@stndrds/schema 1.0.0-alpha.313 → 1.0.0-alpha.315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{all-Bh7BpJ3Y.d.mts → all--LbSrtzk.d.mts} +3 -3
- package/dist/{all-DDzsVtfc.d.ts → all-BGyE2RCe.d.ts} +3 -3
- package/dist/{attributes-BsUcQxfH.d.mts → attributes-cBtnsK8O.d.mts} +4 -0
- package/dist/{attributes-BsUcQxfH.d.ts → attributes-cBtnsK8O.d.ts} +4 -0
- package/dist/{chunk-XB3VOCHA.mjs → chunk-D6LPMF5N.mjs} +1 -1
- package/dist/{chunk-TQLF3EZP.js → chunk-IBM4ID4Y.js} +4 -4
- package/dist/{chunk-DBQCXRYQ.js → chunk-JRBNMHMY.js} +2 -2
- package/dist/chunk-JSKLP4GI.js +12 -0
- package/dist/{chunk-5667SMJ5.js → chunk-RTHLB6T6.js} +2 -2
- package/dist/{chunk-IJPA4GYV.js → chunk-WKDJGNVI.js} +2 -2
- package/dist/{chunk-JBXPLCBH.mjs → chunk-XAVRKIBE.mjs} +1 -1
- package/dist/chunk-XRWRECDA.mjs +12 -0
- package/dist/{chunk-X4BSQRL3.mjs → chunk-YFW2M45I.mjs} +1 -1
- package/dist/{chunk-KBGHKQMA.mjs → chunk-YJSVWV3Z.mjs} +1 -1
- package/dist/exceptions.d.mts +1 -1
- package/dist/exceptions.d.ts +1 -1
- package/dist/exceptions.js +1 -1
- package/dist/exceptions.mjs +1 -1
- package/dist/{helpers-hW8PfxNx.d.ts → helpers-BOtvDGN6.d.ts} +3 -3
- package/dist/{helpers-CiU_vIe1.d.mts → helpers-DrbRe4Xl.d.mts} +3 -3
- package/dist/{index-sxXxWq8j.d.ts → index-XQ-3wEYg.d.ts} +2 -2
- package/dist/{index-DJ33uX8f.d.mts → index-p0utq5vG.d.mts} +2 -2
- package/dist/index.d.mts +129 -10
- package/dist/index.d.ts +129 -10
- package/dist/index.js +13 -13
- package/dist/index.mjs +5 -5
- package/dist/{objects-BAijMcPz.d.ts → objects-iPrveCDN.d.ts} +1 -1
- package/dist/{objects-Bt_2NvL4.d.mts → objects-kXaFEi-P.d.mts} +1 -1
- package/dist/{types-BRpOXTl1.d.ts → types-CT0s-S_Y.d.ts} +1 -1
- package/dist/{types-CIvAiCE3.d.mts → types-DgPbxSij.d.mts} +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/dist/validation/all.d.mts +6 -6
- package/dist/validation/all.d.ts +6 -6
- package/dist/validation/all.js +1 -1
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/complex/currency.d.mts +2 -2
- package/dist/validation/complex/currency.d.ts +2 -2
- package/dist/validation/complex/location.d.mts +2 -2
- package/dist/validation/complex/location.d.ts +2 -2
- package/dist/validation/complex/phone.d.mts +2 -2
- package/dist/validation/complex/phone.d.ts +2 -2
- package/dist/validation/complex/relation.d.mts +2 -2
- package/dist/validation/complex/relation.d.ts +2 -2
- package/dist/validation/complex/richtext.d.mts +2 -2
- package/dist/validation/complex/richtext.d.ts +2 -2
- package/dist/validation/complex/select.d.mts +2 -2
- package/dist/validation/complex/select.d.ts +2 -2
- package/dist/validation/complex/user.d.mts +2 -2
- package/dist/validation/complex/user.d.ts +2 -2
- package/dist/validation/computed/formula.d.mts +2 -2
- package/dist/validation/computed/formula.d.ts +2 -2
- package/dist/validation/computed/rollup.d.mts +2 -2
- package/dist/validation/computed/rollup.d.ts +2 -2
- package/dist/validation/config/index.d.mts +3 -3
- package/dist/validation/config/index.d.ts +3 -3
- package/dist/validation/config/index.js +1 -1
- package/dist/validation/config/index.mjs +1 -1
- package/dist/validation/core/index.d.mts +3 -3
- package/dist/validation/core/index.d.ts +3 -3
- package/dist/validation/object/index.d.mts +4 -4
- package/dist/validation/object/index.d.ts +4 -4
- package/dist/validation/object/index.js +1 -1
- package/dist/validation/object/index.mjs +1 -1
- package/dist/validation/primitives/checkbox.d.mts +2 -2
- package/dist/validation/primitives/checkbox.d.ts +2 -2
- package/dist/validation/primitives/date.d.mts +2 -2
- package/dist/validation/primitives/date.d.ts +2 -2
- package/dist/validation/primitives/number.d.mts +2 -2
- package/dist/validation/primitives/number.d.ts +2 -2
- package/dist/validation/primitives/text.d.mts +2 -2
- package/dist/validation/primitives/text.d.ts +2 -2
- package/package.json +2 -2
- package/dist/chunk-L277YJLQ.js +0 -12
- package/dist/chunk-LDK7LMOY.mjs +0 -12
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
var bo=["fyi","task","question","handoff","system"],go=["low","normal","high","urgent"],yo=["public","internal","sensitive"],ho=["unread","read","archived","snoozed"],Ao=["none","pending","processing","completed","dismissed","expired","failed"],Du="agent.session.waiting_human",Eu="agent.task.assigned",Ou="agent.question.requested",Wg=[Du,Eu,Ou];var Hg=["name","type"],Yg=["required","hidden","archived","deprecated","defaultValue","config","order","unique"],Qg=["label","description","placeholder","icon"];var To=["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"],ee="*";function Zg(e){return e.type!=="relation"||!Array.isArray(e.targets)?[]:e.targets.map(t=>t.object).filter(t=>t!==ee)}chunkDPD6ZWL2_js.a(Zg,"relationTargetsOf");function wo(e){return e.targets.length===1&&e.targets[0].object===ee}chunkDPD6ZWL2_js.a(wo,"isUniversalRelation");function ey(e){return e.bilateral!==void 0}chunkDPD6ZWL2_js.a(ey,"isBilateralRelation");function ty(e){return "many"}chunkDPD6ZWL2_js.a(ty,"inferInverseCardinality");function ry(e){return chunkDBQCXRYQ_js.n(e)}chunkDPD6ZWL2_js.a(ry,"isAttributeSortable");var oy=["record","object","attribute","view","user","role","settings","file","agent","schema_source"],ay=["record.created","record.updated","record.deleted","record.restored","record.purged","object.created","object.updated","object.deleted","attribute.created","attribute.updated","attribute.deleted","view.created","view.updated","view.deleted","schema_source.applied","schema_source.removed","user.created","user.invited","user.updated","user.deleted","user.login","user.logout","role.created","role.updated","role.deleted","role.assigned","role.revoked","settings.updated","file.uploaded","file.updated","file.deleted"];function ly(e){return e.phase==="terminal"}chunkDPD6ZWL2_js.a(ly,"isTerminalState");function dy(e){switch(e.phase){case "running":return "active";case "queued":return "idle";case "parked":if(e.parkedOn===void 0)throw new chunkL277YJLQ_js.b("parked state without parkedOn",chunkL277YJLQ_js.a.INVARIANT_VIOLATION);return e.parkedOn==="agents"?"waiting_agents":"waiting_human";case "terminal":if(e.outcome===void 0)throw new chunkL277YJLQ_js.b("terminal state without outcome",chunkL277YJLQ_js.a.INVARIANT_VIOLATION);return e.outcome}}chunkDPD6ZWL2_js.a(dy,"sessionStateToLegacyStatus");function cy(e){switch(e){case "active":return {phase:"running"};case "idle":return {phase:"queued"};case "waiting_human":return {phase:"parked",parkedOn:"human",humanRequestIds:[]};case "waiting_agents":return {phase:"parked",parkedOn:"agents"};default:return {phase:"terminal",outcome:e}}}chunkDPD6ZWL2_js.a(cy,"legacyStatusToSessionState");var Cu=["completed","failed","cancelled","timeout","expired"];function py(e){return Cu.includes(e)}chunkDPD6ZWL2_js.a(py,"isTerminalSessionStatus");var _u=["idle","completed","waiting_human","waiting_agents","cancelled","failed","timeout"];function my(e){return _u.includes(e)}chunkDPD6ZWL2_js.a(my,"isClaimableSessionStatus");var xo=Object.freeze({mutation:"ask",destructive:"ask",outward:"ask"}),fy=["active","completed","abandoned"],Io=["openai","anthropic","google","spacexai","deepseek","moonshotai","alibaba","mistral","minimax","meta","zai"],So=["standard","fast"],vo=["none","minimal","low","medium","high","xhigh"];function by(e){return e.label?.trim()||e.name}chunkDPD6ZWL2_js.a(by,"agentDisplayName");var Ro=["approval-requested","approval-responded","approval-dispatched"],Nu=["streaming","running","pending",...Ro];function gy(e){return Nu.includes(e)}chunkDPD6ZWL2_js.a(gy,"isOpenToolPartState");function yy(e){return Ro.includes(e)}chunkDPD6ZWL2_js.a(yy,"isToolApprovalState");var br=["CREDITS_EXHAUSTED"];function hy(e){return typeof e=="string"&&br.includes(e)}chunkDPD6ZWL2_js.a(hy,"isSystemPartCode");function ku(e,t){let r=e.createdAt.getTime()-t.createdAt.getTime();return r===0?e.id.localeCompare(t.id):r}chunkDPD6ZWL2_js.a(ku,"compareAgentSessionMessages");function Ay(e){return [...e].sort(ku)}chunkDPD6ZWL2_js.a(Ay,"orderAgentSessionMessages");var Ty=["pending","in_progress","completed","blocked"],wy=50,xy=80,Iy=500;var Dy="session-state",Pu="__stndrdsNativeUiPartIds",ju=1,Fu="Native agent UI part IDs metadata is invalid";function de(){throw new chunkL277YJLQ_js.h(Fu,[])}chunkDPD6ZWL2_js.a(de,"invalidNativePartIds");function Do(e){if(e===null||typeof e!="object"||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}chunkDPD6ZWL2_js.a(Do,"isPlainRecord");function Vu(e,t){if(e.type==="text"||e.type==="reasoning")return `${e.type}:${t}`;if(e.type==="tool")return `tool:${e.toolCallId}`}chunkDPD6ZWL2_js.a(Vu,"nativeAgentUIPartIdMetadataKey");function Ey(e){let t=e.metadata?.[Pu];Do(t)||de(),(Object.keys(t).length!==2||t.schemaVersion!==ju||!Do(t.partIds))&&de();let r=new Map;for(let[s,u]of e.parts.entries()){let d=Vu(u,s);if(!d||r.has(d)){d&&de();continue}r.set(d,u);}let n=Object.entries(t.partIds);n.length!==r.size&&de();let o=new Map,a={};for(let[s,u]of n){let d=r.get(s);d&&typeof u=="string"&&u.length>0||de();let f=o.get(u);f&&(d.type==="tool"||f!==d.type)&&de(),d.type==="tool"&&u!==d.toolCallId&&de(),o.set(u,d.type),a[s]=u;}return a}chunkDPD6ZWL2_js.a(Ey,"parseNativeAgentUIPartIdsMetadata");var _y=16e3,Ny=3200,ky=6400,Py=16e3,jy=65536,Fy=15e3,Vy=1e4,My=5e3,Ly="google/gemini-3.5-transcribe-live",By={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2};var Uy=["web","presentation","document","spreadsheet","image","code","other"],qy=["ephemeral","conversation","persistent"],zy=["source","preview","entrypoint","asset"];var Eo=5;function Ky(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"?"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e):String(e)}chunkDPD6ZWL2_js.a(Ky,"getErrorMessage");function Jy(e){return typeof e=="object"&&e!==null&&"slots"in e&&"steps"in e&&"name"in e&&typeof e.name=="string"&&Array.isArray(e.slots)&&Array.isArray(e.steps)}chunkDPD6ZWL2_js.a(Jy,"isFormDefinition");var gr=["relation","multiRelation","formula","rollup","document","richtext","user"];function Oo(e){return e.type==="slot"}chunkDPD6ZWL2_js.a(Oo,"isFormSlotFieldRef");function yr(e){return e.type==="free"}chunkDPD6ZWL2_js.a(yr,"isFormFreeFieldRef");function eh(e){return e.fieldRequired!==void 0?e.fieldRequired:e.slotMode==="create"&&e.attributeRequired===true}chunkDPD6ZWL2_js.a(eh,"resolveFieldRequired");function Co(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}chunkDPD6ZWL2_js.a(Co,"getSlotFieldTargets");function Mu(e){return Oo(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}chunkDPD6ZWL2_js.a(Mu,"formFieldKey");function Lu(e){return Oo(e)?e.attribute:e.attribute.name}chunkDPD6ZWL2_js.a(Lu,"formFieldFlatKey");function th(e,t){return e[Mu(t)]??e[Lu(t)]}chunkDPD6ZWL2_js.a(th,"readFormFieldValue");function ft(e){return e.type==="fields"}chunkDPD6ZWL2_js.a(ft,"isFormFieldsRow");function ih(e){return e.type==="heading"}chunkDPD6ZWL2_js.a(ih,"isFormHeadingRow");function oh(e){return e.type==="separator"}chunkDPD6ZWL2_js.a(oh,"isFormSeparatorRow");function ah(e){return e.type==="text"}chunkDPD6ZWL2_js.a(ah,"isFormTextRow");var hr=class hr{async autocomplete(){return await Promise.resolve([])}async reverse(){return await Promise.resolve(null)}async geocode(){return await Promise.resolve(null)}};chunkDPD6ZWL2_js.a(hr,"NoopGeocodingAdapter");var _o=hr;var Ar=["read","create","update","delete","manage"];function mh(e){return e.length===0?"none":e.length===1&&e[0]==="read"?"read-only":e.length===Ar.length&&Ar.every(t=>e.includes(t))?"full":"custom"}chunkDPD6ZWL2_js.a(mh,"actionsToAccessLevel");function fh(e){switch(e){case "full":return [...Ar];case "read-only":return ["read"];case "none":return []}}chunkDPD6ZWL2_js.a(fh,"accessLevelToActions");function No(e){let t=e.properties;if(!t)return [];if(Array.isArray(t))return t;let r=t;return Array.isArray(r.definitions)?r.definitions:[]}chunkDPD6ZWL2_js.a(No,"resolvePropertyDefinitions");function yh(e){return e.type==="select"||e.type==="status"||e.type==="multiselect"}chunkDPD6ZWL2_js.a(yh,"hasOptions");var Bu="Notetaker",Th={systemPrompt:null,meetingRecordingPolicy:"none",meetingBotDisplayName:Bu};var xh=["active","suspended"],Ih=["architect","manual","auto"];function vh(e){return `${e.object}:${e.name}:${e.type}`}chunkDPD6ZWL2_js.a(vh,"viewStateKey");function bt(e){return e.type==="detail"}chunkDPD6ZWL2_js.a(bt,"isDetailView");function ko(e){return e.type==="list"}chunkDPD6ZWL2_js.a(ko,"isListView");function $u(e){return e.type==="fields"}chunkDPD6ZWL2_js.a($u,"isFieldGroup");var Ch=["square","landscape","portrait"];var Po=["none","estimated","exact"];function Uu(e){if(typeof e=="string"&&Po.includes(e))return e;throw new chunkL277YJLQ_js.h(`countMode must be one of: ${Po.join(", ")} (received: ${String(e)})`,[])}chunkDPD6ZWL2_js.a(Uu,"parseCountMode");function kh(e){return e===void 0?void 0:Uu(e)}chunkDPD6ZWL2_js.a(kh,"parseOptionalCountMode");var Ph=1e4;var Vh=["storage.bytes","members.seats","data.live_records"];function qu(e){return e==null?true:typeof e!="object"?false:Object.keys(e).length===0}chunkDPD6ZWL2_js.a(qu,"isEmptyObject");function jo(e){return e!=null&&typeof e=="object"&&Object.keys(e).length>0}chunkDPD6ZWL2_js.a(jo,"isNotEmpty");function zu(e){return jo(e)?e:void 0}chunkDPD6ZWL2_js.a(zu,"toUndefinedIfEmpty");function Gu(e){if(e<=0)return {value:0,unitIndex:0};let t=1e3,r=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return {value:Number.parseFloat((e/t**r).toFixed(1)),unitIndex:r}}chunkDPD6ZWL2_js.a(Gu,"computeByteMagnitude");var Wu=["B","KB","MB","GB","TB"];function CA(e){let{value:t,unitIndex:r}=Gu(e);return `${t} ${Wu[r]}`}chunkDPD6ZWL2_js.a(CA,"formatByteSize");function Ku(e){return e.displayAttributes!==void 0?[...e.displayAttributes]:[...new Set([e.cardUserAttribute,e.cardDateAttribute].filter(t=>t!==void 0))]}chunkDPD6ZWL2_js.a(Ku,"getListViewDisplayAttributeNames");var jA={ATTACHMENTS:"attachments"};function FA(e){return e.type==="document"}chunkDPD6ZWL2_js.a(FA,"isDocumentAttribute");function VA(e,t){if(!t||t.length===0)return true;let r=e.name.toLowerCase();return t.some(n=>n.endsWith("/*")?e.mimeType.startsWith(n.slice(0,-1)):n.startsWith(".")?r.endsWith(n.toLowerCase()):e.mimeType===n)}chunkDPD6ZWL2_js.a(VA,"matchesAccepts");var Fo=Object.freeze(["text","number","checkbox","date","phone","currency","status","select","multiselect","location"]);function gt(e){let t=[];for(let r of e){let n=r.build();if(!Fo.includes(n.type))throw new Error(`Property type "${n.type}" is not supported in .qualifyWith()`);t.push(n);}return {definitions:t}}chunkDPD6ZWL2_js.a(gt,"buildPropertySchema");var UA="__";function qA(e){let t=e.indexOf("__");return t<=0||t+2>=e.length?{kind:"scalar",attribute:e}:{kind:"qualified",root:e.slice(0,t),property:e.slice(t+2)}}chunkDPD6ZWL2_js.a(qA,"parseQualifiedAttribute");function zA(e,t){return `${e}__${t}`}chunkDPD6ZWL2_js.a(zA,"buildQualifiedAttribute");function ne(e){return typeof e=="object"&&e!==null&&typeof e.start=="string"}chunkDPD6ZWL2_js.a(ne,"isDateRangeValue");function Hu(e,t){return chunkTQLF3EZP_js.a(e)?null:ne(e)?t.endDate?{start:e.start,end:e.end??null}:e.start:typeof e=="string"?t.endDate?{start:e,end:null}:e:null}chunkDPD6ZWL2_js.a(Hu,"normalizeDateValue");function Te(e){return typeof e=="string"&&e!==""?e:ne(e)&&e.start!==""?e.start:null}chunkDPD6ZWL2_js.a(Te,"dateValueStart");var yt="\u2014";function Yu(e){return String(e)}chunkDPD6ZWL2_js.a(Yu,"formatText");function Qu(e){return e?"Yes":"No"}chunkDPD6ZWL2_js.a(Qu,"formatCheckbox");function Ju(e,t){if(typeof e!="number")return String(e);if(t.renderAs==="rating")return `${e}/${t.max??5}`;let r=t.decimals;return t.unit==="integer"?e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}):t.unit==="percentage"?(e/100).toLocaleString(void 0,{style:"percent",minimumFractionDigits:r,maximumFractionDigits:r}):e.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}chunkDPD6ZWL2_js.a(Ju,"formatNumber");function Xu(e,t){if(typeof e!="object"||e===null)return String(e);let r=e;return "value"in r&&"code"in r?`${r.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} ${r.code}`:String(e)}chunkDPD6ZWL2_js.a(Xu,"formatCurrency");function Tr(e){if(ne(e)){let t=Tr(e.start);return e.end?`${t} \u2192 ${Tr(e.end)}`:t}if(e instanceof Date)return e.toISOString().split("T")[0];if(typeof e=="string"){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toISOString().split("T")[0]}return String(e)}chunkDPD6ZWL2_js.a(Tr,"formatDate");function Zu(e){if(typeof e!="object"||e===null)return String(e);let t=e;return "phoneNumber"in t?t.phoneNumber?t.countryCode?chunkGXSNLYRR_js.c(t):t.phoneNumber:"":String(e)}chunkDPD6ZWL2_js.a(Zu,"formatPhone");function el(e,t="full"){if(typeof e!="object"||e===null)return "";let r=e,n=[];switch(t){case "country":r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;case "state":r.state&&n.push(r.state),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;case "city":r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;case "coordinates":r.latitude!==void 0&&r.longitude!==void 0&&n.push(`${r.latitude}, ${r.longitude}`);break;case "address":r.address&&n.push(r.address),r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;default:r.address&&n.push(r.address),r.address2&&n.push(r.address2),r.city&&n.push(r.city),r.state&&n.push(r.state),r.postalCode&&n.push(r.postalCode),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break}return n.join(", ")}chunkDPD6ZWL2_js.a(el,"formatLocationValue");function tl(e,t){return typeof e!="object"||e===null?String(e):el(e,t.granularity??"full")||yt}chunkDPD6ZWL2_js.a(tl,"formatLocation");function rl(e,t){return typeof e!="string"?String(e):t.options?.find(n=>n.value===e)?.label??String(e)}chunkDPD6ZWL2_js.a(rl,"formatSelect");function nl(e,t){return Array.isArray(e)?t.options?e.map(n=>t.options.find(o=>o.value===n)?.label).filter(Boolean).join(", "):e.join(", "):String(e)}chunkDPD6ZWL2_js.a(nl,"formatMultiselect");function Vo(e,t){if(chunkTQLF3EZP_js.a(e))return yt;switch(t.type){case "text":return Yu(e);case "checkbox":return Qu(e);case "number":return Ju(e,t);case "currency":return Xu(e);case "date":return Tr(e);case "phone":return Zu(e);case "location":return tl(e,t);case "select":case "status":return rl(e,t);case "multiselect":return nl(e,t);case "user":case "relation":return Array.isArray(e)?e.join(", "):String(e);default:return Array.isArray(e)?e.join(", "):String(e)}}chunkDPD6ZWL2_js.a(Vo,"formatAttributeValue");var ol=["UPPER","LOWER","capitalize","trim"],al=["prefix","suffix","wrap","default"],ht=[...ol,...al],we=Ir.z.string().min(1,"labelExpression cannot be empty").refine(e=>At(e),{message:"labelExpression must contain at least one {{ attribute }} interpolation"}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:"labelExpression contains empty {{ }} interpolation"}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,r;for(;(r=t.exec(e))!==null;){let n=r[1];if(!ht.includes(n))return false}return true},{message:`Invalid pipe name. Valid pipes: ${ht.join(", ")}`});function sl(e){let t=we.safeParse(e);return t.success?{success:true,attributes:qo(e)}:{success:false,error:t.error.issues[0]?.message??"Invalid labelExpression"}}chunkDPD6ZWL2_js.a(sl,"validateLabelExpression");var Mo={UPPER:chunkDPD6ZWL2_js.a(e=>String(e).toUpperCase(),"UPPER"),LOWER:chunkDPD6ZWL2_js.a(e=>String(e).toLowerCase(),"LOWER"),capitalize:chunkDPD6ZWL2_js.a(e=>String(e).replace(/(^|\s)\S/g,t=>t.toUpperCase()),"capitalize"),trim:chunkDPD6ZWL2_js.a(e=>String(e).trim(),"trim")},Lo={prefix:chunkDPD6ZWL2_js.a((e,t="")=>e?`${t}${e}`:"","prefix"),suffix:chunkDPD6ZWL2_js.a((e,t="")=>e?`${e}${t}`:"","suffix"),wrap:chunkDPD6ZWL2_js.a((e,t="",r="")=>e?`${t}${e}${r}`:"","wrap"),default:chunkDPD6ZWL2_js.a((e,t="")=>e||t,"default")};function ul(e,t){let r=e;for(let n of t){let{name:o,args:a}=$o(n),s=Mo[o];if(s)r!==""&&(r=s(r));else {let u=Lo[o];u&&(r=u(r,...a));}}return r}chunkDPD6ZWL2_js.a(ul,"applyPipes");function ll(e,t){return t.split(".").reduce((r,n)=>{if(!(r==null||typeof r!="object"))return r[n]},e)}chunkDPD6ZWL2_js.a(ll,"getValue");var Bo="(Untitled)";function $o(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return {name:e,args:[]};let r=t[1],n=t[2];if(!n)return {name:r,args:[]};let o=[],a=/["']([^"']*?)["']/g,s;for(;(s=a.exec(n))!==null;)o.push(s[1]);return {name:r,args:o}}chunkDPD6ZWL2_js.a($o,"parsePipeExpression");function wr(e,t,r=Bo){return e.replace(/\{\{\s*([^}]+)\s*\}\}/g,(o,a)=>{let s=a.split("||").map(R=>R.trim()),d=s[s.length-1].split("|").map(R=>R.trim());s[s.length-1]=d[0];let f=d.slice(1).filter(Boolean),x=s.filter(Boolean),v="";for(let R of x){let Z=Uo(ll(t,R));if(Z!==""){v=Z;break}}if(chunkTQLF3EZP_js.a(v)&&f.length===0)return "";for(let R of f){let{name:Z,args:ou}=$o(R),zi=Mo[Z];if(zi)v!==""&&(v=zi(v));else {let Gi=Lo[Z];Gi&&(v=Gi(v,...ou));}}return v}).trim()||r}chunkDPD6ZWL2_js.a(wr,"renderLabelExpression");function Uo(e){if(e==null||typeof e=="function")return "";if(typeof e!="object")return String(e);if(Array.isArray(e))return e.map(Uo).filter(Boolean).join(",");let t=e.toString;return typeof t=="function"&&t!==Object.prototype.toString?String(e):""}chunkDPD6ZWL2_js.a(Uo,"toText");function At(e){return /\{\{\s*\S+.*\}\}/.test(e)}chunkDPD6ZWL2_js.a(At,"isLabelExpression");function qo(e){let t=[],r=/\{\{\s*([^}]+)\s*\}\}/g,n;for(;(n=r.exec(e))!==null;){let a=n[1].trim().split("||").map(u=>u.trim()),s=a[a.length-1];a[a.length-1]=s.split("|")[0].trim();for(let u of a){if(!u)continue;let d=u.split(".")[0];d&&!t.includes(d)&&t.push(d);}}return t}chunkDPD6ZWL2_js.a(qo,"extractAttributeNames");var dl=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function zo(e){let t=e.trim().match(dl);return t?t[1]:null}chunkDPD6ZWL2_js.a(zo,"getSingleAttributeFromExpression");function cl(e,t){let r=zo(e);if(r===null)return null;let n=t.find(o=>o.name===r);return !n||n.type!=="text"||chunkDBQCXRYQ_js.j(n).authoring.readOnly?null:n}chunkDPD6ZWL2_js.a(cl,"getEditableLabelAttribute");var pl=/\{\{\s*props\./;function ml(e,t,r){if(!pl.test(e))return e;let n={},o=new Map(r?.map(s=>[s.name,s]));if(t)for(let[s,u]of Object.entries(t)){if(u==null)continue;let d=o.get(s);if(d){let f=Vo(u,d);n[s]=f===yt?"":f;}else n[s]=u;}return wr(e,{props:n},"").replace(/\(\s*\)/g,"").replace(/\[\s*\]/g,"").replace(/\s*[-—|:]\s*$/g,"").replace(/\s{2,}/g," ").trim()}chunkDPD6ZWL2_js.a(ml,"applyRelationProps");function fl(e){if(e?.type==="relation")return e.properties?.definitions}chunkDPD6ZWL2_js.a(fl,"relationPropertyDefs");function bl(e){if(e?.type==="relation"||e?.type==="document")return e.properties?.definitions}chunkDPD6ZWL2_js.a(bl,"qualifiedPropertyDefs");function Go(e){if(chunkTQLF3EZP_js.a(e))return [];if(typeof e=="string")return [{id:e}];if(Array.isArray(e))return e.flatMap(t=>Go(t));if(typeof e=="object"&&"id"in e){let t=e;if(typeof t.id=="string")return [{id:t.id,props:t.props}]}return []}chunkDPD6ZWL2_js.a(Go,"extractValueRefs");function gl(e){let t=[e.firstName,e.lastName].map(r=>r?.trim()).filter(Boolean).join(" ");return t!==""?t:e.email?.split("@")[0]??""}chunkDPD6ZWL2_js.a(gl,"getUserDisplayName");var yl=/\p{L}|\p{N}/u;function hl(e,t){let r=e?.trim()??"";if(r==="")return t;let n=r.split(/\s+/),a=(n.length===1?r.split("@")[0].split(/[._-]/):n).map(s=>{let u=s.match(yl)?.[0];return u===void 0?"":[...u.toUpperCase()][0]??""}).filter(Boolean).slice(0,2).join("");return a===""?t:a}chunkDPD6ZWL2_js.a(hl,"deriveInitials");var Wo="__creatorRootActorId";function Al(e){let t=e.metadata?.[Wo];return typeof t=="string"&&t.length>0?t:e.createdBy}chunkDPD6ZWL2_js.a(Al,"getRecordCreatorPrincipalId");function xe(e,t){return e?.includes("*")===true||e?.includes(t)===true}chunkDPD6ZWL2_js.a(xe,"includesAction");function Tl(e){return {canRead:xe(e,"read"),canCreate:xe(e,"create"),canUpdate:xe(e,"update"),canDelete:xe(e,"delete"),canManage:xe(e,"manage")}}chunkDPD6ZWL2_js.a(Tl,"buildPermissionFlags");var hT=new Set(["id","name","label","type","required","system","unique","order"]);var $={PEOPLE:"people",WORKSPACE:"workspace",ARCHITECT:"architect",FEATURE_FLAGS:"feature-flags",FILES:"files",VIEWS:"views",FORMS:"forms",DOCUMENTS:"documents",AUDIT:"audit",API_KEYS:"api-keys",CONNECTORS:"connectors",ENV_VARS:"env-vars",SESSION:"session"},TT=[$.PEOPLE,$.WORKSPACE,$.ARCHITECT,$.FEATURE_FLAGS,$.FILES,$.VIEWS,$.FORMS,$.DOCUMENTS,$.AUDIT,$.API_KEYS,$.CONNECTORS,$.ENV_VARS,$.SESSION],wT={people:"People",workspace:"Workspace",architect:"Architect","feature-flags":"Feature flags",files:"Files",views:"Views",forms:"Forms",documents:"Documents",audit:"Audit","api-keys":"API keys",connectors:"Connected accounts","env-vars":"Environment variables",session:"Agent sessions"},wl={OWNER:"owner",MEMBER:"member",AGENT_DEFAULT:"agent_default",REFLEX_DEFAULT:"reflex_default"},xT={owner:"Owner",member:"Member",agent_default:"Agent Default",reflex_default:"Reflex Default"},IT={owner:"Full access to all platform features and data",member:"Can view, create, edit and delete business data",agent_default:"Default role for AI agents \u2014 CRUD on records plus documents and files",reflex_default:"Default role for reflexes \u2014 no data access; each reflex is granted exactly what its rehearsal showed it uses"},xr=["read","create","update","delete","manage"],xl=["read","create","update","delete"],Ko=["read","create","update","delete"],ST={owner:{system:[{target:"*",actions:xr}],object:[{target:"*",actions:xr}]},member:{system:[{target:"people",actions:["read"]},{target:"workspace",actions:["read"]},{target:"connectors",actions:xl},{target:"files",actions:Ko},{target:"documents",actions:Ko}],object:[{target:"*",actions:xr}]},agent_default:{system:[{target:"documents",actions:["read","create","update"]},{target:"files",actions:["read","create","update"]},{target:"env-vars",actions:["read"]},{target:"session",actions:["observe"]}],object:[{target:"*",actions:["read","create","update","delete"]}]},reflex_default:{system:[],object:[]}};function vT(e){return Object.values(wl).includes(e)}chunkDPD6ZWL2_js.a(vT,"isDefaultRole");var Sl=new Set(constants.ICONS),Yo=/^[a-zA-Z_][a-zA-Z0-9_]*$/,vl=/^[a-z][a-z0-9-]*$/,Ie=63,Ho=128,Tt=Ir__default.default.string().min(1,"Object name cannot be empty").max(63,"Object name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/,{message:`Invalid object name format.
|
|
1
|
+
'use strict';var chunkRTHLB6T6_js=require('./chunk-RTHLB6T6.js'),chunkJRBNMHMY_js=require('./chunk-JRBNMHMY.js'),chunkWKDJGNVI_js=require('./chunk-WKDJGNVI.js'),chunkIBM4ID4Y_js=require('./chunk-IBM4ID4Y.js');require('./chunk-LWSOKXPF.js'),require('./chunk-XXTKNIBK.js'),require('./chunk-JOS2XMXY.js');var chunk47KVYDKG_js=require('./chunk-47KVYDKG.js'),chunkKLR22JMC_js=require('./chunk-KLR22JMC.js'),chunkGXSNLYRR_js=require('./chunk-GXSNLYRR.js');require('./chunk-UXISKZ5Y.js'),require('./chunk-XUAP7KWK.js'),require('./chunk-JVLH3DVZ.js'),require('./chunk-LSCBR4VS.js'),require('./chunk-23KPS33D.js');var chunkJSKLP4GI_js=require('./chunk-JSKLP4GI.js'),chunkXHEBV2HE_js=require('./chunk-XHEBV2HE.js'),chunkSLYRQ72J_js=require('./chunk-SLYRQ72J.js'),chunkJFSQ24XR_js=require('./chunk-JFSQ24XR.js'),chunkDPD6ZWL2_js=require('./chunk-DPD6ZWL2.js'),constants=require('@stndrds/constants'),Ir=require('zod');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ir__default=/*#__PURE__*/_interopDefault(Ir);/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
var bo=["fyi","task","question","handoff","system"],go=["low","normal","high","urgent"],yo=["public","internal","sensitive"],ho=["unread","read","archived","snoozed"],Ao=["none","pending","processing","completed","dismissed","expired","failed"],Du="agent.session.waiting_human",Eu="agent.task.assigned",Cu="agent.question.requested",Wg=[Du,Eu,Cu];var Hg=["name","type"],Yg=["required","hidden","archived","deprecated","defaultValue","config","order","unique"],Qg=["label","description","placeholder","icon"];var To=["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"],ee="*";function Zg(e){return e.type!=="relation"||!Array.isArray(e.targets)?[]:e.targets.map(t=>t.object).filter(t=>t!==ee)}chunkDPD6ZWL2_js.a(Zg,"relationTargetsOf");function wo(e){return e.targets.length===1&&e.targets[0].object===ee}chunkDPD6ZWL2_js.a(wo,"isUniversalRelation");function ey(e){return e.bilateral!==void 0}chunkDPD6ZWL2_js.a(ey,"isBilateralRelation");function ty(e){return "many"}chunkDPD6ZWL2_js.a(ty,"inferInverseCardinality");function ry(e){return chunkJRBNMHMY_js.n(e)}chunkDPD6ZWL2_js.a(ry,"isAttributeSortable");var oy=["record","object","attribute","view","user","role","settings","file","agent","schema_source"],ay=["record.created","record.updated","record.deleted","record.restored","record.purged","object.created","object.updated","object.deleted","attribute.created","attribute.updated","attribute.deleted","view.created","view.updated","view.deleted","schema_source.applied","schema_source.removed","user.created","user.invited","user.updated","user.deleted","user.login","user.logout","role.created","role.updated","role.deleted","role.assigned","role.revoked","settings.updated","file.uploaded","file.updated","file.deleted"];function ly(e){return e.phase==="terminal"}chunkDPD6ZWL2_js.a(ly,"isTerminalState");function dy(e){switch(e.phase){case "running":return "active";case "queued":return "idle";case "parked":if(e.parkedOn===void 0)throw new chunkJSKLP4GI_js.b("parked state without parkedOn",chunkJSKLP4GI_js.a.INVARIANT_VIOLATION);return e.parkedOn==="agents"?"waiting_agents":"waiting_human";case "terminal":if(e.outcome===void 0)throw new chunkJSKLP4GI_js.b("terminal state without outcome",chunkJSKLP4GI_js.a.INVARIANT_VIOLATION);return e.outcome}}chunkDPD6ZWL2_js.a(dy,"sessionStateToLegacyStatus");function cy(e){switch(e){case "active":return {phase:"running"};case "idle":return {phase:"queued"};case "waiting_human":return {phase:"parked",parkedOn:"human",humanRequestIds:[]};case "waiting_agents":return {phase:"parked",parkedOn:"agents"};default:return {phase:"terminal",outcome:e}}}chunkDPD6ZWL2_js.a(cy,"legacyStatusToSessionState");var Ou=["completed","failed","cancelled","timeout","expired"];function py(e){return Ou.includes(e)}chunkDPD6ZWL2_js.a(py,"isTerminalSessionStatus");var _u=["idle","completed","waiting_human","waiting_agents","cancelled","failed","timeout"];function my(e){return _u.includes(e)}chunkDPD6ZWL2_js.a(my,"isClaimableSessionStatus");var xo=Object.freeze({mutation:"ask",destructive:"ask",outward:"ask"}),fy=["active","completed","abandoned"],Io=["openai","anthropic","google","spacexai","deepseek","moonshotai","alibaba","mistral","minimax","meta","zai"],So=["standard","fast"],vo=["none","minimal","low","medium","high","xhigh"];function by(e){return e.label?.trim()||e.name}chunkDPD6ZWL2_js.a(by,"agentDisplayName");var Ro=["approval-requested","approval-responded","approval-dispatched"],Nu=["streaming","running","pending",...Ro];function gy(e){return Nu.includes(e)}chunkDPD6ZWL2_js.a(gy,"isOpenToolPartState");function yy(e){return Ro.includes(e)}chunkDPD6ZWL2_js.a(yy,"isToolApprovalState");var br=["CREDITS_EXHAUSTED"];function hy(e){return typeof e=="string"&&br.includes(e)}chunkDPD6ZWL2_js.a(hy,"isSystemPartCode");function ku(e,t){let r=e.createdAt.getTime()-t.createdAt.getTime();return r===0?e.id.localeCompare(t.id):r}chunkDPD6ZWL2_js.a(ku,"compareAgentSessionMessages");function Ay(e){return [...e].sort(ku)}chunkDPD6ZWL2_js.a(Ay,"orderAgentSessionMessages");var Ty=["pending","in_progress","completed","blocked"],wy=50,xy=80,Iy=500;var Dy="session-state",Pu="__stndrdsNativeUiPartIds",ju=1,Fu="Native agent UI part IDs metadata is invalid";function de(){throw new chunkJSKLP4GI_js.h(Fu,[])}chunkDPD6ZWL2_js.a(de,"invalidNativePartIds");function Do(e){if(e===null||typeof e!="object"||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}chunkDPD6ZWL2_js.a(Do,"isPlainRecord");function Vu(e,t){if(e.type==="text"||e.type==="reasoning")return `${e.type}:${t}`;if(e.type==="tool")return `tool:${e.toolCallId}`}chunkDPD6ZWL2_js.a(Vu,"nativeAgentUIPartIdMetadataKey");function Ey(e){let t=e.metadata?.[Pu];Do(t)||de(),(Object.keys(t).length!==2||t.schemaVersion!==ju||!Do(t.partIds))&&de();let r=new Map;for(let[s,u]of e.parts.entries()){let d=Vu(u,s);if(!d||r.has(d)){d&&de();continue}r.set(d,u);}let n=Object.entries(t.partIds);n.length!==r.size&&de();let o=new Map,a={};for(let[s,u]of n){let d=r.get(s);d&&typeof u=="string"&&u.length>0||de();let f=o.get(u);f&&(d.type==="tool"||f!==d.type)&&de(),d.type==="tool"&&u!==d.toolCallId&&de(),o.set(u,d.type),a[s]=u;}return a}chunkDPD6ZWL2_js.a(Ey,"parseNativeAgentUIPartIdsMetadata");var _y=16e3,Ny=3200,ky=6400,Py=16e3,jy=65536,Fy=15e3,Vy=1e4,My=5e3,Ly="google/gemini-3.5-transcribe-live",By={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2};var Uy=["web","presentation","document","spreadsheet","image","code","other"],qy=["ephemeral","conversation","persistent"],zy=["source","preview","entrypoint","asset"];var Eo=5;function Ky(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"?"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e):String(e)}chunkDPD6ZWL2_js.a(Ky,"getErrorMessage");function Jy(e){return typeof e=="object"&&e!==null&&"slots"in e&&"steps"in e&&"name"in e&&typeof e.name=="string"&&Array.isArray(e.slots)&&Array.isArray(e.steps)}chunkDPD6ZWL2_js.a(Jy,"isFormDefinition");var gr=["relation","multiRelation","formula","rollup","document","richtext","user"];function Co(e){return e.type==="slot"}chunkDPD6ZWL2_js.a(Co,"isFormSlotFieldRef");function yr(e){return e.type==="free"}chunkDPD6ZWL2_js.a(yr,"isFormFreeFieldRef");function eh(e){return e.fieldRequired!==void 0?e.fieldRequired:e.slotMode==="create"&&e.attributeRequired===true}chunkDPD6ZWL2_js.a(eh,"resolveFieldRequired");function Oo(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}chunkDPD6ZWL2_js.a(Oo,"getSlotFieldTargets");function Mu(e){return Co(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}chunkDPD6ZWL2_js.a(Mu,"formFieldKey");function Lu(e){return Co(e)?e.attribute:e.attribute.name}chunkDPD6ZWL2_js.a(Lu,"formFieldFlatKey");function th(e,t){return e[Mu(t)]??e[Lu(t)]}chunkDPD6ZWL2_js.a(th,"readFormFieldValue");function ft(e){return e.type==="fields"}chunkDPD6ZWL2_js.a(ft,"isFormFieldsRow");function ih(e){return e.type==="heading"}chunkDPD6ZWL2_js.a(ih,"isFormHeadingRow");function oh(e){return e.type==="separator"}chunkDPD6ZWL2_js.a(oh,"isFormSeparatorRow");function ah(e){return e.type==="text"}chunkDPD6ZWL2_js.a(ah,"isFormTextRow");var hr=class hr{async autocomplete(){return await Promise.resolve([])}async reverse(){return await Promise.resolve(null)}async geocode(){return await Promise.resolve(null)}};chunkDPD6ZWL2_js.a(hr,"NoopGeocodingAdapter");var _o=hr;var Ar=["read","create","update","delete","manage"];function mh(e){return e.length===0?"none":e.length===1&&e[0]==="read"?"read-only":e.length===Ar.length&&Ar.every(t=>e.includes(t))?"full":"custom"}chunkDPD6ZWL2_js.a(mh,"actionsToAccessLevel");function fh(e){switch(e){case "full":return [...Ar];case "read-only":return ["read"];case "none":return []}}chunkDPD6ZWL2_js.a(fh,"accessLevelToActions");function No(e){let t=e.properties;if(!t)return [];if(Array.isArray(t))return t;let r=t;return Array.isArray(r.definitions)?r.definitions:[]}chunkDPD6ZWL2_js.a(No,"resolvePropertyDefinitions");function yh(e){return e.type==="select"||e.type==="status"||e.type==="multiselect"}chunkDPD6ZWL2_js.a(yh,"hasOptions");var Bu="Notetaker",Th={systemPrompt:null,meetingRecordingPolicy:"none",meetingBotDisplayName:Bu};var xh=["active","suspended"],Ih=["architect","manual","auto"];function vh(e){return `${e.object}:${e.name}:${e.type}`}chunkDPD6ZWL2_js.a(vh,"viewStateKey");function bt(e){return e.type==="detail"}chunkDPD6ZWL2_js.a(bt,"isDetailView");function ko(e){return e.type==="list"}chunkDPD6ZWL2_js.a(ko,"isListView");function $u(e){return e.type==="fields"}chunkDPD6ZWL2_js.a($u,"isFieldGroup");var Oh=["square","landscape","portrait"];var Po=["none","estimated","exact"];function Uu(e){if(typeof e=="string"&&Po.includes(e))return e;throw new chunkJSKLP4GI_js.h(`countMode must be one of: ${Po.join(", ")} (received: ${String(e)})`,[])}chunkDPD6ZWL2_js.a(Uu,"parseCountMode");function kh(e){return e===void 0?void 0:Uu(e)}chunkDPD6ZWL2_js.a(kh,"parseOptionalCountMode");var Ph=1e4;var Vh=["storage.bytes","members.seats","data.live_records"];function qu(e){return e==null?true:typeof e!="object"?false:Object.keys(e).length===0}chunkDPD6ZWL2_js.a(qu,"isEmptyObject");function jo(e){return e!=null&&typeof e=="object"&&Object.keys(e).length>0}chunkDPD6ZWL2_js.a(jo,"isNotEmpty");function zu(e){return jo(e)?e:void 0}chunkDPD6ZWL2_js.a(zu,"toUndefinedIfEmpty");function Gu(e){if(e<=0)return {value:0,unitIndex:0};let t=1e3,r=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return {value:Number.parseFloat((e/t**r).toFixed(1)),unitIndex:r}}chunkDPD6ZWL2_js.a(Gu,"computeByteMagnitude");var Wu=["B","KB","MB","GB","TB"];function OA(e){let{value:t,unitIndex:r}=Gu(e);return `${t} ${Wu[r]}`}chunkDPD6ZWL2_js.a(OA,"formatByteSize");function Ku(e){return e.displayAttributes!==void 0?[...e.displayAttributes]:[...new Set([e.cardUserAttribute,e.cardDateAttribute].filter(t=>t!==void 0))]}chunkDPD6ZWL2_js.a(Ku,"getListViewDisplayAttributeNames");var jA={ATTACHMENTS:"attachments"};function FA(e){return e.type==="document"}chunkDPD6ZWL2_js.a(FA,"isDocumentAttribute");function VA(e,t){if(!t||t.length===0)return true;let r=e.name.toLowerCase();return t.some(n=>n.endsWith("/*")?e.mimeType.startsWith(n.slice(0,-1)):n.startsWith(".")?r.endsWith(n.toLowerCase()):e.mimeType===n)}chunkDPD6ZWL2_js.a(VA,"matchesAccepts");var Fo=Object.freeze(["text","number","checkbox","date","phone","currency","status","select","multiselect","location"]);function gt(e){let t=[];for(let r of e){let n=r.build();if(!Fo.includes(n.type))throw new Error(`Property type "${n.type}" is not supported in .qualifyWith()`);t.push(n);}return {definitions:t}}chunkDPD6ZWL2_js.a(gt,"buildPropertySchema");var UA="__";function qA(e){let t=e.indexOf("__");return t<=0||t+2>=e.length?{kind:"scalar",attribute:e}:{kind:"qualified",root:e.slice(0,t),property:e.slice(t+2)}}chunkDPD6ZWL2_js.a(qA,"parseQualifiedAttribute");function zA(e,t){return `${e}__${t}`}chunkDPD6ZWL2_js.a(zA,"buildQualifiedAttribute");function ne(e){return typeof e=="object"&&e!==null&&typeof e.start=="string"}chunkDPD6ZWL2_js.a(ne,"isDateRangeValue");function Hu(e,t){return chunkIBM4ID4Y_js.a(e)?null:ne(e)?t.endDate?{start:e.start,end:e.end??null}:e.start:typeof e=="string"?t.endDate?{start:e,end:null}:e:null}chunkDPD6ZWL2_js.a(Hu,"normalizeDateValue");function Te(e){return typeof e=="string"&&e!==""?e:ne(e)&&e.start!==""?e.start:null}chunkDPD6ZWL2_js.a(Te,"dateValueStart");var yt="\u2014";function Yu(e){return String(e)}chunkDPD6ZWL2_js.a(Yu,"formatText");function Qu(e){return e?"Yes":"No"}chunkDPD6ZWL2_js.a(Qu,"formatCheckbox");function Ju(e,t){if(typeof e!="number")return String(e);if(t.renderAs==="rating")return `${e}/${t.max??5}`;let r=t.decimals;return t.unit==="integer"?e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}):t.unit==="percentage"?(e/100).toLocaleString(void 0,{style:"percent",minimumFractionDigits:r,maximumFractionDigits:r}):e.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}chunkDPD6ZWL2_js.a(Ju,"formatNumber");function Xu(e,t){if(typeof e!="object"||e===null)return String(e);let r=e;return "value"in r&&"code"in r?`${r.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} ${r.code}`:String(e)}chunkDPD6ZWL2_js.a(Xu,"formatCurrency");function Tr(e){if(ne(e)){let t=Tr(e.start);return e.end?`${t} \u2192 ${Tr(e.end)}`:t}if(e instanceof Date)return e.toISOString().split("T")[0];if(typeof e=="string"){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toISOString().split("T")[0]}return String(e)}chunkDPD6ZWL2_js.a(Tr,"formatDate");function Zu(e){if(typeof e!="object"||e===null)return String(e);let t=e;return "phoneNumber"in t?t.phoneNumber?t.countryCode?chunkGXSNLYRR_js.c(t):t.phoneNumber:"":String(e)}chunkDPD6ZWL2_js.a(Zu,"formatPhone");function el(e,t="full"){if(typeof e!="object"||e===null)return "";let r=e,n=[];switch(t){case "country":r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;case "state":r.state&&n.push(r.state),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;case "city":r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;case "coordinates":r.latitude!==void 0&&r.longitude!==void 0&&n.push(`${r.latitude}, ${r.longitude}`);break;case "address":r.address&&n.push(r.address),r.city&&n.push(r.city),r.state&&n.push(r.state),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break;default:r.address&&n.push(r.address),r.address2&&n.push(r.address2),r.city&&n.push(r.city),r.state&&n.push(r.state),r.postalCode&&n.push(r.postalCode),r.country&&n.push(constants.getCountryDisplayNameByIso3(r.country));break}return n.join(", ")}chunkDPD6ZWL2_js.a(el,"formatLocationValue");function tl(e,t){return typeof e!="object"||e===null?String(e):el(e,t.granularity??"full")||yt}chunkDPD6ZWL2_js.a(tl,"formatLocation");function rl(e,t){return typeof e!="string"?String(e):t.options?.find(n=>n.value===e)?.label??String(e)}chunkDPD6ZWL2_js.a(rl,"formatSelect");function nl(e,t){return Array.isArray(e)?t.options?e.map(n=>t.options.find(o=>o.value===n)?.label).filter(Boolean).join(", "):e.join(", "):String(e)}chunkDPD6ZWL2_js.a(nl,"formatMultiselect");function Vo(e,t){if(chunkIBM4ID4Y_js.a(e))return yt;switch(t.type){case "text":return Yu(e);case "checkbox":return Qu(e);case "number":return Ju(e,t);case "currency":return Xu(e);case "date":return Tr(e);case "phone":return Zu(e);case "location":return tl(e,t);case "select":case "status":return rl(e,t);case "multiselect":return nl(e,t);case "user":case "relation":return Array.isArray(e)?e.join(", "):String(e);default:return Array.isArray(e)?e.join(", "):String(e)}}chunkDPD6ZWL2_js.a(Vo,"formatAttributeValue");var ol=["UPPER","LOWER","capitalize","trim"],al=["prefix","suffix","wrap","default"],ht=[...ol,...al],we=Ir.z.string().min(1,"labelExpression cannot be empty").refine(e=>At(e),{message:"labelExpression must contain at least one {{ attribute }} interpolation"}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:"labelExpression contains empty {{ }} interpolation"}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,r;for(;(r=t.exec(e))!==null;){let n=r[1];if(!ht.includes(n))return false}return true},{message:`Invalid pipe name. Valid pipes: ${ht.join(", ")}`});function sl(e){let t=we.safeParse(e);return t.success?{success:true,attributes:qo(e)}:{success:false,error:t.error.issues[0]?.message??"Invalid labelExpression"}}chunkDPD6ZWL2_js.a(sl,"validateLabelExpression");var Mo={UPPER:chunkDPD6ZWL2_js.a(e=>String(e).toUpperCase(),"UPPER"),LOWER:chunkDPD6ZWL2_js.a(e=>String(e).toLowerCase(),"LOWER"),capitalize:chunkDPD6ZWL2_js.a(e=>String(e).replace(/(^|\s)\S/g,t=>t.toUpperCase()),"capitalize"),trim:chunkDPD6ZWL2_js.a(e=>String(e).trim(),"trim")},Lo={prefix:chunkDPD6ZWL2_js.a((e,t="")=>e?`${t}${e}`:"","prefix"),suffix:chunkDPD6ZWL2_js.a((e,t="")=>e?`${e}${t}`:"","suffix"),wrap:chunkDPD6ZWL2_js.a((e,t="",r="")=>e?`${t}${e}${r}`:"","wrap"),default:chunkDPD6ZWL2_js.a((e,t="")=>e||t,"default")};function ul(e,t){let r=e;for(let n of t){let{name:o,args:a}=$o(n),s=Mo[o];if(s)r!==""&&(r=s(r));else {let u=Lo[o];u&&(r=u(r,...a));}}return r}chunkDPD6ZWL2_js.a(ul,"applyPipes");function ll(e,t){return t.split(".").reduce((r,n)=>{if(!(r==null||typeof r!="object"))return r[n]},e)}chunkDPD6ZWL2_js.a(ll,"getValue");var Bo="(Untitled)";function $o(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return {name:e,args:[]};let r=t[1],n=t[2];if(!n)return {name:r,args:[]};let o=[],a=/["']([^"']*?)["']/g,s;for(;(s=a.exec(n))!==null;)o.push(s[1]);return {name:r,args:o}}chunkDPD6ZWL2_js.a($o,"parsePipeExpression");function wr(e,t,r=Bo){return e.replace(/\{\{\s*([^}]+)\s*\}\}/g,(o,a)=>{let s=a.split("||").map(R=>R.trim()),d=s[s.length-1].split("|").map(R=>R.trim());s[s.length-1]=d[0];let f=d.slice(1).filter(Boolean),x=s.filter(Boolean),v="";for(let R of x){let Z=Uo(ll(t,R));if(Z!==""){v=Z;break}}if(chunkIBM4ID4Y_js.a(v)&&f.length===0)return "";for(let R of f){let{name:Z,args:ou}=$o(R),zi=Mo[Z];if(zi)v!==""&&(v=zi(v));else {let Gi=Lo[Z];Gi&&(v=Gi(v,...ou));}}return v}).trim()||r}chunkDPD6ZWL2_js.a(wr,"renderLabelExpression");function Uo(e){if(e==null||typeof e=="function")return "";if(typeof e!="object")return String(e);if(Array.isArray(e))return e.map(Uo).filter(Boolean).join(",");let t=e.toString;return typeof t=="function"&&t!==Object.prototype.toString?String(e):""}chunkDPD6ZWL2_js.a(Uo,"toText");function At(e){return /\{\{\s*\S+.*\}\}/.test(e)}chunkDPD6ZWL2_js.a(At,"isLabelExpression");function qo(e){let t=[],r=/\{\{\s*([^}]+)\s*\}\}/g,n;for(;(n=r.exec(e))!==null;){let a=n[1].trim().split("||").map(u=>u.trim()),s=a[a.length-1];a[a.length-1]=s.split("|")[0].trim();for(let u of a){if(!u)continue;let d=u.split(".")[0];d&&!t.includes(d)&&t.push(d);}}return t}chunkDPD6ZWL2_js.a(qo,"extractAttributeNames");var dl=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function zo(e){let t=e.trim().match(dl);return t?t[1]:null}chunkDPD6ZWL2_js.a(zo,"getSingleAttributeFromExpression");function cl(e,t){let r=zo(e);if(r===null)return null;let n=t.find(o=>o.name===r);return !n||n.type!=="text"||chunkJRBNMHMY_js.j(n).authoring.readOnly?null:n}chunkDPD6ZWL2_js.a(cl,"getEditableLabelAttribute");var pl=/\{\{\s*props\./;function ml(e,t,r){if(!pl.test(e))return e;let n={},o=new Map(r?.map(s=>[s.name,s]));if(t)for(let[s,u]of Object.entries(t)){if(u==null)continue;let d=o.get(s);if(d){let f=Vo(u,d);n[s]=f===yt?"":f;}else n[s]=u;}return wr(e,{props:n},"").replace(/\(\s*\)/g,"").replace(/\[\s*\]/g,"").replace(/\s*[-—|:]\s*$/g,"").replace(/\s{2,}/g," ").trim()}chunkDPD6ZWL2_js.a(ml,"applyRelationProps");function fl(e){if(e?.type==="relation")return e.properties?.definitions}chunkDPD6ZWL2_js.a(fl,"relationPropertyDefs");function bl(e){if(e?.type==="relation"||e?.type==="document")return e.properties?.definitions}chunkDPD6ZWL2_js.a(bl,"qualifiedPropertyDefs");function Go(e){if(chunkIBM4ID4Y_js.a(e))return [];if(typeof e=="string")return [{id:e}];if(Array.isArray(e))return e.flatMap(t=>Go(t));if(typeof e=="object"&&"id"in e){let t=e;if(typeof t.id=="string")return [{id:t.id,props:t.props}]}return []}chunkDPD6ZWL2_js.a(Go,"extractValueRefs");function gl(e){let t=[e.firstName,e.lastName].map(r=>r?.trim()).filter(Boolean).join(" ");return t!==""?t:e.email?.split("@")[0]??""}chunkDPD6ZWL2_js.a(gl,"getUserDisplayName");var yl=/\p{L}|\p{N}/u;function hl(e,t){let r=e?.trim()??"";if(r==="")return t;let n=r.split(/\s+/),a=(n.length===1?r.split("@")[0].split(/[._-]/):n).map(s=>{let u=s.match(yl)?.[0];return u===void 0?"":[...u.toUpperCase()][0]??""}).filter(Boolean).slice(0,2).join("");return a===""?t:a}chunkDPD6ZWL2_js.a(hl,"deriveInitials");var Wo="__creatorRootActorId";function Al(e){let t=e.metadata?.[Wo];return typeof t=="string"&&t.length>0?t:e.createdBy}chunkDPD6ZWL2_js.a(Al,"getRecordCreatorPrincipalId");function xe(e,t){return e?.includes("*")===true||e?.includes(t)===true}chunkDPD6ZWL2_js.a(xe,"includesAction");function Tl(e){return {canRead:xe(e,"read"),canCreate:xe(e,"create"),canUpdate:xe(e,"update"),canDelete:xe(e,"delete"),canManage:xe(e,"manage")}}chunkDPD6ZWL2_js.a(Tl,"buildPermissionFlags");var hT=new Set(["id","name","label","type","required","system","unique","order"]);var $={PEOPLE:"people",WORKSPACE:"workspace",ARCHITECT:"architect",FEATURE_FLAGS:"feature-flags",FILES:"files",VIEWS:"views",FORMS:"forms",DOCUMENTS:"documents",AUDIT:"audit",API_KEYS:"api-keys",CONNECTORS:"connectors",ENV_VARS:"env-vars",SESSION:"session"},TT=[$.PEOPLE,$.WORKSPACE,$.ARCHITECT,$.FEATURE_FLAGS,$.FILES,$.VIEWS,$.FORMS,$.DOCUMENTS,$.AUDIT,$.API_KEYS,$.CONNECTORS,$.ENV_VARS,$.SESSION],wT={people:"People",workspace:"Workspace",architect:"Architect","feature-flags":"Feature flags",files:"Files",views:"Views",forms:"Forms",documents:"Documents",audit:"Audit","api-keys":"API keys",connectors:"Connected accounts","env-vars":"Environment variables",session:"Agent sessions"},wl={OWNER:"owner",MEMBER:"member",AGENT_DEFAULT:"agent_default",REFLEX_DEFAULT:"reflex_default"},xT={owner:"Owner",member:"Member",agent_default:"Agent Default",reflex_default:"Reflex Default"},IT={owner:"Full access to all platform features and data",member:"Can view, create, edit and delete business data",agent_default:"Default role for AI agents \u2014 CRUD on records plus documents and files",reflex_default:"Default role for reflexes \u2014 no data access; each reflex is granted exactly what its rehearsal showed it uses"},xr=["read","create","update","delete","manage"],xl=["read","create","update","delete"],Ko=["read","create","update","delete"],ST={owner:{system:[{target:"*",actions:xr}],object:[{target:"*",actions:xr}]},member:{system:[{target:"people",actions:["read"]},{target:"workspace",actions:["read"]},{target:"connectors",actions:xl},{target:"files",actions:Ko},{target:"documents",actions:Ko}],object:[{target:"*",actions:xr}]},agent_default:{system:[{target:"documents",actions:["read","create","update"]},{target:"files",actions:["read","create","update"]},{target:"env-vars",actions:["read"]},{target:"session",actions:["observe"]}],object:[{target:"*",actions:["read","create","update","delete"]}]},reflex_default:{system:[],object:[]}};function vT(e){return Object.values(wl).includes(e)}chunkDPD6ZWL2_js.a(vT,"isDefaultRole");var Sl=new Set(constants.ICONS),Yo=/^[a-zA-Z_][a-zA-Z0-9_]*$/,vl=/^[a-z][a-z0-9-]*$/,Ie=63,Ho=128,Tt=Ir__default.default.string().min(1,"Object name cannot be empty").max(63,"Object name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/,{message:`Invalid object name format.
|
|
3
3
|
Name must be in kebab-case (slug format):
|
|
4
4
|
\u2705 Valid: 'products', 'user-profiles', 'order-items'
|
|
5
|
-
\u274C Invalid: 'Products', 'userProfiles', 'user_profiles'`});function $e(e){try{Tt.parse(e);}catch(t){throw t instanceof Ir__default.default.ZodError?new
|
|
5
|
+
\u274C Invalid: 'Products', 'userProfiles', 'user_profiles'`});function $e(e){try{Tt.parse(e);}catch(t){throw t instanceof Ir__default.default.ZodError?new chunkJSKLP4GI_js.b(t.issues[0].message,chunkJSKLP4GI_js.a.INVALID_OBJECT_NAME):t}}chunkDPD6ZWL2_js.a($e,"validateObjectName");function wt(e){if(!e||e.length===0)throw new chunkJSKLP4GI_js.h("View name cannot be empty",[{path:["name"],message:"View name cannot be empty"}]);if(e.length>Ie)throw new chunkJSKLP4GI_js.h("View name is too long",[{path:["name"],message:`View name is too long (max ${Ie} characters)`}]);if(!vl.test(e))throw new chunkJSKLP4GI_js.h("Invalid view name format",[{path:["name"],message:"View name must be in kebab-case (e.g., 'detail', 'list-view')"}])}chunkDPD6ZWL2_js.a(wt,"validateViewName");function ce(e,t,r){let n=new Set;for(let o of e){let a=t(o);if(n.has(a))throw r(a);n.add(a);}}chunkDPD6ZWL2_js.a(ce,"assertUniqueBy");var Sr=Ir__default.default.string().min(1,"Attribute name cannot be empty").max(Ie,`Attribute name is too long (max ${Ie} characters)`).regex(Yo,{message:`Invalid attribute name format.
|
|
6
6
|
Name must be a valid variable identifier:
|
|
7
7
|
\u2705 Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
|
|
8
|
-
\u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`}).refine(e=>!
|
|
8
|
+
\u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`}).refine(e=>!chunkJRBNMHMY_js.B.includes(e),{message:"This is a reserved attribute name"});function Ue(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute name cannot be empty");if(e.length>Ie)throw new Error(`[AttributeBuilder] Attribute name is too long (max ${Ie} characters)`);if(!Yo.test(e))throw new Error(`[AttributeBuilder] Invalid attribute name format.
|
|
9
9
|
Name must be a valid variable identifier:
|
|
10
10
|
\u2705 Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
|
|
11
|
-
\u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`);if(
|
|
12
|
-
Reserved names: ${
|
|
13
|
-
Icon must be one of the predefined icons from @stndrds/constants.`)}chunkDPD6ZWL2_js.a(Jo,"validateIconName");function pe(e,t){let r=new Set;for(let n of t){if(!n.value?.trim())throw new Error(`[AttributeBuilder] Option in "${e}" has an empty or missing value.`);if(!n.label?.trim())throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has an empty or missing label.`);if(r.has(n.value))throw new Error(`[AttributeBuilder] Duplicate option value "${n.value}" in "${e}".`);r.add(n.value);}for(let n of t){if(n.inverse===void 0)continue;let o=t.find(a=>a.value===n.inverse);if(!o)throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has inverse "${n.inverse}" which does not match any option value.`);if(o.inverse!==n.value)throw new Error(`[AttributeBuilder] Inverse mismatch in "${e}": "${n.value}" points to "${n.inverse}", but "${n.inverse}" points to "${o.inverse??"(none)"}". Inverse pairs must be symmetric.`)}}chunkDPD6ZWL2_js.a(pe,"validateOptions");var Xo={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2},timeoutMs:3e5},Rr=class Rr{constructor(t){if(!t.name||t.name.trim().length===0)throw new chunkL277YJLQ_js.h("Agent name is required",[]);this.bp={name:t.name,system:true,visibility:"workspace",triggers:[]};}description(t){return this.bp.description=t,this}label(t){return this.bp.label=t,this}icon(t){return this.bp.icon=t,this}systemPrompt(t){return this.bp.systemPrompt=t,this}model(t,r,n){return this.bp.model={provider:t,model:r,...n},this}tools(t){return this.bp.tools=[...t],this}schedule(t){return this.bp.schedule={...t,enabled:t.enabled??true},this}config(t){let r=this.bp.config??Xo,n=t.inference===void 0?r.inference:{...r.inference,...t.inference};return this.bp.config={...r,...t,...n===void 0?{}:{inference:n}},this}delegation(t){return Object.assign(this.bp,t),this}mcpServers(t){return this.bp.mcpServers=Array.isArray(t)?[...t]:t,this}approval(t){return this.bp.approval={...xo,...this.bp.approval,...t},this}visibility(t){return this.bp.visibility=t,this}requiresPermission(t,r){return this.bp.requiredPermission={resource:t,action:r},this}trigger(t,r,n){return this.bp.triggers.push({name:t,eventType:r,...n,enabled:n?.enabled??true}),this}runtime(){return this.bp.system=false,this}build(){if(!this.bp.systemPrompt)throw new chunkL277YJLQ_js.h(`Agent "${this.bp.name}": systemPrompt is required`,[]);if(!this.bp.model)throw new chunkL277YJLQ_js.h(`Agent "${this.bp.name}": model is required`,[]);if(this.bp.system&&this.bp.visibility==="private")throw new chunkL277YJLQ_js.h(`Agent "${this.bp.name}": system agents must use workspace visibility`,[]);return ce(this.bp.triggers,t=>t.name,t=>new chunkL277YJLQ_js.h(`Agent "${this.bp.name}": duplicate trigger name "${t}"`,[])),{...this.bp,visibility:this.bp.visibility??"workspace",config:this.bp.config??Xo,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};chunkDPD6ZWL2_js.a(Rr,"AgentBuilder");var vr=Rr;function VT(e){return new vr(e)}chunkDPD6ZWL2_js.a(VT,"agent");var Rl="@stndrds/schema";function xt(e){return {version:1,vendor:Rl,validate:chunkDPD6ZWL2_js.a(t=>{let r=e.safeParse(t);return r.success?{value:r.data}:{issues:r.error.issues.map(n=>({message:n.message,path:n.path}))}},"validate")}}chunkDPD6ZWL2_js.a(xt,"createStandardSchemaProps");function BT(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"].version===1}chunkDPD6ZWL2_js.a(BT,"isStandardSchema");var zr=class zr{get"~standard"(){let t=chunkTQLF3EZP_js.c(this.build());return xt(t)}constructor(t,r,n){Ue(r),Qo(n),this.attr={name:r,label:n,type:t,required:false,system:true};}setRequired(t){this.attr.required=t;}asRequiredState(){return this}asPhantomState(){return this}runtime(){return this.attr.system=false,this}hidden(){return this.attr.hidden=true,this}placeholder(t){return this.attr.placeholder=t,this}description(t){return this.attr.description=t,this}icon(t){return Jo(t,`attribute "${this.attr.name}"`),this.attr.icon=t,this}order(t){return this.attr.order=t,this}defaultValue(t){return ("defaultValue"in this.attr||!["formula","rollup"].includes(this.attr.type))&&(this.attr.defaultValue=t),this}metadata(t){return this.attr.metadata=t,this}build(){return this.attr}};chunkDPD6ZWL2_js.a(zr,"BaseAttributeBuilder");var E=zr,Gr=class Gr extends E{constructor(t,r){super("text",t,r);}minLength(t){return this.attr.minLength=t,this}maxLength(t){return this.attr.maxLength=t,this}pattern(t){return this.attr.pattern=t,this.attr.format=void 0,this}multiline(t=true){return this.attr.multiline=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}email(){return this.attr.format="email",this.attr.pattern=void 0,this}url(){return this.attr.format="url",this.attr.pattern=void 0,this}slug(){return this.attr.format="slug",this.attr.pattern=void 0,this}};chunkDPD6ZWL2_js.a(Gr,"TextAttributeBuilder");var Dr=Gr;function b(e){return new Dr(e.name,e.label)}chunkDPD6ZWL2_js.a(b,"text");var Wr=class Wr extends E{constructor(t,r){super("richtext",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Wr,"RichtextAttributeBuilder");var Er=Wr;function ie(e){return new Er(e.name,e.label)}chunkDPD6ZWL2_js.a(ie,"richtext");var Kr=class Kr extends E{constructor(t,r){super("number",t,r);}min(t){return this.attr.min=t,this}max(t){return this.attr.max=t,this}integer(){return this.attr.unit="integer",this.attr.decimals=0,this}decimal(t=2){return this.attr.unit="decimal",this.attr.decimals=t,this}percentage(){return this.attr.unit="percentage",this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Kr,"NumberAttributeBuilder");var Or=Kr;function St(e){return new Or(e.name,e.label)}chunkDPD6ZWL2_js.a(St,"number");var Hr=class Hr extends E{constructor(t,r){super("checkbox",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Hr,"CheckboxAttributeBuilder");var Cr=Hr;function Zo(e){return new Cr(e.name,e.label)}chunkDPD6ZWL2_js.a(Zo,"checkbox");var Yr=class Yr extends E{constructor(t,r){super("date",t,r);}format(t){return this.attr.dateFormat=t,this}minDate(t){return this.attr.minDate=t,this}maxDate(t){return this.attr.maxDate=t,this}endDate(){return this.attr.endDate=true,this.asPhantomState()}includeTime(){return this.attr.includeTime=true,this}timeFormat(t){return this.attr.timeFormat=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Yr,"DateAttributeBuilder");var _r=Yr;function q(e){return new _r(e.name,e.label)}chunkDPD6ZWL2_js.a(q,"date");var Qr=class Qr extends E{constructor(t,r){super("phone",t,r);}defaultCountry(t){return this.attr.defaultCountryCode=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Qr,"PhoneAttributeBuilder");var Nr=Qr;function YT(e){return new Nr(e.name,e.label)}chunkDPD6ZWL2_js.a(YT,"phone");var Jr=class Jr extends E{constructor(t,r){super("currency",t,r);}defaultCurrency(t){return this.attr.defaultCurrency=t,this}allowedCurrencies(t){return this.attr.allowedCurrencies=t,this}allowNegative(t=true){return this.attr.allowNegative=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Jr,"CurrencyAttributeBuilder");var kr=Jr;function QT(e){return new kr(e.name,e.label)}chunkDPD6ZWL2_js.a(QT,"currency");var Xr=class Xr extends E{constructor(t,r){super("status",t,r);}options(t){let r=t;return pe(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return pe(this.attr.name??"unknown",r),this.attr.options.push(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Xr,"StatusAttributeBuilder");var Pr=Xr;function JT(e){return new Pr(e.name,e.label)}chunkDPD6ZWL2_js.a(JT,"status");var Zr=class Zr extends E{constructor(t,r){super("select",t,r);}options(t){let r=t;return pe(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return pe(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Zr,"SelectAttributeBuilder");var jr=Zr;function H(e){return new jr(e.name,e.label)}chunkDPD6ZWL2_js.a(H,"select");var en=class en extends E{constructor(t,r){super("multiselect",t,r);}options(t){let r=t;return pe(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return pe(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(en,"MultiselectAttributeBuilder");var Fr=en;function XT(e){return new Fr(e.name,e.label)}chunkDPD6ZWL2_js.a(XT,"multiselect");var tn=class tn extends E{constructor(t,r){super("location",t,r);}granularity(t){return this.attr.granularity=t,this}defaultCountry(t){return this.attr.defaultCountry=t,this}allowedCountries(t){return this.attr.allowedCountries=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(tn,"LocationAttributeBuilder");var Vr=tn;function ZT(e){return new Vr(e.name,e.label)}chunkDPD6ZWL2_js.a(ZT,"location");var rn=class rn extends E{constructor(t,r){super("user",t,r),this.attr.types=["user","agent"];}types(t){let r=[...new Set(t)];if(r.length===0)throw new Error("[AttributeBuilder] user.types must contain at least one type.");return this.attr.types=r,this}multiple(){return this.attr.multiple=true,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(rn,"UserAttributeBuilder");var Mr=rn;function ew(e){return new Mr(e.name,e.label)}chunkDPD6ZWL2_js.a(ew,"user");var nn=class nn extends E{to(t,r){let n={object:t,...r};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:ee}],this}qualifyWith(...t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.qualifyWith() must be called AFTER .to(). Example: relation({ name: "companies" }).to("companies").qualifyWith(...)');return this.attr.properties=gt(t),this}bilateral(t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.bilateral() must be called AFTER .to(). Example: relation({ name: "company" }).to("companies").bilateral({ ... })');if(r.length>1)throw new Error("Bilateral relations are not supported for polymorphic relations (multiple .to() targets).");if(wo(this.attr))throw new Error("Bilateral relations are not supported for universal relations (.toAny()).");return this.attr.bilateral=t,this}};chunkDPD6ZWL2_js.a(nn,"BaseRelationAttributeBuilder");var It=nn,on=class on extends It{constructor(t,r){super("relation",t,r),this.attr.cardinality="one",this.attr.targets=[];}many(){let t=new Br(this.attr.name,this.attr.label??"",{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===false&&t.runtime(),this.attr.hidden&&t.hidden(),this.attr.placeholder&&t.placeholder(this.attr.placeholder),this.attr.description&&t.description(this.attr.description),this.attr.icon&&t.icon(this.attr.icon),this.attr.order!==void 0&&t.order(this.attr.order),this.attr.metadata&&t.metadata(this.attr.metadata),t}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(on,"SingleRelationAttributeBuilder");var Lr=on,an=class an extends It{constructor(t,r,n){super("relation",t,r),this.attr.cardinality="many",this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&this.setRequired(true);}maxItems(t){return this.attr.maxItems=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(an,"MultiRelationAttributeBuilder");var Br=an;function Se(e){return new Lr(e.name,e.label)}chunkDPD6ZWL2_js.a(Se,"relation");var sn=class sn extends E{constructor(t,r){super("formula",t,r),this.attr.required=false;}expression(t){return this.attr.expression=t,this}returns(t){return this.attr.returnType=t,this}decimals(t){return this.attr.decimals=t,this}required(){throw new Error("Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};chunkDPD6ZWL2_js.a(sn,"FormulaAttributeBuilder");var $r=sn;function tw(e){return new $r(e.name,e.label)}chunkDPD6ZWL2_js.a(tw,"formula");var un=class un extends E{constructor(t,r){super("rollup",t,r),this.attr.required=false;}from(t){return this.attr.relationAttribute=t,this}aggregate(t){return this.attr.targetAttribute=t,this}using(t){return this.attr.function=t,this}decimals(t){return this.attr.decimals=t,this}path(t){return this.attr.relationPath=t,this}targetType(t){return this.attr.targetAttributeType=t,this}targetOptions(t){return this.attr.targetAttributeOptions=t,this}targetCurrency(t){return this.attr.targetCurrencyCode=t,this}build(){let t=this.attr.function,r=this.attr.targetAttributeType;if(t==="original"&&r!==void 0&&r!=="select"&&r!=="status"&&r!=="multiselect"){let n=this.attr.relationAttribute??"relation",o=this.attr.targetAttribute??"field";throw new chunkL277YJLQ_js.b(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${r}") was given. To surface a plain ${r} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${n}.${o}").`,chunkL277YJLQ_js.a.VALIDATION_FAILED)}return super.build()}required(){throw new Error("Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};chunkDPD6ZWL2_js.a(un,"RollupAttributeBuilder");var Ur=un;function rw(e){return new Ur(e.name,e.label)}chunkDPD6ZWL2_js.a(rw,"rollup");var ln=class ln extends E{constructor(t,r){super("document",t,r);}accepts(t){return this.attr.accepts=t,this}maxFileSize(t){return this.attr.maxFileSize=t,this}qualifyWith(...t){return this.attr.properties=gt(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(ln,"DocumentAttributeBuilder");var qr=ln;function ea(e){return new qr(e.name,e.label)}chunkDPD6ZWL2_js.a(ea,"document");function ra(e,t,r){let n=Array.isArray(e)?e:[e],[o,...a]=n;return {type:"slot",slotId:o,additionalSlotIds:a.length>0?a:void 0,attribute:t,label:r?.label,required:r?.required,tooltip:r?.tooltip}}chunkDPD6ZWL2_js.a(ra,"buildSlotFieldRef");var mn=class mn{constructor(t,r,n){this._finalized=false;this.stepBuilder=t,this.rowData={id:r,order:n,type:"fields",fields:[]};}field(t,r,n){return this.rowData.fields.push(ra(t,r,n)),this}freeField(t,r){let o={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression};return this.rowData.fields.push(o),this}row(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).row(t)}heading(t,r){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).heading(t,r)}separator(){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).separator()}text(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).text(t)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=true,this.stepBuilder._finalizeRow(this.rowData))}};chunkDPD6ZWL2_js.a(mn,"FormRowBuilder");var dn=mn,fn=class fn{constructor(t,r,n){this.rowOrder=0;this.formBuilder=t,this.stepData={id:r,label:n,rows:[]};}description(t){return this.stepData.description=t,this}field(t,r,n){this.rowOrder++;let o=`row-${this.stepData.id}-${this.rowOrder}`,a=ra(t,r,n),s={id:o,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}freeField(t,r){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,a={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression},s={id:n,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}row(t){return this.rowOrder++,new dn(this,t,this.rowOrder)}heading(t,r){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"heading",content:t,level:r};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let t={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"separator"};return this.stepData.rows.push(t),this}text(t){this.rowOrder++;let r={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"text",content:t};return this.stepData.rows.push(r),this}step(t,r){return this.formBuilder._finalizeStep(this.stepData).step(t,r)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(t){return t.fields.length>0&&this.stepData.rows.push(t),this}_getData(){return this.stepData}};chunkDPD6ZWL2_js.a(fn,"FormStepBuilder");var cn=fn,bn=class bn{constructor(t,r){this.data={slots:[],steps:[],status:"draft",version:1};this.validateName(t),this.data.name=t,this.data.label=r;}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}status(t){return this.data.status=t,this}metadata(t){return this.data.metadata=t,this}slot(t,r,n){if(this.data.slots.some(a=>a.id===t))throw new Error(`[FormBuilder] Duplicate slot id: "${t}"`);let o={id:t,objectName:r,label:n.label,mode:n.mode??"create",color:n.color,icon:n.icon};return this.data.slots.push(o),this}step(t,r){if(this.data.steps.some(n=>n.id===t))throw new Error(`[FormBuilder] Duplicate step id: "${t}"`);return new cn(this,t,r)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.data}_finalizeStep(t){return this.data.steps.push(t),this}validateName(t){let r=Ir.z.string().min(1,"Form name cannot be empty").max(63,"Form name is too long (max 63 characters)").regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:"Invalid form name format. Name must be in kebab-case: 'client-onboarding', 'contact-creation'"});try{r.parse(t);}catch(n){throw n instanceof Ir.z.ZodError?new Error(`[FormBuilder] ${n.issues[0].message}`):n}}validateRequiredData(){if(this.data.slots.length===0)throw new Error("[FormBuilder] At least one slot is required. Use .slot() to add slots.");if(this.data.steps.length===0)throw new Error("[FormBuilder] At least one step is required. Use .step() to add steps.")}validateSlotReferences(){let t=new Map(this.data.slots.map(r=>[r.id,r.objectName]));for(let r of this.data.steps)for(let n of r.rows)if(ft(n))for(let o of n.fields){if(o.type!=="slot")continue;let a=Co(o);for(let u of a)if(!t.has(u))throw new Error(`[FormBuilder] Step "${r.id}" references unknown slot "${u}". Declare it with .slot("${u}", ...) first.`);let s=new Set(a.map(u=>t.get(u)));if(s.size>1)throw new Error(`[FormBuilder] Step "${r.id}" field on attribute "${o.attribute}" targets slots of different objects (${[...s].join(", ")}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let t=[...ht,"join"];for(let r of this.data.steps)for(let n of r.rows)if(ft(n))for(let o of n.fields){if(!yr(o)||!o.prefillExpression)continue;let a=o.prefillExpression,s=`prefillExpression on free field "${o.attribute.name}" in step "${r.id}"`;if(!At(a))throw new Error(`[FormBuilder] ${s} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(a))throw new Error(`[FormBuilder] ${s} contains empty {{ }} interpolation.`);for(let u of a.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g)){let d=u[1];if(!t.includes(d))throw new Error(`[FormBuilder] ${s} uses invalid pipe "${d}". Valid pipes: ${t.join(", ")}`)}}}validateFreeFields(){let t=new Set(gr);for(let r of this.data.steps)for(let n of r.rows)if(ft(n)){for(let o of n.fields)if(yr(o)){let a=o.attribute.type;if(t.has(a))throw new Error(`[FormBuilder] Free field in step "${r.id}" uses forbidden attribute type "${a}". Forbidden types: ${gr.join(", ")}`)}}}};chunkDPD6ZWL2_js.a(bn,"FormBuilder");var pn=bn;function lw(e,t){return new pn(e,t)}chunkDPD6ZWL2_js.a(lw,"form");function Dl(e){return {text:"toString",richtext:"toString",number:"toNumber",currency:"toNumber",date:"toDate",checkbox:"toBoolean"}[e]}chunkDPD6ZWL2_js.a(Dl,"resolveBuiltInTransform");var gn=class gn{constructor(t){this.operations=[];this.touchedAttributes=new Set;this.version=t;}assertNotTouched(t,r){if(this.touchedAttributes.has(t))throw new Error(`[MigrationBuilder] Conflicting operations on attribute "${t}": it was already modified earlier in this migration (attempted: ${r}).`)}renameAttribute(t,r){return this.assertNotTouched(t,"rename_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"rename_attribute",from:t,to:r}),this}changeType(t,r,n,o){this.assertNotTouched(t,"change_type"),this.touchedAttributes.add(t);let a=o?.transform?Dl(n):void 0;return this.operations.push({type:"change_type",name:t,from:r,to:n,transform:a}),this}removeAttribute(t){return this.assertNotTouched(t,"remove_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"remove_attribute",name:t,backup_config:{}}),this}addAttribute(t){return this.assertNotTouched(t.name,"add_attribute"),this.touchedAttributes.add(t.name),this.operations.push({type:"add_attribute",attribute:t}),this}updateConfig(t,r){return this.assertNotTouched(t,"update_config"),this.touchedAttributes.add(t),this.operations.push({type:"update_config",name:t,from:{},to:r}),this}build(){return {version:this.version,operations:[...this.operations]}}};chunkDPD6ZWL2_js.a(gn,"MigrationBuilder");var vt=gn;function El(e){let{name:t,labelExpression:r,embeddingExpression:n}=e;if(!r)throw new chunkL277YJLQ_js.b(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,chunkL277YJLQ_js.a.VALIDATION_FAILED);let o=we.safeParse(r);if(!o.success){let a=o.error.issues[0]?.message??"Invalid labelExpression";throw new chunkL277YJLQ_js.b(`Invalid labelExpression for "${t}": ${a}`,chunkL277YJLQ_js.a.VALIDATION_FAILED)}if(n!==void 0){let a=we.safeParse(n);if(!a.success){let s=a.error.issues[0]?.message??"Invalid embeddingExpression";throw new chunkL277YJLQ_js.b(`Invalid embeddingExpression for "${t}": ${s}`,chunkL277YJLQ_js.a.VALIDATION_FAILED)}}}chunkDPD6ZWL2_js.a(El,"validateObjectExpressions");var yn=class yn{constructor(t){this._migrations=[];this._sealed=false;this._toleratedAttributes=[];this.validateName(t.name),this.obj={name:t.name,label:t.label,attributes:[],system:true},t.id&&(this.obj.id=t.id);}get"~standard"(){let t=chunkTQLF3EZP_js.e(this.build());return xt(t)}description(t){return this.obj.description=t,this}pluralLabel(t){return this._pluralLabel=t,this}icon(t){return this.obj.icon=t,this}runtime(){return this.obj.system=false,this}sealed(){return this._sealed=true,this}tolerate(t){return this._toleratedAttributes=[...this._toleratedAttributes,...t],this}attribute(t){return this.pushAttributes([t]),this}attributes(t){return this.pushAttributes(t),this}pushAttributes(t){let r=t.map(n=>"build"in n&&typeof n.build=="function"?n.build():n);ce([...this.obj.attributes,...r],n=>n.name,n=>new chunkL277YJLQ_js.r("attribute",n,`Object "${this.obj.name}": duplicate attribute name "${n}"`)),this.obj.attributes.push(...r);}metadata(t){return this.obj.metadata={...this.obj.metadata,...t},this}order(t){return this.obj.metadata={...this.obj.metadata,order:t},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:true},this}labelExpression(t){return this._labelExpression=t,this}embeddingExpression(t){return this._embeddingExpression=t,this}documentLayout(t){if(t.presets)for(let r of t.presets)na(r.id,r.structure,1);return this.obj.documentLayout=t,this}migration(t,r){if(t<2)throw new Error(`[ObjectBuilder] Migration version must be >= 2 (version 1 is implicit). Got: ${t}`);if(this._migrations.some(a=>a.version===t))throw new Error(`[ObjectBuilder] Duplicate migration version: ${t}`);let o=new vt(t);return r(o),this._migrations.push(o.build()),this}build(){if(!this.obj.name)throw new chunkL277YJLQ_js.h("[ObjectBuilder] Missing required field: name",[{path:["name"],message:"name is required"}]);if(!this.obj.label)throw new chunkL277YJLQ_js.h("[ObjectBuilder] Missing required field: label",[{path:["label"],message:"label is required"}]);El({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression});let t=[...this._migrations].sort((n,o)=>n.version-o.version);for(let n=0;n<t.length;n++){let o=n+2;if(t[n].version!==o)throw new Error(`[ObjectBuilder] Migration versions must be sequential starting at 2. Expected version ${o}, got ${t[n].version}.`)}let r=t.length>0?t[t.length-1].version:1;return {...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,schema_version:r,migrations:t,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(t){t!==void 0&&$e(t);}};chunkDPD6ZWL2_js.a(yn,"ObjectBuilder");var qe=yn;function ww(e){if(chunkDBQCXRYQ_js.w(e.name))throw new chunkL277YJLQ_js.s(e.name,"builder");return new qe(e)}chunkDPD6ZWL2_js.a(ww,"object");function na(e,t,r){let n=chunkDPD6ZWL2_js.a((a,s)=>{throw new chunkL277YJLQ_js.h(a,[{path:["documentLayout","presets",e],message:s}])},"fail");r>5&&n(`Preset structure exceeds max depth of ${5}`,"Preset structure too deep");let o=new Set;for(let a of t){let s=a.title.trim();s.length===0&&n("Folder preset node title is required","Empty folder title"),s.includes("/")&&n("Folder preset node title cannot contain /",`Folder title contains /: "${s}"`),o.has(s)&&n("Folder preset sibling titles must be unique",`Duplicate folder title: "${s}"`),o.add(s),a.children&&a.children.length>0&&na(e,a.children,r+1);}}chunkDPD6ZWL2_js.a(na,"validatePresetStructure");var Dn=class Dn{constructor(t,r){this.data={type:"fields",fields:[]};this.data.id=t,this.data.label=r;}description(t){return this.data.description=t,this}collapsible(t=false){return this.data.collapsible=true,this.data.collapsed=t,this}order(t){return this.data.order=t,this}fields(...t){for(let r of t)this.data.fields?.push({attribute:r});return this}field(t,r){return this.data.fields?.push({attribute:t,...r}),this}attributeGroup(t,r){return this.data.fields?.push({attributeGroup:t,...r}),this}build(){if(!this.data.id)throw new Error("[GroupBuilder] id is required");if(!this.data.label)throw new Error("[GroupBuilder] label is required");if(!this.data.fields||this.data.fields.length===0)throw new Error("[GroupBuilder] At least one field is required");return this.data}};chunkDPD6ZWL2_js.a(Dn,"GroupBuilder");var Dt=Dn,En=class En{constructor(t,r){this.view=t,this.tabData=r;}columns(...t){return this.tabData.columns=t,this}create(t){return this.tabData.allowCreate=true,t?.mode&&(this.tabData.createMode=t.mode),this}createMode(t){return this.tabData.createMode=t,this}openMode(t){return this.tabData.openMode=t,this}edit(){return this.tabData.allowEdit=true,this}delete(){return this.tabData.allowDelete=true,this}crud(){return this.tabData.allowCreate=true,this.tabData.allowEdit=true,this.tabData.allowDelete=true,this}filters(t){return this.tabData.filters=t,this}sorts(t){return this.tabData.sorts=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}tab(t,r){return this.finalize(),new te(this.view,t,r)}done(){return this.finalize(),this.view}build(){return this.finalize(),this.view.build()}finalize(){if(!this.tabData.columns||this.tabData.columns.length===0)throw new Error(`[TableTabConfig] columns() is required for tab "${this.tabData.name}"`);this.view._addTab(this.tabData);}};chunkDPD6ZWL2_js.a(En,"TableTabConfig");var Et=En,On=class On{constructor(t,r,n){this.view=t,this.tabData={...r,type:"custom",component:n};}props(t){return this.tabData.props=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(On,"CustomTabConfig");var hn=On,Cn=class Cn{constructor(t,r,n){this.view=t,this.tabData={...r,type:"richtext",attribute:n};}titleAttribute(t){return this.tabData.titleAttribute=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(Cn,"RichtextTabConfig");var An=Cn,_n=class _n{constructor(t,r){this.view=t,this.tabData={...r,type:"activity"};}limit(t){return this.tabData.limit=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(_n,"ActivityTabConfig");var Tn=_n,Nn=class Nn{constructor(t,r,n){this.view=t,this.tabData={...r,type:n,emailAttributeIds:[]};}emailAttributes(...t){return this.tabData.emailAttributeIds=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(Nn,"AddressMatchedTabConfig");var Ot=Nn,kn=class kn extends Ot{constructor(t,r){super(t,r,"emails");}};chunkDPD6ZWL2_js.a(kn,"EmailsTabConfig");var wn=kn,Pn=class Pn extends Ot{constructor(t,r){super(t,r,"meetings");}};chunkDPD6ZWL2_js.a(Pn,"MeetingsTabConfig");var xn=Pn,jn=class jn{constructor(t,r){this.view=t,this.tabData={...r,type:"documents",allowUpload:true,allowRemove:true,hideAttachments:false};}disableUpload(){return this.tabData.allowUpload=false,this}disableRemove(){return this.tabData.allowRemove=false,this}hideAttachments(){return this.tabData.hideAttachments=true,this}from(...t){return this.tabData.relations=[...this.tabData.relations??[],...t],this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(jn,"DocumentsTabConfig");var In=jn,Fn=class Fn{constructor(t,r,n){this.view=t,this.base={id:r,name:r,label:n};}icon(t){return this.base.icon=t,this}order(t){return this.base.order=t,this}form(...t){if(t.length===0)throw new Error(`[TabBuilder] form() requires at least one group for tab "${this.base.name}"`);let r={...this.base,type:"form",groups:t.map(n=>n instanceof Dt?n.build():n)};return this.view._addTab(r)}table(t){return new Et(this.view,{...this.base,type:"table",source:{type:"relation",attribute:t},columns:[]})}tableFrom(t,r){return new Et(this.view,{...this.base,type:"table",source:{type:"inverse",object:t,attribute:r},columns:[]})}custom(t){return new hn(this.view,this.base,t)}richtext(t){return new An(this.view,this.base,t)}activity(){return new Tn(this.view,this.base)}documents(){return new In(this.view,this.base)}emails(){return new wn(this.view,this.base)}meetings(){return new xn(this.view,this.base)}forms(t){let r={...this.base,type:"forms",...t};return this.view._addTab(r)}};chunkDPD6ZWL2_js.a(Fn,"TabBuilder");var te=Fn,Vn=class Vn{constructor(t,r){wt(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}sidePanel(t){return this.data.sidePanel=t,this}readOnly(){return this.data.readOnly=true,this}tab(t,r){return new te(this,t,r)}addTab(t){return this.data.tabs.push(t),this}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[DetailViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[DetailViewBuilder] At least one tab is required");ce(this.data.tabs,r=>r.name,r=>new Error(`[DetailViewBuilder] Duplicate tab name "${r}"`));let t={tabs:this.data.tabs,sidePanel:this.data.sidePanel,...this.data.readOnly?{readOnly:true}:{}};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"detail",config:t,default:this.data.default,metadata:this.data.metadata}}};chunkDPD6ZWL2_js.a(Vn,"DetailViewBuilder");var Sn=Vn;function Y(e,t){return new Sn(e,t)}chunkDPD6ZWL2_js.a(Y,"detailView");function Rt(e){if(Array.isArray(e))return e.map(Rt).find(r=>r!==void 0);if(e===null||typeof e!="object")return;let t=e;return t.attribute==="visibility"||t.attribute==="ownedBy"?t.attribute:Rt(t.rules)??Rt(t.groups)}chunkDPD6ZWL2_js.a(Rt,"findProtectedTabFilterAttribute");var Mn=class Mn{constructor(t,r){wt(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}baseFilter(t){return this.data.defaultFilters=t,this}allowPresentationCustomization(){return this.data.allowPresentationCustomization=true,this}tab(t,r){return new Rn(this,t,r)}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[ListViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[ListViewBuilder] At least one tab is required");if(ce(this.data.tabs,n=>n.id,n=>new Error(`[ListViewBuilder] Duplicate tab id "${n}"`)),this.data.tabs.filter(n=>n.default).length>1)throw new Error("[ListViewBuilder] Only one tab can be marked as default");for(let n of this.data.tabs){if(n.layout==="table"&&n.columns.length===0)throw new chunkL277YJLQ_js.h(`[ListViewBuilder] Tab "${n.id}" must have at least one column`,[]);if(n.layout==="kanban"&&!n.groupByAttribute)throw new chunkL277YJLQ_js.h(`[ListViewBuilder] Kanban tab "${n.id}" requires a groupByAttribute`,[]);if(n.descriptionAttribute!==void 0&&n.descriptionAttribute.length===0)throw new chunkL277YJLQ_js.h(`[ListViewBuilder] Tab "${n.id}" requires a nonempty description attribute name`,[]);if(n.displayAttributes!==void 0){let o=chunkDBQCXRYQ_js._.safeParse(n.displayAttributes);if(!o.success)throw new chunkL277YJLQ_js.h(`[ListViewBuilder] Tab "${n.id}" has invalid display attributes`,o.error.issues.map(a=>({path:["tabs",n.id,"displayAttributes",...a.path.map(String)],message:a.message})))}}let r={allowPresentationCustomization:this.data.allowPresentationCustomization,defaultFilters:this.data.defaultFilters?{id:chunk5667SMJ5_js.h(),combinator:this.data.defaultFilters.combinator,rules:this.data.defaultFilters.rules}:void 0,tabs:this.data.tabs.map(n=>{let o={id:n.id,label:n.label,icon:n.icon,default:n.default,visibility:n.visibility,columns:n.columns,descriptionAttribute:n.descriptionAttribute,displayAttributes:n.displayAttributes,filters:n.filters?{id:chunk5667SMJ5_js.h(),combinator:n.filters.combinator,rules:n.filters.rules}:void 0,sorts:n.sorts,readOnly:n.readOnly,createMode:n.createMode,openMode:n.openMode};return n.layout==="kanban"?{...o,layout:"kanban",groupByAttribute:n.groupByAttribute,cardUserAttribute:n.cardUserAttribute,cardDateAttribute:n.cardDateAttribute,kanbanColumnOrder:n.kanbanColumnOrder,kanbanColumnVisibility:n.kanbanColumnVisibility,kanbanPinnedColumns:n.kanbanPinnedColumns}:{...o,layout:n.layout,columnSizing:n.columnSizing}})};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"list",config:r,default:this.data.default,metadata:this.data.metadata}}};chunkDPD6ZWL2_js.a(Mn,"ListViewBuilder");var vn=Mn,Ct=class Ct{constructor(t,r,n){this.view=t,this.tabData={id:r,label:n,visibility:"all",layout:"table",columns:[]};}icon(t){return this.tabData.icon=t,this}default(){return this.tabData.default=true,this}readOnly(){return this.tabData.readOnly=true,this}visibility(t){return this.tabData.visibility=t,this}table(){return this.tabData.layout="table",this}list(){return this.tabData.layout="list",this}descriptionAttribute(t){return this.tabData.descriptionAttribute=t,this}displayAttributes(...t){return this.tabData.displayAttributes=t,this}kanban(t){return this.tabData.layout="kanban",this.tabData.groupByAttribute=t,this}cardUserAttribute(t){return this.tabData.cardUserAttribute=t,this}cardDateAttribute(t){return this.tabData.cardDateAttribute=t,this}kanbanColumnOrder(t){return this.tabData.kanbanColumnOrder=t,this}kanbanColumnVisibility(t){return this.tabData.kanbanColumnVisibility=t,this}kanbanPinnedColumns(t){return this.tabData.kanbanPinnedColumns=t,this}createMode(t){return this.tabData.createMode=t,this}openMode(t){return this.tabData.openMode=t,this}columns(...t){return this.tabData.columns=t,this}columnWidth(t,r){return this.tabData.columnSizing||(this.tabData.columnSizing={}),this.tabData.columnSizing[t]=r,this}filter(t){let r=Rt(t);if(r){let n=`Tab filters cannot target "${r}". Use .visibility("private")`;throw new chunkL277YJLQ_js.h(n,[{path:["filters"],message:n}])}return this.tabData.filters=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}sorts(t){return this.tabData.sorts=t,this}tab(t,r){return this.view._addTab(this.tabData),new Ct(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(Ct,"ListViewTabConfigBuilder");var Rn=Ct;function Q(e,t){return new vn(e,t)}chunkDPD6ZWL2_js.a(Q,"listView");function Ew(e,t){return new Dt(e,t)}chunkDPD6ZWL2_js.a(Ew,"group");function Ol(e){if(!/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(e))throw new Error(`Invalid flag name "${e}". Flag names must be kebab-case (e.g., "architect-mode", "ai-features").`)}chunkDPD6ZWL2_js.a(Ol,"validateFlagName");var qn=class qn{constructor(t,r,n){Ol(t),this.flag={name:t,valueType:r,defaultValue:n,allowedLevels:["global","tenant","user"]};}label(t){return this.flag.label=t,this}description(t){return this.flag.description=t,this}category(t){return this.flag.category=t,this}system(){return this.flag.system=true,this}tenantScoped(){return this.flag.allowedLevels=["global","tenant"],this}globalOnly(){return this.flag.allowedLevels=["global"],this}allowedLevels(t){return this.flag.allowedLevels=[...t],this}build(){if(!this.flag.label?.trim())throw new Error(`Flag "${this.flag.name}" must have a label. Use .label("Human-readable label").`);return {...this.flag,allowedLevels:[...this.flag.allowedLevels||[]]}}};chunkDPD6ZWL2_js.a(qn,"BaseFlagBuilder");var ve=qn,zn=class zn extends ve{constructor(t){super(t,"boolean",false);}defaultValue(t){return this.flag.defaultValue=t,this}enabledByDefault(){return this.flag.defaultValue=true,this}};chunkDPD6ZWL2_js.a(zn,"BooleanFlagBuilder");var Ln=zn,Gn=class Gn extends ve{constructor(t){super(t,"string","");}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Gn,"StringFlagBuilder");var Bn=Gn,Wn=class Wn extends ve{constructor(t){super(t,"number",0);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Wn,"NumberFlagBuilder");var $n=Wn,Kn=class Kn extends ve{constructor(t,r){super(t,"json",r);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Kn,"JsonFlagBuilder");var Un=Kn;function Cl(e){return new Ln(e)}chunkDPD6ZWL2_js.a(Cl,"booleanFlag");function _l(e){return new Bn(e)}chunkDPD6ZWL2_js.a(_l,"stringFlag");function Nl(e){return new $n(e)}chunkDPD6ZWL2_js.a(Nl,"numberFlag");function kl(e,t){return new Un(e,t)}chunkDPD6ZWL2_js.a(kl,"jsonFlag");function Hn(e){return new chunkL277YJLQ_js.r("feature flag",e,`Flag "${e}" is already registered. Each flag name must be unique.`)}chunkDPD6ZWL2_js.a(Hn,"duplicateFlagError");function Yn(e){return {...e,allowedLevels:[...e.allowedLevels]}}chunkDPD6ZWL2_js.a(Yn,"cloneFlagDefinition");var Qn=class Qn{constructor(){this.flags=new Map;}register(t){if(this.flags.has(t.name))throw Hn(t.name);this.flags.set(t.name,Yn(t));}registerAll(t){let r=new Set;for(let n of t){if(this.flags.has(n.name)||r.has(n.name))throw Hn(n.name);r.add(n.name);}for(let n of t)this.register(n);}get(t){let r=this.flags.get(t);return r?Yn(r):void 0}getOrThrow(t){let r=this.get(t);if(!r)throw new chunkL277YJLQ_js.c("Feature flag",t,void 0,`Flag "${t}" is not registered. Available flags: ${this.listNames().join(", ")}`);return r}has(t){return this.flags.has(t)}list(){return Array.from(this.flags.values(),Yn)}listNames(){return Array.from(this.flags.keys())}unregister(t){return this.flags.delete(t)}clear(){this.flags.clear();}get size(){return this.flags.size}};chunkDPD6ZWL2_js.a(Qn,"FlagRegistry");var ze=Qn,Pl=new ze;function jl(){return new ze}chunkDPD6ZWL2_js.a(jl,"createFlagRegistry");function _t(){return {global:new Map,tenant:new Map,user:new Map}}chunkDPD6ZWL2_js.a(_t,"emptyOverrides");function Fl(e,t){return e.expiresAt===void 0||e.expiresAt.getTime()>t}chunkDPD6ZWL2_js.a(Fl,"isActiveOverride");function Jn(e,t){let r=new Map;for(let n of e){if(!Fl(n,t))continue;let o=n.flagName;r.has(o)||r.set(o,n);}return r}chunkDPD6ZWL2_js.a(Jn,"indexOverrides");var Xn=class Xn{constructor(t){this.repository=t.repository,this.registry=t.registry,this.staticDefaults=new Map(t.staticDefaults?.map(r=>[r.name,r.value])??[]);}async resolveAll(t={}){let r=this.collectFlagNames(),n=this.repository&&r.size>0?await this.getAllOverrides(t,[...r]):_t();return this.resolveNames(r,n,t)}resolveAllStatic(){return this.resolveNames(this.collectFlagNames(),_t(),{})}collectFlagNames(){let t=new Set;for(let r of this.registry.listNames())t.add(r);for(let r of this.staticDefaults.keys())t.add(r);return t}resolveNames(t,r,n){let o=new Map;for(let a of t)o.set(a,this.resolveValue(a,r,n));return o}async resolve(t,r={}){let n=this.repository?await this.getAllOverrides(r,[t]):_t();return this.resolveWithSource(t,n,r)}async isEnabled(t,r={}){return (await this.resolve(t,r)).value===true}async getValue(t,r={}){return (await this.resolve(t,r)).value}async setOverride(t,r,n,o={}){if(!this.repository)throw new chunkL277YJLQ_js.b("Cannot set override: no FeatureFlagsRepository configured. Add featureFlags to your DatabaseAdapter to enable runtime overrides.",chunkL277YJLQ_js.a.CONFIGURATION_REQUIRED);let a=this.registry.get(t);if(a&&!a.allowedLevels.includes(r)){let s=`Flag "${t}" does not allow ${r}-level overrides. Allowed levels: ${a.allowedLevels.join(", ")}`;throw new chunkL277YJLQ_js.h(s,[{path:["level"],message:s}])}if(a?.system){let s=`Flag "${t}" is a system flag and cannot be overridden via API.`;throw new chunkL277YJLQ_js.h(s,[{path:["flagName"],message:s}])}await this.repository.setOverride({flagName:t,level:r,value:n,targetId:o.targetId,expiresAt:o.expiresAt,createdBy:o.createdBy});}async deleteOverride(t,r,n){if(!this.repository)throw new chunkL277YJLQ_js.b("Cannot delete override: no FeatureFlagsRepository configured.",chunkL277YJLQ_js.a.CONFIGURATION_REQUIRED);await this.repository.deleteOverride(t,r,n);}async getAllOverrides(t,r){if(!this.repository)return _t();let[n,o,a]=await Promise.all([this.repository.getOverrides({level:"global",flagNames:r}),t.tenantId?this.repository.getOverrides({level:"tenant",targetId:t.tenantId,flagNames:r}):Promise.resolve([]),t.userId?this.repository.getOverrides({level:"user",targetId:t.userId,flagNames:r}):Promise.resolve([])]),s=Date.now();return {global:Jn(n,s),tenant:Jn(o,s),user:Jn(a,s)}}resolveValue(t,r,n){return this.resolveWithSource(t,r,n).value}resolveWithSource(t,r,n){let o=this.registry.get(t),a=o?.allowedLevels??["global","tenant","user"];if(n.userId&&a.includes("user")){let s=r.user.get(t);if(s)return {name:t,value:s.value,source:"user",sourceId:n.userId}}if(n.tenantId&&a.includes("tenant")){let s=r.tenant.get(t);if(s)return {name:t,value:s.value,source:"tenant",sourceId:n.tenantId}}if(a.includes("global")){let s=r.global.get(t);if(s)return {name:t,value:s.value,source:"global"}}return this.staticDefaults.has(t)?{name:t,value:this.staticDefaults.get(t),source:"default"}:{name:t,value:o?.defaultValue??void 0,source:"default"}}};chunkDPD6ZWL2_js.a(Xn,"FlagService");var Nt=Xn;function Vl(e){return new Nt(e)}chunkDPD6ZWL2_js.a(Vl,"createFlagService");var ia=Symbol("stndrds.native-object");function ei(e){return Object.defineProperty(e,ia,{value:true,enumerable:false}),e}chunkDPD6ZWL2_js.a(ei,"markNativeDefinition");var ri=class ri extends qe{build(){return ei(super.build())}};chunkDPD6ZWL2_js.a(ri,"NativeObjectBuilder");var Zn=ri;function J(e){return new Zn(e)}chunkDPD6ZWL2_js.a(J,"nativeObject");function ti(e){return e[ia]===true}chunkDPD6ZWL2_js.a(ti,"isNativeDefinition");function ni(e){let t=structuredClone(e);return ti(e)?ei(t):t}chunkDPD6ZWL2_js.a(ni,"cloneObjectDefinition");var oi=class oi{constructor(){this.objects=new Map;}register(t){let n=(Array.isArray(t)?t:[t]).map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o=new Set;for(let a of n){if(this.validate(a),o.has(a.name))throw new chunkL277YJLQ_js.r("object",a.name,`[NativeObjectRegistry] Duplicate object name "${a.name}" within a single register() batch.`);o.add(a.name);}for(let a of n)this.objects.set(a.name,ni(a));return this}validate(t){if(!t.system){let r=`[NativeObjectRegistry] Cannot register object "${t.name}" (id: ${t.id}): missing system flag.
|
|
14
|
-
Native objects must have system=true. Did you call .runtime() on the builder? Remove that call \u2014 objects are system:true by default.`;throw new
|
|
11
|
+
\u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`);if(chunkJRBNMHMY_js.B.includes(e))throw new Error(`[AttributeBuilder] "${e}" is a reserved name and cannot be used as an attribute name.
|
|
12
|
+
Reserved names: ${chunkJRBNMHMY_js.B.join(", ")}`)}chunkDPD6ZWL2_js.a(Ue,"validateAttributeName");function Qo(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute label cannot be empty");if(e.length>Ho)throw new Error(`[AttributeBuilder] Attribute label is too long (max ${Ho} characters)`)}chunkDPD6ZWL2_js.a(Qo,"validateLabel");function Jo(e,t){if(!Sl.has(e))throw new Error(`[AttributeBuilder] Invalid icon "${e}" in ${t}.
|
|
13
|
+
Icon must be one of the predefined icons from @stndrds/constants.`)}chunkDPD6ZWL2_js.a(Jo,"validateIconName");function pe(e,t){let r=new Set;for(let n of t){if(!n.value?.trim())throw new Error(`[AttributeBuilder] Option in "${e}" has an empty or missing value.`);if(!n.label?.trim())throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has an empty or missing label.`);if(r.has(n.value))throw new Error(`[AttributeBuilder] Duplicate option value "${n.value}" in "${e}".`);r.add(n.value);}for(let n of t){if(n.inverse===void 0)continue;let o=t.find(a=>a.value===n.inverse);if(!o)throw new Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has inverse "${n.inverse}" which does not match any option value.`);if(o.inverse!==n.value)throw new Error(`[AttributeBuilder] Inverse mismatch in "${e}": "${n.value}" points to "${n.inverse}", but "${n.inverse}" points to "${o.inverse??"(none)"}". Inverse pairs must be symmetric.`)}}chunkDPD6ZWL2_js.a(pe,"validateOptions");var Xo={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2},timeoutMs:3e5},Rr=class Rr{constructor(t){if(!t.name||t.name.trim().length===0)throw new chunkJSKLP4GI_js.h("Agent name is required",[]);this.bp={name:t.name,system:true,visibility:"workspace",triggers:[]};}description(t){return this.bp.description=t,this}label(t){return this.bp.label=t,this}icon(t){return this.bp.icon=t,this}systemPrompt(t){return this.bp.systemPrompt=t,this}model(t,r,n){return this.bp.model={provider:t,model:r,...n},this}tools(t){return this.bp.tools=[...t],this}schedule(t){return this.bp.schedule={...t,enabled:t.enabled??true},this}config(t){let r=this.bp.config??Xo,n=t.inference===void 0?r.inference:{...r.inference,...t.inference};return this.bp.config={...r,...t,...n===void 0?{}:{inference:n}},this}delegation(t){return Object.assign(this.bp,t),this}mcpServers(t){return this.bp.mcpServers=Array.isArray(t)?[...t]:t,this}approval(t){return this.bp.approval={...xo,...this.bp.approval,...t},this}visibility(t){return this.bp.visibility=t,this}requiresPermission(t,r){return this.bp.requiredPermission={resource:t,action:r},this}trigger(t,r,n){return this.bp.triggers.push({name:t,eventType:r,...n,enabled:n?.enabled??true}),this}runtime(){return this.bp.system=false,this}build(){if(!this.bp.systemPrompt)throw new chunkJSKLP4GI_js.h(`Agent "${this.bp.name}": systemPrompt is required`,[]);if(!this.bp.model)throw new chunkJSKLP4GI_js.h(`Agent "${this.bp.name}": model is required`,[]);if(this.bp.system&&this.bp.visibility==="private")throw new chunkJSKLP4GI_js.h(`Agent "${this.bp.name}": system agents must use workspace visibility`,[]);return ce(this.bp.triggers,t=>t.name,t=>new chunkJSKLP4GI_js.h(`Agent "${this.bp.name}": duplicate trigger name "${t}"`,[])),{...this.bp,visibility:this.bp.visibility??"workspace",config:this.bp.config??Xo,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};chunkDPD6ZWL2_js.a(Rr,"AgentBuilder");var vr=Rr;function VT(e){return new vr(e)}chunkDPD6ZWL2_js.a(VT,"agent");var Rl="@stndrds/schema";function xt(e){return {version:1,vendor:Rl,validate:chunkDPD6ZWL2_js.a(t=>{let r=e.safeParse(t);return r.success?{value:r.data}:{issues:r.error.issues.map(n=>({message:n.message,path:n.path}))}},"validate")}}chunkDPD6ZWL2_js.a(xt,"createStandardSchemaProps");function BT(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"].version===1}chunkDPD6ZWL2_js.a(BT,"isStandardSchema");var zr=class zr{get"~standard"(){let t=chunkIBM4ID4Y_js.c(this.build());return xt(t)}constructor(t,r,n){Ue(r),Qo(n),this.attr={name:r,label:n,type:t,required:false,system:true};}setRequired(t){this.attr.required=t;}asRequiredState(){return this}asPhantomState(){return this}runtime(){return this.attr.system=false,this}hidden(){return this.attr.hidden=true,this}placeholder(t){return this.attr.placeholder=t,this}description(t){return this.attr.description=t,this}icon(t){return Jo(t,`attribute "${this.attr.name}"`),this.attr.icon=t,this}order(t){return this.attr.order=t,this}defaultValue(t){return ("defaultValue"in this.attr||!["formula","rollup"].includes(this.attr.type))&&(this.attr.defaultValue=t),this}metadata(t){return this.attr.metadata=t,this}build(){return this.attr}};chunkDPD6ZWL2_js.a(zr,"BaseAttributeBuilder");var E=zr,Gr=class Gr extends E{constructor(t,r){super("text",t,r);}minLength(t){return this.attr.minLength=t,this}maxLength(t){return this.attr.maxLength=t,this}pattern(t){return this.attr.pattern=t,this.attr.format=void 0,this}multiline(t=true){return this.attr.multiline=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}email(){return this.attr.format="email",this.attr.pattern=void 0,this}url(){return this.attr.format="url",this.attr.pattern=void 0,this}slug(){return this.attr.format="slug",this.attr.pattern=void 0,this}};chunkDPD6ZWL2_js.a(Gr,"TextAttributeBuilder");var Dr=Gr;function b(e){return new Dr(e.name,e.label)}chunkDPD6ZWL2_js.a(b,"text");var Wr=class Wr extends E{constructor(t,r){super("richtext",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Wr,"RichtextAttributeBuilder");var Er=Wr;function ie(e){return new Er(e.name,e.label)}chunkDPD6ZWL2_js.a(ie,"richtext");var Kr=class Kr extends E{constructor(t,r){super("number",t,r);}min(t){return this.attr.min=t,this}max(t){return this.attr.max=t,this}integer(){return this.attr.unit="integer",this.attr.decimals=0,this}decimal(t=2){return this.attr.unit="decimal",this.attr.decimals=t,this}percentage(){return this.attr.unit="percentage",this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Kr,"NumberAttributeBuilder");var Cr=Kr;function St(e){return new Cr(e.name,e.label)}chunkDPD6ZWL2_js.a(St,"number");var Hr=class Hr extends E{constructor(t,r){super("checkbox",t,r);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Hr,"CheckboxAttributeBuilder");var Or=Hr;function Zo(e){return new Or(e.name,e.label)}chunkDPD6ZWL2_js.a(Zo,"checkbox");var Yr=class Yr extends E{constructor(t,r){super("date",t,r);}format(t){return this.attr.dateFormat=t,this}minDate(t){return this.attr.minDate=t,this}maxDate(t){return this.attr.maxDate=t,this}endDate(){return this.attr.endDate=true,this.asPhantomState()}includeTime(){return this.attr.includeTime=true,this}timeFormat(t){return this.attr.timeFormat=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Yr,"DateAttributeBuilder");var _r=Yr;function q(e){return new _r(e.name,e.label)}chunkDPD6ZWL2_js.a(q,"date");var Qr=class Qr extends E{constructor(t,r){super("phone",t,r);}defaultCountry(t){return this.attr.defaultCountryCode=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Qr,"PhoneAttributeBuilder");var Nr=Qr;function YT(e){return new Nr(e.name,e.label)}chunkDPD6ZWL2_js.a(YT,"phone");var Jr=class Jr extends E{constructor(t,r){super("currency",t,r);}defaultCurrency(t){return this.attr.defaultCurrency=t,this}allowedCurrencies(t){return this.attr.allowedCurrencies=t,this}allowNegative(t=true){return this.attr.allowNegative=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Jr,"CurrencyAttributeBuilder");var kr=Jr;function QT(e){return new kr(e.name,e.label)}chunkDPD6ZWL2_js.a(QT,"currency");var Xr=class Xr extends E{constructor(t,r){super("status",t,r);}options(t){let r=t;return pe(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return pe(this.attr.name??"unknown",r),this.attr.options.push(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Xr,"StatusAttributeBuilder");var Pr=Xr;function JT(e){return new Pr(e.name,e.label)}chunkDPD6ZWL2_js.a(JT,"status");var Zr=class Zr extends E{constructor(t,r){super("select",t,r);}options(t){let r=t;return pe(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return pe(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Zr,"SelectAttributeBuilder");var jr=Zr;function H(e){return new jr(e.name,e.label)}chunkDPD6ZWL2_js.a(H,"select");var en=class en extends E{constructor(t,r){super("multiselect",t,r);}options(t){let r=t;return pe(this.attr.name??"unknown",r),this.attr.options=r,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let r=[...this.attr.options,t];return pe(this.attr.name??"unknown",r),this.attr.options.push(t),this}renderAs(t){return this.attr.renderAs=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(en,"MultiselectAttributeBuilder");var Fr=en;function XT(e){return new Fr(e.name,e.label)}chunkDPD6ZWL2_js.a(XT,"multiselect");var tn=class tn extends E{constructor(t,r){super("location",t,r);}granularity(t){return this.attr.granularity=t,this}defaultCountry(t){return this.attr.defaultCountry=t,this}allowedCountries(t){return this.attr.allowedCountries=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(tn,"LocationAttributeBuilder");var Vr=tn;function ZT(e){return new Vr(e.name,e.label)}chunkDPD6ZWL2_js.a(ZT,"location");var rn=class rn extends E{constructor(t,r){super("user",t,r),this.attr.types=["user","agent"];}types(t){let r=[...new Set(t)];if(r.length===0)throw new Error("[AttributeBuilder] user.types must contain at least one type.");return this.attr.types=r,this}multiple(){return this.attr.multiple=true,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(rn,"UserAttributeBuilder");var Mr=rn;function ew(e){return new Mr(e.name,e.label)}chunkDPD6ZWL2_js.a(ew,"user");var nn=class nn extends E{to(t,r){let n={object:t,...r};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:ee}],this}qualifyWith(...t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.qualifyWith() must be called AFTER .to(). Example: relation({ name: "companies" }).to("companies").qualifyWith(...)');return this.attr.properties=gt(t),this}bilateral(t){let r=this.attr.targets;if(!r||r.length===0)throw new Error('.bilateral() must be called AFTER .to(). Example: relation({ name: "company" }).to("companies").bilateral({ ... })');if(r.length>1)throw new Error("Bilateral relations are not supported for polymorphic relations (multiple .to() targets).");if(wo(this.attr))throw new Error("Bilateral relations are not supported for universal relations (.toAny()).");return this.attr.bilateral=t,this}};chunkDPD6ZWL2_js.a(nn,"BaseRelationAttributeBuilder");var It=nn,on=class on extends It{constructor(t,r){super("relation",t,r),this.attr.cardinality="one",this.attr.targets=[];}many(){let t=new Br(this.attr.name,this.attr.label??"",{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===false&&t.runtime(),this.attr.hidden&&t.hidden(),this.attr.placeholder&&t.placeholder(this.attr.placeholder),this.attr.description&&t.description(this.attr.description),this.attr.icon&&t.icon(this.attr.icon),this.attr.order!==void 0&&t.order(this.attr.order),this.attr.metadata&&t.metadata(this.attr.metadata),t}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(on,"SingleRelationAttributeBuilder");var Lr=on,an=class an extends It{constructor(t,r,n){super("relation",t,r),this.attr.cardinality="many",this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&this.setRequired(true);}maxItems(t){return this.attr.maxItems=t,this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(an,"MultiRelationAttributeBuilder");var Br=an;function Se(e){return new Lr(e.name,e.label)}chunkDPD6ZWL2_js.a(Se,"relation");var sn=class sn extends E{constructor(t,r){super("formula",t,r),this.attr.required=false;}expression(t){return this.attr.expression=t,this}returns(t){return this.attr.returnType=t,this}decimals(t){return this.attr.decimals=t,this}required(){throw new Error("Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};chunkDPD6ZWL2_js.a(sn,"FormulaAttributeBuilder");var $r=sn;function tw(e){return new $r(e.name,e.label)}chunkDPD6ZWL2_js.a(tw,"formula");var un=class un extends E{constructor(t,r){super("rollup",t,r),this.attr.required=false;}from(t){return this.attr.relationAttribute=t,this}aggregate(t){return this.attr.targetAttribute=t,this}using(t){return this.attr.function=t,this}decimals(t){return this.attr.decimals=t,this}path(t){return this.attr.relationPath=t,this}targetType(t){return this.attr.targetAttributeType=t,this}targetOptions(t){return this.attr.targetAttributeOptions=t,this}targetCurrency(t){return this.attr.targetCurrencyCode=t,this}build(){let t=this.attr.function,r=this.attr.targetAttributeType;if(t==="original"&&r!==void 0&&r!=="select"&&r!=="status"&&r!=="multiselect"){let n=this.attr.relationAttribute??"relation",o=this.attr.targetAttribute??"field";throw new chunkJSKLP4GI_js.b(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${r}") was given. To surface a plain ${r} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${n}.${o}").`,chunkJSKLP4GI_js.a.VALIDATION_FAILED)}return super.build()}required(){throw new Error("Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.")}optional(){return this}};chunkDPD6ZWL2_js.a(un,"RollupAttributeBuilder");var Ur=un;function rw(e){return new Ur(e.name,e.label)}chunkDPD6ZWL2_js.a(rw,"rollup");var ln=class ln extends E{constructor(t,r){super("document",t,r);}accepts(t){return this.attr.accepts=t,this}maxFileSize(t){return this.attr.maxFileSize=t,this}qualifyWith(...t){return this.attr.properties=gt(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(ln,"DocumentAttributeBuilder");var qr=ln;function ea(e){return new qr(e.name,e.label)}chunkDPD6ZWL2_js.a(ea,"document");function ra(e,t,r){let n=Array.isArray(e)?e:[e],[o,...a]=n;return {type:"slot",slotId:o,additionalSlotIds:a.length>0?a:void 0,attribute:t,label:r?.label,required:r?.required,tooltip:r?.tooltip}}chunkDPD6ZWL2_js.a(ra,"buildSlotFieldRef");var mn=class mn{constructor(t,r,n){this._finalized=false;this.stepBuilder=t,this.rowData={id:r,order:n,type:"fields",fields:[]};}field(t,r,n){return this.rowData.fields.push(ra(t,r,n)),this}freeField(t,r){let o={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression};return this.rowData.fields.push(o),this}row(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).row(t)}heading(t,r){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).heading(t,r)}separator(){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).separator()}text(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).text(t)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=true,this.stepBuilder._finalizeRow(this.rowData))}};chunkDPD6ZWL2_js.a(mn,"FormRowBuilder");var dn=mn,fn=class fn{constructor(t,r,n){this.rowOrder=0;this.formBuilder=t,this.stepData={id:r,label:n,rows:[]};}description(t){return this.stepData.description=t,this}field(t,r,n){this.rowOrder++;let o=`row-${this.stepData.id}-${this.rowOrder}`,a=ra(t,r,n),s={id:o,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}freeField(t,r){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,a={type:"free",attribute:t.build(),label:r?.label,required:r?.required,prefillExpression:r?.prefillExpression},s={id:n,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}row(t){return this.rowOrder++,new dn(this,t,this.rowOrder)}heading(t,r){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"heading",content:t,level:r};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let t={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"separator"};return this.stepData.rows.push(t),this}text(t){this.rowOrder++;let r={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"text",content:t};return this.stepData.rows.push(r),this}step(t,r){return this.formBuilder._finalizeStep(this.stepData).step(t,r)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(t){return t.fields.length>0&&this.stepData.rows.push(t),this}_getData(){return this.stepData}};chunkDPD6ZWL2_js.a(fn,"FormStepBuilder");var cn=fn,bn=class bn{constructor(t,r){this.data={slots:[],steps:[],status:"draft",version:1};this.validateName(t),this.data.name=t,this.data.label=r;}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}status(t){return this.data.status=t,this}metadata(t){return this.data.metadata=t,this}slot(t,r,n){if(this.data.slots.some(a=>a.id===t))throw new Error(`[FormBuilder] Duplicate slot id: "${t}"`);let o={id:t,objectName:r,label:n.label,mode:n.mode??"create",color:n.color,icon:n.icon};return this.data.slots.push(o),this}step(t,r){if(this.data.steps.some(n=>n.id===t))throw new Error(`[FormBuilder] Duplicate step id: "${t}"`);return new cn(this,t,r)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.data}_finalizeStep(t){return this.data.steps.push(t),this}validateName(t){let r=Ir.z.string().min(1,"Form name cannot be empty").max(63,"Form name is too long (max 63 characters)").regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:"Invalid form name format. Name must be in kebab-case: 'client-onboarding', 'contact-creation'"});try{r.parse(t);}catch(n){throw n instanceof Ir.z.ZodError?new Error(`[FormBuilder] ${n.issues[0].message}`):n}}validateRequiredData(){if(this.data.slots.length===0)throw new Error("[FormBuilder] At least one slot is required. Use .slot() to add slots.");if(this.data.steps.length===0)throw new Error("[FormBuilder] At least one step is required. Use .step() to add steps.")}validateSlotReferences(){let t=new Map(this.data.slots.map(r=>[r.id,r.objectName]));for(let r of this.data.steps)for(let n of r.rows)if(ft(n))for(let o of n.fields){if(o.type!=="slot")continue;let a=Oo(o);for(let u of a)if(!t.has(u))throw new Error(`[FormBuilder] Step "${r.id}" references unknown slot "${u}". Declare it with .slot("${u}", ...) first.`);let s=new Set(a.map(u=>t.get(u)));if(s.size>1)throw new Error(`[FormBuilder] Step "${r.id}" field on attribute "${o.attribute}" targets slots of different objects (${[...s].join(", ")}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let t=[...ht,"join"];for(let r of this.data.steps)for(let n of r.rows)if(ft(n))for(let o of n.fields){if(!yr(o)||!o.prefillExpression)continue;let a=o.prefillExpression,s=`prefillExpression on free field "${o.attribute.name}" in step "${r.id}"`;if(!At(a))throw new Error(`[FormBuilder] ${s} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(a))throw new Error(`[FormBuilder] ${s} contains empty {{ }} interpolation.`);for(let u of a.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g)){let d=u[1];if(!t.includes(d))throw new Error(`[FormBuilder] ${s} uses invalid pipe "${d}". Valid pipes: ${t.join(", ")}`)}}}validateFreeFields(){let t=new Set(gr);for(let r of this.data.steps)for(let n of r.rows)if(ft(n)){for(let o of n.fields)if(yr(o)){let a=o.attribute.type;if(t.has(a))throw new Error(`[FormBuilder] Free field in step "${r.id}" uses forbidden attribute type "${a}". Forbidden types: ${gr.join(", ")}`)}}}};chunkDPD6ZWL2_js.a(bn,"FormBuilder");var pn=bn;function lw(e,t){return new pn(e,t)}chunkDPD6ZWL2_js.a(lw,"form");function Dl(e){return {text:"toString",richtext:"toString",number:"toNumber",currency:"toNumber",date:"toDate",checkbox:"toBoolean"}[e]}chunkDPD6ZWL2_js.a(Dl,"resolveBuiltInTransform");var gn=class gn{constructor(t){this.operations=[];this.touchedAttributes=new Set;this.version=t;}assertNotTouched(t,r){if(this.touchedAttributes.has(t))throw new Error(`[MigrationBuilder] Conflicting operations on attribute "${t}": it was already modified earlier in this migration (attempted: ${r}).`)}renameAttribute(t,r){return this.assertNotTouched(t,"rename_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"rename_attribute",from:t,to:r}),this}changeType(t,r,n,o){this.assertNotTouched(t,"change_type"),this.touchedAttributes.add(t);let a=o?.transform?Dl(n):void 0;return this.operations.push({type:"change_type",name:t,from:r,to:n,transform:a}),this}removeAttribute(t){return this.assertNotTouched(t,"remove_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"remove_attribute",name:t,backup_config:{}}),this}addAttribute(t){return this.assertNotTouched(t.name,"add_attribute"),this.touchedAttributes.add(t.name),this.operations.push({type:"add_attribute",attribute:t}),this}updateConfig(t,r){return this.assertNotTouched(t,"update_config"),this.touchedAttributes.add(t),this.operations.push({type:"update_config",name:t,from:{},to:r}),this}build(){return {version:this.version,operations:[...this.operations]}}};chunkDPD6ZWL2_js.a(gn,"MigrationBuilder");var vt=gn;function El(e){let{name:t,labelExpression:r,embeddingExpression:n}=e;if(!r)throw new chunkJSKLP4GI_js.b(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,chunkJSKLP4GI_js.a.VALIDATION_FAILED);let o=we.safeParse(r);if(!o.success){let a=o.error.issues[0]?.message??"Invalid labelExpression";throw new chunkJSKLP4GI_js.b(`Invalid labelExpression for "${t}": ${a}`,chunkJSKLP4GI_js.a.VALIDATION_FAILED)}if(n!==void 0){let a=we.safeParse(n);if(!a.success){let s=a.error.issues[0]?.message??"Invalid embeddingExpression";throw new chunkJSKLP4GI_js.b(`Invalid embeddingExpression for "${t}": ${s}`,chunkJSKLP4GI_js.a.VALIDATION_FAILED)}}}chunkDPD6ZWL2_js.a(El,"validateObjectExpressions");var yn=class yn{constructor(t){this._migrations=[];this._sealed=false;this._toleratedAttributes=[];this.validateName(t.name),this.obj={name:t.name,label:t.label,attributes:[],system:true},t.id&&(this.obj.id=t.id);}get"~standard"(){let t=chunkIBM4ID4Y_js.e(this.build());return xt(t)}description(t){return this.obj.description=t,this}pluralLabel(t){return this._pluralLabel=t,this}icon(t){return this.obj.icon=t,this}runtime(){return this.obj.system=false,this}sealed(){return this._sealed=true,this}tolerate(t){return this._toleratedAttributes=[...this._toleratedAttributes,...t],this}attribute(t){return this.pushAttributes([t]),this}attributes(t){return this.pushAttributes(t),this}pushAttributes(t){let r=t.map(n=>"build"in n&&typeof n.build=="function"?n.build():n);ce([...this.obj.attributes,...r],n=>n.name,n=>new chunkJSKLP4GI_js.r("attribute",n,`Object "${this.obj.name}": duplicate attribute name "${n}"`)),this.obj.attributes.push(...r);}metadata(t){return this.obj.metadata={...this.obj.metadata,...t},this}order(t){return this.obj.metadata={...this.obj.metadata,order:t},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:true},this}labelExpression(t){return this._labelExpression=t,this}embeddingExpression(t){return this._embeddingExpression=t,this}documentLayout(t){if(t.presets)for(let r of t.presets)na(r.id,r.structure,1);return this.obj.documentLayout=t,this}migration(t,r){if(t<2)throw new Error(`[ObjectBuilder] Migration version must be >= 2 (version 1 is implicit). Got: ${t}`);if(this._migrations.some(a=>a.version===t))throw new Error(`[ObjectBuilder] Duplicate migration version: ${t}`);let o=new vt(t);return r(o),this._migrations.push(o.build()),this}build(){if(!this.obj.name)throw new chunkJSKLP4GI_js.h("[ObjectBuilder] Missing required field: name",[{path:["name"],message:"name is required"}]);if(!this.obj.label)throw new chunkJSKLP4GI_js.h("[ObjectBuilder] Missing required field: label",[{path:["label"],message:"label is required"}]);El({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression});let t=[...this._migrations].sort((n,o)=>n.version-o.version);for(let n=0;n<t.length;n++){let o=n+2;if(t[n].version!==o)throw new Error(`[ObjectBuilder] Migration versions must be sequential starting at 2. Expected version ${o}, got ${t[n].version}.`)}let r=t.length>0?t[t.length-1].version:1;return {...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,schema_version:r,migrations:t,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(t){t!==void 0&&$e(t);}};chunkDPD6ZWL2_js.a(yn,"ObjectBuilder");var qe=yn;function ww(e){if(chunkJRBNMHMY_js.w(e.name))throw new chunkJSKLP4GI_js.s(e.name,"builder");return new qe(e)}chunkDPD6ZWL2_js.a(ww,"object");function na(e,t,r){let n=chunkDPD6ZWL2_js.a((a,s)=>{throw new chunkJSKLP4GI_js.h(a,[{path:["documentLayout","presets",e],message:s}])},"fail");r>5&&n(`Preset structure exceeds max depth of ${5}`,"Preset structure too deep");let o=new Set;for(let a of t){let s=a.title.trim();s.length===0&&n("Folder preset node title is required","Empty folder title"),s.includes("/")&&n("Folder preset node title cannot contain /",`Folder title contains /: "${s}"`),o.has(s)&&n("Folder preset sibling titles must be unique",`Duplicate folder title: "${s}"`),o.add(s),a.children&&a.children.length>0&&na(e,a.children,r+1);}}chunkDPD6ZWL2_js.a(na,"validatePresetStructure");var Dn=class Dn{constructor(t,r){this.data={type:"fields",fields:[]};this.data.id=t,this.data.label=r;}description(t){return this.data.description=t,this}collapsible(t=false){return this.data.collapsible=true,this.data.collapsed=t,this}order(t){return this.data.order=t,this}fields(...t){for(let r of t)this.data.fields?.push({attribute:r});return this}field(t,r){return this.data.fields?.push({attribute:t,...r}),this}attributeGroup(t,r){return this.data.fields?.push({attributeGroup:t,...r}),this}build(){if(!this.data.id)throw new Error("[GroupBuilder] id is required");if(!this.data.label)throw new Error("[GroupBuilder] label is required");if(!this.data.fields||this.data.fields.length===0)throw new Error("[GroupBuilder] At least one field is required");return this.data}};chunkDPD6ZWL2_js.a(Dn,"GroupBuilder");var Dt=Dn,En=class En{constructor(t,r){this.view=t,this.tabData=r;}columns(...t){return this.tabData.columns=t,this}create(t){return this.tabData.allowCreate=true,t?.mode&&(this.tabData.createMode=t.mode),this}createMode(t){return this.tabData.createMode=t,this}openMode(t){return this.tabData.openMode=t,this}edit(){return this.tabData.allowEdit=true,this}delete(){return this.tabData.allowDelete=true,this}crud(){return this.tabData.allowCreate=true,this.tabData.allowEdit=true,this.tabData.allowDelete=true,this}filters(t){return this.tabData.filters=t,this}sorts(t){return this.tabData.sorts=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}tab(t,r){return this.finalize(),new te(this.view,t,r)}done(){return this.finalize(),this.view}build(){return this.finalize(),this.view.build()}finalize(){if(!this.tabData.columns||this.tabData.columns.length===0)throw new Error(`[TableTabConfig] columns() is required for tab "${this.tabData.name}"`);this.view._addTab(this.tabData);}};chunkDPD6ZWL2_js.a(En,"TableTabConfig");var Et=En,Cn=class Cn{constructor(t,r,n){this.view=t,this.tabData={...r,type:"custom",component:n};}props(t){return this.tabData.props=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(Cn,"CustomTabConfig");var hn=Cn,On=class On{constructor(t,r,n){this.view=t,this.tabData={...r,type:"richtext",attribute:n};}titleAttribute(t){return this.tabData.titleAttribute=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(On,"RichtextTabConfig");var An=On,_n=class _n{constructor(t,r){this.view=t,this.tabData={...r,type:"activity"};}limit(t){return this.tabData.limit=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(_n,"ActivityTabConfig");var Tn=_n,Nn=class Nn{constructor(t,r,n){this.view=t,this.tabData={...r,type:n,emailAttributeIds:[]};}emailAttributes(...t){return this.tabData.emailAttributeIds=t,this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(Nn,"AddressMatchedTabConfig");var Ct=Nn,kn=class kn extends Ct{constructor(t,r){super(t,r,"emails");}};chunkDPD6ZWL2_js.a(kn,"EmailsTabConfig");var wn=kn,Pn=class Pn extends Ct{constructor(t,r){super(t,r,"meetings");}};chunkDPD6ZWL2_js.a(Pn,"MeetingsTabConfig");var xn=Pn,jn=class jn{constructor(t,r){this.view=t,this.tabData={...r,type:"documents",allowUpload:true,allowRemove:true,hideAttachments:false};}disableUpload(){return this.tabData.allowUpload=false,this}disableRemove(){return this.tabData.allowRemove=false,this}hideAttachments(){return this.tabData.hideAttachments=true,this}from(...t){return this.tabData.relations=[...this.tabData.relations??[],...t],this}tab(t,r){return this.view._addTab(this.tabData),new te(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(jn,"DocumentsTabConfig");var In=jn,Fn=class Fn{constructor(t,r,n){this.view=t,this.base={id:r,name:r,label:n};}icon(t){return this.base.icon=t,this}order(t){return this.base.order=t,this}form(...t){if(t.length===0)throw new Error(`[TabBuilder] form() requires at least one group for tab "${this.base.name}"`);let r={...this.base,type:"form",groups:t.map(n=>n instanceof Dt?n.build():n)};return this.view._addTab(r)}table(t){return new Et(this.view,{...this.base,type:"table",source:{type:"relation",attribute:t},columns:[]})}tableFrom(t,r){return new Et(this.view,{...this.base,type:"table",source:{type:"inverse",object:t,attribute:r},columns:[]})}custom(t){return new hn(this.view,this.base,t)}richtext(t){return new An(this.view,this.base,t)}activity(){return new Tn(this.view,this.base)}documents(){return new In(this.view,this.base)}emails(){return new wn(this.view,this.base)}meetings(){return new xn(this.view,this.base)}forms(t){let r={...this.base,type:"forms",...t};return this.view._addTab(r)}};chunkDPD6ZWL2_js.a(Fn,"TabBuilder");var te=Fn,Vn=class Vn{constructor(t,r){wt(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}sidePanel(t){return this.data.sidePanel=t,this}readOnly(){return this.data.readOnly=true,this}tab(t,r){return new te(this,t,r)}addTab(t){return this.data.tabs.push(t),this}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[DetailViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[DetailViewBuilder] At least one tab is required");ce(this.data.tabs,r=>r.name,r=>new Error(`[DetailViewBuilder] Duplicate tab name "${r}"`));let t={tabs:this.data.tabs,sidePanel:this.data.sidePanel,...this.data.readOnly?{readOnly:true}:{}};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"detail",config:t,default:this.data.default,metadata:this.data.metadata}}};chunkDPD6ZWL2_js.a(Vn,"DetailViewBuilder");var Sn=Vn;function Y(e,t){return new Sn(e,t)}chunkDPD6ZWL2_js.a(Y,"detailView");function Rt(e){if(Array.isArray(e))return e.map(Rt).find(r=>r!==void 0);if(e===null||typeof e!="object")return;let t=e;return t.attribute==="visibility"||t.attribute==="ownedBy"?t.attribute:Rt(t.rules)??Rt(t.groups)}chunkDPD6ZWL2_js.a(Rt,"findProtectedTabFilterAttribute");var Mn=class Mn{constructor(t,r){wt(t),this.data={name:t,label:r,tabs:[]};}description(t){return this.data.description=t,this}icon(t){return this.data.icon=t,this}for(t){return this.data.object=t,this}default(){return this.data.default=true,this}metadata(t){return this.data.metadata=t,this}baseFilter(t){return this.data.defaultFilters=t,this}allowPresentationCustomization(){return this.data.allowPresentationCustomization=true,this}tab(t,r){return new Rn(this,t,r)}_addTab(t){return this.data.tabs.push(t),this}build(){if(!this.data.object)throw new Error("[ListViewBuilder] for() is required - specify the target object");if(this.data.tabs.length===0)throw new Error("[ListViewBuilder] At least one tab is required");if(ce(this.data.tabs,n=>n.id,n=>new Error(`[ListViewBuilder] Duplicate tab id "${n}"`)),this.data.tabs.filter(n=>n.default).length>1)throw new Error("[ListViewBuilder] Only one tab can be marked as default");for(let n of this.data.tabs){if(n.layout==="table"&&n.columns.length===0)throw new chunkJSKLP4GI_js.h(`[ListViewBuilder] Tab "${n.id}" must have at least one column`,[]);if(n.layout==="kanban"&&!n.groupByAttribute)throw new chunkJSKLP4GI_js.h(`[ListViewBuilder] Kanban tab "${n.id}" requires a groupByAttribute`,[]);if(n.descriptionAttribute!==void 0&&n.descriptionAttribute.length===0)throw new chunkJSKLP4GI_js.h(`[ListViewBuilder] Tab "${n.id}" requires a nonempty description attribute name`,[]);if(n.displayAttributes!==void 0){let o=chunkJRBNMHMY_js._.safeParse(n.displayAttributes);if(!o.success)throw new chunkJSKLP4GI_js.h(`[ListViewBuilder] Tab "${n.id}" has invalid display attributes`,o.error.issues.map(a=>({path:["tabs",n.id,"displayAttributes",...a.path.map(String)],message:a.message})))}}let r={allowPresentationCustomization:this.data.allowPresentationCustomization,defaultFilters:this.data.defaultFilters?{id:chunkRTHLB6T6_js.h(),combinator:this.data.defaultFilters.combinator,rules:this.data.defaultFilters.rules}:void 0,tabs:this.data.tabs.map(n=>{let o={id:n.id,label:n.label,icon:n.icon,default:n.default,visibility:n.visibility,columns:n.columns,descriptionAttribute:n.descriptionAttribute,displayAttributes:n.displayAttributes,filters:n.filters?{id:chunkRTHLB6T6_js.h(),combinator:n.filters.combinator,rules:n.filters.rules}:void 0,sorts:n.sorts,readOnly:n.readOnly,createMode:n.createMode,openMode:n.openMode};return n.layout==="kanban"?{...o,layout:"kanban",groupByAttribute:n.groupByAttribute,cardUserAttribute:n.cardUserAttribute,cardDateAttribute:n.cardDateAttribute,kanbanColumnOrder:n.kanbanColumnOrder,kanbanColumnVisibility:n.kanbanColumnVisibility,kanbanPinnedColumns:n.kanbanPinnedColumns}:{...o,layout:n.layout,columnSizing:n.columnSizing}})};return {name:this.data.name,label:this.data.label,description:this.data.description,icon:this.data.icon,object:this.data.object,type:"list",config:r,default:this.data.default,metadata:this.data.metadata}}};chunkDPD6ZWL2_js.a(Mn,"ListViewBuilder");var vn=Mn,Ot=class Ot{constructor(t,r,n){this.view=t,this.tabData={id:r,label:n,visibility:"all",layout:"table",columns:[]};}icon(t){return this.tabData.icon=t,this}default(){return this.tabData.default=true,this}readOnly(){return this.tabData.readOnly=true,this}visibility(t){return this.tabData.visibility=t,this}table(){return this.tabData.layout="table",this}list(){return this.tabData.layout="list",this}descriptionAttribute(t){return this.tabData.descriptionAttribute=t,this}displayAttributes(...t){return this.tabData.displayAttributes=t,this}kanban(t){return this.tabData.layout="kanban",this.tabData.groupByAttribute=t,this}cardUserAttribute(t){return this.tabData.cardUserAttribute=t,this}cardDateAttribute(t){return this.tabData.cardDateAttribute=t,this}kanbanColumnOrder(t){return this.tabData.kanbanColumnOrder=t,this}kanbanColumnVisibility(t){return this.tabData.kanbanColumnVisibility=t,this}kanbanPinnedColumns(t){return this.tabData.kanbanPinnedColumns=t,this}createMode(t){return this.tabData.createMode=t,this}openMode(t){return this.tabData.openMode=t,this}columns(...t){return this.tabData.columns=t,this}columnWidth(t,r){return this.tabData.columnSizing||(this.tabData.columnSizing={}),this.tabData.columnSizing[t]=r,this}filter(t){let r=Rt(t);if(r){let n=`Tab filters cannot target "${r}". Use .visibility("private")`;throw new chunkJSKLP4GI_js.h(n,[{path:["filters"],message:n}])}return this.tabData.filters=t,this}sort(t,r="asc"){return this.tabData.sorts||(this.tabData.sorts=[]),this.tabData.sorts.push({attribute:t,direction:r}),this}sorts(t){return this.tabData.sorts=t,this}tab(t,r){return this.view._addTab(this.tabData),new Ot(this.view,t,r)}done(){return this.view._addTab(this.tabData),this.view}build(){return this.view._addTab(this.tabData),this.view.build()}};chunkDPD6ZWL2_js.a(Ot,"ListViewTabConfigBuilder");var Rn=Ot;function Q(e,t){return new vn(e,t)}chunkDPD6ZWL2_js.a(Q,"listView");function Ew(e,t){return new Dt(e,t)}chunkDPD6ZWL2_js.a(Ew,"group");function Cl(e){if(!/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(e))throw new Error(`Invalid flag name "${e}". Flag names must be kebab-case (e.g., "architect-mode", "ai-features").`)}chunkDPD6ZWL2_js.a(Cl,"validateFlagName");var qn=class qn{constructor(t,r,n){Cl(t),this.flag={name:t,valueType:r,defaultValue:n,allowedLevels:["global","tenant","user"]};}label(t){return this.flag.label=t,this}description(t){return this.flag.description=t,this}category(t){return this.flag.category=t,this}system(){return this.flag.system=true,this}tenantScoped(){return this.flag.allowedLevels=["global","tenant"],this}globalOnly(){return this.flag.allowedLevels=["global"],this}allowedLevels(t){return this.flag.allowedLevels=[...t],this}build(){if(!this.flag.label?.trim())throw new Error(`Flag "${this.flag.name}" must have a label. Use .label("Human-readable label").`);return {...this.flag,allowedLevels:[...this.flag.allowedLevels||[]]}}};chunkDPD6ZWL2_js.a(qn,"BaseFlagBuilder");var ve=qn,zn=class zn extends ve{constructor(t){super(t,"boolean",false);}defaultValue(t){return this.flag.defaultValue=t,this}enabledByDefault(){return this.flag.defaultValue=true,this}};chunkDPD6ZWL2_js.a(zn,"BooleanFlagBuilder");var Ln=zn,Gn=class Gn extends ve{constructor(t){super(t,"string","");}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Gn,"StringFlagBuilder");var Bn=Gn,Wn=class Wn extends ve{constructor(t){super(t,"number",0);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Wn,"NumberFlagBuilder");var $n=Wn,Kn=class Kn extends ve{constructor(t,r){super(t,"json",r);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Kn,"JsonFlagBuilder");var Un=Kn;function Ol(e){return new Ln(e)}chunkDPD6ZWL2_js.a(Ol,"booleanFlag");function _l(e){return new Bn(e)}chunkDPD6ZWL2_js.a(_l,"stringFlag");function Nl(e){return new $n(e)}chunkDPD6ZWL2_js.a(Nl,"numberFlag");function kl(e,t){return new Un(e,t)}chunkDPD6ZWL2_js.a(kl,"jsonFlag");function Hn(e){return new chunkJSKLP4GI_js.r("feature flag",e,`Flag "${e}" is already registered. Each flag name must be unique.`)}chunkDPD6ZWL2_js.a(Hn,"duplicateFlagError");function Yn(e){return {...e,allowedLevels:[...e.allowedLevels]}}chunkDPD6ZWL2_js.a(Yn,"cloneFlagDefinition");var Qn=class Qn{constructor(){this.flags=new Map;}register(t){if(this.flags.has(t.name))throw Hn(t.name);this.flags.set(t.name,Yn(t));}registerAll(t){let r=new Set;for(let n of t){if(this.flags.has(n.name)||r.has(n.name))throw Hn(n.name);r.add(n.name);}for(let n of t)this.register(n);}get(t){let r=this.flags.get(t);return r?Yn(r):void 0}getOrThrow(t){let r=this.get(t);if(!r)throw new chunkJSKLP4GI_js.c("Feature flag",t,void 0,`Flag "${t}" is not registered. Available flags: ${this.listNames().join(", ")}`);return r}has(t){return this.flags.has(t)}list(){return Array.from(this.flags.values(),Yn)}listNames(){return Array.from(this.flags.keys())}unregister(t){return this.flags.delete(t)}clear(){this.flags.clear();}get size(){return this.flags.size}};chunkDPD6ZWL2_js.a(Qn,"FlagRegistry");var ze=Qn,Pl=new ze;function jl(){return new ze}chunkDPD6ZWL2_js.a(jl,"createFlagRegistry");function _t(){return {global:new Map,tenant:new Map,user:new Map}}chunkDPD6ZWL2_js.a(_t,"emptyOverrides");function Fl(e,t){return e.expiresAt===void 0||e.expiresAt.getTime()>t}chunkDPD6ZWL2_js.a(Fl,"isActiveOverride");function Jn(e,t){let r=new Map;for(let n of e){if(!Fl(n,t))continue;let o=n.flagName;r.has(o)||r.set(o,n);}return r}chunkDPD6ZWL2_js.a(Jn,"indexOverrides");var Xn=class Xn{constructor(t){this.repository=t.repository,this.registry=t.registry,this.staticDefaults=new Map(t.staticDefaults?.map(r=>[r.name,r.value])??[]);}async resolveAll(t={}){let r=this.collectFlagNames(),n=this.repository&&r.size>0?await this.getAllOverrides(t,[...r]):_t();return this.resolveNames(r,n,t)}resolveAllStatic(){return this.resolveNames(this.collectFlagNames(),_t(),{})}collectFlagNames(){let t=new Set;for(let r of this.registry.listNames())t.add(r);for(let r of this.staticDefaults.keys())t.add(r);return t}resolveNames(t,r,n){let o=new Map;for(let a of t)o.set(a,this.resolveValue(a,r,n));return o}async resolve(t,r={}){let n=this.repository?await this.getAllOverrides(r,[t]):_t();return this.resolveWithSource(t,n,r)}async isEnabled(t,r={}){return (await this.resolve(t,r)).value===true}async getValue(t,r={}){return (await this.resolve(t,r)).value}async setOverride(t,r,n,o={}){if(!this.repository)throw new chunkJSKLP4GI_js.b("Cannot set override: no FeatureFlagsRepository configured. Add featureFlags to your DatabaseAdapter to enable runtime overrides.",chunkJSKLP4GI_js.a.CONFIGURATION_REQUIRED);let a=this.registry.get(t);if(a&&!a.allowedLevels.includes(r)){let s=`Flag "${t}" does not allow ${r}-level overrides. Allowed levels: ${a.allowedLevels.join(", ")}`;throw new chunkJSKLP4GI_js.h(s,[{path:["level"],message:s}])}if(a?.system){let s=`Flag "${t}" is a system flag and cannot be overridden via API.`;throw new chunkJSKLP4GI_js.h(s,[{path:["flagName"],message:s}])}await this.repository.setOverride({flagName:t,level:r,value:n,targetId:o.targetId,expiresAt:o.expiresAt,createdBy:o.createdBy});}async deleteOverride(t,r,n){if(!this.repository)throw new chunkJSKLP4GI_js.b("Cannot delete override: no FeatureFlagsRepository configured.",chunkJSKLP4GI_js.a.CONFIGURATION_REQUIRED);await this.repository.deleteOverride(t,r,n);}async getAllOverrides(t,r){if(!this.repository)return _t();let[n,o,a]=await Promise.all([this.repository.getOverrides({level:"global",flagNames:r}),t.tenantId?this.repository.getOverrides({level:"tenant",targetId:t.tenantId,flagNames:r}):Promise.resolve([]),t.userId?this.repository.getOverrides({level:"user",targetId:t.userId,flagNames:r}):Promise.resolve([])]),s=Date.now();return {global:Jn(n,s),tenant:Jn(o,s),user:Jn(a,s)}}resolveValue(t,r,n){return this.resolveWithSource(t,r,n).value}resolveWithSource(t,r,n){let o=this.registry.get(t),a=o?.allowedLevels??["global","tenant","user"];if(n.userId&&a.includes("user")){let s=r.user.get(t);if(s)return {name:t,value:s.value,source:"user",sourceId:n.userId}}if(n.tenantId&&a.includes("tenant")){let s=r.tenant.get(t);if(s)return {name:t,value:s.value,source:"tenant",sourceId:n.tenantId}}if(a.includes("global")){let s=r.global.get(t);if(s)return {name:t,value:s.value,source:"global"}}return this.staticDefaults.has(t)?{name:t,value:this.staticDefaults.get(t),source:"default"}:{name:t,value:o?.defaultValue??void 0,source:"default"}}};chunkDPD6ZWL2_js.a(Xn,"FlagService");var Nt=Xn;function Vl(e){return new Nt(e)}chunkDPD6ZWL2_js.a(Vl,"createFlagService");var ia=Symbol("stndrds.native-object");function ei(e){return Object.defineProperty(e,ia,{value:true,enumerable:false}),e}chunkDPD6ZWL2_js.a(ei,"markNativeDefinition");var ri=class ri extends qe{build(){return ei(super.build())}};chunkDPD6ZWL2_js.a(ri,"NativeObjectBuilder");var Zn=ri;function J(e){return new Zn(e)}chunkDPD6ZWL2_js.a(J,"nativeObject");function ti(e){return e[ia]===true}chunkDPD6ZWL2_js.a(ti,"isNativeDefinition");function ni(e){let t=structuredClone(e);return ti(e)?ei(t):t}chunkDPD6ZWL2_js.a(ni,"cloneObjectDefinition");var oi=class oi{constructor(){this.objects=new Map;}register(t){let n=(Array.isArray(t)?t:[t]).map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o=new Set;for(let a of n){if(this.validate(a),o.has(a.name))throw new chunkJSKLP4GI_js.r("object",a.name,`[NativeObjectRegistry] Duplicate object name "${a.name}" within a single register() batch.`);o.add(a.name);}for(let a of n)this.objects.set(a.name,ni(a));return this}validate(t){if(!t.system){let r=`[NativeObjectRegistry] Cannot register object "${t.name}" (id: ${t.id}): missing system flag.
|
|
14
|
+
Native objects must have system=true. Did you call .runtime() on the builder? Remove that call \u2014 objects are system:true by default.`;throw new chunkJSKLP4GI_js.h(r,[])}if(chunkJRBNMHMY_js.w(t.name)&&!ti(t))throw new chunkJSKLP4GI_js.s(t.name,"registry");if(this.objects.has(t.name)){let r=this.objects.get(t.name),n=`[NativeObjectRegistry] Duplicate object name "${t.name}":
|
|
15
15
|
- Existing: "${r?.label}" (id: ${r?.id})
|
|
16
16
|
- New: "${t.label}" (id: ${t.id})
|
|
17
|
-
Please use unique names for each native object.`;throw new
|
|
18
|
-
Available objects: ${this.listNames().join(", ")}`;throw new
|
|
17
|
+
Please use unique names for each native object.`;throw new chunkJSKLP4GI_js.r("object",t.name,n)}}getByName(t){let r=this.objects.get(t);return r?ni(r):void 0}getByNameOrThrow(t){let r=this.getByName(t);if(!r){let n=`[NativeObjectRegistry] Native object "${t}" not found.
|
|
18
|
+
Available objects: ${this.listNames().join(", ")}`;throw new chunkJSKLP4GI_js.c("Native object",t,chunkJSKLP4GI_js.a.OBJECT_NOT_FOUND,n)}return r}getAll(){return Array.from(this.objects.values(),ni)}listNames(){return Array.from(this.objects.keys())}has(t){return this.objects.has(t)}get size(){return this.objects.size}clear(){this.objects.clear();}summary(){let t=this.getAll();return [`[NativeObjectRegistry] ${this.size} native object(s) registered:`,...t.map(r=>` - ${r.name}: "${r.label}" (${r.attributes.length} attributes)`)].join(`
|
|
19
19
|
`)}debug(t){let r=this.summary();return t?.(r),r}};chunkDPD6ZWL2_js.a(oi,"NativeObjectRegistryClass");var ii=oi,rx=new ii;function k(e){return {...e,system:true}}chunkDPD6ZWL2_js.a(k,"markSystemView");var oa=`## Overview
|
|
20
20
|
|
|
21
21
|
Describe in one or two sentences what this skill does and the outcome it produces. The agent reads this page when it uses the skill \u2014 write instructions for the agent, not documentation for people.
|
|
@@ -56,6 +56,6 @@ Show at least one concrete example of the skill applied well.
|
|
|
56
56
|
{{ description }}`).attribute(b({name:"name",label:"Name"}).required()).attribute(b({name:"description",label:"Description"}).multiline()).attribute(H({name:"kind",label:"Kind"}).options([{value:"web",label:"Web",color:"blue"},{value:"presentation",label:"Presentation",color:"purple"},{value:"document",label:"Document",color:"sky"},{value:"spreadsheet",label:"Spreadsheet",color:"green"},{value:"image",label:"Image",color:"pink"},{value:"code",label:"Code",color:"slate"},{value:"other",label:"Other",color:"gray"}]).required()).attribute(H({name:"retention",label:"Retention"}).options([{value:"ephemeral",label:"Ephemeral",color:"gray"},{value:"conversation",label:"Conversation",color:"blue"},{value:"persistent",label:"Persistent",color:"green"}]).defaultValue("conversation").required()).attribute(St({name:"currentRevision",label:"Current revision"}).integer().min(1)).attribute(q({name:"expiresAt",label:"Expires at"}).includeTime().hidden()).attribute(b({name:"sourceSessionId",label:"Source session"}).hidden()).attribute(b({name:"sourceMessageId",label:"Source message"}).hidden()).attribute(b({name:"initialToolCallId",label:"Initial tool call"}).hidden()).attribute(ea({name:"versions",label:"Versions"}).qualifyWith(St({name:"revision",label:"Revision"}).integer().min(1).required(),b({name:"toolCallId",label:"Tool call"}).hidden(),b({name:"sourceFileId",label:"Source file"}).hidden(),b({name:"previewFileId",label:"Preview file"}).hidden(),b({name:"fileIds",label:"File manifest"}).hidden(),b({name:"entrypoint",label:"Entrypoint"}).hidden(),b({name:"sourceMessageId",label:"Source message"}).hidden(),b({name:"artifactName",label:"Artifact name"}).hidden(),b({name:"artifactDescription",label:"Artifact description"}).hidden(),b({name:"artifactKind",label:"Artifact kind"}).hidden(),b({name:"displayMode",label:"Display mode"}).hidden(),b({name:"displayInteraction",label:"Display interaction"}).hidden(),b({name:"displaySize",label:"Display size"}).hidden(),St({name:"displayAspectRatio",label:"Display aspect ratio"}).hidden())).build(),Xl=k(Y("artifact-detail","Artifact").for(Pt).default().readOnly().sidePanel({attributes:["description","kind","retention","currentRevision","createdBy","updatedAt"]}).tab("preview","Preview").custom("ArtifactPreview").done().tab("versions","Versions").documents().disableUpload().disableRemove().hideAttachments().done().tab("activity","Activity").activity().done().build());function Zl(){let e=Q("artifact-list","Artifacts").for(Pt).default().allowPresentationCustomization().tab("mine","My artifacts").default().icon("lock").visibility("private").readOnly().list().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc").tab("workspace","Workspace").icon("list").visibility("workspace").readOnly().list().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc").build();return {...e,config:{...e.config,tabs:e.config.tabs.map(t=>({...t,default:t.default??false}))}}}chunkDPD6ZWL2_js.a(Zl,"buildArtifactListView");var ed=k(Zl());var jt="meeting",h={title:"title",description:"description",location:"location",startsAt:"startsAt",endsAt:"endsAt",isAllDay:"isAllDay",status:"status",organizerAddress:"organizerAddress",organizerName:"organizerName",conferenceProvider:"conferenceProvider",conferenceJoinUrl:"conferenceJoinUrl",htmlLink:"htmlLink",participants:"participants",providerEventId:"providerEventId",icalUid:"icalUid",recurringEventId:"recurringEventId",connectionId:"connectionId",recordingOverride:"recordingOverride",endedAnnouncedAt:"endedAnnouncedAt",summary:"summary",transcript:"transcript",linkedRecords:"linkedRecords"},ua="meeting-list",la="calendar-sync",da="meeting-detail",sa=[h.title,h.startsAt,h.endsAt,h.status],td=J({name:jt,label:"Meeting"}).sealed().hidden().metadata({platformOwned:{editable:[h.linkedRecords],source:la}}).icon("calendar").pluralLabel("Meetings").labelExpression("{{ title }}").embeddingExpression(`{{ title }}
|
|
57
57
|
{{ description }}
|
|
58
58
|
{{ participants }}
|
|
59
|
-
{{ summary }}`).attribute(b({name:h.title,label:"Title"}).required()).attribute(ie({name:h.description,label:"Description"})).attribute(ie({name:h.summary,label:"Summary"}).hidden()).attribute(ie({name:h.transcript,label:"Transcript"}).hidden()).attribute(b({name:h.location,label:"Location"})).attribute(q({name:h.startsAt,label:"Starts at"}).includeTime()).attribute(q({name:h.endsAt,label:"Ends at"}).includeTime()).attribute(Zo({name:h.isAllDay,label:"All day"})).attribute(H({name:h.status,label:"Status"}).options([{value:"confirmed",label:"Confirmed"},{value:"tentative",label:"Tentative"},{value:"cancelled",label:"Cancelled"}])).attribute(b({name:h.organizerAddress,label:"Organizer address"}).email()).attribute(b({name:h.organizerName,label:"Organizer"})).attribute(b({name:h.conferenceProvider,label:"Conference provider"})).attribute(b({name:h.conferenceJoinUrl,label:"Join link"}).url()).attribute(b({name:h.htmlLink,label:"Open in calendar"}).url()).attribute(b({name:h.participants,label:"Participants"}).multiline()).attribute(b({name:h.providerEventId,label:"Provider event id"}).hidden()).attribute(b({name:h.icalUid,label:"iCal UID"}).hidden()).attribute(b({name:h.recurringEventId,label:"Recurring event id"}).hidden()).attribute(b({name:h.connectionId,label:"Connection id"})
|
|
60
|
-
Available views: ${s}`;throw new
|
|
61
|
-
`)}debug(t){let r=this.summary();return t?.(r),r}makeKey(t,r,n){return `${t}:${r}:${n}`}};chunkDPD6ZWL2_js.a(si,"ViewRegistry");var ai=si,id=new ai;function ca(e,t=[]){return e.filter(r=>!(!chunkDBQCXRYQ_js.j(r).lifecycle.visibleInRuntime||r.system||t.includes(r.name)))}chunkDPD6ZWL2_js.a(ca,"getRuntimeAttributes");function pa(e){return [...e].sort((t,r)=>{let n=t.order??999,o=r.order??999;return n!==o?n-o:t.name.localeCompare(r.name)})}chunkDPD6ZWL2_js.a(pa,"sortAttributes");function od(e){if(e.type==="text"&&e.multiline)return 12;switch(e.type){case "richtext":case "location":return 12;case "checkbox":return 4;default:return 6}}chunkDPD6ZWL2_js.a(od,"getDefaultFieldSpan");function ad(e){return {attribute:e.name,span:od(e)}}chunkDPD6ZWL2_js.a(ad,"attributeToField");var Ft="all",We="form",Vt="general";function Ke(e,t={}){let{includeActivityTab:r=true,includeDocumentsTab:n=true,excludeAttributes:o=[]}=t,a=ca(e.attributes,o),s=pa(a.filter(K=>chunkDBQCXRYQ_js.j(K).presentation.formField)),d=[{id:We,name:We,label:"Details",type:"form",groups:[{id:Vt,label:"General",type:"fields",fields:s.map(ad),order:0}],order:0}],f=1,x=e.attributes.some(K=>K.type==="document");n&&x&&d.push({id:"documents",name:"documents",label:"Documents",type:"documents",order:f++,allowUpload:true,allowRemove:true}),r&&d.push({id:"activity",name:"activity",label:"Activity",type:"activity",order:f++});let v={tabs:d};return {name:"default",label:"Default View",object:e.name,type:"detail",config:v,default:true}}chunkDPD6ZWL2_js.a(Ke,"generateDefaultDetailView");function He(e,t={}){let{excludeAttributes:r=[],maxListColumns:n=5}=t,o=ca(e.attributes,r),s=pa(o.filter(d=>chunkDBQCXRYQ_js.j(d).presentation.defaultColumn)).slice(0,n).map(d=>d.name),u={tabs:[{id:Ft,label:"All",default:true,visibility:"workspace",layout:"table",columns:s}]};return {name:"default",label:"All Records",object:e.name,type:"list",config:u,default:true}}chunkDPD6ZWL2_js.a(He,"generateDefaultListView");function sd(e,t){let{preserveCustomTabs:r=true,preserveTableTabs:n=true}=t,o=[];for(let a of e.config.tabs)r&&a.type==="custom"&&o.push(a),n&&a.type==="table"&&o.push(a);return o}chunkDPD6ZWL2_js.a(sd,"getPreservedDetailTabs");function ud(e,t){if(t.length===0)return e;let r=e.find(s=>s.type==="form"),n=e.filter(s=>s.type!=="form"),o=[];r&&o.push(r);let a=1;for(let s of t)o.push({...s,order:a++});for(let s of n)o.push({...s,order:a++});return o}chunkDPD6ZWL2_js.a(ud,"mergeDetailTabs");function ld(e,t,r){let{preserveMetadata:n=true,...o}=r,a=Ke(t,o),s=sd(e,r),u=ud(a.config.tabs,s),d={...a.config,tabs:u},f={...a,config:d};return n&&(f.id=e.id,f.name=e.name,f.label=e.label,f.description=e.description,f.icon=e.icon),f}chunkDPD6ZWL2_js.a(ld,"resetDetailViewToDefault");function dd(e,t,r){let{preserveMetadata:n=true,...o}=r,s={...He(t,o)};return n&&(s.id=e.id,s.name=e.name,s.label=e.label,s.description=e.description,s.icon=e.icon),s}chunkDPD6ZWL2_js.a(dd,"resetListViewToDefault");function cd(e,t,r={}){if(bt(e))return ld(e,t,r);if(ko(e))return dd(e,t,r);throw new Error(`Reset not supported for view type: ${e.type}`)}chunkDPD6ZWL2_js.a(cd,"resetViewToDefault");function Bx(e,t){if(t){let r=e.tabs.find(n=>n.id===t);if(r)return r}return e.tabs.find(r=>r.default)??e.tabs[0]}chunkDPD6ZWL2_js.a(Bx,"getActiveTab");function ui(e){return structuredClone(e)}chunkDPD6ZWL2_js.a(ui,"cloneFormDefinition");var li=class li{constructor(){this.forms=new Map;}register(t){let r=Array.isArray(t)?t:[t];for(let n of r){if(this.forms.has(n.name))throw new chunkL277YJLQ_js.r("form",n.name,`[FormRegistry] Duplicate form: "${n.name}"`);this.forms.set(n.name,ui(n));}return this}get(t){let r=this.forms.get(t);return r?ui(r):void 0}getAll(){return Array.from(this.forms.values(),ui)}listNames(){return Array.from(this.forms.keys())}};chunkDPD6ZWL2_js.a(li,"FormRegistry");var Ye=li;var ma=new Ye;function Jx(e,t){return `${e}:${t}`}chunkDPD6ZWL2_js.a(Jx,"formatAgentStreamFrameId");function Xx(e){let t=e.lastIndexOf(":");if(t<=0)return null;let r=e.slice(0,t),n=Number(e.slice(t+1));return !Number.isInteger(n)||n<=0?null:{streamId:r,sequence:n}}chunkDPD6ZWL2_js.a(Xx,"parseAgentStreamFrameId");var tI=204800,rI=256;function ci(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(ci,"isRecord");function pi(e,t){let r=Object.keys(e);return r.length===t.length&&r.every(n=>t.includes(n))}chunkDPD6ZWL2_js.a(pi,"hasExactKeys");function di(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}chunkDPD6ZWL2_js.a(di,"isPositiveInteger");function fa(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(fa,"isNonNegativeInteger");function pd(e){return ci(e)&&pi(e,["kind","startOffset","endOffset"])?(e.kind==="text"||e.kind==="reasoning")&&fa(e.startOffset)&&fa(e.endOffset)&&e.endOffset>=e.startOffset:false}chunkDPD6ZWL2_js.a(pd,"isContentRange");function md(e){if(!ci(e))return false;let t=e.content===void 0?["sequence","chunk"]:["sequence","content","chunk"];return pi(e,t)&&di(e.sequence)&&e.chunk!==void 0&&(e.content===void 0||pd(e.content))}chunkDPD6ZWL2_js.a(md,"isBatchItem");function fd(e){try{return new TextEncoder().encode(JSON.stringify(e)).byteLength}catch{return}}chunkDPD6ZWL2_js.a(fd,"encodedSize");function nI(e){if(!(ci(e)&&pi(e,["schemaVersion","batchId","tenantId","sessionId","streamId","sequenceStart","sequenceEnd","items"]))||e.schemaVersion!==1||typeof e.batchId!="string"||e.batchId.trim()===""||typeof e.tenantId!="string"||e.tenantId.trim()===""||typeof e.sessionId!="string"||e.sessionId.trim()===""||typeof e.streamId!="string"||e.streamId.trim()===""||!di(e.sequenceStart)||!di(e.sequenceEnd)||!Array.isArray(e.items)||e.items.length===0||e.items.length>256||!e.items.every(md))return false;let t=0;for(let n of e.items){if(n.sequence<=t)return false;t=n.sequence;}if(e.items[0]?.sequence!==e.sequenceStart||e.items.at(-1)?.sequence!==e.sequenceEnd)return false;let r=fd(e);return r!==void 0&&r<=204800}chunkDPD6ZWL2_js.a(nI,"isAgentUIMessageBatch");function ba(e){switch(e.kind){case "workspace":return `workspace:${encodeURIComponent(e.tenantId)}`;case "object":return `object:${encodeURIComponent(e.objectId)}`;case "record":return `record:${encodeURIComponent(e.objectId)}:${encodeURIComponent(e.recordId)}`;case "view":return `view:${encodeURIComponent(e.viewId)}`;case "user":return `user:${encodeURIComponent(e.actorId)}`;case "conversation":return `conversation:${encodeURIComponent(e.sessionId)}`;case "architect-draft":return e.scope==="actor"?`architect-draft:actor:${encodeURIComponent(e.actorId)}`:`architect-draft:session:${encodeURIComponent(e.sessionId)}`}}chunkDPD6ZWL2_js.a(ba,"liveChannelKey");function aI(e){return e.sessionId?ba({kind:"architect-draft",scope:"session",sessionId:e.sessionId}):e.actorId?ba({kind:"architect-draft",scope:"actor",actorId:e.actorId}):null}chunkDPD6ZWL2_js.a(aI,"architectDraftChannelKey");function oe(e){try{return decodeURIComponent(e)}catch{return null}}chunkDPD6ZWL2_js.a(oe,"decodeLiveChannelPart");function ga(e){let t=e.split(":");if(t[0]==="workspace"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"workspace",tenantId:r}:null}if(t[0]==="object"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"object",objectId:r}:null}if(t[0]==="record"&&t.length===3&&t[1]&&t[2]){let r=oe(t[1]),n=oe(t[2]);return r&&n?{kind:"record",objectId:r,recordId:n}:null}if(t[0]==="view"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"view",viewId:r}:null}if(t[0]==="user"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"user",actorId:r}:null}if(t[0]==="architect-draft"&&t.length===3&&t[2]){let r=oe(t[2]);return r?t[1]==="actor"?{kind:"architect-draft",scope:"actor",actorId:r}:t[1]==="session"?{kind:"architect-draft",scope:"session",sessionId:r}:null:null}if(t[0]==="conversation"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"conversation",sessionId:r}:null}return null}chunkDPD6ZWL2_js.a(ga,"parseLiveChannelKey");var bd={"record.patch":true,"record.deleted":true,"record.removed":true,"record.created":true,"view.projection.stale":true,"agent.session.patch":true,"notification.created":true,"notification.recipient.patch":true,"notification.count.patch":true,"notification.inbox.archived":true,"reflex.state.changed":true,"reflex.run.completed":true,"reflex.authoring.progress":true,"architect.draft.updated":true,"meeting.recording.patch":true,"wallet.state":true,"channel.revoked":true},gd=Object.keys(bd),yd=["membership-unknown","sort-unknown","permissions-changed"],hd=["permission-revoked","workspace-left","object-deleted"],Ad=["inboxState","workState","lockedAt","lockedByActorId","readAt","archivedAt","snoozedUntil","completedAt","dismissedAt","updatedAt"],Td=["type","objectId","recordId","recordVersion"],wd=["type","objectId","recordId","recordVersion","record"],xd=["id","objectId","visibility","ownedBy","label","values","metadata","createdAt","updatedAt","createdBy","lastUpdatedBy","schemaVersion"],Id=["type","targetActorId","archivedCount","version","updatedAt"];function Sd(e){return typeof e=="string"&&gd.includes(e)}chunkDPD6ZWL2_js.a(Sd,"isLiveEventType");function dI(e){return _(e)&&Sd(e.type)?vd(e.type,e):false}chunkDPD6ZWL2_js.a(dI,"isLiveEventPayload");function vd(e,t){if(!_(t))return false;switch(e){case "record.patch":return Nd(t);case "record.deleted":return kd(t);case "record.removed":return Pd(t);case "record.created":return Fd(t);case "view.projection.stale":return Vd(t);case "agent.session.patch":return Md(t);case "notification.created":return Ud(t);case "notification.recipient.patch":return qd(t);case "notification.count.patch":return zd(t);case "notification.inbox.archived":return Gd(t);case "reflex.state.changed":return Jd(t);case "reflex.run.completed":return Xd(t);case "reflex.authoring.progress":return Zd(t);case "architect.draft.updated":return Qd(t);case "meeting.recording.patch":return tc(t);case "wallet.state":return ic(t);case "channel.revoked":return oc(t);default:return false}}chunkDPD6ZWL2_js.a(vd,"isLiveEventPayloadForType");function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(_,"isRecord");function M(e){return typeof e=="string"}chunkDPD6ZWL2_js.a(M,"isString");function ya(e){return M(e)&&e.length>0}chunkDPD6ZWL2_js.a(ya,"isNonEmptyString");function Mt(e){return e===null||M(e)}chunkDPD6ZWL2_js.a(Mt,"isNullableString");function Rd(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(Rd,"isVersion");function X(e){if(!M(e))return false;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e}chunkDPD6ZWL2_js.a(X,"isIsoDateString");function Re(e){return e===null||X(e)}chunkDPD6ZWL2_js.a(Re,"isNullableIsoDateString");function S(e,t){return M(e[t])}chunkDPD6ZWL2_js.a(S,"hasString");function ae(e,t){return ya(e[t])}chunkDPD6ZWL2_js.a(ae,"hasNonEmptyString");function N(e,t){return Rd(e[t])}chunkDPD6ZWL2_js.a(N,"hasVersion");function P(e,t){return X(e[t])}chunkDPD6ZWL2_js.a(P,"hasIsoDateString");function I(e,t,r){return !Object.hasOwn(e,t)||r(e[t])}chunkDPD6ZWL2_js.a(I,"hasOptional");function Lt(e,t){return Object.keys(e).every(r=>t.includes(r))}chunkDPD6ZWL2_js.a(Lt,"hasOnlyKeys");function j(e,t){return typeof e=="string"&&t.includes(e)}chunkDPD6ZWL2_js.a(j,"isOneOf");function Dd(e){return j(e,bo)}chunkDPD6ZWL2_js.a(Dd,"isNotificationKind");function Ed(e){return j(e,go)}chunkDPD6ZWL2_js.a(Ed,"isNotificationPriority");function Od(e){return j(e,yo)}chunkDPD6ZWL2_js.a(Od,"isNotificationSensitivity");function ha(e){return j(e,ho)}chunkDPD6ZWL2_js.a(ha,"isNotificationInboxState");function Aa(e){return j(e,Ao)}chunkDPD6ZWL2_js.a(Aa,"isNotificationWorkState");function Cd(e){return _(e)&&S(e,"type")&&S(e,"id")}chunkDPD6ZWL2_js.a(Cd,"isNotificationSubject");function _d(e){return _(e)&&S(e,"fieldKey")&&Object.hasOwn(e,"value")&&N(e,"version")}chunkDPD6ZWL2_js.a(_d,"isRecordFieldPatch");function Nd(e){return e.type==="record.patch"&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")&&I(e,"label",M)&&I(e,"metadata",_)&&I(e,"fieldsWithheld",t=>t===true)&&Array.isArray(e.fieldPatches)&&e.fieldPatches.every(_d)&&S(e,"updatedAt")}chunkDPD6ZWL2_js.a(Nd,"isRecordPatchPayload");function kd(e){return e.type==="record.deleted"&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")&&S(e,"deletedAt")}chunkDPD6ZWL2_js.a(kd,"isRecordDeletedPayload");function Pd(e){return e.type==="record.removed"&&Lt(e,Td)&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")}chunkDPD6ZWL2_js.a(Pd,"isRecordRemovedPayload");function jd(e){return _(e)&&Lt(e,xd)&&S(e,"id")&&S(e,"objectId")&&j(e.visibility,["workspace","private"])&&Mt(e.ownedBy)&&(e.visibility==="workspace"&&e.ownedBy===null||e.visibility==="private"&&ya(e.ownedBy))&&S(e,"label")&&_(e.values)&&I(e,"metadata",_)&&P(e,"createdAt")&&P(e,"updatedAt")&&I(e,"createdBy",M)&&I(e,"lastUpdatedBy",M)&&N(e,"schemaVersion")}chunkDPD6ZWL2_js.a(jd,"isRecordLiveSnapshot");function Fd(e){return e.type==="record.created"&&Lt(e,wd)&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")&&jd(e.record)&&e.record.id===e.recordId&&e.record.objectId===e.objectId}chunkDPD6ZWL2_js.a(Fd,"isRecordCreatedPayload");function Vd(e){return e.type==="view.projection.stale"&&S(e,"viewId")&&j(e.reason,yd)}chunkDPD6ZWL2_js.a(Vd,"isViewProjectionStalePayload");function Md(e){return e.type==="agent.session.patch"&&S(e,"sessionId")&&_(e.patch)&&N(e,"version")&&S(e,"updatedAt")}chunkDPD6ZWL2_js.a(Md,"isAgentSessionPatchPayload");function Ld(e){return _(e)&&S(e,"id")&&S(e,"tenantId")&&I(e,"senderActorId",M)&&I(e,"rootActorId",M)&&I(e,"triggeredByActorId",M)&&Dd(e.kind)&&S(e,"type")&&I(e,"subject",Cd)&&S(e,"title")&&I(e,"summary",M)&&_(e.payload)&&Ed(e.priority)&&Od(e.sensitivity)&&I(e,"threadKey",M)&&I(e,"idempotencyKey",M)&&I(e,"expiresAt",X)&&P(e,"createdAt")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Ld,"isLiveNotification");function Bd(e){return _(e)&&S(e,"id")&&S(e,"tenantId")&&S(e,"notificationId")&&S(e,"recipientActorId")&&ha(e.inboxState)&&Aa(e.workState)&&I(e,"lockedAt",X)&&I(e,"lockedByActorId",M)&&I(e,"readAt",X)&&I(e,"archivedAt",X)&&I(e,"snoozedUntil",X)&&I(e,"completedAt",X)&&I(e,"dismissedAt",X)&&P(e,"createdAt")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Bd,"isLiveNotificationRecipient");function $d(e){return _(e)?Object.keys(e).every(t=>Ad.includes(t))&&I(e,"inboxState",ha)&&I(e,"workState",Aa)&&I(e,"lockedAt",Re)&&I(e,"lockedByActorId",Mt)&&I(e,"readAt",Re)&&I(e,"archivedAt",Re)&&I(e,"snoozedUntil",Re)&&I(e,"completedAt",Re)&&I(e,"dismissedAt",Re)&&I(e,"updatedAt",X):false}chunkDPD6ZWL2_js.a($d,"isNotificationRecipientPatch");function Ud(e){let t=Ld(e.notification)?e.notification:null;return e.type==="notification.created"&&t!==null&&Array.isArray(e.recipients)&&e.recipients.length>0&&e.recipients.every(r=>Bd(r)&&r.notificationId===t.id)&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Ud,"isNotificationCreatedPayload");function qd(e){return e.type==="notification.recipient.patch"&&S(e,"recipientId")&&S(e,"recipientActorId")&&$d(e.patch)&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(qd,"isNotificationRecipientPatchPayload");function zd(e){return e.type==="notification.count.patch"&&S(e,"targetActorId")&&N(e,"unread")&&N(e,"pendingWork")&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(zd,"isNotificationCountPatchPayload");function Gd(e){return e.type==="notification.inbox.archived"&&Lt(e,Id)&&ae(e,"targetActorId")&&N(e,"archivedCount")&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Gd,"isNotificationInboxArchivedPayload");var Wd=["armed","disarmed"],Kd=["authoring","compiling","replaying","promoted","failed"],Hd=["promoted","lkg"],Yd=["composing","published","discarded"];function Qd(e){if(e.type!=="architect.draft.updated"||!_(e.draft))return false;let t=e.draft;return ae(t,"id")&&ae(t,"actorId")&&Mt(t.agentSessionId)&&Array.isArray(t.operations)&&t.operations.every(_)&&_(t.baselines)&&j(t.status,Yd)}chunkDPD6ZWL2_js.a(Qd,"isArchitectDraftUpdatedPayload");function Jd(e){return e.type==="reflex.state.changed"&&ae(e,"reflexId")&&j(e.state,Wd)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Jd,"isReflexStateChangedPayload");function Xd(e){return e.type==="reflex.run.completed"&&ae(e,"reflexId")&&ae(e,"runId")&&j(e.served,Hd)&&N(e,"version")&&N(e,"wallMs")&&P(e,"completedAt")}chunkDPD6ZWL2_js.a(Xd,"isReflexRunCompletedPayload");function Zd(e){return e.type==="reflex.authoring.progress"&&ae(e,"reflexId")&&j(e.status,Kd)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Zd,"isReflexAuthoringProgressPayload");var ec=["none","scheduled","recording","completed","failed"];function tc(e){return e.type==="meeting.recording.patch"&&ae(e,"meetingId")&&j(e.status,ec)&&Mt(e.failureReason)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(tc,"isMeetingRecordingPatchPayload");var rc=["ok","low","exhausted","paused"],nc=["metering-only","contract","wallet"];function ic(e){return e.type==="wallet.state"&&j(e.status,rc)&&j(e.mode,nc)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(ic,"isWalletStatePayload");function oc(e){return e.type==="channel.revoked"&&S(e,"channel")&&j(e.reason,hd)}chunkDPD6ZWL2_js.a(oc,"isChannelRevokedPayload");function mi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(mi,"isRecord");function ac(e){let{channel:t}=e;return typeof t=="string"&&ga(t)?t:null}chunkDPD6ZWL2_js.a(ac,"payloadChannel");function fI(e){return mi(e)?ac(e):null}chunkDPD6ZWL2_js.a(fI,"getLiveProtocolPayloadChannel");function bI(e){return mi(e)?typeof e.id=="string"&&e.id.length>0&&typeof e.channel=="string"&&typeof e.type=="string"&&typeof e.tenantId=="string"&&e.tenantId.length>0&&typeof e.occurredAt=="string"&&mi(e.payload):false}chunkDPD6ZWL2_js.a(bI,"isLiveEventEnvelope");var hI=["if","concat","sum","avg","count","min","max","earliest","latest","unique","first","percent_empty","percent_not_empty","count_empty","count_not_empty","count_unique"],Qe={if:{name:"if",returnType:"branch",minArgs:3,maxArgs:3},concat:{name:"concat",returnType:{kind:"scalar",type:"text"},minArgs:1},sum:{name:"sum",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},avg:{name:"avg",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count:{name:"count",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},min:{name:"min",returnType:"source_item",minArgs:1,maxArgs:1},max:{name:"max",returnType:"source_item",minArgs:1,maxArgs:1},earliest:{name:"earliest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},latest:{name:"latest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},unique:{name:"unique",returnType:"argument",minArgs:1,maxArgs:1},first:{name:"first",returnType:"source_item",minArgs:1,maxArgs:1},percent_empty:{name:"percent_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},percent_not_empty:{name:"percent_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_empty:{name:"count_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_not_empty:{name:"count_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_unique:{name:"count_unique",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1}};function Bt(e){return Object.hasOwn(Qe,e)}chunkDPD6ZWL2_js.a(Bt,"isComputedFunctionName");var yi=class yi extends Error{constructor(t){super(t),this.name="ComputedFormulaCompileError";}};chunkDPD6ZWL2_js.a(yi,"ComputedFormulaCompileError");var g=yi;function Ut(e){let t=sc(e.expression),r=$t(t,e.schema),n=Oc(r.valueType);if(n!==e.returnType)throw new g(`Computed formula "${e.attributeName}" returns "${n}", expected "${e.returnType}"`);if(Ra(e.returnType)&&r.optionsSource===void 0)throw new g(`Computed formula "${e.attributeName}" returns "${e.returnType}" without optionsSource`);let o=r.optionsSource===void 0?[]:[{kind:"options",source:r.optionsSource}],a=gi([...r.dependencies,...o]);return {kind:"formula",attributeName:e.attributeName,expression:e.expression,returnType:e.returnType,valueType:r.valueType,dependencies:a,ast:t,...r.optionsSource?{optionsSource:r.optionsSource}:{},...r.targetAttributeType?{targetAttributeType:r.targetAttributeType}:{},dependenciesHash:Cc({expression:e.expression,returnType:e.returnType,dependencies:a})}}chunkDPD6ZWL2_js.a(Ut,"compileComputedFormula");function va(e){let t=new Map(e.map(o=>[o.attributeName,o])),r=new Set,n=chunkDPD6ZWL2_js.a((o,a)=>{let s=a.indexOf(o);if(s!==-1){let f=[...a.slice(s),o];throw new g(`Computed field cycle detected: ${f.join(" -> ")}`)}if(r.has(o))return;let u=t.get(o);if(u===void 0)return;let d=[...a,o];for(let f of u.dependencies)f.kind==="computed"&&n(f.attributeName,d);r.add(o);},"visit");for(let o of e)n(o.attributeName,[]);}chunkDPD6ZWL2_js.a(va,"assertAcyclicComputedDependencies");function sc(e){try{return chunkIJPA4GYV_js.e(e)}catch(t){throw t instanceof Error?new g(t.message):t}}chunkDPD6ZWL2_js.a(sc,"parseCompileFormula");function $t(e,t){switch(e.kind){case "literal":return {valueType:uc(e.value),dependencies:[],...typeof e.value=="string"?{literalString:e.value}:{}};case "path":return lc(e.parts,t);case "call":return bc(e.functionName,e.args,t);case "binary":return Tc(e.operator,$t(e.left,t),$t(e.right,t));default:return e}}chunkDPD6ZWL2_js.a($t,"inferNode");function uc(e){switch(typeof e){case "string":return {kind:"scalar",type:"text"};case "number":return {kind:"scalar",type:"number"};case "boolean":return {kind:"scalar",type:"boolean"};case "object":return {kind:"scalar",type:"text"};default:return e}}chunkDPD6ZWL2_js.a(uc,"literalToValueType");function lc(e,t){if(e.length===1){let r=e[0],n=fi(t,r);if(n===void 0)throw new g(`Unknown attribute "${r}" on object "${t.objectName}"`);return n.type==="relation"?{valueType:pc(),dependencies:[{kind:"relation",relationName:n.name,cardinality:Ta(n)}],targetAttributeType:n.type}:{valueType:wa(n),dependencies:[cc(n)],optionsSource:xa(t.objectName,n),targetAttributeType:n.type}}if(e.length===2){let[r,n]=e,o=fi(t,r);if(o===void 0)throw new g(`Unknown attribute "${r}" on object "${t.objectName}"`);if(o.type!=="relation")throw new g(`Attribute "${r}" on object "${t.objectName}" is not a relation`);let a=dc(o);if(a===void 0)throw new g(`Relation "${r}" on object "${t.objectName}" is missing targetObjectName`);let s=t.relatedObjects?.[a];if(s===void 0)throw new g(`Unknown related object "${a}"`);let u=fi(s,n);if(u===void 0)throw new g(`Unknown attribute "${n}" on object "${s.objectName}"`);let d=wa(u);return {valueType:o.cardinality==="many"?fc(d):d,dependencies:[{kind:"relation",relationName:r,targetAttributeName:n,cardinality:Ta(o)}],optionsSource:xa(s.objectName,u),targetAttributeType:u.type}}throw new g("Computed paths support at most one relation hop")}chunkDPD6ZWL2_js.a(lc,"inferPath");function fi(e,t){return e.attributes.find(r=>r.name===t)}chunkDPD6ZWL2_js.a(fi,"findAttribute");function dc(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}chunkDPD6ZWL2_js.a(dc,"getRelationTargetObjectName");function Ta(e){return e.cardinality??"one"}chunkDPD6ZWL2_js.a(Ta,"relationCardinality");function cc(e){return e.type==="formula"||e.type==="rollup"?{kind:"computed",attributeName:e.name}:{kind:"local",attributeName:e.name}}chunkDPD6ZWL2_js.a(cc,"localDependencyFor");function wa(e){if(e.type==="formula"||e.type==="rollup"){if(e.returnType===void 0)throw new g(`Computed attribute "${e.name}" is missing returnType`);return mc(e.returnType)}switch(e.type){case "number":case "currency":return {kind:"scalar",type:"number"};case "checkbox":return {kind:"scalar",type:"boolean"};case "date":return {kind:"scalar",type:"date"};case "select":case "status":return {kind:"scalar",type:"select"};case "multiselect":return {kind:"collection",itemType:"select"};case "text":case "richtext":case "phone":case "user":case "location":case "relation":case "document":return {kind:"scalar",type:"text"};default:return e.type}}chunkDPD6ZWL2_js.a(wa,"attributeToValueType");function pc(){return {kind:"collection",itemType:"text"}}chunkDPD6ZWL2_js.a(pc,"relationToValueType");function mc(e){return e==="multiselect"?{kind:"collection",itemType:"select"}:{kind:"scalar",type:e}}chunkDPD6ZWL2_js.a(mc,"returnTypeToValueType");function fc(e){return e.kind==="collection"?e:{kind:"collection",itemType:e.type}}chunkDPD6ZWL2_js.a(fc,"asCollectionValueType");function xa(e,t){if(t.type==="formula"||t.type==="rollup")return Ra(t.returnType)?t.optionsSource:void 0;if(!(t.type!=="select"&&t.type!=="status"&&t.type!=="multiselect"))return t.optionsSource??{objectName:e,attributeName:t.name,...t.id?{attributeId:t.id}:{}}}chunkDPD6ZWL2_js.a(xa,"optionsSourceForAttribute");function bc(e,t,r){if(!Bt(e))throw new g(`Unknown computed function "${e}"`);let n=Qe[e];if(t.length<n.minArgs||n.maxArgs!==void 0&&t.length>n.maxArgs){let a=n.maxArgs===void 0||n.maxArgs===n.minArgs?String(n.minArgs):`${n.minArgs}-${n.maxArgs}`;throw new g(`Function "${e}" expects ${a} arguments, received ${t.length}`)}let o=t.map(a=>$t(a,r));return gc(e,o)}chunkDPD6ZWL2_js.a(bc,"inferCall");function gc(e,t){let r=gi(t.flatMap(n=>n.dependencies));switch(e){case "if":return yc(t,r);case "concat":return wc(t,`Function "${e}" does not accept collection values`),{valueType:{kind:"scalar",type:"text"},dependencies:r};case "sum":case "avg":return Ia(e,t[0],"number"),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "count":case "count_empty":case "count_not_empty":case "count_unique":case "percent_empty":case "percent_not_empty":return Ic(e,t[0]),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "min":case "max":return xc(e,t[0]),{valueType:Sc(t[0]),dependencies:r,optionsSource:t[0].optionsSource,targetAttributeType:t[0].targetAttributeType};case "earliest":case "latest":return Ia(e,t[0],"date"),{valueType:{kind:"scalar",type:"date"},dependencies:r,targetAttributeType:t[0].targetAttributeType};case "unique":return hc(t[0],r);case "first":return Ac(t[0],r);default:return e}}chunkDPD6ZWL2_js.a(gc,"inferFunctionReturn");function yc(e,t){bi(e[0].valueType,"boolean",'Function "if" condition must be boolean');let r=e[1],n=e[2],o=Rc(r,n),a=Dc(r,n);if(o===void 0)throw new g('Function "if" branches must return the same type');return {valueType:o,dependencies:t,...a?{optionsSource:a}:{},targetAttributeType:r.targetAttributeType??n.targetAttributeType}}chunkDPD6ZWL2_js.a(yc,"inferIfFunction");function hc(e,t){if(e.valueType.kind!=="collection"||e.valueType.itemType!=="select")throw new g('Function "unique" expects a select collection');return {valueType:{kind:"collection",itemType:"select"},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(hc,"inferUniqueFunction");function Ac(e,t){if(e.valueType.kind!=="collection")throw new g('Function "first" expects a collection');return {valueType:{kind:"scalar",type:e.valueType.itemType},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(Ac,"inferFirstFunction");function Tc(e,t,r){let n=gi([...t.dependencies,...r.dependencies]),o=e==="+"||e==="-"||e==="*"||e==="/";if(t.valueType.kind==="collection"||r.valueType.kind==="collection")throw new g(`Cannot use collection values with ${o?"arithmetic":"comparison"} operator "${e}"`);if(o)return e==="+"&&(t.valueType.type==="text"||r.valueType.type==="text")?{valueType:{kind:"scalar",type:"text"},dependencies:n}:(bi(t.valueType,"number",`Operator "${e}" expects number operands`),bi(r.valueType,"number",`Operator "${e}" expects number operands`),{valueType:{kind:"scalar",type:"number"},dependencies:n});if(e==="=="||e==="!="){if(t.valueType.type!==r.valueType.type)throw new g(`Operator "${e}" expects operands with the same scalar type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}if((t.valueType.type!=="number"||r.valueType.type!=="number")&&(t.valueType.type!=="date"||r.valueType.type!=="date"))throw new g(`Operator "${e}" expects number or date operands of the same type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}chunkDPD6ZWL2_js.a(Tc,"inferBinary");function wc(e,t){for(let r of e)if(r.valueType.kind==="collection")throw new g(t)}chunkDPD6ZWL2_js.a(wc,"ensureNoCollections");function Ia(e,t,r){if((t.valueType.kind==="collection"?t.valueType.itemType:t.valueType.type)!==r)throw new g(`Function "${e}" expects ${r} values`)}chunkDPD6ZWL2_js.a(Ia,"ensureCollectionOrScalarType");function xc(e,t){if(t.valueType.kind!=="collection")throw new g(`Function "${e}" expects a collection`);let r=t.valueType.itemType;if(r!=="number"&&r!=="date")throw new g(`Function "${e}" expects number or date values`)}chunkDPD6ZWL2_js.a(xc,"ensureMinMaxSource");function Ic(e,t){if(t.valueType.kind!=="collection")throw new g(`Function "${e}" expects a collection`)}chunkDPD6ZWL2_js.a(Ic,"ensureCollectionSource");function bi(e,t,r){if(e.kind!=="scalar"||e.type!==t)throw new g(r)}chunkDPD6ZWL2_js.a(bi,"ensureScalarType");function Sc(e){return e.valueType.kind==="scalar"?e.valueType:{kind:"scalar",type:e.valueType.itemType}}chunkDPD6ZWL2_js.a(Sc,"sourceItemValueType");function vc(e,t){return e.kind==="scalar"?t.kind==="scalar"&&e.type===t.type:t.kind==="collection"&&e.itemType===t.itemType}chunkDPD6ZWL2_js.a(vc,"sameValueType");function Rc(e,t){if(vc(e.valueType,t.valueType)||Sa(e,t))return e.valueType;if(Sa(t,e))return t.valueType}chunkDPD6ZWL2_js.a(Rc,"resolveIfBranchValueType");function Sa(e,t){return e.valueType.kind==="scalar"&&e.valueType.type==="select"&&t.valueType.kind==="scalar"&&t.valueType.type==="text"&&t.literalString!==void 0}chunkDPD6ZWL2_js.a(Sa,"isSelectScalarWithStringLiteral");function Dc(e,t){let r=e.optionsSource,n=t.optionsSource;if(r!==void 0&&n!==void 0&&!Ec(r,n))throw new g('Function "if" branches use incompatible options sources');return r??n}chunkDPD6ZWL2_js.a(Dc,"resolveIfOptionsSource");function Ec(e,t){return e.objectName===t.objectName&&e.attributeName===t.attributeName&&e.attributeId===t.attributeId}chunkDPD6ZWL2_js.a(Ec,"sameOptionsSource");function Ra(e){return e==="select"||e==="multiselect"}chunkDPD6ZWL2_js.a(Ra,"isSelectLikeReturnType");function Oc(e){if(e.kind==="scalar")return e.type;if(e.itemType==="select")return "multiselect";throw new g(`Collection item type "${e.itemType}" cannot be used as a computed return type`)}chunkDPD6ZWL2_js.a(Oc,"valueTypeToReturnType");function gi(e){let t=new Set,r=[];for(let n of e){let o=JSON.stringify(Je(n));t.has(o)||(t.add(o),r.push(n));}return r}chunkDPD6ZWL2_js.a(gi,"uniqueDependencies");function Cc(e){let t=e.dependencies.map(r=>Je(r)).sort((r,n)=>Da(JSON.stringify(r),JSON.stringify(n)));return JSON.stringify(Je({expression:e.expression,returnType:e.returnType,dependencies:t}))}chunkDPD6ZWL2_js.a(Cc,"createDependenciesHash");function Je(e){return Array.isArray(e)?e.map(t=>Je(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>Da(t,r)).map(([t,r])=>[t,Je(r)])):e}chunkDPD6ZWL2_js.a(Je,"stableNormalize");function Da(e,t){return e<t?-1:e>t?1:0}chunkDPD6ZWL2_js.a(Da,"compareStrings");function _c(e){return e.function==="count"?`count(${e.relationAttribute})`:`${Pc(e.function)}(${e.relationAttribute}.${e.targetAttribute})`}chunkDPD6ZWL2_js.a(_c,"rollupToFormulaExpression");function Nc(e,t){if(e.function==="count")return "number";let r=jc(e,t);switch(e.function){case "countValues":case "countEmpty":case "percentEmpty":case "percentNotEmpty":case "countUniqueValues":return "number";case "sum":case "avg":return "number";case "earliest":case "latest":return "date";case "original":if(!Vc(r.type))throw new g('Rollup "original" requires a select, status, or multiselect target');return "multiselect";default:return e.function}}chunkDPD6ZWL2_js.a(Nc,"inferRollupReturnType");function Oa(e,t){let r=_c(e),n=Nc(e,t);return {...Ut({attributeName:e.name,expression:r,returnType:n,schema:kc(e,t)}),kind:"rollup"}}chunkDPD6ZWL2_js.a(Oa,"compileRollupAttribute");function kc(e,t){return {...t,attributes:t.attributes.map(r=>r.name===e.relationAttribute&&r.type==="relation"?{...r,cardinality:"many"}:r)}}chunkDPD6ZWL2_js.a(kc,"schemaWithRollupRelationAsMany");function Pc(e){switch(e){case "sum":case "avg":case "earliest":case "latest":return e;case "original":return "unique";case "countValues":return "count_not_empty";case "countEmpty":return "count_empty";case "percentEmpty":return "percent_empty";case "percentNotEmpty":return "percent_not_empty";case "countUniqueValues":return "count_unique";default:return e}}chunkDPD6ZWL2_js.a(Pc,"rollupFunctionToFormulaFunction");function jc(e,t){let r=Ea(t,e.relationAttribute);if(r===void 0)throw new g(`Unknown relation attribute "${e.relationAttribute}" on object "${t.objectName}"`);if(r.type!=="relation")throw new g(`Attribute "${e.relationAttribute}" on object "${t.objectName}" is not a relation`);let n=Fc(r);if(n===void 0)throw new g(`Relation "${e.relationAttribute}" on object "${t.objectName}" is missing targetObjectName`);let o=t.relatedObjects?.[n];if(o===void 0)throw new g(`Unknown related object "${n}"`);let a=Ea(o,e.targetAttribute);if(a===void 0)throw new g(`Unknown attribute "${e.targetAttribute}" on object "${o.objectName}"`);return a}chunkDPD6ZWL2_js.a(jc,"findRollupTargetAttribute");function Ea(e,t){return e.attributes.find(r=>r.name===t)}chunkDPD6ZWL2_js.a(Ea,"findAttribute");function Fc(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}chunkDPD6ZWL2_js.a(Fc,"getRelationTargetObjectName");function Vc(e){return e==="select"||e==="status"||e==="multiselect"}chunkDPD6ZWL2_js.a(Vc,"isSelectLikeAttributeType");function re(e,t){switch(e.kind){case "literal":return e.value;case "path":return Lc(t,e.parts);case "binary":return Bc(e.operator,re(e.left,t),re(e.right,t));case "call":return Mc(e.functionName,e.args,t);default:return e}}chunkDPD6ZWL2_js.a(re,"evaluateAst");function Mc(e,t,r){if(Uc(e),qc(e,t.length),e==="if"){let n=re(t[0],r);return n===null?null:re(n?t[1]:t[2],r)}return zc(e,t.map(n=>re(n,r)))}chunkDPD6ZWL2_js.a(Mc,"evaluateCallNode");function Lc(e,t){return t.reduce((r,n)=>ja(r,n),e)}chunkDPD6ZWL2_js.a(Lc,"resolvePath");function ja(e,t){if(Array.isArray(e))return e.map(n=>ja(n,t));if(!Pa(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let r=e.values;return Pa(r)&&Object.hasOwn(r,t)?r[t]??null:null}chunkDPD6ZWL2_js.a(ja,"resolvePathPart");function Bc(e,t,r){switch(e){case "+":return $c(t,r);case "-":return zt(t,r,(n,o)=>n-o);case "*":return zt(t,r,(n,o)=>n*o);case "/":return zt(t,r,(n,o)=>n/o);case ">":return qt(t,r,n=>n>0);case "<":return qt(t,r,n=>n<0);case ">=":return qt(t,r,n=>n>=0);case "<=":return qt(t,r,n=>n<=0);case "==":return Ca(t,r);case "!=":{let n=Ca(t,r);return n===null?null:!n}default:return e}}chunkDPD6ZWL2_js.a(Bc,"evaluateBinary");function $c(e,t){return typeof e=="string"||typeof t=="string"?`${e??""}${t??""}`:zt(e,t,(r,n)=>r+n)}chunkDPD6ZWL2_js.a($c,"add");function qt(e,t,r){let n=Fa(e,t);return n===null?null:r(n)}chunkDPD6ZWL2_js.a(qt,"compareWith");function Fa(e,t){if(!De([e,t]))return null;let r=Ee(e),n=Ee(t);if(r!==null&&n!==null)return r-n;let o=Ti(e),a=Ti(t);return o&&a?o.getTime()-a.getTime():null}chunkDPD6ZWL2_js.a(Fa,"compare");function Ca(e,t){return e===t?true:e==null||t===null||t===void 0?false:De([e,t])?Fa(e,t)===0:null}chunkDPD6ZWL2_js.a(Ca,"equalScalar");function Uc(e){if(!Bt(e))throw new Error(`Unknown computed function "${e}"`)}chunkDPD6ZWL2_js.a(Uc,"assertComputedFunctionName");function qc(e,t){let{minArgs:r,maxArgs:n}=Qe[e];if(t>=r&&t<=(n??Number.POSITIVE_INFINITY))return;let o=n===void 0?`at least ${r}`:`between ${r} and ${n}`;throw new Error(`Function "${e}" expects ${o} arguments, received ${t}`)}chunkDPD6ZWL2_js.a(qc,"validateArity");function zc(e,t){switch(e){case "concat":return t.filter(r=>r!=null).map(String).join("");case "sum":return De(t)?hi(t).reduce((r,n)=>r+n,0):null;case "avg":{if(!De(t))return null;let r=hi(t);return r.length>0?r.reduce((n,o)=>n+o,0)/r.length:null}case "count":return me(t[0]).length;case "min":return _a(t,"min");case "max":return _a(t,"max");case "earliest":return Ai(t,"min");case "latest":return Ai(t,"max");case "unique":return ka(me(t[0]));case "first":return me(t[0]).find(r=>r!=null)??null;case "percent_empty":return Na(t[0],true);case "percent_not_empty":return Na(t[0],false);case "count_empty":return me(t[0]).filter(chunkTQLF3EZP_js.a).length;case "count_not_empty":return me(t[0]).filter(r=>!chunkTQLF3EZP_js.a(r)).length;case "count_unique":return ka(me(t[0])).length;default:return e}}chunkDPD6ZWL2_js.a(zc,"evaluateCall");function hi(e){return Gt(e).map(Ee).filter(t=>t!==null)}chunkDPD6ZWL2_js.a(hi,"numericValues");function De(e){let t=new Set;for(let r of Gt(e))wi(r)&&t.add(Va(r));return t.size<=1}chunkDPD6ZWL2_js.a(De,"areCommensurable");function Va(e){return e.code.toUpperCase()}chunkDPD6ZWL2_js.a(Va,"currencyCode");function zt(e,t,r){if(!De([e,t]))return null;let n=Ee(e),o=Ee(t);if(n===null||o===null)return null;let a=r(n,o);return Number.isFinite(a)?a:null}chunkDPD6ZWL2_js.a(zt,"numericBinary");function _a(e,t){if(!De(e))return null;let r=hi(e);return r.length>0?t==="min"?Math.min(...r):Math.max(...r):Ai(e,t)}chunkDPD6ZWL2_js.a(_a,"minMax");function Ai(e,t){let r=Gt(e).map(Ti).filter(a=>a!==null);if(r.length===0)return null;let n=r.map(a=>a.getTime()),o=t==="min"?Math.min(...n):Math.max(...n);return new Date(o).toISOString()}chunkDPD6ZWL2_js.a(Ai,"dateMinMax");function Na(e,t){let r=me(e);return r.length===0?0:r.filter(o=>chunkTQLF3EZP_js.a(o)===t).length/r.length}chunkDPD6ZWL2_js.a(Na,"percentByEmptyState");function ka(e){let t=new Set,r=[];for(let n of e){if(chunkTQLF3EZP_js.a(n))continue;let o=Gc(n);t.has(o)||(t.add(o),r.push(n));}return r}chunkDPD6ZWL2_js.a(ka,"uniqueNonEmpty");function me(e){return e==null?[]:Array.isArray(e)?Gt(e):[e]}chunkDPD6ZWL2_js.a(me,"collectionItems");function Gt(e){return e.flat(Number.POSITIVE_INFINITY)}chunkDPD6ZWL2_js.a(Gt,"flatten");function Ee(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return wi(e)&&Number.isFinite(e.value)?e.value:null}chunkDPD6ZWL2_js.a(Ee,"toFiniteNumber");function wi(e){return typeof e=="object"&&e!==null&&typeof e.value=="number"&&typeof e.code=="string"}chunkDPD6ZWL2_js.a(wi,"isCurrencyValue");function Ti(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!="string"){let r=Te(e);if(r===null)return null;let n=new Date(r);return Number.isNaN(n.getTime())?null:n}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}chunkDPD6ZWL2_js.a(Ti,"toDate");function Gc(e){if(wi(e))return `currency:${Va(e)}:${e.value}`;let t=Ee(e);return t!==null?`number:${t}`:e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`}chunkDPD6ZWL2_js.a(Gc,"uniqueKey");function Pa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(Pa,"isPlainRecord");function Wc(e,t,r){if(e==null)return null;let n=chunkDPD6ZWL2_js.a(o=>typeof o=="string"||typeof o=="number"||typeof o=="boolean"||o instanceof Date?String(o):null,"stringifyScalar");switch(t){case "number":{let o=typeof e=="number"?e:Number(e);return Number.isNaN(o)?null:r!==void 0?Number(o.toFixed(r)):o}case "boolean":return !!e;case "date":return e instanceof Date?e.toISOString():typeof e=="string"?e:null;case "text":return String(e);case "select":if(Array.isArray(e)){for(let o of e){if(o==null)continue;let a=n(o);if(a!==null)return a}return null}return n(e);case "multiselect":return Array.isArray(e)?e.flatMap(o=>{if(o==null)return [];let a=n(o);return a===null?[]:[a]}):n(e)===null?[]:[String(e)];default:{let o=t;throw new Error(`Unsupported computed return type: ${o}`)}}}chunkDPD6ZWL2_js.a(Wc,"formatComputedResult");function NI(e,t){return re(e,t)}chunkDPD6ZWL2_js.a(NI,"evaluateComputedAst");function kI(e,t){return re(chunkIJPA4GYV_js.e(e),t)}chunkDPD6ZWL2_js.a(kI,"evaluateComputedFormula");function PI(e,t,r,n){try{let o=re(chunkIJPA4GYV_js.e(e),t);return {value:r?Wc(o,r,n):o}}catch(o){return {value:null,error:o instanceof Error?o.message:String(o)}}}chunkDPD6ZWL2_js.a(PI,"evaluateComputedFormulaWithResult");var VI=[{name:"if",signature:"if(condition, then, else)",description:"Conditional value",category:"logic",example:"if(amount > 100, 'big', 'small')"},{name:"concat",signature:"concat(a, b, ...)",description:"Join values into text",category:"text",example:"concat(firstName, ' ', lastName)"},{name:"sum",signature:"sum(collection)",description:"Total of values",category:"number",example:"sum(orders.amount)"},{name:"avg",signature:"avg(collection)",description:"Average of values",category:"number",example:"avg(orders.amount)"},{name:"min",signature:"min(collection)",description:"Smallest value",category:"number",example:"min(orders.amount)"},{name:"max",signature:"max(collection)",description:"Largest value",category:"number",example:"max(orders.amount)"},{name:"count",signature:"count(collection)",description:"Number of items",category:"collection",example:"count(orders)"},{name:"count_empty",signature:"count_empty(collection)",description:"Items with no value",category:"collection",example:"count_empty(orders.note)"},{name:"count_not_empty",signature:"count_not_empty(collection)",description:"Items with a value",category:"collection",example:"count_not_empty(orders.note)"},{name:"count_unique",signature:"count_unique(collection)",description:"Distinct values",category:"collection",example:"count_unique(orders.status)"},{name:"percent_empty",signature:"percent_empty(collection)",description:"Fraction with no value",category:"collection",example:"percent_empty(orders.note)"},{name:"percent_not_empty",signature:"percent_not_empty(collection)",description:"Fraction with a value",category:"collection",example:"percent_not_empty(orders.note)"},{name:"unique",signature:"unique(collection)",description:"Distinct values as a list",category:"collection",example:"unique(orders.status)"},{name:"first",signature:"first(collection)",description:"First non-empty value",category:"collection",example:"first(orders.status)"},{name:"earliest",signature:"earliest(collection)",description:"Earliest date",category:"date",example:"earliest(orders.closeDate)"},{name:"latest",signature:"latest(collection)",description:"Latest date",category:"date",example:"latest(orders.closeDate)"}];var Ma=chunkDPD6ZWL2_js.a(e=>chunkTQLF3EZP_js.a(e)||Array.isArray(e)&&e.length===0,"isEmpty"),L=chunkDPD6ZWL2_js.a(e=>e==null?"":String(e),"toStr"),Ht=chunkDPD6ZWL2_js.a(e=>{if(chunkTQLF3EZP_js.a(e))return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},"toNum"),Yt=chunkDPD6ZWL2_js.a(e=>{if(e==null)return null;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t},"toDate"),Wt=chunkDPD6ZWL2_js.a(e=>Array.isArray(e)?e:e==null?[]:[e],"toArr"),Kc=chunkDPD6ZWL2_js.a((e,t,r)=>{let n=Ht(e),o=Ht(t);return n!==null&&o!==null&&r(n,o)},"compareNumbers"),Hc=chunkDPD6ZWL2_js.a((e,t,r)=>{let n=Yt(e),o=Yt(t);return n!==null&&o!==null&&r(n.getTime(),o.getTime())},"compareDates"),La=chunkDPD6ZWL2_js.a((e,t,r)=>{if(r.type==="number"||r.type==="currency"){let n=Ht(e),o=Ht(t);if(n!==null&&o!==null)return n===o}return L(e)===L(t)},"equalsForAttr");function $I(e,t){return e?e==="checkbox":typeof t=="boolean"}chunkDPD6ZWL2_js.a($I,"isCheckboxEquality");var Kt=chunkDPD6ZWL2_js.a(e=>({appliesTo:["number","currency","date","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((t,r,n)=>n.type==="date"?Hc(t,r,e):Kc(t,r,e),"evaluateInMemory")}),"orderingSpec"),Qt={is:{appliesTo:["text","phone","number","currency","checkbox","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,r)=>r.type==="checkbox"?e===true==(t===true):La(e,t,r),"evaluateInMemory")},is_not:{appliesTo:["text","phone","number","currency","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,r)=>!La(e,t,r),"evaluateInMemory")},contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>L(e).toLowerCase().includes(L(t).toLowerCase()),"evaluateInMemory")},not_contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>!L(e).toLowerCase().includes(L(t).toLowerCase()),"evaluateInMemory")},starts_with:{appliesTo:["text","phone"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>L(e).toLowerCase().startsWith(L(t).toLowerCase()),"evaluateInMemory")},ends_with:{appliesTo:["text"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>L(e).toLowerCase().endsWith(L(t).toLowerCase()),"evaluateInMemory")},is_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:chunkDPD6ZWL2_js.a(e=>Ma(e),"evaluateInMemory")},is_not_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:chunkDPD6ZWL2_js.a(e=>!Ma(e),"evaluateInMemory")},less_than:Kt((e,t)=>e<t),greater_than:Kt((e,t)=>e>t),less_or_equal:Kt((e,t)=>e<=t),greater_or_equal:Kt((e,t)=>e>=t),is_within:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Yt(e),n=chunkDBQCXRYQ_js.S(t);return r&&n?r.getTime()>=n.startMs&&r.getTime()<n.endMs:false},"evaluateInMemory")},on_day_month:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Yt(e);if(!r)return false;let n=t;return r.getMonth()+1===n.month&&r.getDate()===n.day},"evaluateInMemory")},any_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Wt(t).map(L);return Wt(e).map(L).some(o=>r.includes(o))},"evaluateInMemory")},none_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Wt(t).map(L);return !Wt(e).map(L).some(o=>r.includes(o))},"evaluateInMemory")}};var Yc=chunkDPD6ZWL2_js.a((e,t)=>({id:`system:${e}`,name:e,label:e,type:t,system:true}),"systemAttribute"),Qc=[...Object.entries(chunkDBQCXRYQ_js.V).map(([e,t])=>Yc(e,t))];function XI(e,t,r){let n=t;return Jc(e,{...t.values,id:t.id,objectId:t.objectId,objectName:n.objectName,tenantId:n.tenantId,label:t.label,createdAt:t.createdAt,updatedAt:t.updatedAt,createdBy:t.createdBy,lastUpdatedBy:t.lastUpdatedBy,deletedAt:t.deletedAt,deletedBy:t.deletedBy,visibility:t.visibility,ownedBy:t.ownedBy},[...r,...Qc])}chunkDPD6ZWL2_js.a(XI,"evaluateRecordFilterState");function Jc(e,t,r){if(e.rules.length===0)return true;let n=new Map(r.map(a=>[a.name,a])),o=e.combinator==="or"?"some":"every";return e.rules[o](a=>Xc(a,t,n))}chunkDPD6ZWL2_js.a(Jc,"evaluateFilterState");function Xc(e,t,r){let n=r.get(e.attribute);if(!n)return false;if(e.property&&n.type==="location"){if(!(chunkDBQCXRYQ_js.g(e.property)&&chunkDBQCXRYQ_js.h(e.operator)))return false;let u=Qt[e.operator];if(!u)return false;let d=t[e.attribute],f=typeof d=="object"&&d!==null?d[e.property]:void 0;return xi(u,"text",e.operator,f,e.value,n)}if(e.property){let u=No(n).find(R=>R.name===e.property);if(!u)return false;let d=chunkDBQCXRYQ_js.K(e.operator),f=Qt[d];if(!f?.appliesTo.includes(u.type))return false;let x=t[e.attribute],K=(Array.isArray(x)?x:x==null?[]:[x]).some(R=>{if(typeof R!="object"||R===null)return false;let Z=R.props;return typeof Z!="object"||Z===null?false:xi(f,u.type,d,Z[e.property],e.value,u)});return (e.quantifier??chunkDBQCXRYQ_js.J(e.operator))==="none"?!K:K}let o=Qt[e.operator];if(!o||!o.appliesTo.includes(n.type))return false;let a=t[e.attribute],s=n.type==="relation"||n.type==="document"||n.type==="user"?tp(a):a;return xi(o,n.type,e.operator,s,e.value,n)}chunkDPD6ZWL2_js.a(Xc,"evaluateRule");function xi(e,t,r,n,o,a){let[s,u]=Zc(t,r,n,o);return t==="phone"&&u===""&&r==="contains"?false:t==="phone"&&u===""&&r==="not_contains"?true:e.evaluateInMemory(s,u,a)}chunkDPD6ZWL2_js.a(xi,"evaluateNormalizedComparands");function Zc(e,t,r,n){return e==="date"&&(t==="is"||t==="is_not")?[Ba(r),Ba(n)]:e==="phone"?ep(r,n):[$a(e,r),$a(e,n)]}chunkDPD6ZWL2_js.a(Zc,"normalizeOperatorComparands");function Ba(e){let t=ne(e)?Te(e):e;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t.toISOString().slice(0,10);if(typeof t!="string"||t==="")return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let r=new Date(t);return Number.isNaN(r.getTime())?null:r.toISOString().slice(0,10)}chunkDPD6ZWL2_js.a(Ba,"normalizeUtcCalendarDay");function ep(e,t){let r=typeof t=="object"&&t!==null?t:{},n=typeof r.countryCode=="string"?r.countryCode:void 0,o=chunkDPD6ZWL2_js.a(a=>{let s=typeof a=="object"&&a!==null?a:{phoneNumber:a};if(typeof s.phoneNumber!="string")return null;if(!n)return chunkGXSNLYRR_js.a(s.phoneNumber);let u=typeof s.countryCode=="string"?s.countryCode:n;return `${u}:${chunkGXSNLYRR_js.b(s.phoneNumber,u)}`},"normalizeOne");return [o(e),o(t)]}chunkDPD6ZWL2_js.a(ep,"normalizePhoneComparands");function $a(e,t){return e==="currency"?chunkDBQCXRYQ_js.H(t):e==="date"?ne(t)?Te(t):t instanceof Date?Number.isNaN(t.getTime())?null:t.toISOString():t:t}chunkDPD6ZWL2_js.a($a,"normalizeComparableValue");function tp(e){let t=chunkDPD6ZWL2_js.a(r=>typeof r!="object"||r===null?r:r.id,"normalizeOne");return Array.isArray(e)?e.map(t):t(e)}chunkDPD6ZWL2_js.a(tp,"normalizeReferenceIds");var Ua="today";function Jt(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}chunkDPD6ZWL2_js.a(Jt,"dateInTimezone");function rp(e,t){if(!("defaultValue"in e))return;let{defaultValue:r}=e;return e.type!=="date"||r!==Ua?r:e.includeTime?t.now.toISOString():Jt(t.now,t.timezone)}chunkDPD6ZWL2_js.a(rp,"resolveAttributeDefaultValue");function aS(e,t,r){if(e.combinator==="or"&&e.rules.length>1)return {};let n=new Map(t.map(a=>[a.name,a])),o={};for(let a of e.rules){if(a.property!==void 0||Object.hasOwn(o,a.attribute))continue;let s=n.get(a.attribute);if(!s)continue;let u=np(a,r);u!==void 0&&(o[a.attribute]=chunkDBQCXRYQ_js.j(s).storage.cardinality==="many"?[u]:u);}return o}chunkDPD6ZWL2_js.a(aS,"deriveCreateDefaultsFromFilters");function np(e,t){if(e.operator==="is")return chunkDBQCXRYQ_js.D(e.value)?qa(e.value,t):e.value===null||Array.isArray(e.value)?void 0:e.value;if(e.operator==="any_of"){if(!Array.isArray(e.value)||e.value.length!==1)return;let r=e.value[0];return chunkDBQCXRYQ_js.D(r)?qa(r,t):r}}chunkDPD6ZWL2_js.a(np,"extractDeterministicValue");function qa(e,t){if(t){if(e.dynamic==="actor")return t.userId;if(e.anchor==="today")return Jt(t.now,t.timezone);if(e.anchor==="now")return t.now.toISOString()}}chunkDPD6ZWL2_js.a(qa,"resolveDynamicValue");var lS={status:"connector_status",error:"connector_error",provider:"connector_provider"};var ip=(t=>(t.Desktop="desktop",t))(ip||{});var pS=["force","skip"],mS=["none","all","external_only"],fS="x-fake-signature",bS={override:null,status:"none",failureReason:null,botId:null};var op=/^Session \d+$/;function za(e){let t=e.replace(/\s+/g," ").trim().replace(/[.!?]+$/,"");return t?t.length>60?`${t.slice(0,59).trimEnd()}...`:t:"New conversation"}chunkDPD6ZWL2_js.a(za,"buildAgentFallbackTitle");function ap(e){let t=e.generated?.trim();return t&&!op.test(t)?t:e.firstUserText?za(e.firstUserText):e.emptyLabel}chunkDPD6ZWL2_js.a(ap,"conversationDisplayTitle");var Ii=/^[a-z0-9][a-z0-9-]{0,62}$/;function sp(e){if(!Ii.test(e))throw new chunkL277YJLQ_js.h(`Invalid schema source id "${e}": expected a lowercase slug matching ${Ii}`,[])}chunkDPD6ZWL2_js.a(sp,"assertSchemaSourceId");function up(e){return {label:e.label,description:e.description??null,icon:e.icon??null,config:e.config,default:e.default??false,metadata:e.metadata??null}}chunkDPD6ZWL2_js.a(up,"viewSyncPayload");function SS(e){let{attributeRemovals:t,objectRemovals:r,renames:n}=e.destructive;return t.length>0||r.length>0||n.length>0}chunkDPD6ZWL2_js.a(SS,"hasDestructiveEntries");var z={objectAdditions:20,totalMutations:500,serializedBytes:512*1024};function vi(e){return e instanceof Error?e.message:String(e)}chunkDPD6ZWL2_js.a(vi,"errorMessage");var lp=Ir.z.enum(["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"]).describe('The attribute\'s data type. Determines which keys `config` accepts and requires: `status`/`select`/`multiselect` need a non-empty `options` array (each `status` option carrying its own `group`); `relation` needs `targets` (non-empty) and `cardinality` ("one" or "many"); `formula` needs `expression` and `returnType`; `rollup` needs `targetAttribute` and `function`. Every other type accepts only the shared presentation keys (`placeholder`, `defaultValue`, `icon`, ...) plus a few type-specific optionals (e.g. `number.decimals`, `date.dateFormat`). An attribute\'s type can never be changed later through this tool \u2014 only through a code migration \u2014 so pick it correctly now.');var Ja=Ir.z.string().min(1).superRefine((e,t)=>{try{Ue(e);}catch(r){t.addIssue({code:Ir.z.ZodIssueCode.custom,message:vi(r)});}}).describe('The attribute\'s machine name \u2014 the record\'s field key, and what `{{ name }}` refers to in a labelExpression. Must be a valid identifier: starts with a letter or underscore, then only letters/digits/underscores ("montantHt", "first_name", "FIRST_NAME" are valid; "first-name", "first name", "123name" are not). Max 63 characters. Cannot be a name reserved by the record shape itself (id, createdAt, updatedAt, createdBy, lastUpdatedBy, objectId, label, embeddingText, values, metadata, deletedAt, deletedBy, schemaVersion).'),dp=Ir.z.string().min(1).superRefine((e,t)=>{chunkDBQCXRYQ_js.w(e)&&t.addIssue({code:Ir.z.ZodIssueCode.custom,message:`"${e}" is a reserved object name (${chunkDBQCXRYQ_js.C.join(", ")}) and cannot be used for a new object.`});try{$e(e);}catch(r){t.addIssue({code:Ir.z.ZodIssueCode.custom,message:vi(r)});}}).describe(`The new object's machine name: kebab-case slug, lowercase letters/digits/hyphens only, starting with a letter ("products", "user-profiles", "order-items" are valid; "Products", "userProfiles", "user_profiles" are not). Max 63 characters. Cannot be a name the platform reserves for its own system objects, and cannot already exist.`);function Xa(e){return e.superRefine((t,r)=>{try{let n=chunkIJPA4GYV_js.n(t.type,{...t.config??{},description:t.description}),o=Object.keys(t.config??{}).filter(a=>!Object.hasOwn(n,a));o.length>0&&r.addIssue({code:"unrecognized_keys",keys:o,path:["config"],message:`Unrecognized attribute config key${o.length===1?"":"s"}: ${o.join(", ")}`});}catch(n){if(n instanceof chunkL277YJLQ_js.h){for(let o of n.errors)r.addIssue({code:Ir.z.ZodIssueCode.custom,path:["config",...o.path.map(a=>/^\d+$/.test(a)?Number(a):a)],message:`Config for type "${t.type}" is invalid or incomplete: ${o.message}`});return}r.addIssue({code:Ir.z.ZodIssueCode.custom,path:["config"],message:`Config for type "${t.type}" is invalid or incomplete: ${vi(n)}`});}})}chunkDPD6ZWL2_js.a(Xa,"withConfigCheck");var Za=Ir.z.object({objectName:Ir.z.string().min(1).describe("Name of the existing (or, elsewhere in the same plan, newly created) object this attribute is added to. Ignored for an attribute declared inline in `additive.objects[].attributes` \u2014 there the parent object's own `name` is used instead."),name:Ja,label:Ir.z.string().min(1).max(128).describe("Human-readable display label shown in the UI. 1-128 characters, cannot be empty."),type:lp,config:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional().describe('Type-specific configuration; required keys depend on `type` (see `type`\'s description). Shared optional keys on every type: `placeholder`, `defaultValue`, `icon`, `order`, `hidden`, `archived`, `deprecated`, `metadata`. Per-type keys: `text` \u2014 `multiline`, `minLength`, `maxLength`, `pattern`, `format` ("email"|"url"|"slug"); `number` \u2014 `renderAs` ("number"|"rating"), `min`, `max`, `unit`, `decimals`; `date` \u2014 `dateFormat`, `minDate`, `maxDate`, `includeTime`, `endDate`, `timeFormat` ("12h"|"24h"); `phone` \u2014 `defaultCountryCode` (3-letter); `currency` \u2014 `defaultCurrency`, `allowedCurrencies`, `allowNegative`; `status`/`select`/`multiselect` \u2014 `options` (REQUIRED, non-empty array of `{ value, label, color }`, unique `value`s; for `status` every OPTION also carries `group` as idle|in_progress|finished \u2014 `group` belongs on each option, never on `config` itself; select/multiselect accept `renderAs: "badges"`); `location` \u2014 `granularity`, `defaultCountry`, `allowedCountries`; `user` \u2014 `types` ("user"|"agent"), `multiple`; `relation` \u2014 `targets` (REQUIRED, non-empty array of `{ object }`) and `cardinality` (REQUIRED, "one"|"many"); `formula` \u2014 `expression` (REQUIRED formula string) and `returnType` (REQUIRED); `rollup` \u2014 `targetAttribute` (REQUIRED) and `function` (REQUIRED, e.g. "sum"|"avg"|"count"); `document` \u2014 `properties`, `accepts`, `maxFileSize`. Omit entirely for `richtext`/`checkbox`, which take no type-specific keys.'),required:Ir.z.boolean().optional().describe("Whether the attribute must have a value on every record. Defaults to false (optional)."),description:Ir.z.string().optional().describe("Help text shown under the field in the UI. Not the same as the plan's `summary`.")}).strict(),cp=Xa(Za),pp=Xa(Za.omit({objectName:true})),mp=Ir.z.object({name:dp,label:Ir.z.string().min(1).describe('Human-readable singular display label (e.g. "Devis").'),pluralLabel:Ir.z.string().optional().describe('Human-readable plural display label (e.g. "Devis"/"Invoices"). Defaults from `label` if omitted.'),description:Ir.z.string().optional().describe("Help text describing what this object represents."),icon:chunkIJPA4GYV_js.c.describe("Required icon name for the object. Must be a catalogue value \u2014 call `search_icons` and use a name it returns verbatim. A name that is not in the catalogue is rejected without any hint as to what would have worked, so never guess one."),labelExpression:we.describe('Template used to render a human-readable label for every record of this object \u2014 e.g. shown in relations, search results, and breadcrumbs. MUST contain at least one `{{ attributeName }}` interpolation referencing an attribute this object will actually have (either declared in this same `attributes` array, or an existing attribute if this is an update) \u2014 a plain string with no `{{ }}` at all (e.g. "Devis") is rejected. Interpolations cannot be empty (`{{ }}` is rejected) and only these pipes are allowed: UPPER, LOWER, capitalize, trim, prefix:"...", suffix:"...", wrap:"..." "...", default:"...". `{{ a || b }}` falls back to `b` when `a` is empty. Examples: "{{ firstName }} {{ lastName }}", "{{ numero | UPPER }}", "{{ name || reference }}".'),attributes:Ir.z.array(pp).default([]).describe("Attributes to create on this new object, inline. Same rules as a standalone entry in `additive.attributes`, minus `objectName` (implied by this object). At least one attribute referenced by `labelExpression` should be included here.")}).strict(),es=Ir.z.object({attributeRemovals:Ir.z.array(Ir.z.object({objectName:Ir.z.string().min(1).describe("Object the attribute is removed from."),attributeName:Ir.z.string().min(1).describe("Attribute to delete, together with every record's stored value for it. Must not be a system (code-declared) attribute, and must not be referenced by the object's own `labelExpression` or `embeddingExpression` \u2014 update those first.")}).strict()).default([]).describe("Attributes to permanently delete. Irreversible: record values for the attribute are purged."),objectRemovals:Ir.z.array(Ir.z.object({objectName:Ir.z.string().min(1).describe("Object to delete entirely, together with all its records. Must not be a system (code-declared) object, and must not still be targeted by a `relation` attribute on another object \u2014 retarget or remove that relation first.")}).strict()).default([]).describe("Objects to permanently delete, records included. Irreversible."),renames:Ir.z.array(Ir.z.object({objectName:Ir.z.string().min(1).describe("Object the renamed attribute belongs to."),from:Ir.z.string().min(1).describe("Current attribute name. Must already exist and not be a system attribute."),to:Ja.describe("New attribute name \u2014 same identifier rules as any attribute `name` (see `name` on a planned attribute), and must not collide with another name already on the object, including one added elsewhere in this same plan.")}).strict()).default([]).describe("Attribute renames. Every reference to the old name (labelExpression, views, formulas) must be updated separately \u2014 a rename does not follow references automatically.")}).strict().default({attributeRemovals:[],objectRemovals:[],renames:[]}),ts=Ir.z.string().min(1).describe("ONE sentence naming the intent of the change \u2014 what it is for, not what it contains. The human approving it has already watched every entry land in the preview window and can read every row of the plan itself, so a recap tells them nothing they do not have. A second sentence is warranted only when `destructive` is non-empty: say plainly what will be lost (e.g. 'deletes the \"ancienMontant\" column and its data on every devis'). Never restate the plan \u2014 explain intent."),Ga="The COMPLETE config this view should end up with \u2014 not a patch. Copy the baseline returned by get_default_view and edit it, preserving every tab and setting you are not changing: anything you omit is dropped. To change the columns shown, set `tabs[].columns` (an array of attribute names) \u2014 there is no top-level `columns` on either view type. For a detail view's side panel, set `sidePanel.attributes`. Every attribute name listed must already exist on the object, or be created earlier in this same plan. ONE EXCEPTION to omit-is-dropped: a tab with `type: \"custom\"` renders a component belonging to the application, which you cannot describe or recreate. Copy every such tab through from the baseline exactly as it came, `name`, `component` and `props` untouched \u2014 dropping one, inventing one, or altering any of those three is rejected rather than applied (`name` is the tab's address in links, not its wording). Its `label` and `icon` you may change.",Wa="Opaque token returned by get_default_view alongside the baseline you edited. REQUIRED when the object already exists \u2014 it proves you authored against the baseline that is still current. Must be OMITTED when this plan creates the object, which has no baseline yet.",Ka=Ir.z.string().min(1).describe("Name of the object whose default view of this type is replaced. Not a view name \u2014 a plan can only replace an object's deterministic default view, never create a view or target a non-default one."),fp=Ir.z.discriminatedUnion("viewType",[Ir.z.object({objectName:Ka,viewType:Ir.z.literal("list").describe("Targets the object's default list view (the grid)."),canonicalConfig:chunkDBQCXRYQ_js.ma.describe(Ga),baselineToken:Ir.z.string().min(1).optional().describe(Wa)}).strict(),Ir.z.object({objectName:Ka,viewType:Ir.z.literal("detail").describe("Targets the object's default detail view (the single-record view)."),canonicalConfig:chunkDBQCXRYQ_js.na.describe(Ga),baselineToken:Ir.z.string().min(1).optional().describe(Wa)}).strict()]);var Ha=Ir.z.string().regex(/^[0-9a-f]{64}$/,"Expected a lowercase SHA-256 hash"),Ya={baseConfigHash:Ha.nullable(),targetConfigHash:Ha,baselineOrigin:Ir.z.enum(["persisted","generated","absent"])},bp=Ir.z.discriminatedUnion("viewType",[Ir.z.object({objectName:Ir.z.string().min(1),viewType:Ir.z.literal("list"),canonicalConfig:chunkDBQCXRYQ_js.ma,...Ya}).strict(),Ir.z.object({objectName:Ir.z.string().min(1),viewType:Ir.z.literal("detail"),canonicalConfig:chunkDBQCXRYQ_js.na,...Ya}).strict()]).superRefine((e,t)=>{let r=e.baselineOrigin!=="absent";r!==(e.baseConfigHash!==null)&&t.addIssue({code:"custom",path:["baseConfigHash"],message:r?`A ${e.baselineOrigin} baseline requires baseConfigHash`:"An absent baseline requires baseConfigHash to be null"});});function rs(e){return Ir.z.object({objects:Ir.z.array(mp).default([]).describe("New objects to create, with their attributes inline."),attributes:Ir.z.array(cp).default([]).describe("Attributes to add to existing or same-plan objects."),viewUpdates:Ir.z.array(e).default([]).describe("Complete target configs for deterministic default views; never view names.")}).strict().default({objects:[],attributes:[],viewUpdates:[]})}chunkDPD6ZWL2_js.a(rs,"buildAdditiveSchema");function Si(e,t=[],r=new WeakSet){if(e===null||typeof e=="string"||typeof e=="boolean")return null;if(typeof e=="number")return Number.isFinite(e)?null:{path:t,message:"Plan input contains a non-finite number"};if(typeof e!="object")return {path:t,message:"Plan input must contain only JSON-safe values"};if(r.has(e))return {path:t,message:"Plan input cannot contain circular references"};if(Array.isArray(e)){r.add(e);for(let s of Reflect.ownKeys(e))if(s!=="length"&&(typeof s=="symbol"||!/^(0|[1-9]\d*)$/.test(s)))return r.delete(e),{path:[...t,s],message:"Plan input arrays cannot contain non-index JSON properties"};for(let s=0;s<e.length;s++){if(!Object.hasOwn(e,s))return r.delete(e),{path:[...t,s],message:"Plan input cannot contain sparse arrays"};let u=Si(e[s],[...t,s],r);if(u)return r.delete(e),u}return r.delete(e),null}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return {path:t,message:"Plan input must contain only plain JSON objects"};r.add(e);let o=e,a=Reflect.ownKeys(o);for(let s of a){let u=Object.getOwnPropertyDescriptor(o,s);if(typeof s=="symbol"||!(u?.enumerable&&"value"in u))return r.delete(e),{path:[...t,s],message:"Plan input objects must contain enumerable JSON data properties only"}}for(let s of a.sort()){let u=Si(o[s],[...t,s],r);if(u)return r.delete(e),u}return r.delete(e),null}chunkDPD6ZWL2_js.a(Si,"findJsonSafetyIssue");function gp(e){let t=[];return e.additive.objects.forEach((r,n)=>{t.push(["additive","objects",n]),r.attributes.forEach((o,a)=>{t.push(["additive","objects",n,"attributes",a]);});}),e.additive.attributes.forEach((r,n)=>{t.push(["additive","attributes",n]);}),e.additive.viewUpdates.forEach((r,n)=>{t.push(["additive","viewUpdates",n]);}),e.destructive.attributeRemovals.forEach((r,n)=>{t.push(["destructive","attributeRemovals",n]);}),e.destructive.objectRemovals.forEach((r,n)=>{t.push(["destructive","objectRemovals",n]);}),e.destructive.renames.forEach((r,n)=>{t.push(["destructive","renames",n]);}),t}chunkDPD6ZWL2_js.a(gp,"mutationPaths");function ns(e,t){e.additive.objects.length>z.objectAdditions&&t.addIssue({code:"too_big",origin:"array",maximum:z.objectAdditions,inclusive:true,path:["additive","objects",z.objectAdditions],message:`A schema plan can add at most ${z.objectAdditions} objects`});let r=gp(e);r.length>z.totalMutations&&t.addIssue({code:"too_big",origin:"array",maximum:z.totalMutations,inclusive:true,path:r[z.totalMutations],message:`A schema plan can contain at most ${z.totalMutations} mutations; received ${r.length}`});}chunkDPD6ZWL2_js.a(ns,"addPlanLimitIssues");function is(e,t){let r=Si(e);if(r)return t.addIssue({code:"custom",path:r.path,message:r.message}),Ir.z.NEVER;let n=new TextEncoder().encode(chunk5667SMJ5_js.b(e)).byteLength;return n>z.serializedBytes?(t.addIssue({code:"too_big",origin:"string",maximum:z.serializedBytes,inclusive:true,path:[],message:`A schema plan can serialize to at most ${z.serializedBytes} UTF-8 bytes; received ${n}`}),Ir.z.NEVER):e}chunkDPD6ZWL2_js.a(is,"boundSerializedPlanInput");var yp=rs(fp),hp=rs(bp),Qa=Ir.z.object({schemaPlanVersion:Ir.z.literal(2).describe("Required proposal contract version."),summary:ts,additive:yp,destructive:es}).strict().superRefine((e,t)=>{let r=new Set(e.additive.objects.map(n=>n.name));e.additive.viewUpdates.forEach((n,o)=>{let a=["additive","viewUpdates",o,"baselineToken"];if(r.has(n.objectName)){n.baselineToken!==void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an object added by this plan must not include baselineToken"});return}n.baselineToken===void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an existing object requires baselineToken"});}),ns(e,t);}),VS=Object.assign(Ir.z.preprocess(is,Qa),{shape:Qa.shape}),Ap=Ir.z.object({schemaPlanVersion:Ir.z.literal(2),summary:ts,additive:hp,destructive:es}).strict().superRefine(ns),MS=Ir.z.preprocess(is,Ap);var w=Ir.z.number().finite().nonnegative(),as=Ir.z.enum(Io),Ri=Ir.z.enum(So),Di=Ir.z.enum(vo),ss=Ir.z.object({provider:as,model:Ir.z.string().min(1)}).strict(),zS=Ir.z.object({speed:Ri.optional(),reasoning:Di.optional()}).strict(),us=Ir.z.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),Tp=Ir.z.object({model:ss.optional(),speed:Ri.optional(),reasoning:Di.optional(),imageModel:us.optional()}).strict(),GS=Tp.refine(e=>e.model!==void 0||e.speed!==void 0||e.reasoning!==void 0||e.imageModel!==void 0,{message:"At least one inference override is required"}),WS=Ir.z.object({model:ss.nullable().optional(),speed:Ri.nullable().optional(),reasoning:Di.nullable().optional(),imageModel:us.nullable().optional()}).strict().refine(e=>Object.keys(e).length>0&&Object.values(e).every(t=>t!==void 0),{message:"At least one inference override is required"}),ls=Ir.z.object({label:Ir.z.string(),denied:Ir.z.boolean().optional(),deletion:Ir.z.object({target:Ir.z.string().optional(),count:w.optional(),restorableDays:w.optional()}).strict().optional(),counts:Ir.z.record(Ir.z.string(),w).optional(),warnings:Ir.z.array(Ir.z.string()).optional()}).strict(),wp=Ir.z.union([Ir.z.object({type:Ir.z.literal("text"),text:Ir.z.string()}).strict(),Ir.z.object({type:Ir.z.literal("reasoning"),text:Ir.z.string()}).strict(),Ir.z.object({type:Ir.z.literal("system"),code:Ir.z.enum(br)}).strict(),Ir.z.object({type:Ir.z.literal("error"),error:Ir.z.string(),errorClass:Ir.z.string().optional()}).strict(),Ir.z.object({type:Ir.z.literal("tool"),toolCallId:Ir.z.string(),name:Ir.z.string(),args:Ir.z.record(Ir.z.string(),Ir.z.unknown()),result:Ir.z.unknown().optional(),error:Ir.z.string().optional(),errorCode:Ir.z.enum(["output_limit_reached","interrupted"]).optional(),state:Ir.z.enum(["streaming","running","completed","error","pending","approval-requested","approval-responded","approval-dispatched"]),durationMs:w.optional(),approvalId:Ir.z.string().optional(),approvalImpact:ls.optional(),approved:Ir.z.boolean().optional(),approvalReason:Ir.z.string().optional(),approvalRelaxableByAuto:Ir.z.boolean().optional()}).strict(),Ir.z.object({type:Ir.z.literal("file"),fileId:Ir.z.string(),name:Ir.z.string(),mimeType:Ir.z.string()}).strict(),Ir.z.object({type:Ir.z.literal("compaction"),state:Ir.z.literal("in-progress"),reason:Ir.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:w.optional(),reportedTokens:w.optional()}).strict(),Ir.z.object({type:Ir.z.literal("compaction"),state:Ir.z.literal("completed"),tokensBefore:w,tokensAfter:w,tokensSaved:w,strategy:Ir.z.enum(["no-op","summary","truncation"]),durationMs:w,summary:Ir.z.string().optional()}).strict(),Ir.z.object({type:Ir.z.literal("compaction"),state:Ir.z.literal("failed"),reason:Ir.z.string(),durationMs:w.optional()}).strict()]),xp=Ir.z.object({id:Ir.z.string(),name:Ir.z.string(),mimeType:Ir.z.string(),size:w}).strict(),Ip=Ir.z.object({id:Ir.z.string(),type:Ir.z.string().transform(e=>e),entityId:Ir.z.string(),label:Ir.z.string(),objectName:Ir.z.string().optional(),startIndex:w,endIndex:w}).strict(),Sp=Ir.z.object({provider:as,model:Ir.z.string(),maxTokens:w.optional(),contextWindow:w.optional()}).strict(),vp=Ir.z.union([Ir.z.date(),Ir.z.string().datetime({offset:true}).transform(e=>new Date(e))]),os=Ir.z.object({id:Ir.z.string(),sessionId:Ir.z.string(),tenantId:Ir.z.string().optional(),runId:Ir.z.string().optional(),role:Ir.z.enum(["user","assistant","system","tool"]),parts:Ir.z.array(wp),attachments:Ir.z.array(xp).optional(),mentions:Ir.z.array(Ip).optional(),model:Sp.optional(),tokenUsage:Ir.z.object({input:w,output:w}).strict().optional(),metadata:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional(),createdAt:vp}).strict(),Rp=Ir.z.object({id:Ir.z.string(),description:Ir.z.string(),status:Ir.z.enum(["pending","in_progress","completed","blocked"]),result:Ir.z.string().optional(),updatedAt:w.optional()}).strict(),Dp=Ir.z.object({id:Ir.z.string(),sessionId:Ir.z.string(),status:Ir.z.enum(["active","completed","abandoned"]),todos:Ir.z.array(Rp),version:w,createdAt:Ir.z.string(),updatedAt:Ir.z.string(),completedAt:Ir.z.string().optional()}).strict(),ds={"session-named":Ir.z.object({name:Ir.z.string()}).strict(),"compaction-start":Ir.z.object({reason:Ir.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:w.optional(),reportedTokens:w.optional()}).strict(),"compaction-end":Ir.z.object({tokensBefore:w,tokensAfter:w,tokensSaved:w,strategy:Ir.z.enum(["no-op","summary","truncation"]),durationMs:w,summary:Ir.z.string().optional()}).strict(),"compaction-failed":Ir.z.object({reason:Ir.z.string()}).strict(),usage:Ir.z.object({messageId:Ir.z.string().min(1).optional(),inputTokens:w,outputTokens:w,totalTokens:w,cacheReadTokens:w.optional(),cacheCreationTokens:w.optional(),contextWindow:w,residentTokens:w,utilization:Ir.z.number().finite().min(0).max(1),costUsd:w.optional()}).strict(),"message-persisted":Ir.z.object({message:os}).strict(),"message-updated":Ir.z.object({message:os}).strict(),"todo-plan-update":Ir.z.object({plan:Dp}).strict(),"approval-context":Ir.z.object({approvalId:Ir.z.string(),toolCallId:Ir.z.string(),impact:ls.optional(),relaxableByAuto:Ir.z.boolean().optional()}).strict(),"session-state":Ir.z.object({state:Ir.z.object({phase:Ir.z.enum(["queued","running","parked","terminal"]),parkedOn:Ir.z.enum(["human","agents"]).optional(),humanRequestIds:Ir.z.array(Ir.z.string()).optional(),outcome:Ir.z.enum(["completed","failed","cancelled","timeout","expired"]).optional()}).strict(),version:Ir.z.number().int().positive(),updatedAt:Ir.z.string().datetime({offset:true})}).strict()};function Ep(e){return e in ds}chunkDPD6ZWL2_js.a(Ep,"isAgentUIDataName");function Op(e){return new chunkL277YJLQ_js.h("Invalid agent UI message chunk",e.map(t=>({path:t.path.map(String),message:t.message,code:t.code})))}chunkDPD6ZWL2_js.a(Op,"agentUIValidationError");function Cp(e){if(typeof e!="object"||e===null||typeof e.type!="string")throw new chunkL277YJLQ_js.h("Invalid agent UI message chunk",[{path:["type"],message:"Expected UI message chunk type",code:"invalid_type"}]);let t=e.type;if(!t.startsWith("data-"))throw new chunkL277YJLQ_js.h("Invalid agent UI message chunk",[{path:["type"],message:"Expected agent data chunk type",code:"invalid_value"}]);let r=t.slice(5);if(!Ep(r))throw new chunkL277YJLQ_js.h("Invalid agent UI message chunk",[{path:["type"],message:`Unknown agent UI data type: ${r}`,code:"invalid_value"}]);let n=Ir.z.object({type:Ir.z.literal(`data-${r}`),id:Ir.z.string().optional(),data:ds[r],transient:Ir.z.boolean().optional()}).strict().safeParse(e);if(!n.success)throw Op(n.error.issues);return n.data}chunkDPD6ZWL2_js.a(Cp,"assertCustomAgentUIMessageChunk");function KS(e,t,r){return Cp({type:`data-${e}`,...r?.id!==void 0?{id:r.id}:{},data:t,...r?.transient!==void 0?{transient:r.transient}:{}})}chunkDPD6ZWL2_js.a(KS,"agentDataChunk");function Xt(e){return e}chunkDPD6ZWL2_js.a(Xt,"defineOperation");function T(e,t,r){let n=t==="atomic"?"none":t==="local"?"if-not-visible":"follow";return o=>{let a=r?.(o);return {impact:t,navigation:n,focus:{...e(o),...a===void 0?{}:{propertyPath:a}}}}}chunkDPD6ZWL2_js.a(T,"definePresentation");var Ei={id:Ir.z.string().min(1)},D={...Ei,viewId:Ir.z.string().min(1)},_p={add_tab:"add_list_tab",add_list_tab:"add_tab"};function se(e,t,r,n,o){let a=e.views.find(s=>s.id===t);if(!a)throw new chunkL277YJLQ_js.h(`View "${t}" is not in the draftable state`,[]);if(a.type!==r){let s=_p[o]??`a ${a.type}-view operation`;throw new chunkL277YJLQ_js.h(`${o} targets ${a.type} view "${t}"; use ${s}`,[])}return {...e,views:e.views.map(s=>{if(s.id!==t)return s;let{derived:u,...d}=n(s);return d})}}chunkDPD6ZWL2_js.a(se,"mapView");function ps(e,t,r){let n=[...e],[o]=n.splice(t,1);return n.splice(r,0,o),n}chunkDPD6ZWL2_js.a(ps,"moveWithin");function Xe(e,t,r){if(t.length!==e.length)throw new chunkL277YJLQ_js.h(`${r} order lists ${t.length} ids for ${e.length} items`,[]);return t.map(n=>{let o=e.find(a=>a.id===n);if(!o)throw new chunkL277YJLQ_js.h(`${r} "${n}" is not in this collection`,[]);return o})}chunkDPD6ZWL2_js.a(Xe,"reorderById");function F(e,t,r,n){return se(e,t,"detail",r,n)}chunkDPD6ZWL2_js.a(F,"mapDetailView");function ue(e,t,r){let n=e.tabs.find(o=>o.id===t);if(!n)throw new chunkL277YJLQ_js.h(`Tab "${t}" is not in view "${e.id}"`,[]);if(n.type!=="form")throw new chunkL277YJLQ_js.h(`Tab "${t}" is not a form tab`,[]);return {...e,tabs:e.tabs.map(o=>o.id===t?r(n):o)}}chunkDPD6ZWL2_js.a(ue,"mapFormTab");function tr(e,t){let r=e.groups.find(n=>n.id===t);if(!r)throw new chunkL277YJLQ_js.h(`Group "${t}" is not in tab "${e.id}"`,[]);return r}chunkDPD6ZWL2_js.a(tr,"requireGroup");function Oi(e,t){for(let r of e.groups){let n=r.fields.find(o=>o.id===t);if(n)return {group:r,field:n}}throw new chunkL277YJLQ_js.h(`Field slot "${t}" is not in tab "${e.id}"`,[])}chunkDPD6ZWL2_js.a(Oi,"locateField");function Zt(e){return {viewId:e.viewId}}chunkDPD6ZWL2_js.a(Zt,"viewFocus");function er(e){return {viewId:e.viewId,tabId:e.tabId}}chunkDPD6ZWL2_js.a(er,"tabFocus");function ms(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}}chunkDPD6ZWL2_js.a(ms,"groupFocus");function fs(e){return {viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}}chunkDPD6ZWL2_js.a(fs,"fieldFocus");function bs(e){return {viewId:e.viewId,tabId:e.tab.id}}chunkDPD6ZWL2_js.a(bs,"addTabFocus");function gs(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.group.id}}chunkDPD6ZWL2_js.a(gs,"addGroupFocus");function ys(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId,fieldId:e.field.id}}chunkDPD6ZWL2_js.a(ys,"addFieldFocus");function hs(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.toGroupId,fieldId:e.fieldId}}chunkDPD6ZWL2_js.a(hs,"moveFieldFocus");function Ze(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(Ze,"firstChangedProperty");var Np=chunkDBQCXRYQ_js.ka,kp=chunkDBQCXRYQ_js.fa,Pp=chunkDBQCXRYQ_js.ea,jp=Ir.z.object({...D,type:Ir.z.literal("add_tab"),tab:Np}),Fp={type:"add_tab",schema:jp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{if(r.tabs.some(n=>n.id===t.tab.id))throw new chunkL277YJLQ_js.h(`Tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,tabs:[...r.tabs,t.tab]}},"add_tab"),"apply"),focus:bs,presentation:T(bs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},Vp=Ir.z.object({...D,type:Ir.z.literal("remove_tab"),tabId:Ir.z.string().min(1)}),Mp={type:"remove_tab",schema:Vp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new chunkL277YJLQ_js.h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.filter(n=>n.id!==t.tabId)}},"remove_tab"),"apply"),focus:er,presentation:T(er,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Ss=Ir.z.object({label:Ir.z.string().min(1).optional(),icon:chunkIJPA4GYV_js.c.optional(),order:Ir.z.number().int().optional()}),Lp=Object.keys(Ss.shape),Bp=Ir.z.object({...D,type:Ir.z.literal("update_tab"),tabId:Ir.z.string().min(1),changes:Ss.refine(e=>Object.keys(e).length>0,"update_tab needs at least one change")}),As=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabFocus"),$p={type:"update_tab",schema:Bp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new chunkL277YJLQ_js.h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.map(n=>n.id===t.tabId?{...n,...t.changes}:n)}},"update_tab"),"apply"),focus:As,presentation:T(As,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},Up=Ir.z.object({...D,type:Ir.z.literal("reorder_tabs"),tabOrder:Ir.z.array(Ir.z.string().min(1))}),qp={type:"reorder_tabs",schema:Up,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>({...r,tabs:Xe(r.tabs,t.tabOrder,"Tab")}),"reorder_tabs"),"apply"),focus:Zt,presentation:T(Zt,"local"),describe:chunkDPD6ZWL2_js.a(()=>"R\xE9ordonne les onglets","describe")},zp=Ir.z.object({...D,type:Ir.z.literal("add_group"),tabId:Ir.z.string().min(1),group:kp}),Gp={type:"add_group",schema:zp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{if(n.groups.some(o=>o.id===t.group.id))throw new chunkL277YJLQ_js.h(`Group "${t.group.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:[...n.groups,t.group]}}),"add_group"),"apply"),focus:gs,presentation:T(gs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute le groupe \xAB ${e.group.label} \xBB`,"describe")},Wp=Ir.z.object({...D,type:Ir.z.literal("remove_group"),tabId:Ir.z.string().min(1),groupId:Ir.z.string().min(1)}),Kp={type:"remove_group",schema:Wp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>(tr(n,t.groupId),{...n,groups:n.groups.filter(o=>o.id!==t.groupId)})),"remove_group"),"apply"),focus:ms,presentation:T(ms,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime le groupe ${e.groupId}`,"describe")},Hp=Ir.z.object({...D,type:Ir.z.literal("update_group"),tabId:Ir.z.string().min(1),groupId:Ir.z.string().min(1),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),description:Ir.z.string().optional(),collapsible:Ir.z.boolean().optional(),collapsed:Ir.z.boolean().optional(),order:Ir.z.number().int().optional()}).refine(e=>Object.keys(e).length>0,"update_group needs at least one change")}),Ts=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}),"updateGroupFocus"),Yp={type:"update_group",schema:Hp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>(tr(n,t.groupId),{...n,groups:n.groups.map(o=>o.id===t.groupId?{...o,...t.changes}:o)})),"update_group"),"apply"),focus:Ts,presentation:T(Ts,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme le groupe en \xAB ${e.changes.label} \xBB`:"Modifie le groupe","describe")},Qp=Ir.z.object({...D,type:Ir.z.literal("reorder_groups"),tabId:Ir.z.string().min(1),groupOrder:Ir.z.array(Ir.z.string().min(1))}),Jp={type:"reorder_groups",schema:Qp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>({...n,groups:Xe(n.groups,t.groupOrder,"Group")})),"reorder_groups"),"apply"),focus:er,presentation:T(er,"local"),describe:chunkDPD6ZWL2_js.a(()=>"R\xE9ordonne les groupes","describe")},Xp=Ir.z.object({...D,type:Ir.z.literal("add_field"),tabId:Ir.z.string().min(1),groupId:Ir.z.string().min(1),field:Pp,index:Ir.z.number().int().min(0).optional()}),Zp={type:"add_field",schema:Xp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{if(tr(n,t.groupId),n.groups.some(o=>o.fields.some(a=>a.id===t.field.id)))throw new chunkL277YJLQ_js.h(`Field slot "${t.field.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:n.groups.map(o=>{if(o.id!==t.groupId)return o;let a=t.index??o.fields.length;return {...o,fields:[...o.fields.slice(0,a),t.field,...o.fields.slice(a)]}})}}),"add_field"),"apply"),focus:ys,presentation:T(ys,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute le champ ${e.field.attribute??e.field.attributeGroup?.label??e.field.id}`,"describe")},em=Ir.z.object({...D,type:Ir.z.literal("remove_field"),tabId:Ir.z.string().min(1),fieldId:Ir.z.string().min(1)}),tm={type:"remove_field",schema:em,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{let{group:o}=Oi(n,t.fieldId);return {...n,groups:n.groups.map(a=>a.id===o.id?{...a,fields:a.fields.filter(s=>s.id!==t.fieldId)}:a)}}),"remove_field"),"apply"),focus:fs,presentation:T(fs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Retire le champ ${e.fieldId}`,"describe")},rm=Ir.z.object({...D,type:Ir.z.literal("move_field"),tabId:Ir.z.string().min(1),fieldId:Ir.z.string().min(1),toGroupId:Ir.z.string().min(1),toIndex:Ir.z.number().int().min(0)}),nm={type:"move_field",schema:rm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{let{group:o,field:a}=Oi(n,t.fieldId),s=tr(n,t.toGroupId);if(o.id===s.id){let u=o.fields.findIndex(d=>d.id===t.fieldId);return {...n,groups:n.groups.map(d=>d.id===o.id?{...d,fields:ps(d.fields,u,t.toIndex)}:d)}}return {...n,groups:n.groups.map(u=>u.id===o.id?{...u,fields:u.fields.filter(d=>d.id!==t.fieldId)}:u.id===s.id?{...u,fields:[...u.fields.slice(0,t.toIndex),a,...u.fields.slice(t.toIndex)]}:u)}}),"move_field"),"apply"),focus:hs,presentation:T(hs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`D\xE9place le champ ${e.fieldId} vers le groupe ${e.toGroupId}`,"describe")},im=Ir.z.object({...D,type:Ir.z.literal("update_field"),tabId:Ir.z.string().min(1),fieldId:Ir.z.string().min(1),changes:Ir.z.object({label:Ir.z.string().optional(),readOnly:Ir.z.boolean().optional(),span:Ir.z.number().int().min(1).max(12).optional()}).refine(e=>Object.keys(e).length>0,"update_field needs at least one change")}),ws=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}),"updateFieldFocus"),om={type:"update_field",schema:im,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>(Oi(n,t.fieldId),{...n,groups:n.groups.map(o=>({...o,fields:o.fields.map(a=>a.id===t.fieldId?{...a,...t.changes}:a)}))})),"update_field"),"apply"),focus:ws,presentation:T(ws,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>`Modifie le champ ${e.fieldId}`,"describe")},vs=Ir.z.object({source:chunkDBQCXRYQ_js.ia.optional(),columns:chunkDBQCXRYQ_js.Z.optional(),filters:chunkDBQCXRYQ_js.aa.nullable().optional(),sorts:chunkDBQCXRYQ_js.$.nullable().optional(),allowCreate:Ir.z.boolean().optional(),allowEdit:Ir.z.boolean().optional(),allowDelete:Ir.z.boolean().optional(),createMode:Ir.z.enum(["redirect","inline","peek"]).optional()}),am=Object.keys(vs.shape),Rs=Ir.z.object({emailAttributeIds:Ir.z.array(Ir.z.string().min(1)).optional(),attribute:Ir.z.string().min(1).optional(),titleAttribute:Ir.z.string().min(1).nullable().optional(),component:Ir.z.string().nullable().optional(),props:Ir.z.record(Ir.z.string(),Ir.z.unknown()).nullable().optional()}),sm=Object.keys(Rs.shape),um={emailAttributeIds:["emails","meetings"],attribute:["richtext"],titleAttribute:["richtext"],component:["custom"],props:["custom"]},lm=Ir.z.object({...D,type:Ir.z.literal("update_tab_config"),tabId:Ir.z.string().min(1),changes:Rs.refine(e=>Object.keys(e).length>0,"update_tab_config needs at least one change")}),xs=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabConfigFocus"),dm={type:"update_tab_config",schema:lm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{let n=r.tabs.find(o=>o.id===t.tabId);if(!n)throw new chunkL277YJLQ_js.h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);for(let o of Object.keys(t.changes)){let a=um[o];if(a&&!a.includes(n.type))throw new chunkL277YJLQ_js.h(`"${o}" is not a setting of a "${n.type}" tab`,[])}return {...r,tabs:r.tabs.map(o=>o.id===t.tabId?{...o,...t.changes}:o)}},"update_tab_config"),"apply"),focus:xs,presentation:T(xs,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>`Configure ${Object.keys(e.changes).join(", ")} sur l'onglet ${e.tabId}`,"describe")},cm=Ir.z.object({...D,type:Ir.z.literal("update_table_tab"),tabId:Ir.z.string().min(1),changes:vs.refine(e=>Object.keys(e).length>0,"update_table_tab needs at least one change")}),Is=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTableTabFocus"),pm={type:"update_table_tab",schema:cm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{let n=r.tabs.find(u=>u.id===t.tabId);if(!n)throw new chunkL277YJLQ_js.h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);if(n.type!=="table")throw new chunkL277YJLQ_js.h(`Tab "${t.tabId}" is not a table tab`,[]);let o=Object.entries(t.changes),a=Object.fromEntries(o.filter(([,u])=>u!==null)),s=new Set(o.filter(([,u])=>u===null).map(([u])=>u));return {...r,tabs:r.tabs.map(u=>u.id===t.tabId?Object.fromEntries(Object.entries({...u,...a}).filter(([d])=>!s.has(d))):u)}},"update_table_tab"),"apply"),focus:Is,presentation:T(Is,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>e.changes.columns?`Affiche ${e.changes.columns.length} colonne(s) dans l'onglet ${e.tabId}`:`Modifie l'onglet ${e.tabId}`,"describe")},mm=Ir.z.object({...D,type:Ir.z.literal("set_side_panel"),sidePanel:Ir.z.object({attributes:Ir.z.array(Ir.z.string().min(1)),width:Ir.z.number().int().min(1).optional()}).nullable()}),fm={type:"set_side_panel",schema:mm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>({...r,config:{...r.config,sidePanel:t.sidePanel??void 0}}),"set_side_panel"),"apply"),focus:Zt,presentation:T(Zt,"atomic",()=>["config","sidePanel"]),describe:chunkDPD6ZWL2_js.a(e=>e.sidePanel?"Active le panneau lat\xE9ral":"Retire le panneau lat\xE9ral","describe")},Oe=[Fp,Mp,$p,qp,Gp,Kp,Yp,Jp,Zp,tm,nm,om,pm,dm,fm];var et={...D,tabId:Ir.z.string().min(1)};function rr(e){return {viewId:e.viewId}}chunkDPD6ZWL2_js.a(rr,"viewFocus");function le(e){return {viewId:e.viewId,tabId:e.tabId}}chunkDPD6ZWL2_js.a(le,"tabFocus");function Ds(e){return {viewId:e.viewId,tabId:e.tab.id}}chunkDPD6ZWL2_js.a(Ds,"addTabFocus");function bm(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(bm,"firstChangedProperty");function Os(e){let t={...e};for(let r of chunkDBQCXRYQ_js.sa)delete t[r];return t}chunkDPD6ZWL2_js.a(Os,"withoutKanbanKeys");function Cs(e){let t={...e};for(let r of chunkDBQCXRYQ_js.ra)delete t[r];return t}chunkDPD6ZWL2_js.a(Cs,"withoutTableKeys");function gm(e,t,r,n){let o=chunkDBQCXRYQ_js.la.safeParse(t);if(!o.success){if(!chunkDBQCXRYQ_js.la.safeParse(e).success)return t;let a=o.error.issues.map(s=>s.path.length?`${s.path.join(".")}: ${s.message}`:s.message).join(", ");throw new chunkL277YJLQ_js.h(`List tab "${n}" in view "${r}" would no longer be publishable: ${a}`,[])}return t}chunkDPD6ZWL2_js.a(gm,"assertStillPublishableTab");function nr(e,t,r,n,o){return se(e,t,"list",a=>{let s=a.config.tabs??[];if(!s.some(u=>u.id===r))throw new chunkL277YJLQ_js.h(`List tab "${r}" is not in view "${t}"`,[]);return {...a,config:{...a.config,tabs:s.map(u=>u.id===r?gm(u,n(u),t,r):u)}}},o)}chunkDPD6ZWL2_js.a(nr,"mapListTab");var ym=chunkDBQCXRYQ_js.la,_s=chunkDBQCXRYQ_js.ba,hm=chunkDBQCXRYQ_js.$;function G(e,t,r,n){let o=Ir.z.object({...et,type:Ir.z.literal(e),value:r});return {type:e,schema:o,apply:chunkDPD6ZWL2_js.a((a,s)=>nr(a,s.viewId,s.tabId,u=>{if(s.value===null){let{[t]:d,...f}=u;return f}return {...u,[t]:s.value}},e),"apply"),focus:le,presentation:T(le,"atomic",()=>[String(t)]),describe:chunkDPD6ZWL2_js.a(a=>n(a.value),"describe")}}chunkDPD6ZWL2_js.a(G,"setOnTab");var Am=Ir.z.object({...D,type:Ir.z.literal("add_list_tab"),tab:ym}),Tm={type:"add_list_tab",schema:Am,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>{let n=r.config.tabs??[];if(n.some(o=>o.id===t.tab.id))throw new chunkL277YJLQ_js.h(`List tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:[...n,t.tab]}}},"add_list_tab"),"apply"),focus:Ds,presentation:T(Ds,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},wm=Ir.z.object({...et,type:Ir.z.literal("remove_list_tab")}),xm={type:"remove_list_tab",schema:wm,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>{let n=r.config.tabs??[];if(!n.some(o=>o.id===t.tabId))throw new chunkL277YJLQ_js.h(`List tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:n.filter(o=>o.id!==t.tabId)}}},"remove_list_tab"),"apply"),focus:le,presentation:T(le,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Im=Ir.z.object({...et,type:Ir.z.literal("update_list_tab"),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),icon:chunkIJPA4GYV_js.c.optional(),default:Ir.z.boolean().optional(),visibility:Ir.z.enum(chunkDBQCXRYQ_js.y).optional()}).refine(e=>Object.keys(e).length>0,"update_list_tab needs at least one change")}),Es=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateListTabFocus"),Sm={type:"update_list_tab",schema:Im,apply:chunkDPD6ZWL2_js.a((e,t)=>nr(e,t.viewId,t.tabId,r=>({...r,...t.changes}),"update_list_tab"),"apply"),focus:Es,presentation:T(Es,"atomic",bm),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},vm=Ir.z.object({...D,type:Ir.z.literal("reorder_list_tabs"),tabOrder:Ir.z.array(Ir.z.string().min(1))}),Rm={type:"reorder_list_tabs",schema:vm,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>({...r,config:{...r.config,tabs:Xe(r.config.tabs??[],t.tabOrder,"List tab")}}),"reorder_list_tabs"),"apply"),focus:rr,presentation:T(rr,"local"),describe:chunkDPD6ZWL2_js.a(()=>"R\xE9ordonne les onglets","describe")},Dm=G("set_columns","columns",Ir.z.array(Ir.z.string().min(1)),e=>`Affiche ${Array.isArray(e)?e.length:0} colonne(s)`),Em=G("set_column_sizing","columnSizing",Ir.z.record(Ir.z.string(),Ir.z.number().int().positive()),()=>"Ajuste la largeur des colonnes"),Om=Ir.z.object({...et,type:Ir.z.literal("set_layout"),value:Ir.z.enum(["table","list","kanban"])}),Cm={type:"set_layout",schema:Om,apply:chunkDPD6ZWL2_js.a((e,t)=>nr(e,t.viewId,t.tabId,r=>{if(t.value!=="kanban")return {...Os(r),layout:t.value};if(r.groupByAttribute===void 0)throw new chunkL277YJLQ_js.h(`List tab "${t.tabId}" cannot switch to kanban without a group attribute \u2014 use set_group_by, which switches the layout itself`,[]);return {...Cs(r),layout:"kanban"}},"set_layout"),"apply"),focus:le,presentation:T(le,"atomic",()=>["layout"]),describe:chunkDPD6ZWL2_js.a(e=>`Passe en affichage ${e.value}`,"describe")},_m=Ir.z.object({...et,type:Ir.z.literal("set_group_by"),value:Ir.z.string().min(1).nullable()}),Nm={type:"set_group_by",schema:_m,apply:chunkDPD6ZWL2_js.a((e,t)=>nr(e,t.viewId,t.tabId,r=>t.value===null?{...Os(r),layout:"table"}:{...Cs(r),layout:"kanban",groupByAttribute:t.value},"set_group_by"),"apply"),focus:le,presentation:T(le,"atomic",()=>["groupByAttribute"]),describe:chunkDPD6ZWL2_js.a(e=>e.value?`Regroupe par ${e.value} en kanban`:"Retire le regroupement, retour en table","describe")},km=G("set_filters","filters",_s.nullable(),e=>e?"Modifie les filtres":"Retire les filtres"),Pm=G("set_sorts","sorts",hm.nullable(),e=>e?"Modifie le tri":"Retire le tri"),jm=G("set_create_mode","createMode",Ir.z.enum(["redirect","inline","peek"]),e=>`Cr\xE9ation en mode ${e}`),Fm=G("set_open_mode","openMode",Ir.z.enum(["side","page"]),e=>e==="side"?"Ouvre les fiches en c\xF4t\xE9":"Ouvre les fiches en pleine page"),Vm=G("set_read_only","readOnly",Ir.z.boolean(),e=>e?"Passe l'onglet en lecture seule":"Rend l'onglet modifiable"),Mm=G("set_card_user_attribute","cardUserAttribute",Ir.z.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire l'utilisateur des cartes"),Lm=G("set_card_date_attribute","cardDateAttribute",Ir.z.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire la date des cartes"),Bm=G("set_description_attribute","descriptionAttribute",Ir.z.string().min(1).nullable(),e=>e?`Affiche ${e} en description`:"Retire la description"),$m=G("set_display_attributes","displayAttributes",chunkDBQCXRYQ_js._.nullable(),e=>`Affiche ${Array.isArray(e)?e.length:0} attribut(s)`),Um=Ir.z.object({...D,type:Ir.z.literal("set_default_filters"),filters:_s.nullable()}),qm={type:"set_default_filters",schema:Um,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>{if(t.filters===null){let{defaultFilters:n,...o}=r.config;return {...r,config:o}}return {...r,config:{...r.config,defaultFilters:t.filters}}},"set_default_filters"),"apply"),focus:rr,presentation:T(rr,"atomic",()=>["config","defaultFilters"]),describe:chunkDPD6ZWL2_js.a(e=>e.filters?"Modifie les filtres de la vue":"Retire les filtres de la vue","describe")},Ce=[qm,Tm,xm,Sm,Rm,Dm,Em,Cm,Nm,km,Pm,jm,Fm,Vm,Mm,Lm,Bm,$m];function tt(e,t){return e.objects.find(r=>r.id===t)}chunkDPD6ZWL2_js.a(tt,"findObject");var zm=new Set(["formula","rollup"]);function _e(e){return zm.has(e.attributeType)}chunkDPD6ZWL2_js.a(_e,"isComputedAttribute");var Ns={sum:"number",avg:"number",count:"number",countValues:"number",countUniqueValues:"number",countEmpty:"number",percentEmpty:"number",percentNotEmpty:"number",earliest:"date",latest:"date",original:"multiselect"};function Gm(e){return typeof e=="string"&&e in Ns?Ns[e]:void 0}chunkDPD6ZWL2_js.a(Gm,"rollupReturnTypeOf");function Ps(e,t){let r=tt(e,t);if(!r)throw new chunkL277YJLQ_js.h(`Object "${t}" is not in the draftable state`,[]);return r}chunkDPD6ZWL2_js.a(Ps,"requireObject");function ir(e){return e.config??{}}chunkDPD6ZWL2_js.a(ir,"configOf");function W(e){let t=ir(e).targets;return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null&&typeof r.object=="string"):[]}chunkDPD6ZWL2_js.a(W,"relationTargets");function Ne(e){let t=W(e).filter(r=>r.object!==ee);return t.length===1?t[0]?.object:void 0}chunkDPD6ZWL2_js.a(Ne,"relationTargetObjectName");function Wm(e){let t=ir(e),r=e.attributeType,n={name:e.name,type:r,id:e.id},o=t.optionsSource;if(r==="relation"){let a=Ne(e);return {...n,...t.cardinality==="one"||t.cardinality==="many"?{cardinality:t.cardinality}:{},...a===void 0?{}:{targetObjectName:a},targets:W(e)}}if(r==="formula")return {...n,...t.returnType===void 0?{}:{returnType:t.returnType},...o===void 0?{}:{optionsSource:o}};if(r==="rollup"){let a=Gm(t.function);return {...n,...a===void 0?{}:{returnType:a},...o===void 0?{}:{optionsSource:o}}}return r==="select"||r==="status"||r==="multiselect"?{...n,...Array.isArray(t.options)?{options:t.options}:{}}:n}chunkDPD6ZWL2_js.a(Wm,"toCompileAttribute");function ks(e,t){return {objectName:e.name,attributes:t.filter(r=>r.objectId===e.id).map(Wm)}}chunkDPD6ZWL2_js.a(ks,"toCompileObject");function Ci(e,t){let r=Ps(e,t);return {...ks(r,e.attributes),relatedObjects:Object.fromEntries(e.objects.map(n=>[n.name,ks(n,e.attributes)]))}}chunkDPD6ZWL2_js.a(Ci,"computedCompileSchemaOf");function Km(e){return {id:e.id,name:e.name,label:e.label,type:"rollup",...ir(e)}}chunkDPD6ZWL2_js.a(Km,"toRollupAttribute");function js(e){try{return e()}catch(t){throw t instanceof g?new chunkL277YJLQ_js.h(t.message,[]):t}}chunkDPD6ZWL2_js.a(js,"asValidationError");function or(e,t){let r=Ci(e,t.objectId);return js(()=>Fs(t,r))}chunkDPD6ZWL2_js.a(or,"computedPlanOf");function Fs(e,t){if(e.attributeType==="rollup")return Oa(Km(e),t);let r=ir(e);return Ut({attributeName:e.name,expression:String(r.expression??""),returnType:r.returnType,schema:t})}chunkDPD6ZWL2_js.a(Fs,"compilePlan");function _i(e){js(()=>va(e.map(t=>({attributeName:t.attributeName,dependencies:t.dependencies}))));}chunkDPD6ZWL2_js.a(_i,"assertAcyclicComputed");function Hm(e,t){switch(e.kind){case "local":case "computed":return e.attributeName===t;case "relation":return e.relationName===t;case "options":return false;default:return e}}chunkDPD6ZWL2_js.a(Hm,"dependencyNames");function rt(e,t){let r=Ci(e,t),n=[];for(let o of e.attributes)if(!(o.objectId!==t||!_e(o)))try{n.push(Fs(o,r));}catch(a){if(!(a instanceof g))throw a}return n}chunkDPD6ZWL2_js.a(rt,"compilablePlansOf");function Ni(e,t,r){let n=Ps(e,t),o=[];for(let a of rt(e,t))a.attributeName!==r&&a.dependencies.some(s=>Hm(s,r))&&o.push(a.attributeName);for(let a of e.objects)if(a.id!==t)for(let s of rt(e,a.id))s.dependencies.some(d=>{if(d.kind!=="relation"||d.targetAttributeName!==r)return false;let f=e.attributes.find(x=>x.objectId===a.id&&x.name===d.relationName&&x.attributeType==="relation");return f!==void 0&&Ne(f)===n.name})&&o.push(`${a.name}.${s.attributeName}`);return o}chunkDPD6ZWL2_js.a(Ni,"dependentsOf");function nt(e){let t=e.config?.bilateral;if(typeof t!="object"||t===null)return;let{object:r,attribute:n}=t;return typeof r=="string"&&typeof n=="string"?{object:r,attribute:n}:void 0}chunkDPD6ZWL2_js.a(nt,"bilateralDeclarationOf");function Ym(e,t){return t!==void 0&&e.attributeType===t.attributeType&&Qm(e,t)}chunkDPD6ZWL2_js.a(Ym,"sameAttribute");function Qm(e,t){return JSON.stringify(e.config??{})===JSON.stringify(t.config??{})}chunkDPD6ZWL2_js.a(Qm,"sameConfig");function Jm(e,t){let r=chunkDPD6ZWL2_js.a(n=>Ym(n,e.attributes.find(o=>o.id===n.id)),"untouched");for(let n of t.attributes){if(n.attributeType!=="relation")continue;let o=nt(n);if(o===void 0||r(n))continue;let s=t.objects.find(R=>R.id===n.objectId)?.name??n.objectId,u=t.objects.find(R=>R.name===o.object),d=t.attributes.find(R=>R.objectId===u?.id&&R.name===o.attribute),f=`relation "${s}.${n.name}" declares inverse "${o.object}.${o.attribute}"`;if(d===void 0)throw new chunkL277YJLQ_js.h(`${f}, which object "${o.object}" does not have; draft it first`,[]);if(d.attributeType!=="relation")throw new chunkL277YJLQ_js.h(`${f}, which is not a relation`,[]);let x=nt(d);if(!(W(d).some(R=>R.object===s)&&(r(d)?x===void 0||x.object===s&&x.attribute===n.name:x?.object===s&&x.attribute===n.name)))throw new chunkL277YJLQ_js.h(`${f}, which does not point back to "${s}.${n.name}"`,[])}}chunkDPD6ZWL2_js.a(Jm,"assertBilateralPairs");function Vs(e,t,r){let n=`fld_${e}_${t}`;return r===0?n:`${n}_${r}`}chunkDPD6ZWL2_js.a(Vs,"makeFieldId");function Xm(e,t){return e.attributeGroup?e.attributeGroup.id:e.attribute?e.attribute:`slot${t}`}chunkDPD6ZWL2_js.a(Xm,"seedOf");function Zm(e){let t=new Map,r=e.fields.map((n,o)=>{if(n.id)return n;let a=Xm(n,o),s=t.get(a)??0;return t.set(a,s+1),{...n,id:Vs(e.id,a,s)}});return {...e,fields:r}}chunkDPD6ZWL2_js.a(Zm,"withIds");function ki(e){return e.map(t=>t.type==="form"?{...t,groups:t.groups.map(Zm)}:t)}chunkDPD6ZWL2_js.a(ki,"ensureFieldIds");function ef(e){return {id:e.id??e.name,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon}}}chunkDPD6ZWL2_js.a(ef,"toDraftableObject");function tf(e){let t=e.id??e.name;return (e.attributes??[]).map(r=>rf(r,t))}chunkDPD6ZWL2_js.a(tf,"toDraftableAttributes");function ke(e){return {id:e.id,name:e.name,label:e.label,type:e.attributeType,...e.config}}chunkDPD6ZWL2_js.a(ke,"toAttribute");function rf(e,t){let{id:r,name:n,label:o,type:a,...s}=e;return {id:e.id??e.name,objectId:t,name:e.name,label:e.label??e.name,attributeType:e.type,config:s}}chunkDPD6ZWL2_js.a(rf,"toDraftableAttribute");function Ms(e){let t=e[0];return t?`{{ ${t.name} }}`:"{{ id }}"}chunkDPD6ZWL2_js.a(Ms,"draftedLabelExpression");function ar(e,t){let r=t.filter(n=>n.objectId===e.id);return {id:e.id,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon},labelExpression:Ms(r),attributes:r.map((n,o)=>{let a=ke(n);return a.order===void 0?{...a,order:o}:a})}}chunkDPD6ZWL2_js.a(ar,"draftedObjectDefinition");var nf=0x100000001b3n,of=0xffffffffffffffffn;function Ls(e,t){let r=t;for(let n of new TextEncoder().encode(e))r^=BigInt(n),r=r*nf&of;return r}chunkDPD6ZWL2_js.a(Ls,"fnv1a64");function Pi(e,t){let r=`${e.toLowerCase()}:${t}`,n=Ls(r,0xcbf29ce484222325n).toString(16).padStart(16,"0"),o=Ls(`${t}:${r}`,0x84222325cbf29ce4n).toString(16).padStart(16,"0"),a=n+o,s=(Number.parseInt(a[16],16)&3|8).toString(16);return [a.slice(0,8),a.slice(8,12),`8${a.slice(13,16)}`,`${s}${a.slice(17,20)}`,a.slice(20,32)].join("-")}chunkDPD6ZWL2_js.a(Pi,"viewIdFor");function fe(e){return {list:Pi(e,"list"),detail:Pi(e,"detail")}}chunkDPD6ZWL2_js.a(fe,"defaultViewIdsFor");function Bs(e,t,r){if(e==="list"){let s=He(r);return {id:t,objectName:s.object,type:"list",label:s.label,tabs:[],config:s.config,derived:true}}let n=Ke(r),{tabs:o,...a}=n.config;return {id:t,objectName:n.object,type:"detail",label:n.label,tabs:ki(o??[]),config:a,derived:true}}chunkDPD6ZWL2_js.a(Bs,"derivedView");function ji(e,t){let r=ar(e,t),n=fe(e.id);return ["list","detail"].map(o=>Bs(o,n[o],r))}chunkDPD6ZWL2_js.a(ji,"defaultViewsFor");function Fi(e,t,r){return Bs(e.type,e.id,ar(t,r))}chunkDPD6ZWL2_js.a(Fi,"regenerateDerived");function Pe(e,t){let r=e.objects.find(n=>n.id===t);if(!r)throw new chunkL277YJLQ_js.h(`Object "${t}" is not in the draftable state`,[]);return r}chunkDPD6ZWL2_js.a(Pe,"requireObject");function Vi(e,t,r){return {...e,attributes:[...r],views:e.views.map(n=>n.derived&&n.objectName===t.name?Fi(n,t,r):n)}}chunkDPD6ZWL2_js.a(Vi,"withDerivedViews");function sr(e){return {objectId:e.objectId}}chunkDPD6ZWL2_js.a(sr,"objectFocus");function ur(e){return {objectId:e.objectId,recordId:e.recordId}}chunkDPD6ZWL2_js.a(ur,"recordFocus");function $s(e){return {objectId:e.objectId,attributeId:e.attributeId}}chunkDPD6ZWL2_js.a($s,"attributeFocus");function lr(e){return {objectId:e.objectId,attributeName:e.attribute}}chunkDPD6ZWL2_js.a(lr,"existingAttributeFocus");function af(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(af,"firstChangedProperty");function sf(e,t){if(e.type==="list"){let r=(e.config.tabs??[]).find(n=>n.id!==Ft&&(n.columns??[]).includes(t));return r===void 0?void 0:`tab "${r.id}"`}for(let r of e.tabs){let n="groups"in r?r.groups:[];for(let o of n)if(o.fields.some(a=>a.attribute===t)&&!(r.id===We&&o.id===Vt))return `group "${o.id}"`}}chunkDPD6ZWL2_js.a(sf,"handShapedUse");function uf(e,t){if(e.type==="list"){let r=(e.config.tabs??[]).map(n=>n.id===Ft&&n.columns!==void 0?{...n,columns:n.columns.filter(o=>o!==t)}:n);return {...e,config:{...e.config,tabs:r}}}return {...e,tabs:e.tabs.map(r=>{if(r.id!==We||!("groups"in r))return r;let n=r.groups.map(o=>o.id===Vt?{...o,fields:o.fields.filter(a=>a.attribute!==t)}:o);return {...r,groups:n}})}}chunkDPD6ZWL2_js.a(uf,"withoutGeneratedUse");function lf(e,t,r){let n=r.config??{},o=r.name;if(n.relationPath!==void 0)throw new chunkL277YJLQ_js.h(`rollup "${o}": relationPath is not supported yet`,[]);let a=n.relationAttribute;if(typeof a!="string"||a.length===0)throw new chunkL277YJLQ_js.h(`rollup "${o}" needs a relation attribute; none is configured on object "${t.name}"`,[]);let s=e.attributes.find(v=>v.objectId===t.id&&v.name===a&&v.attributeType==="relation");if(!s)throw new chunkL277YJLQ_js.h(`rollup "${o}" needs a relation attribute; "${a}" is not a relation of object "${t.name}"`,[]);let u=Ne(s);if(u===void 0){let v=W(s).filter(K=>K.object!=="*").length;throw new chunkL277YJLQ_js.h(`rollup "${o}" needs a relation with one target object; "${a}" targets ${v}`,[])}if(n.function==="count")return;let d=e.objects.find(v=>v.name===u),f=n.targetAttribute;if(!(d!==void 0&&e.attributes.some(v=>v.objectId===d.id&&v.name===f)))throw new chunkL277YJLQ_js.h(`rollup "${o}" targets attribute "${f}", which object "${u}" does not have`,[])}chunkDPD6ZWL2_js.a(lf,"assertRollupShape");function df(e,t){let r=e.config??{};if(e.attributeType==="rollup")return r.relationAttribute===t;let n=typeof r.expression=="string"?r.expression:"";return new RegExp(`(^|[^A-Za-z0-9_])${t}\\.`).test(n)}chunkDPD6ZWL2_js.a(df,"traversesRelation");function qs(e,t){let r=Pe(e,t.objectId);if(t.attributeType==="relation"){for(let o of W(t))if(o.object!==ee&&!e.objects.some(a=>a.name===o.object))throw new chunkL277YJLQ_js.h(`object "${o.object}" is unknown; create it first`,[]);let n=nt(t)?.object;if(n!==void 0&&n!==ee&&!e.objects.some(o=>o.name===n))throw new chunkL277YJLQ_js.h(`object "${n}" is unknown; create it first`,[]);for(let o of e.attributes)o.objectId!==t.objectId||!_e(o)||df(o,t.name)&&or(e,o);}else if(_e(t))t.attributeType==="rollup"&&lf(e,r,t),or(e,t);else return;_i(rt(e,t.objectId));}chunkDPD6ZWL2_js.a(qs,"assertConfigFolds");var be={...Ei,objectId:Ir.z.string().uuid()},cf=Ir.z.object({...be,type:Ir.z.literal("add_object"),name:Tt,label:Ir.z.string().min(1),icon:Ir.z.string().min(1).optional()}),pf={type:"add_object",schema:cf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(e.objects.some(n=>n.name===t.name))throw new chunkL277YJLQ_js.h(`Object "${t.name}" already exists`,[]);if(e.objects.some(n=>n.id===t.objectId))throw new chunkL277YJLQ_js.h(`Object id "${t.objectId}" is already taken`,[]);let r={id:t.objectId,name:t.name,label:t.label,...t.icon===void 0?{}:{icon:t.icon}};return {...e,objects:[...e.objects,r],views:[...e.views,...ji(r,e.attributes)]}},"apply"),focus:sr,presentation:T(sr,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Cr\xE9e l'objet \xAB ${e.label} \xBB`,"describe")},mf=Ir.z.object({...be,type:Ir.z.literal("update_object"),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),icon:Ir.z.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_object needs at least one change")}),Us=chunkDPD6ZWL2_js.a(e=>({objectId:e.objectId}),"updateObjectFocus"),ff={type:"update_object",schema:mf,apply:chunkDPD6ZWL2_js.a((e,t)=>(Pe(e,t.objectId),{...e,objects:e.objects.map(r=>r.id===t.objectId?{...r,...t.changes}:r)}),"apply"),focus:Us,presentation:T(Us,"atomic",af),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'objet en \xAB ${e.changes.label} \xBB`:"Modifie l'objet","describe")},bf=Ir.z.object({...be,type:Ir.z.literal("remove_object")}),gf={type:"remove_object",schema:bf,apply:chunkDPD6ZWL2_js.a((e,t)=>{Pe(e,t.objectId);let r=e.objects.find(n=>n.id===t.objectId)?.name;for(let n of e.attributes){if(n.objectId===t.objectId||n.attributeType!=="relation"||!W(n).some(a=>a.object===r))continue;let o=e.objects.find(a=>a.id===n.objectId);throw new chunkL277YJLQ_js.h(`object "${r}" is targeted by attribute "${o?.name}.${n.name}"; remove that attribute first`,[])}return {...e,objects:e.objects.filter(n=>n.id!==t.objectId),attributes:e.attributes.filter(n=>n.objectId!==t.objectId),sampleRecords:e.sampleRecords.filter(n=>n.objectId!==t.objectId),views:e.views.filter(n=>n.objectName!==r)}},"apply"),focus:sr,presentation:T(sr,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'objet ${e.objectId}`,"describe")},zs=To;function Gs(e,t){try{chunkIJPA4GYV_js.n(e,t);}catch(r){throw r instanceof chunkL277YJLQ_js.h?new chunkL277YJLQ_js.h(r.message,r.errors.map(n=>({...n,path:["config",...n.path??[]]}))):r}}chunkDPD6ZWL2_js.a(Gs,"assertConfigParses");var yf=Ir.z.object({...be,type:Ir.z.literal("add_attribute"),attributeId:Ir.z.string().min(1),name:Sr,label:Ir.z.string().min(1),attributeType:Ir.z.enum(zs),config:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional()}).superRefine((e,t)=>{try{Gs(e.attributeType,e.config??{});}catch(r){if(r instanceof chunkL277YJLQ_js.h){for(let n of r.errors)t.addIssue({code:"custom",message:n.message,path:[...n.path]});return}throw r}}),hf={type:"add_attribute",schema:yf,apply:chunkDPD6ZWL2_js.a((e,t)=>{let r=Pe(e,t.objectId);if(e.attributes.some(s=>s.objectId===t.objectId&&s.name===t.name))throw new chunkL277YJLQ_js.h(`Attribute "${t.name}" already exists on object "${t.objectId}"`,[]);let n={id:t.attributeId,objectId:t.objectId,name:t.name,label:t.label,attributeType:t.attributeType,...t.config===void 0?{}:{config:t.config}};for(let s of e.sampleRecords)s.objectId===t.objectId&&Hs(s.id,n,s.values);let o=[...e.attributes,n],a=Vi(e,r,o);return qs(a,n),a},"apply"),focus:$s,presentation:T($s,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'attribut \xAB ${e.label} \xBB`,"describe")},Ws={...be,attribute:Sr};function Ks(e,t,r,n){let o=Pe(e,t);if(r===void 0)throw new chunkL277YJLQ_js.h(`${n} now addresses the attribute by name; remove this operation and append it again with "attribute"`,[]);let a=e.attributes.find(s=>s.objectId===t&&s.name===r);if(!a)throw new chunkL277YJLQ_js.h(`Attribute "${r}" is not on object "${t}"`,[]);return {object:o,attribute:a}}chunkDPD6ZWL2_js.a(Ks,"requireAttribute");var Af=Ir.z.object({...Ws,type:Ir.z.literal("update_attribute"),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),config:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional()}).refine(e=>Object.keys(e).length>0,"update_attribute needs at least one change")}),Tf={type:"update_attribute",schema:Af,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{object:r,attribute:n}=Ks(e,t.objectId,t.attribute,"update_attribute");t.changes.config!==void 0&&Gs(n.attributeType,t.changes.config);let o={...n,...t.changes},a=e.attributes.map(u=>u===n?o:u),s=Vi(e,r,a);return qs(s,o),s},"apply"),focus:lr,presentation:T(lr,"atomic"),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'attribut \xAB ${e.attribute} \xBB en \xAB ${e.changes.label} \xBB`:`Modifie l'attribut \xAB ${e.attribute} \xBB`,"describe")},wf=Ir.z.object({...Ws,type:Ir.z.literal("remove_attribute")}),xf={type:"remove_attribute",schema:wf,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{object:r,attribute:n}=Ks(e,t.objectId,t.attribute,"remove_attribute"),[o]=Ni(e,t.objectId,n.name);if(o!==void 0)throw new chunkL277YJLQ_js.h(`attribute "${n.name}" is used by "${o}"; remove that first`,[]);for(let d of e.views){if(d.objectName!==r.name)continue;let f=sf(d,n.name);if(f!==void 0)throw new chunkL277YJLQ_js.h(`attribute "${n.name}" is used by view "${d.id}" (${f}); remove it from the view first`,[])}let a=e.sampleRecords.find(d=>d.objectId===n.objectId&&n.name in d.values);if(a)throw new chunkL277YJLQ_js.h(`Attribute "${n.name}" is still used by sample record "${a.id}"`,[]);let s=e.attributes.filter(d=>d!==n),u={...e,views:e.views.map(d=>d.objectName===r.name?uf(d,n.name):d)};return Vi(u,r,s)},"apply"),focus:lr,presentation:T(lr,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'attribut \xAB ${e.attribute} \xBB`,"describe")};function If(e,t,r,n){let o=ke(r);try{chunkTQLF3EZP_js.c(o);}catch{return}let a=chunkTQLF3EZP_js.g(o,n);if(a.success)return;let s=a.errors??[],u=s.map(d=>d.path.length>1?`${d.path.join(".")}: ${d.message}`:d.message).join(", ");throw new chunkL277YJLQ_js.h(`Sample record "${e}" has an invalid value for "${t}": ${u}`,s.map(d=>({path:d.path,message:d.message})))}chunkDPD6ZWL2_js.a(If,"assertSampleValue");function Hs(e,t,r){if(t.config?.required===true&&t.config?.defaultValue===void 0&&!(t.name in r&&r[t.name]!==void 0))throw new chunkL277YJLQ_js.h(`Sample record "${e}" is missing a value for required attribute "${t.name}"`,[])}chunkDPD6ZWL2_js.a(Hs,"assertRequiredCovered");function Mi(e){return (Array.isArray(e)?e:[e]).flatMap(r=>{if(typeof r=="string")return [r];if(typeof r=="object"&&r!==null){let n=r.id;if(typeof n=="string")return [n]}return []})}chunkDPD6ZWL2_js.a(Mi,"relationValueIds");function Sf(e,t,r,n){if(r.attributeType!=="relation"||n===void 0||n===null)return;let o=Ne(r),a=e.objects.find(u=>u.name===o);if(!a)return;let s=e.views.some(u=>u.id===fe(a.id).list);for(let u of Mi(n)){let d=e.sampleRecords.find(x=>x.id===u);if(d?.objectId!==a.id&&(d!==void 0||s))throw new chunkL277YJLQ_js.h(`sample record "${t}" references unknown sample "${u}"`,[])}}chunkDPD6ZWL2_js.a(Sf,"assertUnknownSampleReference");var vf=Ir.z.object({...be,type:Ir.z.literal("add_sample_record"),recordId:Ir.z.string().uuid(),values:Ir.z.record(Ir.z.string(),Ir.z.unknown()),publication:Ir.z.enum(["preview","requested-data"]).optional()}),Rf={type:"add_sample_record",schema:vf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(Pe(e,t.objectId),e.sampleRecords.some(n=>n.id===t.recordId))throw new chunkL277YJLQ_js.h(`Sample record "${t.recordId}" already exists`,[]);let r=new Map(e.attributes.filter(n=>n.objectId===t.objectId).map(n=>[n.name,n]));for(let[n,o]of Object.entries(t.values)){let a=r.get(n);if(!a)throw new chunkL277YJLQ_js.h(`Sample record "${t.recordId}" uses unknown attribute "${n}"`,[]);if(_e(a))throw new chunkL277YJLQ_js.h(`attribute "${a.name}" is computed and cannot be set on a sample record`,[]);Sf(e,t.recordId,a,o),If(t.recordId,n,a,o);}for(let n of r.values())Hs(t.recordId,n,t.values);return {...e,sampleRecords:[...e.sampleRecords,{id:t.recordId,objectId:t.objectId,values:t.values,...t.publication===void 0?{}:{publication:t.publication}}]}},"apply"),focus:ur,presentation:T(ur,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Ajoute un exemple","describe")};function Df(e,t){return new Set(e.attributes.filter(r=>r.objectId===t&&r.attributeType==="relation").map(r=>r.name))}chunkDPD6ZWL2_js.a(Df,"relationNamesOf");function Ef(e,t){for(let r of e.sampleRecords){if(r.id===t)continue;let n=Df(e,r.objectId);for(let[o,a]of Object.entries(r.values))if(n.has(o)&&Mi(a).includes(t))throw new chunkL277YJLQ_js.h(`sample record "${t}" is referenced by sample record "${r.id}"; remove that first`,[])}}chunkDPD6ZWL2_js.a(Ef,"assertSampleNotReferenced");var Of=Ir.z.object({...be,type:Ir.z.literal("remove_sample_record"),recordId:Ir.z.string().min(1)}),Cf={type:"remove_sample_record",schema:Of,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(!e.sampleRecords.some(r=>r.id===t.recordId&&r.objectId===t.objectId))throw new chunkL277YJLQ_js.h(`Sample record "${t.recordId}" is not in object "${t.objectId}"`,[]);return Ef(e,t.recordId),{...e,sampleRecords:e.sampleRecords.filter(r=>r.id!==t.recordId)}},"apply"),focus:ur,presentation:T(ur,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Retire un exemple","describe")},je=[pf,ff,gf,hf,Tf,xf,Rf,Cf];function _f(){let e=new Map;for(let t of [...je,...Oe,...Ce]){if(e.has(t.type))throw new chunkL277YJLQ_js.r("architect operation",t.type);e.set(t.type,t);}return e}chunkDPD6ZWL2_js.a(_f,"build");var it=_f(),Nf=[...it.keys()];function ot(e){let t=it.get(e.type);if(!t)throw new chunkL277YJLQ_js.h(`Operation "${e.id}" has unknown type "${e.type}"`,[]);return t}chunkDPD6ZWL2_js.a(ot,"defOf");function Li(e,t){return t.reduce((r,n)=>ot(n).apply(r,n),e)}chunkDPD6ZWL2_js.a(Li,"applyOperations");function Bi(e){return ot(e).focus(e)}chunkDPD6ZWL2_js.a(Bi,"focusOf");function kf(e,t){return e.map(r=>ot(r).describe(r,t))}chunkDPD6ZWL2_js.a(kf,"describeOperations");function Pf(e){if(typeof e!="object"||e===null||!("type"in e))throw new chunkL277YJLQ_js.h("An operation must be an object carrying a type",[]);let t=e.type;if(typeof t!="string")throw new chunkL277YJLQ_js.h("An operation's type must be a string",[]);let r=it.get(t);if(!r)throw new chunkL277YJLQ_js.h(`Unknown operation type "${t}"`,[]);let n=r.schema.safeParse(e);if(!n.success)throw new chunkL277YJLQ_js.h(`Operation "${t}" is invalid: ${n.error.issues.map(o=>`${o.path.join(".")} ${o.message}`).join("; ")}`,[]);return n.data}chunkDPD6ZWL2_js.a(Pf,"parseOperation");function $i(e){return ot(e).presentation(e)}chunkDPD6ZWL2_js.a($i,"presentationOf");function jf(e){let t=e.map($i);return new Set(t.map(({focus:n})=>n.viewId??n.objectId).filter(n=>n!==void 0)).size>1||t.some(({impact:n})=>n==="structural")?"structural":t.some(({impact:n})=>n==="local")?"local":"atomic"}chunkDPD6ZWL2_js.a(jf,"episodeImpactOf");function Ff(e,t){return e.config.tabs?.find(r=>r.id===t)}chunkDPD6ZWL2_js.a(Ff,"listTabOf");function Ys(e,t){let r=t.viewId?e.views.find(o=>o.id===t.viewId):void 0,n=t.tabId?r?.tabs.find(o=>o.id===t.tabId):void 0;if(t.attributeId)return e.attributes.find(o=>o.id===t.attributeId);if(t.attributeName)return e.attributes.find(o=>o.objectId===t.objectId&&o.name===t.attributeName);if(t.fieldId){if(n?.type!=="form")return;for(let o of n.groups){let a=o.fields.find(s=>s.id===t.fieldId);if(a)return a}return}if(t.groupId)return n?.type!=="form"?void 0:n.groups.find(o=>o.id===t.groupId);if(t.tabId)return r?n??Ff(r,t.tabId):void 0;if(t.recordId)return e.sampleRecords.find(o=>o.id===t.recordId);if(r)return r;if(t.objectId)return e.objects.find(o=>o.id===t.objectId)}chunkDPD6ZWL2_js.a(Ys,"snapshotArchitectTarget");function Vf(e,t){let r=e;return t.map(n=>{let o=$i(n),a=Ys(r,o.focus);r=Li(r,[n]);let s=Ys(r,o.focus);return {operationId:n.id,operationType:n.type,presentation:o,before:a,after:s}})}chunkDPD6ZWL2_js.a(Vf,"deriveArchitectChanges");function Qs(e){return e.attributeName&&e.objectId?`attribute:${e.objectId}:${e.attributeName}`:e.attributeId?`attribute-id:${e.attributeId}`:e.tabId&&e.viewId?`tab:${e.viewId}:${e.tabId}`:e.viewId?`view:${e.viewId}`:e.objectId?`object:${e.objectId}`:null}chunkDPD6ZWL2_js.a(Qs,"proposalTargetKey");function Mf(e,t){let r=new Set;for(let n of t){let o=Bi(n),a=Qs(o);a&&r.add(a),o.objectId&&r.add(`object:${o.objectId}`),o.viewId&&r.add(`view:${o.viewId}`);let s=e.views.find(x=>x.id===o.viewId),u=e.objects.find(x=>x.name===s?.objectName);u&&r.add(`object:${u.id}`),(n.type==="remove_object"||n.type.includes("sample_record"))&&o.objectId&&r.add(`object-tree:${o.objectId}`),n.type==="add_object"&&typeof n.name=="string"&&r.add(`object-name:${n.name}`);let d=n.type==="update_attribute"&&typeof n.changes=="object"&&n.changes!==null?n.changes:null,f=n.type==="add_attribute"?n.config:d&&"config"in d?d.config:void 0;if(f&&typeof f=="object"&&"targets"in f&&Array.isArray(f.targets))for(let x of f.targets)typeof x=="object"&&x!==null&&"object"in x&&typeof x.object=="string"&&x.object!=="*"&&r.add(`object-name:${x.object}`);}return [...r]}chunkDPD6ZWL2_js.a(Mf,"requiredTargetKeys");function Lf(e,t){return Object.fromEntries(t.map(r=>[r,chunk5667SMJ5_js.b(Bf(e,r))]))}chunkDPD6ZWL2_js.a(Lf,"targetTokensFor");function Bf(e,t){if(t.startsWith("object:"))return e.objects.find(r=>r.id===t.slice(7))??null;if(t.startsWith("object-name:"))return e.objects.find(r=>r.name===t.slice(12))??null;if(t.startsWith("object-tree:")){let r=t.slice(12),n=e.objects.find(o=>o.id===r);return n?{object:n,attributes:e.attributes.filter(o=>o.objectId===r),views:e.views.filter(o=>o.objectName===n.name),sampleRecords:e.sampleRecords.filter(o=>o.objectId===r)}:null}if(t.startsWith("attribute-id:"))return e.attributes.find(r=>r.id===t.slice(13))??null;if(t.startsWith("attribute:")){let r=t.slice(10),n=r.indexOf(":");if(n<0)throw new chunkL277YJLQ_js.h(`Invalid proposal target key "${t}"`,[]);return e.attributes.find(o=>o.objectId===r.slice(0,n)&&o.name===r.slice(n+1))??null}if(t.startsWith("view:"))return e.views.find(r=>r.id===t.slice(5))??null;if(t.startsWith("tab:")){let r=t.slice(4),n=e.views.find(a=>r.startsWith(`${a.id}:`));if(!n)return null;let o=r.slice(n.id.length+1);return (n.type==="list"?n.config.tabs:n.tabs)?.find(a=>a.id===o)??null}throw new chunkL277YJLQ_js.h(`Unknown proposal target key "${t}"`,[])}chunkDPD6ZWL2_js.a(Bf,"targetSnapshot");function $f(e){return {id:e.id??"",objectName:e.object,type:e.type,label:e.label,tabs:bt(e)?e.config.tabs??[]:[],config:e.config}}chunkDPD6ZWL2_js.a($f,"toDraftableView");function at(e){return e.type==="detail"?{...e.config,tabs:e.tabs}:e.config}chunkDPD6ZWL2_js.a(at,"persistedViewConfig");function Uf(e,t){return e.type==="detail"?{...e,label:t.label,config:at(t)}:{...e,label:t.label,config:at(t)}}chunkDPD6ZWL2_js.a(Uf,"fromDraftableView");function qf(e){let t={id:e.id,name:"default",label:e.label,object:e.objectName,default:true};return e.type==="detail"?{...t,type:"detail",config:at(e)}:{...t,type:"list",config:at(e)}}chunkDPD6ZWL2_js.a(qf,"draftedViewDefinition");var Js=Ir.z.object({type:Ir.z.literal("remove_operation"),operationId:Ir.z.string().min(1).describe("The id of a stored operation to drop from the draft")});function qi(e,t=[]){return [...e.map(r=>r.schema),...t].map(Gf)}chunkDPD6ZWL2_js.a(qi,"membersOf");function Fe(e){return Ir.z.discriminatedUnion("type",e)}chunkDPD6ZWL2_js.a(Fe,"unionOf");function zf(e){return e instanceof Ir.z.ZodString&&e.format==="uuid"}chunkDPD6ZWL2_js.a(zf,"isUuidString");function Gf(e){let t={};for(let[r,n]of Object.entries(e.shape)){if(!zf(n))continue;let o=Ir.z.string().min(1);t[r]=n.description===void 0?o:o.describe(n.description);}return Object.keys(t).length===0?e:e.safeExtend(t)}chunkDPD6ZWL2_js.a(Gf,"relaxUuidKeys");var Wf={add_object:["objectId"],add_sample_record:["recordId"]};function Ui(e){let t={};for(let r of Wf[e.shape.type.value]??[]){let n=e.shape[r];n instanceof Ir.z.ZodString&&(t[r]=n.optional());}return Object.keys(t).length===0?e:e.safeExtend(t)}chunkDPD6ZWL2_js.a(Ui,"relaxMintedKeys");var Xs=qi(je,[Js]),Zs=qi(Ce),eu=qi(Oe),tu=Fe(Xs),ru=Fe(Zs),nu=Fe(eu),Kf={schema:tu,"list-view":ru,"detail-view":nu},Hf={schema:Fe(Xs.map(Ui)),"list-view":Fe(Zs.map(Ui)),"detail-view":Fe(eu.map(Ui))},Yf=new Map([...je.map(e=>[e.type,"schema"]),["remove_operation","schema"],...Ce.map(e=>[e.type,"list-view"]),...Oe.map(e=>[e.type,"detail-view"])]);function Qf(e){return Yf.get(e)??null}chunkDPD6ZWL2_js.a(Qf,"familyOf");function Jf(e){let t=iu(e,"list"),r=iu(e,"detail"),n=e.objects.filter(s=>(t(s)?.config.tabs??[]).length===0).map(s=>`Object "${s.label}" has no list tab: draft_list_view add_list_tab.`),o=e.attributes.flatMap(s=>{if(s.attributeType!=="document")return [];let u=tt(e,s.objectId),d=u&&r(u);return !d||d.tabs.some(f=>f.type==="documents")?[]:[`Attribute "${s.label}" (document) on "${u.label}": the detail view has no Documents tab: draft_detail_view add_tab type "documents".`]}),a=e.attributes.flatMap(s=>{if(!chunkDBQCXRYQ_js.j(ke(s)).presentation.tableCell)return [];let u=tt(e,s.objectId);if(!u)return [];let d=t(u)?.config.tabs??[];return d.length===0||d.some(f=>f.columns.includes(s.name))?[]:[`Attribute "${s.label}" on "${u.label}" is in no column set of its list view: draft_list_view set_columns.`]});return [...n,...o,...a]}chunkDPD6ZWL2_js.a(Jf,"stillMissing");function iu(e,t){return r=>e.views.find(n=>n.type===t&&n.objectName===r.name)}chunkDPD6ZWL2_js.a(iu,"viewFinder");function Xf(e){let t=e.config??{};if(e.attributeType==="relation")return `\u2192 ${W(e).map(r=>r.object).join("|")}`;if(e.attributeType==="formula")return typeof t.expression=="string"?t.expression:void 0;if(e.attributeType==="rollup")return t.function==="count"?`count(${t.relationAttribute})`:`${t.function}(${t.relationAttribute}.${t.targetAttribute})`}chunkDPD6ZWL2_js.a(Xf,"attributeDetail");function Zf(e){let t=e.config?.options,r=Xf(e);return {name:e.name,label:e.label,type:e.attributeType,...Array.isArray(t)?{options:t.map(n=>n.value)}:{},...r===void 0?{}:{detail:r}}}chunkDPD6ZWL2_js.a(Zf,"summarizeAttribute");function eb(e,t,r){let n=fe(e.id),o=r.some(a=>a.id===n.list);return {id:e.id,name:e.name,label:e.label,attributes:t.filter(a=>a.objectId===e.id).map(Zf),...o?{viewIds:n}:{}}}chunkDPD6ZWL2_js.a(eb,"summarizeObject");function tb(e){return e.attribute??e.attributeGroup?.id??""}chunkDPD6ZWL2_js.a(tb,"fieldName");function rb(e){return e.type==="list"?(e.config.tabs??[]).map(r=>({id:r.id,label:r.label,columns:r.columns})):e.tabs.map(t=>{let r="groups"in t?t.groups:void 0;return {id:t.id,label:t.label,...r===void 0?{}:{groups:r.map(n=>({id:n.id,label:n.label,fields:n.fields.map(tb)}))}}})}chunkDPD6ZWL2_js.a(rb,"summarizeTab");function nb(e,t){let r=t.find(n=>n.name===e.objectName)?.id;if(r===void 0)throw new chunkL277YJLQ_js.h(`View "${e.id}" names object "${e.objectName}", which is not in the draft scope`,[]);return {id:e.id,type:e.type,objectId:r,label:e.label,derived:e.derived===true,tabs:rb(e)}}chunkDPD6ZWL2_js.a(nb,"summarizeView");function ib(e,t){let r=new Map;for(let n of e.sampleRecords)r.set(n.objectId,(r.get(n.objectId)??0)+1);return {objects:e.objects.map(n=>eb(n,e.attributes,e.views)),views:e.views.map(n=>nb(n,e.objects)),sampleRecords:[...r.entries()].map(([n,o])=>({objectId:n,count:o})),operationCount:t}}chunkDPD6ZWL2_js.a(ib,"summarizeDraft");var ob=["draft_schema","draft_list_view","draft_detail_view"],ab="publish_architect_draft",sb="discard_architect_draft",ub="request_design_review",lb="get_architect_draft";Object.defineProperty(exports,"NonJsonValueError",{enumerable:true,get:function(){return chunk5667SMJ5_js.a}});Object.defineProperty(exports,"asTenantId",{enumerable:true,get:function(){return chunk5667SMJ5_js.f}});Object.defineProperty(exports,"asUserId",{enumerable:true,get:function(){return chunk5667SMJ5_js.g}});Object.defineProperty(exports,"canonicalStringify",{enumerable:true,get:function(){return chunk5667SMJ5_js.b}});Object.defineProperty(exports,"deepEqual",{enumerable:true,get:function(){return chunk5667SMJ5_js.j}});Object.defineProperty(exports,"generateId",{enumerable:true,get:function(){return chunk5667SMJ5_js.h}});Object.defineProperty(exports,"indexBy",{enumerable:true,get:function(){return chunk5667SMJ5_js.i}});Object.defineProperty(exports,"sameStableValue",{enumerable:true,get:function(){return chunk5667SMJ5_js.e}});Object.defineProperty(exports,"serializeCanonicalJson",{enumerable:true,get:function(){return chunk5667SMJ5_js.d}});Object.defineProperty(exports,"serializeStableJson",{enumerable:true,get:function(){return chunk5667SMJ5_js.c}});Object.defineProperty(exports,"ATTRIBUTE_FILTER_OPERATORS",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.i}});Object.defineProperty(exports,"LIST_TAB_KANBAN_KEYS",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.sa}});Object.defineProperty(exports,"LIST_TAB_TABLE_KEYS",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ra}});Object.defineProperty(exports,"LIST_VIEW_TAB_VISIBILITIES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.y}});Object.defineProperty(exports,"LOCATION_FILTER_PROPERTIES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.f}});Object.defineProperty(exports,"NATIVE_OBJECT_NAMES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.v}});Object.defineProperty(exports,"NO_VALUE_OPERATORS",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.s}});Object.defineProperty(exports,"OPERATORS_BY_TYPE",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.r}});Object.defineProperty(exports,"REMOVED_OPERATOR_REPLACEMENTS",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.W}});Object.defineProperty(exports,"RESERVED_ATTRIBUTE_NAMES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.B}});Object.defineProperty(exports,"RESERVED_OBJECT_NAMES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.C}});Object.defineProperty(exports,"RESOURCE_VISIBILITIES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.x}});Object.defineProperty(exports,"SYNONYM_ALIASES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.O}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.c}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTE_I18N_KEYS",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.a}});Object.defineProperty(exports,"SYSTEM_FIELD_NAMES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.A}});Object.defineProperty(exports,"SYSTEM_FILTER_ATTRIBUTE_TYPES",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.V}});Object.defineProperty(exports,"canonicalizeFilterValue",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.N}});Object.defineProperty(exports,"collectQualifiedRuleIssues",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.X}});Object.defineProperty(exports,"columnsSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.Z}});Object.defineProperty(exports,"currentActor",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.E}});Object.defineProperty(exports,"detailTabDraftSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ka}});Object.defineProperty(exports,"detailTabSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ja}});Object.defineProperty(exports,"detailViewConfigSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.na}});Object.defineProperty(exports,"displayAttributesSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js._}});Object.defineProperty(exports,"extractCurrencyFilterValue",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.H}});Object.defineProperty(exports,"extractFilterValue",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.I}});Object.defineProperty(exports,"fieldSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.da}});Object.defineProperty(exports,"fieldShape",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ca}});Object.defineProperty(exports,"fieldSlotSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ea}});Object.defineProperty(exports,"filterGroupSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ba}});Object.defineProperty(exports,"filterStateSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.aa}});Object.defineProperty(exports,"getAttributeCapabilities",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.j}});Object.defineProperty(exports,"getAttributeFilterOperators",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.k}});Object.defineProperty(exports,"getOperatorPolarity",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.J}});Object.defineProperty(exports,"getRollupFilterOperators",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.u}});Object.defineProperty(exports,"getSystemAttributeI18nKey",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.b}});Object.defineProperty(exports,"getSystemAttributeList",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.d}});Object.defineProperty(exports,"groupWriteSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.fa}});Object.defineProperty(exports,"inverseSourceSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ha}});Object.defineProperty(exports,"isAttributeFilterable",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.l}});Object.defineProperty(exports,"isAttributeGroupable",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.o}});Object.defineProperty(exports,"isAttributeKanbanGroupable",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.p}});Object.defineProperty(exports,"isAttributeSearchable",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.m}});Object.defineProperty(exports,"isDynamicValue",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.D}});Object.defineProperty(exports,"isLocationFilterProperty",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.g}});Object.defineProperty(exports,"isLocationPartOperator",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.h}});Object.defineProperty(exports,"isManagedSystemAttribute",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.e}});Object.defineProperty(exports,"isNativeObjectName",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.w}});Object.defineProperty(exports,"isNoValueOperator",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.t}});Object.defineProperty(exports,"isRelativeDateValue",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.R}});Object.defineProperty(exports,"isSetMembershipOperator",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.M}});Object.defineProperty(exports,"listViewConfigSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ma}});Object.defineProperty(exports,"listViewTabSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.la}});Object.defineProperty(exports,"normalizeFilterRule",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.Q}});Object.defineProperty(exports,"normalizeForEdgeRpc",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.K}});Object.defineProperty(exports,"normalizeOperator",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.P}});Object.defineProperty(exports,"now",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.G}});Object.defineProperty(exports,"parseResourceVisibility",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.z}});Object.defineProperty(exports,"parseViewConfig",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.qa}});Object.defineProperty(exports,"relationSourceSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ga}});Object.defineProperty(exports,"resolveEffectiveFilterType",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.q}});Object.defineProperty(exports,"resolveIsWithinBounds",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.S}});Object.defineProperty(exports,"resolveUtcDayBounds",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.T}});Object.defineProperty(exports,"sortsSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.$}});Object.defineProperty(exports,"tableSourceSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.ia}});Object.defineProperty(exports,"toMultiValueOperator",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.L}});Object.defineProperty(exports,"toUtcDayString",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.U}});Object.defineProperty(exports,"today",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.F}});Object.defineProperty(exports,"validateQualifiedRule",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.Y}});Object.defineProperty(exports,"viewConfigByTypeSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.pa}});Object.defineProperty(exports,"viewTypeSchema",{enumerable:true,get:function(){return chunkDBQCXRYQ_js.oa}});Object.defineProperty(exports,"ComputedFormulaParseError",{enumerable:true,get:function(){return chunkIJPA4GYV_js.d}});Object.defineProperty(exports,"SCHEMA_LIMITS",{enumerable:true,get:function(){return chunkIJPA4GYV_js.a}});Object.defineProperty(exports,"attributeConfigSchemas",{enumerable:true,get:function(){return chunkIJPA4GYV_js.j}});Object.defineProperty(exports,"colorIdSchema",{enumerable:true,get:function(){return chunkIJPA4GYV_js.b}});Object.defineProperty(exports,"iconNameSchema",{enumerable:true,get:function(){return chunkIJPA4GYV_js.c}});Object.defineProperty(exports,"multiselectOptionWriteSchema",{enumerable:true,get:function(){return chunkIJPA4GYV_js.h}});Object.defineProperty(exports,"parseAttributeConfig",{enumerable:true,get:function(){return chunkIJPA4GYV_js.l}});Object.defineProperty(exports,"parseAttributeConfigForCreate",{enumerable:true,get:function(){return chunkIJPA4GYV_js.n}});Object.defineProperty(exports,"parseAttributeConfigForUpdate",{enumerable:true,get:function(){return chunkIJPA4GYV_js.o}});Object.defineProperty(exports,"parseComputedFormula",{enumerable:true,get:function(){return chunkIJPA4GYV_js.e}});Object.defineProperty(exports,"selectOptionWriteSchema",{enumerable:true,get:function(){return chunkIJPA4GYV_js.g}});Object.defineProperty(exports,"statusGroupSchema",{enumerable:true,get:function(){return chunkIJPA4GYV_js.f}});Object.defineProperty(exports,"statusOptionWriteSchema",{enumerable:true,get:function(){return chunkIJPA4GYV_js.i}});Object.defineProperty(exports,"createFormAttributeValidator",{enumerable:true,get:function(){return chunkTQLF3EZP_js.d}});Object.defineProperty(exports,"isNullishOrEmptyString",{enumerable:true,get:function(){return chunkTQLF3EZP_js.a}});Object.defineProperty(exports,"isValuePresent",{enumerable:true,get:function(){return chunkTQLF3EZP_js.b}});Object.defineProperty(exports,"rejectUnknownAttributesOrThrow",{enumerable:true,get:function(){return chunkTQLF3EZP_js.l}});Object.defineProperty(exports,"validateDraft",{enumerable:true,get:function(){return chunkTQLF3EZP_js.j}});Object.defineProperty(exports,"validateDraftOrThrow",{enumerable:true,get:function(){return chunkTQLF3EZP_js.k}});Object.defineProperty(exports,"validateObject",{enumerable:true,get:function(){return chunkTQLF3EZP_js.h}});Object.defineProperty(exports,"validateObjectOrThrow",{enumerable:true,get:function(){return chunkTQLF3EZP_js.i}});Object.defineProperty(exports,"createCheckboxValidator",{enumerable:true,get:function(){return chunk47KVYDKG_js.a}});Object.defineProperty(exports,"createDateValidator",{enumerable:true,get:function(){return chunkKLR22JMC_js.a}});Object.defineProperty(exports,"AccessDeniedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.C}});Object.defineProperty(exports,"AttributeInUseError",{enumerable:true,get:function(){return chunkL277YJLQ_js.I}});Object.defineProperty(exports,"AttributeNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.e}});Object.defineProperty(exports,"ChangeTypeNotSupportedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.q}});Object.defineProperty(exports,"ConcurrentModificationError",{enumerable:true,get:function(){return chunkL277YJLQ_js.A}});Object.defineProperty(exports,"DestructiveSyncNotAllowedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.o}});Object.defineProperty(exports,"DuplicateError",{enumerable:true,get:function(){return chunkL277YJLQ_js.r}});Object.defineProperty(exports,"ForbiddenError",{enumerable:true,get:function(){return chunkL277YJLQ_js.x}});Object.defineProperty(exports,"MemoryNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.G}});Object.defineProperty(exports,"MigrationTimeoutError",{enumerable:true,get:function(){return chunkL277YJLQ_js.p}});Object.defineProperty(exports,"NotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.c}});Object.defineProperty(exports,"NotImplementedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.F}});Object.defineProperty(exports,"ObjectNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.d}});Object.defineProperty(exports,"ObjectReferencedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.J}});Object.defineProperty(exports,"OrphanSystemAttributeError",{enumerable:true,get:function(){return chunkL277YJLQ_js.n}});Object.defineProperty(exports,"ProtectedResourceError",{enumerable:true,get:function(){return chunkL277YJLQ_js.i}});Object.defineProperty(exports,"ProtectedRoleError",{enumerable:true,get:function(){return chunkL277YJLQ_js.y}});Object.defineProperty(exports,"RecordNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.f}});Object.defineProperty(exports,"RecordReferencedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.H}});Object.defineProperty(exports,"RepositoryError",{enumerable:true,get:function(){return chunkL277YJLQ_js.D}});Object.defineProperty(exports,"ReservedObjectNameError",{enumerable:true,get:function(){return chunkL277YJLQ_js.s}});Object.defineProperty(exports,"RoleNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.z}});Object.defineProperty(exports,"SchemaError",{enumerable:true,get:function(){return chunkL277YJLQ_js.b}});Object.defineProperty(exports,"SchemaErrorCode",{enumerable:true,get:function(){return chunkL277YJLQ_js.a}});Object.defineProperty(exports,"SchemaPlanNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.g}});Object.defineProperty(exports,"SearchBackendError",{enumerable:true,get:function(){return chunkL277YJLQ_js.E}});Object.defineProperty(exports,"StorageError",{enumerable:true,get:function(){return chunkL277YJLQ_js.B}});Object.defineProperty(exports,"SyncCascadeError",{enumerable:true,get:function(){return chunkL277YJLQ_js.m}});Object.defineProperty(exports,"SyncConflictError",{enumerable:true,get:function(){return chunkL277YJLQ_js.l}});Object.defineProperty(exports,"SyncError",{enumerable:true,get:function(){return chunkL277YJLQ_js.j}});Object.defineProperty(exports,"SystemEntityImmutableError",{enumerable:true,get:function(){return chunkL277YJLQ_js.k}});Object.defineProperty(exports,"ValidationError",{enumerable:true,get:function(){return chunkL277YJLQ_js.h}});Object.defineProperty(exports,"isAttributeInUseError",{enumerable:true,get:function(){return chunkL277YJLQ_js.L}});Object.defineProperty(exports,"isNotFoundError",{enumerable:true,get:function(){return chunkL277YJLQ_js.u}});Object.defineProperty(exports,"isObjectReferencedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.M}});Object.defineProperty(exports,"isProtectedResourceError",{enumerable:true,get:function(){return chunkL277YJLQ_js.w}});Object.defineProperty(exports,"isRecordReferencedError",{enumerable:true,get:function(){return chunkL277YJLQ_js.K}});Object.defineProperty(exports,"isSchemaError",{enumerable:true,get:function(){return chunkL277YJLQ_js.t}});Object.defineProperty(exports,"isValidationError",{enumerable:true,get:function(){return chunkL277YJLQ_js.v}});Object.defineProperty(exports,"TEXT_FORMAT_PATTERNS",{enumerable:true,get:function(){return chunkXHEBV2HE_js.a}});Object.defineProperty(exports,"createTextValidator",{enumerable:true,get:function(){return chunkXHEBV2HE_js.c}});Object.defineProperty(exports,"resolveTextPattern",{enumerable:true,get:function(){return chunkXHEBV2HE_js.b}});Object.defineProperty(exports,"createNumberValidator",{enumerable:true,get:function(){return chunkSLYRQ72J_js.a}});Object.defineProperty(exports,"DEFAULT_VALIDATION_MESSAGES",{enumerable:true,get:function(){return chunkJFSQ24XR_js.a}});Object.defineProperty(exports,"formatZodErrors",{enumerable:true,get:function(){return chunkJFSQ24XR_js.b}});exports.AGENT_UI_BATCH_MAX_BYTES=tI;exports.AGENT_UI_BATCH_MAX_ITEMS=rI;exports.ALLOWED_PROPERTY_TYPES=Fo;exports.ALL_ACTIONS=Ar;exports.ALL_OPERATION_TYPES=Nf;exports.ALL_SYSTEM_RESOURCES=TT;exports.ARTIFACT_FILE_ROLES=zy;exports.ARTIFACT_KINDS=Uy;exports.ARTIFACT_LIST_VIEW=ed;exports.ARTIFACT_OBJECT=Jl;exports.ARTIFACT_OBJECT_NAME=Pt;exports.ARTIFACT_RETENTIONS=qy;exports.ARTIFACT_VIEW=Xl;exports.ATTRIBUTE_TYPES=To;exports.AUDIT_ACTIONS=ay;exports.AUDIT_RESOURCE_TYPES=oy;exports.ActivityTabConfig=Tn;exports.AgentBuilder=vr;exports.BEHAVIOR_PROPERTIES=Yg;exports.BYTE_UNIT_LABELS=Wu;exports.CLAIMABLE_SESSION_STATUSES=_u;exports.COMPUTED_FUNCTIONS=Qe;exports.COMPUTED_FUNCTION_METADATA=VI;exports.COMPUTED_FUNCTION_NAMES=hI;exports.CONNECTOR_CALLBACK_PARAM=lS;exports.COUNT_MODES=Po;exports.ComputedFormulaCompileError=g;exports.CustomTabConfig=hn;exports.DB_COLUMN_FIELDS=hT;exports.DEFAULT_AGENT_EXECUTION_CONFIG=Xo;exports.DEFAULT_APPROVAL_POLICY=xo;exports.DEFAULT_DICTATION_LIMITS=By;exports.DEFAULT_LABEL_FALLBACK=Bo;exports.DEFAULT_MEETING_BOT_DISPLAY_NAME=Bu;exports.DEFAULT_ROLES=wl;exports.DEFAULT_ROLE_DESCRIPTIONS=IT;exports.DEFAULT_ROLE_LABELS=xT;exports.DEFAULT_ROLE_PERMISSIONS=ST;exports.DEFAULT_TENANT_SETTINGS=Th;exports.DETAIL_VIEW_OPERATIONS=Oe;exports.DETAIL_VIEW_OPERATION_INPUT=nu;exports.DICTATION_FINALIZATION_TIMEOUT_MS=My;exports.DICTATION_FRAME_BYTES=Ny;exports.DICTATION_MAX_BUFFER_BYTES=Py;exports.DICTATION_MAX_FRAME_BYTES=ky;exports.DICTATION_MAX_TRANSCRIPT_BYTES=jy;exports.DICTATION_MODEL_ID=Ly;exports.DICTATION_PREPARATION_TIMEOUT_MS=Vy;exports.DICTATION_SAMPLE_RATE=_y;exports.DICTATION_TICKET_TTL_MS=Fy;exports.DISCARD_ARCHITECT_DRAFT_TOOL_NAME=sb;exports.DOCUMENT_SYSTEM_ATTRIBUTES=jA;exports.DRAFTABLE_ATTRIBUTE_TYPES=zs;exports.DRAFT_WRITE_TOOL_NAMES=ob;exports.DRIVE_LIST_VIEW=Ql;exports.DRIVE_OBJECT=Hl;exports.DRIVE_OBJECT_NAME=kt;exports.DRIVE_VIEW=Yl;exports.DetailViewBuilder=Sn;exports.DocumentsTabConfig=In;exports.EMPTY_VALUE_PLACEHOLDER=yt;exports.ESTIMATED_COUNT_CAP=Ph;exports.EmailsTabConfig=wn;exports.FAKE_MEETING_BOT_SIGNATURE_HEADER=fS;exports.FAMILY_INPUTS=Kf;exports.FAMILY_WIRE_INPUTS=Hf;exports.FORM_FORBIDDEN_ATTRIBUTE_TYPES=gr;exports.FlagRegistry=ze;exports.FlagService=Nt;exports.FormBuilder=pn;exports.FormRegistry=Ye;exports.FormRowBuilder=dn;exports.FormStepBuilder=cn;exports.GET_ARCHITECT_DRAFT_TOOL_NAME=lb;exports.GroupBuilder=Dt;exports.IDENTITY_PROPERTIES=Hg;exports.IMAGE_FORMATS=Ch;exports.INFERENCE_REASONING_OPTIONS=vo;exports.INFERENCE_SPEEDS=So;exports.LIST_VIEW_OPERATIONS=Ce;exports.LIST_VIEW_OPERATION_INPUT=ru;exports.LIVE_EVENT_TYPES=gd;exports.ListViewBuilder=vn;exports.ListViewTabConfigBuilder=Rn;exports.MAX_PRESET_DEPTH=Eo;exports.MAX_TODOS=wy;exports.MAX_TODO_DESCRIPTION_CHARS=Iy;exports.MAX_TODO_ID_CHARS=xy;exports.MEETING_ATTRIBUTES=h;exports.MEETING_DETAIL_VIEW_ID=da;exports.MEETING_LIST_VIEW=nd;exports.MEETING_LIST_VIEW_ID=ua;exports.MEETING_OBJECT=td;exports.MEETING_OBJECT_NAME=jt;exports.MEETING_VIEW=rd;exports.MEETING_WRITE_SOURCE=la;exports.MEMORY_LIST_VIEW=Kl;exports.MEMORY_OBJECT=Gl;exports.MEMORY_VIEW=Wl;exports.McpOAuthCompletionMode=ip;exports.MeetingsTabConfig=xn;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_KEY=Pu;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION=ju;exports.NOTIFICATION_INBOX_STATES=ho;exports.NOTIFICATION_KINDS=bo;exports.NOTIFICATION_PRIORITIES=go;exports.NOTIFICATION_SENSITIVITIES=yo;exports.NOTIFICATION_TYPES_V1=Wg;exports.NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED=Ou;exports.NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN=Du;exports.NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED=Eu;exports.NOTIFICATION_WORK_STATES=Ao;exports.NO_RECORDING=bS;exports.NoopGeocodingAdapter=_o;exports.OBJECT_NAME_SCHEMA=Tt;exports.OPEN_TOOL_PART_STATES=Nu;exports.OPERATION_REGISTRY=it;exports.OPERATOR_SPECS=Qt;exports.ObjectBuilder=qe;exports.PRESENTATION_PROPERTIES=Qg;exports.PROVIDER_NAMES=Io;exports.PUBLISH_ARCHITECT_DRAFT_TOOL_NAME=ab;exports.QUALIFIED_SEPARATOR=UA;exports.QUOTA_KEYS=Vh;exports.RECORDING_OVERRIDES=pS;exports.RECORDING_POLICIES=mS;exports.RECORD_CREATOR_ROOT_ACTOR_METADATA_KEY=Wo;exports.RELATION_TARGET_ANY=ee;exports.REMOVE_OPERATION_SCHEMA=Js;exports.REQUEST_DESIGN_REVIEW_TOOL_NAME=ub;exports.RichtextTabConfig=An;exports.SCHEMA_OPERATIONS=je;exports.SCHEMA_OPERATION_INPUT=tu;exports.SCHEMA_PLAN_LIMITS=z;exports.SCHEMA_SOURCE_ID_PATTERN=Ii;exports.SESSION_STATE_STREAM_ID=Dy;exports.SESSION_TERMINAL_STATUSES=Cu;exports.SKILL_CONTENT_TEMPLATE=oa;exports.SKILL_LIST_VIEW=Ul;exports.SKILL_OBJECT=Bl;exports.SKILL_VIEW=$l;exports.STANDARD_SCHEMA_VENDOR=Rl;exports.SYSTEM_PART_CODES=br;exports.SYSTEM_RESOURCES=$;exports.SYSTEM_RESOURCE_LABELS=wT;exports.TODAY_DEFAULT=Ua;exports.TODO_PLAN_STATUSES=fy;exports.TODO_STATUSES=Ty;exports.TOOL_APPROVAL_STATES=Ro;exports.TabBuilder=te;exports.TableTabConfig=Et;exports.UPDATE_TABLE_TAB_CHANGE_KEYS=am;exports.UPDATE_TAB_CHANGE_KEYS=Lp;exports.UPDATE_TAB_CONFIG_CHANGE_KEYS=sm;exports.USER_STATUSES=xh;exports.USER_WORK_POSTURES=Ih;exports.accessLevelToActions=fh;exports.actionsToAccessLevel=mh;exports.agent=VT;exports.agentDataChunk=KS;exports.agentDisplayName=by;exports.agentInferencePreferencesSchema=zS;exports.agentMessageAttachmentSchema=xp;exports.agentMessagePartSchema=wp;exports.agentSessionInferenceOverridesInputSchema=Tp;exports.agentSessionInferenceOverridesSchema=GS;exports.agentSessionMessageSchema=os;exports.agentUIValidationError=Op;exports.applyOperations=Li;exports.applyPipes=ul;exports.applyRelationProps=ml;exports.architectDraftChannelKey=aI;exports.assertAcyclicComputed=_i;exports.assertAcyclicComputedDependencies=va;exports.assertBilateralPairs=Jm;exports.assertCustomAgentUIMessageChunk=Cp;exports.assertSchemaSourceId=sp;exports.bilateralDeclarationOf=nt;exports.booleanFlag=Cl;exports.buildAgentFallbackTitle=za;exports.buildPermissionFlags=Tl;exports.buildPropertySchema=gt;exports.buildQualifiedAttribute=zA;exports.checkbox=Zo;exports.compareAgentSessionMessages=ku;exports.compilablePlansOf=rt;exports.compileComputedFormula=Ut;exports.compileRollupAttribute=Oa;exports.computeByteMagnitude=Gu;exports.computedCompileSchemaOf=Ci;exports.computedPlanOf=or;exports.conversationDisplayTitle=ap;exports.createFlagRegistry=jl;exports.createFlagService=Vl;exports.createStandardSchemaProps=xt;exports.currency=QT;exports.customDataChunkSchemas=ds;exports.date=q;exports.dateInTimezone=Jt;exports.dateValueStart=Te;exports.defaultViewIdsFor=fe;exports.defaultViewsFor=ji;exports.defineOperation=Xt;exports.definePresentation=T;exports.dependentsOf=Ni;exports.deriveArchitectChanges=Vf;exports.deriveCreateDefaultsFromFilters=aS;exports.deriveInitials=hl;exports.describeOperations=kf;exports.destructiveSchema=es;exports.detailView=Y;exports.document=ea;exports.draftedLabelExpression=Ms;exports.draftedObjectDefinition=ar;exports.draftedViewDefinition=qf;exports.durableDateSchema=vp;exports.ensureFieldIds=ki;exports.episodeImpactOf=jf;exports.evaluateComputedAst=NI;exports.evaluateComputedFormula=kI;exports.evaluateComputedFormulaWithResult=PI;exports.evaluateFilterState=Jc;exports.evaluateRecordFilterState=XI;exports.extractAttributeNames=qo;exports.extractValueRefs=Go;exports.familyOf=Qf;exports.flagRegistry=Pl;exports.focusOf=Bi;exports.form=lw;exports.formFieldFlatKey=Lu;exports.formFieldKey=Mu;exports.formRegistry=ma;exports.formatAgentStreamFrameId=Jx;exports.formatAttributeValue=Vo;exports.formatByteSize=CA;exports.formatComputedResult=Wc;exports.formatLocationValue=el;exports.formula=tw;exports.fromDraftableView=Uf;exports.generateDefaultDetailView=Ke;exports.generateDefaultListView=He;exports.getActiveTab=Bx;exports.getEditableLabelAttribute=cl;exports.getErrorMessage=Ky;exports.getListViewDisplayAttributeNames=Ku;exports.getLiveProtocolPayloadChannel=fI;exports.getRecordCreatorPrincipalId=Al;exports.getSingleAttributeFromExpression=zo;exports.getSlotFieldTargets=Co;exports.getUserDisplayName=gl;exports.group=Ew;exports.hasDestructiveEntries=SS;exports.hasOptions=yh;exports.imageModelIdSchema=us;exports.includesAction=xe;exports.inferInverseCardinality=ty;exports.inferRollupReturnType=Nc;exports.inferenceReasoningSchema=Di;exports.inferenceSpeedSchema=Ri;exports.isAgentUIDataName=Ep;exports.isAgentUIMessageBatch=nI;exports.isAttributeSortable=ry;exports.isBilateralRelation=ey;exports.isCheckboxEquality=$I;exports.isClaimableSessionStatus=my;exports.isComputedAttribute=_e;exports.isComputedFunctionName=Bt;exports.isDateRangeValue=ne;exports.isDefaultRole=vT;exports.isDetailView=bt;exports.isDocumentAttribute=FA;exports.isEmptyObject=qu;exports.isFieldGroup=$u;exports.isFormDefinition=Jy;exports.isFormFieldsRow=ft;exports.isFormFreeFieldRef=yr;exports.isFormHeadingRow=ih;exports.isFormSeparatorRow=oh;exports.isFormSlotFieldRef=Oo;exports.isFormTextRow=ah;exports.isLabelExpression=At;exports.isListView=ko;exports.isLiveEventEnvelope=bI;exports.isLiveEventPayload=dI;exports.isLiveEventPayloadForType=vd;exports.isLiveEventType=Sd;exports.isNotEmpty=jo;exports.isOpenToolPartState=gy;exports.isPlainRecord=Pa;exports.isStandardSchema=BT;exports.isSystemPartCode=hy;exports.isTerminalSessionStatus=py;exports.isTerminalState=ly;exports.isToolApprovalState=yy;exports.isUniversalRelation=wo;exports.jsonFlag=kl;exports.legacyStatusToSessionState=cy;exports.listView=Q;exports.liveChannelKey=ba;exports.location=ZT;exports.makeFieldId=Vs;exports.matchesAccepts=VA;exports.mentionReferenceSchema=Ip;exports.modelDefinitionSchema=Sp;exports.modelReferenceSchema=ss;exports.multiselect=XT;exports.nativeAgentUIPartIdMetadataKey=Vu;exports.normalizeDateValue=Hu;exports.number=St;exports.numberFlag=Nl;exports.object=ww;exports.orderAgentSessionMessages=Ay;exports.parseAgentStreamFrameId=Xx;exports.parseCountMode=Uu;exports.parseLiveChannelKey=ga;exports.parseNativeAgentUIPartIdsMetadata=Ey;exports.parseOperation=Pf;exports.parseOptionalCountMode=kh;exports.parseQualifiedAttribute=qA;exports.persistedDefaultViewTargetSchema=bp;exports.persistedSchemaPlanSchema=MS;exports.persistedViewConfig=at;exports.phone=YT;exports.plannedAttributeSchema=cp;exports.plannedInlineAttributeSchema=pp;exports.plannedObjectSchema=mp;exports.presentationOf=$i;exports.proposalTargetKey=Qs;exports.proposedDefaultViewTargetSchema=fp;exports.providerNameSchema=as;exports.qualifiedPropertyDefs=bl;exports.readFormFieldValue=th;exports.regenerateDerived=Fi;exports.registry=rx;exports.relation=Se;exports.relationPropertyDefs=fl;exports.relationTargetObjectName=Ne;exports.relationTargets=W;exports.relationTargetsOf=Zg;exports.relationValueIds=Mi;exports.renderLabelExpression=wr;exports.requiredTargetKeys=Mf;exports.resetViewToDefault=cd;exports.resolveAttributeDefaultValue=rp;exports.resolveFieldRequired=eh;exports.resolvePropertyDefinitions=No;exports.richtext=ie;exports.rollup=rw;exports.rollupToFormulaExpression=_c;exports.schemaPlanSchema=VS;exports.select=H;exports.sessionInferencePatchSchema=WS;exports.sessionStateToLegacyStatus=dy;exports.status=JT;exports.stillMissing=Jf;exports.stringFlag=_l;exports.summarizeDraft=ib;exports.targetTokensFor=Lf;exports.text=b;exports.toAttribute=ke;exports.toDraftableAttributes=tf;exports.toDraftableObject=ef;exports.toDraftableView=$f;exports.toUndefinedIfEmpty=zu;exports.todoItemSchema=Rp;exports.todoPlanSchema=Dp;exports.toolImpactSchema=ls;exports.user=ew;exports.validateAttributeName=Ue;exports.validateLabelExpression=sl;exports.validateObjectExpressions=El;exports.validateObjectName=$e;exports.validateViewName=wt;exports.viewIdFor=Pi;exports.viewRegistry=id;exports.viewStateKey=vh;exports.viewSyncPayload=up;
|
|
59
|
+
{{ summary }}`).attribute(b({name:h.title,label:"Title"}).required()).attribute(ie({name:h.description,label:"Description"})).attribute(ie({name:h.summary,label:"Summary"}).hidden()).attribute(ie({name:h.transcript,label:"Transcript"}).hidden()).attribute(b({name:h.location,label:"Location"})).attribute(q({name:h.startsAt,label:"Starts at"}).includeTime()).attribute(q({name:h.endsAt,label:"Ends at"}).includeTime()).attribute(Zo({name:h.isAllDay,label:"All day"})).attribute(H({name:h.status,label:"Status"}).options([{value:"confirmed",label:"Confirmed"},{value:"tentative",label:"Tentative"},{value:"cancelled",label:"Cancelled"}])).attribute(b({name:h.organizerAddress,label:"Organizer address"}).email()).attribute(b({name:h.organizerName,label:"Organizer"})).attribute(b({name:h.conferenceProvider,label:"Conference provider"})).attribute(b({name:h.conferenceJoinUrl,label:"Join link"}).url()).attribute(b({name:h.htmlLink,label:"Open in calendar"}).url()).attribute(b({name:h.participants,label:"Participants"}).multiline()).attribute(b({name:h.providerEventId,label:"Provider event id"}).hidden()).attribute(b({name:h.icalUid,label:"iCal UID"}).hidden()).attribute(b({name:h.recurringEventId,label:"Recurring event id"}).hidden()).attribute(b({name:h.connectionId,label:"Connection id"})).attribute(H({name:h.recordingOverride,label:"Recording"}).options([{value:"force",label:"Force"},{value:"skip",label:"Skip"}]).hidden()).attribute(q({name:h.endedAnnouncedAt,label:"Ended announced at"}).includeTime().hidden()).attribute(Se({name:h.linkedRecords,label:"Linked records"}).toAny().many().qualifyWith(b({name:"source",label:"Source"}).hidden())).build(),rd=k(Y(da,"Meeting").for(jt).default().sidePanel({attributes:[h.startsAt,h.endsAt,h.linkedRecords]}).tab("description","Description").richtext(h.description).tab("summary","Summary").richtext(h.summary).tab("transcript","Transcript").richtext(h.transcript).titleAttribute(h.title).build()),nd=k(Q(ua,"Meetings").for(jt).default().tab("workspace","Shared").default().icon("users").visibility("workspace").table().columns(...sa).sort(h.startsAt,"desc").tab("mine","My meetings").icon("lock").visibility("private").table().columns(...sa).sort(h.startsAt,"desc").build());function Ge(e){return structuredClone(e)}chunkDPD6ZWL2_js.a(Ge,"cloneViewDefinition");var si=class si{constructor(){this.views=new Map;this.byObject=new Map;this.byObjectAndType=new Map;}register(t){let r=Array.isArray(t)?t:[t];for(let n of r)this.registerSingle(n);return this}registerSingle(t){let r=this.makeKey(t.object,t.name,t.type);if(this.views.has(r)){let u=`[ViewRegistry] Duplicate view: "${t.name}" (${t.type}) for object "${t.object}"`;throw new chunkJSKLP4GI_js.r("view",r,u)}let n=Ge(t);this.views.set(r,n);let o=this.byObject.get(n.object)??[];o.push(n),this.byObject.set(n.object,o);let a=`${n.object}:${n.type}`,s=this.byObjectAndType.get(a)??[];s.push(n),this.byObjectAndType.set(a,s);}getByObjectName(t){return Array.from(this.byObject.get(t)??[],Ge)}getByObjectNameAndType(t,r){return Array.from(this.byObjectAndType.get(`${t}:${r}`)??[],Ge)}get(t,r,n){if(n){let a=this.views.get(this.makeKey(t,r,n));return a?Ge(a):void 0}return this.getByObjectName(t).find(a=>a.name===r)}getOrThrow(t,r,n){let o=this.get(t,r,n);if(!o){let s=this.getByObjectName(t).map(d=>`${d.name} (${d.type})`).join(", ")||"(none)",u=`[ViewRegistry] View "${r}" not found for object "${t}".
|
|
60
|
+
Available views: ${s}`;throw new chunkJSKLP4GI_js.c("View",`${t}:${r}`,void 0,u)}return o}getAll(){return Array.from(this.views.values(),Ge)}has(t,r,n){return n?this.views.has(this.makeKey(t,r,n)):this.getByObjectName(t).some(a=>a.name===r)}hasObject(t){return this.byObject.has(t)}get size(){return this.views.size}listObjectNames(){return Array.from(this.byObject.keys())}getDefault(t,r){let n=this.getByObjectNameAndType(t,r);return n.find(o=>o.default)??n[0]}clear(){this.views.clear(),this.byObject.clear(),this.byObjectAndType.clear();}summary(){let t=[];t.push(`[ViewRegistry] ${this.size} view(s) registered:`);for(let r of this.listObjectNames()){let o=this.getByObjectName(r).map(a=>{let s=[];a.default&&s.push("default");let u=s.length>0?` (${s.join(", ")})`:"";return `${a.name}:${a.type}${u}`});t.push(` ${r}: ${o.join(", ")}`);}return t.join(`
|
|
61
|
+
`)}debug(t){let r=this.summary();return t?.(r),r}makeKey(t,r,n){return `${t}:${r}:${n}`}};chunkDPD6ZWL2_js.a(si,"ViewRegistry");var ai=si,id=new ai;function ca(e,t=[]){return e.filter(r=>!(!chunkJRBNMHMY_js.j(r).lifecycle.visibleInRuntime||r.system||t.includes(r.name)))}chunkDPD6ZWL2_js.a(ca,"getRuntimeAttributes");function pa(e){return [...e].sort((t,r)=>{let n=t.order??999,o=r.order??999;return n!==o?n-o:t.name.localeCompare(r.name)})}chunkDPD6ZWL2_js.a(pa,"sortAttributes");function od(e){if(e.type==="text"&&e.multiline)return 12;switch(e.type){case "richtext":case "location":return 12;case "checkbox":return 4;default:return 6}}chunkDPD6ZWL2_js.a(od,"getDefaultFieldSpan");function ad(e){return {attribute:e.name,span:od(e)}}chunkDPD6ZWL2_js.a(ad,"attributeToField");var Ft="all",We="form",Vt="general";function Ke(e,t={}){let{includeActivityTab:r=true,includeDocumentsTab:n=true,excludeAttributes:o=[]}=t,a=ca(e.attributes,o),s=pa(a.filter(K=>chunkJRBNMHMY_js.j(K).presentation.formField)),d=[{id:We,name:We,label:"Details",type:"form",groups:[{id:Vt,label:"General",type:"fields",fields:s.map(ad),order:0}],order:0}],f=1,x=e.attributes.some(K=>K.type==="document");n&&x&&d.push({id:"documents",name:"documents",label:"Documents",type:"documents",order:f++,allowUpload:true,allowRemove:true}),r&&d.push({id:"activity",name:"activity",label:"Activity",type:"activity",order:f++});let v={tabs:d};return {name:"default",label:"Default View",object:e.name,type:"detail",config:v,default:true}}chunkDPD6ZWL2_js.a(Ke,"generateDefaultDetailView");function He(e,t={}){let{excludeAttributes:r=[],maxListColumns:n=5}=t,o=ca(e.attributes,r),s=pa(o.filter(d=>chunkJRBNMHMY_js.j(d).presentation.defaultColumn)).slice(0,n).map(d=>d.name),u={tabs:[{id:Ft,label:"All",default:true,visibility:"workspace",layout:"table",columns:s}]};return {name:"default",label:"All Records",object:e.name,type:"list",config:u,default:true}}chunkDPD6ZWL2_js.a(He,"generateDefaultListView");function sd(e,t){let{preserveCustomTabs:r=true,preserveTableTabs:n=true}=t,o=[];for(let a of e.config.tabs)r&&a.type==="custom"&&o.push(a),n&&a.type==="table"&&o.push(a);return o}chunkDPD6ZWL2_js.a(sd,"getPreservedDetailTabs");function ud(e,t){if(t.length===0)return e;let r=e.find(s=>s.type==="form"),n=e.filter(s=>s.type!=="form"),o=[];r&&o.push(r);let a=1;for(let s of t)o.push({...s,order:a++});for(let s of n)o.push({...s,order:a++});return o}chunkDPD6ZWL2_js.a(ud,"mergeDetailTabs");function ld(e,t,r){let{preserveMetadata:n=true,...o}=r,a=Ke(t,o),s=sd(e,r),u=ud(a.config.tabs,s),d={...a.config,tabs:u},f={...a,config:d};return n&&(f.id=e.id,f.name=e.name,f.label=e.label,f.description=e.description,f.icon=e.icon),f}chunkDPD6ZWL2_js.a(ld,"resetDetailViewToDefault");function dd(e,t,r){let{preserveMetadata:n=true,...o}=r,s={...He(t,o)};return n&&(s.id=e.id,s.name=e.name,s.label=e.label,s.description=e.description,s.icon=e.icon),s}chunkDPD6ZWL2_js.a(dd,"resetListViewToDefault");function cd(e,t,r={}){if(bt(e))return ld(e,t,r);if(ko(e))return dd(e,t,r);throw new Error(`Reset not supported for view type: ${e.type}`)}chunkDPD6ZWL2_js.a(cd,"resetViewToDefault");function Bx(e,t){if(t){let r=e.tabs.find(n=>n.id===t);if(r)return r}return e.tabs.find(r=>r.default)??e.tabs[0]}chunkDPD6ZWL2_js.a(Bx,"getActiveTab");function ui(e){return structuredClone(e)}chunkDPD6ZWL2_js.a(ui,"cloneFormDefinition");var li=class li{constructor(){this.forms=new Map;}register(t){let r=Array.isArray(t)?t:[t];for(let n of r){if(this.forms.has(n.name))throw new chunkJSKLP4GI_js.r("form",n.name,`[FormRegistry] Duplicate form: "${n.name}"`);this.forms.set(n.name,ui(n));}return this}get(t){let r=this.forms.get(t);return r?ui(r):void 0}getAll(){return Array.from(this.forms.values(),ui)}listNames(){return Array.from(this.forms.keys())}};chunkDPD6ZWL2_js.a(li,"FormRegistry");var Ye=li;var ma=new Ye;function Jx(e,t){return `${e}:${t}`}chunkDPD6ZWL2_js.a(Jx,"formatAgentStreamFrameId");function Xx(e){let t=e.lastIndexOf(":");if(t<=0)return null;let r=e.slice(0,t),n=Number(e.slice(t+1));return !Number.isInteger(n)||n<=0?null:{streamId:r,sequence:n}}chunkDPD6ZWL2_js.a(Xx,"parseAgentStreamFrameId");var tI=204800,rI=256;function ci(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(ci,"isRecord");function pi(e,t){let r=Object.keys(e);return r.length===t.length&&r.every(n=>t.includes(n))}chunkDPD6ZWL2_js.a(pi,"hasExactKeys");function di(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}chunkDPD6ZWL2_js.a(di,"isPositiveInteger");function fa(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(fa,"isNonNegativeInteger");function pd(e){return ci(e)&&pi(e,["kind","startOffset","endOffset"])?(e.kind==="text"||e.kind==="reasoning")&&fa(e.startOffset)&&fa(e.endOffset)&&e.endOffset>=e.startOffset:false}chunkDPD6ZWL2_js.a(pd,"isContentRange");function md(e){if(!ci(e))return false;let t=e.content===void 0?["sequence","chunk"]:["sequence","content","chunk"];return pi(e,t)&&di(e.sequence)&&e.chunk!==void 0&&(e.content===void 0||pd(e.content))}chunkDPD6ZWL2_js.a(md,"isBatchItem");function fd(e){try{return new TextEncoder().encode(JSON.stringify(e)).byteLength}catch{return}}chunkDPD6ZWL2_js.a(fd,"encodedSize");function nI(e){if(!(ci(e)&&pi(e,["schemaVersion","batchId","tenantId","sessionId","streamId","sequenceStart","sequenceEnd","items"]))||e.schemaVersion!==1||typeof e.batchId!="string"||e.batchId.trim()===""||typeof e.tenantId!="string"||e.tenantId.trim()===""||typeof e.sessionId!="string"||e.sessionId.trim()===""||typeof e.streamId!="string"||e.streamId.trim()===""||!di(e.sequenceStart)||!di(e.sequenceEnd)||!Array.isArray(e.items)||e.items.length===0||e.items.length>256||!e.items.every(md))return false;let t=0;for(let n of e.items){if(n.sequence<=t)return false;t=n.sequence;}if(e.items[0]?.sequence!==e.sequenceStart||e.items.at(-1)?.sequence!==e.sequenceEnd)return false;let r=fd(e);return r!==void 0&&r<=204800}chunkDPD6ZWL2_js.a(nI,"isAgentUIMessageBatch");function ba(e){switch(e.kind){case "workspace":return `workspace:${encodeURIComponent(e.tenantId)}`;case "object":return `object:${encodeURIComponent(e.objectId)}`;case "record":return `record:${encodeURIComponent(e.objectId)}:${encodeURIComponent(e.recordId)}`;case "view":return `view:${encodeURIComponent(e.viewId)}`;case "user":return `user:${encodeURIComponent(e.actorId)}`;case "conversation":return `conversation:${encodeURIComponent(e.sessionId)}`;case "architect-draft":return e.scope==="actor"?`architect-draft:actor:${encodeURIComponent(e.actorId)}`:`architect-draft:session:${encodeURIComponent(e.sessionId)}`}}chunkDPD6ZWL2_js.a(ba,"liveChannelKey");function aI(e){return e.sessionId?ba({kind:"architect-draft",scope:"session",sessionId:e.sessionId}):e.actorId?ba({kind:"architect-draft",scope:"actor",actorId:e.actorId}):null}chunkDPD6ZWL2_js.a(aI,"architectDraftChannelKey");function oe(e){try{return decodeURIComponent(e)}catch{return null}}chunkDPD6ZWL2_js.a(oe,"decodeLiveChannelPart");function ga(e){let t=e.split(":");if(t[0]==="workspace"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"workspace",tenantId:r}:null}if(t[0]==="object"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"object",objectId:r}:null}if(t[0]==="record"&&t.length===3&&t[1]&&t[2]){let r=oe(t[1]),n=oe(t[2]);return r&&n?{kind:"record",objectId:r,recordId:n}:null}if(t[0]==="view"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"view",viewId:r}:null}if(t[0]==="user"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"user",actorId:r}:null}if(t[0]==="architect-draft"&&t.length===3&&t[2]){let r=oe(t[2]);return r?t[1]==="actor"?{kind:"architect-draft",scope:"actor",actorId:r}:t[1]==="session"?{kind:"architect-draft",scope:"session",sessionId:r}:null:null}if(t[0]==="conversation"&&t.length===2&&t[1]){let r=oe(t[1]);return r?{kind:"conversation",sessionId:r}:null}return null}chunkDPD6ZWL2_js.a(ga,"parseLiveChannelKey");var bd={"record.patch":true,"record.deleted":true,"record.removed":true,"record.created":true,"view.projection.stale":true,"agent.session.patch":true,"notification.created":true,"notification.recipient.patch":true,"notification.count.patch":true,"notification.inbox.archived":true,"reflex.state.changed":true,"reflex.run.completed":true,"reflex.authoring.progress":true,"architect.draft.updated":true,"meeting.recording.patch":true,"wallet.state":true,"channel.revoked":true},gd=Object.keys(bd),yd=["membership-unknown","sort-unknown","permissions-changed"],hd=["permission-revoked","workspace-left","object-deleted"],Ad=["inboxState","workState","lockedAt","lockedByActorId","readAt","archivedAt","snoozedUntil","completedAt","dismissedAt","updatedAt"],Td=["type","objectId","recordId","recordVersion"],wd=["type","objectId","recordId","recordVersion","record"],xd=["id","objectId","visibility","ownedBy","label","values","metadata","createdAt","updatedAt","createdBy","lastUpdatedBy","schemaVersion"],Id=["type","targetActorId","archivedCount","version","updatedAt"];function Sd(e){return typeof e=="string"&&gd.includes(e)}chunkDPD6ZWL2_js.a(Sd,"isLiveEventType");function dI(e){return _(e)&&Sd(e.type)?vd(e.type,e):false}chunkDPD6ZWL2_js.a(dI,"isLiveEventPayload");function vd(e,t){if(!_(t))return false;switch(e){case "record.patch":return Nd(t);case "record.deleted":return kd(t);case "record.removed":return Pd(t);case "record.created":return Fd(t);case "view.projection.stale":return Vd(t);case "agent.session.patch":return Md(t);case "notification.created":return Ud(t);case "notification.recipient.patch":return qd(t);case "notification.count.patch":return zd(t);case "notification.inbox.archived":return Gd(t);case "reflex.state.changed":return Jd(t);case "reflex.run.completed":return Xd(t);case "reflex.authoring.progress":return Zd(t);case "architect.draft.updated":return Qd(t);case "meeting.recording.patch":return tc(t);case "wallet.state":return ic(t);case "channel.revoked":return oc(t);default:return false}}chunkDPD6ZWL2_js.a(vd,"isLiveEventPayloadForType");function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(_,"isRecord");function M(e){return typeof e=="string"}chunkDPD6ZWL2_js.a(M,"isString");function ya(e){return M(e)&&e.length>0}chunkDPD6ZWL2_js.a(ya,"isNonEmptyString");function Mt(e){return e===null||M(e)}chunkDPD6ZWL2_js.a(Mt,"isNullableString");function Rd(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(Rd,"isVersion");function X(e){if(!M(e))return false;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e}chunkDPD6ZWL2_js.a(X,"isIsoDateString");function Re(e){return e===null||X(e)}chunkDPD6ZWL2_js.a(Re,"isNullableIsoDateString");function S(e,t){return M(e[t])}chunkDPD6ZWL2_js.a(S,"hasString");function ae(e,t){return ya(e[t])}chunkDPD6ZWL2_js.a(ae,"hasNonEmptyString");function N(e,t){return Rd(e[t])}chunkDPD6ZWL2_js.a(N,"hasVersion");function P(e,t){return X(e[t])}chunkDPD6ZWL2_js.a(P,"hasIsoDateString");function I(e,t,r){return !Object.hasOwn(e,t)||r(e[t])}chunkDPD6ZWL2_js.a(I,"hasOptional");function Lt(e,t){return Object.keys(e).every(r=>t.includes(r))}chunkDPD6ZWL2_js.a(Lt,"hasOnlyKeys");function j(e,t){return typeof e=="string"&&t.includes(e)}chunkDPD6ZWL2_js.a(j,"isOneOf");function Dd(e){return j(e,bo)}chunkDPD6ZWL2_js.a(Dd,"isNotificationKind");function Ed(e){return j(e,go)}chunkDPD6ZWL2_js.a(Ed,"isNotificationPriority");function Cd(e){return j(e,yo)}chunkDPD6ZWL2_js.a(Cd,"isNotificationSensitivity");function ha(e){return j(e,ho)}chunkDPD6ZWL2_js.a(ha,"isNotificationInboxState");function Aa(e){return j(e,Ao)}chunkDPD6ZWL2_js.a(Aa,"isNotificationWorkState");function Od(e){return _(e)&&S(e,"type")&&S(e,"id")}chunkDPD6ZWL2_js.a(Od,"isNotificationSubject");function _d(e){return _(e)&&S(e,"fieldKey")&&Object.hasOwn(e,"value")&&N(e,"version")}chunkDPD6ZWL2_js.a(_d,"isRecordFieldPatch");function Nd(e){return e.type==="record.patch"&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")&&I(e,"label",M)&&I(e,"metadata",_)&&I(e,"fieldsWithheld",t=>t===true)&&Array.isArray(e.fieldPatches)&&e.fieldPatches.every(_d)&&S(e,"updatedAt")}chunkDPD6ZWL2_js.a(Nd,"isRecordPatchPayload");function kd(e){return e.type==="record.deleted"&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")&&S(e,"deletedAt")}chunkDPD6ZWL2_js.a(kd,"isRecordDeletedPayload");function Pd(e){return e.type==="record.removed"&&Lt(e,Td)&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")}chunkDPD6ZWL2_js.a(Pd,"isRecordRemovedPayload");function jd(e){return _(e)&&Lt(e,xd)&&S(e,"id")&&S(e,"objectId")&&j(e.visibility,["workspace","private"])&&Mt(e.ownedBy)&&(e.visibility==="workspace"&&e.ownedBy===null||e.visibility==="private"&&ya(e.ownedBy))&&S(e,"label")&&_(e.values)&&I(e,"metadata",_)&&P(e,"createdAt")&&P(e,"updatedAt")&&I(e,"createdBy",M)&&I(e,"lastUpdatedBy",M)&&N(e,"schemaVersion")}chunkDPD6ZWL2_js.a(jd,"isRecordLiveSnapshot");function Fd(e){return e.type==="record.created"&&Lt(e,wd)&&S(e,"objectId")&&S(e,"recordId")&&N(e,"recordVersion")&&jd(e.record)&&e.record.id===e.recordId&&e.record.objectId===e.objectId}chunkDPD6ZWL2_js.a(Fd,"isRecordCreatedPayload");function Vd(e){return e.type==="view.projection.stale"&&S(e,"viewId")&&j(e.reason,yd)}chunkDPD6ZWL2_js.a(Vd,"isViewProjectionStalePayload");function Md(e){return e.type==="agent.session.patch"&&S(e,"sessionId")&&_(e.patch)&&N(e,"version")&&S(e,"updatedAt")}chunkDPD6ZWL2_js.a(Md,"isAgentSessionPatchPayload");function Ld(e){return _(e)&&S(e,"id")&&S(e,"tenantId")&&I(e,"senderActorId",M)&&I(e,"rootActorId",M)&&I(e,"triggeredByActorId",M)&&Dd(e.kind)&&S(e,"type")&&I(e,"subject",Od)&&S(e,"title")&&I(e,"summary",M)&&_(e.payload)&&Ed(e.priority)&&Cd(e.sensitivity)&&I(e,"threadKey",M)&&I(e,"idempotencyKey",M)&&I(e,"expiresAt",X)&&P(e,"createdAt")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Ld,"isLiveNotification");function Bd(e){return _(e)&&S(e,"id")&&S(e,"tenantId")&&S(e,"notificationId")&&S(e,"recipientActorId")&&ha(e.inboxState)&&Aa(e.workState)&&I(e,"lockedAt",X)&&I(e,"lockedByActorId",M)&&I(e,"readAt",X)&&I(e,"archivedAt",X)&&I(e,"snoozedUntil",X)&&I(e,"completedAt",X)&&I(e,"dismissedAt",X)&&P(e,"createdAt")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Bd,"isLiveNotificationRecipient");function $d(e){return _(e)?Object.keys(e).every(t=>Ad.includes(t))&&I(e,"inboxState",ha)&&I(e,"workState",Aa)&&I(e,"lockedAt",Re)&&I(e,"lockedByActorId",Mt)&&I(e,"readAt",Re)&&I(e,"archivedAt",Re)&&I(e,"snoozedUntil",Re)&&I(e,"completedAt",Re)&&I(e,"dismissedAt",Re)&&I(e,"updatedAt",X):false}chunkDPD6ZWL2_js.a($d,"isNotificationRecipientPatch");function Ud(e){let t=Ld(e.notification)?e.notification:null;return e.type==="notification.created"&&t!==null&&Array.isArray(e.recipients)&&e.recipients.length>0&&e.recipients.every(r=>Bd(r)&&r.notificationId===t.id)&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Ud,"isNotificationCreatedPayload");function qd(e){return e.type==="notification.recipient.patch"&&S(e,"recipientId")&&S(e,"recipientActorId")&&$d(e.patch)&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(qd,"isNotificationRecipientPatchPayload");function zd(e){return e.type==="notification.count.patch"&&S(e,"targetActorId")&&N(e,"unread")&&N(e,"pendingWork")&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(zd,"isNotificationCountPatchPayload");function Gd(e){return e.type==="notification.inbox.archived"&&Lt(e,Id)&&ae(e,"targetActorId")&&N(e,"archivedCount")&&N(e,"version")&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Gd,"isNotificationInboxArchivedPayload");var Wd=["armed","disarmed"],Kd=["authoring","compiling","replaying","promoted","failed"],Hd=["promoted","lkg"],Yd=["composing","published","discarded"];function Qd(e){if(e.type!=="architect.draft.updated"||!_(e.draft))return false;let t=e.draft;return ae(t,"id")&&ae(t,"actorId")&&Mt(t.agentSessionId)&&Array.isArray(t.operations)&&t.operations.every(_)&&_(t.baselines)&&j(t.status,Yd)}chunkDPD6ZWL2_js.a(Qd,"isArchitectDraftUpdatedPayload");function Jd(e){return e.type==="reflex.state.changed"&&ae(e,"reflexId")&&j(e.state,Wd)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Jd,"isReflexStateChangedPayload");function Xd(e){return e.type==="reflex.run.completed"&&ae(e,"reflexId")&&ae(e,"runId")&&j(e.served,Hd)&&N(e,"version")&&N(e,"wallMs")&&P(e,"completedAt")}chunkDPD6ZWL2_js.a(Xd,"isReflexRunCompletedPayload");function Zd(e){return e.type==="reflex.authoring.progress"&&ae(e,"reflexId")&&j(e.status,Kd)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(Zd,"isReflexAuthoringProgressPayload");var ec=["none","scheduled","recording","completed","failed"];function tc(e){return e.type==="meeting.recording.patch"&&ae(e,"meetingId")&&j(e.status,ec)&&Mt(e.failureReason)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(tc,"isMeetingRecordingPatchPayload");var rc=["ok","low","exhausted","paused"],nc=["metering-only","contract","wallet"];function ic(e){return e.type==="wallet.state"&&j(e.status,rc)&&j(e.mode,nc)&&P(e,"updatedAt")}chunkDPD6ZWL2_js.a(ic,"isWalletStatePayload");function oc(e){return e.type==="channel.revoked"&&S(e,"channel")&&j(e.reason,hd)}chunkDPD6ZWL2_js.a(oc,"isChannelRevokedPayload");function mi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(mi,"isRecord");function ac(e){let{channel:t}=e;return typeof t=="string"&&ga(t)?t:null}chunkDPD6ZWL2_js.a(ac,"payloadChannel");function fI(e){return mi(e)?ac(e):null}chunkDPD6ZWL2_js.a(fI,"getLiveProtocolPayloadChannel");function bI(e){return mi(e)?typeof e.id=="string"&&e.id.length>0&&typeof e.channel=="string"&&typeof e.type=="string"&&typeof e.tenantId=="string"&&e.tenantId.length>0&&typeof e.occurredAt=="string"&&mi(e.payload):false}chunkDPD6ZWL2_js.a(bI,"isLiveEventEnvelope");var hI=["if","concat","sum","avg","count","min","max","earliest","latest","unique","first","percent_empty","percent_not_empty","count_empty","count_not_empty","count_unique"],Qe={if:{name:"if",returnType:"branch",minArgs:3,maxArgs:3},concat:{name:"concat",returnType:{kind:"scalar",type:"text"},minArgs:1},sum:{name:"sum",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},avg:{name:"avg",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count:{name:"count",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},min:{name:"min",returnType:"source_item",minArgs:1,maxArgs:1},max:{name:"max",returnType:"source_item",minArgs:1,maxArgs:1},earliest:{name:"earliest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},latest:{name:"latest",returnType:{kind:"scalar",type:"date"},minArgs:1,maxArgs:1},unique:{name:"unique",returnType:"argument",minArgs:1,maxArgs:1},first:{name:"first",returnType:"source_item",minArgs:1,maxArgs:1},percent_empty:{name:"percent_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},percent_not_empty:{name:"percent_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_empty:{name:"count_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_not_empty:{name:"count_not_empty",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1},count_unique:{name:"count_unique",returnType:{kind:"scalar",type:"number"},minArgs:1,maxArgs:1}};function Bt(e){return Object.hasOwn(Qe,e)}chunkDPD6ZWL2_js.a(Bt,"isComputedFunctionName");var yi=class yi extends Error{constructor(t){super(t),this.name="ComputedFormulaCompileError";}};chunkDPD6ZWL2_js.a(yi,"ComputedFormulaCompileError");var g=yi;function Ut(e){let t=sc(e.expression),r=$t(t,e.schema),n=Cc(r.valueType);if(n!==e.returnType)throw new g(`Computed formula "${e.attributeName}" returns "${n}", expected "${e.returnType}"`);if(Ra(e.returnType)&&r.optionsSource===void 0)throw new g(`Computed formula "${e.attributeName}" returns "${e.returnType}" without optionsSource`);let o=r.optionsSource===void 0?[]:[{kind:"options",source:r.optionsSource}],a=gi([...r.dependencies,...o]);return {kind:"formula",attributeName:e.attributeName,expression:e.expression,returnType:e.returnType,valueType:r.valueType,dependencies:a,ast:t,...r.optionsSource?{optionsSource:r.optionsSource}:{},...r.targetAttributeType?{targetAttributeType:r.targetAttributeType}:{},dependenciesHash:Oc({expression:e.expression,returnType:e.returnType,dependencies:a})}}chunkDPD6ZWL2_js.a(Ut,"compileComputedFormula");function va(e){let t=new Map(e.map(o=>[o.attributeName,o])),r=new Set,n=chunkDPD6ZWL2_js.a((o,a)=>{let s=a.indexOf(o);if(s!==-1){let f=[...a.slice(s),o];throw new g(`Computed field cycle detected: ${f.join(" -> ")}`)}if(r.has(o))return;let u=t.get(o);if(u===void 0)return;let d=[...a,o];for(let f of u.dependencies)f.kind==="computed"&&n(f.attributeName,d);r.add(o);},"visit");for(let o of e)n(o.attributeName,[]);}chunkDPD6ZWL2_js.a(va,"assertAcyclicComputedDependencies");function sc(e){try{return chunkWKDJGNVI_js.e(e)}catch(t){throw t instanceof Error?new g(t.message):t}}chunkDPD6ZWL2_js.a(sc,"parseCompileFormula");function $t(e,t){switch(e.kind){case "literal":return {valueType:uc(e.value),dependencies:[],...typeof e.value=="string"?{literalString:e.value}:{}};case "path":return lc(e.parts,t);case "call":return bc(e.functionName,e.args,t);case "binary":return Tc(e.operator,$t(e.left,t),$t(e.right,t));default:return e}}chunkDPD6ZWL2_js.a($t,"inferNode");function uc(e){switch(typeof e){case "string":return {kind:"scalar",type:"text"};case "number":return {kind:"scalar",type:"number"};case "boolean":return {kind:"scalar",type:"boolean"};case "object":return {kind:"scalar",type:"text"};default:return e}}chunkDPD6ZWL2_js.a(uc,"literalToValueType");function lc(e,t){if(e.length===1){let r=e[0],n=fi(t,r);if(n===void 0)throw new g(`Unknown attribute "${r}" on object "${t.objectName}"`);return n.type==="relation"?{valueType:pc(),dependencies:[{kind:"relation",relationName:n.name,cardinality:Ta(n)}],targetAttributeType:n.type}:{valueType:wa(n),dependencies:[cc(n)],optionsSource:xa(t.objectName,n),targetAttributeType:n.type}}if(e.length===2){let[r,n]=e,o=fi(t,r);if(o===void 0)throw new g(`Unknown attribute "${r}" on object "${t.objectName}"`);if(o.type!=="relation")throw new g(`Attribute "${r}" on object "${t.objectName}" is not a relation`);let a=dc(o);if(a===void 0)throw new g(`Relation "${r}" on object "${t.objectName}" is missing targetObjectName`);let s=t.relatedObjects?.[a];if(s===void 0)throw new g(`Unknown related object "${a}"`);let u=fi(s,n);if(u===void 0)throw new g(`Unknown attribute "${n}" on object "${s.objectName}"`);let d=wa(u);return {valueType:o.cardinality==="many"?fc(d):d,dependencies:[{kind:"relation",relationName:r,targetAttributeName:n,cardinality:Ta(o)}],optionsSource:xa(s.objectName,u),targetAttributeType:u.type}}throw new g("Computed paths support at most one relation hop")}chunkDPD6ZWL2_js.a(lc,"inferPath");function fi(e,t){return e.attributes.find(r=>r.name===t)}chunkDPD6ZWL2_js.a(fi,"findAttribute");function dc(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}chunkDPD6ZWL2_js.a(dc,"getRelationTargetObjectName");function Ta(e){return e.cardinality??"one"}chunkDPD6ZWL2_js.a(Ta,"relationCardinality");function cc(e){return e.type==="formula"||e.type==="rollup"?{kind:"computed",attributeName:e.name}:{kind:"local",attributeName:e.name}}chunkDPD6ZWL2_js.a(cc,"localDependencyFor");function wa(e){if(e.type==="formula"||e.type==="rollup"){if(e.returnType===void 0)throw new g(`Computed attribute "${e.name}" is missing returnType`);return mc(e.returnType)}switch(e.type){case "number":case "currency":return {kind:"scalar",type:"number"};case "checkbox":return {kind:"scalar",type:"boolean"};case "date":return {kind:"scalar",type:"date"};case "select":case "status":return {kind:"scalar",type:"select"};case "multiselect":return {kind:"collection",itemType:"select"};case "text":case "richtext":case "phone":case "user":case "location":case "relation":case "document":return {kind:"scalar",type:"text"};default:return e.type}}chunkDPD6ZWL2_js.a(wa,"attributeToValueType");function pc(){return {kind:"collection",itemType:"text"}}chunkDPD6ZWL2_js.a(pc,"relationToValueType");function mc(e){return e==="multiselect"?{kind:"collection",itemType:"select"}:{kind:"scalar",type:e}}chunkDPD6ZWL2_js.a(mc,"returnTypeToValueType");function fc(e){return e.kind==="collection"?e:{kind:"collection",itemType:e.type}}chunkDPD6ZWL2_js.a(fc,"asCollectionValueType");function xa(e,t){if(t.type==="formula"||t.type==="rollup")return Ra(t.returnType)?t.optionsSource:void 0;if(!(t.type!=="select"&&t.type!=="status"&&t.type!=="multiselect"))return t.optionsSource??{objectName:e,attributeName:t.name,...t.id?{attributeId:t.id}:{}}}chunkDPD6ZWL2_js.a(xa,"optionsSourceForAttribute");function bc(e,t,r){if(!Bt(e))throw new g(`Unknown computed function "${e}"`);let n=Qe[e];if(t.length<n.minArgs||n.maxArgs!==void 0&&t.length>n.maxArgs){let a=n.maxArgs===void 0||n.maxArgs===n.minArgs?String(n.minArgs):`${n.minArgs}-${n.maxArgs}`;throw new g(`Function "${e}" expects ${a} arguments, received ${t.length}`)}let o=t.map(a=>$t(a,r));return gc(e,o)}chunkDPD6ZWL2_js.a(bc,"inferCall");function gc(e,t){let r=gi(t.flatMap(n=>n.dependencies));switch(e){case "if":return yc(t,r);case "concat":return wc(t,`Function "${e}" does not accept collection values`),{valueType:{kind:"scalar",type:"text"},dependencies:r};case "sum":case "avg":return Ia(e,t[0],"number"),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "count":case "count_empty":case "count_not_empty":case "count_unique":case "percent_empty":case "percent_not_empty":return Ic(e,t[0]),{valueType:{kind:"scalar",type:"number"},dependencies:r};case "min":case "max":return xc(e,t[0]),{valueType:Sc(t[0]),dependencies:r,optionsSource:t[0].optionsSource,targetAttributeType:t[0].targetAttributeType};case "earliest":case "latest":return Ia(e,t[0],"date"),{valueType:{kind:"scalar",type:"date"},dependencies:r,targetAttributeType:t[0].targetAttributeType};case "unique":return hc(t[0],r);case "first":return Ac(t[0],r);default:return e}}chunkDPD6ZWL2_js.a(gc,"inferFunctionReturn");function yc(e,t){bi(e[0].valueType,"boolean",'Function "if" condition must be boolean');let r=e[1],n=e[2],o=Rc(r,n),a=Dc(r,n);if(o===void 0)throw new g('Function "if" branches must return the same type');return {valueType:o,dependencies:t,...a?{optionsSource:a}:{},targetAttributeType:r.targetAttributeType??n.targetAttributeType}}chunkDPD6ZWL2_js.a(yc,"inferIfFunction");function hc(e,t){if(e.valueType.kind!=="collection"||e.valueType.itemType!=="select")throw new g('Function "unique" expects a select collection');return {valueType:{kind:"collection",itemType:"select"},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(hc,"inferUniqueFunction");function Ac(e,t){if(e.valueType.kind!=="collection")throw new g('Function "first" expects a collection');return {valueType:{kind:"scalar",type:e.valueType.itemType},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(Ac,"inferFirstFunction");function Tc(e,t,r){let n=gi([...t.dependencies,...r.dependencies]),o=e==="+"||e==="-"||e==="*"||e==="/";if(t.valueType.kind==="collection"||r.valueType.kind==="collection")throw new g(`Cannot use collection values with ${o?"arithmetic":"comparison"} operator "${e}"`);if(o)return e==="+"&&(t.valueType.type==="text"||r.valueType.type==="text")?{valueType:{kind:"scalar",type:"text"},dependencies:n}:(bi(t.valueType,"number",`Operator "${e}" expects number operands`),bi(r.valueType,"number",`Operator "${e}" expects number operands`),{valueType:{kind:"scalar",type:"number"},dependencies:n});if(e==="=="||e==="!="){if(t.valueType.type!==r.valueType.type)throw new g(`Operator "${e}" expects operands with the same scalar type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}if((t.valueType.type!=="number"||r.valueType.type!=="number")&&(t.valueType.type!=="date"||r.valueType.type!=="date"))throw new g(`Operator "${e}" expects number or date operands of the same type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:n}}chunkDPD6ZWL2_js.a(Tc,"inferBinary");function wc(e,t){for(let r of e)if(r.valueType.kind==="collection")throw new g(t)}chunkDPD6ZWL2_js.a(wc,"ensureNoCollections");function Ia(e,t,r){if((t.valueType.kind==="collection"?t.valueType.itemType:t.valueType.type)!==r)throw new g(`Function "${e}" expects ${r} values`)}chunkDPD6ZWL2_js.a(Ia,"ensureCollectionOrScalarType");function xc(e,t){if(t.valueType.kind!=="collection")throw new g(`Function "${e}" expects a collection`);let r=t.valueType.itemType;if(r!=="number"&&r!=="date")throw new g(`Function "${e}" expects number or date values`)}chunkDPD6ZWL2_js.a(xc,"ensureMinMaxSource");function Ic(e,t){if(t.valueType.kind!=="collection")throw new g(`Function "${e}" expects a collection`)}chunkDPD6ZWL2_js.a(Ic,"ensureCollectionSource");function bi(e,t,r){if(e.kind!=="scalar"||e.type!==t)throw new g(r)}chunkDPD6ZWL2_js.a(bi,"ensureScalarType");function Sc(e){return e.valueType.kind==="scalar"?e.valueType:{kind:"scalar",type:e.valueType.itemType}}chunkDPD6ZWL2_js.a(Sc,"sourceItemValueType");function vc(e,t){return e.kind==="scalar"?t.kind==="scalar"&&e.type===t.type:t.kind==="collection"&&e.itemType===t.itemType}chunkDPD6ZWL2_js.a(vc,"sameValueType");function Rc(e,t){if(vc(e.valueType,t.valueType)||Sa(e,t))return e.valueType;if(Sa(t,e))return t.valueType}chunkDPD6ZWL2_js.a(Rc,"resolveIfBranchValueType");function Sa(e,t){return e.valueType.kind==="scalar"&&e.valueType.type==="select"&&t.valueType.kind==="scalar"&&t.valueType.type==="text"&&t.literalString!==void 0}chunkDPD6ZWL2_js.a(Sa,"isSelectScalarWithStringLiteral");function Dc(e,t){let r=e.optionsSource,n=t.optionsSource;if(r!==void 0&&n!==void 0&&!Ec(r,n))throw new g('Function "if" branches use incompatible options sources');return r??n}chunkDPD6ZWL2_js.a(Dc,"resolveIfOptionsSource");function Ec(e,t){return e.objectName===t.objectName&&e.attributeName===t.attributeName&&e.attributeId===t.attributeId}chunkDPD6ZWL2_js.a(Ec,"sameOptionsSource");function Ra(e){return e==="select"||e==="multiselect"}chunkDPD6ZWL2_js.a(Ra,"isSelectLikeReturnType");function Cc(e){if(e.kind==="scalar")return e.type;if(e.itemType==="select")return "multiselect";throw new g(`Collection item type "${e.itemType}" cannot be used as a computed return type`)}chunkDPD6ZWL2_js.a(Cc,"valueTypeToReturnType");function gi(e){let t=new Set,r=[];for(let n of e){let o=JSON.stringify(Je(n));t.has(o)||(t.add(o),r.push(n));}return r}chunkDPD6ZWL2_js.a(gi,"uniqueDependencies");function Oc(e){let t=e.dependencies.map(r=>Je(r)).sort((r,n)=>Da(JSON.stringify(r),JSON.stringify(n)));return JSON.stringify(Je({expression:e.expression,returnType:e.returnType,dependencies:t}))}chunkDPD6ZWL2_js.a(Oc,"createDependenciesHash");function Je(e){return Array.isArray(e)?e.map(t=>Je(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>Da(t,r)).map(([t,r])=>[t,Je(r)])):e}chunkDPD6ZWL2_js.a(Je,"stableNormalize");function Da(e,t){return e<t?-1:e>t?1:0}chunkDPD6ZWL2_js.a(Da,"compareStrings");function _c(e){return e.function==="count"?`count(${e.relationAttribute})`:`${Pc(e.function)}(${e.relationAttribute}.${e.targetAttribute})`}chunkDPD6ZWL2_js.a(_c,"rollupToFormulaExpression");function Nc(e,t){if(e.function==="count")return "number";let r=jc(e,t);switch(e.function){case "countValues":case "countEmpty":case "percentEmpty":case "percentNotEmpty":case "countUniqueValues":return "number";case "sum":case "avg":return "number";case "earliest":case "latest":return "date";case "original":if(!Vc(r.type))throw new g('Rollup "original" requires a select, status, or multiselect target');return "multiselect";default:return e.function}}chunkDPD6ZWL2_js.a(Nc,"inferRollupReturnType");function Ca(e,t){let r=_c(e),n=Nc(e,t);return {...Ut({attributeName:e.name,expression:r,returnType:n,schema:kc(e,t)}),kind:"rollup"}}chunkDPD6ZWL2_js.a(Ca,"compileRollupAttribute");function kc(e,t){return {...t,attributes:t.attributes.map(r=>r.name===e.relationAttribute&&r.type==="relation"?{...r,cardinality:"many"}:r)}}chunkDPD6ZWL2_js.a(kc,"schemaWithRollupRelationAsMany");function Pc(e){switch(e){case "sum":case "avg":case "earliest":case "latest":return e;case "original":return "unique";case "countValues":return "count_not_empty";case "countEmpty":return "count_empty";case "percentEmpty":return "percent_empty";case "percentNotEmpty":return "percent_not_empty";case "countUniqueValues":return "count_unique";default:return e}}chunkDPD6ZWL2_js.a(Pc,"rollupFunctionToFormulaFunction");function jc(e,t){let r=Ea(t,e.relationAttribute);if(r===void 0)throw new g(`Unknown relation attribute "${e.relationAttribute}" on object "${t.objectName}"`);if(r.type!=="relation")throw new g(`Attribute "${e.relationAttribute}" on object "${t.objectName}" is not a relation`);let n=Fc(r);if(n===void 0)throw new g(`Relation "${e.relationAttribute}" on object "${t.objectName}" is missing targetObjectName`);let o=t.relatedObjects?.[n];if(o===void 0)throw new g(`Unknown related object "${n}"`);let a=Ea(o,e.targetAttribute);if(a===void 0)throw new g(`Unknown attribute "${e.targetAttribute}" on object "${o.objectName}"`);return a}chunkDPD6ZWL2_js.a(jc,"findRollupTargetAttribute");function Ea(e,t){return e.attributes.find(r=>r.name===t)}chunkDPD6ZWL2_js.a(Ea,"findAttribute");function Fc(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}chunkDPD6ZWL2_js.a(Fc,"getRelationTargetObjectName");function Vc(e){return e==="select"||e==="status"||e==="multiselect"}chunkDPD6ZWL2_js.a(Vc,"isSelectLikeAttributeType");function re(e,t){switch(e.kind){case "literal":return e.value;case "path":return Lc(t,e.parts);case "binary":return Bc(e.operator,re(e.left,t),re(e.right,t));case "call":return Mc(e.functionName,e.args,t);default:return e}}chunkDPD6ZWL2_js.a(re,"evaluateAst");function Mc(e,t,r){if(Uc(e),qc(e,t.length),e==="if"){let n=re(t[0],r);return n===null?null:re(n?t[1]:t[2],r)}return zc(e,t.map(n=>re(n,r)))}chunkDPD6ZWL2_js.a(Mc,"evaluateCallNode");function Lc(e,t){return t.reduce((r,n)=>ja(r,n),e)}chunkDPD6ZWL2_js.a(Lc,"resolvePath");function ja(e,t){if(Array.isArray(e))return e.map(n=>ja(n,t));if(!Pa(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let r=e.values;return Pa(r)&&Object.hasOwn(r,t)?r[t]??null:null}chunkDPD6ZWL2_js.a(ja,"resolvePathPart");function Bc(e,t,r){switch(e){case "+":return $c(t,r);case "-":return zt(t,r,(n,o)=>n-o);case "*":return zt(t,r,(n,o)=>n*o);case "/":return zt(t,r,(n,o)=>n/o);case ">":return qt(t,r,n=>n>0);case "<":return qt(t,r,n=>n<0);case ">=":return qt(t,r,n=>n>=0);case "<=":return qt(t,r,n=>n<=0);case "==":return Oa(t,r);case "!=":{let n=Oa(t,r);return n===null?null:!n}default:return e}}chunkDPD6ZWL2_js.a(Bc,"evaluateBinary");function $c(e,t){return typeof e=="string"||typeof t=="string"?`${e??""}${t??""}`:zt(e,t,(r,n)=>r+n)}chunkDPD6ZWL2_js.a($c,"add");function qt(e,t,r){let n=Fa(e,t);return n===null?null:r(n)}chunkDPD6ZWL2_js.a(qt,"compareWith");function Fa(e,t){if(!De([e,t]))return null;let r=Ee(e),n=Ee(t);if(r!==null&&n!==null)return r-n;let o=Ti(e),a=Ti(t);return o&&a?o.getTime()-a.getTime():null}chunkDPD6ZWL2_js.a(Fa,"compare");function Oa(e,t){return e===t?true:e==null||t===null||t===void 0?false:De([e,t])?Fa(e,t)===0:null}chunkDPD6ZWL2_js.a(Oa,"equalScalar");function Uc(e){if(!Bt(e))throw new Error(`Unknown computed function "${e}"`)}chunkDPD6ZWL2_js.a(Uc,"assertComputedFunctionName");function qc(e,t){let{minArgs:r,maxArgs:n}=Qe[e];if(t>=r&&t<=(n??Number.POSITIVE_INFINITY))return;let o=n===void 0?`at least ${r}`:`between ${r} and ${n}`;throw new Error(`Function "${e}" expects ${o} arguments, received ${t}`)}chunkDPD6ZWL2_js.a(qc,"validateArity");function zc(e,t){switch(e){case "concat":return t.filter(r=>r!=null).map(String).join("");case "sum":return De(t)?hi(t).reduce((r,n)=>r+n,0):null;case "avg":{if(!De(t))return null;let r=hi(t);return r.length>0?r.reduce((n,o)=>n+o,0)/r.length:null}case "count":return me(t[0]).length;case "min":return _a(t,"min");case "max":return _a(t,"max");case "earliest":return Ai(t,"min");case "latest":return Ai(t,"max");case "unique":return ka(me(t[0]));case "first":return me(t[0]).find(r=>r!=null)??null;case "percent_empty":return Na(t[0],true);case "percent_not_empty":return Na(t[0],false);case "count_empty":return me(t[0]).filter(chunkIBM4ID4Y_js.a).length;case "count_not_empty":return me(t[0]).filter(r=>!chunkIBM4ID4Y_js.a(r)).length;case "count_unique":return ka(me(t[0])).length;default:return e}}chunkDPD6ZWL2_js.a(zc,"evaluateCall");function hi(e){return Gt(e).map(Ee).filter(t=>t!==null)}chunkDPD6ZWL2_js.a(hi,"numericValues");function De(e){let t=new Set;for(let r of Gt(e))wi(r)&&t.add(Va(r));return t.size<=1}chunkDPD6ZWL2_js.a(De,"areCommensurable");function Va(e){return e.code.toUpperCase()}chunkDPD6ZWL2_js.a(Va,"currencyCode");function zt(e,t,r){if(!De([e,t]))return null;let n=Ee(e),o=Ee(t);if(n===null||o===null)return null;let a=r(n,o);return Number.isFinite(a)?a:null}chunkDPD6ZWL2_js.a(zt,"numericBinary");function _a(e,t){if(!De(e))return null;let r=hi(e);return r.length>0?t==="min"?Math.min(...r):Math.max(...r):Ai(e,t)}chunkDPD6ZWL2_js.a(_a,"minMax");function Ai(e,t){let r=Gt(e).map(Ti).filter(a=>a!==null);if(r.length===0)return null;let n=r.map(a=>a.getTime()),o=t==="min"?Math.min(...n):Math.max(...n);return new Date(o).toISOString()}chunkDPD6ZWL2_js.a(Ai,"dateMinMax");function Na(e,t){let r=me(e);return r.length===0?0:r.filter(o=>chunkIBM4ID4Y_js.a(o)===t).length/r.length}chunkDPD6ZWL2_js.a(Na,"percentByEmptyState");function ka(e){let t=new Set,r=[];for(let n of e){if(chunkIBM4ID4Y_js.a(n))continue;let o=Gc(n);t.has(o)||(t.add(o),r.push(n));}return r}chunkDPD6ZWL2_js.a(ka,"uniqueNonEmpty");function me(e){return e==null?[]:Array.isArray(e)?Gt(e):[e]}chunkDPD6ZWL2_js.a(me,"collectionItems");function Gt(e){return e.flat(Number.POSITIVE_INFINITY)}chunkDPD6ZWL2_js.a(Gt,"flatten");function Ee(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return wi(e)&&Number.isFinite(e.value)?e.value:null}chunkDPD6ZWL2_js.a(Ee,"toFiniteNumber");function wi(e){return typeof e=="object"&&e!==null&&typeof e.value=="number"&&typeof e.code=="string"}chunkDPD6ZWL2_js.a(wi,"isCurrencyValue");function Ti(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!="string"){let r=Te(e);if(r===null)return null;let n=new Date(r);return Number.isNaN(n.getTime())?null:n}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}chunkDPD6ZWL2_js.a(Ti,"toDate");function Gc(e){if(wi(e))return `currency:${Va(e)}:${e.value}`;let t=Ee(e);return t!==null?`number:${t}`:e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`}chunkDPD6ZWL2_js.a(Gc,"uniqueKey");function Pa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(Pa,"isPlainRecord");function Wc(e,t,r){if(e==null)return null;let n=chunkDPD6ZWL2_js.a(o=>typeof o=="string"||typeof o=="number"||typeof o=="boolean"||o instanceof Date?String(o):null,"stringifyScalar");switch(t){case "number":{let o=typeof e=="number"?e:Number(e);return Number.isNaN(o)?null:r!==void 0?Number(o.toFixed(r)):o}case "boolean":return !!e;case "date":return e instanceof Date?e.toISOString():typeof e=="string"?e:null;case "text":return String(e);case "select":if(Array.isArray(e)){for(let o of e){if(o==null)continue;let a=n(o);if(a!==null)return a}return null}return n(e);case "multiselect":return Array.isArray(e)?e.flatMap(o=>{if(o==null)return [];let a=n(o);return a===null?[]:[a]}):n(e)===null?[]:[String(e)];default:{let o=t;throw new Error(`Unsupported computed return type: ${o}`)}}}chunkDPD6ZWL2_js.a(Wc,"formatComputedResult");function NI(e,t){return re(e,t)}chunkDPD6ZWL2_js.a(NI,"evaluateComputedAst");function kI(e,t){return re(chunkWKDJGNVI_js.e(e),t)}chunkDPD6ZWL2_js.a(kI,"evaluateComputedFormula");function PI(e,t,r,n){try{let o=re(chunkWKDJGNVI_js.e(e),t);return {value:r?Wc(o,r,n):o}}catch(o){return {value:null,error:o instanceof Error?o.message:String(o)}}}chunkDPD6ZWL2_js.a(PI,"evaluateComputedFormulaWithResult");var VI=[{name:"if",signature:"if(condition, then, else)",description:"Conditional value",category:"logic",example:"if(amount > 100, 'big', 'small')"},{name:"concat",signature:"concat(a, b, ...)",description:"Join values into text",category:"text",example:"concat(firstName, ' ', lastName)"},{name:"sum",signature:"sum(collection)",description:"Total of values",category:"number",example:"sum(orders.amount)"},{name:"avg",signature:"avg(collection)",description:"Average of values",category:"number",example:"avg(orders.amount)"},{name:"min",signature:"min(collection)",description:"Smallest value",category:"number",example:"min(orders.amount)"},{name:"max",signature:"max(collection)",description:"Largest value",category:"number",example:"max(orders.amount)"},{name:"count",signature:"count(collection)",description:"Number of items",category:"collection",example:"count(orders)"},{name:"count_empty",signature:"count_empty(collection)",description:"Items with no value",category:"collection",example:"count_empty(orders.note)"},{name:"count_not_empty",signature:"count_not_empty(collection)",description:"Items with a value",category:"collection",example:"count_not_empty(orders.note)"},{name:"count_unique",signature:"count_unique(collection)",description:"Distinct values",category:"collection",example:"count_unique(orders.status)"},{name:"percent_empty",signature:"percent_empty(collection)",description:"Fraction with no value",category:"collection",example:"percent_empty(orders.note)"},{name:"percent_not_empty",signature:"percent_not_empty(collection)",description:"Fraction with a value",category:"collection",example:"percent_not_empty(orders.note)"},{name:"unique",signature:"unique(collection)",description:"Distinct values as a list",category:"collection",example:"unique(orders.status)"},{name:"first",signature:"first(collection)",description:"First non-empty value",category:"collection",example:"first(orders.status)"},{name:"earliest",signature:"earliest(collection)",description:"Earliest date",category:"date",example:"earliest(orders.closeDate)"},{name:"latest",signature:"latest(collection)",description:"Latest date",category:"date",example:"latest(orders.closeDate)"}];var Ma=chunkDPD6ZWL2_js.a(e=>chunkIBM4ID4Y_js.a(e)||Array.isArray(e)&&e.length===0,"isEmpty"),L=chunkDPD6ZWL2_js.a(e=>e==null?"":String(e),"toStr"),Ht=chunkDPD6ZWL2_js.a(e=>{if(chunkIBM4ID4Y_js.a(e))return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},"toNum"),Yt=chunkDPD6ZWL2_js.a(e=>{if(e==null)return null;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?null:t},"toDate"),Wt=chunkDPD6ZWL2_js.a(e=>Array.isArray(e)?e:e==null?[]:[e],"toArr"),Kc=chunkDPD6ZWL2_js.a((e,t,r)=>{let n=Ht(e),o=Ht(t);return n!==null&&o!==null&&r(n,o)},"compareNumbers"),Hc=chunkDPD6ZWL2_js.a((e,t,r)=>{let n=Yt(e),o=Yt(t);return n!==null&&o!==null&&r(n.getTime(),o.getTime())},"compareDates"),La=chunkDPD6ZWL2_js.a((e,t,r)=>{if(r.type==="number"||r.type==="currency"){let n=Ht(e),o=Ht(t);if(n!==null&&o!==null)return n===o}return L(e)===L(t)},"equalsForAttr");function $I(e,t){return e?e==="checkbox":typeof t=="boolean"}chunkDPD6ZWL2_js.a($I,"isCheckboxEquality");var Kt=chunkDPD6ZWL2_js.a(e=>({appliesTo:["number","currency","date","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((t,r,n)=>n.type==="date"?Hc(t,r,e):Kc(t,r,e),"evaluateInMemory")}),"orderingSpec"),Qt={is:{appliesTo:["text","phone","number","currency","checkbox","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,r)=>r.type==="checkbox"?e===true==(t===true):La(e,t,r),"evaluateInMemory")},is_not:{appliesTo:["text","phone","number","currency","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,r)=>!La(e,t,r),"evaluateInMemory")},contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>L(e).toLowerCase().includes(L(t).toLowerCase()),"evaluateInMemory")},not_contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>!L(e).toLowerCase().includes(L(t).toLowerCase()),"evaluateInMemory")},starts_with:{appliesTo:["text","phone"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>L(e).toLowerCase().startsWith(L(t).toLowerCase()),"evaluateInMemory")},ends_with:{appliesTo:["text"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>L(e).toLowerCase().endsWith(L(t).toLowerCase()),"evaluateInMemory")},is_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:chunkDPD6ZWL2_js.a(e=>Ma(e),"evaluateInMemory")},is_not_empty:{appliesTo:["text","richtext","number","phone","currency","status","select","date","multiselect","location","user","relation","formula","document"],evaluateInMemory:chunkDPD6ZWL2_js.a(e=>!Ma(e),"evaluateInMemory")},less_than:Kt((e,t)=>e<t),greater_than:Kt((e,t)=>e>t),less_or_equal:Kt((e,t)=>e<=t),greater_or_equal:Kt((e,t)=>e>=t),is_within:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Yt(e),n=chunkJRBNMHMY_js.S(t);return r&&n?r.getTime()>=n.startMs&&r.getTime()<n.endMs:false},"evaluateInMemory")},on_day_month:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Yt(e);if(!r)return false;let n=t;return r.getMonth()+1===n.month&&r.getDate()===n.day},"evaluateInMemory")},any_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Wt(t).map(L);return Wt(e).map(L).some(o=>r.includes(o))},"evaluateInMemory")},none_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let r=Wt(t).map(L);return !Wt(e).map(L).some(o=>r.includes(o))},"evaluateInMemory")}};var Yc=chunkDPD6ZWL2_js.a((e,t)=>({id:`system:${e}`,name:e,label:e,type:t,system:true}),"systemAttribute"),Qc=[...Object.entries(chunkJRBNMHMY_js.V).map(([e,t])=>Yc(e,t))];function XI(e,t,r){let n=t;return Jc(e,{...t.values,id:t.id,objectId:t.objectId,objectName:n.objectName,tenantId:n.tenantId,label:t.label,createdAt:t.createdAt,updatedAt:t.updatedAt,createdBy:t.createdBy,lastUpdatedBy:t.lastUpdatedBy,deletedAt:t.deletedAt,deletedBy:t.deletedBy,visibility:t.visibility,ownedBy:t.ownedBy},[...r,...Qc])}chunkDPD6ZWL2_js.a(XI,"evaluateRecordFilterState");function Jc(e,t,r){if(e.rules.length===0)return true;let n=new Map(r.map(a=>[a.name,a])),o=e.combinator==="or"?"some":"every";return e.rules[o](a=>Xc(a,t,n))}chunkDPD6ZWL2_js.a(Jc,"evaluateFilterState");function Xc(e,t,r){let n=r.get(e.attribute);if(!n)return false;if(e.property&&n.type==="location"){if(!(chunkJRBNMHMY_js.g(e.property)&&chunkJRBNMHMY_js.h(e.operator)))return false;let u=Qt[e.operator];if(!u)return false;let d=t[e.attribute],f=typeof d=="object"&&d!==null?d[e.property]:void 0;return xi(u,"text",e.operator,f,e.value,n)}if(e.property){let u=No(n).find(R=>R.name===e.property);if(!u)return false;let d=chunkJRBNMHMY_js.K(e.operator),f=Qt[d];if(!f?.appliesTo.includes(u.type))return false;let x=t[e.attribute],K=(Array.isArray(x)?x:x==null?[]:[x]).some(R=>{if(typeof R!="object"||R===null)return false;let Z=R.props;return typeof Z!="object"||Z===null?false:xi(f,u.type,d,Z[e.property],e.value,u)});return (e.quantifier??chunkJRBNMHMY_js.J(e.operator))==="none"?!K:K}let o=Qt[e.operator];if(!o||!o.appliesTo.includes(n.type))return false;let a=t[e.attribute],s=n.type==="relation"||n.type==="document"||n.type==="user"?tp(a):a;return xi(o,n.type,e.operator,s,e.value,n)}chunkDPD6ZWL2_js.a(Xc,"evaluateRule");function xi(e,t,r,n,o,a){let[s,u]=Zc(t,r,n,o);return t==="phone"&&u===""&&r==="contains"?false:t==="phone"&&u===""&&r==="not_contains"?true:e.evaluateInMemory(s,u,a)}chunkDPD6ZWL2_js.a(xi,"evaluateNormalizedComparands");function Zc(e,t,r,n){return e==="date"&&(t==="is"||t==="is_not")?[Ba(r),Ba(n)]:e==="phone"?ep(r,n):[$a(e,r),$a(e,n)]}chunkDPD6ZWL2_js.a(Zc,"normalizeOperatorComparands");function Ba(e){let t=ne(e)?Te(e):e;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t.toISOString().slice(0,10);if(typeof t!="string"||t==="")return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let r=new Date(t);return Number.isNaN(r.getTime())?null:r.toISOString().slice(0,10)}chunkDPD6ZWL2_js.a(Ba,"normalizeUtcCalendarDay");function ep(e,t){let r=typeof t=="object"&&t!==null?t:{},n=typeof r.countryCode=="string"?r.countryCode:void 0,o=chunkDPD6ZWL2_js.a(a=>{let s=typeof a=="object"&&a!==null?a:{phoneNumber:a};if(typeof s.phoneNumber!="string")return null;if(!n)return chunkGXSNLYRR_js.a(s.phoneNumber);let u=typeof s.countryCode=="string"?s.countryCode:n;return `${u}:${chunkGXSNLYRR_js.b(s.phoneNumber,u)}`},"normalizeOne");return [o(e),o(t)]}chunkDPD6ZWL2_js.a(ep,"normalizePhoneComparands");function $a(e,t){return e==="currency"?chunkJRBNMHMY_js.H(t):e==="date"?ne(t)?Te(t):t instanceof Date?Number.isNaN(t.getTime())?null:t.toISOString():t:t}chunkDPD6ZWL2_js.a($a,"normalizeComparableValue");function tp(e){let t=chunkDPD6ZWL2_js.a(r=>typeof r!="object"||r===null?r:r.id,"normalizeOne");return Array.isArray(e)?e.map(t):t(e)}chunkDPD6ZWL2_js.a(tp,"normalizeReferenceIds");var Ua="today";function Jt(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}chunkDPD6ZWL2_js.a(Jt,"dateInTimezone");function rp(e,t){if(!("defaultValue"in e))return;let{defaultValue:r}=e;return e.type!=="date"||r!==Ua?r:e.includeTime?t.now.toISOString():Jt(t.now,t.timezone)}chunkDPD6ZWL2_js.a(rp,"resolveAttributeDefaultValue");function aS(e,t,r){if(e.combinator==="or"&&e.rules.length>1)return {};let n=new Map(t.map(a=>[a.name,a])),o={};for(let a of e.rules){if(a.property!==void 0||Object.hasOwn(o,a.attribute))continue;let s=n.get(a.attribute);if(!s)continue;let u=np(a,r);u!==void 0&&(o[a.attribute]=chunkJRBNMHMY_js.j(s).storage.cardinality==="many"?[u]:u);}return o}chunkDPD6ZWL2_js.a(aS,"deriveCreateDefaultsFromFilters");function np(e,t){if(e.operator==="is")return chunkJRBNMHMY_js.D(e.value)?qa(e.value,t):e.value===null||Array.isArray(e.value)?void 0:e.value;if(e.operator==="any_of"){if(!Array.isArray(e.value)||e.value.length!==1)return;let r=e.value[0];return chunkJRBNMHMY_js.D(r)?qa(r,t):r}}chunkDPD6ZWL2_js.a(np,"extractDeterministicValue");function qa(e,t){if(t){if(e.dynamic==="actor")return t.userId;if(e.anchor==="today")return Jt(t.now,t.timezone);if(e.anchor==="now")return t.now.toISOString()}}chunkDPD6ZWL2_js.a(qa,"resolveDynamicValue");function lS(e){let t=[];return e.canModify&&t.push("modify"),e.canSend&&t.push("send"),t}chunkDPD6ZWL2_js.a(lS,"requestedCapabilities");var dS={status:"connector_status",error:"connector_error",provider:"connector_provider"};var ip=(t=>(t.Desktop="desktop",t))(ip||{});function fS(e){return e==="gmail"||e==="outlook"}chunkDPD6ZWL2_js.a(fS,"isMailProvider");var bS=2e5,gS=998;var AS=["force","skip"],TS=["none","all","external_only"],wS="x-fake-signature",xS={override:null,status:"none",failureReason:null,botId:null};var op=/^Session \d+$/;function za(e){let t=e.replace(/\s+/g," ").trim().replace(/[.!?]+$/,"");return t?t.length>60?`${t.slice(0,59).trimEnd()}...`:t:"New conversation"}chunkDPD6ZWL2_js.a(za,"buildAgentFallbackTitle");function ap(e){let t=e.generated?.trim();return t&&!op.test(t)?t:e.firstUserText?za(e.firstUserText):e.emptyLabel}chunkDPD6ZWL2_js.a(ap,"conversationDisplayTitle");var Ii=/^[a-z0-9][a-z0-9-]{0,62}$/;function sp(e){if(!Ii.test(e))throw new chunkJSKLP4GI_js.h(`Invalid schema source id "${e}": expected a lowercase slug matching ${Ii}`,[])}chunkDPD6ZWL2_js.a(sp,"assertSchemaSourceId");function up(e){return {label:e.label,description:e.description??null,icon:e.icon??null,config:e.config,default:e.default??false,metadata:e.metadata??null}}chunkDPD6ZWL2_js.a(up,"viewSyncPayload");function _S(e){let{attributeRemovals:t,objectRemovals:r,renames:n}=e.destructive;return t.length>0||r.length>0||n.length>0}chunkDPD6ZWL2_js.a(_S,"hasDestructiveEntries");var z={objectAdditions:20,totalMutations:500,serializedBytes:512*1024};function vi(e){return e instanceof Error?e.message:String(e)}chunkDPD6ZWL2_js.a(vi,"errorMessage");var lp=Ir.z.enum(["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"]).describe('The attribute\'s data type. Determines which keys `config` accepts and requires: `status`/`select`/`multiselect` need a non-empty `options` array (each `status` option carrying its own `group`); `relation` needs `targets` (non-empty) and `cardinality` ("one" or "many"); `formula` needs `expression` and `returnType`; `rollup` needs `targetAttribute` and `function`. Every other type accepts only the shared presentation keys (`placeholder`, `defaultValue`, `icon`, ...) plus a few type-specific optionals (e.g. `number.decimals`, `date.dateFormat`). An attribute\'s type can never be changed later through this tool \u2014 only through a code migration \u2014 so pick it correctly now.');var Ja=Ir.z.string().min(1).superRefine((e,t)=>{try{Ue(e);}catch(r){t.addIssue({code:Ir.z.ZodIssueCode.custom,message:vi(r)});}}).describe('The attribute\'s machine name \u2014 the record\'s field key, and what `{{ name }}` refers to in a labelExpression. Must be a valid identifier: starts with a letter or underscore, then only letters/digits/underscores ("montantHt", "first_name", "FIRST_NAME" are valid; "first-name", "first name", "123name" are not). Max 63 characters. Cannot be a name reserved by the record shape itself (id, createdAt, updatedAt, createdBy, lastUpdatedBy, objectId, label, embeddingText, values, metadata, deletedAt, deletedBy, schemaVersion).'),dp=Ir.z.string().min(1).superRefine((e,t)=>{chunkJRBNMHMY_js.w(e)&&t.addIssue({code:Ir.z.ZodIssueCode.custom,message:`"${e}" is a reserved object name (${chunkJRBNMHMY_js.C.join(", ")}) and cannot be used for a new object.`});try{$e(e);}catch(r){t.addIssue({code:Ir.z.ZodIssueCode.custom,message:vi(r)});}}).describe(`The new object's machine name: kebab-case slug, lowercase letters/digits/hyphens only, starting with a letter ("products", "user-profiles", "order-items" are valid; "Products", "userProfiles", "user_profiles" are not). Max 63 characters. Cannot be a name the platform reserves for its own system objects, and cannot already exist.`);function Xa(e){return e.superRefine((t,r)=>{try{let n=chunkWKDJGNVI_js.n(t.type,{...t.config??{},description:t.description}),o=Object.keys(t.config??{}).filter(a=>!Object.hasOwn(n,a));o.length>0&&r.addIssue({code:"unrecognized_keys",keys:o,path:["config"],message:`Unrecognized attribute config key${o.length===1?"":"s"}: ${o.join(", ")}`});}catch(n){if(n instanceof chunkJSKLP4GI_js.h){for(let o of n.errors)r.addIssue({code:Ir.z.ZodIssueCode.custom,path:["config",...o.path.map(a=>/^\d+$/.test(a)?Number(a):a)],message:`Config for type "${t.type}" is invalid or incomplete: ${o.message}`});return}r.addIssue({code:Ir.z.ZodIssueCode.custom,path:["config"],message:`Config for type "${t.type}" is invalid or incomplete: ${vi(n)}`});}})}chunkDPD6ZWL2_js.a(Xa,"withConfigCheck");var Za=Ir.z.object({objectName:Ir.z.string().min(1).describe("Name of the existing (or, elsewhere in the same plan, newly created) object this attribute is added to. Ignored for an attribute declared inline in `additive.objects[].attributes` \u2014 there the parent object's own `name` is used instead."),name:Ja,label:Ir.z.string().min(1).max(128).describe("Human-readable display label shown in the UI. 1-128 characters, cannot be empty."),type:lp,config:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional().describe('Type-specific configuration; required keys depend on `type` (see `type`\'s description). Shared optional keys on every type: `placeholder`, `defaultValue`, `icon`, `order`, `hidden`, `archived`, `deprecated`, `metadata`. Per-type keys: `text` \u2014 `multiline`, `minLength`, `maxLength`, `pattern`, `format` ("email"|"url"|"slug"); `number` \u2014 `renderAs` ("number"|"rating"), `min`, `max`, `unit`, `decimals`; `date` \u2014 `dateFormat`, `minDate`, `maxDate`, `includeTime`, `endDate`, `timeFormat` ("12h"|"24h"); `phone` \u2014 `defaultCountryCode` (3-letter); `currency` \u2014 `defaultCurrency`, `allowedCurrencies`, `allowNegative`; `status`/`select`/`multiselect` \u2014 `options` (REQUIRED, non-empty array of `{ value, label, color }`, unique `value`s; for `status` every OPTION also carries `group` as idle|in_progress|finished \u2014 `group` belongs on each option, never on `config` itself; select/multiselect accept `renderAs: "badges"`); `location` \u2014 `granularity`, `defaultCountry`, `allowedCountries`; `user` \u2014 `types` ("user"|"agent"), `multiple`; `relation` \u2014 `targets` (REQUIRED, non-empty array of `{ object }`) and `cardinality` (REQUIRED, "one"|"many"); `formula` \u2014 `expression` (REQUIRED formula string) and `returnType` (REQUIRED); `rollup` \u2014 `targetAttribute` (REQUIRED) and `function` (REQUIRED, e.g. "sum"|"avg"|"count"); `document` \u2014 `properties`, `accepts`, `maxFileSize`. Omit entirely for `richtext`/`checkbox`, which take no type-specific keys.'),required:Ir.z.boolean().optional().describe("Whether the attribute must have a value on every record. Defaults to false (optional)."),description:Ir.z.string().optional().describe("Help text shown under the field in the UI. Not the same as the plan's `summary`.")}).strict(),cp=Xa(Za),pp=Xa(Za.omit({objectName:true})),mp=Ir.z.object({name:dp,label:Ir.z.string().min(1).describe('Human-readable singular display label (e.g. "Devis").'),pluralLabel:Ir.z.string().optional().describe('Human-readable plural display label (e.g. "Devis"/"Invoices"). Defaults from `label` if omitted.'),description:Ir.z.string().optional().describe("Help text describing what this object represents."),icon:chunkWKDJGNVI_js.c.describe("Required icon name for the object. Must be a catalogue value \u2014 call `search_icons` and use a name it returns verbatim. A name that is not in the catalogue is rejected without any hint as to what would have worked, so never guess one."),labelExpression:we.describe('Template used to render a human-readable label for every record of this object \u2014 e.g. shown in relations, search results, and breadcrumbs. MUST contain at least one `{{ attributeName }}` interpolation referencing an attribute this object will actually have (either declared in this same `attributes` array, or an existing attribute if this is an update) \u2014 a plain string with no `{{ }}` at all (e.g. "Devis") is rejected. Interpolations cannot be empty (`{{ }}` is rejected) and only these pipes are allowed: UPPER, LOWER, capitalize, trim, prefix:"...", suffix:"...", wrap:"..." "...", default:"...". `{{ a || b }}` falls back to `b` when `a` is empty. Examples: "{{ firstName }} {{ lastName }}", "{{ numero | UPPER }}", "{{ name || reference }}".'),attributes:Ir.z.array(pp).default([]).describe("Attributes to create on this new object, inline. Same rules as a standalone entry in `additive.attributes`, minus `objectName` (implied by this object). At least one attribute referenced by `labelExpression` should be included here.")}).strict(),es=Ir.z.object({attributeRemovals:Ir.z.array(Ir.z.object({objectName:Ir.z.string().min(1).describe("Object the attribute is removed from."),attributeName:Ir.z.string().min(1).describe("Attribute to delete, together with every record's stored value for it. Must not be a system (code-declared) attribute, and must not be referenced by the object's own `labelExpression` or `embeddingExpression` \u2014 update those first.")}).strict()).default([]).describe("Attributes to permanently delete. Irreversible: record values for the attribute are purged."),objectRemovals:Ir.z.array(Ir.z.object({objectName:Ir.z.string().min(1).describe("Object to delete entirely, together with all its records. Must not be a system (code-declared) object, and must not still be targeted by a `relation` attribute on another object \u2014 retarget or remove that relation first.")}).strict()).default([]).describe("Objects to permanently delete, records included. Irreversible."),renames:Ir.z.array(Ir.z.object({objectName:Ir.z.string().min(1).describe("Object the renamed attribute belongs to."),from:Ir.z.string().min(1).describe("Current attribute name. Must already exist and not be a system attribute."),to:Ja.describe("New attribute name \u2014 same identifier rules as any attribute `name` (see `name` on a planned attribute), and must not collide with another name already on the object, including one added elsewhere in this same plan.")}).strict()).default([]).describe("Attribute renames. Every reference to the old name (labelExpression, views, formulas) must be updated separately \u2014 a rename does not follow references automatically.")}).strict().default({attributeRemovals:[],objectRemovals:[],renames:[]}),ts=Ir.z.string().min(1).describe("ONE sentence naming the intent of the change \u2014 what it is for, not what it contains. The human approving it has already watched every entry land in the preview window and can read every row of the plan itself, so a recap tells them nothing they do not have. A second sentence is warranted only when `destructive` is non-empty: say plainly what will be lost (e.g. 'deletes the \"ancienMontant\" column and its data on every devis'). Never restate the plan \u2014 explain intent."),Ga="The COMPLETE config this view should end up with \u2014 not a patch. Copy the baseline returned by get_default_view and edit it, preserving every tab and setting you are not changing: anything you omit is dropped. To change the columns shown, set `tabs[].columns` (an array of attribute names) \u2014 there is no top-level `columns` on either view type. For a detail view's side panel, set `sidePanel.attributes`. Every attribute name listed must already exist on the object, or be created earlier in this same plan. ONE EXCEPTION to omit-is-dropped: a tab with `type: \"custom\"` renders a component belonging to the application, which you cannot describe or recreate. Copy every such tab through from the baseline exactly as it came, `name`, `component` and `props` untouched \u2014 dropping one, inventing one, or altering any of those three is rejected rather than applied (`name` is the tab's address in links, not its wording). Its `label` and `icon` you may change.",Wa="Opaque token returned by get_default_view alongside the baseline you edited. REQUIRED when the object already exists \u2014 it proves you authored against the baseline that is still current. Must be OMITTED when this plan creates the object, which has no baseline yet.",Ka=Ir.z.string().min(1).describe("Name of the object whose default view of this type is replaced. Not a view name \u2014 a plan can only replace an object's deterministic default view, never create a view or target a non-default one."),fp=Ir.z.discriminatedUnion("viewType",[Ir.z.object({objectName:Ka,viewType:Ir.z.literal("list").describe("Targets the object's default list view (the grid)."),canonicalConfig:chunkJRBNMHMY_js.ma.describe(Ga),baselineToken:Ir.z.string().min(1).optional().describe(Wa)}).strict(),Ir.z.object({objectName:Ka,viewType:Ir.z.literal("detail").describe("Targets the object's default detail view (the single-record view)."),canonicalConfig:chunkJRBNMHMY_js.na.describe(Ga),baselineToken:Ir.z.string().min(1).optional().describe(Wa)}).strict()]);var Ha=Ir.z.string().regex(/^[0-9a-f]{64}$/,"Expected a lowercase SHA-256 hash"),Ya={baseConfigHash:Ha.nullable(),targetConfigHash:Ha,baselineOrigin:Ir.z.enum(["persisted","generated","absent"])},bp=Ir.z.discriminatedUnion("viewType",[Ir.z.object({objectName:Ir.z.string().min(1),viewType:Ir.z.literal("list"),canonicalConfig:chunkJRBNMHMY_js.ma,...Ya}).strict(),Ir.z.object({objectName:Ir.z.string().min(1),viewType:Ir.z.literal("detail"),canonicalConfig:chunkJRBNMHMY_js.na,...Ya}).strict()]).superRefine((e,t)=>{let r=e.baselineOrigin!=="absent";r!==(e.baseConfigHash!==null)&&t.addIssue({code:"custom",path:["baseConfigHash"],message:r?`A ${e.baselineOrigin} baseline requires baseConfigHash`:"An absent baseline requires baseConfigHash to be null"});});function rs(e){return Ir.z.object({objects:Ir.z.array(mp).default([]).describe("New objects to create, with their attributes inline."),attributes:Ir.z.array(cp).default([]).describe("Attributes to add to existing or same-plan objects."),viewUpdates:Ir.z.array(e).default([]).describe("Complete target configs for deterministic default views; never view names.")}).strict().default({objects:[],attributes:[],viewUpdates:[]})}chunkDPD6ZWL2_js.a(rs,"buildAdditiveSchema");function Si(e,t=[],r=new WeakSet){if(e===null||typeof e=="string"||typeof e=="boolean")return null;if(typeof e=="number")return Number.isFinite(e)?null:{path:t,message:"Plan input contains a non-finite number"};if(typeof e!="object")return {path:t,message:"Plan input must contain only JSON-safe values"};if(r.has(e))return {path:t,message:"Plan input cannot contain circular references"};if(Array.isArray(e)){r.add(e);for(let s of Reflect.ownKeys(e))if(s!=="length"&&(typeof s=="symbol"||!/^(0|[1-9]\d*)$/.test(s)))return r.delete(e),{path:[...t,s],message:"Plan input arrays cannot contain non-index JSON properties"};for(let s=0;s<e.length;s++){if(!Object.hasOwn(e,s))return r.delete(e),{path:[...t,s],message:"Plan input cannot contain sparse arrays"};let u=Si(e[s],[...t,s],r);if(u)return r.delete(e),u}return r.delete(e),null}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return {path:t,message:"Plan input must contain only plain JSON objects"};r.add(e);let o=e,a=Reflect.ownKeys(o);for(let s of a){let u=Object.getOwnPropertyDescriptor(o,s);if(typeof s=="symbol"||!(u?.enumerable&&"value"in u))return r.delete(e),{path:[...t,s],message:"Plan input objects must contain enumerable JSON data properties only"}}for(let s of a.sort()){let u=Si(o[s],[...t,s],r);if(u)return r.delete(e),u}return r.delete(e),null}chunkDPD6ZWL2_js.a(Si,"findJsonSafetyIssue");function gp(e){let t=[];return e.additive.objects.forEach((r,n)=>{t.push(["additive","objects",n]),r.attributes.forEach((o,a)=>{t.push(["additive","objects",n,"attributes",a]);});}),e.additive.attributes.forEach((r,n)=>{t.push(["additive","attributes",n]);}),e.additive.viewUpdates.forEach((r,n)=>{t.push(["additive","viewUpdates",n]);}),e.destructive.attributeRemovals.forEach((r,n)=>{t.push(["destructive","attributeRemovals",n]);}),e.destructive.objectRemovals.forEach((r,n)=>{t.push(["destructive","objectRemovals",n]);}),e.destructive.renames.forEach((r,n)=>{t.push(["destructive","renames",n]);}),t}chunkDPD6ZWL2_js.a(gp,"mutationPaths");function ns(e,t){e.additive.objects.length>z.objectAdditions&&t.addIssue({code:"too_big",origin:"array",maximum:z.objectAdditions,inclusive:true,path:["additive","objects",z.objectAdditions],message:`A schema plan can add at most ${z.objectAdditions} objects`});let r=gp(e);r.length>z.totalMutations&&t.addIssue({code:"too_big",origin:"array",maximum:z.totalMutations,inclusive:true,path:r[z.totalMutations],message:`A schema plan can contain at most ${z.totalMutations} mutations; received ${r.length}`});}chunkDPD6ZWL2_js.a(ns,"addPlanLimitIssues");function is(e,t){let r=Si(e);if(r)return t.addIssue({code:"custom",path:r.path,message:r.message}),Ir.z.NEVER;let n=new TextEncoder().encode(chunkRTHLB6T6_js.b(e)).byteLength;return n>z.serializedBytes?(t.addIssue({code:"too_big",origin:"string",maximum:z.serializedBytes,inclusive:true,path:[],message:`A schema plan can serialize to at most ${z.serializedBytes} UTF-8 bytes; received ${n}`}),Ir.z.NEVER):e}chunkDPD6ZWL2_js.a(is,"boundSerializedPlanInput");var yp=rs(fp),hp=rs(bp),Qa=Ir.z.object({schemaPlanVersion:Ir.z.literal(2).describe("Required proposal contract version."),summary:ts,additive:yp,destructive:es}).strict().superRefine((e,t)=>{let r=new Set(e.additive.objects.map(n=>n.name));e.additive.viewUpdates.forEach((n,o)=>{let a=["additive","viewUpdates",o,"baselineToken"];if(r.has(n.objectName)){n.baselineToken!==void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an object added by this plan must not include baselineToken"});return}n.baselineToken===void 0&&t.addIssue({code:"custom",path:a,message:"A view target for an existing object requires baselineToken"});}),ns(e,t);}),zS=Object.assign(Ir.z.preprocess(is,Qa),{shape:Qa.shape}),Ap=Ir.z.object({schemaPlanVersion:Ir.z.literal(2),summary:ts,additive:hp,destructive:es}).strict().superRefine(ns),GS=Ir.z.preprocess(is,Ap);var w=Ir.z.number().finite().nonnegative(),as=Ir.z.enum(Io),Ri=Ir.z.enum(So),Di=Ir.z.enum(vo),ss=Ir.z.object({provider:as,model:Ir.z.string().min(1)}).strict(),JS=Ir.z.object({speed:Ri.optional(),reasoning:Di.optional()}).strict(),us=Ir.z.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),Tp=Ir.z.object({model:ss.optional(),speed:Ri.optional(),reasoning:Di.optional(),imageModel:us.optional()}).strict(),XS=Tp.refine(e=>e.model!==void 0||e.speed!==void 0||e.reasoning!==void 0||e.imageModel!==void 0,{message:"At least one inference override is required"}),ZS=Ir.z.object({model:ss.nullable().optional(),speed:Ri.nullable().optional(),reasoning:Di.nullable().optional(),imageModel:us.nullable().optional()}).strict().refine(e=>Object.keys(e).length>0&&Object.values(e).every(t=>t!==void 0),{message:"At least one inference override is required"}),ls=Ir.z.object({label:Ir.z.string(),denied:Ir.z.boolean().optional(),deletion:Ir.z.object({target:Ir.z.string().optional(),count:w.optional(),restorableDays:w.optional()}).strict().optional(),counts:Ir.z.record(Ir.z.string(),w).optional(),warnings:Ir.z.array(Ir.z.string()).optional()}).strict(),wp=Ir.z.union([Ir.z.object({type:Ir.z.literal("text"),text:Ir.z.string()}).strict(),Ir.z.object({type:Ir.z.literal("reasoning"),text:Ir.z.string()}).strict(),Ir.z.object({type:Ir.z.literal("system"),code:Ir.z.enum(br)}).strict(),Ir.z.object({type:Ir.z.literal("error"),error:Ir.z.string(),errorClass:Ir.z.string().optional()}).strict(),Ir.z.object({type:Ir.z.literal("tool"),toolCallId:Ir.z.string(),name:Ir.z.string(),args:Ir.z.record(Ir.z.string(),Ir.z.unknown()),result:Ir.z.unknown().optional(),error:Ir.z.string().optional(),errorCode:Ir.z.enum(["output_limit_reached","interrupted"]).optional(),state:Ir.z.enum(["streaming","running","completed","error","pending","approval-requested","approval-responded","approval-dispatched"]),durationMs:w.optional(),approvalId:Ir.z.string().optional(),approvalImpact:ls.optional(),approved:Ir.z.boolean().optional(),approvalReason:Ir.z.string().optional(),approvalRelaxableByAuto:Ir.z.boolean().optional()}).strict(),Ir.z.object({type:Ir.z.literal("file"),fileId:Ir.z.string(),name:Ir.z.string(),mimeType:Ir.z.string()}).strict(),Ir.z.object({type:Ir.z.literal("compaction"),state:Ir.z.literal("in-progress"),reason:Ir.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:w.optional(),reportedTokens:w.optional()}).strict(),Ir.z.object({type:Ir.z.literal("compaction"),state:Ir.z.literal("completed"),tokensBefore:w,tokensAfter:w,tokensSaved:w,strategy:Ir.z.enum(["no-op","summary","truncation"]),durationMs:w,summary:Ir.z.string().optional()}).strict(),Ir.z.object({type:Ir.z.literal("compaction"),state:Ir.z.literal("failed"),reason:Ir.z.string(),durationMs:w.optional()}).strict()]),xp=Ir.z.object({id:Ir.z.string(),name:Ir.z.string(),mimeType:Ir.z.string(),size:w}).strict(),Ip=Ir.z.object({id:Ir.z.string(),type:Ir.z.string().transform(e=>e),entityId:Ir.z.string(),label:Ir.z.string(),objectName:Ir.z.string().optional(),startIndex:w,endIndex:w}).strict(),Sp=Ir.z.object({provider:as,model:Ir.z.string(),maxTokens:w.optional(),contextWindow:w.optional()}).strict(),vp=Ir.z.union([Ir.z.date(),Ir.z.string().datetime({offset:true}).transform(e=>new Date(e))]),os=Ir.z.object({id:Ir.z.string(),sessionId:Ir.z.string(),tenantId:Ir.z.string().optional(),runId:Ir.z.string().optional(),role:Ir.z.enum(["user","assistant","system","tool"]),parts:Ir.z.array(wp),attachments:Ir.z.array(xp).optional(),mentions:Ir.z.array(Ip).optional(),model:Sp.optional(),tokenUsage:Ir.z.object({input:w,output:w}).strict().optional(),metadata:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional(),createdAt:vp}).strict(),Rp=Ir.z.object({id:Ir.z.string(),description:Ir.z.string(),status:Ir.z.enum(["pending","in_progress","completed","blocked"]),result:Ir.z.string().optional(),updatedAt:w.optional()}).strict(),Dp=Ir.z.object({id:Ir.z.string(),sessionId:Ir.z.string(),status:Ir.z.enum(["active","completed","abandoned"]),todos:Ir.z.array(Rp),version:w,createdAt:Ir.z.string(),updatedAt:Ir.z.string(),completedAt:Ir.z.string().optional()}).strict(),ds={"session-named":Ir.z.object({name:Ir.z.string()}).strict(),"compaction-start":Ir.z.object({reason:Ir.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:w.optional(),reportedTokens:w.optional()}).strict(),"compaction-end":Ir.z.object({tokensBefore:w,tokensAfter:w,tokensSaved:w,strategy:Ir.z.enum(["no-op","summary","truncation"]),durationMs:w,summary:Ir.z.string().optional()}).strict(),"compaction-failed":Ir.z.object({reason:Ir.z.string()}).strict(),usage:Ir.z.object({messageId:Ir.z.string().min(1).optional(),inputTokens:w,outputTokens:w,totalTokens:w,cacheReadTokens:w.optional(),cacheCreationTokens:w.optional(),contextWindow:w,residentTokens:w,utilization:Ir.z.number().finite().min(0).max(1),costUsd:w.optional()}).strict(),"message-persisted":Ir.z.object({message:os}).strict(),"message-updated":Ir.z.object({message:os}).strict(),"todo-plan-update":Ir.z.object({plan:Dp}).strict(),"approval-context":Ir.z.object({approvalId:Ir.z.string(),toolCallId:Ir.z.string(),impact:ls.optional(),relaxableByAuto:Ir.z.boolean().optional()}).strict(),"session-state":Ir.z.object({state:Ir.z.object({phase:Ir.z.enum(["queued","running","parked","terminal"]),parkedOn:Ir.z.enum(["human","agents"]).optional(),humanRequestIds:Ir.z.array(Ir.z.string()).optional(),outcome:Ir.z.enum(["completed","failed","cancelled","timeout","expired"]).optional()}).strict(),version:Ir.z.number().int().positive(),updatedAt:Ir.z.string().datetime({offset:true})}).strict()};function Ep(e){return e in ds}chunkDPD6ZWL2_js.a(Ep,"isAgentUIDataName");function Cp(e){return new chunkJSKLP4GI_js.h("Invalid agent UI message chunk",e.map(t=>({path:t.path.map(String),message:t.message,code:t.code})))}chunkDPD6ZWL2_js.a(Cp,"agentUIValidationError");function Op(e){if(typeof e!="object"||e===null||typeof e.type!="string")throw new chunkJSKLP4GI_js.h("Invalid agent UI message chunk",[{path:["type"],message:"Expected UI message chunk type",code:"invalid_type"}]);let t=e.type;if(!t.startsWith("data-"))throw new chunkJSKLP4GI_js.h("Invalid agent UI message chunk",[{path:["type"],message:"Expected agent data chunk type",code:"invalid_value"}]);let r=t.slice(5);if(!Ep(r))throw new chunkJSKLP4GI_js.h("Invalid agent UI message chunk",[{path:["type"],message:`Unknown agent UI data type: ${r}`,code:"invalid_value"}]);let n=Ir.z.object({type:Ir.z.literal(`data-${r}`),id:Ir.z.string().optional(),data:ds[r],transient:Ir.z.boolean().optional()}).strict().safeParse(e);if(!n.success)throw Cp(n.error.issues);return n.data}chunkDPD6ZWL2_js.a(Op,"assertCustomAgentUIMessageChunk");function ev(e,t,r){return Op({type:`data-${e}`,...r?.id!==void 0?{id:r.id}:{},data:t,...r?.transient!==void 0?{transient:r.transient}:{}})}chunkDPD6ZWL2_js.a(ev,"agentDataChunk");function Xt(e){return e}chunkDPD6ZWL2_js.a(Xt,"defineOperation");function T(e,t,r){let n=t==="atomic"?"none":t==="local"?"if-not-visible":"follow";return o=>{let a=r?.(o);return {impact:t,navigation:n,focus:{...e(o),...a===void 0?{}:{propertyPath:a}}}}}chunkDPD6ZWL2_js.a(T,"definePresentation");var Ei={id:Ir.z.string().min(1)},D={...Ei,viewId:Ir.z.string().min(1)},_p={add_tab:"add_list_tab",add_list_tab:"add_tab"};function se(e,t,r,n,o){let a=e.views.find(s=>s.id===t);if(!a)throw new chunkJSKLP4GI_js.h(`View "${t}" is not in the draftable state`,[]);if(a.type!==r){let s=_p[o]??`a ${a.type}-view operation`;throw new chunkJSKLP4GI_js.h(`${o} targets ${a.type} view "${t}"; use ${s}`,[])}return {...e,views:e.views.map(s=>{if(s.id!==t)return s;let{derived:u,...d}=n(s);return d})}}chunkDPD6ZWL2_js.a(se,"mapView");function ps(e,t,r){let n=[...e],[o]=n.splice(t,1);return n.splice(r,0,o),n}chunkDPD6ZWL2_js.a(ps,"moveWithin");function Xe(e,t,r){if(t.length!==e.length)throw new chunkJSKLP4GI_js.h(`${r} order lists ${t.length} ids for ${e.length} items`,[]);return t.map(n=>{let o=e.find(a=>a.id===n);if(!o)throw new chunkJSKLP4GI_js.h(`${r} "${n}" is not in this collection`,[]);return o})}chunkDPD6ZWL2_js.a(Xe,"reorderById");function F(e,t,r,n){return se(e,t,"detail",r,n)}chunkDPD6ZWL2_js.a(F,"mapDetailView");function ue(e,t,r){let n=e.tabs.find(o=>o.id===t);if(!n)throw new chunkJSKLP4GI_js.h(`Tab "${t}" is not in view "${e.id}"`,[]);if(n.type!=="form")throw new chunkJSKLP4GI_js.h(`Tab "${t}" is not a form tab`,[]);return {...e,tabs:e.tabs.map(o=>o.id===t?r(n):o)}}chunkDPD6ZWL2_js.a(ue,"mapFormTab");function tr(e,t){let r=e.groups.find(n=>n.id===t);if(!r)throw new chunkJSKLP4GI_js.h(`Group "${t}" is not in tab "${e.id}"`,[]);return r}chunkDPD6ZWL2_js.a(tr,"requireGroup");function Ci(e,t){for(let r of e.groups){let n=r.fields.find(o=>o.id===t);if(n)return {group:r,field:n}}throw new chunkJSKLP4GI_js.h(`Field slot "${t}" is not in tab "${e.id}"`,[])}chunkDPD6ZWL2_js.a(Ci,"locateField");function Zt(e){return {viewId:e.viewId}}chunkDPD6ZWL2_js.a(Zt,"viewFocus");function er(e){return {viewId:e.viewId,tabId:e.tabId}}chunkDPD6ZWL2_js.a(er,"tabFocus");function ms(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}}chunkDPD6ZWL2_js.a(ms,"groupFocus");function fs(e){return {viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}}chunkDPD6ZWL2_js.a(fs,"fieldFocus");function bs(e){return {viewId:e.viewId,tabId:e.tab.id}}chunkDPD6ZWL2_js.a(bs,"addTabFocus");function gs(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.group.id}}chunkDPD6ZWL2_js.a(gs,"addGroupFocus");function ys(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.groupId,fieldId:e.field.id}}chunkDPD6ZWL2_js.a(ys,"addFieldFocus");function hs(e){return {viewId:e.viewId,tabId:e.tabId,groupId:e.toGroupId,fieldId:e.fieldId}}chunkDPD6ZWL2_js.a(hs,"moveFieldFocus");function Ze(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(Ze,"firstChangedProperty");var Np=chunkJRBNMHMY_js.ka,kp=chunkJRBNMHMY_js.fa,Pp=chunkJRBNMHMY_js.ea,jp=Ir.z.object({...D,type:Ir.z.literal("add_tab"),tab:Np}),Fp={type:"add_tab",schema:jp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{if(r.tabs.some(n=>n.id===t.tab.id))throw new chunkJSKLP4GI_js.h(`Tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,tabs:[...r.tabs,t.tab]}},"add_tab"),"apply"),focus:bs,presentation:T(bs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},Vp=Ir.z.object({...D,type:Ir.z.literal("remove_tab"),tabId:Ir.z.string().min(1)}),Mp={type:"remove_tab",schema:Vp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new chunkJSKLP4GI_js.h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.filter(n=>n.id!==t.tabId)}},"remove_tab"),"apply"),focus:er,presentation:T(er,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Ss=Ir.z.object({label:Ir.z.string().min(1).optional(),icon:chunkWKDJGNVI_js.c.optional(),order:Ir.z.number().int().optional()}),Lp=Object.keys(Ss.shape),Bp=Ir.z.object({...D,type:Ir.z.literal("update_tab"),tabId:Ir.z.string().min(1),changes:Ss.refine(e=>Object.keys(e).length>0,"update_tab needs at least one change")}),As=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabFocus"),$p={type:"update_tab",schema:Bp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{if(!r.tabs.some(n=>n.id===t.tabId))throw new chunkJSKLP4GI_js.h(`Tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,tabs:r.tabs.map(n=>n.id===t.tabId?{...n,...t.changes}:n)}},"update_tab"),"apply"),focus:As,presentation:T(As,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},Up=Ir.z.object({...D,type:Ir.z.literal("reorder_tabs"),tabOrder:Ir.z.array(Ir.z.string().min(1))}),qp={type:"reorder_tabs",schema:Up,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>({...r,tabs:Xe(r.tabs,t.tabOrder,"Tab")}),"reorder_tabs"),"apply"),focus:Zt,presentation:T(Zt,"local"),describe:chunkDPD6ZWL2_js.a(()=>"R\xE9ordonne les onglets","describe")},zp=Ir.z.object({...D,type:Ir.z.literal("add_group"),tabId:Ir.z.string().min(1),group:kp}),Gp={type:"add_group",schema:zp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{if(n.groups.some(o=>o.id===t.group.id))throw new chunkJSKLP4GI_js.h(`Group "${t.group.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:[...n.groups,t.group]}}),"add_group"),"apply"),focus:gs,presentation:T(gs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute le groupe \xAB ${e.group.label} \xBB`,"describe")},Wp=Ir.z.object({...D,type:Ir.z.literal("remove_group"),tabId:Ir.z.string().min(1),groupId:Ir.z.string().min(1)}),Kp={type:"remove_group",schema:Wp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>(tr(n,t.groupId),{...n,groups:n.groups.filter(o=>o.id!==t.groupId)})),"remove_group"),"apply"),focus:ms,presentation:T(ms,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime le groupe ${e.groupId}`,"describe")},Hp=Ir.z.object({...D,type:Ir.z.literal("update_group"),tabId:Ir.z.string().min(1),groupId:Ir.z.string().min(1),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),description:Ir.z.string().optional(),collapsible:Ir.z.boolean().optional(),collapsed:Ir.z.boolean().optional(),order:Ir.z.number().int().optional()}).refine(e=>Object.keys(e).length>0,"update_group needs at least one change")}),Ts=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId,groupId:e.groupId}),"updateGroupFocus"),Yp={type:"update_group",schema:Hp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>(tr(n,t.groupId),{...n,groups:n.groups.map(o=>o.id===t.groupId?{...o,...t.changes}:o)})),"update_group"),"apply"),focus:Ts,presentation:T(Ts,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme le groupe en \xAB ${e.changes.label} \xBB`:"Modifie le groupe","describe")},Qp=Ir.z.object({...D,type:Ir.z.literal("reorder_groups"),tabId:Ir.z.string().min(1),groupOrder:Ir.z.array(Ir.z.string().min(1))}),Jp={type:"reorder_groups",schema:Qp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>({...n,groups:Xe(n.groups,t.groupOrder,"Group")})),"reorder_groups"),"apply"),focus:er,presentation:T(er,"local"),describe:chunkDPD6ZWL2_js.a(()=>"R\xE9ordonne les groupes","describe")},Xp=Ir.z.object({...D,type:Ir.z.literal("add_field"),tabId:Ir.z.string().min(1),groupId:Ir.z.string().min(1),field:Pp,index:Ir.z.number().int().min(0).optional()}),Zp={type:"add_field",schema:Xp,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{if(tr(n,t.groupId),n.groups.some(o=>o.fields.some(a=>a.id===t.field.id)))throw new chunkJSKLP4GI_js.h(`Field slot "${t.field.id}" already exists in tab "${t.tabId}"`,[]);return {...n,groups:n.groups.map(o=>{if(o.id!==t.groupId)return o;let a=t.index??o.fields.length;return {...o,fields:[...o.fields.slice(0,a),t.field,...o.fields.slice(a)]}})}}),"add_field"),"apply"),focus:ys,presentation:T(ys,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute le champ ${e.field.attribute??e.field.attributeGroup?.label??e.field.id}`,"describe")},em=Ir.z.object({...D,type:Ir.z.literal("remove_field"),tabId:Ir.z.string().min(1),fieldId:Ir.z.string().min(1)}),tm={type:"remove_field",schema:em,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{let{group:o}=Ci(n,t.fieldId);return {...n,groups:n.groups.map(a=>a.id===o.id?{...a,fields:a.fields.filter(s=>s.id!==t.fieldId)}:a)}}),"remove_field"),"apply"),focus:fs,presentation:T(fs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Retire le champ ${e.fieldId}`,"describe")},rm=Ir.z.object({...D,type:Ir.z.literal("move_field"),tabId:Ir.z.string().min(1),fieldId:Ir.z.string().min(1),toGroupId:Ir.z.string().min(1),toIndex:Ir.z.number().int().min(0)}),nm={type:"move_field",schema:rm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>{let{group:o,field:a}=Ci(n,t.fieldId),s=tr(n,t.toGroupId);if(o.id===s.id){let u=o.fields.findIndex(d=>d.id===t.fieldId);return {...n,groups:n.groups.map(d=>d.id===o.id?{...d,fields:ps(d.fields,u,t.toIndex)}:d)}}return {...n,groups:n.groups.map(u=>u.id===o.id?{...u,fields:u.fields.filter(d=>d.id!==t.fieldId)}:u.id===s.id?{...u,fields:[...u.fields.slice(0,t.toIndex),a,...u.fields.slice(t.toIndex)]}:u)}}),"move_field"),"apply"),focus:hs,presentation:T(hs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`D\xE9place le champ ${e.fieldId} vers le groupe ${e.toGroupId}`,"describe")},im=Ir.z.object({...D,type:Ir.z.literal("update_field"),tabId:Ir.z.string().min(1),fieldId:Ir.z.string().min(1),changes:Ir.z.object({label:Ir.z.string().optional(),readOnly:Ir.z.boolean().optional(),span:Ir.z.number().int().min(1).max(12).optional()}).refine(e=>Object.keys(e).length>0,"update_field needs at least one change")}),ws=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId,fieldId:e.fieldId}),"updateFieldFocus"),om={type:"update_field",schema:im,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>ue(r,t.tabId,n=>(Ci(n,t.fieldId),{...n,groups:n.groups.map(o=>({...o,fields:o.fields.map(a=>a.id===t.fieldId?{...a,...t.changes}:a)}))})),"update_field"),"apply"),focus:ws,presentation:T(ws,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>`Modifie le champ ${e.fieldId}`,"describe")},vs=Ir.z.object({source:chunkJRBNMHMY_js.ia.optional(),columns:chunkJRBNMHMY_js.Z.optional(),filters:chunkJRBNMHMY_js.aa.nullable().optional(),sorts:chunkJRBNMHMY_js.$.nullable().optional(),allowCreate:Ir.z.boolean().optional(),allowEdit:Ir.z.boolean().optional(),allowDelete:Ir.z.boolean().optional(),createMode:Ir.z.enum(["redirect","inline","peek"]).optional()}),am=Object.keys(vs.shape),Rs=Ir.z.object({emailAttributeIds:Ir.z.array(Ir.z.string().min(1)).optional(),attribute:Ir.z.string().min(1).optional(),titleAttribute:Ir.z.string().min(1).nullable().optional(),component:Ir.z.string().nullable().optional(),props:Ir.z.record(Ir.z.string(),Ir.z.unknown()).nullable().optional()}),sm=Object.keys(Rs.shape),um={emailAttributeIds:["emails","meetings"],attribute:["richtext"],titleAttribute:["richtext"],component:["custom"],props:["custom"]},lm=Ir.z.object({...D,type:Ir.z.literal("update_tab_config"),tabId:Ir.z.string().min(1),changes:Rs.refine(e=>Object.keys(e).length>0,"update_tab_config needs at least one change")}),xs=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTabConfigFocus"),dm={type:"update_tab_config",schema:lm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{let n=r.tabs.find(o=>o.id===t.tabId);if(!n)throw new chunkJSKLP4GI_js.h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);for(let o of Object.keys(t.changes)){let a=um[o];if(a&&!a.includes(n.type))throw new chunkJSKLP4GI_js.h(`"${o}" is not a setting of a "${n.type}" tab`,[])}return {...r,tabs:r.tabs.map(o=>o.id===t.tabId?{...o,...t.changes}:o)}},"update_tab_config"),"apply"),focus:xs,presentation:T(xs,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>`Configure ${Object.keys(e.changes).join(", ")} sur l'onglet ${e.tabId}`,"describe")},cm=Ir.z.object({...D,type:Ir.z.literal("update_table_tab"),tabId:Ir.z.string().min(1),changes:vs.refine(e=>Object.keys(e).length>0,"update_table_tab needs at least one change")}),Is=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateTableTabFocus"),pm={type:"update_table_tab",schema:cm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>{let n=r.tabs.find(u=>u.id===t.tabId);if(!n)throw new chunkJSKLP4GI_js.h(`Tab "${t.tabId}" is not in view "${r.id}"`,[]);if(n.type!=="table")throw new chunkJSKLP4GI_js.h(`Tab "${t.tabId}" is not a table tab`,[]);let o=Object.entries(t.changes),a=Object.fromEntries(o.filter(([,u])=>u!==null)),s=new Set(o.filter(([,u])=>u===null).map(([u])=>u));return {...r,tabs:r.tabs.map(u=>u.id===t.tabId?Object.fromEntries(Object.entries({...u,...a}).filter(([d])=>!s.has(d))):u)}},"update_table_tab"),"apply"),focus:Is,presentation:T(Is,"atomic",Ze),describe:chunkDPD6ZWL2_js.a(e=>e.changes.columns?`Affiche ${e.changes.columns.length} colonne(s) dans l'onglet ${e.tabId}`:`Modifie l'onglet ${e.tabId}`,"describe")},mm=Ir.z.object({...D,type:Ir.z.literal("set_side_panel"),sidePanel:Ir.z.object({attributes:Ir.z.array(Ir.z.string().min(1)),width:Ir.z.number().int().min(1).optional()}).nullable()}),fm={type:"set_side_panel",schema:mm,apply:chunkDPD6ZWL2_js.a((e,t)=>F(e,t.viewId,r=>({...r,config:{...r.config,sidePanel:t.sidePanel??void 0}}),"set_side_panel"),"apply"),focus:Zt,presentation:T(Zt,"atomic",()=>["config","sidePanel"]),describe:chunkDPD6ZWL2_js.a(e=>e.sidePanel?"Active le panneau lat\xE9ral":"Retire le panneau lat\xE9ral","describe")},Ce=[Fp,Mp,$p,qp,Gp,Kp,Yp,Jp,Zp,tm,nm,om,pm,dm,fm];var et={...D,tabId:Ir.z.string().min(1)};function rr(e){return {viewId:e.viewId}}chunkDPD6ZWL2_js.a(rr,"viewFocus");function le(e){return {viewId:e.viewId,tabId:e.tabId}}chunkDPD6ZWL2_js.a(le,"tabFocus");function Ds(e){return {viewId:e.viewId,tabId:e.tab.id}}chunkDPD6ZWL2_js.a(Ds,"addTabFocus");function bm(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(bm,"firstChangedProperty");function Cs(e){let t={...e};for(let r of chunkJRBNMHMY_js.sa)delete t[r];return t}chunkDPD6ZWL2_js.a(Cs,"withoutKanbanKeys");function Os(e){let t={...e};for(let r of chunkJRBNMHMY_js.ra)delete t[r];return t}chunkDPD6ZWL2_js.a(Os,"withoutTableKeys");function gm(e,t,r,n){let o=chunkJRBNMHMY_js.la.safeParse(t);if(!o.success){if(!chunkJRBNMHMY_js.la.safeParse(e).success)return t;let a=o.error.issues.map(s=>s.path.length?`${s.path.join(".")}: ${s.message}`:s.message).join(", ");throw new chunkJSKLP4GI_js.h(`List tab "${n}" in view "${r}" would no longer be publishable: ${a}`,[])}return t}chunkDPD6ZWL2_js.a(gm,"assertStillPublishableTab");function nr(e,t,r,n,o){return se(e,t,"list",a=>{let s=a.config.tabs??[];if(!s.some(u=>u.id===r))throw new chunkJSKLP4GI_js.h(`List tab "${r}" is not in view "${t}"`,[]);return {...a,config:{...a.config,tabs:s.map(u=>u.id===r?gm(u,n(u),t,r):u)}}},o)}chunkDPD6ZWL2_js.a(nr,"mapListTab");var ym=chunkJRBNMHMY_js.la,_s=chunkJRBNMHMY_js.ba,hm=chunkJRBNMHMY_js.$;function G(e,t,r,n){let o=Ir.z.object({...et,type:Ir.z.literal(e),value:r});return {type:e,schema:o,apply:chunkDPD6ZWL2_js.a((a,s)=>nr(a,s.viewId,s.tabId,u=>{if(s.value===null){let{[t]:d,...f}=u;return f}return {...u,[t]:s.value}},e),"apply"),focus:le,presentation:T(le,"atomic",()=>[String(t)]),describe:chunkDPD6ZWL2_js.a(a=>n(a.value),"describe")}}chunkDPD6ZWL2_js.a(G,"setOnTab");var Am=Ir.z.object({...D,type:Ir.z.literal("add_list_tab"),tab:ym}),Tm={type:"add_list_tab",schema:Am,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>{let n=r.config.tabs??[];if(n.some(o=>o.id===t.tab.id))throw new chunkJSKLP4GI_js.h(`List tab "${t.tab.id}" already exists in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:[...n,t.tab]}}},"add_list_tab"),"apply"),focus:Ds,presentation:T(Ds,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'onglet \xAB ${e.tab.label} \xBB`,"describe")},wm=Ir.z.object({...et,type:Ir.z.literal("remove_list_tab")}),xm={type:"remove_list_tab",schema:wm,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>{let n=r.config.tabs??[];if(!n.some(o=>o.id===t.tabId))throw new chunkJSKLP4GI_js.h(`List tab "${t.tabId}" is not in view "${t.viewId}"`,[]);return {...r,config:{...r.config,tabs:n.filter(o=>o.id!==t.tabId)}}},"remove_list_tab"),"apply"),focus:le,presentation:T(le,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'onglet ${e.tabId}`,"describe")},Im=Ir.z.object({...et,type:Ir.z.literal("update_list_tab"),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),icon:chunkWKDJGNVI_js.c.optional(),default:Ir.z.boolean().optional(),visibility:Ir.z.enum(chunkJRBNMHMY_js.y).optional()}).refine(e=>Object.keys(e).length>0,"update_list_tab needs at least one change")}),Es=chunkDPD6ZWL2_js.a(e=>({viewId:e.viewId,tabId:e.tabId}),"updateListTabFocus"),Sm={type:"update_list_tab",schema:Im,apply:chunkDPD6ZWL2_js.a((e,t)=>nr(e,t.viewId,t.tabId,r=>({...r,...t.changes}),"update_list_tab"),"apply"),focus:Es,presentation:T(Es,"atomic",bm),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'onglet en \xAB ${e.changes.label} \xBB`:`Modifie l'onglet ${e.tabId}`,"describe")},vm=Ir.z.object({...D,type:Ir.z.literal("reorder_list_tabs"),tabOrder:Ir.z.array(Ir.z.string().min(1))}),Rm={type:"reorder_list_tabs",schema:vm,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>({...r,config:{...r.config,tabs:Xe(r.config.tabs??[],t.tabOrder,"List tab")}}),"reorder_list_tabs"),"apply"),focus:rr,presentation:T(rr,"local"),describe:chunkDPD6ZWL2_js.a(()=>"R\xE9ordonne les onglets","describe")},Dm=G("set_columns","columns",Ir.z.array(Ir.z.string().min(1)),e=>`Affiche ${Array.isArray(e)?e.length:0} colonne(s)`),Em=G("set_column_sizing","columnSizing",Ir.z.record(Ir.z.string(),Ir.z.number().int().positive()),()=>"Ajuste la largeur des colonnes"),Cm=Ir.z.object({...et,type:Ir.z.literal("set_layout"),value:Ir.z.enum(["table","list","kanban"])}),Om={type:"set_layout",schema:Cm,apply:chunkDPD6ZWL2_js.a((e,t)=>nr(e,t.viewId,t.tabId,r=>{if(t.value!=="kanban")return {...Cs(r),layout:t.value};if(r.groupByAttribute===void 0)throw new chunkJSKLP4GI_js.h(`List tab "${t.tabId}" cannot switch to kanban without a group attribute \u2014 use set_group_by, which switches the layout itself`,[]);return {...Os(r),layout:"kanban"}},"set_layout"),"apply"),focus:le,presentation:T(le,"atomic",()=>["layout"]),describe:chunkDPD6ZWL2_js.a(e=>`Passe en affichage ${e.value}`,"describe")},_m=Ir.z.object({...et,type:Ir.z.literal("set_group_by"),value:Ir.z.string().min(1).nullable()}),Nm={type:"set_group_by",schema:_m,apply:chunkDPD6ZWL2_js.a((e,t)=>nr(e,t.viewId,t.tabId,r=>t.value===null?{...Cs(r),layout:"table"}:{...Os(r),layout:"kanban",groupByAttribute:t.value},"set_group_by"),"apply"),focus:le,presentation:T(le,"atomic",()=>["groupByAttribute"]),describe:chunkDPD6ZWL2_js.a(e=>e.value?`Regroupe par ${e.value} en kanban`:"Retire le regroupement, retour en table","describe")},km=G("set_filters","filters",_s.nullable(),e=>e?"Modifie les filtres":"Retire les filtres"),Pm=G("set_sorts","sorts",hm.nullable(),e=>e?"Modifie le tri":"Retire le tri"),jm=G("set_create_mode","createMode",Ir.z.enum(["redirect","inline","peek"]),e=>`Cr\xE9ation en mode ${e}`),Fm=G("set_open_mode","openMode",Ir.z.enum(["side","page"]),e=>e==="side"?"Ouvre les fiches en c\xF4t\xE9":"Ouvre les fiches en pleine page"),Vm=G("set_read_only","readOnly",Ir.z.boolean(),e=>e?"Passe l'onglet en lecture seule":"Rend l'onglet modifiable"),Mm=G("set_card_user_attribute","cardUserAttribute",Ir.z.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire l'utilisateur des cartes"),Lm=G("set_card_date_attribute","cardDateAttribute",Ir.z.string().min(1).nullable(),e=>e?`Affiche ${e} sur les cartes`:"Retire la date des cartes"),Bm=G("set_description_attribute","descriptionAttribute",Ir.z.string().min(1).nullable(),e=>e?`Affiche ${e} en description`:"Retire la description"),$m=G("set_display_attributes","displayAttributes",chunkJRBNMHMY_js._.nullable(),e=>`Affiche ${Array.isArray(e)?e.length:0} attribut(s)`),Um=Ir.z.object({...D,type:Ir.z.literal("set_default_filters"),filters:_s.nullable()}),qm={type:"set_default_filters",schema:Um,apply:chunkDPD6ZWL2_js.a((e,t)=>se(e,t.viewId,"list",r=>{if(t.filters===null){let{defaultFilters:n,...o}=r.config;return {...r,config:o}}return {...r,config:{...r.config,defaultFilters:t.filters}}},"set_default_filters"),"apply"),focus:rr,presentation:T(rr,"atomic",()=>["config","defaultFilters"]),describe:chunkDPD6ZWL2_js.a(e=>e.filters?"Modifie les filtres de la vue":"Retire les filtres de la vue","describe")},Oe=[qm,Tm,xm,Sm,Rm,Dm,Em,Om,Nm,km,Pm,jm,Fm,Vm,Mm,Lm,Bm,$m];function tt(e,t){return e.objects.find(r=>r.id===t)}chunkDPD6ZWL2_js.a(tt,"findObject");var zm=new Set(["formula","rollup"]);function _e(e){return zm.has(e.attributeType)}chunkDPD6ZWL2_js.a(_e,"isComputedAttribute");var Ns={sum:"number",avg:"number",count:"number",countValues:"number",countUniqueValues:"number",countEmpty:"number",percentEmpty:"number",percentNotEmpty:"number",earliest:"date",latest:"date",original:"multiselect"};function Gm(e){return typeof e=="string"&&e in Ns?Ns[e]:void 0}chunkDPD6ZWL2_js.a(Gm,"rollupReturnTypeOf");function Ps(e,t){let r=tt(e,t);if(!r)throw new chunkJSKLP4GI_js.h(`Object "${t}" is not in the draftable state`,[]);return r}chunkDPD6ZWL2_js.a(Ps,"requireObject");function ir(e){return e.config??{}}chunkDPD6ZWL2_js.a(ir,"configOf");function W(e){let t=ir(e).targets;return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null&&typeof r.object=="string"):[]}chunkDPD6ZWL2_js.a(W,"relationTargets");function Ne(e){let t=W(e).filter(r=>r.object!==ee);return t.length===1?t[0]?.object:void 0}chunkDPD6ZWL2_js.a(Ne,"relationTargetObjectName");function Wm(e){let t=ir(e),r=e.attributeType,n={name:e.name,type:r,id:e.id},o=t.optionsSource;if(r==="relation"){let a=Ne(e);return {...n,...t.cardinality==="one"||t.cardinality==="many"?{cardinality:t.cardinality}:{},...a===void 0?{}:{targetObjectName:a},targets:W(e)}}if(r==="formula")return {...n,...t.returnType===void 0?{}:{returnType:t.returnType},...o===void 0?{}:{optionsSource:o}};if(r==="rollup"){let a=Gm(t.function);return {...n,...a===void 0?{}:{returnType:a},...o===void 0?{}:{optionsSource:o}}}return r==="select"||r==="status"||r==="multiselect"?{...n,...Array.isArray(t.options)?{options:t.options}:{}}:n}chunkDPD6ZWL2_js.a(Wm,"toCompileAttribute");function ks(e,t){return {objectName:e.name,attributes:t.filter(r=>r.objectId===e.id).map(Wm)}}chunkDPD6ZWL2_js.a(ks,"toCompileObject");function Oi(e,t){let r=Ps(e,t);return {...ks(r,e.attributes),relatedObjects:Object.fromEntries(e.objects.map(n=>[n.name,ks(n,e.attributes)]))}}chunkDPD6ZWL2_js.a(Oi,"computedCompileSchemaOf");function Km(e){return {id:e.id,name:e.name,label:e.label,type:"rollup",...ir(e)}}chunkDPD6ZWL2_js.a(Km,"toRollupAttribute");function js(e){try{return e()}catch(t){throw t instanceof g?new chunkJSKLP4GI_js.h(t.message,[]):t}}chunkDPD6ZWL2_js.a(js,"asValidationError");function or(e,t){let r=Oi(e,t.objectId);return js(()=>Fs(t,r))}chunkDPD6ZWL2_js.a(or,"computedPlanOf");function Fs(e,t){if(e.attributeType==="rollup")return Ca(Km(e),t);let r=ir(e);return Ut({attributeName:e.name,expression:String(r.expression??""),returnType:r.returnType,schema:t})}chunkDPD6ZWL2_js.a(Fs,"compilePlan");function _i(e){js(()=>va(e.map(t=>({attributeName:t.attributeName,dependencies:t.dependencies}))));}chunkDPD6ZWL2_js.a(_i,"assertAcyclicComputed");function Hm(e,t){switch(e.kind){case "local":case "computed":return e.attributeName===t;case "relation":return e.relationName===t;case "options":return false;default:return e}}chunkDPD6ZWL2_js.a(Hm,"dependencyNames");function rt(e,t){let r=Oi(e,t),n=[];for(let o of e.attributes)if(!(o.objectId!==t||!_e(o)))try{n.push(Fs(o,r));}catch(a){if(!(a instanceof g))throw a}return n}chunkDPD6ZWL2_js.a(rt,"compilablePlansOf");function Ni(e,t,r){let n=Ps(e,t),o=[];for(let a of rt(e,t))a.attributeName!==r&&a.dependencies.some(s=>Hm(s,r))&&o.push(a.attributeName);for(let a of e.objects)if(a.id!==t)for(let s of rt(e,a.id))s.dependencies.some(d=>{if(d.kind!=="relation"||d.targetAttributeName!==r)return false;let f=e.attributes.find(x=>x.objectId===a.id&&x.name===d.relationName&&x.attributeType==="relation");return f!==void 0&&Ne(f)===n.name})&&o.push(`${a.name}.${s.attributeName}`);return o}chunkDPD6ZWL2_js.a(Ni,"dependentsOf");function nt(e){let t=e.config?.bilateral;if(typeof t!="object"||t===null)return;let{object:r,attribute:n}=t;return typeof r=="string"&&typeof n=="string"?{object:r,attribute:n}:void 0}chunkDPD6ZWL2_js.a(nt,"bilateralDeclarationOf");function Ym(e,t){return t!==void 0&&e.attributeType===t.attributeType&&Qm(e,t)}chunkDPD6ZWL2_js.a(Ym,"sameAttribute");function Qm(e,t){return JSON.stringify(e.config??{})===JSON.stringify(t.config??{})}chunkDPD6ZWL2_js.a(Qm,"sameConfig");function Jm(e,t){let r=chunkDPD6ZWL2_js.a(n=>Ym(n,e.attributes.find(o=>o.id===n.id)),"untouched");for(let n of t.attributes){if(n.attributeType!=="relation")continue;let o=nt(n);if(o===void 0||r(n))continue;let s=t.objects.find(R=>R.id===n.objectId)?.name??n.objectId,u=t.objects.find(R=>R.name===o.object),d=t.attributes.find(R=>R.objectId===u?.id&&R.name===o.attribute),f=`relation "${s}.${n.name}" declares inverse "${o.object}.${o.attribute}"`;if(d===void 0)throw new chunkJSKLP4GI_js.h(`${f}, which object "${o.object}" does not have; draft it first`,[]);if(d.attributeType!=="relation")throw new chunkJSKLP4GI_js.h(`${f}, which is not a relation`,[]);let x=nt(d);if(!(W(d).some(R=>R.object===s)&&(r(d)?x===void 0||x.object===s&&x.attribute===n.name:x?.object===s&&x.attribute===n.name)))throw new chunkJSKLP4GI_js.h(`${f}, which does not point back to "${s}.${n.name}"`,[])}}chunkDPD6ZWL2_js.a(Jm,"assertBilateralPairs");function Vs(e,t,r){let n=`fld_${e}_${t}`;return r===0?n:`${n}_${r}`}chunkDPD6ZWL2_js.a(Vs,"makeFieldId");function Xm(e,t){return e.attributeGroup?e.attributeGroup.id:e.attribute?e.attribute:`slot${t}`}chunkDPD6ZWL2_js.a(Xm,"seedOf");function Zm(e){let t=new Map,r=e.fields.map((n,o)=>{if(n.id)return n;let a=Xm(n,o),s=t.get(a)??0;return t.set(a,s+1),{...n,id:Vs(e.id,a,s)}});return {...e,fields:r}}chunkDPD6ZWL2_js.a(Zm,"withIds");function ki(e){return e.map(t=>t.type==="form"?{...t,groups:t.groups.map(Zm)}:t)}chunkDPD6ZWL2_js.a(ki,"ensureFieldIds");function ef(e){return {id:e.id??e.name,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon}}}chunkDPD6ZWL2_js.a(ef,"toDraftableObject");function tf(e){let t=e.id??e.name;return (e.attributes??[]).map(r=>rf(r,t))}chunkDPD6ZWL2_js.a(tf,"toDraftableAttributes");function ke(e){return {id:e.id,name:e.name,label:e.label,type:e.attributeType,...e.config}}chunkDPD6ZWL2_js.a(ke,"toAttribute");function rf(e,t){let{id:r,name:n,label:o,type:a,...s}=e;return {id:e.id??e.name,objectId:t,name:e.name,label:e.label??e.name,attributeType:e.type,config:s}}chunkDPD6ZWL2_js.a(rf,"toDraftableAttribute");function Ms(e){let t=e[0];return t?`{{ ${t.name} }}`:"{{ id }}"}chunkDPD6ZWL2_js.a(Ms,"draftedLabelExpression");function ar(e,t){let r=t.filter(n=>n.objectId===e.id);return {id:e.id,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon},labelExpression:Ms(r),attributes:r.map((n,o)=>{let a=ke(n);return a.order===void 0?{...a,order:o}:a})}}chunkDPD6ZWL2_js.a(ar,"draftedObjectDefinition");var nf=0x100000001b3n,of=0xffffffffffffffffn;function Ls(e,t){let r=t;for(let n of new TextEncoder().encode(e))r^=BigInt(n),r=r*nf&of;return r}chunkDPD6ZWL2_js.a(Ls,"fnv1a64");function Pi(e,t){let r=`${e.toLowerCase()}:${t}`,n=Ls(r,0xcbf29ce484222325n).toString(16).padStart(16,"0"),o=Ls(`${t}:${r}`,0x84222325cbf29ce4n).toString(16).padStart(16,"0"),a=n+o,s=(Number.parseInt(a[16],16)&3|8).toString(16);return [a.slice(0,8),a.slice(8,12),`8${a.slice(13,16)}`,`${s}${a.slice(17,20)}`,a.slice(20,32)].join("-")}chunkDPD6ZWL2_js.a(Pi,"viewIdFor");function fe(e){return {list:Pi(e,"list"),detail:Pi(e,"detail")}}chunkDPD6ZWL2_js.a(fe,"defaultViewIdsFor");function Bs(e,t,r){if(e==="list"){let s=He(r);return {id:t,objectName:s.object,type:"list",label:s.label,tabs:[],config:s.config,derived:true}}let n=Ke(r),{tabs:o,...a}=n.config;return {id:t,objectName:n.object,type:"detail",label:n.label,tabs:ki(o??[]),config:a,derived:true}}chunkDPD6ZWL2_js.a(Bs,"derivedView");function ji(e,t){let r=ar(e,t),n=fe(e.id);return ["list","detail"].map(o=>Bs(o,n[o],r))}chunkDPD6ZWL2_js.a(ji,"defaultViewsFor");function Fi(e,t,r){return Bs(e.type,e.id,ar(t,r))}chunkDPD6ZWL2_js.a(Fi,"regenerateDerived");function Pe(e,t){let r=e.objects.find(n=>n.id===t);if(!r)throw new chunkJSKLP4GI_js.h(`Object "${t}" is not in the draftable state`,[]);return r}chunkDPD6ZWL2_js.a(Pe,"requireObject");function Vi(e,t,r){return {...e,attributes:[...r],views:e.views.map(n=>n.derived&&n.objectName===t.name?Fi(n,t,r):n)}}chunkDPD6ZWL2_js.a(Vi,"withDerivedViews");function sr(e){return {objectId:e.objectId}}chunkDPD6ZWL2_js.a(sr,"objectFocus");function ur(e){return {objectId:e.objectId,recordId:e.recordId}}chunkDPD6ZWL2_js.a(ur,"recordFocus");function $s(e){return {objectId:e.objectId,attributeId:e.attributeId}}chunkDPD6ZWL2_js.a($s,"attributeFocus");function lr(e){return {objectId:e.objectId,attributeName:e.attribute}}chunkDPD6ZWL2_js.a(lr,"existingAttributeFocus");function af(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(af,"firstChangedProperty");function sf(e,t){if(e.type==="list"){let r=(e.config.tabs??[]).find(n=>n.id!==Ft&&(n.columns??[]).includes(t));return r===void 0?void 0:`tab "${r.id}"`}for(let r of e.tabs){let n="groups"in r?r.groups:[];for(let o of n)if(o.fields.some(a=>a.attribute===t)&&!(r.id===We&&o.id===Vt))return `group "${o.id}"`}}chunkDPD6ZWL2_js.a(sf,"handShapedUse");function uf(e,t){if(e.type==="list"){let r=(e.config.tabs??[]).map(n=>n.id===Ft&&n.columns!==void 0?{...n,columns:n.columns.filter(o=>o!==t)}:n);return {...e,config:{...e.config,tabs:r}}}return {...e,tabs:e.tabs.map(r=>{if(r.id!==We||!("groups"in r))return r;let n=r.groups.map(o=>o.id===Vt?{...o,fields:o.fields.filter(a=>a.attribute!==t)}:o);return {...r,groups:n}})}}chunkDPD6ZWL2_js.a(uf,"withoutGeneratedUse");function lf(e,t,r){let n=r.config??{},o=r.name;if(n.relationPath!==void 0)throw new chunkJSKLP4GI_js.h(`rollup "${o}": relationPath is not supported yet`,[]);let a=n.relationAttribute;if(typeof a!="string"||a.length===0)throw new chunkJSKLP4GI_js.h(`rollup "${o}" needs a relation attribute; none is configured on object "${t.name}"`,[]);let s=e.attributes.find(v=>v.objectId===t.id&&v.name===a&&v.attributeType==="relation");if(!s)throw new chunkJSKLP4GI_js.h(`rollup "${o}" needs a relation attribute; "${a}" is not a relation of object "${t.name}"`,[]);let u=Ne(s);if(u===void 0){let v=W(s).filter(K=>K.object!=="*").length;throw new chunkJSKLP4GI_js.h(`rollup "${o}" needs a relation with one target object; "${a}" targets ${v}`,[])}if(n.function==="count")return;let d=e.objects.find(v=>v.name===u),f=n.targetAttribute;if(!(d!==void 0&&e.attributes.some(v=>v.objectId===d.id&&v.name===f)))throw new chunkJSKLP4GI_js.h(`rollup "${o}" targets attribute "${f}", which object "${u}" does not have`,[])}chunkDPD6ZWL2_js.a(lf,"assertRollupShape");function df(e,t){let r=e.config??{};if(e.attributeType==="rollup")return r.relationAttribute===t;let n=typeof r.expression=="string"?r.expression:"";return new RegExp(`(^|[^A-Za-z0-9_])${t}\\.`).test(n)}chunkDPD6ZWL2_js.a(df,"traversesRelation");function qs(e,t){let r=Pe(e,t.objectId);if(t.attributeType==="relation"){for(let o of W(t))if(o.object!==ee&&!e.objects.some(a=>a.name===o.object))throw new chunkJSKLP4GI_js.h(`object "${o.object}" is unknown; create it first`,[]);let n=nt(t)?.object;if(n!==void 0&&n!==ee&&!e.objects.some(o=>o.name===n))throw new chunkJSKLP4GI_js.h(`object "${n}" is unknown; create it first`,[]);for(let o of e.attributes)o.objectId!==t.objectId||!_e(o)||df(o,t.name)&&or(e,o);}else if(_e(t))t.attributeType==="rollup"&&lf(e,r,t),or(e,t);else return;_i(rt(e,t.objectId));}chunkDPD6ZWL2_js.a(qs,"assertConfigFolds");var be={...Ei,objectId:Ir.z.string().uuid()},cf=Ir.z.object({...be,type:Ir.z.literal("add_object"),name:Tt,label:Ir.z.string().min(1),icon:Ir.z.string().min(1).optional()}),pf={type:"add_object",schema:cf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(e.objects.some(n=>n.name===t.name))throw new chunkJSKLP4GI_js.h(`Object "${t.name}" already exists`,[]);if(e.objects.some(n=>n.id===t.objectId))throw new chunkJSKLP4GI_js.h(`Object id "${t.objectId}" is already taken`,[]);let r={id:t.objectId,name:t.name,label:t.label,...t.icon===void 0?{}:{icon:t.icon}};return {...e,objects:[...e.objects,r],views:[...e.views,...ji(r,e.attributes)]}},"apply"),focus:sr,presentation:T(sr,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Cr\xE9e l'objet \xAB ${e.label} \xBB`,"describe")},mf=Ir.z.object({...be,type:Ir.z.literal("update_object"),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),icon:Ir.z.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_object needs at least one change")}),Us=chunkDPD6ZWL2_js.a(e=>({objectId:e.objectId}),"updateObjectFocus"),ff={type:"update_object",schema:mf,apply:chunkDPD6ZWL2_js.a((e,t)=>(Pe(e,t.objectId),{...e,objects:e.objects.map(r=>r.id===t.objectId?{...r,...t.changes}:r)}),"apply"),focus:Us,presentation:T(Us,"atomic",af),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'objet en \xAB ${e.changes.label} \xBB`:"Modifie l'objet","describe")},bf=Ir.z.object({...be,type:Ir.z.literal("remove_object")}),gf={type:"remove_object",schema:bf,apply:chunkDPD6ZWL2_js.a((e,t)=>{Pe(e,t.objectId);let r=e.objects.find(n=>n.id===t.objectId)?.name;for(let n of e.attributes){if(n.objectId===t.objectId||n.attributeType!=="relation"||!W(n).some(a=>a.object===r))continue;let o=e.objects.find(a=>a.id===n.objectId);throw new chunkJSKLP4GI_js.h(`object "${r}" is targeted by attribute "${o?.name}.${n.name}"; remove that attribute first`,[])}return {...e,objects:e.objects.filter(n=>n.id!==t.objectId),attributes:e.attributes.filter(n=>n.objectId!==t.objectId),sampleRecords:e.sampleRecords.filter(n=>n.objectId!==t.objectId),views:e.views.filter(n=>n.objectName!==r)}},"apply"),focus:sr,presentation:T(sr,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'objet ${e.objectId}`,"describe")},zs=To;function Gs(e,t){try{chunkWKDJGNVI_js.n(e,t);}catch(r){throw r instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(r.message,r.errors.map(n=>({...n,path:["config",...n.path??[]]}))):r}}chunkDPD6ZWL2_js.a(Gs,"assertConfigParses");var yf=Ir.z.object({...be,type:Ir.z.literal("add_attribute"),attributeId:Ir.z.string().min(1),name:Sr,label:Ir.z.string().min(1),attributeType:Ir.z.enum(zs),config:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional()}).superRefine((e,t)=>{try{Gs(e.attributeType,e.config??{});}catch(r){if(r instanceof chunkJSKLP4GI_js.h){for(let n of r.errors)t.addIssue({code:"custom",message:n.message,path:[...n.path]});return}throw r}}),hf={type:"add_attribute",schema:yf,apply:chunkDPD6ZWL2_js.a((e,t)=>{let r=Pe(e,t.objectId);if(e.attributes.some(s=>s.objectId===t.objectId&&s.name===t.name))throw new chunkJSKLP4GI_js.h(`Attribute "${t.name}" already exists on object "${t.objectId}"`,[]);let n={id:t.attributeId,objectId:t.objectId,name:t.name,label:t.label,attributeType:t.attributeType,...t.config===void 0?{}:{config:t.config}};for(let s of e.sampleRecords)s.objectId===t.objectId&&Hs(s.id,n,s.values);let o=[...e.attributes,n],a=Vi(e,r,o);return qs(a,n),a},"apply"),focus:$s,presentation:T($s,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'attribut \xAB ${e.label} \xBB`,"describe")},Ws={...be,attribute:Sr};function Ks(e,t,r,n){let o=Pe(e,t);if(r===void 0)throw new chunkJSKLP4GI_js.h(`${n} now addresses the attribute by name; remove this operation and append it again with "attribute"`,[]);let a=e.attributes.find(s=>s.objectId===t&&s.name===r);if(!a)throw new chunkJSKLP4GI_js.h(`Attribute "${r}" is not on object "${t}"`,[]);return {object:o,attribute:a}}chunkDPD6ZWL2_js.a(Ks,"requireAttribute");var Af=Ir.z.object({...Ws,type:Ir.z.literal("update_attribute"),changes:Ir.z.object({label:Ir.z.string().min(1).optional(),config:Ir.z.record(Ir.z.string(),Ir.z.unknown()).optional()}).refine(e=>Object.keys(e).length>0,"update_attribute needs at least one change")}),Tf={type:"update_attribute",schema:Af,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{object:r,attribute:n}=Ks(e,t.objectId,t.attribute,"update_attribute");t.changes.config!==void 0&&Gs(n.attributeType,t.changes.config);let o={...n,...t.changes},a=e.attributes.map(u=>u===n?o:u),s=Vi(e,r,a);return qs(s,o),s},"apply"),focus:lr,presentation:T(lr,"atomic"),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'attribut \xAB ${e.attribute} \xBB en \xAB ${e.changes.label} \xBB`:`Modifie l'attribut \xAB ${e.attribute} \xBB`,"describe")},wf=Ir.z.object({...Ws,type:Ir.z.literal("remove_attribute")}),xf={type:"remove_attribute",schema:wf,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{object:r,attribute:n}=Ks(e,t.objectId,t.attribute,"remove_attribute"),[o]=Ni(e,t.objectId,n.name);if(o!==void 0)throw new chunkJSKLP4GI_js.h(`attribute "${n.name}" is used by "${o}"; remove that first`,[]);for(let d of e.views){if(d.objectName!==r.name)continue;let f=sf(d,n.name);if(f!==void 0)throw new chunkJSKLP4GI_js.h(`attribute "${n.name}" is used by view "${d.id}" (${f}); remove it from the view first`,[])}let a=e.sampleRecords.find(d=>d.objectId===n.objectId&&n.name in d.values);if(a)throw new chunkJSKLP4GI_js.h(`Attribute "${n.name}" is still used by sample record "${a.id}"`,[]);let s=e.attributes.filter(d=>d!==n),u={...e,views:e.views.map(d=>d.objectName===r.name?uf(d,n.name):d)};return Vi(u,r,s)},"apply"),focus:lr,presentation:T(lr,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'attribut \xAB ${e.attribute} \xBB`,"describe")};function If(e,t,r,n){let o=ke(r);try{chunkIBM4ID4Y_js.c(o);}catch{return}let a=chunkIBM4ID4Y_js.g(o,n);if(a.success)return;let s=a.errors??[],u=s.map(d=>d.path.length>1?`${d.path.join(".")}: ${d.message}`:d.message).join(", ");throw new chunkJSKLP4GI_js.h(`Sample record "${e}" has an invalid value for "${t}": ${u}`,s.map(d=>({path:d.path,message:d.message})))}chunkDPD6ZWL2_js.a(If,"assertSampleValue");function Hs(e,t,r){if(t.config?.required===true&&t.config?.defaultValue===void 0&&!(t.name in r&&r[t.name]!==void 0))throw new chunkJSKLP4GI_js.h(`Sample record "${e}" is missing a value for required attribute "${t.name}"`,[])}chunkDPD6ZWL2_js.a(Hs,"assertRequiredCovered");function Mi(e){return (Array.isArray(e)?e:[e]).flatMap(r=>{if(typeof r=="string")return [r];if(typeof r=="object"&&r!==null){let n=r.id;if(typeof n=="string")return [n]}return []})}chunkDPD6ZWL2_js.a(Mi,"relationValueIds");function Sf(e,t,r,n){if(r.attributeType!=="relation"||n===void 0||n===null)return;let o=Ne(r),a=e.objects.find(u=>u.name===o);if(!a)return;let s=e.views.some(u=>u.id===fe(a.id).list);for(let u of Mi(n)){let d=e.sampleRecords.find(x=>x.id===u);if(d?.objectId!==a.id&&(d!==void 0||s))throw new chunkJSKLP4GI_js.h(`sample record "${t}" references unknown sample "${u}"`,[])}}chunkDPD6ZWL2_js.a(Sf,"assertUnknownSampleReference");var vf=Ir.z.object({...be,type:Ir.z.literal("add_sample_record"),recordId:Ir.z.string().uuid(),values:Ir.z.record(Ir.z.string(),Ir.z.unknown()),publication:Ir.z.enum(["preview","requested-data"]).optional()}),Rf={type:"add_sample_record",schema:vf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(Pe(e,t.objectId),e.sampleRecords.some(n=>n.id===t.recordId))throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" already exists`,[]);let r=new Map(e.attributes.filter(n=>n.objectId===t.objectId).map(n=>[n.name,n]));for(let[n,o]of Object.entries(t.values)){let a=r.get(n);if(!a)throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" uses unknown attribute "${n}"`,[]);if(_e(a))throw new chunkJSKLP4GI_js.h(`attribute "${a.name}" is computed and cannot be set on a sample record`,[]);Sf(e,t.recordId,a,o),If(t.recordId,n,a,o);}for(let n of r.values())Hs(t.recordId,n,t.values);return {...e,sampleRecords:[...e.sampleRecords,{id:t.recordId,objectId:t.objectId,values:t.values,...t.publication===void 0?{}:{publication:t.publication}}]}},"apply"),focus:ur,presentation:T(ur,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Ajoute un exemple","describe")};function Df(e,t){return new Set(e.attributes.filter(r=>r.objectId===t&&r.attributeType==="relation").map(r=>r.name))}chunkDPD6ZWL2_js.a(Df,"relationNamesOf");function Ef(e,t){for(let r of e.sampleRecords){if(r.id===t)continue;let n=Df(e,r.objectId);for(let[o,a]of Object.entries(r.values))if(n.has(o)&&Mi(a).includes(t))throw new chunkJSKLP4GI_js.h(`sample record "${t}" is referenced by sample record "${r.id}"; remove that first`,[])}}chunkDPD6ZWL2_js.a(Ef,"assertSampleNotReferenced");var Cf=Ir.z.object({...be,type:Ir.z.literal("remove_sample_record"),recordId:Ir.z.string().min(1)}),Of={type:"remove_sample_record",schema:Cf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(!e.sampleRecords.some(r=>r.id===t.recordId&&r.objectId===t.objectId))throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" is not in object "${t.objectId}"`,[]);return Ef(e,t.recordId),{...e,sampleRecords:e.sampleRecords.filter(r=>r.id!==t.recordId)}},"apply"),focus:ur,presentation:T(ur,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Retire un exemple","describe")},je=[pf,ff,gf,hf,Tf,xf,Rf,Of];function _f(){let e=new Map;for(let t of [...je,...Ce,...Oe]){if(e.has(t.type))throw new chunkJSKLP4GI_js.r("architect operation",t.type);e.set(t.type,t);}return e}chunkDPD6ZWL2_js.a(_f,"build");var it=_f(),Nf=[...it.keys()];function ot(e){let t=it.get(e.type);if(!t)throw new chunkJSKLP4GI_js.h(`Operation "${e.id}" has unknown type "${e.type}"`,[]);return t}chunkDPD6ZWL2_js.a(ot,"defOf");function Li(e,t){return t.reduce((r,n)=>ot(n).apply(r,n),e)}chunkDPD6ZWL2_js.a(Li,"applyOperations");function Bi(e){return ot(e).focus(e)}chunkDPD6ZWL2_js.a(Bi,"focusOf");function kf(e,t){return e.map(r=>ot(r).describe(r,t))}chunkDPD6ZWL2_js.a(kf,"describeOperations");function Pf(e){if(typeof e!="object"||e===null||!("type"in e))throw new chunkJSKLP4GI_js.h("An operation must be an object carrying a type",[]);let t=e.type;if(typeof t!="string")throw new chunkJSKLP4GI_js.h("An operation's type must be a string",[]);let r=it.get(t);if(!r)throw new chunkJSKLP4GI_js.h(`Unknown operation type "${t}"`,[]);let n=r.schema.safeParse(e);if(!n.success)throw new chunkJSKLP4GI_js.h(`Operation "${t}" is invalid: ${n.error.issues.map(o=>`${o.path.join(".")} ${o.message}`).join("; ")}`,[]);return n.data}chunkDPD6ZWL2_js.a(Pf,"parseOperation");function $i(e){return ot(e).presentation(e)}chunkDPD6ZWL2_js.a($i,"presentationOf");function jf(e){let t=e.map($i);return new Set(t.map(({focus:n})=>n.viewId??n.objectId).filter(n=>n!==void 0)).size>1||t.some(({impact:n})=>n==="structural")?"structural":t.some(({impact:n})=>n==="local")?"local":"atomic"}chunkDPD6ZWL2_js.a(jf,"episodeImpactOf");function Ff(e,t){return e.config.tabs?.find(r=>r.id===t)}chunkDPD6ZWL2_js.a(Ff,"listTabOf");function Ys(e,t){let r=t.viewId?e.views.find(o=>o.id===t.viewId):void 0,n=t.tabId?r?.tabs.find(o=>o.id===t.tabId):void 0;if(t.attributeId)return e.attributes.find(o=>o.id===t.attributeId);if(t.attributeName)return e.attributes.find(o=>o.objectId===t.objectId&&o.name===t.attributeName);if(t.fieldId){if(n?.type!=="form")return;for(let o of n.groups){let a=o.fields.find(s=>s.id===t.fieldId);if(a)return a}return}if(t.groupId)return n?.type!=="form"?void 0:n.groups.find(o=>o.id===t.groupId);if(t.tabId)return r?n??Ff(r,t.tabId):void 0;if(t.recordId)return e.sampleRecords.find(o=>o.id===t.recordId);if(r)return r;if(t.objectId)return e.objects.find(o=>o.id===t.objectId)}chunkDPD6ZWL2_js.a(Ys,"snapshotArchitectTarget");function Vf(e,t){let r=e;return t.map(n=>{let o=$i(n),a=Ys(r,o.focus);r=Li(r,[n]);let s=Ys(r,o.focus);return {operationId:n.id,operationType:n.type,presentation:o,before:a,after:s}})}chunkDPD6ZWL2_js.a(Vf,"deriveArchitectChanges");function Qs(e){return e.attributeName&&e.objectId?`attribute:${e.objectId}:${e.attributeName}`:e.attributeId?`attribute-id:${e.attributeId}`:e.tabId&&e.viewId?`tab:${e.viewId}:${e.tabId}`:e.viewId?`view:${e.viewId}`:e.objectId?`object:${e.objectId}`:null}chunkDPD6ZWL2_js.a(Qs,"proposalTargetKey");function Mf(e,t){let r=new Set;for(let n of t){let o=Bi(n),a=Qs(o);a&&r.add(a),o.objectId&&r.add(`object:${o.objectId}`),o.viewId&&r.add(`view:${o.viewId}`);let s=e.views.find(x=>x.id===o.viewId),u=e.objects.find(x=>x.name===s?.objectName);u&&r.add(`object:${u.id}`),(n.type==="remove_object"||n.type.includes("sample_record"))&&o.objectId&&r.add(`object-tree:${o.objectId}`),n.type==="add_object"&&typeof n.name=="string"&&r.add(`object-name:${n.name}`);let d=n.type==="update_attribute"&&typeof n.changes=="object"&&n.changes!==null?n.changes:null,f=n.type==="add_attribute"?n.config:d&&"config"in d?d.config:void 0;if(f&&typeof f=="object"&&"targets"in f&&Array.isArray(f.targets))for(let x of f.targets)typeof x=="object"&&x!==null&&"object"in x&&typeof x.object=="string"&&x.object!=="*"&&r.add(`object-name:${x.object}`);}return [...r]}chunkDPD6ZWL2_js.a(Mf,"requiredTargetKeys");function Lf(e,t){return Object.fromEntries(t.map(r=>[r,chunkRTHLB6T6_js.b(Bf(e,r))]))}chunkDPD6ZWL2_js.a(Lf,"targetTokensFor");function Bf(e,t){if(t.startsWith("object:"))return e.objects.find(r=>r.id===t.slice(7))??null;if(t.startsWith("object-name:"))return e.objects.find(r=>r.name===t.slice(12))??null;if(t.startsWith("object-tree:")){let r=t.slice(12),n=e.objects.find(o=>o.id===r);return n?{object:n,attributes:e.attributes.filter(o=>o.objectId===r),views:e.views.filter(o=>o.objectName===n.name),sampleRecords:e.sampleRecords.filter(o=>o.objectId===r)}:null}if(t.startsWith("attribute-id:"))return e.attributes.find(r=>r.id===t.slice(13))??null;if(t.startsWith("attribute:")){let r=t.slice(10),n=r.indexOf(":");if(n<0)throw new chunkJSKLP4GI_js.h(`Invalid proposal target key "${t}"`,[]);return e.attributes.find(o=>o.objectId===r.slice(0,n)&&o.name===r.slice(n+1))??null}if(t.startsWith("view:"))return e.views.find(r=>r.id===t.slice(5))??null;if(t.startsWith("tab:")){let r=t.slice(4),n=e.views.find(a=>r.startsWith(`${a.id}:`));if(!n)return null;let o=r.slice(n.id.length+1);return (n.type==="list"?n.config.tabs:n.tabs)?.find(a=>a.id===o)??null}throw new chunkJSKLP4GI_js.h(`Unknown proposal target key "${t}"`,[])}chunkDPD6ZWL2_js.a(Bf,"targetSnapshot");function $f(e){return {id:e.id??"",objectName:e.object,type:e.type,label:e.label,tabs:bt(e)?e.config.tabs??[]:[],config:e.config}}chunkDPD6ZWL2_js.a($f,"toDraftableView");function at(e){return e.type==="detail"?{...e.config,tabs:e.tabs}:e.config}chunkDPD6ZWL2_js.a(at,"persistedViewConfig");function Uf(e,t){return e.type==="detail"?{...e,label:t.label,config:at(t)}:{...e,label:t.label,config:at(t)}}chunkDPD6ZWL2_js.a(Uf,"fromDraftableView");function qf(e){let t={id:e.id,name:"default",label:e.label,object:e.objectName,default:true};return e.type==="detail"?{...t,type:"detail",config:at(e)}:{...t,type:"list",config:at(e)}}chunkDPD6ZWL2_js.a(qf,"draftedViewDefinition");var Js=Ir.z.object({type:Ir.z.literal("remove_operation"),operationId:Ir.z.string().min(1).describe("The id of a stored operation to drop from the draft")});function qi(e,t=[]){return [...e.map(r=>r.schema),...t].map(Gf)}chunkDPD6ZWL2_js.a(qi,"membersOf");function Fe(e){return Ir.z.discriminatedUnion("type",e)}chunkDPD6ZWL2_js.a(Fe,"unionOf");function zf(e){return e instanceof Ir.z.ZodString&&e.format==="uuid"}chunkDPD6ZWL2_js.a(zf,"isUuidString");function Gf(e){let t={};for(let[r,n]of Object.entries(e.shape)){if(!zf(n))continue;let o=Ir.z.string().min(1);t[r]=n.description===void 0?o:o.describe(n.description);}return Object.keys(t).length===0?e:e.safeExtend(t)}chunkDPD6ZWL2_js.a(Gf,"relaxUuidKeys");var Wf={add_object:["objectId"],add_sample_record:["recordId"]};function Ui(e){let t={};for(let r of Wf[e.shape.type.value]??[]){let n=e.shape[r];n instanceof Ir.z.ZodString&&(t[r]=n.optional());}return Object.keys(t).length===0?e:e.safeExtend(t)}chunkDPD6ZWL2_js.a(Ui,"relaxMintedKeys");var Xs=qi(je,[Js]),Zs=qi(Oe),eu=qi(Ce),tu=Fe(Xs),ru=Fe(Zs),nu=Fe(eu),Kf={schema:tu,"list-view":ru,"detail-view":nu},Hf={schema:Fe(Xs.map(Ui)),"list-view":Fe(Zs.map(Ui)),"detail-view":Fe(eu.map(Ui))},Yf=new Map([...je.map(e=>[e.type,"schema"]),["remove_operation","schema"],...Oe.map(e=>[e.type,"list-view"]),...Ce.map(e=>[e.type,"detail-view"])]);function Qf(e){return Yf.get(e)??null}chunkDPD6ZWL2_js.a(Qf,"familyOf");function Jf(e){let t=iu(e,"list"),r=iu(e,"detail"),n=e.objects.filter(s=>(t(s)?.config.tabs??[]).length===0).map(s=>`Object "${s.label}" has no list tab: draft_list_view add_list_tab.`),o=e.attributes.flatMap(s=>{if(s.attributeType!=="document")return [];let u=tt(e,s.objectId),d=u&&r(u);return !d||d.tabs.some(f=>f.type==="documents")?[]:[`Attribute "${s.label}" (document) on "${u.label}": the detail view has no Documents tab: draft_detail_view add_tab type "documents".`]}),a=e.attributes.flatMap(s=>{if(!chunkJRBNMHMY_js.j(ke(s)).presentation.tableCell)return [];let u=tt(e,s.objectId);if(!u)return [];let d=t(u)?.config.tabs??[];return d.length===0||d.some(f=>f.columns.includes(s.name))?[]:[`Attribute "${s.label}" on "${u.label}" is in no column set of its list view: draft_list_view set_columns.`]});return [...n,...o,...a]}chunkDPD6ZWL2_js.a(Jf,"stillMissing");function iu(e,t){return r=>e.views.find(n=>n.type===t&&n.objectName===r.name)}chunkDPD6ZWL2_js.a(iu,"viewFinder");function Xf(e){let t=e.config??{};if(e.attributeType==="relation")return `\u2192 ${W(e).map(r=>r.object).join("|")}`;if(e.attributeType==="formula")return typeof t.expression=="string"?t.expression:void 0;if(e.attributeType==="rollup")return t.function==="count"?`count(${t.relationAttribute})`:`${t.function}(${t.relationAttribute}.${t.targetAttribute})`}chunkDPD6ZWL2_js.a(Xf,"attributeDetail");function Zf(e){let t=e.config?.options,r=Xf(e);return {name:e.name,label:e.label,type:e.attributeType,...Array.isArray(t)?{options:t.map(n=>n.value)}:{},...r===void 0?{}:{detail:r}}}chunkDPD6ZWL2_js.a(Zf,"summarizeAttribute");function eb(e,t,r){let n=fe(e.id),o=r.some(a=>a.id===n.list);return {id:e.id,name:e.name,label:e.label,attributes:t.filter(a=>a.objectId===e.id).map(Zf),...o?{viewIds:n}:{}}}chunkDPD6ZWL2_js.a(eb,"summarizeObject");function tb(e){return e.attribute??e.attributeGroup?.id??""}chunkDPD6ZWL2_js.a(tb,"fieldName");function rb(e){return e.type==="list"?(e.config.tabs??[]).map(r=>({id:r.id,label:r.label,columns:r.columns})):e.tabs.map(t=>{let r="groups"in t?t.groups:void 0;return {id:t.id,label:t.label,...r===void 0?{}:{groups:r.map(n=>({id:n.id,label:n.label,fields:n.fields.map(tb)}))}}})}chunkDPD6ZWL2_js.a(rb,"summarizeTab");function nb(e,t){let r=t.find(n=>n.name===e.objectName)?.id;if(r===void 0)throw new chunkJSKLP4GI_js.h(`View "${e.id}" names object "${e.objectName}", which is not in the draft scope`,[]);return {id:e.id,type:e.type,objectId:r,label:e.label,derived:e.derived===true,tabs:rb(e)}}chunkDPD6ZWL2_js.a(nb,"summarizeView");function ib(e,t){let r=new Map;for(let n of e.sampleRecords)r.set(n.objectId,(r.get(n.objectId)??0)+1);return {objects:e.objects.map(n=>eb(n,e.attributes,e.views)),views:e.views.map(n=>nb(n,e.objects)),sampleRecords:[...r.entries()].map(([n,o])=>({objectId:n,count:o})),operationCount:t}}chunkDPD6ZWL2_js.a(ib,"summarizeDraft");var ob=["draft_schema","draft_list_view","draft_detail_view"],ab="publish_architect_draft",sb="discard_architect_draft",ub="request_design_review",lb="get_architect_draft";Object.defineProperty(exports,"NonJsonValueError",{enumerable:true,get:function(){return chunkRTHLB6T6_js.a}});Object.defineProperty(exports,"asTenantId",{enumerable:true,get:function(){return chunkRTHLB6T6_js.f}});Object.defineProperty(exports,"asUserId",{enumerable:true,get:function(){return chunkRTHLB6T6_js.g}});Object.defineProperty(exports,"canonicalStringify",{enumerable:true,get:function(){return chunkRTHLB6T6_js.b}});Object.defineProperty(exports,"deepEqual",{enumerable:true,get:function(){return chunkRTHLB6T6_js.j}});Object.defineProperty(exports,"generateId",{enumerable:true,get:function(){return chunkRTHLB6T6_js.h}});Object.defineProperty(exports,"indexBy",{enumerable:true,get:function(){return chunkRTHLB6T6_js.i}});Object.defineProperty(exports,"sameStableValue",{enumerable:true,get:function(){return chunkRTHLB6T6_js.e}});Object.defineProperty(exports,"serializeCanonicalJson",{enumerable:true,get:function(){return chunkRTHLB6T6_js.d}});Object.defineProperty(exports,"serializeStableJson",{enumerable:true,get:function(){return chunkRTHLB6T6_js.c}});Object.defineProperty(exports,"ATTRIBUTE_FILTER_OPERATORS",{enumerable:true,get:function(){return chunkJRBNMHMY_js.i}});Object.defineProperty(exports,"LIST_TAB_KANBAN_KEYS",{enumerable:true,get:function(){return chunkJRBNMHMY_js.sa}});Object.defineProperty(exports,"LIST_TAB_TABLE_KEYS",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ra}});Object.defineProperty(exports,"LIST_VIEW_TAB_VISIBILITIES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.y}});Object.defineProperty(exports,"LOCATION_FILTER_PROPERTIES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.f}});Object.defineProperty(exports,"NATIVE_OBJECT_NAMES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.v}});Object.defineProperty(exports,"NO_VALUE_OPERATORS",{enumerable:true,get:function(){return chunkJRBNMHMY_js.s}});Object.defineProperty(exports,"OPERATORS_BY_TYPE",{enumerable:true,get:function(){return chunkJRBNMHMY_js.r}});Object.defineProperty(exports,"REMOVED_OPERATOR_REPLACEMENTS",{enumerable:true,get:function(){return chunkJRBNMHMY_js.W}});Object.defineProperty(exports,"RESERVED_ATTRIBUTE_NAMES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.B}});Object.defineProperty(exports,"RESERVED_OBJECT_NAMES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.C}});Object.defineProperty(exports,"RESOURCE_VISIBILITIES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.x}});Object.defineProperty(exports,"SYNONYM_ALIASES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.O}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.c}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTE_I18N_KEYS",{enumerable:true,get:function(){return chunkJRBNMHMY_js.a}});Object.defineProperty(exports,"SYSTEM_FIELD_NAMES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.A}});Object.defineProperty(exports,"SYSTEM_FILTER_ATTRIBUTE_TYPES",{enumerable:true,get:function(){return chunkJRBNMHMY_js.V}});Object.defineProperty(exports,"canonicalizeFilterValue",{enumerable:true,get:function(){return chunkJRBNMHMY_js.N}});Object.defineProperty(exports,"collectQualifiedRuleIssues",{enumerable:true,get:function(){return chunkJRBNMHMY_js.X}});Object.defineProperty(exports,"columnsSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.Z}});Object.defineProperty(exports,"currentActor",{enumerable:true,get:function(){return chunkJRBNMHMY_js.E}});Object.defineProperty(exports,"detailTabDraftSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ka}});Object.defineProperty(exports,"detailTabSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ja}});Object.defineProperty(exports,"detailViewConfigSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.na}});Object.defineProperty(exports,"displayAttributesSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js._}});Object.defineProperty(exports,"extractCurrencyFilterValue",{enumerable:true,get:function(){return chunkJRBNMHMY_js.H}});Object.defineProperty(exports,"extractFilterValue",{enumerable:true,get:function(){return chunkJRBNMHMY_js.I}});Object.defineProperty(exports,"fieldSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.da}});Object.defineProperty(exports,"fieldShape",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ca}});Object.defineProperty(exports,"fieldSlotSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ea}});Object.defineProperty(exports,"filterGroupSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ba}});Object.defineProperty(exports,"filterStateSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.aa}});Object.defineProperty(exports,"getAttributeCapabilities",{enumerable:true,get:function(){return chunkJRBNMHMY_js.j}});Object.defineProperty(exports,"getAttributeFilterOperators",{enumerable:true,get:function(){return chunkJRBNMHMY_js.k}});Object.defineProperty(exports,"getOperatorPolarity",{enumerable:true,get:function(){return chunkJRBNMHMY_js.J}});Object.defineProperty(exports,"getRollupFilterOperators",{enumerable:true,get:function(){return chunkJRBNMHMY_js.u}});Object.defineProperty(exports,"getSystemAttributeI18nKey",{enumerable:true,get:function(){return chunkJRBNMHMY_js.b}});Object.defineProperty(exports,"getSystemAttributeList",{enumerable:true,get:function(){return chunkJRBNMHMY_js.d}});Object.defineProperty(exports,"groupWriteSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.fa}});Object.defineProperty(exports,"inverseSourceSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ha}});Object.defineProperty(exports,"isAttributeFilterable",{enumerable:true,get:function(){return chunkJRBNMHMY_js.l}});Object.defineProperty(exports,"isAttributeGroupable",{enumerable:true,get:function(){return chunkJRBNMHMY_js.o}});Object.defineProperty(exports,"isAttributeKanbanGroupable",{enumerable:true,get:function(){return chunkJRBNMHMY_js.p}});Object.defineProperty(exports,"isAttributeSearchable",{enumerable:true,get:function(){return chunkJRBNMHMY_js.m}});Object.defineProperty(exports,"isDynamicValue",{enumerable:true,get:function(){return chunkJRBNMHMY_js.D}});Object.defineProperty(exports,"isLocationFilterProperty",{enumerable:true,get:function(){return chunkJRBNMHMY_js.g}});Object.defineProperty(exports,"isLocationPartOperator",{enumerable:true,get:function(){return chunkJRBNMHMY_js.h}});Object.defineProperty(exports,"isManagedSystemAttribute",{enumerable:true,get:function(){return chunkJRBNMHMY_js.e}});Object.defineProperty(exports,"isNativeObjectName",{enumerable:true,get:function(){return chunkJRBNMHMY_js.w}});Object.defineProperty(exports,"isNoValueOperator",{enumerable:true,get:function(){return chunkJRBNMHMY_js.t}});Object.defineProperty(exports,"isRelativeDateValue",{enumerable:true,get:function(){return chunkJRBNMHMY_js.R}});Object.defineProperty(exports,"isSetMembershipOperator",{enumerable:true,get:function(){return chunkJRBNMHMY_js.M}});Object.defineProperty(exports,"listViewConfigSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ma}});Object.defineProperty(exports,"listViewTabSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.la}});Object.defineProperty(exports,"normalizeFilterRule",{enumerable:true,get:function(){return chunkJRBNMHMY_js.Q}});Object.defineProperty(exports,"normalizeForEdgeRpc",{enumerable:true,get:function(){return chunkJRBNMHMY_js.K}});Object.defineProperty(exports,"normalizeOperator",{enumerable:true,get:function(){return chunkJRBNMHMY_js.P}});Object.defineProperty(exports,"now",{enumerable:true,get:function(){return chunkJRBNMHMY_js.G}});Object.defineProperty(exports,"parseResourceVisibility",{enumerable:true,get:function(){return chunkJRBNMHMY_js.z}});Object.defineProperty(exports,"parseViewConfig",{enumerable:true,get:function(){return chunkJRBNMHMY_js.qa}});Object.defineProperty(exports,"relationSourceSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ga}});Object.defineProperty(exports,"resolveEffectiveFilterType",{enumerable:true,get:function(){return chunkJRBNMHMY_js.q}});Object.defineProperty(exports,"resolveIsWithinBounds",{enumerable:true,get:function(){return chunkJRBNMHMY_js.S}});Object.defineProperty(exports,"resolveUtcDayBounds",{enumerable:true,get:function(){return chunkJRBNMHMY_js.T}});Object.defineProperty(exports,"sortsSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.$}});Object.defineProperty(exports,"tableSourceSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.ia}});Object.defineProperty(exports,"toMultiValueOperator",{enumerable:true,get:function(){return chunkJRBNMHMY_js.L}});Object.defineProperty(exports,"toUtcDayString",{enumerable:true,get:function(){return chunkJRBNMHMY_js.U}});Object.defineProperty(exports,"today",{enumerable:true,get:function(){return chunkJRBNMHMY_js.F}});Object.defineProperty(exports,"validateQualifiedRule",{enumerable:true,get:function(){return chunkJRBNMHMY_js.Y}});Object.defineProperty(exports,"viewConfigByTypeSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.pa}});Object.defineProperty(exports,"viewTypeSchema",{enumerable:true,get:function(){return chunkJRBNMHMY_js.oa}});Object.defineProperty(exports,"ComputedFormulaParseError",{enumerable:true,get:function(){return chunkWKDJGNVI_js.d}});Object.defineProperty(exports,"SCHEMA_LIMITS",{enumerable:true,get:function(){return chunkWKDJGNVI_js.a}});Object.defineProperty(exports,"attributeConfigSchemas",{enumerable:true,get:function(){return chunkWKDJGNVI_js.j}});Object.defineProperty(exports,"colorIdSchema",{enumerable:true,get:function(){return chunkWKDJGNVI_js.b}});Object.defineProperty(exports,"iconNameSchema",{enumerable:true,get:function(){return chunkWKDJGNVI_js.c}});Object.defineProperty(exports,"multiselectOptionWriteSchema",{enumerable:true,get:function(){return chunkWKDJGNVI_js.h}});Object.defineProperty(exports,"parseAttributeConfig",{enumerable:true,get:function(){return chunkWKDJGNVI_js.l}});Object.defineProperty(exports,"parseAttributeConfigForCreate",{enumerable:true,get:function(){return chunkWKDJGNVI_js.n}});Object.defineProperty(exports,"parseAttributeConfigForUpdate",{enumerable:true,get:function(){return chunkWKDJGNVI_js.o}});Object.defineProperty(exports,"parseComputedFormula",{enumerable:true,get:function(){return chunkWKDJGNVI_js.e}});Object.defineProperty(exports,"selectOptionWriteSchema",{enumerable:true,get:function(){return chunkWKDJGNVI_js.g}});Object.defineProperty(exports,"statusGroupSchema",{enumerable:true,get:function(){return chunkWKDJGNVI_js.f}});Object.defineProperty(exports,"statusOptionWriteSchema",{enumerable:true,get:function(){return chunkWKDJGNVI_js.i}});Object.defineProperty(exports,"createFormAttributeValidator",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.d}});Object.defineProperty(exports,"isNullishOrEmptyString",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.a}});Object.defineProperty(exports,"isValuePresent",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.b}});Object.defineProperty(exports,"rejectUnknownAttributesOrThrow",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.l}});Object.defineProperty(exports,"validateDraft",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.j}});Object.defineProperty(exports,"validateDraftOrThrow",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.k}});Object.defineProperty(exports,"validateObject",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.h}});Object.defineProperty(exports,"validateObjectOrThrow",{enumerable:true,get:function(){return chunkIBM4ID4Y_js.i}});Object.defineProperty(exports,"createCheckboxValidator",{enumerable:true,get:function(){return chunk47KVYDKG_js.a}});Object.defineProperty(exports,"createDateValidator",{enumerable:true,get:function(){return chunkKLR22JMC_js.a}});Object.defineProperty(exports,"AccessDeniedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.C}});Object.defineProperty(exports,"AttributeInUseError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.I}});Object.defineProperty(exports,"AttributeNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.e}});Object.defineProperty(exports,"ChangeTypeNotSupportedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.q}});Object.defineProperty(exports,"ConcurrentModificationError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.A}});Object.defineProperty(exports,"DestructiveSyncNotAllowedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.o}});Object.defineProperty(exports,"DuplicateError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.r}});Object.defineProperty(exports,"ForbiddenError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.x}});Object.defineProperty(exports,"MemoryNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.G}});Object.defineProperty(exports,"MigrationTimeoutError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.p}});Object.defineProperty(exports,"NotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.c}});Object.defineProperty(exports,"NotImplementedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.F}});Object.defineProperty(exports,"ObjectNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.d}});Object.defineProperty(exports,"ObjectReferencedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.J}});Object.defineProperty(exports,"OrphanSystemAttributeError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.n}});Object.defineProperty(exports,"ProtectedResourceError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.i}});Object.defineProperty(exports,"ProtectedRoleError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.y}});Object.defineProperty(exports,"RecordNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.f}});Object.defineProperty(exports,"RecordReferencedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.H}});Object.defineProperty(exports,"RepositoryError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.D}});Object.defineProperty(exports,"ReservedObjectNameError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.s}});Object.defineProperty(exports,"RoleNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.z}});Object.defineProperty(exports,"SchemaError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.b}});Object.defineProperty(exports,"SchemaErrorCode",{enumerable:true,get:function(){return chunkJSKLP4GI_js.a}});Object.defineProperty(exports,"SchemaPlanNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.g}});Object.defineProperty(exports,"SearchBackendError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.E}});Object.defineProperty(exports,"StorageError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.B}});Object.defineProperty(exports,"SyncCascadeError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.m}});Object.defineProperty(exports,"SyncConflictError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.l}});Object.defineProperty(exports,"SyncError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.j}});Object.defineProperty(exports,"SystemEntityImmutableError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.k}});Object.defineProperty(exports,"ValidationError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.h}});Object.defineProperty(exports,"isAttributeInUseError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.L}});Object.defineProperty(exports,"isNotFoundError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.u}});Object.defineProperty(exports,"isObjectReferencedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.M}});Object.defineProperty(exports,"isProtectedResourceError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.w}});Object.defineProperty(exports,"isRecordReferencedError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.K}});Object.defineProperty(exports,"isSchemaError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.t}});Object.defineProperty(exports,"isValidationError",{enumerable:true,get:function(){return chunkJSKLP4GI_js.v}});Object.defineProperty(exports,"TEXT_FORMAT_PATTERNS",{enumerable:true,get:function(){return chunkXHEBV2HE_js.a}});Object.defineProperty(exports,"createTextValidator",{enumerable:true,get:function(){return chunkXHEBV2HE_js.c}});Object.defineProperty(exports,"resolveTextPattern",{enumerable:true,get:function(){return chunkXHEBV2HE_js.b}});Object.defineProperty(exports,"createNumberValidator",{enumerable:true,get:function(){return chunkSLYRQ72J_js.a}});Object.defineProperty(exports,"DEFAULT_VALIDATION_MESSAGES",{enumerable:true,get:function(){return chunkJFSQ24XR_js.a}});Object.defineProperty(exports,"formatZodErrors",{enumerable:true,get:function(){return chunkJFSQ24XR_js.b}});exports.AGENT_UI_BATCH_MAX_BYTES=tI;exports.AGENT_UI_BATCH_MAX_ITEMS=rI;exports.ALLOWED_PROPERTY_TYPES=Fo;exports.ALL_ACTIONS=Ar;exports.ALL_OPERATION_TYPES=Nf;exports.ALL_SYSTEM_RESOURCES=TT;exports.ARTIFACT_FILE_ROLES=zy;exports.ARTIFACT_KINDS=Uy;exports.ARTIFACT_LIST_VIEW=ed;exports.ARTIFACT_OBJECT=Jl;exports.ARTIFACT_OBJECT_NAME=Pt;exports.ARTIFACT_RETENTIONS=qy;exports.ARTIFACT_VIEW=Xl;exports.ATTRIBUTE_TYPES=To;exports.AUDIT_ACTIONS=ay;exports.AUDIT_RESOURCE_TYPES=oy;exports.ActivityTabConfig=Tn;exports.AgentBuilder=vr;exports.BEHAVIOR_PROPERTIES=Yg;exports.BYTE_UNIT_LABELS=Wu;exports.CLAIMABLE_SESSION_STATUSES=_u;exports.COMPUTED_FUNCTIONS=Qe;exports.COMPUTED_FUNCTION_METADATA=VI;exports.COMPUTED_FUNCTION_NAMES=hI;exports.CONNECTOR_CALLBACK_PARAM=dS;exports.COUNT_MODES=Po;exports.ComputedFormulaCompileError=g;exports.CustomTabConfig=hn;exports.DB_COLUMN_FIELDS=hT;exports.DEFAULT_AGENT_EXECUTION_CONFIG=Xo;exports.DEFAULT_APPROVAL_POLICY=xo;exports.DEFAULT_DICTATION_LIMITS=By;exports.DEFAULT_LABEL_FALLBACK=Bo;exports.DEFAULT_MEETING_BOT_DISPLAY_NAME=Bu;exports.DEFAULT_ROLES=wl;exports.DEFAULT_ROLE_DESCRIPTIONS=IT;exports.DEFAULT_ROLE_LABELS=xT;exports.DEFAULT_ROLE_PERMISSIONS=ST;exports.DEFAULT_TENANT_SETTINGS=Th;exports.DETAIL_VIEW_OPERATIONS=Ce;exports.DETAIL_VIEW_OPERATION_INPUT=nu;exports.DICTATION_FINALIZATION_TIMEOUT_MS=My;exports.DICTATION_FRAME_BYTES=Ny;exports.DICTATION_MAX_BUFFER_BYTES=Py;exports.DICTATION_MAX_FRAME_BYTES=ky;exports.DICTATION_MAX_TRANSCRIPT_BYTES=jy;exports.DICTATION_MODEL_ID=Ly;exports.DICTATION_PREPARATION_TIMEOUT_MS=Vy;exports.DICTATION_SAMPLE_RATE=_y;exports.DICTATION_TICKET_TTL_MS=Fy;exports.DISCARD_ARCHITECT_DRAFT_TOOL_NAME=sb;exports.DOCUMENT_SYSTEM_ATTRIBUTES=jA;exports.DRAFTABLE_ATTRIBUTE_TYPES=zs;exports.DRAFT_WRITE_TOOL_NAMES=ob;exports.DRIVE_LIST_VIEW=Ql;exports.DRIVE_OBJECT=Hl;exports.DRIVE_OBJECT_NAME=kt;exports.DRIVE_VIEW=Yl;exports.DetailViewBuilder=Sn;exports.DocumentsTabConfig=In;exports.EMPTY_VALUE_PLACEHOLDER=yt;exports.ESTIMATED_COUNT_CAP=Ph;exports.EmailsTabConfig=wn;exports.FAKE_MEETING_BOT_SIGNATURE_HEADER=wS;exports.FAMILY_INPUTS=Kf;exports.FAMILY_WIRE_INPUTS=Hf;exports.FORM_FORBIDDEN_ATTRIBUTE_TYPES=gr;exports.FlagRegistry=ze;exports.FlagService=Nt;exports.FormBuilder=pn;exports.FormRegistry=Ye;exports.FormRowBuilder=dn;exports.FormStepBuilder=cn;exports.GET_ARCHITECT_DRAFT_TOOL_NAME=lb;exports.GroupBuilder=Dt;exports.IDENTITY_PROPERTIES=Hg;exports.IMAGE_FORMATS=Oh;exports.INFERENCE_REASONING_OPTIONS=vo;exports.INFERENCE_SPEEDS=So;exports.LIST_VIEW_OPERATIONS=Oe;exports.LIST_VIEW_OPERATION_INPUT=ru;exports.LIVE_EVENT_TYPES=gd;exports.ListViewBuilder=vn;exports.ListViewTabConfigBuilder=Rn;exports.MAIL_DRAFT_BODY_MAX_CHARS=bS;exports.MAIL_SUBJECT_MAX_CHARS=gS;exports.MAX_PRESET_DEPTH=Eo;exports.MAX_TODOS=wy;exports.MAX_TODO_DESCRIPTION_CHARS=Iy;exports.MAX_TODO_ID_CHARS=xy;exports.MEETING_ATTRIBUTES=h;exports.MEETING_DETAIL_VIEW_ID=da;exports.MEETING_LIST_VIEW=nd;exports.MEETING_LIST_VIEW_ID=ua;exports.MEETING_OBJECT=td;exports.MEETING_OBJECT_NAME=jt;exports.MEETING_VIEW=rd;exports.MEETING_WRITE_SOURCE=la;exports.MEMORY_LIST_VIEW=Kl;exports.MEMORY_OBJECT=Gl;exports.MEMORY_VIEW=Wl;exports.McpOAuthCompletionMode=ip;exports.MeetingsTabConfig=xn;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_KEY=Pu;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION=ju;exports.NOTIFICATION_INBOX_STATES=ho;exports.NOTIFICATION_KINDS=bo;exports.NOTIFICATION_PRIORITIES=go;exports.NOTIFICATION_SENSITIVITIES=yo;exports.NOTIFICATION_TYPES_V1=Wg;exports.NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED=Cu;exports.NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN=Du;exports.NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED=Eu;exports.NOTIFICATION_WORK_STATES=Ao;exports.NO_RECORDING=xS;exports.NoopGeocodingAdapter=_o;exports.OBJECT_NAME_SCHEMA=Tt;exports.OPEN_TOOL_PART_STATES=Nu;exports.OPERATION_REGISTRY=it;exports.OPERATOR_SPECS=Qt;exports.ObjectBuilder=qe;exports.PRESENTATION_PROPERTIES=Qg;exports.PROVIDER_NAMES=Io;exports.PUBLISH_ARCHITECT_DRAFT_TOOL_NAME=ab;exports.QUALIFIED_SEPARATOR=UA;exports.QUOTA_KEYS=Vh;exports.RECORDING_OVERRIDES=AS;exports.RECORDING_POLICIES=TS;exports.RECORD_CREATOR_ROOT_ACTOR_METADATA_KEY=Wo;exports.RELATION_TARGET_ANY=ee;exports.REMOVE_OPERATION_SCHEMA=Js;exports.REQUEST_DESIGN_REVIEW_TOOL_NAME=ub;exports.RichtextTabConfig=An;exports.SCHEMA_OPERATIONS=je;exports.SCHEMA_OPERATION_INPUT=tu;exports.SCHEMA_PLAN_LIMITS=z;exports.SCHEMA_SOURCE_ID_PATTERN=Ii;exports.SESSION_STATE_STREAM_ID=Dy;exports.SESSION_TERMINAL_STATUSES=Ou;exports.SKILL_CONTENT_TEMPLATE=oa;exports.SKILL_LIST_VIEW=Ul;exports.SKILL_OBJECT=Bl;exports.SKILL_VIEW=$l;exports.STANDARD_SCHEMA_VENDOR=Rl;exports.SYSTEM_PART_CODES=br;exports.SYSTEM_RESOURCES=$;exports.SYSTEM_RESOURCE_LABELS=wT;exports.TODAY_DEFAULT=Ua;exports.TODO_PLAN_STATUSES=fy;exports.TODO_STATUSES=Ty;exports.TOOL_APPROVAL_STATES=Ro;exports.TabBuilder=te;exports.TableTabConfig=Et;exports.UPDATE_TABLE_TAB_CHANGE_KEYS=am;exports.UPDATE_TAB_CHANGE_KEYS=Lp;exports.UPDATE_TAB_CONFIG_CHANGE_KEYS=sm;exports.USER_STATUSES=xh;exports.USER_WORK_POSTURES=Ih;exports.accessLevelToActions=fh;exports.actionsToAccessLevel=mh;exports.agent=VT;exports.agentDataChunk=ev;exports.agentDisplayName=by;exports.agentInferencePreferencesSchema=JS;exports.agentMessageAttachmentSchema=xp;exports.agentMessagePartSchema=wp;exports.agentSessionInferenceOverridesInputSchema=Tp;exports.agentSessionInferenceOverridesSchema=XS;exports.agentSessionMessageSchema=os;exports.agentUIValidationError=Cp;exports.applyOperations=Li;exports.applyPipes=ul;exports.applyRelationProps=ml;exports.architectDraftChannelKey=aI;exports.assertAcyclicComputed=_i;exports.assertAcyclicComputedDependencies=va;exports.assertBilateralPairs=Jm;exports.assertCustomAgentUIMessageChunk=Op;exports.assertSchemaSourceId=sp;exports.bilateralDeclarationOf=nt;exports.booleanFlag=Ol;exports.buildAgentFallbackTitle=za;exports.buildPermissionFlags=Tl;exports.buildPropertySchema=gt;exports.buildQualifiedAttribute=zA;exports.checkbox=Zo;exports.compareAgentSessionMessages=ku;exports.compilablePlansOf=rt;exports.compileComputedFormula=Ut;exports.compileRollupAttribute=Ca;exports.computeByteMagnitude=Gu;exports.computedCompileSchemaOf=Oi;exports.computedPlanOf=or;exports.conversationDisplayTitle=ap;exports.createFlagRegistry=jl;exports.createFlagService=Vl;exports.createStandardSchemaProps=xt;exports.currency=QT;exports.customDataChunkSchemas=ds;exports.date=q;exports.dateInTimezone=Jt;exports.dateValueStart=Te;exports.defaultViewIdsFor=fe;exports.defaultViewsFor=ji;exports.defineOperation=Xt;exports.definePresentation=T;exports.dependentsOf=Ni;exports.deriveArchitectChanges=Vf;exports.deriveCreateDefaultsFromFilters=aS;exports.deriveInitials=hl;exports.describeOperations=kf;exports.destructiveSchema=es;exports.detailView=Y;exports.document=ea;exports.draftedLabelExpression=Ms;exports.draftedObjectDefinition=ar;exports.draftedViewDefinition=qf;exports.durableDateSchema=vp;exports.ensureFieldIds=ki;exports.episodeImpactOf=jf;exports.evaluateComputedAst=NI;exports.evaluateComputedFormula=kI;exports.evaluateComputedFormulaWithResult=PI;exports.evaluateFilterState=Jc;exports.evaluateRecordFilterState=XI;exports.extractAttributeNames=qo;exports.extractValueRefs=Go;exports.familyOf=Qf;exports.flagRegistry=Pl;exports.focusOf=Bi;exports.form=lw;exports.formFieldFlatKey=Lu;exports.formFieldKey=Mu;exports.formRegistry=ma;exports.formatAgentStreamFrameId=Jx;exports.formatAttributeValue=Vo;exports.formatByteSize=OA;exports.formatComputedResult=Wc;exports.formatLocationValue=el;exports.formula=tw;exports.fromDraftableView=Uf;exports.generateDefaultDetailView=Ke;exports.generateDefaultListView=He;exports.getActiveTab=Bx;exports.getEditableLabelAttribute=cl;exports.getErrorMessage=Ky;exports.getListViewDisplayAttributeNames=Ku;exports.getLiveProtocolPayloadChannel=fI;exports.getRecordCreatorPrincipalId=Al;exports.getSingleAttributeFromExpression=zo;exports.getSlotFieldTargets=Oo;exports.getUserDisplayName=gl;exports.group=Ew;exports.hasDestructiveEntries=_S;exports.hasOptions=yh;exports.imageModelIdSchema=us;exports.includesAction=xe;exports.inferInverseCardinality=ty;exports.inferRollupReturnType=Nc;exports.inferenceReasoningSchema=Di;exports.inferenceSpeedSchema=Ri;exports.isAgentUIDataName=Ep;exports.isAgentUIMessageBatch=nI;exports.isAttributeSortable=ry;exports.isBilateralRelation=ey;exports.isCheckboxEquality=$I;exports.isClaimableSessionStatus=my;exports.isComputedAttribute=_e;exports.isComputedFunctionName=Bt;exports.isDateRangeValue=ne;exports.isDefaultRole=vT;exports.isDetailView=bt;exports.isDocumentAttribute=FA;exports.isEmptyObject=qu;exports.isFieldGroup=$u;exports.isFormDefinition=Jy;exports.isFormFieldsRow=ft;exports.isFormFreeFieldRef=yr;exports.isFormHeadingRow=ih;exports.isFormSeparatorRow=oh;exports.isFormSlotFieldRef=Co;exports.isFormTextRow=ah;exports.isLabelExpression=At;exports.isListView=ko;exports.isLiveEventEnvelope=bI;exports.isLiveEventPayload=dI;exports.isLiveEventPayloadForType=vd;exports.isLiveEventType=Sd;exports.isMailProvider=fS;exports.isNotEmpty=jo;exports.isOpenToolPartState=gy;exports.isPlainRecord=Pa;exports.isStandardSchema=BT;exports.isSystemPartCode=hy;exports.isTerminalSessionStatus=py;exports.isTerminalState=ly;exports.isToolApprovalState=yy;exports.isUniversalRelation=wo;exports.jsonFlag=kl;exports.legacyStatusToSessionState=cy;exports.listView=Q;exports.liveChannelKey=ba;exports.location=ZT;exports.makeFieldId=Vs;exports.matchesAccepts=VA;exports.mentionReferenceSchema=Ip;exports.modelDefinitionSchema=Sp;exports.modelReferenceSchema=ss;exports.multiselect=XT;exports.nativeAgentUIPartIdMetadataKey=Vu;exports.normalizeDateValue=Hu;exports.number=St;exports.numberFlag=Nl;exports.object=ww;exports.orderAgentSessionMessages=Ay;exports.parseAgentStreamFrameId=Xx;exports.parseCountMode=Uu;exports.parseLiveChannelKey=ga;exports.parseNativeAgentUIPartIdsMetadata=Ey;exports.parseOperation=Pf;exports.parseOptionalCountMode=kh;exports.parseQualifiedAttribute=qA;exports.persistedDefaultViewTargetSchema=bp;exports.persistedSchemaPlanSchema=GS;exports.persistedViewConfig=at;exports.phone=YT;exports.plannedAttributeSchema=cp;exports.plannedInlineAttributeSchema=pp;exports.plannedObjectSchema=mp;exports.presentationOf=$i;exports.proposalTargetKey=Qs;exports.proposedDefaultViewTargetSchema=fp;exports.providerNameSchema=as;exports.qualifiedPropertyDefs=bl;exports.readFormFieldValue=th;exports.regenerateDerived=Fi;exports.registry=rx;exports.relation=Se;exports.relationPropertyDefs=fl;exports.relationTargetObjectName=Ne;exports.relationTargets=W;exports.relationTargetsOf=Zg;exports.relationValueIds=Mi;exports.renderLabelExpression=wr;exports.requestedCapabilities=lS;exports.requiredTargetKeys=Mf;exports.resetViewToDefault=cd;exports.resolveAttributeDefaultValue=rp;exports.resolveFieldRequired=eh;exports.resolvePropertyDefinitions=No;exports.richtext=ie;exports.rollup=rw;exports.rollupToFormulaExpression=_c;exports.schemaPlanSchema=zS;exports.select=H;exports.sessionInferencePatchSchema=ZS;exports.sessionStateToLegacyStatus=dy;exports.status=JT;exports.stillMissing=Jf;exports.stringFlag=_l;exports.summarizeDraft=ib;exports.targetTokensFor=Lf;exports.text=b;exports.toAttribute=ke;exports.toDraftableAttributes=tf;exports.toDraftableObject=ef;exports.toDraftableView=$f;exports.toUndefinedIfEmpty=zu;exports.todoItemSchema=Rp;exports.todoPlanSchema=Dp;exports.toolImpactSchema=ls;exports.user=ew;exports.validateAttributeName=Ue;exports.validateLabelExpression=sl;exports.validateObjectExpressions=El;exports.validateObjectName=$e;exports.validateViewName=wt;exports.viewIdFor=Pi;exports.viewRegistry=id;exports.viewStateKey=vh;exports.viewSyncPayload=up;
|