@rizom/brain 0.2.0-alpha.868 → 0.2.0-alpha.869
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/brain.js +6 -6
- package/dist/chunks/app-6ya0ev45.js +5 -0
- package/dist/chunks/{index-2129s41z.js → index-02pt9z7t.js} +2 -2
- package/dist/chunks/{index-n569mach.js → index-dmggce5b.js} +2 -2
- package/dist/chunks/{index-151stz0p.js → index-gnbfdewj.js} +3 -3
- package/dist/chunks/{index-151stz0p.js.map → index-gnbfdewj.js.map} +6 -6
- package/dist/chunks/{index-bgybe5r3.js → index-nnwk2h8n.js} +2 -2
- package/dist/chunks/{index-f6mq05th.js → index-sv87ptaj.js} +3 -3
- package/dist/chunks/{index-f6mq05th.js.map → index-sv87ptaj.js.map} +1 -1
- package/dist/chunks/{index-21c4j6d8.js → index-wete5qfn.js} +2 -2
- package/dist/chunks/{package-hdjj3mg3.js → package-gcdazntk.js} +3 -3
- package/dist/chunks/{package-hdjj3mg3.js.map → package-gcdazntk.js.map} +1 -1
- package/dist/entities.d.ts +11 -0
- package/dist/entities.js +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces.js +1 -1
- package/dist/model.js +5 -5
- package/dist/model.js.map +6 -6
- package/dist/services.d.ts +17 -0
- package/dist/services.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-wgdxs5zd.js → studio-app-dx99m4vs.js} +3 -3
- package/dist/ui/studio-asset-manifest.json +21 -21
- package/dist/ui/studio-chunks/{account-view-063wwkww.js → account-view-pf71e4d1.js} +1 -1
- package/dist/ui/studio-chunks/{main-a91pxdfw.js → main-8zx47tjg.js} +1 -1
- package/dist/ui/studio-chunks/{main-yfr70kka.js → main-e098kfma.js} +1 -1
- package/dist/ui/studio-chunks/{main-wv4cygtj.js → main-ecwfbj4t.js} +1 -1
- package/dist/ui/studio-chunks/{main-6d8fnk33.js → main-eh2baz0t.js} +1 -1
- package/dist/ui/studio-chunks/{main-2dnw093e.js → main-g15rdsa4.js} +2 -2
- package/dist/ui/studio-chunks/{main-2dnw093e.js.map → main-g15rdsa4.js.map} +6 -6
- package/dist/ui/studio-chunks/{main-g05whm36.js → main-j4wezmkn.js} +3 -3
- package/dist/ui/studio-chunks/{main-g05whm36.js.map → main-j4wezmkn.js.map} +3 -3
- package/dist/ui/studio-chunks/{studio-ask-panel-h8vy1aj5.js → studio-ask-panel-cgmkp80w.js} +1 -1
- package/dist/ui/studio-chunks/{studio-chat-workspace-5kxn0f0c.js → studio-chat-workspace-c3xe9bre.js} +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-esb1afkk.js +0 -5
- /package/dist/chunks/{app-esb1afkk.js.map → app-6ya0ev45.js.map} +0 -0
- /package/dist/chunks/{index-2129s41z.js.map → index-02pt9z7t.js.map} +0 -0
- /package/dist/chunks/{index-n569mach.js.map → index-dmggce5b.js.map} +0 -0
- /package/dist/chunks/{index-bgybe5r3.js.map → index-nnwk2h8n.js.map} +0 -0
- /package/dist/chunks/{index-21c4j6d8.js.map → index-wete5qfn.js.map} +0 -0
- /package/dist/ui/{studio-app-wgdxs5zd.js.map → studio-app-dx99m4vs.js.map} +0 -0
- /package/dist/ui/studio-chunks/{account-view-063wwkww.js.map → account-view-pf71e4d1.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-a91pxdfw.js.map → main-8zx47tjg.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-yfr70kka.js.map → main-e098kfma.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-wv4cygtj.js.map → main-ecwfbj4t.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-6d8fnk33.js.map → main-eh2baz0t.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-ask-panel-h8vy1aj5.js.map → studio-ask-panel-cgmkp80w.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-chat-workspace-5kxn0f0c.js.map → studio-chat-workspace-c3xe9bre.js.map} +0 -0
|
@@ -129,7 +129,7 @@ Instructions:
|
|
|
129
129
|
*/var uH=oz((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,s=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=c;function c(h){if(!h)throw TypeError("argument string is required");var R=typeof h==="object"?d(h):h;if(typeof R!=="string")throw TypeError("argument string is required to be a string");var b=R.indexOf(";"),S=b!==-1?R.slice(0,b).trim():R.trim();if(!s.test(S))throw TypeError("invalid media type");var m=new a(S.toLowerCase());if(b!==-1){var w,x,E;t.lastIndex=b;while(x=t.exec(R)){if(x.index!==b)throw TypeError("invalid parameter format");if(b+=x[0].length,w=x[1].toLowerCase(),E=x[2],E.charCodeAt(0)===34){if(E=E.slice(1,-1),E.indexOf("\\")!==-1)E=E.replace(n,"$1")}m.parameters[w]=E}if(b!==R.length)throw TypeError("invalid parameter format")}return m}function d(h){var R;if(typeof h.getHeader==="function")R=h.getHeader("content-type");else if(typeof h.headers==="object")R=h.headers&&h.headers["content-type"];if(typeof R!=="string")throw TypeError("content-type header is missing from object");return R}function a(h){this.parameters=Object.create(null),this.type=h}}),iNe=az(uH(),1);function $l(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let s=e.length;if(s!==t.length)return!1;for(let c=0;c<s;c++)if(!$l(e[c],t[c]))return!1;return!0}if(n==="object"){if(!e||!t)return e===t;let s=Object.keys(e),c=Object.keys(t);if(s.length!==c.length)return!1;for(let d of s)if(!$l(e[d],t[d]))return!1;return!0}return e===t}function Wr(e){return encodeURI(dH(e))}function dH(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var pH={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},fH={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},mH={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},hH=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function ss(e,t=Object.create(null),n=hH,s=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let d=e.$id||e.id;if(d){let a=new URL(d,n.href);if(a.hash.length>1)t[a.href]=e;else if(a.hash="",s==="")n=a;else ss(e,t,n)}}else if(e!==!0&&e!==!1)return t;let c=n.href+(s?"#"+s:"");if(t[c]!==void 0)throw Error(`Duplicate schema URI "${c}".`);if(t[c]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:c});if(e.$ref&&e.__absolute_ref__===void 0){let d=new URL(e.$ref,n.href);d.hash=d.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:d.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let d=new URL(e.$recursiveRef,n.href);d.hash=d.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:d.href})}if(e.$anchor){let d=new URL("#"+e.$anchor,n.href);t[d.href]=e}for(let d in e){if(mH[d])continue;let a=`${s}/${Wr(d)}`,h=e[d];if(Array.isArray(h)){if(pH[d]){let R=h.length;for(let b=0;b<R;b++)ss(h[b],t,n,`${a}/${b}`)}}else if(fH[d])for(let R in h)ss(h[R],t,n,`${a}/${Wr(R)}`);else ss(h,t,n,a)}return t}var gH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,yH=[0,31,28,31,30,31,30,31,31,30,31,30,31],bH=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,SH=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,vH=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,wH=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,RH=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,TH=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,xH=/^(?:\/(?:[^~/]|~0|~1)*)*$/,EH=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,CH=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,AH=(e)=>{if(e[0]==='"')return!1;let[t,n,...s]=e.split("@");if(!t||!n||s.length!==0||t.length>64||n.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return n.split(".").every((c)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(c))},PH=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,IH=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,kH=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function di(e){return e.test.bind(e)}var b_={date:S_,time:v_.bind(void 0,!1),"date-time":_H,duration:kH,uri:jH,"uri-reference":di(vH),"uri-template":di(wH),url:di(RH),email:AH,hostname:di(SH),ipv4:di(PH),ipv6:di(IH),regex:BH,uuid:di(TH),"json-pointer":di(xH),"json-pointer-uri-fragment":di(EH),"relative-json-pointer":di(CH)};function MH(e){return e%4===0&&(e%100!==0||e%400===0)}function S_(e){let t=e.match(gH);if(!t)return!1;let n=+t[1],s=+t[2],c=+t[3];return s>=1&&s<=12&&c>=1&&c<=(s==2&&MH(n)?29:yH[s])}function v_(e,t){let n=t.match(bH);if(!n)return!1;let s=+n[1],c=+n[2],d=+n[3],a=!!n[5];return(s<=23&&c<=59&&d<=59||s==23&&c==59&&d==60)&&(!e||a)}var zH=/t|\s/i;function _H(e){let t=e.split(zH);return t.length==2&&S_(t[0])&&v_(!0,t[1])}var OH=/\/|:/,DH=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function jH(e){return OH.test(e)&&DH.test(e)}var NH=/[^\\]\\Z/;function BH(e){if(NH.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function qH(e){let t=0,n=e.length,s=0,c;while(s<n)if(t++,c=e.charCodeAt(s++),c>=55296&&c<=56319&&s<n){if(c=e.charCodeAt(s),(c&64512)==56320)s++}return t}function on(e,t,n="2019-09",s=ss(t),c=!0,d=null,a="#",h="#",R=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let b=typeof e,S;switch(b){case"boolean":case"number":case"string":S=b;break;case"object":if(e===null)S="null";else if(Array.isArray(e))S="array";else S="object";break;default:throw Error(`Instances of "${b}" type are not supported.`)}let{$ref:m,$recursiveRef:w,$recursiveAnchor:x,type:E,const:A,enum:P,required:M,not:z,anyOf:_,allOf:j,oneOf:B,if:F,then:ne,else:ge,format:pe,properties:W,patternProperties:re,additionalProperties:i,unevaluatedProperties:u,minProperties:f,maxProperties:l,propertyNames:p,dependentRequired:v,dependentSchemas:T,dependencies:g,prefixItems:o,items:y,additionalItems:I,unevaluatedItems:C,contains:O,minContains:q,maxContains:Z,minItems:Q,maxItems:ke,uniqueItems:de,minimum:V,maximum:be,exclusiveMinimum:se,exclusiveMaximum:me,multipleOf:Ge,minLength:U,maxLength:J,pattern:Te,__absolute_ref__:ue,__absolute_recursive_ref__:he}=t,Se=[];if(x===!0&&d===null)d=t;if(w==="#"){let K=d===null?s[he]:d,Ce=`${h}/$recursiveRef`,Y=on(e,d===null?t:d,n,s,c,K,a,Ce,R);if(!Y.valid)Se.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Ce,error:"A subschema had errors."},...Y.errors)}if(m!==void 0){let K=s[ue||m];if(K===void 0){let ie=`Unresolved $ref "${m}".`;if(ue&&ue!==m)ie+=` Absolute URI "${ue}".`;throw ie+=`
|
|
130
130
|
Known schemas:
|
|
131
131
|
- ${Object.keys(s).join(`
|
|
132
|
-
- `)}`,Error(ie)}let Ce=`${h}/$ref`,Y=on(e,K,n,s,c,d,a,Ce,R);if(!Y.valid)Se.push({instanceLocation:a,keyword:"$ref",keywordLocation:Ce,error:"A subschema had errors."},...Y.errors);if(n==="4"||n==="7")return{valid:Se.length===0,errors:Se}}if(Array.isArray(E)){let K=E.length,Ce=!1;for(let Y=0;Y<K;Y++)if(S===E[Y]||E[Y]==="integer"&&S==="number"&&e%1===0&&e===e){Ce=!0;break}if(!Ce)Se.push({instanceLocation:a,keyword:"type",keywordLocation:`${h}/type`,error:`Instance type "${S}" is invalid. Expected "${E.join('", "')}".`})}else if(E==="integer"){if(S!=="number"||e%1||e!==e)Se.push({instanceLocation:a,keyword:"type",keywordLocation:`${h}/type`,error:`Instance type "${S}" is invalid. Expected "${E}".`})}else if(E!==void 0&&S!==E)Se.push({instanceLocation:a,keyword:"type",keywordLocation:`${h}/type`,error:`Instance type "${S}" is invalid. Expected "${E}".`});if(A!==void 0){if(S==="object"||S==="array"){if(!$l(e,A))Se.push({instanceLocation:a,keyword:"const",keywordLocation:`${h}/const`,error:`Instance does not match ${JSON.stringify(A)}.`})}else if(e!==A)Se.push({instanceLocation:a,keyword:"const",keywordLocation:`${h}/const`,error:`Instance does not match ${JSON.stringify(A)}.`})}if(P!==void 0){if(S==="object"||S==="array"){if(!P.some((K)=>$l(e,K)))Se.push({instanceLocation:a,keyword:"enum",keywordLocation:`${h}/enum`,error:`Instance does not match any of ${JSON.stringify(P)}.`})}else if(!P.some((K)=>e===K))Se.push({instanceLocation:a,keyword:"enum",keywordLocation:`${h}/enum`,error:`Instance does not match any of ${JSON.stringify(P)}.`})}if(z!==void 0){let K=`${h}/not`;if(on(e,z,n,s,c,d,a,K).valid)Se.push({instanceLocation:a,keyword:"not",keywordLocation:K,error:'Instance matched "not" schema.'})}let H=[];if(_!==void 0){let K=`${h}/anyOf`,Ce=Se.length,Y=!1;for(let ie=0;ie<_.length;ie++){let De=_[ie],xe=Object.create(R),Re=on(e,De,n,s,c,x===!0?d:null,a,`${K}/${ie}`,xe);if(Se.push(...Re.errors),Y=Y||Re.valid,Re.valid)H.push(xe)}if(Y)Se.length=Ce;else Se.splice(Ce,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:K,error:"Instance does not match any subschemas."})}if(j!==void 0){let K=`${h}/allOf`,Ce=Se.length,Y=!0;for(let ie=0;ie<j.length;ie++){let De=j[ie],xe=Object.create(R),Re=on(e,De,n,s,c,x===!0?d:null,a,`${K}/${ie}`,xe);if(Se.push(...Re.errors),Y=Y&&Re.valid,Re.valid)H.push(xe)}if(Y)Se.length=Ce;else Se.splice(Ce,0,{instanceLocation:a,keyword:"allOf",keywordLocation:K,error:"Instance does not match every subschema."})}if(B!==void 0){let K=`${h}/oneOf`,Ce=Se.length,Y=B.filter((ie,De)=>{let xe=Object.create(R),Re=on(e,ie,n,s,c,x===!0?d:null,a,`${K}/${De}`,xe);if(Se.push(...Re.errors),Re.valid)H.push(xe);return Re.valid}).length;if(Y===1)Se.length=Ce;else Se.splice(Ce,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:K,error:`Instance does not match exactly one subschema (${Y} matches).`})}if(S==="object"||S==="array")Object.assign(R,...H);if(F!==void 0){let K=`${h}/if`;if(on(e,F,n,s,c,d,a,K,R).valid){if(ne!==void 0){let Ce=on(e,ne,n,s,c,d,a,`${h}/then`,R);if(!Ce.valid)Se.push({instanceLocation:a,keyword:"if",keywordLocation:K,error:'Instance does not match "then" schema.'},...Ce.errors)}}else if(ge!==void 0){let Ce=on(e,ge,n,s,c,d,a,`${h}/else`,R);if(!Ce.valid)Se.push({instanceLocation:a,keyword:"if",keywordLocation:K,error:'Instance does not match "else" schema.'},...Ce.errors)}}if(S==="object"){if(M!==void 0){for(let ie of M)if(!(ie in e))Se.push({instanceLocation:a,keyword:"required",keywordLocation:`${h}/required`,error:`Instance does not have required property "${ie}".`})}let K=Object.keys(e);if(f!==void 0&&K.length<f)Se.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${h}/minProperties`,error:`Instance does not have at least ${f} properties.`});if(l!==void 0&&K.length>l)Se.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${h}/maxProperties`,error:`Instance does not have at least ${l} properties.`});if(p!==void 0){let ie=`${h}/propertyNames`;for(let De in e){let xe=`${a}/${Wr(De)}`,Re=on(De,p,n,s,c,d,xe,ie);if(!Re.valid)Se.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:ie,error:`Property name "${De}" does not match schema.`},...Re.errors)}}if(v!==void 0){let ie=`${h}/dependantRequired`;for(let De in v)if(De in e){let xe=v[De];for(let Re of xe)if(!(Re in e))Se.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:ie,error:`Instance has "${De}" but does not have "${Re}".`})}}if(T!==void 0)for(let ie in T){let De=`${h}/dependentSchemas`;if(ie in e){let xe=on(e,T[ie],n,s,c,d,a,`${De}/${Wr(ie)}`,R);if(!xe.valid)Se.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:De,error:`Instance has "${ie}" but does not match dependant schema.`},...xe.errors)}}if(g!==void 0){let ie=`${h}/dependencies`;for(let De in g)if(De in e){let xe=g[De];if(Array.isArray(xe)){for(let Re of xe)if(!(Re in e))Se.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ie,error:`Instance has "${De}" but does not have "${Re}".`})}else{let Re=on(e,xe,n,s,c,d,a,`${ie}/${Wr(De)}`);if(!Re.valid)Se.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ie,error:`Instance has "${De}" but does not match dependant schema.`},...Re.errors)}}}let Ce=Object.create(null),Y=!1;if(W!==void 0){let ie=`${h}/properties`;for(let De in W){if(!(De in e))continue;let xe=`${a}/${Wr(De)}`,Re=on(e[De],W[De],n,s,c,d,xe,`${ie}/${Wr(De)}`);if(Re.valid)R[De]=Ce[De]=!0;else if(Y=c,Se.push({instanceLocation:a,keyword:"properties",keywordLocation:ie,error:`Property "${De}" does not match schema.`},...Re.errors),Y)break}}if(!Y&&re!==void 0){let ie=`${h}/patternProperties`;for(let De in re){let xe=new RegExp(De,"u"),Re=re[De];for(let k in e){if(!xe.test(k))continue;let G=`${a}/${Wr(k)}`,oe=on(e[k],Re,n,s,c,d,G,`${ie}/${Wr(De)}`);if(oe.valid)R[k]=Ce[k]=!0;else Y=c,Se.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:ie,error:`Property "${k}" matches pattern "${De}" but does not match associated schema.`},...oe.errors)}}}if(!Y&&i!==void 0){let ie=`${h}/additionalProperties`;for(let De in e){if(Ce[De])continue;let xe=`${a}/${Wr(De)}`,Re=on(e[De],i,n,s,c,d,xe,ie);if(Re.valid)R[De]=!0;else Y=c,Se.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:ie,error:`Property "${De}" does not match additional properties schema.`},...Re.errors)}}else if(!Y&&u!==void 0){let ie=`${h}/unevaluatedProperties`;for(let De in e)if(!R[De]){let xe=`${a}/${Wr(De)}`,Re=on(e[De],u,n,s,c,d,xe,ie);if(Re.valid)R[De]=!0;else Se.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:ie,error:`Property "${De}" does not match unevaluated properties schema.`},...Re.errors)}}}else if(S==="array"){if(ke!==void 0&&e.length>ke)Se.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${h}/maxItems`,error:`Array has too many items (${e.length} > ${ke}).`});if(Q!==void 0&&e.length<Q)Se.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${h}/minItems`,error:`Array has too few items (${e.length} < ${Q}).`});let K=e.length,Ce=0,Y=!1;if(o!==void 0){let ie=`${h}/prefixItems`,De=Math.min(o.length,K);for(;Ce<De;Ce++){let xe=on(e[Ce],o[Ce],n,s,c,d,`${a}/${Ce}`,`${ie}/${Ce}`);if(R[Ce]=!0,!xe.valid){if(Y=c,Se.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:ie,error:"Items did not match schema."},...xe.errors),Y)break}}}if(y!==void 0){let ie=`${h}/items`;if(Array.isArray(y)){let De=Math.min(y.length,K);for(;Ce<De;Ce++){let xe=on(e[Ce],y[Ce],n,s,c,d,`${a}/${Ce}`,`${ie}/${Ce}`);if(R[Ce]=!0,!xe.valid){if(Y=c,Se.push({instanceLocation:a,keyword:"items",keywordLocation:ie,error:"Items did not match schema."},...xe.errors),Y)break}}}else for(;Ce<K;Ce++){let De=on(e[Ce],y,n,s,c,d,`${a}/${Ce}`,ie);if(R[Ce]=!0,!De.valid){if(Y=c,Se.push({instanceLocation:a,keyword:"items",keywordLocation:ie,error:"Items did not match schema."},...De.errors),Y)break}}if(!Y&&I!==void 0){let De=`${h}/additionalItems`;for(;Ce<K;Ce++){let xe=on(e[Ce],I,n,s,c,d,`${a}/${Ce}`,De);if(R[Ce]=!0,!xe.valid)Y=c,Se.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:De,error:"Items did not match additional items schema."},...xe.errors)}}}if(O!==void 0)if(K===0&&q===void 0)Se.push({instanceLocation:a,keyword:"contains",keywordLocation:`${h}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(q!==void 0&&K<q)Se.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${h}/minContains`,error:`Array has less items (${K}) than minContains (${q}).`});else{let ie=`${h}/contains`,De=Se.length,xe=0;for(let Re=0;Re<K;Re++){let k=on(e[Re],O,n,s,c,d,`${a}/${Re}`,ie);if(k.valid)R[Re]=!0,xe++;else Se.push(...k.errors)}if(xe>=(q||0))Se.length=De;if(q===void 0&&Z===void 0&&xe===0)Se.splice(De,0,{instanceLocation:a,keyword:"contains",keywordLocation:ie,error:"Array does not contain item matching schema."});else if(q!==void 0&&xe<q)Se.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${h}/minContains`,error:`Array must contain at least ${q} items matching schema. Only ${xe} items were found.`});else if(Z!==void 0&&xe>Z)Se.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${h}/maxContains`,error:`Array may contain at most ${Z} items matching schema. ${xe} items were found.`})}if(!Y&&C!==void 0){let ie=`${h}/unevaluatedItems`;for(;Ce<K;Ce++){if(R[Ce])continue;let De=on(e[Ce],C,n,s,c,d,`${a}/${Ce}`,ie);if(R[Ce]=!0,!De.valid)Se.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:ie,error:"Items did not match unevaluated items schema."},...De.errors)}}if(de)for(let ie=0;ie<K;ie++){let De=e[ie],xe=typeof De==="object"&&De!==null;for(let Re=0;Re<K;Re++){if(ie===Re)continue;let k=e[Re];if(De===k||xe&&typeof k==="object"&&k!==null&&$l(De,k))Se.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${h}/uniqueItems`,error:`Duplicate items at indexes ${ie} and ${Re}.`}),ie=Number.MAX_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER}}}else if(S==="number"){if(n==="4"){if(V!==void 0&&(se===!0&&e<=V||e<V))Se.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${h}/minimum`,error:`${e} is less than ${se?"or equal to ":""} ${V}.`});if(be!==void 0&&(me===!0&&e>=be||e>be))Se.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${h}/maximum`,error:`${e} is greater than ${me?"or equal to ":""} ${be}.`})}else{if(V!==void 0&&e<V)Se.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${h}/minimum`,error:`${e} is less than ${V}.`});if(be!==void 0&&e>be)Se.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${h}/maximum`,error:`${e} is greater than ${be}.`});if(se!==void 0&&e<=se)Se.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${h}/exclusiveMinimum`,error:`${e} is less than ${se}.`});if(me!==void 0&&e>=me)Se.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${h}/exclusiveMaximum`,error:`${e} is greater than or equal to ${me}.`})}if(Ge!==void 0){let K=e%Ge;if(Math.abs(0-K)>=0.00000011920929&&Math.abs(Ge-K)>=0.00000011920929)Se.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${h}/multipleOf`,error:`${e} is not a multiple of ${Ge}.`})}}else if(S==="string"){let K=U===void 0&&J===void 0?0:qH(e);if(U!==void 0&&K<U)Se.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${h}/minLength`,error:`String is too short (${K} < ${U}).`});if(J!==void 0&&K>J)Se.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${h}/maxLength`,error:`String is too long (${K} > ${J}).`});if(Te!==void 0&&!new RegExp(Te,"u").test(e))Se.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${h}/pattern`,error:"String does not match pattern."});if(pe!==void 0&&b_[pe]&&!b_[pe](e))Se.push({instanceLocation:a,keyword:"format",keywordLocation:`${h}/format`,error:`String does not match format "${pe}".`})}return{valid:Se.length===0,errors:Se}}var LH=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=ss(e)}validate(e){return on(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};ss(e,this.lookup)}},Dm=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=uz(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new LH(e,this.draft??this._draftFor(e),this.shortcircuit);return(n)=>{let s=t.validate(n);return s.valid?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:s.errors.map((c)=>`${c.instanceLocation}: ${c.error}`).join("; ")}}}};var HH=8,GH=600000;function JH(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??HH,roundTimeoutMs:e?.roundTimeoutMs??GH,legacyShim:e?.legacyShim??!0}}function w_(e,t,n){if(n===null||typeof n!=="object"||typeof n.method!=="string")throw new xt(st.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let s=n,c=qz(s);if(c===void 0)throw new xt(st.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${s.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:s,required:c}}function VH(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map((s)=>s.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function s0(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new xt(st.InternalError,t)}var KH=class{constructor(e){this._host=e}async fulfill(e,t,n,s,c){let{maxRounds:d,roundTimeoutMs:a}=this._host,h=s.mcpReq.signal,R=c,b=0;while(!0){if(b+=1,b>d)return s0(e,d_(e,d));let S=R.inputRequests,m=S!=null&&Object.keys(S).length>0,w=typeof R.requestState==="string"?R.requestState:void 0;if(!m&&w===void 0)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let x;if(m){let P=this._host.resolvedClientCapabilities(s),M=[];for(let[_,j]of Object.entries(S)){let{embedded:B,required:F}=w_(e,_,j);if(B.method!=="roots/list"&&B.params===void 0)throw new xt(st.InternalError,`Handler for ${e} returned an input request '${_}' of kind '${B.method}' without params`);if(zm(F,P)!==void 0)return s0(e,`Cannot request input '${_}' (${B.method}): the client on this 2025-era connection did not declare the required capability${P===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);M.push([_,B])}let z=f_(h);try{let _={relatedRequestId:s.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},j=await Promise.all(M.map(async([B,F])=>{try{return[B,await this._dispatchLeg(F,_)]}catch(ne){throw z.abort(ne),ne}}));x=Object.fromEntries(j)}catch(_){if(h.aborted)throw _;return s0(e,`Fulfilling input required by '${e}' failed: ${_ instanceof Error?_.message:String(_)}`)}finally{z.dispose()}}else await p_(u_,h);let E={...s,mcpReq:{...s.mcpReq,inputResponses:x,droppedInputResponseKeys:void 0,requestState:Ll(w)}};if(w!==void 0){let P=await this._host.verifyRequestState(w,E,e);if(P!==void 0)E=r0(E,P)}let A=await t(n,E);if(!os(A))return A;R=A}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let n=e.params;if(n.mode==="url"&&n.elicitationId===void 0)n={...n,elicitationId:VH()};return await this._host.sendElicitation(n,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},QH=new Set(["tools/call","prompts/get","resources/read"]),YH,XH,eG;var tG=class extends i0{_clientCapabilities;_clientVersion;static{YH=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},XH=(e,t)=>{let n=t.filter((s)=>!e._supportedProtocolVersions.includes(s));if(n.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...n];e.setRequestHandler("server/discover",()=>e._ondiscover())},eG=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new KH({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,n)=>this._verifyRequestState(e,t,n),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Dm,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=JH(t?.inputRequired),t?.cacheHints!==void 0){for(let[n,s]of Object.entries(t.cacheHints))if(s!==void 0)Kz(s,`cacheHints['${n}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(n)=>this._oninitialize(n)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Hv(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}async connect(e){if(this.transport!==void 0)throw new bt(wt.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(e)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let n=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:s}=e.params,c=Om(lo,s);if(c.success)this._loggingLevels.set(n,c.data);return{}})}buildContext(e,t){let n=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(s,c,d)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[ro],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(a!==void 0&&this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(a))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:s,data:c,logger:d}})},elicitInput:(s,c)=>this.elicitInput(s,c),requestSampling:(s,c)=>this.createMessage(s,c)},http:n?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(lo.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1};registerCapabilities(e){if(this.transport)throw new bt(wt.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=o0(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let n=this._cacheHints?.[e],s=QH.has(e);if(n===void 0&&!s)return async(c,d)=>{let a=await t(c,d);if(os(a))throw new xt(st.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a};return async(c,d)=>{let a=s?await this._invokeInputRequiredCapableHandler(e,t,c,d):await t(c,d);if(os(a)){if(!s)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return n===void 0?a:Vz(a,n)}}return async(n,s)=>{let c=Ra(this._negotiatedProtocolVersion),d=c.validateRequest("tools/call",n);if(!d.ok)throw new xt(d.reason==="not-in-era"?st.InternalError:st.InvalidParams,d.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${d.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,n,s);if(os(a))return a;let h=Gv(a),R=c.validateResult("tools/call",h);if(!R.ok)throw new xt(R.reason==="not-in-era"?st.InternalError:st.InvalidParams,R.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${R.message}`);return R.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&ql(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,n,s){let c=this._servedModernEra(),d=s.mcpReq.requestState();if(d!==void 0&&typeof d!=="string")throw new xt(st.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=s;if(typeof d==="string"){let m=await this._verifyRequestState(d,s,e);if(m!==void 0)a=r0(s,m)}let h;try{h=await t(n,a)}catch(m){if(m instanceof xt&&m.code===st.UrlElicitationRequired){if(!c)throw m;throw new xt(st.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw m}if(!os(h))return h;if(!c){if(!this._inputRequiredServing.legacyShim)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??ts}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,n,a,h)}let R=h.inputRequests,b=R!=null&&Object.keys(R).length>0,S=typeof h.requestState==="string";if(!b&&!S)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(b){let m=this._inputRequestCapabilityView(s);for(let[w,x]of Object.entries(R)){let{embedded:E,required:A}=w_(e,w,x),P=zm(A,m);if(P!==void 0)throw new _m({requiredCapabilities:P},`Cannot request input '${w}' (${E.method}): the request's client capabilities do not declare the required capability`)}}return h}async _verifyRequestState(e,t,n){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(s){throw this.onerror?.(Error(`requestState verification rejected ${n}: ${s instanceof Error?s.message:String(s)}`)),new xt(st.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Ii]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new bt(wt.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new bt(wt.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new bt(wt.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new bt(wt.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new bt(wt.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new bt(wt.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new bt(wt.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new bt(wt.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new bt(wt.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new bt(wt.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new bt(wt.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new bt(wt.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new bt(wt.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new bt(wt.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let n=Lz(this._supportedProtocolVersions),s=n.includes(t)?t:n[0]??ts;return this._negotiatedProtocolVersion=s,this.transport?.setProtocolVersion?.(s),{protocolVersion:s,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Hv(this._supportedProtocolVersions),capabilities:nG(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new bt(wt.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let d=e.messages.at(-1),a=Array.isArray(d.content)?d.content:[d.content],h=a.some((m)=>m.type==="tool_result"),R=e.messages.length>1?e.messages.at(-2):void 0,b=R?Array.isArray(R.content)?R.content:[R.content]:[],S=b.some((m)=>m.type==="tool_use");if(h){if(a.some((m)=>m.type!=="tool_result"))throw new xt(st.InvalidParams,"The last message must contain only tool_result content if any is present");if(!S)throw new xt(st.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(S){let m=new Set(b.filter((x)=>x.type==="tool_use").map((x)=>x.id)),w=new Set(a.filter((x)=>x.type==="tool_result").map((x)=>x.toolUseId));if(m.size!==w.size||![...m].every((x)=>w.has(x)))throw new xt(st.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let n=Boolean(e.tools||e.toolChoice),s=await this.request({method:"sampling/createMessage",params:e},t),c=this._wireCodec().samplingResultVariant(n,s);if(!c.ok)throw new bt(wt.InvalidResult,`Invalid sampling/createMessage result: ${c.reason==="invalid"?c.message:c.reason}`);return c.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new bt(wt.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new bt(wt.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,n){let s=e.mode??"form",c=n?.validateAcceptedContent??!0;switch(s){case"url":{let d=e;return this.request({method:"elicitation/create",params:d},t)}case"form":{let d=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:d},t);if(c&&a.action==="accept"&&a.content&&d.requestedSchema)try{let h=this._jsonSchemaValidator.getValidator(d.requestedSchema)(a.content);if(!h.valid)throw new xt(st.InvalidParams,`Elicitation response content does not match requested schema: ${h.errorMessage}`)}catch(h){if(h instanceof xt)throw h;throw new xt(st.InternalError,`Error validating elicitation response: ${h instanceof Error?h.message:String(h)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new bt(wt.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function nG(e){return{...e}}var a0=r.object({interfaceType:r.string(),interfaceId:r.string().optional(),actor:Xt,displayName:r.string().optional(),conversationId:r.string().optional(),channelId:r.string().optional(),channelName:r.string().optional(),runId:r.string().optional(),toolCallId:r.string().optional(),userPermissionLevel:r.enum(["admin","trusted","public"]).optional(),isAnchor:r.boolean().optional()}),R_=r.object({...a0.shape,toolName:r.string(),args:r.unknown(),progressToken:r.union([r.string(),r.number()]).optional(),sendProgress:r.custom((e)=>typeof e==="function").optional(),signal:r.custom((e)=>e instanceof AbortSignal).optional()}),jm=r.strictObject({success:r.literal(!0),data:r.unknown().optional(),message:r.string().optional(),completionDetail:r.string().optional(),cached:r.literal(!0).optional()}),c0=r.strictObject({success:r.literal(!1),error:r.string(),code:r.string().optional()}),Nm=r.strictObject({needsConfirmation:r.literal(!0),toolName:r.string(),summary:r.string(),completionSummary:r.string().optional(),preview:r.string().optional(),text:r.string().optional(),args:r.unknown()}),Fl=r.union([jm,c0,Nm]);var O6e=r.union([r.looseObject({success:r.literal(!0)}),r.object({success:r.literal(!1),error:r.string()})]);var T_=r.union([r.object({success:r.literal(!0),data:r.unknown(),message:r.string().optional()}),r.object({success:r.literal(!1),error:r.string(),code:r.string().optional()})]);var uG=r.strictObject({field:r.string().min(1).max(100),direction:r.enum(["asc","desc"]),nullsFirst:r.boolean().optional(),nullsLast:r.boolean().optional()}),u0=r.array(r.string().min(1)).optional(),LBe=r.strictObject({weight:r.number().optional(),embeddable:r.boolean().optional(),fullTextSearchable:r.boolean().optional(),includeInBroadSearch:r.boolean().optional(),binaryStorage:r.enum(["data-url","asset"]).optional(),storage:r.enum(["markdown","yaml"]).optional(),defaultSort:r.array(uG).max(10).optional(),markdownImport:r.boolean().optional(),contentRepo:r.boolean().optional(),retiredFields:u0,translatedFields:u0,actionPolicy:Kc.optional(),projectionSource:r.boolean().optional(),projectionSourceRole:r.enum(["canonical","primary","secondary","supporting","ambient","excluded"]).optional(),containedIn:r.string().min(1).optional(),memberGroup:r.strictObject({label:r.string().min(1),multiple:r.boolean()}).optional(),consumesSources:u0,requiresGroupingMembership:r.boolean().optional(),publish:r.strictObject({publishStatuses:r.array(r.string().min(1)),requiredFields:r.array(r.string().min(1)).optional()}).optional()});var dG=r.strictObject({from:r.strictObject({entityType:r.string().min(1),status:r.string().min(1).optional(),limit:r.number().int().min(1).max(100)}),mode:r.enum(["each","batch"])});var pG=r.object({grouping:r.string().describe("The key of the grouping chosen"),value:r.string().describe("The one value chosen in that grouping")});var tqe=Symbol("rizom.entity-runtime");var nqe=Symbol("rizom.ordinary-create"),rqe=Symbol("rizom.queued-create"),iqe=Symbol("rizom.stored-create"),oqe=Symbol("rizom.contract-job"),sqe=Symbol("rizom.deduplicated-generation");var aqe=Symbol("rizom.entity-answers");var cqe=Symbol("rizom.body-template");var lqe=Symbol("rizom.display-title");var uqe=Symbol("rizom.persist-validator");var dqe=Symbol("rizom.folder-titles");var pqe=Symbol("rizom.restated-metadata");var fqe=Symbol("rizom.url-route");var mqe=Symbol("rizom.published-statuses");var hqe=Symbol("rizom.unpublished-statuses");var gqe=Symbol("rizom.frontmatter-schema");var yqe=Symbol("rizom.after-generation");var{AsyncLocalStorage:Oqe}=(()=>({}));var z_=r.object({entityType:r.string().min(1),ids:r.array(r.string().min(1)).min(1)});var Qqe=OS(r.unknown()).extend({entityId:r.string().optional(),source:z_.optional()}),Yqe=r.object({legacyRawData:r.literal(!0),input:r.unknown(),entityId:r.string().optional(),source:z_.optional()});var _3e=Symbol("rizom.studio-workspace-executor");var $3e=r.json();var f0=r.enum(["text","url","number","checkbox","select","textarea"]),EG=f0.exclude(["select","textarea"]);var nt=r.string().trim().min(1).max(120),pi=r.string().trim().min(1).max(400),Xe=r.string().trim().min(1).max(160),ln=r.string().max(500),Hr=r.string().max(4000),D_=r.string().max(1e5),mo=r.number().finite().min(0).max(1),pn=r.enum(["good","warn","neutral","error"]),Zl=r.union([r.string().max(2000),r.number().finite(),r.boolean(),r.null()]),m0=r.object({label:Xe,value:r.union([r.string().max(500),r.number().finite()]),caption:ln.optional(),tone:pn.optional()}).strict(),h0=r.object({type:r.literal("stats"),id:nt.optional(),items:r.array(m0).max(20).readonly()}).strict(),CG=r.object({label:Xe,value:Zl}).strict(),g0=r.object({type:r.literal("key-values"),id:nt.optional(),items:r.array(CG).max(40).readonly()}).strict(),y0=r.object({type:r.literal("notice"),id:nt.optional(),title:Xe.optional(),text:Hr,details:r.array(D_).max(50).readonly().optional(),tone:pn.optional()}).strict(),AG=r.string().max(2048).refine((e)=>{try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}},"Expected an http or https address"),j_=r.object({type:r.literal("webpage"),id:nt.optional(),title:Xe,url:AG,caption:Xe.optional(),tag:Xe.optional()}).strict(),N_=r.object({type:r.literal("text"),id:nt.optional(),label:Xe.optional(),text:D_,truncated:r.boolean().optional()}).strict(),PG=r.object({id:nt,label:Xe,value:r.number().finite().nonnegative(),max:r.number().finite().positive().optional(),unit:Xe.optional(),tone:pn.optional()}).strict().superRefine((e,t)=>{if(e.max!==void 0&&e.value>e.max)t.addIssue({code:"custom",message:"Meter value cannot exceed its maximum",path:["value"]})}),b0=r.object({type:r.literal("meters"),id:nt,items:r.array(PG).max(30).readonly()}).strict(),S0=r.object({type:r.literal("progress"),id:nt,label:Xe,state:Xe,detail:Hr.optional(),startedAt:r.string().datetime().optional(),updatedAt:r.string().datetime().optional(),progress:mo.optional(),tone:pn.optional()}).strict(),IG=r.object({id:nt,label:Xe,value:r.number().finite().nonnegative().nullable(),marker:Xe.optional(),tone:pn.optional()}).strict(),v0=r.object({type:r.literal("series"),id:nt,label:Xe,unit:Xe.optional(),points:r.array(IG).min(1).max(370).readonly()}).strict(),kG=r.object({id:pi,at:r.iso.datetime({offset:!0}),title:Xe,tone:pn.optional(),target:pi.optional()}).strict(),MG=r.object({label:Xe,tone:pn.optional()}).strict(),B_=r.object({type:r.literal("timeline"),id:nt,label:Xe,start:r.iso.datetime({offset:!0}),end:r.iso.datetime({offset:!0}),legend:r.array(MG).max(6).readonly().optional(),items:r.array(kG).max(500).readonly()}).strict().refine((e)=>Date.parse(e.start)<Date.parse(e.end),{message:"Timeline start must come before its end",path:["end"]});var q_=r.string().max(2048).refine((e)=>{try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}},{message:"External operator links must use http or https"});function zG(e){return e!==null&&typeof e==="object"&&"kind"in e&&e.kind==="rizom-entity"&&"type"in e&&typeof e.type==="string"&&e.type.length>0}var _G=r.custom(zG,{message:"Expected an imported entity definition"});function OG(e){return e!==null&&typeof e==="object"&&"kind"in e&&e.kind==="rizom-entity-catalog"&&"id"in e&&typeof e.id==="string"&&"label"in e&&typeof e.label==="string"}var DG=r.custom(OG,{message:"Expected an imported entity catalog definition"});function jG(e){return{kind:"external",href:e.external}}function NG(e){return{kind:"entity",entityType:e.entity.type,id:e.id}}var L_=r.union([r.object({target:r.literal("account-settings")}).strict(),r.object({target:r.literal("invitations")}).strict(),r.object({target:r.literal("admin-peer-invite"),peerId:nt,displayName:Xe}).strict(),r.object({target:r.literal("inbox")}).strict(),r.object({target:r.literal("inbox"),source:r.literal("mail"),filter:r.enum(["high-priority","needs-reply","unclassified"]).optional()}).strict(),r.object({target:r.literal("publishing")}).strict(),r.object({target:r.literal("site")}).strict(),r.object({target:r.literal("traffic")}).strict(),r.object({target:r.literal("board")}).strict(),r.object({target:r.literal("memory"),channel:r.string().trim().min(1).max(300).optional(),selected:pi.optional()}).strict(),r.object({target:r.literal("inbox-open-entity"),entityType:nt,entityId:nt}).strict(),r.object({target:r.literal("inbox-capture-note"),title:ln,summary:r.string().trim().min(1).max(1000).optional(),entityType:nt,entityId:nt}).strict(),r.object({target:r.literal("inbox-track-action-item"),sourceId:nt,title:ln,summary:r.string().trim().min(1).max(1000).optional(),entityType:nt,entityId:nt}).strict(),r.object({target:r.literal("inbox-discuss-in-chat"),sourceId:nt,itemId:r.string().trim().min(1).max(300),label:r.string().trim().min(1).max(160)}).strict(),r.object({target:r.literal("ask-in-chat"),question:r.string().trim().min(1).max(500)}).strict()]);function BG(e){return{kind:"entity",entityType:e.entityType,id:e.id}}function qG(e){return{kind:"launch",launch:e.launch}}function LG(e){return{kind:"detail",itemId:e.detail.itemId}}var Ul=r.union([r.object({external:q_}).strict().transform(jG),r.object({entity:_G,id:nt}).strict().transform(NG),r.object({catalog:DG,entityType:nt,id:nt}).strict().transform(BG),r.object({launch:L_}).strict().transform(qG),r.object({detail:r.object({itemId:pi}).strict()}).strict().transform(LG),r.object({kind:r.literal("external"),href:q_}).strict(),r.object({kind:r.literal("entity"),entityType:nt,id:nt}).strict(),r.object({kind:r.literal("launch"),launch:L_}).strict(),r.object({kind:r.literal("detail"),itemId:pi}).strict()]);function lr(e,t,n,s){let[c,d]=s.path,a=new Set;for(let[h,R]of t.entries()){let b=n(R);if(b!==void 0){if(a.has(b)||s.reserved?.has(b))e.addIssue({code:"custom",message:`${s.label} "${b}" is duplicated`,path:[c,h,d]});a.add(b)}s.each?.(R,h)}return a}function $_(e,t){return lr(e,t,(n)=>n.id,{label:"Spatial point id",path:["points","id"]})}var F_=r.object({label:Xe,tone:pn.optional()}).strict(),Z_=r.object({sourceId:nt,targetId:nt,label:Xe.optional(),tone:pn.optional()}).strict(),$G=r.object({id:nt,label:Xe,category:Xe,x:mo,y:mo,zoneId:nt.optional(),tone:pn.optional(),details:r.array(ln).max(20).optional()}).strict(),FG=r.object({id:nt,label:Xe,x:mo,y:mo,memberIds:r.array(nt).max(500)}).strict(),ZG=r.object({type:r.literal("spatial"),layout:r.literal("cartesian"),id:nt,label:Xe,description:Hr,points:r.array($G).max(500),zones:r.array(FG).max(100),relationships:r.array(Z_).max(2000).optional(),legend:r.array(F_).max(20)}).strict().superRefine((e,t)=>{let n=$_(t,e.points),s=lr(t,e.zones,(d)=>d.id,{label:"Spatial zone id",path:["zones","id"],reserved:n,each:(d,a)=>{for(let h of d.memberIds)if(!n.has(h))t.addIssue({code:"custom",message:`Spatial zone member "${h}" has no matching point`,path:["zones",a,"memberIds"]})}});for(let[d,a]of e.points.entries())if(a.zoneId&&!s.has(a.zoneId))t.addIssue({code:"custom",message:`Spatial point zone "${a.zoneId}" has no matching zone`,path:["points",d,"zoneId"]});let c=new Set([...n,...s]);for(let[d,a]of(e.relationships??[]).entries())if(!c.has(a.sourceId)||!c.has(a.targetId))t.addIssue({code:"custom",message:"Spatial relationship endpoints must reference declared points or zones",path:["relationships",d]})}),UG=r.object({id:nt,label:Xe,kind:Xe,status:Xe,tags:r.array(Xe).max(30).optional(),distance:mo,bearing:r.number().finite().min(0).lt(360),relatedIds:r.array(nt).max(100).optional(),tone:pn.optional(),details:r.array(ln).max(20).optional()}).strict(),WG=r.object({id:nt,label:Xe,memberIds:r.array(nt).min(2).max(500)}).strict(),HG=r.object({id:nt,label:Xe,maxDistance:mo}).strict(),GG=r.object({type:r.literal("spatial"),layout:r.literal("radial"),id:nt,label:Xe,description:Hr,centerLabel:Xe,centerKind:r.enum(["identity","centroid"]),points:r.array(UG).max(500),clusters:r.array(WG).max(100).optional(),relationships:r.array(Z_).max(2000).optional(),strata:r.array(HG).min(1).max(10),legend:r.array(F_).max(20)}).strict().superRefine((e,t)=>{let n=$_(t,e.points);for(let[c,d]of e.points.entries())for(let a of d.relatedIds??[])if(!n.has(a))t.addIssue({code:"custom",message:`Related point "${a}" is not declared`,path:["points",c,"relatedIds"]});lr(t,e.clusters??[],(c)=>c.id,{label:"Spatial cluster id",path:["clusters","id"],each:(c,d)=>{for(let a of c.memberIds)if(!n.has(a))t.addIssue({code:"custom",message:`Spatial cluster member "${a}" has no matching point`,path:["clusters",d,"memberIds"]})}});for(let[c,d]of(e.relationships??[]).entries())if(!n.has(d.sourceId)||!n.has(d.targetId))t.addIssue({code:"custom",message:"Spatial relationship endpoints must reference declared points",path:["relationships",c]});let s=-1;for(let[c,d]of e.strata.entries()){if(d.maxDistance<=s)t.addIssue({code:"custom",message:"Radial strata must increase by maximum distance",path:["strata",c,"maxDistance"]});s=d.maxDistance}}),w0=r.discriminatedUnion("layout",[ZG,GG]);var JG=r.object({id:nt,label:Xe,value:Zl.optional(),description:Hr.optional(),tone:pn.optional()}).strict(),W_=r.object({type:r.literal("group"),id:nt,label:Xe,items:r.array(JG).max(50)}).strict(),VG=r.object({id:nt,label:Xe,status:r.enum(["idle","active","complete","failed"]),detail:ln.optional()}).strict(),H_=r.object({type:r.literal("flow"),id:nt,label:Xe,direction:r.enum(["forward","bidirectional"]).optional(),steps:r.array(VG).min(2).max(20)}).strict(),G_=r.string().trim().min(1).max(120).regex(/^[a-z][a-zA-Z0-9_.-]*$/),KG=r.object({value:Xe,label:Xe,count:r.number().int().nonnegative().optional()}).strict(),J_=r.object({key:G_,label:Xe,value:Xe.optional(),allLabel:Xe.optional(),options:r.array(KG).max(100)}).strict(),QG=r.object({key:G_,label:Xe,value:r.string().max(200).optional(),placeholder:Xe.optional()}).strict(),V_=r.object({search:QG.optional(),controls:r.array(J_).max(20),pagination:r.object({offset:r.number().int().nonnegative(),limit:r.number().int().min(1).max(100),total:r.number().int().nonnegative(),label:Xe.optional()}).strict().optional()}).strict();function K_(e,t){let n=lr(t,e.controls,(s)=>s.key,{label:"Query key",path:["controls","key"]});if(e.search&&n.has(e.search.key))t.addIssue({code:"custom",message:`Query key "${e.search.key}" is duplicated`,path:["search","key"]})}var YG=V_.extend({type:r.literal("query"),id:nt}).strict().superRefine(K_),XG=V_.superRefine(K_),Q_=r.object({type:r.literal("links"),id:nt.optional(),items:r.array(r.object({label:Xe,target:Ul}).strict()).max(30)}).strict(),Y_=r.object({label:Xe,tone:pn.optional()}).strict(),eJ=r.object({value:nt,label:Xe,count:r.number().int().nonnegative().optional(),emphasis:r.literal("gap").optional()}).strict(),R0=200,X_=50,tJ=R0*X_+1,nJ=r.object({label:Xe,defaultValue:nt,allValue:nt.optional(),options:r.array(eJ).min(1).max(tJ)}).strict().superRefine((e,t)=>{if(!lr(t,e.options,(s)=>s.value,{label:"List filter value",path:["options","value"]}).has(e.defaultValue))t.addIssue({code:"custom",message:`List filter default "${e.defaultValue}" has no matching option`,path:["defaultValue"]})}),Bm=r.object({id:pi,title:ln,description:Hr.optional(),metadata:r.array(ln).max(20).optional(),tags:r.array(Xe).max(30).optional(),at:r.iso.datetime({offset:!0}).optional(),count:r.number().finite().optional(),badges:r.array(Y_).max(10).optional(),filterValues:r.array(nt).max(X_).optional(),links:r.array(r.object({label:Xe,target:Ul}).strict()).max(10).optional(),tone:pn.optional(),link:Ul.optional()}).strict(),rJ=r.enum(["standard","editorial","attention","activity","log","ranked","chips"]),eO=r.object({type:r.literal("list"),id:nt,empty:ln,presentation:rJ.optional(),unit:Xe.optional(),filter:nJ.optional(),items:r.array(Bm).max(R0)}).strict();function tO(e,t){if(lr(t,e.items,(c)=>c.id,{label:"List item id",path:["items","id"]}),!e.filter)return;let n=new Set(e.filter.options.map((c)=>c.value)),s=e.filter.allValue??"all";for(let[c,d]of e.items.entries())for(let a of d.filterValues??[])if(a!==s&&!n.has(a))t.addIssue({code:"custom",message:`List item filter value "${a}" has no matching option`,path:["items",c,"filterValues"]})}var iJ=eO.superRefine(tO),nO=r.object({key:nt,label:Xe,align:r.enum(["start","center","end"]).optional()}).strict(),rO=r.object({key:nt,label:Xe,values:r.array(Zl).max(50)}).strict(),oJ=r.union([Zl,r.array(r.string().max(500)).max(50)]),sJ=r.object({title:ln.trim().min(1),description:Hr.optional(),metadata:r.array(ln).max(20).optional(),badges:r.array(Y_).max(10).optional(),count:r.number().finite().optional(),tone:pn.optional()}).strict(),iO=r.object({id:pi,cells:r.record(r.string(),oJ),link:Ul.optional()}).strict(),aJ=r.object({type:r.literal("table"),id:nt,empty:ln,filters:r.array(rO).max(20).optional(),columns:r.array(nO).min(1).max(30),rows:r.array(iO).max(500)}).strict();function oO(e,t){let n=lr(t,e.columns,(s)=>s.key,{label:"Table column key",path:["columns","key"]});for(let[s,c]of(e.filters??[]).entries())if(!n.has(c.key))t.addIssue({code:"custom",message:`Table filter key "${c.key}" has no matching column`,path:["filters",s,"key"]});lr(t,e.rows,(s)=>s.id,{label:"Table row id",path:["rows","id"],each:(s,c)=>{for(let d of Object.keys(s.cells))if(!n.has(d))t.addIssue({code:"custom",message:`Table cell key "${d}" has no matching column`,path:["rows",c,"cells",d]})}})}var cJ=aJ.superRefine(oO),sO=r.object({id:nt,label:Xe,tone:pn.optional(),empty:ln,items:r.array(Bm).max(100)}).strict();function aO(e,t){lr(t,e.items,(n)=>n.id,{label:"Matrix item id",path:["items","id"]})}var lJ=sO.superRefine(aO),cO=r.object({type:r.literal("matrix"),id:nt,columns:r.union([r.literal(1),r.literal(2),r.literal(3),r.literal(4)]).optional(),cells:r.array(lJ).min(1).max(12)}).strict();function lO(e,t){lr(t,e.cells,(n)=>n.id,{label:"Matrix cell id",path:["cells","id"]})}var uJ=cO.superRefine(lO);function uO(e,t){if(!lr(t,e.tabs,(s)=>s.id,{label:"Tab id",path:["tabs","id"]}).has(e.defaultTab))t.addIssue({code:"custom",message:`Default tab "${e.defaultTab}" has no matching tab`,path:["defaultTab"]})}function dO(e,t){lr(t,e.blocks,(n)=>n.id,{label:"Operator view block id",path:["blocks","id"]})}var pO=r.union([h0,g0,y0,W_,H_,b0,S0,v0,Q_,iJ,cJ,uJ,w0]),dJ=r.object({type:r.literal("tabs"),id:nt,label:Xe,defaultTab:nt,tabs:r.array(r.object({id:nt,label:Xe,count:r.number().int().nonnegative().optional(),blocks:r.array(pO).max(30)}).strict()).min(1).max(12)}).strict().superRefine(uO);function pJ(e){return e!==null&&typeof e==="object"&&"kind"in e&&e.kind==="rizom-workspace-action"&&"name"in e&&typeof e.name==="string"&&"input"in e&&typeof e.input==="object"&&e.input!==null&&"safeParse"in e.input&&typeof e.input.safeParse==="function"}var fJ=r.custom(pJ,{message:"Expected a workspace action definition"}),mJ=r.object({id:nt,label:Xe,description:Hr.optional(),confirmation:r.literal("prepared").optional()}).strict(),U_=r.object({value:r.string().trim().min(1).max(500),label:Xe}).strict(),hJ=r.object({label:Xe,control:f0,secret:r.boolean().optional(),options:r.array(U_).min(1).max(100).optional(),labelBy:r.object({field:nt,values:r.array(U_).min(1).max(100)}).strict().optional()}).strict(),gJ=r.object({presentation:r.enum(["inline","disclosure"]).optional(),submitLabel:Xe.optional(),fields:r.record(nt,hJ)}).strict(),yJ=r.object({label:Xe,copyable:r.boolean().optional(),sensitive:r.boolean().optional()}).strict(),bJ=r.object({title:Xe,fields:r.record(nt,yJ)}).strict(),xa=r.object({action:fJ,input:r.unknown().optional(),form:gJ.optional(),result:bJ.optional(),capability:mJ.optional(),label:Xe.optional(),disabled:r.boolean().optional()}).strict(),SJ=Bm.extend({actionsLabel:Xe.optional(),actions:r.array(xa).max(20).optional()}),fO=eO.extend({items:r.array(SJ).max(R0)}).superRefine(tO),vJ=iO.extend({compact:sJ.optional(),actions:r.array(xa).max(20).optional()}),mO=r.object({type:r.literal("table"),id:nt,empty:ln,filters:r.array(rO).max(20).optional(),query:XG.optional(),columns:r.array(nO).min(1).max(30),rows:r.array(vJ).max(500)}).strict().superRefine(oO),wJ=xa.extend({dropTarget:nt.optional()}),RJ=Bm.extend({actionsLabel:Xe.optional(),actions:r.array(wJ).max(20).optional()}),TJ=sO.extend({items:r.array(RJ).max(100)}).superRefine(aO);function xJ(e,t){let n=new Set(e.cells.map((s)=>s.id));e.cells.forEach((s,c)=>s.items.forEach((d,a)=>{let h=new Set;(d.actions??[]).forEach((R,b)=>{let S=R.dropTarget;if(S===void 0)return;let m=!n.has(S)?`Drop target "${S}" is not a cell of this matrix`:S===s.id?`Drop target "${S}" is the card's own cell`:h.has(S)?`Drop target "${S}" has more than one action on this card`:R.action.confirmation!==void 0||R.form!==void 0?`Drop target "${S}" needs an action that runs without confirmation or a form`:void 0;if(h.add(S),m)t.addIssue({code:"custom",message:m,path:["cells",c,"items",a,"actions",b,"dropTarget"]})})}))}var hO=cO.extend({cells:r.array(TJ).min(1).max(12)}).superRefine(lO).superRefine(xJ),EJ=xa.extend({type:r.literal("action"),id:nt.optional()}),CJ=r.object({type:r.literal("actions"),id:nt.optional(),items:r.array(xa).max(30)}).strict(),Ta=r.union([h0,g0,y0,j_,N_,W_,H_,b0,S0,v0,B_,YG,Q_,fO,mO,hO,w0,EJ,CJ]),AJ=r.object({type:r.literal("tabs"),id:nt,label:Xe,defaultTab:nt,queryKey:nt.optional(),tabs:r.array(r.object({id:nt,label:Xe,count:r.number().int().nonnegative().optional(),blocks:r.array(r.lazy(()=>r.union([Ta,Wl,gO,yO]))).max(30)}).strict()).min(1).max(12)}).strict().superRefine(uO),Wl=r.object({disclosureLabel:Xe.optional(),type:r.literal("card"),id:nt,label:Xe,presentation:r.enum(["section","disclosure","feature"]).optional(),metadata:r.array(ln).max(20).optional(),summary:r.array(m0).max(4).optional(),tone:pn.optional(),blocks:r.array(Ta).max(12)}).strict().refine((e)=>e.disclosureLabel===void 0||e.presentation==="disclosure",{message:"disclosureLabel requires disclosure presentation",path:["disclosureLabel"]}),gO=r.object({type:r.literal("detail"),id:nt,queryKey:nt,empty:ln,master:r.union([fO,mO,hO]),open:r.object({forId:pi,title:Xe,blocks:r.array(r.union([Ta,Wl])).max(30)}).strict().optional()}).strict(),yO=r.object({type:r.literal("columns"),id:nt,primary:r.array(r.union([Ta,Wl])).max(20),aside:r.array(r.union([Ta,Wl])).max(12)}).strict(),mLe=r.object({kicker:Xe.optional(),title:ln.optional(),description:Hr.optional(),status:r.object({label:Xe,detail:ln.optional(),tone:pn.optional()}).strict().optional(),facts:r.array(r.object({label:Xe,tone:pn.optional()}).strict()).max(6).optional(),primaryAction:xa.optional(),headQuery:J_.optional(),blocks:r.array(r.union([Ta,AJ,gO,yO,Wl])).max(50)}).strict().superRefine(dO),PJ=r.object({title:ln.optional(),blocks:r.array(r.union([pO,dJ])).max(50)}).strict().superRefine(dO),IJ=r.object({items:r.array(r.object({label:Xe,value:r.string().max(500),tone:r.enum(["good","warn"]).optional()}).strict()).max(4),attention:r.number().int().nonnegative().optional()}).strict(),hLe=r.object({view:PJ,digest:IJ.optional()}).strict();var FLe=Object.freeze({config:Object.freeze({}),state:Object.freeze({}),accountSettings:void 0});var NJ=r.looseObject({id:r.string().optional(),limit:r.number().optional(),page:r.number().optional(),pageSize:r.number().optional(),baseUrl:r.string().optional()}),VLe=r.looseObject({entityType:r.string().optional(),query:NJ.optional()});var p8e=r.object({publishedOnly:r.boolean().optional()}),f8e=Symbol("data source read chain"),m8e=r.array(r.string());var S$e={"startup-content-settled":li.startupContentSettled},v$e=r.record(r.string(),r.unknown());var w$e=r.string().min(1).refine((e)=>!e.startsWith("/")&&!e.includes("\\")&&e.split("/").every((t)=>t!==""&&t!==".."),{message:"A feed path is relative to the build output"}),R$e=r.object({items:r.array(r.object({operation:r.enum(["upsert","delete"]),id:r.string(),source:Vo.optional()}))});var T$e=Object.freeze({config:Object.freeze({}),state:Object.freeze({}),accountSettings:void 0});var x$e=r.object({});var z$e=r.object({});var{AsyncLocalStorage:jFe}=(()=>({}));var VJ=Symbol("service-content-target");mn();var KJ=Object.freeze({ttlMs:600000,maxPending:20});var qm="[secret]",QJ=Symbol.for("nodejs.util.inspect.custom");class YJ{#e;constructor(e){this.#e=e,Object.defineProperty(this,QJ,{value:()=>qm}),Object.freeze(this)}reveal(){return this.#e}toJSON(){return qm}toString(){return qm}[Symbol.toPrimitive](){return qm}}mn();var h4e=r.object({url:r.string()});var g4e=Symbol("rizom.workspace-action-executor");var j4e=r.object({actionId:r.string().trim().min(1).max(120),input:r.unknown(),mode:r.enum(["prepare","execute"]).default("execute"),confirmationToken:r.string().uuid().optional()}).strict(),N4e=r.object({capability:r.object({confirmation:r.literal("prepared").optional()})}).passthrough(),B4e=r.array(r.string().trim().min(1).max(120)).max(200).transform((e)=>[...new Set(e)]),q4e=r.object({summary:r.string().trim().min(1).max(500),revision:r.string().trim().min(1).max(500)}),L4e=r.json(),$4e=r.object({url:r.string()});var F4e=Object.freeze({config:Object.freeze({}),state:Object.freeze({}),accountSettings:void 0});var G4e=r.string().min(1).refine((e)=>Buffer.from(e).toString("utf8")===e,"State owner must be well-formed Unicode");var rFe=Symbol("rizom.first-party-service-runtime");function Lm(e){let t=new WeakMap;return{register:(n,s,c)=>{t.set(n,{declarations:s,rebuild:c})},rebuildWith:(n,s,c)=>{let d=t.get(n);if(!d)throw Error(`${s} takes a definition ${e} returned; "${n.id}" is not one`);return d.rebuild(c(d.declarations))}}}var cFe=r.record(r.string(),r.unknown());var SO=Object.freeze({}),tV=Lm("defineServicePlugin"),nV=tV.register;var iV=r.union([r.string(),r.number(),r.boolean()]),SFe=r.record(r.string(),iV.optional());var SZe=r.object({issues:r.array(r.object({path:r.array(r.union([r.string(),r.number()]))}))});var{AsyncLocalStorage:IJe}=(()=>({}));var EO=Object.freeze({daemons:Object.freeze([])});var AV=Lm("defineInterface"),PV=AV.register;var XZe=Symbol("rizom.first-party-interface-runtime");var Hl="The AI provider declined this request. Try rephrasing your message.";class Gl extends Error{constructor(e){super(Hl,{cause:e});this.name="AIProviderDeclinedError"}}var IV=r.object({anthropic:r.string().min(1).optional(),openai:r.string().min(1).optional(),google:r.string().min(1).optional()}),Jl={anthropic:{label:"Anthropic",keyEnvVar:"ANTHROPIC_API_KEY",keyFormat:/^sk-ant-/},openai:{label:"OpenAI",keyEnvVar:"OPENAI_API_KEY",keyFormat:/^sk-(?:proj|svcacct|admin)-/},google:{label:"Google",keyEnvVar:"GOOGLE_GENERATIVE_AI_API_KEY",keyFormat:/^AIza/},local:{label:"the model runtime"}};var C0=["anthropic","openai","google"];function $m(e){let t=Jl[e].keyEnvVar;if(!t)throw Error(`${e} takes no key`);return t}var PO={provider:"openai",maxInputTokens:8191,maxRequestTokens:300000,maxRequestInputs:2048,promptRevision:0,query:(e)=>e,document:({content:e})=>e},w5e=new Map([{...PO,modelId:"text-embedding-3-small",dimensions:1536},{...PO,modelId:"text-embedding-3-large",dimensions:3072},{provider:"local",modelId:"embeddinggemma-2:270m",dimensions:768,maxInputTokens:2048,maxRequestTokens:32768,maxRequestInputs:64,promptRevision:1,query:(e)=>`task: search result | query: ${e}`,document:({title:e,content:t})=>`title: ${e??"none"} | text: ${t}`},{provider:"local",modelId:"nomic-embed-text:v1.5",dimensions:768,maxInputTokens:2048,maxRequestTokens:32768,maxRequestInputs:64,promptRevision:1,query:(e)=>`search_query: ${e}`,document:({content:e})=>`search_document: ${e}`}].map((e)=>{let t=`${e.provider}:${e.modelId}`;return[t,{model:t,...e}]}));mn();var I5e=r.custom(vn);var IO=r.enum(["application/pdf","application/epub+zip"]),kO=r.enum(["pending","draft","failed"]),A0=r.enum(["uploaded","rendered"]),MO=r.enum(["generated","owner"]),zO=r.object({title:r.string().optional(),description:r.string().optional(),descriptionSource:MO.optional().meta({studioWidget:"provenance"}),mimeType:IO.meta({studioWidget:"provenance"}),filename:r.string().min(1).meta({studioWidget:"provenance"}),pageCount:r.number().int().min(0).optional().meta({studioWidget:"provenance"}),sectionCount:r.number().int().min(0).optional().meta({studioWidget:"provenance"}),sizeBytes:r.number().int().min(0).optional().meta({studioWidget:"provenance"}),status:kO.optional().meta({studioWidget:"provenance"}),origin:A0.optional().meta({studioWidget:"provenance"}),processingJobId:r.string().optional().meta({studioWidget:"hidden"}),processingError:r.string().optional().meta({studioWidget:"provenance"}),sourceEntityType:r.string().min(1).optional().meta({studioWidget:"provenance"}),sourceEntityId:r.string().min(1).optional().meta({studioWidget:"provenance"}),sourceUploadId:r.string().optional().meta({studioWidget:"provenance"}),sourceFilename:r.string().optional().meta({studioWidget:"provenance"}),sourceMediaType:r.string().optional().meta({studioWidget:"provenance"}),attachmentType:r.string().min(1).optional().meta({studioWidget:"provenance"}),dedupKey:r.string().min(1).optional().meta({studioWidget:"hidden"})}),MV=Zc.extend({entityType:r.literal("document"),content:r.union([fr,r.string().regex(/^data:application\/pdf;base64,.+$/),r.literal("")]),metadata:zO});var{AsyncLocalStorage:h9e}=(()=>({}));var{AsyncLocalStorage:w9e}=(()=>({}));function GV(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function JV(){let e=GV();if(e.__xstate__)return e.__xstate__;return}var NO=(e)=>{if(typeof window>"u")return;let t=JV();if(t)t.register(e)};class k0{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){if(this._current)this._current.next=null,this._last=this._current}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}if(this._current=t,this._last=t,this._active)this.flush()}flush(){while(this._current){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}}var j0=".",VV="",N0="",KV="#",M0="*",ZO="xstate.init",UO="xstate.error",Kl="xstate.stop";function QV(e,t){return{type:`xstate.after.${e}.${t}`}}function z0(e,t){return{type:`xstate.done.state.${e}`,output:t}}function YV(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function B0(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function Zm(e){return{type:ZO,input:e}}function fi(e){setTimeout(()=>{throw e})}var XV=(()=>typeof Symbol==="function"&&Symbol.observable||"@@observable")();function WO(e,t){let n=BO(e),s=BO(t);if(typeof s==="string"){if(typeof n==="string")return s===n;return!1}if(typeof n==="string")return n in s;return Object.keys(n).every((c)=>{if(!(c in s))return!1;return WO(n[c],s[c])})}function Um(e){if(GO(e))return e;let t=[],n="";for(let s=0;s<e.length;s++){switch(e.charCodeAt(s)){case 92:n+=e[s+1],s++;continue;case 46:t.push(n),n="";continue}n+=e[s]}return t.push(n),t}function BO(e){if(CK(e))return e.value;if(typeof e!=="string")return e;let t=Um(e);return eK(t)}function eK(e){if(e.length===1)return e[0];let t={},n=t;for(let s=0;s<e.length-1;s++)if(s===e.length-2)n[e[s]]=e[s+1];else{let c=n;n={},c[e[s]]=n}return t}function q0(e,t){let n={},s=Object.keys(e);for(let c=0;c<s.length;c++){let d=s[c];n[d]=t(e[d],d,e,c)}return n}function HO(e){if(GO(e))return e;return[e]}function mi(e){if(e===void 0)return[];return HO(e)}function _0(e,t,n,s){if(typeof e==="function")return e({context:t,event:n,self:s});if(!!e&&typeof e==="object"&&Object.values(e).some((c)=>typeof c==="function"))console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.
|
|
132
|
+
- `)}`,Error(ie)}let Ce=`${h}/$ref`,Y=on(e,K,n,s,c,d,a,Ce,R);if(!Y.valid)Se.push({instanceLocation:a,keyword:"$ref",keywordLocation:Ce,error:"A subschema had errors."},...Y.errors);if(n==="4"||n==="7")return{valid:Se.length===0,errors:Se}}if(Array.isArray(E)){let K=E.length,Ce=!1;for(let Y=0;Y<K;Y++)if(S===E[Y]||E[Y]==="integer"&&S==="number"&&e%1===0&&e===e){Ce=!0;break}if(!Ce)Se.push({instanceLocation:a,keyword:"type",keywordLocation:`${h}/type`,error:`Instance type "${S}" is invalid. Expected "${E.join('", "')}".`})}else if(E==="integer"){if(S!=="number"||e%1||e!==e)Se.push({instanceLocation:a,keyword:"type",keywordLocation:`${h}/type`,error:`Instance type "${S}" is invalid. Expected "${E}".`})}else if(E!==void 0&&S!==E)Se.push({instanceLocation:a,keyword:"type",keywordLocation:`${h}/type`,error:`Instance type "${S}" is invalid. Expected "${E}".`});if(A!==void 0){if(S==="object"||S==="array"){if(!$l(e,A))Se.push({instanceLocation:a,keyword:"const",keywordLocation:`${h}/const`,error:`Instance does not match ${JSON.stringify(A)}.`})}else if(e!==A)Se.push({instanceLocation:a,keyword:"const",keywordLocation:`${h}/const`,error:`Instance does not match ${JSON.stringify(A)}.`})}if(P!==void 0){if(S==="object"||S==="array"){if(!P.some((K)=>$l(e,K)))Se.push({instanceLocation:a,keyword:"enum",keywordLocation:`${h}/enum`,error:`Instance does not match any of ${JSON.stringify(P)}.`})}else if(!P.some((K)=>e===K))Se.push({instanceLocation:a,keyword:"enum",keywordLocation:`${h}/enum`,error:`Instance does not match any of ${JSON.stringify(P)}.`})}if(z!==void 0){let K=`${h}/not`;if(on(e,z,n,s,c,d,a,K).valid)Se.push({instanceLocation:a,keyword:"not",keywordLocation:K,error:'Instance matched "not" schema.'})}let H=[];if(_!==void 0){let K=`${h}/anyOf`,Ce=Se.length,Y=!1;for(let ie=0;ie<_.length;ie++){let De=_[ie],xe=Object.create(R),Re=on(e,De,n,s,c,x===!0?d:null,a,`${K}/${ie}`,xe);if(Se.push(...Re.errors),Y=Y||Re.valid,Re.valid)H.push(xe)}if(Y)Se.length=Ce;else Se.splice(Ce,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:K,error:"Instance does not match any subschemas."})}if(j!==void 0){let K=`${h}/allOf`,Ce=Se.length,Y=!0;for(let ie=0;ie<j.length;ie++){let De=j[ie],xe=Object.create(R),Re=on(e,De,n,s,c,x===!0?d:null,a,`${K}/${ie}`,xe);if(Se.push(...Re.errors),Y=Y&&Re.valid,Re.valid)H.push(xe)}if(Y)Se.length=Ce;else Se.splice(Ce,0,{instanceLocation:a,keyword:"allOf",keywordLocation:K,error:"Instance does not match every subschema."})}if(B!==void 0){let K=`${h}/oneOf`,Ce=Se.length,Y=B.filter((ie,De)=>{let xe=Object.create(R),Re=on(e,ie,n,s,c,x===!0?d:null,a,`${K}/${De}`,xe);if(Se.push(...Re.errors),Re.valid)H.push(xe);return Re.valid}).length;if(Y===1)Se.length=Ce;else Se.splice(Ce,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:K,error:`Instance does not match exactly one subschema (${Y} matches).`})}if(S==="object"||S==="array")Object.assign(R,...H);if(F!==void 0){let K=`${h}/if`;if(on(e,F,n,s,c,d,a,K,R).valid){if(ne!==void 0){let Ce=on(e,ne,n,s,c,d,a,`${h}/then`,R);if(!Ce.valid)Se.push({instanceLocation:a,keyword:"if",keywordLocation:K,error:'Instance does not match "then" schema.'},...Ce.errors)}}else if(ge!==void 0){let Ce=on(e,ge,n,s,c,d,a,`${h}/else`,R);if(!Ce.valid)Se.push({instanceLocation:a,keyword:"if",keywordLocation:K,error:'Instance does not match "else" schema.'},...Ce.errors)}}if(S==="object"){if(M!==void 0){for(let ie of M)if(!(ie in e))Se.push({instanceLocation:a,keyword:"required",keywordLocation:`${h}/required`,error:`Instance does not have required property "${ie}".`})}let K=Object.keys(e);if(f!==void 0&&K.length<f)Se.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${h}/minProperties`,error:`Instance does not have at least ${f} properties.`});if(l!==void 0&&K.length>l)Se.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${h}/maxProperties`,error:`Instance does not have at least ${l} properties.`});if(p!==void 0){let ie=`${h}/propertyNames`;for(let De in e){let xe=`${a}/${Wr(De)}`,Re=on(De,p,n,s,c,d,xe,ie);if(!Re.valid)Se.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:ie,error:`Property name "${De}" does not match schema.`},...Re.errors)}}if(v!==void 0){let ie=`${h}/dependantRequired`;for(let De in v)if(De in e){let xe=v[De];for(let Re of xe)if(!(Re in e))Se.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:ie,error:`Instance has "${De}" but does not have "${Re}".`})}}if(T!==void 0)for(let ie in T){let De=`${h}/dependentSchemas`;if(ie in e){let xe=on(e,T[ie],n,s,c,d,a,`${De}/${Wr(ie)}`,R);if(!xe.valid)Se.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:De,error:`Instance has "${ie}" but does not match dependant schema.`},...xe.errors)}}if(g!==void 0){let ie=`${h}/dependencies`;for(let De in g)if(De in e){let xe=g[De];if(Array.isArray(xe)){for(let Re of xe)if(!(Re in e))Se.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ie,error:`Instance has "${De}" but does not have "${Re}".`})}else{let Re=on(e,xe,n,s,c,d,a,`${ie}/${Wr(De)}`);if(!Re.valid)Se.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ie,error:`Instance has "${De}" but does not match dependant schema.`},...Re.errors)}}}let Ce=Object.create(null),Y=!1;if(W!==void 0){let ie=`${h}/properties`;for(let De in W){if(!(De in e))continue;let xe=`${a}/${Wr(De)}`,Re=on(e[De],W[De],n,s,c,d,xe,`${ie}/${Wr(De)}`);if(Re.valid)R[De]=Ce[De]=!0;else if(Y=c,Se.push({instanceLocation:a,keyword:"properties",keywordLocation:ie,error:`Property "${De}" does not match schema.`},...Re.errors),Y)break}}if(!Y&&re!==void 0){let ie=`${h}/patternProperties`;for(let De in re){let xe=new RegExp(De,"u"),Re=re[De];for(let k in e){if(!xe.test(k))continue;let G=`${a}/${Wr(k)}`,oe=on(e[k],Re,n,s,c,d,G,`${ie}/${Wr(De)}`);if(oe.valid)R[k]=Ce[k]=!0;else Y=c,Se.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:ie,error:`Property "${k}" matches pattern "${De}" but does not match associated schema.`},...oe.errors)}}}if(!Y&&i!==void 0){let ie=`${h}/additionalProperties`;for(let De in e){if(Ce[De])continue;let xe=`${a}/${Wr(De)}`,Re=on(e[De],i,n,s,c,d,xe,ie);if(Re.valid)R[De]=!0;else Y=c,Se.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:ie,error:`Property "${De}" does not match additional properties schema.`},...Re.errors)}}else if(!Y&&u!==void 0){let ie=`${h}/unevaluatedProperties`;for(let De in e)if(!R[De]){let xe=`${a}/${Wr(De)}`,Re=on(e[De],u,n,s,c,d,xe,ie);if(Re.valid)R[De]=!0;else Se.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:ie,error:`Property "${De}" does not match unevaluated properties schema.`},...Re.errors)}}}else if(S==="array"){if(ke!==void 0&&e.length>ke)Se.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${h}/maxItems`,error:`Array has too many items (${e.length} > ${ke}).`});if(Q!==void 0&&e.length<Q)Se.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${h}/minItems`,error:`Array has too few items (${e.length} < ${Q}).`});let K=e.length,Ce=0,Y=!1;if(o!==void 0){let ie=`${h}/prefixItems`,De=Math.min(o.length,K);for(;Ce<De;Ce++){let xe=on(e[Ce],o[Ce],n,s,c,d,`${a}/${Ce}`,`${ie}/${Ce}`);if(R[Ce]=!0,!xe.valid){if(Y=c,Se.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:ie,error:"Items did not match schema."},...xe.errors),Y)break}}}if(y!==void 0){let ie=`${h}/items`;if(Array.isArray(y)){let De=Math.min(y.length,K);for(;Ce<De;Ce++){let xe=on(e[Ce],y[Ce],n,s,c,d,`${a}/${Ce}`,`${ie}/${Ce}`);if(R[Ce]=!0,!xe.valid){if(Y=c,Se.push({instanceLocation:a,keyword:"items",keywordLocation:ie,error:"Items did not match schema."},...xe.errors),Y)break}}}else for(;Ce<K;Ce++){let De=on(e[Ce],y,n,s,c,d,`${a}/${Ce}`,ie);if(R[Ce]=!0,!De.valid){if(Y=c,Se.push({instanceLocation:a,keyword:"items",keywordLocation:ie,error:"Items did not match schema."},...De.errors),Y)break}}if(!Y&&I!==void 0){let De=`${h}/additionalItems`;for(;Ce<K;Ce++){let xe=on(e[Ce],I,n,s,c,d,`${a}/${Ce}`,De);if(R[Ce]=!0,!xe.valid)Y=c,Se.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:De,error:"Items did not match additional items schema."},...xe.errors)}}}if(O!==void 0)if(K===0&&q===void 0)Se.push({instanceLocation:a,keyword:"contains",keywordLocation:`${h}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(q!==void 0&&K<q)Se.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${h}/minContains`,error:`Array has less items (${K}) than minContains (${q}).`});else{let ie=`${h}/contains`,De=Se.length,xe=0;for(let Re=0;Re<K;Re++){let k=on(e[Re],O,n,s,c,d,`${a}/${Re}`,ie);if(k.valid)R[Re]=!0,xe++;else Se.push(...k.errors)}if(xe>=(q||0))Se.length=De;if(q===void 0&&Z===void 0&&xe===0)Se.splice(De,0,{instanceLocation:a,keyword:"contains",keywordLocation:ie,error:"Array does not contain item matching schema."});else if(q!==void 0&&xe<q)Se.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${h}/minContains`,error:`Array must contain at least ${q} items matching schema. Only ${xe} items were found.`});else if(Z!==void 0&&xe>Z)Se.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${h}/maxContains`,error:`Array may contain at most ${Z} items matching schema. ${xe} items were found.`})}if(!Y&&C!==void 0){let ie=`${h}/unevaluatedItems`;for(;Ce<K;Ce++){if(R[Ce])continue;let De=on(e[Ce],C,n,s,c,d,`${a}/${Ce}`,ie);if(R[Ce]=!0,!De.valid)Se.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:ie,error:"Items did not match unevaluated items schema."},...De.errors)}}if(de)for(let ie=0;ie<K;ie++){let De=e[ie],xe=typeof De==="object"&&De!==null;for(let Re=0;Re<K;Re++){if(ie===Re)continue;let k=e[Re];if(De===k||xe&&typeof k==="object"&&k!==null&&$l(De,k))Se.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${h}/uniqueItems`,error:`Duplicate items at indexes ${ie} and ${Re}.`}),ie=Number.MAX_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER}}}else if(S==="number"){if(n==="4"){if(V!==void 0&&(se===!0&&e<=V||e<V))Se.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${h}/minimum`,error:`${e} is less than ${se?"or equal to ":""} ${V}.`});if(be!==void 0&&(me===!0&&e>=be||e>be))Se.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${h}/maximum`,error:`${e} is greater than ${me?"or equal to ":""} ${be}.`})}else{if(V!==void 0&&e<V)Se.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${h}/minimum`,error:`${e} is less than ${V}.`});if(be!==void 0&&e>be)Se.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${h}/maximum`,error:`${e} is greater than ${be}.`});if(se!==void 0&&e<=se)Se.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${h}/exclusiveMinimum`,error:`${e} is less than ${se}.`});if(me!==void 0&&e>=me)Se.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${h}/exclusiveMaximum`,error:`${e} is greater than or equal to ${me}.`})}if(Ge!==void 0){let K=e%Ge;if(Math.abs(0-K)>=0.00000011920929&&Math.abs(Ge-K)>=0.00000011920929)Se.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${h}/multipleOf`,error:`${e} is not a multiple of ${Ge}.`})}}else if(S==="string"){let K=U===void 0&&J===void 0?0:qH(e);if(U!==void 0&&K<U)Se.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${h}/minLength`,error:`String is too short (${K} < ${U}).`});if(J!==void 0&&K>J)Se.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${h}/maxLength`,error:`String is too long (${K} > ${J}).`});if(Te!==void 0&&!new RegExp(Te,"u").test(e))Se.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${h}/pattern`,error:"String does not match pattern."});if(pe!==void 0&&b_[pe]&&!b_[pe](e))Se.push({instanceLocation:a,keyword:"format",keywordLocation:`${h}/format`,error:`String does not match format "${pe}".`})}return{valid:Se.length===0,errors:Se}}var LH=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=ss(e)}validate(e){return on(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};ss(e,this.lookup)}},Dm=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=uz(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new LH(e,this.draft??this._draftFor(e),this.shortcircuit);return(n)=>{let s=t.validate(n);return s.valid?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:s.errors.map((c)=>`${c.instanceLocation}: ${c.error}`).join("; ")}}}};var HH=8,GH=600000;function JH(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??HH,roundTimeoutMs:e?.roundTimeoutMs??GH,legacyShim:e?.legacyShim??!0}}function w_(e,t,n){if(n===null||typeof n!=="object"||typeof n.method!=="string")throw new xt(st.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let s=n,c=qz(s);if(c===void 0)throw new xt(st.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${s.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:s,required:c}}function VH(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map((s)=>s.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function s0(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new xt(st.InternalError,t)}var KH=class{constructor(e){this._host=e}async fulfill(e,t,n,s,c){let{maxRounds:d,roundTimeoutMs:a}=this._host,h=s.mcpReq.signal,R=c,b=0;while(!0){if(b+=1,b>d)return s0(e,d_(e,d));let S=R.inputRequests,m=S!=null&&Object.keys(S).length>0,w=typeof R.requestState==="string"?R.requestState:void 0;if(!m&&w===void 0)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let x;if(m){let P=this._host.resolvedClientCapabilities(s),M=[];for(let[_,j]of Object.entries(S)){let{embedded:B,required:F}=w_(e,_,j);if(B.method!=="roots/list"&&B.params===void 0)throw new xt(st.InternalError,`Handler for ${e} returned an input request '${_}' of kind '${B.method}' without params`);if(zm(F,P)!==void 0)return s0(e,`Cannot request input '${_}' (${B.method}): the client on this 2025-era connection did not declare the required capability${P===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);M.push([_,B])}let z=f_(h);try{let _={relatedRequestId:s.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},j=await Promise.all(M.map(async([B,F])=>{try{return[B,await this._dispatchLeg(F,_)]}catch(ne){throw z.abort(ne),ne}}));x=Object.fromEntries(j)}catch(_){if(h.aborted)throw _;return s0(e,`Fulfilling input required by '${e}' failed: ${_ instanceof Error?_.message:String(_)}`)}finally{z.dispose()}}else await p_(u_,h);let E={...s,mcpReq:{...s.mcpReq,inputResponses:x,droppedInputResponseKeys:void 0,requestState:Ll(w)}};if(w!==void 0){let P=await this._host.verifyRequestState(w,E,e);if(P!==void 0)E=r0(E,P)}let A=await t(n,E);if(!os(A))return A;R=A}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let n=e.params;if(n.mode==="url"&&n.elicitationId===void 0)n={...n,elicitationId:VH()};return await this._host.sendElicitation(n,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},QH=new Set(["tools/call","prompts/get","resources/read"]),YH,XH,eG;var tG=class extends i0{_clientCapabilities;_clientVersion;static{YH=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},XH=(e,t)=>{let n=t.filter((s)=>!e._supportedProtocolVersions.includes(s));if(n.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...n];e.setRequestHandler("server/discover",()=>e._ondiscover())},eG=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new KH({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,n)=>this._verifyRequestState(e,t,n),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Dm,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=JH(t?.inputRequired),t?.cacheHints!==void 0){for(let[n,s]of Object.entries(t.cacheHints))if(s!==void 0)Kz(s,`cacheHints['${n}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(n)=>this._oninitialize(n)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Hv(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}async connect(e){if(this.transport!==void 0)throw new bt(wt.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(e)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let n=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:s}=e.params,c=Om(lo,s);if(c.success)this._loggingLevels.set(n,c.data);return{}})}buildContext(e,t){let n=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(s,c,d)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[ro],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(a!==void 0&&this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(a))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:s,data:c,logger:d}})},elicitInput:(s,c)=>this.elicitInput(s,c),requestSampling:(s,c)=>this.createMessage(s,c)},http:n?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(lo.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1};registerCapabilities(e){if(this.transport)throw new bt(wt.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=o0(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let n=this._cacheHints?.[e],s=QH.has(e);if(n===void 0&&!s)return async(c,d)=>{let a=await t(c,d);if(os(a))throw new xt(st.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a};return async(c,d)=>{let a=s?await this._invokeInputRequiredCapableHandler(e,t,c,d):await t(c,d);if(os(a)){if(!s)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return n===void 0?a:Vz(a,n)}}return async(n,s)=>{let c=Ra(this._negotiatedProtocolVersion),d=c.validateRequest("tools/call",n);if(!d.ok)throw new xt(d.reason==="not-in-era"?st.InternalError:st.InvalidParams,d.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${d.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,n,s);if(os(a))return a;let h=Gv(a),R=c.validateResult("tools/call",h);if(!R.ok)throw new xt(R.reason==="not-in-era"?st.InternalError:st.InvalidParams,R.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${R.message}`);return R.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&ql(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,n,s){let c=this._servedModernEra(),d=s.mcpReq.requestState();if(d!==void 0&&typeof d!=="string")throw new xt(st.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=s;if(typeof d==="string"){let m=await this._verifyRequestState(d,s,e);if(m!==void 0)a=r0(s,m)}let h;try{h=await t(n,a)}catch(m){if(m instanceof xt&&m.code===st.UrlElicitationRequired){if(!c)throw m;throw new xt(st.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw m}if(!os(h))return h;if(!c){if(!this._inputRequiredServing.legacyShim)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??ts}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,n,a,h)}let R=h.inputRequests,b=R!=null&&Object.keys(R).length>0,S=typeof h.requestState==="string";if(!b&&!S)throw new xt(st.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(b){let m=this._inputRequestCapabilityView(s);for(let[w,x]of Object.entries(R)){let{embedded:E,required:A}=w_(e,w,x),P=zm(A,m);if(P!==void 0)throw new _m({requiredCapabilities:P},`Cannot request input '${w}' (${E.method}): the request's client capabilities do not declare the required capability`)}}return h}async _verifyRequestState(e,t,n){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(s){throw this.onerror?.(Error(`requestState verification rejected ${n}: ${s instanceof Error?s.message:String(s)}`)),new xt(st.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Ii]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new bt(wt.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new bt(wt.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new bt(wt.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new bt(wt.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new bt(wt.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new bt(wt.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new bt(wt.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new bt(wt.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new bt(wt.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new bt(wt.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new bt(wt.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new bt(wt.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new bt(wt.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new bt(wt.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let n=Lz(this._supportedProtocolVersions),s=n.includes(t)?t:n[0]??ts;return this._negotiatedProtocolVersion=s,this.transport?.setProtocolVersion?.(s),{protocolVersion:s,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Hv(this._supportedProtocolVersions),capabilities:nG(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new bt(wt.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let d=e.messages.at(-1),a=Array.isArray(d.content)?d.content:[d.content],h=a.some((m)=>m.type==="tool_result"),R=e.messages.length>1?e.messages.at(-2):void 0,b=R?Array.isArray(R.content)?R.content:[R.content]:[],S=b.some((m)=>m.type==="tool_use");if(h){if(a.some((m)=>m.type!=="tool_result"))throw new xt(st.InvalidParams,"The last message must contain only tool_result content if any is present");if(!S)throw new xt(st.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(S){let m=new Set(b.filter((x)=>x.type==="tool_use").map((x)=>x.id)),w=new Set(a.filter((x)=>x.type==="tool_result").map((x)=>x.toolUseId));if(m.size!==w.size||![...m].every((x)=>w.has(x)))throw new xt(st.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let n=Boolean(e.tools||e.toolChoice),s=await this.request({method:"sampling/createMessage",params:e},t),c=this._wireCodec().samplingResultVariant(n,s);if(!c.ok)throw new bt(wt.InvalidResult,`Invalid sampling/createMessage result: ${c.reason==="invalid"?c.message:c.reason}`);return c.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new bt(wt.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new bt(wt.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,n){let s=e.mode??"form",c=n?.validateAcceptedContent??!0;switch(s){case"url":{let d=e;return this.request({method:"elicitation/create",params:d},t)}case"form":{let d=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:d},t);if(c&&a.action==="accept"&&a.content&&d.requestedSchema)try{let h=this._jsonSchemaValidator.getValidator(d.requestedSchema)(a.content);if(!h.valid)throw new xt(st.InvalidParams,`Elicitation response content does not match requested schema: ${h.errorMessage}`)}catch(h){if(h instanceof xt)throw h;throw new xt(st.InternalError,`Error validating elicitation response: ${h instanceof Error?h.message:String(h)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new bt(wt.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function nG(e){return{...e}}var a0=r.object({interfaceType:r.string(),interfaceId:r.string().optional(),actor:Xt,displayName:r.string().optional(),conversationId:r.string().optional(),channelId:r.string().optional(),channelName:r.string().optional(),runId:r.string().optional(),toolCallId:r.string().optional(),userPermissionLevel:r.enum(["admin","trusted","public"]).optional(),isAnchor:r.boolean().optional()}),R_=r.object({...a0.shape,toolName:r.string(),args:r.unknown(),progressToken:r.union([r.string(),r.number()]).optional(),sendProgress:r.custom((e)=>typeof e==="function").optional(),signal:r.custom((e)=>e instanceof AbortSignal).optional()}),jm=r.strictObject({success:r.literal(!0),data:r.unknown().optional(),message:r.string().optional(),completionDetail:r.string().optional(),cached:r.literal(!0).optional()}),c0=r.strictObject({success:r.literal(!1),error:r.string(),code:r.string().optional()}),Nm=r.strictObject({needsConfirmation:r.literal(!0),toolName:r.string(),summary:r.string(),completionSummary:r.string().optional(),preview:r.string().optional(),text:r.string().optional(),args:r.unknown()}),Fl=r.union([jm,c0,Nm]);var O6e=r.union([r.looseObject({success:r.literal(!0)}),r.object({success:r.literal(!1),error:r.string()})]);var T_=r.union([r.object({success:r.literal(!0),data:r.unknown(),message:r.string().optional()}),r.object({success:r.literal(!1),error:r.string(),code:r.string().optional()})]);var uG=r.strictObject({field:r.string().min(1).max(100),direction:r.enum(["asc","desc"]),nullsFirst:r.boolean().optional(),nullsLast:r.boolean().optional()}),u0=r.array(r.string().min(1)).optional(),LBe=r.strictObject({weight:r.number().optional(),embeddable:r.boolean().optional(),fullTextSearchable:r.boolean().optional(),includeInBroadSearch:r.boolean().optional(),binaryStorage:r.enum(["data-url","asset"]).optional(),storage:r.enum(["markdown","yaml"]).optional(),defaultSort:r.array(uG).max(10).optional(),markdownImport:r.boolean().optional(),contentRepo:r.boolean().optional(),retiredFields:u0,translatedFields:u0,actionPolicy:Kc.optional(),projectionSource:r.boolean().optional(),projectionSourceRole:r.enum(["canonical","primary","secondary","supporting","ambient","excluded"]).optional(),containedIn:r.string().min(1).optional(),memberGroup:r.strictObject({label:r.string().min(1),multiple:r.boolean()}).optional(),consumesSources:u0,requiresGroupingMembership:r.boolean().optional(),publish:r.strictObject({publishStatuses:r.array(r.string().min(1)),requiredFields:r.array(r.string().min(1)).optional()}).optional()});var dG=r.strictObject({from:r.strictObject({entityType:r.string().min(1),status:r.string().min(1).optional(),limit:r.number().int().min(1).max(100)}),mode:r.enum(["each","batch"])});var pG=r.object({grouping:r.string().describe("The key of the grouping chosen"),value:r.string().describe("The one value chosen in that grouping")});var tqe=Symbol("rizom.entity-runtime");var nqe=Symbol("rizom.ordinary-create"),rqe=Symbol("rizom.queued-create"),iqe=Symbol("rizom.stored-create"),oqe=Symbol("rizom.contract-job"),sqe=Symbol("rizom.deduplicated-generation");var aqe=Symbol("rizom.entity-answers");var cqe=Symbol("rizom.body-template");var lqe=Symbol("rizom.display-title");var uqe=Symbol("rizom.persist-validator");var dqe=Symbol("rizom.folder-titles");var pqe=Symbol("rizom.restated-metadata");var fqe=Symbol("rizom.url-route");var mqe=Symbol("rizom.published-statuses");var hqe=Symbol("rizom.unpublished-statuses");var gqe=Symbol("rizom.frontmatter-schema");var yqe=Symbol("rizom.after-generation");var{AsyncLocalStorage:Oqe}=(()=>({}));var z_=r.object({entityType:r.string().min(1),ids:r.array(r.string().min(1)).min(1)});var Qqe=OS(r.unknown()).extend({entityId:r.string().optional(),source:z_.optional()}),Yqe=r.object({legacyRawData:r.literal(!0),input:r.unknown(),entityId:r.string().optional(),source:z_.optional()});var _3e=Symbol("rizom.studio-workspace-executor");var $3e=r.json();var f0=r.enum(["text","url","number","checkbox","select","textarea"]),EG=f0.exclude(["select","textarea"]);var nt=r.string().trim().min(1).max(120),pi=r.string().trim().min(1).max(400),Xe=r.string().trim().min(1).max(160),ln=r.string().max(500),Hr=r.string().max(4000),D_=r.string().max(1e5),mo=r.number().finite().min(0).max(1),pn=r.enum(["good","warn","neutral","error"]),Zl=r.union([r.string().max(2000),r.number().finite(),r.boolean(),r.null()]),m0=r.object({label:Xe,value:r.union([r.string().max(500),r.number().finite()]),caption:ln.optional(),tone:pn.optional()}).strict(),h0=r.object({type:r.literal("stats"),id:nt.optional(),items:r.array(m0).max(20).readonly()}).strict(),CG=r.object({label:Xe,value:Zl}).strict(),g0=r.object({type:r.literal("key-values"),id:nt.optional(),items:r.array(CG).max(40).readonly()}).strict(),y0=r.object({type:r.literal("notice"),id:nt.optional(),title:Xe.optional(),text:Hr,details:r.array(D_).max(50).readonly().optional(),tone:pn.optional()}).strict(),AG=r.string().max(2048).refine((e)=>{try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}},"Expected an http or https address"),j_=r.object({type:r.literal("webpage"),id:nt.optional(),title:Xe,url:AG,caption:Xe.optional(),tag:Xe.optional()}).strict(),N_=r.object({type:r.literal("text"),id:nt.optional(),label:Xe.optional(),text:D_,truncated:r.boolean().optional()}).strict(),PG=r.object({id:nt,label:Xe,value:r.number().finite().nonnegative(),max:r.number().finite().positive().optional(),unit:Xe.optional(),tone:pn.optional()}).strict().superRefine((e,t)=>{if(e.max!==void 0&&e.value>e.max)t.addIssue({code:"custom",message:"Meter value cannot exceed its maximum",path:["value"]})}),b0=r.object({type:r.literal("meters"),id:nt,items:r.array(PG).max(30).readonly()}).strict(),S0=r.object({type:r.literal("progress"),id:nt,label:Xe,state:Xe,detail:Hr.optional(),startedAt:r.string().datetime().optional(),updatedAt:r.string().datetime().optional(),progress:mo.optional(),tone:pn.optional()}).strict(),IG=r.object({id:nt,label:Xe,value:r.number().finite().nonnegative().nullable(),marker:Xe.optional(),tone:pn.optional()}).strict(),v0=r.object({type:r.literal("series"),id:nt,label:Xe,unit:Xe.optional(),points:r.array(IG).min(1).max(370).readonly()}).strict(),kG=r.object({id:pi,at:r.iso.datetime({offset:!0}),title:Xe,tone:pn.optional(),target:pi.optional()}).strict(),MG=r.object({label:Xe,tone:pn.optional()}).strict(),B_=r.object({type:r.literal("timeline"),id:nt,label:Xe,start:r.iso.datetime({offset:!0}),end:r.iso.datetime({offset:!0}),legend:r.array(MG).max(6).readonly().optional(),items:r.array(kG).max(500).readonly()}).strict().refine((e)=>Date.parse(e.start)<Date.parse(e.end),{message:"Timeline start must come before its end",path:["end"]});var q_=r.string().max(2048).refine((e)=>{try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}},{message:"External operator links must use http or https"});function zG(e){return e!==null&&typeof e==="object"&&"kind"in e&&e.kind==="rizom-entity"&&"type"in e&&typeof e.type==="string"&&e.type.length>0}var _G=r.custom(zG,{message:"Expected an imported entity definition"});function OG(e){return e!==null&&typeof e==="object"&&"kind"in e&&e.kind==="rizom-entity-catalog"&&"id"in e&&typeof e.id==="string"&&"label"in e&&typeof e.label==="string"}var DG=r.custom(OG,{message:"Expected an imported entity catalog definition"});function jG(e){return{kind:"external",href:e.external}}function NG(e){return{kind:"entity",entityType:e.entity.type,id:e.id}}var L_=r.union([r.object({target:r.literal("account-settings")}).strict(),r.object({target:r.literal("invitations")}).strict(),r.object({target:r.literal("admin-peer-invite"),peerId:nt,displayName:Xe}).strict(),r.object({target:r.literal("inbox")}).strict(),r.object({target:r.literal("inbox"),source:r.literal("mail"),filter:r.enum(["high-priority","needs-reply","unclassified"]).optional()}).strict(),r.object({target:r.literal("publishing")}).strict(),r.object({target:r.literal("site")}).strict(),r.object({target:r.literal("traffic")}).strict(),r.object({target:r.literal("board")}).strict(),r.object({target:r.literal("memory"),channel:r.string().trim().min(1).max(300).optional(),selected:pi.optional()}).strict(),r.object({target:r.literal("inbox-open-entity"),entityType:nt,entityId:nt}).strict(),r.object({target:r.literal("inbox-capture-note"),title:ln,summary:r.string().trim().min(1).max(1000).optional(),entityType:nt,entityId:nt}).strict(),r.object({target:r.literal("inbox-track-action-item"),sourceId:nt,title:ln,summary:r.string().trim().min(1).max(1000).optional(),entityType:nt,entityId:nt}).strict(),r.object({target:r.literal("inbox-discuss-in-chat"),sourceId:nt,itemId:r.string().trim().min(1).max(300),label:r.string().trim().min(1).max(160)}).strict(),r.object({target:r.literal("ask-in-chat"),question:r.string().trim().min(1).max(500)}).strict()]);function BG(e){return{kind:"entity",entityType:e.entityType,id:e.id}}function qG(e){return{kind:"launch",launch:e.launch}}function LG(e){return{kind:"detail",itemId:e.detail.itemId}}var Ul=r.union([r.object({external:q_}).strict().transform(jG),r.object({entity:_G,id:nt}).strict().transform(NG),r.object({catalog:DG,entityType:nt,id:nt}).strict().transform(BG),r.object({launch:L_}).strict().transform(qG),r.object({detail:r.object({itemId:pi}).strict()}).strict().transform(LG),r.object({kind:r.literal("external"),href:q_}).strict(),r.object({kind:r.literal("entity"),entityType:nt,id:nt}).strict(),r.object({kind:r.literal("launch"),launch:L_}).strict(),r.object({kind:r.literal("detail"),itemId:pi}).strict()]);function lr(e,t,n,s){let[c,d]=s.path,a=new Set;for(let[h,R]of t.entries()){let b=n(R);if(b!==void 0){if(a.has(b)||s.reserved?.has(b))e.addIssue({code:"custom",message:`${s.label} "${b}" is duplicated`,path:[c,h,d]});a.add(b)}s.each?.(R,h)}return a}function $_(e,t){return lr(e,t,(n)=>n.id,{label:"Spatial point id",path:["points","id"]})}var F_=r.object({label:Xe,tone:pn.optional()}).strict(),Z_=r.object({sourceId:nt,targetId:nt,label:Xe.optional(),tone:pn.optional()}).strict(),$G=r.object({id:nt,label:Xe,category:Xe,x:mo,y:mo,zoneId:nt.optional(),tone:pn.optional(),details:r.array(ln).max(20).optional()}).strict(),FG=r.object({id:nt,label:Xe,x:mo,y:mo,memberIds:r.array(nt).max(500)}).strict(),ZG=r.object({type:r.literal("spatial"),layout:r.literal("cartesian"),id:nt,label:Xe,description:Hr,points:r.array($G).max(500),zones:r.array(FG).max(100),relationships:r.array(Z_).max(2000).optional(),legend:r.array(F_).max(20)}).strict().superRefine((e,t)=>{let n=$_(t,e.points),s=lr(t,e.zones,(d)=>d.id,{label:"Spatial zone id",path:["zones","id"],reserved:n,each:(d,a)=>{for(let h of d.memberIds)if(!n.has(h))t.addIssue({code:"custom",message:`Spatial zone member "${h}" has no matching point`,path:["zones",a,"memberIds"]})}});for(let[d,a]of e.points.entries())if(a.zoneId&&!s.has(a.zoneId))t.addIssue({code:"custom",message:`Spatial point zone "${a.zoneId}" has no matching zone`,path:["points",d,"zoneId"]});let c=new Set([...n,...s]);for(let[d,a]of(e.relationships??[]).entries())if(!c.has(a.sourceId)||!c.has(a.targetId))t.addIssue({code:"custom",message:"Spatial relationship endpoints must reference declared points or zones",path:["relationships",d]})}),UG=r.object({id:nt,label:Xe,kind:Xe,status:Xe,tags:r.array(Xe).max(30).optional(),distance:mo,bearing:r.number().finite().min(0).lt(360),relatedIds:r.array(nt).max(100).optional(),tone:pn.optional(),details:r.array(ln).max(20).optional()}).strict(),WG=r.object({id:nt,label:Xe,memberIds:r.array(nt).min(2).max(500)}).strict(),HG=r.object({id:nt,label:Xe,maxDistance:mo}).strict(),GG=r.object({type:r.literal("spatial"),layout:r.literal("radial"),id:nt,label:Xe,description:Hr,centerLabel:Xe,centerKind:r.enum(["identity","centroid"]),points:r.array(UG).max(500),clusters:r.array(WG).max(100).optional(),relationships:r.array(Z_).max(2000).optional(),strata:r.array(HG).min(1).max(10),legend:r.array(F_).max(20)}).strict().superRefine((e,t)=>{let n=$_(t,e.points);for(let[c,d]of e.points.entries())for(let a of d.relatedIds??[])if(!n.has(a))t.addIssue({code:"custom",message:`Related point "${a}" is not declared`,path:["points",c,"relatedIds"]});lr(t,e.clusters??[],(c)=>c.id,{label:"Spatial cluster id",path:["clusters","id"],each:(c,d)=>{for(let a of c.memberIds)if(!n.has(a))t.addIssue({code:"custom",message:`Spatial cluster member "${a}" has no matching point`,path:["clusters",d,"memberIds"]})}});for(let[c,d]of(e.relationships??[]).entries())if(!n.has(d.sourceId)||!n.has(d.targetId))t.addIssue({code:"custom",message:"Spatial relationship endpoints must reference declared points",path:["relationships",c]});let s=-1;for(let[c,d]of e.strata.entries()){if(d.maxDistance<=s)t.addIssue({code:"custom",message:"Radial strata must increase by maximum distance",path:["strata",c,"maxDistance"]});s=d.maxDistance}}),w0=r.discriminatedUnion("layout",[ZG,GG]);var JG=r.object({id:nt,label:Xe,value:Zl.optional(),description:Hr.optional(),tone:pn.optional()}).strict(),W_=r.object({type:r.literal("group"),id:nt,label:Xe,items:r.array(JG).max(50)}).strict(),VG=r.object({id:nt,label:Xe,status:r.enum(["idle","active","complete","failed"]),detail:ln.optional()}).strict(),H_=r.object({type:r.literal("flow"),id:nt,label:Xe,direction:r.enum(["forward","bidirectional"]).optional(),steps:r.array(VG).min(2).max(20)}).strict(),G_=r.string().trim().min(1).max(120).regex(/^[a-z][a-zA-Z0-9_.-]*$/),KG=r.object({value:Xe,label:Xe,count:r.number().int().nonnegative().optional()}).strict(),J_=r.object({key:G_,label:Xe,value:Xe.optional(),allLabel:Xe.optional(),options:r.array(KG).max(100)}).strict(),QG=r.object({key:G_,label:Xe,value:r.string().max(200).optional(),placeholder:Xe.optional()}).strict(),V_=r.object({search:QG.optional(),controls:r.array(J_).max(20),pagination:r.object({offset:r.number().int().nonnegative(),limit:r.number().int().min(1).max(100),total:r.number().int().nonnegative(),label:Xe.optional()}).strict().optional()}).strict();function K_(e,t){let n=lr(t,e.controls,(s)=>s.key,{label:"Query key",path:["controls","key"]});if(e.search&&n.has(e.search.key))t.addIssue({code:"custom",message:`Query key "${e.search.key}" is duplicated`,path:["search","key"]})}var YG=V_.extend({type:r.literal("query"),id:nt}).strict().superRefine(K_),XG=V_.superRefine(K_),Q_=r.object({type:r.literal("links"),id:nt.optional(),items:r.array(r.object({label:Xe,target:Ul}).strict()).max(30)}).strict(),Y_=r.object({label:Xe,tone:pn.optional()}).strict(),eJ=r.object({value:nt,label:Xe,count:r.number().int().nonnegative().optional(),emphasis:r.literal("gap").optional()}).strict(),R0=200,X_=50,tJ=R0*X_+1,nJ=r.object({label:Xe,defaultValue:nt,allValue:nt.optional(),options:r.array(eJ).min(1).max(tJ)}).strict().superRefine((e,t)=>{if(!lr(t,e.options,(s)=>s.value,{label:"List filter value",path:["options","value"]}).has(e.defaultValue))t.addIssue({code:"custom",message:`List filter default "${e.defaultValue}" has no matching option`,path:["defaultValue"]})}),Bm=r.object({id:pi,title:ln,description:Hr.optional(),metadata:r.array(ln).max(20).optional(),tags:r.array(Xe).max(30).optional(),at:r.iso.datetime({offset:!0}).optional(),count:r.number().finite().optional(),badges:r.array(Y_).max(10).optional(),filterValues:r.array(nt).max(X_).optional(),links:r.array(r.object({label:Xe,target:Ul}).strict()).max(10).optional(),tone:pn.optional(),link:Ul.optional()}).strict(),rJ=r.enum(["standard","editorial","attention","activity","log","ranked","chips"]),eO=r.object({type:r.literal("list"),id:nt,empty:ln,presentation:rJ.optional(),unit:Xe.optional(),filter:nJ.optional(),items:r.array(Bm).max(R0)}).strict();function tO(e,t){if(lr(t,e.items,(c)=>c.id,{label:"List item id",path:["items","id"]}),!e.filter)return;let n=new Set(e.filter.options.map((c)=>c.value)),s=e.filter.allValue??"all";for(let[c,d]of e.items.entries())for(let a of d.filterValues??[])if(a!==s&&!n.has(a))t.addIssue({code:"custom",message:`List item filter value "${a}" has no matching option`,path:["items",c,"filterValues"]})}var iJ=eO.superRefine(tO),nO=r.object({key:nt,label:Xe,align:r.enum(["start","center","end"]).optional()}).strict(),rO=r.object({key:nt,label:Xe,values:r.array(Zl).max(50)}).strict(),oJ=r.union([Zl,r.array(r.string().max(500)).max(50)]),sJ=r.object({title:ln.trim().min(1),description:Hr.optional(),metadata:r.array(ln).max(20).optional(),badges:r.array(Y_).max(10).optional(),count:r.number().finite().optional(),tone:pn.optional()}).strict(),iO=r.object({id:pi,cells:r.record(r.string(),oJ),link:Ul.optional()}).strict(),aJ=r.object({type:r.literal("table"),id:nt,empty:ln,filters:r.array(rO).max(20).optional(),columns:r.array(nO).min(1).max(30),rows:r.array(iO).max(500)}).strict();function oO(e,t){let n=lr(t,e.columns,(s)=>s.key,{label:"Table column key",path:["columns","key"]});for(let[s,c]of(e.filters??[]).entries())if(!n.has(c.key))t.addIssue({code:"custom",message:`Table filter key "${c.key}" has no matching column`,path:["filters",s,"key"]});lr(t,e.rows,(s)=>s.id,{label:"Table row id",path:["rows","id"],each:(s,c)=>{for(let d of Object.keys(s.cells))if(!n.has(d))t.addIssue({code:"custom",message:`Table cell key "${d}" has no matching column`,path:["rows",c,"cells",d]})}})}var cJ=aJ.superRefine(oO),sO=r.object({id:nt,label:Xe,tone:pn.optional(),empty:ln,items:r.array(Bm).max(100)}).strict();function aO(e,t){lr(t,e.items,(n)=>n.id,{label:"Matrix item id",path:["items","id"]})}var lJ=sO.superRefine(aO),cO=r.object({type:r.literal("matrix"),id:nt,columns:r.union([r.literal(1),r.literal(2),r.literal(3),r.literal(4)]).optional(),cells:r.array(lJ).min(1).max(12)}).strict();function lO(e,t){lr(t,e.cells,(n)=>n.id,{label:"Matrix cell id",path:["cells","id"]})}var uJ=cO.superRefine(lO);function uO(e,t){if(!lr(t,e.tabs,(s)=>s.id,{label:"Tab id",path:["tabs","id"]}).has(e.defaultTab))t.addIssue({code:"custom",message:`Default tab "${e.defaultTab}" has no matching tab`,path:["defaultTab"]})}function dO(e,t){lr(t,e.blocks,(n)=>n.id,{label:"Operator view block id",path:["blocks","id"]})}var pO=r.union([h0,g0,y0,W_,H_,b0,S0,v0,Q_,iJ,cJ,uJ,w0]),dJ=r.object({type:r.literal("tabs"),id:nt,label:Xe,defaultTab:nt,tabs:r.array(r.object({id:nt,label:Xe,count:r.number().int().nonnegative().optional(),blocks:r.array(pO).max(30)}).strict()).min(1).max(12)}).strict().superRefine(uO);function pJ(e){return e!==null&&typeof e==="object"&&"kind"in e&&e.kind==="rizom-workspace-action"&&"name"in e&&typeof e.name==="string"&&"input"in e&&typeof e.input==="object"&&e.input!==null&&"safeParse"in e.input&&typeof e.input.safeParse==="function"}var fJ=r.custom(pJ,{message:"Expected a workspace action definition"}),mJ=r.object({id:nt,label:Xe,description:Hr.optional(),confirmation:r.literal("prepared").optional()}).strict(),U_=r.object({value:r.string().trim().min(1).max(500),label:Xe}).strict(),hJ=r.object({label:Xe,control:f0,secret:r.boolean().optional(),options:r.array(U_).min(1).max(100).optional(),labelBy:r.object({field:nt,values:r.array(U_).min(1).max(100)}).strict().optional()}).strict(),gJ=r.object({presentation:r.enum(["inline","disclosure"]).optional(),submitLabel:Xe.optional(),fields:r.record(nt,hJ)}).strict(),yJ=r.object({label:Xe,copyable:r.boolean().optional(),sensitive:r.boolean().optional()}).strict(),bJ=r.object({title:Xe,fields:r.record(nt,yJ)}).strict(),xa=r.object({action:fJ,input:r.unknown().optional(),form:gJ.optional(),result:bJ.optional(),capability:mJ.optional(),label:Xe.optional(),disabled:r.boolean().optional(),destructive:r.boolean().optional()}).strict(),SJ=Bm.extend({actionsLabel:Xe.optional(),actions:r.array(xa).max(20).optional()}),fO=eO.extend({items:r.array(SJ).max(R0)}).superRefine(tO),vJ=iO.extend({compact:sJ.optional(),actions:r.array(xa).max(20).optional()}),mO=r.object({type:r.literal("table"),id:nt,empty:ln,filters:r.array(rO).max(20).optional(),query:XG.optional(),columns:r.array(nO).min(1).max(30),rows:r.array(vJ).max(500)}).strict().superRefine(oO),wJ=xa.extend({dropTarget:nt.optional()}),RJ=Bm.extend({actionsLabel:Xe.optional(),actions:r.array(wJ).max(20).optional()}),TJ=sO.extend({items:r.array(RJ).max(100)}).superRefine(aO);function xJ(e,t){let n=new Set(e.cells.map((s)=>s.id));e.cells.forEach((s,c)=>s.items.forEach((d,a)=>{let h=new Set;(d.actions??[]).forEach((R,b)=>{let S=R.dropTarget;if(S===void 0)return;let m=!n.has(S)?`Drop target "${S}" is not a cell of this matrix`:S===s.id?`Drop target "${S}" is the card's own cell`:h.has(S)?`Drop target "${S}" has more than one action on this card`:R.action.confirmation!==void 0||R.form!==void 0?`Drop target "${S}" needs an action that runs without confirmation or a form`:void 0;if(h.add(S),m)t.addIssue({code:"custom",message:m,path:["cells",c,"items",a,"actions",b,"dropTarget"]})})}))}var hO=cO.extend({cells:r.array(TJ).min(1).max(12)}).superRefine(lO).superRefine(xJ),EJ=xa.extend({type:r.literal("action"),id:nt.optional()}),CJ=r.object({type:r.literal("actions"),id:nt.optional(),items:r.array(xa).max(30)}).strict(),Ta=r.union([h0,g0,y0,j_,N_,W_,H_,b0,S0,v0,B_,YG,Q_,fO,mO,hO,w0,EJ,CJ]),AJ=r.object({type:r.literal("tabs"),id:nt,label:Xe,defaultTab:nt,queryKey:nt.optional(),tabs:r.array(r.object({id:nt,label:Xe,count:r.number().int().nonnegative().optional(),blocks:r.array(r.lazy(()=>r.union([Ta,Wl,gO,yO]))).max(30)}).strict()).min(1).max(12)}).strict().superRefine(uO),Wl=r.object({disclosureLabel:Xe.optional(),type:r.literal("card"),id:nt,label:Xe,presentation:r.enum(["section","disclosure","feature"]).optional(),metadata:r.array(ln).max(20).optional(),summary:r.array(m0).max(4).optional(),tone:pn.optional(),blocks:r.array(Ta).max(12)}).strict().refine((e)=>e.disclosureLabel===void 0||e.presentation==="disclosure",{message:"disclosureLabel requires disclosure presentation",path:["disclosureLabel"]}),gO=r.object({type:r.literal("detail"),id:nt,queryKey:nt,empty:ln,master:r.union([fO,mO,hO]),open:r.object({forId:pi,title:Xe,blocks:r.array(r.union([Ta,Wl])).max(30)}).strict().optional()}).strict(),yO=r.object({type:r.literal("columns"),id:nt,primary:r.array(r.union([Ta,Wl])).max(20),aside:r.array(r.union([Ta,Wl])).max(12)}).strict(),mLe=r.object({kicker:Xe.optional(),title:ln.optional(),description:Hr.optional(),status:r.object({label:Xe,detail:ln.optional(),tone:pn.optional()}).strict().optional(),facts:r.array(r.object({label:Xe,tone:pn.optional()}).strict()).max(6).optional(),primaryAction:xa.optional(),headQuery:J_.optional(),blocks:r.array(r.union([Ta,AJ,gO,yO,Wl])).max(50)}).strict().superRefine(dO),PJ=r.object({title:ln.optional(),blocks:r.array(r.union([pO,dJ])).max(50)}).strict().superRefine(dO),IJ=r.object({items:r.array(r.object({label:Xe,value:r.string().max(500),tone:r.enum(["good","warn"]).optional()}).strict()).max(4),attention:r.number().int().nonnegative().optional()}).strict(),hLe=r.object({view:PJ,digest:IJ.optional()}).strict();var FLe=Object.freeze({config:Object.freeze({}),state:Object.freeze({}),accountSettings:void 0});var NJ=r.looseObject({id:r.string().optional(),limit:r.number().optional(),page:r.number().optional(),pageSize:r.number().optional(),baseUrl:r.string().optional()}),VLe=r.looseObject({entityType:r.string().optional(),query:NJ.optional()});var p8e=r.object({publishedOnly:r.boolean().optional()}),f8e=Symbol("data source read chain"),m8e=r.array(r.string());var S$e={"startup-content-settled":li.startupContentSettled},v$e=r.record(r.string(),r.unknown());var w$e=r.string().min(1).refine((e)=>!e.startsWith("/")&&!e.includes("\\")&&e.split("/").every((t)=>t!==""&&t!==".."),{message:"A feed path is relative to the build output"}),R$e=r.object({items:r.array(r.object({operation:r.enum(["upsert","delete"]),id:r.string(),source:Vo.optional()}))});var T$e=Object.freeze({config:Object.freeze({}),state:Object.freeze({}),accountSettings:void 0});var x$e=r.object({});var z$e=r.object({});var{AsyncLocalStorage:jFe}=(()=>({}));var VJ=Symbol("service-content-target");mn();var KJ=Object.freeze({ttlMs:600000,maxPending:20});var qm="[secret]",QJ=Symbol.for("nodejs.util.inspect.custom");class YJ{#e;constructor(e){this.#e=e,Object.defineProperty(this,QJ,{value:()=>qm}),Object.freeze(this)}reveal(){return this.#e}toJSON(){return qm}toString(){return qm}[Symbol.toPrimitive](){return qm}}mn();var h4e=r.object({url:r.string()});var g4e=Symbol("rizom.workspace-action-executor");var j4e=r.object({actionId:r.string().trim().min(1).max(120),input:r.unknown(),mode:r.enum(["prepare","execute"]).default("execute"),confirmationToken:r.string().uuid().optional()}).strict(),N4e=r.object({capability:r.object({confirmation:r.literal("prepared").optional()})}).passthrough(),B4e=r.array(r.string().trim().min(1).max(120)).max(200).transform((e)=>[...new Set(e)]),q4e=r.object({summary:r.string().trim().min(1).max(500),revision:r.string().trim().min(1).max(500)}),L4e=r.json(),$4e=r.object({url:r.string()});var F4e=Object.freeze({config:Object.freeze({}),state:Object.freeze({}),accountSettings:void 0});var G4e=r.string().min(1).refine((e)=>Buffer.from(e).toString("utf8")===e,"State owner must be well-formed Unicode");var rFe=Symbol("rizom.first-party-service-runtime");function Lm(e){let t=new WeakMap;return{register:(n,s,c)=>{t.set(n,{declarations:s,rebuild:c})},rebuildWith:(n,s,c)=>{let d=t.get(n);if(!d)throw Error(`${s} takes a definition ${e} returned; "${n.id}" is not one`);return d.rebuild(c(d.declarations))}}}var cFe=r.record(r.string(),r.unknown());var SO=Object.freeze({}),tV=Lm("defineServicePlugin"),nV=tV.register;var iV=r.union([r.string(),r.number(),r.boolean()]),SFe=r.record(r.string(),iV.optional());var SZe=r.object({issues:r.array(r.object({path:r.array(r.union([r.string(),r.number()]))}))});var{AsyncLocalStorage:IJe}=(()=>({}));var EO=Object.freeze({daemons:Object.freeze([])});var AV=Lm("defineInterface"),PV=AV.register;var XZe=Symbol("rizom.first-party-interface-runtime");var Hl="The AI provider declined this request. Try rephrasing your message.";class Gl extends Error{constructor(e){super(Hl,{cause:e});this.name="AIProviderDeclinedError"}}var IV=r.object({anthropic:r.string().min(1).optional(),openai:r.string().min(1).optional(),google:r.string().min(1).optional()}),Jl={anthropic:{label:"Anthropic",keyEnvVar:"ANTHROPIC_API_KEY",keyFormat:/^sk-ant-/},openai:{label:"OpenAI",keyEnvVar:"OPENAI_API_KEY",keyFormat:/^sk-(?:proj|svcacct|admin)-/},google:{label:"Google",keyEnvVar:"GOOGLE_GENERATIVE_AI_API_KEY",keyFormat:/^AIza/},local:{label:"the model runtime"}};var C0=["anthropic","openai","google"];function $m(e){let t=Jl[e].keyEnvVar;if(!t)throw Error(`${e} takes no key`);return t}var PO={provider:"openai",maxInputTokens:8191,maxRequestTokens:300000,maxRequestInputs:2048,promptRevision:0,query:(e)=>e,document:({content:e})=>e},w5e=new Map([{...PO,modelId:"text-embedding-3-small",dimensions:1536},{...PO,modelId:"text-embedding-3-large",dimensions:3072},{provider:"local",modelId:"embeddinggemma-2:270m",dimensions:768,maxInputTokens:2048,maxRequestTokens:32768,maxRequestInputs:64,promptRevision:1,query:(e)=>`task: search result | query: ${e}`,document:({title:e,content:t})=>`title: ${e??"none"} | text: ${t}`},{provider:"local",modelId:"nomic-embed-text:v1.5",dimensions:768,maxInputTokens:2048,maxRequestTokens:32768,maxRequestInputs:64,promptRevision:1,query:(e)=>`search_query: ${e}`,document:({content:e})=>`search_document: ${e}`}].map((e)=>{let t=`${e.provider}:${e.modelId}`;return[t,{model:t,...e}]}));mn();var I5e=r.custom(vn);var IO=r.enum(["application/pdf","application/epub+zip"]),kO=r.enum(["pending","draft","failed"]),A0=r.enum(["uploaded","rendered"]),MO=r.enum(["generated","owner"]),zO=r.object({title:r.string().optional(),description:r.string().optional(),descriptionSource:MO.optional().meta({studioWidget:"provenance"}),mimeType:IO.meta({studioWidget:"provenance"}),filename:r.string().min(1).meta({studioWidget:"provenance"}),pageCount:r.number().int().min(0).optional().meta({studioWidget:"provenance"}),sectionCount:r.number().int().min(0).optional().meta({studioWidget:"provenance"}),sizeBytes:r.number().int().min(0).optional().meta({studioWidget:"provenance"}),status:kO.optional().meta({studioWidget:"provenance"}),origin:A0.optional().meta({studioWidget:"provenance"}),processingJobId:r.string().optional().meta({studioWidget:"hidden"}),processingError:r.string().optional().meta({studioWidget:"provenance"}),sourceEntityType:r.string().min(1).optional().meta({studioWidget:"provenance"}),sourceEntityId:r.string().min(1).optional().meta({studioWidget:"provenance"}),sourceUploadId:r.string().optional().meta({studioWidget:"provenance"}),sourceFilename:r.string().optional().meta({studioWidget:"provenance"}),sourceMediaType:r.string().optional().meta({studioWidget:"provenance"}),attachmentType:r.string().min(1).optional().meta({studioWidget:"provenance"}),dedupKey:r.string().min(1).optional().meta({studioWidget:"hidden"})}),MV=Zc.extend({entityType:r.literal("document"),content:r.union([fr,r.string().regex(/^data:application\/pdf;base64,.+$/),r.literal("")]),metadata:zO});var{AsyncLocalStorage:h9e}=(()=>({}));var{AsyncLocalStorage:w9e}=(()=>({}));function GV(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function JV(){let e=GV();if(e.__xstate__)return e.__xstate__;return}var NO=(e)=>{if(typeof window>"u")return;let t=JV();if(t)t.register(e)};class k0{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){if(this._current)this._current.next=null,this._last=this._current}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}if(this._current=t,this._last=t,this._active)this.flush()}flush(){while(this._current){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}}var j0=".",VV="",N0="",KV="#",M0="*",ZO="xstate.init",UO="xstate.error",Kl="xstate.stop";function QV(e,t){return{type:`xstate.after.${e}.${t}`}}function z0(e,t){return{type:`xstate.done.state.${e}`,output:t}}function YV(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function B0(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function Zm(e){return{type:ZO,input:e}}function fi(e){setTimeout(()=>{throw e})}var XV=(()=>typeof Symbol==="function"&&Symbol.observable||"@@observable")();function WO(e,t){let n=BO(e),s=BO(t);if(typeof s==="string"){if(typeof n==="string")return s===n;return!1}if(typeof n==="string")return n in s;return Object.keys(n).every((c)=>{if(!(c in s))return!1;return WO(n[c],s[c])})}function Um(e){if(GO(e))return e;let t=[],n="";for(let s=0;s<e.length;s++){switch(e.charCodeAt(s)){case 92:n+=e[s+1],s++;continue;case 46:t.push(n),n="";continue}n+=e[s]}return t.push(n),t}function BO(e){if(CK(e))return e.value;if(typeof e!=="string")return e;let t=Um(e);return eK(t)}function eK(e){if(e.length===1)return e[0];let t={},n=t;for(let s=0;s<e.length-1;s++)if(s===e.length-2)n[e[s]]=e[s+1];else{let c=n;n={},c[e[s]]=n}return t}function q0(e,t){let n={},s=Object.keys(e);for(let c=0;c<s.length;c++){let d=s[c];n[d]=t(e[d],d,e,c)}return n}function HO(e){if(GO(e))return e;return[e]}function mi(e){if(e===void 0)return[];return HO(e)}function _0(e,t,n,s){if(typeof e==="function")return e({context:t,event:n,self:s});if(!!e&&typeof e==="object"&&Object.values(e).some((c)=>typeof c==="function"))console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.
|
|
133
133
|
Found object containing properties whose values are possibly mapping functions: ${Object.entries(e).filter(([,c])=>typeof c==="function").map(([c,d])=>`
|
|
134
134
|
- ${c}: ${d.toString().replace(/\n\s*/g,"")}`).join("")}`);return e}function GO(e){return Array.isArray(e)}function tK(e){return e.type.startsWith("xstate.error.actor")}function as(e){return HO(e).map((t)=>{if(typeof t>"u"||typeof t==="string")return{target:t};return t})}function JO(e){if(e===void 0||e===VV)return;return mi(e)}function Fm(e,t,n){let s=typeof e==="object",c=s?e:void 0;return{next:(s?e.next:e)?.bind(c),error:(s?e.error:t)?.bind(c),complete:(s?e.complete:n)?.bind(c)}}function L0(e,t){return`${t}.${e}`}function Yl(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,s,c]=n,a=e.getStateNodeById(c).config.invoke;return(Array.isArray(a)?a[s]:a).src}function VO(e,t){if(t===e)return!0;if(t===M0)return!0;if(!t.endsWith(".*"))return!1;if(/.*\*.+/.test(t))console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${t}" event.`);let n=t.split("."),s=e.split(".");for(let c=0;c<n.length;c++){let d=n[c],a=s[c];if(d==="*"){let h=c===n.length-1;if(!h)console.warn(`Infix wildcards in transition events are not allowed. Check the "${t}" transition.`);return h}if(d!==a)return!1}return!0}function qO(e,t){return`${e.sessionId}.${t}`}var nK=0;function KO(e,t){let n=new Map,s=new Map,c=new WeakMap,d=new Set,a={},{clock:h,logger:R}=t,b={schedule:(w,x,E,A,P=Math.random().toString(36).slice(2))=>{let M={source:w,target:x,event:E,delay:A,id:P,startedAt:Date.now()},z=qO(w,P);m._snapshot._scheduledEvents[z]=M;let _=h.setTimeout(()=>{delete a[z],delete m._snapshot._scheduledEvents[z],m._relay(w,x,E)},A);a[z]=_},cancel:(w,x)=>{let E=qO(w,x),A=a[E];if(delete a[E],delete m._snapshot._scheduledEvents[E],A!==void 0)h.clearTimeout(A)},cancelAll:(w)=>{for(let x in m._snapshot._scheduledEvents){let E=m._snapshot._scheduledEvents[x];if(E.source===w)b.cancel(w,E.id)}}},S=(w)=>{if(!d.size)return;let x={...w,rootId:e.sessionId};d.forEach((E)=>E.next?.(x))},m={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${nK++}`,_register:(w,x)=>(n.set(w,x),w),_unregister:(w)=>{n.delete(w.sessionId);let x=c.get(w);if(x!==void 0)s.delete(x),c.delete(w)},get:(w)=>s.get(w),getAll:()=>Object.fromEntries(s.entries()),_set:(w,x)=>{let E=s.get(w);if(E&&E!==x)throw Error(`Actor with system ID '${w}' already exists.`);s.set(w,x),c.set(x,w)},inspect:(w)=>{let x=Fm(w);return d.add(x),{unsubscribe(){d.delete(x)}}},_sendInspectionEvent:S,_relay:(w,x,E)=>{m._sendInspectionEvent({type:"@xstate.event",sourceRef:w,actorRef:x,event:E}),x._send(E)},scheduler:b,getSnapshot:()=>({_scheduledEvents:{...m._snapshot._scheduledEvents}}),start:()=>{let w=m._snapshot._scheduledEvents;m._snapshot._scheduledEvents={};for(let x in w){let{source:E,target:A,event:P,delay:M,id:z}=w[x];b.schedule(E,A,P,M,z)}},_clock:h,_logger:R};return m}var zi=!1,Wm=1,Xn=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({}),rK={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:(e)=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class QO{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new k0(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Xn.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...rK,...t},{clock:s,logger:c,parent:d,syncSnapshot:a,id:h,systemId:R,inspect:b}=n;if(this.system=d?d.system:KO(this,{clock:s,logger:c}),b&&!d)this.system.inspect(Fm(b));if(this.sessionId=this.system._bookId(),this.id=h??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=d,this._syncSnapshot=a,this.options=n,this.src=n.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:(S)=>{this._deferred.push(S)},system:this.system,stopChild:(S)=>{if(S._parent!==this)throw Error(`Cannot stop child actor ${S.id} of ${this.id} because it is not a child`);S._stop()},emit:(S)=>{let m=this.eventListeners.get(S.type),w=this.eventListeners.get("*");if(!m&&!w)return;let x=[...m?m.values():[],...w?w.values():[]];for(let E of x)try{E(S)}catch(A){fi(A)}},actionExecutor:(S)=>{let m=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:S.type,params:S.params}}),!S.exec)return;let w=zi;try{zi=!0,S.exec(S.info,S.params)}finally{zi=w}};if(this._processingStatus===Xn.Running)m();else this._deferred.push(m)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),R)this.systemId=R,this.system._set(R,this);if(this._initState(t?.snapshot??t?.state),R&&this._snapshot.status!=="active")this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(t){this._snapshot={status:"error",output:void 0,error:t}}}update(e,t){this._snapshot=e;let n;while(n=this._deferred.shift())try{n()}catch(s){this._deferred.length=0,this._snapshot={...e,status:"error",error:s}}switch(this._snapshot.status){case"active":for(let s of this.observers)try{s.next?.(e)}catch(c){fi(c)}break;case"done":for(let s of this.observers)try{s.next?.(e)}catch(c){fi(c)}if(this._stopProcedure(),this._complete(),this._doneEvent=YV(this.id,this._snapshot.output),this._parent)this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:t,snapshot:e})}subscribe(e,t,n){let s=Fm(e,t,n);if(this._processingStatus!==Xn.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(c){fi(c)}break;case"error":{let c=this._snapshot.error;if(!s.error)fi(c);else try{s.error(c)}catch(d){fi(d)}break}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(e,t){let n=this.eventListeners.get(e);if(!n)n=new Set,this.eventListeners.set(e,n);let s=t.bind(void 0);return n.add(s),{unsubscribe:()=>{n.delete(s)}}}select(e,t=Object.is){return{subscribe:(n)=>{let s=Fm(n),c=this.getSnapshot(),d=e(c);return this.subscribe((a)=>{let h=e(a);if(!t(d,h))d=h,s.next?.(h)})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===Xn.Running)return this;if(this._syncSnapshot)this.subscribe({next:(n)=>{if(n.status==="active")this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:n})},error:()=>{}});if(this.system._register(this.sessionId,this),this.systemId)this.system._set(this.systemId,this);this._processingStatus=Xn.Running;let e=Zm(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(!this._parent)this.system.start();if(this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(n){return this._snapshot={...this._snapshot,status:"error",error:n},this._error(n),this}if(this.update(this._snapshot,e),this.options.devTools)this.attachDevTools();return this.mailbox.start(),this}_process(e){let t,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(s){n={err:s}}if(n){let{err:s}=n;this._snapshot={...this._snapshot,status:"error",error:s},this._error(s);return}if(this.update(t,e),e.type===Kl)this._stopProcedure(),this._complete()}_stop(){if(this._processingStatus===Xn.Stopped)return this;if(this.mailbox.clear(),this._processingStatus===Xn.NotStarted)return this._processingStatus=Xn.Stopped,this;return this.mailbox.enqueue({type:Kl}),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(t){fi(t)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){if(!this._parent)fi(e);this.eventListeners.clear();return}let t=!1;for(let n of this.observers){let s=n.error;t||=!s;try{s?.(e)}catch(c){fi(c)}}if(this.observers.clear(),this.eventListeners.clear(),t)fi(e)}_error(e){if(this._stopProcedure(),this._reportError(e),this._parent)this.system._relay(this,this._parent,B0(this.id,e))}_stopProcedure(){if(this._processingStatus!==Xn.Running)return this;return this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new k0(this._process.bind(this)),this._processingStatus=Xn.Stopped,this.system._unregister(this),this}_send(e){if(this._processingStatus===Xn.Stopped){{let t=JSON.stringify(e);console.warn(`Event "${e.type}" was sent to stopped actor "${this.id} (${this.sessionId})". This actor has already reached its final state, and will not transition.
|
|
135
135
|
Event: ${t}`)}return}this.mailbox.enqueue(e)}send(e){if(typeof e==="string")throw Error(`Only event objects may be sent to actors; use .send({ type: "${e}" }) instead`);this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;if(e)(typeof e==="function"?e:NO)(this)}toJSON(){return{xstate$$type:Wm,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[XV](){return this}getSnapshot(){if(!this._snapshot)throw Error("Snapshot can't be read while the actor initializes itself");return this._snapshot}}function yo(e,...[t]){return new QO(e,t)}function iK(e,t,n,s,{sendId:c}){let d=typeof c==="function"?c(n,s):c;return[t,{sendId:d},void 0]}function oK(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function Xl(e){function t(n,s){throw Error("This isn't supposed to be called")}return t.type="xstate.cancel",t.sendId=e,t.resolve=iK,t.execute=oK,t}function sK(e,t,n,s,{id:c,systemId:d,src:a,input:h,syncSnapshot:R}){let b=typeof a==="string"?Yl(t.machine,a):a,S=typeof c==="function"?c(n):c,m,w=void 0;if(b)w=typeof h==="function"?h({context:t.context,event:n.event,self:e.self}):h,m=yo(b,{id:S,src:a,parent:e.self,syncSnapshot:R,systemId:d,input:w});if(!m)console.warn(`Actor type '${a}' not found in machine '${e.id}'.`);return[go(t,{children:{...t.children,[S]:m}}),{id:c,systemId:d,actorRef:m,src:a,input:w},void 0]}function aK(e,{actorRef:t}){if(!t)return;e.defer(()=>{if(t._processingStatus===Xn.Stopped)return;t.start()})}function eu(...[e,{id:t,systemId:n,input:s,syncSnapshot:c=!1}={}]){function d(a,h){throw Error("This isn't supposed to be called")}return d.type="xstate.spawnChild",d.id=t,d.systemId=n,d.src=e,d.input=s,d.syncSnapshot=c,d.resolve=sK,d.execute=aK,d}function cK(e,t,n,s,{actorRef:c}){let d=typeof c==="function"?c(n,s):c,a=typeof d==="string"?t.children[d]:d,h=t.children;if(a)h={...h},delete h[a.id];return[go(t,{children:h}),a,void 0]}function YO(e,t){let n=t.getSnapshot();if(n&&"children"in n)for(let s of Object.values(n.children))YO(e,s);e.system._unregister(t)}function lK(e,t){if(!t)return;if(YO(e,t),t._processingStatus!==Xn.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}function Pa(e){function t(n,s){throw Error("This isn't supposed to be called")}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=cK,t.execute=lK,t}function uK(e,{context:t,event:n},{guards:s}){return s.every((c)=>us(c,t,n,e))}function dK(e){function t(n,s){throw Error("This isn't supposed to be called")}return t.check=uK,t.guards=e,t}function us(e,t,n,s){let{machine:c}=s,d=typeof e==="function",a=d?e:c.implementations.guards[typeof e==="string"?e:e.type];if(!d&&!a)throw Error(`Guard '${typeof e==="string"?e:e.type}' is not implemented.'.`);if(typeof a!=="function")return us(a,t,n,s);let h={context:t,event:n},R=d||typeof e==="string"?void 0:("params"in e)?typeof e.params==="function"?e.params({context:t,event:n}):e.params:void 0;if(!("check"in a))return a(h,R);return a.check(s,h,a)}function Hm(e){return e.type==="atomic"||e.type==="final"}function Ca(e){return Object.values(e.states).filter((t)=>t.type!=="history")}function Ia(e,t){let n=[];if(t===e)return n;let s=e.parent;while(s&&s!==t)n.push(s),s=s.parent;return n}function tu(e){let t=new Set(e),n=eD(t);for(let s of t)if(s.type==="compound"&&(!n.get(s)||!n.get(s).length))LO(s).forEach((c)=>t.add(c));else if(s.type==="parallel")for(let c of Ca(s)){if(c.type==="history")continue;if(!t.has(c)){let d=LO(c);for(let a of d)t.add(a)}}for(let s of t){let c=s.parent;while(c)t.add(c),c=c.parent}return t}function XO(e,t){let n=t.get(e);if(!n)return{};if(e.type==="compound"){let c=n[0];if(c){if(Hm(c))return c.key}else return{}}let s={};for(let c of n)s[c.key]=XO(c,t);return s}function eD(e){let t=new Map;for(let n of e){if(!t.has(n))t.set(n,[]);if(n.parent){if(!t.has(n.parent))t.set(n.parent,[]);t.get(n.parent).push(n)}}return t}function tD(e,t){let n=tu(t);return XO(e,eD(n))}function Gm(e,t){if(t.type==="compound")return Ca(t).some((n)=>n.type==="final"&&e.has(n));if(t.type==="parallel")return Ca(t).every((n)=>Gm(e,n));return t.type==="final"}var nu=(e)=>e[0]===KV;function nD(e,t){let n=e.transitions.get(t),s=[...e.transitions.keys()].filter((c)=>c!==t&&VO(t,c)).sort((c,d)=>d.length-c.length).flatMap((c)=>e.transitions.get(c));return n?[...n,...s]:s}function rD(e){let t=e.config.after;if(!t)return[];let n=(c)=>{let d=QV(c,e.id),a=d.type;return e.entry.push(su(d,{id:a,delay:c})),e.exit.push(Xl(a)),a};return Object.keys(t).flatMap((c)=>{let d=t[c],a=typeof d==="string"?{target:d}:d,h=Number.isNaN(+c)?c:+c,R=n(h);return mi(a).map((b)=>({...b,event:R,delay:h}))}).map((c)=>{let{delay:d}=c;return{...Mi(e,c.event,c),delay:d}})}function Mi(e,t,n){let s=JO(n.target),c=n.reenter??!1,d=pK(e,s);if(n.cond)throw Error(`State "${e.id}" has declared \`cond\` for one of its transitions. This property has been renamed to \`guard\`. Please update your code.`);let a={...n,actions:mi(n.actions),guard:n.guard,target:d,source:e,reenter:c,eventType:t,toJSON:()=>({...a,source:`#${e.id}`,target:d?d.map((h)=>`#${h.id}`):void 0})};return a}function iD(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(n===N0)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let s=e.config.on[n];t.set(n,as(s).map((c)=>Mi(e,n,c)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,as(e.config.onDone).map((s)=>Mi(e,n,s)))}for(let n of e.invoke){if(n.onDone){let s=`xstate.done.actor.${n.id}`;t.set(s,as(n.onDone).map((c)=>Mi(e,s,c)))}if(n.onError){let s=`xstate.error.actor.${n.id}`;t.set(s,as(n.onError).map((c)=>Mi(e,s,c)))}if(n.onSnapshot){let s=`xstate.snapshot.${n.id}`;t.set(s,as(n.onSnapshot).map((c)=>Mi(e,s,c)))}}for(let n of e.after){let s=t.get(n.eventType);if(!s)s=[],t.set(n.eventType,s);s.push(n)}return t}function oD(e){let t=[],n=(s)=>{Object.values(s).forEach((c)=>{if(c.config.route&&c.config.id){let d=c.config.id,a=c.config.route.guard,h=({event:b})=>b.to===`#${d}`,R={...c.config.route,guard:a?dK([h,a]):h,target:`#${d}`};t.push(Mi(e,"xstate.route",R))}if(c.states)n(c.states)})};if(n(e.states),t.length>0)e.transitions.set("xstate.route",t)}function sD(e,t){let n=typeof t==="string"?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let s={source:e,actions:!t||typeof t==="string"?[]:mi(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...s,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return s}function pK(e,t){if(t===void 0)return;return t.map((n)=>{if(typeof n!=="string")return n;if(nu(n))return e.machine.getStateNodeById(n);let s=n[0]===j0;if(s&&!e.parent)return Ql(e,n.slice(1));let c=s?e.key+n:n;if(e.parent)try{return Ql(e.parent,c)}catch(d){throw Error(`Invalid transition definition for state node '${e.id}':
|
|
@@ -141,4 +141,4 @@ ${S.message}`)}if(b){s.push(...a.actions),c=a;break}}return c?[c]:void 0}get eve
|
|
|
141
141
|
`).flatMap((t)=>{let n=t.match(YY);if(!n)return[];let s=(n[3]??"").split(",").map((c)=>c.trim()).filter(Boolean);return[{name:n[1]??"",description:n[2]??"",tags:s}]})}var iXe=new Ur(f2,{title:"Agent",mappings:[{key:"about",label:"About",type:"string"},{key:"skills",label:"Skills",type:"custom",formatter:XY,parser:eX},{key:"notes",label:"Notes",type:"string"}]});Os();var MX=r.object({value:Ho.nullable().default(null),type:r.string().max(100).default(""),q:Ys.trim().default(""),sort:Ks.default("updated-desc"),offset:r.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0),limit:r.coerce.number().int().min(1).max(Wo).default(Qs)}),m2=MX;var h2=Xs.pick({grouping:!0,values:!0});var g2=25;var cw=r.object({prefix:r.tuple([r.string()],r.string()).nullable().default(null),scope:r.enum(["folder","collection"]).default("folder"),q:r.string().trim().max(200).default(""),visibility:r.enum(["all","public","shared","restricted"]).default("all"),status:r.string().trim().max(100).default(""),sort:r.enum(["updated-desc","updated-asc","created-desc","created-asc"]).default("updated-desc"),offset:r.coerce.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0),limit:r.coerce.number().int().min(1).max(100).default(g2)});function zrt(e){let t=e.get("prefix"),n=null;if(t!==null)try{n=JSON.parse(t)}catch{n=t}return{prefix:n,scope:e.get("scope")??void 0,q:e.get("q")??void 0,visibility:e.get("visibility")??void 0,status:e.get("status")??void 0,sort:e.get("sort")??void 0,offset:e.get("offset")??void 0,limit:e.get("limit")??void 0}}var y2=r.strictObject({label:r.string().min(1).max(60),href:r.string().min(1).max(1000)}),zX=r.strictObject({id:r.string().min(1).max(300),title:r.string().min(1).max(200),detail:r.string().max(500).optional(),severity:r.enum(["error","warn","info"]),source:r.string().min(1).max(100),action:y2.optional()}),b2={id:r.string().min(1),entityType:r.string().min(1),typeLabel:r.string().min(1),title:r.string().min(1),href:r.string().min(1)},_X=r.strictObject({...b2,updated:r.iso.datetime()}),OX=r.strictObject({...b2,publishedAt:r.iso.datetime()}),DX=r.strictObject({now:r.iso.datetime(),needsYou:r.array(zX).max(50),drafts:r.array(_X).max(10),published:r.array(OX).max(10),status:r.strictObject({tone:r.enum(["good","warn","error"]),text:r.string().min(1).max(200),history:y2})});function S2(e){return DX.parse(e)}class v2 extends Error{status;issues;code;retryAfterMs;conflictId;constructor(e,t,n=[],s={}){super(t);this.status=e,this.issues=n,this.code=s.code,this.retryAfterMs=s.retryAfterMs,this.conflictId=s.conflictId}}function jX(e,t){return`${t==="/"?"":t.replace(/\/+$/,"")}/api/${e.replace(/^\/+/,"")}`}function NX(e){if(typeof e!=="object"||e===null)return{error:void 0,issues:[],code:void 0,conflictId:void 0};let t="error"in e&&typeof e.error==="string"?e.error:void 0,n="issues"in e&&Array.isArray(e.issues)?e.issues.filter((s)=>typeof s==="object"&&s!==null&&("message"in s)&&typeof s.message==="string"):[];return{error:t,issues:n,code:"code"in e&&typeof e.code==="string"?e.code:void 0,conflictId:"conflictId"in e&&typeof e.conflictId==="string"?e.conflictId:void 0}}var BX=(e,t)=>fetch(e,t);class lw{basePath;fetch;constructor(e){this.basePath=e.basePath,this.fetch=e.fetch??BX}path(e){return jX(e,this.basePath)}async request(e,t){let n=await this.fetch(e,t);if(n.ok)return n;let s=NX(await n.json().catch(()=>{return}));throw new v2(n.status,s.error??n.statusText,s.issues,{code:s.code,conflictId:s.conflictId,retryAfterMs:n.headers.has("Retry-After")?Number(n.headers.get("Retry-After"))*1000:void 0})}async requestJson(e,t){return(await this.request(e,t)).json().catch(()=>{return})}async fetchNavigation(){let e=await this.requestJson(this.path("types"));return{types:e.types,workspaces:e.workspaces??[],groupings:e.groupings??[]}}async fetchGrouping(e,t,n){let s=m2.parse(t),c=new URLSearchParams({grouping:e,offset:String(s.offset),limit:String(s.limit)});if(s.type)c.set("type",s.type);if(s.value===null){let a=await this.requestJson(this.path(`groups/catalog?${c}`),{signal:n});return{kind:"catalog",values:a.values,total:a.total,grouping:a.grouping}}c.set("value",s.value),c.set("q",s.q),c.set("sort",s.sort);let d=await this.requestJson(this.path(`groups/members?${c}`),{signal:n});return{kind:"members",entities:d.entities,total:d.total,grouping:d.grouping}}async fetchGroupingUsage(e,t,n){n.throwIfAborted();let s=h2.parse({grouping:e,values:t}),c=new URLSearchParams({grouping:s.grouping});for(let d of s.values)c.append("value",d);return this.requestJson(this.path(`groups/usage?${c}`),{signal:n})}async fetchTypes(){return(await this.fetchNavigation()).types}async fetchWorkspace(e,t={}){let n=new URLSearchParams({id:e});for(let[c,d]of Object.entries(t))if(d!==void 0)n.set(c,String(d));let{workspace:s}=await this.requestJson(this.path(`workspace?${n.toString()}`));return s}async runWorkspaceAction(e,t){let{result:n}=await this.requestJson(this.path("workspace"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:t})});return n}async fetchSchema(e,t){let n=t?`&id=${encodeURIComponent(t)}`:"";return this.requestJson(this.path(`schema?type=${encodeURIComponent(e)}${n}`))}async fetchEntities(e,t=cw.parse({})){let n=cw.parse(t),s=new URLSearchParams({type:e,offset:String(n.offset),limit:String(n.limit)});if(n.prefix)s.set("prefix",JSON.stringify(n.prefix));if(n.scope!=="folder")s.set("scope",n.scope);if(n.q)s.set("q",n.q);if(n.visibility!=="all")s.set("visibility",n.visibility);if(n.status)s.set("status",n.status);if(n.sort!=="updated-desc")s.set("sort",n.sort);return this.requestJson(this.path(`hierarchy?${s.toString()}`))}async fetchImagePreview(e,t,n){return(await this.request(this.path(`images?id=${encodeURIComponent(e)}${n?`&width=${n}`:""}`),{signal:t})).blob()}async fetchImageLibrary(e){return this.requestJson(this.path(`image-library?offset=${e.offset}&limit=${e.limit}`))}async fetchImageDetails(e){return this.requestJson(this.path(`image-details?id=${encodeURIComponent(e)}`))}async saveImageDetails(e){return this.requestJson(this.path("image-details"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async fetchDocumentLibrary(e){return this.requestJson(this.path(`document-library?offset=${e.offset}&limit=${e.limit}`))}async fetchDocumentDetails(e){return this.requestJson(this.path(`document-details?id=${encodeURIComponent(e)}`))}async saveDocumentDetails(e){return this.requestJson(this.path("document-details"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async fetchDocumentFile(e,t){return(await this.request(this.path(`document?id=${encodeURIComponent(e)}`),{signal:t})).blob()}documentDownloadPath(e){return this.path(`document?id=${encodeURIComponent(e)}&download=1`)}async fetchEntity(e,t){let{entity:n}=await this.requestJson(this.path(`entities?type=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`));return n}async fetchHome(){return S2(await this.requestJson(this.path("home")))}async fetchCollectionMembers(e,t){return this.requestJson(this.path(`collection-members?type=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`))}async resolveConflict(e,t){await this.requestJson(this.path("conflicts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conflictId:e,action:t})})}async updateEntity(e){return this.requestJson(this.path("entities"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async saveTranslation(e){return this.requestJson(this.path("translations"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async previewDestination(e,t){return this.requestJson(this.path("destination"),{...t&&{signal:t},method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async createEntity(e){return this.requestJson(this.path("entities"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async uploadFile(e){let t=new FormData;return t.set("file",e),this.requestJson(this.path("upload"),{method:"POST",body:t})}async requestFieldAssist(e){return this.requestJson(this.path("assist"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async fetchAgentTargets(e,t){let{agents:n}=await this.requestJson(this.path(`agents?type=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`));return n}async requestAgentAnswer(e){return this.requestJson(this.path("ask-agent"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async fetchMembers(){let{members:e}=await this.requestJson(this.path("members"));return e}async fetchPalette(e){return lI.parse(await this.requestJson(this.path(`palette?q=${encodeURIComponent(e.trim())}`)))}async fetchSyncStatus(){return this.requestJson(this.path("sync-status"))}async refine(e){return this.requestJson(this.path("refine"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async deleteEntity(e,t){return this.requestJson(this.path(`entities?type=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:!0})})}}var uh=Ye(pt(),1);var R2=Ye(wo(),1),w2=uh.createContext(new lw({basePath:"/studio"}));function Frt(e){return R2.jsxDEV(w2.Provider,{value:e.api,children:e.children},void 0,!1,void 0,this)}function Zrt(){return uh.useContext(w2)}var Wrt={status:{k1xSpc:"x3nfvp2",kGNEyG:"x1pha0wt",kwnvtZ:"x1a02dak",kOIVth:"x17d4w8g",kMv6JI:"x5ddh9m",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},listingRow:{kumcoG:"x770nye",k1JLwA:"x1uf5sbp",$$css:!0},publication:{k1xSpc:"x1lliihq",keoZOQ:"x1gslohp",kMv6JI:"x5ddh9m",kGuDYH:"x1j6dyjg",k63SB2:"xo1l8bm",kMwMTN:"x1ar3pfp",kP9fke:"xn80e1m",kb6lSQ:"x12oo3zp",$$css:!0},propertiesHead:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kjj79g:"x1qughib",k1K539:"x1fqp7bg",kGO01o:"x18d9i69",kHdLCk:"xkaaz9w",$$css:!0},propertiesLabel:{kMwMTN:"x1ar3pfp",kogj98:"x1ghz6dp",$$css:!0},pipeline:{"--console-bg":"xw1b0li","--console-frame":"x1in81u4",kWkggS:"x18s3upu",kMwMTN:"x1ar3pfp",kEafiO:"x178xt8z",kPef9Z:"x13fuv20",kLZC3w:"xvg7k2t",kAzted:"x1gg8mnh",$$css:!0}};function Hrt(e,...t){return`${e} ${Ni(...t).className??""}`}function za(e){let t=e.startsWith("/")?e:`/${e}`;return t==="/"?"":t.replace(/\/+$/,"")}function T2(e,t){return`${za(e)}/entities/${encodeURIComponent(t)}`}function Jrt(e,t){return`${za(e)}/groups/${encodeURIComponent(t)}`}function Vrt(e){return`${za(e)}/images`}function Krt(e,t){let n=`${za(e)}/documents`;return t===void 0?n:`${n}?id=${encodeURIComponent(t)}`}function Qrt(e,t,n){return`${T2(e,t)}/${encodeURIComponent(n)}`}function Yrt(e,t,n){let s=new URL(T2(e,t),"https://brains.invalid");if(s.searchParams.set("mode","create"),n!==void 0)s.searchParams.set("starter",n);return`${s.pathname}${s.search}`}function Xrt(e,t){return`${za(e)}/workspaces/${encodeURIComponent(t)}`}function eit(e,t){let n=za(t);if(e===(n||"/"))return{kind:"home"};let c=n===""?"":n;if(c!==""&&!e.startsWith(`${c}/`))return{kind:"not-found",pathname:e};let d=e.slice(c.length);try{if(d==="/images")return{kind:"images"};if(d==="/documents")return{kind:"documents"};let a=/^\/groups\/([^/]+)$/.exec(d);if(a?.[1])return{kind:"grouping",grouping:decodeURIComponent(a[1])};let h=/^\/entities\/([^/]+)$/.exec(d);if(h?.[1])return{kind:"collection",entityType:decodeURIComponent(h[1])};let R=/^\/entities\/([^/]+)\/(.+)$/.exec(d);if(R?.[1]&&R[2]&&!d.endsWith("/"))return{kind:"entity",entityType:decodeURIComponent(R[1]),id:decodeURIComponent(R[2])};let b=/^\/workspaces\/([^/]+)$/.exec(d);if(b?.[1])return{kind:"workspace",workspaceId:decodeURIComponent(b[1])}}catch{}return{kind:"not-found",pathname:e}}var nit={secondaryDisplay:{kMv6JI:"xssy22x",ka26j:"xkhxzli",kGuDYH:"x1pvqxga",k63SB2:"xk50ysn",kLWn49:"x1u7k74",kb6lSQ:"x72az59",$$css:!0},section:{kMv6JI:"x5ddh9m",kGuDYH:"xif65rj",k63SB2:"x19s9jnd",$$css:!0},operatorRoles:{kMv6JI:"x5ddh9m","--operator-secondary-size":"x7292j8","--operator-secondary-weight":"xr8gae7","--operator-secondary-leading":"xd7rbps","--operator-secondary-tracking":"xvkmti0","--operator-section-family":"x87j1sr","--operator-section-size":"x1l9053m","--operator-section-weight":"x6r9d2h","--operator-eyebrow-size":"x14kal1k","--operator-eyebrow-weight":"x5utkz1","--operator-eyebrow-tracking":"x1lzmy7e",$$css:!0},eyebrow:{kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",k63SB2:"x1s688f",kb6lSQ:"x7447wj",kP9fke:"xtvhhri",$$css:!0}};
|
|
142
142
|
export{Ni as Kc,Yr as Lc,Mx as Mc,wo as Nc,xB as Oc,oc as Pc,EB as Qc,CB as Rc,AB as Sc,PB as Tc,Hx as Uc,Kx as Vc,Qx as Wc,Yx as Xc,kB as Yc,OB as Zc,DB as _c,jB as $c,NB as ad,BB as bd,qB as cd,LB as dd,$B as ed,FB as fd,ZB as gd,UB as hd,WB as id,HB as jd,JB as kd,KB as ld,YB as md,Rp as nd,oCe as od,hk as pd,c7 as qd,sCe as rd,Wrt as sd,Hrt as td,Er as ud,X$ as vd,mt as wd,XB as xd,eq as yd,tq as zd,sq as Ad,aq as Bd,cq as Cd,vn as Dd,fp as Ed,Wo as Fd,mp as Gd,e7 as Hd,qxe as Id,OD as Jd,DD as Kd,jD as Ld,t2 as Md,n2 as Nd,m2 as Od,za as Pd,T2 as Qd,Jrt as Rd,Vrt as Sd,Krt as Td,Qrt as Ud,Yrt as Vd,Xrt as Wd,eit as Xd,g2 as Yd,cw as Zd,zrt as _d,v2 as $d,lw as ae,Frt as be,Zrt as ce,nit as de};
|
|
143
143
|
|
|
144
|
-
//# debugId=
|
|
144
|
+
//# debugId=75DA121088F152E964756E2164756E21
|