@stndrds/schema 1.0.0-alpha.320 → 1.0.0-alpha.322
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-DBCKpYgI.d.ts → all-DPW8A7kG.d.ts} +222 -449
- package/dist/{all-Dlu3MgoQ.d.mts → all-yrWOkrj0.d.mts} +222 -449
- package/dist/chunk-2M4YXNYZ.js +15 -0
- package/dist/chunk-EZCWO4XV.mjs +15 -0
- package/dist/chunk-MXZ3AF5X.js +2 -0
- package/dist/chunk-OGFEFOJQ.mjs +2 -0
- package/dist/{index-Cap0zZBP.d.mts → index-BbYKy1fQ.d.mts} +69 -1
- package/dist/{index-iz5DJ6dg.d.ts → index-BjKaOUx3.d.ts} +69 -1
- package/dist/index.d.mts +192 -391
- package/dist/index.d.ts +192 -391
- package/dist/index.js +13 -24
- package/dist/index.mjs +13 -24
- package/dist/validation/all.d.mts +2 -2
- package/dist/validation/all.d.ts +2 -2
- package/dist/validation/all.js +1 -1
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/config/index.js +1 -1
- package/dist/validation/config/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-HRX4YCKZ.js +0 -4
- package/dist/chunk-J3KPWG7Q.mjs +0 -2
- package/dist/chunk-QIDZFNGR.mjs +0 -4
- package/dist/chunk-RPTKXZBV.js +0 -2
package/dist/index.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
'use strict';var chunkRTHLB6T6_js=require('./chunk-RTHLB6T6.js'),
|
|
2
|
-
var xo=["fyi","task","question","handoff","system"],To=["low","normal","high","urgent"],wo=["public","internal","sensitive"],So=["unread","read","archived","snoozed"],Io=["none","pending","processing","completed","dismissed","expired","failed"],Fc="agent.session.waiting_human",Vc="agent.task.assigned",Bc="agent.question.requested",lg=[Fc,Vc,Bc];var pg=["name","type"],mg=["required","hidden","archived","deprecated","defaultValue","config","order","unique"],fg=["label","description","placeholder","icon"];var Ht=["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"],ae="*";function yg(e){return e.type!=="relation"||!Array.isArray(e.targets)?[]:e.targets.map(t=>t.object).filter(t=>t!==ae)}chunkDPD6ZWL2_js.a(yg,"relationTargetsOf");function Ro(e){return e.targets.length===1&&e.targets[0].object===ae}chunkDPD6ZWL2_js.a(Ro,"isUniversalRelation");function hg(e){return e.bilateral!==void 0}chunkDPD6ZWL2_js.a(hg,"isBilateralRelation");function Co(e){return "many"}chunkDPD6ZWL2_js.a(Co,"inferInverseCardinality");function Ag(e){return chunkRPTKXZBV_js.n(e)}chunkDPD6ZWL2_js.a(Ag,"isAttributeSortable");var wg=["record","object","attribute","view","user","role","settings","file","agent","schema_source"],Sg=["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 Cg(e){return e.phase==="terminal"}chunkDPD6ZWL2_js.a(Cg,"isTerminalState");function vg(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(vg,"sessionStateToLegacyStatus");function Eg(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(Eg,"legacyStatusToSessionState");var Lc=["completed","failed","cancelled","timeout","expired"];function Ng(e){return Lc.includes(e)}chunkDPD6ZWL2_js.a(Ng,"isTerminalSessionStatus");var $c=["idle","completed","waiting_human","waiting_agents","cancelled","failed","timeout"];function Dg(e){return $c.includes(e)}chunkDPD6ZWL2_js.a(Dg,"isClaimableSessionStatus");var vo=Object.freeze({mutation:"ask",destructive:"ask",outward:"ask"}),Og=["active","completed","abandoned"],Eo=["openai","anthropic","google","spacexai","deepseek","moonshotai","alibaba","mistral","minimax","meta","zai"],No=["standard","fast"],Do=["none","minimal","low","medium","high","xhigh"];function kg(e){return e.label?.trim()||e.name}chunkDPD6ZWL2_js.a(kg,"agentDisplayName");var Oo=["approval-requested","approval-responded","approval-dispatched"],Uc=["streaming","running","pending",...Oo];function jg(e){return Uc.includes(e)}chunkDPD6ZWL2_js.a(jg,"isOpenToolPartState");function _g(e){return Oo.includes(e)}chunkDPD6ZWL2_js.a(_g,"isToolApprovalState");var Bn=["CREDITS_EXHAUSTED"];function Pg(e){return typeof e=="string"&&Bn.includes(e)}chunkDPD6ZWL2_js.a(Pg,"isSystemPartCode");function qc(e,t){let n=e.createdAt.getTime()-t.createdAt.getTime();return n===0?e.id.localeCompare(t.id):n}chunkDPD6ZWL2_js.a(qc,"compareAgentSessionMessages");function Mg(e){return [...e].sort(qc)}chunkDPD6ZWL2_js.a(Mg,"orderAgentSessionMessages");var Fg=["pending","in_progress","completed","blocked"],Vg=50,Bg=80,Lg=500;var zg="session-state",zc="__stndrdsNativeUiPartIds",Wc=1,Gc="Native agent UI part IDs metadata is invalid";function Le(){throw new chunkJSKLP4GI_js.h(Gc,[])}chunkDPD6ZWL2_js.a(Le,"invalidNativePartIds");function ko(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(ko,"isPlainRecord");function Kc(e,t){if(e.type==="text"||e.type==="reasoning")return `${e.type}:${t}`;if(e.type==="tool")return `tool:${e.toolCallId}`}chunkDPD6ZWL2_js.a(Kc,"nativeAgentUIPartIdMetadataKey");function Wg(e){let t=e.metadata?.[zc];ko(t)||Le(),(Object.keys(t).length!==2||t.schemaVersion!==Wc||!ko(t.partIds))&&Le();let n=new Map;for(let[s,c]of e.parts.entries()){let u=Kc(c,s);if(!u||n.has(u)){u&&Le();continue}n.set(u,c);}let r=Object.entries(t.partIds);r.length!==n.size&&Le();let o=new Map,a={};for(let[s,c]of r){let u=n.get(s);u&&typeof c=="string"&&c.length>0||Le();let d=o.get(c);d&&(u.type==="tool"||d!==u.type)&&Le(),u.type==="tool"&&c!==u.toolCallId&&Le(),o.set(c,u.type),a[s]=c;}return a}chunkDPD6ZWL2_js.a(Wg,"parseNativeAgentUIPartIdsMetadata");var Yg=16e3,Hg=3200,Jg=6400,Qg=16e3,Xg=65536,Zg=15e3,ey=1e4,ty=5e3,ny="google/gemini-3.5-transcribe-live",ry={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2};var oy=["web","presentation","document","spreadsheet","image","code","other"],ay=["ephemeral","conversation","persistent"],sy=["source","preview","entrypoint","asset"];var jo=5;function ly(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(ly,"getErrorMessage");function fy(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(fy,"isFormDefinition");var Ln=["relation","multiRelation","formula","rollup","document","richtext","user"];function _o(e){return e.type==="slot"}chunkDPD6ZWL2_js.a(_o,"isFormSlotFieldRef");function $n(e){return e.type==="free"}chunkDPD6ZWL2_js.a($n,"isFormFreeFieldRef");function yy(e){return e.fieldRequired!==void 0?e.fieldRequired:e.slotMode==="create"&&e.attributeRequired===true}chunkDPD6ZWL2_js.a(yy,"resolveFieldRequired");function Po(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}chunkDPD6ZWL2_js.a(Po,"getSlotFieldTargets");function Yc(e){return _o(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}chunkDPD6ZWL2_js.a(Yc,"formFieldKey");function Hc(e){return _o(e)?e.attribute:e.attribute.name}chunkDPD6ZWL2_js.a(Hc,"formFieldFlatKey");function hy(e,t){return e[Yc(t)]??e[Hc(t)]}chunkDPD6ZWL2_js.a(hy,"readFormFieldValue");function Jt(e){return e.type==="fields"}chunkDPD6ZWL2_js.a(Jt,"isFormFieldsRow");function Ty(e){return e.type==="heading"}chunkDPD6ZWL2_js.a(Ty,"isFormHeadingRow");function wy(e){return e.type==="separator"}chunkDPD6ZWL2_js.a(wy,"isFormSeparatorRow");function Sy(e){return e.type==="text"}chunkDPD6ZWL2_js.a(Sy,"isFormTextRow");var Un=class Un{async autocomplete(){return await Promise.resolve([])}async reverse(){return await Promise.resolve(null)}async geocode(){return await Promise.resolve(null)}};chunkDPD6ZWL2_js.a(Un,"NoopGeocodingAdapter");var Mo=Un;var qn=["read","create","update","delete","manage"];function Dy(e){return e.length===0?"none":e.length===1&&e[0]==="read"?"read-only":e.length===qn.length&&qn.every(t=>e.includes(t))?"full":"custom"}chunkDPD6ZWL2_js.a(Dy,"actionsToAccessLevel");function Oy(e){switch(e){case "full":return [...qn];case "read-only":return ["read"];case "none":return []}}chunkDPD6ZWL2_js.a(Oy,"accessLevelToActions");function Fo(e){let t=e.properties;if(!t)return [];if(Array.isArray(t))return t;let n=t;return Array.isArray(n.definitions)?n.definitions:[]}chunkDPD6ZWL2_js.a(Fo,"resolvePropertyDefinitions");function _y(e){return e.type==="select"||e.type==="status"||e.type==="multiselect"}chunkDPD6ZWL2_js.a(_y,"hasOptions");var Jc="Notetaker",Fy={systemPrompt:null,meetingRecordingPolicy:"none",meetingBotDisplayName:Jc};var By=["active","suspended"],Ly=["architect","manual","auto"];var Uy=["square","landscape","portrait"];var Vo=["none","estimated","exact"];function Qc(e){if(typeof e=="string"&&Vo.includes(e))return e;throw new chunkJSKLP4GI_js.h(`countMode must be one of: ${Vo.join(", ")} (received: ${String(e)})`,[])}chunkDPD6ZWL2_js.a(Qc,"parseCountMode");function Wy(e){return e===void 0?void 0:Qc(e)}chunkDPD6ZWL2_js.a(Wy,"parseOptionalCountMode");var Gy=1e4;var Hy=["storage.bytes","members.seats","data.live_records"];function Xc(e){return e==null?true:typeof e!="object"?false:Object.keys(e).length===0}chunkDPD6ZWL2_js.a(Xc,"isEmptyObject");function Bo(e){return e!=null&&typeof e=="object"&&Object.keys(e).length>0}chunkDPD6ZWL2_js.a(Bo,"isNotEmpty");function Zc(e){return Bo(e)?e:void 0}chunkDPD6ZWL2_js.a(Zc,"toUndefinedIfEmpty");function eu(e){if(e<=0)return {value:0,unitIndex:0};let t=1e3,n=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return {value:Number.parseFloat((e/t**n).toFixed(1)),unitIndex:n}}chunkDPD6ZWL2_js.a(eu,"computeByteMagnitude");var tu=["B","KB","MB","GB","TB"];function $h(e){let{value:t,unitIndex:n}=eu(e);return `${t} ${tu[n]}`}chunkDPD6ZWL2_js.a($h,"formatByteSize");var zh={ATTACHMENTS:"attachments"};function Wh(e){return e.type==="document"}chunkDPD6ZWL2_js.a(Wh,"isDocumentAttribute");function Gh(e,t){if(!t||t.length===0)return true;let n=e.name.toLowerCase();return t.some(r=>r.endsWith("/*")?e.mimeType.startsWith(r.slice(0,-1)):r.startsWith(".")?n.endsWith(r.toLowerCase()):e.mimeType===r)}chunkDPD6ZWL2_js.a(Gh,"matchesAccepts");var Lo=Object.freeze(["text","number","checkbox","date","phone","currency","status","select","multiselect","location"]);function Qt(e){let t=[];for(let n of e){let r=n.build();if(!Lo.includes(r.type))throw new Error(`Property type "${r.type}" is not supported in .qualifyWith()`);t.push(r);}return {definitions:t}}chunkDPD6ZWL2_js.a(Qt,"buildPropertySchema");var Qh="__";function Xh(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(Xh,"parseQualifiedAttribute");function Zh(e,t){return `${e}__${t}`}chunkDPD6ZWL2_js.a(Zh,"buildQualifiedAttribute");function Ne(e){return typeof e=="object"&&e!==null&&typeof e.start=="string"}chunkDPD6ZWL2_js.a(Ne,"isDateRangeValue");function nu(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(nu,"normalizeDateValue");function tt(e){return typeof e=="string"&&e!==""?e:Ne(e)&&e.start!==""?e.start:null}chunkDPD6ZWL2_js.a(tt,"dateValueStart");var Xt="\u2014";function ru(e){return String(e)}chunkDPD6ZWL2_js.a(ru,"formatText");function iu(e){return e?"Yes":"No"}chunkDPD6ZWL2_js.a(iu,"formatCheckbox");function ou(e,t){if(typeof e!="number")return String(e);if(t.renderAs==="rating")return `${e}/${t.max??5}`;let n=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:n,maximumFractionDigits:n}):e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n})}chunkDPD6ZWL2_js.a(ou,"formatNumber");function au(e,t){if(typeof e!="object"||e===null)return String(e);let n=e;return "value"in n&&"code"in n?`${n.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} ${n.code}`:String(e)}chunkDPD6ZWL2_js.a(au,"formatCurrency");function zn(e){if(Ne(e)){let t=zn(e.start);return e.end?`${t} \u2192 ${zn(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(zn,"formatDate");function su(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(su,"formatPhone");function cu(e,t="full"){if(typeof e!="object"||e===null)return "";let n=e,r=[];switch(t){case "country":n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;case "state":n.state&&r.push(n.state),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;case "city":n.city&&r.push(n.city),n.state&&r.push(n.state),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;case "coordinates":n.latitude!==void 0&&n.longitude!==void 0&&r.push(`${n.latitude}, ${n.longitude}`);break;case "address":n.address&&r.push(n.address),n.city&&r.push(n.city),n.state&&r.push(n.state),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;default:n.address&&r.push(n.address),n.address2&&r.push(n.address2),n.city&&r.push(n.city),n.state&&r.push(n.state),n.postalCode&&r.push(n.postalCode),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break}return r.join(", ")}chunkDPD6ZWL2_js.a(cu,"formatLocationValue");function uu(e,t){return typeof e!="object"||e===null?String(e):cu(e,t.granularity??"full")||Xt}chunkDPD6ZWL2_js.a(uu,"formatLocation");function lu(e,t){return typeof e!="string"?String(e):t.options?.find(r=>r.value===e)?.label??String(e)}chunkDPD6ZWL2_js.a(lu,"formatSelect");function du(e,t){return Array.isArray(e)?t.options?e.map(r=>t.options.find(o=>o.value===r)?.label).filter(Boolean).join(", "):e.join(", "):String(e)}chunkDPD6ZWL2_js.a(du,"formatMultiselect");function $o(e,t){if(chunkIBM4ID4Y_js.a(e))return Xt;switch(t.type){case "text":return ru(e);case "checkbox":return iu(e);case "number":return ou(e,t);case "currency":return au(e);case "date":return zn(e);case "phone":return su(e);case "location":return uu(e,t);case "select":case "status":return lu(e,t);case "multiselect":return du(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($o,"formatAttributeValue");var mu=["UPPER","LOWER","capitalize","trim"],fu=["prefix","suffix","wrap","default"],Zt=[...mu,...fu],nt=Kn.z.string().min(1,"labelExpression cannot be empty").refine(e=>en(e),{message:"labelExpression must contain at least one {{ attribute }} interpolation"}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:"labelExpression contains empty {{ }} interpolation"}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,n;for(;(n=t.exec(e))!==null;){let r=n[1];if(!Zt.includes(r))return false}return true},{message:`Invalid pipe name. Valid pipes: ${Zt.join(", ")}`});function bu(e){let t=nt.safeParse(e);return t.success?{success:true,attributes:wt(e)}:{success:false,error:t.error.issues[0]?.message??"Invalid labelExpression"}}chunkDPD6ZWL2_js.a(bu,"validateLabelExpression");function gu(e,t){let{name:n,args:r}=hu(t);switch(n){case "UPPER":return e.toUpperCase();case "LOWER":return e.toLowerCase();case "capitalize":return e.replace(/(^|\s)\S/g,o=>o.toUpperCase());case "trim":return e.trim();case "prefix":return e?`${r[0]??""}${e}`:"";case "suffix":return e?`${e}${r[0]??""}`:"";case "wrap":return e?`${r[0]??""}${e}${r[1]??""}`:"";case "default":return e||r[0]||"";default:return e}}chunkDPD6ZWL2_js.a(gu,"applyPipe");function Uo(e,t){let n=e;for(let r of t)n=gu(n,r);return n}chunkDPD6ZWL2_js.a(Uo,"applyPipes");function yu(e,t){return t.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},e)}chunkDPD6ZWL2_js.a(yu,"getValue");var qo="(Untitled)";function hu(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return {name:e,args:[]};let n=t[1],r=t[2];if(!r)return {name:n,args:[]};let o=[],a=/["']([^"']*?)["']/g,s;for(;(s=a.exec(r))!==null;)o.push(s[1]);return {name:n,args:o}}chunkDPD6ZWL2_js.a(hu,"parsePipeExpression");function*zo(e){let t=0;for(;t<e.length;){let n=e.indexOf("{{",t);if(n<0)return;let r=e.indexOf("}",n+2);if(r<0)return;if(e[r+1]!=="}"){t=r+1;continue}t=r+2;let o=e.slice(n+2,r);o.length>0&&(yield {start:n,end:t,expr:o});}}chunkDPD6ZWL2_js.a(zo,"templateBlocks");function Au(e,t){let n=e.split("||").map(u=>u.trim()),o=n[n.length-1].split("|").map(u=>u.trim());n[n.length-1]=o[0];let a=o.slice(1).filter(Boolean),s=n.filter(Boolean),c="";for(let u of s){let d=Wo(yu(t,u));if(d!==""){c=d;break}}return Uo(c,a)}chunkDPD6ZWL2_js.a(Au,"resolveLabelBlock");function Wn(e,t,n=qo){let r=[],o=0;for(let s of zo(e))r.push(e.slice(o,s.start),Au(s.expr,t)),o=s.end;return r.push(e.slice(o)),r.join("").trim()||n}chunkDPD6ZWL2_js.a(Wn,"renderLabelExpression");function Wo(e){if(e==null||typeof e=="function")return "";if(typeof e!="object")return String(e);if(Array.isArray(e))return e.map(Wo).filter(Boolean).join(",");let t=e.toString;return typeof t=="function"&&t!==Object.prototype.toString?String(e):""}chunkDPD6ZWL2_js.a(Wo,"toText");function en(e){let t=0;for(;t<e.length;){let n=e.indexOf("{{",t);if(n<0)return false;let r=e.indexOf("}}",n+2);if(r<0)return false;if(e.slice(n+2,r).trim().length>0)return true;t=r+2;}return false}chunkDPD6ZWL2_js.a(en,"isLabelExpression");function wt(e){let t=[];for(let n of zo(e)){let r=n.expr.trim();if(!r)continue;let o=r.split("||").map(s=>s.trim()),a=o[o.length-1];o[o.length-1]=a.split("|")[0].trim();for(let s of o){if(!s)continue;let c=s.split(".")[0];c&&!t.includes(c)&&t.push(c);}}return t}chunkDPD6ZWL2_js.a(wt,"extractAttributeNames");var xu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function Go(e){let t=e.trim().match(xu);return t?t[1]:null}chunkDPD6ZWL2_js.a(Go,"getSingleAttributeFromExpression");function Tu(e,t){let n=Go(e);if(n===null)return null;let r=t.find(o=>o.name===n);return !r||r.type!=="text"||chunkRPTKXZBV_js.j(r).authoring.readOnly?null:r}chunkDPD6ZWL2_js.a(Tu,"getEditableLabelAttribute");var wu=/\{\{\s*props\./;function Su(e,t,n){if(!wu.test(e))return e;let r={},o=new Map(n?.map(s=>[s.name,s]));if(t)for(let[s,c]of Object.entries(t)){if(c==null)continue;let u=o.get(s);if(u){let d=$o(c,u);r[s]=d===Xt?"":d;}else r[s]=c;}return Wn(e,{props:r},"").replace(/\(\s*\)/g,"").replace(/\[\s*\]/g,"").replace(/\s*[-—|:]\s*$/g,"").replace(/\s{2,}/g," ").trim()}chunkDPD6ZWL2_js.a(Su,"applyRelationProps");function Iu(e){if(e?.type==="relation")return e.properties?.definitions}chunkDPD6ZWL2_js.a(Iu,"relationPropertyDefs");function Ru(e){if(e?.type==="relation"||e?.type==="document")return e.properties?.definitions}chunkDPD6ZWL2_js.a(Ru,"qualifiedPropertyDefs");function Ko(e){if(chunkIBM4ID4Y_js.a(e))return [];if(typeof e=="string")return [{id:e}];if(Array.isArray(e))return e.flatMap(t=>Ko(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(Ko,"extractValueRefs");function Cu(e){let t=[e.firstName,e.lastName].map(n=>n?.trim()).filter(Boolean).join(" ");return t!==""?t:e.email?.split("@")[0]??""}chunkDPD6ZWL2_js.a(Cu,"getUserDisplayName");var vu=/\p{L}|\p{N}/u;function Eu(e,t){let n=e?.trim()??"";if(n==="")return t;let r=n.split(/\s+/),a=(r.length===1?n.split("@")[0].split(/[._-]/):r).map(s=>{let c=s.match(vu)?.[0];return c===void 0?"":[...c.toUpperCase()][0]??""}).filter(Boolean).slice(0,2).join("");return a===""?t:a}chunkDPD6ZWL2_js.a(Eu,"deriveInitials");var Yo="__creatorRootActorId";function Nu(e){let t=e.metadata?.[Yo];return typeof t=="string"&&t.length>0?t:e.createdBy}chunkDPD6ZWL2_js.a(Nu,"getRecordCreatorPrincipalId");function rt(e,t){return e?.includes("*")===true||e?.includes(t)===true}chunkDPD6ZWL2_js.a(rt,"includesAction");function Du(e){return {canRead:rt(e,"read"),canCreate:rt(e,"create"),canUpdate:rt(e,"update"),canDelete:rt(e,"delete"),canManage:rt(e,"manage")}}chunkDPD6ZWL2_js.a(Du,"buildPermissionFlags");var CA=new Set(["id","name","label","type","required","system","unique","order"]);var ne={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"},EA=[ne.PEOPLE,ne.WORKSPACE,ne.ARCHITECT,ne.FEATURE_FLAGS,ne.FILES,ne.VIEWS,ne.FORMS,ne.DOCUMENTS,ne.AUDIT,ne.API_KEYS,ne.CONNECTORS,ne.ENV_VARS,ne.SESSION],NA={people:"People",workspace:"Workspace",architect:"Architect","feature-flags":"Feature flags",files:"Files",views:"Views",forms:"Forms",documents:"Documents",audit:"Audit","api-keys":"API keys",connectors:"Connected accounts","env-vars":"Environment variables",session:"Agent sessions"},Ou={OWNER:"owner",MEMBER:"member",AGENT_DEFAULT:"agent_default",REFLEX_DEFAULT:"reflex_default"},DA={owner:"Owner",member:"Member",agent_default:"Agent Default",reflex_default:"Reflex Default"},OA={owner:"Full access to all platform features and data",member:"Can view, create, edit and delete business data",agent_default:"Default role for AI agents \u2014 CRUD on records plus documents and files",reflex_default:"Default role for reflexes \u2014 no data access; each reflex is granted exactly what its rehearsal showed it uses"},Gn=["read","create","update","delete","manage"],ku=["read","create","update","delete"],Ho=["read","create","update","delete"],kA={owner:{system:[{target:"*",actions:Gn}],object:[{target:"*",actions:Gn}]},member:{system:[{target:"people",actions:["read"]},{target:"workspace",actions:["read"]},{target:"connectors",actions:ku},{target:"files",actions:Ho},{target:"documents",actions:Ho}],object:[{target:"*",actions:Gn}]},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 jA(e){return Object.values(Ou).includes(e)}chunkDPD6ZWL2_js.a(jA,"isDefaultRole");var _u=new Set(constants.ICONS),Qo=/^[a-zA-Z_][a-zA-Z0-9_]*$/,Pu=/^[a-z][a-z0-9-]*$/,it=63,Jo=128,tn=Kn__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
|
-
|
|
4
|
-
\u2705 Valid: 'products', 'user-profiles', 'order-items'
|
|
5
|
-
\u274C Invalid: 'Products', 'userProfiles', 'user_profiles'`});function St(e){try{tn.parse(e);}catch(t){throw t instanceof Kn__default.default.ZodError?new chunkJSKLP4GI_js.b(t.issues[0].message,chunkJSKLP4GI_js.a.INVALID_OBJECT_NAME):t}}chunkDPD6ZWL2_js.a(St,"validateObjectName");function Mu(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>it)throw new chunkJSKLP4GI_js.h("View name is too long",[{path:["name"],message:`View name is too long (max ${it} characters)`}]);if(!Pu.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(Mu,"validateViewName");function nn(e,t,n){let r=new Set;for(let o of e){let a=t(o);if(r.has(a))throw n(a);r.add(a);}}chunkDPD6ZWL2_js.a(nn,"assertUniqueBy");var Yn=Kn__default.default.string().min(1,"Attribute name cannot be empty").max(it,`Attribute name is too long (max ${it} characters)`).regex(Qo,{message:`Invalid attribute name format.
|
|
6
|
-
Name must be a valid variable identifier:
|
|
7
|
-
\u2705 Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
|
|
8
|
-
\u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`}).refine(e=>!chunkRPTKXZBV_js.B.includes(e),{message:`This is a reserved attribute name. Reserved names: ${chunkRPTKXZBV_js.B.join(", ")}`});function It(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute name cannot be empty");if(e.length>it)throw new Error(`[AttributeBuilder] Attribute name is too long (max ${it} characters)`);if(!Qo.test(e))throw new Error(`[AttributeBuilder] Invalid attribute name format.
|
|
9
|
-
Name must be a valid variable identifier:
|
|
10
|
-
\u2705 Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
|
|
11
|
-
\u274C Invalid: 'first-name', 'first name', '123name', 'first.name'`);if(chunkRPTKXZBV_js.B.includes(e))throw new Error(`[AttributeBuilder] "${e}" is a reserved name and cannot be used as an attribute name.
|
|
12
|
-
Reserved names: ${chunkRPTKXZBV_js.B.join(", ")}`)}chunkDPD6ZWL2_js.a(It,"validateAttributeName");function Xo(e){if(!e||e.length===0)throw new Error("[AttributeBuilder] Attribute label cannot be empty");if(e.length>Jo)throw new Error(`[AttributeBuilder] Attribute label is too long (max ${Jo} characters)`)}chunkDPD6ZWL2_js.a(Xo,"validateLabel");function Zo(e,t){if(!_u.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(Zo,"validateIconName");function $e(e,t){let n=new Set;for(let r of t){if(!r.value?.trim())throw new Error(`[AttributeBuilder] Option in "${e}" has an empty or missing value.`);if(!r.label?.trim())throw new Error(`[AttributeBuilder] Option "${r.value}" in "${e}" has an empty or missing label.`);if(n.has(r.value))throw new Error(`[AttributeBuilder] Duplicate option value "${r.value}" in "${e}".`);n.add(r.value);}for(let r of t){if(r.inverse===void 0)continue;let o=t.find(a=>a.value===r.inverse);if(!o)throw new Error(`[AttributeBuilder] Option "${r.value}" in "${e}" has inverse "${r.inverse}" which does not match any option value.`);if(o.inverse!==r.value)throw new Error(`[AttributeBuilder] Inverse mismatch in "${e}": "${r.value}" points to "${r.inverse}", but "${r.inverse}" points to "${o.inverse??"(none)"}". Inverse pairs must be symmetric.`)}}chunkDPD6ZWL2_js.a($e,"validateOptions");var ea={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2},timeoutMs:3e5},Jn=class Jn{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,n,r){return this.bp.model={provider:t,model:n,...r},this}tools(t){return this.bp.tools=[...t],this}schedule(t){return this.bp.schedule={...t,enabled:t.enabled??true},this}config(t){let n=this.bp.config??ea,r=t.inference===void 0?n.inference:{...n.inference,...t.inference};return this.bp.config={...n,...t,...r===void 0?{}:{inference:r}},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={...vo,...this.bp.approval,...t},this}visibility(t){return this.bp.visibility=t,this}requiresPermission(t,n){return this.bp.requiredPermission={resource:t,action:n},this}trigger(t,n,r){return this.bp.triggers.push({name:t,eventType:n,...r,enabled:r?.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 nn(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??ea,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};chunkDPD6ZWL2_js.a(Jn,"AgentBuilder");var Hn=Jn;function WA(e){return new Hn(e)}chunkDPD6ZWL2_js.a(WA,"agent");var Fu="@stndrds/schema";function rn(e){return {version:1,vendor:Fu,validate:chunkDPD6ZWL2_js.a(t=>{let n=e.safeParse(t);return n.success?{value:n.data}:{issues:n.error.issues.map(r=>({message:r.message,path:r.path}))}},"validate")}}chunkDPD6ZWL2_js.a(rn,"createStandardSchemaProps");function YA(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"].version===1}chunkDPD6ZWL2_js.a(YA,"isStandardSchema");var fr=class fr{get"~standard"(){let t=chunkIBM4ID4Y_js.c(this.build());return rn(t)}constructor(t,n,r){It(n),Xo(r),this.attr={name:n,label:r,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 Zo(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(fr,"BaseAttributeBuilder");var L=fr,br=class br extends L{constructor(t,n){super("text",t,n);}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(br,"TextAttributeBuilder");var Qn=br;function w(e){return new Qn(e.name,e.label)}chunkDPD6ZWL2_js.a(w,"text");var gr=class gr extends L{constructor(t,n){super("richtext",t,n);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(gr,"RichtextAttributeBuilder");var Xn=gr;function De(e){return new Xn(e.name,e.label)}chunkDPD6ZWL2_js.a(De,"richtext");var yr=class yr extends L{constructor(t,n){super("number",t,n);}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(yr,"NumberAttributeBuilder");var Zn=yr;function an(e){return new Zn(e.name,e.label)}chunkDPD6ZWL2_js.a(an,"number");var hr=class hr extends L{constructor(t,n){super("checkbox",t,n);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(hr,"CheckboxAttributeBuilder");var er=hr;function ta(e){return new er(e.name,e.label)}chunkDPD6ZWL2_js.a(ta,"checkbox");var Ar=class Ar extends L{constructor(t,n){super("date",t,n);}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(Ar,"DateAttributeBuilder");var tr=Ar;function se(e){return new tr(e.name,e.label)}chunkDPD6ZWL2_js.a(se,"date");var xr=class xr extends L{constructor(t,n){super("phone",t,n);}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(xr,"PhoneAttributeBuilder");var nr=xr;function rx(e){return new nr(e.name,e.label)}chunkDPD6ZWL2_js.a(rx,"phone");var Tr=class Tr extends L{constructor(t,n){super("currency",t,n);}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(Tr,"CurrencyAttributeBuilder");var rr=Tr;function ix(e){return new rr(e.name,e.label)}chunkDPD6ZWL2_js.a(ix,"currency");var wr=class wr extends L{constructor(t,n){super("status",t,n);}options(t){let n=t;return $e(this.attr.name??"unknown",n),this.attr.options=n,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let n=[...this.attr.options,t];return $e(this.attr.name??"unknown",n),this.attr.options.push(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(wr,"StatusAttributeBuilder");var ir=wr;function ox(e){return new ir(e.name,e.label)}chunkDPD6ZWL2_js.a(ox,"status");var Sr=class Sr extends L{constructor(t,n){super("select",t,n);}options(t){let n=t;return $e(this.attr.name??"unknown",n),this.attr.options=n,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let n=[...this.attr.options,t];return $e(this.attr.name??"unknown",n),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(Sr,"SelectAttributeBuilder");var or=Sr;function fe(e){return new or(e.name,e.label)}chunkDPD6ZWL2_js.a(fe,"select");var Ir=class Ir extends L{constructor(t,n){super("multiselect",t,n);}options(t){let n=t;return $e(this.attr.name??"unknown",n),this.attr.options=n,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let n=[...this.attr.options,t];return $e(this.attr.name??"unknown",n),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(Ir,"MultiselectAttributeBuilder");var ar=Ir;function ax(e){return new ar(e.name,e.label)}chunkDPD6ZWL2_js.a(ax,"multiselect");var Rr=class Rr extends L{constructor(t,n){super("location",t,n);}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(Rr,"LocationAttributeBuilder");var sr=Rr;function sx(e){return new sr(e.name,e.label)}chunkDPD6ZWL2_js.a(sx,"location");var Cr=class Cr extends L{constructor(t,n){super("user",t,n),this.attr.types=["user","agent"];}types(t){let n=[...new Set(t)];if(n.length===0)throw new Error("[AttributeBuilder] user.types must contain at least one type.");return this.attr.types=n,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(Cr,"UserAttributeBuilder");var cr=Cr;function cx(e){return new cr(e.name,e.label)}chunkDPD6ZWL2_js.a(cx,"user");var vr=class vr extends L{to(t,n){let r={object:t,...n};return this.attr.targets?.push(r),this}toAny(){return this.attr.targets=[{object:ae}],this}qualifyWith(...t){let n=this.attr.targets;if(!n||n.length===0)throw new Error('.qualifyWith() must be called AFTER .to(). Example: relation({ name: "companies" }).to("companies").qualifyWith(...)');return this.attr.properties=Qt(t),this}bilateral(t){let n=this.attr.targets;if(!n||n.length===0)throw new Error('.bilateral() must be called AFTER .to(). Example: relation({ name: "company" }).to("companies").bilateral({ ... })');if(n.length>1)throw new Error("Bilateral relations are not supported for polymorphic relations (multiple .to() targets).");if(Ro(this.attr))throw new Error("Bilateral relations are not supported for universal relations (.toAny()).");let r=n[0]?.object;if(!r)throw new chunkJSKLP4GI_js.h("Bilateral relation requires one target object",[{path:["bilateral","object"],message:"Bilateral relation requires one target object"}]);if(t.object&&t.object!==r){let o=`Bilateral inverse object ${t.object} must match relation target ${r}`;throw new chunkJSKLP4GI_js.h(o,[{path:["bilateral","object"],message:o}])}return this.attr.bilateral={...t,object:r},this}};chunkDPD6ZWL2_js.a(vr,"BaseRelationAttributeBuilder");var on=vr,Er=class Er extends on{constructor(t,n){super("relation",t,n),this.attr.cardinality="one",this.attr.targets=[];}many(){let t=new lr(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(Er,"SingleRelationAttributeBuilder");var ur=Er,Nr=class Nr extends on{constructor(t,n,r){super("relation",t,n),this.attr.cardinality="many",this.attr.targets=r?.targets??[],this.attr.defaultValue=[],r?.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(Nr,"MultiRelationAttributeBuilder");var lr=Nr;function ot(e){return new ur(e.name,e.label)}chunkDPD6ZWL2_js.a(ot,"relation");var Dr=class Dr extends L{constructor(t,n){super("formula",t,n),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(Dr,"FormulaAttributeBuilder");var dr=Dr;function ux(e){return new dr(e.name,e.label)}chunkDPD6ZWL2_js.a(ux,"formula");var Or=class Or extends L{constructor(t,n){super("rollup",t,n),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,n=this.attr.targetAttributeType;if(t==="original"&&n!==void 0&&n!=="select"&&n!=="status"&&n!=="multiselect"){let r=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("${n}") was given. To surface a plain ${n} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${r}.${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(Or,"RollupAttributeBuilder");var pr=Or;function lx(e){return new pr(e.name,e.label)}chunkDPD6ZWL2_js.a(lx,"rollup");var kr=class kr extends L{constructor(t,n){super("document",t,n);}accepts(t){return this.attr.accepts=t,this}maxFileSize(t){return this.attr.maxFileSize=t,this}qualifyWith(...t){return this.attr.properties=Qt(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(kr,"DocumentAttributeBuilder");var mr=kr;function na(e){return new mr(e.name,e.label)}chunkDPD6ZWL2_js.a(na,"document");function ia(e,t,n){let r=Array.isArray(e)?e:[e],[o,...a]=r;return {type:"slot",slotId:o,additionalSlotIds:a.length>0?a:void 0,attribute:t,label:n?.label,required:n?.required,tooltip:n?.tooltip}}chunkDPD6ZWL2_js.a(ia,"buildSlotFieldRef");var Mr=class Mr{constructor(t,n,r){this._finalized=false;this.stepBuilder=t,this.rowData={id:n,order:r,type:"fields",fields:[]};}field(t,n,r){return this.rowData.fields.push(ia(t,n,r)),this}freeField(t,n){let o={type:"free",attribute:t.build(),label:n?.label,required:n?.required,prefillExpression:n?.prefillExpression};return this.rowData.fields.push(o),this}row(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).row(t)}heading(t,n){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).heading(t,n)}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(Mr,"FormRowBuilder");var jr=Mr,Fr=class Fr{constructor(t,n,r){this.rowOrder=0;this.formBuilder=t,this.stepData={id:n,label:r,rows:[]};}description(t){return this.stepData.description=t,this}field(t,n,r){this.rowOrder++;let o=`row-${this.stepData.id}-${this.rowOrder}`,a=ia(t,n,r),s={id:o,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}freeField(t,n){this.rowOrder++;let r=`row-${this.stepData.id}-${this.rowOrder}`,a={type:"free",attribute:t.build(),label:n?.label,required:n?.required,prefillExpression:n?.prefillExpression},s={id:r,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}row(t){return this.rowOrder++,new jr(this,t,this.rowOrder)}heading(t,n){this.rowOrder++;let r={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"heading",content:t,level:n};return this.stepData.rows.push(r),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 n={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"text",content:t};return this.stepData.rows.push(n),this}step(t,n){return this.formBuilder._finalizeStep(this.stepData).step(t,n)}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(Fr,"FormStepBuilder");var _r=Fr,Vr=class Vr{constructor(t,n){this.data={slots:[],steps:[],status:"draft",version:1};this.validateName(t),this.data.name=t,this.data.label=n;}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,n,r){if(this.data.slots.some(a=>a.id===t))throw new Error(`[FormBuilder] Duplicate slot id: "${t}"`);let o={id:t,objectName:n,label:r.label,mode:r.mode??"create",color:r.color,icon:r.icon};return this.data.slots.push(o),this}step(t,n){if(this.data.steps.some(r=>r.id===t))throw new Error(`[FormBuilder] Duplicate step id: "${t}"`);return new _r(this,t,n)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.data}_finalizeStep(t){return this.data.steps.push(t),this}validateName(t){let n=Kn.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{n.parse(t);}catch(r){throw r instanceof Kn.z.ZodError?new Error(`[FormBuilder] ${r.issues[0].message}`):r}}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(n=>[n.id,n.objectName]));for(let n of this.data.steps)for(let r of n.rows)if(Jt(r))for(let o of r.fields){if(o.type!=="slot")continue;let a=Po(o);for(let c of a)if(!t.has(c))throw new Error(`[FormBuilder] Step "${n.id}" references unknown slot "${c}". Declare it with .slot("${c}", ...) first.`);let s=new Set(a.map(c=>t.get(c)));if(s.size>1)throw new Error(`[FormBuilder] Step "${n.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=[...Zt,"join"];for(let n of this.data.steps)for(let r of n.rows)if(Jt(r))for(let o of r.fields){if(!$n(o)||!o.prefillExpression)continue;let a=o.prefillExpression,s=`prefillExpression on free field "${o.attribute.name}" in step "${n.id}"`;if(!en(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 c of a.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g)){let u=c[1];if(!t.includes(u))throw new Error(`[FormBuilder] ${s} uses invalid pipe "${u}". Valid pipes: ${t.join(", ")}`)}}}validateFreeFields(){let t=new Set(Ln);for(let n of this.data.steps)for(let r of n.rows)if(Jt(r)){for(let o of r.fields)if($n(o)){let a=o.attribute.type;if(t.has(a))throw new Error(`[FormBuilder] Free field in step "${n.id}" uses forbidden attribute type "${a}". Forbidden types: ${Ln.join(", ")}`)}}}};chunkDPD6ZWL2_js.a(Vr,"FormBuilder");var Pr=Vr;function yx(e,t){return new Pr(e,t)}chunkDPD6ZWL2_js.a(yx,"form");function Vu(e){return {text:"toString",richtext:"toString",number:"toNumber",currency:"toNumber",date:"toDate",checkbox:"toBoolean"}[e]}chunkDPD6ZWL2_js.a(Vu,"resolveBuiltInTransform");var Br=class Br{constructor(t){this.operations=[];this.touchedAttributes=new Set;this.version=t;}assertNotTouched(t,n){if(this.touchedAttributes.has(t))throw new chunkJSKLP4GI_js.h(`[MigrationBuilder] Conflicting operations on attribute "${t}": it was already modified earlier in this migration (attempted: ${n}).`,[])}renameAttribute(t,n){return this.assertNotTouched(t,"rename_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"rename_attribute",from:t,to:n}),this}changeType(t,n,r,o){this.assertNotTouched(t,"change_type"),this.touchedAttributes.add(t);let a=o?.transform?Vu(r):void 0;return this.operations.push({type:"change_type",name:t,from:n,to:r,transform:a}),this}removeAttribute(t){return this.assertNotTouched(t,"remove_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"remove_attribute",name:t}),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,n){return this.assertNotTouched(t,"update_config"),this.touchedAttributes.add(t),this.operations.push({type:"update_config",name:t,from:{},to:n}),this}build(){return {version:this.version,operations:[...this.operations]}}};chunkDPD6ZWL2_js.a(Br,"MigrationBuilder");var sn=Br;function Bu(e){let{name:t,labelExpression:n,embeddingExpression:r}=e;if(!n)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=nt.safeParse(n);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(r!==void 0){let a=nt.safeParse(r);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(Bu,"validateObjectExpressions");var Lr=class Lr{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 rn(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 n=t.map(r=>"build"in r&&typeof r.build=="function"?r.build():r);nn([...this.obj.attributes,...n],r=>r.name,r=>new chunkJSKLP4GI_js.r("attribute",r,`Object "${this.obj.name}": duplicate attribute name "${r}"`)),this.obj.attributes.push(...n);}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 n of t.presets)oa(n.id,n.structure,1);return this.obj.documentLayout=t,this}migration(t,n){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 sn(t);return n(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"}]);Bu({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression});let t=[...this._migrations].sort((r,o)=>r.version-o.version);for(let r=0;r<t.length;r++){let o=r+2;if(t[r].version!==o)throw new Error(`[ObjectBuilder] Migration versions must be sequential starting at 2. Expected version ${o}, got ${t[r].version}.`)}let n=t.length>0?t[t.length-1].version:1;return {...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,schema_version:n,migrations:t,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(t){t!==void 0&&St(t);}};chunkDPD6ZWL2_js.a(Lr,"ObjectBuilder");var Rt=Lr;function Dx(e){if(chunkRPTKXZBV_js.w(e.name))throw new chunkJSKLP4GI_js.s(e.name,"builder");return new Rt(e)}chunkDPD6ZWL2_js.a(Dx,"object");function oa(e,t,n){let r=chunkDPD6ZWL2_js.a((a,s)=>{throw new chunkJSKLP4GI_js.h(a,[{path:["documentLayout","presets",e],message:s}])},"fail");n>5&&r(`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&&r("Folder preset node title is required","Empty folder title"),s.includes("/")&&r("Folder preset node title cannot contain /",`Folder title contains /: "${s}"`),o.has(s)&&r("Folder preset sibling titles must be unique",`Duplicate folder title: "${s}"`),o.add(s),a.children&&a.children.length>0&&oa(e,a.children,n+1);}}chunkDPD6ZWL2_js.a(oa,"validatePresetStructure");function be(e,t){try{return structuredClone(e)}catch{let n="Builder configuration must contain cloneable data";throw new chunkJSKLP4GI_js.h(n,[{path:t,message:n}])}}chunkDPD6ZWL2_js.a(be,"cloneBuilderValue");function Ie(e,t){if(typeof e!="string"||e.trim().length===0)throw new chunkJSKLP4GI_js.h("Name must not be blank",[{path:t,message:"Name must not be blank"}])}chunkDPD6ZWL2_js.a(Ie,"requireBuilderName");function at(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new chunkJSKLP4GI_js.h("Invalid content configuration",[{path:t,message:"Expected content configuration"}]);for(let c of ["name","label","placement"])if(Object.hasOwn(e,c)){let u=`Independent content configuration cannot define ${c}`;throw new chunkJSKLP4GI_js.h(u,[{path:[...t,c],message:u}])}let n=chunkRPTKXZBV_js.ca.safeParse({...e,name:"content",placement:"main"});if(!n.success)throw chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(c=>({path:[...t,...c.path.map(String)],message:c.message})));n.data.type==="form"&&n.data.groups.forEach((c,u)=>Ie(c.name,[...t,"groups",String(u),"name"]));let{name:r,label:o,placement:a,...s}=n.data;return be(s,t)}chunkDPD6ZWL2_js.a(at,"validateContentConfiguration");function $r(e,t){return at(e,t),be(e,t)}chunkDPD6ZWL2_js.a($r,"validateLiteralContent");function Ue(e){return e.relation===void 0?{kind:"object",object:e.object}:e.object===void 0?{kind:"related",relation:e.relation}:{kind:"relatedFrom",object:e.object,relation:e.relation}}chunkDPD6ZWL2_js.a(Ue,"collectionSourceAddress");function Ur(e){if(!e||typeof e!="object")return;let t="object"in e?e.object:void 0,n="relation"in e?e.relation:void 0;if(typeof t=="string"&&typeof n=="string")return {kind:"relatedFrom",object:t,relation:n};if(typeof t=="string"&&n===void 0)return {kind:"object",object:t};if(typeof n=="string"&&t===void 0)return {kind:"related",relation:n}}chunkDPD6ZWL2_js.a(Ur,"collectionSourceAddressOf");function Ct(e,t,n){if(t!=="record"){let r=`Content "${e}" requires record context. In a collection view only a collection that lists a whole object, or a custom content that does not require a record, is allowed.`;throw new chunkJSKLP4GI_js.h(r,[{path:n,message:r}])}}chunkDPD6ZWL2_js.a(Ct,"requireRecordContentContext");function Lu(e){let t=e.openMode??"page";return {openMode:t,createMode:e.createMode??t}}chunkDPD6ZWL2_js.a(Lu,"resolveContentNavigation");function $u(e,t){return [...new Set(t)].filter(n=>e.actions===void 0||e.actions.includes(n))}chunkDPD6ZWL2_js.a($u,"resolveCollectionActions");var Oe=class Oe{constructor(t,n=[]){this.kind="view";this.data=be(t,["views","0"]),this.extensions=n.map(r=>r&&{...r});}for(t){return new Oe({...this.data,object:t},this.extensions)}default(){return new Oe({...this.data,default:true},this.extensions)}description(t){return new Oe({...this.data,description:t},this.extensions)}icon(t){return new Oe({...this.data,icon:t},this.extensions)}place(t,n,r,o){let a=["views","0","contents",String(this.data.contents.length)],s,c;try{r!==null&&typeof r=="object"&&"build"in r&&typeof r.build=="function"?(s=at(r.build(),a),c=r.extension):s=at(r,a);}catch(f){throw f instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(f.message,f.errors.map(l=>({...l,path:l.path[0]==="content"?[...a,...l.path.slice(1)]:l.path}))):f}let u={...s,name:t,label:n,placement:o},d=[...this.data.contents,u];return new Oe({...this.data,contents:d},[...this.extensions,c])}tab(t,n,r){return this.place(t,n,r,"main")}aside(t,n,r){return this.place(t,n,r,"aside")}build(){let t=["views","0"];Ie(this.data.name,[...t,"name"]),Ie(this.data.object,[...t,"object"]);let n=chunkRPTKXZBV_js.ea.safeParse(this.data);if(!n.success)throw chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(r=>({path:[...t,...r.path.map(String)],message:r.message})));return this.data.contents.forEach((r,o)=>{let a=[...t,"contents",String(o)];Ie(r.name,[...a,"name"]),r.type==="form"&&r.groups.forEach((c,u)=>Ie(c.name,[...a,"groups",String(u),"name"])),(r.type==="custom"?this.extensions[o]?.requiresRecord:r.type==="collection"?Ue(r.source).kind!=="object":true)&&Ct(r.name,this.data.context,a);}),{kind:"view",definition:be(this.data,t)}}};chunkDPD6ZWL2_js.a(Oe,"ViewBuilder");var cn=Oe;function ge(e,t){return new cn({name:e,label:t,object:void 0,context:"record",contents:[]})}chunkDPD6ZWL2_js.a(ge,"detailView");function ye(e,t){return new cn({name:e,label:t,object:void 0,context:"collection",contents:[]})}chunkDPD6ZWL2_js.a(ye,"listView");function Qx(e){return Ie(e,["relationProperty"]),{relationProperty:e}}chunkDPD6ZWL2_js.a(Qx,"relationProperty");var vt=class vt{constructor(t,n){this.data=be(t,["content"]),this.extension=n===void 0?void 0:Object.freeze({name:n.name,requiresRecord:n.requiresRecord,parameters:n.parameters});}set(t){return new vt({...this.data,...t},this.extension)}icon(t){return this.set({icon:t})}object(t){return this.data.type==="forms"?this.set({objectName:t}):this.set({source:{object:t}})}related(t){return this.set({source:{relation:t}})}relatedFrom(t,n){return this.set({source:{object:t,relation:n}})}layout(t){let{layout:n,groupByAttribute:r,columnSizing:o,kanbanColumnOrder:a,kanbanColumnVisibility:s,kanbanPinnedColumns:c,...u}={...this.data,layout:void 0,groupByAttribute:void 0,columnSizing:void 0,kanbanColumnOrder:void 0,kanbanColumnVisibility:void 0,kanbanPinnedColumns:void 0};return new vt({...u,...t},this.extension)}table(){return this.layout({layout:"table"})}list(){return this.layout({layout:"list"})}kanban(t){return this.layout({layout:"kanban",groupByAttribute:t})}columns(...t){return this.set({columns:t})}filter(t){return this.set({filters:t})}sort(t,n="asc"){let o=[..."sorts"in this.data&&Array.isArray(this.data.sorts)?this.data.sorts:[],{attribute:t,direction:n}];return this.set({sorts:o})}actions(...t){return this.set({actions:t})}openMode(t){return this.set({openMode:t})}createMode(t){return this.set({createMode:t})}visibility(t){return this.set({visibility:t})}descriptionAttribute(t){return this.set({descriptionAttribute:t})}displayAttributes(...t){return this.set({displayAttributes:t})}columnSizing(t){return this.set({columnSizing:t})}kanbanColumnOrder(...t){return this.set({kanbanColumnOrder:t})}kanbanColumnVisibility(t){return this.set({kanbanColumnVisibility:t})}kanbanPinnedColumns(...t){return this.set({kanbanPinnedColumns:t})}formColumns(t){return this.set({formColumns:t})}density(t){return this.set({density:t})}titleAttribute(t){return this.set({titleAttribute:t})}allowUpload(t){return this.set({allowUpload:t})}allowRemove(t){return this.set({allowRemove:t})}hideAttachments(t){return this.set({hideAttachments:t})}relations(...t){return this.set({relations:t})}build(){let t=$r(this.data,["content"]);if(this.extension&&t.type==="custom"){let n=this.extension.parameters.safeParse(be(t.parameters??{},["content","parameters"]));if(!n.success)throw chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(r=>({path:["content","parameters",...r.path.map(String)],message:r.message})))}return t}};chunkDPD6ZWL2_js.a(vt,"ContentBuilder");var ce=vt,qe=class qe{constructor(t,n,r,o={}){this.data=be({name:t,label:n,fields:r,...o},["group"]);}field(t,n){let{name:r,label:o,fields:a,...s}=this.data;return new qe(r,o,[...a,{attribute:t,...n}],s)}fields(...t){let{name:n,label:r,fields:o,...a}=this.data;return new qe(n,r,[...o,...t.map(s=>({attribute:s}))],a)}description(t){return new qe(this.data.name,this.data.label,this.data.fields,{...this.presentation(),description:t})}collapsible(t=false){return new qe(this.data.name,this.data.label,this.data.fields,{...this.presentation(),collapsible:true,collapsed:t})}presentation(){let{name:t,label:n,fields:r,...o}=this.data;return o}build(){Ie(this.data.name,["group","name"]);try{$r({type:"form",groups:[this.data]},["group"]);}catch(t){throw t instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(t.message,t.errors.map(n=>({...n,path:n.path[1]==="groups"?["group",...n.path.slice(3)]:n.path}))):t}return be(this.data,["group"])}};chunkDPD6ZWL2_js.a(qe,"GroupBuilder");var qr=qe;function he(e,t){return new qr(e,t,[])}chunkDPD6ZWL2_js.a(he,"group");function Uu(){return new ce({type:"collection"})}chunkDPD6ZWL2_js.a(Uu,"collection");function qu(...e){let t=e.map(n=>"build"in n?n.build():n);return new ce({type:"form",groups:t})}chunkDPD6ZWL2_js.a(qu,"form");function zu(){return new ce({type:"activity"})}chunkDPD6ZWL2_js.a(zu,"activity");function Wu(e){return new ce({type:"richtext",attribute:e})}chunkDPD6ZWL2_js.a(Wu,"richtext");function Gu(){return new ce({type:"documents"})}chunkDPD6ZWL2_js.a(Gu,"documents");function Ku(){return new ce({type:"forms"})}chunkDPD6ZWL2_js.a(Ku,"forms");function Yu(...e){return new ce({type:"emails",emailAttributes:e})}chunkDPD6ZWL2_js.a(Yu,"emails");function Hu(...e){return new ce({type:"meetings",emailAttributes:e})}chunkDPD6ZWL2_js.a(Hu,"meetings");function Ju(e,t){if(typeof e!="object"||e===null||typeof e.name!="string")throw new chunkJSKLP4GI_js.h("Expected registered extension declaration",[{path:["content","extension"],message:"Expected registered extension declaration"}]);let n=at({type:"custom",extension:e.name,parameters:t},["content"]);if(n.type!=="custom")throw new chunkJSKLP4GI_js.h("Expected custom content",[]);let r=new ce({...n,extension:e.name},e);return r.build(),r}chunkDPD6ZWL2_js.a(Ju,"custom");var N={collection:Uu,form:qu,activity:zu,richtext:Wu,documents:Gu,forms:Ku,emails:Yu,meetings:Hu,custom:Ju};function Qu(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(Qu,"validateFlagName");var Yr=class Yr{constructor(t,n,r){Qu(t),this.flag={name:t,valueType:n,defaultValue:r,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(Yr,"BaseFlagBuilder");var st=Yr,Hr=class Hr extends st{constructor(t){super(t,"boolean",false);}defaultValue(t){return this.flag.defaultValue=t,this}enabledByDefault(){return this.flag.defaultValue=true,this}};chunkDPD6ZWL2_js.a(Hr,"BooleanFlagBuilder");var zr=Hr,Jr=class Jr extends st{constructor(t){super(t,"string","");}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Jr,"StringFlagBuilder");var Wr=Jr,Qr=class Qr extends st{constructor(t){super(t,"number",0);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Qr,"NumberFlagBuilder");var Gr=Qr,Xr=class Xr extends st{constructor(t,n){super(t,"json",n);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(Xr,"JsonFlagBuilder");var Kr=Xr;function Xu(e){return new zr(e)}chunkDPD6ZWL2_js.a(Xu,"booleanFlag");function Zu(e){return new Wr(e)}chunkDPD6ZWL2_js.a(Zu,"stringFlag");function el(e){return new Gr(e)}chunkDPD6ZWL2_js.a(el,"numberFlag");function tl(e,t){return new Kr(e,t)}chunkDPD6ZWL2_js.a(tl,"jsonFlag");function Zr(e){return new chunkJSKLP4GI_js.r("feature flag",e,`Flag "${e}" is already registered. Each flag name must be unique.`)}chunkDPD6ZWL2_js.a(Zr,"duplicateFlagError");function ei(e){return {...e,allowedLevels:[...e.allowedLevels]}}chunkDPD6ZWL2_js.a(ei,"cloneFlagDefinition");var ti=class ti{constructor(){this.flags=new Map;}register(t){if(this.flags.has(t.name))throw Zr(t.name);this.flags.set(t.name,ei(t));}registerAll(t){let n=new Set;for(let r of t){if(this.flags.has(r.name)||n.has(r.name))throw Zr(r.name);n.add(r.name);}for(let r of t)this.register(r);}get(t){let n=this.flags.get(t);return n?ei(n):void 0}getOrThrow(t){let n=this.get(t);if(!n)throw new chunkJSKLP4GI_js.c("Feature flag",t,void 0,`Flag "${t}" is not registered. Available flags: ${this.listNames().join(", ")}`);return n}has(t){return this.flags.has(t)}list(){return Array.from(this.flags.values(),ei)}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(ti,"FlagRegistry");var Et=ti,nl=new Et;function rl(){return new Et}chunkDPD6ZWL2_js.a(rl,"createFlagRegistry");function un(){return {global:new Map,tenant:new Map,user:new Map}}chunkDPD6ZWL2_js.a(un,"emptyOverrides");function il(e,t){return e.expiresAt===void 0||e.expiresAt.getTime()>t}chunkDPD6ZWL2_js.a(il,"isActiveOverride");function ni(e,t){let n=new Map;for(let r of e){if(!il(r,t))continue;let o=r.flagName;n.has(o)||n.set(o,r);}return n}chunkDPD6ZWL2_js.a(ni,"indexOverrides");var ri=class ri{constructor(t){this.repository=t.repository,this.registry=t.registry,this.staticDefaults=new Map(t.staticDefaults?.map(n=>[n.name,n.value])??[]);}async resolveAll(t={}){let n=this.collectFlagNames(),r=this.repository&&n.size>0?await this.getAllOverrides(t,[...n]):un();return this.resolveNames(n,r,t)}resolveAllStatic(){return this.resolveNames(this.collectFlagNames(),un(),{})}collectFlagNames(){let t=new Set;for(let n of this.registry.listNames())t.add(n);for(let n of this.staticDefaults.keys())t.add(n);return t}resolveNames(t,n,r){let o=new Map;for(let a of t)o.set(a,this.resolveValue(a,n,r));return o}async resolve(t,n={}){let r=this.repository?await this.getAllOverrides(n,[t]):un();return this.resolveWithSource(t,r,n)}async isEnabled(t,n={}){return (await this.resolve(t,n)).value===true}async getValue(t,n={}){return (await this.resolve(t,n)).value}async setOverride(t,n,r,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(n)){let s=`Flag "${t}" does not allow ${n}-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:n,value:r,targetId:o.targetId,expiresAt:o.expiresAt,createdBy:o.createdBy});}async deleteOverride(t,n,r){if(!this.repository)throw new chunkJSKLP4GI_js.b("Cannot delete override: no FeatureFlagsRepository configured.",chunkJSKLP4GI_js.a.CONFIGURATION_REQUIRED);await this.repository.deleteOverride(t,n,r);}async getAllOverrides(t,n){if(!this.repository)return un();let[r,o,a]=await Promise.all([this.repository.getOverrides({level:"global",flagNames:n}),t.tenantId?this.repository.getOverrides({level:"tenant",targetId:t.tenantId,flagNames:n}):Promise.resolve([]),t.userId?this.repository.getOverrides({level:"user",targetId:t.userId,flagNames:n}):Promise.resolve([])]),s=Date.now();return {global:ni(r,s),tenant:ni(o,s),user:ni(a,s)}}resolveValue(t,n,r){return this.resolveWithSource(t,n,r).value}resolveWithSource(t,n,r){let o=this.registry.get(t),a=o?.allowedLevels??["global","tenant","user"];if(r.userId&&a.includes("user")){let s=n.user.get(t);if(s)return {name:t,value:s.value,source:"user",sourceId:r.userId}}if(r.tenantId&&a.includes("tenant")){let s=n.tenant.get(t);if(s)return {name:t,value:s.value,source:"tenant",sourceId:r.tenantId}}if(a.includes("global")){let s=n.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(ri,"FlagService");var ln=ri;function ol(e){return new ln(e)}chunkDPD6ZWL2_js.a(ol,"createFlagService");var aa=Symbol("stndrds.native-object");function oi(e){return Object.defineProperty(e,aa,{value:true,enumerable:false}),e}chunkDPD6ZWL2_js.a(oi,"markNativeDefinition");var si=class si extends Rt{build(){return oi(super.build())}};chunkDPD6ZWL2_js.a(si,"NativeObjectBuilder");var ii=si;function Ae(e){return new ii(e)}chunkDPD6ZWL2_js.a(Ae,"nativeObject");function ai(e){return e[aa]===true}chunkDPD6ZWL2_js.a(ai,"isNativeDefinition");function ci(e){let t=structuredClone(e);return ai(e)?oi(t):t}chunkDPD6ZWL2_js.a(ci,"cloneObjectDefinition");var li=class li{constructor(){this.objects=new Map;}register(t){let r=(Array.isArray(t)?t:[t]).map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o=new Set;for(let a of r){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 r)this.objects.set(a.name,ci(a));return this}validate(t){if(!t.system){let n=`[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(n,[])}if(chunkRPTKXZBV_js.w(t.name)&&!ai(t))throw new chunkJSKLP4GI_js.s(t.name,"registry");if(this.objects.has(t.name)){let n=this.objects.get(t.name),r=`[NativeObjectRegistry] Duplicate object name "${t.name}":
|
|
1
|
+
'use strict';var chunkRTHLB6T6_js=require('./chunk-RTHLB6T6.js'),chunkMXZ3AF5X_js=require('./chunk-MXZ3AF5X.js'),chunk2M4YXNYZ_js=require('./chunk-2M4YXNYZ.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'),zod=require('zod');/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
var ko=["fyi","task","question","handoff","system"],jo=["low","normal","high","urgent"],_o=["public","internal","sensitive"],Po=["unread","read","archived","snoozed"],Mo=["none","pending","processing","completed","dismissed","expired","failed"],Gc="agent.session.waiting_human",Kc="agent.task.assigned",Yc="agent.question.requested",_g=[Gc,Kc,Yc];var Mg=["name","type"],Fg=["required","hidden","archived","deprecated","defaultValue","config","order","unique"],Vg=["label","description","placeholder","icon"];var Jt=["text","richtext","number","checkbox","date","phone","currency","status","location","select","multiselect","user","relation","formula","rollup","document"],ae="*";function $g(e){return e.type!=="relation"||!Array.isArray(e.targets)?[]:e.targets.map(t=>t.object).filter(t=>t!==ae)}chunkDPD6ZWL2_js.a($g,"relationTargetsOf");function Fo(e){return e.targets.length===1&&e.targets[0].object===ae}chunkDPD6ZWL2_js.a(Fo,"isUniversalRelation");function Ug(e){return e.bilateral!==void 0}chunkDPD6ZWL2_js.a(Ug,"isBilateralRelation");function Vo(e){return "many"}chunkDPD6ZWL2_js.a(Vo,"inferInverseCardinality");function qg(e){return chunkMXZ3AF5X_js.n(e)}chunkDPD6ZWL2_js.a(qg,"isAttributeSortable");var Gg=["record","object","attribute","view","user","role","settings","file","agent","schema_source"],Kg=["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 Jg(e){return e.phase==="terminal"}chunkDPD6ZWL2_js.a(Jg,"isTerminalState");function Qg(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(Qg,"sessionStateToLegacyStatus");function Zg(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(Zg,"legacyStatusToSessionState");var Hc=["completed","failed","cancelled","timeout","expired"];function Xg(e){return Hc.includes(e)}chunkDPD6ZWL2_js.a(Xg,"isTerminalSessionStatus");var Jc=["idle","completed","waiting_human","waiting_agents","cancelled","failed","timeout"];function ey(e){return Jc.includes(e)}chunkDPD6ZWL2_js.a(ey,"isClaimableSessionStatus");var Bo=Object.freeze({mutation:"ask",destructive:"ask",outward:"ask"}),ty=["active","completed","abandoned"],Lo=["openai","anthropic","google","spacexai","deepseek","moonshotai","alibaba","mistral","minimax","meta","zai"],$o=["standard","fast"],Uo=["none","minimal","low","medium","high","xhigh"];function ny(e){return e.label?.trim()||e.name}chunkDPD6ZWL2_js.a(ny,"agentDisplayName");var qo=["approval-requested","approval-responded","approval-dispatched"],Qc=["streaming","running","pending",...qo];function ry(e){return Qc.includes(e)}chunkDPD6ZWL2_js.a(ry,"isOpenToolPartState");function iy(e){return qo.includes(e)}chunkDPD6ZWL2_js.a(iy,"isToolApprovalState");var Wn=["CREDITS_EXHAUSTED"];function oy(e){return typeof e=="string"&&Wn.includes(e)}chunkDPD6ZWL2_js.a(oy,"isSystemPartCode");function Zc(e,t){let n=e.createdAt.getTime()-t.createdAt.getTime();return n===0?e.id.localeCompare(t.id):n}chunkDPD6ZWL2_js.a(Zc,"compareAgentSessionMessages");function ay(e){return [...e].sort(Zc)}chunkDPD6ZWL2_js.a(ay,"orderAgentSessionMessages");var sy=["pending","in_progress","completed","blocked"],cy=50,uy=80,ly=500;var fy="session-state",Xc="__stndrdsNativeUiPartIds",eu=1,tu="Native agent UI part IDs metadata is invalid";function Ue(){throw new chunkJSKLP4GI_js.h(tu,[])}chunkDPD6ZWL2_js.a(Ue,"invalidNativePartIds");function zo(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(zo,"isPlainRecord");function nu(e,t){if(e.type==="text"||e.type==="reasoning")return `${e.type}:${t}`;if(e.type==="tool")return `tool:${e.toolCallId}`}chunkDPD6ZWL2_js.a(nu,"nativeAgentUIPartIdMetadataKey");function by(e){let t=e.metadata?.[Xc];zo(t)||Ue(),(Object.keys(t).length!==2||t.schemaVersion!==eu||!zo(t.partIds))&&Ue();let n=new Map;for(let[s,c]of e.parts.entries()){let u=nu(c,s);if(!u||n.has(u)){u&&Ue();continue}n.set(u,c);}let r=Object.entries(t.partIds);r.length!==n.size&&Ue();let o=new Map,a={};for(let[s,c]of r){let u=n.get(s);u&&typeof c=="string"&&c.length>0||Ue();let l=o.get(c);l&&(u.type==="tool"||l!==u.type)&&Ue(),u.type==="tool"&&c!==u.toolCallId&&Ue(),o.set(c,u.type),a[s]=c;}return a}chunkDPD6ZWL2_js.a(by,"parseNativeAgentUIPartIdsMetadata");var hy=16e3,Ay=3200,xy=6400,Ty=16e3,wy=65536,Sy=15e3,Iy=1e4,Ry=5e3,Cy="google/gemini-3.5-transcribe-live",vy={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2};var Ny=["web","presentation","document","spreadsheet","image","code","other"],Dy=["ephemeral","conversation","persistent"],Oy=["source","preview","entrypoint","asset"];var Wo=5;function _y(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(_y,"getErrorMessage");function Vy(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(Vy,"isFormDefinition");var Gn=["relation","multiRelation","formula","rollup","document","richtext","user"];function Go(e){return e.type==="slot"}chunkDPD6ZWL2_js.a(Go,"isFormSlotFieldRef");function Kn(e){return e.type==="free"}chunkDPD6ZWL2_js.a(Kn,"isFormFreeFieldRef");function $y(e){return e.fieldRequired!==void 0?e.fieldRequired:e.slotMode==="create"&&e.attributeRequired===true}chunkDPD6ZWL2_js.a($y,"resolveFieldRequired");function Ko(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}chunkDPD6ZWL2_js.a(Ko,"getSlotFieldTargets");function ru(e){return Go(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}chunkDPD6ZWL2_js.a(ru,"formFieldKey");function iu(e){return Go(e)?e.attribute:e.attribute.name}chunkDPD6ZWL2_js.a(iu,"formFieldFlatKey");function Uy(e,t){return e[ru(t)]??e[iu(t)]}chunkDPD6ZWL2_js.a(Uy,"readFormFieldValue");function Qt(e){return e.type==="fields"}chunkDPD6ZWL2_js.a(Qt,"isFormFieldsRow");function Wy(e){return e.type==="heading"}chunkDPD6ZWL2_js.a(Wy,"isFormHeadingRow");function Gy(e){return e.type==="separator"}chunkDPD6ZWL2_js.a(Gy,"isFormSeparatorRow");function Ky(e){return e.type==="text"}chunkDPD6ZWL2_js.a(Ky,"isFormTextRow");var Yn=class Yn{async autocomplete(){return await Promise.resolve([])}async reverse(){return await Promise.resolve(null)}async geocode(){return await Promise.resolve(null)}};chunkDPD6ZWL2_js.a(Yn,"NoopGeocodingAdapter");var Yo=Yn;var Hn=["read","create","update","delete","manage"];function eh(e){return e.length===0?"none":e.length===1&&e[0]==="read"?"read-only":e.length===Hn.length&&Hn.every(t=>e.includes(t))?"full":"custom"}chunkDPD6ZWL2_js.a(eh,"actionsToAccessLevel");function th(e){switch(e){case "full":return [...Hn];case "read-only":return ["read"];case "none":return []}}chunkDPD6ZWL2_js.a(th,"accessLevelToActions");function Zt(e){let t=e.properties;if(!t)return [];if(Array.isArray(t))return t;let n=t;return Array.isArray(n.definitions)?n.definitions:[]}chunkDPD6ZWL2_js.a(Zt,"resolvePropertyDefinitions");function ih(e){return e.type==="select"||e.type==="status"||e.type==="multiselect"}chunkDPD6ZWL2_js.a(ih,"hasOptions");var ou="Notetaker",sh={systemPrompt:null,meetingRecordingPolicy:"none",meetingBotDisplayName:ou};var uh=["active","suspended"],lh=["architect","manual","auto"];var ph=["square","landscape","portrait"];var Ho=["none","estimated","exact"];function au(e){if(typeof e=="string"&&Ho.includes(e))return e;throw new chunkJSKLP4GI_js.h(`countMode must be one of: ${Ho.join(", ")} (received: ${String(e)})`,[])}chunkDPD6ZWL2_js.a(au,"parseCountMode");function bh(e){return e===void 0?void 0:au(e)}chunkDPD6ZWL2_js.a(bh,"parseOptionalCountMode");var gh=1e4;var Ah=["storage.bytes","members.seats","data.live_records"];function su(e){return e==null?true:typeof e!="object"?false:Object.keys(e).length===0}chunkDPD6ZWL2_js.a(su,"isEmptyObject");function Jo(e){return e!=null&&typeof e=="object"&&Object.keys(e).length>0}chunkDPD6ZWL2_js.a(Jo,"isNotEmpty");function cu(e){return Jo(e)?e:void 0}chunkDPD6ZWL2_js.a(cu,"toUndefinedIfEmpty");function uu(e){if(e<=0)return {value:0,unitIndex:0};let t=1e3,n=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return {value:Number.parseFloat((e/t**n).toFixed(1)),unitIndex:n}}chunkDPD6ZWL2_js.a(uu,"computeByteMagnitude");var lu=["B","KB","MB","GB","TB"];function dA(e){let{value:t,unitIndex:n}=uu(e);return `${t} ${lu[n]}`}chunkDPD6ZWL2_js.a(dA,"formatByteSize");var fA={ATTACHMENTS:"attachments"};function bA(e){return e.type==="document"}chunkDPD6ZWL2_js.a(bA,"isDocumentAttribute");function gA(e,t){if(!t||t.length===0)return true;let n=e.name.toLowerCase();return t.some(r=>r.endsWith("/*")?e.mimeType.startsWith(r.slice(0,-1)):r.startsWith(".")?n.endsWith(r.toLowerCase()):e.mimeType===r)}chunkDPD6ZWL2_js.a(gA,"matchesAccepts");var Qo=Object.freeze(["text","number","checkbox","date","phone","currency","status","select","multiselect","location"]);function Xt(e){let t=[];for(let n of e){let r=n.build();if(!Qo.includes(r.type))throw new Error(`Property type "${r.type}" is not supported in .qualifyWith()`);t.push(r);}return {definitions:t}}chunkDPD6ZWL2_js.a(Xt,"buildPropertySchema");var TA="__";function wA(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(wA,"parseQualifiedAttribute");function SA(e,t){return `${e}__${t}`}chunkDPD6ZWL2_js.a(SA,"buildQualifiedAttribute");function Oe(e){return typeof e=="object"&&e!==null&&typeof e.start=="string"}chunkDPD6ZWL2_js.a(Oe,"isDateRangeValue");function du(e,t){return chunkIBM4ID4Y_js.a(e)?null:Oe(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(du,"normalizeDateValue");function tt(e){return typeof e=="string"&&e!==""?e:Oe(e)&&e.start!==""?e.start:null}chunkDPD6ZWL2_js.a(tt,"dateValueStart");var en="\u2014";function pu(e){return String(e)}chunkDPD6ZWL2_js.a(pu,"formatText");function mu(e){return e?"Yes":"No"}chunkDPD6ZWL2_js.a(mu,"formatCheckbox");function fu(e,t){if(typeof e!="number")return String(e);if(t.renderAs==="rating")return `${e}/${t.max??5}`;let n=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:n,maximumFractionDigits:n}):e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n})}chunkDPD6ZWL2_js.a(fu,"formatNumber");function bu(e,t){if(typeof e!="object"||e===null)return String(e);let n=e;return "value"in n&&"code"in n?`${n.value.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} ${n.code}`:String(e)}chunkDPD6ZWL2_js.a(bu,"formatCurrency");function Jn(e){if(Oe(e)){let t=Jn(e.start);return e.end?`${t} \u2192 ${Jn(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(Jn,"formatDate");function gu(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(gu,"formatPhone");function yu(e,t="full"){if(typeof e!="object"||e===null)return "";let n=e,r=[];switch(t){case "country":n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;case "state":n.state&&r.push(n.state),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;case "city":n.city&&r.push(n.city),n.state&&r.push(n.state),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;case "coordinates":n.latitude!==void 0&&n.longitude!==void 0&&r.push(`${n.latitude}, ${n.longitude}`);break;case "address":n.address&&r.push(n.address),n.city&&r.push(n.city),n.state&&r.push(n.state),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break;default:n.address&&r.push(n.address),n.address2&&r.push(n.address2),n.city&&r.push(n.city),n.state&&r.push(n.state),n.postalCode&&r.push(n.postalCode),n.country&&r.push(constants.getCountryDisplayNameByIso3(n.country));break}return r.join(", ")}chunkDPD6ZWL2_js.a(yu,"formatLocationValue");function hu(e,t){return typeof e!="object"||e===null?String(e):yu(e,t.granularity??"full")||en}chunkDPD6ZWL2_js.a(hu,"formatLocation");function Au(e,t){return typeof e!="string"?String(e):t.options?.find(r=>r.value===e)?.label??String(e)}chunkDPD6ZWL2_js.a(Au,"formatSelect");function xu(e,t){return Array.isArray(e)?t.options?e.map(r=>t.options.find(o=>o.value===r)?.label).filter(Boolean).join(", "):e.join(", "):String(e)}chunkDPD6ZWL2_js.a(xu,"formatMultiselect");function Zo(e,t){if(chunkIBM4ID4Y_js.a(e))return en;switch(t.type){case "text":return pu(e);case "checkbox":return mu(e);case "number":return fu(e,t);case "currency":return bu(e);case "date":return Jn(e);case "phone":return gu(e);case "location":return hu(e,t);case "select":case "status":return Au(e,t);case "multiselect":return xu(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(Zo,"formatAttributeValue");var wu=["UPPER","LOWER","capitalize","trim"],Su=["prefix","suffix","wrap","default"],tn=[...wu,...Su],nt=zod.z.string().min(1,"labelExpression cannot be empty").refine(e=>nn(e),{message:"labelExpression must contain at least one {{ attribute }} interpolation"}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:"labelExpression contains empty {{ }} interpolation"}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,n;for(;(n=t.exec(e))!==null;){let r=n[1];if(!tn.includes(r))return false}return true},{message:`Invalid pipe name. Valid pipes: ${tn.join(", ")}`});function Iu(e){let t=nt.safeParse(e);return t.success?{success:true,attributes:wt(e)}:{success:false,error:t.error.issues[0]?.message??"Invalid labelExpression"}}chunkDPD6ZWL2_js.a(Iu,"validateLabelExpression");function Ru(e,t){let{name:n,args:r}=vu(t);switch(n){case "UPPER":return e.toUpperCase();case "LOWER":return e.toLowerCase();case "capitalize":return e.replace(/(^|\s)\S/g,o=>o.toUpperCase());case "trim":return e.trim();case "prefix":return e?`${r[0]??""}${e}`:"";case "suffix":return e?`${e}${r[0]??""}`:"";case "wrap":return e?`${r[0]??""}${e}${r[1]??""}`:"";case "default":return e||r[0]||"";default:return e}}chunkDPD6ZWL2_js.a(Ru,"applyPipe");function Xo(e,t){let n=e;for(let r of t)n=Ru(n,r);return n}chunkDPD6ZWL2_js.a(Xo,"applyPipes");function Cu(e,t){return t.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},e)}chunkDPD6ZWL2_js.a(Cu,"getValue");var ea="(Untitled)";function vu(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return {name:e,args:[]};let n=t[1],r=t[2];if(!r)return {name:n,args:[]};let o=[],a=/["']([^"']*?)["']/g,s;for(;(s=a.exec(r))!==null;)o.push(s[1]);return {name:n,args:o}}chunkDPD6ZWL2_js.a(vu,"parsePipeExpression");function*ta(e){let t=0;for(;t<e.length;){let n=e.indexOf("{{",t);if(n<0)return;let r=e.indexOf("}",n+2);if(r<0)return;if(e[r+1]!=="}"){t=r+1;continue}t=r+2;let o=e.slice(n+2,r);o.length>0&&(yield {start:n,end:t,expr:o});}}chunkDPD6ZWL2_js.a(ta,"templateBlocks");function Eu(e,t){let n=e.split("||").map(u=>u.trim()),o=n[n.length-1].split("|").map(u=>u.trim());n[n.length-1]=o[0];let a=o.slice(1).filter(Boolean),s=n.filter(Boolean),c="";for(let u of s){let l=na(Cu(t,u));if(l!==""){c=l;break}}return Xo(c,a)}chunkDPD6ZWL2_js.a(Eu,"resolveLabelBlock");function Qn(e,t,n=ea){let r=[],o=0;for(let s of ta(e))r.push(e.slice(o,s.start),Eu(s.expr,t)),o=s.end;return r.push(e.slice(o)),r.join("").trim()||n}chunkDPD6ZWL2_js.a(Qn,"renderLabelExpression");function na(e){if(e==null||typeof e=="function")return "";if(typeof e!="object")return String(e);if(Array.isArray(e))return e.map(na).filter(Boolean).join(",");let t=e.toString;return typeof t=="function"&&t!==Object.prototype.toString?String(e):""}chunkDPD6ZWL2_js.a(na,"toText");function nn(e){let t=0;for(;t<e.length;){let n=e.indexOf("{{",t);if(n<0)return false;let r=e.indexOf("}}",n+2);if(r<0)return false;if(e.slice(n+2,r).trim().length>0)return true;t=r+2;}return false}chunkDPD6ZWL2_js.a(nn,"isLabelExpression");function wt(e){let t=[];for(let n of ta(e)){let r=n.expr.trim();if(!r)continue;let o=r.split("||").map(s=>s.trim()),a=o[o.length-1];o[o.length-1]=a.split("|")[0].trim();for(let s of o){if(!s)continue;let c=s.split(".")[0];c&&!t.includes(c)&&t.push(c);}}return t}chunkDPD6ZWL2_js.a(wt,"extractAttributeNames");var Nu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function ra(e){let t=e.trim().match(Nu);return t?t[1]:null}chunkDPD6ZWL2_js.a(ra,"getSingleAttributeFromExpression");function Du(e,t){let n=ra(e);if(n===null)return null;let r=t.find(o=>o.name===n);return !r||r.type!=="text"||chunkMXZ3AF5X_js.j(r).authoring.readOnly?null:r}chunkDPD6ZWL2_js.a(Du,"getEditableLabelAttribute");var Ou=/\{\{\s*props\./;function ku(e,t,n){if(!Ou.test(e))return e;let r={},o=new Map(n?.map(s=>[s.name,s]));if(t)for(let[s,c]of Object.entries(t)){if(c==null)continue;let u=o.get(s);if(u){let l=Zo(c,u);r[s]=l===en?"":l;}else r[s]=c;}return Qn(e,{props:r},"").replace(/\(\s*\)/g,"").replace(/\[\s*\]/g,"").replace(/\s*[-—|:]\s*$/g,"").replace(/\s{2,}/g," ").trim()}chunkDPD6ZWL2_js.a(ku,"applyRelationProps");function ju(e){if(e?.type==="relation")return e.properties?.definitions}chunkDPD6ZWL2_js.a(ju,"relationPropertyDefs");function _u(e){if(e?.type==="relation"||e?.type==="document")return e.properties?.definitions}chunkDPD6ZWL2_js.a(_u,"qualifiedPropertyDefs");function ia(e){if(chunkIBM4ID4Y_js.a(e))return [];if(typeof e=="string")return [{id:e}];if(Array.isArray(e))return e.flatMap(t=>ia(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(ia,"extractValueRefs");function Pu(e){let t=[e.firstName,e.lastName].map(n=>n?.trim()).filter(Boolean).join(" ");return t!==""?t:e.email?.split("@")[0]??""}chunkDPD6ZWL2_js.a(Pu,"getUserDisplayName");var Mu=/\p{L}|\p{N}/u;function Fu(e,t){let n=e?.trim()??"";if(n==="")return t;let r=n.split(/\s+/),a=(r.length===1?n.split("@")[0].split(/[._-]/):r).map(s=>{let c=s.match(Mu)?.[0];return c===void 0?"":[...c.toUpperCase()][0]??""}).filter(Boolean).slice(0,2).join("");return a===""?t:a}chunkDPD6ZWL2_js.a(Fu,"deriveInitials");var oa="__creatorRootActorId";function Vu(e){let t=e.metadata?.[oa];return typeof t=="string"&&t.length>0?t:e.createdBy}chunkDPD6ZWL2_js.a(Vu,"getRecordCreatorPrincipalId");function rt(e,t){return e?.includes("*")===true||e?.includes(t)===true}chunkDPD6ZWL2_js.a(rt,"includesAction");function Bu(e){return {canRead:rt(e,"read"),canCreate:rt(e,"create"),canUpdate:rt(e,"update"),canDelete:rt(e,"delete"),canManage:rt(e,"manage")}}chunkDPD6ZWL2_js.a(Bu,"buildPermissionFlags");var JA=new Set(["id","name","label","type","required","system","unique","order"]);var te={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"},ZA=[te.PEOPLE,te.WORKSPACE,te.ARCHITECT,te.FEATURE_FLAGS,te.FILES,te.VIEWS,te.FORMS,te.DOCUMENTS,te.AUDIT,te.API_KEYS,te.CONNECTORS,te.ENV_VARS,te.SESSION],XA={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"},Lu={OWNER:"owner",MEMBER:"member",AGENT_DEFAULT:"agent_default",REFLEX_DEFAULT:"reflex_default"},ex={owner:"Owner",member:"Member",agent_default:"Agent Default",reflex_default:"Reflex Default"},tx={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"},Zn=["read","create","update","delete","manage"],$u=["read","create","update","delete"],aa=["read","create","update","delete"],nx={owner:{system:[{target:"*",actions:Zn}],object:[{target:"*",actions:Zn}]},member:{system:[{target:"people",actions:["read"]},{target:"workspace",actions:["read"]},{target:"connectors",actions:$u},{target:"files",actions:aa},{target:"documents",actions:aa}],object:[{target:"*",actions:Zn}]},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 rx(e){return Object.values(Lu).includes(e)}chunkDPD6ZWL2_js.a(rx,"isDefaultRole");var sa={maxConcurrentRuns:3,retryPolicy:{maxRetries:3,backoffMs:1e3,backoffMultiplier:2},timeoutMs:3e5},er=class er{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,n,r){return this.bp.model={provider:t,model:n,...r},this}tools(t){return this.bp.tools=[...t],this}schedule(t){return this.bp.schedule={...t,enabled:t.enabled??true},this}config(t){let n=this.bp.config??sa,r=t.inference===void 0?n.inference:{...n.inference,...t.inference};return this.bp.config={...n,...t,...r===void 0?{}:{inference:r}},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={...Bo,...this.bp.approval,...t},this}visibility(t){return this.bp.visibility=t,this}requiresPermission(t,n){return this.bp.requiredPermission={resource:t,action:n},this}trigger(t,n,r){return this.bp.triggers.push({name:t,eventType:n,...r,enabled:r?.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 chunk2M4YXNYZ_js.l(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??sa,systemPrompt:this.bp.systemPrompt,model:this.bp.model}}};chunkDPD6ZWL2_js.a(er,"AgentBuilder");var Xn=er;function ux(e){return new Xn(e)}chunkDPD6ZWL2_js.a(ux,"agent");var Uu="@stndrds/schema";function rn(e){return {version:1,vendor:Uu,validate:chunkDPD6ZWL2_js.a(t=>{let n=e.safeParse(t);return n.success?{value:n.data}:{issues:n.error.issues.map(r=>({message:r.message,path:r.path}))}},"validate")}}chunkDPD6ZWL2_js.a(rn,"createStandardSchemaProps");function px(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"].version===1}chunkDPD6ZWL2_js.a(px,"isStandardSchema");var hr=class hr{get"~standard"(){let t=chunkIBM4ID4Y_js.c(this.build());return rn(t)}constructor(t,n,r){chunk2M4YXNYZ_js.n(n),chunk2M4YXNYZ_js.o(r),this.attr={name:n,label:r,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 chunk2M4YXNYZ_js.p(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(hr,"BaseAttributeBuilder");var L=hr,Ar=class Ar extends L{constructor(t,n){super("text",t,n);}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(Ar,"TextAttributeBuilder");var tr=Ar;function S(e){return new tr(e.name,e.label)}chunkDPD6ZWL2_js.a(S,"text");var xr=class xr extends L{constructor(t,n){super("richtext",t,n);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(xr,"RichtextAttributeBuilder");var nr=xr;function ke(e){return new nr(e.name,e.label)}chunkDPD6ZWL2_js.a(ke,"richtext");var Tr=class Tr extends L{constructor(t,n){super("number",t,n);}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(Tr,"NumberAttributeBuilder");var rr=Tr;function an(e){return new rr(e.name,e.label)}chunkDPD6ZWL2_js.a(an,"number");var wr=class wr extends L{constructor(t,n){super("checkbox",t,n);}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(wr,"CheckboxAttributeBuilder");var ir=wr;function ca(e){return new ir(e.name,e.label)}chunkDPD6ZWL2_js.a(ca,"checkbox");var Sr=class Sr extends L{constructor(t,n){super("date",t,n);}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(Sr,"DateAttributeBuilder");var or=Sr;function se(e){return new or(e.name,e.label)}chunkDPD6ZWL2_js.a(se,"date");var Ir=class Ir extends L{constructor(t,n){super("phone",t,n);}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(Ir,"PhoneAttributeBuilder");var ar=Ir;function Tx(e){return new ar(e.name,e.label)}chunkDPD6ZWL2_js.a(Tx,"phone");var Rr=class Rr extends L{constructor(t,n){super("currency",t,n);}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(Rr,"CurrencyAttributeBuilder");var sr=Rr;function wx(e){return new sr(e.name,e.label)}chunkDPD6ZWL2_js.a(wx,"currency");var Cr=class Cr extends L{constructor(t,n){super("status",t,n);}options(t){let n=t;return chunk2M4YXNYZ_js.q(this.attr.name??"unknown",n),this.attr.options=n,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let n=[...this.attr.options,t];return chunk2M4YXNYZ_js.q(this.attr.name??"unknown",n),this.attr.options.push(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Cr,"StatusAttributeBuilder");var cr=Cr;function Sx(e){return new cr(e.name,e.label)}chunkDPD6ZWL2_js.a(Sx,"status");var vr=class vr extends L{constructor(t,n){super("select",t,n);}options(t){let n=t;return chunk2M4YXNYZ_js.q(this.attr.name??"unknown",n),this.attr.options=n,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let n=[...this.attr.options,t];return chunk2M4YXNYZ_js.q(this.attr.name??"unknown",n),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(vr,"SelectAttributeBuilder");var ur=vr;function fe(e){return new ur(e.name,e.label)}chunkDPD6ZWL2_js.a(fe,"select");var Er=class Er extends L{constructor(t,n){super("multiselect",t,n);}options(t){let n=t;return chunk2M4YXNYZ_js.q(this.attr.name??"unknown",n),this.attr.options=n,this.asPhantomState()}option(t){this.attr.options||(this.attr.options=[]);let n=[...this.attr.options,t];return chunk2M4YXNYZ_js.q(this.attr.name??"unknown",n),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(Er,"MultiselectAttributeBuilder");var lr=Er;function Ix(e){return new lr(e.name,e.label)}chunkDPD6ZWL2_js.a(Ix,"multiselect");var Nr=class Nr extends L{constructor(t,n){super("location",t,n);}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(Nr,"LocationAttributeBuilder");var dr=Nr;function Rx(e){return new dr(e.name,e.label)}chunkDPD6ZWL2_js.a(Rx,"location");var Dr=class Dr extends L{constructor(t,n){super("user",t,n),this.attr.types=["user","agent"];}types(t){let n=[...new Set(t)];if(n.length===0)throw new Error("[AttributeBuilder] user.types must contain at least one type.");return this.attr.types=n,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(Dr,"UserAttributeBuilder");var pr=Dr;function Cx(e){return new pr(e.name,e.label)}chunkDPD6ZWL2_js.a(Cx,"user");var Or=class Or extends L{to(t,n){let r={object:t,...n};return this.attr.targets?.push(r),this}toAny(){return this.attr.targets=[{object:ae}],this}qualifyWith(...t){let n=this.attr.targets;if(!n||n.length===0)throw new Error('.qualifyWith() must be called AFTER .to(). Example: relation({ name: "companies" }).to("companies").qualifyWith(...)');return this.attr.properties=Xt(t),this}bilateral(t){let n=this.attr.targets;if(!n||n.length===0)throw new Error('.bilateral() must be called AFTER .to(). Example: relation({ name: "company" }).to("companies").bilateral({ ... })');if(n.length>1)throw new Error("Bilateral relations are not supported for polymorphic relations (multiple .to() targets).");if(Fo(this.attr))throw new Error("Bilateral relations are not supported for universal relations (.toAny()).");let r=n[0]?.object;if(!r)throw new chunkJSKLP4GI_js.h("Bilateral relation requires one target object",[{path:["bilateral","object"],message:"Bilateral relation requires one target object"}]);if(t.object&&t.object!==r){let o=`Bilateral inverse object ${t.object} must match relation target ${r}`;throw new chunkJSKLP4GI_js.h(o,[{path:["bilateral","object"],message:o}])}return this.attr.bilateral={...t,object:r},this}};chunkDPD6ZWL2_js.a(Or,"BaseRelationAttributeBuilder");var on=Or,kr=class kr extends on{constructor(t,n){super("relation",t,n),this.attr.cardinality="one",this.attr.targets=[];}many(){let t=new fr(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(kr,"SingleRelationAttributeBuilder");var mr=kr,jr=class jr extends on{constructor(t,n,r){super("relation",t,n),this.attr.cardinality="many",this.attr.targets=r?.targets??[],this.attr.defaultValue=[],r?.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(jr,"MultiRelationAttributeBuilder");var fr=jr;function it(e){return new mr(e.name,e.label)}chunkDPD6ZWL2_js.a(it,"relation");var _r=class _r extends L{constructor(t,n){super("formula",t,n),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(_r,"FormulaAttributeBuilder");var br=_r;function vx(e){return new br(e.name,e.label)}chunkDPD6ZWL2_js.a(vx,"formula");var Pr=class Pr extends L{constructor(t,n){super("rollup",t,n),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,n=this.attr.targetAttributeType;if(t==="original"&&n!==void 0&&n!=="select"&&n!=="status"&&n!=="multiselect"){let r=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("${n}") was given. To surface a plain ${n} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${r}.${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(Pr,"RollupAttributeBuilder");var gr=Pr;function Ex(e){return new gr(e.name,e.label)}chunkDPD6ZWL2_js.a(Ex,"rollup");var Mr=class Mr extends L{constructor(t,n){super("document",t,n);}accepts(t){return this.attr.accepts=t,this}maxFileSize(t){return this.attr.maxFileSize=t,this}qualifyWith(...t){return this.attr.properties=Xt(t),this}required(){return this.setRequired(true),this.asRequiredState()}optional(){return this.setRequired(false),this.asRequiredState()}};chunkDPD6ZWL2_js.a(Mr,"DocumentAttributeBuilder");var yr=Mr;function ua(e){return new yr(e.name,e.label)}chunkDPD6ZWL2_js.a(ua,"document");function da(e,t,n){let r=Array.isArray(e)?e:[e],[o,...a]=r;return {type:"slot",slotId:o,additionalSlotIds:a.length>0?a:void 0,attribute:t,label:n?.label,required:n?.required,tooltip:n?.tooltip}}chunkDPD6ZWL2_js.a(da,"buildSlotFieldRef");var Lr=class Lr{constructor(t,n,r){this._finalized=false;this.stepBuilder=t,this.rowData={id:n,order:r,type:"fields",fields:[]};}field(t,n,r){return this.rowData.fields.push(da(t,n,r)),this}freeField(t,n){let o={type:"free",attribute:t.build(),label:n?.label,required:n?.required,prefillExpression:n?.prefillExpression};return this.rowData.fields.push(o),this}row(t){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).row(t)}heading(t,n){return this._finalized=true,this.stepBuilder._finalizeRow(this.rowData).heading(t,n)}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(Lr,"FormRowBuilder");var Fr=Lr,$r=class $r{constructor(t,n,r){this.rowOrder=0;this.formBuilder=t,this.stepData={id:n,label:r,rows:[]};}description(t){return this.stepData.description=t,this}field(t,n,r){this.rowOrder++;let o=`row-${this.stepData.id}-${this.rowOrder}`,a=da(t,n,r),s={id:o,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}freeField(t,n){this.rowOrder++;let r=`row-${this.stepData.id}-${this.rowOrder}`,a={type:"free",attribute:t.build(),label:n?.label,required:n?.required,prefillExpression:n?.prefillExpression},s={id:r,order:this.rowOrder,type:"fields",fields:[a]};return this.stepData.rows.push(s),this}row(t){return this.rowOrder++,new Fr(this,t,this.rowOrder)}heading(t,n){this.rowOrder++;let r={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"heading",content:t,level:n};return this.stepData.rows.push(r),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 n={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:"text",content:t};return this.stepData.rows.push(n),this}step(t,n){return this.formBuilder._finalizeStep(this.stepData).step(t,n)}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($r,"FormStepBuilder");var Vr=$r,Ur=class Ur{constructor(t,n){this.data={slots:[],steps:[],status:"draft",version:1};this.validateName(t),this.data.name=t,this.data.label=n;}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,n,r){if(this.data.slots.some(a=>a.id===t))throw new Error(`[FormBuilder] Duplicate slot id: "${t}"`);let o={id:t,objectName:n,label:r.label,mode:r.mode??"create",color:r.color,icon:r.icon};return this.data.slots.push(o),this}step(t,n){if(this.data.steps.some(r=>r.id===t))throw new Error(`[FormBuilder] Duplicate step id: "${t}"`);return new Vr(this,t,n)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.data}_finalizeStep(t){return this.data.steps.push(t),this}validateName(t){let n=zod.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{n.parse(t);}catch(r){throw r instanceof zod.z.ZodError?new Error(`[FormBuilder] ${r.issues[0].message}`):r}}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(n=>[n.id,n.objectName]));for(let n of this.data.steps)for(let r of n.rows)if(Qt(r))for(let o of r.fields){if(o.type!=="slot")continue;let a=Ko(o);for(let c of a)if(!t.has(c))throw new Error(`[FormBuilder] Step "${n.id}" references unknown slot "${c}". Declare it with .slot("${c}", ...) first.`);let s=new Set(a.map(c=>t.get(c)));if(s.size>1)throw new Error(`[FormBuilder] Step "${n.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=[...tn,"join"];for(let n of this.data.steps)for(let r of n.rows)if(Qt(r))for(let o of r.fields){if(!Kn(o)||!o.prefillExpression)continue;let a=o.prefillExpression,s=`prefillExpression on free field "${o.attribute.name}" in step "${n.id}"`;if(!nn(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 c of a.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g)){let u=c[1];if(!t.includes(u))throw new Error(`[FormBuilder] ${s} uses invalid pipe "${u}". Valid pipes: ${t.join(", ")}`)}}}validateFreeFields(){let t=new Set(Gn);for(let n of this.data.steps)for(let r of n.rows)if(Qt(r)){for(let o of r.fields)if(Kn(o)){let a=o.attribute.type;if(t.has(a))throw new Error(`[FormBuilder] Free field in step "${n.id}" uses forbidden attribute type "${a}". Forbidden types: ${Gn.join(", ")}`)}}}};chunkDPD6ZWL2_js.a(Ur,"FormBuilder");var Br=Ur;function Px(e,t){return new Br(e,t)}chunkDPD6ZWL2_js.a(Px,"form");function qu(e){return {text:"toString",richtext:"toString",number:"toNumber",currency:"toNumber",date:"toDate",checkbox:"toBoolean"}[e]}chunkDPD6ZWL2_js.a(qu,"resolveBuiltInTransform");var qr=class qr{constructor(t){this.operations=[];this.touchedAttributes=new Set;this.version=t;}assertNotTouched(t,n){if(this.touchedAttributes.has(t))throw new chunkJSKLP4GI_js.h(`[MigrationBuilder] Conflicting operations on attribute "${t}": it was already modified earlier in this migration (attempted: ${n}).`,[])}renameAttribute(t,n){return this.assertNotTouched(t,"rename_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"rename_attribute",from:t,to:n}),this}changeType(t,n,r,o){this.assertNotTouched(t,"change_type"),this.touchedAttributes.add(t);let a=o?.transform?qu(r):void 0;return this.operations.push({type:"change_type",name:t,from:n,to:r,transform:a}),this}removeAttribute(t){return this.assertNotTouched(t,"remove_attribute"),this.touchedAttributes.add(t),this.operations.push({type:"remove_attribute",name:t}),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,n){return this.assertNotTouched(t,"update_config"),this.touchedAttributes.add(t),this.operations.push({type:"update_config",name:t,from:{},to:n}),this}build(){return {version:this.version,operations:[...this.operations]}}};chunkDPD6ZWL2_js.a(qr,"MigrationBuilder");var sn=qr;function zu(e){let{name:t,labelExpression:n,embeddingExpression:r}=e;if(!n)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=nt.safeParse(n);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(r!==void 0){let a=nt.safeParse(r);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(zu,"validateObjectExpressions");var zr=class zr{constructor(t){this._migrations=[];this._sealed=false;this._toleratedAttributes=[];this.validateName(t.name),this.obj={name:t.name,label:t.label,attributes:[],system:true},t.id&&(this.obj.id=t.id);}get"~standard"(){let t=chunkIBM4ID4Y_js.e(this.build());return rn(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 n=t.map(r=>"build"in r&&typeof r.build=="function"?r.build():r);chunk2M4YXNYZ_js.l([...this.obj.attributes,...n],r=>r.name,r=>new chunkJSKLP4GI_js.r("attribute",r,`Object "${this.obj.name}": duplicate attribute name "${r}"`)),this.obj.attributes.push(...n);}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 n of t.presets)pa(n.id,n.structure,1);return this.obj.documentLayout=t,this}migration(t,n){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 sn(t);return n(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"}]);zu({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression});let t=[...this._migrations].sort((r,o)=>r.version-o.version);for(let r=0;r<t.length;r++){let o=r+2;if(t[r].version!==o)throw new Error(`[ObjectBuilder] Migration versions must be sequential starting at 2. Expected version ${o}, got ${t[r].version}.`)}let n=t.length>0?t[t.length-1].version:1;return {...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,schema_version:n,migrations:t,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(t){t!==void 0&&chunk2M4YXNYZ_js.j(t);}};chunkDPD6ZWL2_js.a(zr,"ObjectBuilder");var St=zr;function Yx(e){if(chunk2M4YXNYZ_js.b(e.name))throw new chunkJSKLP4GI_js.s(e.name,"builder");return new St(e)}chunkDPD6ZWL2_js.a(Yx,"object");function pa(e,t,n){let r=chunkDPD6ZWL2_js.a((a,s)=>{throw new chunkJSKLP4GI_js.h(a,[{path:["documentLayout","presets",e],message:s}])},"fail");n>5&&r(`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&&r("Folder preset node title is required","Empty folder title"),s.includes("/")&&r("Folder preset node title cannot contain /",`Folder title contains /: "${s}"`),o.has(s)&&r("Folder preset sibling titles must be unique",`Duplicate folder title: "${s}"`),o.add(s),a.children&&a.children.length>0&&pa(e,a.children,n+1);}}chunkDPD6ZWL2_js.a(pa,"validatePresetStructure");function be(e,t){try{return structuredClone(e)}catch{let n="Builder configuration must contain cloneable data";throw new chunkJSKLP4GI_js.h(n,[{path:t,message:n}])}}chunkDPD6ZWL2_js.a(be,"cloneBuilderValue");function Ce(e,t){if(typeof e!="string"||e.trim().length===0)throw new chunkJSKLP4GI_js.h("Name must not be blank",[{path:t,message:"Name must not be blank"}])}chunkDPD6ZWL2_js.a(Ce,"requireBuilderName");function ot(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new chunkJSKLP4GI_js.h("Invalid content configuration",[{path:t,message:"Expected content configuration"}]);for(let c of ["name","label","placement"])if(Object.hasOwn(e,c)){let u=`Independent content configuration cannot define ${c}`;throw new chunkJSKLP4GI_js.h(u,[{path:[...t,c],message:u}])}let n=chunkMXZ3AF5X_js.W.safeParse({...e,name:"content",placement:"main"});if(!n.success)throw chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(c=>({path:[...t,...c.path.map(String)],message:c.message})));n.data.type==="form"&&n.data.groups.forEach((c,u)=>Ce(c.name,[...t,"groups",String(u),"name"]));let{name:r,label:o,placement:a,...s}=n.data;return be(s,t)}chunkDPD6ZWL2_js.a(ot,"validateContentConfiguration");function Wr(e,t){return ot(e,t),be(e,t)}chunkDPD6ZWL2_js.a(Wr,"validateLiteralContent");function qe(e){return e.relation===void 0?{kind:"object",object:e.object}:e.object===void 0?{kind:"related",relation:e.relation}:{kind:"relatedFrom",object:e.object,relation:e.relation}}chunkDPD6ZWL2_js.a(qe,"collectionSourceAddress");function Gr(e){if(!e||typeof e!="object")return;let t="object"in e?e.object:void 0,n="relation"in e?e.relation:void 0;if(typeof t=="string"&&typeof n=="string")return {kind:"relatedFrom",object:t,relation:n};if(typeof t=="string"&&n===void 0)return {kind:"object",object:t};if(typeof n=="string"&&t===void 0)return {kind:"related",relation:n}}chunkDPD6ZWL2_js.a(Gr,"collectionSourceAddressOf");function It(e,t,n){if(t!=="record"){let r=`Content "${e}" requires record context. In a collection view only a collection that lists a whole object, or a custom content that does not require a record, is allowed.`;throw new chunkJSKLP4GI_js.h(r,[{path:n,message:r}])}}chunkDPD6ZWL2_js.a(It,"requireRecordContentContext");function Wu(e){let t=e.openMode??"page";return {openMode:t,createMode:e.createMode??t}}chunkDPD6ZWL2_js.a(Wu,"resolveContentNavigation");function Gu(e,t){return [...new Set(t)].filter(n=>e.actions===void 0||e.actions.includes(n))}chunkDPD6ZWL2_js.a(Gu,"resolveCollectionActions");var je=class je{constructor(t,n=[]){this.kind="view";this.data=be(t,["views","0"]),this.extensions=n.map(r=>r&&{...r});}for(t){return new je({...this.data,object:t},this.extensions)}default(){return new je({...this.data,default:true},this.extensions)}description(t){return new je({...this.data,description:t},this.extensions)}icon(t){return new je({...this.data,icon:t},this.extensions)}place(t,n,r,o){let a=["views","0","contents",String(this.data.contents.length)],s,c;try{r!==null&&typeof r=="object"&&"build"in r&&typeof r.build=="function"?(s=ot(r.build(),a),c=r.extension):s=ot(r,a);}catch(m){throw m instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(m.message,m.errors.map(d=>({...d,path:d.path[0]==="content"?[...a,...d.path.slice(1)]:d.path}))):m}let u={...s,name:t,label:n,placement:o},l=[...this.data.contents,u];return new je({...this.data,contents:l},[...this.extensions,c])}tab(t,n,r){return this.place(t,n,r,"main")}aside(t,n,r){return this.place(t,n,r,"aside")}build(){let t=["views","0"];Ce(this.data.name,[...t,"name"]),Ce(this.data.object,[...t,"object"]);let n=chunkMXZ3AF5X_js._.safeParse(this.data);if(!n.success)throw chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(r=>({path:[...t,...r.path.map(String)],message:r.message})));return this.data.contents.forEach((r,o)=>{let a=[...t,"contents",String(o)];Ce(r.name,[...a,"name"]),r.type==="form"&&r.groups.forEach((c,u)=>Ce(c.name,[...a,"groups",String(u),"name"])),(r.type==="custom"?this.extensions[o]?.requiresRecord:r.type==="collection"?qe(r.source).kind!=="object":true)&&It(r.name,this.data.context,a);}),{kind:"view",definition:be(this.data,t)}}};chunkDPD6ZWL2_js.a(je,"ViewBuilder");var cn=je;function ge(e,t){return new cn({name:e,label:t,object:void 0,context:"record",contents:[]})}chunkDPD6ZWL2_js.a(ge,"detailView");function ye(e,t){return new cn({name:e,label:t,object:void 0,context:"collection",contents:[]})}chunkDPD6ZWL2_js.a(ye,"listView");function bT(e){return Ce(e,["relationProperty"]),{relationProperty:e}}chunkDPD6ZWL2_js.a(bT,"relationProperty");var Rt=class Rt{constructor(t,n){this.data=be(t,["content"]),this.extension=n===void 0?void 0:Object.freeze({name:n.name,requiresRecord:n.requiresRecord,parameters:n.parameters});}set(t){return new Rt({...this.data,...t},this.extension)}icon(t){return this.set({icon:t})}object(t){return this.data.type==="forms"?this.set({objectName:t}):this.set({source:{object:t}})}related(t){return this.set({source:{relation:t}})}relatedFrom(t,n){return this.set({source:{object:t,relation:n}})}layout(t){let{layout:n,groupByAttribute:r,columnSizing:o,kanbanColumnOrder:a,kanbanColumnVisibility:s,kanbanPinnedColumns:c,...u}={...this.data,layout:void 0,groupByAttribute:void 0,columnSizing:void 0,kanbanColumnOrder:void 0,kanbanColumnVisibility:void 0,kanbanPinnedColumns:void 0};return new Rt({...u,...t},this.extension)}table(){return this.layout({layout:"table"})}list(){return this.layout({layout:"list"})}kanban(t){return this.layout({layout:"kanban",groupByAttribute:t})}columns(...t){return this.set({columns:t})}filter(t){return this.set({filters:t})}sort(t,n="asc"){let o=[..."sorts"in this.data&&Array.isArray(this.data.sorts)?this.data.sorts:[],{attribute:t,direction:n}];return this.set({sorts:o})}actions(...t){return this.set({actions:t})}openMode(t){return this.set({openMode:t})}createMode(t){return this.set({createMode:t})}visibility(t){return this.set({visibility:t})}descriptionAttribute(t){return this.set({descriptionAttribute:t})}displayAttributes(...t){return this.set({displayAttributes:t})}columnSizing(t){return this.set({columnSizing:t})}kanbanColumnOrder(...t){return this.set({kanbanColumnOrder:t})}kanbanColumnVisibility(t){return this.set({kanbanColumnVisibility:t})}kanbanPinnedColumns(...t){return this.set({kanbanPinnedColumns:t})}formColumns(t){return this.set({formColumns:t})}density(t){return this.set({density:t})}titleAttribute(t){return this.set({titleAttribute:t})}allowUpload(t){return this.set({allowUpload:t})}allowRemove(t){return this.set({allowRemove:t})}hideAttachments(t){return this.set({hideAttachments:t})}relations(...t){return this.set({relations:t})}build(){let t=Wr(this.data,["content"]);if(this.extension&&t.type==="custom"){let n=this.extension.parameters.safeParse(be(t.parameters??{},["content","parameters"]));if(!n.success)throw chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(r=>({path:["content","parameters",...r.path.map(String)],message:r.message})))}return t}};chunkDPD6ZWL2_js.a(Rt,"ContentBuilder");var ce=Rt,ze=class ze{constructor(t,n,r,o={}){this.data=be({name:t,label:n,fields:r,...o},["group"]);}field(t,n){let{name:r,label:o,fields:a,...s}=this.data;return new ze(r,o,[...a,{attribute:t,...n}],s)}fields(...t){let{name:n,label:r,fields:o,...a}=this.data;return new ze(n,r,[...o,...t.map(s=>({attribute:s}))],a)}description(t){return new ze(this.data.name,this.data.label,this.data.fields,{...this.presentation(),description:t})}collapsible(t=false){return new ze(this.data.name,this.data.label,this.data.fields,{...this.presentation(),collapsible:true,collapsed:t})}presentation(){let{name:t,label:n,fields:r,...o}=this.data;return o}build(){Ce(this.data.name,["group","name"]);try{Wr({type:"form",groups:[this.data]},["group"]);}catch(t){throw t instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(t.message,t.errors.map(n=>({...n,path:n.path[1]==="groups"?["group",...n.path.slice(3)]:n.path}))):t}return be(this.data,["group"])}};chunkDPD6ZWL2_js.a(ze,"GroupBuilder");var Kr=ze;function he(e,t){return new Kr(e,t,[])}chunkDPD6ZWL2_js.a(he,"group");function Ku(){return new ce({type:"collection"})}chunkDPD6ZWL2_js.a(Ku,"collection");function Yu(...e){let t=e.map(n=>"build"in n?n.build():n);return new ce({type:"form",groups:t})}chunkDPD6ZWL2_js.a(Yu,"form");function Hu(){return new ce({type:"activity"})}chunkDPD6ZWL2_js.a(Hu,"activity");function Ju(e){return new ce({type:"richtext",attribute:e})}chunkDPD6ZWL2_js.a(Ju,"richtext");function Qu(){return new ce({type:"documents"})}chunkDPD6ZWL2_js.a(Qu,"documents");function Zu(){return new ce({type:"forms"})}chunkDPD6ZWL2_js.a(Zu,"forms");function Xu(...e){return new ce({type:"emails",emailAttributes:e})}chunkDPD6ZWL2_js.a(Xu,"emails");function el(...e){return new ce({type:"meetings",emailAttributes:e})}chunkDPD6ZWL2_js.a(el,"meetings");function tl(e,t){if(typeof e!="object"||e===null||typeof e.name!="string")throw new chunkJSKLP4GI_js.h("Expected registered extension declaration",[{path:["content","extension"],message:"Expected registered extension declaration"}]);let n=ot({type:"custom",extension:e.name,parameters:t},["content"]);if(n.type!=="custom")throw new chunkJSKLP4GI_js.h("Expected custom content",[]);let r=new ce({...n,extension:e.name},e);return r.build(),r}chunkDPD6ZWL2_js.a(tl,"custom");var E={collection:Ku,form:Yu,activity:Hu,richtext:Ju,documents:Qu,forms:Zu,emails:Xu,meetings:el,custom:tl};function nl(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(nl,"validateFlagName");var Zr=class Zr{constructor(t,n,r){nl(t),this.flag={name:t,valueType:n,defaultValue:r,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(Zr,"BaseFlagBuilder");var at=Zr,Xr=class Xr extends at{constructor(t){super(t,"boolean",false);}defaultValue(t){return this.flag.defaultValue=t,this}enabledByDefault(){return this.flag.defaultValue=true,this}};chunkDPD6ZWL2_js.a(Xr,"BooleanFlagBuilder");var Yr=Xr,ei=class ei extends at{constructor(t){super(t,"string","");}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(ei,"StringFlagBuilder");var Hr=ei,ti=class ti extends at{constructor(t){super(t,"number",0);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(ti,"NumberFlagBuilder");var Jr=ti,ni=class ni extends at{constructor(t,n){super(t,"json",n);}defaultValue(t){return this.flag.defaultValue=t,this}};chunkDPD6ZWL2_js.a(ni,"JsonFlagBuilder");var Qr=ni;function rl(e){return new Yr(e)}chunkDPD6ZWL2_js.a(rl,"booleanFlag");function il(e){return new Hr(e)}chunkDPD6ZWL2_js.a(il,"stringFlag");function ol(e){return new Jr(e)}chunkDPD6ZWL2_js.a(ol,"numberFlag");function al(e,t){return new Qr(e,t)}chunkDPD6ZWL2_js.a(al,"jsonFlag");function ri(e){return new chunkJSKLP4GI_js.r("feature flag",e,`Flag "${e}" is already registered. Each flag name must be unique.`)}chunkDPD6ZWL2_js.a(ri,"duplicateFlagError");function ii(e){return {...e,allowedLevels:[...e.allowedLevels]}}chunkDPD6ZWL2_js.a(ii,"cloneFlagDefinition");var oi=class oi{constructor(){this.flags=new Map;}register(t){if(this.flags.has(t.name))throw ri(t.name);this.flags.set(t.name,ii(t));}registerAll(t){let n=new Set;for(let r of t){if(this.flags.has(r.name)||n.has(r.name))throw ri(r.name);n.add(r.name);}for(let r of t)this.register(r);}get(t){let n=this.flags.get(t);return n?ii(n):void 0}getOrThrow(t){let n=this.get(t);if(!n)throw new chunkJSKLP4GI_js.c("Feature flag",t,void 0,`Flag "${t}" is not registered. Available flags: ${this.listNames().join(", ")}`);return n}has(t){return this.flags.has(t)}list(){return Array.from(this.flags.values(),ii)}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(oi,"FlagRegistry");var Ct=oi,sl=new Ct;function cl(){return new Ct}chunkDPD6ZWL2_js.a(cl,"createFlagRegistry");function un(){return {global:new Map,tenant:new Map,user:new Map}}chunkDPD6ZWL2_js.a(un,"emptyOverrides");function ul(e,t){return e.expiresAt===void 0||e.expiresAt.getTime()>t}chunkDPD6ZWL2_js.a(ul,"isActiveOverride");function ai(e,t){let n=new Map;for(let r of e){if(!ul(r,t))continue;let o=r.flagName;n.has(o)||n.set(o,r);}return n}chunkDPD6ZWL2_js.a(ai,"indexOverrides");var si=class si{constructor(t){this.repository=t.repository,this.registry=t.registry,this.staticDefaults=new Map(t.staticDefaults?.map(n=>[n.name,n.value])??[]);}async resolveAll(t={}){let n=this.collectFlagNames(),r=this.repository&&n.size>0?await this.getAllOverrides(t,[...n]):un();return this.resolveNames(n,r,t)}resolveAllStatic(){return this.resolveNames(this.collectFlagNames(),un(),{})}collectFlagNames(){let t=new Set;for(let n of this.registry.listNames())t.add(n);for(let n of this.staticDefaults.keys())t.add(n);return t}resolveNames(t,n,r){let o=new Map;for(let a of t)o.set(a,this.resolveValue(a,n,r));return o}async resolve(t,n={}){let r=this.repository?await this.getAllOverrides(n,[t]):un();return this.resolveWithSource(t,r,n)}async isEnabled(t,n={}){return (await this.resolve(t,n)).value===true}async getValue(t,n={}){return (await this.resolve(t,n)).value}async setOverride(t,n,r,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(n)){let s=`Flag "${t}" does not allow ${n}-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:n,value:r,targetId:o.targetId,expiresAt:o.expiresAt,createdBy:o.createdBy});}async deleteOverride(t,n,r){if(!this.repository)throw new chunkJSKLP4GI_js.b("Cannot delete override: no FeatureFlagsRepository configured.",chunkJSKLP4GI_js.a.CONFIGURATION_REQUIRED);await this.repository.deleteOverride(t,n,r);}async getAllOverrides(t,n){if(!this.repository)return un();let[r,o,a]=await Promise.all([this.repository.getOverrides({level:"global",flagNames:n}),t.tenantId?this.repository.getOverrides({level:"tenant",targetId:t.tenantId,flagNames:n}):Promise.resolve([]),t.userId?this.repository.getOverrides({level:"user",targetId:t.userId,flagNames:n}):Promise.resolve([])]),s=Date.now();return {global:ai(r,s),tenant:ai(o,s),user:ai(a,s)}}resolveValue(t,n,r){return this.resolveWithSource(t,n,r).value}resolveWithSource(t,n,r){let o=this.registry.get(t),a=o?.allowedLevels??["global","tenant","user"];if(r.userId&&a.includes("user")){let s=n.user.get(t);if(s)return {name:t,value:s.value,source:"user",sourceId:r.userId}}if(r.tenantId&&a.includes("tenant")){let s=n.tenant.get(t);if(s)return {name:t,value:s.value,source:"tenant",sourceId:r.tenantId}}if(a.includes("global")){let s=n.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(si,"FlagService");var ln=si;function ll(e){return new ln(e)}chunkDPD6ZWL2_js.a(ll,"createFlagService");var ma=Symbol("stndrds.native-object");function ui(e){return Object.defineProperty(e,ma,{value:true,enumerable:false}),e}chunkDPD6ZWL2_js.a(ui,"markNativeDefinition");var di=class di extends St{build(){return ui(super.build())}};chunkDPD6ZWL2_js.a(di,"NativeObjectBuilder");var ci=di;function Ae(e){return new ci(e)}chunkDPD6ZWL2_js.a(Ae,"nativeObject");function li(e){return e[ma]===true}chunkDPD6ZWL2_js.a(li,"isNativeDefinition");function pi(e){let t=structuredClone(e);return li(e)?ui(t):t}chunkDPD6ZWL2_js.a(pi,"cloneObjectDefinition");var fi=class fi{constructor(){this.objects=new Map;}register(t){let r=(Array.isArray(t)?t:[t]).map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o=new Set;for(let a of r){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 r)this.objects.set(a.name,pi(a));return this}validate(t){if(!t.system){let n=`[NativeObjectRegistry] Cannot register object "${t.name}" (id: ${t.id}): missing system flag.
|
|
3
|
+
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(n,[])}if(chunk2M4YXNYZ_js.b(t.name)&&!li(t))throw new chunkJSKLP4GI_js.s(t.name,"registry");if(this.objects.has(t.name)){let n=this.objects.get(t.name),r=`[NativeObjectRegistry] Duplicate object name "${t.name}":
|
|
15
4
|
- Existing: "${n?.label}" (id: ${n?.id})
|
|
16
5
|
- New: "${t.label}" (id: ${t.id})
|
|
17
|
-
Please use unique names for each native object.`;throw new chunkJSKLP4GI_js.r("object",t.name,r)}}getByName(t){let n=this.objects.get(t);return n?
|
|
18
|
-
Available objects: ${this.listNames().join(", ")}`;throw new chunkJSKLP4GI_js.c("Native object",t,chunkJSKLP4GI_js.a.OBJECT_NOT_FOUND,r)}return n}getAll(){return Array.from(this.objects.values(),
|
|
19
|
-
`)}debug(t){let n=this.summary();return t?.(n),n}};chunkDPD6ZWL2_js.a(
|
|
6
|
+
Please use unique names for each native object.`;throw new chunkJSKLP4GI_js.r("object",t.name,r)}}getByName(t){let n=this.objects.get(t);return n?pi(n):void 0}getByNameOrThrow(t){let n=this.getByName(t);if(!n){let r=`[NativeObjectRegistry] Native object "${t}" not found.
|
|
7
|
+
Available objects: ${this.listNames().join(", ")}`;throw new chunkJSKLP4GI_js.c("Native object",t,chunkJSKLP4GI_js.a.OBJECT_NOT_FOUND,r)}return n}getAll(){return Array.from(this.objects.values(),pi)}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(n=>` - ${n.name}: "${n.label}" (${n.attributes.length} attributes)`)].join(`
|
|
8
|
+
`)}debug(t){let n=this.summary();return t?.(n),n}};chunkDPD6ZWL2_js.a(fi,"NativeObjectRegistryClass");var mi=fi,zT=new mi;var fa=new WeakSet;function W(e){return fa.add(e.definition),e}chunkDPD6ZWL2_js.a(W,"markSystemView");function ba(e){return typeof e=="object"&&e!==null&&fa.has(e)}chunkDPD6ZWL2_js.a(ba,"isSystemViewDefinition");var ga=`## Overview
|
|
20
9
|
|
|
21
10
|
Describe in one or two sentences what this skill does and the outcome it produces. The agent reads this page when it uses the skill \u2014 write instructions for the agent, not documentation for people.
|
|
22
11
|
|
|
@@ -47,15 +36,15 @@ Show at least one concrete example of the skill applied well.
|
|
|
47
36
|
|
|
48
37
|
- Never \u2026
|
|
49
38
|
- Do not \u2026
|
|
50
|
-
`,
|
|
39
|
+
`,ml=Ae({name:"skill",label:"Skill"}).sealed().icon("book-open").order(Number.MAX_SAFE_INTEGER).pluralLabel("Skills").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
|
|
51
40
|
{{ description }}
|
|
52
|
-
{{ content }}`).attribute(
|
|
41
|
+
{{ content }}`).attribute(S({name:"name",label:"Name"}).maxLength(constants.SKILL_NAME_MAX_LENGTH).required()).attribute(S({name:"description",label:"Description"}).multiline().maxLength(constants.SKILL_DESCRIPTION_MAX_LENGTH).required().placeholder('What this skill does and when to use it \u2014 e.g. "Drafts replies to customer complaints. Use when asked to answer an unhappy customer."')).attribute(ke({name:"content",label:"Content"}).defaultValue(ga)).build(),fl=W(ge("skill-detail","Skill").for("skill").default().tab("content","Content",E.richtext("content").titleAttribute("name")).tab("files","Files",E.documents()).tab("activity","Activity",E.activity()).aside("details","Details",E.form(he("details","Details").fields("name","description"))).build()),bl=W(ye("skill-list","Skills").for("skill").default().tab("workspace","Skills",E.collection().object("skill").list().icon("list").visibility("workspace").columns("name","description").descriptionAttribute("description").displayAttributes("createdBy","updatedAt").sort("name")).tab("mine","My skills",E.collection().object("skill").list().icon("lock").visibility("private").columns("name","description").descriptionAttribute("description").displayAttributes("createdBy","updatedAt").sort("name")).build());var hl=Ae({name:"memory",label:"Memory"}).sealed().icon("database").order(Number.MAX_SAFE_INTEGER).pluralLabel("Memories").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
|
|
53
42
|
{{ description }}
|
|
54
|
-
{{ content }}`).migration(2,e=>e.changeType("content","text","richtext")).attribute(
|
|
55
|
-
{{ description }}`).attribute(
|
|
56
|
-
{{ description }}`).attribute(
|
|
43
|
+
{{ content }}`).migration(2,e=>e.changeType("content","text","richtext")).attribute(S({name:"name",label:"Name"}).maxLength(constants.MEMORY_NAME_MAX_LENGTH).required()).attribute(S({name:"description",label:"Description"}).multiline().maxLength(constants.MEMORY_DESCRIPTION_MAX_LENGTH).required()).attribute(ke({name:"content",label:"Content"})).attribute(fe({name:"kind",label:"Kind"}).options([{value:"fact",label:"Fact"},{value:"preference",label:"Preference"},{value:"feedback",label:"Feedback"},{value:"reference",label:"Reference"}])).attribute(it({name:"subjects",label:"Subjects"}).toAny().many()).attribute(it({name:"links",label:"Links"}).to("memory").many()).attribute(fe({name:"source",label:"Source"}).options([{value:"explicit",label:"Saved by an agent"},{value:"extracted",label:"Extracted from a session"},{value:"corroborated",label:"Corroborated across users"},{value:"curated",label:"Curated by Dreamer"}])).attribute(se({name:"validFrom",label:"Valid from"}).includeTime()).attribute(se({name:"invalidAt",label:"Invalid at"}).includeTime()).attribute(it({name:"supersededBy",label:"Superseded by"}).to("memory")).attribute(S({name:"provenance",label:"Provenance"}).multiline()).attribute(fe({name:"reviewState",label:"Review state"}).options([{value:"needs_review",label:"Needs review"},{value:"skill_candidate",label:"Skill candidate"}])).attribute(S({name:"reviewReason",label:"Review reason"}).multiline()).attribute(se({name:"curatedAt",label:"Curated at"}).includeTime()).attribute(se({name:"reviewAfter",label:"Review after"}).includeTime()).attribute(S({name:"curationFingerprint",label:"Curation fingerprint"})).build(),ya={combinator:"and",rules:[{attribute:"invalidAt",operator:"is_empty",value:null},{attribute:"reviewState",operator:"is_empty",value:null}]},Al=W(ge("memory-detail","Memory").for("memory").default().tab("content","Content",E.richtext("content").titleAttribute("name")).aside("details","Details",E.form(he("details","Details").fields("description","kind","source","provenance","reviewState","reviewReason","validFrom","invalidAt","supersededBy","curatedAt","reviewAfter","subjects","links"))).build()),xl=W(ye("memory-list","Memories").for("memory").default().tab("workspace","Memories",E.collection().object("memory").list().icon("list").visibility("workspace").columns("name","kind","description","createdAt").descriptionAttribute("description").displayAttributes("kind","subjects","createdAt").filter(ya).sort("name")).tab("mine","My memories",E.collection().object("memory").list().icon("lock").visibility("private").columns("name","kind","description","createdAt").descriptionAttribute("description").displayAttributes("kind","subjects","createdAt").filter(ya).sort("name")).tab("review","To review",E.collection().object("memory").table().icon("question-circle").columns("name","reviewState","reviewReason","updatedAt").filter({combinator:"and",rules:[{attribute:"invalidAt",operator:"is_empty",value:null},{attribute:"reviewState",operator:"is_not_empty",value:null}]}).sort("updatedAt","desc")).tab("history","History",E.collection().object("memory").table().icon("archive").columns("name","kind","invalidAt","supersededBy").filter({combinator:"and",rules:[{attribute:"invalidAt",operator:"is_not_empty",value:null}]}).sort("invalidAt","desc")).build());var st="drives",Tl=Ae({name:st,label:"Drive"}).sealed().icon("folder").hidden().pluralLabel("Drives").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
|
|
44
|
+
{{ description }}`).attribute(S({name:"name",label:"Name"}).required()).attribute(S({name:"description",label:"Description"}).multiline()).build(),wl=W(ge("drive-detail","Drive").for(st).default().tab("documents","Documents",E.documents()).aside("details","Details",E.form(he("details","Details").field("description"))).build()),Sl=W(ye("drive-list","Drives").for(st).default().tab("workspace","Shared",E.collection().object(st).table().icon("users").visibility("workspace").columns("name","description","updatedAt").sort("name")).tab("mine","My drives",E.collection().object(st).table().icon("lock").visibility("private").columns("name","description","updatedAt").sort("name")).build());var ct="artifact",Rl=Ae({name:ct,label:"Artifact"}).sealed().icon("package").pluralLabel("Artifacts").labelExpression("{{ name }}").embeddingExpression(`{{ name }}
|
|
45
|
+
{{ description }}`).attribute(S({name:"name",label:"Name"}).required()).attribute(S({name:"description",label:"Description"}).multiline()).attribute(fe({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(fe({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(an({name:"currentRevision",label:"Current revision"}).integer().min(1)).attribute(se({name:"expiresAt",label:"Expires at"}).includeTime().hidden()).attribute(S({name:"sourceSessionId",label:"Source session"}).hidden()).attribute(S({name:"sourceMessageId",label:"Source message"}).hidden()).attribute(S({name:"initialToolCallId",label:"Initial tool call"}).hidden()).attribute(ua({name:"versions",label:"Versions"}).qualifyWith(an({name:"revision",label:"Revision"}).integer().min(1).required(),S({name:"toolCallId",label:"Tool call"}).hidden(),S({name:"sourceFileId",label:"Source file"}).hidden(),S({name:"previewFileId",label:"Preview file"}).hidden(),S({name:"fileIds",label:"File manifest"}).hidden(),S({name:"entrypoint",label:"Entrypoint"}).hidden(),S({name:"sourceMessageId",label:"Source message"}).hidden(),S({name:"artifactName",label:"Artifact name"}).hidden(),S({name:"artifactDescription",label:"Artifact description"}).hidden(),S({name:"artifactKind",label:"Artifact kind"}).hidden(),S({name:"displayMode",label:"Display mode"}).hidden(),S({name:"displayInteraction",label:"Display interaction"}).hidden(),S({name:"displaySize",label:"Display size"}).hidden(),an({name:"displayAspectRatio",label:"Display aspect ratio"}).hidden())).build(),ha={name:"artifact_preview",requiresRecord:true,parameters:zod.z.object({}).strict()},Cl=W(ge("artifact-detail","Artifact").for(ct).default().tab("preview","Preview",E.custom(ha,{})).tab("versions","Versions",E.documents().allowUpload(false).allowRemove(false).hideAttachments(true)).tab("activity","Activity",E.activity()).aside("details","Details",E.form(he("details","Details").field("description",{readOnly:true}).field("kind",{readOnly:true}).field("retention",{readOnly:true}).field("currentRevision",{readOnly:true}).field("createdBy",{readOnly:true}).field("updatedAt",{readOnly:true}))).build()),vl=W(ye("artifact-list","Artifacts").for(ct).default().tab("mine","My artifacts",E.collection().object(ct).list().icon("lock").visibility("private").actions().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc")).tab("workspace","Workspace",E.collection().object(ct).list().icon("list").visibility("workspace").actions().columns("name","kind","currentRevision","updatedAt").descriptionAttribute("description").displayAttributes("kind","currentRevision","updatedAt").sort("updatedAt","desc")).build());var ut="meeting",C={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"},xa="meeting-list",Ta="calendar-sync",wa="meeting-detail",Aa=[C.title,C.startsAt,C.endsAt,C.status],El=Ae({name:ut,label:"Meeting"}).sealed().hidden().metadata({platformOwned:{editable:[C.linkedRecords],source:Ta}}).icon("calendar").pluralLabel("Meetings").labelExpression("{{ title }}").embeddingExpression(`{{ title }}
|
|
57
46
|
{{ description }}
|
|
58
47
|
{{ participants }}
|
|
59
|
-
{{ summary }}`).attribute(
|
|
48
|
+
{{ summary }}`).attribute(S({name:C.title,label:"Title"}).required()).attribute(ke({name:C.description,label:"Description"})).attribute(ke({name:C.summary,label:"Summary"}).hidden()).attribute(ke({name:C.transcript,label:"Transcript"}).hidden()).attribute(S({name:C.location,label:"Location"})).attribute(se({name:C.startsAt,label:"Starts at"}).includeTime()).attribute(se({name:C.endsAt,label:"Ends at"}).includeTime()).attribute(ca({name:C.isAllDay,label:"All day"})).attribute(fe({name:C.status,label:"Status"}).options([{value:"confirmed",label:"Confirmed"},{value:"tentative",label:"Tentative"},{value:"cancelled",label:"Cancelled"}])).attribute(S({name:C.organizerAddress,label:"Organizer address"}).email()).attribute(S({name:C.organizerName,label:"Organizer"})).attribute(S({name:C.conferenceProvider,label:"Conference provider"})).attribute(S({name:C.conferenceJoinUrl,label:"Join link"}).url()).attribute(S({name:C.htmlLink,label:"Open in calendar"}).url()).attribute(S({name:C.participants,label:"Participants"}).multiline()).attribute(S({name:C.providerEventId,label:"Provider event id"}).hidden()).attribute(S({name:C.icalUid,label:"iCal UID"}).hidden()).attribute(S({name:C.recurringEventId,label:"Recurring event id"}).hidden()).attribute(S({name:C.connectionId,label:"Connection id"})).attribute(fe({name:C.recordingOverride,label:"Recording"}).options([{value:"force",label:"Force"},{value:"skip",label:"Skip"}]).hidden()).attribute(se({name:C.endedAnnouncedAt,label:"Ended announced at"}).includeTime().hidden()).attribute(it({name:C.linkedRecords,label:"Linked records"}).toAny().many().qualifyWith(S({name:"source",label:"Source"}).hidden())).build(),Nl=W(ge(wa,"Meeting").for(ut).default().tab("description","Description",E.richtext(C.description).titleAttribute(C.title)).tab("summary","Summary",E.richtext(C.summary)).tab("transcript","Transcript",E.richtext(C.transcript)).aside("details","Details",E.form(he("details","Details").fields(C.startsAt,C.endsAt,C.linkedRecords))).build()),Dl=W(ye(xa,"Meetings").for(ut).default().tab("workspace","Shared",E.collection().object(ut).table().icon("users").visibility("workspace").columns(...Aa).sort(C.startsAt,"desc")).tab("mine","My meetings",E.collection().object(ut).table().icon("lock").visibility("private").columns(...Aa).sort(C.startsAt,"desc")).build());function bi(e,t){return JSON.stringify([e,t])}chunkDPD6ZWL2_js.a(bi,"viewIdentityKey");function dn(e){return structuredClone(e)}chunkDPD6ZWL2_js.a(dn,"cloneDeclaration");var yi=class yi{constructor(){this.views=new Map;this.systemNames=new Map;}register(t){let r=(Array.isArray(t)?t:[t]).map((s,c)=>this.prepare(s,c)),o=new Map,a=new Set;for(let{declaration:s}of r){let{object:c,name:u,context:l,default:m}=s.definition,d=o.get(c)??new Set;if((this.views.get(c)?.has(u)||d.has(u))&&this.throwDuplicate(c,u),d.add(u),o.set(c,d),!m)continue;let b=JSON.stringify([c,l]);if(this.getByObjectNameAndContext(c,l).some(y=>y.definition.default)||a.has(b))throw new chunkJSKLP4GI_js.r("default view",b,`[ViewRegistry] Duplicate default view for object "${c}" in context "${l}"`);a.add(b);}for(let s of r)this.commit(s);return this}prepare(t,n){if(typeof t!="object"||t===null||t.kind!=="view"||Object.keys(t).some(o=>o!=="kind"&&o!=="definition")){let o="Expected an exact view declaration";throw new chunkJSKLP4GI_js.h(o,[{path:["views",String(n)],message:o}])}let r=chunkMXZ3AF5X_js._.safeParse(t.definition);if(!r.success)throw chunkJSKLP4GI_js.h.fromZodErrors(r.error.issues.map(o=>({path:["views",String(n),"definition",...o.path.map(String)],message:o.message})));return {declaration:dn(t),system:ba(t.definition)}}commit({declaration:t,system:n}){let{object:r,name:o}=t.definition,a=this.views.get(r)??new Map;if(a.set(o,t),this.views.set(r,a),n){let s=this.systemNames.get(r)??new Set;s.add(o),this.systemNames.set(r,s);}}getByObjectName(t){return Array.from(this.views.get(t)?.values()??[],dn)}getByObjectNameAndContext(t,n){return this.getByObjectName(t).filter(r=>r.definition.context===n)}get(t,n){let r=this.views.get(t)?.get(n);return r&&dn(r)}getOrThrow(t,n){let r=this.get(t,n);if(r)return r;let a=this.getByObjectName(t).map(({definition:s})=>`${s.name} (${s.context})`).join(", ")||"(none)";throw new chunkJSKLP4GI_js.c("View",`${t}:${n}`,void 0,`[ViewRegistry] View "${n}" not found for object "${t}".
|
|
60
49
|
Available views: ${a}`)}getAll(){return Array.from(this.views.values()).flatMap(t=>Array.from(t.values(),dn))}has(t,n){return this.views.get(t)?.has(n)??false}hasObject(t){return this.views.has(t)}get size(){let t=0;for(let n of this.views.values())t+=n.size;return t}listObjectNames(){return Array.from(this.views.keys())}getDefault(t,n){let r=this.getByObjectNameAndContext(t,n);return r.find(o=>o.definition.default)??r[0]}isSystem(t,n){return this.systemNames.get(t)?.has(n)??false}isSystemDeclaration(t){return this.isSystem(t.definition.object,t.definition.name)}clear(){this.views.clear(),this.systemNames.clear();}summary(){let t=[`[ViewRegistry] ${this.size} view(s) registered:`];for(let n of this.listObjectNames()){let r=this.getByObjectName(n).map(({definition:o})=>{let a=o.default?" (default)":"";return `${o.name}:${o.context}${a}`});t.push(` ${n}: ${r.join(", ")}`);}return t.join(`
|
|
61
|
-
`)}debug(t){let n=this.summary();return t?.(n),n}throwDuplicate(t,n){let r=di(t,n);throw new chunkJSKLP4GI_js.r("view",r,`[ViewRegistry] Duplicate view: "${n}" for object "${t}"`)}};chunkDPD6ZWL2_js.a(mi,"ViewRegistry");var pi=mi,Cl=new pi;function ga(e,t){if(t.suppressed)return null;let n=t.workspaceDefinition??t.sourceDefinition;return n===null?null:{...structuredClone(n),name:e}}chunkDPD6ZWL2_js.a(ga,"contentDefinition");function Nt(e){let{name:t,...n}=e;return structuredClone(n)}chunkDPD6ZWL2_js.a(Nt,"storedContentDefinition");function Dt(e){let t={main:0,aside:0};return {origin:"runtime",mainOrderCustomized:false,asideOrderCustomized:false,contents:Object.fromEntries(e.map(n=>[n.name,{sourceDefinition:null,workspaceDefinition:Nt(n),suppressed:false,sourcePosition:null,workspacePosition:t[n.placement]++}]))}}chunkDPD6ZWL2_js.a(Dt,"workspaceViewAuthoring");function fi(e){let t=Object.entries(e.contents).flatMap(([n,r])=>{let o=ga(n,r);return o?[{definition:o,...r}]:[]});return ["main","aside"].flatMap(n=>{let r=n==="main"?e.mainOrderCustomized:e.asideOrderCustomized;return t.filter(o=>o.definition.placement===n).sort((o,a)=>{let s=r?o.workspacePosition:o.sourcePosition,c=r?a.workspacePosition:a.sourcePosition;if(s!==null&&c!==null&&s!==c)return s-c;if(s!==null&&c===null)return -1;if(c!==null&&s===null)return 1;let u=o.sourcePosition??o.workspacePosition,d=a.sourcePosition??a.workspacePosition;return u!==null&&d!==null&&u!==d?u-d:u!==null&&d===null?-1:d!==null&&u===null?1:o.definition.name.localeCompare(a.definition.name)}).map(o=>o.definition)})}chunkDPD6ZWL2_js.a(fi,"resolveViewContents");function ya(e,t){return e.attributes.find(n=>n.name===t&&n.type==="relation")}chunkDPD6ZWL2_js.a(ya,"findRelationAttribute");function bi(e,t){return e.targets.some(n=>n.object===t||n.object===ae)}chunkDPD6ZWL2_js.a(bi,"relationAcceptsObject");function ha(e,t=[e.name,"targets"]){if(e.targets.length!==1||e.targets[0].object==="*"){let n=`Relation "${e.name}" requires one concrete collection target`;throw new chunkJSKLP4GI_js.h(n,[{path:t,message:n}])}return e.targets[0].object}chunkDPD6ZWL2_js.a(ha,"requireSingleRelationTarget");var vl=new Map(chunkRPTKXZBV_js.d().map(e=>[e.name,e]));function ue(e,t){throw new chunkJSKLP4GI_js.h(t,[{path:e,message:t}])}chunkDPD6ZWL2_js.a(ue,"reject");function ke(e,t){e.trim().length===0&&ue(t,"API name must not be empty");}chunkDPD6ZWL2_js.a(ke,"requireName");function Aa(e,t,n){let r=new Map;return e.forEach((o,a)=>{if(ke(o.name,[...n,String(a),"name"]),r.has(o.name))throw new chunkJSKLP4GI_js.r(t,o.name);r.set(o.name,o);}),r}chunkDPD6ZWL2_js.a(Aa,"indexUnique");function re(e,t,n,r,o){if(ke(t,n),!e)return;let a=e.attributes?.get(t)??vl.get(t);if(!a){if(!e.attributes)return;let s=[...e.attributes.keys()].slice(0,30),c=s.length===0?`Object "${e.name}" has no attributes yet.`:`Attributes of "${e.name}": ${s.join(", ")}`;ue(n,`Unknown attribute "${e.name}.${t}". ${c}${o?.()??""}`);}return r&&a.type!==r&&ue(n,`Attribute "${e.name}.${t}" must have type ${r}`),a}chunkDPD6ZWL2_js.a(re,"requireAttribute");function gi(e){let t=e.mode??"published",n=new Map;e.objects.forEach((l,b)=>{if(ke(l.name,["objects",String(b),"name"]),n.has(l.name))throw new chunkJSKLP4GI_js.r("object",l.name);n.set(l.name,{name:l.name,attributes:Aa(l.attributes,"attribute",["objects",String(b),"attributes"])});});let r=new Set;(e.reservedObjects??[]).forEach((l,b)=>{let g=["reservedObjects",String(b)];ke(l,g),!n.has(l)&&(t!=="draft"&&ue(g,`Unresolved reserved object "${l}"`),r.add(l),n.set(l,{name:l}));});let o=Aa(e.extensions??[],"extension",["extensions"]);function a(l,b){ke(l,b);let g=n.get(l);return g||ue(b,`Unknown object "${l}"`),g}chunkDPD6ZWL2_js.a(a,"resolveObject");function s(l){let b=[];for(let[g,y]of n)if(g!==l)for(let h of y.attributes?.values()??[])h.type==="relation"&&bi(h,l)&&b.push(`relatedFrom("${g}", "${h.name}")`);return b.sort().slice(0,3)}chunkDPD6ZWL2_js.a(s,"inverseAddresses");let c=t==="draft"?chunkRPTKXZBV_js.da:chunkRPTKXZBV_js.ea,u=new Map,d=new Map;return {views:e.views.map((l,b)=>{let g=["views",String(b)],y=c.safeParse(l);if(!y.success)throw new chunkJSKLP4GI_js.h("Invalid content view",y.error.issues.map(E=>({path:[...g,...E.path.map(String)],message:E.message,code:E.code})));let h=y.data;ke(h.name,[...g,"name"]);let x=a(h.object,[...g,"object"]),k=u.get(h.object)??new Set;if(k.has(h.name))throw new chunkJSKLP4GI_js.r("view",`${h.object}.${h.name}`);if(k.add(h.name),u.set(h.object,k),h.default){let E=d.get(h.object)??new Set;if(E.has(h.context))throw new chunkJSKLP4GI_js.r("default view",`${h.object}.${h.context}`);E.add(h.context),d.set(h.object,E);}return h.contents.forEach((E,M)=>{let B=[...g,"contents",String(M)];ke(E.name,[...B,"name"]),El(E,B,x,h.context,o,a,s);}),h}),unresolvedObjects:[...r].sort()}}chunkDPD6ZWL2_js.a(gi,"validateContentViewCatalogue");function El(e,t,n,r,o,a,s){function c(){Ct(e.name,r,t);}if(chunkDPD6ZWL2_js.a(c,"requireRecord"),e.type==="custom"){let u=o.get(e.extension);u||ue([...t,"extension"],`Unknown extension "${e.extension}"`),u.requiresRecord&&c();let d=u.parameters.safeParse(structuredClone(e.parameters??{}));if(!d.success)throw new chunkJSKLP4GI_js.h("Invalid extension parameters",d.error.issues.map(f=>({path:[...t,"parameters",...f.path.map(String)],message:f.message,code:f.code})));return}if(e.type==="collection"){let u=Ue(e.source),d,f;if(u.kind==="object")d=a(u.object,[...t,"source","object"]);else if(u.kind==="related"){c();let l=[...t,"source","relation"],b=chunkDPD6ZWL2_js.a(()=>{if(!n)return "";let y=s(n.name);return y.length===0?"":`. Records pointing at "${n.name}" are addressed from the other side: ${y.join(", ")}`},"hint"),g=re(n,u.relation,l,"relation",b);g?.type==="relation"&&(f=g,d=a(ha(g,l),l));}else {c(),d=a(u.object,[...t,"source","object"]);let l=[...t,"source","relation"],b=re(d,u.relation,l,"relation");if(b?.type==="relation"&&n&&!bi(b,n.name)){let g=b.targets.map(y=>`"${y.object}"`).join(", ");ue(l,`Relation "${u.object}.${u.relation}" targets ${g}, not "${n.name}"`);}e.filters?.combinator==="or"&&ue([...t,"filters","combinator"],`Collection "${e.name}" addresses "${u.object}" from the far side, so its filters must use the "and" combinator`);}e.columns?.forEach((l,b)=>{let g=[...t,"columns",String(b)];if(typeof l=="string"){re(d,l,g);return}let y=[...g,"relationProperty"];f||ue(y,"Relation property columns require a relation source"),f.properties?.definitions.some(h=>h.name===l.relationProperty)||ue(y,`Unknown relation property "${l.relationProperty}"`);}),e.displayAttributes?.forEach((l,b)=>re(d,l,[...t,"displayAttributes",String(b)])),e.sorts?.forEach((l,b)=>re(d,l.attribute,[...t,"sorts",String(b),"attribute"])),e.filters?.rules.forEach((l,b)=>re(d,l.attribute,[...t,"filters","rules",String(b),"attribute"])),e.descriptionAttribute!==void 0&&re(d,e.descriptionAttribute,[...t,"descriptionAttribute"]),e.layout==="kanban"&&re(d,e.groupByAttribute,[...t,"groupByAttribute"]);return}switch(c(),e.type){case "form":e.groups.forEach((u,d)=>{let f=[...t,"groups",String(d)];ke(u.name,[...f,"name"]),u.fields.forEach((l,b)=>re(n,l.attribute,[...f,"fields",String(b),"attribute"]));});break;case "richtext":re(n,e.attribute,[...t,"attribute"],"richtext"),e.titleAttribute!==void 0&&re(n,e.titleAttribute,[...t,"titleAttribute"],"text");break;case "emails":case "meetings":e.emailAttributes.forEach((u,d)=>re(n,u,[...t,"emailAttributes",String(d)],"text"));break;case "documents":e.relations?.forEach((u,d)=>re(n,u,[...t,"relations",String(d)],"relation"));break;case "forms":e.objectName!==void 0&&a(e.objectName,[...t,"objectName"]);break;case "activity":break;default:ue(t,`Unknown content type: ${String(e)}`);}}chunkDPD6ZWL2_js.a(El,"validateContent");function yi(e){return structuredClone(e)}chunkDPD6ZWL2_js.a(yi,"cloneFormDefinition");var hi=class hi{constructor(){this.forms=new Map;}register(t){let n=Array.isArray(t)?t:[t];for(let r of n){if(this.forms.has(r.name))throw new chunkJSKLP4GI_js.r("form",r.name,`[FormRegistry] Duplicate form: "${r.name}"`);this.forms.set(r.name,yi(r));}return this}get(t){let n=this.forms.get(t);return n?yi(n):void 0}getAll(){return Array.from(this.forms.values(),yi)}listNames(){return Array.from(this.forms.keys())}};chunkDPD6ZWL2_js.a(hi,"FormRegistry");var Ot=hi;var xa=new Ot;function Bw(e,t){return `${e}:${t}`}chunkDPD6ZWL2_js.a(Bw,"formatAgentStreamFrameId");function Lw(e){let t=e.lastIndexOf(":");if(t<=0)return null;let n=e.slice(0,t),r=Number(e.slice(t+1));return !Number.isInteger(r)||r<=0?null:{streamId:n,sequence:r}}chunkDPD6ZWL2_js.a(Lw,"parseAgentStreamFrameId");var qw=204800,zw=256;function xi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(xi,"isRecord");function Ti(e,t){let n=Object.keys(e);return n.length===t.length&&n.every(r=>t.includes(r))}chunkDPD6ZWL2_js.a(Ti,"hasExactKeys");function Ai(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}chunkDPD6ZWL2_js.a(Ai,"isPositiveInteger");function Ta(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(Ta,"isNonNegativeInteger");function Nl(e){return xi(e)&&Ti(e,["kind","startOffset","endOffset"])?(e.kind==="text"||e.kind==="reasoning")&&Ta(e.startOffset)&&Ta(e.endOffset)&&e.endOffset>=e.startOffset:false}chunkDPD6ZWL2_js.a(Nl,"isContentRange");function Dl(e){if(!xi(e))return false;let t=e.content===void 0?["sequence","chunk"]:["sequence","content","chunk"];return Ti(e,t)&&Ai(e.sequence)&&e.chunk!==void 0&&(e.content===void 0||Nl(e.content))}chunkDPD6ZWL2_js.a(Dl,"isBatchItem");function Ol(e){try{return new TextEncoder().encode(JSON.stringify(e)).byteLength}catch{return}}chunkDPD6ZWL2_js.a(Ol,"encodedSize");function Ww(e){if(!(xi(e)&&Ti(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()===""||!Ai(e.sequenceStart)||!Ai(e.sequenceEnd)||!Array.isArray(e.items)||e.items.length===0||e.items.length>256||!e.items.every(Dl))return false;let t=0;for(let r of e.items){if(r.sequence<=t)return false;t=r.sequence;}if(e.items[0]?.sequence!==e.sequenceStart||e.items.at(-1)?.sequence!==e.sequenceEnd)return false;let n=Ol(e);return n!==void 0&&n<=204800}chunkDPD6ZWL2_js.a(Ww,"isAgentUIMessageBatch");function wa(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(wa,"liveChannelKey");function Yw(e){return e.sessionId?wa({kind:"architect-draft",scope:"session",sessionId:e.sessionId}):e.actorId?wa({kind:"architect-draft",scope:"actor",actorId:e.actorId}):null}chunkDPD6ZWL2_js.a(Yw,"architectDraftChannelKey");function je(e){try{return decodeURIComponent(e)}catch{return null}}chunkDPD6ZWL2_js.a(je,"decodeLiveChannelPart");function Sa(e){let t=e.split(":");if(t[0]==="workspace"&&t.length===2&&t[1]){let n=je(t[1]);return n?{kind:"workspace",tenantId:n}:null}if(t[0]==="object"&&t.length===2&&t[1]){let n=je(t[1]);return n?{kind:"object",objectId:n}:null}if(t[0]==="record"&&t.length===3&&t[1]&&t[2]){let n=je(t[1]),r=je(t[2]);return n&&r?{kind:"record",objectId:n,recordId:r}:null}if(t[0]==="view"&&t.length===2&&t[1]){let n=je(t[1]);return n?{kind:"view",viewId:n}:null}if(t[0]==="user"&&t.length===2&&t[1]){let n=je(t[1]);return n?{kind:"user",actorId:n}:null}if(t[0]==="architect-draft"&&t.length===3&&t[2]){let n=je(t[2]);return n?t[1]==="actor"?{kind:"architect-draft",scope:"actor",actorId:n}:t[1]==="session"?{kind:"architect-draft",scope:"session",sessionId:n}:null:null}if(t[0]==="conversation"&&t.length===2&&t[1]){let n=je(t[1]);return n?{kind:"conversation",sessionId:n}:null}return null}chunkDPD6ZWL2_js.a(Sa,"parseLiveChannelKey");var kl={"record.patch":true,"record.deleted":true,"record.removed":true,"record.created":true,"view.projection.stale":true,"agent.session.patch":true,"notification.created":true,"notification.recipient.patch":true,"notification.count.patch":true,"notification.inbox.archived":true,"reflex.state.changed":true,"reflex.run.completed":true,"reflex.authoring.progress":true,"architect.draft.updated":true,"meeting.recording.patch":true,"wallet.state":true,"channel.revoked":true},jl=Object.keys(kl),_l=["membership-unknown","sort-unknown","permissions-changed"],Pl=["permission-revoked","workspace-left","object-deleted"],Ml=["inboxState","workState","lockedAt","lockedByActorId","readAt","archivedAt","snoozedUntil","completedAt","dismissedAt","updatedAt"],Fl=["type","objectId","recordId","recordVersion"],Vl=["type","objectId","recordId","recordVersion","record"],Bl=["id","objectId","visibility","ownedBy","label","values","metadata","createdAt","updatedAt","createdBy","lastUpdatedBy","schemaVersion"],Ll=["type","targetActorId","archivedCount","version","updatedAt"];function $l(e){return typeof e=="string"&&jl.includes(e)}chunkDPD6ZWL2_js.a($l,"isLiveEventType");function Xw(e){return U(e)&&$l(e.type)?Ul(e.type,e):false}chunkDPD6ZWL2_js.a(Xw,"isLiveEventPayload");function Ul(e,t){if(!U(t))return false;switch(e){case "record.patch":return Hl(t);case "record.deleted":return Jl(t);case "record.removed":return Ql(t);case "record.created":return Zl(t);case "view.projection.stale":return ed(t);case "agent.session.patch":return td(t);case "notification.created":return od(t);case "notification.recipient.patch":return ad(t);case "notification.count.patch":return sd(t);case "notification.inbox.archived":return cd(t);case "reflex.state.changed":return fd(t);case "reflex.run.completed":return bd(t);case "reflex.authoring.progress":return gd(t);case "architect.draft.updated":return pd(t);case "meeting.recording.patch":return hd(t);case "wallet.state":return Td(t);case "channel.revoked":return wd(t);default:return false}}chunkDPD6ZWL2_js.a(Ul,"isLiveEventPayloadForType");function U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(U,"isRecord");function J(e){return typeof e=="string"}chunkDPD6ZWL2_js.a(J,"isString");function kt(e){return J(e)&&e.length>0}chunkDPD6ZWL2_js.a(kt,"isNonEmptyString");function wi(e){return e===null||J(e)}chunkDPD6ZWL2_js.a(wi,"isNullableString");function ql(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(ql,"isVersion");function xe(e){if(!J(e))return false;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e}chunkDPD6ZWL2_js.a(xe,"isIsoDateString");function dt(e){return e===null||xe(e)}chunkDPD6ZWL2_js.a(dt,"isNullableIsoDateString");function O(e,t){return J(e[t])}chunkDPD6ZWL2_js.a(O,"hasString");function le(e,t){return kt(e[t])}chunkDPD6ZWL2_js.a(le,"hasNonEmptyString");function q(e,t){return ql(e[t])}chunkDPD6ZWL2_js.a(q,"hasVersion");function K(e,t){return xe(e[t])}chunkDPD6ZWL2_js.a(K,"hasIsoDateString");function D(e,t,n){return !Object.hasOwn(e,t)||n(e[t])}chunkDPD6ZWL2_js.a(D,"hasOptional");function pn(e,t){return Object.keys(e).every(n=>t.includes(n))}chunkDPD6ZWL2_js.a(pn,"hasOnlyKeys");function Q(e,t){return typeof e=="string"&&t.includes(e)}chunkDPD6ZWL2_js.a(Q,"isOneOf");function zl(e){return Q(e,xo)}chunkDPD6ZWL2_js.a(zl,"isNotificationKind");function Wl(e){return Q(e,To)}chunkDPD6ZWL2_js.a(Wl,"isNotificationPriority");function Gl(e){return Q(e,wo)}chunkDPD6ZWL2_js.a(Gl,"isNotificationSensitivity");function Ia(e){return Q(e,So)}chunkDPD6ZWL2_js.a(Ia,"isNotificationInboxState");function Ra(e){return Q(e,Io)}chunkDPD6ZWL2_js.a(Ra,"isNotificationWorkState");function Kl(e){return U(e)&&O(e,"type")&&O(e,"id")}chunkDPD6ZWL2_js.a(Kl,"isNotificationSubject");function Yl(e){return U(e)&&O(e,"fieldKey")&&Object.hasOwn(e,"value")&&q(e,"version")}chunkDPD6ZWL2_js.a(Yl,"isRecordFieldPatch");function Hl(e){return e.type==="record.patch"&&O(e,"objectId")&&O(e,"recordId")&&q(e,"recordVersion")&&D(e,"label",J)&&D(e,"metadata",U)&&D(e,"fieldsWithheld",t=>t===true)&&Array.isArray(e.fieldPatches)&&e.fieldPatches.every(Yl)&&O(e,"updatedAt")}chunkDPD6ZWL2_js.a(Hl,"isRecordPatchPayload");function Jl(e){return e.type==="record.deleted"&&O(e,"objectId")&&O(e,"recordId")&&q(e,"recordVersion")&&O(e,"deletedAt")}chunkDPD6ZWL2_js.a(Jl,"isRecordDeletedPayload");function Ql(e){return e.type==="record.removed"&&pn(e,Fl)&&O(e,"objectId")&&O(e,"recordId")&&q(e,"recordVersion")}chunkDPD6ZWL2_js.a(Ql,"isRecordRemovedPayload");function Xl(e){return U(e)&&pn(e,Bl)&&O(e,"id")&&O(e,"objectId")&&Q(e.visibility,["workspace","private"])&&wi(e.ownedBy)&&(e.visibility==="workspace"&&e.ownedBy===null||e.visibility==="private"&&kt(e.ownedBy))&&O(e,"label")&&U(e.values)&&D(e,"metadata",U)&&K(e,"createdAt")&&K(e,"updatedAt")&&D(e,"createdBy",J)&&D(e,"lastUpdatedBy",J)&&q(e,"schemaVersion")}chunkDPD6ZWL2_js.a(Xl,"isRecordLiveSnapshot");function Zl(e){return e.type==="record.created"&&pn(e,Vl)&&O(e,"objectId")&&O(e,"recordId")&&q(e,"recordVersion")&&Xl(e.record)&&e.record.id===e.recordId&&e.record.objectId===e.objectId}chunkDPD6ZWL2_js.a(Zl,"isRecordCreatedPayload");function ed(e){return e.type==="view.projection.stale"&&O(e,"viewId")&&Q(e.reason,_l)}chunkDPD6ZWL2_js.a(ed,"isViewProjectionStalePayload");function td(e){return e.type==="agent.session.patch"&&O(e,"sessionId")&&U(e.patch)&&q(e,"version")&&O(e,"updatedAt")}chunkDPD6ZWL2_js.a(td,"isAgentSessionPatchPayload");function nd(e){return U(e)&&O(e,"id")&&O(e,"tenantId")&&D(e,"senderActorId",J)&&D(e,"rootActorId",J)&&D(e,"triggeredByActorId",J)&&zl(e.kind)&&O(e,"type")&&D(e,"subject",Kl)&&O(e,"title")&&D(e,"summary",J)&&U(e.payload)&&Wl(e.priority)&&Gl(e.sensitivity)&&D(e,"threadKey",J)&&D(e,"idempotencyKey",J)&&D(e,"expiresAt",xe)&&K(e,"createdAt")&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(nd,"isLiveNotification");function rd(e){return U(e)&&O(e,"id")&&O(e,"tenantId")&&O(e,"notificationId")&&O(e,"recipientActorId")&&Ia(e.inboxState)&&Ra(e.workState)&&D(e,"lockedAt",xe)&&D(e,"lockedByActorId",J)&&D(e,"readAt",xe)&&D(e,"archivedAt",xe)&&D(e,"snoozedUntil",xe)&&D(e,"completedAt",xe)&&D(e,"dismissedAt",xe)&&K(e,"createdAt")&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(rd,"isLiveNotificationRecipient");function id(e){return U(e)?Object.keys(e).every(t=>Ml.includes(t))&&D(e,"inboxState",Ia)&&D(e,"workState",Ra)&&D(e,"lockedAt",dt)&&D(e,"lockedByActorId",wi)&&D(e,"readAt",dt)&&D(e,"archivedAt",dt)&&D(e,"snoozedUntil",dt)&&D(e,"completedAt",dt)&&D(e,"dismissedAt",dt)&&D(e,"updatedAt",xe):false}chunkDPD6ZWL2_js.a(id,"isNotificationRecipientPatch");function od(e){let t=nd(e.notification)?e.notification:null;return e.type==="notification.created"&&t!==null&&Array.isArray(e.recipients)&&e.recipients.length>0&&e.recipients.every(n=>rd(n)&&n.notificationId===t.id)&&q(e,"version")&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(od,"isNotificationCreatedPayload");function ad(e){return e.type==="notification.recipient.patch"&&O(e,"recipientId")&&O(e,"recipientActorId")&&id(e.patch)&&q(e,"version")&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(ad,"isNotificationRecipientPatchPayload");function sd(e){return e.type==="notification.count.patch"&&O(e,"targetActorId")&&q(e,"unread")&&q(e,"pendingWork")&&q(e,"version")&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(sd,"isNotificationCountPatchPayload");function cd(e){return e.type==="notification.inbox.archived"&&pn(e,Ll)&&le(e,"targetActorId")&&q(e,"archivedCount")&&q(e,"version")&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(cd,"isNotificationInboxArchivedPayload");var ud=["armed","disarmed"],ld=["authoring","compiling","replaying","promoted","failed"],dd=["promoted","lkg"];function pd(e){if(e.type!=="architect.draft.updated"||!U(e.receipt))return false;let t=e.receipt;return Array.isArray(t.operationIds)&&t.operationIds.every(kt)&&U(t.revision)&&le(t.revision,"draftId")&&q(t.revision,"version")&&Array.isArray(t.changedTargets)&&t.changedTargets.every(n=>U(n)&&kt(n.token)&&md(n.target))}chunkDPD6ZWL2_js.a(pd,"isArchitectDraftUpdatedPayload");function md(e){if(!U(e))return false;let t=Object.keys(e);return t.every(n=>kt(e[n]))?le(e,"viewName")?le(e,"objectName")&&t.every(n=>["objectName","viewName","contentName"].includes(n)):le(e,"objectName")?t.length===1:le(e,"objectId")&&t.length<=2&&t.every(n=>["objectId","attributeName","attributeId","recordId"].includes(n)):false}chunkDPD6ZWL2_js.a(md,"isNamedTarget");function fd(e){return e.type==="reflex.state.changed"&&le(e,"reflexId")&&Q(e.state,ud)&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(fd,"isReflexStateChangedPayload");function bd(e){return e.type==="reflex.run.completed"&&le(e,"reflexId")&&le(e,"runId")&&Q(e.served,dd)&&q(e,"version")&&q(e,"wallMs")&&K(e,"completedAt")}chunkDPD6ZWL2_js.a(bd,"isReflexRunCompletedPayload");function gd(e){return e.type==="reflex.authoring.progress"&&le(e,"reflexId")&&Q(e.status,ld)&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(gd,"isReflexAuthoringProgressPayload");var yd=["none","scheduled","recording","completed","failed"];function hd(e){return e.type==="meeting.recording.patch"&&le(e,"meetingId")&&Q(e.status,yd)&&wi(e.failureReason)&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(hd,"isMeetingRecordingPatchPayload");var Ad=["ok","low","exhausted","paused"],xd=["metering-only","contract","wallet"];function Td(e){return e.type==="wallet.state"&&Q(e.status,Ad)&&Q(e.mode,xd)&&K(e,"updatedAt")}chunkDPD6ZWL2_js.a(Td,"isWalletStatePayload");function wd(e){return e.type==="channel.revoked"&&O(e,"channel")&&Q(e.reason,Pl)}chunkDPD6ZWL2_js.a(wd,"isChannelRevokedPayload");function Si(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(Si,"isRecord");function Sd(e){let{channel:t}=e;return typeof t=="string"&&Sa(t)?t:null}chunkDPD6ZWL2_js.a(Sd,"payloadChannel");function nS(e){return Si(e)?Sd(e):null}chunkDPD6ZWL2_js.a(nS,"getLiveProtocolPayloadChannel");function rS(e){return Si(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"&&Si(e.payload):false}chunkDPD6ZWL2_js.a(rS,"isLiveEventEnvelope");var aS=["if","concat","sum","avg","count","min","max","earliest","latest","unique","first","percent_empty","percent_not_empty","count_empty","count_not_empty","count_unique"],jt={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 mn(e){return Object.hasOwn(jt,e)}chunkDPD6ZWL2_js.a(mn,"isComputedFunctionName");var vi=class vi extends Error{constructor(t){super(t),this.name="ComputedFormulaCompileError";}};chunkDPD6ZWL2_js.a(vi,"ComputedFormulaCompileError");var S=vi;function bn(e){let t=Id(e.expression),n=fn(t,e.schema),r=Gd(n.valueType);if(r!==e.returnType)throw new S(`Computed formula "${e.attributeName}" returns "${r}", expected "${e.returnType}"`);if(ka(e.returnType)&&n.optionsSource===void 0)throw new S(`Computed formula "${e.attributeName}" returns "${e.returnType}" without optionsSource`);let o=n.optionsSource===void 0?[]:[{kind:"options",source:n.optionsSource}],a=Ci([...n.dependencies,...o]);return {kind:"formula",attributeName:e.attributeName,expression:e.expression,returnType:e.returnType,valueType:n.valueType,dependencies:a,ast:t,...n.optionsSource?{optionsSource:n.optionsSource}:{},...n.targetAttributeType?{targetAttributeType:n.targetAttributeType}:{},dependenciesHash:Kd({expression:e.expression,returnType:e.returnType,dependencies:a})}}chunkDPD6ZWL2_js.a(bn,"compileComputedFormula");function Oa(e){let t=new Map(e.map(o=>[o.attributeName,o])),n=new Set,r=chunkDPD6ZWL2_js.a((o,a)=>{let s=a.indexOf(o);if(s!==-1){let d=[...a.slice(s),o];throw new S(`Computed field cycle detected: ${d.join(" -> ")}`)}if(n.has(o))return;let c=t.get(o);if(c===void 0)return;let u=[...a,o];for(let d of c.dependencies)d.kind==="computed"&&r(d.attributeName,u);n.add(o);},"visit");for(let o of e)r(o.attributeName,[]);}chunkDPD6ZWL2_js.a(Oa,"assertAcyclicComputedDependencies");function Id(e){try{return chunkHRX4YCKZ_js.e(e)}catch(t){throw t instanceof Error?new S(t.message):t}}chunkDPD6ZWL2_js.a(Id,"parseCompileFormula");function fn(e,t){switch(e.kind){case "literal":return {valueType:Rd(e.value),dependencies:[],...typeof e.value=="string"?{literalString:e.value}:{}};case "path":return Cd(e.parts,t);case "call":return kd(e.functionName,e.args,t);case "binary":return Fd(e.operator,fn(e.left,t),fn(e.right,t));default:return e}}chunkDPD6ZWL2_js.a(fn,"inferNode");function Rd(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(Rd,"literalToValueType");function Cd(e,t){if(e.length===1){let n=e[0],r=Ii(t,n);if(r===void 0)throw new S(`Unknown attribute "${n}" on object "${t.objectName}"`);return r.type==="relation"?{valueType:Nd(),dependencies:[{kind:"relation",relationName:r.name,cardinality:Ca(r)}],targetAttributeType:r.type}:{valueType:va(r),dependencies:[Ed(r)],optionsSource:Ea(t.objectName,r),targetAttributeType:r.type}}if(e.length===2){let[n,r]=e,o=Ii(t,n);if(o===void 0)throw new S(`Unknown attribute "${n}" on object "${t.objectName}"`);if(o.type!=="relation")throw new S(`Attribute "${n}" on object "${t.objectName}" is not a relation`);let a=vd(o);if(a===void 0)throw new S(`Relation "${n}" on object "${t.objectName}" is missing targetObjectName`);let s=t.relatedObjects?.[a];if(s===void 0)throw new S(`Unknown related object "${a}"`);let c=Ii(s,r);if(c===void 0)throw new S(`Unknown attribute "${r}" on object "${s.objectName}"`);let u=va(c);return {valueType:o.cardinality==="many"?Od(u):u,dependencies:[{kind:"relation",relationName:n,targetAttributeName:r,cardinality:Ca(o)}],optionsSource:Ea(s.objectName,c),targetAttributeType:c.type}}throw new S("Computed paths support at most one relation hop")}chunkDPD6ZWL2_js.a(Cd,"inferPath");function Ii(e,t){return e.attributes.find(n=>n.name===t)}chunkDPD6ZWL2_js.a(Ii,"findAttribute");function vd(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(vd,"getRelationTargetObjectName");function Ca(e){return e.cardinality??"one"}chunkDPD6ZWL2_js.a(Ca,"relationCardinality");function Ed(e){return e.type==="formula"||e.type==="rollup"?{kind:"computed",attributeName:e.name}:{kind:"local",attributeName:e.name}}chunkDPD6ZWL2_js.a(Ed,"localDependencyFor");function va(e){if(e.type==="formula"||e.type==="rollup"){if(e.returnType===void 0)throw new S(`Computed attribute "${e.name}" is missing returnType`);return Dd(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(va,"attributeToValueType");function Nd(){return {kind:"collection",itemType:"text"}}chunkDPD6ZWL2_js.a(Nd,"relationToValueType");function Dd(e){return e==="multiselect"?{kind:"collection",itemType:"select"}:{kind:"scalar",type:e}}chunkDPD6ZWL2_js.a(Dd,"returnTypeToValueType");function Od(e){return e.kind==="collection"?e:{kind:"collection",itemType:e.type}}chunkDPD6ZWL2_js.a(Od,"asCollectionValueType");function Ea(e,t){if(t.type==="formula"||t.type==="rollup")return ka(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(Ea,"optionsSourceForAttribute");function kd(e,t,n){if(!mn(e))throw new S(`Unknown computed function "${e}"`);let r=jt[e];if(t.length<r.minArgs||r.maxArgs!==void 0&&t.length>r.maxArgs){let a=r.maxArgs===void 0||r.maxArgs===r.minArgs?String(r.minArgs):`${r.minArgs}-${r.maxArgs}`;throw new S(`Function "${e}" expects ${a} arguments, received ${t.length}`)}let o=t.map(a=>fn(a,n));return jd(e,o)}chunkDPD6ZWL2_js.a(kd,"inferCall");function jd(e,t){let n=Ci(t.flatMap(r=>r.dependencies));switch(e){case "if":return _d(t,n);case "concat":return Vd(t,`Function "${e}" does not accept collection values`),{valueType:{kind:"scalar",type:"text"},dependencies:n};case "sum":case "avg":return Na(e,t[0],"number"),{valueType:{kind:"scalar",type:"number"},dependencies:n};case "count":case "count_empty":case "count_not_empty":case "count_unique":case "percent_empty":case "percent_not_empty":return Ld(e,t[0]),{valueType:{kind:"scalar",type:"number"},dependencies:n};case "min":case "max":return Bd(e,t[0]),{valueType:$d(t[0]),dependencies:n,optionsSource:t[0].optionsSource,targetAttributeType:t[0].targetAttributeType};case "earliest":case "latest":return Na(e,t[0],"date"),{valueType:{kind:"scalar",type:"date"},dependencies:n,targetAttributeType:t[0].targetAttributeType};case "unique":return Pd(t[0],n);case "first":return Md(t[0],n);default:return e}}chunkDPD6ZWL2_js.a(jd,"inferFunctionReturn");function _d(e,t){Ri(e[0].valueType,"boolean",'Function "if" condition must be boolean');let n=e[1],r=e[2],o=qd(n,r),a=zd(n,r);if(o===void 0)throw new S('Function "if" branches must return the same type');return {valueType:o,dependencies:t,...a?{optionsSource:a}:{},targetAttributeType:n.targetAttributeType??r.targetAttributeType}}chunkDPD6ZWL2_js.a(_d,"inferIfFunction");function Pd(e,t){if(e.valueType.kind!=="collection"||e.valueType.itemType!=="select")throw new S('Function "unique" expects a select collection');return {valueType:{kind:"collection",itemType:"select"},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(Pd,"inferUniqueFunction");function Md(e,t){if(e.valueType.kind!=="collection")throw new S('Function "first" expects a collection');return {valueType:{kind:"scalar",type:e.valueType.itemType},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(Md,"inferFirstFunction");function Fd(e,t,n){let r=Ci([...t.dependencies,...n.dependencies]),o=e==="+"||e==="-"||e==="*"||e==="/";if(t.valueType.kind==="collection"||n.valueType.kind==="collection")throw new S(`Cannot use collection values with ${o?"arithmetic":"comparison"} operator "${e}"`);if(o)return e==="+"&&(t.valueType.type==="text"||n.valueType.type==="text")?{valueType:{kind:"scalar",type:"text"},dependencies:r}:(Ri(t.valueType,"number",`Operator "${e}" expects number operands`),Ri(n.valueType,"number",`Operator "${e}" expects number operands`),{valueType:{kind:"scalar",type:"number"},dependencies:r});if(e==="=="||e==="!="){if(t.valueType.type!==n.valueType.type)throw new S(`Operator "${e}" expects operands with the same scalar type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:r}}if((t.valueType.type!=="number"||n.valueType.type!=="number")&&(t.valueType.type!=="date"||n.valueType.type!=="date"))throw new S(`Operator "${e}" expects number or date operands of the same type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:r}}chunkDPD6ZWL2_js.a(Fd,"inferBinary");function Vd(e,t){for(let n of e)if(n.valueType.kind==="collection")throw new S(t)}chunkDPD6ZWL2_js.a(Vd,"ensureNoCollections");function Na(e,t,n){if((t.valueType.kind==="collection"?t.valueType.itemType:t.valueType.type)!==n)throw new S(`Function "${e}" expects ${n} values`)}chunkDPD6ZWL2_js.a(Na,"ensureCollectionOrScalarType");function Bd(e,t){if(t.valueType.kind!=="collection")throw new S(`Function "${e}" expects a collection`);let n=t.valueType.itemType;if(n!=="number"&&n!=="date")throw new S(`Function "${e}" expects number or date values`)}chunkDPD6ZWL2_js.a(Bd,"ensureMinMaxSource");function Ld(e,t){if(t.valueType.kind!=="collection")throw new S(`Function "${e}" expects a collection`)}chunkDPD6ZWL2_js.a(Ld,"ensureCollectionSource");function Ri(e,t,n){if(e.kind!=="scalar"||e.type!==t)throw new S(n)}chunkDPD6ZWL2_js.a(Ri,"ensureScalarType");function $d(e){return e.valueType.kind==="scalar"?e.valueType:{kind:"scalar",type:e.valueType.itemType}}chunkDPD6ZWL2_js.a($d,"sourceItemValueType");function Ud(e,t){return e.kind==="scalar"?t.kind==="scalar"&&e.type===t.type:t.kind==="collection"&&e.itemType===t.itemType}chunkDPD6ZWL2_js.a(Ud,"sameValueType");function qd(e,t){if(Ud(e.valueType,t.valueType)||Da(e,t))return e.valueType;if(Da(t,e))return t.valueType}chunkDPD6ZWL2_js.a(qd,"resolveIfBranchValueType");function Da(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(Da,"isSelectScalarWithStringLiteral");function zd(e,t){let n=e.optionsSource,r=t.optionsSource;if(n!==void 0&&r!==void 0&&!Wd(n,r))throw new S('Function "if" branches use incompatible options sources');return n??r}chunkDPD6ZWL2_js.a(zd,"resolveIfOptionsSource");function Wd(e,t){return e.objectName===t.objectName&&e.attributeName===t.attributeName&&e.attributeId===t.attributeId}chunkDPD6ZWL2_js.a(Wd,"sameOptionsSource");function ka(e){return e==="select"||e==="multiselect"}chunkDPD6ZWL2_js.a(ka,"isSelectLikeReturnType");function Gd(e){if(e.kind==="scalar")return e.type;if(e.itemType==="select")return "multiselect";throw new S(`Collection item type "${e.itemType}" cannot be used as a computed return type`)}chunkDPD6ZWL2_js.a(Gd,"valueTypeToReturnType");function Ci(e){let t=new Set,n=[];for(let r of e){let o=JSON.stringify(_t(r));t.has(o)||(t.add(o),n.push(r));}return n}chunkDPD6ZWL2_js.a(Ci,"uniqueDependencies");function Kd(e){let t=e.dependencies.map(n=>_t(n)).sort((n,r)=>ja(JSON.stringify(n),JSON.stringify(r)));return JSON.stringify(_t({expression:e.expression,returnType:e.returnType,dependencies:t}))}chunkDPD6ZWL2_js.a(Kd,"createDependenciesHash");function _t(e){return Array.isArray(e)?e.map(t=>_t(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>ja(t,n)).map(([t,n])=>[t,_t(n)])):e}chunkDPD6ZWL2_js.a(_t,"stableNormalize");function ja(e,t){return e<t?-1:e>t?1:0}chunkDPD6ZWL2_js.a(ja,"compareStrings");function Yd(e){return e.function==="count"?`count(${e.relationAttribute})`:`${Qd(e.function)}(${e.relationAttribute}.${e.targetAttribute})`}chunkDPD6ZWL2_js.a(Yd,"rollupToFormulaExpression");function Hd(e,t){if(e.function==="count")return "number";let n=Xd(e,t);switch(e.function){case "countValues":case "countEmpty":case "percentEmpty":case "percentNotEmpty":case "countUniqueValues":return "number";case "sum":case "avg":return "number";case "earliest":case "latest":return "date";case "original":if(!ep(n.type))throw new S('Rollup "original" requires a select, status, or multiselect target');return "multiselect";default:return e.function}}chunkDPD6ZWL2_js.a(Hd,"inferRollupReturnType");function Pa(e,t){let n=Yd(e),r=Hd(e,t);return {...bn({attributeName:e.name,expression:n,returnType:r,schema:Jd(e,t)}),kind:"rollup"}}chunkDPD6ZWL2_js.a(Pa,"compileRollupAttribute");function Jd(e,t){return {...t,attributes:t.attributes.map(n=>n.name===e.relationAttribute&&n.type==="relation"?{...n,cardinality:"many"}:n)}}chunkDPD6ZWL2_js.a(Jd,"schemaWithRollupRelationAsMany");function Qd(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(Qd,"rollupFunctionToFormulaFunction");function Xd(e,t){let n=_a(t,e.relationAttribute);if(n===void 0)throw new S(`Unknown relation attribute "${e.relationAttribute}" on object "${t.objectName}"`);if(n.type!=="relation")throw new S(`Attribute "${e.relationAttribute}" on object "${t.objectName}" is not a relation`);let r=Zd(n);if(r===void 0)throw new S(`Relation "${e.relationAttribute}" on object "${t.objectName}" is missing targetObjectName`);let o=t.relatedObjects?.[r];if(o===void 0)throw new S(`Unknown related object "${r}"`);let a=_a(o,e.targetAttribute);if(a===void 0)throw new S(`Unknown attribute "${e.targetAttribute}" on object "${o.objectName}"`);return a}chunkDPD6ZWL2_js.a(Xd,"findRollupTargetAttribute");function _a(e,t){return e.attributes.find(n=>n.name===t)}chunkDPD6ZWL2_js.a(_a,"findAttribute");function Zd(e){if(e.targetObjectName!==void 0)return e.targetObjectName;if(e.targets?.length===1){let[t]=e.targets;return t?.object==="*"?void 0:t?.object}}chunkDPD6ZWL2_js.a(Zd,"getRelationTargetObjectName");function ep(e){return e==="select"||e==="status"||e==="multiselect"}chunkDPD6ZWL2_js.a(ep,"isSelectLikeAttributeType");function Re(e,t){switch(e.kind){case "literal":return e.value;case "path":return np(t,e.parts);case "binary":return rp(e.operator,Re(e.left,t),Re(e.right,t));case "call":return tp(e.functionName,e.args,t);default:return e}}chunkDPD6ZWL2_js.a(Re,"evaluateAst");function tp(e,t,n){if(op(e),ap(e,t.length),e==="if"){let r=Re(t[0],n);return r===null?null:Re(r?t[1]:t[2],n)}return sp(e,t.map(r=>Re(r,n)))}chunkDPD6ZWL2_js.a(tp,"evaluateCallNode");function np(e,t){return t.reduce((n,r)=>$a(n,r),e)}chunkDPD6ZWL2_js.a(np,"resolvePath");function $a(e,t){if(Array.isArray(e))return e.map(r=>$a(r,t));if(!La(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let n=e.values;return La(n)&&Object.hasOwn(n,t)?n[t]??null:null}chunkDPD6ZWL2_js.a($a,"resolvePathPart");function rp(e,t,n){switch(e){case "+":return ip(t,n);case "-":return yn(t,n,(r,o)=>r-o);case "*":return yn(t,n,(r,o)=>r*o);case "/":return yn(t,n,(r,o)=>r/o);case ">":return gn(t,n,r=>r>0);case "<":return gn(t,n,r=>r<0);case ">=":return gn(t,n,r=>r>=0);case "<=":return gn(t,n,r=>r<=0);case "==":return Ma(t,n);case "!=":{let r=Ma(t,n);return r===null?null:!r}default:return e}}chunkDPD6ZWL2_js.a(rp,"evaluateBinary");function ip(e,t){return typeof e=="string"||typeof t=="string"?`${e??""}${t??""}`:yn(e,t,(n,r)=>n+r)}chunkDPD6ZWL2_js.a(ip,"add");function gn(e,t,n){let r=Ua(e,t);return r===null?null:n(r)}chunkDPD6ZWL2_js.a(gn,"compareWith");function Ua(e,t){if(!pt([e,t]))return null;let n=mt(e),r=mt(t);if(n!==null&&r!==null)return n-r;let o=Di(e),a=Di(t);return o&&a?o.getTime()-a.getTime():null}chunkDPD6ZWL2_js.a(Ua,"compare");function Ma(e,t){return e===t?true:e==null||t===null||t===void 0?false:pt([e,t])?Ua(e,t)===0:null}chunkDPD6ZWL2_js.a(Ma,"equalScalar");function op(e){if(!mn(e))throw new Error(`Unknown computed function "${e}"`)}chunkDPD6ZWL2_js.a(op,"assertComputedFunctionName");function ap(e,t){let{minArgs:n,maxArgs:r}=jt[e];if(t>=n&&t<=(r??Number.POSITIVE_INFINITY))return;let o=r===void 0?`at least ${n}`:`between ${n} and ${r}`;throw new Error(`Function "${e}" expects ${o} arguments, received ${t}`)}chunkDPD6ZWL2_js.a(ap,"validateArity");function sp(e,t){switch(e){case "concat":return t.filter(n=>n!=null).map(String).join("");case "sum":return pt(t)?Ei(t).reduce((n,r)=>n+r,0):null;case "avg":{if(!pt(t))return null;let n=Ei(t);return n.length>0?n.reduce((r,o)=>r+o,0)/n.length:null}case "count":return ze(t[0]).length;case "min":return Fa(t,"min");case "max":return Fa(t,"max");case "earliest":return Ni(t,"min");case "latest":return Ni(t,"max");case "unique":return Ba(ze(t[0]));case "first":return ze(t[0]).find(n=>n!=null)??null;case "percent_empty":return Va(t[0],true);case "percent_not_empty":return Va(t[0],false);case "count_empty":return ze(t[0]).filter(chunkIBM4ID4Y_js.a).length;case "count_not_empty":return ze(t[0]).filter(n=>!chunkIBM4ID4Y_js.a(n)).length;case "count_unique":return Ba(ze(t[0])).length;default:return e}}chunkDPD6ZWL2_js.a(sp,"evaluateCall");function Ei(e){return hn(e).map(mt).filter(t=>t!==null)}chunkDPD6ZWL2_js.a(Ei,"numericValues");function pt(e){let t=new Set;for(let n of hn(e))Oi(n)&&t.add(qa(n));return t.size<=1}chunkDPD6ZWL2_js.a(pt,"areCommensurable");function qa(e){return e.code.toUpperCase()}chunkDPD6ZWL2_js.a(qa,"currencyCode");function yn(e,t,n){if(!pt([e,t]))return null;let r=mt(e),o=mt(t);if(r===null||o===null)return null;let a=n(r,o);return Number.isFinite(a)?a:null}chunkDPD6ZWL2_js.a(yn,"numericBinary");function Fa(e,t){if(!pt(e))return null;let n=Ei(e);return n.length>0?t==="min"?Math.min(...n):Math.max(...n):Ni(e,t)}chunkDPD6ZWL2_js.a(Fa,"minMax");function Ni(e,t){let n=hn(e).map(Di).filter(a=>a!==null);if(n.length===0)return null;let r=n.map(a=>a.getTime()),o=t==="min"?Math.min(...r):Math.max(...r);return new Date(o).toISOString()}chunkDPD6ZWL2_js.a(Ni,"dateMinMax");function Va(e,t){let n=ze(e);return n.length===0?0:n.filter(o=>chunkIBM4ID4Y_js.a(o)===t).length/n.length}chunkDPD6ZWL2_js.a(Va,"percentByEmptyState");function Ba(e){let t=new Set,n=[];for(let r of e){if(chunkIBM4ID4Y_js.a(r))continue;let o=cp(r);t.has(o)||(t.add(o),n.push(r));}return n}chunkDPD6ZWL2_js.a(Ba,"uniqueNonEmpty");function ze(e){return e==null?[]:Array.isArray(e)?hn(e):[e]}chunkDPD6ZWL2_js.a(ze,"collectionItems");function hn(e){return e.flat(Number.POSITIVE_INFINITY)}chunkDPD6ZWL2_js.a(hn,"flatten");function mt(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 Oi(e)&&Number.isFinite(e.value)?e.value:null}chunkDPD6ZWL2_js.a(mt,"toFiniteNumber");function Oi(e){return typeof e=="object"&&e!==null&&typeof e.value=="number"&&typeof e.code=="string"}chunkDPD6ZWL2_js.a(Oi,"isCurrencyValue");function Di(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!="string"){let n=tt(e);if(n===null)return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}chunkDPD6ZWL2_js.a(Di,"toDate");function cp(e){if(Oi(e))return `currency:${qa(e)}:${e.value}`;let t=mt(e);return t!==null?`number:${t}`:e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`}chunkDPD6ZWL2_js.a(cp,"uniqueKey");function La(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(La,"isPlainRecord");function up(e,t,n){if(e==null)return null;let r=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:n!==void 0?Number(o.toFixed(n)):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=r(o);if(a!==null)return a}return null}return r(e);case "multiselect":return Array.isArray(e)?e.flatMap(o=>{if(o==null)return [];let a=r(o);return a===null?[]:[a]}):r(e)===null?[]:[String(e)];default:{let o=t;throw new Error(`Unsupported computed return type: ${o}`)}}}chunkDPD6ZWL2_js.a(up,"formatComputedResult");function xS(e,t){return Re(e,t)}chunkDPD6ZWL2_js.a(xS,"evaluateComputedAst");function TS(e,t){return Re(chunkHRX4YCKZ_js.e(e),t)}chunkDPD6ZWL2_js.a(TS,"evaluateComputedFormula");function wS(e,t,n,r){try{let o=Re(chunkHRX4YCKZ_js.e(e),t);return {value:n?up(o,n,r):o}}catch(o){return {value:null,error:o instanceof Error?o.message:String(o)}}}chunkDPD6ZWL2_js.a(wS,"evaluateComputedFormulaWithResult");var RS=[{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 za=chunkDPD6ZWL2_js.a(e=>chunkIBM4ID4Y_js.a(e)||Array.isArray(e)&&e.length===0,"isEmpty"),X=chunkDPD6ZWL2_js.a(e=>e==null?"":String(e),"toStr"),Tn=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"),wn=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"),An=chunkDPD6ZWL2_js.a(e=>Array.isArray(e)?e:e==null?[]:[e],"toArr"),lp=chunkDPD6ZWL2_js.a((e,t,n)=>{let r=Tn(e),o=Tn(t);return r!==null&&o!==null&&n(r,o)},"compareNumbers"),dp=chunkDPD6ZWL2_js.a((e,t,n)=>{let r=wn(e),o=wn(t);return r!==null&&o!==null&&n(r.getTime(),o.getTime())},"compareDates"),Wa=chunkDPD6ZWL2_js.a((e,t,n)=>{if(n.type==="number"||n.type==="currency"){let r=Tn(e),o=Tn(t);if(r!==null&&o!==null)return r===o}return X(e)===X(t)},"equalsForAttr");function NS(e,t){return e?e==="checkbox":typeof t=="boolean"}chunkDPD6ZWL2_js.a(NS,"isCheckboxEquality");var xn=chunkDPD6ZWL2_js.a(e=>({appliesTo:["number","currency","date","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((t,n,r)=>r.type==="date"?dp(t,n,e):lp(t,n,e),"evaluateInMemory")}),"orderingSpec"),Sn={is:{appliesTo:["text","phone","number","currency","checkbox","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,n)=>n.type==="checkbox"?e===true==(t===true):Wa(e,t,n),"evaluateInMemory")},is_not:{appliesTo:["text","phone","number","currency","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,n)=>!Wa(e,t,n),"evaluateInMemory")},contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>X(e).toLowerCase().includes(X(t).toLowerCase()),"evaluateInMemory")},not_contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>!X(e).toLowerCase().includes(X(t).toLowerCase()),"evaluateInMemory")},starts_with:{appliesTo:["text","phone"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>X(e).toLowerCase().startsWith(X(t).toLowerCase()),"evaluateInMemory")},ends_with:{appliesTo:["text"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>X(e).toLowerCase().endsWith(X(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=>za(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=>!za(e),"evaluateInMemory")},less_than:xn((e,t)=>e<t),greater_than:xn((e,t)=>e>t),less_or_equal:xn((e,t)=>e<=t),greater_or_equal:xn((e,t)=>e>=t),is_within:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=wn(e),r=chunkRPTKXZBV_js.S(t);return n&&r?n.getTime()>=r.startMs&&n.getTime()<r.endMs:false},"evaluateInMemory")},on_day_month:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=wn(e);if(!n)return false;let r=t;return n.getMonth()+1===r.month&&n.getDate()===r.day},"evaluateInMemory")},any_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=An(t).map(X);return An(e).map(X).some(o=>n.includes(o))},"evaluateInMemory")},none_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=An(t).map(X);return !An(e).map(X).some(o=>n.includes(o))},"evaluateInMemory")}};var pp=chunkDPD6ZWL2_js.a((e,t)=>({id:`system:${e}`,name:e,label:e,type:t,system:true}),"systemAttribute"),mp=[...Object.entries(chunkRPTKXZBV_js.V).map(([e,t])=>pp(e,t))];function LS(e,t,n){let r=t;return fp(e,{...t.values,id:t.id,objectId:t.objectId,objectName:r.objectName,tenantId:r.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},[...n,...mp])}chunkDPD6ZWL2_js.a(LS,"evaluateRecordFilterState");function fp(e,t,n){if(e.rules.length===0)return true;let r=new Map(n.map(a=>[a.name,a])),o=e.combinator==="or"?"some":"every";return e.rules[o](a=>bp(a,t,r))}chunkDPD6ZWL2_js.a(fp,"evaluateFilterState");function bp(e,t,n){let r=n.get(e.attribute);if(!r)return false;if(e.property&&r.type==="location"){if(!(chunkRPTKXZBV_js.g(e.property)&&chunkRPTKXZBV_js.h(e.operator)))return false;let c=Sn[e.operator];if(!c)return false;let u=t[e.attribute],d=typeof u=="object"&&u!==null?u[e.property]:void 0;return ki(c,"text",e.operator,d,e.value,r)}if(e.property){let c=Fo(r).find(g=>g.name===e.property);if(!c)return false;let u=chunkRPTKXZBV_js.K(e.operator),d=Sn[u];if(!d?.appliesTo.includes(c.type))return false;let f=t[e.attribute],b=(Array.isArray(f)?f:f==null?[]:[f]).some(g=>{if(typeof g!="object"||g===null)return false;let y=g.props;return typeof y!="object"||y===null?false:ki(d,c.type,u,y[e.property],e.value,c)});return (e.quantifier??chunkRPTKXZBV_js.J(e.operator))==="none"?!b:b}let o=Sn[e.operator];if(!o||!o.appliesTo.includes(r.type))return false;let a=t[e.attribute],s=r.type==="relation"||r.type==="document"||r.type==="user"?hp(a):a;return ki(o,r.type,e.operator,s,e.value,r)}chunkDPD6ZWL2_js.a(bp,"evaluateRule");function ki(e,t,n,r,o,a){let[s,c]=gp(t,n,r,o);return t==="phone"&&c===""&&n==="contains"?false:t==="phone"&&c===""&&n==="not_contains"?true:e.evaluateInMemory(s,c,a)}chunkDPD6ZWL2_js.a(ki,"evaluateNormalizedComparands");function gp(e,t,n,r){return e==="date"&&(t==="is"||t==="is_not")?[Ga(n),Ga(r)]:e==="phone"?yp(n,r):[Ka(e,n),Ka(e,r)]}chunkDPD6ZWL2_js.a(gp,"normalizeOperatorComparands");function Ga(e){let t=Ne(e)?tt(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 n=new Date(t);return Number.isNaN(n.getTime())?null:n.toISOString().slice(0,10)}chunkDPD6ZWL2_js.a(Ga,"normalizeUtcCalendarDay");function yp(e,t){let n=typeof t=="object"&&t!==null?t:{},r=typeof n.countryCode=="string"?n.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(!r)return chunkGXSNLYRR_js.a(s.phoneNumber);let c=typeof s.countryCode=="string"?s.countryCode:r;return `${c}:${chunkGXSNLYRR_js.b(s.phoneNumber,c)}`},"normalizeOne");return [o(e),o(t)]}chunkDPD6ZWL2_js.a(yp,"normalizePhoneComparands");function Ka(e,t){return e==="currency"?chunkRPTKXZBV_js.H(t):e==="date"?Ne(t)?tt(t):t instanceof Date?Number.isNaN(t.getTime())?null:t.toISOString():t:t}chunkDPD6ZWL2_js.a(Ka,"normalizeComparableValue");function hp(e){let t=chunkDPD6ZWL2_js.a(n=>typeof n!="object"||n===null?n:n.id,"normalizeOne");return Array.isArray(e)?e.map(t):t(e)}chunkDPD6ZWL2_js.a(hp,"normalizeReferenceIds");var Ya="today";function In(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}chunkDPD6ZWL2_js.a(In,"dateInTimezone");function Ap(e,t){if(!("defaultValue"in e))return;let{defaultValue:n}=e;return e.type!=="date"||n!==Ya?n:e.includeTime?t.now.toISOString():In(t.now,t.timezone)}chunkDPD6ZWL2_js.a(Ap,"resolveAttributeDefaultValue");function YS(e,t,n){if(e.combinator==="or"&&e.rules.length>1)return {};let r=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=r.get(a.attribute);if(!s)continue;let c=xp(a,n);c!==void 0&&(o[a.attribute]=chunkRPTKXZBV_js.j(s).storage.cardinality==="many"?[c]:c);}return o}chunkDPD6ZWL2_js.a(YS,"deriveCreateDefaultsFromFilters");function xp(e,t){if(e.operator==="is")return chunkRPTKXZBV_js.D(e.value)?Ha(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 n=e.value[0];return chunkRPTKXZBV_js.D(n)?Ha(n,t):n}}chunkDPD6ZWL2_js.a(xp,"extractDeterministicValue");function Ha(e,t){if(t){if(e.dynamic==="actor")return t.userId;if(e.anchor==="today")return In(t.now,t.timezone);if(e.anchor==="now")return t.now.toISOString()}}chunkDPD6ZWL2_js.a(Ha,"resolveDynamicValue");function QS(e){let t=[];return e.canModify&&t.push("modify"),e.canSend&&t.push("send"),t}chunkDPD6ZWL2_js.a(QS,"requestedCapabilities");var XS={status:"connector_status",error:"connector_error",provider:"connector_provider"};var Tp=(t=>(t.Desktop="desktop",t))(Tp||{});function nI(e){return e==="gmail"||e==="outlook"}chunkDPD6ZWL2_js.a(nI,"isMailProvider");var wp=["threads","messages"];function rI(e){return wp.includes(e)}chunkDPD6ZWL2_js.a(rI,"isMailboxListMode");var Sp=["reply","reply_all"];function iI(e){return Sp.includes(e)}chunkDPD6ZWL2_js.a(iI,"isReplyMode");var oI=2e5,aI=998;var uI=["force","skip"],lI=["none","all","external_only"],dI="x-fake-signature",pI={override:null,status:"none",failureReason:null,botId:null};var Ip=/^Session \d+$/;function Ja(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(Ja,"buildAgentFallbackTitle");function Rp(e){let t=e.generated?.trim();return t&&!Ip.test(t)?t:e.firstUserText?Ja(e.firstUserText):e.emptyLabel}chunkDPD6ZWL2_js.a(Rp,"conversationDisplayTitle");var ji=/^[a-z0-9][a-z0-9-]{0,62}$/;function Cp(e){if(!ji.test(e))throw new chunkJSKLP4GI_js.h(`Invalid schema source id "${e}": expected a lowercase slug matching ${ji}`,[])}chunkDPD6ZWL2_js.a(Cp,"assertSchemaSourceId");function AI(e){let{attributeRemovals:t,objectRemovals:n,renames:r}=e.destructive;return t.length>0||n.length>0||r.length>0}chunkDPD6ZWL2_js.a(AI,"hasDestructiveEntries");var de={objectAdditions:20,totalMutations:500,serializedBytes:512*1024};function Pi(e){return e instanceof Error?e.message:String(e)}chunkDPD6ZWL2_js.a(Pi,"errorMessage");var vp=Kn.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 Xa=Kn.z.string().min(1).superRefine((e,t)=>{try{It(e);}catch(n){t.addIssue({code:Kn.z.ZodIssueCode.custom,message:Pi(n)});}}).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).'),Ep=Kn.z.string().min(1).superRefine((e,t)=>{chunkRPTKXZBV_js.w(e)&&t.addIssue({code:Kn.z.ZodIssueCode.custom,message:`"${e}" is a reserved object name (${chunkRPTKXZBV_js.C.join(", ")}) and cannot be used for a new object.`});try{St(e);}catch(n){t.addIssue({code:Kn.z.ZodIssueCode.custom,message:Pi(n)});}}).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 Za(e){return e.superRefine((t,n)=>{try{let r=chunkHRX4YCKZ_js.n(t.type,{...t.config??{},description:t.description}),o=Object.keys(t.config??{}).filter(a=>!Object.hasOwn(r,a));o.length>0&&n.addIssue({code:"unrecognized_keys",keys:o,path:["config"],message:`Unrecognized attribute config key${o.length===1?"":"s"}: ${o.join(", ")}`});}catch(r){if(r instanceof chunkJSKLP4GI_js.h){for(let o of r.errors)n.addIssue({code:Kn.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}n.addIssue({code:Kn.z.ZodIssueCode.custom,path:["config"],message:`Config for type "${t.type}" is invalid or incomplete: ${Pi(r)}`});}})}chunkDPD6ZWL2_js.a(Za,"withConfigCheck");var es=Kn.z.object({objectName:Kn.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:Xa,label:Kn.z.string().min(1).max(128).describe("Human-readable display label shown in the UI. 1-128 characters, cannot be empty."),type:vp,config:Kn.z.record(Kn.z.string(),Kn.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:Kn.z.boolean().optional().describe("Whether the attribute must have a value on every record. Defaults to false (optional)."),description:Kn.z.string().optional().describe("Help text shown under the field in the UI. Not the same as the plan's `summary`.")}).strict(),Np=Za(es),Dp=Za(es.omit({objectName:true})),Op=Kn.z.object({name:Ep,label:Kn.z.string().min(1).describe('Human-readable singular display label (e.g. "Devis").'),pluralLabel:Kn.z.string().optional().describe('Human-readable plural display label (e.g. "Devis"/"Invoices"). Defaults from `label` if omitted.'),description:Kn.z.string().optional().describe("Help text describing what this object represents."),icon:chunkHRX4YCKZ_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:nt.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:Kn.z.array(Dp).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(),ts=Kn.z.object({attributeRemovals:Kn.z.array(Kn.z.object({objectName:Kn.z.string().min(1).describe("Object the attribute is removed from."),attributeName:Kn.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:Kn.z.array(Kn.z.object({objectName:Kn.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:Kn.z.array(Kn.z.object({objectName:Kn.z.string().min(1).describe("Object the renamed attribute belongs to."),from:Kn.z.string().min(1).describe("Current attribute name. Must already exist and not be a system attribute."),to:Xa.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:[]}),ns=Kn.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."),rs=Kn.z.object({objects:Kn.z.array(Op).default([]),attributes:Kn.z.array(Np).default([])}).strict().default({objects:[],attributes:[]});function _i(e,t=[],n=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(n.has(e))return {path:t,message:"Plan input cannot contain circular references"};if(Array.isArray(e)){n.add(e);for(let s of Reflect.ownKeys(e))if(s!=="length"&&(typeof s=="symbol"||!/^(0|[1-9]\d*)$/.test(s)))return n.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 n.delete(e),{path:[...t,s],message:"Plan input cannot contain sparse arrays"};let c=_i(e[s],[...t,s],n);if(c)return n.delete(e),c}return n.delete(e),null}let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return {path:t,message:"Plan input must contain only plain JSON objects"};n.add(e);let o=e,a=Reflect.ownKeys(o);for(let s of a){let c=Object.getOwnPropertyDescriptor(o,s);if(typeof s=="symbol"||!(c?.enumerable&&"value"in c))return n.delete(e),{path:[...t,s],message:"Plan input objects must contain enumerable JSON data properties only"}}for(let s of a.sort()){let c=_i(o[s],[...t,s],n);if(c)return n.delete(e),c}return n.delete(e),null}chunkDPD6ZWL2_js.a(_i,"findJsonSafetyIssue");function kp(e){let t=[];return e.additive.objects.forEach((n,r)=>{t.push(["additive","objects",r]),n.attributes.forEach((o,a)=>{t.push(["additive","objects",r,"attributes",a]);});}),e.additive.attributes.forEach((n,r)=>{t.push(["additive","attributes",r]);}),e.destructive.attributeRemovals.forEach((n,r)=>{t.push(["destructive","attributeRemovals",r]);}),e.destructive.objectRemovals.forEach((n,r)=>{t.push(["destructive","objectRemovals",r]);}),e.destructive.renames.forEach((n,r)=>{t.push(["destructive","renames",r]);}),t}chunkDPD6ZWL2_js.a(kp,"mutationPaths");function is(e,t){e.additive.objects.length>de.objectAdditions&&t.addIssue({code:"too_big",origin:"array",maximum:de.objectAdditions,inclusive:true,path:["additive","objects",de.objectAdditions],message:`A schema plan can add at most ${de.objectAdditions} objects`});let n=kp(e);n.length>de.totalMutations&&t.addIssue({code:"too_big",origin:"array",maximum:de.totalMutations,inclusive:true,path:n[de.totalMutations],message:`A schema plan can contain at most ${de.totalMutations} mutations; received ${n.length}`});}chunkDPD6ZWL2_js.a(is,"addPlanLimitIssues");function os(e,t){let n=_i(e);if(n)return t.addIssue({code:"custom",path:n.path,message:n.message}),Kn.z.NEVER;let r=new TextEncoder().encode(chunkRTHLB6T6_js.b(e)).byteLength;return r>de.serializedBytes?(t.addIssue({code:"too_big",origin:"string",maximum:de.serializedBytes,inclusive:true,path:[],message:`A schema plan can serialize to at most ${de.serializedBytes} UTF-8 bytes; received ${r}`}),Kn.z.NEVER):e}chunkDPD6ZWL2_js.a(os,"boundSerializedPlanInput");var Qa=Kn.z.object({schemaPlanVersion:Kn.z.literal(2).describe("Required proposal contract version."),summary:ns,additive:rs,destructive:ts}).strict().superRefine(is),OI=Object.assign(Kn.z.preprocess(os,Qa),{shape:Qa.shape}),jp=Kn.z.object({schemaPlanVersion:Kn.z.literal(2),summary:ns,additive:rs,destructive:ts}).strict().superRefine(is),kI=Kn.z.preprocess(os,jp);function ft(e,t){throw new chunkJSKLP4GI_js.h(t,[{path:e,message:t}])}chunkDPD6ZWL2_js.a(ft,"reject");function Rn(e){throw new chunkJSKLP4GI_js.h(`Unsupported schema reference variant ${String(e)}`,[])}chunkDPD6ZWL2_js.a(Rn,"exhaustive");function LI(e){let t=new Map(e.objects.map(s=>[s.name,s])),n=[];function r(s,c,u){function d(y,h,x){(y.kind==="object"?t.has(y.object):y.kind==="attribute"?t.get(y.object)?.attributes.some(E=>E.name===y.attribute):true)||ft([...c,...x],`Unknown schema reference ${JSON.stringify(y)}`),n.push({owner:s,target:y,category:h,path:x,...u===void 0?{}:{layer:u}});}chunkDPD6ZWL2_js.a(d,"add");function f(y,h,x,k){d({kind:"attribute",object:y,attribute:h},x,k);}chunkDPD6ZWL2_js.a(f,"attribute");function l(y,h,x,k,E){f(y,h,x,k);let M=t.get(y)?.attributes.find(B=>B.name===h);return M?.type!=="relation"&&ft([...c,...k],`Invalid schema reference path "${E}"`),(M.targets.length!==1||M.targets[0].object==="*")&&ft([...c,...k],`Ambiguous schema reference path "${E}"`),M.targets[0].object}chunkDPD6ZWL2_js.a(l,"traverse");function b(y,h,x,k){let E=y;for(let[M,B]of h.entries())M===h.length-1?f(E,B,x,k):E=l(E,B,x,k,h.join("."));}chunkDPD6ZWL2_js.a(b,"attributePath");function g(y,h,x){switch(h.kind){case "literal":return;case "path":b(y,h.parts,"computed",x);return;case "call":for(let k of h.args)g(y,k,x);return;case "binary":g(y,h.left,x),g(y,h.right,x);return;default:Rn(h);}}return chunkDPD6ZWL2_js.a(g,"formula"),{add:d,attribute:f,traverse:l,attributePath:b,formula:g}}chunkDPD6ZWL2_js.a(r,"visitor"),e.objects.forEach((s,c)=>{let u=["objects",String(c)],d=r({kind:"object",object:s.name},u);for(let f of ["labelExpression","embeddingExpression"]){let l=s[f];if(l)for(let b of wt(l))d.attributePath(s.name,b.split("."),"business",[f]);}s.attributes.forEach((f,l)=>{let b=[...u,"attributes",String(l)],g=r({kind:"attribute",object:s.name,attribute:f.name},b);switch(f.type){case "relation":f.targets.forEach((y,h)=>{if(y.object!=="*"&&g.add({kind:"object",object:y.object},"structural",["targets",String(h),"object"]),y.displayTemplate)for(let x of wt(y.displayTemplate))g.attributePath(y.object,x.split("."),"business",["targets",String(h),"displayTemplate"]);for(let x of Object.keys(y.filter??{}))g.attribute(y.object,x,"business",["targets",String(h),"filter",x]);});break;case "formula":{let y;try{y=chunkHRX4YCKZ_js.e(f.expression);}catch(h){ft([...b,"expression"],h instanceof Error?h.message:String(h));}g.formula(s.name,y,["expression"]),o(f,g);break}case "rollup":{let y=f.relationPath??f.relationAttribute,h=s.name;for(let x of y.split("."))h=g.traverse(h,x,"computed",[f.relationPath===void 0?"relationAttribute":"relationPath"],y);g.attributePath(h,f.targetAttribute.split("."),"computed",["targetAttribute"]),o(f,g);break}case "text":case "richtext":case "number":case "checkbox":case "date":case "phone":case "currency":case "status":case "location":case "select":case "multiselect":case "user":case "document":break;default:Rn(f);}});});function o(s,c){s.optionsSource&&(c.add({kind:"object",object:s.optionsSource.objectName},"computed",["optionsSource","objectName"]),c.attribute(s.optionsSource.objectName,s.optionsSource.attributeName,"computed",["optionsSource","attributeName"]));}chunkDPD6ZWL2_js.a(o,"visitOptions");function a(s,c,u){r({kind:"view",object:s.object,view:s.name},c,u).add({kind:"object",object:s.object},"structural",["object"]),s.contents.forEach((d,f)=>{let l=r({kind:"content",object:s.object,view:s.name,content:d.name},[...c,"contents",String(f)],u);function b(g,y,h,x){g?.forEach((k,E)=>l.attribute(y,k,h,[x,String(E)]));}switch(chunkDPD6ZWL2_js.a(b,"names"),d.type){case "collection":{let g=Ue(d.source),y;switch(g.kind==="object"?(y=g.object,l.add({kind:"object",object:y},"source",["source","object"])):g.kind==="relatedFrom"?(y=g.object,l.add({kind:"object",object:y},"source",["source","object"]),l.attribute(y,g.relation,"source",["source","relation"])):y=l.traverse(s.object,g.relation,"source",["source","relation"],g.relation),d.columns?.forEach((h,x)=>{if(typeof h=="string"){l.attribute(y,h,"display",["columns",String(x)]);return}let k=t.get(s.object),E=g.kind!=="related"||!k?void 0:ya(k,g.relation),M=["columns",String(x),"relationProperty"];E||ft([...c,"contents",String(f),...M],"Relation property columns require a relation source"),E.properties?.definitions.some(B=>B.name===h.relationProperty)||ft([...c,"contents",String(f),...M],`Unknown relation property "${h.relationProperty}"`),l.add({kind:"attribute",object:s.object,attribute:E.name},"display",M);}),b(d.displayAttributes,y,"display","displayAttributes"),d.descriptionAttribute!==void 0&&l.attribute(y,d.descriptionAttribute,"display",["descriptionAttribute"]),d.filters?.rules.forEach((h,x)=>l.attribute(y,h.attribute,"business",["filters","rules",String(x),"attribute"])),d.sorts?.forEach((h,x)=>l.attribute(y,h.attribute,"business",["sorts",String(x),"attribute"])),d.layout){case "table":case "list":if(d.columnSizing)for(let h of Object.keys(d.columnSizing))l.attribute(y,h,"display",["columnSizing",h]);break;case "kanban":l.attribute(y,d.groupByAttribute,"business",["groupByAttribute"]);break;default:Rn(d);}break}case "form":d.groups.forEach((g,y)=>g.fields.forEach((h,x)=>l.attribute(s.object,h.attribute,"display",["groups",String(y),"fields",String(x),"attribute"])));break;case "richtext":l.attribute(s.object,d.attribute,"source",["attribute"]),d.titleAttribute!==void 0&&l.attribute(s.object,d.titleAttribute,"display",["titleAttribute"]);break;case "documents":b(d.relations,s.object,"business","relations");break;case "forms":d.objectName!==void 0&&l.add({kind:"object",object:d.objectName},"source",["objectName"]);break;case "emails":case "meetings":b(d.emailAttributes,s.object,"business","emailAttributes");break;case "activity":case "custom":break;default:Rn(d);}});}return chunkDPD6ZWL2_js.a(a,"viewReferences"),e.views.forEach((s,c)=>a(s,["views",String(c)])),e.retainedViews?.forEach(({definition:s,layer:c},u)=>a(s,["retainedViews",String(u),"definition"],c)),n}chunkDPD6ZWL2_js.a(LI,"collectSchemaReferences");var as=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function $(e,t,n){throw new chunkJSKLP4GI_js.h(n,[{path:[...e.split("."),t],message:n}])}chunkDPD6ZWL2_js.a($,"reject");function Mi(e){return e.join("|")}chunkDPD6ZWL2_js.a(Mi,"pairKey");function Fi(e,t){return [e,t].sort()}chunkDPD6ZWL2_js.a(Fi,"pairedAddresses");function _p(e){let t=new Map,n=new Map,r=new Set;for(let o of e){let a=Mi(o.addresses);(!as.test(o.id)||o.addresses[0]===o.addresses[1]!=(o.symmetric===true))&&$(o.addresses[0],"pair",`Invalid stored pair identity for ${a}`),(t.has(a)||n.has(o.id)&&n.get(o.id)!==a||o.addresses.some(s=>r.has(s)))&&$(o.addresses[0],"pair",`Duplicate stored pair identity for ${a}`),o.addresses.includes(o.ownerAddress)||$(o.addresses[0],"pair",`Invalid property owner for ${a}`),t.set(a,o),n.set(o.id,a);for(let s of o.addresses)r.add(s);}return t}chunkDPD6ZWL2_js.a(_p,"validateExistingPairs");function Pp(e,t){let n=new Set(e.flatMap(s=>s.addresses)),r=new Map,o=new Set;for(let{from:s,to:c}of t)(!n.has(s)||s===c||r.has(s)||o.has(c))&&$(s,"rename",`Invalid or duplicate relation attribute rename ${s} to ${c}`),r.set(s,c),o.add(c);let a=chunkDPD6ZWL2_js.a(s=>r.get(s)??s,"mapped");return e.map(s=>({...s,addresses:Fi(a(s.addresses[0]),a(s.addresses[1])),ownerAddress:a(s.ownerAddress),generatedAddresses:s.generatedAddresses.map(a)}))}chunkDPD6ZWL2_js.a(Pp,"remapExistingPairs");function Mp(e,t,n){return e.type==="relation"&&e.bilateral?.object===t&&e.bilateral.attribute===n&&e.targets.length===1&&e.targets[0]?.object===t}chunkDPD6ZWL2_js.a(Mp,"isReciprocal");function Fp(e,t,n){let r=e.bilateral;r||$(`${t}.${e.name}`,"bilateral","Missing inverse address");let o={type:"relation",name:r.attribute,label:r.label??r.attribute,required:false,targets:[{object:t}],bilateral:{object:t,attribute:e.name,cardinality:e.cardinality},order:n};return (r.cardinality??Co(e.cardinality))==="one"?{...o,cardinality:"one"}:{...o,cardinality:"many"}}chunkDPD6ZWL2_js.a(Fp,"generateInverse");function Vp(e,t,n,r,o){e.bilateral?.cardinality&&e.bilateral.cardinality!==t.cardinality&&$(r,"cardinality",`${n} declares ${r} as ${e.bilateral.cardinality}, but ${r} declares ${t.cardinality}`),t.bilateral?.cardinality&&t.bilateral.cardinality!==e.cardinality&&$(n,"cardinality",`${r} declares ${n} as ${t.bilateral.cardinality}, but ${n} declares ${e.cardinality}`),e.bilateral?.label&&e.bilateral.label!==t.label&&$(r,"label",`${n} declares a different label for ${r}`),t.bilateral?.label&&t.bilateral.label!==e.label&&$(n,"label",`${r} declares a different label for ${n}`),e.properties&&t.properties&&!chunkRTHLB6T6_js.j(e.properties,t.properties)&&!o&&$(r,"properties",`${n} and ${r} declare different qualified properties`),e.bilateral?.storageOwner===t.bilateral?.storageOwner&&e.bilateral?.storageOwner!==void 0&&$(r,"storageOwner",`${n} and ${r} cannot both own or both disown qualified properties`);}chunkDPD6ZWL2_js.a(Vp,"checkExplicitDeclarations");function Bp(e,t,n,r,o,a){return o?o.ownerAddress:e.bilateral?.storageOwner===true||t.bilateral?.storageOwner===false?n:e.bilateral?.storageOwner===false||t.bilateral?.storageOwner===true?r:a?n:Fi(n,r)[0]}chunkDPD6ZWL2_js.a(Bp,"chooseOwner");function Lp(e){if(!e.metadata)return;let{relationPairId:t,relationGenerated:n,...r}=e.metadata;e.metadata=Object.keys(r).length>0?r:void 0;}chunkDPD6ZWL2_js.a(Lp,"stripUntrustedPairMetadata");function $p(e,t,n,r,o,a){a.has(n)&&a.has(r)&&!chunkRTHLB6T6_js.j(e.properties,t.properties)&&$(r,"properties",`${n} and ${r} edit different qualified properties`);let s=a.has(n)||o.has(n)&&!o.has(r)&&!a.has(r),c=a.has(r)||o.has(r)&&!o.has(n)&&!a.has(n),u=s?e.properties:c?t.properties:e.properties??t.properties;u?(e.properties=structuredClone(u),t.properties=structuredClone(u)):(delete e.properties,delete t.properties);}chunkDPD6ZWL2_js.a($p,"reconcileProperties");function Vi(e){let t=structuredClone(e.objects),n=new Map;for(let l of t){if(n.has(l.name))throw new chunkJSKLP4GI_js.r("object",l.name);n.set(l.name,l);let b=new Set;for(let g of l.attributes){if(b.has(g.name))throw new chunkJSKLP4GI_js.r("attribute",g.name);b.add(g.name),Lp(g);}}let r=Pp(e.existingPairs??[],e.addressRenames??[]),o=_p(r),a=new Set(r.flatMap(l=>l.generatedAddresses)),s=new Set(e.propertyEditAddresses??[]),c=new Set(e.explicitAddresses??t.flatMap(l=>l.attributes.filter(b=>!a.has(`${l.name}.${b.name}`)).map(b=>`${l.name}.${b.name}`))),u=t.flatMap(l=>l.attributes.filter(b=>b.type==="relation"&&!!b.bilateral).map(b=>({object:l,attribute:b,address:`${l.name}.${b.name}`}))).sort((l,b)=>l.address.localeCompare(b.address)),d=new Map,f=new Map;for(let{object:l,attribute:b,address:g}of u){let y=b.bilateral?.object;(!y||y==="*"||b.targets.length!==1||b.targets[0]?.object!==y)&&$(g,"targets",`Bilateral target of ${g} must be one concrete object`);let h=n.get(y);h||$(g,"bilateral",`Unknown inverse object ${y} for ${g}`);let x=`${y}.${b.bilateral?.attribute}`,k=g===x;k&&b.cardinality!=="many"&&$(g,"cardinality",`Symmetric self relation ${g} must be many`),k&&b.bilateral?.cardinality&&b.bilateral.cardinality!==b.cardinality&&$(g,"bilateral",`Symmetric self relation ${g} needs matching cardinality`);let E=Fi(g,x),M=Mi(E);if(d.has(M))continue;let B=h.attributes.find(we=>we.name===b.bilateral?.attribute);if(B&&!Mp(B,l.name,b.name))throw new chunkJSKLP4GI_js.r("attribute",x);let Qe=!(B&&c.has(x));B||(B=Fp(b,l.name,h.attributes.length),h.attributes.push(B));let Y=B;!k&&c.has(g)&&c.has(x)&&Vp(b,Y,g,x,s.has(g)!==s.has(x));let j=o.get(M),P=j?.id??e.nextPairId(E),oe=r.find(we=>we.id===P&&Mi(we.addresses)!==M);(!as.test(P)||oe||f.has(P)&&f.get(P)!==M)&&$(g,"pair",`Invalid or duplicate pair identity for ${g} and ${x}`),f.set(P,M);let te=k?g:Bp(b,Y,g,x,j,Qe);b.bilateral&&Y.bilateral||$(g,"bilateral",`Missing reciprocal configuration for ${g} and ${x}`),b.bilateral={...b.bilateral,cardinality:Y.cardinality,label:Y.label,storageOwner:te===g},Y.bilateral={...Y.bilateral,cardinality:b.cardinality,label:b.label,storageOwner:te===x},$p(b,Y,g,x,c,s),b.metadata={...b.metadata,relationPairId:P},Y.metadata={...Y.metadata,relationPairId:P},d.set(M,{id:P,addresses:E,ownerAddress:te,generatedAddresses:E.filter(we=>!c.has(we)),...k?{symmetric:true}:{}});}return {objects:t,pairs:[...d.values()].sort((l,b)=>l.addresses[0].localeCompare(b.addresses[0]))}}chunkDPD6ZWL2_js.a(Vi,"reconcileRelationAttributes");var v=Kn.z.number().finite().nonnegative(),cs=Kn.z.enum(Eo),Bi=Kn.z.enum(No),Li=Kn.z.enum(Do),us=Kn.z.object({provider:cs,model:Kn.z.string().min(1)}).strict(),QI=Kn.z.object({speed:Bi.optional(),reasoning:Li.optional()}).strict(),ls=Kn.z.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),Up=Kn.z.object({model:us.optional(),speed:Bi.optional(),reasoning:Li.optional(),imageModel:ls.optional()}).strict(),XI=Up.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"}),ZI=Kn.z.object({model:us.nullable().optional(),speed:Bi.nullable().optional(),reasoning:Li.nullable().optional(),imageModel:ls.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"}),ds=Kn.z.object({label:Kn.z.string(),denied:Kn.z.boolean().optional(),deletion:Kn.z.object({target:Kn.z.string().optional(),count:v.optional(),restorableDays:v.optional()}).strict().optional(),counts:Kn.z.record(Kn.z.string(),v).optional(),warnings:Kn.z.array(Kn.z.string()).optional()}).strict(),qp=Kn.z.union([Kn.z.object({type:Kn.z.literal("text"),text:Kn.z.string()}).strict(),Kn.z.object({type:Kn.z.literal("reasoning"),text:Kn.z.string()}).strict(),Kn.z.object({type:Kn.z.literal("system"),code:Kn.z.enum(Bn)}).strict(),Kn.z.object({type:Kn.z.literal("error"),error:Kn.z.string(),errorClass:Kn.z.string().optional()}).strict(),Kn.z.object({type:Kn.z.literal("tool"),toolCallId:Kn.z.string(),name:Kn.z.string(),args:Kn.z.record(Kn.z.string(),Kn.z.unknown()),result:Kn.z.unknown().optional(),error:Kn.z.string().optional(),errorCode:Kn.z.enum(["output_limit_reached","interrupted"]).optional(),state:Kn.z.enum(["streaming","running","completed","error","pending","approval-requested","approval-responded","approval-dispatched"]),durationMs:v.optional(),approvalId:Kn.z.string().optional(),approvalImpact:ds.optional(),approved:Kn.z.boolean().optional(),approvalReason:Kn.z.string().optional(),approvalRelaxableByAuto:Kn.z.boolean().optional()}).strict(),Kn.z.object({type:Kn.z.literal("file"),fileId:Kn.z.string(),name:Kn.z.string(),mimeType:Kn.z.string()}).strict(),Kn.z.object({type:Kn.z.literal("compaction"),state:Kn.z.literal("in-progress"),reason:Kn.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:v.optional(),reportedTokens:v.optional()}).strict(),Kn.z.object({type:Kn.z.literal("compaction"),state:Kn.z.literal("completed"),tokensBefore:v,tokensAfter:v,tokensSaved:v,strategy:Kn.z.enum(["no-op","summary","truncation"]),durationMs:v,summary:Kn.z.string().optional()}).strict(),Kn.z.object({type:Kn.z.literal("compaction"),state:Kn.z.literal("failed"),reason:Kn.z.string(),durationMs:v.optional()}).strict()]),zp=Kn.z.object({id:Kn.z.string(),name:Kn.z.string(),mimeType:Kn.z.string(),size:v}).strict(),Wp=Kn.z.object({id:Kn.z.string(),type:Kn.z.string().transform(e=>e),entityId:Kn.z.string(),label:Kn.z.string(),objectName:Kn.z.string().optional(),startIndex:v,endIndex:v}).strict(),Gp=Kn.z.object({provider:cs,model:Kn.z.string(),maxTokens:v.optional(),contextWindow:v.optional()}).strict(),Kp=Kn.z.union([Kn.z.date(),Kn.z.string().datetime({offset:true}).transform(e=>new Date(e))]),ss=Kn.z.object({id:Kn.z.string(),sessionId:Kn.z.string(),tenantId:Kn.z.string().optional(),runId:Kn.z.string().optional(),role:Kn.z.enum(["user","assistant","system","tool"]),parts:Kn.z.array(qp),attachments:Kn.z.array(zp).optional(),mentions:Kn.z.array(Wp).optional(),model:Gp.optional(),tokenUsage:Kn.z.object({input:v,output:v}).strict().optional(),metadata:Kn.z.record(Kn.z.string(),Kn.z.unknown()).optional(),createdAt:Kp}).strict(),Yp=Kn.z.object({id:Kn.z.string(),description:Kn.z.string(),status:Kn.z.enum(["pending","in_progress","completed","blocked"]),result:Kn.z.string().optional(),updatedAt:v.optional()}).strict(),Hp=Kn.z.object({id:Kn.z.string(),sessionId:Kn.z.string(),status:Kn.z.enum(["active","completed","abandoned"]),todos:Kn.z.array(Yp),version:v,createdAt:Kn.z.string(),updatedAt:Kn.z.string(),completedAt:Kn.z.string().optional()}).strict(),ps={"session-named":Kn.z.object({name:Kn.z.string()}).strict(),"compaction-start":Kn.z.object({reason:Kn.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:v.optional(),reportedTokens:v.optional()}).strict(),"compaction-end":Kn.z.object({tokensBefore:v,tokensAfter:v,tokensSaved:v,strategy:Kn.z.enum(["no-op","summary","truncation"]),durationMs:v,summary:Kn.z.string().optional()}).strict(),"compaction-failed":Kn.z.object({reason:Kn.z.string()}).strict(),usage:Kn.z.object({messageId:Kn.z.string().min(1).optional(),inputTokens:v,outputTokens:v,totalTokens:v,cacheReadTokens:v.optional(),cacheCreationTokens:v.optional(),contextWindow:v,residentTokens:v,utilization:Kn.z.number().finite().min(0).max(1),costUsd:v.optional()}).strict(),"message-persisted":Kn.z.object({message:ss}).strict(),"message-updated":Kn.z.object({message:ss}).strict(),"todo-plan-update":Kn.z.object({plan:Hp}).strict(),"approval-context":Kn.z.object({approvalId:Kn.z.string(),toolCallId:Kn.z.string(),impact:ds.optional(),relaxableByAuto:Kn.z.boolean().optional()}).strict(),"session-state":Kn.z.object({state:Kn.z.object({phase:Kn.z.enum(["queued","running","parked","terminal"]),parkedOn:Kn.z.enum(["human","agents"]).optional(),humanRequestIds:Kn.z.array(Kn.z.string()).optional(),outcome:Kn.z.enum(["completed","failed","cancelled","timeout","expired"]).optional()}).strict(),version:Kn.z.number().int().positive(),updatedAt:Kn.z.string().datetime({offset:true})}).strict()};function Jp(e){return e in ps}chunkDPD6ZWL2_js.a(Jp,"isAgentUIDataName");function Qp(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(Qp,"agentUIValidationError");function Xp(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 n=t.slice(5);if(!Jp(n))throw new chunkJSKLP4GI_js.h("Invalid agent UI message chunk",[{path:["type"],message:`Unknown agent UI data type: ${n}`,code:"invalid_value"}]);let r=Kn.z.object({type:Kn.z.literal(`data-${n}`),id:Kn.z.string().optional(),data:ps[n],transient:Kn.z.boolean().optional()}).strict().safeParse(e);if(!r.success)throw Qp(r.error.issues);return r.data}chunkDPD6ZWL2_js.a(Xp,"assertCustomAgentUIMessageChunk");function eR(e,t,n){return Xp({type:`data-${e}`,...n?.id!==void 0?{id:n.id}:{},data:t,...n?.transient!==void 0?{transient:n.transient}:{}})}chunkDPD6ZWL2_js.a(eR,"agentDataChunk");function $i(e){return e}chunkDPD6ZWL2_js.a($i,"defineOperation");function V(e,t,n){let r=t==="atomic"?"none":t==="local"?"if-not-visible":"follow";return o=>{let a=n?.(o);return {impact:t,navigation:r,focus:{...e(o),...a===void 0?{}:{propertyPath:a}}}}}chunkDPD6ZWL2_js.a(V,"definePresentation");function Zp(e){return {id:e.id??e.name,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon}}}chunkDPD6ZWL2_js.a(Zp,"toDraftableObject");function em(e){let t=e.id??e.name;return (e.attributes??[]).map(n=>Ui(n,t))}chunkDPD6ZWL2_js.a(em,"toDraftableAttributes");function Z(e){return {id:e.id,name:e.name,label:e.label,type:e.attributeType,...e.config}}chunkDPD6ZWL2_js.a(Z,"toAttribute");function Ui(e,t){let{id:n,name:r,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(Ui,"toDraftableAttribute");function ms(e){let t=e[0];return t?`{{ ${t.name} }}`:"{{ id }}"}chunkDPD6ZWL2_js.a(ms,"draftedLabelExpression");function qi(e,t){let n=t.filter(r=>r.objectId===e.id);return {id:e.id,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon},labelExpression:ms(n),attributes:n.map((r,o)=>{let a=Z(r);return a.order===void 0?{...a,order:o}:a})}}chunkDPD6ZWL2_js.a(qi,"draftedObjectDefinition");function tm(e,t,n=Dt(e.contents)){return structuredClone({...e,...t,authoring:n})}chunkDPD6ZWL2_js.a(tm,"toDraftableView");function bt(e){let{id:t,revision:n,contentIds:r,contentRevisions:o,derived:a,authoring:s,...c}=e;return structuredClone(c)}chunkDPD6ZWL2_js.a(bt,"draftedViewDefinition");function nm(e,t){return {...e,...bt(t)}}chunkDPD6ZWL2_js.a(nm,"fromDraftableView");var Pt={id:Kn.z.string().min(1),objectName:Kn.z.string().min(1),viewName:Kn.z.string().min(1)},Mt={...Pt,contentName:Kn.z.string().min(1)},ys=Kn.z.union([Kn.z.object({before:Kn.z.string().min(1)}).strict(),Kn.z.object({after:Kn.z.string().min(1)}).strict(),Kn.z.object({end:Kn.z.literal(true)}).strict()]),We=chunkDPD6ZWL2_js.a(e=>({objectName:e.objectName,viewName:e.viewName}),"viewFocus"),_e=chunkDPD6ZWL2_js.a(e=>({...We(e),contentName:e.contentName}),"contentFocus");function pe(e,t){throw new chunkJSKLP4GI_js.h(t,[{path:e,message:t}])}chunkDPD6ZWL2_js.a(pe,"invalid");function Ce(e,t,n,r){let o=e.views.findIndex(u=>u.object===t.objectName&&u.name===t.viewName);o<0&&pe(["viewName"],"View is not in the draftable state"),e.views[o].authoring||pe(["authoring"],"Missing view authoring baseline");let{derived:a,...s}=r(structuredClone(e.views[o]));s.contents=fi(s.authoring);let c=e.views.map((u,d)=>d===o?s:u);return gi({extensions:[...n.extensions],objects:e.objects.map(u=>qi(u,e.attributes.filter(d=>d.objectId===u.id))),views:c.map(bt)}),{...e,views:c}}chunkDPD6ZWL2_js.a(Ce,"change");function Ge(e,t){let n=Object.hasOwn(e.authoring.contents,t)?e.authoring.contents[t]:void 0;return n||pe(["contentName"],"Content is not in the draftable state"),n}chunkDPD6ZWL2_js.a(Ge,"contentState");function zi(e,t,n){for(let r of n)e.authoring[r==="main"?"mainOrderCustomized":"asideOrderCustomized"]=true,t.filter(o=>o.placement===r).forEach((o,a)=>{Ge(e,o.name).workspacePosition=a;});}chunkDPD6ZWL2_js.a(zi,"setOrder");function Wi(e,t){let n=e.contents.find(r=>r.name===t);return n||pe(["contentName"],"Content is not in the draftable state"),n}chunkDPD6ZWL2_js.a(Wi,"find");function hs(e,t,n){let r=e.filter(s=>s.name!==t.name),o=r.filter(s=>s.placement===t.placement),a=o.length;if(!("end"in n)){let s="before"in n?n.before:n.after;a=o.findIndex(c=>c.name===s),a<0&&pe(["target"],"Order target is not in this placement"),"after"in n&&a++;}return o.splice(a,0,t),t.placement==="main"?[...o,...r.filter(s=>s.placement==="aside")]:[...r.filter(s=>s.placement==="main"),...o]}chunkDPD6ZWL2_js.a(hs,"placed");var rm=Kn.z.unknown().transform((e,t)=>{let n=chunkRPTKXZBV_js.ca.safeParse(typeof e=="object"&&e!==null?{...e,name:"candidate"}:e);if(!n.success){for(let a of n.error.issues)t.addIssue({code:"custom",path:a.path,message:a.message});return Kn.z.NEVER}if(typeof e=="object"&&e!==null&&"name"in e)return t.addIssue({code:"custom",path:["name"],message:"Content name is the operation target"}),Kn.z.NEVER;let{name:r,...o}=n.data;return o}),As=Kn.z.object({...Mt,type:Kn.z.literal("replace_view_content"),definition:rm}).strict(),im={type:"replace_view_content",schema:As,focus:_e,presentation:V(_e,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Replace ${e.objectName}.${e.viewName}.${e.contentName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>(Wi(r,t.contentName).placement!==t.definition.placement&&pe(["definition","placement"],"Use move_view_content to change placement"),Ge(r,t.contentName).workspaceDefinition=structuredClone(t.definition),{...r,contents:r.contents.map(a=>a.name===t.contentName?{...t.definition,name:t.contentName}:a),contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+1}})),"apply")},xs=Kn.z.object({...Pt,type:Kn.z.literal("add_view_content"),content:chunkRPTKXZBV_js.ca,target:ys}).strict(),fs=chunkDPD6ZWL2_js.a(e=>({...We(e),contentName:e.content.name}),"addFocus"),om={type:"add_view_content",schema:xs,focus:fs,presentation:V(fs,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Add ${e.content.name}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{if(Object.hasOwn(r.authoring.contents,t.content.name))throw new chunkJSKLP4GI_js.r("content",t.content.name);r.authoring.contents={...r.authoring.contents,[t.content.name]:{sourceDefinition:null,workspaceDefinition:Nt(t.content),suppressed:false,sourcePosition:null,workspacePosition:0}};let o=hs(r.contents,t.content,t.target);return zi(r,o,[t.content.placement]),{...r,revision:r.revision+1,contents:o,contentIds:{...r.contentIds,[t.content.name]:JSON.stringify(["draft-content",t.id])},contentRevisions:{...r.contentRevisions,[t.content.name]:1}}}),"apply")},Ts=Kn.z.object({...Mt,type:Kn.z.literal("remove_view_content")}).strict(),am={type:"remove_view_content",schema:Ts,focus:_e,presentation:V(_e,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Remove ${e.contentName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{let o=Wi(r,t.contentName),a=Ge(r,t.contentName),s=r.contents.filter(l=>l.name!==t.contentName);if(zi(r,s,[o.placement]),a.sourceDefinition!==null)return a.workspaceDefinition=null,a.suppressed=true,{...r,revision:r.revision+1,contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+1}};delete r.authoring.contents[t.contentName];let{[t.contentName]:c,...u}=r.contentIds,{[t.contentName]:d,...f}=r.contentRevisions;return {...r,revision:r.revision+1,contents:r.contents.filter(l=>l.name!==t.contentName),contentIds:u,contentRevisions:f}}),"apply")},ws=Kn.z.object({...Mt,type:Kn.z.literal("move_view_content"),placement:Kn.z.enum(["main","aside"]),target:ys}).strict(),sm={type:"move_view_content",schema:ws,focus:_e,presentation:V(_e,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Move ${e.contentName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{let o=Wi(r,t.contentName);o.placement!==t.placement&&(Ge(r,t.contentName).workspaceDefinition={...Nt(o),placement:t.placement});let a=hs(r.contents,{...o,placement:t.placement},t.target);return zi(r,a,[...new Set([o.placement,t.placement])]),{...r,revision:r.revision+1,contents:a,contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+ +(o.placement!==t.placement)}}}),"apply")},Ss=Kn.z.object({...Pt,type:Kn.z.literal("update_view_metadata"),changes:Kn.z.object({label:Kn.z.string().min(1).optional(),description:Kn.z.string().optional(),icon:chunkHRX4YCKZ_js.c.nullable().optional()}).strict().refine(e=>Object.keys(e).length>0)}).strict(),cm={type:"update_view_metadata",schema:Ss,focus:We,presentation:V(We,"atomic"),describe:chunkDPD6ZWL2_js.a(e=>`Update ${e.viewName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{let{icon:o,...a}=t.changes,s={...r,...a,revision:r.revision+1};if(o===null){let{icon:c,...u}=s;return u}return o===void 0?s:{...s,icon:o}}),"apply")},Is=Kn.z.string().refine(e=>e.trim().length>0,"API name must not be blank"),Rs=Kn.z.object({...Pt,type:Kn.z.literal("rename_view"),newName:Is}).strict(),bs=chunkDPD6ZWL2_js.a(e=>({objectName:e.objectName,viewName:e.newName}),"renameViewFocus"),um={type:"rename_view",schema:Rs,focus:bs,presentation:V(bs,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Rename view ${e.viewName} to ${e.newName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>t.newName===r.name?r:(r.authoring.origin==="code"&&pe(["newName"],"Source-owned API names must be changed in their declaration"),e.views.some(o=>o.object===t.objectName&&o.name===t.newName)&&pe(["newName"],"View API name is already used"),{...r,name:t.newName,revision:r.revision+1})),"apply")},Cs=Kn.z.object({...Mt,type:Kn.z.literal("rename_view_content"),newName:Is}).strict(),gs=chunkDPD6ZWL2_js.a(e=>({...We(e),contentName:e.newName}),"renameContentFocus"),lm={type:"rename_view_content",schema:Cs,focus:gs,presentation:V(gs,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Rename content ${e.contentName} to ${e.newName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{let o=Ge(r,t.contentName);if(t.newName===t.contentName)return r;o.sourceDefinition!==null&&pe(["newName"],"Source-owned API names must be changed in their declaration"),Object.hasOwn(r.authoring.contents,t.newName)&&pe(["newName"],"Content API name is already used");let a=r.contentIds[t.contentName],s=r.contentRevisions[t.contentName];return delete r.authoring.contents[t.contentName],delete r.contentIds[t.contentName],delete r.contentRevisions[t.contentName],r.authoring.contents={...r.authoring.contents,[t.newName]:o},{...r,revision:r.revision+1,contentIds:{...r.contentIds,[t.newName]:a},contentRevisions:{...r.contentRevisions,[t.newName]:s+1}}}),"apply")},vs=Kn.z.object({...Mt,type:Kn.z.literal("reset_view_content")}).strict(),dm={type:"reset_view_content",schema:vs,focus:_e,presentation:V(_e,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Reset ${e.contentName} to source`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{let o=Ge(r,t.contentName);return o.sourceDefinition===null&&pe(["contentName"],"Content has no source to reset to"),o.workspaceDefinition===null&&!o.suppressed&&o.workspacePosition===null?r:(o.workspaceDefinition=null,o.suppressed=false,o.workspacePosition=null,{...r,revision:r.revision+1,contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+1}})}),"apply")},Es=Kn.z.object({...Pt,type:Kn.z.literal("reset_view_order"),placement:Kn.z.enum(["main","aside"])}).strict(),pm={type:"reset_view_order",schema:Es,focus:We,presentation:V(We,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Reset ${e.placement} order`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ce(e,t,n,r=>{let o=t.placement==="main"?"mainOrderCustomized":"asideOrderCustomized";if(!r.authoring[o])return r;r.authoring[o]=false;for(let a of r.contents.filter(s=>s.placement===t.placement)){let s=Ge(r,a.name);s.sourceDefinition!==null&&(s.workspacePosition=null);}return {...r,revision:r.revision+1}}),"apply")},Gi=Kn.z.discriminatedUnion("type",[As,xs,Ts,ws,Ss,Rs,Cs,vs,Es]),gt=[im,om,am,sm,cm,um,lm,dm,pm];function Ns(e,t){return e.objects.find(n=>n.id===t)}chunkDPD6ZWL2_js.a(Ns,"findObject");var mm=new Set(["formula","rollup"]);function yt(e){return mm.has(e.attributeType)}chunkDPD6ZWL2_js.a(yt,"isComputedAttribute");var Ds={sum:"number",avg:"number",count:"number",countValues:"number",countUniqueValues:"number",countEmpty:"number",percentEmpty:"number",percentNotEmpty:"number",earliest:"date",latest:"date",original:"multiselect"};function fm(e){return typeof e=="string"&&e in Ds?Ds[e]:void 0}chunkDPD6ZWL2_js.a(fm,"rollupReturnTypeOf");function ks(e,t){let n=Ns(e,t);if(!n)throw new chunkJSKLP4GI_js.h(`Object "${t}" is not in the draftable state`,[]);return n}chunkDPD6ZWL2_js.a(ks,"requireObject");function Cn(e){return e.config??{}}chunkDPD6ZWL2_js.a(Cn,"configOf");function ee(e){let t=Cn(e).targets;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null&&typeof n.object=="string"):[]}chunkDPD6ZWL2_js.a(ee,"relationTargets");function ht(e){let t=ee(e).filter(n=>n.object!==ae);return t.length===1?t[0]?.object:void 0}chunkDPD6ZWL2_js.a(ht,"relationTargetObjectName");function bm(e){let t=Cn(e),n=e.attributeType,r={name:e.name,type:n,id:e.id},o=t.optionsSource;if(n==="relation"){let a=ht(e);return {...r,...t.cardinality==="one"||t.cardinality==="many"?{cardinality:t.cardinality}:{},...a===void 0?{}:{targetObjectName:a},targets:ee(e)}}if(n==="formula")return {...r,...t.returnType===void 0?{}:{returnType:t.returnType},...o===void 0?{}:{optionsSource:o}};if(n==="rollup"){let a=fm(t.function);return {...r,...a===void 0?{}:{returnType:a},...o===void 0?{}:{optionsSource:o}}}return n==="select"||n==="status"||n==="multiselect"?{...r,...Array.isArray(t.options)?{options:t.options}:{}}:r}chunkDPD6ZWL2_js.a(bm,"toCompileAttribute");function Os(e,t){return {objectName:e.name,attributes:t.filter(n=>n.objectId===e.id).map(bm)}}chunkDPD6ZWL2_js.a(Os,"toCompileObject");function Ki(e,t){let n=ks(e,t);return {...Os(n,e.attributes),relatedObjects:Object.fromEntries(e.objects.map(r=>[r.name,Os(r,e.attributes)]))}}chunkDPD6ZWL2_js.a(Ki,"computedCompileSchemaOf");function gm(e){return {id:e.id,name:e.name,label:e.label,type:"rollup",...Cn(e)}}chunkDPD6ZWL2_js.a(gm,"toRollupAttribute");function js(e){try{return e()}catch(t){throw t instanceof S?new chunkJSKLP4GI_js.h(t.message,[]):t}}chunkDPD6ZWL2_js.a(js,"asValidationError");function vn(e,t){let n=Ki(e,t.objectId);return js(()=>_s(t,n))}chunkDPD6ZWL2_js.a(vn,"computedPlanOf");function _s(e,t){if(e.attributeType==="rollup")return Pa(gm(e),t);let n=Cn(e);return bn({attributeName:e.name,expression:String(n.expression??""),returnType:n.returnType,schema:t})}chunkDPD6ZWL2_js.a(_s,"compilePlan");function Yi(e){js(()=>Oa(e.map(t=>({attributeName:t.attributeName,dependencies:t.dependencies}))));}chunkDPD6ZWL2_js.a(Yi,"assertAcyclicComputed");function ym(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(ym,"dependencyNames");function Ft(e,t){let n=Ki(e,t),r=[];for(let o of e.attributes)if(!(o.objectId!==t||!yt(o)))try{r.push(_s(o,n));}catch(a){if(!(a instanceof S))throw a}return r}chunkDPD6ZWL2_js.a(Ft,"compilablePlansOf");function Hi(e,t,n){let r=ks(e,t),o=[];for(let a of Ft(e,t))a.attributeName!==n&&a.dependencies.some(s=>ym(s,n))&&o.push(a.attributeName);for(let a of e.objects)if(a.id!==t)for(let s of Ft(e,a.id))s.dependencies.some(u=>{if(u.kind!=="relation"||u.targetAttributeName!==n)return false;let d=e.attributes.find(f=>f.objectId===a.id&&f.name===u.relationName&&f.attributeType==="relation");return d!==void 0&&ht(d)===r.name})&&o.push(`${a.name}.${s.attributeName}`);return o}chunkDPD6ZWL2_js.a(Hi,"dependentsOf");function Te(e){let t=e.config?.bilateral;if(typeof t!="object"||t===null)return;let{object:n,attribute:r}=t;return typeof n=="string"&&typeof r=="string"?{object:n,attribute:r}:void 0}chunkDPD6ZWL2_js.a(Te,"bilateralDeclarationOf");function hm(e,t){return t!==void 0&&e.attributeType===t.attributeType&&Am(e,t)}chunkDPD6ZWL2_js.a(hm,"sameAttribute");function Am(e,t){return JSON.stringify(e.config??{})===JSON.stringify(t.config??{})}chunkDPD6ZWL2_js.a(Am,"sameConfig");function xm(e,t){let n=chunkDPD6ZWL2_js.a(r=>hm(r,e.attributes.find(o=>o.id===r.id)),"untouched");for(let r of t.attributes){if(r.attributeType!=="relation")continue;let o=Te(r);if(o===void 0||n(r))continue;let s=t.objects.find(g=>g.id===r.objectId)?.name??r.objectId,c=t.objects.find(g=>g.name===o.object),u=t.attributes.find(g=>g.objectId===c?.id&&g.name===o.attribute),d=`relation "${s}.${r.name}" declares inverse "${o.object}.${o.attribute}"`;if(u===void 0)throw new chunkJSKLP4GI_js.h(`${d}, which object "${o.object}" does not have; draft it first`,[]);if(u.attributeType!=="relation")throw new chunkJSKLP4GI_js.h(`${d}, which is not a relation`,[]);let f=Te(u);if(!(ee(u).some(g=>g.object===s)&&(n(u)?f===void 0||f.object===s&&f.attribute===r.name:f?.object===s&&f.attribute===r.name)))throw new chunkJSKLP4GI_js.h(`${d}, which does not point back to "${s}.${r.name}"`,[])}}chunkDPD6ZWL2_js.a(xm,"assertBilateralPairs");var Tm=0x100000001b3n,wm=0xffffffffffffffffn;function Ps(e,t){let n=t;for(let r of new TextEncoder().encode(e))n^=BigInt(r),n=n*Tm&wm;return n}chunkDPD6ZWL2_js.a(Ps,"fnv1a64");function Ji(e,t){return En(t,e.toLowerCase())}chunkDPD6ZWL2_js.a(Ji,"viewIdFor");function En(e,t){let n=`${t}:${e}`,r=Ps(n,0xcbf29ce484222325n).toString(16).padStart(16,"0"),o=Ps(`${e}:${n}`,0x84222325cbf29ce4n).toString(16).padStart(16,"0"),a=r+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(En,"draftEntityIdFor");function Ke(e){return {list:Ji(e,"list"),detail:Ji(e,"detail")}}chunkDPD6ZWL2_js.a(Ke,"defaultViewIdsFor");function Qi(e,t,n,r){let a=r.filter(c=>c.objectId===n.id).filter(c=>chunkRPTKXZBV_js.j(Z(c)).presentation.formField).map(c=>({attribute:c.name})),s=e==="collection"?[{name:"all",type:"collection",placement:"main",label:"All",layout:"table",source:{object:n.name}}]:a.length?[{name:"form",type:"form",placement:"main",label:"Details",groups:[{name:"general",label:"General",fields:a}]}]:[{name:"activity",type:"activity",placement:"main",label:"Activity"}];return {id:t,object:n.name,name:e==="collection"?"default_list":"default_detail",label:n.label,context:e,default:true,contents:s,authoring:Dt(s),revision:1,contentIds:Object.fromEntries(s.map(c=>[c.name,JSON.stringify(["draft-content",t,c.name])])),contentRevisions:Object.fromEntries(s.map(c=>[c.name,1])),derived:true}}chunkDPD6ZWL2_js.a(Qi,"derivedView");function Xi(e,t){let n=Ke(e.id);return [Qi("collection",n.list,e,t),Qi("record",n.detail,e,t)]}chunkDPD6ZWL2_js.a(Xi,"defaultViewsFor");function Vt(e,t,n){return Qi(e.context,e.id,t,n)}chunkDPD6ZWL2_js.a(Vt,"regenerateDerived");function Zi(e){return e.attributeType==="relation"&&Z(e).metadata?.relationGenerated===true}chunkDPD6ZWL2_js.a(Zi,"isGeneratedDraftRelation");function Ms(e,t){let n=Te(t);if(!n)return [t];let r=e.objects.find(c=>c.id===t.objectId),o=e.objects.find(c=>c.name===n.object),a=e.attributes.find(c=>c.objectId===o?.id&&c.name===n.attribute);if(!a||a===t)return [t];let s=Te(a);return s&&s.object===r?.name&&s.attribute===t.name?[t,a]:[t]}chunkDPD6ZWL2_js.a(Ms,"pairedDraftAttributes");function eo(e,t,n,r,o=false){let a=Z(t),s=r&&Z(r),c=r&&Te(r),u=Te(t);if(c&&(c.object!==u?.object||c.attribute!==u?.attribute))throw new chunkJSKLP4GI_js.h("Changing a bilateral address requires removing the existing pair first",[]);if(a.type!=="relation"||!a.bilateral)return e;let d=e.objects.find(j=>j.id===t.objectId),f=e.objects.find(j=>j.name===a.bilateral?.object);if(!(d&&f))throw new chunkJSKLP4GI_js.h("Both objects must exist before materializing a relation pair",[]);let l=`${d.name}.${t.name}`,b=a.bilateral.attribute,g=`${f.name}.${b}`,y=e.attributes.find(j=>j.objectId===f.id&&j.name===b),h=s?.metadata?.relationPairId,x=typeof h=="string"?h:En("relation-pair",`${n}:${t.id}`),k=[l,g].sort(),E=typeof h=="string"?{id:x,addresses:k,ownerAddress:s?.type==="relation"&&s.bilateral?.storageOwner===false?g:l,generatedAddresses:[],...l===g?{symmetric:true}:{}}:void 0,M=[...new Map([d,f].map(j=>[j.id,j])).values()].map(j=>({name:j.name,attributes:[t,...y&&y.id!==t.id?[y]:[]].filter(P=>P.objectId===j.id).map(Z)})),B=Vi({objects:M,existingPairs:E?[E]:[],...r&&!o?{explicitAddresses:[l],propertyEditAddresses:[l]}:{},nextPairId:chunkDPD6ZWL2_js.a(()=>x,"nextPairId")}),Qe=new Map;for(let j of B.objects){let P=j.name===d.name?d.id:f.id;for(let oe of j.attributes){let te=e.attributes.find(zt=>zt.objectId===P&&zt.name===oe.name),we=te?.id===t.id?r??te:te,ac={...Sm(oe,te&&Z(te)),metadata:{...oe.metadata,...we&&Zi(we)&&!(o&&te?.id===t.id)||!te?{relationGenerated:true}:{}},id:te?.id??En("relation-attribute",`${x}:${P}:${oe.name}`),...te?{}:{order:e.attributes.filter(zt=>zt.objectId===P).length}};Qe.set(`${P}.${oe.name}`,Ui(ac,P));}}let Y=e.attributes.map(j=>{let P=`${j.objectId}.${j.name}`,oe=Qe.get(P);return Qe.delete(P),oe??j});return Y.push(...Qe.values()),{...e,attributes:Y,views:e.views.map(j=>{let P=[d,f].find(oe=>oe.name===j.object);return j.derived&&P?Vt(j,P,Y):j})}}chunkDPD6ZWL2_js.a(eo,"reconcileDraftRelationAttribute");function Sm(e,t){if(e.type!=="relation"||!e.bilateral||t?.type!=="relation"||!t.bilateral)return e;let{label:n,cardinality:r,...o}=e.bilateral;return {...e,bilateral:{...o,...t.bilateral.label===void 0?{}:{label:n},...t.bilateral.cardinality===void 0?{}:{cardinality:r}}}}chunkDPD6ZWL2_js.a(Sm,"preserveDeclarationHints");var Fs={id:Kn.z.string().min(1)};function Pe(e,t){let n=e.objects.find(r=>r.id===t);if(!n)throw new chunkJSKLP4GI_js.h(`Object "${t}" is not in the draftable state`,[]);return n}chunkDPD6ZWL2_js.a(Pe,"requireObject");function to(e,t,n){return {...e,attributes:[...n],views:e.views.map(r=>r.derived&&r.object===t.name?Vt(r,t,n):r)}}chunkDPD6ZWL2_js.a(to,"withDerivedViews");function Nn(e){return {objectId:e.objectId}}chunkDPD6ZWL2_js.a(Nn,"objectFocus");function Dn(e){return {objectId:e.objectId,recordId:e.recordId}}chunkDPD6ZWL2_js.a(Dn,"recordFocus");function Vs(e){return {objectId:e.objectId,attributeName:e.name}}chunkDPD6ZWL2_js.a(Vs,"attributeFocus");function On(e){return {objectId:e.objectId,attributeName:e.attribute}}chunkDPD6ZWL2_js.a(On,"existingAttributeFocus");function Rm(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(Rm,"firstChangedProperty");function Cm(e,t){if(!e.derived)for(let n of e.contents){if(n.type==="collection"&&(n.columns?.includes(t)||n.displayAttributes?.includes(t)||n.sorts?.some(r=>r.attribute===t)))return `content "${n.name}"`;if(n.type==="form"&&n.groups.some(r=>r.fields.some(o=>o.attribute===t)))return `content "${n.name}"`;if(n.type==="richtext"&&(n.attribute===t||n.titleAttribute===t))return `content "${n.name}"`}}chunkDPD6ZWL2_js.a(Cm,"handShapedUse");function vm(e,t,n){let r=n.config??{},o=n.name;if(r.relationPath!==void 0)throw new chunkJSKLP4GI_js.h(`rollup "${o}": relationPath is not supported yet`,[]);let a=r.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(l=>l.objectId===t.id&&l.name===a&&l.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 c=ht(s);if(c===void 0){let l=ee(s).filter(b=>b.object!=="*").length;throw new chunkJSKLP4GI_js.h(`rollup "${o}" needs a relation with one target object; "${a}" targets ${l}`,[])}if(r.function==="count")return;let u=e.objects.find(l=>l.name===c),d=r.targetAttribute;if(!(u!==void 0&&e.attributes.some(l=>l.objectId===u.id&&l.name===d)))throw new chunkJSKLP4GI_js.h(`rollup "${o}" targets attribute "${d}", which object "${c}" does not have`,[])}chunkDPD6ZWL2_js.a(vm,"assertRollupShape");function Em(e,t){let n=e.config??{};if(e.attributeType==="rollup")return n.relationAttribute===t;let r=typeof n.expression=="string"?n.expression:"";return new RegExp(`(^|[^A-Za-z0-9_])${t}\\.`).test(r)}chunkDPD6ZWL2_js.a(Em,"traversesRelation");function Ls(e,t){let n=Pe(e,t.objectId);if(t.attributeType==="relation"){for(let o of ee(t))if(o.object!==ae&&!e.objects.some(a=>a.name===o.object))throw new chunkJSKLP4GI_js.h(`object "${o.object}" is unknown; create it first`,[]);let r=Te(t)?.object;if(r!==void 0&&r!==ae&&!e.objects.some(o=>o.name===r))throw new chunkJSKLP4GI_js.h(`object "${r}" is unknown; create it first`,[]);for(let o of e.attributes)o.objectId!==t.objectId||!yt(o)||Em(o,t.name)&&vn(e,o);}else if(yt(t))t.attributeType==="rollup"&&vm(e,n,t),vn(e,t);else return;Yi(Ft(e,t.objectId));}chunkDPD6ZWL2_js.a(Ls,"assertConfigFolds");var Ye={...Fs,objectId:Kn.z.string().uuid()},Nm=Kn.z.object({...Ye,type:Kn.z.literal("add_object"),name:tn,label:Kn.z.string().min(1),icon:Kn.z.string().min(1).optional()}),Dm={type:"add_object",schema:Nm,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(e.objects.some(r=>r.name===t.name))throw new chunkJSKLP4GI_js.h(`Object "${t.name}" already exists`,[]);if(e.objects.some(r=>r.id===t.objectId))throw new chunkJSKLP4GI_js.h(`Object id "${t.objectId}" is already taken`,[]);let n={id:t.objectId,name:t.name,label:t.label,...t.icon===void 0?{}:{icon:t.icon}};return {...e,objects:[...e.objects,n],views:[...e.views,...Xi(n,e.attributes)]}},"apply"),focus:Nn,presentation:V(Nn,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Cr\xE9e l'objet \xAB ${e.label} \xBB`,"describe")},Om=Kn.z.object({...Ye,type:Kn.z.literal("update_object"),changes:Kn.z.object({label:Kn.z.string().min(1).optional(),icon:Kn.z.string().min(1).optional()}).refine(e=>Object.keys(e).length>0,"update_object needs at least one change")}),Bs=chunkDPD6ZWL2_js.a(e=>({objectId:e.objectId}),"updateObjectFocus"),km={type:"update_object",schema:Om,apply:chunkDPD6ZWL2_js.a((e,t)=>(Pe(e,t.objectId),{...e,objects:e.objects.map(n=>n.id===t.objectId?{...n,...t.changes}:n)}),"apply"),focus:Bs,presentation:V(Bs,"atomic",Rm),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'objet en \xAB ${e.changes.label} \xBB`:"Modifie l'objet","describe")},jm=Kn.z.object({...Ye,type:Kn.z.literal("remove_object")}),_m={type:"remove_object",schema:jm,apply:chunkDPD6ZWL2_js.a((e,t)=>{Pe(e,t.objectId);let n=e.objects.find(r=>r.id===t.objectId)?.name;for(let r of e.attributes){if(r.objectId===t.objectId||r.attributeType!=="relation"||!ee(r).some(a=>a.object===n))continue;let o=e.objects.find(a=>a.id===r.objectId);throw new chunkJSKLP4GI_js.h(`object "${n}" is targeted by attribute "${o?.name}.${r.name}"; remove that attribute first`,[])}return {...e,objects:e.objects.filter(r=>r.id!==t.objectId),attributes:e.attributes.filter(r=>r.objectId!==t.objectId),sampleRecords:e.sampleRecords.filter(r=>r.objectId!==t.objectId),views:e.views.filter(r=>r.object!==n)}},"apply"),focus:Nn,presentation:V(Nn,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'objet ${e.objectId}`,"describe")},$s=Ht;function Us(e,t){try{chunkHRX4YCKZ_js.n(e,t);}catch(n){throw n instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(n.message,n.errors.map(r=>({...r,path:["config",...r.path??[]]}))):n}}chunkDPD6ZWL2_js.a(Us,"assertConfigParses");var Pm=Kn.z.object({...Ye,type:Kn.z.literal("add_attribute"),attributeId:Kn.z.string().min(1),name:Yn,label:Kn.z.string().min(1),attributeType:Kn.z.enum($s),config:Kn.z.record(Kn.z.string(),Kn.z.unknown()).optional()}).superRefine((e,t)=>{try{Us(e.attributeType,e.config??{});}catch(n){if(n instanceof chunkJSKLP4GI_js.h){for(let r of n.errors)t.addIssue({code:"custom",message:r.message,path:[...r.path]});return}throw n}}),Mm={type:"add_attribute",schema:Pm,apply:chunkDPD6ZWL2_js.a((e,t)=>{let n=Pe(e,t.objectId),r=e.attributes.find(c=>c.objectId===t.objectId&&c.name===t.name);if(r&&!Zi(r))throw new chunkJSKLP4GI_js.h(`Attribute "${t.name}" already exists on object "${t.objectId}"`,[]);let o={id:r?.id??t.attributeId,objectId:t.objectId,name:t.name,label:t.label,attributeType:t.attributeType,...t.config===void 0?{}:{config:t.config}};for(let c of e.sampleRecords)c.objectId===t.objectId&&Ws(c.id,o,c.values);let a=r?e.attributes.map(c=>c===r?o:c):[...e.attributes,o],s=to(e,n,a);return Ls(s,o),eo(s,o,t.id,r,true)},"apply"),focus:Vs,presentation:V(Vs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'attribut \xAB ${e.label} \xBB`,"describe")},qs={...Ye,attribute:Yn};function zs(e,t,n,r){let o=Pe(e,t);if(n===void 0)throw new chunkJSKLP4GI_js.h(`${r} 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===n);if(!a)throw new chunkJSKLP4GI_js.h(`Attribute "${n}" is not on object "${t}"`,[]);return {object:o,attribute:a}}chunkDPD6ZWL2_js.a(zs,"requireAttribute");var Fm=Kn.z.object({...qs,type:Kn.z.literal("update_attribute"),changes:Kn.z.object({label:Kn.z.string().min(1).optional(),config:Kn.z.record(Kn.z.string(),Kn.z.unknown()).optional()}).refine(e=>Object.keys(e).length>0,"update_attribute needs at least one change")}),Vm={type:"update_attribute",schema:Fm,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{object:n,attribute:r}=zs(e,t.objectId,t.attribute,"update_attribute");t.changes.config!==void 0&&Us(r.attributeType,t.changes.config);let o={...r,...t.changes},a=e.attributes.map(c=>c===r?o:c),s=to(e,n,a);return Ls(s,o),eo(s,o,t.id,r)},"apply"),focus:On,presentation:V(On,"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")},Bm=Kn.z.object({...qs,type:Kn.z.literal("remove_attribute")}),Lm={type:"remove_attribute",schema:Bm,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{attribute:n}=zs(e,t.objectId,t.attribute,"remove_attribute"),r=Ms(e,n);for(let s of r){let c=Pe(e,s.objectId),[u]=Hi(e,s.objectId,s.name);if(u!==void 0)throw new chunkJSKLP4GI_js.h(`attribute "${s.name}" is used by "${u}"; remove that first`,[]);for(let f of e.views){if(f.object!==c.name)continue;let l=Cm(f,s.name);if(l!==void 0)throw new chunkJSKLP4GI_js.h(`attribute "${s.name}" is used by view "${f.id}" (${l}); remove it from the view first`,[])}let d=e.sampleRecords.find(f=>f.objectId===s.objectId&&s.name in f.values);if(d)throw new chunkJSKLP4GI_js.h(`Attribute "${s.name}" is still used by sample record "${d.id}"`,[])}let o=e.attributes.filter(s=>!r.includes(s)),a={...e,views:e.views.map(s=>s)};return r.reduce((s,c)=>to(s,Pe(e,c.objectId),o),a)},"apply"),focus:On,presentation:V(On,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'attribut \xAB ${e.attribute} \xBB`,"describe")};function $m(e,t,n,r){let o=Z(n);try{chunkIBM4ID4Y_js.c(o);}catch{return}let a=chunkIBM4ID4Y_js.g(o,r);if(a.success)return;let s=a.errors??[],c=s.map(u=>u.path.length>1?`${u.path.join(".")}: ${u.message}`:u.message).join(", ");throw new chunkJSKLP4GI_js.h(`Sample record "${e}" has an invalid value for "${t}": ${c}`,s.map(u=>({path:u.path,message:u.message})))}chunkDPD6ZWL2_js.a($m,"assertSampleValue");function Ws(e,t,n){if(t.config?.required===true&&t.config?.defaultValue===void 0&&!(t.name in n&&n[t.name]!==void 0))throw new chunkJSKLP4GI_js.h(`Sample record "${e}" is missing a value for required attribute "${t.name}"`,[])}chunkDPD6ZWL2_js.a(Ws,"assertRequiredCovered");function no(e){return (Array.isArray(e)?e:[e]).flatMap(n=>{if(typeof n=="string")return [n];if(typeof n=="object"&&n!==null){let r=n.id;if(typeof r=="string")return [r]}return []})}chunkDPD6ZWL2_js.a(no,"relationValueIds");function Um(e,t,n,r){n.attributeType!=="relation"||r===void 0||r===null||qm(e,t,ht(n),r);}chunkDPD6ZWL2_js.a(Um,"assertUnknownSampleReference");function qm(e,t,n,r){let o=e.objects.find(s=>s.name===n);if(!o)return;let a=e.views.some(s=>s.id===Ke(o.id).list);for(let s of no(r)){let c=e.sampleRecords.find(d=>d.id===s);if(c?.objectId!==o.id&&(c!==void 0||a))throw new chunkJSKLP4GI_js.h(`sample record "${t}" references unknown sample "${s}"`,[])}}chunkDPD6ZWL2_js.a(qm,"assertSampleTarget");var zm=Kn.z.object({...Ye,type:Kn.z.literal("add_sample_record"),recordId:Kn.z.string().uuid(),values:Kn.z.record(Kn.z.string(),Kn.z.unknown()),publication:Kn.z.enum(["preview","requested-data"]).optional()}),Wm={type:"add_sample_record",schema:zm,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(Pe(e,t.objectId),e.sampleRecords.some(r=>r.id===t.recordId))throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" already exists`,[]);let n=new Map(e.attributes.filter(r=>r.objectId===t.objectId).map(r=>[r.name,r]));for(let[r,o]of Object.entries(t.values)){let a=n.get(r);if(!a)throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" uses unknown attribute "${r}"`,[]);if(yt(a))throw new chunkJSKLP4GI_js.h(`attribute "${a.name}" is computed and cannot be set on a sample record`,[]);Um(e,t.recordId,a,o),$m(t.recordId,r,a,o);}for(let r of n.values())Ws(t.recordId,r,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:Dn,presentation:V(Dn,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Ajoute un exemple","describe")};function Gm(e,t){return new Set([...e.attributes.filter(n=>n.objectId===t&&n.attributeType==="relation").map(n=>n.name)])}chunkDPD6ZWL2_js.a(Gm,"relationNamesOf");function Km(e,t){for(let n of e.sampleRecords){if(n.id===t)continue;let r=Gm(e,n.objectId);for(let[o,a]of Object.entries(n.values))if(r.has(o)&&no(a).includes(t))throw new chunkJSKLP4GI_js.h(`sample record "${t}" is referenced by sample record "${n.id}"; remove that first`,[])}}chunkDPD6ZWL2_js.a(Km,"assertSampleNotReferenced");var Ym=Kn.z.object({...Ye,type:Kn.z.literal("remove_sample_record"),recordId:Kn.z.string().min(1)}),Hm={type:"remove_sample_record",schema:Ym,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(!e.sampleRecords.some(n=>n.id===t.recordId&&n.objectId===t.objectId))throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" is not in object "${t.objectId}"`,[]);return Km(e,t.recordId),{...e,sampleRecords:e.sampleRecords.filter(n=>n.id!==t.recordId)}},"apply"),focus:Dn,presentation:V(Dn,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Retire un exemple","describe")},At=[Dm,km,_m,Mm,Vm,Lm,Wm,Hm];function Jm(){let e=new Map;for(let t of [...At,...gt]){if(e.has(t.type))throw new chunkJSKLP4GI_js.r("architect operation",t.type);e.set(t.type,t);}return e}chunkDPD6ZWL2_js.a(Jm,"build");var Bt=Jm(),Qm=[...Bt.keys()];function Lt(e){let t=Bt.get(e.type);if(!t)throw new chunkJSKLP4GI_js.h(`Operation "${e.id}" has unknown type "${e.type}"`,[]);return t}chunkDPD6ZWL2_js.a(Lt,"defOf");function ro(e,t,n={extensions:[]}){return t.reduce((r,o)=>Lt(o).apply(r,o,n),e)}chunkDPD6ZWL2_js.a(ro,"applyOperations");function io(e){return Lt(e).focus(e)}chunkDPD6ZWL2_js.a(io,"focusOf");function Xm(e,t){return e.map(n=>Lt(n).describe(n,t))}chunkDPD6ZWL2_js.a(Xm,"describeOperations");function Zm(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 n=Bt.get(t);if(!n)throw new chunkJSKLP4GI_js.h(`Unknown operation type "${t}"`,[]);let r=n.schema.safeParse(e);if(!r.success)throw new chunkJSKLP4GI_js.h(`Operation "${t}" is invalid: ${r.error.issues.map(o=>`${o.path.join(".")} ${o.message}`).join("; ")}`,[]);return r.data}chunkDPD6ZWL2_js.a(Zm,"parseOperation");var $t=chunkDPD6ZWL2_js.a(e=>Kn.z.tuple([Kn.z.literal(e),Kn.z.string()]),"pair"),ef=Kn.z.union([Kn.z.tuple([Kn.z.literal("content"),Kn.z.string(),Kn.z.string(),Kn.z.string()]),Kn.z.tuple([Kn.z.literal("view"),Kn.z.string(),Kn.z.string()]),Kn.z.tuple([Kn.z.literal("attribute"),Kn.z.string(),Kn.z.string()]),Kn.z.tuple([Kn.z.literal("sample"),Kn.z.string(),Kn.z.string()]),$t("object"),$t("object-name"),$t("object-schema"),$t("object-tree"),$t("attribute-id")]);function Ut(e){return e.viewName&&e.objectName?JSON.stringify(e.contentName?["content",e.objectName,e.viewName,e.contentName]:["view",e.objectName,e.viewName]):e.attributeName&&e.objectId?JSON.stringify(["attribute",e.objectId,e.attributeName]):e.attributeId?JSON.stringify(["attribute-id",e.attributeId]):e.recordId&&e.objectId?JSON.stringify(["sample",e.objectId,e.recordId]):e.objectId?JSON.stringify(["object",e.objectId]):e.objectName?JSON.stringify(["object-name",e.objectName]):null}chunkDPD6ZWL2_js.a(Ut,"proposalTargetKey");function Gs(e,t,n,r){if(n&&typeof n=="object")if("source"in n&&n.source&&typeof n.source=="object"){let o=Ur(n.source);if(o&&o.kind!=="related"&&r(o.object),o?.kind==="related"){let a=o.relation;r(t);let s=e.objects.find(u=>u.name===t),c=e.attributes.find(u=>u.objectId===s?.id&&u.name===a);if(c?.attributeType==="relation"&&Array.isArray(c.config?.targets))for(let u of c.config.targets)u&&typeof u.object=="string"&&u.object!=="*"&&r(u.object);}}else "type"in n&&n.type==="forms"?r("objectName"in n&&typeof n.objectName=="string"?n.objectName:t):"type"in n&&["form","richtext","emails","meetings","documents"].includes(String(n.type))&&r(t);}chunkDPD6ZWL2_js.a(Gs,"addContentDependencies");function tf(e,t,n,r,o){if(["add_attribute","update_attribute","remove_attribute"].includes(t.type)){let a=e.attributes.find(c=>c.objectId===n.objectId&&c.name===n.attributeName),s=r&&typeof r=="object"&&"bilateral"in r?r.bilateral:a?.config?.bilateral;if((t.attributeType==="relation"||a?.attributeType==="relation")&&s&&typeof s=="object"&&"object"in s&&typeof s.object=="string"){n.objectId&&o("object-tree",n.objectId);let c=e.objects.find(u=>u.name===s.object);c?o("object-tree",c.id):o("object-name",s.object);}}}chunkDPD6ZWL2_js.a(tf,"addBilateralDependencies");function nf(e,t){let n=new Set,r=chunkDPD6ZWL2_js.a((...a)=>n.add(JSON.stringify(a)),"add"),o=chunkDPD6ZWL2_js.a(a=>{let s=e.objects.find(c=>c.name===a);s?r("object-schema",s.id):r("object-name",a);},"schemaFor");for(let a of t){let s=io(a);if(a.type==="rename_view"||a.type==="rename_view_content"){let f=Gi.parse(a),l=Ut({objectName:f.objectName,viewName:f.viewName,...f.type==="rename_view_content"?{contentName:f.contentName}:{}});l&&n.add(l);}let c=Ut(s);if(c&&n.add(c),s.viewName&&s.objectName){a.type!=="replace_view_content"&&r("view",s.objectName,s.viewName);let f=e.objects.find(l=>l.name===s.objectName);if(f?r("object",f.id):r("object-name",s.objectName),Gs(e,s.objectName,a.definition??a.content,o),a.type==="reset_view_content"&&typeof a.contentName=="string"){let l=e.views.find(b=>b.object===a.objectName&&b.name===a.viewName);Gs(e,s.objectName,l?.authoring.contents[a.contentName]?.sourceDefinition,o);}}s.objectId&&r("object",s.objectId),s.objectId&&(a.type==="remove_object"||a.type.includes("sample_record"))&&r("object-tree",s.objectId),a.type==="add_object"&&typeof a.name=="string"&&r("object-name",a.name);let u=a.changes&&typeof a.changes=="object"?a.changes:null,d=a.type==="add_attribute"?a.config:u&&"config"in u?u.config:null;if(tf(e,a,s,d,r),d&&typeof d=="object"&&"targets"in d&&Array.isArray(d.targets))for(let f of d.targets)f&&typeof f.object=="string"&&f.object!=="*"&&r("object-name",f.object);}return [...n]}chunkDPD6ZWL2_js.a(nf,"requiredTargetKeys");function rf(e,t){return Object.fromEntries(t.map(n=>[n,chunkRTHLB6T6_js.b(kn(e,n))]))}chunkDPD6ZWL2_js.a(rf,"targetTokensFor");function kn(e,t){let n;try{n=JSON.parse(t);}catch{throw new chunkJSKLP4GI_js.h(`Invalid proposal target key "${t}"`,[])}let r=ef.safeParse(n);if(!r.success)throw new chunkJSKLP4GI_js.h(`Invalid proposal target key "${t}"`,[]);let[o,a,s,c]=r.data,u=e.objects.find(l=>l.id===a);if(o==="object")return u??null;if(o==="object-name")return e.objects.find(l=>l.name===a)??null;if(o==="attribute-id")return e.attributes.find(l=>l.id===a)??null;if(o==="attribute")return e.attributes.find(l=>l.objectId===a&&l.name===s)??null;if(o==="sample")return e.sampleRecords.find(l=>l.objectId===a&&l.id===s)??null;if(o==="object-schema"||o==="object-tree"){if(!u)return null;let l=e.attributes.filter(b=>b.objectId===a);return o==="object-schema"?{object:u,attributes:l.toSorted((b,g)=>b.name.localeCompare(g.name))}:{object:u,attributes:l,views:e.views.filter(b=>b.object===u.name),sampleRecords:e.sampleRecords.filter(b=>b.objectId===a)}}let d=e.views.find(l=>l.object===a&&l.name===s);if(!d)return null;if(o==="view")return {id:d.id,revision:d.revision,definition:{...bt(d),contents:d.contents.map(({name:l,placement:b})=>({name:l,placement:b}))}};let f=d.contents.find(l=>l.name===c);return c!==void 0&&Object.hasOwn(d.contentIds,c)?{id:d.contentIds[c],revision:d.contentRevisions[c],definition:f??null}:null}chunkDPD6ZWL2_js.a(kn,"targetSnapshot");function qt(e){return Lt(e).presentation(e)}chunkDPD6ZWL2_js.a(qt,"presentationOf");function of(e){let t=e.map(qt);return new Set(t.map(({focus:r})=>r.viewName?JSON.stringify([r.objectName,r.viewName]):r.objectId).filter(r=>r!==void 0)).size>1||t.some(({impact:r})=>r==="structural")?"structural":t.some(({impact:r})=>r==="local")?"local":"atomic"}chunkDPD6ZWL2_js.a(of,"episodeImpactOf");function Ks(e,t){let n=Ut(t);return n===null?null:kn(e,n)}chunkDPD6ZWL2_js.a(Ks,"snapshotArchitectTarget");function af(e,t,n={extensions:[]}){let r=e;return t.map(o=>{let a=qt(o),s=Ks(r,a.focus);r=ro(r,[o],n);let c=Ks(r,a.focus);return {operationId:o.id,operationType:o.type,presentation:a,before:s,after:c}})}chunkDPD6ZWL2_js.a(af,"deriveArchitectChanges");var me=Kn.z.string().min(1),sf=Kn.z.union([Kn.z.object({objectName:me,viewName:me,contentName:me.optional()}).strict(),Kn.z.object({objectId:me}).strict(),Kn.z.object({objectName:me}).strict(),Kn.z.object({objectId:me,attributeName:me}).strict(),Kn.z.object({objectId:me,attributeId:me}).strict(),Kn.z.object({objectId:me,recordId:me}).strict()]);function cf(e){let t=sf.safeParse(e);if(!t.success)throw new chunkJSKLP4GI_js.h("Invalid scoped target",[{path:["target"],message:"Expected exactly one named target branch"}]);return t.data}chunkDPD6ZWL2_js.a(cf,"parseNamedTarget");var Hs=Kn.z.object({type:Kn.z.literal("remove_operation"),operationId:Kn.z.string().min(1).describe("The id of a stored operation to drop from the draft")});function Js(e,t=[]){return [...e.map(n=>n.schema),...t].map(lf)}chunkDPD6ZWL2_js.a(Js,"membersOf");function jn(e){return Kn.z.discriminatedUnion("type",e)}chunkDPD6ZWL2_js.a(jn,"unionOf");function uf(e){return e instanceof Kn.z.ZodString&&e.format==="uuid"}chunkDPD6ZWL2_js.a(uf,"isUuidString");function lf(e){let t={};for(let[n,r]of Object.entries(e.shape)){if(!uf(r))continue;let o=Kn.z.string().min(1);t[n]=r.description===void 0?o:o.describe(r.description);}return Object.keys(t).length===0?e:e.safeExtend(t)}chunkDPD6ZWL2_js.a(lf,"relaxUuidKeys");var df={add_object:["objectId"],add_sample_record:["recordId"]};function Ys(e){let t={};for(let n of df[e.shape.type.value]??[]){let r=e.shape[n];r instanceof Kn.z.ZodString&&(t[n]=r.optional());}return Object.keys(t).length===0?e:e.safeExtend(t)}chunkDPD6ZWL2_js.a(Ys,"relaxMintedKeys");var Qs=Js(At,[Hs]),Xs=Js(gt),Zs=jn(Qs),ec=jn(Xs),pf={schema:Zs,view:ec},mf={schema:jn(Qs.map(Ys)),view:jn(Xs.map(Ys))},ff=new Map([...At.map(e=>[e.type,"schema"]),["remove_operation","schema"],...gt.map(e=>[e.type,"view"])]);function bf(e){return ff.get(e)??null}chunkDPD6ZWL2_js.a(bf,"familyOf");function _n(e,t,n){return e.views.filter(r=>r.object===t.name&&r.context===n)}chunkDPD6ZWL2_js.a(_n,"viewsOf");function nc(e,t){return _n(e,t,"collection").flatMap(n=>n.contents).filter(n=>n.type==="collection")}chunkDPD6ZWL2_js.a(nc,"collectionContentsOf");function rc(e,t){return e.attributes.filter(n=>n.objectId===t.id)}chunkDPD6ZWL2_js.a(rc,"ownAttributes");function gf(e){return chunkRPTKXZBV_js.j(Z(e)).presentation.tableCell}chunkDPD6ZWL2_js.a(gf,"isTableCell");function tc(e,t,n){return _n(e,t,"record").some(r=>r.contents.some(o=>o.type===n))}chunkDPD6ZWL2_js.a(tc,"hasRecordContent");function ic(e,t){return e===2&&t<=5}chunkDPD6ZWL2_js.a(ic,"isEdgePayload");function yf(e,t){let n=rc(e,t),r=n.filter(o=>o.attributeType==="relation");return ic(r.length,n.length)?!e.attributes.some(o=>o.attributeType==="relation"&&o.objectId!==t.id&&ee(o).some(a=>a.object===t.name)):false}chunkDPD6ZWL2_js.a(yf,"looksLikeEdge");function hf(e,t,n){return _n(e,n,"record").some(r=>r.contents.some(o=>o.type==="collection"&&o.source.relation===t.name))}chunkDPD6ZWL2_js.a(hf,"reciprocalExists");function Af(e,t){let n=[],r=t?e.objects.filter(o=>t.has(o.id)):e.objects;for(let o of r){if(yf(e,o)){n.push(`Object "${o.label}" is an edge (two relations plus scalars): qualify a relation with config.properties.definitions instead of an object.`);continue}let a=nc(e,o);a.length===0&&n.push(`Object "${o.label}" has no collection content: add_view_content.`);for(let s of rc(e,o))if(gf(s)&&a.length&&!a.some(c=>c.columns===void 0||c.columns.includes(s.name))&&n.push(`Attribute "${s.label}" on "${o.label}" is in no collection column set: replace_view_content.`),s.attributeType==="document"&&!tc(e,o,"documents")&&n.push(`Object "${o.label}" has no documents content: add_view_content.`),s.attributeType==="relation")for(let{object:c}of ee(s)){let u=e.objects.find(d=>d.name===c);u&&!hf(e,s,u)&&n.push(`Relation "${s.label}" on "${o.label}" has no reciprocal collection on "${u.label}": add_view_content with source.relation.`);}_n(e,o,"record").length&&!tc(e,o,"activity")&&n.push(`Object "${o.label}" has no activity content on its record view: add_view_content.`),a.length===1&&n.push(`Object "${o.label}" has a single collection content; a person would add one to three that answer a question: add_view_content.`);}return n}chunkDPD6ZWL2_js.a(Af,"stillMissing");function xf(e,t){let n=new Set(t.flatMap(r=>r.type==="add_attribute"&&typeof r.attributeId=="string"?[r.attributeId]:[]));return e.attributes.filter(r=>n.has(r.id))}chunkDPD6ZWL2_js.a(xf,"addedAttributes");function Tf(e,t){let n={next:[],needsColumns:[],regenerated:[]},r=new Set;for(let o of xf(e,t)){let a=e.objects.find(d=>d.id===o.objectId);if(!a)continue;let s=e.views.filter(d=>d.object===a.name);if(!r.has(a.id)){r.add(a.id);for(let d of s.filter(f=>f.derived))for(let f of d.contents)n.regenerated.push(`${d.name}.${f.name}`);}for(let d of s.filter(f=>!f.derived&&f.context==="collection"))for(let f of d.contents)f.type==="collection"&&f.columns!==void 0&&!f.columns.includes(o.name)&&n.needsColumns.push({view:d.name,content:f.name,attribute:o.name});let c=s.some(d=>d.context==="record"&&d.contents.some(f=>f.type==="documents")),u=s.find(d=>d.context==="record");o.attributeType==="document"&&u&&!c&&n.next.push({type:"add_view_content",objectName:a.name,viewName:u.name,content:{name:"documents",type:"documents",placement:"aside",label:"Documents"},target:{end:true}});}return n}chunkDPD6ZWL2_js.a(Tf,"guidanceForBatch");function wf(e,t){let n=new Map(e.objects.map(o=>[o.name,o.id])),r=new Set;for(let o of t){let{focus:a}=qt(o),s=a.objectId??(a.objectName?n.get(a.objectName):void 0);s!==void 0&&r.add(s);}return r}chunkDPD6ZWL2_js.a(wf,"touchedObjectIds");function Sf(e){let t=e.config??{};if(e.attributeType==="relation")return `\u2192 ${ee(e).map(n=>n.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(Sf,"attributeDetail");function If(e){let t=e.config?.options,n=Sf(e);return {name:e.name,label:e.label,type:e.attributeType,...Array.isArray(t)?{options:t.map(r=>r.value)}:{},...n===void 0?{}:{detail:n}}}chunkDPD6ZWL2_js.a(If,"summarizeAttribute");function Rf(e,t,n){let r=Ke(e.id),o=n.some(a=>a.id===r.list);return {id:e.id,name:e.name,label:e.label,attributes:t.filter(a=>a.objectId===e.id).map(If),...o?{viewIds:r}:{}}}chunkDPD6ZWL2_js.a(Rf,"summarizeObject");function Cf(e,t){if(!t.some(n=>n.name===e.object))throw new chunkJSKLP4GI_js.h(`View "${e.name}" names an object outside the draft scope`,[]);return {id:e.id,name:e.name,context:e.context,objectName:e.object,label:e.label,derived:e.derived===true,contents:e.contents.map(({name:n,type:r,placement:o,label:a})=>({name:n,type:r,placement:o,label:a}))}}chunkDPD6ZWL2_js.a(Cf,"summarizeView");function vf(e,t){let n=new Map;for(let r of e.sampleRecords)n.set(r.objectId,(n.get(r.objectId)??0)+1);return {objects:e.objects.map(r=>Rf(r,e.attributes,e.views)),views:e.views.map(r=>Cf(r,e.objects)),sampleRecords:[...n.entries()].map(([r,o])=>({objectId:r,count:o})),operationCount:t}}chunkDPD6ZWL2_js.a(vf,"summarizeDraft");var Ef=["draft_schema"],Nf="publish_architect_draft",Df="discard_architect_draft",Of="request_design_review",kf="get_architect_draft";var ie=Kn.z.string().refine(e=>e.trim().length>0,"Must not be blank"),oc=Kn.z.union([Kn.z.tuple([Kn.z.literal("object"),ie]),Kn.z.tuple([Kn.z.literal("attribute"),ie,ie]),Kn.z.tuple([Kn.z.literal("view"),ie,ie]),Kn.z.tuple([Kn.z.literal("content"),ie,ie,ie])]),jf=Kn.z.object({label:ie,pluralLabel:Kn.z.string().optional(),description:Kn.z.string().optional(),icon:chunkHRX4YCKZ_js.c.optional(),labelExpression:Kn.z.string(),embeddingExpression:Kn.z.string().optional(),sealed:Kn.z.boolean().optional(),toleratedAttributes:Kn.z.array(ie).optional(),metadata:Kn.z.record(Kn.z.string(),Kn.z.unknown()).optional(),schema_version:Kn.z.number().int().nonnegative(),migrations:Kn.z.array(Kn.z.record(Kn.z.string(),Kn.z.unknown())),documentLayout:Kn.z.record(Kn.z.string(),Kn.z.unknown()).optional()}).strict();function Je(e){throw new chunkJSKLP4GI_js.h(e,[])}chunkDPD6ZWL2_js.a(Je,"failure");function _f(e){return Kn.z.custom(t=>{let n=Kn.z.record(Kn.z.string(),Kn.z.unknown()).parse(t);for(let r of e[0]==="view"?["object","name"]:["name"])Object.hasOwn(n,r)&&Je(`Invalid schema state: unrecognized definition key ${r}`);switch(e[0]){case "object":jf.parse(n);break;case "attribute":{let r=Kn.z.enum(Ht).parse(n.type);chunkHRX4YCKZ_js.k(r).extend({type:Kn.z.literal(r),label:ie,required:Kn.z.boolean().optional(),unique:Kn.z.boolean().optional(),icon:chunkHRX4YCKZ_js.c.optional()}).strict().parse(n);break}case "view":{let{contents:r,...o}=n,a=Kn.z.array(ie).parse(r);new Set(a).size!==a.length&&Je("Invalid schema state: duplicate content membership"),chunkRPTKXZBV_js.da.parse({...o,object:e[1],name:e[2],contents:[]});break}case "content":chunkRPTKXZBV_js.ca.parse({...n,name:e[3]});break}return true})}chunkDPD6ZWL2_js.a(_f,"definitionSchema");function Pn(e,t){let n=JSON.stringify(e.address),r=JSON.stringify(t.address);return n<r?-1:n>r?1:0}chunkDPD6ZWL2_js.a(Pn,"compareSchemaStateEntries");function Pf(e){return {modelVersion:1,hashVersion:1,entries:[...e].sort(Pn).filter(t=>t.source!==null).map(({address:t,source:n})=>({address:t,source:n}))}}chunkDPD6ZWL2_js.a(Pf,"schemaStateSourcePayload");function Mf(e){let t=Kn.z.record(Kn.z.string(),Kn.z.unknown()).parse(e);for(let[a,s]of [["modelVersion","model"],["hashVersion","hash"]])t[a]!==1&&Je(`Unsupported schema ${s} version: expected 1, received ${t[a]===void 0?"missing":String(t[a])}`);let n=Kn.z.object({modelVersion:Kn.z.literal(1),hashVersion:Kn.z.literal(1),tenant:ie,sourceFingerprint:Kn.z.string().regex(/^[a-f0-9]{64}$/),entries:Kn.z.array(Kn.z.unknown())}).strict().safeParse(e);if(!n.success){let a=n.error.issues.find(s=>s.code==="unrecognized_keys");throw a?.code==="unrecognized_keys"&&Je(`Invalid schema state: unrecognized key ${a.keys[0]}`),chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(s=>({path:s.path.map(String),message:s.message})))}let r=new Set,o=n.data.entries.map(a=>{let s=oc.parse(Kn.z.object({address:Kn.z.unknown()}).parse(a).address),c=JSON.stringify(s);r.has(c)&&Je(`Invalid schema state: duplicate address ${c}`),r.add(c);let u=_f(s).nullable(),d=s[0]==="object"||s[0]==="attribute"?Kn.z.object({id:Kn.z.string().uuid(),updatedAt:Kn.z.string().datetime()}).strict():Kn.z.object({id:Kn.z.string().uuid(),revision:Kn.z.number().int().nonnegative()}).strict(),f=Kn.z.object({address:oc,source:u,effective:u,status:Kn.z.enum(["source","runtime","copy","suppressed"]),sourceOwner:Kn.z.union([Kn.z.literal("core"),Kn.z.string().regex(/^(bundle|source):.+$/)]).nullable(),guard:d.nullable()}).strict().parse(a);(f.status==="runtime"&&(f.source!==null||f.effective===null||f.sourceOwner!==null)||f.status==="suppressed"&&(s[0]!=="content"||f.source===null||f.effective!==null||f.guard===null)||f.status==="copy"&&(f.source===null||f.effective===null)||f.effective!==null&&f.guard===null||f.source===null&&f.effective===null)&&Je(`Invalid schema state: inconsistent status at ${c}`);let l=f.sourceOwner;l!==null&&l!=="core"&&!l.startsWith("bundle:")&&!l.startsWith("source:")&&Je("Invalid source owner");let b=l===null||l==="core"?l:l.startsWith("bundle:")?`bundle:${l.slice(7)}`:`source:${l.slice(7)}`;return {...f,sourceOwner:b}});return {...n.data,entries:o.sort(Pn)}}chunkDPD6ZWL2_js.a(Mf,"parseState");function Ff(e){try{return Mf(e)}catch(t){throw t instanceof Kn.z.ZodError?chunkJSKLP4GI_js.h.fromZodErrors(t.issues.map(n=>({path:n.path.map(String),message:n.message}))):t}}chunkDPD6ZWL2_js.a(Ff,"parseSchemaState");function Vf(e){let t=[];for(let n of [...e.entries].sort(Pn)){let r=n.source===null?"added":n.status==="suppressed"?"suppressed":n.effective===null?"removed":chunkRTHLB6T6_js.b(n.source)!==chunkRTHLB6T6_js.b(n.effective)?"changed":n.status==="copy"?"copied":null;r&&t.push({...n,change:r});}return {modelVersion:1,tenant:e.tenant,sourceFingerprint:e.sourceFingerprint,changes:t}}chunkDPD6ZWL2_js.a(Vf,"diffSchemaState");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 chunkRPTKXZBV_js.i}});Object.defineProperty(exports,"LIST_VIEW_TAB_VISIBILITIES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.y}});Object.defineProperty(exports,"LOCATION_FILTER_PROPERTIES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.f}});Object.defineProperty(exports,"NATIVE_OBJECT_NAMES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.v}});Object.defineProperty(exports,"NO_VALUE_OPERATORS",{enumerable:true,get:function(){return chunkRPTKXZBV_js.s}});Object.defineProperty(exports,"OPERATORS_BY_TYPE",{enumerable:true,get:function(){return chunkRPTKXZBV_js.r}});Object.defineProperty(exports,"REMOVED_OPERATOR_REPLACEMENTS",{enumerable:true,get:function(){return chunkRPTKXZBV_js.W}});Object.defineProperty(exports,"RESERVED_ATTRIBUTE_NAMES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.B}});Object.defineProperty(exports,"RESERVED_OBJECT_NAMES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.C}});Object.defineProperty(exports,"RESOURCE_VISIBILITIES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.x}});Object.defineProperty(exports,"SYNONYM_ALIASES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.O}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.c}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTE_I18N_KEYS",{enumerable:true,get:function(){return chunkRPTKXZBV_js.a}});Object.defineProperty(exports,"SYSTEM_FIELD_NAMES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.A}});Object.defineProperty(exports,"SYSTEM_FILTER_ATTRIBUTE_TYPES",{enumerable:true,get:function(){return chunkRPTKXZBV_js.V}});Object.defineProperty(exports,"canonicalizeFilterValue",{enumerable:true,get:function(){return chunkRPTKXZBV_js.N}});Object.defineProperty(exports,"collectQualifiedRuleIssues",{enumerable:true,get:function(){return chunkRPTKXZBV_js.X}});Object.defineProperty(exports,"collectionContentSourceSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.ba}});Object.defineProperty(exports,"columnsSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.Z}});Object.defineProperty(exports,"contentViewDefinitionSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.ea}});Object.defineProperty(exports,"currentActor",{enumerable:true,get:function(){return chunkRPTKXZBV_js.E}});Object.defineProperty(exports,"displayAttributesSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js._}});Object.defineProperty(exports,"draftContentViewDefinitionSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.da}});Object.defineProperty(exports,"extractCurrencyFilterValue",{enumerable:true,get:function(){return chunkRPTKXZBV_js.H}});Object.defineProperty(exports,"extractFilterValue",{enumerable:true,get:function(){return chunkRPTKXZBV_js.I}});Object.defineProperty(exports,"filterStateSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.aa}});Object.defineProperty(exports,"getAttributeCapabilities",{enumerable:true,get:function(){return chunkRPTKXZBV_js.j}});Object.defineProperty(exports,"getAttributeFilterOperators",{enumerable:true,get:function(){return chunkRPTKXZBV_js.k}});Object.defineProperty(exports,"getOperatorPolarity",{enumerable:true,get:function(){return chunkRPTKXZBV_js.J}});Object.defineProperty(exports,"getRollupFilterOperators",{enumerable:true,get:function(){return chunkRPTKXZBV_js.u}});Object.defineProperty(exports,"getSystemAttributeI18nKey",{enumerable:true,get:function(){return chunkRPTKXZBV_js.b}});Object.defineProperty(exports,"getSystemAttributeList",{enumerable:true,get:function(){return chunkRPTKXZBV_js.d}});Object.defineProperty(exports,"isAttributeFilterable",{enumerable:true,get:function(){return chunkRPTKXZBV_js.l}});Object.defineProperty(exports,"isAttributeGroupable",{enumerable:true,get:function(){return chunkRPTKXZBV_js.o}});Object.defineProperty(exports,"isAttributeKanbanGroupable",{enumerable:true,get:function(){return chunkRPTKXZBV_js.p}});Object.defineProperty(exports,"isAttributeSearchable",{enumerable:true,get:function(){return chunkRPTKXZBV_js.m}});Object.defineProperty(exports,"isDynamicValue",{enumerable:true,get:function(){return chunkRPTKXZBV_js.D}});Object.defineProperty(exports,"isLocationFilterProperty",{enumerable:true,get:function(){return chunkRPTKXZBV_js.g}});Object.defineProperty(exports,"isLocationPartOperator",{enumerable:true,get:function(){return chunkRPTKXZBV_js.h}});Object.defineProperty(exports,"isManagedSystemAttribute",{enumerable:true,get:function(){return chunkRPTKXZBV_js.e}});Object.defineProperty(exports,"isNativeObjectName",{enumerable:true,get:function(){return chunkRPTKXZBV_js.w}});Object.defineProperty(exports,"isNoValueOperator",{enumerable:true,get:function(){return chunkRPTKXZBV_js.t}});Object.defineProperty(exports,"isRelativeDateValue",{enumerable:true,get:function(){return chunkRPTKXZBV_js.R}});Object.defineProperty(exports,"isSetMembershipOperator",{enumerable:true,get:function(){return chunkRPTKXZBV_js.M}});Object.defineProperty(exports,"normalizeFilterRule",{enumerable:true,get:function(){return chunkRPTKXZBV_js.Q}});Object.defineProperty(exports,"normalizeForEdgeRpc",{enumerable:true,get:function(){return chunkRPTKXZBV_js.K}});Object.defineProperty(exports,"normalizeOperator",{enumerable:true,get:function(){return chunkRPTKXZBV_js.P}});Object.defineProperty(exports,"now",{enumerable:true,get:function(){return chunkRPTKXZBV_js.G}});Object.defineProperty(exports,"parseResourceVisibility",{enumerable:true,get:function(){return chunkRPTKXZBV_js.z}});Object.defineProperty(exports,"publishedViewContentDefinitionSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.ca}});Object.defineProperty(exports,"resolveEffectiveFilterType",{enumerable:true,get:function(){return chunkRPTKXZBV_js.q}});Object.defineProperty(exports,"resolveIsWithinBounds",{enumerable:true,get:function(){return chunkRPTKXZBV_js.S}});Object.defineProperty(exports,"resolveUtcDayBounds",{enumerable:true,get:function(){return chunkRPTKXZBV_js.T}});Object.defineProperty(exports,"sortsSchema",{enumerable:true,get:function(){return chunkRPTKXZBV_js.$}});Object.defineProperty(exports,"toMultiValueOperator",{enumerable:true,get:function(){return chunkRPTKXZBV_js.L}});Object.defineProperty(exports,"toUtcDayString",{enumerable:true,get:function(){return chunkRPTKXZBV_js.U}});Object.defineProperty(exports,"today",{enumerable:true,get:function(){return chunkRPTKXZBV_js.F}});Object.defineProperty(exports,"validateQualifiedRule",{enumerable:true,get:function(){return chunkRPTKXZBV_js.Y}});Object.defineProperty(exports,"ComputedFormulaParseError",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.d}});Object.defineProperty(exports,"SCHEMA_LIMITS",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.a}});Object.defineProperty(exports,"attributeConfigSchemas",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.j}});Object.defineProperty(exports,"colorIdSchema",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.b}});Object.defineProperty(exports,"iconNameSchema",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.c}});Object.defineProperty(exports,"multiselectOptionWriteSchema",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.h}});Object.defineProperty(exports,"parseAttributeConfig",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.l}});Object.defineProperty(exports,"parseAttributeConfigForCreate",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.n}});Object.defineProperty(exports,"parseAttributeConfigForUpdate",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.o}});Object.defineProperty(exports,"parseComputedFormula",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.e}});Object.defineProperty(exports,"selectOptionWriteSchema",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.g}});Object.defineProperty(exports,"statusGroupSchema",{enumerable:true,get:function(){return chunkHRX4YCKZ_js.f}});Object.defineProperty(exports,"statusOptionWriteSchema",{enumerable:true,get:function(){return chunkHRX4YCKZ_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=qw;exports.AGENT_UI_BATCH_MAX_ITEMS=zw;exports.ALLOWED_PROPERTY_TYPES=Lo;exports.ALL_ACTIONS=qn;exports.ALL_OPERATION_TYPES=Qm;exports.ALL_SYSTEM_RESOURCES=EA;exports.ARTIFACT_FILE_ROLES=sy;exports.ARTIFACT_KINDS=oy;exports.ARTIFACT_LIST_VIEW=wl;exports.ARTIFACT_OBJECT=xl;exports.ARTIFACT_OBJECT_NAME=ut;exports.ARTIFACT_PREVIEW_EXTENSION=da;exports.ARTIFACT_RETENTIONS=ay;exports.ARTIFACT_VIEW=Tl;exports.ATTRIBUTE_TYPES=Ht;exports.AUDIT_ACTIONS=Sg;exports.AUDIT_RESOURCE_TYPES=wg;exports.AgentBuilder=Hn;exports.BEHAVIOR_PROPERTIES=mg;exports.BYTE_UNIT_LABELS=tu;exports.CLAIMABLE_SESSION_STATUSES=$c;exports.COMPUTED_FUNCTIONS=jt;exports.COMPUTED_FUNCTION_METADATA=RS;exports.COMPUTED_FUNCTION_NAMES=aS;exports.CONNECTOR_CALLBACK_PARAM=XS;exports.COUNT_MODES=Vo;exports.ComputedFormulaCompileError=S;exports.ContentBuilder=ce;exports.DB_COLUMN_FIELDS=CA;exports.DEFAULT_AGENT_EXECUTION_CONFIG=ea;exports.DEFAULT_APPROVAL_POLICY=vo;exports.DEFAULT_DICTATION_LIMITS=ry;exports.DEFAULT_LABEL_FALLBACK=qo;exports.DEFAULT_MEETING_BOT_DISPLAY_NAME=Jc;exports.DEFAULT_ROLES=Ou;exports.DEFAULT_ROLE_DESCRIPTIONS=OA;exports.DEFAULT_ROLE_LABELS=DA;exports.DEFAULT_ROLE_PERMISSIONS=kA;exports.DEFAULT_TENANT_SETTINGS=Fy;exports.DICTATION_FINALIZATION_TIMEOUT_MS=ty;exports.DICTATION_FRAME_BYTES=Hg;exports.DICTATION_MAX_BUFFER_BYTES=Qg;exports.DICTATION_MAX_FRAME_BYTES=Jg;exports.DICTATION_MAX_TRANSCRIPT_BYTES=Xg;exports.DICTATION_MODEL_ID=ny;exports.DICTATION_PREPARATION_TIMEOUT_MS=ey;exports.DICTATION_SAMPLE_RATE=Yg;exports.DICTATION_TICKET_TTL_MS=Zg;exports.DISCARD_ARCHITECT_DRAFT_TOOL_NAME=Df;exports.DOCUMENT_SYSTEM_ATTRIBUTES=zh;exports.DRAFTABLE_ATTRIBUTE_TYPES=$s;exports.DRAFT_WRITE_TOOL_NAMES=Ef;exports.DRIVE_LIST_VIEW=hl;exports.DRIVE_OBJECT=gl;exports.DRIVE_OBJECT_NAME=ct;exports.DRIVE_VIEW=yl;exports.EMPTY_VALUE_PLACEHOLDER=Xt;exports.ESTIMATED_COUNT_CAP=Gy;exports.FAKE_MEETING_BOT_SIGNATURE_HEADER=dI;exports.FAMILY_INPUTS=pf;exports.FAMILY_WIRE_INPUTS=mf;exports.FORM_FORBIDDEN_ATTRIBUTE_TYPES=Ln;exports.FlagRegistry=Et;exports.FlagService=ln;exports.FormBuilder=Pr;exports.FormRegistry=Ot;exports.FormRowBuilder=jr;exports.FormStepBuilder=_r;exports.GET_ARCHITECT_DRAFT_TOOL_NAME=kf;exports.GroupBuilder=qr;exports.IDENTITY_PROPERTIES=pg;exports.IMAGE_FORMATS=Uy;exports.INFERENCE_REASONING_OPTIONS=Do;exports.INFERENCE_SPEEDS=No;exports.LIVE_EVENT_TYPES=jl;exports.MAILBOX_LIST_MODES=wp;exports.MAIL_DRAFT_BODY_MAX_CHARS=oI;exports.MAIL_SUBJECT_MAX_CHARS=aI;exports.MAX_PRESET_DEPTH=jo;exports.MAX_TODOS=Vg;exports.MAX_TODO_DESCRIPTION_CHARS=Lg;exports.MAX_TODO_ID_CHARS=Bg;exports.MEETING_ATTRIBUTES=C;exports.MEETING_DETAIL_VIEW_ID=ba;exports.MEETING_LIST_VIEW=Rl;exports.MEETING_LIST_VIEW_ID=ma;exports.MEETING_OBJECT=Sl;exports.MEETING_OBJECT_NAME=lt;exports.MEETING_VIEW=Il;exports.MEETING_WRITE_SOURCE=fa;exports.MEMORY_LIST_VIEW=bl;exports.MEMORY_OBJECT=ml;exports.MEMORY_VIEW=fl;exports.McpOAuthCompletionMode=Tp;exports.MultiRelationAttributeBuilder=lr;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_KEY=zc;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION=Wc;exports.NOTIFICATION_INBOX_STATES=So;exports.NOTIFICATION_KINDS=xo;exports.NOTIFICATION_PRIORITIES=To;exports.NOTIFICATION_SENSITIVITIES=wo;exports.NOTIFICATION_TYPES_V1=lg;exports.NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED=Bc;exports.NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN=Fc;exports.NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED=Vc;exports.NOTIFICATION_WORK_STATES=Io;exports.NO_RECORDING=pI;exports.NoopGeocodingAdapter=Mo;exports.OBJECT_NAME_SCHEMA=tn;exports.OPEN_TOOL_PART_STATES=Uc;exports.OPERATION_REGISTRY=Bt;exports.OPERATOR_SPECS=Sn;exports.ObjectBuilder=Rt;exports.PRESENTATION_PROPERTIES=fg;exports.PROVIDER_NAMES=Eo;exports.PUBLISH_ARCHITECT_DRAFT_TOOL_NAME=Nf;exports.QUALIFIED_SEPARATOR=Qh;exports.QUOTA_KEYS=Hy;exports.RECORDING_OVERRIDES=uI;exports.RECORDING_POLICIES=lI;exports.RECORD_CREATOR_ROOT_ACTOR_METADATA_KEY=Yo;exports.RELATION_TARGET_ANY=ae;exports.REMOVE_OPERATION_SCHEMA=Hs;exports.REPLY_MODES=Sp;exports.REQUEST_DESIGN_REVIEW_TOOL_NAME=Of;exports.SCHEMA_OPERATIONS=At;exports.SCHEMA_OPERATION_INPUT=Zs;exports.SCHEMA_PLAN_LIMITS=de;exports.SCHEMA_SOURCE_ID_PATTERN=ji;exports.SESSION_STATE_STREAM_ID=zg;exports.SESSION_TERMINAL_STATUSES=Lc;exports.SKILL_CONTENT_TEMPLATE=ua;exports.SKILL_LIST_VIEW=ll;exports.SKILL_OBJECT=cl;exports.SKILL_VIEW=ul;exports.STANDARD_SCHEMA_VENDOR=Fu;exports.SYSTEM_PART_CODES=Bn;exports.SYSTEM_RESOURCES=ne;exports.SYSTEM_RESOURCE_LABELS=NA;exports.SingleRelationAttributeBuilder=ur;exports.TODAY_DEFAULT=Ya;exports.TODO_PLAN_STATUSES=Og;exports.TODO_STATUSES=Fg;exports.TOOL_APPROVAL_STATES=Oo;exports.USER_STATUSES=By;exports.USER_WORK_POSTURES=Ly;exports.VIEW_OPERATIONS=gt;exports.VIEW_OPERATION_INPUT=ec;exports.ViewBuilder=cn;exports.accessLevelToActions=Oy;exports.actionsToAccessLevel=Dy;exports.agent=WA;exports.agentDataChunk=eR;exports.agentDisplayName=kg;exports.agentInferencePreferencesSchema=QI;exports.agentMessageAttachmentSchema=zp;exports.agentMessagePartSchema=qp;exports.agentSessionInferenceOverridesInputSchema=Up;exports.agentSessionInferenceOverridesSchema=XI;exports.agentSessionMessageSchema=ss;exports.agentUIValidationError=Qp;exports.applyOperations=ro;exports.applyPipes=Uo;exports.applyRelationProps=Su;exports.architectDraftChannelKey=Yw;exports.assertAcyclicComputed=Yi;exports.assertAcyclicComputedDependencies=Oa;exports.assertBilateralPairs=xm;exports.assertCustomAgentUIMessageChunk=Xp;exports.assertSchemaSourceId=Cp;exports.bilateralDeclarationOf=Te;exports.booleanFlag=Xu;exports.buildAgentFallbackTitle=Ja;exports.buildPermissionFlags=Du;exports.buildPropertySchema=Qt;exports.buildQualifiedAttribute=Zh;exports.canonicalViewOperationSchema=Gi;exports.checkbox=ta;exports.collectSchemaReferences=LI;exports.collectionContentsOf=nc;exports.collectionSourceAddress=Ue;exports.collectionSourceAddressOf=Ur;exports.compareAgentSessionMessages=qc;exports.compareSchemaStateEntries=Pn;exports.compilablePlansOf=Ft;exports.compileComputedFormula=bn;exports.compileRollupAttribute=Pa;exports.computeByteMagnitude=eu;exports.computedCompileSchemaOf=Ki;exports.computedPlanOf=vn;exports.content=N;exports.contentDefinition=ga;exports.conversationDisplayTitle=Rp;exports.createFlagRegistry=rl;exports.createFlagService=ol;exports.createStandardSchemaProps=rn;exports.currency=ix;exports.customDataChunkSchemas=ps;exports.date=se;exports.dateInTimezone=In;exports.dateValueStart=tt;exports.defaultViewIdsFor=Ke;exports.defaultViewsFor=Xi;exports.defineOperation=$i;exports.definePresentation=V;exports.dependentsOf=Hi;exports.deriveArchitectChanges=af;exports.deriveCreateDefaultsFromFilters=YS;exports.deriveInitials=Eu;exports.describeOperations=Xm;exports.destructiveSchema=ts;exports.detailView=ge;exports.diffSchemaState=Vf;exports.document=na;exports.draftedLabelExpression=ms;exports.draftedObjectDefinition=qi;exports.draftedViewDefinition=bt;exports.durableDateSchema=Kp;exports.episodeImpactOf=of;exports.evaluateComputedAst=xS;exports.evaluateComputedFormula=TS;exports.evaluateComputedFormulaWithResult=wS;exports.evaluateFilterState=fp;exports.evaluateRecordFilterState=LS;exports.extractAttributeNames=wt;exports.extractValueRefs=Ko;exports.familyOf=bf;exports.findRelationAttribute=ya;exports.flagRegistry=nl;exports.focusOf=io;exports.form=yx;exports.formFieldFlatKey=Hc;exports.formFieldKey=Yc;exports.formRegistry=xa;exports.formatAgentStreamFrameId=Bw;exports.formatAttributeValue=$o;exports.formatByteSize=$h;exports.formatComputedResult=up;exports.formatLocationValue=cu;exports.formula=ux;exports.fromDraftableView=nm;exports.getEditableLabelAttribute=Tu;exports.getErrorMessage=ly;exports.getLiveProtocolPayloadChannel=nS;exports.getRecordCreatorPrincipalId=Nu;exports.getSingleAttributeFromExpression=Go;exports.getSlotFieldTargets=Po;exports.getUserDisplayName=Cu;exports.group=he;exports.guidanceForBatch=Tf;exports.hasDestructiveEntries=AI;exports.hasOptions=_y;exports.imageModelIdSchema=ls;exports.includesAction=rt;exports.inferInverseCardinality=Co;exports.inferRollupReturnType=Hd;exports.inferenceReasoningSchema=Li;exports.inferenceSpeedSchema=Bi;exports.isAgentUIDataName=Jp;exports.isAgentUIMessageBatch=Ww;exports.isAttributeSortable=Ag;exports.isBilateralRelation=hg;exports.isCheckboxEquality=NS;exports.isClaimableSessionStatus=Dg;exports.isComputedAttribute=yt;exports.isComputedFunctionName=mn;exports.isDateRangeValue=Ne;exports.isDefaultRole=jA;exports.isDocumentAttribute=Wh;exports.isEdgePayload=ic;exports.isEmptyObject=Xc;exports.isFormDefinition=fy;exports.isFormFieldsRow=Jt;exports.isFormFreeFieldRef=$n;exports.isFormHeadingRow=Ty;exports.isFormSeparatorRow=wy;exports.isFormSlotFieldRef=_o;exports.isFormTextRow=Sy;exports.isLabelExpression=en;exports.isLiveEventEnvelope=rS;exports.isLiveEventPayload=Xw;exports.isLiveEventPayloadForType=Ul;exports.isLiveEventType=$l;exports.isMailProvider=nI;exports.isMailboxListMode=rI;exports.isNotEmpty=Bo;exports.isOpenToolPartState=jg;exports.isPlainRecord=La;exports.isReplyMode=iI;exports.isStandardSchema=YA;exports.isSystemPartCode=Pg;exports.isTerminalSessionStatus=Ng;exports.isTerminalState=Cg;exports.isToolApprovalState=_g;exports.isUniversalRelation=Ro;exports.jsonFlag=tl;exports.legacyStatusToSessionState=Eg;exports.listView=ye;exports.liveChannelKey=wa;exports.location=sx;exports.matchesAccepts=Gh;exports.mentionReferenceSchema=Wp;exports.modelDefinitionSchema=Gp;exports.modelReferenceSchema=us;exports.multiselect=ax;exports.nativeAgentUIPartIdMetadataKey=Kc;exports.normalizeDateValue=nu;exports.number=an;exports.numberFlag=el;exports.object=Dx;exports.orderAgentSessionMessages=Mg;exports.parseAgentStreamFrameId=Lw;exports.parseCountMode=Qc;exports.parseLiveChannelKey=Sa;exports.parseNamedTarget=cf;exports.parseNativeAgentUIPartIdsMetadata=Wg;exports.parseOperation=Zm;exports.parseOptionalCountMode=Wy;exports.parseQualifiedAttribute=Xh;exports.parseSchemaState=Ff;exports.persistedSchemaPlanSchema=kI;exports.phone=rx;exports.plannedAttributeSchema=Np;exports.plannedInlineAttributeSchema=Dp;exports.plannedObjectSchema=Op;exports.presentationOf=qt;exports.proposalTargetKey=Ut;exports.providerNameSchema=cs;exports.qualifiedPropertyDefs=Ru;exports.readFormFieldValue=hy;exports.reconcileRelationAttributes=Vi;exports.regenerateDerived=Vt;exports.registry=CT;exports.relation=ot;exports.relationAcceptsObject=bi;exports.relationProperty=Qx;exports.relationPropertyDefs=Iu;exports.relationTargetObjectName=ht;exports.relationTargets=ee;exports.relationTargetsOf=yg;exports.relationValueIds=no;exports.renderLabelExpression=Wn;exports.requestedCapabilities=QS;exports.requireRecordContentContext=Ct;exports.requireSingleRelationTarget=ha;exports.requiredTargetKeys=nf;exports.resolveAttributeDefaultValue=Ap;exports.resolveCollectionActions=$u;exports.resolveContentNavigation=Lu;exports.resolveFieldRequired=yy;exports.resolvePropertyDefinitions=Fo;exports.resolveViewContents=fi;exports.richtext=De;exports.rollup=lx;exports.rollupToFormulaExpression=Yd;exports.schemaPlanSchema=OI;exports.schemaStateSourcePayload=Pf;exports.select=fe;exports.sessionInferencePatchSchema=ZI;exports.sessionStateToLegacyStatus=vg;exports.status=ox;exports.stillMissing=Af;exports.storedContentDefinition=Nt;exports.stringFlag=Zu;exports.summarizeDraft=vf;exports.targetSnapshot=kn;exports.targetTokensFor=rf;exports.text=w;exports.toAttribute=Z;exports.toDraftableAttributes=em;exports.toDraftableObject=Zp;exports.toDraftableView=tm;exports.toUndefinedIfEmpty=Zc;exports.todoItemSchema=Yp;exports.todoPlanSchema=Hp;exports.toolImpactSchema=ds;exports.touchedObjectIds=wf;exports.user=cx;exports.validateAttributeName=It;exports.validateContentViewCatalogue=gi;exports.validateLabelExpression=bu;exports.validateObjectExpressions=Bu;exports.validateObjectName=St;exports.validateViewName=Mu;exports.viewIdFor=Ji;exports.viewIdentityKey=di;exports.viewRegistry=Cl;exports.workspaceViewAuthoring=Dt;
|
|
50
|
+
`)}debug(t){let n=this.summary();return t?.(n),n}throwDuplicate(t,n){let r=bi(t,n);throw new chunkJSKLP4GI_js.r("view",r,`[ViewRegistry] Duplicate view: "${n}" for object "${t}"`)}};chunkDPD6ZWL2_js.a(yi,"ViewRegistry");var gi=yi,Ol=new gi;function Sa(e,t){if(t.suppressed)return null;let n=t.workspaceDefinition??t.sourceDefinition;return n===null?null:{...structuredClone(n),name:e}}chunkDPD6ZWL2_js.a(Sa,"contentDefinition");function vt(e){let{name:t,...n}=e;return structuredClone(n)}chunkDPD6ZWL2_js.a(vt,"storedContentDefinition");function Et(e){let t={main:0,aside:0};return {origin:"runtime",mainOrderCustomized:false,asideOrderCustomized:false,contents:Object.fromEntries(e.map(n=>[n.name,{sourceDefinition:null,workspaceDefinition:vt(n),suppressed:false,sourcePosition:null,workspacePosition:t[n.placement]++}]))}}chunkDPD6ZWL2_js.a(Et,"workspaceViewAuthoring");function hi(e){let t=Object.entries(e.contents).flatMap(([n,r])=>{let o=Sa(n,r);return o?[{definition:o,...r}]:[]});return ["main","aside"].flatMap(n=>{let r=n==="main"?e.mainOrderCustomized:e.asideOrderCustomized;return t.filter(o=>o.definition.placement===n).sort((o,a)=>{let s=r?o.workspacePosition:o.sourcePosition,c=r?a.workspacePosition:a.sourcePosition;if(s!==null&&c!==null&&s!==c)return s-c;if(s!==null&&c===null)return -1;if(c!==null&&s===null)return 1;let u=o.sourcePosition??o.workspacePosition,l=a.sourcePosition??a.workspacePosition;return u!==null&&l!==null&&u!==l?u-l:u!==null&&l===null?-1:l!==null&&u===null?1:o.definition.name.localeCompare(a.definition.name)}).map(o=>o.definition)})}chunkDPD6ZWL2_js.a(hi,"resolveViewContents");function Ia(e,t){return e.attributes.find(n=>n.name===t&&n.type==="relation")}chunkDPD6ZWL2_js.a(Ia,"findRelationAttribute");function Ai(e,t){return e.targets.some(n=>n.object===t||n.object===ae)}chunkDPD6ZWL2_js.a(Ai,"relationAcceptsObject");function Ra(e,t=[e.name,"targets"]){if(e.targets.length!==1||e.targets[0].object==="*"){let n=`Relation "${e.name}" requires one concrete collection target`;throw new chunkJSKLP4GI_js.h(n,[{path:t,message:n}])}return e.targets[0].object}chunkDPD6ZWL2_js.a(Ra,"requireSingleRelationTarget");var kl=new Map(chunkMXZ3AF5X_js.d().map(e=>[e.name,e]));function ue(e,t){throw new chunkJSKLP4GI_js.h(t,[{path:e,message:t}])}chunkDPD6ZWL2_js.a(ue,"reject");function _e(e,t){e.trim().length===0&&ue(t,"API name must not be empty");}chunkDPD6ZWL2_js.a(_e,"requireName");function Ca(e,t,n){let r=new Map;return e.forEach((o,a)=>{if(_e(o.name,[...n,String(a),"name"]),r.has(o.name))throw new chunkJSKLP4GI_js.r(t,o.name);r.set(o.name,o);}),r}chunkDPD6ZWL2_js.a(Ca,"indexUnique");function ne(e,t,n,r,o){if(_e(t,n),!e)return;let a=e.attributes?.get(t)??kl.get(t);if(!a){if(!e.attributes)return;let s=[...e.attributes.keys()].slice(0,30),c=s.length===0?`Object "${e.name}" has no attributes yet.`:`Attributes of "${e.name}": ${s.join(", ")}`;ue(n,`Unknown attribute "${e.name}.${t}". ${c}${o?.()??""}`);}return r&&a.type!==r&&ue(n,`Attribute "${e.name}.${t}" must have type ${r}`),a}chunkDPD6ZWL2_js.a(ne,"requireAttribute");function xi(e){let t=e.mode??"published",n=new Map;e.objects.forEach((b,g)=>{if(_e(b.name,["objects",String(g),"name"]),n.has(b.name))throw new chunkJSKLP4GI_js.r("object",b.name);n.set(b.name,{name:b.name,attributes:Ca(b.attributes,"attribute",["objects",String(g),"attributes"])});});let r=new Set;(e.reservedObjects??[]).forEach((b,g)=>{let y=["reservedObjects",String(g)];_e(b,y),!n.has(b)&&(t!=="draft"&&ue(y,`Unresolved reserved object "${b}"`),r.add(b),n.set(b,{name:b}));});let o=Ca(e.extensions??[],"extension",["extensions"]);function a(b,g){_e(b,g);let y=n.get(b);return y||ue(g,`Unknown object "${b}"`),y}chunkDPD6ZWL2_js.a(a,"resolveObject");function s(b){let g=[];for(let[y,A]of n)if(y!==b)for(let h of A.attributes?.values()??[])h.type==="relation"&&Ai(h,b)&&g.push(`relatedFrom("${y}", "${h.name}")`);return g.sort().slice(0,3)}chunkDPD6ZWL2_js.a(s,"inverseAddresses");let c=e.asideRule??"enforce",u=t==="draft"?chunkMXZ3AF5X_js.X({asideRule:c}):chunkMXZ3AF5X_js.Y({asideRule:c}),l=new Map,m=new Map;return {views:e.views.map((b,g)=>{let y=["views",String(g)],A=u.safeParse(b);if(!A.success)throw new chunkJSKLP4GI_js.h("Invalid content view",A.error.issues.map(O=>({path:[...y,...O.path.map(String)],message:O.message,code:O.code})));let h=A.data;_e(h.name,[...y,"name"]);let j=a(h.object,[...y,"object"]),_=l.get(h.object)??new Set;if(_.has(h.name))throw new chunkJSKLP4GI_js.r("view",`${h.object}.${h.name}`);if(_.add(h.name),l.set(h.object,_),h.default){let O=m.get(h.object)??new Set;if(O.has(h.context))throw new chunkJSKLP4GI_js.r("default view",`${h.object}.${h.context}`);O.add(h.context),m.set(h.object,O);}return h.contents.forEach((O,B)=>{let Se=[...y,"contents",String(B)];_e(O.name,[...Se,"name"]),jl(O,Se,j,h.context,o,a,s);}),h}),unresolvedObjects:[...r].sort()}}chunkDPD6ZWL2_js.a(xi,"validateContentViewCatalogue");function jl(e,t,n,r,o,a,s){function c(){It(e.name,r,t);}if(chunkDPD6ZWL2_js.a(c,"requireRecord"),e.type==="custom"){let u=o.get(e.extension);u||ue([...t,"extension"],`Unknown extension "${e.extension}"`),u.requiresRecord&&c();let l=u.parameters.safeParse(structuredClone(e.parameters??{}));if(!l.success)throw new chunkJSKLP4GI_js.h("Invalid extension parameters",l.error.issues.map(m=>({path:[...t,"parameters",...m.path.map(String)],message:m.message,code:m.code})));return}if(e.type==="collection"){let u=qe(e.source),l,m;if(u.kind==="object")l=a(u.object,[...t,"source","object"]);else if(u.kind==="related"){c();let d=[...t,"source","relation"],b=chunkDPD6ZWL2_js.a(()=>{if(!n)return "";let y=s(n.name);return y.length===0?"":`. Records pointing at "${n.name}" are addressed from the other side: ${y.join(", ")}`},"hint"),g=ne(n,u.relation,d,"relation",b);g?.type==="relation"&&(m=g,l=a(Ra(g,d),d));}else {c(),l=a(u.object,[...t,"source","object"]);let d=[...t,"source","relation"],b=ne(l,u.relation,d,"relation");if(b?.type==="relation"&&n&&!Ai(b,n.name)){let g=b.targets.map(y=>`"${y.object}"`).join(", ");ue(d,`Relation "${u.object}.${u.relation}" targets ${g}, not "${n.name}"`);}e.filters?.combinator==="or"&&ue([...t,"filters","combinator"],`Collection "${e.name}" addresses "${u.object}" from the far side, so its filters must use the "and" combinator`);}e.columns?.forEach((d,b)=>{let g=[...t,"columns",String(b)];if(typeof d=="string"){ne(l,d,g);return}let y=[...g,"relationProperty"];m||ue(y,"Relation property columns require a relation source"),m.properties?.definitions.some(A=>A.name===d.relationProperty)||ue(y,`Unknown relation property "${d.relationProperty}"`);}),e.displayAttributes?.forEach((d,b)=>ne(l,d,[...t,"displayAttributes",String(b)])),e.sorts?.forEach((d,b)=>ne(l,d.attribute,[...t,"sorts",String(b),"attribute"])),e.filters?.rules.forEach((d,b)=>ne(l,d.attribute,[...t,"filters","rules",String(b),"attribute"])),e.descriptionAttribute!==void 0&&ne(l,e.descriptionAttribute,[...t,"descriptionAttribute"]),e.layout==="kanban"&&e.groupByAttribute!==void 0&&ne(l,e.groupByAttribute,[...t,"groupByAttribute"]);return}switch(c(),e.type){case "form":e.groups.forEach((u,l)=>{let m=[...t,"groups",String(l)];_e(u.name,[...m,"name"]),u.fields.forEach((d,b)=>ne(n,d.attribute,[...m,"fields",String(b),"attribute"]));});break;case "richtext":ne(n,e.attribute,[...t,"attribute"],"richtext"),e.titleAttribute!==void 0&&ne(n,e.titleAttribute,[...t,"titleAttribute"],"text");break;case "emails":case "meetings":e.emailAttributes.forEach((u,l)=>ne(n,u,[...t,"emailAttributes",String(l)],"text"));break;case "documents":e.relations?.forEach((u,l)=>ne(n,u,[...t,"relations",String(l)],"relation"));break;case "forms":e.objectName!==void 0&&a(e.objectName,[...t,"objectName"]);break;case "activity":break;default:ue(t,`Unknown content type: ${String(e)}`);}}chunkDPD6ZWL2_js.a(jl,"validateContent");function Ti(e){return structuredClone(e)}chunkDPD6ZWL2_js.a(Ti,"cloneFormDefinition");var wi=class wi{constructor(){this.forms=new Map;}register(t){let n=Array.isArray(t)?t:[t];for(let r of n){if(this.forms.has(r.name))throw new chunkJSKLP4GI_js.r("form",r.name,`[FormRegistry] Duplicate form: "${r.name}"`);this.forms.set(r.name,Ti(r));}return this}get(t){let n=this.forms.get(t);return n?Ti(n):void 0}getAll(){return Array.from(this.forms.values(),Ti)}listNames(){return Array.from(this.forms.keys())}};chunkDPD6ZWL2_js.a(wi,"FormRegistry");var Nt=wi;var va=new Nt;function rS(e,t){return `${e}:${t}`}chunkDPD6ZWL2_js.a(rS,"formatAgentStreamFrameId");function iS(e){let t=e.lastIndexOf(":");if(t<=0)return null;let n=e.slice(0,t),r=Number(e.slice(t+1));return !Number.isInteger(r)||r<=0?null:{streamId:n,sequence:r}}chunkDPD6ZWL2_js.a(iS,"parseAgentStreamFrameId");var sS=204800,cS=256;function Ii(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(Ii,"isRecord");function Ri(e,t){let n=Object.keys(e);return n.length===t.length&&n.every(r=>t.includes(r))}chunkDPD6ZWL2_js.a(Ri,"hasExactKeys");function Si(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}chunkDPD6ZWL2_js.a(Si,"isPositiveInteger");function Ea(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(Ea,"isNonNegativeInteger");function _l(e){return Ii(e)&&Ri(e,["kind","startOffset","endOffset"])?(e.kind==="text"||e.kind==="reasoning")&&Ea(e.startOffset)&&Ea(e.endOffset)&&e.endOffset>=e.startOffset:false}chunkDPD6ZWL2_js.a(_l,"isContentRange");function Pl(e){if(!Ii(e))return false;let t=e.content===void 0?["sequence","chunk"]:["sequence","content","chunk"];return Ri(e,t)&&Si(e.sequence)&&e.chunk!==void 0&&(e.content===void 0||_l(e.content))}chunkDPD6ZWL2_js.a(Pl,"isBatchItem");function Ml(e){try{return new TextEncoder().encode(JSON.stringify(e)).byteLength}catch{return}}chunkDPD6ZWL2_js.a(Ml,"encodedSize");function uS(e){if(!(Ii(e)&&Ri(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()===""||!Si(e.sequenceStart)||!Si(e.sequenceEnd)||!Array.isArray(e.items)||e.items.length===0||e.items.length>256||!e.items.every(Pl))return false;let t=0;for(let r of e.items){if(r.sequence<=t)return false;t=r.sequence;}if(e.items[0]?.sequence!==e.sequenceStart||e.items.at(-1)?.sequence!==e.sequenceEnd)return false;let n=Ml(e);return n!==void 0&&n<=204800}chunkDPD6ZWL2_js.a(uS,"isAgentUIMessageBatch");function Na(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(Na,"liveChannelKey");function pS(e){return e.sessionId?Na({kind:"architect-draft",scope:"session",sessionId:e.sessionId}):e.actorId?Na({kind:"architect-draft",scope:"actor",actorId:e.actorId}):null}chunkDPD6ZWL2_js.a(pS,"architectDraftChannelKey");function Pe(e){try{return decodeURIComponent(e)}catch{return null}}chunkDPD6ZWL2_js.a(Pe,"decodeLiveChannelPart");function Da(e){let t=e.split(":");if(t[0]==="workspace"&&t.length===2&&t[1]){let n=Pe(t[1]);return n?{kind:"workspace",tenantId:n}:null}if(t[0]==="object"&&t.length===2&&t[1]){let n=Pe(t[1]);return n?{kind:"object",objectId:n}:null}if(t[0]==="record"&&t.length===3&&t[1]&&t[2]){let n=Pe(t[1]),r=Pe(t[2]);return n&&r?{kind:"record",objectId:n,recordId:r}:null}if(t[0]==="view"&&t.length===2&&t[1]){let n=Pe(t[1]);return n?{kind:"view",viewId:n}:null}if(t[0]==="user"&&t.length===2&&t[1]){let n=Pe(t[1]);return n?{kind:"user",actorId:n}:null}if(t[0]==="architect-draft"&&t.length===3&&t[2]){let n=Pe(t[2]);return n?t[1]==="actor"?{kind:"architect-draft",scope:"actor",actorId:n}:t[1]==="session"?{kind:"architect-draft",scope:"session",sessionId:n}:null:null}if(t[0]==="conversation"&&t.length===2&&t[1]){let n=Pe(t[1]);return n?{kind:"conversation",sessionId:n}:null}return null}chunkDPD6ZWL2_js.a(Da,"parseLiveChannelKey");var Fl={"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},Vl=Object.keys(Fl),Bl=["membership-unknown","sort-unknown","permissions-changed"],Ll=["permission-revoked","workspace-left","object-deleted"],$l=["inboxState","workState","lockedAt","lockedByActorId","readAt","archivedAt","snoozedUntil","completedAt","dismissedAt","updatedAt"],Ul=["type","objectId","recordId","recordVersion"],ql=["type","objectId","recordId","recordVersion","record"],zl=["id","objectId","visibility","ownedBy","label","values","metadata","createdAt","updatedAt","createdBy","lastUpdatedBy","schemaVersion"],Wl=["type","targetActorId","archivedCount","version","updatedAt"];function Gl(e){return typeof e=="string"&&Vl.includes(e)}chunkDPD6ZWL2_js.a(Gl,"isLiveEventType");function gS(e){return U(e)&&Gl(e.type)?Kl(e.type,e):false}chunkDPD6ZWL2_js.a(gS,"isLiveEventPayload");function Kl(e,t){if(!U(t))return false;switch(e){case "record.patch":return ed(t);case "record.deleted":return td(t);case "record.removed":return nd(t);case "record.created":return id(t);case "view.projection.stale":return od(t);case "agent.session.patch":return ad(t);case "notification.created":return ld(t);case "notification.recipient.patch":return dd(t);case "notification.count.patch":return pd(t);case "notification.inbox.archived":return md(t);case "reflex.state.changed":return Ad(t);case "reflex.run.completed":return xd(t);case "reflex.authoring.progress":return Td(t);case "architect.draft.updated":return yd(t);case "meeting.recording.patch":return Sd(t);case "wallet.state":return Cd(t);case "channel.revoked":return vd(t);default:return false}}chunkDPD6ZWL2_js.a(Kl,"isLiveEventPayloadForType");function U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(U,"isRecord");function H(e){return typeof e=="string"}chunkDPD6ZWL2_js.a(H,"isString");function Dt(e){return H(e)&&e.length>0}chunkDPD6ZWL2_js.a(Dt,"isNonEmptyString");function Ci(e){return e===null||H(e)}chunkDPD6ZWL2_js.a(Ci,"isNullableString");function Yl(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}chunkDPD6ZWL2_js.a(Yl,"isVersion");function xe(e){if(!H(e))return false;let t=Date.parse(e);return Number.isFinite(t)&&new Date(t).toISOString()===e}chunkDPD6ZWL2_js.a(xe,"isIsoDateString");function lt(e){return e===null||xe(e)}chunkDPD6ZWL2_js.a(lt,"isNullableIsoDateString");function D(e,t){return H(e[t])}chunkDPD6ZWL2_js.a(D,"hasString");function le(e,t){return Dt(e[t])}chunkDPD6ZWL2_js.a(le,"hasNonEmptyString");function q(e,t){return Yl(e[t])}chunkDPD6ZWL2_js.a(q,"hasVersion");function G(e,t){return xe(e[t])}chunkDPD6ZWL2_js.a(G,"hasIsoDateString");function N(e,t,n){return !Object.hasOwn(e,t)||n(e[t])}chunkDPD6ZWL2_js.a(N,"hasOptional");function pn(e,t){return Object.keys(e).every(n=>t.includes(n))}chunkDPD6ZWL2_js.a(pn,"hasOnlyKeys");function J(e,t){return typeof e=="string"&&t.includes(e)}chunkDPD6ZWL2_js.a(J,"isOneOf");function Hl(e){return J(e,ko)}chunkDPD6ZWL2_js.a(Hl,"isNotificationKind");function Jl(e){return J(e,jo)}chunkDPD6ZWL2_js.a(Jl,"isNotificationPriority");function Ql(e){return J(e,_o)}chunkDPD6ZWL2_js.a(Ql,"isNotificationSensitivity");function Oa(e){return J(e,Po)}chunkDPD6ZWL2_js.a(Oa,"isNotificationInboxState");function ka(e){return J(e,Mo)}chunkDPD6ZWL2_js.a(ka,"isNotificationWorkState");function Zl(e){return U(e)&&D(e,"type")&&D(e,"id")}chunkDPD6ZWL2_js.a(Zl,"isNotificationSubject");function Xl(e){return U(e)&&D(e,"fieldKey")&&Object.hasOwn(e,"value")&&q(e,"version")}chunkDPD6ZWL2_js.a(Xl,"isRecordFieldPatch");function ed(e){return e.type==="record.patch"&&D(e,"objectId")&&D(e,"recordId")&&q(e,"recordVersion")&&N(e,"label",H)&&N(e,"metadata",U)&&N(e,"fieldsWithheld",t=>t===true)&&Array.isArray(e.fieldPatches)&&e.fieldPatches.every(Xl)&&D(e,"updatedAt")}chunkDPD6ZWL2_js.a(ed,"isRecordPatchPayload");function td(e){return e.type==="record.deleted"&&D(e,"objectId")&&D(e,"recordId")&&q(e,"recordVersion")&&D(e,"deletedAt")}chunkDPD6ZWL2_js.a(td,"isRecordDeletedPayload");function nd(e){return e.type==="record.removed"&&pn(e,Ul)&&D(e,"objectId")&&D(e,"recordId")&&q(e,"recordVersion")}chunkDPD6ZWL2_js.a(nd,"isRecordRemovedPayload");function rd(e){return U(e)&&pn(e,zl)&&D(e,"id")&&D(e,"objectId")&&J(e.visibility,["workspace","private"])&&Ci(e.ownedBy)&&(e.visibility==="workspace"&&e.ownedBy===null||e.visibility==="private"&&Dt(e.ownedBy))&&D(e,"label")&&U(e.values)&&N(e,"metadata",U)&&G(e,"createdAt")&&G(e,"updatedAt")&&N(e,"createdBy",H)&&N(e,"lastUpdatedBy",H)&&q(e,"schemaVersion")}chunkDPD6ZWL2_js.a(rd,"isRecordLiveSnapshot");function id(e){return e.type==="record.created"&&pn(e,ql)&&D(e,"objectId")&&D(e,"recordId")&&q(e,"recordVersion")&&rd(e.record)&&e.record.id===e.recordId&&e.record.objectId===e.objectId}chunkDPD6ZWL2_js.a(id,"isRecordCreatedPayload");function od(e){return e.type==="view.projection.stale"&&D(e,"viewId")&&J(e.reason,Bl)}chunkDPD6ZWL2_js.a(od,"isViewProjectionStalePayload");function ad(e){return e.type==="agent.session.patch"&&D(e,"sessionId")&&U(e.patch)&&q(e,"version")&&D(e,"updatedAt")}chunkDPD6ZWL2_js.a(ad,"isAgentSessionPatchPayload");function sd(e){return U(e)&&D(e,"id")&&D(e,"tenantId")&&N(e,"senderActorId",H)&&N(e,"rootActorId",H)&&N(e,"triggeredByActorId",H)&&Hl(e.kind)&&D(e,"type")&&N(e,"subject",Zl)&&D(e,"title")&&N(e,"summary",H)&&U(e.payload)&&Jl(e.priority)&&Ql(e.sensitivity)&&N(e,"threadKey",H)&&N(e,"idempotencyKey",H)&&N(e,"expiresAt",xe)&&G(e,"createdAt")&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(sd,"isLiveNotification");function cd(e){return U(e)&&D(e,"id")&&D(e,"tenantId")&&D(e,"notificationId")&&D(e,"recipientActorId")&&Oa(e.inboxState)&&ka(e.workState)&&N(e,"lockedAt",xe)&&N(e,"lockedByActorId",H)&&N(e,"readAt",xe)&&N(e,"archivedAt",xe)&&N(e,"snoozedUntil",xe)&&N(e,"completedAt",xe)&&N(e,"dismissedAt",xe)&&G(e,"createdAt")&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(cd,"isLiveNotificationRecipient");function ud(e){return U(e)?Object.keys(e).every(t=>$l.includes(t))&&N(e,"inboxState",Oa)&&N(e,"workState",ka)&&N(e,"lockedAt",lt)&&N(e,"lockedByActorId",Ci)&&N(e,"readAt",lt)&&N(e,"archivedAt",lt)&&N(e,"snoozedUntil",lt)&&N(e,"completedAt",lt)&&N(e,"dismissedAt",lt)&&N(e,"updatedAt",xe):false}chunkDPD6ZWL2_js.a(ud,"isNotificationRecipientPatch");function ld(e){let t=sd(e.notification)?e.notification:null;return e.type==="notification.created"&&t!==null&&Array.isArray(e.recipients)&&e.recipients.length>0&&e.recipients.every(n=>cd(n)&&n.notificationId===t.id)&&q(e,"version")&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(ld,"isNotificationCreatedPayload");function dd(e){return e.type==="notification.recipient.patch"&&D(e,"recipientId")&&D(e,"recipientActorId")&&ud(e.patch)&&q(e,"version")&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(dd,"isNotificationRecipientPatchPayload");function pd(e){return e.type==="notification.count.patch"&&D(e,"targetActorId")&&q(e,"unread")&&q(e,"pendingWork")&&q(e,"version")&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(pd,"isNotificationCountPatchPayload");function md(e){return e.type==="notification.inbox.archived"&&pn(e,Wl)&&le(e,"targetActorId")&&q(e,"archivedCount")&&q(e,"version")&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(md,"isNotificationInboxArchivedPayload");var fd=["armed","disarmed"],bd=["authoring","compiling","replaying","promoted","failed"],gd=["promoted","lkg"];function yd(e){if(e.type!=="architect.draft.updated"||!U(e.receipt))return false;let t=e.receipt;return Array.isArray(t.operationIds)&&t.operationIds.every(Dt)&&U(t.revision)&&le(t.revision,"draftId")&&q(t.revision,"version")&&Array.isArray(t.changedTargets)&&t.changedTargets.every(n=>U(n)&&Dt(n.token)&&hd(n.target))}chunkDPD6ZWL2_js.a(yd,"isArchitectDraftUpdatedPayload");function hd(e){if(!U(e))return false;let t=Object.keys(e);return t.every(n=>Dt(e[n]))?le(e,"viewName")?le(e,"objectName")&&t.every(n=>["objectName","viewName","contentName"].includes(n)):le(e,"objectName")?t.length===1:le(e,"objectId")&&t.length<=2&&t.every(n=>["objectId","attributeName","attributeId","recordId"].includes(n)):false}chunkDPD6ZWL2_js.a(hd,"isNamedTarget");function Ad(e){return e.type==="reflex.state.changed"&&le(e,"reflexId")&&J(e.state,fd)&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(Ad,"isReflexStateChangedPayload");function xd(e){return e.type==="reflex.run.completed"&&le(e,"reflexId")&&le(e,"runId")&&J(e.served,gd)&&q(e,"version")&&q(e,"wallMs")&&G(e,"completedAt")}chunkDPD6ZWL2_js.a(xd,"isReflexRunCompletedPayload");function Td(e){return e.type==="reflex.authoring.progress"&&le(e,"reflexId")&&J(e.status,bd)&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(Td,"isReflexAuthoringProgressPayload");var wd=["none","scheduled","recording","completed","failed"];function Sd(e){return e.type==="meeting.recording.patch"&&le(e,"meetingId")&&J(e.status,wd)&&Ci(e.failureReason)&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(Sd,"isMeetingRecordingPatchPayload");var Id=["ok","low","exhausted","paused"],Rd=["metering-only","contract","wallet"];function Cd(e){return e.type==="wallet.state"&&J(e.status,Id)&&J(e.mode,Rd)&&G(e,"updatedAt")}chunkDPD6ZWL2_js.a(Cd,"isWalletStatePayload");function vd(e){return e.type==="channel.revoked"&&D(e,"channel")&&J(e.reason,Ll)}chunkDPD6ZWL2_js.a(vd,"isChannelRevokedPayload");function vi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(vi,"isRecord");function Ed(e){let{channel:t}=e;return typeof t=="string"&&Da(t)?t:null}chunkDPD6ZWL2_js.a(Ed,"payloadChannel");function xS(e){return vi(e)?Ed(e):null}chunkDPD6ZWL2_js.a(xS,"getLiveProtocolPayloadChannel");function TS(e){return vi(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"&&vi(e.payload):false}chunkDPD6ZWL2_js.a(TS,"isLiveEventEnvelope");var IS=["if","concat","sum","avg","count","min","max","earliest","latest","unique","first","percent_empty","percent_not_empty","count_empty","count_not_empty","count_unique"],Ot={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 mn(e){return Object.hasOwn(Ot,e)}chunkDPD6ZWL2_js.a(mn,"isComputedFunctionName");var Oi=class Oi extends Error{constructor(t){super(t),this.name="ComputedFormulaCompileError";}};chunkDPD6ZWL2_js.a(Oi,"ComputedFormulaCompileError");var I=Oi;function bn(e){let t=Nd(e.expression),n=fn(t,e.schema),r=Qd(n.valueType);if(r!==e.returnType)throw new I(`Computed formula "${e.attributeName}" returns "${r}", expected "${e.returnType}"`);if(Ba(e.returnType)&&n.optionsSource===void 0)throw new I(`Computed formula "${e.attributeName}" returns "${e.returnType}" without optionsSource`);let o=n.optionsSource===void 0?[]:[{kind:"options",source:n.optionsSource}],a=Di([...n.dependencies,...o]);return {kind:"formula",attributeName:e.attributeName,expression:e.expression,returnType:e.returnType,valueType:n.valueType,dependencies:a,ast:t,...n.optionsSource?{optionsSource:n.optionsSource}:{},...n.targetAttributeType?{targetAttributeType:n.targetAttributeType}:{},dependenciesHash:Zd({expression:e.expression,returnType:e.returnType,dependencies:a})}}chunkDPD6ZWL2_js.a(bn,"compileComputedFormula");function Va(e){let t=new Map(e.map(o=>[o.attributeName,o])),n=new Set,r=chunkDPD6ZWL2_js.a((o,a)=>{let s=a.indexOf(o);if(s!==-1){let l=[...a.slice(s),o];throw new I(`Computed field cycle detected: ${l.join(" -> ")}`)}if(n.has(o))return;let c=t.get(o);if(c===void 0)return;let u=[...a,o];for(let l of c.dependencies)l.kind==="computed"&&r(l.attributeName,u);n.add(o);},"visit");for(let o of e)r(o.attributeName,[]);}chunkDPD6ZWL2_js.a(Va,"assertAcyclicComputedDependencies");function Nd(e){try{return chunk2M4YXNYZ_js.v(e)}catch(t){throw t instanceof Error?new I(t.message):t}}chunkDPD6ZWL2_js.a(Nd,"parseCompileFormula");function fn(e,t){switch(e.kind){case "literal":return {valueType:Dd(e.value),dependencies:[],...typeof e.value=="string"?{literalString:e.value}:{}};case "path":return Od(e.parts,t);case "call":return Fd(e.functionName,e.args,t);case "binary":return Ud(e.operator,fn(e.left,t),fn(e.right,t));default:return e}}chunkDPD6ZWL2_js.a(fn,"inferNode");function Dd(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(Dd,"literalToValueType");function Od(e,t){if(e.length===1){let n=e[0],r=Ei(t,n);if(r===void 0)throw new I(`Unknown attribute "${n}" on object "${t.objectName}"`);return r.type==="relation"?{valueType:_d(),dependencies:[{kind:"relation",relationName:r.name,cardinality:ja(r)}],targetAttributeType:r.type}:{valueType:_a(r),dependencies:[jd(r)],optionsSource:Pa(t.objectName,r),targetAttributeType:r.type}}if(e.length===2){let[n,r]=e,o=Ei(t,n);if(o===void 0)throw new I(`Unknown attribute "${n}" on object "${t.objectName}"`);if(o.type!=="relation")throw new I(`Attribute "${n}" on object "${t.objectName}" is not a relation`);let a=kd(o);if(a===void 0)throw new I(`Relation "${n}" on object "${t.objectName}" is missing targetObjectName`);let s=t.relatedObjects?.[a];if(s===void 0)throw new I(`Unknown related object "${a}"`);let c=Ei(s,r);if(c===void 0)throw new I(`Unknown attribute "${r}" on object "${s.objectName}"`);let u=_a(c);return {valueType:o.cardinality==="many"?Md(u):u,dependencies:[{kind:"relation",relationName:n,targetAttributeName:r,cardinality:ja(o)}],optionsSource:Pa(s.objectName,c),targetAttributeType:c.type}}throw new I("Computed paths support at most one relation hop")}chunkDPD6ZWL2_js.a(Od,"inferPath");function Ei(e,t){return e.attributes.find(n=>n.name===t)}chunkDPD6ZWL2_js.a(Ei,"findAttribute");function kd(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(kd,"getRelationTargetObjectName");function ja(e){return e.cardinality??"one"}chunkDPD6ZWL2_js.a(ja,"relationCardinality");function jd(e){return e.type==="formula"||e.type==="rollup"?{kind:"computed",attributeName:e.name}:{kind:"local",attributeName:e.name}}chunkDPD6ZWL2_js.a(jd,"localDependencyFor");function _a(e){if(e.type==="formula"||e.type==="rollup"){if(e.returnType===void 0)throw new I(`Computed attribute "${e.name}" is missing returnType`);return Pd(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(_a,"attributeToValueType");function _d(){return {kind:"collection",itemType:"text"}}chunkDPD6ZWL2_js.a(_d,"relationToValueType");function Pd(e){return e==="multiselect"?{kind:"collection",itemType:"select"}:{kind:"scalar",type:e}}chunkDPD6ZWL2_js.a(Pd,"returnTypeToValueType");function Md(e){return e.kind==="collection"?e:{kind:"collection",itemType:e.type}}chunkDPD6ZWL2_js.a(Md,"asCollectionValueType");function Pa(e,t){if(t.type==="formula"||t.type==="rollup")return Ba(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(Pa,"optionsSourceForAttribute");function Fd(e,t,n){if(!mn(e))throw new I(`Unknown computed function "${e}"`);let r=Ot[e];if(t.length<r.minArgs||r.maxArgs!==void 0&&t.length>r.maxArgs){let a=r.maxArgs===void 0||r.maxArgs===r.minArgs?String(r.minArgs):`${r.minArgs}-${r.maxArgs}`;throw new I(`Function "${e}" expects ${a} arguments, received ${t.length}`)}let o=t.map(a=>fn(a,n));return Vd(e,o)}chunkDPD6ZWL2_js.a(Fd,"inferCall");function Vd(e,t){let n=Di(t.flatMap(r=>r.dependencies));switch(e){case "if":return Bd(t,n);case "concat":return qd(t,`Function "${e}" does not accept collection values`),{valueType:{kind:"scalar",type:"text"},dependencies:n};case "sum":case "avg":return Ma(e,t[0],"number"),{valueType:{kind:"scalar",type:"number"},dependencies:n};case "count":case "count_empty":case "count_not_empty":case "count_unique":case "percent_empty":case "percent_not_empty":return Wd(e,t[0]),{valueType:{kind:"scalar",type:"number"},dependencies:n};case "min":case "max":return zd(e,t[0]),{valueType:Gd(t[0]),dependencies:n,optionsSource:t[0].optionsSource,targetAttributeType:t[0].targetAttributeType};case "earliest":case "latest":return Ma(e,t[0],"date"),{valueType:{kind:"scalar",type:"date"},dependencies:n,targetAttributeType:t[0].targetAttributeType};case "unique":return Ld(t[0],n);case "first":return $d(t[0],n);default:return e}}chunkDPD6ZWL2_js.a(Vd,"inferFunctionReturn");function Bd(e,t){Ni(e[0].valueType,"boolean",'Function "if" condition must be boolean');let n=e[1],r=e[2],o=Yd(n,r),a=Hd(n,r);if(o===void 0)throw new I('Function "if" branches must return the same type');return {valueType:o,dependencies:t,...a?{optionsSource:a}:{},targetAttributeType:n.targetAttributeType??r.targetAttributeType}}chunkDPD6ZWL2_js.a(Bd,"inferIfFunction");function Ld(e,t){if(e.valueType.kind!=="collection"||e.valueType.itemType!=="select")throw new I('Function "unique" expects a select collection');return {valueType:{kind:"collection",itemType:"select"},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a(Ld,"inferUniqueFunction");function $d(e,t){if(e.valueType.kind!=="collection")throw new I('Function "first" expects a collection');return {valueType:{kind:"scalar",type:e.valueType.itemType},dependencies:t,optionsSource:e.optionsSource,targetAttributeType:e.targetAttributeType}}chunkDPD6ZWL2_js.a($d,"inferFirstFunction");function Ud(e,t,n){let r=Di([...t.dependencies,...n.dependencies]),o=e==="+"||e==="-"||e==="*"||e==="/";if(t.valueType.kind==="collection"||n.valueType.kind==="collection")throw new I(`Cannot use collection values with ${o?"arithmetic":"comparison"} operator "${e}"`);if(o)return e==="+"&&(t.valueType.type==="text"||n.valueType.type==="text")?{valueType:{kind:"scalar",type:"text"},dependencies:r}:(Ni(t.valueType,"number",`Operator "${e}" expects number operands`),Ni(n.valueType,"number",`Operator "${e}" expects number operands`),{valueType:{kind:"scalar",type:"number"},dependencies:r});if(e==="=="||e==="!="){if(t.valueType.type!==n.valueType.type)throw new I(`Operator "${e}" expects operands with the same scalar type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:r}}if((t.valueType.type!=="number"||n.valueType.type!=="number")&&(t.valueType.type!=="date"||n.valueType.type!=="date"))throw new I(`Operator "${e}" expects number or date operands of the same type`);return {valueType:{kind:"scalar",type:"boolean"},dependencies:r}}chunkDPD6ZWL2_js.a(Ud,"inferBinary");function qd(e,t){for(let n of e)if(n.valueType.kind==="collection")throw new I(t)}chunkDPD6ZWL2_js.a(qd,"ensureNoCollections");function Ma(e,t,n){if((t.valueType.kind==="collection"?t.valueType.itemType:t.valueType.type)!==n)throw new I(`Function "${e}" expects ${n} values`)}chunkDPD6ZWL2_js.a(Ma,"ensureCollectionOrScalarType");function zd(e,t){if(t.valueType.kind!=="collection")throw new I(`Function "${e}" expects a collection`);let n=t.valueType.itemType;if(n!=="number"&&n!=="date")throw new I(`Function "${e}" expects number or date values`)}chunkDPD6ZWL2_js.a(zd,"ensureMinMaxSource");function Wd(e,t){if(t.valueType.kind!=="collection")throw new I(`Function "${e}" expects a collection`)}chunkDPD6ZWL2_js.a(Wd,"ensureCollectionSource");function Ni(e,t,n){if(e.kind!=="scalar"||e.type!==t)throw new I(n)}chunkDPD6ZWL2_js.a(Ni,"ensureScalarType");function Gd(e){return e.valueType.kind==="scalar"?e.valueType:{kind:"scalar",type:e.valueType.itemType}}chunkDPD6ZWL2_js.a(Gd,"sourceItemValueType");function Kd(e,t){return e.kind==="scalar"?t.kind==="scalar"&&e.type===t.type:t.kind==="collection"&&e.itemType===t.itemType}chunkDPD6ZWL2_js.a(Kd,"sameValueType");function Yd(e,t){if(Kd(e.valueType,t.valueType)||Fa(e,t))return e.valueType;if(Fa(t,e))return t.valueType}chunkDPD6ZWL2_js.a(Yd,"resolveIfBranchValueType");function Fa(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(Fa,"isSelectScalarWithStringLiteral");function Hd(e,t){let n=e.optionsSource,r=t.optionsSource;if(n!==void 0&&r!==void 0&&!Jd(n,r))throw new I('Function "if" branches use incompatible options sources');return n??r}chunkDPD6ZWL2_js.a(Hd,"resolveIfOptionsSource");function Jd(e,t){return e.objectName===t.objectName&&e.attributeName===t.attributeName&&e.attributeId===t.attributeId}chunkDPD6ZWL2_js.a(Jd,"sameOptionsSource");function Ba(e){return e==="select"||e==="multiselect"}chunkDPD6ZWL2_js.a(Ba,"isSelectLikeReturnType");function Qd(e){if(e.kind==="scalar")return e.type;if(e.itemType==="select")return "multiselect";throw new I(`Collection item type "${e.itemType}" cannot be used as a computed return type`)}chunkDPD6ZWL2_js.a(Qd,"valueTypeToReturnType");function Di(e){let t=new Set,n=[];for(let r of e){let o=JSON.stringify(kt(r));t.has(o)||(t.add(o),n.push(r));}return n}chunkDPD6ZWL2_js.a(Di,"uniqueDependencies");function Zd(e){let t=e.dependencies.map(n=>kt(n)).sort((n,r)=>La(JSON.stringify(n),JSON.stringify(r)));return JSON.stringify(kt({expression:e.expression,returnType:e.returnType,dependencies:t}))}chunkDPD6ZWL2_js.a(Zd,"createDependenciesHash");function kt(e){return Array.isArray(e)?e.map(t=>kt(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>La(t,n)).map(([t,n])=>[t,kt(n)])):e}chunkDPD6ZWL2_js.a(kt,"stableNormalize");function La(e,t){return e<t?-1:e>t?1:0}chunkDPD6ZWL2_js.a(La,"compareStrings");function Xd(e){return e.function==="count"?`count(${e.relationAttribute})`:`${np(e.function)}(${e.relationAttribute}.${e.targetAttribute})`}chunkDPD6ZWL2_js.a(Xd,"rollupToFormulaExpression");function ep(e,t){if(e.function==="count")return "number";let n=rp(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(!op(n.type))throw new I('Rollup "original" requires a select, status, or multiselect target');return "multiselect";default:return e.function}}chunkDPD6ZWL2_js.a(ep,"inferRollupReturnType");function Ua(e,t){let n=Xd(e),r=ep(e,t);return {...bn({attributeName:e.name,expression:n,returnType:r,schema:tp(e,t)}),kind:"rollup"}}chunkDPD6ZWL2_js.a(Ua,"compileRollupAttribute");function tp(e,t){return {...t,attributes:t.attributes.map(n=>n.name===e.relationAttribute&&n.type==="relation"?{...n,cardinality:"many"}:n)}}chunkDPD6ZWL2_js.a(tp,"schemaWithRollupRelationAsMany");function np(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(np,"rollupFunctionToFormulaFunction");function rp(e,t){let n=$a(t,e.relationAttribute);if(n===void 0)throw new I(`Unknown relation attribute "${e.relationAttribute}" on object "${t.objectName}"`);if(n.type!=="relation")throw new I(`Attribute "${e.relationAttribute}" on object "${t.objectName}" is not a relation`);let r=ip(n);if(r===void 0)throw new I(`Relation "${e.relationAttribute}" on object "${t.objectName}" is missing targetObjectName`);let o=t.relatedObjects?.[r];if(o===void 0)throw new I(`Unknown related object "${r}"`);let a=$a(o,e.targetAttribute);if(a===void 0)throw new I(`Unknown attribute "${e.targetAttribute}" on object "${o.objectName}"`);return a}chunkDPD6ZWL2_js.a(rp,"findRollupTargetAttribute");function $a(e,t){return e.attributes.find(n=>n.name===t)}chunkDPD6ZWL2_js.a($a,"findAttribute");function ip(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(ip,"getRelationTargetObjectName");function op(e){return e==="select"||e==="status"||e==="multiselect"}chunkDPD6ZWL2_js.a(op,"isSelectLikeAttributeType");function ve(e,t){switch(e.kind){case "literal":return e.value;case "path":return sp(t,e.parts);case "binary":return cp(e.operator,ve(e.left,t),ve(e.right,t));case "call":return ap(e.functionName,e.args,t);default:return e}}chunkDPD6ZWL2_js.a(ve,"evaluateAst");function ap(e,t,n){if(lp(e),dp(e,t.length),e==="if"){let r=ve(t[0],n);return r===null?null:ve(r?t[1]:t[2],n)}return pp(e,t.map(r=>ve(r,n)))}chunkDPD6ZWL2_js.a(ap,"evaluateCallNode");function sp(e,t){return t.reduce((n,r)=>Ya(n,r),e)}chunkDPD6ZWL2_js.a(sp,"resolvePath");function Ya(e,t){if(Array.isArray(e))return e.map(r=>Ya(r,t));if(!Ka(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let n=e.values;return Ka(n)&&Object.hasOwn(n,t)?n[t]??null:null}chunkDPD6ZWL2_js.a(Ya,"resolvePathPart");function cp(e,t,n){switch(e){case "+":return up(t,n);case "-":return yn(t,n,(r,o)=>r-o);case "*":return yn(t,n,(r,o)=>r*o);case "/":return yn(t,n,(r,o)=>r/o);case ">":return gn(t,n,r=>r>0);case "<":return gn(t,n,r=>r<0);case ">=":return gn(t,n,r=>r>=0);case "<=":return gn(t,n,r=>r<=0);case "==":return qa(t,n);case "!=":{let r=qa(t,n);return r===null?null:!r}default:return e}}chunkDPD6ZWL2_js.a(cp,"evaluateBinary");function up(e,t){return typeof e=="string"||typeof t=="string"?`${e??""}${t??""}`:yn(e,t,(n,r)=>n+r)}chunkDPD6ZWL2_js.a(up,"add");function gn(e,t,n){let r=Ha(e,t);return r===null?null:n(r)}chunkDPD6ZWL2_js.a(gn,"compareWith");function Ha(e,t){if(!dt([e,t]))return null;let n=pt(e),r=pt(t);if(n!==null&&r!==null)return n-r;let o=_i(e),a=_i(t);return o&&a?o.getTime()-a.getTime():null}chunkDPD6ZWL2_js.a(Ha,"compare");function qa(e,t){return e===t?true:e==null||t===null||t===void 0?false:dt([e,t])?Ha(e,t)===0:null}chunkDPD6ZWL2_js.a(qa,"equalScalar");function lp(e){if(!mn(e))throw new Error(`Unknown computed function "${e}"`)}chunkDPD6ZWL2_js.a(lp,"assertComputedFunctionName");function dp(e,t){let{minArgs:n,maxArgs:r}=Ot[e];if(t>=n&&t<=(r??Number.POSITIVE_INFINITY))return;let o=r===void 0?`at least ${n}`:`between ${n} and ${r}`;throw new Error(`Function "${e}" expects ${o} arguments, received ${t}`)}chunkDPD6ZWL2_js.a(dp,"validateArity");function pp(e,t){switch(e){case "concat":return t.filter(n=>n!=null).map(String).join("");case "sum":return dt(t)?ki(t).reduce((n,r)=>n+r,0):null;case "avg":{if(!dt(t))return null;let n=ki(t);return n.length>0?n.reduce((r,o)=>r+o,0)/n.length:null}case "count":return We(t[0]).length;case "min":return za(t,"min");case "max":return za(t,"max");case "earliest":return ji(t,"min");case "latest":return ji(t,"max");case "unique":return Ga(We(t[0]));case "first":return We(t[0]).find(n=>n!=null)??null;case "percent_empty":return Wa(t[0],true);case "percent_not_empty":return Wa(t[0],false);case "count_empty":return We(t[0]).filter(chunkIBM4ID4Y_js.a).length;case "count_not_empty":return We(t[0]).filter(n=>!chunkIBM4ID4Y_js.a(n)).length;case "count_unique":return Ga(We(t[0])).length;default:return e}}chunkDPD6ZWL2_js.a(pp,"evaluateCall");function ki(e){return hn(e).map(pt).filter(t=>t!==null)}chunkDPD6ZWL2_js.a(ki,"numericValues");function dt(e){let t=new Set;for(let n of hn(e))Pi(n)&&t.add(Ja(n));return t.size<=1}chunkDPD6ZWL2_js.a(dt,"areCommensurable");function Ja(e){return e.code.toUpperCase()}chunkDPD6ZWL2_js.a(Ja,"currencyCode");function yn(e,t,n){if(!dt([e,t]))return null;let r=pt(e),o=pt(t);if(r===null||o===null)return null;let a=n(r,o);return Number.isFinite(a)?a:null}chunkDPD6ZWL2_js.a(yn,"numericBinary");function za(e,t){if(!dt(e))return null;let n=ki(e);return n.length>0?t==="min"?Math.min(...n):Math.max(...n):ji(e,t)}chunkDPD6ZWL2_js.a(za,"minMax");function ji(e,t){let n=hn(e).map(_i).filter(a=>a!==null);if(n.length===0)return null;let r=n.map(a=>a.getTime()),o=t==="min"?Math.min(...r):Math.max(...r);return new Date(o).toISOString()}chunkDPD6ZWL2_js.a(ji,"dateMinMax");function Wa(e,t){let n=We(e);return n.length===0?0:n.filter(o=>chunkIBM4ID4Y_js.a(o)===t).length/n.length}chunkDPD6ZWL2_js.a(Wa,"percentByEmptyState");function Ga(e){let t=new Set,n=[];for(let r of e){if(chunkIBM4ID4Y_js.a(r))continue;let o=mp(r);t.has(o)||(t.add(o),n.push(r));}return n}chunkDPD6ZWL2_js.a(Ga,"uniqueNonEmpty");function We(e){return e==null?[]:Array.isArray(e)?hn(e):[e]}chunkDPD6ZWL2_js.a(We,"collectionItems");function hn(e){return e.flat(Number.POSITIVE_INFINITY)}chunkDPD6ZWL2_js.a(hn,"flatten");function pt(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 Pi(e)&&Number.isFinite(e.value)?e.value:null}chunkDPD6ZWL2_js.a(pt,"toFiniteNumber");function Pi(e){return typeof e=="object"&&e!==null&&typeof e.value=="number"&&typeof e.code=="string"}chunkDPD6ZWL2_js.a(Pi,"isCurrencyValue");function _i(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!="string"){let n=tt(e);if(n===null)return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}chunkDPD6ZWL2_js.a(_i,"toDate");function mp(e){if(Pi(e))return `currency:${Ja(e)}:${e.value}`;let t=pt(e);return t!==null?`number:${t}`:e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`}chunkDPD6ZWL2_js.a(mp,"uniqueKey");function Ka(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}chunkDPD6ZWL2_js.a(Ka,"isPlainRecord");function fp(e,t,n){if(e==null)return null;let r=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:n!==void 0?Number(o.toFixed(n)):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=r(o);if(a!==null)return a}return null}return r(e);case "multiselect":return Array.isArray(e)?e.flatMap(o=>{if(o==null)return [];let a=r(o);return a===null?[]:[a]}):r(e)===null?[]:[String(e)];default:{let o=t;throw new Error(`Unsupported computed return type: ${o}`)}}}chunkDPD6ZWL2_js.a(fp,"formatComputedResult");function VS(e,t){return ve(e,t)}chunkDPD6ZWL2_js.a(VS,"evaluateComputedAst");function BS(e,t){return ve(chunk2M4YXNYZ_js.v(e),t)}chunkDPD6ZWL2_js.a(BS,"evaluateComputedFormula");function LS(e,t,n,r){try{let o=ve(chunk2M4YXNYZ_js.v(e),t);return {value:n?fp(o,n,r):o}}catch(o){return {value:null,error:o instanceof Error?o.message:String(o)}}}chunkDPD6ZWL2_js.a(LS,"evaluateComputedFormulaWithResult");var qS=[{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 Qa=chunkDPD6ZWL2_js.a(e=>chunkIBM4ID4Y_js.a(e)||Array.isArray(e)&&e.length===0,"isEmpty"),Q=chunkDPD6ZWL2_js.a(e=>e==null?"":String(e),"toStr"),Tn=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"),wn=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"),An=chunkDPD6ZWL2_js.a(e=>Array.isArray(e)?e:e==null?[]:[e],"toArr"),bp=chunkDPD6ZWL2_js.a((e,t,n)=>{let r=Tn(e),o=Tn(t);return r!==null&&o!==null&&n(r,o)},"compareNumbers"),gp=chunkDPD6ZWL2_js.a((e,t,n)=>{let r=wn(e),o=wn(t);return r!==null&&o!==null&&n(r.getTime(),o.getTime())},"compareDates"),Za=chunkDPD6ZWL2_js.a((e,t,n)=>{if(n.type==="number"||n.type==="currency"){let r=Tn(e),o=Tn(t);if(r!==null&&o!==null)return r===o}return Q(e)===Q(t)},"equalsForAttr");function KS(e,t){return e?e==="checkbox":typeof t=="boolean"}chunkDPD6ZWL2_js.a(KS,"isCheckboxEquality");var xn=chunkDPD6ZWL2_js.a(e=>({appliesTo:["number","currency","date","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((t,n,r)=>r.type==="date"?gp(t,n,e):bp(t,n,e),"evaluateInMemory")}),"orderingSpec"),Sn={is:{appliesTo:["text","phone","number","currency","checkbox","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,n)=>n.type==="checkbox"?e===true==(t===true):Za(e,t,n),"evaluateInMemory")},is_not:{appliesTo:["text","phone","number","currency","status","select","date","user","relation","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t,n)=>!Za(e,t,n),"evaluateInMemory")},contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>Q(e).toLowerCase().includes(Q(t).toLowerCase()),"evaluateInMemory")},not_contains:{appliesTo:["text","phone","formula"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>!Q(e).toLowerCase().includes(Q(t).toLowerCase()),"evaluateInMemory")},starts_with:{appliesTo:["text","phone"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>Q(e).toLowerCase().startsWith(Q(t).toLowerCase()),"evaluateInMemory")},ends_with:{appliesTo:["text"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>Q(e).toLowerCase().endsWith(Q(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=>Qa(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=>!Qa(e),"evaluateInMemory")},less_than:xn((e,t)=>e<t),greater_than:xn((e,t)=>e>t),less_or_equal:xn((e,t)=>e<=t),greater_or_equal:xn((e,t)=>e>=t),is_within:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=wn(e),r=chunkMXZ3AF5X_js.K(t);return n&&r?n.getTime()>=r.startMs&&n.getTime()<r.endMs:false},"evaluateInMemory")},on_day_month:{appliesTo:["date"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=wn(e);if(!n)return false;let r=t;return n.getMonth()+1===r.month&&n.getDate()===r.day},"evaluateInMemory")},any_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=An(t).map(Q);return An(e).map(Q).some(o=>n.includes(o))},"evaluateInMemory")},none_of:{appliesTo:["status","select","multiselect","user","relation"],evaluateInMemory:chunkDPD6ZWL2_js.a((e,t)=>{let n=An(t).map(Q);return !An(e).map(Q).some(o=>n.includes(o))},"evaluateInMemory")}};var yp=chunkDPD6ZWL2_js.a((e,t)=>({id:`system:${e}`,name:e,label:e,type:t,system:true}),"systemAttribute"),hp=[...Object.entries(chunkMXZ3AF5X_js.N).map(([e,t])=>yp(e,t))];function iI(e,t,n){let r=t;return Ap(e,{...t.values,id:t.id,objectId:t.objectId,objectName:r.objectName,tenantId:r.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},[...n,...hp])}chunkDPD6ZWL2_js.a(iI,"evaluateRecordFilterState");function Ap(e,t,n){if(e.rules.length===0)return true;let r=new Map(n.map(a=>[a.name,a])),o=e.combinator==="or"?"some":"every";return e.rules[o](a=>xp(a,t,r))}chunkDPD6ZWL2_js.a(Ap,"evaluateFilterState");function xp(e,t,n){let r=n.get(e.attribute);if(!r)return false;if(e.property&&r.type==="location"){if(!(chunkMXZ3AF5X_js.g(e.property)&&chunkMXZ3AF5X_js.h(e.operator)))return false;let c=Sn[e.operator];if(!c)return false;let u=t[e.attribute],l=typeof u=="object"&&u!==null?u[e.property]:void 0;return Mi(c,"text",e.operator,l,e.value,r)}if(e.property){let c=Zt(r).find(g=>g.name===e.property);if(!c)return false;let u=chunkMXZ3AF5X_js.C(e.operator),l=Sn[u];if(!l?.appliesTo.includes(c.type))return false;let m=t[e.attribute],b=(Array.isArray(m)?m:m==null?[]:[m]).some(g=>{if(typeof g!="object"||g===null)return false;let y=g.props;return typeof y!="object"||y===null?false:Mi(l,c.type,u,y[e.property],e.value,c)});return (e.quantifier??chunkMXZ3AF5X_js.B(e.operator))==="none"?!b:b}let o=Sn[e.operator];if(!o||!o.appliesTo.includes(r.type))return false;let a=t[e.attribute],s=r.type==="relation"||r.type==="document"||r.type==="user"?Sp(a):a;return Mi(o,r.type,e.operator,s,e.value,r)}chunkDPD6ZWL2_js.a(xp,"evaluateRule");function Mi(e,t,n,r,o,a){let[s,c]=Tp(t,n,r,o);return t==="phone"&&c===""&&n==="contains"?false:t==="phone"&&c===""&&n==="not_contains"?true:e.evaluateInMemory(s,c,a)}chunkDPD6ZWL2_js.a(Mi,"evaluateNormalizedComparands");function Tp(e,t,n,r){return e==="date"&&(t==="is"||t==="is_not")?[Xa(n),Xa(r)]:e==="phone"?wp(n,r):[es(e,n),es(e,r)]}chunkDPD6ZWL2_js.a(Tp,"normalizeOperatorComparands");function Xa(e){let t=Oe(e)?tt(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 n=new Date(t);return Number.isNaN(n.getTime())?null:n.toISOString().slice(0,10)}chunkDPD6ZWL2_js.a(Xa,"normalizeUtcCalendarDay");function wp(e,t){let n=typeof t=="object"&&t!==null?t:{},r=typeof n.countryCode=="string"?n.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(!r)return chunkGXSNLYRR_js.a(s.phoneNumber);let c=typeof s.countryCode=="string"?s.countryCode:r;return `${c}:${chunkGXSNLYRR_js.b(s.phoneNumber,c)}`},"normalizeOne");return [o(e),o(t)]}chunkDPD6ZWL2_js.a(wp,"normalizePhoneComparands");function es(e,t){return e==="currency"?chunkMXZ3AF5X_js.z(t):e==="date"?Oe(t)?tt(t):t instanceof Date?Number.isNaN(t.getTime())?null:t.toISOString():t:t}chunkDPD6ZWL2_js.a(es,"normalizeComparableValue");function Sp(e){let t=chunkDPD6ZWL2_js.a(n=>typeof n!="object"||n===null?n:n.id,"normalizeOne");return Array.isArray(e)?e.map(t):t(e)}chunkDPD6ZWL2_js.a(Sp,"normalizeReferenceIds");var ts="today";function In(e,t){return new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}chunkDPD6ZWL2_js.a(In,"dateInTimezone");function Ip(e,t){if(!("defaultValue"in e))return;let{defaultValue:n}=e;return e.type!=="date"||n!==ts?n:e.includeTime?t.now.toISOString():In(t.now,t.timezone)}chunkDPD6ZWL2_js.a(Ip,"resolveAttributeDefaultValue");function pI(e,t,n){if(e.combinator==="or"&&e.rules.length>1)return {};let r=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=r.get(a.attribute);if(!s)continue;let c=Rp(a,n);c!==void 0&&(o[a.attribute]=chunkMXZ3AF5X_js.j(s).storage.cardinality==="many"?[c]:c);}return o}chunkDPD6ZWL2_js.a(pI,"deriveCreateDefaultsFromFilters");function Rp(e,t){if(e.operator==="is")return chunkMXZ3AF5X_js.v(e.value)?ns(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 n=e.value[0];return chunkMXZ3AF5X_js.v(n)?ns(n,t):n}}chunkDPD6ZWL2_js.a(Rp,"extractDeterministicValue");function ns(e,t){if(t){if(e.dynamic==="actor")return t.userId;if(e.anchor==="today")return In(t.now,t.timezone);if(e.anchor==="now")return t.now.toISOString()}}chunkDPD6ZWL2_js.a(ns,"resolveDynamicValue");function bI(e){let t=[];return e.canModify&&t.push("modify"),e.canSend&&t.push("send"),t}chunkDPD6ZWL2_js.a(bI,"requestedCapabilities");var gI={status:"connector_status",error:"connector_error",provider:"connector_provider"};var Cp=(t=>(t.Desktop="desktop",t))(Cp||{});function xI(e){return e==="gmail"||e==="outlook"}chunkDPD6ZWL2_js.a(xI,"isMailProvider");var vp=["threads","messages"];function TI(e){return vp.includes(e)}chunkDPD6ZWL2_js.a(TI,"isMailboxListMode");var Ep=["reply","reply_all"];function wI(e){return Ep.includes(e)}chunkDPD6ZWL2_js.a(wI,"isReplyMode");var SI=2e5,II=998;var vI=["force","skip"],EI=["none","all","external_only"],NI="x-fake-signature",DI={override:null,status:"none",failureReason:null,botId:null};var Np=/^Session \d+$/;function rs(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(rs,"buildAgentFallbackTitle");function Dp(e){let t=e.generated?.trim();return t&&!Np.test(t)?t:e.firstUserText?rs(e.firstUserText):e.emptyLabel}chunkDPD6ZWL2_js.a(Dp,"conversationDisplayTitle");var Fi=/^[a-z0-9][a-z0-9-]{0,62}$/;function Op(e){if(!Fi.test(e))throw new chunkJSKLP4GI_js.h(`Invalid schema source id "${e}": expected a lowercase slug matching ${Fi}`,[])}chunkDPD6ZWL2_js.a(Op,"assertSchemaSourceId");function FI(e){let{attributeRemovals:t,objectRemovals:n,renames:r}=e.destructive;return t.length>0||n.length>0||r.length>0}chunkDPD6ZWL2_js.a(FI,"hasDestructiveEntries");var de={objectAdditions:20,totalMutations:500,serializedBytes:512*1024};function Bi(e){return e instanceof Error?e.message:String(e)}chunkDPD6ZWL2_js.a(Bi,"errorMessage");var kp=zod.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 os=zod.z.string().min(1).superRefine((e,t)=>{try{chunk2M4YXNYZ_js.n(e);}catch(n){t.addIssue({code:zod.z.ZodIssueCode.custom,message:Bi(n)});}}).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).'),jp=zod.z.string().min(1).superRefine((e,t)=>{chunk2M4YXNYZ_js.b(e)&&t.addIssue({code:zod.z.ZodIssueCode.custom,message:`"${e}" is a reserved object name (${chunk2M4YXNYZ_js.h.join(", ")}) and cannot be used for a new object.`});try{chunk2M4YXNYZ_js.j(e);}catch(n){t.addIssue({code:zod.z.ZodIssueCode.custom,message:Bi(n)});}}).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 as(e){return e.superRefine((t,n)=>{try{let r=chunk2M4YXNYZ_js.L(t.type,{...t.config??{},description:t.description}),o=Object.keys(t.config??{}).filter(a=>!Object.hasOwn(r,a));o.length>0&&n.addIssue({code:"unrecognized_keys",keys:o,path:["config"],message:`Unrecognized attribute config key${o.length===1?"":"s"}: ${o.join(", ")}`});}catch(r){if(r instanceof chunkJSKLP4GI_js.h){for(let o of r.errors)n.addIssue({code:zod.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}n.addIssue({code:zod.z.ZodIssueCode.custom,path:["config"],message:`Config for type "${t.type}" is invalid or incomplete: ${Bi(r)}`});}})}chunkDPD6ZWL2_js.a(as,"withConfigCheck");var ss=zod.z.object({objectName:zod.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:os,label:zod.z.string().min(1).max(128).describe("Human-readable display label shown in the UI. 1-128 characters, cannot be empty."),type:kp,config:zod.z.record(zod.z.string(),zod.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:zod.z.boolean().optional().describe("Whether the attribute must have a value on every record. Defaults to false (optional)."),description:zod.z.string().optional().describe("Help text shown under the field in the UI. Not the same as the plan's `summary`.")}).strict(),_p=as(ss),Pp=as(ss.omit({objectName:true})),Mp=zod.z.object({name:jp,label:zod.z.string().min(1).describe('Human-readable singular display label (e.g. "Devis").'),pluralLabel:zod.z.string().optional().describe('Human-readable plural display label (e.g. "Devis"/"Invoices"). Defaults from `label` if omitted.'),description:zod.z.string().optional().describe("Help text describing what this object represents."),icon:chunk2M4YXNYZ_js.t.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:nt.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:zod.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(),cs=zod.z.object({attributeRemovals:zod.z.array(zod.z.object({objectName:zod.z.string().min(1).describe("Object the attribute is removed from."),attributeName:zod.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:zod.z.array(zod.z.object({objectName:zod.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:zod.z.array(zod.z.object({objectName:zod.z.string().min(1).describe("Object the renamed attribute belongs to."),from:zod.z.string().min(1).describe("Current attribute name. Must already exist and not be a system attribute."),to:os.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:[]}),us=zod.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."),ls=zod.z.object({objects:zod.z.array(Mp).default([]),attributes:zod.z.array(_p).default([])}).strict().default({objects:[],attributes:[]});function Vi(e,t=[],n=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(n.has(e))return {path:t,message:"Plan input cannot contain circular references"};if(Array.isArray(e)){n.add(e);for(let s of Reflect.ownKeys(e))if(s!=="length"&&(typeof s=="symbol"||!/^(0|[1-9]\d*)$/.test(s)))return n.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 n.delete(e),{path:[...t,s],message:"Plan input cannot contain sparse arrays"};let c=Vi(e[s],[...t,s],n);if(c)return n.delete(e),c}return n.delete(e),null}let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return {path:t,message:"Plan input must contain only plain JSON objects"};n.add(e);let o=e,a=Reflect.ownKeys(o);for(let s of a){let c=Object.getOwnPropertyDescriptor(o,s);if(typeof s=="symbol"||!(c?.enumerable&&"value"in c))return n.delete(e),{path:[...t,s],message:"Plan input objects must contain enumerable JSON data properties only"}}for(let s of a.sort()){let c=Vi(o[s],[...t,s],n);if(c)return n.delete(e),c}return n.delete(e),null}chunkDPD6ZWL2_js.a(Vi,"findJsonSafetyIssue");function Fp(e){let t=[];return e.additive.objects.forEach((n,r)=>{t.push(["additive","objects",r]),n.attributes.forEach((o,a)=>{t.push(["additive","objects",r,"attributes",a]);});}),e.additive.attributes.forEach((n,r)=>{t.push(["additive","attributes",r]);}),e.destructive.attributeRemovals.forEach((n,r)=>{t.push(["destructive","attributeRemovals",r]);}),e.destructive.objectRemovals.forEach((n,r)=>{t.push(["destructive","objectRemovals",r]);}),e.destructive.renames.forEach((n,r)=>{t.push(["destructive","renames",r]);}),t}chunkDPD6ZWL2_js.a(Fp,"mutationPaths");function ds(e,t){e.additive.objects.length>de.objectAdditions&&t.addIssue({code:"too_big",origin:"array",maximum:de.objectAdditions,inclusive:true,path:["additive","objects",de.objectAdditions],message:`A schema plan can add at most ${de.objectAdditions} objects`});let n=Fp(e);n.length>de.totalMutations&&t.addIssue({code:"too_big",origin:"array",maximum:de.totalMutations,inclusive:true,path:n[de.totalMutations],message:`A schema plan can contain at most ${de.totalMutations} mutations; received ${n.length}`});}chunkDPD6ZWL2_js.a(ds,"addPlanLimitIssues");function ps(e,t){let n=Vi(e);if(n)return t.addIssue({code:"custom",path:n.path,message:n.message}),zod.z.NEVER;let r=new TextEncoder().encode(chunkRTHLB6T6_js.b(e)).byteLength;return r>de.serializedBytes?(t.addIssue({code:"too_big",origin:"string",maximum:de.serializedBytes,inclusive:true,path:[],message:`A schema plan can serialize to at most ${de.serializedBytes} UTF-8 bytes; received ${r}`}),zod.z.NEVER):e}chunkDPD6ZWL2_js.a(ps,"boundSerializedPlanInput");var is=zod.z.object({schemaPlanVersion:zod.z.literal(2).describe("Required proposal contract version."),summary:us,additive:ls,destructive:cs}).strict().superRefine(ds),HI=Object.assign(zod.z.preprocess(ps,is),{shape:is.shape}),Vp=zod.z.object({schemaPlanVersion:zod.z.literal(2),summary:us,additive:ls,destructive:cs}).strict().superRefine(ds),JI=zod.z.preprocess(ps,Vp);function mt(e,t){throw new chunkJSKLP4GI_js.h(t,[{path:e,message:t}])}chunkDPD6ZWL2_js.a(mt,"reject");function Rn(e){throw new chunkJSKLP4GI_js.h(`Unsupported schema reference variant ${String(e)}`,[])}chunkDPD6ZWL2_js.a(Rn,"exhaustive");function iR(e){let t=new Map(e.objects.map(s=>[s.name,s])),n=[];function r(s,c,u){function l(y,A,h){(y.kind==="object"?t.has(y.object):y.kind==="attribute"?t.get(y.object)?.attributes.some(_=>_.name===y.attribute):true)||mt([...c,...h],`Unknown schema reference ${JSON.stringify(y)}`),n.push({owner:s,target:y,category:A,path:h,...u===void 0?{}:{layer:u}});}chunkDPD6ZWL2_js.a(l,"add");function m(y,A,h,j){l({kind:"attribute",object:y,attribute:A},h,j);}chunkDPD6ZWL2_js.a(m,"attribute");function d(y,A,h,j,_){m(y,A,h,j);let O=t.get(y)?.attributes.find(B=>B.name===A);return O?.type!=="relation"&&mt([...c,...j],`Invalid schema reference path "${_}"`),(O.targets.length!==1||O.targets[0].object==="*")&&mt([...c,...j],`Ambiguous schema reference path "${_}"`),O.targets[0].object}chunkDPD6ZWL2_js.a(d,"traverse");function b(y,A,h,j){let _=y;for(let[O,B]of A.entries())O===A.length-1?m(_,B,h,j):_=d(_,B,h,j,A.join("."));}chunkDPD6ZWL2_js.a(b,"attributePath");function g(y,A,h){switch(A.kind){case "literal":return;case "path":b(y,A.parts,"computed",h);return;case "call":for(let j of A.args)g(y,j,h);return;case "binary":g(y,A.left,h),g(y,A.right,h);return;default:Rn(A);}}return chunkDPD6ZWL2_js.a(g,"formula"),{add:l,attribute:m,traverse:d,attributePath:b,formula:g}}chunkDPD6ZWL2_js.a(r,"visitor"),e.objects.forEach((s,c)=>{let u=["objects",String(c)],l=r({kind:"object",object:s.name},u);for(let m of ["labelExpression","embeddingExpression"]){let d=s[m];if(d)for(let b of wt(d))l.attributePath(s.name,b.split("."),"business",[m]);}s.attributes.forEach((m,d)=>{let b=[...u,"attributes",String(d)],g=r({kind:"attribute",object:s.name,attribute:m.name},b);switch(m.type){case "relation":m.targets.forEach((y,A)=>{if(y.object!=="*"&&g.add({kind:"object",object:y.object},"structural",["targets",String(A),"object"]),y.displayTemplate)for(let h of wt(y.displayTemplate))g.attributePath(y.object,h.split("."),"business",["targets",String(A),"displayTemplate"]);for(let h of Object.keys(y.filter??{}))g.attribute(y.object,h,"business",["targets",String(A),"filter",h]);});break;case "formula":{let y;try{y=chunk2M4YXNYZ_js.v(m.expression);}catch(A){mt([...b,"expression"],A instanceof Error?A.message:String(A));}g.formula(s.name,y,["expression"]),o(m,g);break}case "rollup":{let y=m.relationPath??m.relationAttribute,A=s.name;for(let h of y.split("."))A=g.traverse(A,h,"computed",[m.relationPath===void 0?"relationAttribute":"relationPath"],y);g.attributePath(A,m.targetAttribute.split("."),"computed",["targetAttribute"]),o(m,g);break}case "text":case "richtext":case "number":case "checkbox":case "date":case "phone":case "currency":case "status":case "location":case "select":case "multiselect":case "user":case "document":break;default:Rn(m);}});});function o(s,c){s.optionsSource&&(c.add({kind:"object",object:s.optionsSource.objectName},"computed",["optionsSource","objectName"]),c.attribute(s.optionsSource.objectName,s.optionsSource.attributeName,"computed",["optionsSource","attributeName"]));}chunkDPD6ZWL2_js.a(o,"visitOptions");function a(s,c,u){r({kind:"view",object:s.object,view:s.name},c,u).add({kind:"object",object:s.object},"structural",["object"]),s.contents.forEach((l,m)=>{let d=r({kind:"content",object:s.object,view:s.name,content:l.name},[...c,"contents",String(m)],u);function b(g,y,A,h){g?.forEach((j,_)=>d.attribute(y,j,A,[h,String(_)]));}switch(chunkDPD6ZWL2_js.a(b,"names"),l.type){case "collection":{let g=qe(l.source),y;switch(g.kind==="object"?(y=g.object,d.add({kind:"object",object:y},"source",["source","object"])):g.kind==="relatedFrom"?(y=g.object,d.add({kind:"object",object:y},"source",["source","object"]),d.attribute(y,g.relation,"source",["source","relation"])):y=d.traverse(s.object,g.relation,"source",["source","relation"],g.relation),l.columns?.forEach((A,h)=>{if(typeof A=="string"){d.attribute(y,A,"display",["columns",String(h)]);return}let j=t.get(s.object),_=g.kind!=="related"||!j?void 0:Ia(j,g.relation),O=["columns",String(h),"relationProperty"];_||mt([...c,"contents",String(m),...O],"Relation property columns require a relation source"),_.properties?.definitions.some(B=>B.name===A.relationProperty)||mt([...c,"contents",String(m),...O],`Unknown relation property "${A.relationProperty}"`),d.add({kind:"attribute",object:s.object,attribute:_.name},"display",O);}),b(l.displayAttributes,y,"display","displayAttributes"),l.descriptionAttribute!==void 0&&d.attribute(y,l.descriptionAttribute,"display",["descriptionAttribute"]),l.filters?.rules.forEach((A,h)=>d.attribute(y,A.attribute,"business",["filters","rules",String(h),"attribute"])),l.sorts?.forEach((A,h)=>d.attribute(y,A.attribute,"business",["sorts",String(h),"attribute"])),l.layout){case "table":case "list":if(l.columnSizing)for(let A of Object.keys(l.columnSizing))d.attribute(y,A,"display",["columnSizing",A]);break;case "kanban":l.groupByAttribute!==void 0&&d.attribute(y,l.groupByAttribute,"business",["groupByAttribute"]);break;default:Rn(l.layout);}break}case "form":l.groups.forEach((g,y)=>g.fields.forEach((A,h)=>d.attribute(s.object,A.attribute,"display",["groups",String(y),"fields",String(h),"attribute"])));break;case "richtext":d.attribute(s.object,l.attribute,"source",["attribute"]),l.titleAttribute!==void 0&&d.attribute(s.object,l.titleAttribute,"display",["titleAttribute"]);break;case "documents":b(l.relations,s.object,"business","relations");break;case "forms":l.objectName!==void 0&&d.add({kind:"object",object:l.objectName},"source",["objectName"]);break;case "emails":case "meetings":b(l.emailAttributes,s.object,"business","emailAttributes");break;case "activity":case "custom":break;default:Rn(l);}});}return chunkDPD6ZWL2_js.a(a,"viewReferences"),e.views.forEach((s,c)=>a(s,["views",String(c)])),e.retainedViews?.forEach(({definition:s,layer:c},u)=>a(s,["retainedViews",String(u),"definition"],c)),n}chunkDPD6ZWL2_js.a(iR,"collectSchemaReferences");var ms=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function $(e,t,n){throw new chunkJSKLP4GI_js.h(n,[{path:[...e.split("."),t],message:n}])}chunkDPD6ZWL2_js.a($,"reject");function Li(e){return e.join("|")}chunkDPD6ZWL2_js.a(Li,"pairKey");function $i(e,t){return [e,t].sort()}chunkDPD6ZWL2_js.a($i,"pairedAddresses");function Bp(e){let t=new Map,n=new Map,r=new Set;for(let o of e){let a=Li(o.addresses);(!ms.test(o.id)||o.addresses[0]===o.addresses[1]!=(o.symmetric===true))&&$(o.addresses[0],"pair",`Invalid stored pair identity for ${a}`),(t.has(a)||n.has(o.id)&&n.get(o.id)!==a||o.addresses.some(s=>r.has(s)))&&$(o.addresses[0],"pair",`Duplicate stored pair identity for ${a}`),o.addresses.includes(o.ownerAddress)||$(o.addresses[0],"pair",`Invalid property owner for ${a}`),t.set(a,o),n.set(o.id,a);for(let s of o.addresses)r.add(s);}return t}chunkDPD6ZWL2_js.a(Bp,"validateExistingPairs");function Lp(e,t){let n=new Set(e.flatMap(s=>s.addresses)),r=new Map,o=new Set;for(let{from:s,to:c}of t)(!n.has(s)||s===c||r.has(s)||o.has(c))&&$(s,"rename",`Invalid or duplicate relation attribute rename ${s} to ${c}`),r.set(s,c),o.add(c);let a=chunkDPD6ZWL2_js.a(s=>r.get(s)??s,"mapped");return e.map(s=>({...s,addresses:$i(a(s.addresses[0]),a(s.addresses[1])),ownerAddress:a(s.ownerAddress),generatedAddresses:s.generatedAddresses.map(a)}))}chunkDPD6ZWL2_js.a(Lp,"remapExistingPairs");function $p(e,t,n){return e.type==="relation"&&e.bilateral?.object===t&&e.bilateral.attribute===n&&e.targets.length===1&&e.targets[0]?.object===t}chunkDPD6ZWL2_js.a($p,"isReciprocal");function Up(e,t,n){let r=e.bilateral;r||$(`${t}.${e.name}`,"bilateral","Missing inverse address");let o={type:"relation",name:r.attribute,label:r.label??r.attribute,required:false,targets:[{object:t}],bilateral:{object:t,attribute:e.name,cardinality:e.cardinality},order:n};return (r.cardinality??Vo(e.cardinality))==="one"?{...o,cardinality:"one"}:{...o,cardinality:"many"}}chunkDPD6ZWL2_js.a(Up,"generateInverse");function qp(e,t,n,r,o){e.bilateral?.cardinality&&e.bilateral.cardinality!==t.cardinality&&$(r,"cardinality",`${n} declares ${r} as ${e.bilateral.cardinality}, but ${r} declares ${t.cardinality}`),t.bilateral?.cardinality&&t.bilateral.cardinality!==e.cardinality&&$(n,"cardinality",`${r} declares ${n} as ${t.bilateral.cardinality}, but ${n} declares ${e.cardinality}`),e.bilateral?.label&&e.bilateral.label!==t.label&&$(r,"label",`${n} declares a different label for ${r}`),t.bilateral?.label&&t.bilateral.label!==e.label&&$(n,"label",`${r} declares a different label for ${n}`),e.properties&&t.properties&&!chunkRTHLB6T6_js.j(e.properties,t.properties)&&!o&&$(r,"properties",`${n} and ${r} declare different qualified properties`),e.bilateral?.storageOwner===t.bilateral?.storageOwner&&e.bilateral?.storageOwner!==void 0&&$(r,"storageOwner",`${n} and ${r} cannot both own or both disown qualified properties`);}chunkDPD6ZWL2_js.a(qp,"checkExplicitDeclarations");function zp(e,t,n,r,o,a){return o?o.ownerAddress:e.bilateral?.storageOwner===true||t.bilateral?.storageOwner===false?n:e.bilateral?.storageOwner===false||t.bilateral?.storageOwner===true?r:a?n:$i(n,r)[0]}chunkDPD6ZWL2_js.a(zp,"chooseOwner");function Wp(e){if(!e.metadata)return;let{relationPairId:t,relationGenerated:n,...r}=e.metadata;e.metadata=Object.keys(r).length>0?r:void 0;}chunkDPD6ZWL2_js.a(Wp,"stripUntrustedPairMetadata");function Gp(e,t,n,r,o,a){a.has(n)&&a.has(r)&&!chunkRTHLB6T6_js.j(e.properties,t.properties)&&$(r,"properties",`${n} and ${r} edit different qualified properties`);let s=a.has(n)||o.has(n)&&!o.has(r)&&!a.has(r),c=a.has(r)||o.has(r)&&!o.has(n)&&!a.has(n),u=s?e.properties:c?t.properties:e.properties??t.properties;u?(e.properties=structuredClone(u),t.properties=structuredClone(u)):(delete e.properties,delete t.properties);}chunkDPD6ZWL2_js.a(Gp,"reconcileProperties");function Ui(e){let t=structuredClone(e.objects),n=new Map;for(let d of t){if(n.has(d.name))throw new chunkJSKLP4GI_js.r("object",d.name);n.set(d.name,d);let b=new Set;for(let g of d.attributes){if(b.has(g.name))throw new chunkJSKLP4GI_js.r("attribute",g.name);b.add(g.name),Wp(g);}}let r=Lp(e.existingPairs??[],e.addressRenames??[]),o=Bp(r),a=new Set(r.flatMap(d=>d.generatedAddresses)),s=new Set(e.propertyEditAddresses??[]),c=new Set(e.explicitAddresses??t.flatMap(d=>d.attributes.filter(b=>!a.has(`${d.name}.${b.name}`)).map(b=>`${d.name}.${b.name}`))),u=t.flatMap(d=>d.attributes.filter(b=>b.type==="relation"&&!!b.bilateral).map(b=>({object:d,attribute:b,address:`${d.name}.${b.name}`}))).sort((d,b)=>d.address.localeCompare(b.address)),l=new Map,m=new Map;for(let{object:d,attribute:b,address:g}of u){let y=b.bilateral?.object;(!y||y==="*"||b.targets.length!==1||b.targets[0]?.object!==y)&&$(g,"targets",`Bilateral target of ${g} must be one concrete object`);let A=n.get(y);A||$(g,"bilateral",`Unknown inverse object ${y} for ${g}`);let h=`${y}.${b.bilateral?.attribute}`,j=g===h;j&&b.cardinality!=="many"&&$(g,"cardinality",`Symmetric self relation ${g} must be many`),j&&b.bilateral?.cardinality&&b.bilateral.cardinality!==b.cardinality&&$(g,"bilateral",`Symmetric self relation ${g} needs matching cardinality`);let _=$i(g,h),O=Li(_);if(l.has(O))continue;let B=A.attributes.find(Ie=>Ie.name===b.bilateral?.attribute);if(B&&!$p(B,d.name,b.name))throw new chunkJSKLP4GI_js.r("attribute",h);let Se=!(B&&c.has(h));B||(B=Up(b,d.name,A.attributes.length),A.attributes.push(B));let K=B;!j&&c.has(g)&&c.has(h)&&qp(b,K,g,h,s.has(g)!==s.has(h));let k=o.get(O),M=k?.id??e.nextPairId(_),oe=r.find(Ie=>Ie.id===M&&Li(Ie.addresses)!==O);(!ms.test(M)||oe||m.has(M)&&m.get(M)!==O)&&$(g,"pair",`Invalid or duplicate pair identity for ${g} and ${h}`),m.set(M,O);let ee=j?g:zp(b,K,g,h,k,Se);b.bilateral&&K.bilateral||$(g,"bilateral",`Missing reciprocal configuration for ${g} and ${h}`),b.bilateral={...b.bilateral,cardinality:K.cardinality,label:K.label,storageOwner:ee===g},K.bilateral={...K.bilateral,cardinality:b.cardinality,label:b.label,storageOwner:ee===h},Gp(b,K,g,h,c,s),b.metadata={...b.metadata,relationPairId:M},K.metadata={...K.metadata,relationPairId:M},l.set(O,{id:M,addresses:_,ownerAddress:ee,generatedAddresses:_.filter(Ie=>!c.has(Ie)),...j?{symmetric:true}:{}});}return {objects:t,pairs:[...l.values()].sort((d,b)=>d.addresses[0].localeCompare(b.addresses[0]))}}chunkDPD6ZWL2_js.a(Ui,"reconcileRelationAttributes");var v=zod.z.number().finite().nonnegative(),bs=zod.z.enum(Lo),qi=zod.z.enum($o),zi=zod.z.enum(Uo),gs=zod.z.object({provider:bs,model:zod.z.string().min(1)}).strict(),bR=zod.z.object({speed:qi.optional(),reasoning:zi.optional()}).strict(),ys=zod.z.string().regex(/^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9._-]*$/),Kp=zod.z.object({model:gs.optional(),speed:qi.optional(),reasoning:zi.optional(),imageModel:ys.optional()}).strict(),gR=Kp.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"}),yR=zod.z.object({model:gs.nullable().optional(),speed:qi.nullable().optional(),reasoning:zi.nullable().optional(),imageModel:ys.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"}),hs=zod.z.object({label:zod.z.string(),denied:zod.z.boolean().optional(),deletion:zod.z.object({target:zod.z.string().optional(),count:v.optional(),restorableDays:v.optional()}).strict().optional(),counts:zod.z.record(zod.z.string(),v).optional(),warnings:zod.z.array(zod.z.string()).optional()}).strict(),Yp=zod.z.union([zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}).strict(),zod.z.object({type:zod.z.literal("reasoning"),text:zod.z.string()}).strict(),zod.z.object({type:zod.z.literal("system"),code:zod.z.enum(Wn)}).strict(),zod.z.object({type:zod.z.literal("error"),error:zod.z.string(),errorClass:zod.z.string().optional()}).strict(),zod.z.object({type:zod.z.literal("tool"),toolCallId:zod.z.string(),name:zod.z.string(),args:zod.z.record(zod.z.string(),zod.z.unknown()),result:zod.z.unknown().optional(),error:zod.z.string().optional(),errorCode:zod.z.enum(["output_limit_reached","interrupted"]).optional(),state:zod.z.enum(["streaming","running","completed","error","pending","approval-requested","approval-responded","approval-dispatched"]),durationMs:v.optional(),approvalId:zod.z.string().optional(),approvalImpact:hs.optional(),approved:zod.z.boolean().optional(),approvalReason:zod.z.string().optional(),approvalRelaxableByAuto:zod.z.boolean().optional()}).strict(),zod.z.object({type:zod.z.literal("file"),fileId:zod.z.string(),name:zod.z.string(),mimeType:zod.z.string()}).strict(),zod.z.object({type:zod.z.literal("compaction"),state:zod.z.literal("in-progress"),reason:zod.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:v.optional(),reportedTokens:v.optional()}).strict(),zod.z.object({type:zod.z.literal("compaction"),state:zod.z.literal("completed"),tokensBefore:v,tokensAfter:v,tokensSaved:v,strategy:zod.z.enum(["no-op","summary","truncation"]),durationMs:v,summary:zod.z.string().optional()}).strict(),zod.z.object({type:zod.z.literal("compaction"),state:zod.z.literal("failed"),reason:zod.z.string(),durationMs:v.optional()}).strict()]),Hp=zod.z.object({id:zod.z.string(),name:zod.z.string(),mimeType:zod.z.string(),size:v}).strict(),Jp=zod.z.object({id:zod.z.string(),type:zod.z.string().transform(e=>e),entityId:zod.z.string(),label:zod.z.string(),objectName:zod.z.string().optional(),startIndex:v,endIndex:v}).strict(),Qp=zod.z.object({provider:bs,model:zod.z.string(),maxTokens:v.optional(),contextWindow:v.optional()}).strict(),Zp=zod.z.union([zod.z.date(),zod.z.string().datetime({offset:true}).transform(e=>new Date(e))]),fs=zod.z.object({id:zod.z.string(),sessionId:zod.z.string(),tenantId:zod.z.string().optional(),runId:zod.z.string().optional(),role:zod.z.enum(["user","assistant","system","tool"]),parts:zod.z.array(Yp),attachments:zod.z.array(Hp).optional(),mentions:zod.z.array(Jp).optional(),model:Qp.optional(),tokenUsage:zod.z.object({input:v,output:v}).strict().optional(),metadata:zod.z.record(zod.z.string(),zod.z.unknown()).optional(),createdAt:Zp}).strict(),Xp=zod.z.object({id:zod.z.string(),description:zod.z.string(),status:zod.z.enum(["pending","in_progress","completed","blocked"]),result:zod.z.string().optional(),updatedAt:v.optional()}).strict(),em=zod.z.object({id:zod.z.string(),sessionId:zod.z.string(),status:zod.z.enum(["active","completed","abandoned"]),todos:zod.z.array(Xp),version:v,createdAt:zod.z.string(),updatedAt:zod.z.string(),completedAt:zod.z.string().optional()}).strict(),As={"session-named":zod.z.object({name:zod.z.string()}).strict(),"compaction-start":zod.z.object({reason:zod.z.enum(["preflight_threshold","overflow_recovery"]),estimatedTokens:v.optional(),reportedTokens:v.optional()}).strict(),"compaction-end":zod.z.object({tokensBefore:v,tokensAfter:v,tokensSaved:v,strategy:zod.z.enum(["no-op","summary","truncation"]),durationMs:v,summary:zod.z.string().optional()}).strict(),"compaction-failed":zod.z.object({reason:zod.z.string()}).strict(),usage:zod.z.object({messageId:zod.z.string().min(1).optional(),inputTokens:v,outputTokens:v,totalTokens:v,cacheReadTokens:v.optional(),cacheCreationTokens:v.optional(),contextWindow:v,residentTokens:v,utilization:zod.z.number().finite().min(0).max(1),costUsd:v.optional()}).strict(),"message-persisted":zod.z.object({message:fs}).strict(),"message-updated":zod.z.object({message:fs}).strict(),"todo-plan-update":zod.z.object({plan:em}).strict(),"approval-context":zod.z.object({approvalId:zod.z.string(),toolCallId:zod.z.string(),impact:hs.optional(),relaxableByAuto:zod.z.boolean().optional()}).strict(),"session-state":zod.z.object({state:zod.z.object({phase:zod.z.enum(["queued","running","parked","terminal"]),parkedOn:zod.z.enum(["human","agents"]).optional(),humanRequestIds:zod.z.array(zod.z.string()).optional(),outcome:zod.z.enum(["completed","failed","cancelled","timeout","expired"]).optional()}).strict(),version:zod.z.number().int().positive(),updatedAt:zod.z.string().datetime({offset:true})}).strict()};function tm(e){return e in As}chunkDPD6ZWL2_js.a(tm,"isAgentUIDataName");function nm(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(nm,"agentUIValidationError");function rm(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 n=t.slice(5);if(!tm(n))throw new chunkJSKLP4GI_js.h("Invalid agent UI message chunk",[{path:["type"],message:`Unknown agent UI data type: ${n}`,code:"invalid_value"}]);let r=zod.z.object({type:zod.z.literal(`data-${n}`),id:zod.z.string().optional(),data:As[n],transient:zod.z.boolean().optional()}).strict().safeParse(e);if(!r.success)throw nm(r.error.issues);return r.data}chunkDPD6ZWL2_js.a(rm,"assertCustomAgentUIMessageChunk");function hR(e,t,n){return rm({type:`data-${e}`,...n?.id!==void 0?{id:n.id}:{},data:t,...n?.transient!==void 0?{transient:n.transient}:{}})}chunkDPD6ZWL2_js.a(hR,"agentDataChunk");function Wi(e){return e}chunkDPD6ZWL2_js.a(Wi,"defineOperation");function V(e,t,n){let r=t==="atomic"?"none":t==="local"?"if-not-visible":"follow";return o=>{let a=n?.(o);return {impact:t,navigation:r,focus:{...e(o),...a===void 0?{}:{propertyPath:a}}}}}chunkDPD6ZWL2_js.a(V,"definePresentation");function im(e){return {id:e.id??e.name,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon}}}chunkDPD6ZWL2_js.a(im,"toDraftableObject");function om(e){let t=e.id??e.name;return (e.attributes??[]).map(n=>Gi(n,t))}chunkDPD6ZWL2_js.a(om,"toDraftableAttributes");function Z(e){return {id:e.id,name:e.name,label:e.label,type:e.attributeType,...e.config}}chunkDPD6ZWL2_js.a(Z,"toAttribute");function Gi(e,t){let{id:n,name:r,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(Gi,"toDraftableAttribute");function xs(e){let t=e[0];return t?`{{ ${t.name} }}`:"{{ id }}"}chunkDPD6ZWL2_js.a(xs,"draftedLabelExpression");function Ki(e,t){let n=t.filter(r=>r.objectId===e.id);return {id:e.id,name:e.name,label:e.label,...e.icon===void 0?{}:{icon:e.icon},labelExpression:xs(n),attributes:n.map((r,o)=>{let a=Z(r);return a.order===void 0?{...a,order:o}:a})}}chunkDPD6ZWL2_js.a(Ki,"draftedObjectDefinition");function am(e,t,n=Et(e.contents)){return structuredClone({...e,...t,authoring:n})}chunkDPD6ZWL2_js.a(am,"toDraftableView");function ft(e){let{id:t,revision:n,contentIds:r,contentRevisions:o,derived:a,authoring:s,...c}=e;return structuredClone(c)}chunkDPD6ZWL2_js.a(ft,"draftedViewDefinition");function sm(e,t){return {...e,...ft(t)}}chunkDPD6ZWL2_js.a(sm,"fromDraftableView");var jt={id:zod.z.string().min(1).describe("Your id, echoed back"),note:zod.z.string().trim().min(1).max(160).optional().describe("Why, in the person's words, \u2264160 chars")};var _t={...jt,objectName:zod.z.string().min(1).describe("Object"),viewName:zod.z.string().min(1).describe("View API name")},bt={..._t,contentName:zod.z.string().min(1).describe("Content API name")},Rs=zod.z.union([zod.z.object({before:zod.z.string().min(1).describe("Place immediately before this content name")}).strict(),zod.z.object({after:zod.z.string().min(1).describe("Place immediately after this content name")}).strict(),zod.z.object({end:zod.z.literal(true).describe("Place at the end of the placement zone")}).strict()]),Ge=chunkDPD6ZWL2_js.a(e=>({objectName:e.objectName,viewName:e.viewName}),"viewFocus"),Me=chunkDPD6ZWL2_js.a(e=>({...Ge(e),contentName:e.contentName}),"contentFocus");function pe(e,t){throw new chunkJSKLP4GI_js.h(t,[{path:e,message:t}])}chunkDPD6ZWL2_js.a(pe,"invalid");function Ee(e,t,n,r){let o=e.views.findIndex(u=>u.object===t.objectName&&u.name===t.viewName);o<0&&pe(["viewName"],"View is not in the draftable state"),e.views[o].authoring||pe(["authoring"],"Missing view authoring baseline");let{derived:a,...s}=r(structuredClone(e.views[o]));s.contents=hi(s.authoring);let c=e.views.map((u,l)=>l===o?s:u);return xi({extensions:[...n.extensions],objects:e.objects.map(u=>Ki(u,e.attributes.filter(l=>l.objectId===u.id))),views:c.map(ft)}),{...e,views:c}}chunkDPD6ZWL2_js.a(Ee,"change");function Ke(e,t){let n=Object.hasOwn(e.authoring.contents,t)?e.authoring.contents[t]:void 0;return n||pe(["contentName"],"Content is not in the draftable state"),n}chunkDPD6ZWL2_js.a(Ke,"contentState");function Yi(e,t,n){for(let r of n)e.authoring[r==="main"?"mainOrderCustomized":"asideOrderCustomized"]=true,t.filter(o=>o.placement===r).forEach((o,a)=>{Ke(e,o.name).workspacePosition=a;});}chunkDPD6ZWL2_js.a(Yi,"setOrder");function Hi(e,t){let n=e.contents.find(r=>r.name===t);return n||pe(["contentName"],"Content is not in the draftable state"),n}chunkDPD6ZWL2_js.a(Hi,"find");function Cs(e,t,n){let r=e.filter(s=>s.name!==t.name),o=r.filter(s=>s.placement===t.placement),a=o.length;if(!("end"in n)){let s="before"in n?n.before:n.after;a=o.findIndex(c=>c.name===s),a<0&&pe(["target"],"Order target is not in this placement"),"after"in n&&a++;}return o.splice(a,0,t),t.placement==="main"?[...o,...r.filter(s=>s.placement==="aside")]:[...r.filter(s=>s.placement==="main"),...o]}chunkDPD6ZWL2_js.a(Cs,"placed");var cm=zod.z.unknown().transform((e,t)=>{let n=chunkMXZ3AF5X_js.W.safeParse(typeof e=="object"&&e!==null?{...e,name:"candidate"}:e);if(!n.success){for(let o of n.error.issues)t.addIssue({code:"custom",path:o.path,message:o.message});return zod.z.NEVER}let r=typeof e=="object"&&e!==null&&"name"in e?e.name:void 0;return {...n.data,name:r}}),vs=zod.z.object({...bt,type:zod.z.literal("replace_view_content"),definition:cm}).strict().superRefine((e,t)=>{e.definition.name!==void 0&&e.definition.name!==e.contentName&&t.addIssue({code:"custom",path:["definition","name"],message:"must equal the target contentName, or be omitted"});}).overwrite(e=>{let{name:t,...n}=e.definition;return {...e,definition:n}}),Es=chunkMXZ3AF5X_js.W.describe("The whole content definition."),um=zod.z.object({...bt,type:zod.z.literal("replace_view_content"),definition:Es}).strict().describe("definition.name, if sent, must equal contentName \u2014 the operation's own target; a different name is refused."),lm={type:"replace_view_content",summary:"Replaces a content's whole definition; placement can't change here (use move_view_content); first content op freezes derived views.",schema:vs,wire:um,focus:Me,presentation:V(Me,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Replace ${e.objectName}.${e.viewName}.${e.contentName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>(Hi(r,t.contentName).placement!==t.definition.placement&&pe(["definition","placement"],"Use move_view_content to change placement"),Ke(r,t.contentName).workspaceDefinition=structuredClone(t.definition),{...r,contents:r.contents.map(a=>a.name===t.contentName?{...t.definition,name:t.contentName}:a),contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+1}})),"apply")},Ns=zod.z.object({..._t,type:zod.z.literal("add_view_content"),content:Es,target:Rs.describe("Where to place the new content within its placement zone")}).strict(),ws=chunkDPD6ZWL2_js.a(e=>({...Ge(e),contentName:e.content.name}),"addFocus"),dm={type:"add_view_content",summary:"Adds a content; content.name unique; collection view needs collection with source.object; aside holds one content, a form; target positions it among siblings.",schema:Ns,focus:ws,presentation:V(ws,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Add ${e.content.name}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{if(Object.hasOwn(r.authoring.contents,t.content.name))throw new chunkJSKLP4GI_js.r("content",t.content.name);r.authoring.contents={...r.authoring.contents,[t.content.name]:{sourceDefinition:null,workspaceDefinition:vt(t.content),suppressed:false,sourcePosition:null,workspacePosition:0}};let o=Cs(r.contents,t.content,t.target);return Yi(r,o,[t.content.placement]),{...r,revision:r.revision+1,contents:o,contentIds:{...r.contentIds,[t.content.name]:JSON.stringify(["draft-content",t.id])},contentRevisions:{...r.contentRevisions,[t.content.name]:1}}}),"apply")},Ds=zod.z.object({...bt,type:zod.z.literal("remove_view_content")}).strict(),pm={type:"remove_view_content",summary:"Removes a content; a published view keeps \u22651 main content; a code-declared content is hidden, not deleted.",schema:Ds,focus:Me,presentation:V(Me,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Remove ${e.contentName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{let o=Hi(r,t.contentName),a=Ke(r,t.contentName),s=r.contents.filter(d=>d.name!==t.contentName);if(Yi(r,s,[o.placement]),a.sourceDefinition!==null)return a.workspaceDefinition=null,a.suppressed=true,{...r,revision:r.revision+1,contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+1}};delete r.authoring.contents[t.contentName];let{[t.contentName]:c,...u}=r.contentIds,{[t.contentName]:l,...m}=r.contentRevisions;return {...r,revision:r.revision+1,contents:r.contents.filter(d=>d.name!==t.contentName),contentIds:u,contentRevisions:m}}),"apply")},Os=zod.z.object({...bt,type:zod.z.literal("move_view_content"),placement:zod.z.enum(["main","aside"]).describe("The placement zone to move the content into"),target:Rs.describe("Where to place the content within that placement zone")}).strict(),mm={type:"move_view_content",summary:"Reorders or moves a content to a different placement; the aside rule applies.",schema:Os,focus:Me,presentation:V(Me,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Move ${e.contentName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{let o=Hi(r,t.contentName);o.placement!==t.placement&&(Ke(r,t.contentName).workspaceDefinition={...vt(o),placement:t.placement});let a=Cs(r.contents,{...o,placement:t.placement},t.target);return Yi(r,a,[...new Set([o.placement,t.placement])]),{...r,revision:r.revision+1,contents:a,contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+ +(o.placement!==t.placement)}}}),"apply")},ks=zod.z.object({..._t,type:zod.z.literal("update_view_metadata"),changes:zod.z.object({label:zod.z.string().min(1).optional().describe("New label for the view"),description:zod.z.string().optional().describe("New description for the view"),icon:chunk2M4YXNYZ_js.t.nullable().optional().describe("New icon; null clears it")}).strict().refine(e=>Object.keys(e).length>0).describe("\u22651 change")}).strict(),fm={type:"update_view_metadata",summary:"Updates a view's label, description, or icon (null clears the icon).",schema:ks,focus:Ge,presentation:V(Ge,"atomic"),describe:chunkDPD6ZWL2_js.a(e=>`Update ${e.viewName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{let{icon:o,...a}=t.changes,s={...r,...a,revision:r.revision+1};if(o===null){let{icon:c,...u}=s;return u}return o===void 0?s:{...s,icon:o}}),"apply")},js=zod.z.string().refine(e=>e.trim().length>0,"API name must not be blank"),_s=zod.z.object({..._t,type:zod.z.literal("rename_view"),newName:js.describe("New API name for the view")}).strict(),Ss=chunkDPD6ZWL2_js.a(e=>({objectName:e.objectName,viewName:e.newName}),"renameViewFocus"),bm={type:"rename_view",summary:"Renames a view; refused on a code-declared name \u2014 change it in the declaration.",schema:_s,focus:Ss,presentation:V(Ss,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Rename view ${e.viewName} to ${e.newName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>t.newName===r.name?r:(r.authoring.origin==="code"&&pe(["newName"],"Source-owned API names must be changed in their declaration"),e.views.some(o=>o.object===t.objectName&&o.name===t.newName)&&pe(["newName"],"View API name is already used"),{...r,name:t.newName,revision:r.revision+1})),"apply")},Ps=zod.z.object({...bt,type:zod.z.literal("rename_view_content"),newName:js.describe("New API name for the content")}).strict(),Is=chunkDPD6ZWL2_js.a(e=>({...Ge(e),contentName:e.newName}),"renameContentFocus"),gm={type:"rename_view_content",summary:"Renames a content; refused on a code-declared name \u2014 change it in the declaration.",schema:Ps,focus:Is,presentation:V(Is,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Rename content ${e.contentName} to ${e.newName}`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{let o=Ke(r,t.contentName);if(t.newName===t.contentName)return r;o.sourceDefinition!==null&&pe(["newName"],"Source-owned API names must be changed in their declaration"),Object.hasOwn(r.authoring.contents,t.newName)&&pe(["newName"],"Content API name is already used");let a=r.contentIds[t.contentName],s=r.contentRevisions[t.contentName];return delete r.authoring.contents[t.contentName],delete r.contentIds[t.contentName],delete r.contentRevisions[t.contentName],r.authoring.contents={...r.authoring.contents,[t.newName]:o},{...r,revision:r.revision+1,contentIds:{...r.contentIds,[t.newName]:a},contentRevisions:{...r.contentRevisions,[t.newName]:s+1}}}),"apply")},Ms=zod.z.object({...bt,type:zod.z.literal("reset_view_content")}).strict(),ym={type:"reset_view_content",summary:"Resets a content back to its code-declared source; only works when one exists.",schema:Ms,focus:Me,presentation:V(Me,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Reset ${e.contentName} to source`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{let o=Ke(r,t.contentName);return o.sourceDefinition===null&&pe(["contentName"],"Content has no source to reset to"),o.workspaceDefinition===null&&!o.suppressed&&o.workspacePosition===null?r:(o.workspaceDefinition=null,o.suppressed=false,o.workspacePosition=null,{...r,revision:r.revision+1,contentRevisions:{...r.contentRevisions,[t.contentName]:r.contentRevisions[t.contentName]+1}})}),"apply")},Fs=zod.z.object({..._t,type:zod.z.literal("reset_view_order"),placement:zod.z.enum(["main","aside"]).describe("The placement zone to reset to source order")}).strict(),hm={type:"reset_view_order",summary:"Resets a placement zone's order to its code-declared source, if one exists.",schema:Fs,focus:Ge,presentation:V(Ge,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Reset ${e.placement} order`,"describe"),apply:chunkDPD6ZWL2_js.a((e,t,n)=>Ee(e,t,n,r=>{let o=t.placement==="main"?"mainOrderCustomized":"asideOrderCustomized";if(!r.authoring[o])return r;r.authoring[o]=false;for(let a of r.contents.filter(s=>s.placement===t.placement)){let s=Ke(r,a.name);s.sourceDefinition!==null&&(s.workspacePosition=null);}return {...r,revision:r.revision+1}}),"apply")},Ji=zod.z.discriminatedUnion("type",[vs,Ns,Ds,Os,ks,_s,Ps,Ms,Fs]),Ye=[lm,dm,pm,mm,fm,bm,gm,ym,hm];function Vs(e,t){return e.objects.find(n=>n.id===t)}chunkDPD6ZWL2_js.a(Vs,"findObject");var Am=new Set(["formula","rollup"]);function gt(e){return Am.has(e.attributeType)}chunkDPD6ZWL2_js.a(gt,"isComputedAttribute");var Bs={sum:"number",avg:"number",count:"number",countValues:"number",countUniqueValues:"number",countEmpty:"number",percentEmpty:"number",percentNotEmpty:"number",earliest:"date",latest:"date",original:"multiselect"};function xm(e){return typeof e=="string"&&e in Bs?Bs[e]:void 0}chunkDPD6ZWL2_js.a(xm,"rollupReturnTypeOf");function $s(e,t){let n=Vs(e,t);if(!n)throw new chunkJSKLP4GI_js.h(`Object "${t}" is not in the draftable state`,[]);return n}chunkDPD6ZWL2_js.a($s,"requireObject");function Cn(e){return e.config??{}}chunkDPD6ZWL2_js.a(Cn,"configOf");function X(e){let t=Cn(e).targets;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null&&typeof n.object=="string"):[]}chunkDPD6ZWL2_js.a(X,"relationTargets");function yt(e){let t=X(e).filter(n=>n.object!==ae);return t.length===1?t[0]?.object:void 0}chunkDPD6ZWL2_js.a(yt,"relationTargetObjectName");function Tm(e){let t=Cn(e),n=e.attributeType,r={name:e.name,type:n,id:e.id},o=t.optionsSource;if(n==="relation"){let a=yt(e);return {...r,...t.cardinality==="one"||t.cardinality==="many"?{cardinality:t.cardinality}:{},...a===void 0?{}:{targetObjectName:a},targets:X(e)}}if(n==="formula")return {...r,...t.returnType===void 0?{}:{returnType:t.returnType},...o===void 0?{}:{optionsSource:o}};if(n==="rollup"){let a=xm(t.function);return {...r,...a===void 0?{}:{returnType:a},...o===void 0?{}:{optionsSource:o}}}return n==="select"||n==="status"||n==="multiselect"?{...r,...Array.isArray(t.options)?{options:t.options}:{}}:r}chunkDPD6ZWL2_js.a(Tm,"toCompileAttribute");function Ls(e,t){return {objectName:e.name,attributes:t.filter(n=>n.objectId===e.id).map(Tm)}}chunkDPD6ZWL2_js.a(Ls,"toCompileObject");function Qi(e,t){let n=$s(e,t);return {...Ls(n,e.attributes),relatedObjects:Object.fromEntries(e.objects.map(r=>[r.name,Ls(r,e.attributes)]))}}chunkDPD6ZWL2_js.a(Qi,"computedCompileSchemaOf");function wm(e){return {id:e.id,name:e.name,label:e.label,type:"rollup",...Cn(e)}}chunkDPD6ZWL2_js.a(wm,"toRollupAttribute");function Us(e){try{return e()}catch(t){throw t instanceof I?new chunkJSKLP4GI_js.h(t.message,[]):t}}chunkDPD6ZWL2_js.a(Us,"asValidationError");function vn(e,t){let n=Qi(e,t.objectId);return Us(()=>qs(t,n))}chunkDPD6ZWL2_js.a(vn,"computedPlanOf");function qs(e,t){if(e.attributeType==="rollup")return Ua(wm(e),t);let n=Cn(e);return bn({attributeName:e.name,expression:String(n.expression??""),returnType:n.returnType,schema:t})}chunkDPD6ZWL2_js.a(qs,"compilePlan");function Zi(e){Us(()=>Va(e.map(t=>({attributeName:t.attributeName,dependencies:t.dependencies}))));}chunkDPD6ZWL2_js.a(Zi,"assertAcyclicComputed");function Sm(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(Sm,"dependencyNames");function Pt(e,t){let n=Qi(e,t),r=[];for(let o of e.attributes)if(!(o.objectId!==t||!gt(o)))try{r.push(qs(o,n));}catch(a){if(!(a instanceof I))throw a}return r}chunkDPD6ZWL2_js.a(Pt,"compilablePlansOf");function Xi(e,t,n){let r=$s(e,t),o=[];for(let a of Pt(e,t))a.attributeName!==n&&a.dependencies.some(s=>Sm(s,n))&&o.push(a.attributeName);for(let a of e.objects)if(a.id!==t)for(let s of Pt(e,a.id))s.dependencies.some(u=>{if(u.kind!=="relation"||u.targetAttributeName!==n)return false;let l=e.attributes.find(m=>m.objectId===a.id&&m.name===u.relationName&&m.attributeType==="relation");return l!==void 0&&yt(l)===r.name})&&o.push(`${a.name}.${s.attributeName}`);return o}chunkDPD6ZWL2_js.a(Xi,"dependentsOf");function Te(e){let t=e.config?.bilateral;if(typeof t!="object"||t===null)return;let{object:n,attribute:r}=t;return typeof n=="string"&&typeof r=="string"?{object:n,attribute:r}:void 0}chunkDPD6ZWL2_js.a(Te,"bilateralDeclarationOf");function Im(e,t){return t!==void 0&&e.attributeType===t.attributeType&&Rm(e,t)}chunkDPD6ZWL2_js.a(Im,"sameAttribute");function Rm(e,t){return JSON.stringify(e.config??{})===JSON.stringify(t.config??{})}chunkDPD6ZWL2_js.a(Rm,"sameConfig");function Cm(e,t){let n=chunkDPD6ZWL2_js.a(r=>Im(r,e.attributes.find(o=>o.id===r.id)),"untouched");for(let r of t.attributes){if(r.attributeType!=="relation")continue;let o=Te(r);if(o===void 0||n(r))continue;let s=t.objects.find(g=>g.id===r.objectId)?.name??r.objectId,c=t.objects.find(g=>g.name===o.object),u=t.attributes.find(g=>g.objectId===c?.id&&g.name===o.attribute),l=`relation "${s}.${r.name}" declares inverse "${o.object}.${o.attribute}"`;if(u===void 0)throw new chunkJSKLP4GI_js.h(`${l}, which object "${o.object}" does not have; draft it first`,[]);if(u.attributeType!=="relation")throw new chunkJSKLP4GI_js.h(`${l}, which is not a relation`,[]);let m=Te(u);if(!(X(u).some(g=>g.object===s)&&(n(u)?m===void 0||m.object===s&&m.attribute===r.name:m?.object===s&&m.attribute===r.name)))throw new chunkJSKLP4GI_js.h(`${l}, which does not point back to "${s}.${r.name}"`,[])}}chunkDPD6ZWL2_js.a(Cm,"assertBilateralPairs");var vm=0x100000001b3n,Em=0xffffffffffffffffn;function zs(e,t){let n=t;for(let r of new TextEncoder().encode(e))n^=BigInt(r),n=n*vm&Em;return n}chunkDPD6ZWL2_js.a(zs,"fnv1a64");function eo(e,t){return En(t,e.toLowerCase())}chunkDPD6ZWL2_js.a(eo,"viewIdFor");function En(e,t){let n=`${t}:${e}`,r=zs(n,0xcbf29ce484222325n).toString(16).padStart(16,"0"),o=zs(`${e}:${n}`,0x84222325cbf29ce4n).toString(16).padStart(16,"0"),a=r+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(En,"draftEntityIdFor");function He(e){return {list:eo(e,"list"),detail:eo(e,"detail")}}chunkDPD6ZWL2_js.a(He,"defaultViewIdsFor");function to(e,t,n,r){let a=r.filter(c=>c.objectId===n.id).filter(c=>chunkMXZ3AF5X_js.j(Z(c)).presentation.formField).map(c=>({attribute:c.name})),s=e==="collection"?[{name:"all",type:"collection",placement:"main",label:"All",layout:"table",source:{object:n.name}}]:a.length?[{name:"form",type:"form",placement:"main",label:"Details",groups:[{name:"general",label:"General",fields:a}]}]:[{name:"activity",type:"activity",placement:"main",label:"Activity"}];return {id:t,object:n.name,name:e==="collection"?"default_list":"default_detail",label:n.label,context:e,default:true,contents:s,authoring:Et(s),revision:1,contentIds:Object.fromEntries(s.map(c=>[c.name,JSON.stringify(["draft-content",t,c.name])])),contentRevisions:Object.fromEntries(s.map(c=>[c.name,1])),derived:true}}chunkDPD6ZWL2_js.a(to,"derivedView");function no(e,t){let n=He(e.id);return [to("collection",n.list,e,t),to("record",n.detail,e,t)]}chunkDPD6ZWL2_js.a(no,"defaultViewsFor");function Mt(e,t,n){return to(e.context,e.id,t,n)}chunkDPD6ZWL2_js.a(Mt,"regenerateDerived");function ro(e){return e.attributeType==="relation"&&Z(e).metadata?.relationGenerated===true}chunkDPD6ZWL2_js.a(ro,"isGeneratedDraftRelation");function Ws(e,t){let n=Te(t);if(!n)return [t];let r=e.objects.find(c=>c.id===t.objectId),o=e.objects.find(c=>c.name===n.object),a=e.attributes.find(c=>c.objectId===o?.id&&c.name===n.attribute);if(!a||a===t)return [t];let s=Te(a);return s&&s.object===r?.name&&s.attribute===t.name?[t,a]:[t]}chunkDPD6ZWL2_js.a(Ws,"pairedDraftAttributes");function io(e,t,n,r,o=false){let a=Z(t),s=r&&Z(r),c=r&&Te(r),u=Te(t);if(c&&(c.object!==u?.object||c.attribute!==u?.attribute))throw new chunkJSKLP4GI_js.h("Changing a bilateral address requires removing the existing pair first",[]);if(a.type!=="relation"||!a.bilateral)return e;let l=e.objects.find(k=>k.id===t.objectId),m=e.objects.find(k=>k.name===a.bilateral?.object);if(!(l&&m))throw new chunkJSKLP4GI_js.h("Both objects must exist before materializing a relation pair",[]);let d=`${l.name}.${t.name}`,b=a.bilateral.attribute,g=`${m.name}.${b}`,y=e.attributes.find(k=>k.objectId===m.id&&k.name===b),A=s?.metadata?.relationPairId,h=typeof A=="string"?A:En("relation-pair",`${n}:${t.id}`),j=[d,g].sort(),_=typeof A=="string"?{id:h,addresses:j,ownerAddress:s?.type==="relation"&&s.bilateral?.storageOwner===false?g:d,generatedAddresses:[],...d===g?{symmetric:true}:{}}:void 0,O=[...new Map([l,m].map(k=>[k.id,k])).values()].map(k=>({name:k.name,attributes:[t,...y&&y.id!==t.id?[y]:[]].filter(M=>M.objectId===k.id).map(Z)})),B=Ui({objects:O,existingPairs:_?[_]:[],...r&&!o?{explicitAddresses:[d],propertyEditAddresses:[d]}:{},nextPairId:chunkDPD6ZWL2_js.a(()=>h,"nextPairId")}),Se=new Map;for(let k of B.objects){let M=k.name===l.name?l.id:m.id;for(let oe of k.attributes){let ee=e.attributes.find(Ut=>Ut.objectId===M&&Ut.name===oe.name),Ie=ee?.id===t.id?r??ee:ee,mc={...Nm(oe,ee&&Z(ee)),metadata:{...oe.metadata,...Ie&&ro(Ie)&&!(o&&ee?.id===t.id)||!ee?{relationGenerated:true}:{}},id:ee?.id??En("relation-attribute",`${h}:${M}:${oe.name}`),...ee?{}:{order:e.attributes.filter(Ut=>Ut.objectId===M).length}};Se.set(`${M}.${oe.name}`,Gi(mc,M));}}let K=e.attributes.map(k=>{let M=`${k.objectId}.${k.name}`,oe=Se.get(M);return Se.delete(M),oe??k});return K.push(...Se.values()),{...e,attributes:K,views:e.views.map(k=>{let M=[l,m].find(oe=>oe.name===k.object);return k.derived&&M?Mt(k,M,K):k})}}chunkDPD6ZWL2_js.a(io,"reconcileDraftRelationAttribute");function Nm(e,t){if(e.type!=="relation"||!e.bilateral||t?.type!=="relation"||!t.bilateral)return e;let{label:n,cardinality:r,...o}=e.bilateral;return {...e,bilateral:{...o,...t.bilateral.label===void 0?{}:{label:n},...t.bilateral.cardinality===void 0?{}:{cardinality:r}}}}chunkDPD6ZWL2_js.a(Nm,"preserveDeclarationHints");function Fe(e,t){let n=e.objects.find(r=>r.id===t);if(!n)throw new chunkJSKLP4GI_js.h(`Object "${t}" is not in the draftable state`,[]);return n}chunkDPD6ZWL2_js.a(Fe,"requireObject");function oo(e,t,n){return {...e,attributes:[...n],views:e.views.map(r=>r.derived&&r.object===t.name?Mt(r,t,n):r)}}chunkDPD6ZWL2_js.a(oo,"withDerivedViews");function Nn(e){return {objectId:e.objectId}}chunkDPD6ZWL2_js.a(Nn,"objectFocus");function Dn(e){return {objectId:e.objectId,recordId:e.recordId}}chunkDPD6ZWL2_js.a(Dn,"recordFocus");function Gs(e){return {objectId:e.objectId,attributeName:e.name}}chunkDPD6ZWL2_js.a(Gs,"attributeFocus");function On(e){return {objectId:e.objectId,attributeName:e.attribute}}chunkDPD6ZWL2_js.a(On,"existingAttributeFocus");function Dm(e){let t=Object.keys(e.changes).sort();return t.length===1?[t[0]]:void 0}chunkDPD6ZWL2_js.a(Dm,"firstChangedProperty");function Om(e,t){if(!e.derived)for(let n of e.contents){if(n.type==="collection"&&(n.columns?.includes(t)||n.displayAttributes?.includes(t)||n.sorts?.some(r=>r.attribute===t)))return `content "${n.name}"`;if(n.type==="form"&&n.groups.some(r=>r.fields.some(o=>o.attribute===t)))return `content "${n.name}"`;if(n.type==="richtext"&&(n.attribute===t||n.titleAttribute===t))return `content "${n.name}"`}}chunkDPD6ZWL2_js.a(Om,"handShapedUse");function km(e,t,n){let r=n.config??{},o=n.name;if(r.relationPath!==void 0)throw new chunkJSKLP4GI_js.h(`rollup "${o}": relationPath is not supported yet`,[]);let a=r.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(d=>d.objectId===t.id&&d.name===a&&d.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 c=yt(s);if(c===void 0){let d=X(s).filter(b=>b.object!=="*").length;throw new chunkJSKLP4GI_js.h(`rollup "${o}" needs a relation with one target object; "${a}" targets ${d}`,[])}if(r.function==="count")return;let u=e.objects.find(d=>d.name===c),l=r.targetAttribute;if(!(u!==void 0&&e.attributes.some(d=>d.objectId===u.id&&d.name===l)))throw new chunkJSKLP4GI_js.h(`rollup "${o}" targets attribute "${l}", which object "${c}" does not have`,[])}chunkDPD6ZWL2_js.a(km,"assertRollupShape");function jm(e,t){let n=e.config??{};if(e.attributeType==="rollup")return n.relationAttribute===t;let r=typeof n.expression=="string"?n.expression:"";return new RegExp(`(^|[^A-Za-z0-9_])${t}\\.`).test(r)}chunkDPD6ZWL2_js.a(jm,"traversesRelation");function Hs(e,t){let n=Fe(e,t.objectId);if(t.attributeType==="relation"){for(let o of X(t))if(o.object!==ae&&!e.objects.some(a=>a.name===o.object))throw new chunkJSKLP4GI_js.h(`object "${o.object}" is unknown; create it first`,[]);let r=Te(t)?.object;if(r!==void 0&&r!==ae&&!e.objects.some(o=>o.name===r))throw new chunkJSKLP4GI_js.h(`object "${r}" is unknown; create it first`,[]);for(let o of e.attributes)o.objectId!==t.objectId||!gt(o)||jm(o,t.name)&&vn(e,o);}else if(gt(t))t.attributeType==="rollup"&&km(e,n,t),vn(e,t);else return;Zi(Pt(e,t.objectId));}chunkDPD6ZWL2_js.a(Hs,"assertConfigFolds");var Je={...jt,objectId:zod.z.string().uuid().describe("The object this operation acts on")},_m=zod.z.object({...Je,objectId:zod.z.string().uuid().describe("Stable id for the new object; the server mints one when omitted"),type:zod.z.literal("add_object"),name:chunk2M4YXNYZ_js.i.describe("kebab-case plural API name (`purchase-orders`)"),label:zod.z.string().min(1).describe("Label people see"),icon:zod.z.string().min(1).optional().describe("Icon name")}),Pm={type:"add_object",summary:"Creates an object: kebab-case plural name, icon from search_icons; folds in default_list/default_detail; reserved names are native objects.",schema:_m,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(e.objects.some(r=>r.name===t.name))throw new chunkJSKLP4GI_js.h(`Object "${t.name}" already exists`,[]);if(e.objects.some(r=>r.id===t.objectId))throw new chunkJSKLP4GI_js.h(`Object id "${t.objectId}" is already taken`,[]);let n={id:t.objectId,name:t.name,label:t.label,...t.icon===void 0?{}:{icon:t.icon}};return {...e,objects:[...e.objects,n],views:[...e.views,...no(n,e.attributes)]}},"apply"),focus:Nn,presentation:V(Nn,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Cr\xE9e l'objet \xAB ${e.label} \xBB`,"describe")},Mm=zod.z.object({...Je,type:zod.z.literal("update_object"),changes:zod.z.object({label:zod.z.string().min(1).optional().describe("New label"),icon:zod.z.string().min(1).optional().describe("New icon name from search_icons")}).refine(e=>Object.keys(e).length>0,"update_object needs at least one change").describe("\u22651 change")}),Ks=chunkDPD6ZWL2_js.a(e=>({objectId:e.objectId}),"updateObjectFocus"),Fm={type:"update_object",summary:"Updates an object's label and/or icon \u2014 no other field.",schema:Mm,apply:chunkDPD6ZWL2_js.a((e,t)=>(Fe(e,t.objectId),{...e,objects:e.objects.map(n=>n.id===t.objectId?{...n,...t.changes}:n)}),"apply"),focus:Ks,presentation:V(Ks,"atomic",Dm),describe:chunkDPD6ZWL2_js.a(e=>e.changes.label?`Renomme l'objet en \xAB ${e.changes.label} \xBB`:"Modifie l'objet","describe")},Vm=zod.z.object({...Je,type:zod.z.literal("remove_object")}),Bm={type:"remove_object",summary:"Removes an object; refused while a relation attribute targets it \u2014 remove it first.",schema:Vm,apply:chunkDPD6ZWL2_js.a((e,t)=>{Fe(e,t.objectId);let n=e.objects.find(r=>r.id===t.objectId)?.name;for(let r of e.attributes){if(r.objectId===t.objectId||r.attributeType!=="relation"||!X(r).some(a=>a.object===n))continue;let o=e.objects.find(a=>a.id===r.objectId);throw new chunkJSKLP4GI_js.h(`object "${n}" is targeted by attribute "${o?.name}.${r.name}"; remove that attribute first`,[])}return {...e,objects:e.objects.filter(r=>r.id!==t.objectId),attributes:e.attributes.filter(r=>r.objectId!==t.objectId),sampleRecords:e.sampleRecords.filter(r=>r.objectId!==t.objectId),views:e.views.filter(r=>r.object!==n)}},"apply"),focus:Nn,presentation:V(Nn,"structural"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'objet ${e.objectId}`,"describe")},ao=Jt;function Js(e,t){try{chunk2M4YXNYZ_js.L(e,t);}catch(n){throw n instanceof chunkJSKLP4GI_js.h?new chunkJSKLP4GI_js.h(n.message,n.errors.map(r=>({...r,path:["config",...r.path??[]]}))):n}}chunkDPD6ZWL2_js.a(Js,"assertConfigParses");var Lm=zod.z.object({...Je,type:zod.z.literal("add_attribute"),attributeId:zod.z.string().min(1),name:chunk2M4YXNYZ_js.m,label:zod.z.string().min(1),attributeType:zod.z.enum(ao),config:zod.z.record(zod.z.string(),zod.z.unknown()).optional()}).superRefine((e,t)=>{try{Js(e.attributeType,e.config??{});}catch(n){if(n instanceof chunkJSKLP4GI_js.h){for(let r of n.errors)t.addIssue({code:"custom",message:r.message,path:[...r.path]});return}throw n}}),Ys={...jt,type:zod.z.literal("add_attribute"),attributeId:zod.z.string().min(1).describe("Stable attribute id"),name:chunk2M4YXNYZ_js.m.describe("API name, camelCase or snake_case, no hyphen; the title attribute is `title`"),label:zod.z.string().min(1).describe("Label people see")},so=Object.fromEntries(chunk2M4YXNYZ_js.w.map(e=>[e,true])),kn=["text","richtext","number","checkbox","date","phone","currency","location","user"],$m=zod.z.object(kn.reduce((e,t)=>(Object.assign(e,chunk2M4YXNYZ_js.K(t).omit(so).shape),e),{})).strict(),Um=ao.filter(e=>!kn.includes(e)),qm=Object.fromEntries(kn.map(e=>[e,new Set(Object.keys(chunk2M4YXNYZ_js.K(e).omit(so).shape))])),zm=chunk2M4YXNYZ_js.x(qm,"config key");function Wm(e,t){zm(e.attributeType,e.config,t,["config"]);}chunkDPD6ZWL2_js.a(Wm,"refuseForeignSimpleConfigKeys");function Gm(e){let t=chunk2M4YXNYZ_js.K(e).omit(so);return (e==="relation"||e==="document"?t.extend({properties:chunk2M4YXNYZ_js.G.optional()}):t).strict()}chunkDPD6ZWL2_js.a(Gm,"wireConfigFor");var Km=zod.z.discriminatedUnion("attributeType",[zod.z.object({...Ys,objectId:zod.z.string().uuid(),attributeType:zod.z.enum(kn).describe("Attribute type"),config:$m.optional().describe("Configuration of a simple attribute (text, number, date\u2026)")}).strict().superRefine(Wm),...Um.map(e=>zod.z.object({...Ys,objectId:zod.z.string().uuid(),attributeType:zod.z.literal(e).describe("Attribute type"),config:Gm(e).optional().describe(`Configuration of a ${e} attribute`)}).strict())]),Ym={type:"add_attribute",summary:"Adds an attribute; relation/bilateral/rollup targets must pre-exist; no relationPath; formula needs returnType; cover new required attrs.",schema:Lm,wire:Km,apply:chunkDPD6ZWL2_js.a((e,t)=>{let n=Fe(e,t.objectId),r=e.attributes.find(c=>c.objectId===t.objectId&&c.name===t.name);if(r&&!ro(r))throw new chunkJSKLP4GI_js.h(`Attribute "${t.name}" already exists on object "${t.objectId}"`,[]);let o={id:r?.id??t.attributeId,objectId:t.objectId,name:t.name,label:t.label,attributeType:t.attributeType,...t.config===void 0?{}:{config:t.config}};for(let c of e.sampleRecords)c.objectId===t.objectId&&Xs(c.id,o,c.values);let a=r?e.attributes.map(c=>c===r?o:c):[...e.attributes,o],s=oo(e,n,a);return Hs(s,o),io(s,o,t.id,r,true)},"apply"),focus:Gs,presentation:V(Gs,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Ajoute l'attribut \xAB ${e.label} \xBB`,"describe")},Qs={...Je,attribute:chunk2M4YXNYZ_js.m.describe("The attribute's API name on this object")};function Zs(e,t,n,r){let o=Fe(e,t);if(n===void 0)throw new chunkJSKLP4GI_js.h(`${r} 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===n);if(!a)throw new chunkJSKLP4GI_js.h(`Attribute "${n}" is not on object "${t}"`,[]);return {object:o,attribute:a}}chunkDPD6ZWL2_js.a(Zs,"requireAttribute");var Hm=zod.z.object({...Qs,type:zod.z.literal("update_attribute"),changes:zod.z.object({label:zod.z.string().min(1).optional().describe("New label"),config:zod.z.record(zod.z.string(),zod.z.unknown()).optional().describe("Whole config, replaced \u2014 same shape as add_attribute")}).refine(e=>Object.keys(e).length>0,"update_attribute needs at least one change").describe("\u22651 change")}),Jm={type:"update_attribute",summary:"Updates an attribute's label, or replaces its whole config; a published config can't change \u2014 add a new attribute and migrate values.",schema:Hm,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{object:n,attribute:r}=Zs(e,t.objectId,t.attribute,"update_attribute");t.changes.config!==void 0&&Js(r.attributeType,t.changes.config);let o={...r,...t.changes},a=e.attributes.map(c=>c===r?o:c),s=oo(e,n,a);return Hs(s,o),io(s,o,t.id,r)},"apply"),focus:On,presentation:V(On,"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")},Qm=zod.z.object({...Qs,type:zod.z.literal("remove_attribute")}),Zm={type:"remove_attribute",summary:"Removes an attribute; refused while a sample carries its value, a content names it, or a formula/rollup depends on it \u2014 remove those first.",schema:Qm,apply:chunkDPD6ZWL2_js.a((e,t)=>{let{attribute:n}=Zs(e,t.objectId,t.attribute,"remove_attribute"),r=Ws(e,n);for(let s of r){let c=Fe(e,s.objectId),[u]=Xi(e,s.objectId,s.name);if(u!==void 0)throw new chunkJSKLP4GI_js.h(`attribute "${s.name}" is used by "${u}"; remove that first`,[]);for(let m of e.views){if(m.object!==c.name)continue;let d=Om(m,s.name);if(d!==void 0)throw new chunkJSKLP4GI_js.h(`attribute "${s.name}" is used by view "${m.id}" (${d}); remove it from the view first`,[])}let l=e.sampleRecords.find(m=>m.objectId===s.objectId&&s.name in m.values);if(l)throw new chunkJSKLP4GI_js.h(`Attribute "${s.name}" is still used by sample record "${l.id}"`,[])}let o=e.attributes.filter(s=>!r.includes(s)),a={...e,views:e.views.map(s=>s)};return r.reduce((s,c)=>oo(s,Fe(e,c.objectId),o),a)},"apply"),focus:On,presentation:V(On,"local"),describe:chunkDPD6ZWL2_js.a(e=>`Supprime l'attribut \xAB ${e.attribute} \xBB`,"describe")};function Xm(e,t,n,r){let o=Z(n);try{chunkIBM4ID4Y_js.c(o);}catch{return}let a=chunkIBM4ID4Y_js.g(o,r);if(a.success)return;let s=a.errors??[],c=s.map(u=>u.path.length>1?`${u.path.join(".")}: ${u.message}`:u.message).join(", ");throw new chunkJSKLP4GI_js.h(`Sample record "${e}" has an invalid value for "${t}": ${c}`,s.map(u=>({path:u.path,message:u.message})))}chunkDPD6ZWL2_js.a(Xm,"assertSampleValue");function Xs(e,t,n){if(t.config?.required===true&&t.config?.defaultValue===void 0&&!(t.name in n&&n[t.name]!==void 0))throw new chunkJSKLP4GI_js.h(`Sample record "${e}" is missing a value for required attribute "${t.name}"`,[])}chunkDPD6ZWL2_js.a(Xs,"assertRequiredCovered");function co(e){return (Array.isArray(e)?e:[e]).flatMap(n=>{if(typeof n=="string")return [n];if(typeof n=="object"&&n!==null){let r=n.id;if(typeof r=="string")return [r]}return []})}chunkDPD6ZWL2_js.a(co,"relationValueIds");function ef(e,t,n,r){n.attributeType!=="relation"||r===void 0||r===null||tf(e,t,yt(n),r);}chunkDPD6ZWL2_js.a(ef,"assertUnknownSampleReference");function tf(e,t,n,r){let o=e.objects.find(s=>s.name===n);if(!o)return;let a=e.views.some(s=>s.id===He(o.id).list);for(let s of co(r)){let c=e.sampleRecords.find(l=>l.id===s);if(c?.objectId!==o.id&&(c!==void 0||a))throw new chunkJSKLP4GI_js.h(`sample record "${t}" references unknown sample "${s}"`,[])}}chunkDPD6ZWL2_js.a(tf,"assertSampleTarget");var nf=zod.z.object({...Je,type:zod.z.literal("add_sample_record"),recordId:zod.z.string().uuid().describe("Minted by the server when omitted"),values:zod.z.record(zod.z.string(),zod.z.unknown()).describe("Attribute name \u2192 value; currency is `{code,value}`, relation is a record id or name minted here"),publication:zod.z.enum(["preview","requested-data"]).optional().describe("preview = display-only; requested-data = real records asked for")}),rf={type:"add_sample_record",summary:"Adds a sample record; keys are attribute names, required covered, computed never set; relation value is a minted/published recordId; publication is preview or requested-data.",schema:nf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(Fe(e,t.objectId),e.sampleRecords.some(r=>r.id===t.recordId))throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" already exists`,[]);let n=new Map(e.attributes.filter(r=>r.objectId===t.objectId).map(r=>[r.name,r]));for(let[r,o]of Object.entries(t.values)){let a=n.get(r);if(!a)throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" uses unknown attribute "${r}"`,[]);if(gt(a))throw new chunkJSKLP4GI_js.h(`attribute "${a.name}" is computed and cannot be set on a sample record`,[]);ef(e,t.recordId,a,o),Xm(t.recordId,r,a,o);}for(let r of n.values())Xs(t.recordId,r,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:Dn,presentation:V(Dn,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Ajoute un exemple","describe")};function of(e,t){return new Set([...e.attributes.filter(n=>n.objectId===t&&n.attributeType==="relation").map(n=>n.name)])}chunkDPD6ZWL2_js.a(of,"relationNamesOf");function af(e,t){for(let n of e.sampleRecords){if(n.id===t)continue;let r=of(e,n.objectId);for(let[o,a]of Object.entries(n.values))if(r.has(o)&&co(a).includes(t))throw new chunkJSKLP4GI_js.h(`sample record "${t}" is referenced by sample record "${n.id}"; remove that first`,[])}}chunkDPD6ZWL2_js.a(af,"assertSampleNotReferenced");var sf=zod.z.object({...Je,type:zod.z.literal("remove_sample_record"),recordId:zod.z.string().min(1).describe("recordId of the sample to remove")}),cf={type:"remove_sample_record",summary:"Removes a sample record; refused while another sample still references it.",schema:sf,apply:chunkDPD6ZWL2_js.a((e,t)=>{if(!e.sampleRecords.some(n=>n.id===t.recordId&&n.objectId===t.objectId))throw new chunkJSKLP4GI_js.h(`Sample record "${t.recordId}" is not in object "${t.objectId}"`,[]);return af(e,t.recordId),{...e,sampleRecords:e.sampleRecords.filter(n=>n.id!==t.recordId)}},"apply"),focus:Dn,presentation:V(Dn,"local"),describe:chunkDPD6ZWL2_js.a(()=>"Retire un exemple","describe")},Qe=[Pm,Fm,Bm,Ym,Jm,Zm,rf,cf];function uf(){let e=new Map;for(let t of [...Qe,...Ye]){if(e.has(t.type))throw new chunkJSKLP4GI_js.r("architect operation",t.type);e.set(t.type,t);}return e}chunkDPD6ZWL2_js.a(uf,"build");var Ft=uf(),lf=[...Ft.keys()];function Vt(e){let t=Ft.get(e.type);if(!t)throw new chunkJSKLP4GI_js.h(`Operation "${e.id}" has unknown type "${e.type}"`,[]);return t}chunkDPD6ZWL2_js.a(Vt,"defOf");function uo(e,t,n={extensions:[]}){return t.reduce((r,o)=>Vt(o).apply(r,o,n),e)}chunkDPD6ZWL2_js.a(uo,"applyOperations");function lo(e){return Vt(e).focus(e)}chunkDPD6ZWL2_js.a(lo,"focusOf");function df(e,t){return e.map(n=>Vt(n).describe(n,t))}chunkDPD6ZWL2_js.a(df,"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 n=Ft.get(t);if(!n)throw new chunkJSKLP4GI_js.h(`Unknown operation type "${t}"`,[]);let r=n.schema.safeParse(e);if(!r.success)throw new chunkJSKLP4GI_js.h(`Operation "${t}" is invalid: ${r.error.issues.map(o=>`${o.path.join(".")} ${o.message}`).join("; ")}`,[]);return r.data}chunkDPD6ZWL2_js.a(pf,"parseOperation");var Bt=chunkDPD6ZWL2_js.a(e=>zod.z.tuple([zod.z.literal(e),zod.z.string()]),"pair"),mf=zod.z.union([zod.z.tuple([zod.z.literal("content"),zod.z.string(),zod.z.string(),zod.z.string()]),zod.z.tuple([zod.z.literal("view"),zod.z.string(),zod.z.string()]),zod.z.tuple([zod.z.literal("attribute"),zod.z.string(),zod.z.string()]),zod.z.tuple([zod.z.literal("sample"),zod.z.string(),zod.z.string()]),Bt("object"),Bt("object-name"),Bt("object-schema"),Bt("object-tree"),Bt("attribute-id")]);function Lt(e){return e.viewName&&e.objectName?JSON.stringify(e.contentName?["content",e.objectName,e.viewName,e.contentName]:["view",e.objectName,e.viewName]):e.attributeName&&e.objectId?JSON.stringify(["attribute",e.objectId,e.attributeName]):e.attributeId?JSON.stringify(["attribute-id",e.attributeId]):e.recordId&&e.objectId?JSON.stringify(["sample",e.objectId,e.recordId]):e.objectId?JSON.stringify(["object",e.objectId]):e.objectName?JSON.stringify(["object-name",e.objectName]):null}chunkDPD6ZWL2_js.a(Lt,"proposalTargetKey");function ec(e,t,n,r){if(n&&typeof n=="object")if("source"in n&&n.source&&typeof n.source=="object"){let o=Gr(n.source);if(o&&o.kind!=="related"&&r(o.object),o?.kind==="related"){let a=o.relation;r(t);let s=e.objects.find(u=>u.name===t),c=e.attributes.find(u=>u.objectId===s?.id&&u.name===a);if(c?.attributeType==="relation"&&Array.isArray(c.config?.targets))for(let u of c.config.targets)u&&typeof u.object=="string"&&u.object!=="*"&&r(u.object);}}else "type"in n&&n.type==="forms"?r("objectName"in n&&typeof n.objectName=="string"?n.objectName:t):"type"in n&&["form","richtext","emails","meetings","documents"].includes(String(n.type))&&r(t);}chunkDPD6ZWL2_js.a(ec,"addContentDependencies");function ff(e,t,n,r,o){if(["add_attribute","update_attribute","remove_attribute"].includes(t.type)){let a=e.attributes.find(c=>c.objectId===n.objectId&&c.name===n.attributeName),s=r&&typeof r=="object"&&"bilateral"in r?r.bilateral:a?.config?.bilateral;if((t.attributeType==="relation"||a?.attributeType==="relation")&&s&&typeof s=="object"&&"object"in s&&typeof s.object=="string"){n.objectId&&o("object-tree",n.objectId);let c=e.objects.find(u=>u.name===s.object);c?o("object-tree",c.id):o("object-name",s.object);}}}chunkDPD6ZWL2_js.a(ff,"addBilateralDependencies");function bf(e,t){let n=new Set,r=chunkDPD6ZWL2_js.a((...a)=>n.add(JSON.stringify(a)),"add"),o=chunkDPD6ZWL2_js.a(a=>{let s=e.objects.find(c=>c.name===a);s?r("object-schema",s.id):r("object-name",a);},"schemaFor");for(let a of t){let s=lo(a);if(a.type==="rename_view"||a.type==="rename_view_content"){let m=Ji.parse(a),d=Lt({objectName:m.objectName,viewName:m.viewName,...m.type==="rename_view_content"?{contentName:m.contentName}:{}});d&&n.add(d);}let c=Lt(s);if(c&&n.add(c),s.viewName&&s.objectName){a.type!=="replace_view_content"&&r("view",s.objectName,s.viewName);let m=e.objects.find(d=>d.name===s.objectName);if(m?r("object",m.id):r("object-name",s.objectName),ec(e,s.objectName,a.definition??a.content,o),a.type==="reset_view_content"&&typeof a.contentName=="string"){let d=e.views.find(b=>b.object===a.objectName&&b.name===a.viewName);ec(e,s.objectName,d?.authoring.contents[a.contentName]?.sourceDefinition,o);}}s.objectId&&r("object",s.objectId),s.objectId&&(a.type==="remove_object"||a.type.includes("sample_record"))&&r("object-tree",s.objectId),a.type==="add_object"&&typeof a.name=="string"&&r("object-name",a.name);let u=a.changes&&typeof a.changes=="object"?a.changes:null,l=a.type==="add_attribute"?a.config:u&&"config"in u?u.config:null;if(ff(e,a,s,l,r),l&&typeof l=="object"&&"targets"in l&&Array.isArray(l.targets))for(let m of l.targets)m&&typeof m.object=="string"&&m.object!=="*"&&r("object-name",m.object);}return [...n]}chunkDPD6ZWL2_js.a(bf,"requiredTargetKeys");function gf(e,t){return Object.fromEntries(t.map(n=>[n,chunkRTHLB6T6_js.b(jn(e,n))]))}chunkDPD6ZWL2_js.a(gf,"targetTokensFor");function jn(e,t){let n;try{n=JSON.parse(t);}catch{throw new chunkJSKLP4GI_js.h(`Invalid proposal target key "${t}"`,[])}let r=mf.safeParse(n);if(!r.success)throw new chunkJSKLP4GI_js.h(`Invalid proposal target key "${t}"`,[]);let[o,a,s,c]=r.data,u=e.objects.find(d=>d.id===a);if(o==="object")return u??null;if(o==="object-name")return e.objects.find(d=>d.name===a)??null;if(o==="attribute-id")return e.attributes.find(d=>d.id===a)??null;if(o==="attribute")return e.attributes.find(d=>d.objectId===a&&d.name===s)??null;if(o==="sample")return e.sampleRecords.find(d=>d.objectId===a&&d.id===s)??null;if(o==="object-schema"||o==="object-tree"){if(!u)return null;let d=e.attributes.filter(b=>b.objectId===a);return o==="object-schema"?{object:u,attributes:d.toSorted((b,g)=>b.name.localeCompare(g.name))}:{object:u,attributes:d,views:e.views.filter(b=>b.object===u.name),sampleRecords:e.sampleRecords.filter(b=>b.objectId===a)}}let l=e.views.find(d=>d.object===a&&d.name===s);if(!l)return null;if(o==="view")return {id:l.id,revision:l.revision,definition:{...ft(l),contents:l.contents.map(({name:d,placement:b})=>({name:d,placement:b}))}};let m=l.contents.find(d=>d.name===c);return c!==void 0&&Object.hasOwn(l.contentIds,c)?{id:l.contentIds[c],revision:l.contentRevisions[c],definition:m??null}:null}chunkDPD6ZWL2_js.a(jn,"targetSnapshot");function $t(e){return Vt(e).presentation(e)}chunkDPD6ZWL2_js.a($t,"presentationOf");function yf(e){let t=e.map($t);return new Set(t.map(({focus:r})=>r.viewName?JSON.stringify([r.objectName,r.viewName]):r.objectId).filter(r=>r!==void 0)).size>1||t.some(({impact:r})=>r==="structural")?"structural":t.some(({impact:r})=>r==="local")?"local":"atomic"}chunkDPD6ZWL2_js.a(yf,"episodeImpactOf");function tc(e,t){let n=Lt(t);return n===null?null:jn(e,n)}chunkDPD6ZWL2_js.a(tc,"snapshotArchitectTarget");function hf(e,t,n={extensions:[]}){let r=e;return t.map(o=>{let a=$t(o),s=tc(r,a.focus);r=uo(r,[o],n);let c=tc(r,a.focus);return {operationId:o.id,operationType:o.type,presentation:a,before:s,after:c,...o.note===void 0?{}:{note:o.note}}})}chunkDPD6ZWL2_js.a(hf,"deriveArchitectChanges");var me=zod.z.string().min(1),nc=zod.z.union([zod.z.object({objectName:me,viewName:me,contentName:me.optional()}).strict().describe("Full configuration of a view, or of one content when contentName is given"),zod.z.object({objectId:me}).strict().describe("An object with its attributes, by id"),zod.z.object({objectName:me}).strict().describe("An object with its attributes"),zod.z.object({objectId:me,attributeName:me}).strict().describe("One attribute's config, by name"),zod.z.object({objectId:me,attributeId:me}).strict().describe("One attribute's config, by id"),zod.z.object({objectId:me,recordId:me}).strict().describe("One sample record")]);function Af(e){let t=nc.safeParse(e);if(!t.success)throw new chunkJSKLP4GI_js.h("Invalid scoped target",[{path:["target"],message:"Expected exactly one named target branch"}]);return t.data}chunkDPD6ZWL2_js.a(Af,"parseNamedTarget");var po=zod.z.object({type:zod.z.literal("remove_operation"),operationId:zod.z.string().min(1).describe("The id of a stored operation to drop from the draft")}),xf=12;function ic(e,t=[]){return [...e.map(n=>n.schema),...t].map(oc)}chunkDPD6ZWL2_js.a(ic,"membersOf");function Tf(e,t){return Pn(e,n=>n.describe(t))}chunkDPD6ZWL2_js.a(Tf,"describeMember");function rc(e,t=[]){return [...e.map(o=>o.wire??o.schema),...t].map(oc).map(Rf).map(vf).map((o,a)=>{let s=e[a];return s===void 0?o:Tf(o,s.summary)})}chunkDPD6ZWL2_js.a(rc,"wireMembersOf");function _n(e){return zod.z.discriminatedUnion("type",e)}chunkDPD6ZWL2_js.a(_n,"unionOf");function wf(e){return e instanceof zod.z.ZodString&&e.format==="uuid"}chunkDPD6ZWL2_js.a(wf,"isUuidString");function Sf(e){let t=e;return !Array.isArray(t.options)||typeof t.def?.discriminator!="string"?null:{discriminator:t.def.discriminator,options:t.options}}chunkDPD6ZWL2_js.a(Sf,"asUnionMember");function Pn(e,t){let n=Sf(e);return n===null?t(e):zod.z.discriminatedUnion(n.discriminator,n.options.map(t))}chunkDPD6ZWL2_js.a(Pn,"mapMember");function oc(e){return Pn(e,t=>{let n={};for(let[r,o]of Object.entries(t.shape)){if(!wf(o))continue;let a=zod.z.string().min(1);n[r]=o.description===void 0?a:a.describe(o.description);}return Object.keys(n).length===0?t:t.safeExtend(n)})}chunkDPD6ZWL2_js.a(oc,"relaxUuidKeys");var If={add_object:["objectId"],add_sample_record:["recordId"]};function Rf(e){return Pn(e,t=>{let n={};for(let r of If[t.shape.type.value]??[]){let o=t.shape[r];o instanceof zod.z.ZodString&&(n[r]=o.optional());}return Object.keys(n).length===0?t:t.safeExtend(n)})}chunkDPD6ZWL2_js.a(Rf,"relaxMintedKeys");function Cf(e,t){let n=e._zod.def.checks;return !n||n.length===0?t:t.check(...n)}chunkDPD6ZWL2_js.a(Cf,"withOriginalChecks");function vf(e){return Pn(e,t=>{if(t.shape.type.value==="add_object"||!("objectId"in t.shape))return t;let{objectId:n,...r}=t.shape,o=zod.z.object({...r,objectName:zod.z.string().min(1).describe("Object")}).strict();return Cf(t,o)})}chunkDPD6ZWL2_js.a(vf,"addressByName");var Ef=ic(Qe,[po]),Nf=ic(Ye),ac=_n(Ef),sc=_n(Nf),Df={schema:ac,view:sc},Of={schema:_n(rc(Qe,[po])),view:_n(rc(Ye))},kf=new Map([...Qe.map(e=>[e.type,"schema"]),["remove_operation","schema"],...Ye.map(e=>[e.type,"view"])]);function jf(e){return kf.get(e)??null}chunkDPD6ZWL2_js.a(jf,"familyOf");function Mn(e,t,n){return e.views.filter(r=>r.object===t.name&&r.context===n)}chunkDPD6ZWL2_js.a(Mn,"viewsOf");function uc(e,t){return Mn(e,t,"collection").flatMap(n=>n.contents).filter(n=>n.type==="collection")}chunkDPD6ZWL2_js.a(uc,"collectionContentsOf");function lc(e,t){return e.attributes.filter(n=>n.objectId===t.id)}chunkDPD6ZWL2_js.a(lc,"ownAttributes");function _f(e){return chunkMXZ3AF5X_js.j(Z(e)).presentation.tableCell}chunkDPD6ZWL2_js.a(_f,"isTableCell");function cc(e,t,n){return Mn(e,t,"record").some(r=>r.contents.some(o=>o.type===n))}chunkDPD6ZWL2_js.a(cc,"hasRecordContent");function dc(e,t){return e===2&&t<=5}chunkDPD6ZWL2_js.a(dc,"isEdgePayload");function Pf(e,t){let n=lc(e,t),r=n.filter(o=>o.attributeType==="relation");return dc(r.length,n.length)?!e.attributes.some(o=>o.attributeType==="relation"&&o.objectId!==t.id&&X(o).some(a=>a.object===t.name)):false}chunkDPD6ZWL2_js.a(Pf,"looksLikeEdge");function Mf(e,t,n){return Mn(e,n,"record").some(r=>r.contents.some(o=>o.type==="collection"&&o.source.relation===t.name))}chunkDPD6ZWL2_js.a(Mf,"reciprocalExists");function Ff(e,t){let n=[],r=t?e.objects.filter(o=>t.has(o.id)):e.objects;for(let o of r){if(Pf(e,o)){n.push(`Object "${o.label}" is an edge (two relations plus scalars): qualify a relation with config.properties.definitions instead of an object.`);continue}let a=uc(e,o);a.length===0&&n.push(`Object "${o.label}" has no collection content: add_view_content.`);for(let s of lc(e,o))if(_f(s)&&a.length&&!a.some(c=>c.columns===void 0||c.columns.includes(s.name))&&n.push(`Attribute "${s.label}" on "${o.label}" is in no collection column set: replace_view_content.`),s.attributeType==="document"&&!cc(e,o,"documents")&&n.push(`Object "${o.label}" has no documents content: add_view_content.`),s.attributeType==="relation")for(let{object:c}of X(s)){let u=e.objects.find(l=>l.name===c);u&&!Mf(e,s,u)&&n.push(`Relation "${s.label}" on "${o.label}" has no reciprocal collection on "${u.label}": add_view_content with source.relation.`);}Mn(e,o,"record").length&&!cc(e,o,"activity")&&n.push(`Object "${o.label}" has no activity content on its record view: add_view_content.`),a.length===1&&n.push(`Object "${o.label}" has a single collection content; a person would add one to three that answer a question: add_view_content.`);}return n}chunkDPD6ZWL2_js.a(Ff,"stillMissing");function Vf(e,t){let n=new Set(t.flatMap(r=>r.type==="add_attribute"&&typeof r.attributeId=="string"?[r.attributeId]:[]));return e.attributes.filter(r=>n.has(r.id))}chunkDPD6ZWL2_js.a(Vf,"addedAttributes");function Bf(e,t){let n={next:[],needsColumns:[],regenerated:[]},r=new Set;for(let o of Vf(e,t)){let a=e.objects.find(l=>l.id===o.objectId);if(!a)continue;let s=e.views.filter(l=>l.object===a.name);if(!r.has(a.id)){r.add(a.id);for(let l of s.filter(m=>m.derived))for(let m of l.contents)n.regenerated.push(`${l.name}.${m.name}`);}for(let l of s.filter(m=>!m.derived&&m.context==="collection"))for(let m of l.contents)m.type==="collection"&&m.columns!==void 0&&!m.columns.includes(o.name)&&n.needsColumns.push({view:l.name,content:m.name,attribute:o.name});let c=s.some(l=>l.context==="record"&&l.contents.some(m=>m.type==="documents")),u=s.find(l=>l.context==="record");o.attributeType==="document"&&u&&!c&&n.next.push({type:"add_view_content",objectName:a.name,viewName:u.name,content:{name:"documents",type:"documents",placement:"main",label:"Documents"},target:{end:true}});}return n}chunkDPD6ZWL2_js.a(Bf,"guidanceForBatch");function Lf(e,t){let n=new Map(e.objects.map(o=>[o.name,o.id])),r=new Set;for(let o of t){let{focus:a}=$t(o),s=a.objectId??(a.objectName?n.get(a.objectName):void 0);s!==void 0&&r.add(s);}return r}chunkDPD6ZWL2_js.a(Lf,"touchedObjectIds");function $f(e){let t=e.config??{};if(e.attributeType==="relation")return `\u2192 ${X(e).map(n=>n.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($f,"attributeDetail");function Uf(e){let t=Zt({properties:e.config?.properties});if(t.length!==0)return t.map(n=>`${n.name}: ${n.type}`)}chunkDPD6ZWL2_js.a(Uf,"propertyLines");function qf(e){let t=e.config?.options,n=$f(e),r=Uf(e);return {name:e.name,label:e.label,type:e.attributeType,...Array.isArray(t)?{options:t.map(o=>o.value)}:{},...n===void 0?{}:{detail:n},...r===void 0?{}:{properties:r}}}chunkDPD6ZWL2_js.a(qf,"summarizeAttribute");function zf(e,t,n){let r=He(e.id),o=n.some(a=>a.id===r.list);return {id:e.id,name:e.name,label:e.label,attributes:t.filter(a=>a.objectId===e.id).map(qf),...o?{viewIds:r}:{}}}chunkDPD6ZWL2_js.a(zf,"summarizeObject");function Wf(e,t){if(!t.some(n=>n.name===e.object))throw new chunkJSKLP4GI_js.h(`View "${e.name}" names an object outside the draft scope`,[]);return {id:e.id,name:e.name,context:e.context,objectName:e.object,label:e.label,derived:e.derived===true,contents:e.contents.map(({name:n,type:r,placement:o,label:a})=>({name:n,type:r,placement:o,label:a}))}}chunkDPD6ZWL2_js.a(Wf,"summarizeView");function Gf(e,t){let n=new Map;for(let r of e.sampleRecords)n.set(r.objectId,(n.get(r.objectId)??0)+1);return {objects:e.objects.map(r=>zf(r,e.attributes,e.views)),views:e.views.map(r=>Wf(r,e.objects)),sampleRecords:[...n.entries()].map(([r,o])=>({objectId:r,count:o})),operationCount:t}}chunkDPD6ZWL2_js.a(Gf,"summarizeDraft");var Kf=["draft_schema"],Yf="publish_architect_draft",Hf="discard_architect_draft",Jf="request_design_review",Qf="get_architect_draft";var Zf=[{input:{operations:[{type:"add_attribute",id:"op-statut",objectName:"devis",attributeId:"attr-statut",name:"statut",label:"Statut",attributeType:"select",config:{options:[{value:"draft",label:"Brouillon",color:"gray"},{value:"sent",label:"Envoy\xE9",color:"blue"},{value:"accepted",label:"Accept\xE9",color:"green"}]}}],guard:{revision:null,targetTokens:{}}}},{input:{operations:[{type:"add_view_content",id:"op-open",objectName:"devis",viewName:"default_list",content:{name:"open",label:"\xC0 traiter",type:"collection",placement:"main",layout:"table",source:{object:"devis"},columns:["title","client","montant","statut"],filters:{combinator:"and",rules:[{attribute:"statut",operator:"is",value:"sent"}]},sorts:[{attribute:"montant",direction:"desc"}]},target:{end:true}}],guard:{revision:null,targetTokens:{}}}},{input:{operations:[{type:"replace_view_content",id:"op-all",objectName:"devis",viewName:"default_list",contentName:"all",definition:{name:"all",type:"collection",placement:"main",layout:"table",source:{object:"devis"},columns:["title","client","montant","statut"]}}],guard:{revision:null,targetTokens:{}}}}];var re=zod.z.string().refine(e=>e.trim().length>0,"Must not be blank"),pc=zod.z.union([zod.z.tuple([zod.z.literal("object"),re]),zod.z.tuple([zod.z.literal("attribute"),re,re]),zod.z.tuple([zod.z.literal("view"),re,re]),zod.z.tuple([zod.z.literal("content"),re,re,re])]),Xf=zod.z.object({label:re,pluralLabel:zod.z.string().optional(),description:zod.z.string().optional(),icon:chunk2M4YXNYZ_js.t.optional(),labelExpression:zod.z.string(),embeddingExpression:zod.z.string().optional(),sealed:zod.z.boolean().optional(),toleratedAttributes:zod.z.array(re).optional(),metadata:zod.z.record(zod.z.string(),zod.z.unknown()).optional(),schema_version:zod.z.number().int().nonnegative(),migrations:zod.z.array(zod.z.record(zod.z.string(),zod.z.unknown())),documentLayout:zod.z.record(zod.z.string(),zod.z.unknown()).optional()}).strict();function Ze(e){throw new chunkJSKLP4GI_js.h(e,[])}chunkDPD6ZWL2_js.a(Ze,"failure");function eb(e){return zod.z.custom(t=>{let n=zod.z.record(zod.z.string(),zod.z.unknown()).parse(t);for(let r of e[0]==="view"?["object","name"]:["name"])Object.hasOwn(n,r)&&Ze(`Invalid schema state: unrecognized definition key ${r}`);switch(e[0]){case "object":Xf.parse(n);break;case "attribute":{let r=zod.z.enum(Jt).parse(n.type);chunk2M4YXNYZ_js.I(r).extend({type:zod.z.literal(r),label:re,required:zod.z.boolean().optional(),unique:zod.z.boolean().optional(),icon:chunk2M4YXNYZ_js.t.optional()}).strict().parse(n);break}case "view":{let{contents:r,...o}=n,a=zod.z.array(re).parse(r);new Set(a).size!==a.length&&Ze("Invalid schema state: duplicate content membership"),chunkMXZ3AF5X_js.Z.parse({...o,object:e[1],name:e[2],contents:[]});break}case "content":chunkMXZ3AF5X_js.W.parse({...n,name:e[3]});break}return true})}chunkDPD6ZWL2_js.a(eb,"definitionSchema");function Fn(e,t){let n=JSON.stringify(e.address),r=JSON.stringify(t.address);return n<r?-1:n>r?1:0}chunkDPD6ZWL2_js.a(Fn,"compareSchemaStateEntries");function tb(e){return {modelVersion:1,hashVersion:1,entries:[...e].sort(Fn).filter(t=>t.source!==null).map(({address:t,source:n})=>({address:t,source:n}))}}chunkDPD6ZWL2_js.a(tb,"schemaStateSourcePayload");function nb(e){let t=zod.z.record(zod.z.string(),zod.z.unknown()).parse(e);for(let[a,s]of [["modelVersion","model"],["hashVersion","hash"]])t[a]!==1&&Ze(`Unsupported schema ${s} version: expected 1, received ${t[a]===void 0?"missing":String(t[a])}`);let n=zod.z.object({modelVersion:zod.z.literal(1),hashVersion:zod.z.literal(1),tenant:re,sourceFingerprint:zod.z.string().regex(/^[a-f0-9]{64}$/),entries:zod.z.array(zod.z.unknown())}).strict().safeParse(e);if(!n.success){let a=n.error.issues.find(s=>s.code==="unrecognized_keys");throw a?.code==="unrecognized_keys"&&Ze(`Invalid schema state: unrecognized key ${a.keys[0]}`),chunkJSKLP4GI_js.h.fromZodErrors(n.error.issues.map(s=>({path:s.path.map(String),message:s.message})))}let r=new Set,o=n.data.entries.map(a=>{let s=pc.parse(zod.z.object({address:zod.z.unknown()}).parse(a).address),c=JSON.stringify(s);r.has(c)&&Ze(`Invalid schema state: duplicate address ${c}`),r.add(c);let u=eb(s).nullable(),l=s[0]==="object"||s[0]==="attribute"?zod.z.object({id:zod.z.string().uuid(),updatedAt:zod.z.string().datetime()}).strict():zod.z.object({id:zod.z.string().uuid(),revision:zod.z.number().int().nonnegative()}).strict(),m=zod.z.object({address:pc,source:u,effective:u,status:zod.z.enum(["source","runtime","copy","suppressed"]),sourceOwner:zod.z.union([zod.z.literal("core"),zod.z.string().regex(/^(bundle|source):.+$/)]).nullable(),guard:l.nullable()}).strict().parse(a);(m.status==="runtime"&&(m.source!==null||m.effective===null||m.sourceOwner!==null)||m.status==="suppressed"&&(s[0]!=="content"||m.source===null||m.effective!==null||m.guard===null)||m.status==="copy"&&(m.source===null||m.effective===null)||m.effective!==null&&m.guard===null||m.source===null&&m.effective===null)&&Ze(`Invalid schema state: inconsistent status at ${c}`);let d=m.sourceOwner;d!==null&&d!=="core"&&!d.startsWith("bundle:")&&!d.startsWith("source:")&&Ze("Invalid source owner");let b=d===null||d==="core"?d:d.startsWith("bundle:")?`bundle:${d.slice(7)}`:`source:${d.slice(7)}`;return {...m,sourceOwner:b}});return {...n.data,entries:o.sort(Fn)}}chunkDPD6ZWL2_js.a(nb,"parseState");function rb(e){try{return nb(e)}catch(t){throw t instanceof zod.z.ZodError?chunkJSKLP4GI_js.h.fromZodErrors(t.issues.map(n=>({path:n.path.map(String),message:n.message}))):t}}chunkDPD6ZWL2_js.a(rb,"parseSchemaState");function ib(e){let t=[];for(let n of [...e.entries].sort(Fn)){let r=n.source===null?"added":n.status==="suppressed"?"suppressed":n.effective===null?"removed":chunkRTHLB6T6_js.b(n.source)!==chunkRTHLB6T6_js.b(n.effective)?"changed":n.status==="copy"?"copied":null;r&&t.push({...n,change:r});}return {modelVersion:1,tenant:e.tenant,sourceFingerprint:e.sourceFingerprint,changes:t}}chunkDPD6ZWL2_js.a(ib,"diffSchemaState");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 chunkMXZ3AF5X_js.i}});Object.defineProperty(exports,"LOCATION_FILTER_PROPERTIES",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.f}});Object.defineProperty(exports,"NO_VALUE_OPERATORS",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.s}});Object.defineProperty(exports,"OPERATORS_BY_TYPE",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.r}});Object.defineProperty(exports,"REMOVED_OPERATOR_REPLACEMENTS",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.O}});Object.defineProperty(exports,"SYNONYM_ALIASES",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.G}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTES",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.c}});Object.defineProperty(exports,"SYSTEM_ATTRIBUTE_I18N_KEYS",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.a}});Object.defineProperty(exports,"SYSTEM_FILTER_ATTRIBUTE_TYPES",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.N}});Object.defineProperty(exports,"canonicalizeFilterValue",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.F}});Object.defineProperty(exports,"collectQualifiedRuleIssues",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.P}});Object.defineProperty(exports,"collectionContentSourceSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.V}});Object.defineProperty(exports,"columnsSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.R}});Object.defineProperty(exports,"contentViewDefinitionSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js._}});Object.defineProperty(exports,"contentViewDefinitionSchemaFor",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.Y}});Object.defineProperty(exports,"currentActor",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.w}});Object.defineProperty(exports,"displayAttributesSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.S}});Object.defineProperty(exports,"draftContentViewDefinitionSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.Z}});Object.defineProperty(exports,"draftContentViewDefinitionSchemaFor",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.X}});Object.defineProperty(exports,"extractCurrencyFilterValue",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.z}});Object.defineProperty(exports,"extractFilterValue",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.A}});Object.defineProperty(exports,"filterStateSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.U}});Object.defineProperty(exports,"getAttributeCapabilities",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.j}});Object.defineProperty(exports,"getAttributeFilterOperators",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.k}});Object.defineProperty(exports,"getOperatorPolarity",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.B}});Object.defineProperty(exports,"getRollupFilterOperators",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.u}});Object.defineProperty(exports,"getSystemAttributeI18nKey",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.b}});Object.defineProperty(exports,"getSystemAttributeList",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.d}});Object.defineProperty(exports,"isAttributeFilterable",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.l}});Object.defineProperty(exports,"isAttributeGroupable",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.o}});Object.defineProperty(exports,"isAttributeKanbanGroupable",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.p}});Object.defineProperty(exports,"isAttributeSearchable",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.m}});Object.defineProperty(exports,"isDynamicValue",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.v}});Object.defineProperty(exports,"isLocationFilterProperty",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.g}});Object.defineProperty(exports,"isLocationPartOperator",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.h}});Object.defineProperty(exports,"isManagedSystemAttribute",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.e}});Object.defineProperty(exports,"isNoValueOperator",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.t}});Object.defineProperty(exports,"isRelativeDateValue",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.J}});Object.defineProperty(exports,"isSetMembershipOperator",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.E}});Object.defineProperty(exports,"normalizeFilterRule",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.I}});Object.defineProperty(exports,"normalizeForEdgeRpc",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.C}});Object.defineProperty(exports,"normalizeOperator",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.H}});Object.defineProperty(exports,"now",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.y}});Object.defineProperty(exports,"publishedViewContentDefinitionSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.W}});Object.defineProperty(exports,"resolveEffectiveFilterType",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.q}});Object.defineProperty(exports,"resolveIsWithinBounds",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.K}});Object.defineProperty(exports,"resolveUtcDayBounds",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.L}});Object.defineProperty(exports,"sortsSchema",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.T}});Object.defineProperty(exports,"toMultiValueOperator",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.D}});Object.defineProperty(exports,"toUtcDayString",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.M}});Object.defineProperty(exports,"today",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.x}});Object.defineProperty(exports,"validateQualifiedRule",{enumerable:true,get:function(){return chunkMXZ3AF5X_js.Q}});Object.defineProperty(exports,"ComputedFormulaParseError",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.u}});Object.defineProperty(exports,"LIST_VIEW_TAB_VISIBILITIES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.d}});Object.defineProperty(exports,"NATIVE_OBJECT_NAMES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.a}});Object.defineProperty(exports,"OBJECT_NAME_SCHEMA",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.i}});Object.defineProperty(exports,"RESERVED_ATTRIBUTE_NAMES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.g}});Object.defineProperty(exports,"RESERVED_OBJECT_NAMES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.h}});Object.defineProperty(exports,"RESOURCE_VISIBILITIES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.c}});Object.defineProperty(exports,"SCHEMA_LIMITS",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.r}});Object.defineProperty(exports,"SIMPLE_PROPERTY_TYPES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.C}});Object.defineProperty(exports,"SYSTEM_FIELD_NAMES",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.f}});Object.defineProperty(exports,"WIRE_OMITTED_CONFIG_KEYS",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.w}});Object.defineProperty(exports,"attributeConfigSchemas",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.H}});Object.defineProperty(exports,"colorIdSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.s}});Object.defineProperty(exports,"iconNameSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.t}});Object.defineProperty(exports,"isNativeObjectName",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.b}});Object.defineProperty(exports,"multiselectOptionWriteSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.A}});Object.defineProperty(exports,"parseAttributeConfig",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.J}});Object.defineProperty(exports,"parseAttributeConfigForCreate",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.L}});Object.defineProperty(exports,"parseAttributeConfigForUpdate",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.M}});Object.defineProperty(exports,"parseComputedFormula",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.v}});Object.defineProperty(exports,"parseResourceVisibility",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.e}});Object.defineProperty(exports,"propertyAttributeSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.D}});Object.defineProperty(exports,"propertyAttributeWireSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.F}});Object.defineProperty(exports,"propertySchemaSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.E}});Object.defineProperty(exports,"propertySchemaWireSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.G}});Object.defineProperty(exports,"refuseForeignKeys",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.x}});Object.defineProperty(exports,"selectOptionWriteSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.z}});Object.defineProperty(exports,"statusGroupSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.y}});Object.defineProperty(exports,"statusOptionWriteSchema",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.B}});Object.defineProperty(exports,"validateAttributeName",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.n}});Object.defineProperty(exports,"validateObjectName",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.j}});Object.defineProperty(exports,"validateViewName",{enumerable:true,get:function(){return chunk2M4YXNYZ_js.k}});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=sS;exports.AGENT_UI_BATCH_MAX_ITEMS=cS;exports.ALLOWED_PROPERTY_TYPES=Qo;exports.ALL_ACTIONS=Hn;exports.ALL_OPERATION_TYPES=lf;exports.ALL_SYSTEM_RESOURCES=ZA;exports.ARTIFACT_FILE_ROLES=Oy;exports.ARTIFACT_KINDS=Ny;exports.ARTIFACT_LIST_VIEW=vl;exports.ARTIFACT_OBJECT=Rl;exports.ARTIFACT_OBJECT_NAME=ct;exports.ARTIFACT_PREVIEW_EXTENSION=ha;exports.ARTIFACT_RETENTIONS=Dy;exports.ARTIFACT_VIEW=Cl;exports.ATTRIBUTE_TYPES=Jt;exports.AUDIT_ACTIONS=Kg;exports.AUDIT_RESOURCE_TYPES=Gg;exports.AgentBuilder=Xn;exports.BEHAVIOR_PROPERTIES=Fg;exports.BYTE_UNIT_LABELS=lu;exports.CLAIMABLE_SESSION_STATUSES=Jc;exports.COMPUTED_FUNCTIONS=Ot;exports.COMPUTED_FUNCTION_METADATA=qS;exports.COMPUTED_FUNCTION_NAMES=IS;exports.CONNECTOR_CALLBACK_PARAM=gI;exports.COUNT_MODES=Ho;exports.ComputedFormulaCompileError=I;exports.ContentBuilder=ce;exports.DB_COLUMN_FIELDS=JA;exports.DEFAULT_AGENT_EXECUTION_CONFIG=sa;exports.DEFAULT_APPROVAL_POLICY=Bo;exports.DEFAULT_DICTATION_LIMITS=vy;exports.DEFAULT_LABEL_FALLBACK=ea;exports.DEFAULT_MEETING_BOT_DISPLAY_NAME=ou;exports.DEFAULT_ROLES=Lu;exports.DEFAULT_ROLE_DESCRIPTIONS=tx;exports.DEFAULT_ROLE_LABELS=ex;exports.DEFAULT_ROLE_PERMISSIONS=nx;exports.DEFAULT_TENANT_SETTINGS=sh;exports.DICTATION_FINALIZATION_TIMEOUT_MS=Ry;exports.DICTATION_FRAME_BYTES=Ay;exports.DICTATION_MAX_BUFFER_BYTES=Ty;exports.DICTATION_MAX_FRAME_BYTES=xy;exports.DICTATION_MAX_TRANSCRIPT_BYTES=wy;exports.DICTATION_MODEL_ID=Cy;exports.DICTATION_PREPARATION_TIMEOUT_MS=Iy;exports.DICTATION_SAMPLE_RATE=hy;exports.DICTATION_TICKET_TTL_MS=Sy;exports.DISCARD_ARCHITECT_DRAFT_TOOL_NAME=Hf;exports.DOCUMENT_SYSTEM_ATTRIBUTES=fA;exports.DRAFTABLE_ATTRIBUTE_TYPES=ao;exports.DRAFT_BATCH_LIMIT=xf;exports.DRAFT_SCHEMA_INPUT_EXAMPLES=Zf;exports.DRAFT_WRITE_TOOL_NAMES=Kf;exports.DRIVE_LIST_VIEW=Sl;exports.DRIVE_OBJECT=Tl;exports.DRIVE_OBJECT_NAME=st;exports.DRIVE_VIEW=wl;exports.EMPTY_VALUE_PLACEHOLDER=en;exports.ESTIMATED_COUNT_CAP=gh;exports.FAKE_MEETING_BOT_SIGNATURE_HEADER=NI;exports.FAMILY_INPUTS=Df;exports.FAMILY_WIRE_INPUTS=Of;exports.FORM_FORBIDDEN_ATTRIBUTE_TYPES=Gn;exports.FlagRegistry=Ct;exports.FlagService=ln;exports.FormBuilder=Br;exports.FormRegistry=Nt;exports.FormRowBuilder=Fr;exports.FormStepBuilder=Vr;exports.GET_ARCHITECT_DRAFT_TOOL_NAME=Qf;exports.GroupBuilder=Kr;exports.IDENTITY_PROPERTIES=Mg;exports.IMAGE_FORMATS=ph;exports.INFERENCE_REASONING_OPTIONS=Uo;exports.INFERENCE_SPEEDS=$o;exports.LIVE_EVENT_TYPES=Vl;exports.MAILBOX_LIST_MODES=vp;exports.MAIL_DRAFT_BODY_MAX_CHARS=SI;exports.MAIL_SUBJECT_MAX_CHARS=II;exports.MAX_PRESET_DEPTH=Wo;exports.MAX_TODOS=cy;exports.MAX_TODO_DESCRIPTION_CHARS=ly;exports.MAX_TODO_ID_CHARS=uy;exports.MEETING_ATTRIBUTES=C;exports.MEETING_DETAIL_VIEW_ID=wa;exports.MEETING_LIST_VIEW=Dl;exports.MEETING_LIST_VIEW_ID=xa;exports.MEETING_OBJECT=El;exports.MEETING_OBJECT_NAME=ut;exports.MEETING_VIEW=Nl;exports.MEETING_WRITE_SOURCE=Ta;exports.MEMORY_LIST_VIEW=xl;exports.MEMORY_OBJECT=hl;exports.MEMORY_VIEW=Al;exports.McpOAuthCompletionMode=Cp;exports.MultiRelationAttributeBuilder=fr;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_KEY=Xc;exports.NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION=eu;exports.NOTIFICATION_INBOX_STATES=Po;exports.NOTIFICATION_KINDS=ko;exports.NOTIFICATION_PRIORITIES=jo;exports.NOTIFICATION_SENSITIVITIES=_o;exports.NOTIFICATION_TYPES_V1=_g;exports.NOTIFICATION_TYPE_AGENT_QUESTION_REQUESTED=Yc;exports.NOTIFICATION_TYPE_AGENT_SESSION_WAITING_HUMAN=Gc;exports.NOTIFICATION_TYPE_AGENT_TASK_ASSIGNED=Kc;exports.NOTIFICATION_WORK_STATES=Mo;exports.NO_RECORDING=DI;exports.NoopGeocodingAdapter=Yo;exports.OPEN_TOOL_PART_STATES=Qc;exports.OPERATION_REGISTRY=Ft;exports.OPERATOR_SPECS=Sn;exports.ObjectBuilder=St;exports.PRESENTATION_PROPERTIES=Vg;exports.PROVIDER_NAMES=Lo;exports.PUBLISH_ARCHITECT_DRAFT_TOOL_NAME=Yf;exports.QUALIFIED_SEPARATOR=TA;exports.QUOTA_KEYS=Ah;exports.RECORDING_OVERRIDES=vI;exports.RECORDING_POLICIES=EI;exports.RECORD_CREATOR_ROOT_ACTOR_METADATA_KEY=oa;exports.RELATION_TARGET_ANY=ae;exports.REMOVE_OPERATION_SCHEMA=po;exports.REPLY_MODES=Ep;exports.REQUEST_DESIGN_REVIEW_TOOL_NAME=Jf;exports.SCHEMA_OPERATIONS=Qe;exports.SCHEMA_OPERATION_INPUT=ac;exports.SCHEMA_PLAN_LIMITS=de;exports.SCHEMA_SOURCE_ID_PATTERN=Fi;exports.SESSION_STATE_STREAM_ID=fy;exports.SESSION_TERMINAL_STATUSES=Hc;exports.SKILL_CONTENT_TEMPLATE=ga;exports.SKILL_LIST_VIEW=bl;exports.SKILL_OBJECT=ml;exports.SKILL_VIEW=fl;exports.STANDARD_SCHEMA_VENDOR=Uu;exports.SYSTEM_PART_CODES=Wn;exports.SYSTEM_RESOURCES=te;exports.SYSTEM_RESOURCE_LABELS=XA;exports.SingleRelationAttributeBuilder=mr;exports.TODAY_DEFAULT=ts;exports.TODO_PLAN_STATUSES=ty;exports.TODO_STATUSES=sy;exports.TOOL_APPROVAL_STATES=qo;exports.USER_STATUSES=uh;exports.USER_WORK_POSTURES=lh;exports.VIEW_OPERATIONS=Ye;exports.VIEW_OPERATION_INPUT=sc;exports.ViewBuilder=cn;exports.accessLevelToActions=th;exports.actionsToAccessLevel=eh;exports.agent=ux;exports.agentDataChunk=hR;exports.agentDisplayName=ny;exports.agentInferencePreferencesSchema=bR;exports.agentMessageAttachmentSchema=Hp;exports.agentMessagePartSchema=Yp;exports.agentSessionInferenceOverridesInputSchema=Kp;exports.agentSessionInferenceOverridesSchema=gR;exports.agentSessionMessageSchema=fs;exports.agentUIValidationError=nm;exports.applyOperations=uo;exports.applyPipes=Xo;exports.applyRelationProps=ku;exports.architectDraftChannelKey=pS;exports.assertAcyclicComputed=Zi;exports.assertAcyclicComputedDependencies=Va;exports.assertBilateralPairs=Cm;exports.assertCustomAgentUIMessageChunk=rm;exports.assertSchemaSourceId=Op;exports.bilateralDeclarationOf=Te;exports.booleanFlag=rl;exports.buildAgentFallbackTitle=rs;exports.buildPermissionFlags=Bu;exports.buildPropertySchema=Xt;exports.buildQualifiedAttribute=SA;exports.canonicalViewOperationSchema=Ji;exports.checkbox=ca;exports.collectSchemaReferences=iR;exports.collectionContentsOf=uc;exports.collectionSourceAddress=qe;exports.collectionSourceAddressOf=Gr;exports.compareAgentSessionMessages=Zc;exports.compareSchemaStateEntries=Fn;exports.compilablePlansOf=Pt;exports.compileComputedFormula=bn;exports.compileRollupAttribute=Ua;exports.computeByteMagnitude=uu;exports.computedCompileSchemaOf=Qi;exports.computedPlanOf=vn;exports.content=E;exports.contentDefinition=Sa;exports.conversationDisplayTitle=Dp;exports.createFlagRegistry=cl;exports.createFlagService=ll;exports.createStandardSchemaProps=rn;exports.currency=wx;exports.customDataChunkSchemas=As;exports.date=se;exports.dateInTimezone=In;exports.dateValueStart=tt;exports.defaultViewIdsFor=He;exports.defaultViewsFor=no;exports.defineOperation=Wi;exports.definePresentation=V;exports.dependentsOf=Xi;exports.deriveArchitectChanges=hf;exports.deriveCreateDefaultsFromFilters=pI;exports.deriveInitials=Fu;exports.describeOperations=df;exports.destructiveSchema=cs;exports.detailView=ge;exports.diffSchemaState=ib;exports.document=ua;exports.draftedLabelExpression=xs;exports.draftedObjectDefinition=Ki;exports.draftedViewDefinition=ft;exports.durableDateSchema=Zp;exports.episodeImpactOf=yf;exports.evaluateComputedAst=VS;exports.evaluateComputedFormula=BS;exports.evaluateComputedFormulaWithResult=LS;exports.evaluateFilterState=Ap;exports.evaluateRecordFilterState=iI;exports.extractAttributeNames=wt;exports.extractValueRefs=ia;exports.familyOf=jf;exports.findRelationAttribute=Ia;exports.flagRegistry=sl;exports.focusOf=lo;exports.form=Px;exports.formFieldFlatKey=iu;exports.formFieldKey=ru;exports.formRegistry=va;exports.formatAgentStreamFrameId=rS;exports.formatAttributeValue=Zo;exports.formatByteSize=dA;exports.formatComputedResult=fp;exports.formatLocationValue=yu;exports.formula=vx;exports.fromDraftableView=sm;exports.getEditableLabelAttribute=Du;exports.getErrorMessage=_y;exports.getLiveProtocolPayloadChannel=xS;exports.getRecordCreatorPrincipalId=Vu;exports.getSingleAttributeFromExpression=ra;exports.getSlotFieldTargets=Ko;exports.getUserDisplayName=Pu;exports.group=he;exports.guidanceForBatch=Bf;exports.hasDestructiveEntries=FI;exports.hasOptions=ih;exports.imageModelIdSchema=ys;exports.includesAction=rt;exports.inferInverseCardinality=Vo;exports.inferRollupReturnType=ep;exports.inferenceReasoningSchema=zi;exports.inferenceSpeedSchema=qi;exports.isAgentUIDataName=tm;exports.isAgentUIMessageBatch=uS;exports.isAttributeSortable=qg;exports.isBilateralRelation=Ug;exports.isCheckboxEquality=KS;exports.isClaimableSessionStatus=ey;exports.isComputedAttribute=gt;exports.isComputedFunctionName=mn;exports.isDateRangeValue=Oe;exports.isDefaultRole=rx;exports.isDocumentAttribute=bA;exports.isEdgePayload=dc;exports.isEmptyObject=su;exports.isFormDefinition=Vy;exports.isFormFieldsRow=Qt;exports.isFormFreeFieldRef=Kn;exports.isFormHeadingRow=Wy;exports.isFormSeparatorRow=Gy;exports.isFormSlotFieldRef=Go;exports.isFormTextRow=Ky;exports.isLabelExpression=nn;exports.isLiveEventEnvelope=TS;exports.isLiveEventPayload=gS;exports.isLiveEventPayloadForType=Kl;exports.isLiveEventType=Gl;exports.isMailProvider=xI;exports.isMailboxListMode=TI;exports.isNotEmpty=Jo;exports.isOpenToolPartState=ry;exports.isPlainRecord=Ka;exports.isReplyMode=wI;exports.isStandardSchema=px;exports.isSystemPartCode=oy;exports.isTerminalSessionStatus=Xg;exports.isTerminalState=Jg;exports.isToolApprovalState=iy;exports.isUniversalRelation=Fo;exports.jsonFlag=al;exports.legacyStatusToSessionState=Zg;exports.listView=ye;exports.liveChannelKey=Na;exports.location=Rx;exports.matchesAccepts=gA;exports.mentionReferenceSchema=Jp;exports.modelDefinitionSchema=Qp;exports.modelReferenceSchema=gs;exports.multiselect=Ix;exports.namedTargetSchema=nc;exports.nativeAgentUIPartIdMetadataKey=nu;exports.normalizeDateValue=du;exports.number=an;exports.numberFlag=ol;exports.object=Yx;exports.orderAgentSessionMessages=ay;exports.parseAgentStreamFrameId=iS;exports.parseCountMode=au;exports.parseLiveChannelKey=Da;exports.parseNamedTarget=Af;exports.parseNativeAgentUIPartIdsMetadata=by;exports.parseOperation=pf;exports.parseOptionalCountMode=bh;exports.parseQualifiedAttribute=wA;exports.parseSchemaState=rb;exports.persistedSchemaPlanSchema=JI;exports.phone=Tx;exports.plannedAttributeSchema=_p;exports.plannedInlineAttributeSchema=Pp;exports.plannedObjectSchema=Mp;exports.presentationOf=$t;exports.proposalTargetKey=Lt;exports.providerNameSchema=bs;exports.qualifiedPropertyDefs=_u;exports.readFormFieldValue=Uy;exports.reconcileRelationAttributes=Ui;exports.regenerateDerived=Mt;exports.registry=zT;exports.relation=it;exports.relationAcceptsObject=Ai;exports.relationProperty=bT;exports.relationPropertyDefs=ju;exports.relationTargetObjectName=yt;exports.relationTargets=X;exports.relationTargetsOf=$g;exports.relationValueIds=co;exports.renderLabelExpression=Qn;exports.requestedCapabilities=bI;exports.requireRecordContentContext=It;exports.requireSingleRelationTarget=Ra;exports.requiredTargetKeys=bf;exports.resolveAttributeDefaultValue=Ip;exports.resolveCollectionActions=Gu;exports.resolveContentNavigation=Wu;exports.resolveFieldRequired=$y;exports.resolvePropertyDefinitions=Zt;exports.resolveViewContents=hi;exports.richtext=ke;exports.rollup=Ex;exports.rollupToFormulaExpression=Xd;exports.schemaPlanSchema=HI;exports.schemaStateSourcePayload=tb;exports.select=fe;exports.sessionInferencePatchSchema=yR;exports.sessionStateToLegacyStatus=Qg;exports.status=Sx;exports.stillMissing=Ff;exports.storedContentDefinition=vt;exports.stringFlag=il;exports.summarizeDraft=Gf;exports.targetSnapshot=jn;exports.targetTokensFor=gf;exports.text=S;exports.toAttribute=Z;exports.toDraftableAttributes=om;exports.toDraftableObject=im;exports.toDraftableView=am;exports.toUndefinedIfEmpty=cu;exports.todoItemSchema=Xp;exports.todoPlanSchema=em;exports.toolImpactSchema=hs;exports.touchedObjectIds=Lf;exports.user=Cx;exports.validateContentViewCatalogue=xi;exports.validateLabelExpression=Iu;exports.validateObjectExpressions=zu;exports.viewIdFor=eo;exports.viewIdentityKey=bi;exports.viewRegistry=Ol;exports.workspaceViewAuthoring=Et;
|