@standards/schema 1.0.0-alpha.418 → 1.0.0-alpha.419

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 (36) hide show
  1. package/dist/{all-1pGx58g6.mjs → all-BFZvSwku.mjs} +1 -1
  2. package/dist/{all-C-tG86Pt.d.mts → all-CcI67hiC.d.mts} +1 -1
  3. package/dist/{all-DxVkjo74.d.ts → all-cpt9cxka.d.ts} +1 -1
  4. package/dist/{all-B1SMbpC9.js → all-kYfkyIit.js} +1 -1
  5. package/dist/api/index.d.mts +793 -46
  6. package/dist/api/index.d.ts +793 -46
  7. package/dist/api/index.js +1 -1
  8. package/dist/api/index.mjs +1 -1
  9. package/dist/{exceptions-BQiNZXm5.d.mts → exceptions-C3d0YoMy.d.mts} +8 -0
  10. package/dist/{exceptions-g7YWWqxM.d.ts → exceptions-DzEpWPJ7.d.ts} +8 -0
  11. package/dist/exceptions.d.mts +1 -1
  12. package/dist/exceptions.d.ts +1 -1
  13. package/dist/exceptions.js +1 -1
  14. package/dist/exceptions.mjs +1 -1
  15. package/dist/{index-B_nj48YC.d.mts → index-D59FeAd4.d.mts} +358 -71
  16. package/dist/{index-DsmLdvid.d.ts → index-DhzoMOYA.d.ts} +358 -71
  17. package/dist/index.d.mts +5 -5
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.js +2 -2
  20. package/dist/index.mjs +2 -2
  21. package/dist/{primitives-CXio5R1q.mjs → primitives-B-h9MEQ4.mjs} +1 -1
  22. package/dist/{primitives-B4ZEOP32.js → primitives-CvuPz5hX.js} +1 -1
  23. package/dist/record-operation-BYjGrZ1R.js +2 -0
  24. package/dist/record-operation-q6w-3EDJ.mjs +2 -0
  25. package/dist/{utils-Cb1wqWLJ.d.mts → utils-Bl7NhRVP.d.mts} +1 -1
  26. package/dist/{utils-zJGDp1O7.d.ts → utils-YUFgn36U.d.ts} +1 -1
  27. package/dist/utils.d.mts +1 -1
  28. package/dist/utils.d.ts +1 -1
  29. package/dist/validation/all.d.mts +1 -1
  30. package/dist/validation/all.d.ts +1 -1
  31. package/dist/validation/all.js +1 -1
  32. package/dist/validation/all.mjs +1 -1
  33. package/openapi.json +24996 -0
  34. package/package.json +4 -2
  35. package/dist/record-operation-Ce5oJe9K.js +0 -2
  36. package/dist/record-operation-DszVqr_i.mjs +0 -2
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- import{NonJsonValueError as e,asTenantId as t,asUserId as n,canonicalStringify as r,deepEqual as i,generateId as a,indexBy as o,sameStableValue as s,serializeCanonicalJson as c,serializeStableJson as l}from"./utils-DKrBP9EH.mjs";import{ACTIONABLE_DECISION_KINDS as u,AGGREGATE_BUCKETS as d,AGGREGATE_MEASURES as f,ATTRIBUTE_NAME_SCHEMA as p,DECISION_INBOX_STATES as m,DECISION_KINDS as ee,DECISION_LINE_MAX_LENGTH as te,DECISION_LINK_TARGET_TYPES as ne,DECISION_LIST_STATES as re,DECISION_READ_STATES as ie,DECISION_SETTINGS_AREAS as ae,DECISION_TITLE_MAX_LENGTH as oe,DECISION_TRANSFERS_KEY as se,DECISION_TYPES_V1 as ce,DECISION_TYPE_ACCESS_GRANTED as le,DECISION_TYPE_AGENT_APPROVAL as ue,DECISION_TYPE_AGENT_MESSAGE as de,DECISION_TYPE_AGENT_QUESTION as fe,DECISION_TYPE_AGENT_REVIEW as pe,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as me,DECISION_TYPE_AGENT_SETUP as he,DECISION_TYPE_BUNDLE_SETUP as ge,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as _e,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as ve,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as ye,DECISION_TYPE_KINDS as h,DECISION_TYPE_PERSON as be,DECISION_TYPE_RECORD_ASSIGNED as xe,DECISION_TYPE_RECORD_MENTIONED as Se,DECISION_WORK_STATES as Ce,HIERARCHY_ATTRIBUTE_IDS as we,HIERARCHY_ATTRIBUTE_NAMES as Te,HIERARCHY_CHILD_IDS_LIMIT as Ee,LIST_VIEW_TAB_VISIBILITIES as De,MAX_AGGREGATE_GROUPS as Oe,NATIVE_OBJECT_NAMES as ke,OBJECT_NAME_SCHEMA as Ae,RECORD_LIST_SCOPES as je,RESERVED_ATTRIBUTE_NAMES as Me,RESERVED_OBJECT_NAMES as Ne,RESOURCE_VISIBILITIES as Pe,SCHEMA_LIMITS as g,SYSTEM_ATTRIBUTES as Fe,SYSTEM_ATTRIBUTE_I18N_KEYS as Ie,SYSTEM_FIELD_NAMES as Le,assertUniqueBy as Re,colorIdSchema as ze,decisionThreadKey as Be,decisionTransferBy as Ve,decisionTransfersOf as He,formatDecisionLink as Ue,getHierarchyAttributes as We,getObjectSystemAttributes as Ge,getSystemAttributeI18nKey as Ke,getSystemAttributeList as qe,iconNameSchema as _,isActionableDecisionKind as Je,isHierarchyAttribute as Ye,isManagedSystemAttribute as Xe,isNativeObjectName as v,isPlainRecord as Ze,parseDecisionLink as Qe,parseRecordListScope as $e,parseResourceVisibility as et,validateAttributeName as tt,validateIconName as nt,validateLabel as rt,validateObjectName as it,validateOptions as at,validateViewName as ot}from"./primitives-CXio5R1q.mjs";import{AGENDA_BLOCK as y,ARTIFACT_PREVIEW_EXTENSION as st,ATTRIBUTE_FILTER_OPERATORS as ct,ATTRIBUTE_TYPES as lt,ATTRIBUTE_TYPE_DESCRIPTORS as ut,BLOCK_CONTEXTS as dt,BLOCK_PERIODS as ft,BLOCK_WIDTHS as b,CARD_BLOCK as pt,CHART_BLOCK as mt,CHART_KINDS as ht,COMPUTED_RETURN_TYPES as gt,CONTENT_PLACEMENT_CONTEXTS as _t,DECISIONS_BLOCK as vt,DEFAULT_LAYOUT_TRAITS as yt,DEFAULT_VALIDATION_MESSAGES as bt,GROUPABLE_ATTRIBUTE_TYPES as xt,HEADING_BLOCK as St,INVENTORY_LIMIT as Ct,LOCATION_FILTER_PROPERTIES as wt,MAILBOX_BLOCK as Tt,MEASURABLE_ATTRIBUTE_TYPES as Et,MEETINGS_UPCOMING_BLOCK as Dt,METRIC_BLOCK as Ot,NATIVE_BLOCKS as kt,NO_VALUE_OPERATORS as At,OPERATORS_BY_TYPE as jt,PAGE_GRID_COLUMNS as Mt,QUALIFIED_SEPARATOR as Nt,QUERY_OBJECT as Pt,RECORD_LINKS_BLOCK as Ft,RECORD_LINKS_CONTENT as x,RECORD_OBJECT as It,RELATION_TARGET_ANY as Lt,REMOVED_OPERATOR_REPLACEMENTS as Rt,RecordQuery as zt,SIMPLE_PROPERTY_TYPES as Bt,SYNONYM_ALIASES as Vt,SYSTEM_FILTER_ATTRIBUTE_TYPES as Ht,TEXT_BLOCK as S,TEXT_FORMAT_PATTERNS as Ut,WIRE_OFFERED_BASE_CONFIG as Wt,WIRE_OMITTED_CONFIG_KEYS as Gt,attributeConfigSchemas as Kt,attributeFilterTarget as qt,attributeInventory as Jt,blockObjectInputs as Yt,buildQualifiedAttribute as Xt,canonicalizeFilterValue as Zt,capped as Qt,collectContentViewCatalogue as $t,collectQualifiedRuleIssues as en,collectionContentSourceSchema as tn,collectionSourceAddress as nn,collectionSourceAddressOf as rn,columnsSchema as an,contentExtensionRegistry as C,contentReadObjects as on,contentViewDefinitionSchema as w,contentViewDefinitionSchemaFor as sn,createAttributeValidator as cn,createFormAttributeValidator as ln,createObjectValidator as un,currentActor as dn,datePrecisionIssues as fn,defineBlock as pn,describeViewIssue as mn,displayAttributesSchema as hn,draftContentViewDefinitionSchema as gn,draftContentViewDefinitionSchemaFor as _n,edgePropertyFilterTarget as vn,extractCurrencyFilterValue as yn,extractFilterValue as bn,filterOperatorsOfType as xn,filterStateSchema as Sn,filterTargetsOf as Cn,findGridViolation as wn,findGroupViolation as Tn,findLayoutRuleViolation as En,findRelationAttribute as Dn,findRowLimitViolation as On,formatPhoneForDisplay as kn,formatZodErrors as An,getAttributeCapabilities as jn,getAttributeConfigSchema as Mn,getAttributeConfigWriteSchema as Nn,getAttributeFilterOperators as Pn,getIso2 as Fn,getOperatorPolarity as In,getRollupFilterOperators as Ln,gridPositionSchema as Rn,groupSizeMessage as zn,groupedMembers as Bn,hasTypeTrait as Vn,hasValueKind as Hn,inferInverseCardinality as Un,input as Wn,invalidViewMessage as Gn,isAttributeFilterable as Kn,isAttributeGroupable as qn,isAttributeKanbanGroupable as Jn,isAttributeSearchable as Yn,isAttributeSortable as Xn,isBilateralRelation as Zn,isBoardGrouping as Qn,isCalendarDay as $n,isCollectionContent as er,isDynamicValue as tr,isEmptyValue as nr,isLocationFilterProperty as rr,isLocationPartOperator as ir,isNoValueOperator as ar,isNullishOrEmptyString as or,isRelativeDateValue as sr,isSetMembershipOperator as cr,isUniversalRelation as lr,isValueKindType as T,isValuePresent as ur,layoutTraitsOf as dr,locationPartFilterTarget as fr,memberlessGroups as E,metricComparePeriod as pr,normalizeCountrylessPhoneNumber as mr,normalizeFilterRule as hr,normalizeForEdgeRpc as gr,normalizeOperator as _r,normalizePhoneNumber as vr,now as yr,overlaps as br,pageTraitsOf as xr,parseAttributeConfig as Sr,parseAttributeConfigForCreate as Cr,parseAttributeConfigForUpdate as wr,parseBlockParameters as D,parseQualifiedAttribute as Tr,propertyAttributeSchema as Er,propertyAttributeWireSchema as Dr,propertySchemaSchema as Or,propertySchemaWireSchema as kr,publishedViewContentDefinitionSchema as O,query as Ar,recordQueryDefinitionSchema as jr,refuseForeignKeys as Mr,rejectUnknownAttributesOrThrow as Nr,relationAcceptsObject as Pr,relationTargetsOf as Fr,requireContentPlacement as Ir,requireRecordContentContext as Lr,requireSingleRelationTarget as Rr,resolveCollectionActions as zr,resolveContentNavigation as Br,resolveEffectiveFilterType as Vr,resolveIsWithinBounds as Hr,resolveTextPattern as Ur,resolveUtcDayBounds as Wr,selectOptionWriteSchema as Gr,singleRelationTarget as Kr,sortsSchema as qr,sourcedAttributeOf as Jr,statusGroupSchema as Yr,statusOptionWriteSchema as Xr,systemColumnFilterTarget as Zr,toMultiValueOperator as Qr,toUtcDayString as $r,today as ei,validateAttribute as ti,validateContentViewCatalogue as ni,validateDraft as ri,validateDraftOrThrow as ii,validateObject as ai,validateObjectOrThrow as oi,validateQualifiedRule as si,validateStoredViews as ci,wireHiddenTypeConfigMask as li,wireOmittedConfigKeysFor as ui,withoutUnknownOptionKeys as di}from"./all-1pGx58g6.mjs";import"./zod-locale.mjs";import{AccessDeniedError as fi,AggregateValidationError as pi,AmbiguousSchemaChangeError as mi,AttributeInUseError as hi,AttributeNotFoundError as gi,ConcurrentModificationError as _i,DuplicateError as k,ExportTooLargeError as vi,ForbiddenError as yi,InvalidPermissionGrantError as bi,LogoProviderUnavailableError as xi,LogoSearchRateLimitedError as Si,MemoryNotFoundError as Ci,NotFoundError as wi,NotImplementedError as Ti,ObjectNotFoundError as Ei,ObjectReferencedError as Di,OrphanSystemAttributeError as Oi,PageReferencedError as ki,ProtectedResourceError as Ai,ProtectedRoleError as ji,QueryTimeoutError as Mi,RealtimeDeliveryError as Ni,RealtimeRateLimitedError as Pi,RealtimeSubscriptionError as Fi,RecordNotFoundError as Ii,RecordReferencedError as Li,RepositoryError as Ri,ReservedObjectNameError as A,RoleNotFoundError as zi,SchemaError as j,SchemaErrorCode as M,SearchBackendError as Bi,SearchPathNotIndexedError as Vi,StorageError as Hi,SyncCascadeError as Ui,SyncConflictError as Wi,SyncError as Gi,SystemEntityImmutableError as Ki,ToolGroupGrantError as qi,ValidationError as N,WorkspaceInvariantReason as Ji,isAttributeInUseError as Yi,isNotFoundError as Xi,isObjectReferencedError as Zi,isProtectedResourceError as Qi,isRecordReferencedError as $i,isSchemaError as ea,isValidationError as ta}from"./exceptions.mjs";import{ACCESS_LEVELS as na,ACCESS_ROLES as ra,AGENT_ASIDE_ANSWER_MAX_LENGTH as ia,AGENT_ASIDE_HISTORY_LIMIT as aa,AGENT_ASIDE_QUESTION_MAX_LENGTH as oa,AGENT_AVATAR_EXPRESSIONS as sa,AGENT_AVATAR_TYPES as ca,AGENT_MESSAGE_KIND as la,AGENT_MESSAGE_SENDER_NAME_KEY as ua,AGENT_NOTIFICATION_KIND as da,AGENT_SESSION_ACCESS_ROLES as fa,AGENT_SESSION_LIST_ORDERS as pa,AGENT_SESSION_ORIGINS as ma,AGENT_SESSION_PROVENANCES as ha,AGENT_STARTERS_MAX as ga,AGENT_STARTER_MAX_LENGTH as _a,AGENT_SYSTEM_PROMPT_MAX_LENGTH as va,AGENT_TASK_KINDS as ya,AGENT_WAKE_KIND as ba,ALL_CATALOG_TOOL_NAMES as xa,ALWAYS_KINDS as Sa,APPROVAL_FAMILY_TOOL_NAMES as Ca,ARCHITECT_PUBLICATION_KIND as wa,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Ta,ASK_QUESTIONS_ANSWER_MAX_VALUES as Ea,ASK_QUESTIONS_MAX_BATCH as Da,ASK_QUESTIONS_TOOL_NAME as Oa,AUDIT_ACTIONS as ka,AUDIT_AGENT_SESSION_METADATA_KEY as Aa,AUDIT_RESOURCE_TYPES as ja,AgentBuilder as P,BROWSER_LAUNCH_TOOL_NAME as Ma,BROWSER_TOOL_NAMES as Na,BUNDLE_LOCALES as Pa,BUNDLE_SETUP_PROMPT_MAX_LENGTH as Fa,CONNECTION_GRANT_PROVIDERS as Ia,CONTINUATION_KEY_PATTERN as La,CONVERSATION_SURFACES as Ra,COPY_VERB_NAME as za,CORE_RECORD_TOOL_NAMES as Ba,CORE_TOOL_NAMES as Va,COUNT_MODES as Ha,DEFAULT_AGENT_EXECUTION_CONFIG as Ua,DEFAULT_AGENT_TOOL_GROUPS as Wa,DEFAULT_APPROVAL_POLICY as Ga,DEFAULT_BLUEPRINT_TOOL_GROUPS as Ka,DEFAULT_DAILY_ACTIVITY_DAYS as qa,DEFAULT_MEETING_BOT_DISPLAY_NAME as Ja,DEFAULT_TENANT_SETTINGS as Ya,DEVICE_ACCESS_ROLES as Xa,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as Za,DOCUMENT_SORT_MODES as Qa,DRAFT_WRITE_TOOL_NAMES as $a,EMAIL_CATEGORY_DEFAULT_COLOR as eo,EMAIL_CATEGORY_DEFAULT_ICON as to,EMAIL_CATEGORY_DESCRIPTION_MAX as no,EMAIL_CATEGORY_DESCRIPTION_MIN as ro,EMAIL_CATEGORY_LIMIT as io,EMAIL_CATEGORY_NAME_MAX as ao,ENVIRONMENT_BUILD_LOG_STEPS as oo,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as so,ENVIRONMENT_HARNESSES as co,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as lo,ENVIRONMENT_HARNESS_WORKDIR as uo,ENVIRONMENT_IMAGES as fo,ENVIRONMENT_MEMORY_GB_PER_VCPU as po,ENVIRONMENT_NAME_MAX_CHARS as mo,ENVIRONMENT_NETWORK_ALLOW_MAX as ho,ENVIRONMENT_SCRIPT_MAX_BYTES as go,ENVIRONMENT_SIZES as _o,ENVIRONMENT_SIZE_VCPUS as vo,ENVIRONMENT_STANDARDS_WORKDIR as yo,ENV_VAR_KEY_PATTERN as bo,ESTIMATED_COUNT_CAP as xo,FILE_URLS_MAX_IDS as So,GET_ARCHITECT_DRAFT_TOOL_NAME as Co,GITHUB_TRIGGER_CATALOG as wo,GRANT_ENABLES as To,HITL_TOOL_NAMES as Eo,INFERENCE_REASONING_OPTIONS as Do,INFERENCE_ROUTING_MODES as Oo,INFERENCE_SPEEDS as ko,LAST_RUN_ERROR_MAX_LENGTH as Ao,MAILBOX_LIST_MODES as jo,MAIL_DRAFT_BODY_MAX_CHARS as Mo,MAIL_SIGNATURE_MAX_CHARS as No,MAIL_SUBJECT_MAX_CHARS as Po,MAX_DAILY_ACTIVITY_DAYS as Fo,MAX_TODOS as Io,MAX_TODO_DESCRIPTION_CHARS as Lo,MAX_TODO_ID_CHARS as Ro,MCP_SERVER_NAME_MAX_LENGTH as zo,MEETING_BOT_IMAGE as Bo,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as Vo,MEETING_BOT_NO_CREDITS as Ho,MEETING_BOT_SILENT_REASON as Uo,MEETING_RESPONSES as Wo,MEMORY_SPEND_LIMIT_PATTERN as Go,McpOAuthCompletionMode as Ko,NATIVE_TOOL_GROUPS as qo,NATIVE_TOOL_GROUP_CATALOG as Jo,NO_RECORDING as Yo,OPEN_TOOL_PART_STATES as Xo,OPERATION_MAX_STEPS as Zo,PROVIDER_DRAFT_LABEL as Qo,PROVIDER_NAMES as $o,PUBLIC_MAIL_DOMAINS as es,QUESTION_FAMILY_TOOL_NAMES as ts,RECENT_ACTIVITY_LEDGER_LIMIT as ns,RECIPIENT_IDENTITIES_MAX as rs,RECORDING_OVERRIDES as is,RECORDING_POLICIES as as,RECORD_ACCESS_ROLES as os,RECORD_ACCESS_SOURCES as ss,RECORD_DRIVE_CURSOR_MAX_LENGTH as cs,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as ls,RECORD_DRIVE_PAGE_MAX_LIMIT as us,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as ds,RECORD_GRAPH_MAX_LIMIT_PER_NODE as fs,RECORD_GRAPH_MAX_NODES as ps,RECORD_IMAGE_MAX_BYTES as ms,REPLY_MODES as hs,REQUEST_DESIGN_REVIEW_TOOL_NAME as gs,REQUEST_SETUP_TOOL_NAME as _s,RESOURCE_GRANT_KINDS as vs,RESOURCE_KIND_CATALOG as ys,ROUTING_PRICE_CEILINGS as bs,SEND_VERB_NAME as xs,SESSION_INFERENCE_PATCH_KEYS as Ss,SLACK_TRIGGER_CATALOG as Cs,SPEAKS_THROUGH_SEND_METADATA_KEY as ws,SURFACE_TOOL_NAMES as Ts,SYSTEM_EMAIL_CATEGORIES as Es,SYSTEM_EMAIL_CATEGORY_NAMES as Ds,SYSTEM_PART_CODES as Os,TASK_DEMAND_LEVELS as ks,TODO_PHASES as As,TODO_PLAN_STATUSES as js,TODO_STATUSES as Ms,TOOL_APPROVAL_STATES as Ns,TOOL_IMPACT_COUNT_KEYS as Ps,TRIAGE_ACTIONS as Fs,TRIGGER_EVENT_TYPES as Is,TURN_OUTCOMES as Ls,UNSHAREABLE_OBJECT_NAMES as Rs,USERS_RESOLVE_MAX_IDS as zs,USER_STATUSES as Bs,USER_WORK_POSTURES as Vs,VERB_NAMES as Hs,WAKE_TURN_METADATA_KEY as Us,WAKE_TURN_SPOKE_METADATA_KEY as Ws,agent as Gs,agentAvatarFromMetadata as Ks,agentAvatarSchema as qs,agentDataChunk as Js,agentDisplayName as Ys,agentInferencePreferencesSchema as Xs,agentMessageAttachmentSchema as Zs,agentMessagePartSchema as Qs,agentScheduleSchema as $s,agentSessionInferenceOverridesInputSchema as ec,agentSessionInferenceOverridesSchema as tc,agentSessionMessageSchema as nc,agentStartersSchema as rc,agentTriggerBaseSchema as ic,agentTriggerPatchSchema as ac,agentTriggerSchema as oc,agentUIValidationError as sc,artifactQuoteSchema as cc,askQuestionsOutputSchema as lc,assertCustomAgentUIMessageChunk as uc,assertSessionState as dc,canonicalToolGroups as fc,classificationRestoreSchema as pc,classifyEmailSchema as mc,cliDefaultModelOf as hc,compareAgentSessionMessages as gc,compiledHarnessModels as _c,connectionGrantKindsOf as vc,connectorTriggerMatchSchema as yc,customDataChunkSchemas as bc,decodeAgentSessionListCursor as xc,deriveViewerAccess as Sc,durableDateSchema as Cc,emailCategoryCreateSchema as wc,emailCategoryDeleteSchema as Tc,emailCategoryScopeQuerySchema as Ec,emailCategoryUpdateSchema as Dc,emailRuleScopeSchema as Oc,encodeAgentSessionListCursor as kc,environmentHarness as Ac,environmentWorkdir as jc,findEnvironmentHarness as Mc,githubConditionSchema as Nc,githubTriggerMatchSchema as Pc,grantKindOf as Fc,harnessModelChoices as Ic,humanRequestId as Lc,humanRequestKind as Rc,imageModelIdSchema as zc,inferenceReasoningSchema as Bc,inferenceRoutingSchema as Vc,inferenceSpeedSchema as Hc,isAgentMessageMetadata as Uc,isAgentNotificationMetadata as Wc,isAgentUIDataName as Gc,isAgentWakeMetadata as Kc,isAgentWrittenAuditEntry as qc,isArchitectPublicationMetadata as Jc,isAwaitingHuman as Yc,isBlocking as Xc,isEnvironmentBuildLogStep as Zc,isEnvironmentHarnessId as Qc,isMailProvider as $c,isMailboxListMode as el,isNativeToolGroup as tl,isOpenToolPartState as nl,isParkedOnHuman as rl,isProviderDraft as il,isPublicMailDomain as al,isQuestionPart as ol,isReplyMode as sl,isResourceGrant as cl,isRoutineActorMetadata as ll,isSessionInferencePatch as ul,isSystemEmailCategory as dl,isSystemEmailCategoryName as fl,isSystemPartCode as pl,isToolApprovalState as ml,isToolImpactCountKey as hl,lockingSendCall as gl,meetingBotDispatchRequestSchema as _l,meetingBotDispatchResponseSchema as vl,meetingBotNotificationSchema as yl,meetingTranscriptSegmentSchema as bl,mentionReferenceSchema as xl,mergeSessionInferencePatch as Sl,modelDefinitionSchema as Cl,modelReferenceSchema as wl,needsManageWhenUnattended as Tl,normalizedMeetingTranscriptSchema as El,openRequests as Dl,orderAgentSessionMessages as Ol,parseAgentDefinitionAccessRole as kl,parseAgentSessionAccessRole as Al,parseCountMode as jl,parseDeviceAccessRole as Ml,parseMergedAgentTrigger as Nl,parseOptionalCountMode as Pl,parsePageAccessRole as Fl,parseRecordAccessRole as Il,parseToolGroupGrant as Ll,providerNameSchema as Rl,readArchitectPublication as zl,readAskQuestionsResult as Bl,recentActivityEntryKey as Vl,recordGraphNodeKey as Hl,recordGraphRequestSchema as Ul,recordMeetingsCount as Wl,recordOperationSchema as Gl,refineTrigger as Kl,resourceGrant as ql,routedMessageInferenceSchema as Jl,sessionInferencePatchSchema as Yl,slackConditionSchema as Xl,slackTriggerMatchSchema as Zl,todoItemSchema as Ql,todoPlanSchema as $l,toolImpactSchema as eu,utf8ByteLength as tu}from"./record-operation-DszVqr_i.mjs";import*as F from"zod";import{colorIdFromString as nu,getCountryByIso2 as ru,isValidCurrencyCode as iu,isValidIso3 as au}from"@standards/constants";import{parsePhoneNumberFromString as ou}from"libphonenumber-js";const su=`__stndrdsNativeUiPartIds`,cu=1;function invalidNativePartIds(){throw new N(`Native agent UI part IDs metadata is invalid`,[])}function isPlainRecord$1(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function nativeAgentUIPartIdMetadataKey(e,t){if(e.type===`text`||e.type===`reasoning`)return`${e.type}:${t}`;if(e.type===`tool`)return`tool:${e.toolCallId}`}function parseNativeAgentUIPartIdsMetadata(e){let t=e.metadata?.[su];isPlainRecord$1(t)||invalidNativePartIds(),Object.keys(t).length===2&&t.schemaVersion===1&&isPlainRecord$1(t.partIds)||invalidNativePartIds();let n=/* @__PURE__ */ new Map;for(let[t,r]of e.parts.entries()){let e=nativeAgentUIPartIdMetadataKey(r,t);!e||n.has(e)?e&&invalidNativePartIds():n.set(e,r)}let r=Object.entries(t.partIds);r.length!==n.size&&invalidNativePartIds();let i=/* @__PURE__ */ new Map,a={};for(let[e,t]of r){let r=n.get(e);r&&typeof t==`string`&&t.length>0||invalidNativePartIds();let o=i.get(t);o&&(r.type===`tool`||o!==r.type)&&invalidNativePartIds(),r.type===`tool`&&t!==r.toolCallId&&invalidNativePartIds(),i.set(t,r.type),a[e]=t}return a}const lu=`/v1/device-worker/channel`,uu=262144,du=1e4,fu=2e3,pu=2e3,mu=2e4,hu=4008,gu={initialMs:1e3,maxMs:3e4};function deviceChannelUrl(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}${lu}`}function computeRetryDelay(e,t,n){return Math.min(n.initialMs*2**e,n.maxMs)+Math.floor(t()*250)}function computeReconnectDelay(e,t=Math.random){return computeRetryDelay(e,t,gu)}const _u=[`worker_disconnected`,`cancelled`,`timed_out`,`execution_failed`];var DeviceChannelProtocolError=class extends j{constructor(e){super(e,M.DEVICE_CHANNEL_PROTOCOL),this._tag=`DeviceChannelProtocolError`,this.name=`DeviceChannelProtocolError`}};const vu=[`zsh`,`bash`,`sh`,`fish`,`pwsh`,`powershell`],yu=[`ready`,`permission_missing`,`no_session`,`unavailable`],bu=F.strictObject({state:F.enum(yu),version:F.string().min(1)}),I={id:F.uuid(),leaseToken:F.string().min(1)},xu=F.discriminatedUnion(`type`,[F.strictObject({type:F.literal(`authenticate`),credential:F.string().regex(/^Device \S+$/),protocol:F.number().int().positive().optional(),desktop:bu.optional(),shell:F.enum(vu).optional()}),F.strictObject({type:F.literal(`running`),...I}),F.strictObject({type:F.literal(`heartbeat`),...I}),F.strictObject({type:F.literal(`output`),...I,stdout:F.string().optional(),stderr:F.string().optional()}),F.strictObject({type:F.literal(`complete`),...I,result:F.strictObject({stdout:F.string().optional(),stderr:F.string().optional(),exitCode:F.number().int(),success:F.boolean(),errorCode:F.enum(_u).optional()}),background:F.strictObject({pid:F.number().int(),logPath:F.string().min(1)}).optional()}),F.strictObject({type:F.literal(`pong`)})]),Su=F.discriminatedUnion(`type`,[F.strictObject({type:F.literal(`ready`),device:F.strictObject({id:F.string(),name:F.string(),capability:F.enum([`shell`,`browser`])}),protocol:F.number().int().positive().optional()}),F.strictObject({type:F.literal(`command`),...I,kind:F.enum([`shell`,`browser`]),intent:F.string(),timeoutMs:F.number().int(),command:F.string().optional(),cwd:F.string().nullable().optional(),rootSessionId:F.string().min(1).optional(),background:F.boolean().optional()}),F.strictObject({type:F.literal(`release_session`),rootSessionId:F.string().min(1)}),F.strictObject({type:F.literal(`cancel`),id:F.uuid(),reason:F.enum([`cancelled`,`timed_out`,`revoked`])}),F.strictObject({type:F.literal(`reauthenticate`)}),F.strictObject({type:F.literal(`revoked`)}),F.strictObject({type:F.literal(`ping`)})]);function parseDeviceChannelFrame(e,t){let n;try{n=JSON.parse(t)}catch{throw new DeviceChannelProtocolError(`Frame is not JSON`)}let r=e.safeParse(n);if(!r.success)throw new DeviceChannelProtocolError(`Frame does not match the channel protocol`);return r.data}function parseWorkerFrame(e){return parseDeviceChannelFrame(xu,e)}function parseServerFrame(e){return parseDeviceChannelFrame(Su,e)}const Cu=5;function isFormDefinition(e){return typeof e==`object`&&!!e&&`slots`in e&&`steps`in e&&`name`in e&&typeof e.name==`string`&&Array.isArray(e.slots)&&Array.isArray(e.steps)}const L=[`relation`,`multiRelation`,`formula`,`rollup`,`document`,`richtext`,`user`];function isFormSlotFieldRef(e){return e.type===`slot`}function isFormFreeFieldRef(e){return e.type===`free`}function resolveFieldRequired(e){return e.readOnly===!0?!1:e.fieldRequired===void 0?e.slotMode===`create`&&e.attributeRequired===!0:e.fieldRequired}function getSlotFieldTargets(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}function formFieldKey(e){return isFormSlotFieldRef(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}function formFieldFlatKey(e){return isFormSlotFieldRef(e)?e.attribute:e.attribute.name}function readFormFieldValue(e,t){return e[formFieldKey(t)]??e[formFieldFlatKey(t)]}function isFormFieldsRow(e){return e.type===`fields`}function isFormHeadingRow(e){return e.type===`heading`}function isFormSeparatorRow(e){return e.type===`separator`}function isFormTextRow(e){return e.type===`text`}function moveWidensAudience(e){return e.added.length>0||!e.workspaceBefore&&e.workspaceAfter}function resolvePropertyDefinitions(e){let t=e.properties;if(!t)return[];if(Array.isArray(t))return t;let n=t;return Array.isArray(n.definitions)?n.definitions:[]}function hasOptions(e){return T(e.type,`options`)}function schemaGroupKey(e){return`${e.kind}:${e.name}`}function refuse$3(e){throw new N(e,[{path:[`label`],message:e}])}function parseSchemaGroupPresentation(e){let t=e??{},n={};if(t.label!==void 0){let e=t.label;if(e===null)n.label=null;else if(typeof e!=`string`)refuse$3(`Label must be a string`);else{let t=e.trim();t.length===0&&refuse$3(`Label must not be empty`),t.length>g.labelLength&&refuse$3(`Label is too long (max ${g.labelLength} characters)`),n.label=t}}return n}const R=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!R.test(e))throw new N(`Invalid schema owner "${e}"`,[]);return e}const wu=16e3,Tu=3200,Eu=6400,Du=16e3,Ou=65536,ku=15e3,Au=1e4,ju=5e3,Mu=`google/gemini-3.5-transcribe-live`,Nu={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2},Pu=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],Fu=[`ephemeral`,`conversation`,`persistent`],Iu=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};const Lu=6048e5,Ru=36e5,zu=2592e6,Bu=6e4,Vu=[`square`,`landscape`,`portrait`];function imageModelFormatDefect(e){if(e.formats.length===0)return`declares no output format`;for(let t of e.formats)if(e.requests[t]===void 0)return`declares the format "${t}" without a request`;for(let t of Object.keys(e.requests))if(!e.formats.includes(t))return`carries a request for the undeclared format "${t}"`}function declaredImageRequests(e){let t={};for(let n of e.formats){let r=e.requests[n];r!==void 0&&(t[n]=r)}return t}const Hu=[`storage.bytes`,`members.seats`,`data.live_records`,`email.mailboxes`,`calendar.connections`],Uu=/* @__PURE__ */ new Set([`data.live_records`,`email.mailboxes`,`calendar.connections`]);function computeByteMagnitude(e){if(e<=0)return{value:0,unitIndex:0};let t=1e3,n=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return{value:Number.parseFloat((e/t**n).toFixed(1)),unitIndex:n}}const Wu=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${Wu[n]}`}const Gu=Object.freeze([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`,`multiselect`,`location`]);function buildPropertySchema(e){let t=[];for(let n of e){let e=n.build();if(!Gu.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const Ku=[`UPPER`,`LOWER`,`capitalize`,`trim`],qu=[`prefix`,`suffix`,`wrap`,`default`],z=[...Ku,...qu],Ju=/^\s*where\s*(?::(.*))?$/s,Yu=`[A-Za-z_][A-Za-z0-9_]*`,Xu=/^[^\s,()|{}="']+$/,Zu=RegExp(`^(${Yu})\\s*=\\s*(.*)$`),Qu=RegExp(`^(${Yu})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return Ju.test(e)}function parseWherePipe(e){let t=e.match(Ju)?.[1]?.trim();if(!t)return null;let n=t.match(Qu);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>Xu.test(e))?{property:n[1],values:e}:null}let r=t.match(Zu);return r&&Xu.test(r[2])?{property:r[1],values:[r[2]]}:null}const B=F.string().min(1,`labelExpression cannot be empty`).refine(e=>isLabelExpression(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,n;for(;(n=t.exec(e))!==null;){let e=n[1];if(!z.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${z.join(`, `)}`});function validateLabelExpression(e){let t=B.safeParse(e);return t.success?{success:!0,attributes:extractAttributeNames(e)}:{success:!1,error:t.error.issues[0]?.message??`Invalid labelExpression`}}function applyPipe(e,t){let{name:n,args:r}=parsePipeExpression(t);switch(n){case`UPPER`:return e.toUpperCase();case`LOWER`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|\s)\S/g,e=>e.toUpperCase());case`trim`:return e.trim();case`prefix`:return e?`${r[0]??``}${e}`:``;case`suffix`:return e?`${e}${r[0]??``}`:``;case`wrap`:return e?`${r[0]??``}${e}${r[1]??``}`:``;case`default`:return e||r[0]||``;default:return e}}function applyPipes(e,t){let n=e;for(let e of t)n=applyPipe(n,e);return n}function getValue(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}const $u=`(Untitled)`;function parsePipeExpression(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return{name:e,args:[]};let n=t[1],r=t[2];if(!r)return{name:n,args:[]};let i=[],a=/["']([^"']*?)["']/g,o;for(;(o=a.exec(r))!==null;)i.push(o[1]);return{name:n,args:i}}function*templateBlocks(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return;let r=e.indexOf(`}`,n+2);if(r<0)return;if(e[r+1]!==`}`){t=r+1;continue}t=r+2;let i=e.slice(n+2,r);i.length>0&&(yield{start:n,end:t,expr:i})}}function resolveLabelBlock(e,t){let n=e.split(`||`).map(e=>e.trim()),r=n[n.length-1].split(`|`).map(e=>e.trim());n[n.length-1]=r[0];let i=r.slice(1).filter(Boolean),a=n.filter(Boolean),o=``;for(let e of a){let n=toText(getValue(t,e));if(n!==``){o=n;break}}return applyPipes(o,i)}function renderLabelExpression(e,t,n=$u){let r=[],i=0;for(let n of templateBlocks(e))r.push(e.slice(i,n.start),resolveLabelBlock(n.expr,t)),i=n.end;return r.push(e.slice(i)),r.join(``).trim()||n}function toText(e){if(e==null||typeof e==`function`)return``;if(typeof e!=`object`)return String(e);if(Array.isArray(e))return e.map(toText).filter(Boolean).join(`,`);let t=e.toString;return typeof t==`function`&&t!==Object.prototype.toString?String(e):``}function isLabelExpression(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return!1;let r=e.indexOf(`}}`,n+2);if(r<0)return!1;if(e.slice(n+2,r).trim().length>0)return!0;t=r+2}return!1}function extractAttributePaths(e){let t=[];for(let n of templateBlocks(e)){let e=n.expr.trim();if(!e)continue;let r=e.split(`||`).map(e=>e.trim()),i=r[r.length-1];r[r.length-1]=i.split(`|`)[0].trim();for(let e of r)e&&!t.includes(e)&&t.push(e)}return t}function extractAttributeNames(e){let t=extractAttributePaths(e).map(e=>e.split(`.`)[0]).filter(e=>e.length>0);return[...new Set(t)]}const ed=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(ed);return t?t[1]:null}function getEditableLabelAttribute(e,t){let n=getSingleAttributeFromExpression(e);if(n===null)return null;let r=t.find(e=>e.name===n);return!r||r.type!==`text`||jn(r).authoring.readOnly?null:r}const td=[{id:`data`,capabilities:[{id:`forms`,resources:[`forms`],levels:[{id:`fill`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]},{id:`manage`,add:[`manage`]}]},{id:`emails`,resources:[`emails`],levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]}]}]},{id:`structure`,capabilities:[{id:`schema`,resources:[`architect`],levels:[{id:`use`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]}]},{id:`pages`,resources:[`pages`],levels:[{id:`read`,add:[`read`]},{id:`create`,add:[`create`,`update`,`delete`]}]}]},{id:`ai`,capabilities:[{id:`agents`,resources:[`agents`],levels:[{id:`chat`,add:[`read`]},{id:`create`,add:[`create`]},{id:`build`,add:[`update`,`delete`]},{id:`manage`,add:[`manage`]}]},{id:`environments`,resources:[`environments`],levels:[{id:`use`,add:[`read`]},{id:`create`,add:[`create`]}]},{id:`browser-profiles`,resources:[`browser-profiles`],levels:[{id:`use`,add:[`create`]}]},{id:`private-secrets`,resources:[`private-secrets`],levels:[{id:`use`,add:[`create`]}]},{id:`routine-audiences`,resources:[`routine-audiences`],levels:[{id:`use`,add:[`create`]}]},{id:`supervision`,resources:[`supervision`],levels:[{id:`use`,add:[`create`]}]}]},{id:`files`,capabilities:[{id:`files`,resources:[`files`,`documents`],levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]}]},{id:`team`,capabilities:[{id:`people`,resources:[`people`],levels:[{id:`view`,add:[`read`]},{id:`invite`,add:[`create`]},{id:`manage`,add:[`update`,`delete`]}]}]},{id:`integrations`,capabilities:[{id:`connectors`,resources:[`connectors`],levels:[{id:`use`,add:[`read`,`create`,`update`,`delete`]}]},{id:`api-keys`,resources:[`api-keys`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]},{id:`env-vars`,resources:[`env-vars`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]},{id:`devices`,resources:[`devices`],levels:[{id:`manage`,add:[`manage`]}]}]},{id:`administration`,capabilities:[{id:`settings`,resources:[`settings`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`update`,`delete`,`manage`]}]},{id:`audit`,resources:[`audit`],levels:[{id:`view`,add:[`read`]}]},{id:`billing`,resources:[`billing`],levels:[{id:`view`,add:[`read`]}]}]}],V=`none`,nd=`custom`,H={actions:[`read`,`create`,`update`,`delete`],purge:`manage`,levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]},U=td.flatMap(e=>e.capabilities),rd=U.flatMap(e=>e.resources),id=new Map(U.flatMap(e=>e.resources.map(t=>[t,e])));function isCatalogResource(e){return id.has(e)}function capabilityForResource(e){let t=id.get(e);if(!t)throw new j(`Unknown catalog resource "${e}"`,M.INVARIANT_VIOLATION);return t}function sameActions(e,t){let n=new Set(e),r=new Set(t);return n.size===r.size&&[...n].every(e=>r.has(e))}function levelActions(e,t){let n=/* @__PURE__ */ new Set;for(let r of e.levels){for(let e of r.add)n.add(e);if(r.id===t)return[...n]}return[]}function levelFloor(e,t){let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=V;for(let t of e.levels){if(!t.add.every(e=>r.has(e)))break;i=t.id}return i}function levelOf(e,t){if(t.length===0)return V;let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=/* @__PURE__ */ new Set;for(let t of e.levels){for(let e of t.add)i.add(e);if(i.size===r.size&&[...r].every(e=>i.has(e)))return t.id}return nd}const ad=[`read`,`create`,`update`,`delete`,`manage`],od=F.object({scope:F.enum([`object`,`system`]),target:F.string().min(1),actions:F.array(F.enum(ad))}).strict();function findGrantIssues(e,t){let n=[],r=/* @__PURE__ */ new Map;for(let i of e){let e=od.safeParse(i);if(!e.success){let e=typeof i==`object`&&i&&`target`in i?String(i.target):`?`;n.push({target:e,reason:`shape`});continue}let a=e.data;if(a.scope===`system`){if(!isCatalogResource(a.target)){n.push({target:a.target,reason:`unknown-resource`});continue}if(levelOf(capabilityForResource(a.target),a.actions)===`custom`){n.push({target:a.target,reason:`off-level`});continue}r.set(a.target,a.actions);continue}if(a.target!==`*`&&!t.objectNames.has(a.target)){n.push({target:a.target,reason:`unknown-object`});continue}let o=a.target===`*`?[...H.actions,H.purge]:H.actions;a.actions.every(e=>o.includes(e))||n.push({target:a.target,reason:`object-action`})}let i=/* @__PURE__ */ new Set;for(let[e,t]of r){let a=capabilityForResource(e);if(!i.has(a)){for(let o of a.resources)if(!sameActions(t,r.get(o)??[])){n.push({target:e,reason:`split-capability`}),i.add(a);break}}}return n}const sd=`memory`,cd=4e3,ld=`workspace`,W={name:`name`,description:`description`,content:`content`,profileOf:`profileOf`,profileActor:`profileActor`,subjects:`subjects`,subjectId:`subjectId`};function textValue(e){return typeof e==`string`?e:``}function memoryPageViewOf(e){let{values:t}=e;return{id:e.id,name:textValue(t[W.name]),description:textValue(t[W.description]),content:textValue(t[W.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const ud={meetingHour:`0.80`,computeVcpuHour:`0.20`,browserHour:`0.60`},dd=[`meeting.recording`,`sandbox.agent`,`sandbox.harness`,`sandbox.build`,`browser.session`];function isMeteredChargeKind(e){return dd.includes(e)}const fd=/^\d+(?:\.\d+)?$/u;function meteredUsd(e,t){if(!fd.test(e))throw new N(`Invalid metered rate "${e}"`,[]);if(!(t>=0&&t<=2**53-1))throw new N(`Invalid metered duration "${t}"`,[]);let[n=`0`,r=``]=e.split(`.`),i=BigInt(n+r)*BigInt(t.toFixed(12).replace(`.`,``)),a=10n**BigInt(r.length+12-4),o=(i+a-1n)/a,s=10n**BigInt(4),c=(o%s).toString().padStart(4,`0`).replace(/0+$/u,``);return c?`${o/s}.${c}`:`${o/s}`}const pd=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:pd,validate:t=>{let n=e.safeParse(t);return n.success?{value:n.data}:{issues:n.error.issues.map(e=>({message:e.message,path:e.path}))}}}}function isStandardSchema(e){return typeof e==`object`&&!!e&&`~standard`in e&&typeof e[`~standard`]==`object`&&e[`~standard`].version===1}function asMutableArray(e){return e}var BaseAttributeBuilder=class{get"~standard"(){return createStandardSchemaProps(cn(this.build()))}constructor(e,t,n){tt(t),rt(n),this.attr={name:t,label:n,type:e,required:!1,system:!0}}asPhantomState(){return this}required(){return this.attr.required=!0,this.asPhantomState()}optional(){return this.attr.required=!1,this.asPhantomState()}runtime(){return this.attr.system=!1,this}hidden(){return this.attr.hidden=!0,this}placeholder(e){return this.attr.placeholder=e,this}description(e){return this.attr.description=e,this}icon(e){return nt(e,`attribute "${this.attr.name}"`),this.attr.icon=e,this}order(e){return this.attr.order=e,this}defaultValue(e){return(`defaultValue`in this.attr||!T(String(this.attr.type),`computed`))&&(this.attr.defaultValue=e),this}metadata(e){return this.attr.metadata=e,this}build(){return this.attr}},TextAttributeBuilder=class extends BaseAttributeBuilder{minLength(e){return this.attr.minLength=e,this}maxLength(e){return this.attr.maxLength=e,this}pattern(e){return this.attr.pattern=e,this.attr.format=void 0,this}multiline(e=!0){return this.attr.multiline=e,this}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}};function text(e,t){return new TextAttributeBuilder(`text`,e,t)}var RichtextAttributeBuilder=class extends BaseAttributeBuilder{};function richtext(e,t){return new RichtextAttributeBuilder(`richtext`,e,t)}var NumberAttributeBuilder=class extends BaseAttributeBuilder{min(e){return this.attr.min=e,this}max(e){return this.attr.max=e,this}integer(){return this.attr.unit=`integer`,this.attr.decimals=0,this}decimal(e=2){return this.attr.unit=`decimal`,this.attr.decimals=e,this}percentage(){return this.attr.unit=`percentage`,this}renderAs(e){return this.attr.renderAs=e,this}};function number(e,t){return new NumberAttributeBuilder(`number`,e,t)}var CheckboxAttributeBuilder=class extends BaseAttributeBuilder{};function checkbox(e,t){return new CheckboxAttributeBuilder(`checkbox`,e,t)}var DateAttributeBuilder=class extends BaseAttributeBuilder{format(e){return this.attr.dateFormat=e,this}precision(e){return this.attr.precision=e,this}build(){let[e]=fn(`date`,this.attr);if(e!==void 0)throw new N(e.message,[{path:[`precision`],message:e.message}]);return super.build()}minDate(e){return this.attr.minDate=e,this}maxDate(e){return this.attr.maxDate=e,this}endDate(){return this.attr.endDate=!0,this.asPhantomState()}includeTime(){return this.attr.includeTime=!0,this}timeFormat(e){return this.attr.timeFormat=e,this}};function date(e,t){return new DateAttributeBuilder(`date`,e,t)}var PhoneAttributeBuilder=class extends BaseAttributeBuilder{defaultCountry(e){return this.attr.defaultCountryCode=e,this}};function phone(e,t){return new PhoneAttributeBuilder(`phone`,e,t)}var CurrencyAttributeBuilder=class extends BaseAttributeBuilder{defaultCurrency(e){return this.attr.defaultCurrency=e,this}allowedCurrencies(e){return this.attr.allowedCurrencies=e,this}allowNegative(e=!0){return this.attr.allowNegative=e,this}};function currency(e,t){return new CurrencyAttributeBuilder(`currency`,e,t)}function setOptions(e,t){let n=asMutableArray(t);at(e.name??`unknown`,n),e.options=n}function addOption(e,t){e.options||=[],at(e.name??`unknown`,[...e.options,t]),e.options.push(t)}var StatusAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}};function status(e,t){return new StatusAttributeBuilder(`status`,e,t)}var SelectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function select(e,t){return new SelectAttributeBuilder(`select`,e,t)}var MultiselectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function multiselect(e,t){return new MultiselectAttributeBuilder(`multiselect`,e,t)}var LocationAttributeBuilder=class extends BaseAttributeBuilder{granularity(e){return this.attr.granularity=e,this}defaultCountry(e){return this.attr.defaultCountry=e,this}allowedCountries(e){return this.attr.allowedCountries=e,this}};function location(e,t){return new LocationAttributeBuilder(`location`,e,t)}var UserAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`user`,e,t),this.attr.types=[`user`,`agent`]}types(e){let t=[...new Set(e)];if(t.length===0)throw Error(`[AttributeBuilder] user.types must contain at least one type.`);return this.attr.types=t,this}multiple(){return this.attr.multiple=!0,this}notifiesOnAssign(){return this.attr.notifiesOnAssign=!0,this}actors(){return this.attr.actors=!0,this}};function user(e,t){return new UserAttributeBuilder(e,t)}var BaseRelationAttributeBuilder=class extends BaseAttributeBuilder{to(e,t){let n={object:e,...t};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:`*`}],this}qualifyWith(...e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.qualifyWith() must be called AFTER .to(). Example: relation("companies", "Companies").to("companies").qualifyWith(...)`);return this.attr.properties=buildPropertySchema(e),this}bilateral(e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.bilateral() must be called AFTER .to(). Example: relation("company", "Company").to("companies").bilateral({ ... })`);if(t.length>1)throw Error(`Bilateral relations are not supported for polymorphic relations (multiple .to() targets).`);if(lr(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new N(`Bilateral relation requires one target object`,[{path:[`bilateral`,`object`],message:`Bilateral relation requires one target object`}]);if(e.object&&e.object!==n){let t=`Bilateral inverse object ${e.object} must match relation target ${n}`;throw new N(t,[{path:[`bilateral`,`object`],message:t}])}return this.attr.bilateral={...e,object:n},this}},SingleRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t){super(`relation`,e,t),this.attr.cardinality=`one`,this.attr.targets=[]}many(){let e=new MultiRelationAttributeBuilder(this.attr.name,this.attr.label??``,{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===!1&&e.runtime(),this.attr.hidden&&e.hidden(),this.attr.placeholder&&e.placeholder(this.attr.placeholder),this.attr.description&&e.description(this.attr.description),this.attr.icon&&e.icon(this.attr.icon),this.attr.order!==void 0&&e.order(this.attr.order),this.attr.metadata&&e.metadata(this.attr.metadata),e}},MultiRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t,n){super(`relation`,e,t),this.attr.cardinality=`many`,this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&(this.attr.required=!0)}maxItems(e){return this.attr.maxItems=e,this}};function relation(e,t){return new SingleRelationAttributeBuilder(e,t)}var FormulaAttributeBuilder=class extends BaseAttributeBuilder{expression(e){return this.attr.expression=e,this}returns(e){return this.attr.returnType=e,this}decimals(e){return this.attr.decimals=e,this}currency(e){return this.attr.currencyCode=e,this}required(){throw Error(`Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}};function formula(e,t){return new FormulaAttributeBuilder(`formula`,e,t)}var RollupAttributeBuilder=class extends BaseAttributeBuilder{from(e){return this.attr.relationAttribute=e,this}aggregate(e){return this.attr.targetAttribute=e,this}using(e){return this.attr.function=e,this}decimals(e){return this.attr.decimals=e,this}path(e){return this.attr.relationPath=e,this}targetType(e){return this.attr.targetAttributeType=e,this}targetOptions(e){return this.attr.targetAttributeOptions=asMutableArray(e),this}targetCurrency(e){return this.attr.targetCurrencyCode=e,this}build(){let e=this.attr.function,t=this.attr.targetAttributeType;if(e===`original`&&t!==void 0&&t!==`select`&&t!==`status`&&t!==`multiselect`){let e=this.attr.relationAttribute??`relation`,n=this.attr.targetAttribute??`field`;throw new j(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${t}") was given. To surface a plain ${t} value from a related record, use a formula instead — e.g. formula("${this.attr.name}", "…").expression("${e}.${n}").`,M.VALIDATION_FAILED)}return super.build()}required(){throw Error(`Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}};function rollup(e,t){return new RollupAttributeBuilder(`rollup`,e,t)}var DocumentAttributeBuilder=class extends BaseAttributeBuilder{accepts(e){return this.attr.accepts=e,this}maxFileSize(e){return this.attr.maxFileSize=e,this}qualifyWith(...e){return this.attr.properties=buildPropertySchema(e),this}};function document(e,t){return new DocumentAttributeBuilder(`document`,e,t)}const G={owner:`standardshq`,repo:`skills`,ref:`stable`},K=`[A-Za-z0-9._-]+`,md=`[A-Za-z0-9_-]+`,hd=RegExp(`^(${md})/(${K})@([a-z0-9-]+)(?:#(${K}))?$`),gd=RegExp(`^(${md})/(${K})$`),_d=/^[0-9a-f]{40}$/i;function isSafeSegment(e){return e!==`.`&&!e.startsWith(`-`)&&!e.includes(`..`)}function refuse$2(e,t){throw new N(`Invalid skill source "${e}": ${t} (expected owner/repo@skill or owner/repo@skill#ref)`,[{path:[`source`],message:t}])}function canonicalRef(e){return _d.test(e)?e.toLowerCase():e}function parseSkillSource(e){let t=e.trim(),n=t.startsWith(`github.com/`)?t.slice(11):t,r=hd.exec(n);if(!r)return refuse$2(e,`malformed or not a github.com source`);let[,i,a,o,s]=r;return[i,a,s??``].every(isSafeSegment)?{host:`github.com`,owner:i,repo:a,skill:o,ref:s===void 0?null:canonicalRef(s)}:refuse$2(e,"a segment cannot start with `-`, hold `..` or be `.`")}function isSkillRepository(e){return gd.exec(e)?.slice(1).every(isSafeSegment)??!1}function formatSkillSource(e){let t=`${e.owner}/${e.repo}@${e.skill}`;return e.ref===null?t:`${t}#${e.ref}`}function isPinnedSkillSource(e){return e.ref!==null&&_d.test(e.ref)}const q=/^[a-z0-9][a-z0-9-]{0,62}$/,J=`core`;function assertBundleName(e){if(!q.test(e))throw new N(`Invalid bundle name "${e}": expected a lowercase slug matching ${q}`,[]);if(e===`core`)throw new N(`Bundle name "${J}" is reserved`,[])}async function sha256Hex(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function nameSlug(e,t){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).slice(0,t).replace(/^_+|_+$/g,``)}function cloneBuilderValue(e,t){try{return structuredClone(e)}catch{let e=`Builder configuration must contain cloneable data`;throw new N(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new N(`Name must not be blank`,[{path:t,message:`Name must not be blank`}])}function validateContentConfiguration(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new N(`Invalid content configuration`,[{path:t,message:`Expected content configuration`}]);for(let n of[`name`,`label`,`placement`])if(Object.hasOwn(e,n)){let e=`Independent content configuration cannot define ${n}`;throw new N(e,[{path:[...t,n],message:e}])}let n=O.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw N.fromZodErrors(n.error.issues.map(e=>({path:[...t,...e.path.map(String)],message:e.message})));n.data.type===`form`&&n.data.groups.forEach((e,n)=>requireBuilderName(e.name,[...t,`groups`,String(n),`name`]));let{name:r,label:i,placement:a,...o}=n.data;return cloneBuilderValue(o,t)}function validateLiteralContent(e,t){return validateContentConfiguration(e,t),cloneBuilderValue(e,t)}function positionOf(e){return{x:e.x,y:e.y,w:e.w,h:e.h}}function bottomOf(e){return e.y+e.h}function collides(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function firstCollision(e,t){return t.find(t=>collides(e,t))}function inReadingOrder$1(e){return[...e].sort((e,t)=>e.y-t.y||e.x-t.x)}function snapWidth(e,t,n){let r=12-t,i=b.filter(e=>e>=n&&e<=r);return i.length===0?b.find(e=>e>=n)??n:i.reduce((t,n)=>{let r=Math.abs(n-e),i=Math.abs(t-e);return r<i||r===i&&n>t?n:t})}function sharesColumns(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w}function risenRow(e,t){return t.reduce((t,n)=>n.y<e.y&&sharesColumns(e,n)?Math.max(t,bottomOf(n)):t,0)}function packLayout(e,t){let n=e.map(e=>{let n=t?.get(e.i);return n===void 0?e:{...e,h:n}}),r=n.filter(e=>e.static===!0),i=new Map(r.map(e=>[e.i,e]));for(let e of inReadingOrder$1(n.filter(e=>e.static!==!0))){let t=risenRow(e,r),n=firstCollision({...e,y:t},r);for(;n!==void 0;)t=bottomOf(n),n=firstCollision({...e,y:t},r);let a={...e,y:t};r.push(a),i.set(e.i,a)}return n.map(e=>i.get(e.i)??e)}function settleLayout(e,t){let n=e.filter(e=>e.static===!0),r=e.filter(e=>e.static!==!0),i=/* @__PURE__ */ new Map;for(let e of[...inReadingOrder$1(r.filter(e=>t.has(e.i))),...inReadingOrder$1(r.filter(e=>!t.has(e.i)))]){let t=e,r=firstCollision(t,n);for(;r!==void 0;)t={...t,y:bottomOf(r)},r=firstCollision(t,n);n.push(t),i.set(e.i,t)}return packLayout(e.map(e=>i.get(e.i)??e))}function pageCompactor(){return{type:`vertical`,allowOverlap:!1,preventCollision:!1,compact:e=>packLayout(e).map(e=>({...e,moved:!1}))}}function clampHeight(e,t){let n=t.minHeight??1,r=t.maxHeight??1/0;return Math.max(1,n,Math.min(r,e))}function widthStepConstraint(e){return{name:`width-steps`,constrainSize:(t,n,r)=>{let i=e(t.i),a=snapWidth(n,t.x,i.minWidth);return i.height===`fit`?{w:a,h:t.h}:i.height===`flexible`?{w:a,h:clampHeight(r,i)}:{w:a,h:Math.max(1,r)}}}}function snapCell(e,t){let n=Math.max(0,Math.min(e.x,11)),r=snapWidth(e.w,n,t(e.i).minWidth);return{...e,x:Math.min(n,12-r),y:Math.max(0,e.y),w:r,h:Math.max(1,e.h)}}function samePosition(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}function pushApart(e){let t=e.filter(e=>e.static===!0),n=/* @__PURE__ */ new Map;for(let r of inReadingOrder$1(e.filter(e=>e.static!==!0))){let e=r,i=firstCollision(e,t);for(;i!==void 0;){let n={...e,x:i.x+i.w};e=n.x+n.w<=12&&firstCollision(n,t)===void 0?n:{...e,y:bottomOf(i)},i=firstCollision(e,t)}t.push(e),n.set(r.i,e)}return e.map(e=>n.get(e.i)??e)}function isValidStatic(e){return[e.x,e.y,e.w,e.h].every(Number.isInteger)&&e.x>=0&&e.y>=0&&e.h>=1&&b.includes(e.w)&&e.x+e.w<=12}function keptStatics(e){let t=[],n=/* @__PURE__ */ new Set;for(let r of inReadingOrder$1(e.filter(e=>e.static===!0)))isValidStatic(r)&&firstCollision(r,t)===void 0?t.push(r):n.add(r.i);return e.map(e=>n.has(e.i)?{...e,static:!1}:e)}function boundedHeight(e,t){let n=t(e.i);if(e.static===!0||n.height!==`flexible`)return e;let r=clampHeight(e.h,n);return r===e.h?e:{...e,h:r}}function repairPageGrid(e,t){let n=[],r=keptStatics(e).map(e=>{let r=boundedHeight(e,t);return r!==e&&n.push({name:e.i,kind:`height`,from:positionOf(e),to:positionOf(r)}),r}).map(e=>{if(e.static===!0)return e;let r=snapCell(e,t);return samePosition(e,r)||n.push({name:e.i,kind:`width`,from:positionOf(e),to:positionOf(r)}),r}),i=pushApart(r);i.forEach((e,t)=>{let i=r[t];i!==void 0&&!samePosition(i,e)&&n.push({name:e.i,kind:`pushed`,from:positionOf(i),to:positionOf(e)})});let a=packLayout(i),o=keptFill(a,t);for(let e of inReadingOrder$1(a))e.i!==o&&t(e.i).height===`fill`&&n.push({name:e.i,kind:`fill`});return{cells:a,repairs:n}}function keptFill(e,t){return inReadingOrder$1(e).find(e=>e.static!==!0&&t(e.i).height===`fill`)?.i}function firstFreeSlot(e,t,n){let r=t.reduce((e,t)=>Math.max(e,bottomOf(t)),0);for(let i=n;i<=r;i+=1)for(let n=0;n+e.w<=6;n+=1)if(firstCollision({x:n,y:i,...e},t)===void 0)return{x:n,y:i};return{x:0,y:r}}function deriveLayout6(e,t){let n=[];for(let r of inReadingOrder$1(e)){let e=Math.min(6,Math.max(t(r.i).minWidth,Math.ceil(r.w/2))),i=n.at(-1)?.y??0;n.push({i:r.i,...firstFreeSlot({w:e,h:r.h},n,i),w:e,h:r.h})}return n}function figureSlot(e,t,n){for(let r of inReadingOrder$1(e.filter(e=>n.has(e.i)))){let n={x:r.x+r.w,y:r.y,...t};if(n.x+n.w<=12&&firstCollision(n,e)===void 0)return n}}function placeNew(e,t,n,r){let i={w:snapWidth(n.size.w,0,n.minWidth),h:Math.max(1,n.size.h)};return n.figure?{i:t,...figureSlot(e,i,r)??{x:0,y:0,...i}}:{i:t,x:0,y:e.reduce((e,t)=>Math.max(e,bottomOf(t)),0),...i}}function spanContent(e,t){if(!b.includes(t)){let e=`A block spans ${b.join(`, `)} columns, not ${String(t)}`;throw new N(e,[{path:[`content`,`span`],message:e}])}return{content:e,span:t}}function configureContent(e,t){try{return typeof e==`object`&&e&&`build`in e&&typeof e.build==`function`?{configuration:validateContentConfiguration(e.build(),t),extension:e.extension}:{configuration:validateContentConfiguration(e,t)}}catch(e){throw e instanceof N?new N(e.message,e.errors.map(e=>({...e,path:e.path[0]===`content`?[...t,...e.path.slice(1)]:e.path}))):e}}function storedQuery(e,t){let n=[`search`,`offset`].filter(t=>e.state[t]!==void 0);if(n.length>0)throw new N(`A ${t} cannot keep a query's ${n.join(` or `)}`,n.map(e=>({path:[t,e],message:`A ${t} stores no ${e}; use filters and limit instead`})));return e.toDefinition()}function checkInputs(e,t){for(let[n,r]of Object.entries(t)){let t=e.inputs[n];r!==void 0&&t!==void 0&&D({parameters:t.schema},r,[`content`,`parameters`,n])}return t}var BlockContentBuilder=class{constructor(e,t,n){this.extension=e,this.parameters=t,this.heightMode=n}copy(e,t){let n=this.constructor;return new n(this.extension,e,t)}with(e){let t={...this.parameters};for(let[n,r]of Object.entries(e))r===void 0?delete t[n]:t[n]=r;return checkInputs(this.extension,e),this.copy(t,this.heightMode)}height(e){return this.copy(this.parameters,e)}build(){let e={type:`custom`,extension:this.extension.name,parameters:cloneBuilderValue(this.parameters,[`content`,`parameters`]),...this.heightMode===void 0?{}:{height:this.heightMode}};return validateContentConfiguration(e,[`content`]),D(this.extension,e.parameters,[`content`,`parameters`]),e}span(e){return spanContent(this,e)}},Measures=class{count(){return this.measured(`count`)}sum(e){return this.measured(`sum`,e)}avg(e){return this.measured(`avg`,e)}min(e){return this.measured(`min`,e)}max(e){return this.measured(`max`,e)}};function measure(e,t,n){return{query:e,measure:t,...n===void 0?{}:{attribute:n}}}var MetricBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}trend(e,t){return this.with({trend:e,trendBucket:t})}compare(e,t){return this.with({compare:e,period:t})}target(e){return this.with({target:e})}},MetricQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new MetricBuilder(Ot,checkInputs(Ot,measure(this.query,e,t)))}};function groupBy(e){return typeof e==`string`?[e,void 0]:[e.attribute,e.bucket]}var ChartBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}by(e){let[t,n]=groupBy(e);return this.with({by:t,byBucket:n})}by2(e){let[t,n]=groupBy(e);return this.with({by2:t,by2Bucket:n})}kind(e){return this.with({kind:e})}bar(){return this.kind(`bar`)}horizontalBar(){return this.kind(`horizontal_bar`)}line(){return this.kind(`line`)}area(){return this.kind(`area`)}donut(){return this.kind(`donut`)}funnel(){return this.kind(`funnel`)}treemap(){return this.kind(`treemap`)}calendar(){return this.kind(`calendar`)}},ChartQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new ChartBuilder(mt,checkInputs(mt,{...measure(this.query,e,t),kind:`bar`}))}};const vd={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:vd[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new N(e,[{path:[`content`,`parameters`,`next`],message:e}])}return this.with({next:t})}yearly(){return this.with({yearly:!0})}},CardBuilder=class extends BlockContentBuilder{fields(...e){return this.with({fields:e})}record(e){return this.with({record:e})}},DecisionsBuilder=class extends BlockContentBuilder{kinds(...e){return this.with({kinds:e})}limit(e){return this.with({limit:e})}},MeetingsUpcomingBuilder=class extends BlockContentBuilder{limit(e){return this.with({limit:e})}},MailboxBuilder=class extends BlockContentBuilder{category(e){return this.with({category:e})}important(){return this.with({important:!0})}unread(){return this.with({unread:!0})}limit(e){return this.with({limit:e})}label(e){return this.with({label:e})}};function metric(e){return new MetricQuery(storedQuery(e,`metric`))}function chart(e){return new ChartQuery(storedQuery(e,`chart`))}function agenda(e,t){return new AgendaBuilder(y,checkInputs(y,{query:storedQuery(e,`agenda`),attribute:t}))}function card(e){let t=e===void 0||typeof e==`string`?e:e.build().name;return new CardBuilder(pt,t===void 0?{}:checkInputs(pt,{object:t}))}function text$1(e){return new BlockContentBuilder(S,checkInputs(S,{markdown:e}))}function decisions(){return new DecisionsBuilder(vt,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(Dt,{})}function mailbox(){return new MailboxBuilder(Tt,{})}function isSpanned(e){return typeof e==`object`&&!!e&&`span`in e&&`content`in e}function total(e){return e.reduce((e,t)=>e+t,0)}function spread(e){return e.length===0?0:Math.max(...e)-Math.min(...e)}function betterSplit(e,t){let n=total(e)-total(t);if(n!==0)return n>0;let r=spread(t)-spread(e);if(r!==0)return r>0;let i=e.findIndex((e,n)=>e!==t[n]);return i!==-1&&(e[i]??0)>(t[i]??0)}function splitColumns(e,t){let n=[...t];function visit(r,i){let a=t[r.length];if(a===void 0)betterSplit(r,n)&&(n=r);else for(let t of b)t>=a&&i+t<=e&&visit([...r,t],i+t)}return visit([],0),n}function rowWidths(e,t){let n=e.filter(e=>e.span===void 0);n.length>4&&reject(t,`A row holds at most 4 unsized blocks`);let r=total(e.map(e=>e.span??e.minWidth));r>12&&reject(t,`Blocks ${e.map(e=>`"${e.key}"`).join(`, `)} do not fit one row: they need at least ${r} of 12 columns`);let i=splitColumns(12-total(e.map(e=>e.span??0)),n.map(e=>e.minWidth)),a=0;return e.map(e=>{if(e.span!==void 0)return e.span;let t=i[a]??e.minWidth;return a+=1,t})}function reject(e,t){throw new N(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return dr(e,C,new Map(t.map(e=>[e.name,e])))}function headingNames(e){let t=new Set(e.flatMap(e=>e.kind===`heading`?e.meta.name===void 0?[]:[e.meta.name]:[...Object.keys(e.blocks),...e.group?.name===void 0?[]:[e.group.name]]));return e.flatMap(e=>{if(e.kind!==`heading`)return[];if(e.meta.name!==void 0)return[e.meta.name];let n=nameSlug(e.title,40),r=n===``?`heading`:`heading_${n}`,i=r;for(let e=2;t.has(i);e+=1)i=`${r}_${e}`;return t.add(i),[i]})}function headingEntry(e,t,n){let r={title:t,...n.description===void 0?{}:{description:n.description},...n.icon===void 0?{}:{icon:n.icon}};return{key:e,content:new BlockContentBuilder(St,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=zn(e.length);return(i!==void 0||r===void 0)&&reject(n,String(i)),{type:`group`,name:t.name??`group_${r}`,placement:`grid`,...t.label===void 0?{}:{label:t.label},members:e.map(e=>e.name)}}function requirePlacement(e,t,n,r,i){if(e.type===`page`&&reject(i,`Content "${n}" cannot reference a page from a page`),Ir(e,t,n,r,i),e.type!==`custom`)return;let a=t?.refine?.(e.parameters??{},r);a&&reject([...i,`parameters`,a.input],a.message)}var Y=class PageBuilder{constructor(e){this.kind=`view`,this.data=e}icon(e){return new PageBuilder({...this.data,icon:e})}description(e){return new PageBuilder({...this.data,description:e})}home(){return new PageBuilder({...this.data,home:!0})}for(e){let t=typeof e==`string`?e:e.build().name;return new PageBuilder({...this.data,object:t})}row(e,t={}){let n=t.group===void 0?{kind:`row`,blocks:e}:{kind:`row`,blocks:e,group:t.group};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}heading(e,t={}){let n={kind:`heading`,title:e,meta:t};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}build(){let e=[`views`,`0`],{name:t,label:n,object:r,icon:i,description:a,home:o,sections:s}=this.data;requireBuilderName(t,[...e,`name`]),r!==void 0&&requireBuilderName(r,[...e,`object`]),o&&r!==void 0&&reject([...e,`home`],`Only a standalone page can be the home`),s.every(e=>e.kind===`row`&&Object.keys(e.blocks).length===0)&&reject([...e,`contents`],`A page declares at least one block`);let c=r===void 0?`page`:`record`,l=[],u=[],d=headingNames(s),f=0;for(let t of s){let n=[...e,`contents`,String(l.length)],r=(t.kind===`heading`?[headingEntry(d[f++]??``,t.title,t.meta)]:Object.entries(t.blocks).map(([e,t])=>isSpanned(t)?{key:e,content:t.content,span:t.span}:{key:e,content:t,span:void 0})).map(t=>{let n=[...e,`contents`,String(l.length)];requireBuilderName(t.key,[...n,`name`]);let{configuration:r,extension:i}=configureContent(t.content,n);requirePlacement(r,i,t.key,c,n);let a={...r,name:t.key,placement:`grid`};return l.push(a),{content:a,span:t.span}}),i=rowWidths(r.map(({content:e,span:t})=>({key:e.name,...t===void 0?{}:{span:t},minWidth:traitsOf(e).minWidth})),n),a=u.reduce((e,t)=>Math.max(e,t.y+t.h),0);if(t.kind===`row`&&t.group!==void 0){let e=groupOf(r.map(({content:e})=>e),t.group,n);l.push(e),u.push({i:e.name,x:0,y:a,w:12,h:traitsOf(e,l).size.h});continue}let o=0;r.forEach(({content:e},t)=>{let n=i[t]??0;u.push({i:e.name,x:o,y:a,w:n,h:traitsOf(e).size.h}),o+=n})}let p=Object.fromEntries(packLayout(u).map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),m={name:t,label:n,...r===void 0?{}:{object:r},context:`page`,...i===void 0?{}:{icon:i},...a===void 0?{}:{description:a},...o?{home:!0}:{},contents:l,grid:p},ee=w.safeParse(m);if(!ee.success)throw N.fromZodErrors(ee.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return{kind:`view`,definition:cloneBuilderValue(m,e)}}};function page(e,t){return new Y({name:e,label:t,object:void 0,sections:[]})}var X=class ViewBuilder{constructor(e,t=[]){this.kind=`view`,this.data=cloneBuilderValue(e,[`views`,`0`]),this.extensions=t.map(e=>e&&{...e})}for(e){let t=typeof e==`string`?e:e.build().name;return new ViewBuilder({...this.data,object:t},this.extensions)}default(){return new ViewBuilder({...this.data,default:!0},this.extensions)}description(e){return new ViewBuilder({...this.data,description:e},this.extensions)}icon(e){return new ViewBuilder({...this.data,icon:e},this.extensions)}place(e,t,n,r,i){let{configuration:a,extension:o}=configureContent(n,[`views`,`0`,`contents`,String(this.data.contents.length)]),s={...a,name:e,label:t,placement:r},c=[...this.data.contents,s],l=i===void 0?{}:{anchors:{...this.data.anchors,[e]:{after:i}}};return new ViewBuilder({...this.data,...l,contents:c},[...this.extensions,o])}tab(e,t,n,r){return this.place(e,t,n,`main`,r?.after)}aside(e,t,n){return this.place(e,t,n,`aside`)}build(){let e=[`views`,`0`];requireBuilderName(this.data.name,[...e,`name`]),requireBuilderName(this.data.object,[...e,`object`]);let t=w.safeParse(this.data);if(!t.success)throw N.fromZodErrors(t.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return this.data.contents.forEach((t,n)=>{let r=[...e,`contents`,String(n)];requireBuilderName(t.name,[...r,`name`]),t.type===`form`&&t.groups.forEach((e,t)=>requireBuilderName(e.name,[...r,`groups`,String(t),`name`])),Ir(t,this.extensions[n],t.name,this.data.context,r)}),{kind:`view`,definition:cloneBuilderValue(this.data,e)}}};function detailView(e,t){return new X({name:e,label:t,object:void 0,context:`record`,contents:[]})}function listView(e,t){return new X({name:e,label:t,object:void 0,context:`collection`,contents:[]})}function isViewPiece(e){return`kind`in e&&e.kind===`view`}function isObjectPiece(e){return!(isViewPiece(e)||e instanceof P)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new N(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof P||typeof e.build==`function`)return;let n=e.name;throw new N(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof Y||e instanceof X?e.build():e}function isPage(e){return e.definition.context===`page`}function validateView(e){let t=w.safeParse(e);if(t.success)return t.data;let n=typeof e==`object`&&e&&`name`in e?String(e.name):`(unnamed)`,r=N.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new N(`View "${n}" is invalid. ${r.message}`,r.errors)}function identityOf(e){return`${e.object??``}:${e.name}`}function assertUniqueIdentities(e,t){let n=/* @__PURE__ */ new Set;for(let r of t){let t=identityOf(r);if(n.has(t))throw new k(e,r.name);n.add(t)}}function byIdentity(e){return(t,n)=>{let r=identityOf(e(t)),i=identityOf(e(n));return r<i?-1:+(r>i)}}async function hashBundlePieces(e){return sha256Hex(r({objects:[...e.objects].sort(byIdentity(e=>({name:e.name}))),views:[...e.views].sort(byIdentity(e=>e)),pages:[...e.pages].sort(byIdentity(e=>e.definition)),agents:[...e.agents].sort(byIdentity(e=>({name:e.name})))}))}const yd={title:120,why:200,prompt:Fa};function assertSetupWithinLimits(e){let t=Object.keys(yd).flatMap(t=>{let n=yd[t],r=e[t];return r!==void 0&&r.length>n?[{path:[`setup`,t],message:`Setup ${t} must be at most ${n} characters`}]:[]});if(t.length>0)throw new N(`Bundle setup is invalid`,t)}function assertSetup(e,t){e&&assertSetupWithinLimits(e);for(let e of Object.values(t))assertSetupWithinLimits({title:e[`setup.title`],why:e[`setup.why`],prompt:e[`setup.prompt`]})}function assertSkills(e){let t=/* @__PURE__ */ new Set,n=e.flatMap(e=>{let n=skillProblem(e,t);return n===null?[]:[{path:[`skills`],message:n}]});if(n.length>0)throw new N(`Bundle skills are invalid`,n)}function skillProblem(e,t){let n;try{n=parseSkillSource(e)}catch(t){return t instanceof Error?t.message:`Invalid skill source "${e}"`}return n.owner!==G.owner||n.repo!==G.repo?`Skill "${e}" must come from ${G.owner}/${G.repo}`:n.ref===null?t.has(n.skill)?`Skill "${e}" is declared twice`:(t.add(n.skill),null):`Skill "${e}" cannot pin a ref`}async function builtBundleFromPieces(e){let t=e.name===J;t||assertBundleName(e.name);let{objects:n,pages:r,agents:i}=e,a=e.views.map(validateView),o=n.map(e=>e.name);if(assertUniqueIdentities(`object`,o.map(e=>({name:e}))),assertUniqueIdentities(`view`,a),assertUniqueIdentities(`page`,r.map(e=>e.definition)),assertUniqueIdentities(`agent`,i.map(e=>({name:e.name}))),!t){let e=o.find(v);if(e!==void 0)throw new A(e,`bundle`)}let{setup:s}=e,c=e.translations??{};assertSetup(s,c);let l=e.skills??[];return assertSkills(l),{name:e.name,label:e.label.trim(),description:e.description??null,hash:await hashBundlePieces({objects:n,views:a,pages:r,agents:i}),objects:n,views:a,pages:r,agents:i,uses:e.uses??[],samples:e.samples??[],...s?{setup:s}:{},...l.length>0?{skills:l}:{},translations:c}}const bd=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[bd]===!0}var BundleBuilder=class{constructor(e,t){this[bd]=!0,this.pieces=[],this.used=[],this.descriptionText=null,this.sampleRecords=[],this.skillSources=[],this.translationTables={},this.built=null,assertBundleName(e),this.name=e,this.label=t,this.objectBuilders=[]}description(e){return this.descriptionText=e,this.changed()}add(...e){return this.pieces.push(...e),this.objectBuilders.push(...e.filter(isObjectPiece)),this.changed(),this}uses(...e){return this.used.push(...e),this.changed()}samples(e){return this.sampleRecords=e,this.changed()}setup(e){return this.setupInvitation=e,this.changed()}skills(...e){return this.skillSources=[...this.skillSources,...e],this.changed()}translations(e,t){return this.translationTables[e]=t,this.changed()}build(){return this.built??=this.assemble(),this.built}changed(){return this.built=null,this}async assemble(){let e=[],t=[],n=[],r=[];for(let[i,a]of this.pieces.entries())if(assertPiece(a,i),a instanceof P)r.push(a.build());else if(isViewPiece(a)){let e=declarationOf$1(a);isPage(e)?n.push(e):t.push(e.definition)}else e.push(a.build());return this.assertNotInUsed(e),builtBundleFromPieces({name:this.name,label:this.label,description:this.descriptionText,objects:e,views:t,pages:n,agents:r,uses:this.used.map(e=>e.name),samples:this.sampleRecords,...this.setupInvitation?{setup:this.setupInvitation}:{},skills:this.skillSources,translations:{...this.translationTables}})}assertNotInUsed(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set([this]),visit=e=>{if(!n.has(e)){n.add(e);for(let n of e.objectBuilders){let r=n.build().name;t.has(r)||t.set(r,e.name)}for(let t of e.used)visit(t)}};for(let e of this.used)visit(e);for(let{name:n}of e){let e=t.get(n);if(e!==void 0)throw new k(`object`,n,`Object "${n}" is declared by bundle "${this.name}" and by its used bundle "${e}"`)}}};function bundle(e,t){return new BundleBuilder(e,t)}function readOnlyOption(e){return e?.readOnly===void 0?{}:{readOnly:e.readOnly}}function buildFreeFieldRef(e,t){return{type:`free`,attribute:e.build(),label:t?.label,required:t?.required,prefillExpression:t?.prefillExpression,...readOnlyOption(t)}}function buildSlotFieldRef(e,t,n){let[r,...i]=Array.isArray(e)?e:[e];return{type:`slot`,slotId:r,additionalSlotIds:i.length>0?i:void 0,attribute:t,label:n?.label,required:n?.required,tooltip:n?.tooltip,...readOnlyOption(n)}}const xd=F.boolean().optional();var FormRowBuilder=class{constructor(e,t,n){this._finalized=!1,this.stepBuilder=e,this.rowData={id:t,order:n,type:`fields`,fields:[]}}field(e,t,n){return this.rowData.fields.push(buildSlotFieldRef(e,t,n)),this}freeField(e,t){return this.rowData.fields.push(buildFreeFieldRef(e,t)),this}row(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).row(e)}heading(e,t){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).heading(e,t)}separator(){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).separator()}text(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).text(e)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData))}},FormStepBuilder=class{constructor(e,t,n){this.rowOrder=0,this.formBuilder=e,this.stepData={id:t,label:n,rows:[]}}description(e){return this.stepData.description=e,this}field(e,t,n){this.rowOrder++;let r=`row-${this.stepData.id}-${this.rowOrder}`,i=buildSlotFieldRef(e,t,n),a={id:r,order:this.rowOrder,type:`fields`,fields:[i]};return this.stepData.rows.push(a),this}freeField(e,t){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,r=buildFreeFieldRef(e,t),i={id:n,order:this.rowOrder,type:`fields`,fields:[r]};return this.stepData.rows.push(i),this}row(e){return this.rowOrder++,new FormRowBuilder(this,e,this.rowOrder)}heading(e,t){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`heading`,content:e,level:t};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let e={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`separator`};return this.stepData.rows.push(e),this}text(e){this.rowOrder++;let t={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`text`,content:e};return this.stepData.rows.push(t),this}step(e,t){return this.formBuilder._finalizeStep(this.stepData).step(e,t)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(e){return e.fields.length>0&&this.stepData.rows.push(e),this}_getData(){return this.stepData}},FormBuilder=class{constructor(e,t){this.data={slots:[],steps:[],status:`draft`,version:1},this.validateName(e),this.data.name=e,this.data.label=t}description(e){return this.data.description=e,this}icon(e){return this.data.icon=e,this}status(e){return this.data.status=e,this}metadata(e){return this.data.metadata=e,this}slot(e,t,n){if(this.data.slots.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate slot id: "${e}"`);let r={id:e,objectName:t,label:n.label,mode:n.mode??`create`,color:n.color,icon:n.icon};return this.data.slots.push(r),this}step(e,t){if(this.data.steps.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate step id: "${e}"`);return new FormStepBuilder(this,e,t)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.validateReadOnly(),this.data}_finalizeStep(e){return this.data.steps.push(e),this}validateName(e){let t=F.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{t.parse(e)}catch(e){throw e instanceof F.ZodError?Error(`[FormBuilder] ${e.issues[0].message}`):e}}validateRequiredData(){if(this.data.slots.length===0)throw Error(`[FormBuilder] At least one slot is required. Use .slot() to add slots.`);if(this.data.steps.length===0)throw Error(`[FormBuilder] At least one step is required. Use .step() to add steps.`)}validateSlotReferences(){let e=new Map(this.data.slots.map(e=>[e.id,e.objectName]));for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(r.type!==`slot`)continue;let n=getSlotFieldTargets(r);for(let r of n)if(!e.has(r))throw Error(`[FormBuilder] Step "${t.id}" references unknown slot "${r}". Declare it with .slot("${r}", ...) first.`);let i=new Set(n.map(t=>e.get(t)));if(i.size>1)throw Error(`[FormBuilder] Step "${t.id}" field on attribute "${r.attribute}" targets slots of different objects (${[...i].join(`, `)}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let e=[...z,`join`,`where`];for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(!isFormFreeFieldRef(r)||!r.prefillExpression)continue;let n=r.prefillExpression,i=`prefillExpression on free field "${r.attribute.name}" in step "${t.id}"`;if(!isLabelExpression(n))throw Error(`[FormBuilder] ${i} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(n))throw Error(`[FormBuilder] ${i} contains empty {{ }} interpolation.`);for(let a of n.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?:\s*:[^|}]*)?/g)){let n=a[1];if(!e.includes(n))throw Error(`[FormBuilder] ${i} uses invalid pipe "${n}". Valid pipes: ${e.join(`, `)}`);let o=a[0].replace(/^\|/,``);if(isWherePipe(o)&&!parseWherePipe(o))throw new N(`[FormBuilder] ${i} has a malformed where: pipe "${o.trim()}". Write where:property=value or where:property in (a,b).`,[{path:[t.id,r.attribute.name,`prefillExpression`],message:`Malformed where: pipe`}])}}}validateReadOnly(){for(let e of this.data.steps)for(let t of e.rows)if(isFormFieldsRow(t))for(let n of t.fields){if(xd.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new N(`[FormBuilder] readOnly on ${r} "${t}" in step "${e.id}" must be a boolean.`,[{path:[e.id,t,`readOnly`],message:`Expected a boolean`}])}}validateFreeFields(){let e=new Set(L);for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n)){for(let r of n.fields)if(isFormFreeFieldRef(r)){let n=r.attribute.type;if(e.has(n))throw Error(`[FormBuilder] Free field in step "${t.id}" uses forbidden attribute type "${n}". Forbidden types: ${L.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const Sd=`box`,Cd=[`circle`,`square`],wd=[`upload`,`website`,`name`,`email`];function isImageSource(e){return wd.some(t=>t===e)}const Td={object:[`icon`,`color`],record:[`icon`,`image`],emailCategory:[`icon`,`color`],option:[`color`],view:[`icon`],agent:[`color`],user:[`image`]};function imageFileIdOf(e){return`image`in e?e.image?.fileId:`imageFileId`in e?e.imageFileId:void 0}function resolveAppearance(e,t){let n=imageFileIdOf(e);if(n)return{kind:`image`,imageFileId:n,shape:t?.image?.shape??`square`};let r=t?.name??e.name,i=e.color??t?.color??(r?nu(r):void 0),a=e.icon??t?.icon??`box`;return i?{kind:`tile`,icon:a,color:i}:{kind:`glyph`,icon:a}}const Ed=F.object({shape:F.enum(Cd),from:F.array(F.string().refine(e=>e.trim().length>0,`Must not be blank`)).optional()}).strict();function imageLookupKindOf(e){return e.type===`text`?e.format===`url`?`website`:e.format===`email`?`email`:`name`:null}function validateObjectImage(e){let t=e.image?.from;if(t===void 0)return;let refuse=(t,n)=>{throw new N(`Object "${e.name}": ${t}`,[{path:n===void 0?[`image`,`from`]:[`image`,`from`,String(n)],message:t}])};t.length===0&&refuse(`image.from must name at least one attribute`);let n=new Map((e.attributes??[]).map(e=>[e.name,e])),r=/* @__PURE__ */ new Set;for(let[e,i]of t.entries()){r.has(i)&&refuse(`image.from names "${i}" twice`,e),r.add(i);let t=n.get(i);t?imageLookupKindOf(t)===null&&refuse(`image.from names "${i}", a ${t.type} attribute: only text attributes can locate an image`,e):refuse(`image.from names "${i}", which is not one of its attributes`,e)}}function validateObjectExpressions(e){let{name:t,labelExpression:n,embeddingExpression:r}=e;if(!n)throw new j(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,M.VALIDATION_FAILED);let i=B.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new j(`Invalid labelExpression for "${t}": ${e}`,M.VALIDATION_FAILED)}if(r!==void 0){let e=B.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new j(`Invalid embeddingExpression for "${t}": ${n}`,M.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(un(this.build()))}constructor(e,t){this._sealed=!1,this._toleratedAttributes=[],this.validateName(e),this.obj={name:e,label:t,attributes:[],system:!0}}id(e){return this.obj.id=e,this}description(e){return this.obj.description=e,this}pluralLabel(e){return this._pluralLabel=e,this}icon(e){return this.obj.icon=e,this}color(e){return this.obj.color=e,this}image(e={}){return this.obj.image={shape:e.shape??`square`,...e.from===void 0?{}:{from:[...e.from]}},this}runtime(){return this.obj.system=!1,this}sealed(){return this._sealed=!0,this}tolerate(e){return this._toleratedAttributes=[...this._toleratedAttributes,...e],this}attribute(e){return this.pushAttributes([e]),this}attributes(e){return this.pushAttributes(e),this}pushAttributes(e){let t=e.map(e=>`build`in e&&typeof e.build==`function`?e.build():e);Re([...this.obj.attributes,...t],e=>e.name,e=>new k(`attribute`,e,`Object "${this.obj.name}": duplicate attribute name "${e}"`)),this.obj.attributes.push(...t)}metadata(e){return this.obj.metadata={...this.obj.metadata,...e},this}order(e){return this.obj.metadata={...this.obj.metadata,order:e},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:!0},this}labelExpression(e){return this._labelExpression=e,this}embeddingExpression(e){return this._embeddingExpression=e,this}documentLayout(e){if(e.presets)for(let t of e.presets)validatePresetStructure(t.id,t.structure,1);return this.obj.documentLayout=e,this}hierarchical(){return this.obj.hierarchical=!0,this}build(){if(!this.obj.name)throw new N(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new N(`[ObjectBuilder] Missing required field: label`,[{path:[`label`],message:`label is required`}]);return validateObjectExpressions({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression}),validateObjectImage({name:this.obj.name,image:this.obj.image,attributes:this.obj.attributes}),{...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(e){e!==void 0&&it(e)}};function object(e,t){if(v(e))throw new A(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new N(t,[{path:[`documentLayout`,`presets`,e],message:n}])};n>5&&fail(`Preset structure exceeds max depth of 5`,`Preset structure too deep`);let r=/* @__PURE__ */ new Set;for(let i of t){let t=i.title.trim();t.length===0&&fail(`Folder preset node title is required`,`Empty folder title`),t.includes(`/`)&&fail(`Folder preset node title cannot contain /`,`Folder title contains /: "${t}"`),r.has(t)&&fail(`Folder preset sibling titles must be unique`,`Duplicate folder title: "${t}"`),r.add(t),i.children&&i.children.length>0&&validatePresetStructure(e,i.children,n+1)}}function relationProperty(e){return requireBuilderName(e,[`relationProperty`]),{relationProperty:e}}var Z=class ContentBuilder{constructor(e,t){this.data=cloneBuilderValue(e,[`content`]),this.extension=t===void 0?void 0:Object.freeze({name:t.name,contexts:t.contexts,parameters:t.parameters,refine:t.refine})}set(e){return new ContentBuilder({...this.data,...e},this.extension)}icon(e){return this.set({icon:e})}object(e){return this.set({objectName:e})}layout(e){let{layout:t,groupByAttribute:n,columnSizing:r,kanbanColumnOrder:i,kanbanColumnVisibility:a,kanbanPinnedColumns:o,...s}={...this.data,layout:void 0,groupByAttribute:void 0,columnSizing:void 0,kanbanColumnOrder:void 0,kanbanColumnVisibility:void 0,kanbanPinnedColumns:void 0};return new ContentBuilder({...s,...e},this.extension)}table(){return this.layout({layout:`table`})}list(){return this.layout({layout:`list`})}kanban(e){return this.layout({layout:`kanban`,groupByAttribute:e})}columns(...e){return this.set({columns:e})}actions(...e){return this.set({actions:e})}openMode(e){return this.set({openMode:e})}createMode(e){return this.set({createMode:e})}visibility(e){return this.set({visibility:e})}descriptionAttribute(e){return this.set({descriptionAttribute:e})}displayAttributes(...e){return this.set({displayAttributes:e})}columnSizing(e){return this.set({columnSizing:e})}kanbanColumnOrder(...e){return this.set({kanbanColumnOrder:e})}kanbanColumnVisibility(e){return this.set({kanbanColumnVisibility:e})}kanbanPinnedColumns(...e){return this.set({kanbanPinnedColumns:e})}formColumns(e){return this.set({formColumns:e})}density(e){return this.set({density:e})}titleAttribute(e){return this.set({titleAttribute:e})}allowUpload(e){return this.set({allowUpload:e})}allowRemove(e){return this.set({allowRemove:e})}hideAttachments(e){return this.set({hideAttachments:e})}relations(...e){return this.set({relations:e})}span(e){return spanContent(this,e)}height(e){return this.set({height:e})}build(){let e=validateLiteralContent(this.data,[`content`]);return this.extension&&e.type===`custom`&&D(this.extension,e.parameters,[`content`,`parameters`]),e}},Dd=class GroupBuilder{constructor(e,t,n,r={}){this.data=cloneBuilderValue({name:e,label:t,fields:n,...r},[`group`])}field(e,t){let{name:n,label:r,fields:i,...a}=this.data;return new GroupBuilder(n,r,[...i,{attribute:e,...t}],a)}fields(...e){let{name:t,label:n,fields:r,...i}=this.data;return new GroupBuilder(t,n,[...r,...e.map(e=>({attribute:e}))],i)}description(e){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),description:e})}collapsible(e=!1){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),collapsible:!0,collapsed:e})}alwaysOpen(){let{collapsed:e,...t}=this.presentation();return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...t,collapsible:!1})}presentation(){let{name:e,label:t,fields:n,...r}=this.data;return r}build(){requireBuilderName(this.data.name,[`group`,`name`]);try{validateLiteralContent({type:`form`,groups:[this.data]},[`group`])}catch(e){throw e instanceof N?new N(e.message,e.errors.map(e=>({...e,path:e.path[1]===`groups`?[`group`,...e.path.slice(3)]:e.path}))):e}return cloneBuilderValue(this.data,[`group`])}};function group(e,t){return new Dd(e,t,[])}function collection(e){return new Z({type:`collection`,...storedQuery(e,`collection`)})}function form$1(...e){return new Z({type:`form`,groups:e.map(e=>`build`in e?e.build():e)})}function activity(){return new Z({type:`activity`})}function richtext$1(e){return new Z({type:`richtext`,attribute:e})}function documents(){return new Z({type:`documents`})}function forms(){return new Z({type:`forms`})}function emails(...e){return new Z({type:`emails`,emailAttributes:e})}function meetings(...e){return new Z({type:`meetings`,emailAttributes:e})}function custom(e,t){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw new N(`Expected registered extension declaration`,[{path:[`content`,`extension`],message:`Expected registered extension declaration`}]);let n=validateContentConfiguration({type:`custom`,extension:e.name,parameters:t},[`content`]);if(n.type!==`custom`)throw new N(`Expected custom content`,[]);let r=new Z({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[x.name,x.label,custom(Ft,{}).icon(x.icon)]}function page$1(e){let{object:t,name:n}=e.definition;if(typeof t!=`string`){let e=`Page "${n}" is standalone; a record tab renders a record page (\`page(...).for(object)\`)`;throw new N(e,[{path:[`content`,`page`,`object`],message:e}])}return new Z({type:`page`,page:{object:t,name:n}})}const Od={collection,metric,chart,agenda,card,text:text$1,decisions,meetingsUpcoming,mailbox,page:page$1,form:form$1,activity,richtext:richtext$1,documents,forms,emails,meetings,custom};function contentDefinition(e,t){if(t.suppressed)return null;let n=t.workspaceDefinition??t.sourceDefinition;return n===null?null:{...structuredClone(n),name:e}}function storedContentDefinition(e){let{name:t,...n}=e;return structuredClone(n)}function workspaceViewAuthoring(e,t={}){let n={main:0,aside:0};return{origin:`runtime`,mainOrderCustomized:!1,asideOrderCustomized:!1,gridCustomized:Object.keys(t).length>0,homeCustomized:!1,contents:Object.fromEntries(e.map(e=>[e.name,{sourceDefinition:null,workspaceDefinition:storedContentDefinition(e),suppressed:!1,sourcePosition:null,workspacePosition:e.placement===`grid`?null:n[e.placement]++,sourceGrid:null,workspaceGrid:t[e.name]??null}]))}}function byKind(e,t){let rank=e=>Number(e.definition.type===`group`);return rank(e)-rank(t)||e.name.localeCompare(t.name)}function inReadingOrder(e){return(t,n)=>{let r=e(t.name),i=e(n.name);return r===null||i===null?r===i?byKind(t,n):r?-1:1:r.y-i.y||r.x-i.x||byKind(t,n)}}function overLimit(e,t){let n=/* @__PURE__ */ new Set;if(e.length<=g.tabsPerView)return n;let r=new Map(e.map(e=>[e.name,e])),i=/* @__PURE__ */ new Map;for(let{name:t,definition:n}of e)if(n.type===`group`)for(let e of n.members)i.has(e)||i.set(e,t);let cellOf=e=>{let n=r.get(e),a=n?t(n.state):null;if(a!==null)return a;let o=r.get(i.get(e)??``);return o?t(o.state):null},a=e.filter(e=>e.state.sourceDefinition===null).sort(inReadingOrder(cellOf)).reverse();for(let t of a){if(e.length-n.size<=g.tabsPerView)break;if(n.has(t.name))continue;let i=t.definition.type===`group`?t.definition.members.flatMap(e=>{let t=r.get(e);return t&&t.definition.type!==`group`?[t]:[]}):[];if(!i.some(e=>e.state.sourceDefinition!==null))for(let e of[t,...i])n.add(e.name)}return n}function resolvePageGrid(e,t={}){let rawCell=t=>e.gridCustomized||t.sourceDefinition===null?t.workspaceGrid:t.sourceGrid,n=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{name:e,state:t,definition:n}]:[]}),r=E(n.map(e=>e.definition)),i=n.filter(e=>!r.has(e.name)).sort((e,t)=>e.name.localeCompare(t.name)),a=overLimit(i,rawCell),o=i.filter(e=>!a.has(e.name)),s=new Map(o.map(e=>[e.name,e.definition])),c=t.traitsOf??xr(s,C),l=Bn([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>br(t,e))?d[e]={...t}:f.push(e)};if(e.gridCustomized)for(let{name:e,state:t}of u)place(e,t.workspaceGrid);else{for(let{name:e,state:t}of u)t.sourceDefinition!==null&&place(e,t.sourceGrid);for(let{name:e,state:t}of u)t.sourceDefinition===null&&place(e,t.workspaceGrid)}let p=Math.max(0,...Object.values(d).map(e=>e.y+e.h));for(let t of f.sort()){let n=e.contents[t],{w:r,h:i}=n.workspaceGrid??n.sourceGrid??c(t).size;d[t]={x:0,y:p,w:r,h:i},p+=i}let m=repairPageGrid(Object.entries(d).map(([e,n])=>({i:e,...n,...t.statics?.has(e)?{static:!0}:{}})),c);return{grid:Object.fromEntries(m.cells.map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),repairs:[...[...a].map(e=>({name:e,kind:`dropped`})),...m.repairs]}}function droppedContents(e){return new Set(e.flatMap(e=>e.kind===`dropped`?[e.name]:[]))}function resolveViewContents(e){let t=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{definition:n,...t}]:[]}),n=[`main`,`aside`].flatMap(n=>{let r=n===`main`?e.mainOrderCustomized:e.asideOrderCustomized;return t.filter(e=>e.definition.placement===n).sort((e,t)=>{let n=r?e.workspacePosition:e.sourcePosition,i=r?t.workspacePosition:t.sourcePosition;if(n!==null&&i!==null&&n!==i)return n-i;if(n!==null&&i===null)return-1;if(i!==null&&n===null)return 1;let a=e.sourcePosition??e.workspacePosition,o=t.sourcePosition??t.workspacePosition;return a!==null&&o!==null&&a!==o?a-o:a!==null&&o===null?-1:o!==null&&a===null?1:e.definition.name.localeCompare(t.definition.name)}).map(e=>e.definition)}),r=E(t.map(e=>e.definition)),i=t.filter(e=>e.definition.placement===`grid`&&!r.has(e.definition.name)).map(e=>e.definition).sort((e,t)=>e.name.localeCompare(t.name));return[...n,...i]}const kd=[`record`,`document`,`file`,`email`,`thread`,`event`,`memory`,`skill`,`schema`,`user`,`guide`,`bundle`,`draft`,`decision`,`session`,`catalog`,`wake`],Ad=/* @__PURE__ */ new Set([`memory`,`schema`,`wake`]),jd=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function isReferenceKind(e){return kd.includes(e)}function refuse$1(e,t){return{ok:!1,reason:e,expected:t}}function parseReference(e){let t=e.trim();if(jd.test(t))return refuse$1(`bare_uuid`,`record:<id>`);let n=t.indexOf(`:`);if(n===-1)return refuse$1(`malformed`,`<kind>:<id>`);let r=t.slice(0,n).toLowerCase();if(!isReferenceKind(r))return refuse$1(`unknown_kind`,`<kind>:<id> with kind one of ${kd.join(`, `)}`);let i=t.slice(n+1).trim();return i===``?refuse$1(`malformed`,`${r}:<id>`):r===`record`&&i.includes(`:`)?refuse$1(`legacy_mention`,`record:${i.slice(i.lastIndexOf(`:`)+1)}`):i===`*`&&!Ad.has(r)?refuse$1(`malformed`,`${r}:<id>`):{ok:!0,ref:{kind:r,id:i}}}function formatReference(e){return`${e.kind}:${e.id}`}function isWildcard(e){return e.id===`*`&&Ad.has(e.kind)}let Md;function unaccentRules(){if(Md)return Md;let e=/* @__PURE__ */ new Map;for(let t of`
2
+ import{NonJsonValueError as e,asTenantId as t,asUserId as n,canonicalStringify as r,deepEqual as i,generateId as a,indexBy as o,sameStableValue as s,serializeCanonicalJson as c,serializeStableJson as l}from"./utils-DKrBP9EH.mjs";import{ACTIONABLE_DECISION_KINDS as u,AGGREGATE_BUCKETS as d,AGGREGATE_MEASURES as f,ATTRIBUTE_NAME_SCHEMA as p,DECISION_INBOX_STATES as m,DECISION_KINDS as ee,DECISION_LINE_MAX_LENGTH as te,DECISION_LINK_TARGET_TYPES as ne,DECISION_LIST_STATES as re,DECISION_READ_STATES as ie,DECISION_SETTINGS_AREAS as ae,DECISION_TITLE_MAX_LENGTH as oe,DECISION_TRANSFERS_KEY as se,DECISION_TYPES_V1 as ce,DECISION_TYPE_ACCESS_GRANTED as le,DECISION_TYPE_AGENT_APPROVAL as ue,DECISION_TYPE_AGENT_MESSAGE as de,DECISION_TYPE_AGENT_QUESTION as fe,DECISION_TYPE_AGENT_REVIEW as pe,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as me,DECISION_TYPE_AGENT_SETUP as he,DECISION_TYPE_BUNDLE_SETUP as ge,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as _e,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as ve,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as ye,DECISION_TYPE_KINDS as h,DECISION_TYPE_PERSON as be,DECISION_TYPE_RECORD_ASSIGNED as xe,DECISION_TYPE_RECORD_MENTIONED as Se,DECISION_WORK_STATES as Ce,HIERARCHY_ATTRIBUTE_IDS as we,HIERARCHY_ATTRIBUTE_NAMES as Te,HIERARCHY_CHILD_IDS_LIMIT as Ee,LIST_VIEW_TAB_VISIBILITIES as De,MAX_AGGREGATE_GROUPS as Oe,NATIVE_OBJECT_NAMES as ke,OBJECT_NAME_SCHEMA as Ae,RECORD_LIST_SCOPES as je,RESERVED_ATTRIBUTE_NAMES as Me,RESERVED_OBJECT_NAMES as Ne,RESOURCE_VISIBILITIES as Pe,SCHEMA_LIMITS as g,SYSTEM_ATTRIBUTES as Fe,SYSTEM_ATTRIBUTE_I18N_KEYS as Ie,SYSTEM_FIELD_NAMES as Le,assertUniqueBy as Re,colorIdSchema as ze,decisionThreadKey as Be,decisionTransferBy as Ve,decisionTransfersOf as He,formatDecisionLink as Ue,getHierarchyAttributes as We,getObjectSystemAttributes as Ge,getSystemAttributeI18nKey as Ke,getSystemAttributeList as qe,iconNameSchema as _,isActionableDecisionKind as Je,isHierarchyAttribute as Ye,isManagedSystemAttribute as Xe,isNativeObjectName as v,isPlainRecord as Ze,parseDecisionLink as Qe,parseRecordListScope as $e,parseResourceVisibility as et,validateAttributeName as tt,validateIconName as nt,validateLabel as rt,validateObjectName as it,validateOptions as at,validateViewName as ot}from"./primitives-B-h9MEQ4.mjs";import{AGENDA_BLOCK as y,ARTIFACT_PREVIEW_EXTENSION as st,ATTRIBUTE_FILTER_OPERATORS as ct,ATTRIBUTE_TYPES as lt,ATTRIBUTE_TYPE_DESCRIPTORS as ut,BLOCK_CONTEXTS as dt,BLOCK_PERIODS as ft,BLOCK_WIDTHS as b,CARD_BLOCK as pt,CHART_BLOCK as mt,CHART_KINDS as ht,COMPUTED_RETURN_TYPES as gt,CONTENT_PLACEMENT_CONTEXTS as _t,DECISIONS_BLOCK as vt,DEFAULT_LAYOUT_TRAITS as yt,DEFAULT_VALIDATION_MESSAGES as bt,GROUPABLE_ATTRIBUTE_TYPES as xt,HEADING_BLOCK as St,INVENTORY_LIMIT as Ct,LOCATION_FILTER_PROPERTIES as wt,MAILBOX_BLOCK as Tt,MEASURABLE_ATTRIBUTE_TYPES as Et,MEETINGS_UPCOMING_BLOCK as Dt,METRIC_BLOCK as Ot,NATIVE_BLOCKS as kt,NO_VALUE_OPERATORS as At,OPERATORS_BY_TYPE as jt,PAGE_GRID_COLUMNS as Mt,QUALIFIED_SEPARATOR as Nt,QUERY_OBJECT as Pt,RECORD_LINKS_BLOCK as Ft,RECORD_LINKS_CONTENT as x,RECORD_OBJECT as It,RELATION_TARGET_ANY as Lt,REMOVED_OPERATOR_REPLACEMENTS as Rt,RecordQuery as zt,SIMPLE_PROPERTY_TYPES as Bt,SYNONYM_ALIASES as Vt,SYSTEM_FILTER_ATTRIBUTE_TYPES as Ht,TEXT_BLOCK as S,TEXT_FORMAT_PATTERNS as Ut,WIRE_OFFERED_BASE_CONFIG as Wt,WIRE_OMITTED_CONFIG_KEYS as Gt,attributeConfigSchemas as Kt,attributeFilterTarget as qt,attributeInventory as Jt,blockObjectInputs as Yt,buildQualifiedAttribute as Xt,canonicalizeFilterValue as Zt,capped as Qt,collectContentViewCatalogue as $t,collectQualifiedRuleIssues as en,collectionContentSourceSchema as tn,collectionSourceAddress as nn,collectionSourceAddressOf as rn,columnsSchema as an,contentExtensionRegistry as C,contentReadObjects as on,contentViewDefinitionSchema as w,contentViewDefinitionSchemaFor as sn,createAttributeValidator as cn,createFormAttributeValidator as ln,createObjectValidator as un,currentActor as dn,datePrecisionIssues as fn,defineBlock as pn,describeViewIssue as mn,displayAttributesSchema as hn,draftContentViewDefinitionSchema as gn,draftContentViewDefinitionSchemaFor as _n,edgePropertyFilterTarget as vn,extractCurrencyFilterValue as yn,extractFilterValue as bn,filterOperatorsOfType as xn,filterStateSchema as Sn,filterTargetsOf as Cn,findGridViolation as wn,findGroupViolation as Tn,findLayoutRuleViolation as En,findRelationAttribute as Dn,findRowLimitViolation as On,formatPhoneForDisplay as kn,formatZodErrors as An,getAttributeCapabilities as jn,getAttributeConfigSchema as Mn,getAttributeConfigWriteSchema as Nn,getAttributeFilterOperators as Pn,getIso2 as Fn,getOperatorPolarity as In,getRollupFilterOperators as Ln,gridPositionSchema as Rn,groupSizeMessage as zn,groupedMembers as Bn,hasTypeTrait as Vn,hasValueKind as Hn,inferInverseCardinality as Un,input as Wn,invalidViewMessage as Gn,isAttributeFilterable as Kn,isAttributeGroupable as qn,isAttributeKanbanGroupable as Jn,isAttributeSearchable as Yn,isAttributeSortable as Xn,isBilateralRelation as Zn,isBoardGrouping as Qn,isCalendarDay as $n,isCollectionContent as er,isDynamicValue as tr,isEmptyValue as nr,isLocationFilterProperty as rr,isLocationPartOperator as ir,isNoValueOperator as ar,isNullishOrEmptyString as or,isRelativeDateValue as sr,isSetMembershipOperator as cr,isUniversalRelation as lr,isValueKindType as T,isValuePresent as ur,layoutTraitsOf as dr,locationPartFilterTarget as fr,memberlessGroups as E,metricComparePeriod as pr,normalizeCountrylessPhoneNumber as mr,normalizeFilterRule as hr,normalizeForEdgeRpc as gr,normalizeOperator as _r,normalizePhoneNumber as vr,now as yr,overlaps as br,pageTraitsOf as xr,parseAttributeConfig as Sr,parseAttributeConfigForCreate as Cr,parseAttributeConfigForUpdate as wr,parseBlockParameters as D,parseQualifiedAttribute as Tr,propertyAttributeSchema as Er,propertyAttributeWireSchema as Dr,propertySchemaSchema as Or,propertySchemaWireSchema as kr,publishedViewContentDefinitionSchema as O,query as Ar,recordQueryDefinitionSchema as jr,refuseForeignKeys as Mr,rejectUnknownAttributesOrThrow as Nr,relationAcceptsObject as Pr,relationTargetsOf as Fr,requireContentPlacement as Ir,requireRecordContentContext as Lr,requireSingleRelationTarget as Rr,resolveCollectionActions as zr,resolveContentNavigation as Br,resolveEffectiveFilterType as Vr,resolveIsWithinBounds as Hr,resolveTextPattern as Ur,resolveUtcDayBounds as Wr,selectOptionWriteSchema as Gr,singleRelationTarget as Kr,sortsSchema as qr,sourcedAttributeOf as Jr,statusGroupSchema as Yr,statusOptionWriteSchema as Xr,systemColumnFilterTarget as Zr,toMultiValueOperator as Qr,toUtcDayString as $r,today as ei,validateAttribute as ti,validateContentViewCatalogue as ni,validateDraft as ri,validateDraftOrThrow as ii,validateObject as ai,validateObjectOrThrow as oi,validateQualifiedRule as si,validateStoredViews as ci,wireHiddenTypeConfigMask as li,wireOmittedConfigKeysFor as ui,withoutUnknownOptionKeys as di}from"./all-BFZvSwku.mjs";import"./zod-locale.mjs";import{AccessDeniedError as fi,AggregateValidationError as pi,AmbiguousSchemaChangeError as mi,AttributeInUseError as hi,AttributeNotFoundError as gi,ConcurrentModificationError as _i,DuplicateError as k,ExportTooLargeError as vi,ForbiddenError as yi,InvalidPermissionGrantError as bi,LogoProviderUnavailableError as xi,LogoSearchRateLimitedError as Si,MemoryNotFoundError as Ci,NotFoundError as wi,NotImplementedError as Ti,ObjectNotFoundError as Ei,ObjectReferencedError as Di,OrphanSystemAttributeError as Oi,PageReferencedError as ki,ProtectedResourceError as Ai,ProtectedRoleError as ji,QueryTimeoutError as Mi,RealtimeDeliveryError as Ni,RealtimeRateLimitedError as Pi,RealtimeSubscriptionError as Fi,RecordNotFoundError as Ii,RecordReferencedError as Li,RepositoryError as Ri,ReservedObjectNameError as A,RoleNotFoundError as zi,SchemaError as j,SchemaErrorCode as M,SearchBackendError as Bi,SearchPathNotIndexedError as Vi,StorageError as Hi,SyncCascadeError as Ui,SyncConflictError as Wi,SyncError as Gi,SystemEntityImmutableError as Ki,ToolGroupGrantError as qi,ValidationError as N,WorkspaceInvariantReason as Ji,isAttributeInUseError as Yi,isNotFoundError as Xi,isObjectReferencedError as Zi,isProtectedResourceError as Qi,isRecordReferencedError as $i,isSchemaError as ea,isValidationError as ta}from"./exceptions.mjs";import{ACCESS_LEVELS as na,ACCESS_ROLES as ra,AGENT_ASIDE_ANSWER_MAX_LENGTH as ia,AGENT_ASIDE_HISTORY_LIMIT as aa,AGENT_ASIDE_QUESTION_MAX_LENGTH as oa,AGENT_AVATAR_EXPRESSIONS as sa,AGENT_AVATAR_TYPES as ca,AGENT_MESSAGE_KIND as la,AGENT_MESSAGE_SENDER_NAME_KEY as ua,AGENT_NOTIFICATION_KIND as da,AGENT_SESSION_ACCESS_ROLES as fa,AGENT_SESSION_LIST_ORDERS as pa,AGENT_SESSION_ORIGINS as ma,AGENT_SESSION_PROVENANCES as ha,AGENT_STARTERS_MAX as ga,AGENT_STARTER_MAX_LENGTH as _a,AGENT_SYSTEM_PROMPT_MAX_LENGTH as va,AGENT_TASK_KINDS as ya,AGENT_WAKE_KIND as ba,ALL_CATALOG_TOOL_NAMES as xa,ALWAYS_KINDS as Sa,APPROVAL_FAMILY_TOOL_NAMES as Ca,ARCHITECT_PUBLICATION_KIND as wa,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Ta,ASK_QUESTIONS_ANSWER_MAX_VALUES as Ea,ASK_QUESTIONS_MAX_BATCH as Da,ASK_QUESTIONS_TOOL_NAME as Oa,AUDIT_ACTIONS as ka,AUDIT_AGENT_SESSION_METADATA_KEY as Aa,AUDIT_RESOURCE_TYPES as ja,AgentBuilder as P,BROWSER_LAUNCH_TOOL_NAME as Ma,BROWSER_TOOL_NAMES as Na,BUNDLE_LOCALES as Pa,BUNDLE_SETUP_PROMPT_MAX_LENGTH as Fa,CONNECTION_GRANT_PROVIDERS as Ia,CONTINUATION_KEY_PATTERN as La,CONVERSATION_SURFACES as Ra,COPY_VERB_NAME as za,CORE_RECORD_TOOL_NAMES as Ba,CORE_TOOL_NAMES as Va,COUNT_MODES as Ha,DEFAULT_AGENT_EXECUTION_CONFIG as Ua,DEFAULT_AGENT_TOOL_GROUPS as Wa,DEFAULT_APPROVAL_POLICY as Ga,DEFAULT_BLUEPRINT_TOOL_GROUPS as Ka,DEFAULT_DAILY_ACTIVITY_DAYS as qa,DEFAULT_MEETING_BOT_DISPLAY_NAME as Ja,DEFAULT_TENANT_SETTINGS as Ya,DEVICE_ACCESS_ROLES as Xa,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as Za,DOCUMENT_SORT_MODES as Qa,DRAFT_WRITE_TOOL_NAMES as $a,EMAIL_CATEGORY_DEFAULT_COLOR as eo,EMAIL_CATEGORY_DEFAULT_ICON as to,EMAIL_CATEGORY_DESCRIPTION_MAX as no,EMAIL_CATEGORY_DESCRIPTION_MIN as ro,EMAIL_CATEGORY_LIMIT as io,EMAIL_CATEGORY_NAME_MAX as ao,ENVIRONMENT_BUILD_LOG_STEPS as oo,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as so,ENVIRONMENT_HARNESSES as co,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as lo,ENVIRONMENT_HARNESS_WORKDIR as uo,ENVIRONMENT_IMAGES as fo,ENVIRONMENT_MEMORY_GB_PER_VCPU as po,ENVIRONMENT_NAME_MAX_CHARS as mo,ENVIRONMENT_NETWORK_ALLOW_MAX as ho,ENVIRONMENT_SCRIPT_MAX_BYTES as go,ENVIRONMENT_SIZES as _o,ENVIRONMENT_SIZE_VCPUS as vo,ENVIRONMENT_STANDARDS_WORKDIR as yo,ENV_VAR_KEY_PATTERN as bo,ESTIMATED_COUNT_CAP as xo,FILE_URLS_MAX_IDS as So,GET_ARCHITECT_DRAFT_TOOL_NAME as Co,GITHUB_TRIGGER_CATALOG as wo,GRANT_ENABLES as To,HITL_TOOL_NAMES as Eo,INFERENCE_REASONING_OPTIONS as Do,INFERENCE_ROUTING_MODES as Oo,INFERENCE_SPEEDS as ko,LAST_RUN_ERROR_MAX_LENGTH as Ao,MAILBOX_LIST_MODES as jo,MAIL_DRAFT_BODY_MAX_CHARS as Mo,MAIL_SIGNATURE_MAX_CHARS as No,MAIL_SUBJECT_MAX_CHARS as Po,MAX_DAILY_ACTIVITY_DAYS as Fo,MAX_TODOS as Io,MAX_TODO_DESCRIPTION_CHARS as Lo,MAX_TODO_ID_CHARS as Ro,MEETING_BOT_IMAGE as zo,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as Bo,MEETING_BOT_NO_CREDITS as Vo,MEETING_BOT_SILENT_REASON as Ho,MEETING_RESPONSES as Uo,MEMORY_SPEND_LIMIT_PATTERN as Wo,NATIVE_TOOL_GROUPS as Go,NATIVE_TOOL_GROUP_CATALOG as Ko,NO_RECORDING as qo,OPEN_TOOL_PART_STATES as Jo,OPERATION_MAX_STEPS as Yo,PROVIDER_DRAFT_LABEL as Xo,PROVIDER_NAMES as Zo,PUBLIC_MAIL_DOMAINS as Qo,QUESTION_FAMILY_TOOL_NAMES as $o,RECENT_ACTIVITY_LEDGER_LIMIT as es,RECIPIENT_IDENTITIES_MAX as ts,RECORDING_OVERRIDES as ns,RECORDING_POLICIES as rs,RECORD_ACCESS_ROLES as is,RECORD_ACCESS_SOURCES as as,RECORD_DRIVE_CURSOR_MAX_LENGTH as os,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as ss,RECORD_DRIVE_PAGE_MAX_LIMIT as cs,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as ls,RECORD_GRAPH_MAX_LIMIT_PER_NODE as us,RECORD_GRAPH_MAX_NODES as ds,RECORD_IMAGE_MAX_BYTES as fs,REPLY_MODES as ps,REQUEST_DESIGN_REVIEW_TOOL_NAME as ms,REQUEST_SETUP_TOOL_NAME as hs,RESOURCE_GRANT_KINDS as gs,RESOURCE_KIND_CATALOG as _s,ROUTING_PRICE_CEILINGS as vs,SEND_VERB_NAME as ys,SESSION_INFERENCE_PATCH_KEYS as bs,SLACK_TRIGGER_CATALOG as xs,SPEAKS_THROUGH_SEND_METADATA_KEY as Ss,SURFACE_TOOL_NAMES as Cs,SYSTEM_EMAIL_CATEGORIES as ws,SYSTEM_EMAIL_CATEGORY_NAMES as Ts,SYSTEM_PART_CODES as Es,TASK_DEMAND_LEVELS as Ds,TODO_PHASES as Os,TODO_PLAN_STATUSES as ks,TODO_STATUSES as As,TOOL_APPROVAL_STATES as js,TOOL_IMPACT_COUNT_KEYS as Ms,TRIAGE_ACTIONS as Ns,TRIGGER_EVENT_TYPES as Ps,TURN_OUTCOMES as Fs,UNSHAREABLE_OBJECT_NAMES as Is,USERS_RESOLVE_MAX_IDS as Ls,USER_STATUSES as Rs,USER_WORK_POSTURES as zs,VERB_NAMES as Bs,WAKE_TURN_METADATA_KEY as Vs,WAKE_TURN_SPOKE_METADATA_KEY as Hs,actorSchema as Us,agent as Ws,agentAvatarFromMetadata as Gs,agentAvatarSchema as Ks,agentDataChunk as qs,agentDisplayName as Js,agentInferencePreferencesSchema as Ys,agentMessageAttachmentSchema as Xs,agentMessagePartSchema as Zs,agentScheduleSchema as Qs,agentSessionInferenceOverridesInputSchema as $s,agentSessionInferenceOverridesSchema as ec,agentSessionMessageSchema as tc,agentStartersSchema as nc,agentTriggerBaseSchema as rc,agentTriggerPatchSchema as ic,agentTriggerSchema as ac,agentUIValidationError as oc,artifactQuoteSchema as sc,askQuestionsOutputSchema as cc,assertCustomAgentUIMessageChunk as lc,assertSessionState as uc,canonicalToolGroups as dc,classificationRestoreSchema as fc,classifyEmailSchema as pc,cliDefaultModelOf as mc,compareAgentSessionMessages as hc,compiledHarnessModels as gc,connectionGrantKindsOf as _c,connectorTriggerMatchSchema as vc,customDataChunkSchemas as yc,decodeAgentSessionListCursor as bc,deriveViewerAccess as xc,durableDateSchema as Sc,emailCategoryCreateSchema as Cc,emailCategoryDeleteSchema as wc,emailCategoryScopeQuerySchema as Tc,emailCategoryUpdateSchema as Ec,emailRuleScopeSchema as Dc,encodeAgentSessionListCursor as Oc,environmentHarness as kc,environmentWorkdir as Ac,findEnvironmentHarness as jc,githubConditionSchema as Mc,githubTriggerMatchSchema as Nc,grantKindOf as Pc,harnessModelChoices as Fc,humanRequestId as Ic,humanRequestKind as Lc,imageModelIdSchema as Rc,inferenceReasoningSchema as zc,inferenceRoutingSchema as Bc,inferenceSpeedSchema as Vc,isAgentMessageMetadata as Hc,isAgentNotificationMetadata as Uc,isAgentUIDataName as Wc,isAgentWakeMetadata as Gc,isAgentWrittenAuditEntry as Kc,isArchitectPublicationMetadata as qc,isAwaitingHuman as Jc,isBlocking as Yc,isEnvironmentBuildLogStep as Xc,isEnvironmentHarnessId as Zc,isMailProvider as Qc,isMailboxListMode as $c,isNativeToolGroup as el,isOpenToolPartState as tl,isParkedOnHuman as nl,isProviderDraft as rl,isPublicMailDomain as il,isQuestionPart as al,isReplyMode as ol,isResourceGrant as sl,isRoutineActorMetadata as cl,isSessionInferencePatch as ll,isSystemEmailCategory as ul,isSystemEmailCategoryName as dl,isSystemPartCode as fl,isToolApprovalState as pl,isToolImpactCountKey as ml,lockingSendCall as hl,meetingBotDispatchRequestSchema as gl,meetingBotDispatchResponseSchema as _l,meetingBotNotificationSchema as vl,meetingTranscriptSegmentSchema as yl,mentionReferenceSchema as bl,mergeSessionInferencePatch as xl,modelDefinitionSchema as Sl,modelReferenceSchema as Cl,needsManageWhenUnattended as wl,normalizedMeetingTranscriptSchema as Tl,openRequests as El,orderAgentSessionMessages as Dl,parseAgentDefinitionAccessRole as Ol,parseAgentSessionAccessRole as kl,parseCountMode as Al,parseDeviceAccessRole as jl,parseMergedAgentTrigger as Ml,parseOptionalCountMode as Nl,parsePageAccessRole as Pl,parseRecordAccessRole as Fl,parseToolGroupGrant as Il,providerNameSchema as Ll,readArchitectPublication as Rl,readAskQuestionsResult as zl,recentActivityEntryKey as Bl,recordGraphNodeKey as Vl,recordGraphRequestSchema as Hl,recordMeetingsCount as Ul,recordOperationSchema as Wl,refineTrigger as Gl,resourceGrant as Kl,routedMessageInferenceSchema as ql,sessionInferencePatchSchema as Jl,slackConditionSchema as Yl,slackTriggerMatchSchema as Xl,todoItemSchema as Zl,todoPlanSchema as Ql,toolImpactSchema as $l,utf8ByteLength as eu}from"./record-operation-q6w-3EDJ.mjs";import*as F from"zod";import{colorIdFromString as tu,getCountryByIso2 as nu,isValidCurrencyCode as ru,isValidIso3 as iu}from"@standards/constants";import{parsePhoneNumberFromString as au}from"libphonenumber-js";const ou=`__stndrdsNativeUiPartIds`,su=1;function invalidNativePartIds(){throw new N(`Native agent UI part IDs metadata is invalid`,[])}function isPlainRecord$1(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function nativeAgentUIPartIdMetadataKey(e,t){if(e.type===`text`||e.type===`reasoning`)return`${e.type}:${t}`;if(e.type===`tool`)return`tool:${e.toolCallId}`}function parseNativeAgentUIPartIdsMetadata(e){let t=e.metadata?.[ou];isPlainRecord$1(t)||invalidNativePartIds(),Object.keys(t).length===2&&t.schemaVersion===1&&isPlainRecord$1(t.partIds)||invalidNativePartIds();let n=/* @__PURE__ */ new Map;for(let[t,r]of e.parts.entries()){let e=nativeAgentUIPartIdMetadataKey(r,t);!e||n.has(e)?e&&invalidNativePartIds():n.set(e,r)}let r=Object.entries(t.partIds);r.length!==n.size&&invalidNativePartIds();let i=/* @__PURE__ */ new Map,a={};for(let[e,t]of r){let r=n.get(e);r&&typeof t==`string`&&t.length>0||invalidNativePartIds();let o=i.get(t);o&&(r.type===`tool`||o!==r.type)&&invalidNativePartIds(),r.type===`tool`&&t!==r.toolCallId&&invalidNativePartIds(),i.set(t,r.type),a[e]=t}return a}const cu=`/v1/device-worker/channel`,lu=262144,uu=1e4,du=2e3,fu=2e3,pu=2e4,mu=4008,hu={initialMs:1e3,maxMs:3e4};function deviceChannelUrl(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}${cu}`}function computeRetryDelay(e,t,n){return Math.min(n.initialMs*2**e,n.maxMs)+Math.floor(t()*250)}function computeReconnectDelay(e,t=Math.random){return computeRetryDelay(e,t,hu)}const gu=[`worker_disconnected`,`cancelled`,`timed_out`,`execution_failed`];var DeviceChannelProtocolError=class extends j{constructor(e){super(e,M.DEVICE_CHANNEL_PROTOCOL),this._tag=`DeviceChannelProtocolError`,this.name=`DeviceChannelProtocolError`}};const _u=[`zsh`,`bash`,`sh`,`fish`,`pwsh`,`powershell`],vu=[`ready`,`permission_missing`,`no_session`,`unavailable`],yu=F.strictObject({state:F.enum(vu),version:F.string().min(1)}),I={id:F.uuid(),leaseToken:F.string().min(1)},bu=F.discriminatedUnion(`type`,[F.strictObject({type:F.literal(`authenticate`),credential:F.string().regex(/^Device \S+$/),protocol:F.number().int().positive().optional(),desktop:yu.optional(),shell:F.enum(_u).optional()}),F.strictObject({type:F.literal(`running`),...I}),F.strictObject({type:F.literal(`heartbeat`),...I}),F.strictObject({type:F.literal(`output`),...I,stdout:F.string().optional(),stderr:F.string().optional()}),F.strictObject({type:F.literal(`complete`),...I,result:F.strictObject({stdout:F.string().optional(),stderr:F.string().optional(),exitCode:F.number().int(),success:F.boolean(),errorCode:F.enum(gu).optional()}),background:F.strictObject({pid:F.number().int(),logPath:F.string().min(1)}).optional()}),F.strictObject({type:F.literal(`pong`)})]),xu=F.discriminatedUnion(`type`,[F.strictObject({type:F.literal(`ready`),device:F.strictObject({id:F.string(),name:F.string(),capability:F.enum([`shell`,`browser`])}),protocol:F.number().int().positive().optional()}),F.strictObject({type:F.literal(`command`),...I,kind:F.enum([`shell`,`browser`]),intent:F.string(),timeoutMs:F.number().int(),command:F.string().optional(),cwd:F.string().nullable().optional(),rootSessionId:F.string().min(1).optional(),background:F.boolean().optional()}),F.strictObject({type:F.literal(`release_session`),rootSessionId:F.string().min(1)}),F.strictObject({type:F.literal(`cancel`),id:F.uuid(),reason:F.enum([`cancelled`,`timed_out`,`revoked`])}),F.strictObject({type:F.literal(`reauthenticate`)}),F.strictObject({type:F.literal(`revoked`)}),F.strictObject({type:F.literal(`ping`)})]);function parseDeviceChannelFrame(e,t){let n;try{n=JSON.parse(t)}catch{throw new DeviceChannelProtocolError(`Frame is not JSON`)}let r=e.safeParse(n);if(!r.success)throw new DeviceChannelProtocolError(`Frame does not match the channel protocol`);return r.data}function parseWorkerFrame(e){return parseDeviceChannelFrame(bu,e)}function parseServerFrame(e){return parseDeviceChannelFrame(xu,e)}const Su=5;function isFormDefinition(e){return typeof e==`object`&&!!e&&`slots`in e&&`steps`in e&&`name`in e&&typeof e.name==`string`&&Array.isArray(e.slots)&&Array.isArray(e.steps)}const L=[`relation`,`multiRelation`,`formula`,`rollup`,`document`,`richtext`,`user`];function isFormSlotFieldRef(e){return e.type===`slot`}function isFormFreeFieldRef(e){return e.type===`free`}function resolveFieldRequired(e){return e.readOnly===!0?!1:e.fieldRequired===void 0?e.slotMode===`create`&&e.attributeRequired===!0:e.fieldRequired}function getSlotFieldTargets(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}function formFieldKey(e){return isFormSlotFieldRef(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}function formFieldFlatKey(e){return isFormSlotFieldRef(e)?e.attribute:e.attribute.name}function readFormFieldValue(e,t){return e[formFieldKey(t)]??e[formFieldFlatKey(t)]}function isFormFieldsRow(e){return e.type===`fields`}function isFormHeadingRow(e){return e.type===`heading`}function isFormSeparatorRow(e){return e.type===`separator`}function isFormTextRow(e){return e.type===`text`}function moveWidensAudience(e){return e.added.length>0||!e.workspaceBefore&&e.workspaceAfter}function resolvePropertyDefinitions(e){let t=e.properties;if(!t)return[];if(Array.isArray(t))return t;let n=t;return Array.isArray(n.definitions)?n.definitions:[]}function hasOptions(e){return T(e.type,`options`)}function schemaGroupKey(e){return`${e.kind}:${e.name}`}function refuse$3(e){throw new N(e,[{path:[`label`],message:e}])}function parseSchemaGroupPresentation(e){let t=e??{},n={};if(t.label!==void 0){let e=t.label;if(e===null)n.label=null;else if(typeof e!=`string`)refuse$3(`Label must be a string`);else{let t=e.trim();t.length===0&&refuse$3(`Label must not be empty`),t.length>g.labelLength&&refuse$3(`Label is too long (max ${g.labelLength} characters)`),n.label=t}}return n}const R=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!R.test(e))throw new N(`Invalid schema owner "${e}"`,[]);return e}const Cu=16e3,wu=3200,Tu=6400,Eu=16e3,Du=65536,Ou=15e3,ku=1e4,Au=5e3,ju=`google/gemini-3.5-transcribe-live`,Mu={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2},Nu=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],Pu=[`ephemeral`,`conversation`,`persistent`],Fu=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};const Iu=6048e5,Lu=36e5,Ru=2592e6,zu=6e4,Bu=[`square`,`landscape`,`portrait`];function imageModelFormatDefect(e){if(e.formats.length===0)return`declares no output format`;for(let t of e.formats)if(e.requests[t]===void 0)return`declares the format "${t}" without a request`;for(let t of Object.keys(e.requests))if(!e.formats.includes(t))return`carries a request for the undeclared format "${t}"`}function declaredImageRequests(e){let t={};for(let n of e.formats){let r=e.requests[n];r!==void 0&&(t[n]=r)}return t}const Vu=[`storage.bytes`,`members.seats`,`data.live_records`,`email.mailboxes`,`calendar.connections`],Hu=/* @__PURE__ */ new Set([`data.live_records`,`email.mailboxes`,`calendar.connections`]);function computeByteMagnitude(e){if(e<=0)return{value:0,unitIndex:0};let t=1e3,n=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return{value:Number.parseFloat((e/t**n).toFixed(1)),unitIndex:n}}const Uu=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${Uu[n]}`}const Wu=Object.freeze([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`,`multiselect`,`location`]);function buildPropertySchema(e){let t=[];for(let n of e){let e=n.build();if(!Wu.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const Gu=[`UPPER`,`LOWER`,`capitalize`,`trim`],Ku=[`prefix`,`suffix`,`wrap`,`default`],z=[...Gu,...Ku],qu=/^\s*where\s*(?::(.*))?$/s,Ju=`[A-Za-z_][A-Za-z0-9_]*`,Yu=/^[^\s,()|{}="']+$/,Xu=RegExp(`^(${Ju})\\s*=\\s*(.*)$`),Zu=RegExp(`^(${Ju})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return qu.test(e)}function parseWherePipe(e){let t=e.match(qu)?.[1]?.trim();if(!t)return null;let n=t.match(Zu);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>Yu.test(e))?{property:n[1],values:e}:null}let r=t.match(Xu);return r&&Yu.test(r[2])?{property:r[1],values:[r[2]]}:null}const B=F.string().min(1,`labelExpression cannot be empty`).refine(e=>isLabelExpression(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,n;for(;(n=t.exec(e))!==null;){let e=n[1];if(!z.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${z.join(`, `)}`});function validateLabelExpression(e){let t=B.safeParse(e);return t.success?{success:!0,attributes:extractAttributeNames(e)}:{success:!1,error:t.error.issues[0]?.message??`Invalid labelExpression`}}function applyPipe(e,t){let{name:n,args:r}=parsePipeExpression(t);switch(n){case`UPPER`:return e.toUpperCase();case`LOWER`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|\s)\S/g,e=>e.toUpperCase());case`trim`:return e.trim();case`prefix`:return e?`${r[0]??``}${e}`:``;case`suffix`:return e?`${e}${r[0]??``}`:``;case`wrap`:return e?`${r[0]??``}${e}${r[1]??``}`:``;case`default`:return e||r[0]||``;default:return e}}function applyPipes(e,t){let n=e;for(let e of t)n=applyPipe(n,e);return n}function getValue(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}const Qu=`(Untitled)`;function parsePipeExpression(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return{name:e,args:[]};let n=t[1],r=t[2];if(!r)return{name:n,args:[]};let i=[],a=/["']([^"']*?)["']/g,o;for(;(o=a.exec(r))!==null;)i.push(o[1]);return{name:n,args:i}}function*templateBlocks(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return;let r=e.indexOf(`}`,n+2);if(r<0)return;if(e[r+1]!==`}`){t=r+1;continue}t=r+2;let i=e.slice(n+2,r);i.length>0&&(yield{start:n,end:t,expr:i})}}function resolveLabelBlock(e,t){let n=e.split(`||`).map(e=>e.trim()),r=n[n.length-1].split(`|`).map(e=>e.trim());n[n.length-1]=r[0];let i=r.slice(1).filter(Boolean),a=n.filter(Boolean),o=``;for(let e of a){let n=toText(getValue(t,e));if(n!==``){o=n;break}}return applyPipes(o,i)}function renderLabelExpression(e,t,n=Qu){let r=[],i=0;for(let n of templateBlocks(e))r.push(e.slice(i,n.start),resolveLabelBlock(n.expr,t)),i=n.end;return r.push(e.slice(i)),r.join(``).trim()||n}function toText(e){if(e==null||typeof e==`function`)return``;if(typeof e!=`object`)return String(e);if(Array.isArray(e))return e.map(toText).filter(Boolean).join(`,`);let t=e.toString;return typeof t==`function`&&t!==Object.prototype.toString?String(e):``}function isLabelExpression(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return!1;let r=e.indexOf(`}}`,n+2);if(r<0)return!1;if(e.slice(n+2,r).trim().length>0)return!0;t=r+2}return!1}function extractAttributePaths(e){let t=[];for(let n of templateBlocks(e)){let e=n.expr.trim();if(!e)continue;let r=e.split(`||`).map(e=>e.trim()),i=r[r.length-1];r[r.length-1]=i.split(`|`)[0].trim();for(let e of r)e&&!t.includes(e)&&t.push(e)}return t}function extractAttributeNames(e){let t=extractAttributePaths(e).map(e=>e.split(`.`)[0]).filter(e=>e.length>0);return[...new Set(t)]}const $u=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match($u);return t?t[1]:null}function getEditableLabelAttribute(e,t){let n=getSingleAttributeFromExpression(e);if(n===null)return null;let r=t.find(e=>e.name===n);return!r||r.type!==`text`||jn(r).authoring.readOnly?null:r}const ed=[{id:`data`,capabilities:[{id:`forms`,resources:[`forms`],levels:[{id:`fill`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]},{id:`manage`,add:[`manage`]}]},{id:`emails`,resources:[`emails`],levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]}]}]},{id:`structure`,capabilities:[{id:`schema`,resources:[`architect`],levels:[{id:`use`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]}]},{id:`pages`,resources:[`pages`],levels:[{id:`read`,add:[`read`]},{id:`create`,add:[`create`,`update`,`delete`]}]}]},{id:`ai`,capabilities:[{id:`agents`,resources:[`agents`],levels:[{id:`chat`,add:[`read`]},{id:`create`,add:[`create`]},{id:`build`,add:[`update`,`delete`]},{id:`manage`,add:[`manage`]}]},{id:`environments`,resources:[`environments`],levels:[{id:`use`,add:[`read`]},{id:`create`,add:[`create`]}]},{id:`browser-profiles`,resources:[`browser-profiles`],levels:[{id:`use`,add:[`create`]}]},{id:`private-secrets`,resources:[`private-secrets`],levels:[{id:`use`,add:[`create`]}]},{id:`routine-audiences`,resources:[`routine-audiences`],levels:[{id:`use`,add:[`create`]}]},{id:`supervision`,resources:[`supervision`],levels:[{id:`use`,add:[`create`]}]}]},{id:`files`,capabilities:[{id:`files`,resources:[`files`,`documents`],levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]}]},{id:`team`,capabilities:[{id:`people`,resources:[`people`],levels:[{id:`view`,add:[`read`]},{id:`invite`,add:[`create`]},{id:`manage`,add:[`update`,`delete`]}]}]},{id:`integrations`,capabilities:[{id:`connectors`,resources:[`connectors`],levels:[{id:`use`,add:[`read`,`create`,`update`,`delete`]}]},{id:`api-keys`,resources:[`api-keys`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]},{id:`env-vars`,resources:[`env-vars`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]},{id:`devices`,resources:[`devices`],levels:[{id:`manage`,add:[`manage`]}]}]},{id:`administration`,capabilities:[{id:`settings`,resources:[`settings`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`update`,`delete`,`manage`]}]},{id:`audit`,resources:[`audit`],levels:[{id:`view`,add:[`read`]}]},{id:`billing`,resources:[`billing`],levels:[{id:`view`,add:[`read`]}]}]}],V=`none`,td=`custom`,H={actions:[`read`,`create`,`update`,`delete`],purge:`manage`,levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]},U=ed.flatMap(e=>e.capabilities),nd=U.flatMap(e=>e.resources),rd=new Map(U.flatMap(e=>e.resources.map(t=>[t,e])));function isCatalogResource(e){return rd.has(e)}function capabilityForResource(e){let t=rd.get(e);if(!t)throw new j(`Unknown catalog resource "${e}"`,M.INVARIANT_VIOLATION);return t}function sameActions(e,t){let n=new Set(e),r=new Set(t);return n.size===r.size&&[...n].every(e=>r.has(e))}function levelActions(e,t){let n=/* @__PURE__ */ new Set;for(let r of e.levels){for(let e of r.add)n.add(e);if(r.id===t)return[...n]}return[]}function levelFloor(e,t){let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=V;for(let t of e.levels){if(!t.add.every(e=>r.has(e)))break;i=t.id}return i}function levelOf(e,t){if(t.length===0)return V;let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=/* @__PURE__ */ new Set;for(let t of e.levels){for(let e of t.add)i.add(e);if(i.size===r.size&&[...r].every(e=>i.has(e)))return t.id}return td}const id=[`read`,`create`,`update`,`delete`,`manage`],ad=F.object({scope:F.enum([`object`,`system`]),target:F.string().min(1),actions:F.array(F.enum(id))}).strict();function findGrantIssues(e,t){let n=[],r=/* @__PURE__ */ new Map;for(let i of e){let e=ad.safeParse(i);if(!e.success){let e=typeof i==`object`&&i&&`target`in i?String(i.target):`?`;n.push({target:e,reason:`shape`});continue}let a=e.data;if(a.scope===`system`){if(!isCatalogResource(a.target)){n.push({target:a.target,reason:`unknown-resource`});continue}if(levelOf(capabilityForResource(a.target),a.actions)===`custom`){n.push({target:a.target,reason:`off-level`});continue}r.set(a.target,a.actions);continue}if(a.target!==`*`&&!t.objectNames.has(a.target)){n.push({target:a.target,reason:`unknown-object`});continue}let o=a.target===`*`?[...H.actions,H.purge]:H.actions;a.actions.every(e=>o.includes(e))||n.push({target:a.target,reason:`object-action`})}let i=/* @__PURE__ */ new Set;for(let[e,t]of r){let a=capabilityForResource(e);if(!i.has(a)){for(let o of a.resources)if(!sameActions(t,r.get(o)??[])){n.push({target:e,reason:`split-capability`}),i.add(a);break}}}return n}const od=`memory`,sd=4e3,cd=`workspace`,W={name:`name`,description:`description`,content:`content`,profileOf:`profileOf`,profileActor:`profileActor`,subjects:`subjects`,subjectId:`subjectId`};function textValue(e){return typeof e==`string`?e:``}function memoryPageViewOf(e){let{values:t}=e;return{id:e.id,name:textValue(t[W.name]),description:textValue(t[W.description]),content:textValue(t[W.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const ld={meetingHour:`0.80`,computeVcpuHour:`0.20`,browserHour:`0.60`},ud=[`meeting.recording`,`sandbox.agent`,`sandbox.harness`,`sandbox.build`,`browser.session`];function isMeteredChargeKind(e){return ud.includes(e)}const dd=/^\d+(?:\.\d+)?$/u;function meteredUsd(e,t){if(!dd.test(e))throw new N(`Invalid metered rate "${e}"`,[]);if(!(t>=0&&t<=2**53-1))throw new N(`Invalid metered duration "${t}"`,[]);let[n=`0`,r=``]=e.split(`.`),i=BigInt(n+r)*BigInt(t.toFixed(12).replace(`.`,``)),a=10n**BigInt(r.length+12-4),o=(i+a-1n)/a,s=10n**BigInt(4),c=(o%s).toString().padStart(4,`0`).replace(/0+$/u,``);return c?`${o/s}.${c}`:`${o/s}`}const fd=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:fd,validate:t=>{let n=e.safeParse(t);return n.success?{value:n.data}:{issues:n.error.issues.map(e=>({message:e.message,path:e.path}))}}}}function isStandardSchema(e){return typeof e==`object`&&!!e&&`~standard`in e&&typeof e[`~standard`]==`object`&&e[`~standard`].version===1}function asMutableArray(e){return e}var BaseAttributeBuilder=class{get"~standard"(){return createStandardSchemaProps(cn(this.build()))}constructor(e,t,n){tt(t),rt(n),this.attr={name:t,label:n,type:e,required:!1,system:!0}}asPhantomState(){return this}required(){return this.attr.required=!0,this.asPhantomState()}optional(){return this.attr.required=!1,this.asPhantomState()}runtime(){return this.attr.system=!1,this}hidden(){return this.attr.hidden=!0,this}placeholder(e){return this.attr.placeholder=e,this}description(e){return this.attr.description=e,this}icon(e){return nt(e,`attribute "${this.attr.name}"`),this.attr.icon=e,this}order(e){return this.attr.order=e,this}defaultValue(e){return(`defaultValue`in this.attr||!T(String(this.attr.type),`computed`))&&(this.attr.defaultValue=e),this}metadata(e){return this.attr.metadata=e,this}build(){return this.attr}},TextAttributeBuilder=class extends BaseAttributeBuilder{minLength(e){return this.attr.minLength=e,this}maxLength(e){return this.attr.maxLength=e,this}pattern(e){return this.attr.pattern=e,this.attr.format=void 0,this}multiline(e=!0){return this.attr.multiline=e,this}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}};function text(e,t){return new TextAttributeBuilder(`text`,e,t)}var RichtextAttributeBuilder=class extends BaseAttributeBuilder{};function richtext(e,t){return new RichtextAttributeBuilder(`richtext`,e,t)}var NumberAttributeBuilder=class extends BaseAttributeBuilder{min(e){return this.attr.min=e,this}max(e){return this.attr.max=e,this}integer(){return this.attr.unit=`integer`,this.attr.decimals=0,this}decimal(e=2){return this.attr.unit=`decimal`,this.attr.decimals=e,this}percentage(){return this.attr.unit=`percentage`,this}renderAs(e){return this.attr.renderAs=e,this}};function number(e,t){return new NumberAttributeBuilder(`number`,e,t)}var CheckboxAttributeBuilder=class extends BaseAttributeBuilder{};function checkbox(e,t){return new CheckboxAttributeBuilder(`checkbox`,e,t)}var DateAttributeBuilder=class extends BaseAttributeBuilder{format(e){return this.attr.dateFormat=e,this}precision(e){return this.attr.precision=e,this}build(){let[e]=fn(`date`,this.attr);if(e!==void 0)throw new N(e.message,[{path:[`precision`],message:e.message}]);return super.build()}minDate(e){return this.attr.minDate=e,this}maxDate(e){return this.attr.maxDate=e,this}endDate(){return this.attr.endDate=!0,this.asPhantomState()}includeTime(){return this.attr.includeTime=!0,this}timeFormat(e){return this.attr.timeFormat=e,this}};function date(e,t){return new DateAttributeBuilder(`date`,e,t)}var PhoneAttributeBuilder=class extends BaseAttributeBuilder{defaultCountry(e){return this.attr.defaultCountryCode=e,this}};function phone(e,t){return new PhoneAttributeBuilder(`phone`,e,t)}var CurrencyAttributeBuilder=class extends BaseAttributeBuilder{defaultCurrency(e){return this.attr.defaultCurrency=e,this}allowedCurrencies(e){return this.attr.allowedCurrencies=e,this}allowNegative(e=!0){return this.attr.allowNegative=e,this}};function currency(e,t){return new CurrencyAttributeBuilder(`currency`,e,t)}function setOptions(e,t){let n=asMutableArray(t);at(e.name??`unknown`,n),e.options=n}function addOption(e,t){e.options||=[],at(e.name??`unknown`,[...e.options,t]),e.options.push(t)}var StatusAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}};function status(e,t){return new StatusAttributeBuilder(`status`,e,t)}var SelectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function select(e,t){return new SelectAttributeBuilder(`select`,e,t)}var MultiselectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function multiselect(e,t){return new MultiselectAttributeBuilder(`multiselect`,e,t)}var LocationAttributeBuilder=class extends BaseAttributeBuilder{granularity(e){return this.attr.granularity=e,this}defaultCountry(e){return this.attr.defaultCountry=e,this}allowedCountries(e){return this.attr.allowedCountries=e,this}};function location(e,t){return new LocationAttributeBuilder(`location`,e,t)}var UserAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`user`,e,t),this.attr.types=[`user`,`agent`]}types(e){let t=[...new Set(e)];if(t.length===0)throw Error(`[AttributeBuilder] user.types must contain at least one type.`);return this.attr.types=t,this}multiple(){return this.attr.multiple=!0,this}notifiesOnAssign(){return this.attr.notifiesOnAssign=!0,this}actors(){return this.attr.actors=!0,this}};function user(e,t){return new UserAttributeBuilder(e,t)}var BaseRelationAttributeBuilder=class extends BaseAttributeBuilder{to(e,t){let n={object:e,...t};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:`*`}],this}qualifyWith(...e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.qualifyWith() must be called AFTER .to(). Example: relation("companies", "Companies").to("companies").qualifyWith(...)`);return this.attr.properties=buildPropertySchema(e),this}bilateral(e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.bilateral() must be called AFTER .to(). Example: relation("company", "Company").to("companies").bilateral({ ... })`);if(t.length>1)throw Error(`Bilateral relations are not supported for polymorphic relations (multiple .to() targets).`);if(lr(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new N(`Bilateral relation requires one target object`,[{path:[`bilateral`,`object`],message:`Bilateral relation requires one target object`}]);if(e.object&&e.object!==n){let t=`Bilateral inverse object ${e.object} must match relation target ${n}`;throw new N(t,[{path:[`bilateral`,`object`],message:t}])}return this.attr.bilateral={...e,object:n},this}},SingleRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t){super(`relation`,e,t),this.attr.cardinality=`one`,this.attr.targets=[]}many(){let e=new MultiRelationAttributeBuilder(this.attr.name,this.attr.label??``,{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===!1&&e.runtime(),this.attr.hidden&&e.hidden(),this.attr.placeholder&&e.placeholder(this.attr.placeholder),this.attr.description&&e.description(this.attr.description),this.attr.icon&&e.icon(this.attr.icon),this.attr.order!==void 0&&e.order(this.attr.order),this.attr.metadata&&e.metadata(this.attr.metadata),e}},MultiRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t,n){super(`relation`,e,t),this.attr.cardinality=`many`,this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&(this.attr.required=!0)}maxItems(e){return this.attr.maxItems=e,this}};function relation(e,t){return new SingleRelationAttributeBuilder(e,t)}var FormulaAttributeBuilder=class extends BaseAttributeBuilder{expression(e){return this.attr.expression=e,this}returns(e){return this.attr.returnType=e,this}decimals(e){return this.attr.decimals=e,this}currency(e){return this.attr.currencyCode=e,this}required(){throw Error(`Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}};function formula(e,t){return new FormulaAttributeBuilder(`formula`,e,t)}var RollupAttributeBuilder=class extends BaseAttributeBuilder{from(e){return this.attr.relationAttribute=e,this}aggregate(e){return this.attr.targetAttribute=e,this}using(e){return this.attr.function=e,this}decimals(e){return this.attr.decimals=e,this}path(e){return this.attr.relationPath=e,this}targetType(e){return this.attr.targetAttributeType=e,this}targetOptions(e){return this.attr.targetAttributeOptions=asMutableArray(e),this}targetCurrency(e){return this.attr.targetCurrencyCode=e,this}build(){let e=this.attr.function,t=this.attr.targetAttributeType;if(e===`original`&&t!==void 0&&t!==`select`&&t!==`status`&&t!==`multiselect`){let e=this.attr.relationAttribute??`relation`,n=this.attr.targetAttribute??`field`;throw new j(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${t}") was given. To surface a plain ${t} value from a related record, use a formula instead — e.g. formula("${this.attr.name}", "…").expression("${e}.${n}").`,M.VALIDATION_FAILED)}return super.build()}required(){throw Error(`Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}};function rollup(e,t){return new RollupAttributeBuilder(`rollup`,e,t)}var DocumentAttributeBuilder=class extends BaseAttributeBuilder{accepts(e){return this.attr.accepts=e,this}maxFileSize(e){return this.attr.maxFileSize=e,this}qualifyWith(...e){return this.attr.properties=buildPropertySchema(e),this}};function document(e,t){return new DocumentAttributeBuilder(`document`,e,t)}const G={owner:`standardshq`,repo:`skills`,ref:`stable`},K=`[A-Za-z0-9._-]+`,pd=`[A-Za-z0-9_-]+`,md=RegExp(`^(${pd})/(${K})@([a-z0-9-]+)(?:#(${K}))?$`),hd=RegExp(`^(${pd})/(${K})$`),gd=/^[0-9a-f]{40}$/i;function isSafeSegment(e){return e!==`.`&&!e.startsWith(`-`)&&!e.includes(`..`)}function refuse$2(e,t){throw new N(`Invalid skill source "${e}": ${t} (expected owner/repo@skill or owner/repo@skill#ref)`,[{path:[`source`],message:t}])}function canonicalRef(e){return gd.test(e)?e.toLowerCase():e}function parseSkillSource(e){let t=e.trim(),n=t.startsWith(`github.com/`)?t.slice(11):t,r=md.exec(n);if(!r)return refuse$2(e,`malformed or not a github.com source`);let[,i,a,o,s]=r;return[i,a,s??``].every(isSafeSegment)?{host:`github.com`,owner:i,repo:a,skill:o,ref:s===void 0?null:canonicalRef(s)}:refuse$2(e,"a segment cannot start with `-`, hold `..` or be `.`")}function isSkillRepository(e){return hd.exec(e)?.slice(1).every(isSafeSegment)??!1}function formatSkillSource(e){let t=`${e.owner}/${e.repo}@${e.skill}`;return e.ref===null?t:`${t}#${e.ref}`}function isPinnedSkillSource(e){return e.ref!==null&&gd.test(e.ref)}const q=/^[a-z0-9][a-z0-9-]{0,62}$/,J=`core`;function assertBundleName(e){if(!q.test(e))throw new N(`Invalid bundle name "${e}": expected a lowercase slug matching ${q}`,[]);if(e===`core`)throw new N(`Bundle name "${J}" is reserved`,[])}async function sha256Hex(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function nameSlug(e,t){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).slice(0,t).replace(/^_+|_+$/g,``)}function cloneBuilderValue(e,t){try{return structuredClone(e)}catch{let e=`Builder configuration must contain cloneable data`;throw new N(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new N(`Name must not be blank`,[{path:t,message:`Name must not be blank`}])}function validateContentConfiguration(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new N(`Invalid content configuration`,[{path:t,message:`Expected content configuration`}]);for(let n of[`name`,`label`,`placement`])if(Object.hasOwn(e,n)){let e=`Independent content configuration cannot define ${n}`;throw new N(e,[{path:[...t,n],message:e}])}let n=O.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw N.fromZodErrors(n.error.issues.map(e=>({path:[...t,...e.path.map(String)],message:e.message})));n.data.type===`form`&&n.data.groups.forEach((e,n)=>requireBuilderName(e.name,[...t,`groups`,String(n),`name`]));let{name:r,label:i,placement:a,...o}=n.data;return cloneBuilderValue(o,t)}function validateLiteralContent(e,t){return validateContentConfiguration(e,t),cloneBuilderValue(e,t)}function positionOf(e){return{x:e.x,y:e.y,w:e.w,h:e.h}}function bottomOf(e){return e.y+e.h}function collides(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function firstCollision(e,t){return t.find(t=>collides(e,t))}function inReadingOrder$1(e){return[...e].sort((e,t)=>e.y-t.y||e.x-t.x)}function snapWidth(e,t,n){let r=12-t,i=b.filter(e=>e>=n&&e<=r);return i.length===0?b.find(e=>e>=n)??n:i.reduce((t,n)=>{let r=Math.abs(n-e),i=Math.abs(t-e);return r<i||r===i&&n>t?n:t})}function sharesColumns(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w}function risenRow(e,t){return t.reduce((t,n)=>n.y<e.y&&sharesColumns(e,n)?Math.max(t,bottomOf(n)):t,0)}function packLayout(e,t){let n=e.map(e=>{let n=t?.get(e.i);return n===void 0?e:{...e,h:n}}),r=n.filter(e=>e.static===!0),i=new Map(r.map(e=>[e.i,e]));for(let e of inReadingOrder$1(n.filter(e=>e.static!==!0))){let t=risenRow(e,r),n=firstCollision({...e,y:t},r);for(;n!==void 0;)t=bottomOf(n),n=firstCollision({...e,y:t},r);let a={...e,y:t};r.push(a),i.set(e.i,a)}return n.map(e=>i.get(e.i)??e)}function settleLayout(e,t){let n=e.filter(e=>e.static===!0),r=e.filter(e=>e.static!==!0),i=/* @__PURE__ */ new Map;for(let e of[...inReadingOrder$1(r.filter(e=>t.has(e.i))),...inReadingOrder$1(r.filter(e=>!t.has(e.i)))]){let t=e,r=firstCollision(t,n);for(;r!==void 0;)t={...t,y:bottomOf(r)},r=firstCollision(t,n);n.push(t),i.set(e.i,t)}return packLayout(e.map(e=>i.get(e.i)??e))}function pageCompactor(){return{type:`vertical`,allowOverlap:!1,preventCollision:!1,compact:e=>packLayout(e).map(e=>({...e,moved:!1}))}}function clampHeight(e,t){let n=t.minHeight??1,r=t.maxHeight??1/0;return Math.max(1,n,Math.min(r,e))}function widthStepConstraint(e){return{name:`width-steps`,constrainSize:(t,n,r)=>{let i=e(t.i),a=snapWidth(n,t.x,i.minWidth);return i.height===`fit`?{w:a,h:t.h}:i.height===`flexible`?{w:a,h:clampHeight(r,i)}:{w:a,h:Math.max(1,r)}}}}function snapCell(e,t){let n=Math.max(0,Math.min(e.x,11)),r=snapWidth(e.w,n,t(e.i).minWidth);return{...e,x:Math.min(n,12-r),y:Math.max(0,e.y),w:r,h:Math.max(1,e.h)}}function samePosition(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}function pushApart(e){let t=e.filter(e=>e.static===!0),n=/* @__PURE__ */ new Map;for(let r of inReadingOrder$1(e.filter(e=>e.static!==!0))){let e=r,i=firstCollision(e,t);for(;i!==void 0;){let n={...e,x:i.x+i.w};e=n.x+n.w<=12&&firstCollision(n,t)===void 0?n:{...e,y:bottomOf(i)},i=firstCollision(e,t)}t.push(e),n.set(r.i,e)}return e.map(e=>n.get(e.i)??e)}function isValidStatic(e){return[e.x,e.y,e.w,e.h].every(Number.isInteger)&&e.x>=0&&e.y>=0&&e.h>=1&&b.includes(e.w)&&e.x+e.w<=12}function keptStatics(e){let t=[],n=/* @__PURE__ */ new Set;for(let r of inReadingOrder$1(e.filter(e=>e.static===!0)))isValidStatic(r)&&firstCollision(r,t)===void 0?t.push(r):n.add(r.i);return e.map(e=>n.has(e.i)?{...e,static:!1}:e)}function boundedHeight(e,t){let n=t(e.i);if(e.static===!0||n.height!==`flexible`)return e;let r=clampHeight(e.h,n);return r===e.h?e:{...e,h:r}}function repairPageGrid(e,t){let n=[],r=keptStatics(e).map(e=>{let r=boundedHeight(e,t);return r!==e&&n.push({name:e.i,kind:`height`,from:positionOf(e),to:positionOf(r)}),r}).map(e=>{if(e.static===!0)return e;let r=snapCell(e,t);return samePosition(e,r)||n.push({name:e.i,kind:`width`,from:positionOf(e),to:positionOf(r)}),r}),i=pushApart(r);i.forEach((e,t)=>{let i=r[t];i!==void 0&&!samePosition(i,e)&&n.push({name:e.i,kind:`pushed`,from:positionOf(i),to:positionOf(e)})});let a=packLayout(i),o=keptFill(a,t);for(let e of inReadingOrder$1(a))e.i!==o&&t(e.i).height===`fill`&&n.push({name:e.i,kind:`fill`});return{cells:a,repairs:n}}function keptFill(e,t){return inReadingOrder$1(e).find(e=>e.static!==!0&&t(e.i).height===`fill`)?.i}function firstFreeSlot(e,t,n){let r=t.reduce((e,t)=>Math.max(e,bottomOf(t)),0);for(let i=n;i<=r;i+=1)for(let n=0;n+e.w<=6;n+=1)if(firstCollision({x:n,y:i,...e},t)===void 0)return{x:n,y:i};return{x:0,y:r}}function deriveLayout6(e,t){let n=[];for(let r of inReadingOrder$1(e)){let e=Math.min(6,Math.max(t(r.i).minWidth,Math.ceil(r.w/2))),i=n.at(-1)?.y??0;n.push({i:r.i,...firstFreeSlot({w:e,h:r.h},n,i),w:e,h:r.h})}return n}function figureSlot(e,t,n){for(let r of inReadingOrder$1(e.filter(e=>n.has(e.i)))){let n={x:r.x+r.w,y:r.y,...t};if(n.x+n.w<=12&&firstCollision(n,e)===void 0)return n}}function placeNew(e,t,n,r){let i={w:snapWidth(n.size.w,0,n.minWidth),h:Math.max(1,n.size.h)};return n.figure?{i:t,...figureSlot(e,i,r)??{x:0,y:0,...i}}:{i:t,x:0,y:e.reduce((e,t)=>Math.max(e,bottomOf(t)),0),...i}}function spanContent(e,t){if(!b.includes(t)){let e=`A block spans ${b.join(`, `)} columns, not ${String(t)}`;throw new N(e,[{path:[`content`,`span`],message:e}])}return{content:e,span:t}}function configureContent(e,t){try{return typeof e==`object`&&e&&`build`in e&&typeof e.build==`function`?{configuration:validateContentConfiguration(e.build(),t),extension:e.extension}:{configuration:validateContentConfiguration(e,t)}}catch(e){throw e instanceof N?new N(e.message,e.errors.map(e=>({...e,path:e.path[0]===`content`?[...t,...e.path.slice(1)]:e.path}))):e}}function storedQuery(e,t){let n=[`search`,`offset`].filter(t=>e.state[t]!==void 0);if(n.length>0)throw new N(`A ${t} cannot keep a query's ${n.join(` or `)}`,n.map(e=>({path:[t,e],message:`A ${t} stores no ${e}; use filters and limit instead`})));return e.toDefinition()}function checkInputs(e,t){for(let[n,r]of Object.entries(t)){let t=e.inputs[n];r!==void 0&&t!==void 0&&D({parameters:t.schema},r,[`content`,`parameters`,n])}return t}var BlockContentBuilder=class{constructor(e,t,n){this.extension=e,this.parameters=t,this.heightMode=n}copy(e,t){let n=this.constructor;return new n(this.extension,e,t)}with(e){let t={...this.parameters};for(let[n,r]of Object.entries(e))r===void 0?delete t[n]:t[n]=r;return checkInputs(this.extension,e),this.copy(t,this.heightMode)}height(e){return this.copy(this.parameters,e)}build(){let e={type:`custom`,extension:this.extension.name,parameters:cloneBuilderValue(this.parameters,[`content`,`parameters`]),...this.heightMode===void 0?{}:{height:this.heightMode}};return validateContentConfiguration(e,[`content`]),D(this.extension,e.parameters,[`content`,`parameters`]),e}span(e){return spanContent(this,e)}},Measures=class{count(){return this.measured(`count`)}sum(e){return this.measured(`sum`,e)}avg(e){return this.measured(`avg`,e)}min(e){return this.measured(`min`,e)}max(e){return this.measured(`max`,e)}};function measure(e,t,n){return{query:e,measure:t,...n===void 0?{}:{attribute:n}}}var MetricBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}trend(e,t){return this.with({trend:e,trendBucket:t})}compare(e,t){return this.with({compare:e,period:t})}target(e){return this.with({target:e})}},MetricQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new MetricBuilder(Ot,checkInputs(Ot,measure(this.query,e,t)))}};function groupBy(e){return typeof e==`string`?[e,void 0]:[e.attribute,e.bucket]}var ChartBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}by(e){let[t,n]=groupBy(e);return this.with({by:t,byBucket:n})}by2(e){let[t,n]=groupBy(e);return this.with({by2:t,by2Bucket:n})}kind(e){return this.with({kind:e})}bar(){return this.kind(`bar`)}horizontalBar(){return this.kind(`horizontal_bar`)}line(){return this.kind(`line`)}area(){return this.kind(`area`)}donut(){return this.kind(`donut`)}funnel(){return this.kind(`funnel`)}treemap(){return this.kind(`treemap`)}calendar(){return this.kind(`calendar`)}},ChartQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new ChartBuilder(mt,checkInputs(mt,{...measure(this.query,e,t),kind:`bar`}))}};const _d={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:_d[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new N(e,[{path:[`content`,`parameters`,`next`],message:e}])}return this.with({next:t})}yearly(){return this.with({yearly:!0})}},CardBuilder=class extends BlockContentBuilder{fields(...e){return this.with({fields:e})}record(e){return this.with({record:e})}},DecisionsBuilder=class extends BlockContentBuilder{kinds(...e){return this.with({kinds:e})}limit(e){return this.with({limit:e})}},MeetingsUpcomingBuilder=class extends BlockContentBuilder{limit(e){return this.with({limit:e})}},MailboxBuilder=class extends BlockContentBuilder{category(e){return this.with({category:e})}important(){return this.with({important:!0})}unread(){return this.with({unread:!0})}limit(e){return this.with({limit:e})}label(e){return this.with({label:e})}};function metric(e){return new MetricQuery(storedQuery(e,`metric`))}function chart(e){return new ChartQuery(storedQuery(e,`chart`))}function agenda(e,t){return new AgendaBuilder(y,checkInputs(y,{query:storedQuery(e,`agenda`),attribute:t}))}function card(e){let t=e===void 0||typeof e==`string`?e:e.build().name;return new CardBuilder(pt,t===void 0?{}:checkInputs(pt,{object:t}))}function text$1(e){return new BlockContentBuilder(S,checkInputs(S,{markdown:e}))}function decisions(){return new DecisionsBuilder(vt,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(Dt,{})}function mailbox(){return new MailboxBuilder(Tt,{})}function isSpanned(e){return typeof e==`object`&&!!e&&`span`in e&&`content`in e}function total(e){return e.reduce((e,t)=>e+t,0)}function spread(e){return e.length===0?0:Math.max(...e)-Math.min(...e)}function betterSplit(e,t){let n=total(e)-total(t);if(n!==0)return n>0;let r=spread(t)-spread(e);if(r!==0)return r>0;let i=e.findIndex((e,n)=>e!==t[n]);return i!==-1&&(e[i]??0)>(t[i]??0)}function splitColumns(e,t){let n=[...t];function visit(r,i){let a=t[r.length];if(a===void 0)betterSplit(r,n)&&(n=r);else for(let t of b)t>=a&&i+t<=e&&visit([...r,t],i+t)}return visit([],0),n}function rowWidths(e,t){let n=e.filter(e=>e.span===void 0);n.length>4&&reject(t,`A row holds at most 4 unsized blocks`);let r=total(e.map(e=>e.span??e.minWidth));r>12&&reject(t,`Blocks ${e.map(e=>`"${e.key}"`).join(`, `)} do not fit one row: they need at least ${r} of 12 columns`);let i=splitColumns(12-total(e.map(e=>e.span??0)),n.map(e=>e.minWidth)),a=0;return e.map(e=>{if(e.span!==void 0)return e.span;let t=i[a]??e.minWidth;return a+=1,t})}function reject(e,t){throw new N(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return dr(e,C,new Map(t.map(e=>[e.name,e])))}function headingNames(e){let t=new Set(e.flatMap(e=>e.kind===`heading`?e.meta.name===void 0?[]:[e.meta.name]:[...Object.keys(e.blocks),...e.group?.name===void 0?[]:[e.group.name]]));return e.flatMap(e=>{if(e.kind!==`heading`)return[];if(e.meta.name!==void 0)return[e.meta.name];let n=nameSlug(e.title,40),r=n===``?`heading`:`heading_${n}`,i=r;for(let e=2;t.has(i);e+=1)i=`${r}_${e}`;return t.add(i),[i]})}function headingEntry(e,t,n){let r={title:t,...n.description===void 0?{}:{description:n.description},...n.icon===void 0?{}:{icon:n.icon}};return{key:e,content:new BlockContentBuilder(St,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=zn(e.length);return(i!==void 0||r===void 0)&&reject(n,String(i)),{type:`group`,name:t.name??`group_${r}`,placement:`grid`,...t.label===void 0?{}:{label:t.label},members:e.map(e=>e.name)}}function requirePlacement(e,t,n,r,i){if(e.type===`page`&&reject(i,`Content "${n}" cannot reference a page from a page`),Ir(e,t,n,r,i),e.type!==`custom`)return;let a=t?.refine?.(e.parameters??{},r);a&&reject([...i,`parameters`,a.input],a.message)}var Y=class PageBuilder{constructor(e){this.kind=`view`,this.data=e}icon(e){return new PageBuilder({...this.data,icon:e})}description(e){return new PageBuilder({...this.data,description:e})}home(){return new PageBuilder({...this.data,home:!0})}for(e){let t=typeof e==`string`?e:e.build().name;return new PageBuilder({...this.data,object:t})}row(e,t={}){let n=t.group===void 0?{kind:`row`,blocks:e}:{kind:`row`,blocks:e,group:t.group};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}heading(e,t={}){let n={kind:`heading`,title:e,meta:t};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}build(){let e=[`views`,`0`],{name:t,label:n,object:r,icon:i,description:a,home:o,sections:s}=this.data;requireBuilderName(t,[...e,`name`]),r!==void 0&&requireBuilderName(r,[...e,`object`]),o&&r!==void 0&&reject([...e,`home`],`Only a standalone page can be the home`),s.every(e=>e.kind===`row`&&Object.keys(e.blocks).length===0)&&reject([...e,`contents`],`A page declares at least one block`);let c=r===void 0?`page`:`record`,l=[],u=[],d=headingNames(s),f=0;for(let t of s){let n=[...e,`contents`,String(l.length)],r=(t.kind===`heading`?[headingEntry(d[f++]??``,t.title,t.meta)]:Object.entries(t.blocks).map(([e,t])=>isSpanned(t)?{key:e,content:t.content,span:t.span}:{key:e,content:t,span:void 0})).map(t=>{let n=[...e,`contents`,String(l.length)];requireBuilderName(t.key,[...n,`name`]);let{configuration:r,extension:i}=configureContent(t.content,n);requirePlacement(r,i,t.key,c,n);let a={...r,name:t.key,placement:`grid`};return l.push(a),{content:a,span:t.span}}),i=rowWidths(r.map(({content:e,span:t})=>({key:e.name,...t===void 0?{}:{span:t},minWidth:traitsOf(e).minWidth})),n),a=u.reduce((e,t)=>Math.max(e,t.y+t.h),0);if(t.kind===`row`&&t.group!==void 0){let e=groupOf(r.map(({content:e})=>e),t.group,n);l.push(e),u.push({i:e.name,x:0,y:a,w:12,h:traitsOf(e,l).size.h});continue}let o=0;r.forEach(({content:e},t)=>{let n=i[t]??0;u.push({i:e.name,x:o,y:a,w:n,h:traitsOf(e).size.h}),o+=n})}let p=Object.fromEntries(packLayout(u).map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),m={name:t,label:n,...r===void 0?{}:{object:r},context:`page`,...i===void 0?{}:{icon:i},...a===void 0?{}:{description:a},...o?{home:!0}:{},contents:l,grid:p},ee=w.safeParse(m);if(!ee.success)throw N.fromZodErrors(ee.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return{kind:`view`,definition:cloneBuilderValue(m,e)}}};function page(e,t){return new Y({name:e,label:t,object:void 0,sections:[]})}var X=class ViewBuilder{constructor(e,t=[]){this.kind=`view`,this.data=cloneBuilderValue(e,[`views`,`0`]),this.extensions=t.map(e=>e&&{...e})}for(e){let t=typeof e==`string`?e:e.build().name;return new ViewBuilder({...this.data,object:t},this.extensions)}default(){return new ViewBuilder({...this.data,default:!0},this.extensions)}description(e){return new ViewBuilder({...this.data,description:e},this.extensions)}icon(e){return new ViewBuilder({...this.data,icon:e},this.extensions)}place(e,t,n,r,i){let{configuration:a,extension:o}=configureContent(n,[`views`,`0`,`contents`,String(this.data.contents.length)]),s={...a,name:e,label:t,placement:r},c=[...this.data.contents,s],l=i===void 0?{}:{anchors:{...this.data.anchors,[e]:{after:i}}};return new ViewBuilder({...this.data,...l,contents:c},[...this.extensions,o])}tab(e,t,n,r){return this.place(e,t,n,`main`,r?.after)}aside(e,t,n){return this.place(e,t,n,`aside`)}build(){let e=[`views`,`0`];requireBuilderName(this.data.name,[...e,`name`]),requireBuilderName(this.data.object,[...e,`object`]);let t=w.safeParse(this.data);if(!t.success)throw N.fromZodErrors(t.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return this.data.contents.forEach((t,n)=>{let r=[...e,`contents`,String(n)];requireBuilderName(t.name,[...r,`name`]),t.type===`form`&&t.groups.forEach((e,t)=>requireBuilderName(e.name,[...r,`groups`,String(t),`name`])),Ir(t,this.extensions[n],t.name,this.data.context,r)}),{kind:`view`,definition:cloneBuilderValue(this.data,e)}}};function detailView(e,t){return new X({name:e,label:t,object:void 0,context:`record`,contents:[]})}function listView(e,t){return new X({name:e,label:t,object:void 0,context:`collection`,contents:[]})}function isViewPiece(e){return`kind`in e&&e.kind===`view`}function isObjectPiece(e){return!(isViewPiece(e)||e instanceof P)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new N(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof P||typeof e.build==`function`)return;let n=e.name;throw new N(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof Y||e instanceof X?e.build():e}function isPage(e){return e.definition.context===`page`}function validateView(e){let t=w.safeParse(e);if(t.success)return t.data;let n=typeof e==`object`&&e&&`name`in e?String(e.name):`(unnamed)`,r=N.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new N(`View "${n}" is invalid. ${r.message}`,r.errors)}function identityOf(e){return`${e.object??``}:${e.name}`}function assertUniqueIdentities(e,t){let n=/* @__PURE__ */ new Set;for(let r of t){let t=identityOf(r);if(n.has(t))throw new k(e,r.name);n.add(t)}}function byIdentity(e){return(t,n)=>{let r=identityOf(e(t)),i=identityOf(e(n));return r<i?-1:+(r>i)}}async function hashBundlePieces(e){return sha256Hex(r({objects:[...e.objects].sort(byIdentity(e=>({name:e.name}))),views:[...e.views].sort(byIdentity(e=>e)),pages:[...e.pages].sort(byIdentity(e=>e.definition)),agents:[...e.agents].sort(byIdentity(e=>({name:e.name})))}))}const vd={title:120,why:200,prompt:Fa};function assertSetupWithinLimits(e){let t=Object.keys(vd).flatMap(t=>{let n=vd[t],r=e[t];return r!==void 0&&r.length>n?[{path:[`setup`,t],message:`Setup ${t} must be at most ${n} characters`}]:[]});if(t.length>0)throw new N(`Bundle setup is invalid`,t)}function assertSetup(e,t){e&&assertSetupWithinLimits(e);for(let e of Object.values(t))assertSetupWithinLimits({title:e[`setup.title`],why:e[`setup.why`],prompt:e[`setup.prompt`]})}function assertSkills(e){let t=/* @__PURE__ */ new Set,n=e.flatMap(e=>{let n=skillProblem(e,t);return n===null?[]:[{path:[`skills`],message:n}]});if(n.length>0)throw new N(`Bundle skills are invalid`,n)}function skillProblem(e,t){let n;try{n=parseSkillSource(e)}catch(t){return t instanceof Error?t.message:`Invalid skill source "${e}"`}return n.owner!==G.owner||n.repo!==G.repo?`Skill "${e}" must come from ${G.owner}/${G.repo}`:n.ref===null?t.has(n.skill)?`Skill "${e}" is declared twice`:(t.add(n.skill),null):`Skill "${e}" cannot pin a ref`}async function builtBundleFromPieces(e){let t=e.name===J;t||assertBundleName(e.name);let{objects:n,pages:r,agents:i}=e,a=e.views.map(validateView),o=n.map(e=>e.name);if(assertUniqueIdentities(`object`,o.map(e=>({name:e}))),assertUniqueIdentities(`view`,a),assertUniqueIdentities(`page`,r.map(e=>e.definition)),assertUniqueIdentities(`agent`,i.map(e=>({name:e.name}))),!t){let e=o.find(v);if(e!==void 0)throw new A(e,`bundle`)}let{setup:s}=e,c=e.translations??{};assertSetup(s,c);let l=e.skills??[];return assertSkills(l),{name:e.name,label:e.label.trim(),description:e.description??null,hash:await hashBundlePieces({objects:n,views:a,pages:r,agents:i}),objects:n,views:a,pages:r,agents:i,uses:e.uses??[],samples:e.samples??[],...s?{setup:s}:{},...l.length>0?{skills:l}:{},translations:c}}const yd=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[yd]===!0}var BundleBuilder=class{constructor(e,t){this[yd]=!0,this.pieces=[],this.used=[],this.descriptionText=null,this.sampleRecords=[],this.skillSources=[],this.translationTables={},this.built=null,assertBundleName(e),this.name=e,this.label=t,this.objectBuilders=[]}description(e){return this.descriptionText=e,this.changed()}add(...e){return this.pieces.push(...e),this.objectBuilders.push(...e.filter(isObjectPiece)),this.changed(),this}uses(...e){return this.used.push(...e),this.changed()}samples(e){return this.sampleRecords=e,this.changed()}setup(e){return this.setupInvitation=e,this.changed()}skills(...e){return this.skillSources=[...this.skillSources,...e],this.changed()}translations(e,t){return this.translationTables[e]=t,this.changed()}build(){return this.built??=this.assemble(),this.built}changed(){return this.built=null,this}async assemble(){let e=[],t=[],n=[],r=[];for(let[i,a]of this.pieces.entries())if(assertPiece(a,i),a instanceof P)r.push(a.build());else if(isViewPiece(a)){let e=declarationOf$1(a);isPage(e)?n.push(e):t.push(e.definition)}else e.push(a.build());return this.assertNotInUsed(e),builtBundleFromPieces({name:this.name,label:this.label,description:this.descriptionText,objects:e,views:t,pages:n,agents:r,uses:this.used.map(e=>e.name),samples:this.sampleRecords,...this.setupInvitation?{setup:this.setupInvitation}:{},skills:this.skillSources,translations:{...this.translationTables}})}assertNotInUsed(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set([this]),visit=e=>{if(!n.has(e)){n.add(e);for(let n of e.objectBuilders){let r=n.build().name;t.has(r)||t.set(r,e.name)}for(let t of e.used)visit(t)}};for(let e of this.used)visit(e);for(let{name:n}of e){let e=t.get(n);if(e!==void 0)throw new k(`object`,n,`Object "${n}" is declared by bundle "${this.name}" and by its used bundle "${e}"`)}}};function bundle(e,t){return new BundleBuilder(e,t)}function readOnlyOption(e){return e?.readOnly===void 0?{}:{readOnly:e.readOnly}}function buildFreeFieldRef(e,t){return{type:`free`,attribute:e.build(),label:t?.label,required:t?.required,prefillExpression:t?.prefillExpression,...readOnlyOption(t)}}function buildSlotFieldRef(e,t,n){let[r,...i]=Array.isArray(e)?e:[e];return{type:`slot`,slotId:r,additionalSlotIds:i.length>0?i:void 0,attribute:t,label:n?.label,required:n?.required,tooltip:n?.tooltip,...readOnlyOption(n)}}const bd=F.boolean().optional();var FormRowBuilder=class{constructor(e,t,n){this._finalized=!1,this.stepBuilder=e,this.rowData={id:t,order:n,type:`fields`,fields:[]}}field(e,t,n){return this.rowData.fields.push(buildSlotFieldRef(e,t,n)),this}freeField(e,t){return this.rowData.fields.push(buildFreeFieldRef(e,t)),this}row(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).row(e)}heading(e,t){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).heading(e,t)}separator(){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).separator()}text(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).text(e)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData))}},FormStepBuilder=class{constructor(e,t,n){this.rowOrder=0,this.formBuilder=e,this.stepData={id:t,label:n,rows:[]}}description(e){return this.stepData.description=e,this}field(e,t,n){this.rowOrder++;let r=`row-${this.stepData.id}-${this.rowOrder}`,i=buildSlotFieldRef(e,t,n),a={id:r,order:this.rowOrder,type:`fields`,fields:[i]};return this.stepData.rows.push(a),this}freeField(e,t){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,r=buildFreeFieldRef(e,t),i={id:n,order:this.rowOrder,type:`fields`,fields:[r]};return this.stepData.rows.push(i),this}row(e){return this.rowOrder++,new FormRowBuilder(this,e,this.rowOrder)}heading(e,t){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`heading`,content:e,level:t};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let e={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`separator`};return this.stepData.rows.push(e),this}text(e){this.rowOrder++;let t={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`text`,content:e};return this.stepData.rows.push(t),this}step(e,t){return this.formBuilder._finalizeStep(this.stepData).step(e,t)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(e){return e.fields.length>0&&this.stepData.rows.push(e),this}_getData(){return this.stepData}},FormBuilder=class{constructor(e,t){this.data={slots:[],steps:[],status:`draft`,version:1},this.validateName(e),this.data.name=e,this.data.label=t}description(e){return this.data.description=e,this}icon(e){return this.data.icon=e,this}status(e){return this.data.status=e,this}metadata(e){return this.data.metadata=e,this}slot(e,t,n){if(this.data.slots.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate slot id: "${e}"`);let r={id:e,objectName:t,label:n.label,mode:n.mode??`create`,color:n.color,icon:n.icon};return this.data.slots.push(r),this}step(e,t){if(this.data.steps.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate step id: "${e}"`);return new FormStepBuilder(this,e,t)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.validateReadOnly(),this.data}_finalizeStep(e){return this.data.steps.push(e),this}validateName(e){let t=F.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{t.parse(e)}catch(e){throw e instanceof F.ZodError?Error(`[FormBuilder] ${e.issues[0].message}`):e}}validateRequiredData(){if(this.data.slots.length===0)throw Error(`[FormBuilder] At least one slot is required. Use .slot() to add slots.`);if(this.data.steps.length===0)throw Error(`[FormBuilder] At least one step is required. Use .step() to add steps.`)}validateSlotReferences(){let e=new Map(this.data.slots.map(e=>[e.id,e.objectName]));for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(r.type!==`slot`)continue;let n=getSlotFieldTargets(r);for(let r of n)if(!e.has(r))throw Error(`[FormBuilder] Step "${t.id}" references unknown slot "${r}". Declare it with .slot("${r}", ...) first.`);let i=new Set(n.map(t=>e.get(t)));if(i.size>1)throw Error(`[FormBuilder] Step "${t.id}" field on attribute "${r.attribute}" targets slots of different objects (${[...i].join(`, `)}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let e=[...z,`join`,`where`];for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(!isFormFreeFieldRef(r)||!r.prefillExpression)continue;let n=r.prefillExpression,i=`prefillExpression on free field "${r.attribute.name}" in step "${t.id}"`;if(!isLabelExpression(n))throw Error(`[FormBuilder] ${i} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(n))throw Error(`[FormBuilder] ${i} contains empty {{ }} interpolation.`);for(let a of n.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?:\s*:[^|}]*)?/g)){let n=a[1];if(!e.includes(n))throw Error(`[FormBuilder] ${i} uses invalid pipe "${n}". Valid pipes: ${e.join(`, `)}`);let o=a[0].replace(/^\|/,``);if(isWherePipe(o)&&!parseWherePipe(o))throw new N(`[FormBuilder] ${i} has a malformed where: pipe "${o.trim()}". Write where:property=value or where:property in (a,b).`,[{path:[t.id,r.attribute.name,`prefillExpression`],message:`Malformed where: pipe`}])}}}validateReadOnly(){for(let e of this.data.steps)for(let t of e.rows)if(isFormFieldsRow(t))for(let n of t.fields){if(bd.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new N(`[FormBuilder] readOnly on ${r} "${t}" in step "${e.id}" must be a boolean.`,[{path:[e.id,t,`readOnly`],message:`Expected a boolean`}])}}validateFreeFields(){let e=new Set(L);for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n)){for(let r of n.fields)if(isFormFreeFieldRef(r)){let n=r.attribute.type;if(e.has(n))throw Error(`[FormBuilder] Free field in step "${t.id}" uses forbidden attribute type "${n}". Forbidden types: ${L.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const xd=`box`,Sd=[`circle`,`square`],Cd=[`upload`,`website`,`name`,`email`];function isImageSource(e){return Cd.some(t=>t===e)}const wd={object:[`icon`,`color`],record:[`icon`,`image`],emailCategory:[`icon`,`color`],option:[`color`],view:[`icon`],agent:[`color`],user:[`image`]};function imageFileIdOf(e){return`image`in e?e.image?.fileId:`imageFileId`in e?e.imageFileId:void 0}function resolveAppearance(e,t){let n=imageFileIdOf(e);if(n)return{kind:`image`,imageFileId:n,shape:t?.image?.shape??`square`};let r=t?.name??e.name,i=e.color??t?.color??(r?tu(r):void 0),a=e.icon??t?.icon??`box`;return i?{kind:`tile`,icon:a,color:i}:{kind:`glyph`,icon:a}}const Td=F.object({shape:F.enum(Sd),from:F.array(F.string().refine(e=>e.trim().length>0,`Must not be blank`)).optional()}).strict();function imageLookupKindOf(e){return e.type===`text`?e.format===`url`?`website`:e.format===`email`?`email`:`name`:null}function validateObjectImage(e){let t=e.image?.from;if(t===void 0)return;let refuse=(t,n)=>{throw new N(`Object "${e.name}": ${t}`,[{path:n===void 0?[`image`,`from`]:[`image`,`from`,String(n)],message:t}])};t.length===0&&refuse(`image.from must name at least one attribute`);let n=new Map((e.attributes??[]).map(e=>[e.name,e])),r=/* @__PURE__ */ new Set;for(let[e,i]of t.entries()){r.has(i)&&refuse(`image.from names "${i}" twice`,e),r.add(i);let t=n.get(i);t?imageLookupKindOf(t)===null&&refuse(`image.from names "${i}", a ${t.type} attribute: only text attributes can locate an image`,e):refuse(`image.from names "${i}", which is not one of its attributes`,e)}}function validateObjectExpressions(e){let{name:t,labelExpression:n,embeddingExpression:r}=e;if(!n)throw new j(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,M.VALIDATION_FAILED);let i=B.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new j(`Invalid labelExpression for "${t}": ${e}`,M.VALIDATION_FAILED)}if(r!==void 0){let e=B.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new j(`Invalid embeddingExpression for "${t}": ${n}`,M.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(un(this.build()))}constructor(e,t){this._sealed=!1,this._toleratedAttributes=[],this.validateName(e),this.obj={name:e,label:t,attributes:[],system:!0}}id(e){return this.obj.id=e,this}description(e){return this.obj.description=e,this}pluralLabel(e){return this._pluralLabel=e,this}icon(e){return this.obj.icon=e,this}color(e){return this.obj.color=e,this}image(e={}){return this.obj.image={shape:e.shape??`square`,...e.from===void 0?{}:{from:[...e.from]}},this}runtime(){return this.obj.system=!1,this}sealed(){return this._sealed=!0,this}tolerate(e){return this._toleratedAttributes=[...this._toleratedAttributes,...e],this}attribute(e){return this.pushAttributes([e]),this}attributes(e){return this.pushAttributes(e),this}pushAttributes(e){let t=e.map(e=>`build`in e&&typeof e.build==`function`?e.build():e);Re([...this.obj.attributes,...t],e=>e.name,e=>new k(`attribute`,e,`Object "${this.obj.name}": duplicate attribute name "${e}"`)),this.obj.attributes.push(...t)}metadata(e){return this.obj.metadata={...this.obj.metadata,...e},this}order(e){return this.obj.metadata={...this.obj.metadata,order:e},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:!0},this}labelExpression(e){return this._labelExpression=e,this}embeddingExpression(e){return this._embeddingExpression=e,this}documentLayout(e){if(e.presets)for(let t of e.presets)validatePresetStructure(t.id,t.structure,1);return this.obj.documentLayout=e,this}hierarchical(){return this.obj.hierarchical=!0,this}build(){if(!this.obj.name)throw new N(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new N(`[ObjectBuilder] Missing required field: label`,[{path:[`label`],message:`label is required`}]);return validateObjectExpressions({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression}),validateObjectImage({name:this.obj.name,image:this.obj.image,attributes:this.obj.attributes}),{...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(e){e!==void 0&&it(e)}};function object(e,t){if(v(e))throw new A(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new N(t,[{path:[`documentLayout`,`presets`,e],message:n}])};n>5&&fail(`Preset structure exceeds max depth of 5`,`Preset structure too deep`);let r=/* @__PURE__ */ new Set;for(let i of t){let t=i.title.trim();t.length===0&&fail(`Folder preset node title is required`,`Empty folder title`),t.includes(`/`)&&fail(`Folder preset node title cannot contain /`,`Folder title contains /: "${t}"`),r.has(t)&&fail(`Folder preset sibling titles must be unique`,`Duplicate folder title: "${t}"`),r.add(t),i.children&&i.children.length>0&&validatePresetStructure(e,i.children,n+1)}}function relationProperty(e){return requireBuilderName(e,[`relationProperty`]),{relationProperty:e}}var Z=class ContentBuilder{constructor(e,t){this.data=cloneBuilderValue(e,[`content`]),this.extension=t===void 0?void 0:Object.freeze({name:t.name,contexts:t.contexts,parameters:t.parameters,refine:t.refine})}set(e){return new ContentBuilder({...this.data,...e},this.extension)}icon(e){return this.set({icon:e})}object(e){return this.set({objectName:e})}layout(e){let{layout:t,groupByAttribute:n,columnSizing:r,kanbanColumnOrder:i,kanbanColumnVisibility:a,kanbanPinnedColumns:o,...s}={...this.data,layout:void 0,groupByAttribute:void 0,columnSizing:void 0,kanbanColumnOrder:void 0,kanbanColumnVisibility:void 0,kanbanPinnedColumns:void 0};return new ContentBuilder({...s,...e},this.extension)}table(){return this.layout({layout:`table`})}list(){return this.layout({layout:`list`})}kanban(e){return this.layout({layout:`kanban`,groupByAttribute:e})}columns(...e){return this.set({columns:e})}actions(...e){return this.set({actions:e})}openMode(e){return this.set({openMode:e})}createMode(e){return this.set({createMode:e})}visibility(e){return this.set({visibility:e})}descriptionAttribute(e){return this.set({descriptionAttribute:e})}displayAttributes(...e){return this.set({displayAttributes:e})}columnSizing(e){return this.set({columnSizing:e})}kanbanColumnOrder(...e){return this.set({kanbanColumnOrder:e})}kanbanColumnVisibility(e){return this.set({kanbanColumnVisibility:e})}kanbanPinnedColumns(...e){return this.set({kanbanPinnedColumns:e})}formColumns(e){return this.set({formColumns:e})}density(e){return this.set({density:e})}titleAttribute(e){return this.set({titleAttribute:e})}allowUpload(e){return this.set({allowUpload:e})}allowRemove(e){return this.set({allowRemove:e})}hideAttachments(e){return this.set({hideAttachments:e})}relations(...e){return this.set({relations:e})}span(e){return spanContent(this,e)}height(e){return this.set({height:e})}build(){let e=validateLiteralContent(this.data,[`content`]);return this.extension&&e.type===`custom`&&D(this.extension,e.parameters,[`content`,`parameters`]),e}},Ed=class GroupBuilder{constructor(e,t,n,r={}){this.data=cloneBuilderValue({name:e,label:t,fields:n,...r},[`group`])}field(e,t){let{name:n,label:r,fields:i,...a}=this.data;return new GroupBuilder(n,r,[...i,{attribute:e,...t}],a)}fields(...e){let{name:t,label:n,fields:r,...i}=this.data;return new GroupBuilder(t,n,[...r,...e.map(e=>({attribute:e}))],i)}description(e){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),description:e})}collapsible(e=!1){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),collapsible:!0,collapsed:e})}alwaysOpen(){let{collapsed:e,...t}=this.presentation();return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...t,collapsible:!1})}presentation(){let{name:e,label:t,fields:n,...r}=this.data;return r}build(){requireBuilderName(this.data.name,[`group`,`name`]);try{validateLiteralContent({type:`form`,groups:[this.data]},[`group`])}catch(e){throw e instanceof N?new N(e.message,e.errors.map(e=>({...e,path:e.path[1]===`groups`?[`group`,...e.path.slice(3)]:e.path}))):e}return cloneBuilderValue(this.data,[`group`])}};function group(e,t){return new Ed(e,t,[])}function collection(e){return new Z({type:`collection`,...storedQuery(e,`collection`)})}function form$1(...e){return new Z({type:`form`,groups:e.map(e=>`build`in e?e.build():e)})}function activity(){return new Z({type:`activity`})}function richtext$1(e){return new Z({type:`richtext`,attribute:e})}function documents(){return new Z({type:`documents`})}function forms(){return new Z({type:`forms`})}function emails(...e){return new Z({type:`emails`,emailAttributes:e})}function meetings(...e){return new Z({type:`meetings`,emailAttributes:e})}function custom(e,t){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw new N(`Expected registered extension declaration`,[{path:[`content`,`extension`],message:`Expected registered extension declaration`}]);let n=validateContentConfiguration({type:`custom`,extension:e.name,parameters:t},[`content`]);if(n.type!==`custom`)throw new N(`Expected custom content`,[]);let r=new Z({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[x.name,x.label,custom(Ft,{}).icon(x.icon)]}function page$1(e){let{object:t,name:n}=e.definition;if(typeof t!=`string`){let e=`Page "${n}" is standalone; a record tab renders a record page (\`page(...).for(object)\`)`;throw new N(e,[{path:[`content`,`page`,`object`],message:e}])}return new Z({type:`page`,page:{object:t,name:n}})}const Dd={collection,metric,chart,agenda,card,text:text$1,decisions,meetingsUpcoming,mailbox,page:page$1,form:form$1,activity,richtext:richtext$1,documents,forms,emails,meetings,custom};function contentDefinition(e,t){if(t.suppressed)return null;let n=t.workspaceDefinition??t.sourceDefinition;return n===null?null:{...structuredClone(n),name:e}}function storedContentDefinition(e){let{name:t,...n}=e;return structuredClone(n)}function workspaceViewAuthoring(e,t={}){let n={main:0,aside:0};return{origin:`runtime`,mainOrderCustomized:!1,asideOrderCustomized:!1,gridCustomized:Object.keys(t).length>0,homeCustomized:!1,contents:Object.fromEntries(e.map(e=>[e.name,{sourceDefinition:null,workspaceDefinition:storedContentDefinition(e),suppressed:!1,sourcePosition:null,workspacePosition:e.placement===`grid`?null:n[e.placement]++,sourceGrid:null,workspaceGrid:t[e.name]??null}]))}}function byKind(e,t){let rank=e=>Number(e.definition.type===`group`);return rank(e)-rank(t)||e.name.localeCompare(t.name)}function inReadingOrder(e){return(t,n)=>{let r=e(t.name),i=e(n.name);return r===null||i===null?r===i?byKind(t,n):r?-1:1:r.y-i.y||r.x-i.x||byKind(t,n)}}function overLimit(e,t){let n=/* @__PURE__ */ new Set;if(e.length<=g.tabsPerView)return n;let r=new Map(e.map(e=>[e.name,e])),i=/* @__PURE__ */ new Map;for(let{name:t,definition:n}of e)if(n.type===`group`)for(let e of n.members)i.has(e)||i.set(e,t);let cellOf=e=>{let n=r.get(e),a=n?t(n.state):null;if(a!==null)return a;let o=r.get(i.get(e)??``);return o?t(o.state):null},a=e.filter(e=>e.state.sourceDefinition===null).sort(inReadingOrder(cellOf)).reverse();for(let t of a){if(e.length-n.size<=g.tabsPerView)break;if(n.has(t.name))continue;let i=t.definition.type===`group`?t.definition.members.flatMap(e=>{let t=r.get(e);return t&&t.definition.type!==`group`?[t]:[]}):[];if(!i.some(e=>e.state.sourceDefinition!==null))for(let e of[t,...i])n.add(e.name)}return n}function resolvePageGrid(e,t={}){let rawCell=t=>e.gridCustomized||t.sourceDefinition===null?t.workspaceGrid:t.sourceGrid,n=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{name:e,state:t,definition:n}]:[]}),r=E(n.map(e=>e.definition)),i=n.filter(e=>!r.has(e.name)).sort((e,t)=>e.name.localeCompare(t.name)),a=overLimit(i,rawCell),o=i.filter(e=>!a.has(e.name)),s=new Map(o.map(e=>[e.name,e.definition])),c=t.traitsOf??xr(s,C),l=Bn([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>br(t,e))?d[e]={...t}:f.push(e)};if(e.gridCustomized)for(let{name:e,state:t}of u)place(e,t.workspaceGrid);else{for(let{name:e,state:t}of u)t.sourceDefinition!==null&&place(e,t.sourceGrid);for(let{name:e,state:t}of u)t.sourceDefinition===null&&place(e,t.workspaceGrid)}let p=Math.max(0,...Object.values(d).map(e=>e.y+e.h));for(let t of f.sort()){let n=e.contents[t],{w:r,h:i}=n.workspaceGrid??n.sourceGrid??c(t).size;d[t]={x:0,y:p,w:r,h:i},p+=i}let m=repairPageGrid(Object.entries(d).map(([e,n])=>({i:e,...n,...t.statics?.has(e)?{static:!0}:{}})),c);return{grid:Object.fromEntries(m.cells.map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),repairs:[...[...a].map(e=>({name:e,kind:`dropped`})),...m.repairs]}}function droppedContents(e){return new Set(e.flatMap(e=>e.kind===`dropped`?[e.name]:[]))}function resolveViewContents(e){let t=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{definition:n,...t}]:[]}),n=[`main`,`aside`].flatMap(n=>{let r=n===`main`?e.mainOrderCustomized:e.asideOrderCustomized;return t.filter(e=>e.definition.placement===n).sort((e,t)=>{let n=r?e.workspacePosition:e.sourcePosition,i=r?t.workspacePosition:t.sourcePosition;if(n!==null&&i!==null&&n!==i)return n-i;if(n!==null&&i===null)return-1;if(i!==null&&n===null)return 1;let a=e.sourcePosition??e.workspacePosition,o=t.sourcePosition??t.workspacePosition;return a!==null&&o!==null&&a!==o?a-o:a!==null&&o===null?-1:o!==null&&a===null?1:e.definition.name.localeCompare(t.definition.name)}).map(e=>e.definition)}),r=E(t.map(e=>e.definition)),i=t.filter(e=>e.definition.placement===`grid`&&!r.has(e.definition.name)).map(e=>e.definition).sort((e,t)=>e.name.localeCompare(t.name));return[...n,...i]}const Od=[`record`,`document`,`file`,`email`,`thread`,`event`,`memory`,`skill`,`schema`,`user`,`guide`,`bundle`,`draft`,`decision`,`session`,`catalog`,`wake`],kd=/* @__PURE__ */ new Set([`memory`,`schema`,`wake`]),Ad=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function isReferenceKind(e){return Od.includes(e)}function refuse$1(e,t){return{ok:!1,reason:e,expected:t}}function parseReference(e){let t=e.trim();if(Ad.test(t))return refuse$1(`bare_uuid`,`record:<id>`);let n=t.indexOf(`:`);if(n===-1)return refuse$1(`malformed`,`<kind>:<id>`);let r=t.slice(0,n).toLowerCase();if(!isReferenceKind(r))return refuse$1(`unknown_kind`,`<kind>:<id> with kind one of ${Od.join(`, `)}`);let i=t.slice(n+1).trim();return i===``?refuse$1(`malformed`,`${r}:<id>`):r===`record`&&i.includes(`:`)?refuse$1(`legacy_mention`,`record:${i.slice(i.lastIndexOf(`:`)+1)}`):i===`*`&&!kd.has(r)?refuse$1(`malformed`,`${r}:<id>`):{ok:!0,ref:{kind:r,id:i}}}function formatReference(e){return`${e.kind}:${e.id}`}function isWildcard(e){return e.id===`*`&&kd.has(e.kind)}let jd;function unaccentRules(){if(jd)return jd;let e=/* @__PURE__ */ new Map;for(let t of`
3
3
  ¡!
4
4
  ©(C)
5
5
  «<<
@@ -1651,4 +1651,4 @@ import{NonJsonValueError as e,asTenantId as t,asUserId as n,canonicalStringify a
1651
1651
  🄨(Y)
1652
1652
  🄩(Z)
1653
1653
  `.split(`
1654
- `)){if(t===``)continue;let n=String.fromCodePoint(t.codePointAt(0)??0);e.set(n,t.slice(n.length))}return Md=e,e}function foldText(e){let t=unaccentRules(),n=``;for(let r of e)n+=t.get(r)??r;return n.toLowerCase()}function requestedCapabilities(e){let t=[];return e.canModify&&t.push(`modify`),e.canSend&&t.push(`send`),t}const Nd={status:`connector_status`,error:`connector_error`,provider:`connector_provider`,quota:`connector_quota`},Pd={phone:`text`,currency:`number`},Fd={rename:[`kind`,`object`,`from`,`to`],phone:[`kind`,`object`,`attribute`,`to`,`defaultCountryCode`],currency:[`kind`,`object`,`attribute`,`to`,`currencyCode`]};function refuse(e,t,n){throw new N(n,[{path:t===void 0?[`resolutions`,String(e)]:[`resolutions`,String(e),t],message:n}])}function assertKeys(e,t,n){for(let r of n)(typeof t[r]!=`string`||t[r]===``)&&refuse(e,r,`Resolution ${e} needs a non-empty string \`${r}\``);let r=Object.keys(t).find(e=>!n.includes(e));r!==void 0&&refuse(e,r,`Resolution ${e} has an unknown field \`${r}\``)}function assertResolution(e,t){if(Ze(t)||refuse(e,void 0,`Resolution ${e} must be an object`),t.kind===`rename`){assertKeys(e,t,Fd.rename),t.from===t.to&&refuse(e,`to`,`Resolution ${e} renames "${t.from}" to itself`);return}if(t.kind!==`retype`&&refuse(e,`kind`,`Unknown resolution kind ${JSON.stringify(t.kind)}: expected "rename" or "retype"`),t.to!==`phone`&&t.to!==`currency`&&refuse(e,`to`,`Unsupported retype to ${JSON.stringify(t.to)}: a push converts text → phone and number → currency only`),assertKeys(e,t,Fd[t.to]),t.to===`phone`){let n=t.defaultCountryCode;/^[A-Z]{3}$/.test(n)&&au(n)||refuse(e,`defaultCountryCode`,`Resolution ${e}: "${n}" is not an ISO 3166-1 alpha-3 country code`);return}let n=t.currencyCode;/^[A-Z]{3}$/.test(n)&&iu(n)||refuse(e,`currencyCode`,`Resolution ${e}: "${n}" is not a supported ISO 4217 currency code`)}function addressesOf(e){return e.kind===`rename`?{reads:e.from,lands:e.to}:{reads:e.attribute,lands:e.attribute}}function assertSchemaSourceResolutions(e){if(!Array.isArray(e))throw new N("`resolutions` must be an array",[{path:[`resolutions`],message:"`resolutions` must be an array"}]);if(e.length>100)throw new N(`A push carries ${e.length} resolutions; the limit is 100`,[]);let t=/* @__PURE__ */ new Set;for(let[n,r]of e.entries()){assertResolution(n,r);let{reads:e,lands:i}=addressesOf(r);for(let[a,o]of[[`${r.kind}:${r.object}.${e}`,`of "${r.object}.${e}"`],[`${r.kind}>${r.object}.${i}`,`onto "${r.object}.${i}"`]])t.has(a)&&refuse(n,void 0,`Resolution ${n} repeats a ${r.kind} ${o}`),t.add(a)}}function phoneFromText(e,t){let n=e.trim();if(n===``)return{value:null};let r=ou(n,Fn(t));if(!r?.isPossible()||r.country===void 0||r.ext!==void 0)return;let i=ru(r.country)?.iso3;if(i!==void 0)return{value:{countryCode:i,phoneNumber:vr(n,i)}}}function convertRetypedValue(e,t,n={}){if(t===null)return{value:null};if(e.to===`phone`)return typeof t==`string`?phoneFromText(t,e.defaultCountryCode):void 0;if(typeof t==`number`&&Math.abs(t)<=2**53-1&&!(t<0&&n.allowNegative!==!0))return{value:{code:e.currencyCode,value:t}}}const Q=F.string().refine(e=>e.trim().length>0,`Must not be blank`),Id=F.union([F.tuple([F.literal(`object`),Q]),F.tuple([F.literal(`attribute`),Q,Q]),F.tuple([F.literal(`view`),Q,Q]),F.tuple([F.literal(`content`),Q,Q,Q])]),Ld=F.object({label:Q,pluralLabel:F.string().optional(),description:F.string().optional(),icon:_.optional(),color:ze.optional(),image:Ed.optional(),labelExpression:F.string(),embeddingExpression:F.string().optional(),sealed:F.boolean().optional(),toleratedAttributes:F.array(Q).optional(),metadata:F.record(F.string(),F.unknown()).optional(),documentLayout:F.record(F.string(),F.unknown()).optional(),hierarchical:F.boolean().optional()}).strict();function failure(e){throw new N(e,[])}function definitionSchema(e){return F.custom(t=>{let n=F.record(F.string(),F.unknown()).parse(t);for(let t of e[0]===`view`?[`object`,`name`]:[`name`])Object.hasOwn(n,t)&&failure(`Invalid schema state: unrecognized definition key ${t}`);switch(e[0]){case`object`:Ld.parse(n);break;case`attribute`:{let e=F.enum(lt).parse(n.type);Mn(e).extend({type:F.literal(e),label:Q,required:F.boolean().optional(),unique:F.boolean().optional(),icon:_.optional()}).strict().parse(n);break}case`view`:{let{contents:t,...r}=n,i=F.array(Q).parse(t);new Set(i).size!==i.length&&failure(`Invalid schema state: duplicate content membership`),gn.parse({...r,object:e[1],name:e[2],contents:[]});break}case`content`:O.parse({...n,name:e[3]})}return!0})}function compareSchemaStateEntries(e,t){let n=JSON.stringify(e.address),r=JSON.stringify(t.address);return n<r?-1:+(n>r)}function schemaStateSourcePayload(e){return{modelVersion:1,hashVersion:1,entries:[...e].sort(compareSchemaStateEntries).filter(e=>e.source!==null).map(({address:e,source:t})=>({address:e,source:t}))}}function parseState(e){let t=F.record(F.string(),F.unknown()).parse(e);for(let[e,n]of[[`modelVersion`,`model`],[`hashVersion`,`hash`]])t[e]!==1&&failure(`Unsupported schema ${n} version: expected 1, received ${t[e]===void 0?`missing`:String(t[e])}`);let n=F.object({modelVersion:F.literal(1),hashVersion:F.literal(1),tenant:Q,sourceFingerprint:F.string().regex(/^[a-f0-9]{64}$/),entries:F.array(F.unknown())}).strict().safeParse(e);if(!n.success){let e=n.error.issues.find(e=>e.code===`unrecognized_keys`);throw e?.code===`unrecognized_keys`&&failure(`Invalid schema state: unrecognized key ${e.keys[0]}`),N.fromZodErrors(n.error.issues.map(e=>({path:e.path.map(String),message:e.message})))}let r=/* @__PURE__ */ new Set,i=n.data.entries.map(e=>{let t=Id.parse(F.object({address:F.unknown()}).parse(e).address),n=JSON.stringify(t);r.has(n)&&failure(`Invalid schema state: duplicate address ${n}`),r.add(n);let i=definitionSchema(t).nullable(),a=t[0]===`object`||t[0]===`attribute`?F.object({id:F.string().uuid(),updatedAt:F.string().datetime()}).strict():F.object({id:F.string().uuid(),revision:F.number().int().nonnegative()}).strict(),o=F.object({address:Id,source:i,effective:i,status:F.enum([`source`,`runtime`,`copy`,`suppressed`]),sourceOwner:F.string().regex(R).nullable(),guard:a.nullable()}).strict().parse(e);return(o.status===`runtime`&&(o.source!==null||o.effective===null||o.sourceOwner!==null)||o.status===`suppressed`&&(t[0]!==`content`||o.source===null||o.effective!==null||o.guard===null)||o.status===`copy`&&(o.source===null||o.effective===null)||o.effective!==null&&o.guard===null||o.source===null&&o.effective===null)&&failure(`Invalid schema state: inconsistent status at ${n}`),{...o,sourceOwner:parseSchemaOwner(o.sourceOwner)}});return{...n.data,entries:i.sort(compareSchemaStateEntries)}}function parseSchemaState(e){try{return parseState(e)}catch(e){throw e instanceof F.ZodError?N.fromZodErrors(e.issues.map(e=>({path:e.path.map(String),message:e.message}))):e}}function diffSchemaState(e){let t=[];for(let n of[...e.entries].sort(compareSchemaStateEntries)){let e=n.source===null?`added`:n.status===`suppressed`?`suppressed`:n.effective===null?`removed`:r(n.source)===r(n.effective)?n.status===`copy`?`copied`:null:`changed`;e&&t.push({...n,change:e})}return{modelVersion:1,tenant:e.tenant,sourceFingerprint:e.sourceFingerprint,changes:t}}const $=F.string().min(1),Rd=F.union([F.object({objectName:$,viewName:$,contentName:$.optional()}).strict().describe(`Full configuration of a view, or of one content when contentName is given`),F.object({objectId:$}).strict().describe(`An object with its attributes, by id`),F.object({objectName:$}).strict().describe(`An object with its attributes`),F.object({objectId:$,attributeName:$}).strict().describe(`One attribute's config, by name`),F.object({objectId:$,attributeId:$}).strict().describe(`One attribute's config, by id`),F.object({objectId:$,recordId:$}).strict().describe(`One sample record`)]);function parseNamedTarget(e){let t=Rd.safeParse(e);if(!t.success)throw new N(`Invalid scoped target`,[{path:[`target`],message:`Expected exactly one named target branch`}]);return t.data}const zd=[`object`,`attribute`,`view`,`content`,`sample`],Bd=F.object({mode:F.enum([`inline`,`window`]),interaction:F.enum([`static`,`interactive`]),size:F.enum([`compact`,`regular`]),aspectRatio:F.number().positive().finite().optional()}).strict(),Vd=F.object({artifactId:F.string().min(1),revision:F.number().int().positive(),name:F.string().min(1),kind:F.string().min(1),retention:F.enum(Fu),display:Bd}).strict();function readArtifactResult(e){let t=Vd.safeParse(e);return t.success?t.data:null}const Hd=F.string().regex(/^[^/\s]+\/[^/\s]+$/),Ud=F.object({kind:F.literal(`generated-image`),artifact:F.unknown(),generation:F.object({attemptId:F.uuid(),requestedModelId:Hd,executedModelId:Hd.nullable(),format:F.enum(Vu),mimeType:F.enum([`image/png`,`image/jpeg`,`image/webp`])}).strict()}).strict();function readGeneratedImageResult(e){let t=Ud.safeParse(e);if(!t.success)return null;let n=readArtifactResult(t.data.artifact);return!n||n.kind!==`image`?null:{...t.data,artifact:{...n,kind:`image`}}}function isCompletedToolPart(e){return e.type===`tool`&&e.state===`completed`}function readString(e,t){let n=e[t];return typeof n==`string`?n:void 0}function upsertWithPrecedence(e,t,n,r){let i=e.get(t),a=i&&r[i.kind]>r[n.kind]?i:n;e.delete(t),e.set(t,a)}function asRecord(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function readRefId(e,t,n){let r=readString(e,t),i=`${n}:`;return r?.startsWith(i)&&r.length>i.length?r.slice(i.length):void 0}function verbResultEntries(e){let t=asRecord(e);if(!t)return[];let n=[t];for(let e of[`members`,`created`,`updated`]){let r=t[e];if(Array.isArray(r))for(let e of r){let t=asRecord(e);t&&n.push(t)}}return n.filter(e=>!(`error`in e))}function extractReadRecordIds(e){let t=/* @__PURE__ */ new Set;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.name!==`read`)continue;let n=e.args.refs;if(Array.isArray(n))for(let e of n){if(typeof e!=`string`)continue;let n=parseReference(e);n.ok&&n.ref.kind===`record`&&t.add(n.ref.id)}}return[...t]}const Wd={created:1,modified:0};function readSingleRecordEntry(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.record==`object`&&t.record!==null?t.record:void 0,r=(n&&readString(n,`id`))??readString(t,`recordId`);return r?{id:r,label:(n&&readString(n,`label`))??r,objectName:(n&&readString(n,`objectName`))??``}:null}function readBulkRecordEntries(e,t,n){if(typeof e!=`object`||!e)return[];let r=e[t];if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e,r=readString(t,`id`);r&&i.push({id:r,label:readString(t,`label`)??r,objectName:readString(t,`objectName`)??n})}return i}function readVerbRecordEntries(e){let t=asRecord(asRecord(e.result)?.record),n=readString(e.args,`object`)??(t&&readString(t,`objectName`))??``,r=[];for(let t of verbResultEntries(e.result)){let e=readRefId(t,`ref`,`record`);e&&r.push({id:e,label:readString(t,`title`)||readString(t,`label`)||e,objectName:readString(t,`objectName`)??n})}return r}function extractTouchedRecords(e){let t=/* @__PURE__ */ new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e))continue;let n=[],r;if(e.name===`create_record`||e.name===`update_record`||e.name===`edit_content`){let t=readSingleRecordEntry(e.result);n=t?[t]:[],r=e.name===`create_record`?`created`:`modified`}else if(e.name===`bulk_create_records`||e.name===`bulk_update_records`){let t=readString(e.args,`objectId`)??``,i=e.name===`bulk_create_records`?`created`:`updated`;n=readBulkRecordEntries(e.result,i,t),r=e.name===`bulk_create_records`?`created`:`modified`}else if(e.name===`write`)n=readVerbRecordEntries(e),r=readString(e.args,`action`)===`create`?`created`:`modified`;else continue;for(let e of n){let n={recordId:e.id,objectName:e.objectName,label:e.label,kind:r};upsertWithPrecedence(t,e.id,n,Wd)}}return[...t.values()]}const Gd={modified:1,consulted:0};function isFilePart(e){return e.type===`file`}function entryFromDocumentMutation(e,t){if(typeof e.result!=`object`||e.result===null)return null;let n=e.result,r=readString(n,`documentId`)??(t===`folderId`?readString(n,t):void 0);return r?{id:r,title:readString(e.args,`name`)??readString(e.args,`title`)??r,kind:`modified`}:null}function entryFromReadDocument(e){let t=readString(e.args,`documentId`);return t?{id:t,title:t,kind:`consulted`}:null}function entryFromRef(e,t,n){let r=readRefId(e,`ref`,`file`),i=r??readRefId(e,`ref`,`document`);return i?{id:i,...r?{fileId:r}:{},title:n||readString(e,`title`)||i,kind:t,mimeType:readString(e,`mimeType`)}:null}function entriesFromOrganize(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=readString(e.args,`action`),r=readString(e.args,`name`)??readString(e.args,`title`),i=readString(t,`documentId`);if(i)return[{id:i,title:r??i,kind:`modified`}];let a=readString(t,`folderId`);if(a)return n===`create_folder`?[{id:a,title:r??a,kind:`modified`}]:[];let o=entryFromRef(t,`modified`,r);return o?[o]:[]}function entriesFromCopy(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=(Array.isArray(t.copied)?t.copied:[]).flatMap(e=>{let t=asRecord(e),n=t?entryFromRef(t,`modified`,void 0):null;return n?[n]:[]});if(n.length>0)return n;let r=entryFromRef(t,t.ref!==void 0&&t.ref===readString(e.args,`from`)?`consulted`:`modified`,void 0);return r?[r]:[]}function entriesFromRead(e){let t=asRecord(e.result);return(Array.isArray(t?.members)?t.members:[]).flatMap(e=>{let t=asRecord(e);if(!t||`error`in t||!readRefId(t,`ref`,`document`))return[];let n=entryFromRef(t,`consulted`,void 0);return n?[n]:[]})}function entriesFromToolPart(e){switch(e.name){case`organize`:return entriesFromOrganize(e);case`copy`:return entriesFromCopy(e);case`read`:return entriesFromRead(e);default:{let t=entryFromToolPart(e);return t?[t]:[]}}}function entryFromSandboxUpload(e){if(typeof e.result!=`object`||e.result===null)return null;let t=e.result,n=readString(t,`fileId`);return n?{id:n,fileId:n,title:readString(t,`title`)??n,kind:`modified`,mimeType:readString(t,`mimeType`)}:null}function entryFromToolPart(e){switch(e.name){case`update_document`:case`attach_file`:return entryFromDocumentMutation(e,`documentId`);case`create_folder`:return entryFromDocumentMutation(e,`folderId`);case`read_document`:return entryFromReadDocument(e);case`sandbox_upload_file`:return entryFromSandboxUpload(e);default:return null}}function extractTouchedDocuments(e){let t=/* @__PURE__ */ new Map;for(let n of e)if(n.role===`assistant`){for(let e of n.parts)if(isCompletedToolPart(e))for(let n of entriesFromToolPart(e))upsertWithPrecedence(t,n.id,n,Gd);else if(isFilePart(e)&&e.fileId){let n={id:e.fileId,fileId:e.fileId,title:e.name||e.fileId,kind:`modified`,mimeType:e.mimeType};upsertWithPrecedence(t,n.id,n,Gd)}}return[...t.values()]}function extractTouchedArtifacts(e){let t=/* @__PURE__ */ new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.error)continue;let n=e.name===`generate_image`?readGeneratedImageResult(e.result)?.artifact:e.name===`publish_artifact`?readArtifactResult(e.result):null;if(!n)continue;let r=`${n.artifactId}:${n.revision}`;t.delete(r),t.set(r,n)}return[...t.values()]}function isNonBlankString(e){return typeof e==`string`&&/\S/u.test(e)}const Kd=F.object({provider:F.custom(e=>isNonBlankString(e)&&e.length<=200,{message:`must be a non-blank string of at most 200 characters`}),model:F.string().max(200).regex(/\S/u)});function normalizeNewsLocale(e){return e.toLowerCase().split(`-`)[0]===`fr`?`fr`:`en`}function resolveLocalized(e,t){return e[normalizeNewsLocale(t)]||(e.en?e.en:e.fr||void 0)}function hasLocale(e){return!!(e.fr||e.en)}const qd=Object.keys({home:!0,agents:!0,routines:!0,object:!0,settings:!0}),Jd=[`dot`,`label`,`bubble`];function parseNewsIntensity(e){return Jd.find(t=>t===e)??`dot`}function parseNewsTarget(e){let[t,...n]=e.split(`:`),r=n.join(`:`);switch(t){case`home`:case`agents`:case`routines`:return r===``?{kind:t}:null;case`object`:return r?{kind:t,name:r}:null;case`settings`:return r?{kind:t,section:r}:null;default:return null}}function formatNewsTarget(e){return e.kind===`object`?`object:${e.name}`:e.kind===`settings`?`settings:${e.section}`:e.kind}function withoutTrailingSlashes(e){let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)}const Yd=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;function compareIdentifiers(e,t){let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?Math.sign(Number(e)-Number(t)):n?-1:r?1:e<t?-1:+(e>t)}function compareVersions(e,t){let n=Yd.exec(e),r=Yd.exec(t);if(!(n&&r))return null;for(let e=1;e<=3;e+=1){let t=Number(n[e])-Number(r[e]);if(t!==0)return t<0?-1:1}let i=n[4],a=r[4];if(i===void 0&&a===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;let o=i.split(`.`),s=a.split(`.`);for(let e=0;e<Math.max(o.length,s.length);e+=1){let t=o[e],n=s[e];if(t===void 0)return-1;if(n===void 0)return 1;let r=compareIdentifiers(t,n);if(r!==0)return r<0?-1:1}return 0}function isSemver(e){return Yd.test(e)}const Xd=30,Zd=90,Qd=50,$d=F.looseObject({fr:F.string().optional(),en:F.string().optional()}),ef=F.iso.datetime({offset:!0}),tf=F.looseObject({id:F.string().min(1),slug:F.string().min(1),updatedAt:ef,publishedAt:ef,since:F.string(),displayDays:F.number().int().positive().optional(),requires:F.looseObject({capability:F.string(),level:F.string()}).optional(),target:F.string().optional(),intensity:F.unknown().optional(),title:$d,summary:$d});function knownRequirement(e){let t=U.find(t=>t.id===e.capability);return t!==void 0&&levelActions(t,e.level).length>0}function parseEntry(e){let t=tf.safeParse(e);if(!t.success)return`malformed entry: ${t.error.issues[0]?.message??`invalid`}`;let n=t.data;if(!isSemver(n.since))return`entry ${n.id}: since "${n.since}" is not semver`;if(!hasLocale(n.title))return`entry ${n.id}: title has no locale`;if(!hasLocale(n.summary))return`entry ${n.id}: summary has no locale`;if(n.requires&&!knownRequirement(n.requires))return`entry ${n.id}: unknown requirement ${n.requires.capability}/${n.requires.level}`;let r=n.target?parseNewsTarget(n.target):null;return{...n,displayDays:n.displayDays??30,intensity:parseNewsIntensity(n.intensity),target:r??void 0}}function httpsUrl(e){return typeof e==`string`&&e.startsWith(`https://`)?e:void 0}function parseNewsIndex(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new N(`News feed: document must be an object`,[]);let n=e;if(!Array.isArray(n.entries))throw new N(`News feed: entries must be an array`,[]);let r=[];for(let e of n.entries){let n=parseEntry(e);typeof n==`string`?t?.(n):r.push(n)}let i=httpsUrl(n.blogUrl),a=httpsUrl(n.mediaBaseUrl),o=a?withoutTrailingSlashes(a):void 0;return{...i?{blogUrl:i}:{},...o?{mediaBaseUrl:o}:{},entries:r.slice(0,50)}}const nf=F.looseObject({id:F.string().min(1),slug:F.string().min(1),updatedAt:ef,body:$d});function parseNewsBody(e){let t=nf.safeParse(e);if(!t.success)throw new N(`News body: malformed document`,[]);if(!hasLocale(t.data.body))throw new N(`News body: body needs at least one locale`,[]);return t.data}function preference(e,t){return{key:e,value:t.value,default:t.default,audited:t.audited??!1,...t.parameter===void 0?{}:{parameter:t.parameter},...t.parameters===void 0?{}:{parameters:t.parameters},...t.refine===void 0?{}:{refine:t.refine}}}const rf=``;function refusal(e,t){return{ok:!1,field:e,message:t,issues:[{path:[e],message:t}]}}function declarationOf(e,t){return`get`in e?e.get(t):e.find(e=>e.key===t)}function locatePreference(e,t,n){let r=declarationOf(e,t);return r?r.parameter===void 0?n===void 0?{ok:!0,declaration:r,parameter:``}:refusal(`parameter`,`Preference "${t}" takes no parameter`):n===void 0||n===``||n.trim()!==n?refusal(`parameter`,`Preference "${t}" is keyed by ${r.parameter}`):r.parameters&&!r.parameters.includes(n)?refusal(`parameter`,`"${n}" is not a ${r.parameter} of "${t}"`):{ok:!0,declaration:r,parameter:n}:refusal(`key`,`Unknown preference "${t}"`)}function judgePreferenceWrite(e,t,n,r){let i=locatePreference(e,t,n);if(!i.ok)return i;let a=i.declaration.value.safeParse(r);if(a.success){let e=i.declaration.refine?.(a.data,i.parameter);return e===void 0?{...i,value:a.data}:refusal(`value`,e)}return{ok:!1,field:`value`,message:`Invalid value for preference "${t}"`,issues:a.error.issues.map(e=>({path:[`value`,...e.path.map(String)],message:e.message}))}}const af=F.strictObject({model:Kd.optional(),routing:F.literal(`auto`).optional()}),of=F.strictObject({inApp:F.boolean()});function isActionableType(e){let t=h[e];return t!==void 0&&Je(t.kind)}const sf=[preference(`workPosture`,{value:F.enum(Vs),default:`auto`,audited:!0}),preference(`chat.default`,{value:af,default:{},audited:!0}),preference(`conversationSurface`,{value:F.enum(Ra),default:`panel`}),preference(`mailboxListMode`,{value:F.enum(jo),default:`threads`}),preference(`home`,{value:F.string().uuid().nullable(),default:null}),preference(`memory.learnFromEmail`,{value:F.boolean(),default:!0,audited:!0}),preference(`memory.shareWithTeam`,{value:F.boolean(),default:!0,audited:!0}),preference(`onboarding.completed`,{value:F.boolean(),default:!1,audited:!1}),preference(`decisions.seenAt`,{value:F.iso.datetime().nullable(),default:null}),preference(`decisions.delivery`,{value:of,default:{inApp:!0},parameter:`decision type`,parameters:Object.keys(h),refine:(e,t)=>!e.inApp&&isActionableType(t)?`A "${t}" decision asks you to act: it is always shown in-app`:void 0})];function preferenceEntry(e,t,n){return n===void 0?{key:e,value:t}:{key:e,parameter:n,value:t}}function withPreferenceEntry(e,t){if(t.parameter===void 0)return{...e,values:{...e.values,[t.key]:t.value}};let n=e.entries.findIndex(e=>e.key===t.key&&e.parameter===t.parameter),r=n===-1?[...e.entries,t]:e.entries.map((e,r)=>r===n?t:e);return{...e,entries:r}}export{na as ACCESS_LEVELS,ra as ACCESS_ROLES,u as ACTIONABLE_DECISION_KINDS,y as AGENDA_BLOCK,ia as AGENT_ASIDE_ANSWER_MAX_LENGTH,aa as AGENT_ASIDE_HISTORY_LIMIT,oa as AGENT_ASIDE_QUESTION_MAX_LENGTH,sa as AGENT_AVATAR_EXPRESSIONS,ca as AGENT_AVATAR_TYPES,la as AGENT_MESSAGE_KIND,ua as AGENT_MESSAGE_SENDER_NAME_KEY,da as AGENT_NOTIFICATION_KIND,fa as AGENT_SESSION_ACCESS_ROLES,pa as AGENT_SESSION_LIST_ORDERS,ma as AGENT_SESSION_ORIGINS,ha as AGENT_SESSION_PROVENANCES,ga as AGENT_STARTERS_MAX,_a as AGENT_STARTER_MAX_LENGTH,va as AGENT_SYSTEM_PROMPT_MAX_LENGTH,ya as AGENT_TASK_KINDS,ba as AGENT_WAKE_KIND,d as AGGREGATE_BUCKETS,f as AGGREGATE_MEASURES,Gu as ALLOWED_PROPERTY_TYPES,xa as ALL_CATALOG_TOOL_NAMES,z as ALL_PIPES,Sa as ALWAYS_KINDS,Td as APPEARANCE_FACETS,Ca as APPROVAL_FAMILY_TOOL_NAMES,wa as ARCHITECT_PUBLICATION_KIND,Iu as ARTIFACT_FILE_ROLES,Pu as ARTIFACT_KINDS,st as ARTIFACT_PREVIEW_EXTENSION,Fu as ARTIFACT_RETENTIONS,Ta as ASK_QUESTIONS_ANSWER_MAX_LENGTH,Ea as ASK_QUESTIONS_ANSWER_MAX_VALUES,Da as ASK_QUESTIONS_MAX_BATCH,Oa as ASK_QUESTIONS_TOOL_NAME,ct as ATTRIBUTE_FILTER_OPERATORS,p as ATTRIBUTE_NAME_SCHEMA,lt as ATTRIBUTE_TYPES,ut as ATTRIBUTE_TYPE_DESCRIPTORS,ka as AUDIT_ACTIONS,Aa as AUDIT_AGENT_SESSION_METADATA_KEY,ja as AUDIT_RESOURCE_TYPES,fi as AccessDeniedError,AgendaBuilder,P as AgentBuilder,pi as AggregateValidationError,mi as AmbiguousSchemaChangeError,hi as AttributeInUseError,gi as AttributeNotFoundError,dt as BLOCK_CONTEXTS,ft as BLOCK_PERIODS,b as BLOCK_WIDTHS,Ma as BROWSER_LAUNCH_TOOL_NAME,Na as BROWSER_TOOL_NAMES,Pa as BUNDLE_LOCALES,q as BUNDLE_NAME_PATTERN,Fa as BUNDLE_SETUP_PROMPT_MAX_LENGTH,Wu as BYTE_UNIT_LABELS,BlockContentBuilder,BundleBuilder,pt as CARD_BLOCK,rd as CATALOG_RESOURCES,mt as CHART_BLOCK,ht as CHART_KINDS,gt as COMPUTED_RETURN_TYPES,Ia as CONNECTION_GRANT_PROVIDERS,Nd as CONNECTOR_CALLBACK_PARAM,_t as CONTENT_PLACEMENT_CONTEXTS,La as CONTINUATION_KEY_PATTERN,Ra as CONVERSATION_SURFACES,za as COPY_VERB_NAME,J as CORE_BUNDLE_NAME,sf as CORE_PREFERENCES,Ba as CORE_RECORD_TOOL_NAMES,Va as CORE_TOOL_NAMES,Ha as COUNT_MODES,nd as CUSTOM_LEVEL,CardBuilder,ChartBuilder,ChartQuery,_i as ConcurrentModificationError,Z as ContentBuilder,vt as DECISIONS_BLOCK,m as DECISION_INBOX_STATES,ee as DECISION_KINDS,te as DECISION_LINE_MAX_LENGTH,ne as DECISION_LINK_TARGET_TYPES,re as DECISION_LIST_STATES,ie as DECISION_READ_STATES,ae as DECISION_SETTINGS_AREAS,oe as DECISION_TITLE_MAX_LENGTH,se as DECISION_TRANSFERS_KEY,ce as DECISION_TYPES_V1,le as DECISION_TYPE_ACCESS_GRANTED,ue as DECISION_TYPE_AGENT_APPROVAL,de as DECISION_TYPE_AGENT_MESSAGE,fe as DECISION_TYPE_AGENT_QUESTION,pe as DECISION_TYPE_AGENT_REVIEW,me as DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED,he as DECISION_TYPE_AGENT_SETUP,ge as DECISION_TYPE_BUNDLE_SETUP,_e as DECISION_TYPE_CONNECTOR_CONNECTION_ERROR,ve as DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED,ye as DECISION_TYPE_ENVIRONMENT_BUILD_FAILED,h as DECISION_TYPE_KINDS,be as DECISION_TYPE_PERSON,xe as DECISION_TYPE_RECORD_ASSIGNED,Se as DECISION_TYPE_RECORD_MENTIONED,Ce as DECISION_WORK_STATES,Ua as DEFAULT_AGENT_EXECUTION_CONFIG,Wa as DEFAULT_AGENT_TOOL_GROUPS,Sd as DEFAULT_APPEARANCE_ICON,Ga as DEFAULT_APPROVAL_POLICY,Ka as DEFAULT_BLUEPRINT_TOOL_GROUPS,qa as DEFAULT_DAILY_ACTIVITY_DAYS,Nu as DEFAULT_DICTATION_LIMITS,$u as DEFAULT_LABEL_FALLBACK,yt as DEFAULT_LAYOUT_TRAITS,Ja as DEFAULT_MEETING_BOT_DISPLAY_NAME,Ya as DEFAULT_TENANT_SETTINGS,bt as DEFAULT_VALIDATION_MESSAGES,Xa as DEVICE_ACCESS_ROLES,du as DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS,fu as DEVICE_CHANNEL_IDLE_POLL_MS,mu as DEVICE_CHANNEL_KEEPALIVE_MS,uu as DEVICE_CHANNEL_MAX_FRAME_BYTES,lu as DEVICE_CHANNEL_PATH,pu as DEVICE_CHANNEL_PRESENCE_MS,hu as DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION,_u as DEVICE_COMMAND_ERROR_CODES,yu as DEVICE_DESKTOP_STATES,vu as DEVICE_SHELLS,ju as DICTATION_FINALIZATION_TIMEOUT_MS,Tu as DICTATION_FRAME_BYTES,Du as DICTATION_MAX_BUFFER_BYTES,Eu as DICTATION_MAX_FRAME_BYTES,Ou as DICTATION_MAX_TRANSCRIPT_BYTES,Mu as DICTATION_MODEL_ID,Au as DICTATION_PREPARATION_TIMEOUT_MS,wu as DICTATION_SAMPLE_RATE,ku as DICTATION_TICKET_TTL_MS,Za as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,Qa as DOCUMENT_SORT_MODES,zd as DRAFT_CONFLICT_KINDS,$a as DRAFT_WRITE_TOOL_NAMES,DecisionsBuilder,DeviceChannelProtocolError,Su as DeviceChannelServerFrameSchema,xu as DeviceChannelWorkerFrameSchema,bu as DeviceDesktopStatusSchema,k as DuplicateError,eo as EMAIL_CATEGORY_DEFAULT_COLOR,to as EMAIL_CATEGORY_DEFAULT_ICON,no as EMAIL_CATEGORY_DESCRIPTION_MAX,ro as EMAIL_CATEGORY_DESCRIPTION_MIN,io as EMAIL_CATEGORY_LIMIT,ao as EMAIL_CATEGORY_NAME_MAX,oo as ENVIRONMENT_BUILD_LOG_STEPS,so as ENVIRONMENT_BUILD_LOG_STEP_PREFIX,co as ENVIRONMENT_HARNESSES,lo as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,uo as ENVIRONMENT_HARNESS_WORKDIR,fo as ENVIRONMENT_IMAGES,po as ENVIRONMENT_MEMORY_GB_PER_VCPU,mo as ENVIRONMENT_NAME_MAX_CHARS,ho as ENVIRONMENT_NETWORK_ALLOW_MAX,go as ENVIRONMENT_SCRIPT_MAX_BYTES,_o as ENVIRONMENT_SIZES,vo as ENVIRONMENT_SIZE_VCPUS,yo as ENVIRONMENT_STANDARDS_WORKDIR,bo as ENV_VAR_KEY_PATTERN,xo as ESTIMATED_COUNT_CAP,vi as ExportTooLargeError,So as FILE_URLS_MAX_IDS,L as FORM_FORBIDDEN_ATTRIBUTE_TYPES,yi as ForbiddenError,FormBuilder,FormRowBuilder,FormStepBuilder,Co as GET_ARCHITECT_DRAFT_TOOL_NAME,wo as GITHUB_TRIGGER_CATALOG,To as GRANT_ENABLES,xt as GROUPABLE_ATTRIBUTE_TYPES,Dd as GroupBuilder,St as HEADING_BLOCK,we as HIERARCHY_ATTRIBUTE_IDS,Te as HIERARCHY_ATTRIBUTE_NAMES,Ee as HIERARCHY_CHILD_IDS_LIMIT,Eo as HITL_TOOL_NAMES,Vu as IMAGE_FORMATS,Cd as IMAGE_SHAPES,wd as IMAGE_SOURCES,Do as INFERENCE_REASONING_OPTIONS,Oo as INFERENCE_ROUTING_MODES,ko as INFERENCE_SPEEDS,Ct as INVENTORY_LIMIT,bi as InvalidPermissionGrantError,Ao as LAST_RUN_ERROR_MAX_LENGTH,De as LIST_VIEW_TAB_VISIBILITIES,wt as LOCATION_FILTER_PROPERTIES,xi as LogoProviderUnavailableError,Si as LogoSearchRateLimitedError,Tt as MAILBOX_BLOCK,jo as MAILBOX_LIST_MODES,Mo as MAIL_DRAFT_BODY_MAX_CHARS,No as MAIL_SIGNATURE_MAX_CHARS,Po as MAIL_SUBJECT_MAX_CHARS,Oe as MAX_AGGREGATE_GROUPS,Fo as MAX_DAILY_ACTIVITY_DAYS,Cu as MAX_PRESET_DEPTH,Io as MAX_TODOS,Lo as MAX_TODO_DESCRIPTION_CHARS,Ro as MAX_TODO_ID_CHARS,zo as MCP_SERVER_NAME_MAX_LENGTH,Et as MEASURABLE_ATTRIBUTE_TYPES,Dt as MEETINGS_UPCOMING_BLOCK,Bo as MEETING_BOT_IMAGE,Vo as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,Ho as MEETING_BOT_NO_CREDITS,Uo as MEETING_BOT_SILENT_REASON,Wo as MEETING_RESPONSES,W as MEMORY_ATTRIBUTES,cd as MEMORY_PAGE_MAX_CHARS,Go as MEMORY_SPEND_LIMIT_PATTERN,ld as MEMORY_WORKSPACE_PROFILE,sd as MEMORY_WRITE_SOURCE,dd as METERED_CHARGE_KINDS,ud as METERED_RATES_USD,Ot as METRIC_BLOCK,MailboxBuilder,Ko as McpOAuthCompletionMode,Ci as MemoryNotFoundError,MetricBuilder,MetricQuery,MultiRelationAttributeBuilder,su as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,cu as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,kt as NATIVE_BLOCKS,ke as NATIVE_OBJECT_NAMES,qo as NATIVE_TOOL_GROUPS,Jo as NATIVE_TOOL_GROUP_CATALOG,Xd as NEWS_DEFAULT_DISPLAY_DAYS,Zd as NEWS_DISPLAY_CAP_DAYS,Qd as NEWS_INDEX_MAX_ENTRIES,Jd as NEWS_INTENSITIES,qd as NEWS_TARGET_KINDS,V as NO_ACCESS,rf as NO_PREFERENCE_PARAMETER,Yo as NO_RECORDING,At as NO_VALUE_OPERATORS,e as NonJsonValueError,NoopGeocodingAdapter,wi as NotFoundError,Ti as NotImplementedError,H as OBJECT_GRANT,Ae as OBJECT_NAME_SCHEMA,G as OFFICIAL_SKILLS_REPO,Xo as OPEN_TOOL_PART_STATES,Zo as OPERATION_MAX_STEPS,jt as OPERATORS_BY_TYPE,ObjectBuilder,Ei as ObjectNotFoundError,Di as ObjectReferencedError,Oi as OrphanSystemAttributeError,Mt as PAGE_GRID_COLUMNS,ad as PERMISSION_ACTIONS,U as PERMISSION_CAPABILITIES,td as PERMISSION_CATALOG,Uu as PERSISTENCE_OWNED_QUOTA_KEYS,qu as PIPES_WITH_ARGS,Qo as PROVIDER_DRAFT_LABEL,$o as PROVIDER_NAMES,es as PUBLIC_MAIL_DOMAINS,Y as PageBuilder,ki as PageReferencedError,Ai as ProtectedResourceError,ji as ProtectedRoleError,Nt as QUALIFIED_SEPARATOR,Pt as QUERY_OBJECT,ts as QUESTION_FAMILY_TOOL_NAMES,Hu as QUOTA_KEYS,Mi as QueryTimeoutError,ns as RECENT_ACTIVITY_LEDGER_LIMIT,rs as RECIPIENT_IDENTITIES_MAX,is as RECORDING_OVERRIDES,as as RECORDING_POLICIES,os as RECORD_ACCESS_ROLES,ss as RECORD_ACCESS_SOURCES,cs as RECORD_DRIVE_CURSOR_MAX_LENGTH,ls as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,us as RECORD_DRIVE_PAGE_MAX_LIMIT,ds as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,fs as RECORD_GRAPH_MAX_LIMIT_PER_NODE,ps as RECORD_GRAPH_MAX_NODES,ms as RECORD_IMAGE_MAX_BYTES,Ft as RECORD_LINKS_BLOCK,x as RECORD_LINKS_CONTENT,je as RECORD_LIST_SCOPES,It as RECORD_OBJECT,kd as REFERENCE_KINDS,Lt as RELATION_TARGET_ANY,Rt as REMOVED_OPERATOR_REPLACEMENTS,hs as REPLY_MODES,gs as REQUEST_DESIGN_REVIEW_TOOL_NAME,_s as REQUEST_SETUP_TOOL_NAME,Me as RESERVED_ATTRIBUTE_NAMES,Ne as RESERVED_OBJECT_NAMES,vs as RESOURCE_GRANT_KINDS,ys as RESOURCE_KIND_CATALOG,Pe as RESOURCE_VISIBILITIES,bs as ROUTING_PRICE_CEILINGS,Ni as RealtimeDeliveryError,Pi as RealtimeRateLimitedError,Fi as RealtimeSubscriptionError,Ii as RecordNotFoundError,zt as RecordQuery,Li as RecordReferencedError,Ri as RepositoryError,A as ReservedObjectNameError,zi as RoleNotFoundError,g as SCHEMA_LIMITS,R as SCHEMA_OWNER_PATTERN,Pd as SCHEMA_SOURCE_RETYPE_FROM,xs as SEND_VERB_NAME,Ss as SESSION_INFERENCE_PATCH_KEYS,Ku as SIMPLE_PIPES,Bt as SIMPLE_PROPERTY_TYPES,Cs as SLACK_TRIGGER_CATALOG,ws as SPEAKS_THROUGH_SEND_METADATA_KEY,pd as STANDARD_SCHEMA_VENDOR,Ts as SURFACE_TOOL_NAMES,Vt as SYNONYM_ALIASES,Fe as SYSTEM_ATTRIBUTES,Ie as SYSTEM_ATTRIBUTE_I18N_KEYS,Es as SYSTEM_EMAIL_CATEGORIES,Ds as SYSTEM_EMAIL_CATEGORY_NAMES,Le as SYSTEM_FIELD_NAMES,Ht as SYSTEM_FILTER_ATTRIBUTE_TYPES,Os as SYSTEM_PART_CODES,j as SchemaError,M as SchemaErrorCode,Bi as SearchBackendError,Vi as SearchPathNotIndexedError,SingleRelationAttributeBuilder,Hi as StorageError,Ui as SyncCascadeError,Wi as SyncConflictError,Gi as SyncError,Ki as SystemEntityImmutableError,ks as TASK_DEMAND_LEVELS,Lu as TENANT_INVITATION_DEFAULT_TTL_MS,zu as TENANT_INVITATION_MAX_TTL_MS,Ru as TENANT_INVITATION_MIN_TTL_MS,Bu as TENANT_INVITATION_RESEND_INTERVAL_MS,S as TEXT_BLOCK,Ut as TEXT_FORMAT_PATTERNS,As as TODO_PHASES,js as TODO_PLAN_STATUSES,Ms as TODO_STATUSES,Ns as TOOL_APPROVAL_STATES,Ps as TOOL_IMPACT_COUNT_KEYS,Fs as TRIAGE_ACTIONS,Is as TRIGGER_EVENT_TYPES,Ls as TURN_OUTCOMES,qi as ToolGroupGrantError,Rs as UNSHAREABLE_OBJECT_NAMES,zs as USERS_RESOLVE_MAX_IDS,Bs as USER_STATUSES,Vs as USER_WORK_POSTURES,Hs as VERB_NAMES,N as ValidationError,X as ViewBuilder,Us as WAKE_TURN_METADATA_KEY,Ws as WAKE_TURN_SPOKE_METADATA_KEY,Wt as WIRE_OFFERED_BASE_CONFIG,Gt as WIRE_OMITTED_CONFIG_KEYS,Ji as WorkspaceInvariantReason,Gs as agent,Ks as agentAvatarFromMetadata,qs as agentAvatarSchema,Js as agentDataChunk,Ys as agentDisplayName,Xs as agentInferencePreferencesSchema,Zs as agentMessageAttachmentSchema,Qs as agentMessagePartSchema,$s as agentScheduleSchema,ec as agentSessionInferenceOverridesInputSchema,tc as agentSessionInferenceOverridesSchema,nc as agentSessionMessageSchema,rc as agentStartersSchema,ic as agentTriggerBaseSchema,ac as agentTriggerPatchSchema,oc as agentTriggerSchema,sc as agentUIValidationError,applyPipes,cc as artifactQuoteSchema,t as asTenantId,n as asUserId,lc as askQuestionsOutputSchema,assertBundleName,uc as assertCustomAgentUIMessageChunk,assertSchemaSourceResolutions,dc as assertSessionState,Kt as attributeConfigSchemas,qt as attributeFilterTarget,Jt as attributeInventory,Yt as blockObjectInputs,buildPropertySchema,Xt as buildQualifiedAttribute,builtBundleFromPieces,bundle,r as canonicalStringify,fc as canonicalToolGroups,Zt as canonicalizeFilterValue,capabilityForResource,Qt as capped,checkbox,pc as classificationRestoreSchema,mc as classifyEmailSchema,hc as cliDefaultModelOf,$t as collectContentViewCatalogue,en as collectQualifiedRuleIssues,tn as collectionContentSourceSchema,nn as collectionSourceAddress,rn as collectionSourceAddressOf,ze as colorIdSchema,an as columnsSchema,gc as compareAgentSessionMessages,compareSchemaStateEntries,compareVersions,_c as compiledHarnessModels,computeByteMagnitude,computeReconnectDelay,computeRetryDelay,vc as connectionGrantKindsOf,yc as connectorTriggerMatchSchema,Od as content,contentDefinition,C as contentExtensionRegistry,on as contentReadObjects,w as contentViewDefinitionSchema,sn as contentViewDefinitionSchemaFor,convertRetypedValue,cn as createAttributeValidator,ln as createFormAttributeValidator,createStandardSchemaProps,currency,dn as currentActor,bc as customDataChunkSchemas,date,Be as decisionThreadKey,Ve as decisionTransferBy,He as decisionTransfersOf,declaredImageRequests,xc as decodeAgentSessionListCursor,i as deepEqual,pn as defineBlock,deriveLayout6,Sc as deriveViewerAccess,mn as describeViewIssue,detailView,deviceChannelUrl,diffSchemaState,hn as displayAttributesSchema,document,gn as draftContentViewDefinitionSchema,_n as draftContentViewDefinitionSchemaFor,droppedContents,Cc as durableDateSchema,vn as edgePropertyFilterTarget,wc as emailCategoryCreateSchema,Tc as emailCategoryDeleteSchema,Ec as emailCategoryScopeQuerySchema,Dc as emailCategoryUpdateSchema,Oc as emailRuleScopeSchema,kc as encodeAgentSessionListCursor,Ac as environmentHarness,jc as environmentWorkdir,extractAttributeNames,extractAttributePaths,yn as extractCurrencyFilterValue,bn as extractFilterValue,extractReadRecordIds,extractTouchedArtifacts,extractTouchedDocuments,extractTouchedRecords,xn as filterOperatorsOfType,Sn as filterStateSchema,Cn as filterTargetsOf,Mc as findEnvironmentHarness,findGrantIssues,wn as findGridViolation,Tn as findGroupViolation,En as findLayoutRuleViolation,Dn as findRelationAttribute,On as findRowLimitViolation,foldText,form,formFieldFlatKey,formFieldKey,formatByteSize,Ue as formatDecisionLink,formatNewsTarget,kn as formatPhoneForDisplay,formatReference,formatSkillSource,An as formatZodErrors,formula,a as generateId,jn as getAttributeCapabilities,Mn as getAttributeConfigSchema,Nn as getAttributeConfigWriteSchema,Pn as getAttributeFilterOperators,getEditableLabelAttribute,We as getHierarchyAttributes,Ge as getObjectSystemAttributes,In as getOperatorPolarity,Ln as getRollupFilterOperators,getSingleAttributeFromExpression,getSlotFieldTargets,Ke as getSystemAttributeI18nKey,qe as getSystemAttributeList,Nc as githubConditionSchema,Pc as githubTriggerMatchSchema,Fc as grantKindOf,Rn as gridPositionSchema,group,zn as groupSizeMessage,Bn as groupedMembers,Ic as harnessModelChoices,hasLocale,hasOptions,Vn as hasTypeTrait,Hn as hasValueKind,hashBundlePieces,Lc as humanRequestId,Rc as humanRequestKind,_ as iconNameSchema,imageLookupKindOf,imageModelFormatDefect,zc as imageModelIdSchema,o as indexBy,Un as inferInverseCardinality,Bc as inferenceReasoningSchema,Vc as inferenceRoutingSchema,Hc as inferenceSpeedSchema,Wn as input,Gn as invalidViewMessage,Je as isActionableDecisionKind,Uc as isAgentMessageMetadata,Wc as isAgentNotificationMetadata,Gc as isAgentUIDataName,Kc as isAgentWakeMetadata,qc as isAgentWrittenAuditEntry,Jc as isArchitectPublicationMetadata,Kn as isAttributeFilterable,qn as isAttributeGroupable,Yi as isAttributeInUseError,Jn as isAttributeKanbanGroupable,Yn as isAttributeSearchable,Xn as isAttributeSortable,Yc as isAwaitingHuman,Zn as isBilateralRelation,Xc as isBlocking,Qn as isBoardGrouping,isBundle,$n as isCalendarDay,isCatalogResource,er as isCollectionContent,tr as isDynamicValue,nr as isEmptyValue,Zc as isEnvironmentBuildLogStep,Qc as isEnvironmentHarnessId,isFormDefinition,isFormFieldsRow,isFormFreeFieldRef,isFormHeadingRow,isFormSeparatorRow,isFormSlotFieldRef,isFormTextRow,Ye as isHierarchyAttribute,isImageSource,isLabelExpression,rr as isLocationFilterProperty,ir as isLocationPartOperator,$c as isMailProvider,el as isMailboxListMode,Xe as isManagedSystemAttribute,isMeteredChargeKind,v as isNativeObjectName,tl as isNativeToolGroup,ar as isNoValueOperator,Xi as isNotFoundError,or as isNullishOrEmptyString,Zi as isObjectReferencedError,nl as isOpenToolPartState,rl as isParkedOnHuman,isPinnedSkillSource,Ze as isPlainRecord,Qi as isProtectedResourceError,il as isProviderDraft,al as isPublicMailDomain,ol as isQuestionPart,$i as isRecordReferencedError,sr as isRelativeDateValue,sl as isReplyMode,cl as isResourceGrant,ll as isRoutineActorMetadata,ea as isSchemaError,isSemver,ul as isSessionInferencePatch,cr as isSetMembershipOperator,isSkillRepository,isStandardSchema,dl as isSystemEmailCategory,fl as isSystemEmailCategoryName,pl as isSystemPartCode,ml as isToolApprovalState,hl as isToolImpactCountKey,lr as isUniversalRelation,ta as isValidationError,T as isValueKindType,ur as isValuePresent,isWherePipe,isWildcard,judgePreferenceWrite,keptFill,B as labelExpressionSchema,dr as layoutTraitsOf,levelActions,levelFloor,levelOf,listView,locatePreference,location,fr as locationPartFilterTarget,gl as lockingSendCall,_l as meetingBotDispatchRequestSchema,vl as meetingBotDispatchResponseSchema,yl as meetingBotNotificationSchema,bl as meetingTranscriptSegmentSchema,E as memberlessGroups,memoryPageViewOf,xl as mentionReferenceSchema,Sl as mergeSessionInferencePatch,meteredUsd,pr as metricComparePeriod,Cl as modelDefinitionSchema,Kd as modelIdentitySchema,wl as modelReferenceSchema,moveWidensAudience,multiselect,nameSlug,Rd as namedTargetSchema,nativeAgentUIPartIdMetadataKey,Tl as needsManageWhenUnattended,mr as normalizeCountrylessPhoneNumber,hr as normalizeFilterRule,gr as normalizeForEdgeRpc,normalizeNewsLocale,_r as normalizeOperator,vr as normalizePhoneNumber,El as normalizedMeetingTranscriptSchema,yr as now,number,object,Ed as objectImageSchema,Dl as openRequests,Ol as orderAgentSessionMessages,packLayout,page,pageCompactor,xr as pageTraitsOf,kl as parseAgentDefinitionAccessRole,Al as parseAgentSessionAccessRole,Sr as parseAttributeConfig,Cr as parseAttributeConfigForCreate,wr as parseAttributeConfigForUpdate,D as parseBlockParameters,jl as parseCountMode,Qe as parseDecisionLink,Ml as parseDeviceAccessRole,parseDeviceChannelFrame,Nl as parseMergedAgentTrigger,parseNamedTarget,parseNativeAgentUIPartIdsMetadata,parseNewsBody,parseNewsIndex,parseNewsIntensity,parseNewsTarget,Pl as parseOptionalCountMode,Fl as parsePageAccessRole,Tr as parseQualifiedAttribute,Il as parseRecordAccessRole,$e as parseRecordListScope,parseReference,et as parseResourceVisibility,parseSchemaGroupPresentation,parseSchemaOwner,parseSchemaState,parseServerFrame,parseSkillSource,Ll as parseToolGroupGrant,parseWherePipe,parseWorkerFrame,od as permissionGrantSchema,phone,placeNew,preference,preferenceEntry,Er as propertyAttributeSchema,Dr as propertyAttributeWireSchema,Or as propertySchemaSchema,kr as propertySchemaWireSchema,Rl as providerNameSchema,O as publishedViewContentDefinitionSchema,Ar as query,zl as readArchitectPublication,readArtifactResult,Bl as readAskQuestionsResult,readFormFieldValue,readGeneratedImageResult,Vl as recentActivityEntryKey,Hl as recordGraphNodeKey,Ul as recordGraphRequestSchema,recordLinksTab,Wl as recordMeetingsCount,Gl as recordOperationSchema,jr as recordQueryDefinitionSchema,Kl as refineTrigger,Mr as refuseForeignKeys,Nr as rejectUnknownAttributesOrThrow,relation,Pr as relationAcceptsObject,relationProperty,Fr as relationTargetsOf,renderLabelExpression,repairPageGrid,requestedCapabilities,Lr as requireRecordContentContext,Rr as requireSingleRelationTarget,resolveAppearance,zr as resolveCollectionActions,Br as resolveContentNavigation,Vr as resolveEffectiveFilterType,resolveFieldRequired,Hr as resolveIsWithinBounds,resolveLocalized,resolvePageGrid,resolvePropertyDefinitions,Ur as resolveTextPattern,Wr as resolveUtcDayBounds,resolveViewContents,ql as resourceGrant,richtext,rollup,Jl as routedMessageInferenceSchema,sameActions,s as sameStableValue,schemaGroupKey,schemaStateSourcePayload,select,Gr as selectOptionWriteSchema,c as serializeCanonicalJson,l as serializeStableJson,Yl as sessionInferencePatchSchema,settleLayout,sha256Hex,Kr as singleRelationTarget,Xl as slackConditionSchema,Zl as slackTriggerMatchSchema,snapWidth,qr as sortsSchema,Jr as sourcedAttributeOf,status,Yr as statusGroupSchema,Xr as statusOptionWriteSchema,storedContentDefinition,Zr as systemColumnFilterTarget,text,Qr as toMultiValueOperator,$r as toUtcDayString,ei as today,Ql as todoItemSchema,$l as todoPlanSchema,eu as toolImpactSchema,user,tu as utf8ByteLength,ti as validateAttribute,tt as validateAttributeName,ni as validateContentViewCatalogue,ri as validateDraft,ii as validateDraftOrThrow,validateLabelExpression,ai as validateObject,validateObjectExpressions,validateObjectImage,it as validateObjectName,oi as validateObjectOrThrow,si as validateQualifiedRule,ci as validateStoredViews,ot as validateViewName,widthStepConstraint,li as wireHiddenTypeConfigMask,ui as wireOmittedConfigKeysFor,withPreferenceEntry,withoutTrailingSlashes,di as withoutUnknownOptionKeys,workspaceViewAuthoring};
1654
+ `)){if(t===``)continue;let n=String.fromCodePoint(t.codePointAt(0)??0);e.set(n,t.slice(n.length))}return jd=e,e}function foldText(e){let t=unaccentRules(),n=``;for(let r of e)n+=t.get(r)??r;return n.toLowerCase()}function requestedCapabilities(e){let t=[];return e.canModify&&t.push(`modify`),e.canSend&&t.push(`send`),t}const Md={phone:`text`,currency:`number`},Nd={rename:[`kind`,`object`,`from`,`to`],phone:[`kind`,`object`,`attribute`,`to`,`defaultCountryCode`],currency:[`kind`,`object`,`attribute`,`to`,`currencyCode`]};function refuse(e,t,n){throw new N(n,[{path:t===void 0?[`resolutions`,String(e)]:[`resolutions`,String(e),t],message:n}])}function assertKeys(e,t,n){for(let r of n)(typeof t[r]!=`string`||t[r]===``)&&refuse(e,r,`Resolution ${e} needs a non-empty string \`${r}\``);let r=Object.keys(t).find(e=>!n.includes(e));r!==void 0&&refuse(e,r,`Resolution ${e} has an unknown field \`${r}\``)}function assertResolution(e,t){if(Ze(t)||refuse(e,void 0,`Resolution ${e} must be an object`),t.kind===`rename`){assertKeys(e,t,Nd.rename),t.from===t.to&&refuse(e,`to`,`Resolution ${e} renames "${t.from}" to itself`);return}if(t.kind!==`retype`&&refuse(e,`kind`,`Unknown resolution kind ${JSON.stringify(t.kind)}: expected "rename" or "retype"`),t.to!==`phone`&&t.to!==`currency`&&refuse(e,`to`,`Unsupported retype to ${JSON.stringify(t.to)}: a push converts text → phone and number → currency only`),assertKeys(e,t,Nd[t.to]),t.to===`phone`){let n=t.defaultCountryCode;/^[A-Z]{3}$/.test(n)&&iu(n)||refuse(e,`defaultCountryCode`,`Resolution ${e}: "${n}" is not an ISO 3166-1 alpha-3 country code`);return}let n=t.currencyCode;/^[A-Z]{3}$/.test(n)&&ru(n)||refuse(e,`currencyCode`,`Resolution ${e}: "${n}" is not a supported ISO 4217 currency code`)}function addressesOf(e){return e.kind===`rename`?{reads:e.from,lands:e.to}:{reads:e.attribute,lands:e.attribute}}function assertSchemaSourceResolutions(e){if(!Array.isArray(e))throw new N("`resolutions` must be an array",[{path:[`resolutions`],message:"`resolutions` must be an array"}]);if(e.length>100)throw new N(`A push carries ${e.length} resolutions; the limit is 100`,[]);let t=/* @__PURE__ */ new Set;for(let[n,r]of e.entries()){assertResolution(n,r);let{reads:e,lands:i}=addressesOf(r);for(let[a,o]of[[`${r.kind}:${r.object}.${e}`,`of "${r.object}.${e}"`],[`${r.kind}>${r.object}.${i}`,`onto "${r.object}.${i}"`]])t.has(a)&&refuse(n,void 0,`Resolution ${n} repeats a ${r.kind} ${o}`),t.add(a)}}function phoneFromText(e,t){let n=e.trim();if(n===``)return{value:null};let r=au(n,Fn(t));if(!r?.isPossible()||r.country===void 0||r.ext!==void 0)return;let i=nu(r.country)?.iso3;if(i!==void 0)return{value:{countryCode:i,phoneNumber:vr(n,i)}}}function convertRetypedValue(e,t,n={}){if(t===null)return{value:null};if(e.to===`phone`)return typeof t==`string`?phoneFromText(t,e.defaultCountryCode):void 0;if(typeof t==`number`&&Math.abs(t)<=2**53-1&&!(t<0&&n.allowNegative!==!0))return{value:{code:e.currencyCode,value:t}}}const Q=F.string().refine(e=>e.trim().length>0,`Must not be blank`),Pd=F.union([F.tuple([F.literal(`object`),Q]),F.tuple([F.literal(`attribute`),Q,Q]),F.tuple([F.literal(`view`),Q,Q]),F.tuple([F.literal(`content`),Q,Q,Q])]),Fd=F.object({label:Q,pluralLabel:F.string().optional(),description:F.string().optional(),icon:_.optional(),color:ze.optional(),image:Td.optional(),labelExpression:F.string(),embeddingExpression:F.string().optional(),sealed:F.boolean().optional(),toleratedAttributes:F.array(Q).optional(),metadata:F.record(F.string(),F.unknown()).optional(),documentLayout:F.record(F.string(),F.unknown()).optional(),hierarchical:F.boolean().optional()}).strict();function failure(e){throw new N(e,[])}function definitionSchema(e){return F.custom(t=>{let n=F.record(F.string(),F.unknown()).parse(t);for(let t of e[0]===`view`?[`object`,`name`]:[`name`])Object.hasOwn(n,t)&&failure(`Invalid schema state: unrecognized definition key ${t}`);switch(e[0]){case`object`:Fd.parse(n);break;case`attribute`:{let e=F.enum(lt).parse(n.type);Mn(e).extend({type:F.literal(e),label:Q,required:F.boolean().optional(),unique:F.boolean().optional(),icon:_.optional()}).strict().parse(n);break}case`view`:{let{contents:t,...r}=n,i=F.array(Q).parse(t);new Set(i).size!==i.length&&failure(`Invalid schema state: duplicate content membership`),gn.parse({...r,object:e[1],name:e[2],contents:[]});break}case`content`:O.parse({...n,name:e[3]})}return!0})}function compareSchemaStateEntries(e,t){let n=JSON.stringify(e.address),r=JSON.stringify(t.address);return n<r?-1:+(n>r)}function schemaStateSourcePayload(e){return{modelVersion:1,hashVersion:1,entries:[...e].sort(compareSchemaStateEntries).filter(e=>e.source!==null).map(({address:e,source:t})=>({address:e,source:t}))}}function parseState(e){let t=F.record(F.string(),F.unknown()).parse(e);for(let[e,n]of[[`modelVersion`,`model`],[`hashVersion`,`hash`]])t[e]!==1&&failure(`Unsupported schema ${n} version: expected 1, received ${t[e]===void 0?`missing`:String(t[e])}`);let n=F.object({modelVersion:F.literal(1),hashVersion:F.literal(1),tenant:Q,sourceFingerprint:F.string().regex(/^[a-f0-9]{64}$/),entries:F.array(F.unknown())}).strict().safeParse(e);if(!n.success){let e=n.error.issues.find(e=>e.code===`unrecognized_keys`);throw e?.code===`unrecognized_keys`&&failure(`Invalid schema state: unrecognized key ${e.keys[0]}`),N.fromZodErrors(n.error.issues.map(e=>({path:e.path.map(String),message:e.message})))}let r=/* @__PURE__ */ new Set,i=n.data.entries.map(e=>{let t=Pd.parse(F.object({address:F.unknown()}).parse(e).address),n=JSON.stringify(t);r.has(n)&&failure(`Invalid schema state: duplicate address ${n}`),r.add(n);let i=definitionSchema(t).nullable(),a=t[0]===`object`||t[0]===`attribute`?F.object({id:F.string().uuid(),updatedAt:F.string().datetime()}).strict():F.object({id:F.string().uuid(),revision:F.number().int().nonnegative()}).strict(),o=F.object({address:Pd,source:i,effective:i,status:F.enum([`source`,`runtime`,`copy`,`suppressed`]),sourceOwner:F.string().regex(R).nullable(),guard:a.nullable()}).strict().parse(e);return(o.status===`runtime`&&(o.source!==null||o.effective===null||o.sourceOwner!==null)||o.status===`suppressed`&&(t[0]!==`content`||o.source===null||o.effective!==null||o.guard===null)||o.status===`copy`&&(o.source===null||o.effective===null)||o.effective!==null&&o.guard===null||o.source===null&&o.effective===null)&&failure(`Invalid schema state: inconsistent status at ${n}`),{...o,sourceOwner:parseSchemaOwner(o.sourceOwner)}});return{...n.data,entries:i.sort(compareSchemaStateEntries)}}function parseSchemaState(e){try{return parseState(e)}catch(e){throw e instanceof F.ZodError?N.fromZodErrors(e.issues.map(e=>({path:e.path.map(String),message:e.message}))):e}}function diffSchemaState(e){let t=[];for(let n of[...e.entries].sort(compareSchemaStateEntries)){let e=n.source===null?`added`:n.status===`suppressed`?`suppressed`:n.effective===null?`removed`:r(n.source)===r(n.effective)?n.status===`copy`?`copied`:null:`changed`;e&&t.push({...n,change:e})}return{modelVersion:1,tenant:e.tenant,sourceFingerprint:e.sourceFingerprint,changes:t}}const $=F.string().min(1),Id=F.union([F.object({objectName:$,viewName:$,contentName:$.optional()}).strict().describe(`Full configuration of a view, or of one content when contentName is given`),F.object({objectId:$}).strict().describe(`An object with its attributes, by id`),F.object({objectName:$}).strict().describe(`An object with its attributes`),F.object({objectId:$,attributeName:$}).strict().describe(`One attribute's config, by name`),F.object({objectId:$,attributeId:$}).strict().describe(`One attribute's config, by id`),F.object({objectId:$,recordId:$}).strict().describe(`One sample record`)]);function parseNamedTarget(e){let t=Id.safeParse(e);if(!t.success)throw new N(`Invalid scoped target`,[{path:[`target`],message:`Expected exactly one named target branch`}]);return t.data}const Ld=[`object`,`attribute`,`view`,`content`,`sample`],Rd=100,zd=3e5,Bd=F.object({mode:F.enum([`inline`,`window`]),interaction:F.enum([`static`,`interactive`]),size:F.enum([`compact`,`regular`]),aspectRatio:F.number().positive().finite().optional()}).strict(),Vd=F.object({artifactId:F.string().min(1),revision:F.number().int().positive(),name:F.string().min(1),kind:F.string().min(1),retention:F.enum(Pu),display:Bd}).strict();function readArtifactResult(e){let t=Vd.safeParse(e);return t.success?t.data:null}const Hd=F.string().regex(/^[^/\s]+\/[^/\s]+$/),Ud=F.object({kind:F.literal(`generated-image`),artifact:F.unknown(),generation:F.object({attemptId:F.uuid(),requestedModelId:Hd,executedModelId:Hd.nullable(),format:F.enum(Bu),mimeType:F.enum([`image/png`,`image/jpeg`,`image/webp`])}).strict()}).strict();function readGeneratedImageResult(e){let t=Ud.safeParse(e);if(!t.success)return null;let n=readArtifactResult(t.data.artifact);return!n||n.kind!==`image`?null:{...t.data,artifact:{...n,kind:`image`}}}function isCompletedToolPart(e){return e.type===`tool`&&e.state===`completed`}function readString(e,t){let n=e[t];return typeof n==`string`?n:void 0}function upsertWithPrecedence(e,t,n,r){let i=e.get(t),a=i&&r[i.kind]>r[n.kind]?i:n;e.delete(t),e.set(t,a)}function asRecord(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function readRefId(e,t,n){let r=readString(e,t),i=`${n}:`;return r?.startsWith(i)&&r.length>i.length?r.slice(i.length):void 0}function verbResultEntries(e){let t=asRecord(e);if(!t)return[];let n=[t];for(let e of[`members`,`created`,`updated`]){let r=t[e];if(Array.isArray(r))for(let e of r){let t=asRecord(e);t&&n.push(t)}}return n.filter(e=>!(`error`in e))}function extractReadRecordIds(e){let t=/* @__PURE__ */ new Set;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.name!==`read`)continue;let n=e.args.refs;if(Array.isArray(n))for(let e of n){if(typeof e!=`string`)continue;let n=parseReference(e);n.ok&&n.ref.kind===`record`&&t.add(n.ref.id)}}return[...t]}const Wd={created:1,modified:0};function readSingleRecordEntry(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.record==`object`&&t.record!==null?t.record:void 0,r=(n&&readString(n,`id`))??readString(t,`recordId`);return r?{id:r,label:(n&&readString(n,`label`))??r,objectName:(n&&readString(n,`objectName`))??``}:null}function readBulkRecordEntries(e,t,n){if(typeof e!=`object`||!e)return[];let r=e[t];if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e,r=readString(t,`id`);r&&i.push({id:r,label:readString(t,`label`)??r,objectName:readString(t,`objectName`)??n})}return i}function readVerbRecordEntries(e){let t=asRecord(asRecord(e.result)?.record),n=readString(e.args,`object`)??(t&&readString(t,`objectName`))??``,r=[];for(let t of verbResultEntries(e.result)){let e=readRefId(t,`ref`,`record`);e&&r.push({id:e,label:readString(t,`title`)||readString(t,`label`)||e,objectName:readString(t,`objectName`)??n})}return r}function extractTouchedRecords(e){let t=/* @__PURE__ */ new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e))continue;let n=[],r;if(e.name===`create_record`||e.name===`update_record`||e.name===`edit_content`){let t=readSingleRecordEntry(e.result);n=t?[t]:[],r=e.name===`create_record`?`created`:`modified`}else if(e.name===`bulk_create_records`||e.name===`bulk_update_records`){let t=readString(e.args,`objectId`)??``,i=e.name===`bulk_create_records`?`created`:`updated`;n=readBulkRecordEntries(e.result,i,t),r=e.name===`bulk_create_records`?`created`:`modified`}else if(e.name===`write`)n=readVerbRecordEntries(e),r=readString(e.args,`action`)===`create`?`created`:`modified`;else continue;for(let e of n){let n={recordId:e.id,objectName:e.objectName,label:e.label,kind:r};upsertWithPrecedence(t,e.id,n,Wd)}}return[...t.values()]}const Gd={modified:1,consulted:0};function isFilePart(e){return e.type===`file`}function entryFromDocumentMutation(e,t){if(typeof e.result!=`object`||e.result===null)return null;let n=e.result,r=readString(n,`documentId`)??(t===`folderId`?readString(n,t):void 0);return r?{id:r,title:readString(e.args,`name`)??readString(e.args,`title`)??r,kind:`modified`}:null}function entryFromReadDocument(e){let t=readString(e.args,`documentId`);return t?{id:t,title:t,kind:`consulted`}:null}function entryFromRef(e,t,n){let r=readRefId(e,`ref`,`file`),i=r??readRefId(e,`ref`,`document`);return i?{id:i,...r?{fileId:r}:{},title:n||readString(e,`title`)||i,kind:t,mimeType:readString(e,`mimeType`)}:null}function entriesFromOrganize(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=readString(e.args,`action`),r=readString(e.args,`name`)??readString(e.args,`title`),i=readString(t,`documentId`);if(i)return[{id:i,title:r??i,kind:`modified`}];let a=readString(t,`folderId`);if(a)return n===`create_folder`?[{id:a,title:r??a,kind:`modified`}]:[];let o=entryFromRef(t,`modified`,r);return o?[o]:[]}function entriesFromCopy(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=(Array.isArray(t.copied)?t.copied:[]).flatMap(e=>{let t=asRecord(e),n=t?entryFromRef(t,`modified`,void 0):null;return n?[n]:[]});if(n.length>0)return n;let r=entryFromRef(t,t.ref!==void 0&&t.ref===readString(e.args,`from`)?`consulted`:`modified`,void 0);return r?[r]:[]}function entriesFromRead(e){let t=asRecord(e.result);return(Array.isArray(t?.members)?t.members:[]).flatMap(e=>{let t=asRecord(e);if(!t||`error`in t||!readRefId(t,`ref`,`document`))return[];let n=entryFromRef(t,`consulted`,void 0);return n?[n]:[]})}function entriesFromToolPart(e){switch(e.name){case`organize`:return entriesFromOrganize(e);case`copy`:return entriesFromCopy(e);case`read`:return entriesFromRead(e);default:{let t=entryFromToolPart(e);return t?[t]:[]}}}function entryFromSandboxUpload(e){if(typeof e.result!=`object`||e.result===null)return null;let t=e.result,n=readString(t,`fileId`);return n?{id:n,fileId:n,title:readString(t,`title`)??n,kind:`modified`,mimeType:readString(t,`mimeType`)}:null}function entryFromToolPart(e){switch(e.name){case`update_document`:case`attach_file`:return entryFromDocumentMutation(e,`documentId`);case`create_folder`:return entryFromDocumentMutation(e,`folderId`);case`read_document`:return entryFromReadDocument(e);case`sandbox_upload_file`:return entryFromSandboxUpload(e);default:return null}}function extractTouchedDocuments(e){let t=/* @__PURE__ */ new Map;for(let n of e)if(n.role===`assistant`){for(let e of n.parts)if(isCompletedToolPart(e))for(let n of entriesFromToolPart(e))upsertWithPrecedence(t,n.id,n,Gd);else if(isFilePart(e)&&e.fileId){let n={id:e.fileId,fileId:e.fileId,title:e.name||e.fileId,kind:`modified`,mimeType:e.mimeType};upsertWithPrecedence(t,n.id,n,Gd)}}return[...t.values()]}function extractTouchedArtifacts(e){let t=/* @__PURE__ */ new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.error)continue;let n=e.name===`generate_image`?readGeneratedImageResult(e.result)?.artifact:e.name===`publish_artifact`?readArtifactResult(e.result):null;if(!n)continue;let r=`${n.artifactId}:${n.revision}`;t.delete(r),t.set(r,n)}return[...t.values()]}function isNonBlankString(e){return typeof e==`string`&&/\S/u.test(e)}const Kd=F.object({provider:F.custom(e=>isNonBlankString(e)&&e.length<=200,{message:`must be a non-blank string of at most 200 characters`}),model:F.string().max(200).regex(/\S/u)});function normalizeNewsLocale(e){return e.toLowerCase().split(`-`)[0]===`fr`?`fr`:`en`}function resolveLocalized(e,t){return e[normalizeNewsLocale(t)]||(e.en?e.en:e.fr||void 0)}function hasLocale(e){return!!(e.fr||e.en)}const qd=Object.keys({home:!0,agents:!0,routines:!0,object:!0,settings:!0}),Jd=[`dot`,`label`,`bubble`];function parseNewsIntensity(e){return Jd.find(t=>t===e)??`dot`}function parseNewsTarget(e){let[t,...n]=e.split(`:`),r=n.join(`:`);switch(t){case`home`:case`agents`:case`routines`:return r===``?{kind:t}:null;case`object`:return r?{kind:t,name:r}:null;case`settings`:return r?{kind:t,section:r}:null;default:return null}}function formatNewsTarget(e){return e.kind===`object`?`object:${e.name}`:e.kind===`settings`?`settings:${e.section}`:e.kind}function withoutTrailingSlashes(e){let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)}const Yd=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;function compareIdentifiers(e,t){let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?Math.sign(Number(e)-Number(t)):n?-1:r?1:e<t?-1:+(e>t)}function compareVersions(e,t){let n=Yd.exec(e),r=Yd.exec(t);if(!(n&&r))return null;for(let e=1;e<=3;e+=1){let t=Number(n[e])-Number(r[e]);if(t!==0)return t<0?-1:1}let i=n[4],a=r[4];if(i===void 0&&a===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;let o=i.split(`.`),s=a.split(`.`);for(let e=0;e<Math.max(o.length,s.length);e+=1){let t=o[e],n=s[e];if(t===void 0)return-1;if(n===void 0)return 1;let r=compareIdentifiers(t,n);if(r!==0)return r<0?-1:1}return 0}function isSemver(e){return Yd.test(e)}const Xd=30,Zd=90,Qd=50,$d=F.looseObject({fr:F.string().optional(),en:F.string().optional()}),ef=F.iso.datetime({offset:!0}),tf=F.looseObject({id:F.string().min(1),slug:F.string().min(1),updatedAt:ef,publishedAt:ef,since:F.string(),displayDays:F.number().int().positive().optional(),requires:F.looseObject({capability:F.string(),level:F.string()}).optional(),target:F.string().optional(),intensity:F.unknown().optional(),title:$d,summary:$d});function knownRequirement(e){let t=U.find(t=>t.id===e.capability);return t!==void 0&&levelActions(t,e.level).length>0}function parseEntry(e){let t=tf.safeParse(e);if(!t.success)return`malformed entry: ${t.error.issues[0]?.message??`invalid`}`;let n=t.data;if(!isSemver(n.since))return`entry ${n.id}: since "${n.since}" is not semver`;if(!hasLocale(n.title))return`entry ${n.id}: title has no locale`;if(!hasLocale(n.summary))return`entry ${n.id}: summary has no locale`;if(n.requires&&!knownRequirement(n.requires))return`entry ${n.id}: unknown requirement ${n.requires.capability}/${n.requires.level}`;let r=n.target?parseNewsTarget(n.target):null;return{...n,displayDays:n.displayDays??30,intensity:parseNewsIntensity(n.intensity),target:r??void 0}}function httpsUrl(e){return typeof e==`string`&&e.startsWith(`https://`)?e:void 0}function parseNewsIndex(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new N(`News feed: document must be an object`,[]);let n=e;if(!Array.isArray(n.entries))throw new N(`News feed: entries must be an array`,[]);let r=[];for(let e of n.entries){let n=parseEntry(e);typeof n==`string`?t?.(n):r.push(n)}let i=httpsUrl(n.blogUrl),a=httpsUrl(n.mediaBaseUrl),o=a?withoutTrailingSlashes(a):void 0;return{...i?{blogUrl:i}:{},...o?{mediaBaseUrl:o}:{},entries:r.slice(0,50)}}const nf=F.looseObject({id:F.string().min(1),slug:F.string().min(1),updatedAt:ef,body:$d});function parseNewsBody(e){let t=nf.safeParse(e);if(!t.success)throw new N(`News body: malformed document`,[]);if(!hasLocale(t.data.body))throw new N(`News body: body needs at least one locale`,[]);return t.data}function preference(e,t){return{key:e,value:t.value,default:t.default,audited:t.audited??!1,...t.parameter===void 0?{}:{parameter:t.parameter},...t.parameters===void 0?{}:{parameters:t.parameters},...t.refine===void 0?{}:{refine:t.refine}}}const rf=``;function refusal(e,t){return{ok:!1,field:e,message:t,issues:[{path:[e],message:t}]}}function declarationOf(e,t){return`get`in e?e.get(t):e.find(e=>e.key===t)}function locatePreference(e,t,n){let r=declarationOf(e,t);return r?r.parameter===void 0?n===void 0?{ok:!0,declaration:r,parameter:``}:refusal(`parameter`,`Preference "${t}" takes no parameter`):n===void 0||n===``||n.trim()!==n?refusal(`parameter`,`Preference "${t}" is keyed by ${r.parameter}`):r.parameters&&!r.parameters.includes(n)?refusal(`parameter`,`"${n}" is not a ${r.parameter} of "${t}"`):{ok:!0,declaration:r,parameter:n}:refusal(`key`,`Unknown preference "${t}"`)}function judgePreferenceWrite(e,t,n,r){let i=locatePreference(e,t,n);if(!i.ok)return i;let a=i.declaration.value.safeParse(r);if(a.success){let e=i.declaration.refine?.(a.data,i.parameter);return e===void 0?{...i,value:a.data}:refusal(`value`,e)}return{ok:!1,field:`value`,message:`Invalid value for preference "${t}"`,issues:a.error.issues.map(e=>({path:[`value`,...e.path.map(String)],message:e.message}))}}const af=F.strictObject({model:Kd.optional(),routing:F.literal(`auto`).optional()}),of=F.strictObject({inApp:F.boolean()});function isActionableType(e){let t=h[e];return t!==void 0&&Je(t.kind)}const sf=[preference(`workPosture`,{value:F.enum(zs),default:`auto`,audited:!0}),preference(`chat.default`,{value:af,default:{},audited:!0}),preference(`conversationSurface`,{value:F.enum(Ra),default:`panel`}),preference(`mailboxListMode`,{value:F.enum(jo),default:`threads`}),preference(`home`,{value:F.string().uuid().nullable(),default:null}),preference(`memory.learnFromEmail`,{value:F.boolean(),default:!0,audited:!0}),preference(`memory.shareWithTeam`,{value:F.boolean(),default:!0,audited:!0}),preference(`onboarding.completed`,{value:F.boolean(),default:!1,audited:!1}),preference(`decisions.seenAt`,{value:F.iso.datetime().nullable(),default:null}),preference(`decisions.delivery`,{value:of,default:{inApp:!0},parameter:`decision type`,parameters:Object.keys(h),refine:(e,t)=>!e.inApp&&isActionableType(t)?`A "${t}" decision asks you to act: it is always shown in-app`:void 0})];function preferenceEntry(e,t,n){return n===void 0?{key:e,value:t}:{key:e,parameter:n,value:t}}function withPreferenceEntry(e,t){if(t.parameter===void 0)return{...e,values:{...e.values,[t.key]:t.value}};let n=e.entries.findIndex(e=>e.key===t.key&&e.parameter===t.parameter),r=n===-1?[...e.entries,t]:e.entries.map((e,r)=>r===n?t:e);return{...e,entries:r}}export{na as ACCESS_LEVELS,ra as ACCESS_ROLES,u as ACTIONABLE_DECISION_KINDS,y as AGENDA_BLOCK,ia as AGENT_ASIDE_ANSWER_MAX_LENGTH,aa as AGENT_ASIDE_HISTORY_LIMIT,oa as AGENT_ASIDE_QUESTION_MAX_LENGTH,sa as AGENT_AVATAR_EXPRESSIONS,ca as AGENT_AVATAR_TYPES,la as AGENT_MESSAGE_KIND,ua as AGENT_MESSAGE_SENDER_NAME_KEY,da as AGENT_NOTIFICATION_KIND,fa as AGENT_SESSION_ACCESS_ROLES,pa as AGENT_SESSION_LIST_ORDERS,ma as AGENT_SESSION_ORIGINS,ha as AGENT_SESSION_PROVENANCES,ga as AGENT_STARTERS_MAX,_a as AGENT_STARTER_MAX_LENGTH,va as AGENT_SYSTEM_PROMPT_MAX_LENGTH,ya as AGENT_TASK_KINDS,ba as AGENT_WAKE_KIND,d as AGGREGATE_BUCKETS,f as AGGREGATE_MEASURES,Wu as ALLOWED_PROPERTY_TYPES,xa as ALL_CATALOG_TOOL_NAMES,z as ALL_PIPES,Sa as ALWAYS_KINDS,wd as APPEARANCE_FACETS,Ca as APPROVAL_FAMILY_TOOL_NAMES,wa as ARCHITECT_PUBLICATION_KIND,Fu as ARTIFACT_FILE_ROLES,Nu as ARTIFACT_KINDS,st as ARTIFACT_PREVIEW_EXTENSION,Pu as ARTIFACT_RETENTIONS,Ta as ASK_QUESTIONS_ANSWER_MAX_LENGTH,Ea as ASK_QUESTIONS_ANSWER_MAX_VALUES,Da as ASK_QUESTIONS_MAX_BATCH,Oa as ASK_QUESTIONS_TOOL_NAME,ct as ATTRIBUTE_FILTER_OPERATORS,p as ATTRIBUTE_NAME_SCHEMA,lt as ATTRIBUTE_TYPES,ut as ATTRIBUTE_TYPE_DESCRIPTORS,ka as AUDIT_ACTIONS,Aa as AUDIT_AGENT_SESSION_METADATA_KEY,ja as AUDIT_RESOURCE_TYPES,fi as AccessDeniedError,AgendaBuilder,P as AgentBuilder,pi as AggregateValidationError,mi as AmbiguousSchemaChangeError,hi as AttributeInUseError,gi as AttributeNotFoundError,dt as BLOCK_CONTEXTS,ft as BLOCK_PERIODS,b as BLOCK_WIDTHS,Ma as BROWSER_LAUNCH_TOOL_NAME,Na as BROWSER_TOOL_NAMES,Pa as BUNDLE_LOCALES,q as BUNDLE_NAME_PATTERN,Fa as BUNDLE_SETUP_PROMPT_MAX_LENGTH,Uu as BYTE_UNIT_LABELS,BlockContentBuilder,BundleBuilder,pt as CARD_BLOCK,nd as CATALOG_RESOURCES,mt as CHART_BLOCK,ht as CHART_KINDS,gt as COMPUTED_RETURN_TYPES,Ia as CONNECTION_GRANT_PROVIDERS,_t as CONTENT_PLACEMENT_CONTEXTS,La as CONTINUATION_KEY_PATTERN,Ra as CONVERSATION_SURFACES,za as COPY_VERB_NAME,J as CORE_BUNDLE_NAME,sf as CORE_PREFERENCES,Ba as CORE_RECORD_TOOL_NAMES,Va as CORE_TOOL_NAMES,Ha as COUNT_MODES,td as CUSTOM_LEVEL,CardBuilder,ChartBuilder,ChartQuery,_i as ConcurrentModificationError,Z as ContentBuilder,vt as DECISIONS_BLOCK,m as DECISION_INBOX_STATES,ee as DECISION_KINDS,te as DECISION_LINE_MAX_LENGTH,ne as DECISION_LINK_TARGET_TYPES,re as DECISION_LIST_STATES,ie as DECISION_READ_STATES,ae as DECISION_SETTINGS_AREAS,oe as DECISION_TITLE_MAX_LENGTH,se as DECISION_TRANSFERS_KEY,ce as DECISION_TYPES_V1,le as DECISION_TYPE_ACCESS_GRANTED,ue as DECISION_TYPE_AGENT_APPROVAL,de as DECISION_TYPE_AGENT_MESSAGE,fe as DECISION_TYPE_AGENT_QUESTION,pe as DECISION_TYPE_AGENT_REVIEW,me as DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED,he as DECISION_TYPE_AGENT_SETUP,ge as DECISION_TYPE_BUNDLE_SETUP,_e as DECISION_TYPE_CONNECTOR_CONNECTION_ERROR,ve as DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED,ye as DECISION_TYPE_ENVIRONMENT_BUILD_FAILED,h as DECISION_TYPE_KINDS,be as DECISION_TYPE_PERSON,xe as DECISION_TYPE_RECORD_ASSIGNED,Se as DECISION_TYPE_RECORD_MENTIONED,Ce as DECISION_WORK_STATES,Ua as DEFAULT_AGENT_EXECUTION_CONFIG,Wa as DEFAULT_AGENT_TOOL_GROUPS,xd as DEFAULT_APPEARANCE_ICON,Ga as DEFAULT_APPROVAL_POLICY,Ka as DEFAULT_BLUEPRINT_TOOL_GROUPS,qa as DEFAULT_DAILY_ACTIVITY_DAYS,Mu as DEFAULT_DICTATION_LIMITS,Qu as DEFAULT_LABEL_FALLBACK,yt as DEFAULT_LAYOUT_TRAITS,Ja as DEFAULT_MEETING_BOT_DISPLAY_NAME,Ya as DEFAULT_TENANT_SETTINGS,bt as DEFAULT_VALIDATION_MESSAGES,Xa as DEVICE_ACCESS_ROLES,uu as DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS,du as DEVICE_CHANNEL_IDLE_POLL_MS,pu as DEVICE_CHANNEL_KEEPALIVE_MS,lu as DEVICE_CHANNEL_MAX_FRAME_BYTES,cu as DEVICE_CHANNEL_PATH,fu as DEVICE_CHANNEL_PRESENCE_MS,mu as DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION,gu as DEVICE_COMMAND_ERROR_CODES,vu as DEVICE_DESKTOP_STATES,_u as DEVICE_SHELLS,Au as DICTATION_FINALIZATION_TIMEOUT_MS,wu as DICTATION_FRAME_BYTES,Eu as DICTATION_MAX_BUFFER_BYTES,Tu as DICTATION_MAX_FRAME_BYTES,Du as DICTATION_MAX_TRANSCRIPT_BYTES,ju as DICTATION_MODEL_ID,ku as DICTATION_PREPARATION_TIMEOUT_MS,Cu as DICTATION_SAMPLE_RATE,Ou as DICTATION_TICKET_TTL_MS,Za as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,Qa as DOCUMENT_SORT_MODES,Ld as DRAFT_CONFLICT_KINDS,$a as DRAFT_WRITE_TOOL_NAMES,DecisionsBuilder,DeviceChannelProtocolError,xu as DeviceChannelServerFrameSchema,bu as DeviceChannelWorkerFrameSchema,yu as DeviceDesktopStatusSchema,k as DuplicateError,eo as EMAIL_CATEGORY_DEFAULT_COLOR,to as EMAIL_CATEGORY_DEFAULT_ICON,no as EMAIL_CATEGORY_DESCRIPTION_MAX,ro as EMAIL_CATEGORY_DESCRIPTION_MIN,io as EMAIL_CATEGORY_LIMIT,ao as EMAIL_CATEGORY_NAME_MAX,oo as ENVIRONMENT_BUILD_LOG_STEPS,so as ENVIRONMENT_BUILD_LOG_STEP_PREFIX,co as ENVIRONMENT_HARNESSES,lo as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,uo as ENVIRONMENT_HARNESS_WORKDIR,fo as ENVIRONMENT_IMAGES,po as ENVIRONMENT_MEMORY_GB_PER_VCPU,mo as ENVIRONMENT_NAME_MAX_CHARS,ho as ENVIRONMENT_NETWORK_ALLOW_MAX,go as ENVIRONMENT_SCRIPT_MAX_BYTES,_o as ENVIRONMENT_SIZES,vo as ENVIRONMENT_SIZE_VCPUS,yo as ENVIRONMENT_STANDARDS_WORKDIR,bo as ENV_VAR_KEY_PATTERN,xo as ESTIMATED_COUNT_CAP,vi as ExportTooLargeError,So as FILE_URLS_MAX_IDS,L as FORM_FORBIDDEN_ATTRIBUTE_TYPES,yi as ForbiddenError,FormBuilder,FormRowBuilder,FormStepBuilder,Co as GET_ARCHITECT_DRAFT_TOOL_NAME,wo as GITHUB_TRIGGER_CATALOG,To as GRANT_ENABLES,xt as GROUPABLE_ATTRIBUTE_TYPES,Ed as GroupBuilder,St as HEADING_BLOCK,we as HIERARCHY_ATTRIBUTE_IDS,Te as HIERARCHY_ATTRIBUTE_NAMES,Ee as HIERARCHY_CHILD_IDS_LIMIT,Eo as HITL_TOOL_NAMES,Bu as IMAGE_FORMATS,Sd as IMAGE_SHAPES,Cd as IMAGE_SOURCES,Do as INFERENCE_REASONING_OPTIONS,Oo as INFERENCE_ROUTING_MODES,ko as INFERENCE_SPEEDS,Ct as INVENTORY_LIMIT,bi as InvalidPermissionGrantError,Ao as LAST_RUN_ERROR_MAX_LENGTH,De as LIST_VIEW_TAB_VISIBILITIES,wt as LOCATION_FILTER_PROPERTIES,xi as LogoProviderUnavailableError,Si as LogoSearchRateLimitedError,Tt as MAILBOX_BLOCK,jo as MAILBOX_LIST_MODES,Mo as MAIL_DRAFT_BODY_MAX_CHARS,No as MAIL_SIGNATURE_MAX_CHARS,Po as MAIL_SUBJECT_MAX_CHARS,Oe as MAX_AGGREGATE_GROUPS,Fo as MAX_DAILY_ACTIVITY_DAYS,Su as MAX_PRESET_DEPTH,Io as MAX_TODOS,Lo as MAX_TODO_DESCRIPTION_CHARS,Ro as MAX_TODO_ID_CHARS,Rd as MCP_SERVER_NAME_MAX_LENGTH,Et as MEASURABLE_ATTRIBUTE_TYPES,Dt as MEETINGS_UPCOMING_BLOCK,zo as MEETING_BOT_IMAGE,Bo as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,Vo as MEETING_BOT_NO_CREDITS,Ho as MEETING_BOT_SILENT_REASON,Uo as MEETING_RESPONSES,W as MEMORY_ATTRIBUTES,sd as MEMORY_PAGE_MAX_CHARS,Wo as MEMORY_SPEND_LIMIT_PATTERN,cd as MEMORY_WORKSPACE_PROFILE,od as MEMORY_WRITE_SOURCE,ud as METERED_CHARGE_KINDS,ld as METERED_RATES_USD,Ot as METRIC_BLOCK,MailboxBuilder,Ci as MemoryNotFoundError,MetricBuilder,MetricQuery,MultiRelationAttributeBuilder,ou as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,su as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,kt as NATIVE_BLOCKS,ke as NATIVE_OBJECT_NAMES,Go as NATIVE_TOOL_GROUPS,Ko as NATIVE_TOOL_GROUP_CATALOG,Xd as NEWS_DEFAULT_DISPLAY_DAYS,Zd as NEWS_DISPLAY_CAP_DAYS,Qd as NEWS_INDEX_MAX_ENTRIES,Jd as NEWS_INTENSITIES,qd as NEWS_TARGET_KINDS,V as NO_ACCESS,rf as NO_PREFERENCE_PARAMETER,qo as NO_RECORDING,At as NO_VALUE_OPERATORS,e as NonJsonValueError,NoopGeocodingAdapter,wi as NotFoundError,Ti as NotImplementedError,zd as OAUTH_TICKET_TTL_MS,H as OBJECT_GRANT,Ae as OBJECT_NAME_SCHEMA,G as OFFICIAL_SKILLS_REPO,Jo as OPEN_TOOL_PART_STATES,Yo as OPERATION_MAX_STEPS,jt as OPERATORS_BY_TYPE,ObjectBuilder,Ei as ObjectNotFoundError,Di as ObjectReferencedError,Oi as OrphanSystemAttributeError,Mt as PAGE_GRID_COLUMNS,id as PERMISSION_ACTIONS,U as PERMISSION_CAPABILITIES,ed as PERMISSION_CATALOG,Hu as PERSISTENCE_OWNED_QUOTA_KEYS,Ku as PIPES_WITH_ARGS,Xo as PROVIDER_DRAFT_LABEL,Zo as PROVIDER_NAMES,Qo as PUBLIC_MAIL_DOMAINS,Y as PageBuilder,ki as PageReferencedError,Ai as ProtectedResourceError,ji as ProtectedRoleError,Nt as QUALIFIED_SEPARATOR,Pt as QUERY_OBJECT,$o as QUESTION_FAMILY_TOOL_NAMES,Vu as QUOTA_KEYS,Mi as QueryTimeoutError,es as RECENT_ACTIVITY_LEDGER_LIMIT,ts as RECIPIENT_IDENTITIES_MAX,ns as RECORDING_OVERRIDES,rs as RECORDING_POLICIES,is as RECORD_ACCESS_ROLES,as as RECORD_ACCESS_SOURCES,os as RECORD_DRIVE_CURSOR_MAX_LENGTH,ss as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,cs as RECORD_DRIVE_PAGE_MAX_LIMIT,ls as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,us as RECORD_GRAPH_MAX_LIMIT_PER_NODE,ds as RECORD_GRAPH_MAX_NODES,fs as RECORD_IMAGE_MAX_BYTES,Ft as RECORD_LINKS_BLOCK,x as RECORD_LINKS_CONTENT,je as RECORD_LIST_SCOPES,It as RECORD_OBJECT,Od as REFERENCE_KINDS,Lt as RELATION_TARGET_ANY,Rt as REMOVED_OPERATOR_REPLACEMENTS,ps as REPLY_MODES,ms as REQUEST_DESIGN_REVIEW_TOOL_NAME,hs as REQUEST_SETUP_TOOL_NAME,Me as RESERVED_ATTRIBUTE_NAMES,Ne as RESERVED_OBJECT_NAMES,gs as RESOURCE_GRANT_KINDS,_s as RESOURCE_KIND_CATALOG,Pe as RESOURCE_VISIBILITIES,vs as ROUTING_PRICE_CEILINGS,Ni as RealtimeDeliveryError,Pi as RealtimeRateLimitedError,Fi as RealtimeSubscriptionError,Ii as RecordNotFoundError,zt as RecordQuery,Li as RecordReferencedError,Ri as RepositoryError,A as ReservedObjectNameError,zi as RoleNotFoundError,g as SCHEMA_LIMITS,R as SCHEMA_OWNER_PATTERN,Md as SCHEMA_SOURCE_RETYPE_FROM,ys as SEND_VERB_NAME,bs as SESSION_INFERENCE_PATCH_KEYS,Gu as SIMPLE_PIPES,Bt as SIMPLE_PROPERTY_TYPES,xs as SLACK_TRIGGER_CATALOG,Ss as SPEAKS_THROUGH_SEND_METADATA_KEY,fd as STANDARD_SCHEMA_VENDOR,Cs as SURFACE_TOOL_NAMES,Vt as SYNONYM_ALIASES,Fe as SYSTEM_ATTRIBUTES,Ie as SYSTEM_ATTRIBUTE_I18N_KEYS,ws as SYSTEM_EMAIL_CATEGORIES,Ts as SYSTEM_EMAIL_CATEGORY_NAMES,Le as SYSTEM_FIELD_NAMES,Ht as SYSTEM_FILTER_ATTRIBUTE_TYPES,Es as SYSTEM_PART_CODES,j as SchemaError,M as SchemaErrorCode,Bi as SearchBackendError,Vi as SearchPathNotIndexedError,SingleRelationAttributeBuilder,Hi as StorageError,Ui as SyncCascadeError,Wi as SyncConflictError,Gi as SyncError,Ki as SystemEntityImmutableError,Ds as TASK_DEMAND_LEVELS,Iu as TENANT_INVITATION_DEFAULT_TTL_MS,Ru as TENANT_INVITATION_MAX_TTL_MS,Lu as TENANT_INVITATION_MIN_TTL_MS,zu as TENANT_INVITATION_RESEND_INTERVAL_MS,S as TEXT_BLOCK,Ut as TEXT_FORMAT_PATTERNS,Os as TODO_PHASES,ks as TODO_PLAN_STATUSES,As as TODO_STATUSES,js as TOOL_APPROVAL_STATES,Ms as TOOL_IMPACT_COUNT_KEYS,Ns as TRIAGE_ACTIONS,Ps as TRIGGER_EVENT_TYPES,Fs as TURN_OUTCOMES,qi as ToolGroupGrantError,Is as UNSHAREABLE_OBJECT_NAMES,Ls as USERS_RESOLVE_MAX_IDS,Rs as USER_STATUSES,zs as USER_WORK_POSTURES,Bs as VERB_NAMES,N as ValidationError,X as ViewBuilder,Vs as WAKE_TURN_METADATA_KEY,Hs as WAKE_TURN_SPOKE_METADATA_KEY,Wt as WIRE_OFFERED_BASE_CONFIG,Gt as WIRE_OMITTED_CONFIG_KEYS,Ji as WorkspaceInvariantReason,Us as actorSchema,Ws as agent,Gs as agentAvatarFromMetadata,Ks as agentAvatarSchema,qs as agentDataChunk,Js as agentDisplayName,Ys as agentInferencePreferencesSchema,Xs as agentMessageAttachmentSchema,Zs as agentMessagePartSchema,Qs as agentScheduleSchema,$s as agentSessionInferenceOverridesInputSchema,ec as agentSessionInferenceOverridesSchema,tc as agentSessionMessageSchema,nc as agentStartersSchema,rc as agentTriggerBaseSchema,ic as agentTriggerPatchSchema,ac as agentTriggerSchema,oc as agentUIValidationError,applyPipes,sc as artifactQuoteSchema,t as asTenantId,n as asUserId,cc as askQuestionsOutputSchema,assertBundleName,lc as assertCustomAgentUIMessageChunk,assertSchemaSourceResolutions,uc as assertSessionState,Kt as attributeConfigSchemas,qt as attributeFilterTarget,Jt as attributeInventory,Yt as blockObjectInputs,buildPropertySchema,Xt as buildQualifiedAttribute,builtBundleFromPieces,bundle,r as canonicalStringify,dc as canonicalToolGroups,Zt as canonicalizeFilterValue,capabilityForResource,Qt as capped,checkbox,fc as classificationRestoreSchema,pc as classifyEmailSchema,mc as cliDefaultModelOf,$t as collectContentViewCatalogue,en as collectQualifiedRuleIssues,tn as collectionContentSourceSchema,nn as collectionSourceAddress,rn as collectionSourceAddressOf,ze as colorIdSchema,an as columnsSchema,hc as compareAgentSessionMessages,compareSchemaStateEntries,compareVersions,gc as compiledHarnessModels,computeByteMagnitude,computeReconnectDelay,computeRetryDelay,_c as connectionGrantKindsOf,vc as connectorTriggerMatchSchema,Dd as content,contentDefinition,C as contentExtensionRegistry,on as contentReadObjects,w as contentViewDefinitionSchema,sn as contentViewDefinitionSchemaFor,convertRetypedValue,cn as createAttributeValidator,ln as createFormAttributeValidator,createStandardSchemaProps,currency,dn as currentActor,yc as customDataChunkSchemas,date,Be as decisionThreadKey,Ve as decisionTransferBy,He as decisionTransfersOf,declaredImageRequests,bc as decodeAgentSessionListCursor,i as deepEqual,pn as defineBlock,deriveLayout6,xc as deriveViewerAccess,mn as describeViewIssue,detailView,deviceChannelUrl,diffSchemaState,hn as displayAttributesSchema,document,gn as draftContentViewDefinitionSchema,_n as draftContentViewDefinitionSchemaFor,droppedContents,Sc as durableDateSchema,vn as edgePropertyFilterTarget,Cc as emailCategoryCreateSchema,wc as emailCategoryDeleteSchema,Tc as emailCategoryScopeQuerySchema,Ec as emailCategoryUpdateSchema,Dc as emailRuleScopeSchema,Oc as encodeAgentSessionListCursor,kc as environmentHarness,Ac as environmentWorkdir,extractAttributeNames,extractAttributePaths,yn as extractCurrencyFilterValue,bn as extractFilterValue,extractReadRecordIds,extractTouchedArtifacts,extractTouchedDocuments,extractTouchedRecords,xn as filterOperatorsOfType,Sn as filterStateSchema,Cn as filterTargetsOf,jc as findEnvironmentHarness,findGrantIssues,wn as findGridViolation,Tn as findGroupViolation,En as findLayoutRuleViolation,Dn as findRelationAttribute,On as findRowLimitViolation,foldText,form,formFieldFlatKey,formFieldKey,formatByteSize,Ue as formatDecisionLink,formatNewsTarget,kn as formatPhoneForDisplay,formatReference,formatSkillSource,An as formatZodErrors,formula,a as generateId,jn as getAttributeCapabilities,Mn as getAttributeConfigSchema,Nn as getAttributeConfigWriteSchema,Pn as getAttributeFilterOperators,getEditableLabelAttribute,We as getHierarchyAttributes,Ge as getObjectSystemAttributes,In as getOperatorPolarity,Ln as getRollupFilterOperators,getSingleAttributeFromExpression,getSlotFieldTargets,Ke as getSystemAttributeI18nKey,qe as getSystemAttributeList,Mc as githubConditionSchema,Nc as githubTriggerMatchSchema,Pc as grantKindOf,Rn as gridPositionSchema,group,zn as groupSizeMessage,Bn as groupedMembers,Fc as harnessModelChoices,hasLocale,hasOptions,Vn as hasTypeTrait,Hn as hasValueKind,hashBundlePieces,Ic as humanRequestId,Lc as humanRequestKind,_ as iconNameSchema,imageLookupKindOf,imageModelFormatDefect,Rc as imageModelIdSchema,o as indexBy,Un as inferInverseCardinality,zc as inferenceReasoningSchema,Bc as inferenceRoutingSchema,Vc as inferenceSpeedSchema,Wn as input,Gn as invalidViewMessage,Je as isActionableDecisionKind,Hc as isAgentMessageMetadata,Uc as isAgentNotificationMetadata,Wc as isAgentUIDataName,Gc as isAgentWakeMetadata,Kc as isAgentWrittenAuditEntry,qc as isArchitectPublicationMetadata,Kn as isAttributeFilterable,qn as isAttributeGroupable,Yi as isAttributeInUseError,Jn as isAttributeKanbanGroupable,Yn as isAttributeSearchable,Xn as isAttributeSortable,Jc as isAwaitingHuman,Zn as isBilateralRelation,Yc as isBlocking,Qn as isBoardGrouping,isBundle,$n as isCalendarDay,isCatalogResource,er as isCollectionContent,tr as isDynamicValue,nr as isEmptyValue,Xc as isEnvironmentBuildLogStep,Zc as isEnvironmentHarnessId,isFormDefinition,isFormFieldsRow,isFormFreeFieldRef,isFormHeadingRow,isFormSeparatorRow,isFormSlotFieldRef,isFormTextRow,Ye as isHierarchyAttribute,isImageSource,isLabelExpression,rr as isLocationFilterProperty,ir as isLocationPartOperator,Qc as isMailProvider,$c as isMailboxListMode,Xe as isManagedSystemAttribute,isMeteredChargeKind,v as isNativeObjectName,el as isNativeToolGroup,ar as isNoValueOperator,Xi as isNotFoundError,or as isNullishOrEmptyString,Zi as isObjectReferencedError,tl as isOpenToolPartState,nl as isParkedOnHuman,isPinnedSkillSource,Ze as isPlainRecord,Qi as isProtectedResourceError,rl as isProviderDraft,il as isPublicMailDomain,al as isQuestionPart,$i as isRecordReferencedError,sr as isRelativeDateValue,ol as isReplyMode,sl as isResourceGrant,cl as isRoutineActorMetadata,ea as isSchemaError,isSemver,ll as isSessionInferencePatch,cr as isSetMembershipOperator,isSkillRepository,isStandardSchema,ul as isSystemEmailCategory,dl as isSystemEmailCategoryName,fl as isSystemPartCode,pl as isToolApprovalState,ml as isToolImpactCountKey,lr as isUniversalRelation,ta as isValidationError,T as isValueKindType,ur as isValuePresent,isWherePipe,isWildcard,judgePreferenceWrite,keptFill,B as labelExpressionSchema,dr as layoutTraitsOf,levelActions,levelFloor,levelOf,listView,locatePreference,location,fr as locationPartFilterTarget,hl as lockingSendCall,gl as meetingBotDispatchRequestSchema,_l as meetingBotDispatchResponseSchema,vl as meetingBotNotificationSchema,yl as meetingTranscriptSegmentSchema,E as memberlessGroups,memoryPageViewOf,bl as mentionReferenceSchema,xl as mergeSessionInferencePatch,meteredUsd,pr as metricComparePeriod,Sl as modelDefinitionSchema,Kd as modelIdentitySchema,Cl as modelReferenceSchema,moveWidensAudience,multiselect,nameSlug,Id as namedTargetSchema,nativeAgentUIPartIdMetadataKey,wl as needsManageWhenUnattended,mr as normalizeCountrylessPhoneNumber,hr as normalizeFilterRule,gr as normalizeForEdgeRpc,normalizeNewsLocale,_r as normalizeOperator,vr as normalizePhoneNumber,Tl as normalizedMeetingTranscriptSchema,yr as now,number,object,Td as objectImageSchema,El as openRequests,Dl as orderAgentSessionMessages,packLayout,page,pageCompactor,xr as pageTraitsOf,Ol as parseAgentDefinitionAccessRole,kl as parseAgentSessionAccessRole,Sr as parseAttributeConfig,Cr as parseAttributeConfigForCreate,wr as parseAttributeConfigForUpdate,D as parseBlockParameters,Al as parseCountMode,Qe as parseDecisionLink,jl as parseDeviceAccessRole,parseDeviceChannelFrame,Ml as parseMergedAgentTrigger,parseNamedTarget,parseNativeAgentUIPartIdsMetadata,parseNewsBody,parseNewsIndex,parseNewsIntensity,parseNewsTarget,Nl as parseOptionalCountMode,Pl as parsePageAccessRole,Tr as parseQualifiedAttribute,Fl as parseRecordAccessRole,$e as parseRecordListScope,parseReference,et as parseResourceVisibility,parseSchemaGroupPresentation,parseSchemaOwner,parseSchemaState,parseServerFrame,parseSkillSource,Il as parseToolGroupGrant,parseWherePipe,parseWorkerFrame,ad as permissionGrantSchema,phone,placeNew,preference,preferenceEntry,Er as propertyAttributeSchema,Dr as propertyAttributeWireSchema,Or as propertySchemaSchema,kr as propertySchemaWireSchema,Ll as providerNameSchema,O as publishedViewContentDefinitionSchema,Ar as query,Rl as readArchitectPublication,readArtifactResult,zl as readAskQuestionsResult,readFormFieldValue,readGeneratedImageResult,Bl as recentActivityEntryKey,Vl as recordGraphNodeKey,Hl as recordGraphRequestSchema,recordLinksTab,Ul as recordMeetingsCount,Wl as recordOperationSchema,jr as recordQueryDefinitionSchema,Gl as refineTrigger,Mr as refuseForeignKeys,Nr as rejectUnknownAttributesOrThrow,relation,Pr as relationAcceptsObject,relationProperty,Fr as relationTargetsOf,renderLabelExpression,repairPageGrid,requestedCapabilities,Lr as requireRecordContentContext,Rr as requireSingleRelationTarget,resolveAppearance,zr as resolveCollectionActions,Br as resolveContentNavigation,Vr as resolveEffectiveFilterType,resolveFieldRequired,Hr as resolveIsWithinBounds,resolveLocalized,resolvePageGrid,resolvePropertyDefinitions,Ur as resolveTextPattern,Wr as resolveUtcDayBounds,resolveViewContents,Kl as resourceGrant,richtext,rollup,ql as routedMessageInferenceSchema,sameActions,s as sameStableValue,schemaGroupKey,schemaStateSourcePayload,select,Gr as selectOptionWriteSchema,c as serializeCanonicalJson,l as serializeStableJson,Jl as sessionInferencePatchSchema,settleLayout,sha256Hex,Kr as singleRelationTarget,Yl as slackConditionSchema,Xl as slackTriggerMatchSchema,snapWidth,qr as sortsSchema,Jr as sourcedAttributeOf,status,Yr as statusGroupSchema,Xr as statusOptionWriteSchema,storedContentDefinition,Zr as systemColumnFilterTarget,text,Qr as toMultiValueOperator,$r as toUtcDayString,ei as today,Zl as todoItemSchema,Ql as todoPlanSchema,$l as toolImpactSchema,user,eu as utf8ByteLength,ti as validateAttribute,tt as validateAttributeName,ni as validateContentViewCatalogue,ri as validateDraft,ii as validateDraftOrThrow,validateLabelExpression,ai as validateObject,validateObjectExpressions,validateObjectImage,it as validateObjectName,oi as validateObjectOrThrow,si as validateQualifiedRule,ci as validateStoredViews,ot as validateViewName,widthStepConstraint,li as wireHiddenTypeConfigMask,ui as wireOmittedConfigKeysFor,withPreferenceEntry,withoutTrailingSlashes,di as withoutUnknownOptionKeys,workspaceViewAuthoring};