@npm-ken/pi-a2ui 0.0.0-stage → 0.1.0

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/client.js ADDED
@@ -0,0 +1,1084 @@
1
+ var im=Object.create;var pa=Object.defineProperty;var om=Object.getOwnPropertyDescriptor;var sm=Object.getOwnPropertyNames;var am=Object.getPrototypeOf,cm=Object.prototype.hasOwnProperty;var um=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},lm=(t,e)=>{for(var r in e)pa(t,r,{get:e[r],enumerable:!0})},dm=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sm(e))!cm.call(t,i)&&i!==r&&pa(t,i,{get:()=>e[i],enumerable:!(n=om(e,i))||n.enumerable});return t};var fm=(t,e,r)=>(r=t!=null?im(am(t)):{},dm(e||!t||!t.__esModule?pa(r,"default",{value:t,enumerable:!0}):r,t));var np=um((d2,rp)=>{rp.exports=(function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(n,i,o){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:o})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,i){if(1&i&&(n=r(n)),8&i||4&i&&typeof n=="object"&&n&&n.__esModule)return n;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&i&&typeof n!="string")for(var s in n)r.d(o,s,function(a){return n[a]}.bind(null,s));return o},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=0)})([function(t,e,r){"use strict";r.r(e),r.d(e,"validateHTMLColorName",(function(){return s})),r.d(e,"validateHTMLColorSpecialName",(function(){return a})),r.d(e,"validateHTMLColorHex",(function(){return c})),r.d(e,"validateHTMLColorRgb",(function(){return y})),r.d(e,"validateHTMLColorHsl",(function(){return A})),r.d(e,"validateHTMLColorHwb",(function(){return D})),r.d(e,"validateHTMLColorLab",(function(){return _})),r.d(e,"validateHTMLColorLch",(function(){return q})),r.d(e,"validateHTMLColor",(function(){return j}));let n=I=>I&&typeof I=="string",i=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenrod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","Goldenrod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenrodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquamarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenrod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],o=["currentColor","inherit","transparent"],s=I=>{let P=!1;return n(I)&&i.map(M=>(I.toLowerCase()===M.toLowerCase()&&(P=!0),null)),P},a=I=>{let P=!1;return n(I)&&o.map(M=>(I.toLowerCase()===M.toLowerCase()&&(P=!0),null)),P},c=I=>n(I)?I&&/^#([\da-f]{3}){1,2}$|^#([\da-f]{4}){1,2}$/i.test(I):!1,u="(([\\d]{0,5})((\\.([\\d]{1,5}))?))",l=`(${u}%)`,f="(([0-9]|[1-9][0-9]|100)%)",h=`(${f}|(0?((\\.([\\d]{1,5}))?))|1)`,p=`([\\s]{0,5})\\)?)(([\\s]{0,5})(\\/?)([\\s]{1,5})${`(((${f}))|(0?((\\.([\\d]{1,5}))?))|1))?`}([\\s]{0,5})\\)`,m="(-?(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\.([\\d]{1,5}))?)|360)(deg)?)",y=I=>{if(n(I)){let P="([\\s]{0,5})([\\d]{1,5})%?([\\s]{0,5}),?",M="((([\\s]{0,5}),?([\\s]{0,5}))|(([\\s]{1,5})))",U=new RegExp(`^(rgb)a?\\(${`${P}${M}`}${`${P}${M}`}${`${P}${M}`}((\\/?([\\s]{0,5})(0?\\.?([\\d]{1,5})%?([\\s]{0,5}))?|1|0))?\\)$`);return I&&U.test(I)}return!1},A=I=>{if(n(I)){let P=new RegExp(`^(hsl)a?\\((([\\s]{0,5})(${m}|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|400)grad)|((([0-5])?\\.([\\d]{1,5})|6\\.([0-9]|1[0-9]|2[0-8])|[0-6])rad)|((0?((\\.([\\d]{1,5}))?)|1)turn))((([\\s]{0,5}),([\\s]{0,5}))|(([\\s]{1,5}))))(([\\s]{0,5})(0|${f})((([\\s]{0,5}),([\\s]{0,5}))|(([\\s]{1,5}))))(([\\s]{0,5})(0|${f})([\\s]{0,5})\\)?)(([\\s]{0,5})(\\/?|,?)([\\s]{0,5})(((${f}))|(0?((\\.([\\d]{1,5}))?))|1))?\\)$`);return I&&P.test(I)}return!1},D=I=>{if(n(I)){let P=new RegExp(`^(hwb\\(([\\s]{0,5})${m}([\\s]{1,5}))((0|${f})([\\s]{1,5}))((0|${f})${p}$`);return I&&P.test(I)}return!1},_=I=>{if(n(I)){let P="(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])((\\.([\\d]{1,5}))?)?|160))",M=new RegExp(`^(lab\\(([\\s]{0,5})${l}([\\s]{1,5})${P}([\\s]{1,5})${P}${p}$`);return I&&M.test(I)}return!1},q=I=>{if(n(I)){let P="((([0-9]|[1-9][0-9])?((\\.([\\d]{1,5}))?)|100)(%)?)",M=""+u,U=`((${m})|(0|${h})|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\.([\\d]{1,5}))?)|360))`,T=`(\\/([\\s]{0,5})${h})`,ae=new RegExp(`^lch\\(${`(([\\s]{0,5})${P}([\\s]{1,5})${M}([\\s]{1,5})${U}([\\s]{0,5})(${T})?)`}\\)$`);return I&&ae.test(I)}return!1},j=I=>!!(I&&c(I)||y(I)||A(I)||D(I)||_(I)||q(I));e.default=I=>!!(I&&c(I)||s(I)||a(I)||y(I)||A(I)||D(I)||_(I)||q(I))}])});var d={};lm(d,{BRAND:()=>Mm,DIRTY:()=>rn,EMPTY_PATH:()=>gm,INVALID:()=>L,NEVER:()=>Dg,OK:()=>Be,ParseStatus:()=>Oe,Schema:()=>H,ZodAny:()=>Sr,ZodArray:()=>cr,ZodBigInt:()=>on,ZodBoolean:()=>sn,ZodBranded:()=>Zi,ZodCatch:()=>yn,ZodDate:()=>an,ZodDefault:()=>gn,ZodDiscriminatedUnion:()=>Go,ZodEffects:()=>bt,ZodEnum:()=>hn,ZodError:()=>Xe,ZodFirstPartyTypeKind:()=>S,ZodFunction:()=>Ko,ZodIntersection:()=>dn,ZodIssueCode:()=>w,ZodLazy:()=>fn,ZodLiteral:()=>pn,ZodMap:()=>li,ZodNaN:()=>fi,ZodNativeEnum:()=>mn,ZodNever:()=>$t,ZodNull:()=>un,ZodNullable:()=>qt,ZodNumber:()=>nn,ZodObject:()=>Qe,ZodOptional:()=>gt,ZodParsedType:()=>$,ZodPipeline:()=>Wi,ZodPromise:()=>_r,ZodReadonly:()=>bn,ZodRecord:()=>Ho,ZodSchema:()=>H,ZodSet:()=>di,ZodString:()=>Er,ZodSymbol:()=>ci,ZodTransformer:()=>bt,ZodTuple:()=>zt,ZodType:()=>H,ZodUndefined:()=>cn,ZodUnion:()=>ln,ZodUnknown:()=>ar,ZodVoid:()=>ui,addIssueToContext:()=>k,any:()=>Gm,array:()=>Ym,bigint:()=>Um,boolean:()=>wu,coerce:()=>Ag,custom:()=>Au,date:()=>zm,datetimeRegex:()=>vu,defaultErrorMap:()=>or,discriminatedUnion:()=>tg,effect:()=>pg,enum:()=>lg,function:()=>ag,getErrorMap:()=>oi,getParsedType:()=>Ut,instanceof:()=>Bm,intersection:()=>rg,isAborted:()=>Zo,isAsync:()=>si,isDirty:()=>Wo,isValid:()=>wr,late:()=>Lm,lazy:()=>cg,literal:()=>ug,makeIssue:()=>qi,map:()=>og,nan:()=>Vm,nativeEnum:()=>dg,never:()=>Km,null:()=>Wm,nullable:()=>mg,number:()=>Cu,object:()=>Xm,objectUtil:()=>ha,oboolean:()=>xg,onumber:()=>vg,optional:()=>hg,ostring:()=>bg,pipeline:()=>yg,preprocess:()=>gg,promise:()=>fg,quotelessJson:()=>pm,record:()=>ig,set:()=>sg,setErrorMap:()=>mm,strictObject:()=>Qm,string:()=>Du,symbol:()=>qm,transformer:()=>pg,tuple:()=>ng,undefined:()=>Zm,union:()=>eg,unknown:()=>Hm,util:()=>ie,void:()=>Jm});var ie;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ie||(ie={}));var ha;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ha||(ha={}));var $=ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ut=t=>{switch(typeof t){case"undefined":return $.undefined;case"string":return $.string;case"number":return Number.isNaN(t)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(t)?$.array:t===null?$.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?$.promise:typeof Map<"u"&&t instanceof Map?$.map:typeof Set<"u"&&t instanceof Set?$.set:typeof Date<"u"&&t instanceof Date?$.date:$.object;default:return $.unknown}};var w=ie.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),pm=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Xe=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Xe.create=t=>new Xe(t);var hm=(t,e)=>{let r;switch(t.code){case w.invalid_type:t.received===$.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ie.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:r=`Unrecognized key(s) in object: ${ie.joinValues(t.keys,", ")}`;break;case w.invalid_union:r="Invalid input";break;case w.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ie.joinValues(t.options)}`;break;case w.invalid_enum_value:r=`Invalid enum value. Expected ${ie.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:r="Invalid function arguments";break;case w.invalid_return_type:r="Invalid function return type";break;case w.invalid_date:r="Invalid date";break;case w.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ie.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case w.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case w.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case w.custom:r="Invalid input";break;case w.invalid_intersection_types:r="Intersection results could not be merged";break;case w.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:r="Number must be finite";break;default:r=e.defaultError,ie.assertNever(t)}return{message:r}},or=hm;var hu=or;function mm(t){hu=t}function oi(){return hu}var qi=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},gm=[];function k(t,e){let r=oi(),n=qi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===or?void 0:or].filter(i=>!!i)});t.common.issues.push(n)}var Oe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return L;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return L;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},L=Object.freeze({status:"aborted"}),rn=t=>({status:"dirty",value:t}),Be=t=>({status:"valid",value:t}),Zo=t=>t.status==="aborted",Wo=t=>t.status==="dirty",wr=t=>t.status==="valid",si=t=>typeof Promise<"u"&&t instanceof Promise;var O;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(O||(O={}));var yt=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},mu=(t,e)=>{if(wr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Xe(t.common.issues);return this._error=r,this._error}}};function G(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var H=class{get description(){return this._def.description}_getType(e){return Ut(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ut(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Oe,ctx:{common:e.parent.common,data:e.data,parsedType:Ut(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(si(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ut(e)},i=this._parseSync({data:e,path:n.path,parent:n});return mu(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ut(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return wr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>wr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ut(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(si(i)?i:Promise.resolve(i));return mu(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:w.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new bt({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return gt.create(this,this._def)}nullable(){return qt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cr.create(this)}promise(){return _r.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return dn.create(this,e,this._def)}transform(e){return new bt({...G(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new gn({...G(this._def),innerType:this,defaultValue:r,typeName:S.ZodDefault})}brand(){return new Zi({typeName:S.ZodBranded,type:this,...G(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new yn({...G(this._def),innerType:this,catchValue:r,typeName:S.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Wi.create(this,e)}readonly(){return bn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ym=/^c[^\s-]{8,}$/i,bm=/^[0-9a-z]+$/,vm=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xm=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Am=/^[a-z0-9_-]{21}$/i,Dm=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Cm=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wm=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Em="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ma,Sm=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_m=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Im=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,km=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fm=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$m=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yu="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Rm=new RegExp(`^${yu}$`);function bu(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Tm(t){return new RegExp(`^${bu(t)}$`)}function vu(t){let e=`${yu}T${bu(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Om(t,e){return!!((e==="v4"||!e)&&Sm.test(t)||(e==="v6"||!e)&&Im.test(t))}function Nm(t,e){if(!Dm.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function jm(t,e){return!!((e==="v4"||!e)&&_m.test(t)||(e==="v6"||!e)&&km.test(t))}var Er=class t extends H{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){let o=this._getOrReturnCtx(e);return k(o,{code:w.invalid_type,expected:$.string,received:o.parsedType}),L}let n=new Oe,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),k(i,{code:w.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),k(i,{code:w.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?k(i,{code:w.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&k(i,{code:w.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")wm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"email",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")ma||(ma=new RegExp(Em,"u")),ma.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"emoji",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")xm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"uuid",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Am.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"nanoid",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")ym.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"cuid",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")bm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"cuid2",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")vm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"ulid",code:w.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),k(i,{validation:"url",code:w.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"regex",code:w.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),k(i,{code:w.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),k(i,{code:w.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),k(i,{code:w.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?vu(o).test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{code:w.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Rm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{code:w.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Tm(o).test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{code:w.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Cm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"duration",code:w.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Om(e.data,o.version)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"ip",code:w.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Nm(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"jwt",code:w.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?jm(e.data,o.version)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"cidr",code:w.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Fm.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"base64",code:w.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?$m.test(e.data)||(i=this._getOrReturnCtx(e,i),k(i,{validation:"base64url",code:w.invalid_string,message:o.message}),n.dirty()):ie.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:w.invalid_string,...O.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...O.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...O.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...O.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...O.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...O.errToObj(r)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Er.create=t=>new Er({checks:[],typeName:S.ZodString,coerce:t?.coerce??!1,...G(t)});function Pm(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var nn=class t extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==$.number){let o=this._getOrReturnCtx(e);return k(o,{code:w.invalid_type,expected:$.number,received:o.parsedType}),L}let n,i=new Oe;for(let o of this._def.checks)o.kind==="int"?ie.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:w.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:w.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:w.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Pm(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),k(n,{code:w.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:w.not_finite,message:o.message}),i.dirty()):ie.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ie.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nn.create=t=>new nn({checks:[],typeName:S.ZodNumber,coerce:t?.coerce||!1,...G(t)});var on=class t extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==$.bigint)return this._getInvalidInput(e);let n,i=new Oe;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:w.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:w.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),k(n,{code:w.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ie.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return k(r,{code:w.invalid_type,expected:$.bigint,received:r.parsedType}),L}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};on.create=t=>new on({checks:[],typeName:S.ZodBigInt,coerce:t?.coerce??!1,...G(t)});var sn=class extends H{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==$.boolean){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:$.boolean,received:n.parsedType}),L}return Be(e.data)}};sn.create=t=>new sn({typeName:S.ZodBoolean,coerce:t?.coerce||!1,...G(t)});var an=class t extends H{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){let o=this._getOrReturnCtx(e);return k(o,{code:w.invalid_type,expected:$.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return k(o,{code:w.invalid_date}),L}let n=new Oe,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),k(i,{code:w.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),k(i,{code:w.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ie.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};an.create=t=>new an({checks:[],coerce:t?.coerce||!1,typeName:S.ZodDate,...G(t)});var ci=class extends H{_parse(e){if(this._getType(e)!==$.symbol){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:$.symbol,received:n.parsedType}),L}return Be(e.data)}};ci.create=t=>new ci({typeName:S.ZodSymbol,...G(t)});var cn=class extends H{_parse(e){if(this._getType(e)!==$.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:$.undefined,received:n.parsedType}),L}return Be(e.data)}};cn.create=t=>new cn({typeName:S.ZodUndefined,...G(t)});var un=class extends H{_parse(e){if(this._getType(e)!==$.null){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:$.null,received:n.parsedType}),L}return Be(e.data)}};un.create=t=>new un({typeName:S.ZodNull,...G(t)});var Sr=class extends H{constructor(){super(...arguments),this._any=!0}_parse(e){return Be(e.data)}};Sr.create=t=>new Sr({typeName:S.ZodAny,...G(t)});var ar=class extends H{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Be(e.data)}};ar.create=t=>new ar({typeName:S.ZodUnknown,...G(t)});var $t=class extends H{_parse(e){let r=this._getOrReturnCtx(e);return k(r,{code:w.invalid_type,expected:$.never,received:r.parsedType}),L}};$t.create=t=>new $t({typeName:S.ZodNever,...G(t)});var ui=class extends H{_parse(e){if(this._getType(e)!==$.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:$.void,received:n.parsedType}),L}return Be(e.data)}};ui.create=t=>new ui({typeName:S.ZodVoid,...G(t)});var cr=class t extends H{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==$.array)return k(r,{code:w.invalid_type,expected:$.array,received:r.parsedType}),L;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(k(r,{code:s?w.too_big:w.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(k(r,{code:w.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(k(r,{code:w.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new yt(r,s,r.path,a)))).then(s=>Oe.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new yt(r,s,r.path,a)));return Oe.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:O.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:O.toString(r)}})}nonempty(e){return this.min(1,e)}};cr.create=(t,e)=>new cr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...G(e)});function ai(t){if(t instanceof Qe){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=gt.create(ai(n))}return new Qe({...t._def,shape:()=>e})}else return t instanceof cr?new cr({...t._def,type:ai(t.element)}):t instanceof gt?gt.create(ai(t.unwrap())):t instanceof qt?qt.create(ai(t.unwrap())):t instanceof zt?zt.create(t.items.map(e=>ai(e))):t}var Qe=class t extends H{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ie.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==$.object){let u=this._getOrReturnCtx(e);return k(u,{code:w.invalid_type,expected:$.object,received:u.parsedType}),L}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof $t&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new yt(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof $t){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&(k(i,{code:w.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let f=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new yt(i,f,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let f=await l.key,h=await l.value;u.push({key:f,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>Oe.mergeObjectSync(n,u)):Oe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ie.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ie.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return ai(this)}partial(e){let r={};for(let n of ie.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ie.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof gt;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return xu(ie.objectKeys(this.shape))}};Qe.create=(t,e)=>new Qe({shape:()=>t,unknownKeys:"strip",catchall:$t.create(),typeName:S.ZodObject,...G(e)});Qe.strictCreate=(t,e)=>new Qe({shape:()=>t,unknownKeys:"strict",catchall:$t.create(),typeName:S.ZodObject,...G(e)});Qe.lazycreate=(t,e)=>new Qe({shape:t,unknownKeys:"strip",catchall:$t.create(),typeName:S.ZodObject,...G(e)});var ln=class extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Xe(a.ctx.common.issues));return k(r,{code:w.invalid_union,unionErrors:s}),L}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Xe(c));return k(r,{code:w.invalid_union,unionErrors:a}),L}}get options(){return this._def.options}};ln.create=(t,e)=>new ln({options:t,typeName:S.ZodUnion,...G(e)});var sr=t=>t instanceof fn?sr(t.schema):t instanceof bt?sr(t.innerType()):t instanceof pn?[t.value]:t instanceof hn?t.options:t instanceof mn?ie.objectValues(t.enum):t instanceof gn?sr(t._def.innerType):t instanceof cn?[void 0]:t instanceof un?[null]:t instanceof gt?[void 0,...sr(t.unwrap())]:t instanceof qt?[null,...sr(t.unwrap())]:t instanceof Zi||t instanceof bn?sr(t.unwrap()):t instanceof yn?sr(t._def.innerType):[],Go=class t extends H{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.object)return k(r,{code:w.invalid_type,expected:$.object,received:r.parsedType}),L;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(k(r,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=sr(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...G(n)})}};function ga(t,e){let r=Ut(t),n=Ut(e);if(t===e)return{valid:!0,data:t};if(r===$.object&&n===$.object){let i=ie.objectKeys(e),o=ie.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=ga(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===$.array&&n===$.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=ga(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===$.date&&n===$.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var dn=class extends H{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Zo(o)||Zo(s))return L;let a=ga(o.value,s.value);return a.valid?((Wo(o)||Wo(s))&&r.dirty(),{status:r.value,value:a.data}):(k(n,{code:w.invalid_intersection_types}),L)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};dn.create=(t,e,r)=>new dn({left:t,right:e,typeName:S.ZodIntersection,...G(r)});var zt=class t extends H{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.array)return k(n,{code:w.invalid_type,expected:$.array,received:n.parsedType}),L;if(n.data.length<this._def.items.length)return k(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&n.data.length>this._def.items.length&&(k(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new yt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Oe.mergeArray(r,s)):Oe.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};zt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zt({items:t,typeName:S.ZodTuple,rest:null,...G(e)})};var Ho=class t extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.object)return k(n,{code:w.invalid_type,expected:$.object,received:n.parsedType}),L;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new yt(n,a,n.path,a)),value:s._parse(new yt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Oe.mergeObjectAsync(r,i):Oe.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof H?new t({keyType:e,valueType:r,typeName:S.ZodRecord,...G(n)}):new t({keyType:Er.create(),valueType:e,typeName:S.ZodRecord,...G(r)})}},li=class extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.map)return k(n,{code:w.invalid_type,expected:$.map,received:n.parsedType}),L;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new yt(n,a,n.path,[u,"key"])),value:o._parse(new yt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return L;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return L;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};li.create=(t,e,r)=>new li({valueType:e,keyType:t,typeName:S.ZodMap,...G(r)});var di=class t extends H{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.set)return k(n,{code:w.invalid_type,expected:$.set,received:n.parsedType}),L;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(k(n,{code:w.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(k(n,{code:w.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return L;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new yt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:O.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};di.create=(t,e)=>new di({valueType:t,minSize:null,maxSize:null,typeName:S.ZodSet,...G(e)});var Ko=class t extends H{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.function)return k(r,{code:w.invalid_type,expected:$.function,received:r.parsedType}),L;function n(a,c){return qi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oi(),or].filter(u=>!!u),issueData:{code:w.invalid_arguments,argumentsError:c}})}function i(a,c){return qi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oi(),or].filter(u=>!!u),issueData:{code:w.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof _r){let a=this;return Be(async function(...c){let u=new Xe([]),l=await a._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(n(c,p)),u}),f=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(f,o).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{let a=this;return Be(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Xe([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(l,o);if(!f.success)throw new Xe([i(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:zt.create(e).rest(ar.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||zt.create([]).rest(ar.create()),returns:r||ar.create(),typeName:S.ZodFunction,...G(n)})}},fn=class extends H{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};fn.create=(t,e)=>new fn({getter:t,typeName:S.ZodLazy,...G(e)});var pn=class extends H{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return k(r,{received:r.data,code:w.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};pn.create=(t,e)=>new pn({value:t,typeName:S.ZodLiteral,...G(e)});function xu(t,e){return new hn({values:t,typeName:S.ZodEnum,...G(e)})}var hn=class t extends H{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{expected:ie.joinValues(n),received:r.parsedType,code:w.invalid_type}),L}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{received:r.data,code:w.invalid_enum_value,options:n}),L}return Be(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};hn.create=xu;var mn=class extends H{_parse(e){let r=ie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==$.string&&n.parsedType!==$.number){let i=ie.objectValues(r);return k(n,{expected:ie.joinValues(i),received:n.parsedType,code:w.invalid_type}),L}if(this._cache||(this._cache=new Set(ie.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ie.objectValues(r);return k(n,{received:n.data,code:w.invalid_enum_value,options:i}),L}return Be(e.data)}get enum(){return this._def.values}};mn.create=(t,e)=>new mn({values:t,typeName:S.ZodNativeEnum,...G(e)});var _r=class extends H{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==$.promise&&r.common.async===!1)return k(r,{code:w.invalid_type,expected:$.promise,received:r.parsedType}),L;let n=r.parsedType===$.promise?r.data:Promise.resolve(r.data);return Be(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};_r.create=(t,e)=>new _r({type:t,typeName:S.ZodPromise,...G(e)});var bt=class extends H{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{k(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return L;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?L:c.status==="dirty"?rn(c.value):r.value==="dirty"?rn(c.value):c});{if(r.value==="aborted")return L;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?L:a.status==="dirty"?rn(a.value):r.value==="dirty"?rn(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?L:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?L:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!wr(s))return L;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>wr(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):L);ie.assertNever(i)}};bt.create=(t,e,r)=>new bt({schema:t,typeName:S.ZodEffects,effect:e,...G(r)});bt.createWithPreprocess=(t,e,r)=>new bt({schema:e,effect:{type:"preprocess",transform:t},typeName:S.ZodEffects,...G(r)});var gt=class extends H{_parse(e){return this._getType(e)===$.undefined?Be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(t,e)=>new gt({innerType:t,typeName:S.ZodOptional,...G(e)});var qt=class extends H{_parse(e){return this._getType(e)===$.null?Be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qt.create=(t,e)=>new qt({innerType:t,typeName:S.ZodNullable,...G(e)});var gn=class extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===$.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};gn.create=(t,e)=>new gn({innerType:t,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var yn=class extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return si(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Xe(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yn.create=(t,e)=>new yn({innerType:t,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var fi=class extends H{_parse(e){if(this._getType(e)!==$.nan){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:$.nan,received:n.parsedType}),L}return{status:"valid",value:e.data}}};fi.create=t=>new fi({typeName:S.ZodNaN,...G(t)});var Mm=Symbol("zod_brand"),Zi=class extends H{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Wi=class t extends H{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?L:o.status==="dirty"?(r.dirty(),rn(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?L:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:S.ZodPipeline})}},bn=class extends H{_parse(e){let r=this._def.innerType._parse(e),n=i=>(wr(i)&&(i.value=Object.freeze(i.value)),i);return si(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};bn.create=(t,e)=>new bn({innerType:t,typeName:S.ZodReadonly,...G(e)});function gu(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Au(t,e={},r){return t?Sr.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=gu(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=gu(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Sr.create()}var Lm={object:Qe.lazycreate},S;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(S||(S={}));var Bm=(t,e={message:`Input not instance of ${t.name}`})=>Au(r=>r instanceof t,e),Du=Er.create,Cu=nn.create,Vm=fi.create,Um=on.create,wu=sn.create,zm=an.create,qm=ci.create,Zm=cn.create,Wm=un.create,Gm=Sr.create,Hm=ar.create,Km=$t.create,Jm=ui.create,Ym=cr.create,Xm=Qe.create,Qm=Qe.strictCreate,eg=ln.create,tg=Go.create,rg=dn.create,ng=zt.create,ig=Ho.create,og=li.create,sg=di.create,ag=Ko.create,cg=fn.create,ug=pn.create,lg=hn.create,dg=mn.create,fg=_r.create,pg=bt.create,hg=gt.create,mg=qt.create,gg=bt.createWithPreprocess,yg=Wi.create,bg=()=>Du().optional(),vg=()=>Cu().optional(),xg=()=>wu().optional(),Ag={string:(t=>Er.create({...t,coerce:!0})),number:(t=>nn.create({...t,coerce:!0})),boolean:(t=>sn.create({...t,coerce:!0})),bigint:(t=>on.create({...t,coerce:!0})),date:(t=>an.create({...t,coerce:!0}))};var Dg=L;var Ve=class extends Error{constructor(e,r="UNKNOWN_ERROR",n){super(e),this.name=this.constructor.name,this.code=r,n?.path!==void 0&&(this.path=n.path),n?.surfaceId!==void 0&&(this.surfaceId=n.surfaceId),n?.functionCallId!==void 0&&(this.functionCallId=n.functionCallId),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},R=class extends Ve{constructor(e,r,n="VALIDATION_ERROR",i){super(e,n,i),this.details=r}},Se=class extends Ve{constructor(e,r,n){super(e,"DATA_ERROR",{path:r,surfaceId:n})}},K=class extends Ve{constructor(e,r,n,i){super(e,"EXPRESSION_ERROR",i),this.expression=r,this.details=n}},Rt=class extends Ve{constructor(e,r){super(e,"STATE_ERROR",r)}},me=class extends Ve{constructor(e,r="CATALOG_ERROR",n){super(e,r,n)}},ot=class extends R{constructor(e,r,n="INTEGRITY_ERROR",i){super(e,r,n,i),this.name="A2uiIntegrityError"}},vt=class extends R{constructor(e,r,n="RECURSION_ERROR",i){super(e,r,n,i),this.name="A2uiRecursionError"}},ge;(function(t){t.INVALID_FUNCTION_CALL="INVALID_FUNCTION_CALL",t.EXECUTION_ERROR="EXECUTION_ERROR",t.UNKNOWN_FUNCTION="UNKNOWN_FUNCTION",t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.TIMEOUT="TIMEOUT",t.CANCELLED="CANCELLED",t.DISPOSED="DISPOSED",t.DUPLICATE="DUPLICATE",t.NO_LISTENER="NO_LISTENER"})(ge||(ge={}));var et=class extends Ve{constructor(e,r=ge.UNKNOWN_ERROR,n,i){let o=r||ge.UNKNOWN_ERROR;super(`[${o}] ${e}`,o),this.functionCallId=n,this.details=i,this.name="A2uiRpcError"}};var Cg=/^[vV]?(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function ur(t){if(!t||typeof t!="string")return"";let e=t.trim().replace(/^[vV]/,""),r=e.indexOf("-"),n=e.indexOf("+"),i=e.length;return r!==-1&&n!==-1?i=Math.min(r,n):r!==-1?i=r:n!==-1&&(i=n),`${e.slice(0,i).replace(/_/g,".")}${e.slice(i)}`}function wg(t){if(!t||typeof t!="string")return null;let e=t.trim().match(Cg);return e?{major:parseInt(e[1],10),minor:parseInt(e[2],10),patch:e[3]!==void 0?parseInt(e[3],10):0,prerelease:e[4]?e[4].split("."):[],build:e[5]?e[5].split("."):[]}:null}function Ir(t){if(!t)return null;if(typeof t=="object"){let e=t;return typeof e.major!="number"||!Number.isInteger(e.major)||e.major<0||typeof e.minor=="number"&&(!Number.isInteger(e.minor)||e.minor<0)||typeof e.patch=="number"&&(!Number.isInteger(e.patch)||e.patch<0)?null:{major:e.major,minor:typeof e.minor=="number"?e.minor:0,patch:typeof e.patch=="number"?e.patch:0,prerelease:Array.isArray(e.prerelease)?e.prerelease:[],build:Array.isArray(e.build)?e.build:[]}}return wg(ur(t))}function Ae(t){if(!t)return null;let e=Ir(t);if(!e)return null;if(e.patch===0&&e.prerelease.length===0&&e.build.length===0)return`${e.major}.${e.minor}`;let r=e.prerelease.length>0?`-${e.prerelease.join(".")}`:"",n=e.build.length>0?`+${e.build.join(".")}`:"";return`${e.major}.${e.minor}.${e.patch}${r}${n}`}function Eg(t,e){let r=/^\d+$/.test(t),n=/^\d+$/.test(e);return r&&n?t.length!==e.length?t.length-e.length:t<e?-1:t>e?1:0:r?-1:n?1:t<e?-1:t>e?1:0}function Sg(t,e){if(t.length===0&&e.length===0)return 0;if(t.length===0)return 1;if(e.length===0)return-1;let r=Math.min(t.length,e.length);for(let n=0;n<r;n++){let i=Eg(t[n],e[n]);if(i!==0)return i}return t.length-e.length}function Jo(t,e){let r=Ir(t),n=Ir(e);return!r&&!n?0:r?n?r.major!==n.major?r.major-n.major:r.minor!==n.minor?r.minor-n.minor:r.patch!==n.patch?r.patch-n.patch:Sg(r.prerelease,n.prerelease):1:-1}function oe(t,e){if(!t)return!1;let r=Ir(t),n=Ir(e);return!r||!n?!1:Jo(r,n)>=0}function xt(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"}function _g(t){if(Array.isArray(t)||typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function vn(t){if(xt(t))return Promise.resolve(t).then(vn);if(Array.isArray(t)){let e=t.map(vn);return e.some(xt)?Promise.all(e):t}if(_g(t)){let e=Object.entries(t).map(([r,n])=>[r,vn(n)]);return e.some(([,r])=>xt(r))?Promise.all(e.map(([,r])=>r)).then(r=>Object.fromEntries(e.map(([n],i)=>[n,r[i]]))):t}return t}var kr;(function(t){t.V0_8="v0.8",t.V0_9="v0.9",t.V0_9_1="v0.9.1",t.V1_0="1.0"})(kr||(kr={}));var Ig=new RegExp("^[\\p{XID_Start}_][\\p{XID_Continue}]*$","u");function lr(t,e=!1){if(!t)return!1;let r=e&&t.startsWith("@")?t.slice(1):t;return Ig.test(r)}function Gi(t,e,r=!1){if(!lr(t,r))throw new me(`Invalid UAX #31 ${e}`)}function xn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function kg(t){if(!xn(t))throw new R("Invalid metadata.extensions: expected a plain object.");for(let e of Object.keys(t))if(!lr(e))throw new R(`Invalid UAX #31 extension identifier: "${e}". Keys MUST be Unicode identifiers (UAX #31).`)}function An(t){if(t!==void 0){if(!xn(t))throw new R("Invalid metadata: expected a plain object.");for(let e of Object.keys(t))if(e!=="extensions")throw new R(`Unexpected property "${e}" in metadata; only "extensions" is allowed.`);"extensions"in t&&t.extensions!==void 0&&kg(t.extensions)}}function ya(t){if(Array.isArray(t)){let e=t.map(r=>ya(r));return Object.freeze(e)}if(xn(t)){let e={};for(let[r,n]of Object.entries(t))n!==void 0&&Object.defineProperty(e,r,{value:ya(n),enumerable:!0,configurable:!0,writable:!0});return Object.freeze(e)}return t}function Eu(t,e){if(An(t),An(e),t===void 0&&e===void 0)return;if(t===void 0)return Zt(e);if(e===void 0)return Zt(t);let r={};if(xn(t.extensions))for(let[i,o]of Object.entries(t.extensions))Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0});if(xn(e.extensions))for(let[i,o]of Object.entries(e.extensions))Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0});let n=Object.keys(r).length>0?{extensions:r}:{};return Zt(n)}function Zt(t){if(t!==void 0&&(An(t),!(!t.extensions||Object.keys(t.extensions).length===0)))return ya(t)}function Fg(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Hi(t[r],e[r]))return!1;return!0}function $g(t,e){let r=Object.keys(t).filter(i=>t[i]!==void 0),n=Object.keys(e).filter(i=>e[i]!==void 0);if(r.length!==n.length)return!1;for(let i of r)if(!Object.prototype.hasOwnProperty.call(e,i)||!Hi(t[i],e[i]))return!1;return!0}function Hi(t,e){return Object.is(t,e)?!0:Array.isArray(t)&&Array.isArray(e)?Fg(t,e):xn(t)&&xn(e)?$g(t,e):!1}function Ki(t,e){return Hi(t,e)}function pi(t,e){return t._def.a2uiChildRef=e,t}function Fr(t){return t?._def?.a2uiChildRef}var Dn=pi(d.string().describe("REF:common_types.json#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface."),"component-id"),Cn=d.object({path:d.string().describe("A JSON Pointer path to a value in the data model.").optional(),"@path":d.string().describe("A JSON Pointer path to a value in the data model.").optional()}).refine(t=>t["@path"]!==void 0||t.path!==void 0,{message:"Either '@path' or 'path' must be provided."}).describe("REF:common_types.json#/$defs/DataBinding"),dr=d.object({call:d.string().describe("The name of the function to call.").optional(),"@call":d.string().describe("The name of the function to call.").optional(),args:d.record(d.string(),d.unknown()).describe("Arguments passed to the function.").optional(),returnType:d.enum(["string","number","boolean","array","object","any","void"]).describe("The expected return type of the function call.").optional(),catalogId:d.string().describe("The catalog ID for this function, overriding any surface-level default catalogId.").optional()}).strict().refine(t=>t["@call"]!==void 0||t.call!==void 0,{message:"Either '@call' or 'call' must be provided."}).describe("REF:common_types.json#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition."),Yo=d.union([d.string(),Cn,dr]).describe("REF:common_types.json#/$defs/DynamicString|Represents a string"),ba=d.union([d.boolean(),Cn,dr]).describe("REF:common_types.json#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its \\'valid\\' boolean)."),hi=d.object({label:Yo.optional(),description:Yo.optional(),live:d.enum(["off","polite","assertive"]).default("off").describe("Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.").optional(),hidden:ba.optional()}).describe("REF:common_types.json#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding."),Su=d.record(d.string(),d.unknown()).superRefine((t,e)=>{for(let r in t)lr(r)||e.addIssue({path:[r],code:d.ZodIssueCode.custom,message:`Invalid extension key "${r}": Keys MUST be Unicode identifiers (UAX #31).`})}).describe("REF:#/$defs/Extensions|Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions."),Ji=d.object({id:Dn,accessibility:hi.optional(),catalogId:d.string().describe("The catalog ID for this component, overriding any surface-level default catalogId.").optional(),metadata:d.object({extensions:Su.optional()}).strict().describe("Optional component-level metadata for vendor extensions.").optional()}).describe("REF:common_types.json#/$defs/ComponentCommon"),_u=pi(d.union([d.array(Dn).describe("A static list of child component IDs."),d.object({componentId:Dn,path:d.string().describe("The path to the list of component property objects in the data model.")}).describe("A template for generating a dynamic list of children.")]).describe("REF:common_types.json#/$defs/ChildList"),"child-list"),Rg=d.union([d.string(),d.number(),d.boolean(),d.array(d.unknown()),Cn,dr,d.record(d.string(),d.unknown()).refine(t=>!t||!("@path"in t)&&!("path"in t)&&!("@call"in t)&&!("call"in t))]).describe("REF:common_types.json#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type."),Iu=d.union([d.number(),Cn,dr]).describe("REF:common_types.json#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number."),Tg=d.union([d.array(d.string()),Cn,dr]).describe("REF:common_types.json#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array."),ku=d.object({condition:d.union([ba,Cn,dr]).describe("Path or function call evaluating to a structured validation result object or a boolean."),message:d.string().describe("Optional fallback error message.").optional()}).describe("REF:common_types.json#/$defs/CheckRule|A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object)."),Og=d.object({checks:d.array(ku).describe("A list of validation check rules to perform on the component.").optional()}).describe("REF:common_types.json#/$defs/Checkable|Properties for components that support renderer-side checks."),Ng=d.union([d.object({event:d.object({name:d.string().describe("The name of the action to be dispatched to the server."),context:d.record(d.string(),d.unknown()).describe("A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.").optional()}).strict().describe("The event to dispatch to the server.")}).strict().describe("Triggers a server-side event."),d.object({functionCall:dr}).strict().describe("Executes a local client-side function."),d.object({event:d.object({name:d.string().describe("The name of the action to be dispatched to the agent."),userMessage:Yo.optional(),context:d.record(d.string(),d.unknown()).describe("A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.").optional()}).strict().describe("The event to dispatch to the agent.")}).strict().describe("Triggers an agent-side event."),d.object({functionCall:dr}).strict().describe("Executes a renderer or agent-side function.")]).describe("REF:common_types.json#/$defs/Action|Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function."),Fu=d.string().describe("REF:common_types.json#/$defs/CallId|The unique identifier for a function call."),jg=Dn,Pg=d.object({call:d.string().describe("The name of the function to call.").optional(),"@call":d.string().describe("The name of the function to call.").optional(),catalogId:d.string().describe("The catalog ID for this function, overriding any surface-level default catalogId.").optional()}).refine(t=>t["@call"]!==void 0||t.call!==void 0,{message:"Either '@call' or 'call' must be provided."}).describe("REF:common_types.json#/$defs/FunctionCommon|Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog."),Mg=d.object({call:d.literal("@index").optional(),"@call":d.literal("@index").optional(),args:d.object({offset:Iu.optional()}).optional()}).refine(t=>t["@call"]!==void 0||t.call!==void 0,{message:"Either '@call' or 'call' must be '@index'."}).describe("REF:common_types.json#/$defs/IndexSystemFunction|Returns the 0-based index of the current item when rendering a dynamic list from a template. This function MUST ONLY be available when evaluating template items within a list context."),Lg=d.object({component:d.literal("Surface").optional(),child:d.literal("root").optional()}).strict().describe("REF:common_types.json#/$defs/Surface|The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has \\'child\\': \\'root\\'."),Bg=d.object({functionCallId:Fu,value:d.unknown().describe("The return value of the function.").optional(),error:d.object({code:d.string(),message:d.string()}).strict().describe("An error object indicating failure of the function execution.").optional()}).strict().describe("REF:common_types.json#/$defs/FunctionResponse|The return response matching a callAgentFunction or callRendererFunction invocation."),Yi={ComponentId:Dn,DataBinding:Cn,FunctionCall:dr,DynamicString:Yo,DynamicBoolean:ba,AccessibilityAttributes:hi,Extensions:Su,ComponentCommon:Ji,ChildList:_u,DynamicValue:Rg,DynamicNumber:Iu,DynamicStringList:Tg,CheckRule:ku,Checkable:Og,Action:Ng,CallId:Fu,Child:jg,FunctionCommon:Pg,IndexSystemFunction:Mg,Surface:Lg,FunctionResponse:Bg};var Xo=Symbol("Let zodToJsonSchema decide on which parser to use");var $u={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Ru=t=>typeof t=="string"?{...$u,name:t}:{...$u,...t};var Tu=t=>{let e=Ru(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function va(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function se(t,e,r,n,i){t[e]=r,va(t,e,n,i)}var Qo=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function fe(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Qo(e,t.currentPath):e.join("/")}}function Ou(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==S.ZodAny&&(r.items=B(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&se(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&se(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(se(r,"minItems",t.exactLength.value,t.exactLength.message,e),se(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Nu(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?se(r,"minimum",n.value,n.message,e):se(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),se(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?se(r,"maximum",n.value,n.message,e):se(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),se(r,"maximum",n.value,n.message,e));break;case"multipleOf":se(r,"multipleOf",n.value,n.message,e);break}return r}function ju(){return{type:"boolean"}}function es(t,e){return B(t.type._def,e)}var Pu=(t,e)=>B(t.innerType._def,e);function xa(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,o)=>xa(t,e,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Vg(t,e)}}var Vg=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":se(r,"minimum",n.value,n.message,e);break;case"max":se(r,"maximum",n.value,n.message,e);break}return r};function Mu(t,e){return{...B(t.innerType._def,e),default:t.defaultValue()}}function Lu(t,e){return e.effectStrategy==="input"?B(t.schema._def,e):fe(e)}function Bu(t){return{type:"string",enum:Array.from(t.values)}}var Ug=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Vu(t,e){let r=[B(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return r.forEach(o=>{if(Ug(o))i.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else n=void 0;i.push(s)}}),i.length?{allOf:i,...n}:void 0}function Uu(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Aa,Tt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Aa===void 0&&(Aa=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Aa),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ts(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":se(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":se(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ot(r,"email",n.message,e);break;case"format:idn-email":Ot(r,"idn-email",n.message,e);break;case"pattern:zod":Ze(r,Tt.email,n.message,e);break}break;case"url":Ot(r,"uri",n.message,e);break;case"uuid":Ot(r,"uuid",n.message,e);break;case"regex":Ze(r,n.regex,n.message,e);break;case"cuid":Ze(r,Tt.cuid,n.message,e);break;case"cuid2":Ze(r,Tt.cuid2,n.message,e);break;case"startsWith":Ze(r,RegExp(`^${Da(n.value,e)}`),n.message,e);break;case"endsWith":Ze(r,RegExp(`${Da(n.value,e)}$`),n.message,e);break;case"datetime":Ot(r,"date-time",n.message,e);break;case"date":Ot(r,"date",n.message,e);break;case"time":Ot(r,"time",n.message,e);break;case"duration":Ot(r,"duration",n.message,e);break;case"length":se(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),se(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Ze(r,RegExp(Da(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Ot(r,"ipv4",n.message,e),n.version!=="v4"&&Ot(r,"ipv6",n.message,e);break}case"base64url":Ze(r,Tt.base64url,n.message,e);break;case"jwt":Ze(r,Tt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Ze(r,Tt.ipv4Cidr,n.message,e),n.version!=="v4"&&Ze(r,Tt.ipv6Cidr,n.message,e);break}case"emoji":Ze(r,Tt.emoji(),n.message,e);break;case"ulid":{Ze(r,Tt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ot(r,"binary",n.message,e);break}case"contentEncoding:base64":{se(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Ze(r,Tt.base64,n.message,e);break}}break}case"nanoid":Ze(r,Tt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Da(t,e){return e.patternStrategy==="escape"?qg(t):t}var zg=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function qg(t){let e="";for(let r=0;r<t.length;r++)zg.has(t[r])||(e+="\\"),e+=t[r];return e}function Ot(t,e,r,n){t.format||t.anyOf?.some(i=>i.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):se(t,"format",e,r,n)}function Ze(t,e,r,n){t.pattern||t.allOf?.some(i=>i.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:zu(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):se(t,"pattern",zu(e,n),r,n)}function zu(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,i="",o=!1,s=!1,a=!1;for(let c=0;c<n.length;c++){if(o){i+=n[c],o=!1;continue}if(r.i){if(s){if(n[c].match(/[a-z]/)){a?(i+=n[c],i+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(i+=n[c],a=!0):i+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){i+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){i+=`(^|(?<=[\r
2
+ ]))`;continue}else if(n[c]==="$"){i+=`($|(?=[\r
3
+ ]))`;continue}}if(r.s&&n[c]==="."){i+=s?`${n[c]}\r
4
+ `:`[${n[c]}\r
5
+ ]`;continue}i+=n[c],n[c]==="\\"?o=!0:s&&n[c]==="]"?s=!1:!s&&n[c]==="["&&(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return i}function rs(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===S.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,i)=>({...n,[i]:B(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",i]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:B(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===S.ZodString&&t.keyType._def.checks?.length){let{type:n,...i}=ts(t.keyType._def,e);return{...r,propertyNames:i}}else{if(t.keyType?._def.typeName===S.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===S.ZodBranded&&t.keyType._def.type._def.typeName===S.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...i}=es(t.keyType._def,e);return{...r,propertyNames:i}}}return r}function qu(t,e){if(e.mapStrategy==="record")return rs(t,e);let r=B(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),n=B(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Zu(t){let e=t.values,n=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),i=Array.from(new Set(n.map(o=>typeof o)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:n}}function Wu(t){return t.target==="openAi"?void 0:{not:fe({...t,currentPath:[...t.currentPath,"not"]})}}function Gu(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Xi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Ku(t,e){if(e.target==="openApi3")return Hu(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Xi&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((i,o)=>{let s=Xi[o._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((i,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(o._def.value===null)return[...i,"null"];default:return i}},[]);if(n.length===r.length){let i=n.filter((o,s,a)=>a.indexOf(o)===s);return{type:i.length>1?i:i[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,i)=>[...n,...i._def.values.filter(o=>!n.includes(o))],[])};return Hu(t,e)}var Hu=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,i)=>B(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Ju(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Xi[t.innerType._def.typeName],nullable:!0}:{type:[Xi[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=B(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=B(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Yu(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",va(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?se(r,"minimum",n.value,n.message,e):se(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),se(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?se(r,"maximum",n.value,n.message,e):se(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),se(r,"maximum",n.value,n.message,e));break;case"multipleOf":se(r,"multipleOf",n.value,n.message,e);break}return r}function Xu(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},i=[],o=t.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=Wg(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=B(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||i.push(a))}i.length&&(n.required=i);let s=Zg(t,e);return s!==void 0&&(n.additionalProperties=s),n}function Zg(t,e){if(t.catchall._def.typeName!=="ZodNever")return B(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Wg(t){try{return t.isOptional()}catch{return!0}}var Qu=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(t.innerType._def,e);let r=B(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:fe(e)},r]}:fe(e)};var el=(t,e)=>{if(e.pipeStrategy==="input")return B(t.in._def,e);if(e.pipeStrategy==="output")return B(t.out._def,e);let r=B(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=B(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(i=>i!==void 0)}};function tl(t,e){return B(t.type._def,e)}function rl(t,e){let n={type:"array",uniqueItems:!0,items:B(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&se(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&se(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function nl(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>B(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:B(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>B(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function il(t){return{not:fe(t)}}function ol(t){return fe(t)}var sl=(t,e)=>B(t.innerType._def,e);var al=(t,e,r)=>{switch(e){case S.ZodString:return ts(t,r);case S.ZodNumber:return Yu(t,r);case S.ZodObject:return Xu(t,r);case S.ZodBigInt:return Nu(t,r);case S.ZodBoolean:return ju();case S.ZodDate:return xa(t,r);case S.ZodUndefined:return il(r);case S.ZodNull:return Gu(r);case S.ZodArray:return Ou(t,r);case S.ZodUnion:case S.ZodDiscriminatedUnion:return Ku(t,r);case S.ZodIntersection:return Vu(t,r);case S.ZodTuple:return nl(t,r);case S.ZodRecord:return rs(t,r);case S.ZodLiteral:return Uu(t,r);case S.ZodEnum:return Bu(t);case S.ZodNativeEnum:return Zu(t);case S.ZodNullable:return Ju(t,r);case S.ZodOptional:return Qu(t,r);case S.ZodMap:return qu(t,r);case S.ZodSet:return rl(t,r);case S.ZodLazy:return()=>t.getter()._def;case S.ZodPromise:return tl(t,r);case S.ZodNaN:case S.ZodNever:return Wu(r);case S.ZodEffects:return Lu(t,r);case S.ZodAny:return fe(r);case S.ZodUnknown:return ol(r);case S.ZodDefault:return Mu(t,r);case S.ZodBranded:return es(t,r);case S.ZodReadonly:return sl(t,r);case S.ZodCatch:return Pu(t,r);case S.ZodPipeline:return el(t,r);case S.ZodFunction:case S.ZodVoid:case S.ZodSymbol:return;default:return(n=>{})(e)}};function B(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Xo)return a}if(n&&!r){let a=Gg(n,e);if(a!==void 0)return a}let i={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,i);let o=al(t,t.typeName,e),s=typeof o=="function"?B(o(),e):o;if(s&&Hg(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return i.jsonSchema=s,a}return i.jsonSchema=s,s}var Gg=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Qo(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Hg=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var st=(t,e)=>{let r=Tu(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:B(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??fe(r)}),{}):void 0,i=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=B(t._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1)??fe(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(o.title=s),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=i===void 0?n?{...o,[r.definitionPath]:n}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...n,[i]:o}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};var cl=new WeakSet;function ul(t){let e=d.any().superRefine((r,n)=>{let i=0;for(let o of t)if(o.safeParse(r).success&&++i>1){n.addIssue({code:d.ZodIssueCode.custom,message:"Value matched more than one schema in oneOf"});return}});return cl.add(e._def),e.pipe(d.union(t))}var At=(t,e)=>{let r=t;if(!r.in||!r.out||!cl.has(r.in._def))return Xo;let i=r.out._def.options.map((o,s)=>B(o._def,{...e,currentPath:[...e.currentPath,"oneOf",`${s}`]})).filter(o=>o!==void 0);return t.description===void 0?{oneOf:i}:{oneOf:i,description:t.description}};var Qi=new WeakMap;function to(t){return Qi.get(t)}function dl(t,e){for(let[r,n]of Object.entries(e)){let i=!1,o;Object.defineProperty(t,r,{enumerable:!0,get(){return i||(o=n(),i=!0),o}})}}function Ca(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ll(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):void 0}var ns=class{constructor(e,r,n){this.name=e,Qi.set(this,r),dl(this,{schema:()=>n(r),allowedParents:()=>ll(r.allowedParents),allowedChildren:()=>ll(r.allowedChildren),metadata:()=>Ca(r.metadata)?r.metadata:void 0}),Object.freeze(this)}get jsonSchema(){return Qi.get(this)}},eo=class{constructor(e,r,n){this.name=e,Qi.set(this,r);let i=Ca(r.properties)?r.properties:void 0,o=s=>{let a=i?.[s];return Ca(a)?a.const:void 0};dl(this,{schema:()=>n(r),returnType:()=>{let s=r.returnType??o("returnType");return typeof s=="string"?s:"any"},description:()=>typeof r.description=="string"?r.description:void 0,allowedCallers:()=>r.allowedCallers??o("allowedCallers"),requiresUserActivation:()=>r.requiresUserActivation??o("requiresUserActivation")}),Object.freeze(this)}get jsonSchema(){return Qi.get(this)}};var $r=new WeakMap;function fl(t,e,r=t.description){let n=d.ZodType.prototype.describe.call(t,r);return $r.set(n,e),n.describe=i=>fl(n,$r.get(n)??e,i),n}function W(t,e){let r=d.ZodType.prototype.describe.call(t,t.description);return $r.set(r,{...$r.get(t),...e}),r}function pl(t,e,r={}){let n=fl(e,{...$r.get(e),...r,defName:t});return $r.set(n,{...$r.get(n),defName:t,defModel:n}),n}function mi(t){return typeof t=="object"&&t!==null?$r.get(t):void 0}var hl={childRefNames:new Set(["ComponentId","Child","ChildComponentId"]),childListRefNames:new Set(["ChildList","TemplateChildList"]),childPropertyNames:new Set(["child","entryPointChild","contentChild"])},ml={ComponentId:{description:"The unique identifier for a component, used for both definitions and references within the same surface.",type:"string"},TextItem:{additionalProperties:!1,description:"The value of the text field. This can be a literal string or a reference to a value in the data model ('path', e.g. '/user/name').",properties:{literalString:{type:"string"},path:{type:"string"}},type:"object"},UrlItem:{additionalProperties:!1,description:"The URL of the audio to be played. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/song/url').",properties:{literalString:{type:"string"},path:{type:"string"}},type:"object"},AltTextItem:{additionalProperties:!1,description:"The alt text for the image. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/thumbnail/altText').",properties:{literalString:{type:"string"},path:{type:"string"}},type:"object"},NameItem:{additionalProperties:!1,description:"The name of the icon to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/form/submit').",properties:{literalString:{enum:["accountCircle","add","arrowBack","arrowForward","attachFile","calendarToday","call","camera","check","close","delete","download","edit","event","error","favorite","favoriteOff","folder","help","home","info","locationOn","lock","lockOpen","mail","menu","moreVert","moreHoriz","notificationsOff","notifications","payment","person","phone","photo","print","refresh","search","send","settings","share","shoppingCart","star","starHalf","starOff","upload","visibility","visibilityOff","warning"],type:"string"},path:{type:"string"}},type:"object"},DescriptionItem:{additionalProperties:!1,description:"A description of the audio, such as a title or summary. This can be a literal string or a reference to a value in the data model ('path', e.g. '/song/title').",properties:{literalString:{type:"string"},path:{type:"string"}},type:"object"},ChildrenItem:{additionalProperties:!1,description:"Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.",properties:{explicitList:{items:{type:"string"},type:"array"},template:{$ref:"#/$defs/TemplateItem",description:"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children."}},type:"object"},TemplateItem:{additionalProperties:!1,description:"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.",properties:{componentId:{type:"string"},dataBinding:{type:"string"}},required:["componentId","dataBinding"],type:"object"},TabItemItem:{additionalProperties:!1,properties:{child:{type:"string"},title:{$ref:"#/$defs/TitleItem"}},required:["title","child"],type:"object"},TitleItem:{additionalProperties:!1,description:"The tab title. Defines the value as either a literal value or a path to data model value (e.g. '/options/title').",properties:{literalString:{type:"string"},path:{type:"string"}},type:"object"},ActionItem:{additionalProperties:!1,description:"The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.",properties:{context:{items:{$ref:"#/$defs/ContextItem"},type:"array"},name:{type:"string"}},required:["name"],type:"object"},ContextItem:{additionalProperties:!1,properties:{key:{type:"string"},value:{$ref:"#/$defs/ValueItem",description:"Defines the value to be included in the context as either a literal value or a path to a data model value (e.g. '/user/name')."}},required:["key","value"],type:"object"},ValueItem:{additionalProperties:!1,description:"The current value of the slider. This can be a literal number ('literalNumber') or a reference to a value in the data model ('path', e.g. '/restaurant/cost').",properties:{literalNumber:{type:"number"},path:{type:"string"}},type:"object"},LabelItem:{additionalProperties:!1,description:"The label for the slider. This can be a literal string or a reference to a value in the data model ('path').",properties:{literalString:{type:"string"},path:{type:"string"}},type:"object"},OptionItem:{additionalProperties:!1,properties:{label:{$ref:"#/$defs/LabelItem",description:"The text to display for this option. This can be a literal string or a reference to a value in the data model (e.g. '/option/label')."},value:{description:"The value to be associated with this option when selected.",type:"string"}},required:["label","value"],type:"object"},SelectionItem:{additionalProperties:!1,description:"The currently selected values for the component. This can be a literal array of strings or a path to an array in the data model('path', e.g. '/hotel/options').",properties:{literalArray:{items:{type:"string"},type:"array"},path:{type:"string"}},type:"object"}};var gl={childRefNames:new Set(["ComponentId","Child","ChildComponentId"]),childListRefNames:new Set(["ChildList","TemplateChildList","ChildrenItem","TemplateItem"])},is={ComponentId:{type:"string",description:"The unique identifier for a component, used for both definitions and references within the same surface."},AccessibilityAttributes:{type:"object",description:"Attributes to enhance accessibility when using assistive technologies like screen readers.",properties:{label:{$ref:"#/$defs/DynamicString",description:"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'."},description:{$ref:"#/$defs/DynamicString",description:"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'."}}},ComponentCommon:{type:"object",properties:{id:{$ref:"#/$defs/ComponentId"},accessibility:{$ref:"#/$defs/AccessibilityAttributes"}},required:["id"]},ChildList:{oneOf:[{type:"array",description:"A static list of child component IDs.",items:{$ref:"#/$defs/ComponentId"}},{type:"object",description:"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.",properties:{componentId:{$ref:"#/$defs/ComponentId"},path:{type:"string",description:"The path to the list of component property objects in the data model."}},required:["componentId","path"],additionalProperties:!1}]},DataBinding:{type:"object",properties:{path:{type:"string",description:"A JSON Pointer path to a value in the data model."}},required:["path"],additionalProperties:!1},DynamicValue:{description:"A value that can be a literal, a path, or a function call returning any type.",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},DynamicString:{description:"Represents a string",oneOf:[{type:"string"},{$ref:"#/$defs/DataBinding"},{allOf:[{$ref:"#/$defs/FunctionCall"},{properties:{returnType:{const:"string"}}}]}]},DynamicNumber:{description:"Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.",oneOf:[{type:"number"},{$ref:"#/$defs/DataBinding"},{allOf:[{$ref:"#/$defs/FunctionCall"},{properties:{returnType:{const:"number"}}}]}]},DynamicBoolean:{description:"A boolean value that can be a literal, a path, or a function call returning a boolean.",oneOf:[{type:"boolean"},{$ref:"#/$defs/DataBinding"},{allOf:[{$ref:"#/$defs/FunctionCall"},{properties:{returnType:{const:"boolean"}}}]}]},DynamicStringList:{description:"Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.",oneOf:[{type:"array",items:{type:"string"}},{$ref:"#/$defs/DataBinding"},{allOf:[{$ref:"#/$defs/FunctionCall"},{properties:{returnType:{const:"array"}}}]}]},FunctionCall:{type:"object",description:"Invokes a named function on the client.",properties:{call:{type:"string",description:"The name of the function to call."},args:{type:"object",description:"Arguments passed to the function.",additionalProperties:{anyOf:[{$ref:"#/$defs/DynamicValue"},{type:"object",description:"A literal object argument (e.g. configuration)."}]}},returnType:{type:"string",description:"The expected return type of the function call.",enum:["string","number","boolean","array","object","any","void"],default:"boolean"}},required:["call"],oneOf:[{$ref:"catalog.json#/$defs/anyFunction"}]},CheckRule:{type:"object",description:"A single validation rule applied to an input component.",properties:{condition:{$ref:"#/$defs/DynamicBoolean"},message:{type:"string",description:"The error message to display if the check fails."}},required:["condition","message"],additionalProperties:!1},Checkable:{type:"object",description:"Properties for components that support client-side checks.",properties:{checks:{type:"array",description:"A list of checks to perform. These are function calls that must return a boolean indicating validity.",items:{$ref:"#/$defs/CheckRule"}}}},Action:{description:"Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.",oneOf:[{type:"object",description:"Triggers a server-side event.",properties:{event:{type:"object",description:"The event to dispatch to the server.",properties:{name:{type:"string",description:"The name of the action to be dispatched to the server."},context:{type:"object",description:"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.",additionalProperties:{$ref:"#/$defs/DynamicValue"}}},required:["name"],additionalProperties:!1}},required:["event"],additionalProperties:!1},{type:"object",description:"Executes a local client-side function.",properties:{functionCall:{$ref:"#/$defs/FunctionCall"}},required:["functionCall"],additionalProperties:!1}]}};var yl={childRefNames:new Set(["ComponentId","Child","ChildComponentId"]),childListRefNames:new Set(["ChildList","TemplateChildList","ChildrenItem","TemplateItem"])},wa={ComponentId:{type:"string",description:"The unique identifier for a component, used for both definitions and references within the same surface."},CallId:{type:"string",description:"The unique identifier for a function call."},AccessibilityAttributes:{type:"object",description:"Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.",properties:{label:{$ref:"#/$defs/DynamicString",description:"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'."},description:{$ref:"#/$defs/DynamicString",description:"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'."},live:{type:"string",description:"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.",enum:["off","polite","assertive"],default:"off"},hidden:{$ref:"#/$defs/DynamicBoolean",description:"Hides the element and its children from assistive technologies when true. Default is false."}},additionalProperties:!1},Extensions:{type:"object",description:"Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.",patternProperties:{"^[\\p{XID_Start}_][\\p{XID_Continue}]*$":{}},additionalProperties:!1},ComponentCommon:{type:"object",properties:{id:{$ref:"#/$defs/ComponentId"},catalogId:{type:"string",description:"The catalog ID for this component, overriding any surface-level default catalogId."},accessibility:{$ref:"#/$defs/AccessibilityAttributes"},metadata:{type:"object",description:"Optional component-level metadata for vendor extensions.",properties:{extensions:{$ref:"#/$defs/Extensions"}},additionalProperties:!1}},required:["id"]},Child:{$ref:"#/$defs/ComponentId",description:"A reference to a single child component ID."},ChildList:{oneOf:[{type:"array",description:"A static list of child component IDs.",items:{$ref:"#/$defs/ComponentId"}},{type:"object",description:"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.",properties:{componentId:{$ref:"#/$defs/ComponentId"},path:{type:"string",description:"The path to the list of component property objects in the data model."}},required:["componentId","path"],additionalProperties:!1}]},DataBinding:{type:"object",properties:{"@path":{type:"string",description:"A JSON Pointer path to a value in the data model."}},required:["@path"],additionalProperties:!1},DynamicValue:{description:"A value that can be a literal, a path, or a function call returning any type.",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object",propertyNames:{not:{pattern:"^@([^@]|$)"}},not:{anyOf:[{required:["@path"]},{required:["@call"]}]}},{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},DynamicString:{description:"Represents a string",oneOf:[{type:"string"},{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},DynamicNumber:{description:"Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.",oneOf:[{type:"number"},{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},DynamicBoolean:{description:"A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its 'valid' boolean).",oneOf:[{type:"boolean"},{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},DynamicStringList:{description:"Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.",oneOf:[{type:"array",items:{type:"string"}},{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},FunctionCommon:{type:"object",description:"Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.",properties:{"@call":{type:"string",description:"The name of the function to call."},catalogId:{type:"string",description:"The catalog ID for this function, overriding any surface-level default catalogId."}},required:["@call"]},IndexSystemFunction:{type:"object",description:"Returns the 0-based index of the current item when rendering a dynamic list from a template. This function MUST ONLY be available when evaluating template items within a list context.",properties:{"@call":{const:"@index"},args:{type:"object",properties:{offset:{$ref:"#/$defs/DynamicNumber",description:"Optional. An offset to add to the 0-based index (e.g., 1 for 1-based indexing). Defaults to 0.",default:0}},unevaluatedProperties:!1}},required:["@call"],unevaluatedProperties:!1},FunctionCall:{type:"object",description:"Invokes a named function, combining common function properties with the catalog function definition.",allOf:[{$ref:"#/$defs/FunctionCommon"},{oneOf:[{$ref:"catalog.json#/$defs/anyFunction"},{$ref:"#/$defs/IndexSystemFunction"}]}],unevaluatedProperties:!1},CheckRule:{type:"object",description:"A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).",properties:{condition:{description:"Path or function call evaluating to a structured validation result object or a boolean.",oneOf:[{$ref:"#/$defs/DataBinding"},{$ref:"#/$defs/FunctionCall"}]},message:{type:"string",description:"Optional fallback error message."}},required:["condition"],additionalProperties:!1},Checkable:{type:"object",description:"Properties for components that support renderer-side checks.",properties:{checks:{type:"array",description:"A list of validation check rules to perform on the component.",items:{$ref:"#/$defs/CheckRule"}}}},Action:{description:"Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.",oneOf:[{type:"object",description:"Triggers an agent-side event.",properties:{event:{type:"object",description:"The event to dispatch to the agent.",properties:{name:{type:"string",description:"The name of the action to be dispatched to the agent."},userMessage:{$ref:"#/$defs/DynamicString",description:"An optional human-readable message describing the action performed by the user, resolved by the renderer and included in the outbound action message."},context:{type:"object",description:"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.",additionalProperties:{$ref:"#/$defs/DynamicValue"}}},required:["name"],additionalProperties:!1}},required:["event"],additionalProperties:!1},{type:"object",description:"Executes a renderer or agent-side function.",properties:{functionCall:{$ref:"#/$defs/FunctionCall"}},required:["functionCall"],additionalProperties:!1}]},Surface:{title:"Surface Container Component",description:"The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has 'child': 'root'.",type:"object",allowedParents:[],properties:{component:{const:"Surface"},child:{const:"root"}},additionalProperties:!1},FunctionResponse:{type:"object",description:"The return response matching a callAgentFunction or callRendererFunction invocation.",properties:{functionCallId:{$ref:"#/$defs/CallId",description:"The unique ID matching the initiating function call."},value:{description:"The return value of the function."},error:{type:"object",description:"An error object indicating failure of the function execution.",properties:{code:{type:"string"},message:{type:"string"}},required:["code","message"],additionalProperties:!1}},required:["functionCallId"],oneOf:[{required:["value"]},{required:["error"]}],additionalProperties:!1}};var Rr="common_types.json",bl={"0.8":ml,"0.9":is,"0.9.1":is,"1.0":wa};function Fa(t){if(t){let e=Ae(t)??ur(t);if(e in bl)return bl[e];if(oe(t,"1.0"))return wa}return is}function vl(t){return JSON.parse(JSON.stringify(t))}function Dt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $a=8;function xl(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function _a(t,e,r){let n=t;for(let i=0;Dt(n)&&typeof n.$ref=="string";i++){if(i+r>$a)return;n=e(n.$ref)}return Dt(n)?n:void 0}function Al(t){let e=t.type;if(typeof e=="string"||Array.isArray(e))return new Set([].concat(e).map(r=>r==="integer"?"number":String(r)));if(Object.hasOwn(t,"const"))return new Set([xl(t.const)]);if(Array.isArray(t.enum))return new Set(t.enum.map(xl))}function Dl(t){let e;if(Object.hasOwn(t,"const"))e=[t.const];else if(Array.isArray(t.enum))e=t.enum;else return;if(!e.some(r=>typeof r=="object"&&r!==null))return e.map(r=>JSON.stringify(r))}function Ia(t,e,r){let n=new Set;if(Array.isArray(t.required))for(let i of t.required)n.add(String(i));if(r<$a&&Array.isArray(t.allOf))for(let i of t.allOf){let o=_a(i,e,r+1);if(o)for(let s of Ia(o,e,r+1))n.add(s)}return n}function Cl(t){if(t.additionalProperties!==!1||Object.hasOwn(t,"patternProperties"))return;let e=t.properties;return new Set(Dt(e)?Object.keys(e):[])}function wl(t,e){let r=t.properties;return Dt(r)?r[e]:void 0}function _l(t,e,r,n=0){if(n>$a)return!1;let i=_a(t,r,n),o=_a(e,r,n);if(!i||!o)return!1;let s=Al(i),a=Al(o);if(s&&a&&![...s].some(y=>a.has(y)))return!0;let c=Dl(i),u=Dl(o);if(c&&u&&!c.some(y=>u.includes(y)))return!0;let l=y=>y!==void 0&&y.size===1&&y.has("object");if(!l(s)||!l(a))return!1;let f=Ia(i,r,n),h=Ia(o,r,n),p=Cl(i),m=Cl(o);return p&&[...h].some(y=>!p.has(y))||m&&[...f].some(y=>!m.has(y))?!0:[...f].some(y=>h.has(y)&&_l(wl(i,y),wl(o,y),r,n+1))}function wn(t){return t._def}var Ea=new Set(["id","component"]);function Il(t){return gi(t).mixins!==void 0}function kl(t){return Object.keys(gi(t)).length>0}function fr(t,e,r=new Set){if(!Dt(t)||t.default!==void 0)return!1;if(Array.isArray(t.required)&&t.required.length>0||typeof t.minProperties=="number"&&t.minProperties>0)return!0;let n=t.$ref;if(typeof n=="string"&&e&&n.startsWith("#/$defs/")&&!r.has(n)){let i=e;for(let o of n.slice(8).split("/")){let s=o.replace(/~1/g,"/").replace(/~0/g,"~");i=Dt(i)&&Object.hasOwn(i,s)?i[s]:void 0}if(i!==void 0&&fr(i,e,new Set(r).add(n)))return!0}return!!(Array.isArray(t.allOf)&&t.allOf.some(i=>fr(i,e,r))||Array.isArray(t.oneOf)&&t.oneOf.length>0&&t.oneOf.every(i=>fr(i,e,r))||Array.isArray(t.anyOf)&&t.anyOf.length>0&&t.anyOf.every(i=>fr(i,e,r)))}function gi(t,e){let r=[],n=e?mi(e):void 0,i=t;for(;i&&typeof i=="object"&&"_def"in i;){let o=mi(i);if(e!==void 0&&(i===e||o&&o===n))break;o&&r.push(o);let s=ro(i);if(!s)break;i=s}return r.reduceRight((o,s)=>({...o,...s}),{})}function ro(t){let e=wn(t);switch(e.typeName){case"ZodOptional":case"ZodDefault":case"ZodCatch":case"ZodReadonly":return e.innerType;case"ZodEffects":return e.schema;case"ZodBranded":return e.type;default:return}}var no=class{constructor(e,r=Rr){this.commonTypesUri=r,this.standardDefsInCatalog=new Map,this.isV08=!oe(e,"0.9"),this.isV10=oe(e,"1.0"),this.standardDefs=Fa(e)}componentSchema(e,r,n,i){let o=new Map,s;if(this.isV08){s=this.toJson(r,o);let a=s.properties;if(Dt(a))for(let c of Ea)delete a[c];if(Array.isArray(s.required)){let c=s.required.filter(u=>!Ea.has(u));c.length>0?s.required=c:delete s.required}}else{let a=gi(r),c=a.mixins??[],u=new Set(Ea),l=[];for(let D of c){l.push({$ref:this.mixinRef(D,o)});for(let _ of this.mixinProperties(D))u.add(_)}let f=Sa(r),h=Kg(r),p=this.objectSchema(f,a,D=>!u.has(D),o),m={component:{const:e},...p.properties},y=["component",...p.required??[]],A={type:"object"};h!==void 0&&!this.isV10&&(A.description=h),A.properties=m,A.required=y,s={type:"object"},this.isV10?(h!==void 0&&(s.description=h),l.length>0?s.allOf=[...l,A]:(s.properties=m,s.required=y)):(s.allOf=[...l,A],s.unevaluatedProperties=!1)}return n&&n.length>0&&(s.allowedParents=[...n]),i&&i.length>0&&(s.allowedChildren=[...i]),{schema:s,catalogDefs:o}}functionSchema(e,r,n,i){let o=this.toJson(r.schema,i),s=fr(o,n),a={type:"object"};return r.description&&(a.description=r.description),this.isV10?(a.returnType=r.returnType,r.allowedCallers&&(a.allowedCallers=r.allowedCallers),r.requiresUserActivation&&(a.requiresUserActivation=!0),a.properties={"@call":{const:e},args:o},a.required=s?["@call","args"]:["@call"],a):(r.allowedCallers&&(a.allowedCallers=r.allowedCallers),r.requiresUserActivation&&(a.requiresUserActivation=!0),a.properties={call:{const:e},args:o,returnType:{const:r.returnType}},a.required=s?["call","args"]:["call"],a.unevaluatedProperties=!1,a)}defSchema(e,r){return this.toJson(e,r,!0)}mixinRef(e,r){if(typeof e=="string")return`${this.commonTypesUri}#/$defs/${e}`;let n=gi(e).defName;if(n===void 0)throw new Error("A component mixin model must be named with specDef().");return r.set(n,e),`#/$defs/${n}`}mixinProperties(e){if(typeof e!="string"){let i=Sa(e);return wn(i).typeName==="ZodObject"?Object.keys(i.shape):[]}let r=[],n=(i,o)=>{if(!(!Dt(i)||o.has(i))){o.add(i),Dt(i.properties)&&r.push(...Object.keys(i.properties));for(let s of Array.isArray(i.allOf)?i.allOf:[]){let a=Dt(s)?s.$ref:void 0,c=typeof a=="string"&&a.startsWith("#/$defs/")?this.standardDefs[a.substring(8)]:s;n(c,o)}}};return n(this.standardDefs[e],new Set),r}toJson(e,r,n=!1){let i=gi(e),o=ka(e),s=El(e),a=i,c=s,u,l=o;if(!n&&r!==void 0&&i.defName!==void 0&&i.defModel!==void 0){r.set(i.defName,i.defModel),u={$ref:`#/$defs/${i.defName}`},a=gi(e,i.defModel);let h=ka(i.defModel);l=o!==h?o:void 0;let p=El(i.defModel);c=s!==p?s:void 0}else if(o!==void 0&&o.startsWith("REF:")){let h=o.substring(4),p=h.indexOf("|"),m=p===-1?h:h.substring(0,p);l=p===-1?void 0:h.substring(p+1),u={$ref:this.refTarget(m)}}else u=this.coreJson(Sa(e),i,r);a.keywords&&Object.assign(u,vl(a.keywords));let f=a.allOf?{allOf:[u,...a.allOf.map(h=>vl(h))]}:u;return l&&(f.description=l),c!==void 0&&(f.default=c),f}resolveStandardRef(e){let r=`${this.commonTypesUri}#/$defs/`;if(!e.startsWith(r))return;let n=e.substring(r.length);if(n.includes("/")||!Object.hasOwn(this.standardDefs,n))return;let i=this.standardDefsInCatalog.get(n);if(i)return i;let o=this.standardDefs[n];if(!Dt(o))return;let s=this.withCatalogRefs(o);return this.standardDefsInCatalog.set(n,s),s}withCatalogRefs(e){if(Array.isArray(e))return e.map(n=>this.withCatalogRefs(n));if(!Dt(e))return e;let r={};for(let[n,i]of Object.entries(e))r[n]=n==="$ref"&&typeof i=="string"?this.refTarget(i):this.withCatalogRefs(i);return r}refTarget(e){return e.startsWith("#/$defs/")?`${this.commonTypesUri}${e}`:e}coreJson(e,r,n){let i=wn(e);switch(i.typeName){case"ZodObject":return this.objectSchema(e,r,()=>!0,n);case"ZodString":return Jg(i);case"ZodNumber":return Yg(i);case"ZodBoolean":return{type:"boolean"};case"ZodNull":return{type:"null"};case"ZodEnum":return{type:"string",enum:[...i.values]};case"ZodLiteral":return{const:i.value};case"ZodAny":case"ZodUnknown":return{};case"ZodNever":return{not:{}};case"ZodArray":{let o={type:"array",items:this.toJson(i.type,n)},s=i.minLength,a=i.maxLength;return s&&(o.minItems=s.value),a&&(o.maxItems=a.value),o}case"ZodUnion":case"ZodDiscriminatedUnion":{let s=[...i.options].map(u=>this.toJson(u,n)),a=u=>{if(u.startsWith("#/$defs/")&&n!==void 0){let l=u.substring(8),f=n.get(l);if(f!==void 0)return this.defSchema(f,n)}return this.resolveStandardRef(u)};return{[s.every((u,l)=>s.slice(l+1).every(f=>_l(u,f,a)))?"oneOf":"anyOf"]:s}}case"ZodRecord":return{type:"object",additionalProperties:this.toJson(i.valueType,n)};case"ZodLazy":return this.toJson(i.getter(),n);default:return Xg(e)}}objectSchema(e,r,n,i){let o=wn(e);if(o.typeName!=="ZodObject")return this.toJson(e,i);let s=e.shape,a={},c=[];for(let[y,A]of Object.entries(s))n(y)&&(a[y]=this.toJson(A,i),A.isOptional()||c.push(y));let u={type:"object",properties:a},l=r.required?.filter(y=>c.includes(y)),f=c.filter(y=>!l?.includes(y));c.length>0&&(u.required=l?[...l,...f]:c);let h=o.unknownKeys,p=o.catchall,m=r.closure??(h==="strict"?"additionalProperties":"none");return p&&wn(p).typeName!=="ZodNever"?u[m==="none"?"additionalProperties":m]=this.toJson(p,i):m!=="none"&&(u[m]=h==="passthrough"),u}};function Sa(t){let e=t;for(let r=ro(e);r;r=ro(e))e=r;return e}function ka(t){for(let e=t;e;e=ro(e)){let r=wn(e).description;if(typeof r=="string")return r}}function Kg(t){let e=ka(t);return e!==void 0&&!e.startsWith("REF:")?e:void 0}function El(t){for(let e=t;e;e=ro(e)){let r=wn(e);if(r.typeName==="ZodDefault")return r.defaultValue()}}var Sl={email:"email",url:"uri",uuid:"uuid",datetime:"date-time",date:"date",time:"time"};function Jg(t){let e={type:"string"};for(let r of t.checks??[])r.kind==="regex"?e.pattern=r.regex.source:r.kind==="min"?e.minLength=r.value:r.kind==="max"?e.maxLength=r.value:r.kind in Sl&&(e.format=Sl[r.kind]);return e}function Yg(t){let e=t.checks??[],r={type:e.some(n=>n.kind==="int")?"integer":"number"};for(let n of e)n.kind==="min"?r[n.inclusive?"minimum":"exclusiveMinimum"]=n.value:n.kind==="max"&&(r[n.inclusive?"maximum":"exclusiveMaximum"]=n.value);return r}function Xg(t){let e=st(t,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});return delete e.$schema,delete e.definitions,delete e.$defs,e}var Qg=new Set(["anyComponent","anyFunction"]),Na=["theme","themeSchema","styles"];function we(t){return t===void 0?t:JSON.parse(JSON.stringify(t))}function Tr(t){if(typeof t=="object"&&t!==null&&!Object.isFrozen(t)){Object.freeze(t);for(let e of Object.values(t))Tr(e)}return t}function ja(t){return typeof t!="object"||t===null||Object.isFrozen(t)?t:Tr(we(t))}function Wt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function os(t,e){if(Array.isArray(t)){for(let n of t)os(n,e);return}if(!Wt(t))return;let r=t.$ref;typeof r=="string"&&r.startsWith("#/$defs/")&&e.add(r.slice(8).split("/")[0].replace(/~1/g,"/").replace(/~0/g,"~"));for(let n of Object.values(t))os(n,e)}function Ra(t,e){let r=new Set,n=new Set;for(let i of t)os(i,n);for(;n.size>0;){let[i]=n;n.delete(i),!r.has(i)&&(r.add(i),i in e&&os(e[i],n))}return r}function Ta(t,e){let r=to(t);if(!Wt(r))return;let n=e??{};for(let i of Ra([r],n))if(!(i in n)&&!Qg.has(i))return;return r}function Fl(t){return typeof t.name=="string"&&!("properties"in t)}function Tl(t,e,r,n){if(!t)return t;let i=l=>l.map(f=>Ta(f,t)).filter(f=>f!==void 0),o=Ra(i(e),t),s=Object.keys(t).filter(l=>!o.has(l)),a=Ra([...i(r),n,...s.map(l=>t[l])],t),c={},u=!1;for(let[l,f]of Object.entries(t))!o.has(l)||a.has(l)?c[l]=f:u=!0;return u?c:t}function Oa(t,e,r=Rr){if(Array.isArray(t)){for(let n of t)Oa(n,e,r);return}if(Wt(t)){if(typeof t.description=="string"&&t.description.startsWith("REF:")){let n=t.description.substring(4),i=n.indexOf("|"),o=i===-1?n:n.substring(0,i),s=i===-1?"":n.substring(i+1),a=t.default;for(let l of Object.keys(t))delete t[l];let c=o.split(/#\/(?:\$defs|definitions)\//)[1],u=c?.split("/")[0];t.$ref=u===void 0||o.startsWith("#")&&e.has(u)?o:`${r}#/$defs/${c}`,a!==void 0&&(t.default=a),s&&(t.description=s);return}for(let n of["additionalProperties","unevaluatedProperties"]){let i=t[n];Wt(i)&&Object.keys(i).length===0&&(t[n]=!0)}delete t.$schema;for(let n of Object.values(t))Oa(n,e,r)}}function Pa(t,e,r=Rr){if(!t||typeof t!="object"||!("safeParse"in t))return{type:"object",properties:{}};let n=st(t,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});return delete n.definitions,delete n.$defs,Oa(n,e,r),n}function ey(t){if(t.type!=="object")return;let e=t.unevaluatedProperties??t.additionalProperties;delete t.additionalProperties,t.unevaluatedProperties=typeof e=="boolean"||Wt(e)?e:!1}function ty(t,e,r,n=Rr){let i=Pa(e.schema,r,n),{component:o,id:s,...a}=Wt(i.properties)?i.properties:{},c=Array.isArray(i.required)?i.required.filter(f=>f!=="component"&&f!=="id"):[],u=i.unevaluatedProperties??i.additionalProperties,l={type:"object",properties:{component:{const:t},...a},required:["component",...c],unevaluatedProperties:typeof u=="boolean"||Wt(u)?u:!1};return e.allowedParents&&e.allowedParents.length>0&&(l.allowedParents=[...e.allowedParents]),e.allowedChildren&&e.allowedChildren.length>0&&(l.allowedChildren=[...e.allowedChildren]),e.metadata!==void 0&&(l.metadata=we(e.metadata)),l}function $l(t,e,r,n,i,o=Rr,s){let a=Pa(e.schema,r,o);if(i)return{name:t,...e.description?{description:e.description}:{},returnType:e.returnType,parameters:a,...e.allowedCallers?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{}};ey(a);let c=fr(a,s),u={type:"object"};return e.description&&(u.description=e.description),n?(u.returnType=e.returnType,e.allowedCallers&&(u.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(u.requiresUserActivation=e.requiresUserActivation),u.properties={"@call":{const:t},args:a},u.required=c?["@call","args"]:["@call"],u):(e.allowedCallers&&(u.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(u.requiresUserActivation=e.requiresUserActivation),u.properties={call:{const:t},args:a,returnType:{const:e.returnType}},u.required=c?["call","args"]:["call"],u.unevaluatedProperties=!1,u)}function ry(t,e,r=Rr){let n=Pa(t,e,r);return{type:"object",properties:Wt(n.properties)?n.properties:{},...Array.isArray(n.required)&&n.required.length>0?{required:n.required}:{},additionalProperties:n.additionalProperties!==void 0?n.additionalProperties:!0}}var Ol={not:{}};function Ma(t){let e=[...t].map(r=>({$ref:`#/components/${Nl(r)}`}));return e.length===0?{...Ol}:{oneOf:e,discriminator:{propertyName:"component"}}}function La(t){let e=[...t].map(r=>({$ref:`#/functions/${Nl(r)}`}));return e.length===0?{...Ol}:{oneOf:e}}function Nl(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var Rl=new WeakMap;function Ba(t){let e=Rl.get(t);return e||(e=ny(t),Rl.set(t,e)),e}function ny(t){let e=new no(t.protocolVersion,t.commonTypesUri),r=new Map,n=new Map;for(let[l,f]of t.components){if(to(f)||!Il(f.schema))continue;let{schema:h,catalogDefs:p}=e.componentSchema(l,f.schema,f.allowedParents,f.allowedChildren);f.metadata!==void 0&&(h.metadata=we(f.metadata)),n.set(l,Tr(h));for(let[m,y]of p)r.set(m,y)}for(let l of t.defModels??[]){let f=mi(l)?.defName;if(f===void 0)throw new Error("A catalog definition model must be named with specDef().");r.set(f,l)}let i=new Map,o=new Map;for(let[l,f]of t.functions)!to(f)&&kl(f.schema)&&(o.set(l,f),e.toJson(f.schema,r));let s={...t.defs},a=new Set;for(;[...r.keys()].some(l=>!a.has(l)&&!(l in s));)for(let[l,f]of[...r])a.has(l)||l in s||(a.add(l),s[l]=e.defSchema(f,r));let c={...t.extensionFields};if(t.themeLocation==="styles"&&t.themeSchema&&!jl(t)){let l=e.defSchema(t.themeSchema);c.styles=Wt(l.properties)?l.properties:{}}let u=new Map;for(let[l,f]of t.components)u.set(l,n.get(l)??Ta(f,s));for(let[l,f]of t.functions){let h=Ta(f,s);i.set(l,h??(o.has(l)?Tr(e.functionSchema(l,f,s,r)):void 0))}return{components:u,functions:i,defs:Tr(s),extensionFields:Tr(c)}}function jl(t){return Wt(t.defs?.theme)||Na.some(e=>t.extensionFields?.[e]!==void 0)}function Pl(t){let e=oe(t.protocolVersion,"1.0"),r=Ba(t),n=new Set(Object.keys(r.defs)),i={};t.schemaUri!==void 0&&(i.$schema=t.schemaUri),t.schemaId!==void 0&&(i.$id=t.schemaId),typeof t.declaredProtocolVersion=="string"?i.protocolVersion=t.declaredProtocolVersion:t.declaredProtocolVersion===void 0&&(i.protocolVersion=Ae(t.protocolVersion)??t.protocolVersion),t.title!==void 0&&(i.title=t.title),t.description!==void 0&&(i.description=t.description),t.declaresCatalogId!==!1&&(i.catalogId=t.id),t.instructions!==void 0&&(i.instructions=t.instructions);let o=t.commonTypesUri??Rr;if(t.declaresComponents!==!1||t.components.size>0){let f={};for(let[h,p]of t.components){let m=r.components.get(h);f[h]=m?we(m):ty(h,p,n,o)}i.components=f}let s=[...t.functions].filter(([f,h])=>to(h)!==void 0||!f.startsWith("@")),a=s.map(([f])=>f);if(t.functionsLayout==="list")i.functions=s.map(([f,h])=>{let p=r.functions.get(f);return p&&Fl(p)?we(p):$l(f,h,n,e,!0,o,r.defs)});else if(t.functionsLayout==="map"||s.length>0){let f={};for(let[h,p]of s){let m=r.functions.get(h);f[h]=m&&!Fl(m)?we(m):$l(h,p,n,e,!1,o,r.defs)}i.functions=f}for(let[f,h]of Object.entries(r.extensionFields))f in i||(i[f]=we(h));let c=we({...r.defs});(t.themeLocation??(e?void 0:"defs"))==="defs"&&t.themeSchema&&!jl(r)&&(c.theme=mi(t.themeSchema)?new no(t.protocolVersion,t.commonTypesUri).defSchema(t.themeSchema):ry(t.themeSchema,n,o));let l=t.unions??{anyComponent:e||t.components.size>0,anyFunction:e||a.length>0};if(l.anyComponent&&!("anyComponent"in c)){let f=c.anyFunction;f!==void 0&&delete c.anyFunction,c.anyComponent=Ma(t.components.keys()),f!==void 0&&(c.anyFunction=f)}return l.anyFunction&&!("anyFunction"in c)&&(c.anyFunction=La(a)),(t.defs!==void 0||Object.keys(c).length>0)&&(i.$defs=c),i}var iy="0.9";function as(t,e){if(!e.startsWith("#/"))return;let r=e.slice(2).split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~")),n=t;for(let i of r)if(n&&typeof n=="object"&&i in n)n=n[i];else return;return typeof n=="object"&&n!==null?n:void 0}function Zl(t){let e=t.split(/#\/(?:\$defs|definitions)\//)[1];return e&&Object.hasOwn(Yi,e)?Yi[e]:void 0}function oy(t){return t.length===0?d.unknown():t.every(e=>typeof e=="string")?d.enum(t):t.length===1?d.literal(t[0]):d.union(t.map(e=>d.literal(e)))}function oo(t){return t===null||typeof t!="object"?JSON.stringify(t):Array.isArray(t)?`[${t.map(oo).join(",")}]`:`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${oo(t[n])}`).join(",")}}`}function Gt(t,e,r,n,i){let o=t;if(e.not&&typeof e.not=="object"){let s=En(e.not,r,new Set(n),i);o=o.refine(a=>!s.safeParse(a).success,{message:'Value matched prohibited "not" schema'})}return e.default!==void 0&&(o=o.default(e.default)),typeof e.description=="string"&&(o=o.describe(e.description)),o}function sy(t,e,r,n,i){let o=Zl(t);if(o){let s=t.split(/#\/(?:\$defs|definitions)\//)[1],a=typeof e.description=="string"?`REF:common_types.json#/$defs/${s}|${e.description}`:o.description;return a?o.describe(a):o}if(r&&t.startsWith("#/")){let s=as(r,t);if(!s)return d.unknown().superRefine((c,u)=>{u.addIssue({code:d.ZodIssueCode.custom,message:`Unresolvable schema reference: '${t}'`})});if(n.has(t)){let c=i.get(t);return d.lazy(()=>(c||(c=i.get(t)??En(s,r,new Set([t]),i),i.set(t,c)),c))}let a=i.get(t);if(!a){let c=new Set(n);c.add(t),a=En(s,r,c,i),i.set(t,a)}return typeof e.description=="string"&&(a=a.describe(e.description)),a}}function ay(t,e,r,n){let i=Array.isArray(t.oneOf),s=(t.oneOf||t.anyOf).filter(h=>typeof h=="object"&&h!==null);if(s.length===0)return;let a=s.find(h=>Array.isArray(h.enum)),c=s.some(h=>typeof h.$ref=="string"&&h.$ref.includes("DataBinding")),u=s.map(h=>En(h,e,new Set(r),n)),l;if(u.length===1)l=u[0];else{let h=[u[0],u[1],...u.slice(2)];l=i?ul(h):d.union(h)}t.default!==void 0&&(l=l.default(t.default));let f=(typeof t.description=="string"?t.description:void 0)||(a&&c?"REF:common_types.json#/$defs/DynamicString":void 0);return f?l.describe(f):l}function cy(t,e,r,n){let o=t.allOf.filter(c=>typeof c=="object"&&c!==null);if(o.length===0)return;if(e){let c=ss(t,e,new Set(r),!1);if(c.length>0){let u=new Set;for(let m of c)if(m.kind==="json"&&Array.isArray(m.schema.required))for(let y of m.schema.required)typeof y=="string"&&u.add(y);if(Array.isArray(t.required))for(let m of t.required)typeof m=="string"&&u.add(m);let l={};for(let m of c){if(m.kind==="zod"){Object.assign(l,m.properties);continue}let y=cs(m.schema.properties||{},u,!1,e,new Set(r),n);Object.assign(l,y)}let f=d.object(l),p=t.additionalProperties===!1||t.unevaluatedProperties===!1||c.some(m=>m.kind==="json"&&(m.schema.additionalProperties===!1||m.schema.unevaluatedProperties===!1))?f.strict():f.passthrough();return Gt(p,t,e,r,n)}}let s=o.map(c=>En(c,e,new Set(r),n)),a=s[0];for(let c=1;c<s.length;c++)a=a.and(s[c]);return Gt(a,t,e,r,n)}function En(t,e,r=new Set,n=new Map){if(!t||typeof t!="object")return d.unknown();if(t instanceof d.ZodType)return t;if(t.$ref&&typeof t.$ref=="string"){let i=sy(t.$ref,t,e,r,n);if(i)return i}if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let i=ay(t,e,r,n);if(i)return i}if(Array.isArray(t.allOf)&&t.allOf.length>0){let i=cy(t,e,r,n);if(i)return i}if(t.const!==void 0){let i=d.literal(t.const);return Gt(i,t,e,r,n)}if(Array.isArray(t.enum)&&t.enum.length>0){let i=oy(t.enum);return Gt(i,t,e,r,n)}if(t.type==="array"){let i=t.items&&typeof t.items=="object"?En(t.items,e,new Set(r),n):d.unknown(),o=d.array(i);return typeof t.minItems=="number"&&(o=o.min(t.minItems)),typeof t.maxItems=="number"&&(o=o.max(t.maxItems)),t.uniqueItems===!0&&(o=o.refine(s=>new Set(s.map(oo)).size===s.length,{message:"Array items must be unique"})),Gt(o,t,e,r,n)}switch(t.type){case"string":{let i=d.string();if(typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),typeof t.pattern=="string")try{i=i.regex(new RegExp(t.pattern,"u"))}catch{}return Gt(i,t,e,r,n)}case"integer":case"number":{let i=t.type==="integer"?d.number().int():d.number();return typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"&&(i=i.gt(t.exclusiveMinimum)),typeof t.exclusiveMaximum=="number"&&(i=i.lt(t.exclusiveMaximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),Gt(i,t,e,r,n)}case"boolean":return Gt(d.boolean(),t,e,r,n);case"object":{let i=t.properties,o;if(typeof i=="object"&&i!==null){let s=Array.isArray(t.required)?new Set(t.required.filter(u=>typeof u=="string")):new Set,a=d.object(cs(i,s,!1,e,r,n));o=t.additionalProperties===!1||t.unevaluatedProperties===!1?a.strict():a.passthrough()}else o=d.record(d.unknown());return Gt(o,t,e,r,n)}default:return Gt(d.unknown(),t,e,r,n)}}function Wl(t){return t==="id"||t==="component"||t==="catalogId"}function cs(t,e,r=!1,n,i,o=new Map){let s={};for(let[a,c]of Object.entries(t)){if(r&&Wl(a))continue;let u=En(typeof c=="object"&&c!==null?c:{},n,i?new Set(i):new Set,o);e.has(a)?u.safeParse(void 0).success?s[a]=u.refine(l=>l!==void 0,{message:"Required"}):s[a]=u:s[a]=u.optional()}return s}function ss(t,e,r=new Set,n=!1){if(!t||typeof t!="object")return[];let i=[],o=[],s=[];if(Array.isArray(t.allOf)){for(let c of t.allOf)if(!(!c||typeof c!="object"))if(typeof c.$ref=="string"){let u=c.$ref;if(u.includes("common_types.json")&&u.includes("ComponentCommon")){let{accessibility:l,metadata:f}=Ji.shape;i.push({kind:"zod",properties:n?{accessibility:l,metadata:f}:{accessibility:l}})}else if(u.startsWith("#/")){if(!r.has(u)){r.add(u);let l=as(e,u);l&&o.push(...ss(l,e,r,n))}}else{let l=Zl(u);l instanceof d.ZodObject&&i.push({kind:"zod",properties:{...l.shape}})}}else s.push(...ss(c,e,r,n))}let a=[...i,...o,...s];return t.properties&&a.push({kind:"json",schema:t}),a}function Gl(t,e,r=!0,n=new Map,i=!1){let o={},s=ss(t,e,void 0,i),a=new Set;for(let l of s)l.kind==="json"&&Array.isArray(l.schema.required)&&l.schema.required.forEach(f=>{typeof f=="string"&&a.add(f)});for(let l of s){if(l.kind==="zod"){for(let[h,p]of Object.entries(l.properties))r&&Wl(h)||(o[h]=p);continue}let f=cs(l.schema.properties||{},a,r,e,void 0,n);Object.assign(o,f)}let c=d.object(o);return t.unevaluatedProperties===!0||typeof t.unevaluatedProperties=="object"&&t.unevaluatedProperties!==null||t.additionalProperties===!0||typeof t.additionalProperties=="object"&&t.additionalProperties!==null?c.passthrough():c.strict()}function so(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return Object.keys(e).length>0&&e.properties===void 0&&typeof e.type!="string"&&!("$ref"in e)&&!("allOf"in e)&&!("oneOf"in e)&&!("anyOf"in e)&&!("not"in e)&&Object.values(e).every(r=>r!==null&&(typeof r=="object"||typeof r=="boolean"))}function Ml(t){return t.unevaluatedProperties===!0||typeof t.unevaluatedProperties=="object"&&t.unevaluatedProperties!==null||t.additionalProperties===!0||typeof t.additionalProperties=="object"&&t.additionalProperties!==null}function Va(t,e,r=new Set){let n={schemas:[],hasUnresolvable:!1};if(!t||typeof t!="object"||Array.isArray(t))return n;if(so(t))return n.schemas.push({type:"object",properties:t}),n;if(typeof t.$ref=="string"){let i=t.$ref;if(i.startsWith("#/")){if(!e)n.hasUnresolvable=!0;else if(!r.has(i)){r.add(i);let o=as(e,i);if(o){let s=Va(o,e,r);n.schemas.push(...s.schemas),s.hasUnresolvable&&(n.hasUnresolvable=!0)}else n.hasUnresolvable=!0}}else n.hasUnresolvable=!0}if(Array.isArray(t.allOf)){for(let i of t.allOf)if(i&&typeof i=="object"&&!Array.isArray(i)){let o=Va(i,e,r);n.schemas.push(...o.schemas),o.hasUnresolvable&&(n.hasUnresolvable=!0)}}return(Array.isArray(t.anyOf)||Array.isArray(t.oneOf))&&(n.hasUnresolvable=!0),(t.properties||t.required||t.additionalProperties!==void 0||t.unevaluatedProperties!==void 0)&&n.schemas.push(t),n}function Ll(t,e,r=new Map){let n=Va(t,e),i=new Set;for(let c of n.schemas)if(Array.isArray(c.required))for(let u of c.required)typeof u=="string"&&i.add(u);let o={};for(let c of n.schemas)if(c.properties&&typeof c.properties=="object"&&!Array.isArray(c.properties)){let u=cs(c.properties,i,!1,e,void 0,r);Object.assign(o,u)}let s=d.object(o);return n.hasUnresolvable||n.schemas.some(Ml)||Ml(t)?s.passthrough():s.strict()}function Bl(t,e){if(!t||typeof t!="object"||Array.isArray(t))return[];let r=t,n=[],i=new Set,o=s=>{if(!s||typeof s!="object"||Array.isArray(s))return;let a=s;if(typeof a.$ref=="string"&&e&&a.$ref.startsWith("#/")&&!i.has(a.$ref)){i.add(a.$ref);let c=as(e,a.$ref);c&&o(c)}if(a.properties&&typeof a.properties=="object"&&a.properties!==null&&!Array.isArray(a.properties)&&n.push(...Object.keys(a.properties)),Array.isArray(a.allOf))for(let c of a.allOf)o(c)};return r.properties&&typeof r.properties=="object"&&r.properties!==null&&!Array.isArray(r.properties)||Array.isArray(r.allOf)||typeof r.$ref=="string"?(o(r),n):so(r)?Object.keys(r):[]}function uy(t,e,r,n=!1){let i=[];if(!t)return i;let o=new Map,s=(a,c)=>{if(n){Gi(a,`function identifier: '${a}'`);for(let u of c)Gi(u,`argument identifier: '${u}' in function '${a}'`)}};if(Array.isArray(t)){for(let a of t)if(a&&typeof a=="object"&&typeof a.name=="string"){let c=Bl(a.parameters,e);if(s(a.name,c),r&&!r.has(a.name))continue;i.push(new eo(a.name,a,u=>u.parameters&&typeof u.parameters=="object"?Ll(u.parameters,e,o):d.record(d.unknown())))}return i}if(typeof t=="object"&&t!==null)for(let[a,c]of Object.entries(t)){let l=Vl(c&&typeof c=="object"?c:{}),f=Bl(l,e);s(a,f),!(r&&!r.has(a))&&(!c||typeof c!="object"||i.push(new eo(a,c,h=>{let p=Vl(h);return p?Ll(p,e,o):d.record(d.unknown())})))}return i}function Vl(t){let e=t.properties&&typeof t.properties=="object"&&t.properties!==null&&!Array.isArray(t.properties)?t.properties:void 0,r=e?.args??t.args??t.parameters;return!r&&e&&!("call"in e)&&!("@call"in e)&&!("function"in e)?r=t:so(r)&&(r={type:"object",properties:r,required:t.required,additionalProperties:t.additionalProperties}),r&&typeof r=="object"&&!Array.isArray(r)?r:void 0}function Ul(t,e){if(!Array.isArray(t))return;let r=new Set;for(let n of t)if(typeof n?.$ref=="string"&&n.$ref.startsWith(e)){let o=n.$ref.slice(e.length).replace(/~([01])/g,(s,a)=>a==="1"?"/":"~");r.add(o)}return r}function ly(t,e,r,n){let i=[],o=new Map;for(let[s,a]of Object.entries(t)){let c=a||{};if(r){Gi(s,`component identifier: '${s}'`);let u=c.properties;if(u&&typeof u=="object")for(let f of Object.keys(u))Gi(f,`property identifier: '${f}' in component '${s}'`);let l=c.metadata;if(l!==void 0)try{An(l)}catch(f){throw new me(f instanceof Error?f.message:String(f))}}n&&!n.has(s)||i.push(new ns(s,c,u=>Gl(u,e,!0,o,r)))}return i}function dy(t,e){let r=t.theme??t.themeSchema??t.styles??e?.theme;if(r&&typeof r=="object"){let n=r,i="properties"in n||"allOf"in n||n.type==="object"?n:{type:"object",properties:n},o=Gl(i,t,!1);return i.additionalProperties===!1||i.unevaluatedProperties===!1?o:o.passthrough()}}function fy(t){if(t.startsWith("#"))return!0;let e=t.indexOf("#"),r=e===-1?t:t.slice(0,e);return r==="catalog.json"?!0:r.split("/").pop()==="common_types.json"}function py(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Ua(t,e){if(Array.isArray(t)){t.forEach((r,n)=>Ua(r,`${e}/${n}`));return}if(io(t))for(let[r,n]of Object.entries(t)){let i=`${e}/${py(r)}`;if(r==="$ref"&&typeof n=="string"&&!fy(n))throw new me(`Unsupported external $ref '${n}' at ${i}: a v1.0 catalog may only reference its own components and functions (#/...) or common_types.json.`);Ua(n,i)}}function Hl(t,e,r){let n=we(t),i=r??n.catalogId??n.$id??n.id;if(!i||typeof i!="string")throw new Error("Catalog ID must be specified via catalog metadata ('catalogId' or '$id').");let o=n.$defs,s=o?.anyComponent,a=Ul(s?.oneOf,"#/components/"),c=e??n.protocolVersion??iy,u=oe(c,"1.0");u&&Ua(n,"");let l=n.components??{},f=ly(l,n,u,a),h=o?.anyFunction,p=Ul(h?.oneOf,"#/functions/"),m=uy(n.functions,n,p,u),y=dy(n,o);return Tr(n),{id:i,protocolVersion:c,components:f,functions:m,themeSchema:y,...my(n,f,m)}}var zl={$schema:"schemaUri",$id:"schemaId",title:"title",description:"description",instructions:"instructions"},hy=new Set(["protocolVersion","catalogId","components"]);function io(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ql(t,e){return oo(t)===oo(e)}function my(t,e,r){let n={},i={};for(let[o,s]of Object.entries(t))if(o in zl&&typeof s=="string")n[zl[o]]=s;else if(o==="protocolVersion"&&typeof s=="string")n.declaredProtocolVersion=s;else if(o==="functions"&&(Array.isArray(s)||io(s)))n.functionsLayout=Array.isArray(s)?"list":"map";else if(o==="$defs"&&io(s)){let a=ql(s.anyComponent,Ma(e.map(l=>l.name))),c=ql(s.anyFunction,La(r.map(l=>l.name)));n.unions={anyComponent:a,anyFunction:c};let u={};for(let[l,f]of Object.entries(s))l==="anyComponent"&&a||l==="anyFunction"&&c||(u[l]=f);n.defs=Object.freeze(u)}else(!hy.has(o)||o==="components"&&!io(s))&&(i[o]=s);return n.declaredProtocolVersion??=null,n.declaresCatalogId=typeof t.catalogId=="string",n.declaresComponents=io(t.components),n.unions??={anyComponent:!1,anyFunction:!1},Object.keys(i).length>0&&(n.extensionFields=Object.freeze(i)),n}function gy(t,e){return e?.standardDefs?e.standardDefs:Fa(e?.protocolVersion??t.protocolVersion)}var Wa=/^[^#]+#\/(?:\$defs|definitions)\/([^/]+)(\/.*)?$/;function Jl(t){let e=Wa.exec(t);return e?`#/$defs/${e[1]}${e[2]??""}`:`#/$defs/${t.split("/").pop()}`}function yy(t){if(t.startsWith("#/$defs/"))return t.substring(8).split("/")[0].replace(/~1/g,"/").replace(/~0/g,"~")}function by(t){if(typeof t.description!="string"||!t.description.startsWith("REF:"))return!1;let e=t.description.substring(4),r=e.indexOf("|"),n=r===-1?e:e.substring(0,r),i=r===-1?"":e.substring(r+1),o=t.default;for(let s of Object.keys(t))delete t[s];return t.$ref=n.startsWith("#")?n:Jl(n),o!==void 0&&(t.default=o),i&&(t.description=i),!0}function vy(t,e={}){if(Array.isArray(t.allOf)){let r=t.allOf.filter(i=>!(typeof i=="object"&&i!==null&&Object.keys(i).length===0)),n=r.length===1?r[0]:void 0;typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).every(i=>!(i in t)||i==="allOf")?(delete t.allOf,Object.assign(t,n)):r.length===0?delete t.allOf:t.allOf=r}e.stripAdditionalProperties?(delete t.additionalProperties,delete t.unevaluatedProperties):(t.additionalProperties&&typeof t.additionalProperties=="object"&&Object.keys(t.additionalProperties).length===0&&(t.additionalProperties=!0),t.unevaluatedProperties&&typeof t.unevaluatedProperties=="object"&&Object.keys(t.unevaluatedProperties).length===0&&(t.unevaluatedProperties=!0)),"$schema"in t&&delete t.$schema}function pr(t,e=new Set,r={}){if(typeof t!="object"||t===null||e.has(t))return;if(e.add(t),Array.isArray(t)){for(let i of t)pr(i,e,r);return}let n=t;if(!by(n)){vy(n,r);for(let i of Object.keys(n))pr(n[i],e,r)}}function tt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var xy=new Set(["description","title","default","deprecated","readOnly","writeOnly","examples"]),Kl=new Set(["id","component","catalogId"]),Ay=new Set(["anyComponent","anyFunction","theme"]),Dy=/^(?:([^#]*common_types\.json))?#\/\$defs\/([^/]+)(\/.*)?$/,Cy=/\/(ComponentCommon|Checkable)$/;function za(t,e,r,n=""){if(t.$ref=`#/$defs/${e}${n}`,n||t.description!==void 0)return;let i=r[e];tt(i)&&typeof i.description=="string"&&(t.description=i.description)}function ao(t,e,r){if(Array.isArray(t)){for(let o of t)ao(o,e,r);return}if(!tt(t))return;let n=t.$ref,i=typeof n=="string"?Dy.exec(n):null;if(i){let[,o,s,a]=i;if(o!==void 0||s in e){if(r){for(let c of Object.keys(t))c!=="$ref"&&!xy.has(c)&&delete t[c];za(t,s,e,a);return}za(t,s,e,a)}}for(let o of Object.values(t))ao(o,e,r)}function wy(t,e){if(!e.startsWith("#/"))return;let r=t;for(let n of e.substring(2).split("/")){let i=n.replace(/~([01])/g,(o,s)=>s==="1"?"/":"~");if(!tt(r)||!(i in r))return;r=r[i]}return r}function qa(t,e,r){let n=[],i=[],o=[];for(let a of Array.isArray(t.allOf)?t.allOf:[]){if(!tt(a))continue;let c=a.$ref;if(typeof c!="string"){n.push(...qa(a,e,r));continue}let u=Cy.exec(c)?.[1],l=c.startsWith("#/")?wy(e.rootDoc,c):void 0;if(u===void 0&&tt(l)){r.has(c)||(r.add(c),i.push(...qa(l,e,r)));continue}let f=Wa.exec(c),h=u??(f&&!f[2]?f[1]:void 0),p=h!==void 0?e.standardDefs[h]:void 0;tt(p)&&tt(p.properties)&&o.push({properties:we(p.properties),...Array.isArray(p.required)?{required:p.required}:{}})}let s=[...o,...i,...n];return("properties"in t||"description"in t)&&s.push(t),s}function Ey(t,e){let r=qa(t,e,new Set),n,i={},o=new Set;for(let a of r)if(typeof a.description=="string"&&(n=a.description),tt(a.properties)&&Object.assign(i,a.properties),Array.isArray(a.required))for(let c of a.required)typeof c=="string"&&o.add(c);let s={};for(let[a,c]of Object.entries(i)){if(Kl.has(a))continue;let u=we(c);ao(u,e.standardDefs,!0),s[a]=u}return{props:s,required:[...o].filter(a=>!Kl.has(a)).sort(),...n!==void 0?{description:n}:{}}}function Sy(t,e){let r=e.model.functions.get(t);if(!r)return;let n=tt(r.properties)?r.properties:void 0,i=n?.args??r.args??r.parameters;if(i!==void 0)return tt(i)?so(i)?{type:"object",properties:i,...r.required!==void 0?{required:r.required}:{},...r.additionalProperties!==void 0?{additionalProperties:r.additionalProperties}:{}}:i:{};let o=n&&("call"in n||"@call"in n||"function"in n);if(!n||o)return{};let{description:s,title:a,name:c,returnType:u,allowedCallers:l,requiresUserActivation:f,...h}=r;return h}function _y(t){let e=Na.map(r=>t.extensionFields[r]).find(r=>r!==void 0)??t.defs.theme;if(tt(e))return"properties"in e||"allOf"in e||e.type==="object"?e:{type:"object",properties:e}}function Iy(t){return(Ae(t.protocolVersion)??t.protocolVersion)==="0.8"||t.id.includes("v0_8")||t.id.includes("v0.8")}function ky(t,e,r,n){if(!t.themeSchema)return;let i=Iy(t),o=_y(n.model);if(o){let u=we({...o});!i&&u.additionalProperties===void 0&&u.unevaluatedProperties===void 0&&(u.additionalProperties=!0),e.theme=u;return}let s=st(t.themeSchema,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});pr(s),Ga(s,e,r);let a=s.additionalProperties===!1,c={type:"object",...typeof s.description=="string"&&!s.description.startsWith("REF:")?{description:s.description}:{},properties:s.properties||{},...Array.isArray(s.required)&&s.required.length>0?{required:s.required}:{},...a?{additionalProperties:!1}:i?{}:{additionalProperties:s.additionalProperties!==void 0?s.additionalProperties:!0}};r.push(c),e.theme=c}function Ga(t,e,r){let n=tt(t.definitions)?t.definitions:tt(t.$defs)?t.$defs:void 0;delete t.definitions,delete t.$defs,n&&(Object.assign(e,n),r.push(n))}function Fy(t,e,r){if(!t.schema||typeof t.schema!="object"||!("safeParse"in t.schema))return{props:{},reqList:[],additionalProps:void 0};let n=st(t.schema,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});pr(n),Ga(n,e,r);let i=n.properties||{},o=Array.isArray(n.required)?n.required.filter(c=>c!=="component"&&c!=="id"):[],s=n.unevaluatedProperties??n.additionalProperties,a=typeof s=="boolean"||tt(s)?s:void 0;return{props:i,reqList:o,additionalProps:a}}function $y(t){let e=t.schema?.description;return typeof e=="string"&&!e.startsWith("REF:")?e:void 0}function Ry(t){return t.unevaluatedProperties??t.additionalProperties}function Ty(t,e,r,n,i,o){let s,a,c,u,l=i.model.components.get(t);if(l)({props:s,required:a,description:c}=Ey(l,i)),u=Ry(l)??(i.isV10?void 0:!1);else{let A=Fy(e,r,n),{component:D,id:_,...q}=A.props;n.push(q),s=q,a=A.reqList,c=$y(e),u=i.isV10?void 0:A.additionalProps??!1}let f={};za(f,"ComponentId",i.standardDefs);let h={id:f,...s,component:{const:t}},p=["id",...a,"component"],m=u!==void 0?{unevaluatedProperties:u}:{},y;return o?.componentEnvelopeRef?y={...c!==void 0?{description:c}:{},allOf:[{$ref:o.componentEnvelopeRef},{type:"object",properties:h,required:p}],...m}:y={type:"object",...c!==void 0?{description:c}:{},properties:h,required:p,...m},e.allowedParents&&e.allowedParents.length>0&&(y.allowedParents=e.allowedParents),e.allowedChildren&&e.allowedChildren.length>0&&(y.allowedChildren=e.allowedChildren),y}function Oy(t,e,r,n,i,o){if(t.components.size===0){e.components={};return}let s={};for(let[a,c]of t.components.entries())s[a]=Ty(a,c,r,n,i,o);e.components=s,r.anyComponent={oneOf:Array.from(t.components.keys()).map(a=>({$ref:`#/components/${a}`})),discriminator:{propertyName:"component"}}}function Ny(t,e,r,n,i){let o,s=Sy(t,i);if(s)o=we(s),ao(o,i.standardDefs,!1);else if(e.schema&&typeof e.schema=="object"&&"safeParse"in e.schema){let a=st(e.schema,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});pr(a),Ga(a,r,n),n.push(a),o=a}else o={type:"object",properties:{}};if(o.type==="object"){let a=o.additionalProperties;delete o.additionalProperties,o.unevaluatedProperties=o.unevaluatedProperties??a??!1}return o}function jy(t,e,r,n,i){let o=Ny(t,e,r,n,i),s=fr(o,{...i.defs,...r}),a=i.isV10?"@call":"call",c=s?[a,"args"]:[a];return i.isV10?{type:"object",...e.description?{description:e.description}:{},returnType:e.returnType,...e.allowedCallers!==void 0?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{},properties:{"@call":{const:t},args:o},required:c}:{type:"object",...e.description?{description:e.description}:{},properties:{call:{const:t},args:o,returnType:{const:e.returnType}},required:c,unevaluatedProperties:!1}}function Py(t,e,r,n,i){let o=Array.from(t.functions.keys()).filter(a=>!a.startsWith("@"));if(o.length===0)return;let s={};for(let a of o)s[a]=jy(a,t.functions.get(a),r,n,i);e.functions=s,r.anyFunction={oneOf:o.map(a=>({$ref:`#/functions/${a}`}))}}var My=new Map(Object.values(Yi).flatMap(t=>{let e=t.description;if(typeof e!="string"||!e.startsWith("REF:"))return[];let r=e.substring(4),n=r.indexOf("|");return n===-1?[]:[[r.substring(0,n).split("/").pop(),r.substring(n+1)]]}));function yi(t,e,r=new Set){if(typeof t!="object"||t===null||r.has(t))return;if(r.add(t),Array.isArray(t)){for(let o of t)yi(o,e,r);return}let n=t,i=n.$ref;if(typeof i=="string"&&!i.startsWith("#")&&i!==e){if(!Wa.test(i))throw new Error(`Cannot bundle the external schema reference '${i}'.`);n.$ref=Jl(i)}for(let o of Object.values(n))yi(o,e,r)}function Za(t,e,r=new Set){if(typeof t!="object"||t===null||r.has(t))return;if(r.add(t),Array.isArray(t)){for(let o of t)Za(o,e,r);return}let n=t,i=n.$ref;if(typeof i=="string"&&i.startsWith("#/$defs/")){let o=i.substring(8),s=o.includes("/")?void 0:e[o],a=n.description===void 0||n.description===My.get(o);s&&a&&(typeof s.description=="string"?n.description=s.description:delete n.description)}for(let o of Object.values(n))Za(o,e,r)}function us(t,e,r=new Set){if(!(typeof t!="object"||t===null)&&!r.has(t)){if(r.add(t),typeof t.$ref=="string"){let n=yy(t.$ref);n!==void 0&&e.add(n)}if(Array.isArray(t))for(let n of t)us(n,e,r);else for(let n of Object.values(t))us(n,e,r)}}function Yl(t,e){let r={$schema:"https://json-schema.org/draft/2020-12/schema",...typeof t.declaredProtocolVersion=="string"?{protocolVersion:t.declaredProtocolVersion.trim().replace(/^[vV](?=\d)/,"")}:{},catalogId:t.id};t.instructions&&(r.instructions=t.instructions);let n=gy(t,e),i=e?.protocolVersion??t.protocolVersion,o=Ba(t),s=o.defs,a={standardDefs:n,model:o,defs:s,rootDoc:{$defs:s},isV10:!!i&&oe(i,"1.0")},c={},u=[];ky(t,c,u,a),Oy(t,r,c,u,a,e),Py(t,r,c,u,a),yi(r,e?.componentEnvelopeRef),yi(c);for(let f of u)Za(f,n);let l;do{l=Object.keys(c).length;let f=new Set;us(r,f),us(c,f),(f.has("DynamicString")||f.has("DynamicNumber")||f.has("DynamicBoolean")||f.has("DynamicValue"))&&(f.add("DataBinding"),f.add("FunctionCall"));for(let h of f)if(!(h in c)){if(h in n){let p=we(n[h]);yi(p),c[h]=p}else if(!Ay.has(h)&&h in s){let p=we(s[h]);ao(p,n,!1),yi(p),c[h]=p}}f.has("anyFunction")&&!("anyFunction"in c)&&(c.anyFunction={not:{}})}while(Object.keys(c).length>l);return Object.keys(c).length>0&&(r.$defs=c),r}function Sn(t){if(!t)return"";let e=t.lastIndexOf("#");return(e!==-1?t.slice(e+1):t).split("/").filter(Boolean).pop()??""}function Xl(t,e){if(!t?._def)return null;if(e){if(e.has(t))return null;e.add(t)}switch(t._def.typeName){case"ZodOptional":case"ZodNullable":case"ZodDefault":case"ZodReadonly":return t._def.innerType;case"ZodBranded":return t._def.type;case"ZodEffects":return t._def.schema;case"ZodLazy":return t._def.getter();default:return null}}function Ly(t){let e=[],r=new Set,n=t;for(;n;){n.description&&e.push(n.description),n._def?.description&&e.push(n._def.description);let i=Xl(n,r);if(!i)break;n=i}return e}function Or(t){let e=new Set,r=t;for(;r;){let n=Xl(r,e);if(!n)break;r=n}return r}function By(t,e){if(!t)return null;let r=Sn(t),n=e.childListRefNames,i=e.childRefNames;return n.has(r)?{isChild:!1,isChildList:!0}:i.has(r)?{isChild:!0,isChildList:!1}:null}function Vy(t,e){let r=!1;for(let n of t){if(typeof n!="object"||n===null)continue;let i=Ha(n,e);if(i.isChildList)return{isChild:!1,isChildList:!0};i.isChild&&(r=!0)}return r?{isChild:!0,isChildList:!1}:null}function Uy(t,e){let r=!1;for(let n of["oneOf","anyOf","allOf"]){let i=t[n];if(!Array.isArray(i))continue;let o=Vy(i,e);if(o?.isChildList)return o;o?.isChild&&(r=!0)}return r?{isChild:!0,isChildList:!1}:null}function Ha(t,e){let r=typeof t.$ref=="string"?t.$ref:"",n=By(r,e);if(n)return n;if(t.type==="array"&&t.items){let o=Ha(t.items,e);if(o.isChild||o.isChildList)return{isChild:!1,isChildList:!0}}let i=Uy(t,e);return i||(t.type==="object"&&t.properties&&("componentId"in t.properties&&("path"in t.properties||"dataBinding"in t.properties)||"explicitList"in t.properties||"template"in t.properties)?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1})}function zy(t){if(t?._def?.typeName==="ZodObject"&&typeof t._def.shape=="function"){let e=t._def.shape();return!!(e.componentId&&(e.path||e.dataBinding)||e.explicitList||e.template)}return!1}function qy(t,e){if(t?._def?.typeName==="ZodArray"){let r=Or(t._def.type);return _n(r,e).isChild}return!1}function Zy(t,e){let r=!1,n=!1,i=!1;for(let o of t){let s=Or(o);zy(s)&&(r=!0),qy(s,e)&&(n=!0);let a=_n(s,e);if(a.isChildList)return{isChild:!1,isChildList:!0};a.isChild&&(i=!0)}return r||n?{isChild:!1,isChildList:!0}:i?{isChild:!0,isChildList:!1}:{isChild:!1,isChildList:!1}}function Wy(t,e){if(!t)return!1;if(t.startsWith("REF:")){let i=Sn(t.substring(4).split("|")[0]);if(e.has(i))return!0}let r=Sn(t.split("|")[0]);if(r&&e.has(r))return!0;let n=t.trim();return!!e.has(n)}function Gy(t,e){if(!t)return!1;if(t.startsWith("REF:")){let i=Sn(t.substring(4).split("|")[0]);if(e.has(i))return!0}let r=Sn(t.split("|")[0]);if(r&&e.has(r))return!0;let n=t.trim();return!!e.has(n)}function Hy(t,e){let r=e.childListRefNames,n=e.childRefNames;for(let i of t){if(Wy(i,r))return{isChild:!1,isChildList:!0};if(Gy(i,n))return{isChild:!0,isChildList:!1}}return null}function Ky(t,e){let r=_n(t,e);return r.isChild||r.isChildList?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1}}function _n(t,e){if(!t||typeof t!="object")return{isChild:!1,isChildList:!1};let r=Fr(t);if(r==="component-id")return{isChild:!0,isChildList:!1};if(r==="child-list")return{isChild:!1,isChildList:!0};let n=Hy(Ly(t),e);if(n)return n;let i=Or(t);if(!i?._def)return Ha(t,e);let o=Fr(i);if(o==="component-id")return{isChild:!0,isChildList:!1};if(o==="child-list")return{isChild:!1,isChildList:!0};let s=i._def.typeName;if(s==="ZodArray"){let a=Or(i._def.type);return Ky(a,e)}if(s==="ZodUnion"){let a=i._def.options??[];return Zy(a,e)}if(s==="ZodObject"&&typeof i._def.shape=="function"){let a=i._def.shape();if(a.componentId&&(a.path||a.dataBinding)||a.explicitList||a.template)return{isChild:!1,isChildList:!0}}return{isChild:!1,isChildList:!1}}function Ql(t,e,r){let n=t.nestedRefs[e];if(n){n.add(r);return}t.nestedRefs[e]=new Set([r])}function Jy(t,e,r,n){let i=_n(e,n);if(i.isChildList){r.listRefs.add(t);return}if(i.isChild){r.singleRefs.add(t);return}let o=Or(e);if(n.childPropertyNames?.has(t)&&o?._def?.typeName==="ZodString"){r.singleRefs.add(t);return}if(o?._def?.typeName!=="ZodArray")return;let s=Or(o._def.type);if(s?._def?.typeName!=="ZodObject"||typeof s._def.shape!="function")return;let a=s._def.shape();for(let[c,u]of Object.entries(a)){let l=_n(u,n),f=Or(u);(l.isChild||l.isChildList||n.childPropertyNames?.has(c)&&f?._def?.typeName==="ZodString")&&(r.listRefs.add(t),Ql(r,t,c))}}function Yy(t){if(typeof t!="object"||t===null)return null;let e=t;if(e.type!=="array"&&!("items"in e))return null;let r=e.items;if(typeof r!="object"||r===null)return null;let n=r.properties;return typeof n!="object"||n===null?null:n}function Xy(t,e,r){for(let[n,i]of Object.entries(t)){let o=_n(i,r);if(o.isChildList){e.listRefs.add(n);continue}if(o.isChild){e.singleRefs.add(n);continue}if(r.childPropertyNames?.has(n)&&typeof i=="object"&&i!==null&&i.type==="string"){e.singleRefs.add(n);continue}let s=Yy(i);if(s)for(let[a,c]of Object.entries(s)){let u=_n(c,r);(u.isChild||u.isChildList||r.childPropertyNames?.has(a)&&typeof c=="object"&&c!==null&&c.type==="string")&&(e.listRefs.add(n),Ql(e,n,a))}}}function Qy(t,e,r){if(!t)return;let n=Or(t);if(n?._def?.typeName==="ZodObject"&&typeof n._def.shape=="function"){let i=n._def.shape();for(let[o,s]of Object.entries(i))Jy(o,s,e,r);return}if(typeof t=="object"&&t!==null&&"properties"in t){let i=t.properties;typeof i=="object"&&i!==null&&Xy(i,e,r)}}function ed(t,e){let r={},n=typeof t?.components?.values=="function"?Array.from(t.components.values()):Array.isArray(t)?t:Array.from(t.values());for(let i of n){let o={singleRefs:new Set,listRefs:new Set,nestedRefs:{}};Qy(i.schema,o,e),r[i.name]={singleRefs:o.singleRefs,listRefs:o.listRefs,nestedRefs:o.nestedRefs}}return r}var eb=Symbol.for("preact-signals");function ps(){if(hr>1)hr--;else{var t,e=!1;for((function(){var i=ds;for(ds=void 0;i!==void 0;){var o=i.S;if(o.v===i.v)for(var s=o.t;s!==void 0;s=s.x)s.i===i.i&&(s.i=o.i);i=i.o}})();uo!==void 0;){var r=uo;for(uo=void 0,ls++;r!==void 0;){var n=r.u;if(r.u=void 0,r.f&=-3,!(8&r.f)&&id(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(ls=0,hr--,e)throw t}}function td(t){if(hr>0)return t();Ka=++tb,hr++;try{return t()}finally{ps()}}var co,pe=void 0;function hs(t){var e=pe,r=co;pe=void 0,co=void 0;try{return t()}finally{pe=e,co=r}}var uo=void 0,hr=0,ls=0,tb=0,Ka=0,ds=void 0,fs=0;function rd(t){if(pe!==void 0){var e=t.n;if(e===void 0||e.t!==pe)return e={i:0,S:t,p:pe.s,n:void 0,t:pe,e:void 0,x:void 0,r:e},pe.s!==void 0&&(pe.s.n=e),pe.s=e,t.n=e,32&pe.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=pe.s,e.n=void 0,pe.s.n=e,pe.s=e),e}}function We(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}We.prototype.brand=eb;We.prototype.h=function(){return!0};We.prototype.S=function(t){var e=this,r=this.t;r!==t&&t.e===void 0&&(t.x=r,this.t=t,r!==void 0?r.e=t:hs(function(){var n;(n=e.W)==null||n.call(e)}))};We.prototype.U=function(t){var e=this;if(this.t!==void 0){var r=t.e,n=t.x;r!==void 0&&(r.x=n,t.e=void 0),n!==void 0&&(n.e=r,t.x=void 0),t===this.t&&(this.t=n,n===void 0&&hs(function(){var i;(i=e.Z)==null||i.call(e)}))}};We.prototype.subscribe=function(t){var e=this;return Ya(function(){var r=e.value;hs(function(){return t(r)})},{name:"sub"})};We.prototype.valueOf=function(){return this.value};We.prototype.toString=function(){return this.value+""};We.prototype.toJSON=function(){return this.value};We.prototype.peek=function(){var t=this;return hs(function(){return t.value})};Object.defineProperty(We.prototype,"value",{get:function(){var t=rd(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(ls>100)throw new Error("Cycle detected");(function(r){hr!==0&&ls===0&&r.l!==Ka&&(r.l=Ka,ds={S:r,v:r.v,i:r.i,o:ds})})(this),this.v=t,this.i++,fs++,hr++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{ps()}}}});function nd(t,e){return new We(t,e)}function id(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function od(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function sd(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function mr(t,e){We.call(this,void 0,e),this.x=t,this.s=void 0,this.g=fs-1,this.f=4}mr.prototype=new We;mr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===fs))return!0;if(this.g=fs,this.f|=1,this.i>0&&!id(this))return this.f&=-2,!0;var t=pe;try{od(this),pe=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return pe=t,sd(this),this.f&=-2,!0};mr.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}We.prototype.S.call(this,t)};mr.prototype.U=function(t){if(this.t!==void 0&&(We.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};mr.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(mr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=rd(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function ad(t,e){return new mr(t,e)}function cd(t){var e=t.j;if(t.j=void 0,typeof e=="function"){hr++;var r=pe;pe=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Ja(t),n}finally{pe=r,ps()}}}function Ja(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,cd(t)}function rb(t){if(pe!==this)throw new Error("Out-of-order effect");sd(this),pe=t,this.f&=-2;try{8&this.f&&Ja(this)}finally{ps()}}function bi(t,e){this.x=t,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name,co&&co.push(this)}bi.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.j=e)}finally{t()}};bi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,cd(this),od(this),hr++;var t=pe;return pe=this,rb.bind(this,t)};bi.prototype.N=function(){2&this.f||(this.f|=2,this.u=uo,uo=this)};bi.prototype.d=function(){this.f|=8,1&this.f||Ja(this)};bi.prototype.dispose=function(){this.d()};function Ya(t,e){var r=new bi(t,e);try{r.c()}catch(i){throw r.d(),i}var n=r.d.bind(r);return n[Symbol.dispose]=n,n}var ud,ld,dd,fd,pd,hd,md,gd,nb={signal:nd,computed:ad,effect:Ya,batchWrite:td,isSignal:t=>typeof t=="function"||!!t&&typeof t=="object"&&("value"in t||"peek"in t),getValue:t=>typeof t=="function"?t():t.value,setValue:(t,e)=>{if(typeof t?.set=="function"){t.set(e);return}if(t instanceof mr||typeof t=="function")throw new TypeError("Cannot set value of a read-only computed signal.");t.value=e},peekValue:t=>typeof t?.peek=="function"?t.peek():typeof t=="function"?t():t&&typeof t=="object"&&"value"in t?t.value:t};ib(nb);function ib(t){ud=t.signal,ld=t.computed,dd=t.effect,fd=t.batchWrite,pd=t.isSignal,hd=t.getValue,md=t.setValue,gd=t.peekValue}function De(t){return ud(t)}function at(t){return ld(t)}function Nt(t){return dd(t)}function vi(t){return fd(t)}function Nr(t){return pd(t)}function ye(t){return hd(t)}function be(t,e){md(t,e)}function ce(t){return gd(t)}function lo(t){return/^(0|[1-9]\d*)$/.test(t)}var jr=1e4,ob=new Set(["__proto__","constructor","prototype"]),gr=class{constructor(e={}){this.data={},this.signals=new Map,this.subscriptions=new Set,this.data=e}getSignal(e){let r=this.normalizePath(e);return this.signals.has(r)||this.signals.set(r,De(this.get(r))),this.signals.get(r)}set(e,r,n=!1){if(e==null)throw new Se("Path cannot be null or undefined.");let i=this.parsePath(e);if(i.length===0)return this.data=r??{},this.notifyAllSignals(),this;let o=i.pop(),s=r===void 0||!n&&r===null;if(s&&this.get(e)===void 0)return this;if(this.data===void 0||this.data===null)this.data={};else if(typeof this.data!="object")throw new Se(`Cannot set path '${e}': the data model root is a primitive value.`,e);let a=this.data;for(let c=0;c<i.length;c++){let u=i[c];if(Array.isArray(a)){if(!lo(u))throw new Se(`Cannot use non-numeric segment '${u}' on an array in path '${e}'.`,e);let l=parseInt(u,10);if(l>jr)throw new Se(`Cannot set path '${e}': array index '${u}' exceeds maximum supported index (${jr}).`,e);let f=a[l];if(f!=null&&typeof f!="object")throw new Se(`Cannot set path '${e}': segment '${u}' is a primitive value.`,e);if(f==null){let h=c<i.length-1?i[c+1]:o;if(lo(h)){if(parseInt(h,10)>jr)throw new Se(`Cannot set path '${e}': array index '${h}' exceeds maximum supported index (${jr}).`,e);a[l]=[]}else a[l]={}}}else{let l=Object.prototype.hasOwnProperty.call(a,u);if(l){let f=a[u];if(f!=null&&typeof f!="object")throw new Se(`Cannot set path '${e}': segment '${u}' is a primitive value.`,e)}if(!l||a[u]===void 0||a[u]===null){let f=c<i.length-1?i[c+1]:o;if(lo(f)){if(parseInt(f,10)>jr)throw new Se(`Cannot set path '${e}': array index '${f}' exceeds maximum supported index (${jr}).`,e);a[u]=[]}else a[u]={}}}a=a[u]}if(Array.isArray(a)){if(!lo(o))throw new Se(`Cannot use non-numeric segment '${o}' on an array in path '${e}'.`,e);if(parseInt(o,10)>jr)throw new Se(`Cannot set path '${e}': array index '${o}' exceeds maximum supported index (${jr}).`,e)}if(s)if(Array.isArray(a)){let c=parseInt(o,10);c<a.length&&(a[c]=void 0)}else delete a[o];else a[o]=r;return this.notifySignals(e),this}delete(e){return this.set(e,void 0)}static resolvePath(e,r){return e.startsWith("/")?e:r?`${r.endsWith("/")?r:`${r}/`}${e}`:`/${e}`}get(e){if(e==null)throw new Se("Path cannot be null or undefined.");if(e==="/"||e==="")return this.data;let r=this.parsePath(e),n=this.data;for(let i of r){if(n==null||typeof n!="object")return;if(Array.isArray(n)){if(!lo(i))return;let o=parseInt(i,10);if(o<0||o>=n.length)return;n=n[o]}else{if(!Object.prototype.hasOwnProperty.call(n,i))return;n=n[i]}}return n}hasPath(e){return e==null?!1:this.get(e)!==void 0}subscribe(e,r){let n=this.getSignal(e),i=!0,o=ce(n),s=Nt(()=>{let a=ye(n);o=a,i||r(a)});return i=!1,this.subscriptions.add(s),{get value(){return o},unsubscribe:()=>{s(),this.subscriptions.delete(s)}}}dispose(){for(let e of this.subscriptions)e();this.subscriptions.clear(),this.signals.clear()}normalizePath(e){let r=e.split("/").filter(n=>n.length>0);return r.length===0?"/":`/${r.join("/")}`}parsePath(e){return e.split("/").filter(r=>r.length>0).map(r=>{let n=r.replace(/~([01])/g,(i,o)=>o==="1"?"/":"~");if(ob.has(n))throw new Se(`Forbidden path segment '${n}' in path '${e}'.`,e);return n})}notifySignals(e){let r=this.normalizePath(e);vi(()=>{this.updateSignal(r);let n=r;for(;n!=="/"&&n!=="";)n=n.substring(0,n.lastIndexOf("/"))||"/",this.updateSignal(n);for(let i of this.signals.keys())this.isDescendant(i,r)&&this.updateSignal(i)})}updateSignal(e){let r=this.signals.get(e);if(r){let n=this.get(e);Array.isArray(n)?be(r,n.slice()):typeof n=="object"&&n!==null?be(r,{...n}):be(r,n)}}notifyAllSignals(){vi(()=>{for(let e of this.signals.keys())this.updateSignal(e)})}isDescendant(e,r){return r==="/"||r===""?e!=="/":e.startsWith(r+"/")}};var xi=1e3;var GE=d.object({component:d.string().describe("The type name of the component."),id:d.lazy(()=>Dn).optional(),weight:d.number().optional()}).passthrough().describe("A generic A2UI component definition.");function fo(t,e,r){if(e!==void 0){let n=t.availableCatalogs?.get(e);if(!n)throw new me(`Catalog not found: ${e}`);return n}if(!t.defaultCatalog)throw new me(`${r} names no catalogId and surface '${t.id}' has no default catalogId.`);return t.defaultCatalog}var Xa=new WeakMap,sb="a2ui:system-functions",yd;function ab(){return yd??=new Ht(sb,kr.V1_0,[],Ad),yd}function Di(t){if(Xa.has(t))return Xa.get(t);let e=(()=>{let r=t;for(;r;){if(r instanceof d.ZodObject||r._def?.typeName==="ZodObject"){if(r._def?.unknownKeys==="passthrough")return null;let n=typeof r.shape=="function"?r.shape():r.shape;return n&&typeof n=="object"?new Set(Object.keys(n)):null}if(r instanceof d.ZodEffects||r._def?.typeName==="ZodEffects"){r=r._def.schema;continue}if(r instanceof d.ZodOptional||r instanceof d.ZodNullable||r._def?.typeName==="ZodOptional"||r._def?.typeName==="ZodNullable"){r=r._def.innerType;continue}if(r instanceof d.ZodDefault||r._def?.typeName==="ZodDefault"){r=r._def.innerType;continue}if(r instanceof d.ZodCatch||r._def?.typeName==="ZodCatch"){r=r._def.innerType;continue}if(r instanceof d.ZodIntersection||r._def?.typeName==="ZodIntersection"){let n=Di(r._def.left),i=Di(r._def.right);return!n||!i?null:new Set([...n,...i])}if(r instanceof d.ZodUnion||r._def?.typeName==="ZodUnion"){let n=r._def.options,i=new Set;for(let o of n){let s=Di(o);if(!s)return null;for(let a of s)i.add(a)}return i}return null}return null})();return Xa.set(t,e),e}function bd(t,e,r){if(!e||typeof e!="object"||Array.isArray(e))return;let n=Object.keys(e);if(n.length>xi)throw new K(`Function call '${t}' exceeds maximum allowed arguments count (${xi})`,t);let i=r?.functions?.get?.(t)??(t==="@index"&&r?.protocolVersion&&oe(r.protocolVersion,kr.V1_0)?Ci:void 0);if(!i?.schema)return;let o=Di(i.schema);if(o){for(let s of n)if(!o.has(s))throw new K(`Unknown argument '${s}' passed to function '${t}'`,t);if(n.length>o.size)throw new K(`Too many arguments for function '${t}': expected at most ${o.size}, received ${n.length}`,t)}}function cb(t){return t.startsWith("@")&&!t.startsWith("@@")}function vd(t){return t.startsWith("@@")?t.slice(1):t}var xd=new Set(["@path","@call"]);function ms(t,e){if(oe(e,"1.0")){for(let r of t)if(cb(r)&&!xd.has(r))throw new R(`Unrecognized reserved protocol directive '${r}' in v1.0 dynamic object. Reserved keys must be in ${Array.from(xd).join(", ")}, or escaped with prefix doubling (e.g. '@${r}').`,void 0,"INVALID_RESERVED_KEY")}}function Qa(t){let e=t;for(;e;){if(e.explicitIndex!==void 0&&Number.isFinite(e.explicitIndex))return e.explicitIndex;if(!(e instanceof Ct)&&typeof e.getIndex=="function"){let r=e.getIndex();if(r!==void 0&&Number.isFinite(r))return r}if(!(e instanceof Ct)&&typeof e.index=="number"&&Number.isFinite(e.index))return e.index;if(typeof e.path=="string"){let r=e.path.split("/").filter(Boolean);if(r.length>0&&/^\d+$/.test(r[r.length-1]))return parseInt(r[r.length-1],10)}e=e.parent}}var Ai=1e3,Ct=class t{constructor(e,r,n,i){this.path=r,this._isUserActivated=!1,this._isPassiveEvaluation=!1,this._isActionExecution=!1,e instanceof gr?(this.surface=void 0,this.dataModel=e,this.functionInvoker=()=>{}):(this.surface=e,this.dataModel=e.dataModel,this.functionInvoker=e.defaultCatalog?.invoker??((o,...s)=>fo(e,void 0,`Function call '${o}'`).invoker(o,...s))),this.explicitIndex=n,this.parent=i,this.warnedPaths=i?i.warnedPaths:new Set}get isUserActivated(){return this._isUserActivated||!!this.parent?.isUserActivated}get isPassiveEvaluation(){return this._isPassiveEvaluation||!!this.parent?.isPassiveEvaluation}getIndex(){return Qa(this)}get index(){return this.getIndex()}set(e,r){let n=this.resolvePath(e),i=!!(this.surfaceProtocolVersion&&!this.atLeastV10);this.dataModel.set(n,r,i)}get surfaceProtocolVersion(){return this.surface?.protocolVersion??this.surface?.defaultCatalog?.protocolVersion}get atLeastV10(){return this._cachedAtLeastV10===void 0&&(this._cachedAtLeastV10=oe(this.surfaceProtocolVersion,"1.0")),this._cachedAtLeastV10}isDataBindingObject(e){return(this.atLeastV10?"@path"in e&&typeof e["@path"]=="string":"path"in e&&typeof e.path=="string")&&!("componentId"in e)}isFunctionCallObject(e){return this.atLeastV10?"@call"in e&&typeof e["@call"]=="string":"call"in e&&typeof e.call=="string"}containsDynamicValue(e){if(e===null||typeof e!="object"||xt(e))return!1;if(Array.isArray(e))return e.some(n=>this.containsDynamicValue(n));let r=e;if(this.isDataBindingObject(r)||this.isFunctionCallObject(r))return!0;if(this.atLeastV10){for(let n of Object.keys(r))if(n.startsWith("@"))return!0}return Object.values(r).some(n=>this.containsDynamicValue(n))}emitMissingDataBindingWarning(e){typeof this.dataModel?.hasPath=="function"&&!this.dataModel.hasPath(e)&&!this.warnedPaths.has(e)&&(this.warnedPaths.add(e),this.surface?.dispatchWarning?.({code:"MISSING_DATA_BINDING",path:e,message:`Preflight DataBinding Warning: The bound JSON Pointer '${e}' does not physically exist in the active DataModel. Evaluating to None.`}))}resolveDynamicValue(e,r=0,n=!1){if(r>Ai){let o=new K(`Maximum dynamic value nesting depth exceeded (${Ai})`);this.dispatchExpressionError(o,"DynamicValue");return}if(e===null||typeof e!="object"||xt(e))return e;if(Array.isArray(e))return this.containsDynamicValue(e)?e.map(o=>this.resolveDynamicValue(o,r+1,n)):e;let i=e;if(this.isDataBindingObject(i)){let o=i["@path"]??i.path,s=this.resolvePath(o),a=this.dataModel.get(s);return a===void 0&&this.emitMissingDataBindingWarning(s),a}return this.isFunctionCallObject(i)?this.resolveFunctionCallValue(i,r,n):this.resolvePlainObjectValue(i,r,n)}resolveFunctionCallValue(e,r=0,n=!1){let i=e["@call"]??e.call,o=this.resolveCallCatalog(i,e);if(!o)return;try{bd(i,e.args,o)}catch(l){this.dispatchExpressionError(l,i);return}let s={};for(let[l,f]of Object.entries(e.args??{}))s[l]=this.resolveDynamicValue(f,r+1,n);let a=new AbortController,c=this._isUserActivated;this._isUserActivated=c||n;let u;try{u=this.evaluateFunctionReactive(i,s,o.invoker,a.signal)}finally{this._isUserActivated=c}if(u!==void 0)return xt(u)?r>0?u:Promise.resolve(u).then(l=>l,l=>{this.dispatchExpressionError(l,i)}):Nr(u)?ce(u):u}resolvePlainObjectValue(e,r=0,n=!1){if(this.atLeastV10&&ms(Object.keys(e),this.surfaceProtocolVersion),!this.containsDynamicValue(e))return e;let i={};for(let[o,s]of Object.entries(e)){let a=this.atLeastV10?vd(o):o;i[a]=this.resolveDynamicValue(s,r+1,n)}return i}subscribeDynamicValue(e,r){let n=this.resolveSignal(e),i=!0,o=ce(n),s=Nt(()=>{let a=ye(n);o=a,i||r(a)});return i=!1,{get value(){return o},unsubscribe:()=>{s(),n.unsubscribe?.()}}}resolveSignal(e,r=0){if(r>Ai){let a=new K(`Maximum dynamic value nesting depth exceeded (${Ai})`);return this.dispatchExpressionError(a,typeof e=="object"&&e&&("@call"in e||"call"in e)?e["@call"]??e.call:"DynamicValue"),De(void 0)}if(typeof e!="object"||e===null)return De(e);if(xt(e)){let a=De(void 0);return this.settleIntoSignal(a,e,"DynamicValue"),a}if(Array.isArray(e)){if(!this.containsDynamicValue(e))return De(e);let a=e.map(u=>this.resolveSignal(u,r+1)),c=at(()=>a.map(u=>ye(u)));return c.unsubscribe=()=>{for(let u of a)u.unsubscribe?.()},c}let n=e;if(this.isDataBindingObject(n)){let a=n["@path"]??n.path,c=this.resolvePath(a);return this.emitMissingDataBindingWarning(c),this.dataModel.getSignal(c)}if(this.isFunctionCallObject(n)){let a=n,c=a["@call"]??a.call,u=this.resolveCallCatalog(c,a);if(!u)return De(void 0);try{bd(c,a.args,u)}catch(D){return this.dispatchExpressionError(D,c),De(void 0)}let l={};for(let[D,_]of Object.entries(a.args??{}))l[D]=this.resolveSignal(_,r+1);if(Object.keys(l).length===0){let D=new AbortController,_=this.evaluateFunctionPassive({name:c,args:{},abortSignal:D.signal,invoker:u.invoker}),q;if(Nr(_))q=_;else if(xt(_)){let j=De(void 0);this.settleIntoSignal(j,_,c,D.signal),q=j}else q=De(_);return q.unsubscribe=()=>D.abort(),q}let f=Object.keys(l),h=De(void 0),p,m,y=at(()=>{let D={};for(let _=0;_<f.length;_++)D[f[_]]=ye(l[f[_]]);return D}),A=Nt(()=>{try{let D=ye(y);p&&p.abort(),m&&(m(),m=void 0),p=new AbortController;let _=this.evaluateFunctionPassive({name:c,args:D,abortSignal:p.signal,invoker:u.invoker});Nr(_)?(be(h,ce(_)),m=Nt(()=>{be(h,ye(_))})):xt(_)?this.settleIntoSignal(h,_,c,p.signal):be(h,_)}catch(D){this.dispatchExpressionError(D,c),be(h,void 0)}});return h.unsubscribe=()=>{A(),m&&m(),p&&p.abort();for(let D=0;D<f.length;D++)l[f[D]].unsubscribe?.()},h}if(this.atLeastV10&&ms(Object.keys(n),this.surfaceProtocolVersion),!this.containsDynamicValue(n))return De(e);let i=Object.entries(n).map(([a,c])=>[this.atLeastV10?vd(a):a,this.resolveSignal(c,r+1)]),o=at(()=>{let a={};for(let[c,u]of i)a[c]=ye(u);return a}),s=o.unsubscribe?.bind(o);return o.unsubscribe=()=>{s?.();for(let[,a]of i)a.unsubscribe?.()},o}handleInvalidAction(e){this.surface?.dispatchError({code:"INVALID_ACTION",surfaceId:this.surface?.id,message:e})}resolveActionEventObject(e){if(typeof e.name!="string"||e.name.length===0)return this.handleInvalidAction("Action event is missing required 'name' string.");let r;if(e.context&&typeof e.context=="object"&&!Array.isArray(e.context)){r={};for(let[i,o]of Object.entries(e.context))r[i]=this.resolveDynamicValue(o)}let n={...e,...r!==void 0?{context:r}:{}};if(e.context===void 0&&delete n.context,e.userMessage!==void 0){let i=this.resolveDynamicValue(e.userMessage);if(typeof i!="string")return this.handleInvalidAction("Action event 'userMessage' must resolve to a string.");n.userMessage=i}return n}executeActionFunctionCall(e,r){let n="functionCall"in e?e.functionCall:e;if(n&&typeof n=="object"){let a=n["@call"]??n.call;typeof a=="string"&&(n=this.atLeastV10&&!("@call"in n)?{"@call":a,...n}:!this.atLeastV10&&!("call"in n)?{call:a,...n}:n)}let i=r?.userActivation??!0,o=this._isActionExecution,s=this._isPassiveEvaluation;this._isActionExecution=!0,r?.userActivation===!1&&(this._isPassiveEvaluation=!0);try{return this.resolveDynamicValue(n,0,i)}finally{this._isActionExecution=o,this._isPassiveEvaluation=s}}resolveAction(e,r){if("event"in e&&typeof e.event=="object"&&e.event!==null){let n=this.resolveActionEventObject(e.event);return n===void 0?void 0:{...e,event:n}}return"name"in e?this.resolveActionEventObject(e):"functionCall"in e||"call"in e||"@call"in e?this.executeActionFunctionCall(e,r):e}resolveFunctionCatalog(e,r,n){if(this.atLeastV10&&e.startsWith("@")){if(n)throw new K(`System function '${e}' belongs to no catalog and must not name a catalogId.`,e);return ab()}if(!this.surface)throw new me(`No surface available to resolve catalog: ${r??"default"}`);return fo(this.surface,this.atLeastV10?r:void 0,`Function call '${e}'`)}resolveCallCatalog(e,r){try{return this.resolveFunctionCatalog(e,r.catalogId,"catalogId"in r)}catch(n){n instanceof me&&this.surface?this.surface.dispatchError({code:"CATALOG_ERROR",message:n.message,expression:e}):this.dispatchExpressionError(n,e);return}}evaluateFunctionPassive(e){let{name:r,args:n,invoker:i,abortSignal:o}=e,s=this._isPassiveEvaluation;this._isPassiveEvaluation=!0;try{return this.evaluateFunctionReactive(r,n,i,o)}finally{this._isPassiveEvaluation=s}}evaluateFunctionReactive(e,r,n,i){try{return n(e,r,this,i)}catch(o){this.dispatchExpressionError(o,e);return}}settleIntoSignal(e,r,n,i){Promise.resolve(r).then(o=>{i?.aborted||be(e,o)},o=>{i?.aborted||(this.dispatchExpressionError(o,n),be(e,void 0))})}dispatchExpressionError(e,r){if(this.surface)if(e instanceof d.ZodError||typeof e=="object"&&e!==null&&e.name==="ZodError"){let n=e,i=new K(`Validation failed for function '${r}': ${n.message}`,r,n.errors??n.issues);this.surface.dispatchError({code:"EXPRESSION_ERROR",message:i.message,expression:r,details:i.details})}else if(e instanceof K)this.surface.dispatchError({code:"EXPRESSION_ERROR",message:e.message,expression:e.expression,details:e.details});else{let n=typeof e=="object"&&e!==null?e:{};this.surface.dispatchError({code:this._isActionExecution?"EXECUTION_ERROR":"EXPRESSION_ERROR",message:n.message??`An unexpected error occurred in function ${r}.`,expression:r})}}nested(e,r){let n=this.resolvePath(e);return new t(this.surface??this.dataModel,n,r,this)}resolvePath(e){if(e.startsWith("/"))return e;let r=this.path;return r.endsWith("/")&&r.length>1&&(r=r.slice(0,-1)),e===""||e==="."?r||"/":(r==="/"&&(r=""),`${r}/${e}`)}};var wi=pi(d.string().describe("REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface."),"component-id"),ec=d.string().describe("REF:#/$defs/CallId|The unique identifier for a function call."),wt=d.object({"@path":d.string().describe("A JSON Pointer path to a value in the data model.").optional(),path:d.string().describe("A JSON Pointer path to a value in the data model.").optional()}).refine(t=>t["@path"]!==void 0||t.path!==void 0,{message:"Either '@path' or 'path' must be provided."}).describe("REF:#/$defs/DataBinding"),ub=d.object({"@call":d.string().describe("The name of the function to call.").optional(),call:d.string().describe("The name of the function to call.").optional(),catalogId:d.string().describe("The catalog ID for this function, overriding any surface-level default catalogId.").optional()}).refine(t=>t["@call"]!==void 0||t.call!==void 0,{message:"Either '@call' or 'call' must be provided."}).describe("REF:#/$defs/FunctionCommon|Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog."),ct=d.record(d.string(),d.any()).and(d.intersection(ub,d.any())).describe("REF:#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition."),Q=d.union([d.string(),wt,ct]).describe("REF:#/$defs/DynamicString|Represents a string"),Kt=d.union([d.boolean(),wt,ct]).describe("REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its 'valid' boolean)."),lb=d.object({label:Q.optional(),description:Q.optional(),live:d.enum(["off","polite","assertive"]).describe("Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.").default("off"),hidden:Kt.optional()}).strict().describe("REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding."),tc=d.record(d.string(),d.unknown()).superRefine((t,e)=>{for(let r in t)lr(r)||e.addIssue({path:[r],code:d.ZodIssueCode.custom,message:`Invalid extension key "${r}": Keys MUST be Unicode identifiers (UAX #31).`})}).describe("REF:#/$defs/Extensions|Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions."),Dd=d.object({id:wi,catalogId:d.string().describe("The catalog ID for this component, overriding any surface-level default catalogId.").optional(),accessibility:lb.optional(),metadata:d.object({extensions:tc.optional()}).strict().describe("Optional component-level metadata for vendor extensions.").optional()}).describe("REF:#/$defs/ComponentCommon"),Ei=wi,po=pi(d.union([d.array(wi).describe("A static list of child component IDs."),d.object({componentId:wi,path:d.string().describe("The path to the list of component property objects in the data model.")}).strict().describe("A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.")]).describe("REF:#/$defs/ChildList"),"child-list"),gs=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),d.record(d.string(),d.unknown()).refine(t=>!t||!("@path"in t)&&!("path"in t)&&!("@call"in t)&&!("call"in t)),wt,ct]).describe("REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type."),jt=d.union([d.number(),wt,ct]).describe("REF:#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number."),rc=d.union([d.array(d.string()),wt,ct]).describe("REF:#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array."),fS=d.object({"@call":d.literal("@index").optional(),call:d.literal("@index").optional(),args:d.object({offset:jt.optional()}).optional()}).refine(t=>t["@call"]!==void 0||t.call!==void 0,{message:"Either '@call' or 'call' must be '@index'."}).describe("REF:#/$defs/IndexSystemFunction"),Pr=d.object({condition:d.union([wt,ct]).describe("Path or function call evaluating to a structured validation result object or a boolean."),message:d.string().describe("Optional fallback error message.").optional()}).strict().describe("REF:#/$defs/CheckRule|A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object)."),pS=d.object({checks:d.array(Pr).describe("A list of validation check rules to perform on the component.").optional()}).describe("REF:#/$defs/Checkable|Properties for components that support renderer-side checks."),Cd=d.union([d.object({event:d.object({name:d.string().describe("The name of the action to be dispatched to the agent."),userMessage:Q.optional(),context:d.record(d.string(),gs).describe("A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.").optional()}).strict().describe("The event to dispatch to the agent.")}).strict().describe("Triggers an agent-side event."),d.object({functionCall:ct}).strict().describe("Executes a renderer or agent-side function.")]).describe("REF:#/$defs/Action|Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function."),hS=d.object({component:d.literal("Surface").optional(),child:d.literal("root").optional()}).strict().describe("REF:#/$defs/Surface|The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has 'child': 'root'."),wd=d.object({functionCallId:ec,value:d.any().describe("The return value of the function.").optional(),error:d.object({code:d.string(),message:d.string()}).strict().describe("An error object indicating failure of the function execution.").optional()}).strict().superRefine((t,e)=>{let r="value"in t,n="error"in t;(r&&n||!r&&!n)&&e.addIssue({code:d.ZodIssueCode.custom,message:'FunctionResponse must have either "value" or "error", but not both or neither.'})}).describe("REF:#/$defs/FunctionResponse|The return response matching a callAgentFunction or callRendererFunction invocation.");var Ci={name:"@index",returnType:"number",allowedCallers:"rendererOnly",schema:d.object({offset:d.union([wt,ct,d.coerce.number()]).optional()})},ho=ke(Ci,(t,e)=>{let r=typeof t.offset=="number"&&Number.isFinite(t.offset)?t.offset:0,n=Qa(e);if(n===void 0||!Number.isFinite(n))throw new R("@index function can only be evaluated inside a collection template iteration scope.");return n+r}),Ad=[ho];var db=/^REF:[^|#]*#\/\$defs\/DynamicBoolean(?:\||$)/;function fb(t){if(typeof t!="object"||t===null||Array.isArray(t))return;let e=t.valid;return typeof e=="boolean"?e:void 0}function nc(t){let e=t._def;switch(e.typeName){case"ZodOptional":case"ZodNullable":case"ZodDefault":case"ZodCatch":case"ZodBranded":case"ZodReadonly":return e.innerType;case"ZodEffects":return e.schema;case"ZodLazy":return e.getter?.();default:return}}function pb(t){let e=t;for(;e;){if(typeof e.description=="string"&&db.test(e.description))return!0;e=nc(e)}return!1}function hb(t){let e=t;for(let r=nc(e);r;r=nc(e))e=r;return e}function mb(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ys(t,e){if(typeof e!="object"||e===null)return e;if(pb(t))return fb(e)??e;let r=hb(t),n=r._def;if(n.typeName==="ZodArray"&&Array.isArray(e)&&n.type){let i=n.type,o=!1,s=e.map(a=>{let c=ys(i,a);return o||=c!==a,c});return o?s:e}if(n.typeName==="ZodObject"&&mb(e)){let i=r.shape,o=!1,s={};for(let[a,c]of Object.entries(e)){let u=i[a],l=u?ys(u,c):c;o||=l!==c,s[a]=l}return o?s:e}return e}function ke(t,e){return{name:t.name,returnType:t.returnType,schema:t.schema,allowedCallers:t.allowedCallers,requiresUserActivation:t.requiresUserActivation,description:t.description,execute:e}}var Ht=class t{get validationSchema(){return this.cachedValidationSchema||(this.cachedValidationSchema=Yl(this)),we(this.cachedValidationSchema)}get catalogSchema(){return this.validationSchema}toJson(){return this.cachedDocument||(this.cachedDocument=Pl(this)),we(this.cachedDocument)}withEntries(e,r){return this.rebuild(e,r,{id:this.id,schemaId:this.schemaId,title:this.title,description:this.description,instructions:this.instructions})}derive(e){let r=(n,i,o)=>o===void 0?[...i.values()]:o.map(s=>{if(typeof s!="string")return s;let a=i.get(s);if(!a)throw new me(`Catalog '${this.id}' has no ${n} '${s}' to derive catalog '${e.catalogId}' from.`);return a});return this.rebuild(r("component",this.components,e.components),r("function",this.functions,e.functions),{id:e.catalogId,instructions:e.instructions})}rebuild(e,r,n){let i=e.length!==this.components.size||e.some(c=>this.components.get(c.name)!==c),o=r.length!==this.functions.size||r.some(c=>this.functions.get(c.name)!==c),s=this.defs;if(s&&(i||o)){let c={...s};i&&delete c.anyComponent,o&&delete c.anyFunction,s=c}let a=this.unions?{anyComponent:this.unions.anyComponent||i,anyFunction:this.unions.anyFunction||o}:void 0;return new t(n.id,this.protocolVersion,e,r,{themeSchema:this.themeSchema,instructions:n.instructions,schemaUri:this.schemaUri,schemaId:n.schemaId,title:n.title,description:n.description,declaredProtocolVersion:this.declaredProtocolVersion,declaresCatalogId:this.declaresCatalogId,declaresComponents:this.declaresComponents,functionsLayout:this.functionsLayout,unions:a,defs:Tl(s,[...this.components.values(),...this.functions.values()],[...e,...r],this.extensionFields),extensionFields:this.extensionFields,commonTypesUri:this.commonTypesUri,themeLocation:this.themeLocation,defModels:this.defModels})}get componentRefMap(){if(!this._componentRefMap){let e=oe(this.protocolVersion,"1.0")?yl:oe(this.protocolVersion,"0.9")?gl:hl;this._componentRefMap=ed(this,e)}return this._componentRefMap}constructor(e,r,n,i,o,s){let a,c,u,l,f;if(typeof r!="string"?(a="0.9",c=r??[],u=n??[],l=i,f=o):(a=r,c=n??[],u=i??[],l=o,f=s),!a)throw new me("protocolVersion must be provided.");this.id=e,this.protocolVersion=a;let h=new Map;for(let y of c)h.set(y.name,y);this.components=h;let p=new Map;for(let y of u)p.set(y.name,y);this.functions=p;let m=gb(l)?{themeSchema:l}:l??{};this.themeSchema=m.themeSchema,this.instructions=m.instructions??f,this.schemaUri=m.schemaUri,this.schemaId=m.schemaId,this.title=m.title,this.description=m.description,this.declaredProtocolVersion=m.declaredProtocolVersion,this.declaresCatalogId=m.declaresCatalogId??!0,this.declaresComponents=m.declaresComponents??!0,this.functionsLayout=m.functionsLayout,this.unions=m.unions?Object.freeze({...m.unions}):void 0,this.defs=ja(m.defs),this.extensionFields=ja(m.extensionFields),this.commonTypesUri=m.commonTypesUri,this.themeLocation=m.themeLocation,this.defModels=m.defModels?Object.freeze([...m.defModels]):void 0,this.invoker=yb(this.id,this.protocolVersion,this.functions)}static fromJson(e,r,n){let{id:i,protocolVersion:o,components:s,functions:a,...c}=Hl(e,r,n);return new t(i,o,s,a,c)}static fromSchema(e,r){return t.fromJson(e,r)}};function gb(t){return typeof t=="object"&&t!==null&&typeof t.safeParse=="function"}function yb(t,e,r){return(n,i,o,s)=>{let a=r.get(n)??(oe(e,kr.V1_0)&&n==="@index"?ho:void 0);if(!a)throw new K(`Function not found in catalog '${t}': ${n}`,n);bb(a),vb(a,o);let c=a.execute;if(typeof c!="function")throw new K(`Function '${n}' in catalog '${t}' is schema-only and has no implementation.`,n);let u=f=>{try{let h=oe(e,kr.V1_0)?ys(a.schema,f):f,p=a.schema.parse(h);return c.call(a,p,o,s)}catch(h){throw h?.name==="ZodError"||h instanceof d.ZodError?new K(`Validation failed for function '${n}': ${h.message}`,n,h.errors??h.issues):h}},l=vn(i);return xt(l)?Promise.resolve(l).then(f=>s?.aborted?void 0:u(f)):u(l)}}function bb(t){if(t.allowedCallers==="agentOnly")throw new K(`Function '${t.name}' cannot be called by renderer (allowedCallers is agentOnly).`,t.name)}function vb(t,e){if(!t.requiresUserActivation)return;let r=!!e?.isPassiveEvaluation,i=!!!e?.isUserActivated&&typeof navigator<"u"&&!(navigator.userActivation?.isActive??!0);if(r||i)throw new K(`Function '${t.name}' requires user activation and cannot be evaluated without an active user gesture.`,t.name)}var Ee=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),{unsubscribe:()=>this.listeners.delete(e)}}async emit(e){for(let r of this.listeners)try{let n=r(e);n&&typeof n.then=="function"&&await n}catch(n){console.error("EventEmitter error:",n)}}dispose(){this.listeners.clear()}};var Si=50,bs=5,ic=/^(?:(?:\/(?:[^~/]|~[01])*)*|(?:[^~/]|~[01])+(?:\/(?:[^~/]|~[01])*)*)$/;function*vs(t,e,r){if(typeof t=="string")yield[t,e];else if(Array.isArray(t))for(let n=0;n<t.length;n++){let i=t[n],o=`${e}[${n}]`;yield*vs(i,o,r)}else if(typeof t=="object"&&t!==null){let n=t;if("componentId"in n&&typeof n.componentId=="string"&&("path"in n||"dataBinding"in n))yield[n.componentId,`${e}.componentId`];else if(r?.size)for(let i of r)i in n&&(yield*vs(n[i],`${e}.${i}`));else for(let[i,o]of Object.entries(n))yield*vs(o,`${e}.${i}`)}}function xb(t){return t.componentRefMap}function*mo(t,e){if(!t||typeof t!="object")return;let r=e instanceof Ht?xb(e):e,n=t.component,i="",o=t;if(typeof n=="string")i=n;else if(typeof n=="object"&&n!==null){let l=n;i=Object.keys(l)[0]??"",o=l[i]??{}}if(!i||typeof o!="object"||o===null)return;let s=r[i],a=s?s.singleRefs:new Set,c=s?s.listRefs:new Set,u=s?.nestedRefs;for(let[l,f]of Object.entries(o))(a.has(l)||c.has(l))&&(yield*vs(f,l,u?.[l]))}var Ab=Object.freeze({allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1}),Db=Object.freeze({allowOrphanComponents:!0,allowDanglingReferences:!0,allowMissingRoot:!0,allowUnknownElements:!0});function In(t,e,r){if(e>Si)throw new vt(`Global recursion limit exceeded: Depth > ${Si}`);if(Array.isArray(t)){for(let n of t)In(n,e+1,r);return}if(typeof t=="object"&&t!==null){let n=t;for(let s of[n.path,n["@path"]])if(typeof s=="string"&&!ic.test(s))throw new R(`Invalid path syntax: '${s}'`);let i="functionCall"in n&&typeof n.functionCall=="object"&&n.functionCall!==null,o=("call"in n||"@call"in n)&&"args"in n;if(i){if(r>=bs)throw new vt(`Recursion limit exceeded: functionCall depth > ${bs}`);for(let[s,a]of Object.entries(n))s==="functionCall"?In(a,e+1,r+1):In(a,e+1,r)}else if(o){if(r>=bs)throw new vt(`Recursion limit exceeded: functionCall depth > ${bs}`);for(let[s,a]of Object.entries(n))s==="args"?In(a,e+1,r+1):In(a,e+1,r)}else for(let s of Object.values(n))In(s,e+1,r)}}function Ed(t){In(t,0,0)}var _i=class{constructor(e){this.components=new Map,this._onCreated=new Ee,this._onDeleted=new Ee,this.onCreated=this._onCreated,this.onDeleted=this._onDeleted,e&&this.setCatalog(e)}setCatalog(e){this.refMap=e instanceof Ht?e.componentRefMap:e}get(e){return this.components.get(e)}getAll(){return new Map(this.components)}has(e){return this.components.has(e)}get entries(){return this.components.entries()}get keys(){return this.components.keys()}get values(){return this.components.values()}get size(){return this.components.size}get componentsMap(){return this.components}addComponent(e){if(this.components.has(e.id))throw new Rt(`Component with id '${e.id}' already exists.`);this.components.set(e.id,e),this._onCreated.emit(e)}insertComponent(e,r){if(this.components.has(r.id))throw new Rt(`Component with id '${r.id}' already exists.`);if(e<this.components.size){let n=[...this.components].slice(Math.max(0,e));for(let[i]of n)this.components.delete(i);this.components.set(r.id,r);for(let[i,o]of n)this.components.set(i,o)}else this.components.set(r.id,r);this._onCreated.emit(r)}removeComponent(e){let r=this.components.get(e);r&&(this.components.delete(e),r.dispose(),this._onDeleted.emit(e))}getChildReferences(e){let r=this.components.get(e);if(!r)return[];let n=r.catalog.components.size?r.catalog.componentRefMap:this.refMap??r.catalog.componentRefMap;return Array.from(mo(r.componentTree,n))}getChildIds(e){return this.getChildReferences(e).map(([r])=>r)}detectCycles(e={}){let r=e.rootId??"root",n=e.maxDepth??Si,i=e.allowMissingRoot??!1;for(let c of this.components.values())for(let[u,l]of this.getChildReferences(c.id))if(u===c.id)throw new vt(`Circular reference detected: Component '${c.id}' references itself in field '${l}' (Self-reference detected)`);let o=new Set,s=new Set,a=(c,u)=>{if(u>n)throw new vt(`Global recursion limit exceeded: logical depth > ${n}`);o.add(c),s.add(c);let l=this.getChildIds(c);for(let f of l)if(this.components.has(f)){if(!o.has(f))a(f,u+1);else if(s.has(f))throw new vt(`Circular reference detected involving component '${f}'`)}s.delete(c)};if(i){let c=Array.from(this.components.keys()).sort();for(let u of c)o.has(u)||a(u,0)}else this.components.has(r)&&a(r,0);return o}validateTopology(e={}){if(this.components.size===0)return;let r=e.rootId??"root",n=e.allowMissingRoot??!1,i=e.allowDanglingReferences??!1,o=e.allowOrphanComponents??!1;if(!n&&!this.components.has(r))throw new ot(`Missing root component: No component has id='${r}'`);if(!i){for(let a of this.components.values())for(let[c,u]of this.getChildReferences(a.id))if(!this.components.has(c))throw new ot(`Component '${a.id}' references non-existent component '${c}' in field '${u}' (Dangling reference '${c}' in component '${a.id}')`)}let s=this.detectCycles({rootId:r,allowMissingRoot:n,maxDepth:e.maxDepth});if(!o&&!n&&s.size<this.components.size){let a=Array.from(this.components.keys()).filter(c=>!s.has(c)).sort();if(a.length>0)throw new ot(`Component '${a[0]}' is not reachable from '${r}' (Orphaned component '${a[0]}' is not reachable from root)`)}}validateReferences(e={}){let r=[];try{this.validateTopology(e)}catch(n){n instanceof R?r.push(n):n instanceof Error&&r.push(new R(n.message))}return r}dispose(){let e=Array.from(this.components.keys());for(let r of this.components.values())r.dispose();this.components.clear();for(let r of e)this._onDeleted.emit(r);this._onCreated.dispose(),this._onDeleted.dispose()}};function Cb(t){if(!t)return;let e=Ae(t);return e?oe(e,"1.0")?e:`v${e}`:t}var kn=class{constructor(e,r,n=new Map,i={},o=!1,s,a="root",c,u){this.id=e,this.defaultCatalog=r,this.rootId=a,this._onAction=new Ee,this._onError=new Ee,this._onWarning=new Ee,this._onMetadataChanged=new Ee,this.onAction=this._onAction,this.onError=this._onError,this.onWarning=this._onWarning,this.onMetadataChanged=this._onMetadataChanged,this._metadataSignal=De(Zt(c)),this.metadataSignal=at(()=>ye(this._metadataSignal)),this.protocolVersion=Cb(u??r?.protocolVersion);let l,f={},h=!1;if(n!=null&&!(n instanceof Map))if(typeof n=="object"&&!Array.isArray(n))f=n,h=i===!0,s=o instanceof gr?o:void 0,l=void 0;else throw new TypeError("availableCatalogs must be a Map, or undefined/null. Note that availableCatalogs is now the 3rd argument to SurfaceModel and theme is the 4th argument.");else l=n,f=i??{},h=!!o;this.theme=f,this.sendDataModel=h;let p=new Map(l??[]);r?.id&&!p.has(r.id)&&p.set(r.id,r),this.availableCatalogs=p,this.dataModel=s??new gr({}),this.componentsModel=new _i(r)}get catalog(){return this.defaultCatalog}resolveCatalog(e,r="Item"){return fo(this,e,r)}get metadata(){return ce(this._metadataSignal)}set metadata(e){let r=Zt(e);Ki(ce(this._metadataSignal),r)||(be(this._metadataSignal,r),this._onMetadataChanged.emit(r))}get extensions(){return ce(this._metadataSignal)?.extensions}setExtension(e,r){if(r===void 0){this.removeExtension(e);return}let n=ce(this._metadataSignal),i={...n?.extensions??{},[e]:r};this.metadata={...n??{},extensions:i}}removeExtension(e){let r=ce(this._metadataSignal),n=r?.extensions;if(!n||!(e in n))return;let i={...n};delete i[e];let o={...r};delete o.extensions,Object.keys(i).length>0?this.metadata={...o,extensions:i}:Object.keys(o).length>0?this.metadata=o:this.metadata=void 0}async dispatchAction(e,r,n){if(!e||typeof e!="object")return;let i=wb(e);if(!i)return;let o=i.name;if(!o||typeof o!="string")return;let s=i.context,a=s&&typeof s=="object"&&!Array.isArray(s)?s:{},c={name:o,surfaceId:this.id,sourceComponentId:r,timestamp:new Date().toISOString(),context:a},u=i.catalogId??e.catalogId;typeof u=="string"&&u&&(c.catalogId=u),typeof i.userMessage=="string"&&i.userMessage.length>0&&(c.userMessage=i.userMessage);let l=i.metadata??e.metadata,f=Eu(l,n);f!==void 0&&(c.metadata=f),await this._onAction.emit(c)}async dispatchError(e){await this._onError.emit({...e,surfaceId:this.id})}async dispatchWarning(e){await this._onWarning.emit({...e,surfaceId:this.id})}dispose(){this.dataModel.dispose(),this.componentsModel.dispose(),this._onAction.dispose(),this._onError.dispose(),this._onWarning.dispose(),this._onMetadataChanged.dispose()}};function wb(t){return"event"in t&&t.event&&typeof t.event=="object"?t.event:"name"in t&&typeof t.name=="string"?t:null}var xs=class{constructor(){this.surfaces=new Map,this.surfaceUnsubscribers=new Map,this.surfaceErrorUnsubscribers=new Map,this._onSurfaceCreated=new Ee,this._onSurfaceDeleted=new Ee,this._onAction=new Ee,this._onError=new Ee,this.onSurfaceCreated=this._onSurfaceCreated,this.onSurfaceDeleted=this._onSurfaceDeleted,this.onAction=this._onAction,this.onError=this._onError}emitError(e){this._onError.emit(e)}addSurface(e){if(this.surfaces.has(e.id)){console.warn(`Surface ${e.id} already exists. Ignoring.`);return}this.surfaces.set(e.id,e);let r=e.onAction.subscribe(i=>{this._onAction.emit(i)});this.surfaceUnsubscribers.set(e.id,r);let n=e.onError.subscribe(i=>{this._onError.emit(i)});this.surfaceErrorUnsubscribers.set(e.id,n),this._onSurfaceCreated.emit(e)}deleteSurface(e){let r=this.surfaces.get(e);if(r){let n=this.surfaceUnsubscribers.get(e);n&&(n.unsubscribe(),this.surfaceUnsubscribers.delete(e));let i=this.surfaceErrorUnsubscribers.get(e);i&&(i.unsubscribe(),this.surfaceErrorUnsubscribers.delete(e)),this.surfaces.delete(e),r.dispose(),this._onSurfaceDeleted.emit(e)}}getSurface(e){return this.surfaces.get(e)}get surfacesMap(){return this.surfaces}dispose(){for(let e of Array.from(this.surfaces.keys()))this.deleteSurface(e);this._onSurfaceCreated.dispose(),this._onSurfaceDeleted.dispose(),this._onAction.dispose(),this._onError.dispose()}};var yr=class{constructor(e,r,n,i,o){this.id=e,this.type=r,this._onUpdated=new Ee,this._onMetadataChanged=new Ee,this.onUpdated=this._onUpdated,this.onMetadataChanged=this._onMetadataChanged,this._properties=n,this.catalog=i,this._metadataSignal=De(Zt(o))}get metadataSignal(){return this._metadataSignal}get metadata(){return ce(this._metadataSignal)}set metadata(e){let r=Zt(e);Ki(ce(this._metadataSignal),r)||(be(this._metadataSignal,r),this._onMetadataChanged.emit(r))}get extensions(){return ce(this._metadataSignal)?.extensions}setExtension(e,r){if(r===void 0){this.removeExtension(e);return}let n=ce(this._metadataSignal),i={...n?.extensions??{},[e]:r};this.metadata={...n??{},extensions:i}}removeExtension(e){let r=ce(this._metadataSignal),n=r?.extensions;if(!n||!(e in n))return;let i={...n};delete i[e];let o={...r};delete o.extensions,Object.keys(i).length>0?this.metadata={...o,extensions:i}:Object.keys(o).length>0?this.metadata=o:this.metadata=void 0}get properties(){return this._properties}set properties(e){this._properties=e,this._onUpdated.emit(this)}applyUpdate(e,r){let n=Zt(r),i=!Hi(this._properties,e),o=!Ki(ce(this._metadataSignal),n);i&&(this._properties=e),o&&be(this._metadataSignal,n),i&&this._onUpdated.emit(this),o&&this._onMetadataChanged.emit(n)}dispose(){this._onUpdated.dispose(),this._onMetadataChanged.dispose()}get componentTree(){let e=this.metadata;return{...this._properties,id:this.id,component:this.type,...e!==void 0?{metadata:e}:{}}}};var _d=["createSurface","updateComponents","updateDataModel","deleteSurface","callRendererFunction","agentFunctionResponse","beginRendering","surfaceUpdate","dataModelUpdate"];function Sd(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Mr(t,e){if(!Sd(t))return{version:e};let r=typeof t.version=="string"?t.version:e,n=_d.find(c=>Object.hasOwn(t,c));if(!n)return{version:r};let i=n==="callRendererFunction",o=t[n];if(!Sd(o))return{actionType:n,isCallRendererFunction:i,version:r};let s=typeof o.surfaceId=="string"?o.surfaceId:void 0,a=typeof o.functionCallId=="string"?o.functionCallId:void 0;return{surfaceId:s,functionCallId:a,actionType:n,isCallRendererFunction:i,version:r}}function Id(t){return t.length>0&&_d.includes(t[0])?t.slice(1):t}function kd(t){if(!t)return;if(t.startsWith("/"))return t;let e=t.replace(/\[(\d+)\]/g,"/$1").replace(/\./g,"/").replace(/^\/+/,"");if(!e)return"/";let r=Id(e.split("/").filter(Boolean));return r.length>0?`/${r.join("/")}`:void 0}function Fd(t,e){let r=[];for(let i of t)if(i.code===d.ZodIssueCode.invalid_union&&"unionErrors"in i){let o=i.unionErrors.flatMap(s=>s.issues);r.push(...Fd(o,e))}else r.push(i);if(!e)return r;let n=r.filter(i=>i.path[0]===e&&i.path.length>1);return n.length>0?n:r}function Eb(t,e){let r;if(t instanceof d.ZodError)r=t.issues;else if(Array.isArray(t)&&t.length>0){let s=t[0];if(typeof s?.path=="string")return kd(s.path);Array.isArray(s?.path)&&(r=t)}if(!r||r.length===0)return;let n=Fd(r,e)[0];if(!n)return;let i=n.path.map(s=>String(s).replace(/~/g,"~0").replace(/\//g,"~1"));n.code===d.ZodIssueCode.unrecognized_keys&&"keys"in n&&Array.isArray(n.keys)&&n.keys.length>0&&i.push(String(n.keys[0]).replace(/~/g,"~0").replace(/\//g,"~1"));let o=Id(i);return o.length>0?`/${o.join("/")}`:void 0}function Sb(t){return t==="v0.8"||t==="0.8"?"v0.8":t==="v0.9.1"||t==="0.9.1"?"v0.9.1":t&&oe(t,"1.0")?"1.0":"v0.9"}function _b(t,e){return t instanceof vt?"RECURSION_LIMIT_EXCEEDED":t instanceof ot||t instanceof Rt?"INTEGRITY_ERROR":t instanceof me?"CATALOG_NOT_FOUND":t instanceof Se?"DATA_ERROR":t instanceof K?"EXPRESSION_ERROR":t instanceof R?(t.code==="UNALLOWED_PARENT"||t.code==="UNALLOWED_CHILD")&&e?t.code:"VALIDATION_FAILED":t instanceof Ve&&t.code||"INTERNAL_ERROR"}function As(t,e={}){let r=Sb(e.version),n=r==="1.0",i=t instanceof Ve?t:void 0,o=t instanceof Error?t.message:String(t),s=i?.functionCallId??e.functionCallId;if(t instanceof et||n&&(e.isCallRendererFunction||e.actionType==="callRendererFunction"||s!==void 0)){let h=t instanceof et?t.code:"INVALID_FUNCTION_CALL";if(s!==void 0)return{version:r,error:{code:h,functionCallId:s,message:o}};let p=i?.surfaceId??e.surfaceId??"";return{version:r,error:{code:h,surfaceId:p,message:o}}}let c=_b(t,n),u=i?.surfaceId??e.surfaceId??"",l=i?.path??(t instanceof R?Eb(t.details,e.actionType):void 0),f=kd(l);return f===void 0&&(c==="VALIDATION_FAILED"||c==="UNALLOWED_PARENT"||c==="UNALLOWED_CHILD")&&(f="/"),{version:r,error:{code:c,surfaceId:u,...f!==void 0?{path:f}:{},message:o}}}var go=class t{constructor(){this.children=new Map,this.parents=new Map,this.heights=new Map,this.maxHeight=0}static of(e){let r=new t;for(let[i,o]of e)r.setChildren(i,o);let n=new Set;for(let i of e.keys()){if(r.heights.has(i))continue;let o=[{id:i,childIndex:0,height:0}];for(n.add(i);o.length>0;){let s=o[o.length-1],a=r.children.get(s.id)??[],c=!0;for(;s.childIndex<a.length;){let u=a[s.childIndex];if(s.childIndex++,!e.has(u))continue;let l=r.heights.get(u);if(l===void 0){if(n.has(u))return;s.childIndex--,o.push({id:u,childIndex:0,height:0}),n.add(u),c=!1;break}l>=s.height&&(s.height=l+1)}c&&(r.heights.set(s.id,s.height),s.height>r.maxHeight&&(r.maxHeight=s.height),n.delete(s.id),o.pop())}}return r}childrenOf(e){return this.children.get(e)??[]}parentsOf(e){return this.parents.get(e)??new Set}setChildren(e,r){for(let n of this.children.get(e)??[])this.parents.get(n)?.delete(e);for(let n of r){let i=this.parents.get(n);i||(i=new Set,this.parents.set(n,i)),i.add(e)}this.children.set(e,r)}admits(e,r,n){for(let[s,a]of e)this.setChildren(s,a);if(this.maxHeight>r)return!1;for(let[s,a]of e)if(a.includes(s))return!1;let i=s=>e.has(s)||n(s),o=[];for(let[s,a]of e){let c=0;for(let u of a){let l=this.heights.get(u)??0;i(u)&&l>=c&&(c=l+1)}this.heights.set(s,c),o.push(s)}for(let s=0;s<o.length;s++){let a=o[s],c=this.heights.get(a)??0;if(c>r)return!1;c>this.maxHeight&&(this.maxHeight=c);for(let u of this.parents.get(a)??[])(this.heights.get(u)??0)<=c&&(this.heights.set(u,c+1),o.push(u))}return!0}},Ii=class t{constructor(){this.count=0,this.seenCatalogs=new Set}static of(e){let r=$d.get(e);return r||(r=new t,r.watch(e),$d.set(e,r)),r}get changes(){return this.count}get catalogs(){return this.seenCatalogs}watch(e){let r=new Map,n=()=>{this.count++},i=o=>{this.seenCatalogs.add(o.catalog),r.get(o.id)?.unsubscribe(),r.set(o.id,o.onUpdated.subscribe(n))};for(let o of e.values)i(o);e.onCreated.subscribe(o=>{this.count++,i(o)}),e.onDeleted.subscribe(o=>{this.count++,r.get(o)?.unsubscribe(),r.delete(o)})}},$d=new WeakMap;var Rd=new WeakMap;function Td(t,e,r,n,i){let o=t.componentsModel,s=i.get(o);if(i.delete(o),!r||!Nd(r)){oc(t,e,n,r),sc(t,e,n,r);return}let a=Ib(t,e,n),c=r.rootId??t.rootId;if(a&&s&&s.changes===Ii.of(o).changes&&(r.allowMissingRoot||a.children.has(c)||o.has(c))){let{bound:l}=s,f=new Map;for(let m of a.children.keys())f.set(m,l.childrenOf(m));let h=l.admits(a.children,r.maxDepth??Si,m=>o.has(m));if(kb(t,a,f,l,r)||oc(t,e,n,r),h)return l;let p=sc(t,e,n,r,!0);return p?go.of(p):void 0}oc(t,e,n,r);let u=sc(t,e,n,r,!0);return u?go.of(u):void 0}function Od(t,e,r){r.set(t,{bound:e,changes:Ii.of(t).changes})}function Nd(t){return t!==void 0&&t.allowDanglingReferences===!0&&(t.allowOrphanComponents===!0||t.allowMissingRoot===!0)}function Ib(t,e,r){let n={children:new Map,types:new Map,catalogs:new Map};for(let i of e){let{id:o,component:s,...a}=i;if(typeof o!="string"||!o)continue;let c=r(i,t);delete a.catalogId,delete a.metadata;let u=(typeof s=="string"?s:t.componentsModel.get(o)?.type)||"";if(!u||c.components.size===0)return;let l=Array.from(mo({...a,id:o,component:u},c.componentRefMap),([f])=>f);n.children.set(o,l),n.types.set(o,u),n.catalogs.set(o,c)}return n}function kb(t,e,r,n,i){if(!jd(t,e.catalogs.values(),i))return!0;let o=Pd(t,i),s=t.componentsModel,a={get:p=>e.types.get(p)??s.get(p)?.type},c=new Set,u=new Map;for(let[p,m]of e.children){for(let y of m)e.children.has(y)||c.add(y);for(let y of r.get(p)??[])e.children.has(y)||c.add(y);for(let y of n.parentsOf(p)){if(e.children.has(y))continue;let A=u.get(y);A?A.push(p):u.set(y,[p])}}let l=p=>{let m=a.get(p);if(!m)return;let A=(e.catalogs.get(p)??s.get(p)?.catalog)?.components.get(m);return A?{componentType:m,componentApi:A}:void 0},f=p=>{let m=l(p);if(!m)return;let{componentType:y,componentApi:A}=m;if(A.allowedParents&&A.allowedParents.length>0){let D=Array.from(n.parentsOf(p),_=>({parentId:_,parentType:a.get(_)||"Unknown"}));Md(p,y,A.allowedParents,D,o)}},h=(p,m)=>{let y=l(p);if(!y)return;let{componentType:A,componentApi:D}=y;D.allowedChildren&&D.allowedChildren.length>0&&Ld(p,A,D.allowedChildren,m,a)};try{for(let p of e.children.keys())f(p),h(p,n.childrenOf(p));for(let p of c)f(p);for(let[p,m]of u)h(p,m)}catch{return!1}return!0}function jd(t,e,r){let n=o=>{let s=Rd.get(o);return s===void 0&&(s=Array.from(o.components.values()).some(a=>a.allowedParents!==void 0&&a.allowedParents.length>0||a.allowedChildren!==void 0&&a.allowedChildren.length>0),Rd.set(o,s)),s};for(let o of e)if(n(o))return!0;if(Nd(r)){for(let o of Ii.of(t.componentsModel).catalogs)if(n(o))return!0;return!1}let i=new Set(t.availableCatalogs.values());t.defaultCatalog&&i.add(t.defaultCatalog);for(let o of i)if(n(o))return!0;for(let o of t.componentsModel.values)if(!i.has(o.catalog)&&n(o.catalog))return!0;return!1}function Pd(t,e){return e?.rootId??t.rootId??"root"}function Md(t,e,r,n,i,o,s,a){if(t===i&&!r.includes("Surface")){let c=s!==void 0?`/components/${s}`:"/components",u=`Component '${t}' (${e}) cannot be placed under parent 'Surface' (Surface). Allowed parents: ${JSON.stringify(r)}.`,l=[{path:c,code:"UNALLOWED_PARENT",message:u,...o!==void 0?{surfaceId:o}:{}}];throw new R(u,l,"UNALLOWED_PARENT",{path:c,surfaceId:o})}for(let c of n??[])if(!r.includes(c.parentType)){let u=s??a?.get(c.parentId),l=u!==void 0?`/components/${u}`:"/components",f=`Component '${t}' (${e}) cannot be placed under parent '${c.parentId}' (${c.parentType||"unknown"}). Allowed parents: ${JSON.stringify(r)}.`,h=[{path:l,code:"UNALLOWED_PARENT",message:f,...o!==void 0?{surfaceId:o}:{}}];throw new R(f,h,"UNALLOWED_PARENT",{path:l,surfaceId:o})}}function Ld(t,e,r,n,i,o,s,a,c){for(let u of n){let l=i.get(u);if(l&&!r.includes(l)){let f;if(s!==void 0){let y=(a?.get(u)??"children").replace(/\[(\d+)\]/g,"/$1").replace(/\./g,"/").replace(/^\/+/,"");f=`/components/${s}${y?`/${y}`:""}`}else{let m=c?.get(u);f=m!==void 0?`/components/${m}`:"/components"}let h=`Container '${t}' (${e}) cannot contain child '${u}' (${l}). Allowed children: ${JSON.stringify(r)}.`,p=[{path:f,code:"UNALLOWED_CHILD",message:h,...o!==void 0?{surfaceId:o}:{}}];throw new R(h,p,"UNALLOWED_CHILD",{path:f,surfaceId:o})}}}function Fb(t,e,r){let n=new Map,i=new Map,o=new Map,s=new Map,a=new Map;for(let[u,l]of t.componentsModel.entries){n.set(u,l.type),i.set(u,l.catalog);let f=t.componentsModel.getChildReferences(u);f.length>0&&(o.set(u,f.map(([h])=>h)),s.set(u,new Map(f)))}for(let u=0;u<e.length;u++){let l=e[u],{id:f,component:h,...p}=l;if(typeof f!="string")continue;a.set(f,u);let m=r(l,t);i.set(f,m);let y=t.componentsModel.get(f),A=(typeof h=="string"?h:y?.type)??"";A&&n.set(f,A);let D={id:f,component:A,...p},_=Array.from(mo(D,m));_.length>0?(o.set(f,_.map(([q])=>q)),s.set(f,new Map(_))):(o.delete(f),s.delete(f))}let c=new Map;for(let[u,l]of o.entries()){let f=n.get(u)||"Unknown";for(let h of l){let p=c.get(h)??[];p.push({parentId:u,parentType:f}),c.set(h,p)}}return{typeMap:n,compCatalogMap:i,childMap:o,childPathMap:s,parentMap:c,compIndexMap:a}}function oc(t,e,r,n){let i=e.filter(h=>typeof h.id=="string").map(h=>r(h,t));if(!jd(t,i,n))return;let{typeMap:o,compCatalogMap:s,childMap:a,childPathMap:c,parentMap:u,compIndexMap:l}=Fb(t,e,r),f=Pd(t,n);for(let[h,p]of o.entries()){let y=s.get(h)?.components.get(p);y&&(y.allowedParents&&y.allowedParents.length>0&&Md(h,p,y.allowedParents,u.get(h),f,t.id,l.get(h),l),y.allowedChildren&&y.allowedChildren.length>0&&Ld(h,p,y.allowedChildren,a.get(h)||[],o,t.id,l.get(h),c.get(h),l))}}function sc(t,e,r,n,i=!1){if(!n)return;let o=new _i(t.defaultCatalog);for(let[a,c]of t.componentsModel.entries)o.addComponent(new yr(a,c.type,c.properties,c.catalog));for(let a of e){let{id:c,component:u,...l}=a;if(typeof c!="string"||!c)continue;let f=r(a,t);delete l.catalogId,delete l.metadata;let h=o.get(c),p=(typeof u=="string"?u:h?.type)||"";p&&(h?p!==h.type||h.catalog.id!==f.id?(o.removeComponent(c),o.addComponent(new yr(c,p,l,f))):h.properties=l:o.addComponent(new yr(c,p,l,f)))}if(o.validateTopology({...n,rootId:n.rootId??t.rootId}),!i)return;let s=new Map;for(let a of o.keys)s.set(a,o.getChildIds(a));return s}function br(t){let e=t.path.join(".")||"root";switch(t.code){case d.ZodIssueCode.invalid_union:{let r=t.unionErrors?.flatMap(n=>n.issues);return r&&r.length>0?r.map(br).join("; "):`${e}: Invalid union`}case d.ZodIssueCode.unrecognized_keys:{let r=t.keys.map(n=>`'${n}'`).join(", ");return`${e}: Unrecognized key(s) in object: ${r}`}case d.ZodIssueCode.invalid_enum_value:{let r=t,n=r.options.map(i=>String(i)).join(" | ");return`${e}: Invalid enum value. Expected ${n}, received '${String(r.received)}'`}case d.ZodIssueCode.invalid_type:{let r=t;return`${e}: Expected ${r.expected}, received ${r.received}`}case d.ZodIssueCode.custom:return`${e}: ${t.message}`;default:return t.message?`${e}: ${t.message}`:`${e}: Validation error (${t.code})`}}var $b={"0.8":new Set(["0.8"]),"0.9":new Set(["0.9","0.9.1"]),"0.9.1":new Set(["0.9.1","0.9"]),"1.0":new Set(["1.0"])};function Jt(t,e,r=$b){if(!t||!e)return!1;let n=Ae(t),i=Ae(e);if(n&&i){if(n===i)return!0;let a=r[i];if(a&&a.has(n))return!0;let c=Ir(t),u=Ir(e);return!!(c&&u&&c.major>=1&&c.major===u.major)}if(typeof t!="string"||typeof e!="string")return!1;let o=ur(t),s=ur(e);return o.length>0&&o===s}var ac;function Bd(t){ac=t}function Rb(t,e){for(let r of e){let n=t[r];if(n&&typeof n=="object"){let i=n;if("surfaceId"in i&&i.surfaceId!==void 0&&typeof i.surfaceId!="string"){let o="surfaceId must be a string";throw new R(o,[{path:`/${r}/surfaceId`,code:"type_mismatch",message:o}],"VALIDATION_ERROR",{path:"/surfaceId"})}}}}var Lr=class{get compatibleCatalogVersions(){let e=Ae(this.version);return e?new Set([e]):new Set}get validActions(){return new Set(this.getNativeActionKeys())}isCatalogCompatible(e){return e?Jt(e,this.version):!1}extractOperations(e){if(!e||typeof e!="object")return[];if(Array.isArray(e))return e.flatMap(a=>this.extractOperations(a));let r=e;if(Array.isArray(r.messages))return this.extractOperations(r.messages);let n=this.getNativeActionKeys();Rb(r,n);let i=n.filter(a=>a in r).sort();if(i.length>1)throw new R(`Message contains multiple conflicting update actions: ${i.join(", ")}.`);if(i.length===0){let a=ac?ac():new Set(n),c=Object.keys(r).find(l=>a.has(l)&&!n.includes(l)),u=n.slice().sort().join(", ");if(c){let l=`Invalid ${this.version} message: action '${c}' is not supported in protocol version ${this.version}. Allowed actions: ${u}.`;throw new R(l,[{path:"/version",code:"invalid_value",message:l}],"VALIDATION_ERROR",{path:"/version"})}throw new R(`Invalid ${this.version} message: message must contain exactly one update action: ${u}.`)}let o=this.preparePayloadForValidation(r),s=this.schema.safeParse(o);if(!s.success){let a=s.error.errors.map(br).join("; "),c=Mr(r,this.version),u=new R(`Invalid ${this.version} message: ${a}`,s.error,"VALIDATION_ERROR"),l=As(u,c);throw u.path=l.error.path,u.surfaceId=l.error.surfaceId||void 0,u.functionCallId=l.error.functionCallId,u}return this.extractOperationsFromObject(r)}preparePayloadForValidation(e){return"version"in e?e:{version:this.version,...e}}};var Yt=(t,e)=>{let r=Object.keys(t).filter(n=>t[n]!==void 0);r.length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Must define exactly one property, found ${r.length} (${r.join(", ")}).`})},Et=d.object({path:d.string().optional(),literalString:d.string().optional(),literal:d.string().optional()}).strict().superRefine(Yt),Vd=d.lazy(()=>d.object({key:d.string(),valueString:d.string().optional(),valueNumber:d.number().optional(),valueBoolean:d.boolean().optional(),valueMap:d.array(Vd).optional()}).strict().superRefine((t,e)=>{let r=0;t.valueString!==void 0&&r++,t.valueNumber!==void 0&&r++,t.valueBoolean!==void 0&&r++,t.valueMap!==void 0&&r++,r!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Value map item must have exactly one value property (valueString, valueNumber, valueBoolean, valueMap), found ${r}.`})}));function Tb(t={}){let e=t.maxDepth??5;return Vd.superRefine((r,n)=>{let i=(o,s)=>{if(s>e){n.addIssue({code:d.ZodIssueCode.custom,message:`valueMap recursion exceeded maximum depth of ${e}.`});return}if(o.valueMap&&Array.isArray(o.valueMap))for(let a of o.valueMap)i(a,s+1)};i(r,1)})}var Ud=Tb(),S_=d.object({path:d.string().optional(),literalNumber:d.number().optional(),literal:d.number().optional()}).strict().superRefine(Yt),__=d.object({path:d.string().optional(),literalBoolean:d.boolean().optional(),literal:d.boolean().optional()}).strict().superRefine(Yt),Ob=d.object({name:d.string().describe("A unique name identifying the action (e.g., 'submitForm')."),context:d.array(d.object({key:d.string(),value:d.object({path:d.string().describe("A data binding reference to a location in the data model (e.g., '/user/name').").optional(),literalString:d.string().describe("A fixed, hardcoded string value.").optional(),literalNumber:d.number().optional(),literalBoolean:d.boolean().optional()}).describe("The dynamic value. Define EXACTLY ONE of the nested properties.").strict().superRefine(Yt)})).describe("A key-value map of data bindings to be resolved when the action is triggered.").optional()}),I_=d.object({text:Et,usageHint:d.enum(["h1","h2","h3","h4","h5","caption","body"]).optional()}),k_=d.object({url:Et,usageHint:d.enum(["icon","avatar","smallFeature","mediumFeature","largeFeature","header"]).optional(),fit:d.enum(["contain","cover","fill","none","scale-down"]).optional(),altText:Et.optional()}),F_=d.object({name:Et}),$_=d.object({url:Et}),R_=d.object({url:Et,description:Et.optional().describe("A label, title, or placeholder text.")}),T_=d.object({tabItems:d.array(d.object({title:d.object({path:d.string().describe("A data binding reference to a location in the data model (e.g., '/user/name').").optional(),literalString:d.string().describe("A fixed, hardcoded string value.").optional()}),child:d.string().describe("A reference to a component instance by its unique ID.")}).strict().superRefine((t,e)=>{t.title||e.addIssue({code:d.ZodIssueCode.custom,message:"Tab item is missing 'title'."}),t.child||e.addIssue({code:d.ZodIssueCode.custom,message:"Tab item is missing 'child'."}),t.title&&Yt(t.title,e)})).describe("A list of tabs, each with a title and a child component ID.")}),O_=d.object({axis:d.enum(["horizontal","vertical"]).optional().describe("The orientation."),color:d.string().optional().describe("The color of the divider (e.g., hex code or semantic name)."),thickness:d.number().optional().describe("The thickness of the divider.")}),N_=d.object({entryPointChild:d.string().describe("The ID of the component (e.g., a button) that triggers the modal."),contentChild:d.string().describe("The ID of the component to display as the modal's content.")}),j_=d.object({child:d.string().describe("The ID of the component to display as the button's content."),action:Ob.describe("Represents a user-initiated action."),primary:d.boolean().optional().describe("Indicates if this button should be styled as the primary action.")}),P_=d.object({label:Et,value:d.object({path:d.string().describe("A data binding reference to a location in the data model (e.g., '/user/name').").optional(),literalBoolean:d.boolean().optional()}).strict().superRefine(Yt)}),M_=d.object({text:Et.optional(),label:Et.describe("A label, title, or placeholder text."),textFieldType:d.enum(["shortText","number","date","longText","obscured"]).optional(),validationRegexp:d.string().optional().describe("A regex string to validate the input.")}),L_=d.object({value:Et,enableDate:d.boolean().optional(),enableTime:d.boolean().optional(),outputFormat:d.string().optional().describe("The string format for the output (e.g., 'YYYY-MM-DD').")}),B_=d.object({selections:d.object({path:d.string().describe("A data binding reference to a location in the data model (e.g., '/user/name').").optional(),literalArray:d.array(d.string()).optional()}).strict().superRefine(Yt),options:d.array(d.object({label:d.object({path:d.string().describe("A data binding reference to a location in the data model (e.g., '/user/name').").optional(),literalString:d.string().describe("A fixed, hardcoded string value.").optional()}).strict().superRefine(Yt),value:d.string()})).optional(),maxAllowedSelections:d.number().optional(),type:d.enum(["checkbox","chips"]).optional(),filterable:d.boolean().optional()}),V_=d.object({value:d.object({path:d.string().describe("A data binding reference to a location in the data model (e.g., '/user/name').").optional(),literalNumber:d.number().optional()}).strict().superRefine(Yt),minValue:d.number().optional(),maxValue:d.number().optional(),label:Et.optional()}),Nb=d.object({componentId:d.string(),dataBinding:d.string()}),cc=d.object({explicitList:d.array(d.string()).optional(),template:Nb.describe("A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.").optional()}).strict().superRefine(Yt),U_=d.object({children:cc,distribution:d.enum(["start","center","end","spaceBetween","spaceAround","spaceEvenly"]).optional(),alignment:d.enum(["start","center","end","stretch"]).optional()}),z_=d.object({children:cc,distribution:d.enum(["start","center","end","spaceBetween","spaceAround","spaceEvenly"]).optional(),alignment:d.enum(["start","center","end","stretch"]).optional()}),q_=d.object({children:cc,direction:d.enum(["vertical","horizontal"]).optional(),alignment:d.enum(["start","center","end","stretch"]).optional()}),Z_=d.object({child:d.string().describe("The ID of the component to be rendered inside the card.")});var jb=Ud.describe("A single data entry. Exactly one 'value*' property should be provided alongside the key."),Pb=d.record(d.any()).refine(t=>Object.keys(t).length===1,"A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading').");var Mb=d.object({id:d.string().describe("The unique identifier for this component."),weight:d.number().optional().describe("The relative weight of this component within a Row or Column. This corresponds to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column."),component:Pb.describe("A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading'). The value is an object containing the properties for that specific component.")}).strict().describe("Represents a *single* component in a UI widget tree. This component could be one of many supported types."),Lb=d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be rendered."),catalogId:d.string().optional().describe("The identifier of the component catalog to use for this surface. If omitted, the client MUST default to the standard catalog for this A2UI version (https://a2ui.org/specification/v0_8/standard_catalog_definition.json)."),root:d.string().describe("The ID of the root component to render."),styles:d.object({font:d.string().optional().describe("The primary font for the UI."),primaryColor:d.string().regex(/^#[0-9a-fA-F]{6}$/).optional().describe("The primary UI color as a hexadecimal code (e.g., '#00BFFF').")}).strict().optional().describe("Styling information for the UI.")}).strict().describe("Signals the client to begin rendering a surface with a root component and specific styles."),Bb=d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be updated. If you are adding a new surface this *must* be a new, unique identified that has never been used for any existing surfaces shown."),components:d.array(Mb).min(1).describe("A list containing all UI components for the surface.")}).strict().superRefine((t,e)=>{let r=new Set;for(let i of t.components)i.id&&(r.has(i.id)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Duplicate component ID found: ${i.id}`,path:["components"]}),r.add(i.id));let n=(i,o)=>{for(let s of i)s&&!r.has(s)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${o}' references non-existent component ID '${s}'.`,path:["components"]})};for(let i of t.components){if(!i.id||!i.component)continue;let o=Object.keys(i.component);if(o.length!==1)continue;let s=o[0],a=i.component[s];switch(s){case"Row":case"Column":case"List":if(a.children&&!Array.isArray(a.children)){let c=!!a.children.explicitList,u=!!a.children.template;(c&&u||!c&&!u)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${i.id}' must have either 'explicitList' or 'template' in children, but not both or neither.`}),c&&n(a.children.explicitList,i.id),u&&n([a.children.template?.componentId],i.id)}break;case"Card":a.child&&n([a.child],i.id);break;case"Tabs":a.tabItems&&Array.isArray(a.tabItems)&&a.tabItems.forEach(c=>{c.child&&n([c.child],i.id)});break;case"Modal":n([a.entryPointChild,a.contentChild],i.id);break;case"Button":a.child&&n([a.child],i.id);break}}}).describe("Updates a surface with a new set of components."),Vb=d.object({surfaceId:d.string().describe("The unique identifier for the UI surface this data model update applies to."),path:d.string().optional().describe("An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', the entire data model will be replaced."),contents:d.array(jb).describe("An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.")}).strict().describe("Updates the data model for a surface."),Ub=d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be deleted.")}).strict().describe("Signals the client to delete the surface identified by 'surfaceId'."),zd=d.object({beginRendering:Lb.optional(),surfaceUpdate:Bb.optional(),dataModelUpdate:Vb.optional(),deleteSurface:Ub.optional()}).strict().superRefine((t,e)=>{Object.keys(t).filter(n=>["beginRendering","surfaceUpdate","dataModelUpdate","deleteSurface"].includes(n)).length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:"A2UI Protocol message must have exactly one of: surfaceUpdate, dataModelUpdate, beginRendering, deleteSurface."})}).describe("Describes a JSON payload for an A2UI (Agent to UI) message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.");function qd(t){if(!t||typeof t!="object")return{id:"",component:""};let e=t,r=typeof e.component=="string"?e.component:"",n={};for(let[i,o]of Object.entries(e))i!=="component"&&i!=="id"&&(n[i]=o);if(e.component&&typeof e.component=="object"){let i=e.component,o=Object.keys(i);if(o.length>0){r=o[0];let s=i[o[0]];s&&typeof s=="object"&&s!==null&&!Array.isArray(s)&&Object.assign(n,s)}}return{...n,id:String(e.id??""),component:r}}var Ds=class extends Lr{constructor(){super(...arguments),this.version="v0.8",this.schema=zd}getNativeActionKeys(){return["beginRendering","surfaceUpdate","dataModelUpdate","deleteSurface"]}preparePayloadForValidation(e){let r={...e};return delete r.version,r}extractOperationsFromObject(e){let r=[];if("beginRendering"in e){let n=e.beginRendering;r.push({type:"createSurface",surfaceId:String(n?.surfaceId??""),catalogId:typeof n?.catalogId=="string"?n.catalogId:void 0,theme:n?.theme??n?.styles,sendDataModel:!!n?.sendDataModel,components:Array.isArray(n?.components)?n.components.map(qd):void 0,dataModel:n?.dataModel&&typeof n.dataModel=="object"&&!Array.isArray(n.dataModel)?n.dataModel:void 0,version:typeof e.version=="string"?e.version:this.version,rootId:typeof n?.root=="string"&&n.root?n.root:void 0})}if("surfaceUpdate"in e){let n=e.surfaceUpdate;r.push({type:"updateComponents",surfaceId:String(n?.surfaceId??""),components:Array.isArray(n?.components)?n.components.map(qd):[]})}if("dataModelUpdate"in e){let n=e.dataModelUpdate,i=String(n?.surfaceId??""),o=typeof n?.path=="string"?n.path.trim():"",s=o&&o!=="/"?(o.startsWith("/")?o:`/${o}`).replace(/\/+$/,""):"",a=c=>{if("valueNumber"in c)return c.valueNumber;if("valueString"in c)return c.valueString;if("valueBoolean"in c)return c.valueBoolean;if("valueObject"in c)return c.valueObject;if("valueArray"in c)return c.valueArray;if(Array.isArray(c.valueMap)){let u={};for(let l of c.valueMap)l&&typeof l=="object"&&typeof l.key=="string"&&(u[l.key]=a(l));return u}return c.value};if(Array.isArray(n?.contents)){for(let c of n.contents)if(c&&typeof c=="object"&&typeof c.key=="string"){let u=a(c),l=c.key.replace(/^\/+/,""),f=l==="."||l===""?s||"/":`${s}/${l}`;r.push({type:"updateDataModel",surfaceId:i,path:f,value:u})}}else r.push({type:"updateDataModel",surfaceId:i,path:typeof n?.path=="string"?n.path:void 0,value:n?.value})}if("deleteSurface"in e){let n=e.deleteSurface;r.push({type:"deleteSurface",surfaceId:String(n?.surfaceId??"")})}return r}};var zb=d.object({version:d.enum(["v0.9","v0.9.1"]),createSurface:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be rendered."),catalogId:d.string().describe("A string that uniquely identifies this catalog. It is recommended to prefix this with an internet domain that you own, to avoid conflicts e.g. mycompany.com:somecatalog'."),theme:d.any().optional(),sendDataModel:d.boolean().describe("If true, the client will send the full data model of this surface in the metadata of every A2A message sent to the server that created the surface. Defaults to false.").optional()}).strict().describe("Signals the client to create a new surface and begin rendering it. It is an error to send 'createSurface' for a surfaceId that already exists without first deleting it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.")}).strict(),qb=d.object({version:d.enum(["v0.9","v0.9.1"]),updateComponents:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be updated."),components:d.array(d.record(d.string(),d.any())).min(1).describe("A list containing all UI components for the surface.")}).strict().describe("Updates a surface with a new set of components. This message can be sent multiple times to update the component tree of an existing surface. One of the components in one of the components lists MUST have an 'id' of 'root' to serve as the root of the component tree. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.")}).strict(),Zb=d.object({version:d.enum(["v0.9","v0.9.1"]),updateDataModel:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface this data model update applies to."),path:d.string().describe("An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', refers to the entire data model.").optional(),value:d.any().describe("The data to be updated in the data model. If present, the value at 'path' is replaced (or created). If omitted, the key at 'path' is removed.").optional()}).strict().describe("Updates the data model for an existing surface. This message can be sent multiple times to update the data model. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.")}).strict(),Wb=d.object({version:d.enum(["v0.9","v0.9.1"]),deleteSurface:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be deleted.")}).strict().describe("Signals the client to delete the surface identified by 'surfaceId'. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.")}).strict(),uc=d.union([zb,qb,Zb,Wb]),Gb=d.array(uc).describe("A list of messages."),e1=d.object({messages:Gb}).strict().describe("An object wrapping a list of messages.");var yo=class extends Lr{constructor(){super(...arguments),this.version="v0.9",this.schema=uc}get compatibleCatalogVersions(){return new Set(["0.9","0.9.1"])}getNativeActionKeys(){return["createSurface","updateComponents","updateDataModel","deleteSurface"]}extractOperationsFromObject(e){let r=[];if("createSurface"in e){let n=e.createSurface;r.push({type:"createSurface",surfaceId:String(n?.surfaceId||""),catalogId:typeof n?.catalogId=="string"?n.catalogId:void 0,theme:n?.theme,sendDataModel:!!n?.sendDataModel,components:Array.isArray(n?.components)?n.components:void 0,dataModel:n?.dataModel&&typeof n.dataModel=="object"&&!Array.isArray(n.dataModel)?n.dataModel:void 0,version:typeof e.version=="string"?e.version:this.version})}if("updateComponents"in e){let n=e.updateComponents;r.push({type:"updateComponents",surfaceId:String(n?.surfaceId||""),components:Array.isArray(n?.components)?n.components:[]})}if("updateDataModel"in e){let n=e.updateDataModel;r.push({type:"updateDataModel",surfaceId:String(n?.surfaceId||""),path:typeof n?.path=="string"?n.path:void 0,value:n?.value})}if("deleteSurface"in e){let n=e.deleteSurface;r.push({type:"deleteSurface",surfaceId:String(n?.surfaceId||"")})}return r}};var lc=["createSurface","updateComponents","updateDataModel","deleteSurface","callRendererFunction","agentFunctionResponse"];function Zd(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&lc.includes(t.type)}var c1=d.object({componentId:d.lazy(()=>wi),path:d.string().describe("The path to the list of component property objects in the data model.")}).strict().describe("REF:#/$defs/TemplateChildList|A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.");var Hb=d.lazy(()=>Dd.extend({component:d.string()}).passthrough().refine(t=>t.component!=="Surface",{message:'Component type cannot be "Surface". "Surface" is a top-level protocol container defined in createSurface, not a child component.'})),dc=d.array(Hb).min(1),u1=d.record(d.string(),d.any());var Kb=d.object({version:d.literal("1.0"),createSurface:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be rendered. It must be globally unique for the renderer's lifetime."),catalogId:d.string().describe("A string that uniquely identifies the default catalog for this surface. It is recommended to prefix this with an internet domain that you own, to avoid conflicts e.g. 'mycompany.com:somecatalog'. Components and function calls that do not explicitly specify a catalogId will use this surface-level default catalogId.").optional(),sendDataModel:d.boolean().describe("If true, the renderer will send the full data model of this surface in the metadata of every A2A message sent to the agent that created the surface. Defaults to false.").optional(),components:dc.optional(),dataModel:d.record(d.string(),d.any()).describe("The initial root data model object for the surface.").optional(),metadata:d.object({extensions:tc.optional()}).strict().describe("Optional surface-level metadata.").optional()}).strict().describe("Signals the renderer to create a new surface and begin rendering it. Creating a surface implicitly instantiates the canonical 'Surface' container component ('common_types.json#/$defs/Surface') with 'child': 'root'. It is an error to try to create a surface with an existing ID without first deleting it; surfaceId MUST be globally unique for the renderer's lifetime. The component tree and initial data model may be provided inline via 'components' and 'dataModel', or sent later in 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId.")}).strict(),Jb=d.object({version:d.literal("1.0"),updateComponents:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be updated. It must be globally unique for the renderer's lifetime."),components:dc}).strict().describe("Updates a surface with a new set of components. This message can be sent multiple times to update the component tree of an existing surface. One of the components in one of the components lists MUST have an 'id' of 'root' to serve as the root of the component tree. The createSurface message MUST have been previously sent for this surfaceId.")}).strict(),Yb=d.object({version:d.literal("1.0"),updateDataModel:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface this data model update applies to. It must be globally unique for the renderer's lifetime."),path:d.string().describe("An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', refers to the entire data model.").optional(),value:d.any().describe("The data to be updated in the data model. To delete the key/value at 'path', set 'value' explicitly to null.")}).strict().describe("Updates the data model for an existing surface. This message can be sent multiple times to update the data model. The createSurface message MUST have been previously sent for this surfaceId.")}).strict(),Xb=d.object({version:d.literal("1.0"),deleteSurface:d.object({surfaceId:d.string().describe("The unique identifier for the UI surface to be deleted. It must be globally unique for the renderer's lifetime.")}).strict().describe("Signals the renderer to delete the surface identified by 'surfaceId'. The createSurface message MUST have been previously sent for this surfaceId.")}).strict(),Qb=d.object({version:d.literal("1.0"),callRendererFunction:d.object({surfaceId:d.string().describe("Optional ID of the surface whose data model provides the evaluation context for this call. If omitted, the function executes in a surface-independent root context with an empty data model.").optional(),functionCallId:ec,callFunction:d.intersection(ct,d.object({catalogId:d.string()}).passthrough())}).strict().describe("Signals the renderer to execute a function locally on behalf of the agent.")}).strict(),ev=d.object({version:d.literal("1.0"),agentFunctionResponse:wd}).strict(),Wd=d.union([Kb,Jb,Yb,Xb,Qb,ev]);function tv(t,e,r){if(Object.hasOwn(t,"args")&&t.args!==void 0&&(typeof t.args!="object"||t.args===null||Array.isArray(t.args)))throw new R(`Invalid ${e} message: callRendererFunction.callFunction.args: Expected object, received ${Array.isArray(t.args)?"array":typeof t.args}`,void 0,"VALIDATION_ERROR",{functionCallId:r||void 0})}function rv(t,e){let r=t?.callFunction||{},n=String(t?.functionCallId||"");return tv(r,e,n),{type:"callRendererFunction",surfaceId:typeof t?.surfaceId=="string"?t.surfaceId:void 0,functionCallId:n,call:String(r?.["@call"]||r?.call||""),version:e,catalogId:typeof r?.catalogId=="string"?r?.catalogId:void 0,args:r?.args&&typeof r.args=="object"&&!Array.isArray(r.args)?r.args:{}}}var Cs=class extends Lr{constructor(){super(...arguments),this.version="1.0",this.schema=Wd}getNativeActionKeys(){return[...lc]}extractOperationsFromObject(e){let r=[];if("createSurface"in e){let n=e.createSurface;r.push({type:"createSurface",surfaceId:String(n?.surfaceId||""),catalogId:typeof n?.catalogId=="string"?n.catalogId:void 0,theme:n?.theme,sendDataModel:!!n?.sendDataModel,components:Array.isArray(n?.components)?n.components:void 0,dataModel:n?.dataModel&&typeof n.dataModel=="object"&&!Array.isArray(n.dataModel)?n.dataModel:void 0,version:typeof e.version=="string"?e.version:this.version,metadata:n?.metadata&&typeof n.metadata=="object"&&!Array.isArray(n.metadata)?n.metadata:void 0})}if("updateComponents"in e){let n=e.updateComponents;r.push({type:"updateComponents",surfaceId:String(n?.surfaceId||""),components:Array.isArray(n?.components)?n.components:[]})}if("updateDataModel"in e){let n=e.updateDataModel;r.push({type:"updateDataModel",surfaceId:String(n?.surfaceId||""),path:typeof n?.path=="string"?n.path:void 0,value:n?.value})}if("deleteSurface"in e){let n=e.deleteSurface;r.push({type:"deleteSurface",surfaceId:String(n?.surfaceId||"")})}if("callRendererFunction"in e&&r.push(rv(e.callRendererFunction,this.version)),"agentFunctionResponse"in e){let n=e.agentFunctionResponse;r.push({type:"agentFunctionResponse",functionCallId:String(n?.functionCallId||""),version:this.version,value:n?.value,error:n?.error&&typeof n.error=="object"?n.error:void 0})}return r}};var fc=class{constructor(){this.adapters=new Map([["0.8",new Ds],["0.9",new yo],["0.9.1",new yo],["1.0",new Cs]])}getAllKnownActions(){let e=new Set;for(let r of this.adapters.values())if(r.validActions)for(let n of r.validActions)e.add(n);return e}registerAdapter(e){let r=Ae(e.version)??ur(e.version);this.adapters.set(r,e)}getAdapter(e){let r=Ae(e)??ur(e),n=this.adapters.get(r);if(!n){let i=Array.from(new Set(Array.from(this.adapters.entries()).map(([o,s])=>o==="0.9.1"?"v0.9.1":s.version))).sort().join(", ");throw new R(`[VersionAdapterFactory] Unsupported protocol version '${e}'. Supported versions: ${i}.`)}return n}resolveFromPayload(e){let r=Array.isArray(e)?e[0]:e;if(typeof r=="object"&&r!==null){if("messages"in r&&Array.isArray(r.messages))return this.resolveFromPayload(r.messages);if("version"in r){let n=r.version;if(typeof n!="string")throw new R(`[VersionAdapterFactory] Message payload is missing a valid 'version' string: 'version' property must be a string, got ${typeof n}.`);return this.getAdapter(n)}if("beginRendering"in r||"surfaceUpdate"in r||"dataModelUpdate"in r||"deleteSurface"in r)return this.getAdapter("v0.8")}throw new R("[VersionAdapterFactory] Message payload is missing a valid 'version' string.")}static registerAdapter(e){Fn.registerAdapter(e)}static getAdapter(e){return Fn.getAdapter(e)}static resolveFromPayload(e){return Fn.resolveFromPayload(e)}static getAllKnownActions(){return Fn.getAllKnownActions()}},Fn=new fc;Bd(()=>Fn.getAllKnownActions());var nv=["id","component","catalogId","metadata"];function iv(t){return t===Ci.name?Ci:void 0}function ov(t,e){if(e.catalogId!==void 0)throw new R(`System function '${t}' belongs to no catalog and must not name a catalogId.`)}function pc(t){return`Function call '${t}' has a non-string 'catalogId'.`}function hc(t,e,{catalogIsDefault:r}){return t===void 0?r:t===e}var Br=class{constructor(e,r){this.catalog=e,this.config=r,this.enforceIdentifiers=oe(e.protocolVersion,"1.0")}get allowUnknown(){return this.config?this.config.allowUnknownElements??!1:!0}validateComponent(e,r,n){let i=e.id;if(typeof i!="string"||!i){let p=`Component '${e.component}' is missing an 'id'; entries require a valid string 'id'.`;throw new R(p,[{path:"/id",code:"missing_field",message:p}],"VALIDATION_ERROR",{path:"/id"})}this.assertIdentifier(i,`Component id '${i}' must be a valid UAX #31 identifier`,!1,"/id");let o=e.component,s=typeof o=="string"?o:r;if(!s){let p=`Cannot create component ${i} without a type.`;throw new R(p,[{path:"/component",code:"missing_field",message:p}],"VALIDATION_ERROR",{path:"/component"})}let a=e.catalogId,c=typeof a=="string"?a:void 0,u=sv(e),l=this.catalog.components.get(s);if(!l){if(!this.allowUnknown){let p=`Unknown component type '${s}' not found in catalog '${this.catalog.id}'.`;throw new R(p,[{path:"/component",code:"invalid_value",message:p}],"VALIDATION_ERROR",{path:"/component"})}n?.skipNestedFunctions||this.validateNestedFunctions(u,c);return}let f=Di(l.schema);this.validateCommonEnvelopeFields(u,f,s,i,c);let h=l.schema.safeParse(u);if(!h.success){let p=h.error.errors.map(br).join(", "),m=bo(h.error.issues),A=new Set(m.map(D=>D.path)).size===1?m[0]?.path:void 0;throw new R(`Validation failed for component '${s}' (${i}): ${p}`,m,"VALIDATION_ERROR",{path:A&&A!=="/"?A:void 0})}n?.skipNestedFunctions||this.validateNestedFunctions(u,c)}validateCommonEnvelopeFields(e,r,n,i,o){if("accessibility"in e&&!r?.has("accessibility")){let s=e.accessibility;delete e.accessibility;let a=hi.optional().safeParse(s);if(!a.success){let c=a.error.errors.map(br).join(", "),u=bo(a.error.issues,"/accessibility");throw new R(`Validation failed for component '${n}' (${i}): ${c}`,u,"VALIDATION_ERROR",{path:u[0]?.path})}this.validateNestedFunctions(s,o,"/accessibility")}if("metadata"in e&&!r?.has("metadata")){let s=e.metadata;delete e.metadata;let a=Ji.shape.metadata.safeParse(s);if(!a.success){let c=a.error.errors.map(br).join(", "),u=bo(a.error.issues,"/metadata");throw new R(`Validation failed for component '${n}' (${i}): ${c}`,u,"VALIDATION_ERROR",{path:u[0]?.path})}}}assertFunctionIdentifiers(e,r){if(this.assertIdentifier(e,`Function name '${e}' must be a valid UAX #31 identifier`,!0),this.enforceIdentifiers&&r!==void 0&&r!==null&&(typeof r!="object"||Array.isArray(r)))throw new R(`Validation failed for function '${e}': Expected object, received ${Array.isArray(r)?"array":typeof r}`);if(r&&typeof r=="object"&&!Array.isArray(r)){let n=Object.keys(r);if(n.length>xi)throw new R(`Function call '${e}' exceeds maximum allowed arguments count (${xi})`);for(let i of n)this.assertIdentifier(i,`Function argument '${i}' in function '${e}' must be a valid UAX #31 identifier`)}}checkNestedCallRecord(e,r,n){let i=e.args,o=i!==void 0?i:{};if(!this.enforceIdentifiers){this.validateFunction(r,o);return}if(r.startsWith("@")){ov(r,e),this.validateFunction(r,o);return}let s=e.catalogId;if(s!==void 0&&typeof s!="string")throw new R(pc(r));hc(s,this.catalog.id,{catalogIsDefault:n===void 0})?this.validateFunction(r,o):this.assertFunctionIdentifiers(r,o)}validateNestedFunctions(e,r,n=""){if(Array.isArray(e)){for(let s=0;s<e.length;s++)this.validateNestedFunctions(e[s],r,`${n}/${s}`);return}if(typeof e!="object"||e===null)return;let i=e;this.enforceIdentifiers&&ms(Object.keys(i),this.catalog.protocolVersion);let o=this.enforceIdentifiers?i["@call"]:i.call??i.function;if(typeof o=="string"&&(this.enforceIdentifiers||o.length>0))try{this.checkNestedCallRecord(i,o,r)}catch(s){throw s instanceof R&&n&&(s.path=s.path&&s.path!=="/"?`${n}${s.path}`:n),s}for(let[s,a]of Object.entries(i))this.validateNestedFunctions(a,r,`${n}/${s}`)}validateFunction(e,r){this.assertFunctionIdentifiers(e,r);let n=this.enforceIdentifiers&&e.startsWith("@")?iv(e):this.catalog.functions.get(e);if(!n){if(!this.allowUnknown)throw new R(`Unrecognized function '${e}'`);return r??{}}if(!n.schema){if(r!==void 0&&(typeof r!="object"||r===null||Array.isArray(r)))throw new R(`Validation failed for function '${e}': Expected object, received ${Array.isArray(r)?"array":typeof r}`,void 0,"VALIDATION_ERROR",{path:"/args"});return r??{}}let i=n.schema.safeParse(r??{});if(!i.success){let o=i.error.errors.map(br).join(", "),s=bo(i.error.issues,"/args");throw new R(`Validation failed for function '${e}': ${o}`,s,"VALIDATION_ERROR",{path:s[0]?.path})}return i.data}validateTheme(e){let r=this.catalog.themeSchema;if(!r)return e;let n=r.safeParse(e);if(!n.success){let i=n.error.errors.map(br).join(", "),o=bo(n.error.issues,"/theme");throw new R(`Validation failed for theme: ${i}`,o,"VALIDATION_ERROR",{path:o[0]?.path??"/theme"})}return n.data}assertIdentifier(e,r,n=!1,i){if(this.enforceIdentifiers&&!lr(e,n))throw new R(r,i?[{path:i,code:"invalid_value",message:r}]:void 0,"VALIDATION_ERROR",{path:i})}};function bo(t,e=""){return t.map(r=>{let n=r.path.map(a=>String(a).replace(/~/g,"~0").replace(/\//g,"~1"));r.code==="unrecognized_keys"&&"keys"in r&&Array.isArray(r.keys)&&r.keys.length>0&&n.push(String(r.keys[0]).replace(/~/g,"~0").replace(/\//g,"~1"));let i=n.length>0?`/${n.join("/")}`:"",o=`${e}${i}`||"/",s=r.code==="invalid_type"&&"received"in r&&r.received==="undefined"||r.message==="Required";return{path:o,code:s?"missing_field":"invalid_value",message:r.message}})}function sv(t){let e={};for(let[r,n]of Object.entries(t))nv.includes(r)||(e[r]=n);return e}var ws=class{constructor(e,r){if(this.pendingAgentCalls=new Map,this.isDisposed=!1,Array.isArray(e))this.catalogs=e,this.outboundListener=r,this.defaultTimeoutMs=3e4;else{let n=e??{};this.catalogs=n.catalogs??[],this.outboundListener=n.outboundListener,this.defaultTimeoutMs=n.defaultTimeoutMs??3e4}}get disposed(){return this.isDisposed}async handleCallRendererFunction(e,r,n=!1){let i=this.validateInboundMessage(e);if(i)return await this.emitOutboundResponse(i),i;let{version:o,callRendererFunction:s}=e,{surfaceId:a,functionCallId:c,callFunction:u}=s;if(a!==void 0&&r?.surface?.id!==a){let j=this.createResponseError(c,ge.INVALID_FUNCTION_CALL,`Surface not found: ${a}`,o);return await this.emitOutboundResponse(j),j}let l=u["@call"]??u.call,{catalogId:f,args:h}=u,p=this.resolveFunctionImplementation(f,l,r,o);if("error"in p){let j=this.createResponseError(c,ge.INVALID_FUNCTION_CALL,p.error,o);return await this.emitOutboundResponse(j),j}let m=this.checkExecutionPermissions(p.funcImpl,l,n);if(m){let j=this.createResponseError(c,ge.INVALID_FUNCTION_CALL,m,o);return await this.emitOutboundResponse(j),j}let y=this.ensureDataContext(r,p.catalog,c),A=this.resolveDynamicArguments(h,y,n);if("error"in A){let j=this.createResponseError(c,ge.EXECUTION_ERROR,A.error,o);return await this.emitOutboundResponse(j),j}let D;try{D=await vn(A.args)}catch(j){let I=this.createResponseError(c,ge.EXECUTION_ERROR,this.extractErrorMessage(j)||"An error occurred during function execution.",o);return await this.emitOutboundResponse(I),I}let _=this.parseArguments(p.catalog,p.funcImpl,D,l);if("error"in _){let j=this.createResponseError(c,ge.INVALID_FUNCTION_CALL,_.error,o);return await this.emitOutboundResponse(j),j}let q=await this.executeFunctionSafely(p.funcImpl,_.args,y,c,o);return await this.emitOutboundResponse(q),q}handleAgentFunctionResponse(e){if(!e||!e.agentFunctionResponse)return;let{functionCallId:r,value:n,error:i}=e.agentFunctionResponse,o=this.pendingAgentCalls.get(r);if(o)if(this.pendingAgentCalls.delete(r),i){let s=i.code??ge.UNKNOWN_ERROR,a=i.message??"Agent function execution failed";o.reject(new et(a,s,r,i))}else o.resolve(n)}callAgentFunction(e,r,n){if(this.isDisposed)return Promise.reject(new et("RpcHandler has been disposed.",ge.DISPOSED));if(!this.outboundListener)return Promise.reject(new et("Cannot call agent function without outboundListener configured.",ge.NO_LISTENER));let i=r?.["@call"]??r?.call;if(!r||!i)return Promise.reject(new et("Missing or invalid function call name.",ge.INVALID_FUNCTION_CALL));let o=n??{},s=o.functionCallId??this.generateFunctionCallId(),a=o.timeoutMs??this.defaultTimeoutMs;if(this.pendingAgentCalls.has(s))return Promise.reject(new et(`A call with functionCallId '${s}' is already pending.`,ge.DUPLICATE,s));let c={functionCallId:s,call:r,effectiveTimeoutMs:a,version:o.version};return this.dispatchAgentCall(e,c)}dispose(){if(!this.isDisposed){this.isDisposed=!0;for(let[e,r]of this.pendingAgentCalls.entries())r.reject(new et(`RpcHandler disposed while call '${e}' was pending.`,ge.CANCELLED,e));this.pendingAgentCalls.clear()}}async emitOutboundResponse(e){if(this.outboundListener)try{let r=this.outboundListener(e);r&&typeof r.catch=="function"&&await r}catch{}}validateInboundMessage(e){if(!e)return this.createResponseError("unknown",ge.INVALID_FUNCTION_CALL,"Inbound message is null or undefined.","unknown");let r=e.version;return this.isDisposed?this.createResponseError(e.callRendererFunction?.functionCallId??"unknown",ge.DISPOSED,"RpcHandler has been disposed.",r):e.callRendererFunction?.callFunction?null:this.createResponseError(e.callRendererFunction?.functionCallId??"unknown",ge.INVALID_FUNCTION_CALL,"Malformed message: missing callRendererFunction or callFunction.",r)}resolveFunctionImplementation(e,r,n,i){let o;if(e&&(o=n?.surface?.availableCatalogs?.get(e)??this.catalogs.find(a=>a.id===e),!o))return{error:`Catalog not found: ${e}`};if(!o)return{error:"No catalog available for function resolution."};if(o.protocolVersion&&i&&!Jt(o.protocolVersion,i))return{error:`Catalog '${o.id}' specification version (${o.protocolVersion}) does not match message protocol version (${i}).`};let s=o.functions?.get(r);return s?{funcImpl:s,catalog:o}:{error:`Function not found: ${r}`}}ensureDataContext(e,r,n){if(e instanceof Ct&&e.surface)return e;let i=new Map;for(let s of this.catalogs)r.protocolVersion&&s.protocolVersion&&Jt(r.protocolVersion,s.protocolVersion)&&i.set(s.id,s);i.set(r.id,r);let o=new kn(`_rpc_fallback_${n||"default"}`,r,i);return new Ct(o,"/")}resolveDynamicArguments(e,r,n){if(e===void 0||typeof e!="object"||e===null||Array.isArray(e))return{args:e};let i={},o,s=r.surface?.onError.subscribe(a=>{!o&&a?.code==="EXPRESSION_ERROR"&&(o=a.message||"An error occurred during function execution.")});try{for(let[a,c]of Object.entries(e))i[a]=r.resolveDynamicValue(c,1,n)}catch(a){o=this.extractErrorMessage(a)||"An error occurred during function execution."}finally{s?.unsubscribe()}return o?{error:o}:{args:i}}checkExecutionPermissions(e,r,n){let i=e.allowedCallers??"rendererOnly";return i==="rendererOrAgent"||i==="agentOnly"?e.requiresUserActivation&&!n?`Function '${r}' requires user activation context to execute.`:null:`Function '${r}' cannot be called by agent (allowedCallers is ${i}).`}parseArguments(e,r,n,i){try{return{args:new Br(e,{allowUnknownElements:!1}).validateFunction(i,n)}}catch(o){let s=this.extractErrorMessage(o);return{error:`Invalid function arguments for '${i}': ${s}`}}}async executeFunctionSafely(e,r,n,i,o){let s=o||"1.0";try{let a=await Promise.resolve(e.execute(r,n)),c=Nr(a)?ye(a):a;return{version:s,rendererFunctionResponse:{functionCallId:i,value:c!==void 0?c:null}}}catch(a){let c=this.extractErrorMessage(a);return{version:s,rendererFunctionResponse:{functionCallId:i,error:{code:ge.EXECUTION_ERROR,message:c||"An error occurred during function execution."}}}}}generateFunctionCallId(){if(typeof globalThis.crypto?.randomUUID=="function")return globalThis.crypto.randomUUID();let e=Math.random().toString(36).substring(2,15).padEnd(13,"0");return`call-${Date.now()}-${e}`}dispatchAgentCall(e,r){let{functionCallId:n,call:i,effectiveTimeoutMs:o,version:s}=r;return new Promise((a,c)=>{let u,l=()=>{u&&(clearTimeout(u),u=void 0),this.pendingAgentCalls.delete(n)},f=(i["@call"]??i.call)||"unknown";u=this.createTimeoutTimer(n,f,o,l,c),this.pendingAgentCalls.set(n,{resolve:h=>{l(),a(h)},reject:h=>{l(),c(h)}}),this.sendOutboundMessage(e,n,i,s,l,c)})}createTimeoutTimer(e,r,n,i,o){if(!(n<=0))return setTimeout(()=>{this.pendingAgentCalls.delete(e)&&(i(),o(new et(`Agent function call '${r}' timed out after ${n}ms.`,ge.TIMEOUT,e)))},n)}sendOutboundMessage(e,r,n,i,o,s){let{call:a,"@call":c,...u}=n,l={"@call":c??a,...u},f={version:i||"1.0",callAgentFunction:{surfaceId:e,functionCallId:r,callFunction:l}};try{let h=this.outboundListener(f);h&&typeof h.catch=="function"&&h.catch(p=>{o(),s(p)})}catch(h){o(),s(h)}}extractErrorMessage(e){return e instanceof Error?e.message:String(e)}createResponseError(e,r,n,i){return{version:i||"1.0",rendererFunctionResponse:{functionCallId:e,error:{code:r,message:n}}}}};var Es=class{constructor(e,r,n){this.actionHandler=r,this.graphBounds=new WeakMap,this.registeredCatalogs=e,this.model=new xs,this.adapterRegistry=n?.adapterRegistry??Fn,this.defaultVersion=n?.version,this.errorHandler=n?.errorHandler,this.reportErrorsOnly=n?.reportErrorsOnly??!1,this.rpc=new ws({catalogs:this.registeredCatalogs,outboundListener:n?.outboundListener,defaultTimeoutMs:n?.defaultTimeoutMs}),this.validationConfig=n?.validationConfig?Gd(n.validationConfig):void 0,this.actionHandler&&this.model.onAction.subscribe(this.actionHandler)}get catalogs(){return[...this.registeredCatalogs]}callAgentFunction(e,r,n){return this.rpc.callAgentFunction(e,r,n)}dispose(){this.rpc.dispose()}getRendererCapabilities(e){let r=e?.versions??(e?.version?[e.version]:void 0);if(!r||r.length===0)throw new R("At least one protocol version must be provided in CapabilitiesOptions to generate renderer capabilities.");let n={};for(let i of r){let o={supportedCatalogIds:this.registeredCatalogs.map(a=>a.id)},s=e?.includeInlineCatalogs?this.registeredCatalogs.map(a=>Jo(i,"1.0")>=0?this.generateInlineCatalog(a):this.generateLegacyInlineCatalog(a,e?.componentEnvelopeRef??"common_types.json#/$defs/ComponentCommon")):void 0;s&&(o.inlineCatalogs=s),n[i]=o}return n}getClientCapabilities(e){let r=e?.versions&&e.versions.length>0?e.versions:[e?.version??"v0.9"];return this.getRendererCapabilities({...e,versions:r})}generateInlineCatalog(e){let r=e.toJson();r.catalogId=e.id;let n=typeof r.protocolVersion=="string"?r.protocolVersion:Ae(e.protocolVersion)??e.protocolVersion;return r.protocolVersion=n.trim().replace(/^[vV](?=\d)/,""),r}generateLegacyInlineCatalog(e,r="common_types.json#/$defs/ComponentCommon"){let n={};for(let[s,a]of e.components.entries()){let c={},u=[];if(a.schema&&typeof a.schema=="object"&&"safeParse"in a.schema){let p=st(a.schema,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});pr(p,void 0,{stripAdditionalProperties:!0}),c=p.properties||{},u=Array.isArray(p.required)?p.required.filter(m=>m!=="component"&&m!=="id"):[]}let{component:l,id:f,...h}=c;n[s]={allOf:[{$ref:r},{properties:{component:{const:s},...h},required:["component",...u]}]}}let i=[];for(let s of e.functions.values()){let a={type:"object",properties:{}};if(s.schema&&typeof s.schema=="object"&&"safeParse"in s.schema){let c=st(s.schema,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});pr(c,void 0,{stripAdditionalProperties:!0}),a=c}i.push({name:s.name,...s.description?{description:s.description}:{},returnType:s.returnType,parameters:a})}let o;if(e.themeSchema){let s=st(e.themeSchema,{target:"jsonSchema2019-09",$refStrategy:"none",override:At});pr(s,void 0,{stripAdditionalProperties:!0}),o=s.properties||void 0}return{catalogId:e.id,...Object.keys(n).length>0?{components:n}:{},...i.length>0?{functions:i}:{},...o?{theme:o}:{}}}getRendererDataModel(e){let r=Array.from(this.model.surfacesMap.values()).filter(s=>s.sendDataModel);if(r.length===0)return;if(e!==void 0){let s={};for(let a of r){let c=a.protocolVersion;(!c||Jt(c,e))&&(s[a.id]=a.dataModel.get("/"))}return Object.keys(s).length===0?void 0:{version:e,surfaces:s}}let n=new Set;for(let s of r)if(s.protocolVersion){let a=Ae(s.protocolVersion),c=a?Jo(a,"1.0")>=0?a:`v${a}`:s.protocolVersion;n.add(c)}if(n.size>1)throw new R(`Multiple protocol versions detected among active surfaces: ${Array.from(n).sort().join(", ")}. Specify a target protocol version in getRendererDataModel(version).`);let i=n.size===1?n.values().next().value:"1.0",o={};for(let s of r)o[s.id]=s.dataModel.get("/");return{version:i,surfaces:o}}getClientDataModel(e){return this.getRendererDataModel(e)}resolvePath(e,r){return gr.resolvePath(e,r)}getSurfaces(){return this.model.surfacesMap}getSurface(e){return this.model.getSurface(e)}onSurfaceCreated(e){return this.model.onSurfaceCreated.subscribe(e)}onSurfaceDeleted(e){return this.model.onSurfaceDeleted.subscribe(e)}processMessages(e,r){this.withValidationConfig(r,()=>{let n=Mr(Array.isArray(e)?e[0]:e,this.defaultVersion),i=n;try{let o=this.prepareOperations(e,s=>{i=s});for(let s of o)i=this.contextFromOperation(s,n),this.processOperation(s,r)}catch(o){if(this.handleProcessingError(o,i),!this.reportErrorsOnly)throw o}})}processMessagesWithErrors(e,r){return this.withValidationConfig(r,()=>{let n=Array.isArray(e)?e:[e],i=[];for(let o of n){let s=Mr(o,this.defaultVersion),a=s;try{let c=this.prepareOperations(o,u=>{a=u});for(let u of c)a=this.contextFromOperation(u,s),this.processOperation(u,r)}catch(c){i.push(this.handleProcessingError(c,a))}}return i})}async processMessagesAsync(e,r){let n=Mr(Array.isArray(e)?e[0]:e,this.defaultVersion),i=n;try{let o=this.withValidationConfig(r,()=>this.prepareOperations(e,a=>{i=a})),s=[];for(let a of o){i=this.contextFromOperation(a,n);let c=await this.processOperationAsync(a,r);c&&s.push(c)}return s}catch(o){if(this.handleProcessingError(o,i),!this.reportErrorsOnly)throw o;return[]}}contextFromOperation(e,r){let n=e.envelopeContext??r,i="surfaceId"in e&&e.surfaceId?e.surfaceId:n.surfaceId,o="functionCallId"in e&&e.functionCallId?e.functionCallId:n.functionCallId,s="version"in e?e.version:void 0,a=i?this.model.getSurface(i)?.protocolVersion:void 0;return{surfaceId:i,functionCallId:o,actionType:e.type,version:s??a??n.version??this.defaultVersion}}handleProcessingError(e,r){let n=As(e,r),i={code:n.error.code,message:n.error.message,surfaceId:n.error.surfaceId,details:e instanceof R?e.details:void 0},o=n.error.surfaceId?this.model.getSurface(n.error.surfaceId):void 0;return o?o.dispatchError(i):this.model.emitError(i),this.errorHandler?.(n),n}extractSingleMessageOperations(e){let r=Mr(e,this.defaultVersion),n;try{n=this.adapterRegistry.resolveFromPayload(e)}catch(s){if(this.isImplicitV09Payload(e)){let a=this.catalogs.some(c=>c.protocolVersion==="0.9.1"||c.protocolVersion==="v0.9.1");n=this.adapterRegistry.getAdapter(a?"v0.9.1":"v0.9")}else throw s}let i=n.extractOperations(e),o=r.version;for(let s of i)o&&Ae(o)&&("version"in s&&s.version||(s.version=o)),s.envelopeContext=r;return i}withValidationConfig(e,r){let n=e?.validationConfig;if(!n)return r();let i=this.validationConfig;this.validationConfig=Gd(n);try{return r()}finally{this.validationConfig=i}}prepareSingleItem(e,r){return r?.(Mr(e,this.defaultVersion)),this.validationConfig&&Ed(e),this.validationConfig?.targetVersion&&this.validateTargetVersion(e),Zd(e)?[e]:this.extractSingleMessageOperations(e)}prepareOperations(e,r){return!e||Array.isArray(e)&&e.length===0?[]:Array.isArray(e)?e.flatMap(n=>this.prepareSingleItem(n,r)):this.prepareSingleItem(e,r)}isImplicitV09Payload(e){if(this.validationConfig||this.catalogs.length===0||this.catalogs.some(n=>oe(n.protocolVersion,"1.0")))return!1;let r=Array.isArray(e)?e[0]:e;return typeof r=="object"&&r!==null&&"messages"in r&&Array.isArray(r.messages)&&(r=r.messages[0]),typeof r!="object"||r===null||"version"in r?!1:["createSurface","updateComponents","updateDataModel","deleteSurface"].some(n=>n in r)}validateTargetVersion(e){let r=this.validationConfig?.targetVersion;if(!r)return;let n=i=>{if(typeof i=="object"&&i!==null&&"version"in i){let o=i.version;if(o){let s=Ae(o)??o,a=Ae(r)??r;if(s!==a)throw new R(`Message version '${o}' does not match expected target version '${r}'`)}}};if(Array.isArray(e))for(let i of e)n(i);else n(e)}applyStateOperation(e){if(this.validationConfig?.allowedMessages&&!this.validationConfig.allowedMessages.includes(e.type))throw new R(`Operation '${e.type}' is not permitted by ValidationConfig.allowedMessages`);switch(e.type){case"createSurface":this.processCreateSurfaceOp(e);break;case"deleteSurface":this.processDeleteSurfaceOp(e);break;case"updateComponents":this.processUpdateComponentsOp(e);break;case"updateDataModel":this.processUpdateDataModelOp(e);break;case"agentFunctionResponse":this.rpc.handleAgentFunctionResponse({version:e.version??"1.0",agentFunctionResponse:{functionCallId:e.functionCallId,value:e.value,error:e.error}});break;case"callRendererFunction":break}}resolveRpcDataContext(e){if(e.surfaceId!==void 0){let o=this.model.surfacesMap.get(e.surfaceId);return o?new Ct(o,"/"):void 0}let r=e.catalogId?this.registeredCatalogs.find(o=>o.id===e.catalogId):void 0;if(!r)return;let n=`_rpc_fallback_${e.functionCallId||"default"}`,i=new Map;for(let o of this.registeredCatalogs)r?.protocolVersion&&o.protocolVersion&&Jt(r.protocolVersion,o.protocolVersion)&&i.set(o.id,o);return r&&i.set(r.id,r),new Ct(new kn(n,r,i),"/")}processOperation(e,r){if(e.type==="callRendererFunction"){let n=this.resolveRpcDataContext(e),i=r?.isUserActivated??e.isUserActivated??!1,o={version:e.version??"1.0",callRendererFunction:{...e.surfaceId!==void 0?{surfaceId:e.surfaceId}:{},functionCallId:e.functionCallId,callFunction:{"@call":e.call,catalogId:e.catalogId,args:e.args}}};this.rpc.handleCallRendererFunction(o,n,i).catch(s=>{console.error(`Unhandled error in callRendererFunction (${e.call}):`,s)});return}this.withValidationConfig(r,()=>this.applyStateOperation(e))}async processOperationAsync(e,r){if(e.type==="callRendererFunction"){let n=this.resolveRpcDataContext(e),i=r?.isUserActivated??e.isUserActivated??!1,o={version:e.version??"1.0",callRendererFunction:{...e.surfaceId!==void 0?{surfaceId:e.surfaceId}:{},functionCallId:e.functionCallId,callFunction:{"@call":e.call,catalogId:e.catalogId,args:e.args}}};return await this.rpc.handleCallRendererFunction(o,n,i)}return this.withValidationConfig(r,()=>this.applyStateOperation(e)),null}validateSurfaceTheme(e,r,n){if(!e||!r?.themeSchema)return e;try{return new Br(r,this.validationConfig).validateTheme(e)}catch(i){if(i instanceof R){let o=Array.isArray(i.details)?i.details.map(s=>typeof s=="object"&&s!==null?{...s,surfaceId:n}:s):i.details;throw new R(i.message.replace(/^Validation failed for theme:/,`Validation failed for theme on surface '${n}':`),o,i.code,{path:i.path,surfaceId:n})}throw i}}processCreateSurfaceOp(e){let{surfaceId:r,catalogId:n,theme:i,sendDataModel:o,components:s,dataModel:a}=e,c=e.version,u=n===void 0&&c!==void 0&&oe(c,"1.0"),l=u?void 0:cv(this.registeredCatalogs,n,c);if(!l&&!u)throw n!==void 0?new me(`Catalog not found: ${n}`,"CATALOG_ERROR",{surfaceId:r}):new me(`No default catalog available for surface '${r}'.`,"CATALOG_ERROR",{surfaceId:r});if(l?.protocolVersion&&c&&!Jt(l.protocolVersion,c)){let y=`Surface '${r}' catalog '${n??l.id}' specification version (${l.protocolVersion}) does not match message protocol version (${c}).`;throw oe(c,"1.0")?new me(y,"CATALOG_ERROR",{surfaceId:r}):new R(y,void 0,"VALIDATION_ERROR",{surfaceId:r})}if(this.model.getSurface(r))throw new ot(`Surface ${r} already exists.`,void 0,"INTEGRITY_ERROR",{surfaceId:r});let f=this.validateSurfaceTheme(i,l,r),h=l?.protocolVersion??c,p=new Map(this.registeredCatalogs.filter(y=>Jt(y.protocolVersion,h)).map(y=>[y.id,y])),m=new kn(r,l,p,f,o??!1,void 0,e.rootId??"root",e.metadata,h);this.model.addSurface(m),a&&m.dataModel.set("/",a),s&&s.length>0&&this.processUpdateComponentsOp({type:"updateComponents",surfaceId:r,components:s})}processDeleteSurfaceOp(e){e.surfaceId&&this.model.deleteSurface(e.surfaceId)}validateComponentProperties(e,r){let{id:n,component:i}=e;if(typeof n!="string"||!n)throw new R(`Component '${i}' is missing an 'id'; entries require a valid string 'id'.`);let o=this.resolveComponentCatalog(e,r);"metadata"in e&&e.metadata!==void 0&&An(e.metadata);let s=r.componentsModel.get(n),a=!this.validationConfig&&!oe(r.protocolVersion,"1.0");new Br(o,this.validationConfig).validateComponent(this.componentPayloadForValidation(e,r,o),s?.type,{skipNestedFunctions:a}),!a&&this.validateNestedFunctionCalls(e,r,o)}componentPayloadForValidation(e,r,n){let{catalogId:i,...o}=e;return oe(r.protocolVersion,"1.0")&&n!==r.defaultCatalog&&(o.catalogId=n.id),o}resolveComponentCatalog(e,r){let{id:n,component:i,catalogId:o}=e,s=`Component '${n}'`,a=oe(r.protocolVersion,"1.0");if(typeof o=="string"&&(o||a))return this.resolveSurfaceItemCatalog(r,o,s);if(!a){let c=typeof n=="string"?r.componentsModel.get(n):void 0;if(c&&(typeof i!="string"||!i||i===c.type))return c.catalog}return this.resolveSurfaceItemCatalog(r,void 0,s)}validateSingleNestedCall(e,r,n,i,o){let s=e.catalogId;if(s!==void 0&&typeof s!="string")throw new R(pc(r),void 0,"VALIDATION_ERROR",{path:o||void 0,surfaceId:n.id});let a=this.resolveNestedCallCatalog(n,s,r,o);hc(s,i.id,{catalogIsDefault:i===n.defaultCatalog})||this.validateExternalCatalogFunction(a,r,e.args,n.id,o)}resolveNestedCallCatalog(e,r,n,i){try{return this.resolveSurfaceItemCatalog(e,r,`Function call '${n}'`)}catch(o){throw o instanceof Ve&&(o.surfaceId=e.id,i&&(o.path=i)),o}}validateExternalCatalogFunction(e,r,n,i,o){try{new Br(e,this.validationConfig).validateFunction(r,n??{})}catch(s){throw s instanceof Ve&&(s.surfaceId=i,o&&(s.path=s.path&&s.path!=="/"?`${o}${s.path}`:o)),s}}validateNestedFunctionCalls(e,r,n){if(!oe(r.protocolVersion,"1.0"))return;let i=(o,s)=>{if(Array.isArray(o)){for(let u=0;u<o.length;u++)i(o[u],`${s}/${u}`);return}if(typeof o!="object"||o===null)return;let a=o,c=a["@call"];typeof c=="string"&&!c.startsWith("@")&&this.validateSingleNestedCall(a,c,r,n,s);for(let[u,l]of Object.entries(a))i(l,`${s}/${u}`)};for(let[o,s]of Object.entries(e))o==="id"||o==="component"||o==="catalogId"||o==="metadata"||i(s,`/${o}`)}resolveSurfaceItemCatalog(e,r,n){if(r!==void 0&&!e.availableCatalogs.has(r)){let i=this.registeredCatalogs.find(o=>o.id===r);if(i)throw new me(`${n} names catalog '${r}', whose specification version (${i.protocolVersion}) does not match surface '${e.id}' version (${e.protocolVersion}).`)}return e.resolveCatalog(r,n)}applyComponentUpdate(e,r){let{id:n,component:i,catalogId:o,metadata:s,...a}=e;if(typeof n!="string")return;let c=av(s),u=this.resolveComponentCatalog(e,r),l=r.componentsModel.get(n);if(l){let f=typeof i=="string"?i:l.type;if(f!==l.type||l.catalog.id!==u.id){r.componentsModel.removeComponent(n);let h=new yr(n,f,a,u,c);r.componentsModel.addComponent(h)}else vi(()=>{l.applyUpdate(a,c)})}else{if(typeof i!="string"||!i)throw new R(`Cannot create component ${n} without a type.`);let f=new yr(n,i,a,u,c);r.componentsModel.addComponent(f)}}rebaseComponentValidationError(e,r,n){if(e instanceof Ve&&(e.surfaceId||(e.surfaceId=n),e instanceof R&&(e.path=e.path&&e.path!=="/"?`/components/${r}${e.path}`:`/components/${r}`,Array.isArray(e.details))))for(let i of e.details)typeof i=="object"&&i!==null&&!("surfaceId"in i)&&(i.surfaceId=n)}validateComponentsBatch(e,r){let n=new Set;for(let i=0;i<e.components.length;i++){let o=e.components[i];if(o&&typeof o=="object"&&typeof o.id=="string"){if(n.has(o.id))throw new ot(`Duplicate component ID: '${o.id}'`,[o.id],"INTEGRITY_ERROR",{surfaceId:e.surfaceId,path:`/components/${i}/id`});n.add(o.id)}try{this.validateComponentProperties(o,r)}catch(s){throw this.rebaseComponentValidationError(s,i,e.surfaceId),s}}}validateSurfaceComponentGraph(e,r){try{return Td(r,e.components,this.validationConfig,(n,i)=>this.resolveComponentCatalog(n,i),this.graphBounds)}catch(n){throw n instanceof Ve&&!n.surfaceId&&(n.surfaceId=e.surfaceId),n}}processUpdateComponentsOp(e){if(!e.surfaceId)return;let r=this.model.getSurface(e.surfaceId);if(!r)throw new ot(`Surface not found for message: ${e.surfaceId}`,void 0,"INTEGRITY_ERROR",{surfaceId:e.surfaceId});this.validateComponentsBatch(e,r);let n=this.validateSurfaceComponentGraph(e,r);vi(()=>{for(let i of e.components)this.applyComponentUpdate(i,r)}),n&&Od(r.componentsModel,n,this.graphBounds)}processUpdateDataModelOp(e){if(!e.surfaceId)return;let r=this.model.getSurface(e.surfaceId);if(!r)throw new ot(`Surface not found for message: ${e.surfaceId}`,void 0,"INTEGRITY_ERROR",{surfaceId:e.surfaceId});if(e.path!==void 0&&e.path!==""&&(!e.path.startsWith("/")||!ic.test(e.path))){let o=`Invalid path syntax: '${e.path}' (path must be a valid RFC 6901 JSON Pointer starting with '/')`;throw new R(o,[{path:"/path",code:"invalid_value",message:o,surfaceId:e.surfaceId}],"VALIDATION_ERROR",{path:"/path",surfaceId:e.surfaceId})}let n=e.path||"/",i=e.value;try{r.dataModel.set(n,i)}catch(o){throw o instanceof Se&&!o.surfaceId&&(o.surfaceId=e.surfaceId),o}}};function av(t){if(t&&typeof t=="object"&&!Array.isArray(t))return t}function cv(t,e,r){return e!==void 0?t.find(n=>n.id===e):t.find(n=>r?Jt(n.protocolVersion,r):!0)??t[0]}function Gd(t){return{allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1,...t}}var ki=class{constructor(e,r,n="/",i,o){let s=e.componentsModel.get(r);if(!s)throw new Rt(`Component not found: ${r}`);this.componentModel=s,this.surfaceComponents=e.componentsModel,this.theme=e.theme,this.dataContext=new Ct(e,n,o,i),this._actionDispatcher=(a,c)=>e.dispatchAction(a,this.componentModel.id,c)}dispatchAction(e,r){return this._actionDispatcher(e,r)}};var Hd=new WeakMap;function gc(t){let e=Hd.get(t);if(e)return e;let r=Ss(t),n=r.type==="OBJECT"&&r.shape&&!("accessibility"in r.shape)?{...r,shape:{...r.shape,accessibility:Ss(hi)}}:r;return Hd.set(t,n),n}function vo(t){let e=t;for(;e;){let r=e._def?.typeName;if(r==="ZodOptional"||r==="ZodNullable"||r==="ZodDefault"||r==="ZodReadonly")e=e._def.innerType;else if(r==="ZodEffects")e=e._def.schema;else if(r==="ZodBranded")e=e._def.type;else if(r==="ZodLazy")e=e._def.getter();else break}return e}function Vr(t){let e=t,r="";for(;e&&(r=e.description??e._def?.description??"",!r);){let i=e._def?.typeName;if(i==="ZodOptional"||i==="ZodNullable"||i==="ZodDefault"||i==="ZodReadonly")e=e._def.innerType;else if(i==="ZodEffects")e=e._def.schema;else if(i==="ZodBranded")e=e._def.type;else if(i==="ZodLazy")e=e._def.getter();else break}if(!r||!r.startsWith("REF:"))return"";let n=r.slice(4);return Sn(n.split("|")[0])}function uv(t){let e=Vr(t);if(e==="Checkable"||e==="CheckRule")return!0;let r=vo(t);if(r?._def?.typeName==="ZodArray"){let n=r._def.type;if(Vr(n)==="CheckRule")return!0}return!1}function lv(t){if(Vr(t)==="Action")return!0;let r=vo(t)._def;return r?.typeName==="ZodObject"&&!!r.shape?.().event}function dv(t){let e=Vr(t);if(e==="DataBinding"||e==="FunctionCall"||e.startsWith("Dynamic"))return!0;let n=vo(t)._def;if(n?.typeName!=="ZodObject")return!1;let i=n.shape?.()||{},o=Object.values(i).some(s=>Vr(s)==="ComponentId");return(!!i["@path"]||!!i.path||!!i["@call"]||!!i.call)&&!o}function fv(t){if(Fr(t)==="child-list"||Vr(t)==="ChildList")return!0;let r=vo(t)._def;if(r?.typeName!=="ZodObject")return!1;let n=r.shape?.()||{};return Object.values(n).some(i=>Vr(i)==="ComponentId")}function pv(t,e){return(t==="DataBinding"||t==="FunctionCall"||t.startsWith("Dynamic"))&&e!=="ZodObject"&&e!=="ZodArray"}function hv(t){if(t.some(lv))return{type:"ACTION"};if(t.some(dv))return{type:"DYNAMIC"};if(t.some(fv))return{type:"STRUCTURAL"}}function mv(t){let e={};for(let[r,n]of Object.entries(t))e[r]=Ss(n);return e}function Ss(t){let e=Vr(t);if(uv(t))return{type:"CHECKABLE"};if(e==="Action")return{type:"ACTION"};let r=vo(t);if(Fr(r)==="child-list"||e==="ChildList")return{type:"STRUCTURAL"};if(pv(e,r._def?.typeName))return{type:"DYNAMIC"};if(r._def.typeName==="ZodUnion"){let n=hv(r._def.options);if(n)return n}return r._def.typeName==="ZodArray"?{type:"ARRAY",element:Ss(r._def.type)}:r._def.typeName==="ZodObject"?{type:"OBJECT",shape:mv(r._def.shape())}:{type:"STATIC"}}var Kd=1e4;function yc(t){return Array.isArray(t)?t.length>Kd?t.slice(0,Kd):t:[]}var Fi=class{constructor(e,r){this.dataListeners=[],this.propsListeners=[],this.currentProps={},this.isConnected=!1,this.actionClosures=new Map,this.context=e,this.behaviorTree=gc(r),this.behaviorTree.type!=="OBJECT"&&(this.behaviorTree={type:"OBJECT",shape:{}}),this.resolveInitialProps()}resolveInitialProps(){let e=this.context.componentModel.properties,r=this.resolveAndBind(e,this.behaviorTree,[],!0);this.currentProps={...this.currentProps,...r||{}}}connect(){if(this.isConnected)return;this.isConnected=!0;let e=this.context.componentModel.onUpdated.subscribe(()=>{this.rebuildAllBindings()});this.compUnsub=()=>e.unsubscribe(),this.rebuildAllBindings()}rebuildAllBindings(){this.dataListeners.forEach(n=>n()),this.dataListeners=[];let e=this.context.componentModel.properties,r=this.resolveAndBind(e,this.behaviorTree,[],!1);this.currentProps={...this.currentProps,...r||{}},this.notify()}bindDynamicValue(e,r,n){let i=this.context.dataContext.subscribeDynamicValue(e,o=>{this.updateDeepValue(r,o),this.notify()});return n?i.unsubscribe():this.dataListeners.push(()=>i.unsubscribe()),i.value}resolveDeepSync(e,r=0){if(typeof e!="object"||e===null)return e;if(r>Ai)return;if("path"in e||"call"in e||"@path"in e||"@call"in e)return this.context.dataContext.resolveDynamicValue(e,r);if(Array.isArray(e))return e.map(i=>this.resolveDeepSync(i,r+1));let n={};for(let[i,o]of Object.entries(e))n[i]=this.resolveDeepSync(o,r+1);return n}bindAction(e,r){let n=r.join("/"),i=this.actionClosures.get(n);if(i&&mc(i.raw,e))return i.closure;let o=async s=>{if(!e||typeof e!="object")return;let a=e;if(!!(a.functionCall&&typeof a.functionCall=="object")||"call"in a||"@call"in a){await this.context.dataContext.resolveAction(e,{userActivation:!0});return}let u=this.context.dataContext.resolveAction(e,{userActivation:!0});u!==void 0&&await this.context.dispatchAction(u,s?.metadata)};return this.actionClosures.set(n,{raw:e,closure:o}),o}mapTemplateChildren(e,r,n){let i=yc(e),o=this.context.dataContext.nested(n);return i.map((s,a)=>({id:r,basePath:o.nested(String(a)).path}))}bindStructuralTemplate(e,r,n){if(!e||typeof e!="object"||Array.isArray(e))return e;let i=e,o=typeof i.path=="string"?i.path:void 0,s=typeof i.componentId=="string"?i.componentId:void 0;if(!o||!s)return e;let c=oe(this.context.dataContext.surface?.protocolVersion??this.context.dataContext.surface?.defaultCatalog?.protocolVersion,"1.0")?{"@path":o}:{path:o},u=this.context.dataContext.subscribeDynamicValue(c,l=>{let f=this.mapTemplateChildren(l,s,o);this.updateDeepValue(r,f),this.notify()});return n?u.unsubscribe():this.dataListeners.push(()=>u.unsubscribe()),this.mapTemplateChildren(u.value,s,o)}extractValidationResult(e,r,n="Validation failed"){if(typeof e=="object"&&e!==null&&"valid"in e){let i=e,o=i.message,s=i.severity==="warning"||i.severity==="info"?i.severity:"error",a=typeof i.code=="string"?i.code:void 0,c=r!==void 0?r:o!=null?String(o):n;return{valid:!!i.valid,message:c,...a!==void 0?{code:a}:{},severity:s}}return{valid:!!e,message:r??n,severity:"error"}}bindCheckable(e,r,n){let i=Array.isArray(e)?e:[],o=i.map(()=>({valid:!0,message:"",severity:"error"})),s=r.slice(0,-1),a=()=>{let u=o.filter(f=>!f.valid&&f.severity==="error").map(f=>f.message),l=o.filter(f=>!f.valid);this.updateDeepValue([...s,"isValid"],u.length===0),this.updateDeepValue([...s,"validationErrors"],u),this.updateDeepValue([...s,"validationResults"],l)},c=()=>{a(),this.notify()};return i.forEach((u,l)=>{let f=typeof u=="object"&&u!==null?u:void 0,h=f&&f.condition!==void 0?f.condition:u,p=typeof f?.message=="string"?f.message:void 0,m=this.isPathBoundCondition(h)?void 0:p,y=p??"Validation failed";o[l].message=y;let A=this.context.dataContext.subscribeDynamicValue(h,D=>{o[l]=this.extractValidationResult(D,m,y),c()});n?A.unsubscribe():this.dataListeners.push(()=>A.unsubscribe()),o[l]=this.extractValidationResult(A.value,m,y)}),a(),e}isPathBoundCondition(e){if(typeof e!="object"||e===null)return!1;let r=e;return this.context.dataContext.atLeastV10?typeof r["@path"]=="string"&&!("@call"in r):typeof r.path=="string"&&!("call"in r)}bindObject(e,r,n,i){let o={};for(let[s,a]of Object.entries(e)){let c=r[s]||{type:"STATIC"};o[s]=this.resolveAndBind(a,c,[...n,s],i)}for(let[s,a]of Object.entries(r))if(a.type==="DYNAMIC"){let c=`set${s.charAt(0).toUpperCase()+s.slice(1)}`,u=e[s];o[c]=l=>{if(u&&typeof u=="object"){let f=u,h=this.context.dataContext.atLeastV10?"@path":"path",p=f[h];typeof p=="string"&&(this.context.dataContext.atLeastV10||!("componentId"in f))&&this.context.dataContext.set(p,l)}}}return o}resolveAndBind(e,r,n,i){if(e==null)return e;switch(r.type){case"DYNAMIC":return this.bindDynamicValue(e,n,i);case"ACTION":return this.bindAction(e,n);case"STRUCTURAL":return this.bindStructuralTemplate(e,n,i);case"CHECKABLE":return this.bindCheckable(e,n,i);case"STATIC":return e;case"ARRAY":return Array.isArray(e)?e.map((o,s)=>this.resolveAndBind(o,r.element,[...n,s.toString()],i)):e;case"OBJECT":return typeof e!="object"?e:this.bindObject(e,r.shape,n,i)}}updateDeepValue(e,r){this.currentProps=this.cloneAndUpdate(this.currentProps,e,r)}cloneAndUpdate(e,r,n){if(r.length===0)return n;let[i,...o]=r;if(Array.isArray(e)){let s=[...e];return s[Number(i)]=this.cloneAndUpdate(s[Number(i)],o,n),s}else{let s=typeof e=="object"&&e!==null?e:{};return{...s,[i]:this.cloneAndUpdate(s[i],o,n)}}}dispose(){this.isConnected&&(this.isConnected=!1,this.dataListeners.forEach(e=>e()),this.dataListeners=[],this.compUnsub&&(this.compUnsub(),this.compUnsub=void 0))}notify(){this.propsListeners.forEach(e=>e(this.currentProps))}subscribe(e){return this.propsListeners.length===0&&this.connect(),this.propsListeners.push(e),{unsubscribe:()=>{this.propsListeners=this.propsListeners.filter(r=>r!==e),this.propsListeners.length===0&&this.dispose()}}}get snapshot(){return this.currentProps}};function mc(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return!1;if(Array.isArray(t)||Array.isArray(e))return!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length?!1:t.every((i,o)=>mc(i,e[o]));let r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&mc(t[i],e[i]))}var Ge=class{constructor(e){this.value=e}},xo=class extends Ge{constructor(e,r,n){super(e),this.set=r,this.path=n}};function $i(t){return t instanceof xo}function Yd(t,e){return $i(t)!==$i(e)||$i(t)&&$i(e)&&t.path!==e.path?!1:bc(t.value,e.value)}function bc(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every((r,n)=>bc(r,e[n]));if(Jd(t)&&Jd(e)){let r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(i=>i in e&&bc(t[i],e[i]))}return!1}function Jd(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}var Xd=Symbol.for("a2ui.nodeId");function Qd(){let t=globalThis,e=(t[Xd]??0)+1;return t[Xd]=e,`a2ui-n${e}`}var vc="Placeholder";function St(t){return t instanceof Ur}var Ur=class{constructor(e,r,n,i,o,s,a,c="resolved",u=at(()=>{})){this.id=Qd(),this._onDestroyed=new Ee,this.onDestroyed=this._onDestroyed,this.cleanups=[],this._disposed=!1,this.instanceId=e,this.componentId=r,this.type=n,this.dataPath=i,this.props=De(o),this.impl=s,this.context=a,this.state=c,this.metadata=u}get disposed(){return this._disposed}get isPlaceholder(){return this.state!=="resolved"}addCleanup(e){this.cleanups.push(e)}toJSON(){if(this.isPlaceholder)return{id:this.componentId,type:this.type,state:this.state};let e={id:this.componentId,type:this.type},r=ce(this.props);for(let[i,o]of Object.entries(r))e[i]=_s(o);let n=ce(this.metadata);return n!==void 0&&(e.metadata=n),e}setProps(e){if(this._disposed)return;let r=ce(this.props);gv(r,e)||be(this.props,e)}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.cleanups)try{e()}catch(r){console.error(`ComponentNode cleanup error (${this.instanceId}):`,r)}this.cleanups=[],this._onDestroyed.emit(),this._onDestroyed.dispose()}}};function _s(t){if(St(t))return t.toJSON();if(t instanceof Ge)return _s(t.value);if(typeof t=="function")return"<Action>";if(Array.isArray(t))return t.map(_s);if(t&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=_s(n);return e}return t}function gv(t,e){if(Object.is(t,e))return!0;let r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let i of r)if(!Object.is(t[i],e[i]))return!1;return!0}var yv="REF:common_types.json#/$defs/ComponentId",bv="REF:common_types.json#/$defs/ChildList",ef=new Map,xc=new WeakMap;function tf(t){let e=xc.get(t);if(e)return e;let r=Is(t);if(r.schema._def.typeName!=="ZodObject")return xc.set(t,ef),ef;let n=new Map,i=r.schema.shape;for(let[s,a]of Object.entries(i)){let c=Is(a);if(vv(c)||xv(c.schema)){n.set(s,{kind:"list"});continue}if(Ac(c)){n.set(s,{kind:"single"});continue}if(c.schema._def.typeName==="ZodArray"){let u=Is(c.schema._def.type);if(Ac(u)){n.set(s,{kind:"list"});continue}if(u.schema._def.typeName==="ZodObject"){let l=new Set,f=u.schema.shape;for(let[h,p]of Object.entries(f))Ac(Is(p))&&l.add(h);l.size>0&&n.set(s,{kind:"nested",keys:l})}}}let o=n;return xc.set(t,o),o}function Is(t){let e=[],r=new Set,n=t;for(;;){n.description&&e.push(n.description);let i=Fr(n);i&&r.add(i);let o=n._def.typeName;if(o==="ZodOptional"||o==="ZodNullable"||o==="ZodDefault")n=n._def.innerType;else if(o==="ZodEffects")n=n._def.schema;else return{schema:n,descriptions:e,refs:r}}}function Ac(t){return t.refs.has("component-id")||rf(t.descriptions,yv)}function vv(t){return t.refs.has("child-list")||rf(t.descriptions,bv)}function rf(t,e){return t.some(r=>r.startsWith(e))}function xv(t){return t._def.typeName!=="ZodUnion"?!1:t._def.options.some(r=>{if(r._def.typeName!=="ZodObject")return!1;let n=r.shape;return n.componentId&&n.path})}var Av="root",Cc="/",Dc=new Map,Fs=class{constructor(e,r=e.defaultCatalog){if(this.records=new Map,this.nodesByEdge=new Map,this.nodesByComponentId=new Map,this.pendingParents=new Map,this.dispatchedErrors=new Map,this.modelSubs=[],this._disposed=!1,r!==e.defaultCatalog)throw new Rt("NodeResolver requires the same catalog instance its surface was constructed with.");this.surface=e,this.rootId=e.rootId??Av,this.rootNode=De(void 0),e.componentsModel?.onCreated&&this.modelSubs.push(e.componentsModel.onCreated.subscribe(n=>this.onComponentCreated(n))),e.componentsModel?.onDeleted&&this.modelSubs.push(e.componentsModel.onDeleted.subscribe(n=>this.onComponentDeleted(n))),e.componentsModel.get(this.rootId)&&this.buildRoot()}dispatchOnce(e,r,n,i){let o=this.dispatchedErrors.get(r);o||(o=new Map,this.dispatchedErrors.set(r,o));let s=o.get(n);s||(s=new Set,o.set(n,s)),!s.has(e)&&(s.add(e),this.surface.dispatchError({code:e,message:i}))}clearDispatched(e,r){let n=this.dispatchedErrors.get(e);n?.delete(r)&&n.size===0&&this.dispatchedErrors.delete(e)}get activeNodeCount(){return this.records.size}get disposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.modelSubs)e.unsubscribe();this.modelSubs.length=0;for(let e of[...this.records.keys()])this.disposeNode(e);this.pendingParents.clear(),this.dispatchedErrors.clear(),this.rootRecord=void 0,be(this.rootNode,void 0)}}buildRoot(){if(this.rootRecord)return;let e=`>${Pt(this.rootId)}>${Pt(this.rootId)}@/`,r=this.createNode(this.rootId,Cc,e,void 0);this.rootRecord=this.records.get(r),be(this.rootNode,r)}onComponentCreated(e){if(this._disposed)return;if(e.id===this.rootId){let n=this.surface.componentsModel.get(this.rootId);this.rootRecord&&this.rootRecord.componentModel!==n&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,n||be(this.rootNode,void 0)),n&&this.buildRoot()}let r=this.pendingParents.get(e.id);if(r){this.pendingParents.delete(e.id);for(let n of r){let i=this.records.get(n);i&&!n.disposed&&this.materialize(i)}}}onComponentDeleted(e){if(this._disposed)return;this.dispatchedErrors.delete(e);let r=this.surface.componentsModel.get(e),n=this.nodesByComponentId.get(e);if(!n)return;let i=new Set,o=!1;for(let s of[...n]){let a=this.records.get(s);a&&(a.parent?i.add(a.parent):o=!0)}o&&this.rootRecord&&(r?this.rootRecord.componentModel!==r&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,this.buildRoot()):(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,be(this.rootNode,void 0)));for(let s of i){let a=this.records.get(s);a&&!s.disposed&&this.materialize(a)}}createNode(e,r,n,i,o=1){let s=this.surface.componentsModel.get(e);if(!s){let h=this.registerNode(new Ur(ks(e,r,o),e,vc,r,{},void 0,void 0,"pending"),{edgeKey:n,parent:i,occurrence:o,refFields:Dc});return i&&this.registerPendingParent(e,i),h.node}let a=this.catalogFor(s),c=a.components.get(s.type);if(!c)return this.dispatchOnce("UNKNOWN_COMPONENT_TYPE",e,r,`Component '${e}' has type '${s.type}', which is not in catalog '${a.id}'.`),this.registerNode(new Ur(ks(e,r,o),e,s.type,r,{},void 0,void 0,"unknown-type",at(()=>ye(s.metadataSignal))),{edgeKey:n,parent:i,occurrence:o,refFields:Dc,componentModel:s}).node;this.clearDispatched(e,r);let u=new ki(this.surface,e,r,i?.context?.dataContext),l=new Fi(u,c.schema),f=this.registerNode(new Ur(ks(e,r,o),e,s.type,r,{},c,u,"resolved",at(()=>ye(s.metadataSignal))),{edgeKey:n,parent:i,occurrence:o,refFields:tf(c.schema),behavior:gc(c.schema),componentModel:s,binder:l});return f.binderSub=l.subscribe(h=>{f.lastBinderProps=h,this.materialize(f)}),f.lastBinderProps=l.snapshot,this.materialize(f),f.node}catalogFor(e){return e.catalog}registerNode(e,r){let n={node:e,edgeKey:r.edgeKey,parent:r.parent,occurrence:r.occurrence,refFields:r.refFields,behavior:r.behavior,componentModel:r.componentModel,binder:r.binder,childEdges:new Map};this.records.set(e,n),this.nodesByEdge.set(r.edgeKey,e);let i=this.nodesByComponentId.get(e.componentId);return i||(i=new Set,this.nodesByComponentId.set(e.componentId,i)),i.add(e),n}childNode(e,r,n,i,o=1){let s=this.nodesByEdge.get(n);if(this.isCyclic(e,r,i))return s&&!s.disposed&&s.isPlaceholder&&this.records.get(s)?.occurrence===o?s:(s&&!s.disposed&&this.disposeNode(s),this.dispatchOnce("CYCLIC_REFERENCE",e,r,`Component '${e}' at '${r}' is referenced by one of its own descendants; rendering a placeholder instead.`),this.registerNode(new Ur(ks(e,r,o),e,vc,r,{},void 0,void 0,"cyclic"),{edgeKey:n,parent:i,occurrence:o,refFields:Dc}).node);if(s&&!s.disposed){let a=this.surface.componentsModel.get(e),c=a?this.catalogFor(a).components.get(a.type):void 0,u=this.records.get(s);if(s.componentId===e&&s.dataPath===r&&u?.occurrence===o&&(s.isPlaceholder?a===void 0&&s.state==="pending"||a!==void 0&&c===void 0&&s.state==="unknown-type"&&u?.componentModel===a:a!==void 0&&s.type===a.type&&u?.componentModel===a))return s.state==="pending"&&this.registerPendingParent(e,i),s;this.disposeNode(s)}return this.createNode(e,r,n,i,o)}registerPendingParent(e,r){let n=this.pendingParents.get(e);n||(n=new Set,this.pendingParents.set(e,n)),n.add(r)}isCyclic(e,r,n){for(let i=n;i;i=this.records.get(i)?.parent)if(i.componentId===e&&i.dataPath===r)return!0;return!1}materialize(e){if(e.node.disposed)return;let n={...e.lastBinderProps??e.binder?.snapshot??{}},i=new Map,o=e.componentModel?.properties;if(o)for(let l of e.refFields.keys())l in n&&!(l in o)&&delete n[l];let s=new Map,a=(l,f,h)=>{let p=`${Pt(f)}@${Pt(h)}`,m=(s.get(p)??0)+1;s.set(p,m);let y=`${e.edgeKey}>${l}>${p}#${m}`,A=this.childNode(f,h,y,e.node,m);return i.set(y,A),A};for(let[l,f]of e.refFields)switch(f.kind){case"single":{let h=n[l];typeof h=="string"&&h&&(n[l]=a(Pt(l),h,e.node.dataPath));break}case"list":{let h=n[l];if(!Array.isArray(h))break;let p=yc(h),m=Pt(l);n[l]=p.map(y=>{if(typeof y=="string"&&y)return a(m,y,e.node.dataPath);if(y&&typeof y=="object"&&!Array.isArray(y)){let A=y;if(typeof A.id=="string"&&typeof A.basePath=="string")return a(m,A.id,A.basePath);if(typeof A.componentId=="string"&&A.componentId)return a(m,A.componentId,e.node.dataPath)}return y});break}case"nested":{let h=n[l];if(!Array.isArray(h))break;n[l]=h.map((p,m)=>{if(!p||typeof p!="object"||Array.isArray(p))return p;let y={...p},A=!1;for(let D of f.keys){let _=y[D];typeof _=="string"&&_&&(y[D]=a(`${Pt(l)}[${m}].${Pt(D)}`,_,e.node.dataPath),A=!0)}return A?y:p});break}}for(let[l,f]of e.childEdges)if(!i.has(l)&&(this.disposeNode(f),f.isPlaceholder&&![...i.values()].some(p=>p.isPlaceholder&&p.componentId===f.componentId))){let p=this.pendingParents.get(f.componentId);p&&(p.delete(e.node),p.size===0&&this.pendingParents.delete(f.componentId))}e.childEdges=i;let c=e.behavior&&e.node.context?wc(n,e.behavior,o??{},e.node.context.dataContext):n,u=ce(e.node.props);for(let l of Object.keys(c))c[l]=Ec(u[l],c[l]);e.node.setProps(c)}disposeNode(e){if(e.disposed)return;let r=this.records.get(e);if(r){for(let i of r.childEdges.values())this.disposeNode(i);r.childEdges.clear(),r.binderSub?.unsubscribe(),r.binderSub=void 0,this.nodesByEdge.get(r.edgeKey)===e&&this.nodesByEdge.delete(r.edgeKey),this.records.delete(e)}let n=this.nodesByComponentId.get(e.componentId);n&&(n.delete(e),n.size===0&&this.nodesByComponentId.delete(e.componentId));for(let[i,o]of this.pendingParents)o.delete(e),o.size===0&&this.pendingParents.delete(i);e.state==="cyclic"&&this.clearDispatched(e.componentId,e.dataPath),e.dispose()}},Dv={"~":"~0","#":"~1","[":"~2","]":"~3",">":"~4","@":"~5"};function Pt(t){return t.replace(/[~#[\]>@]/g,e=>Dv[e])}function ks(t,e,r){let n=e.replace(/\/+$/,"")||Cc,i=e===Cc?Pt(t):`${Pt(t)}-[${Pt(n)}]`;return r>1?`${i}#${r}`:i}function wc(t,e,r,n){switch(e.type){case"DYNAMIC":{let i=n.atLeastV10?"@path":"path",o=r&&typeof r=="object"&&!Array.isArray(r)?r:void 0,s=o&&typeof o[i]=="string"&&!("componentId"in o)?o[i]:void 0;return s===void 0?new Ge(t):new xo(t,a=>n.set(s,a),s)}case"ARRAY":{if(!Array.isArray(t))return t;let i=Array.isArray(r)?r:[];return t.map((o,s)=>wc(o,e.element,i[s],n))}case"OBJECT":{if(!t||typeof t!="object"||Array.isArray(t))return t;let i=new Set;for(let[a,c]of Object.entries(e.shape))c.type==="DYNAMIC"&&i.add(`set${a.charAt(0).toUpperCase()}${a.slice(1)}`);let o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s={};for(let[a,c]of Object.entries(t))i.has(a)||(s[a]=wc(c,e.shape[a]??{type:"STATIC"},o[a],n));for(let[a,c]of Object.entries(e.shape))c.type==="DYNAMIC"&&!(a in s)&&(s[a]=new Ge(void 0));return s}default:return t}}function Ec(t,e){if(Object.is(t,e))return e;if(t instanceof Ge&&e instanceof Ge)return Yd(t,e)?t:e;if(St(t)||St(e))return e;if(Array.isArray(t)&&Array.isArray(e)&&t.length===e.length){let r=!0,n=e.map((i,o)=>{let s=Ec(t[o],i);return Object.is(s,t[o])||(r=!1),s});return r?t:n}if(nf(t)&&nf(e)){let r=Object.keys(t),n=Object.keys(e);if(r.length===n.length){let i=!0,o={};for(let s of n){let a=Ec(t[s],e[s]);o[s]=a,(!(s in t)||!Object.is(a,t[s]))&&(i=!1)}return i?t:o}}return e}function nf(t){if(!t||typeof t!="object"||Array.isArray(t)||St(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}var of=1e4,sf=1e3,Cv=/^[+-]?(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,Ao=class t{parse(e,r=0){if(r>t.MAX_DEPTH)throw new K("Max recursion depth reached in parse");if(e&&e.length>of)throw new K(`Expression template length (${e.length}) exceeds maximum limit (${of})`);if(!e)return[];if(!e.includes("${"))return[e];let n=[],i=new $s(e);for(;!i.isAtEnd();){if(n.length>=sf)throw new K(`Expression parts count exceeds maximum limit (${sf})`);if(i.matches("${")){i.advance(2);let o=this.extractInterpolationContent(i),s=this.parseExpression(o,r+1);s!==null&&n.push(s)}else if(i.peek()==="\\"&&i.peek(1)==="$"&&i.peek(2)==="{")i.advance(),n.push("${"),i.advance(2);else{let o=i.pos;for(;!i.isAtEnd()&&!(i.matches("${")||i.peek()==="\\"&&i.peek(1)==="$"&&i.peek(2)==="{");)i.advance();n.push(i.input.substring(o,i.pos))}}return n.filter(o=>o!==null&&o!=="")}extractInterpolationContent(e){let r=e.pos,n=1;for(;!e.isAtEnd()&&n>0;){let i=e.advance();if(i==="{")n++;else if(i==="}")n--;else if(i==="'"||i==='"'){let o=i;for(;!e.isAtEnd();){let s=e.advance();if(s==="\\")e.advance();else if(s===o)break}}}if(n>0)throw new K("Unclosed interpolation: missing '}'");return e.input.substring(r,e.pos-1)}parseExpression(e,r=0){if(e=e.trim(),!e)return"";let n=new $s(e),i=this.parseExpressionInternal(n,r);if(!n.isAtEnd())throw new K(`Unexpected characters at end of expression: '${n.input.substring(n.pos)}'`);return i}parseExpressionInternal(e,r){if(r>t.MAX_DEPTH)throw new K("Max recursion depth reached in parse");if(e.skipWhitespace(),e.isAtEnd())return"";if(e.matches("${")){e.advance(2);let i=this.extractInterpolationContent(e);return this.parseExpression(i,r+1)}if(e.matchesString("'")||e.matchesString('"'))return this.parseStringLiteral(e);if(this.isNumberStart(e))return this.parseNumberLiteral(e);if(e.matchesKeyword("true"))return!0;if(e.matchesKeyword("false"))return!1;if(e.matchesKeyword("null"))return"";let n=this.scanPathOrIdentifier(e);if(e.skipWhitespace(),e.peek()==="(")return this.parseFunctionCall(n,e,r);if(n.startsWith("@"))throw new K(`Expected '(' after function name '${n}'`);return n?{path:n}:""}scanPathOrIdentifier(e){let r=e.pos;if(e.peek()==="@"){let n=e.peek(1);if(!n||!/[A-Za-z_]/.test(n))throw new K("Invalid identifier starting with '@' in expression");for(e.advance();!e.isAtEnd();){let i=e.peek();if(/[A-Za-z0-9_]/.test(i))e.advance();else break}return e.input.substring(r,e.pos)}for(;!e.isAtEnd();){let n=e.peek();if(Sc(n)||n==="/"||n==="."||n==="-")e.advance();else break}return e.input.substring(r,e.pos)}parseFunctionCall(e,r,n){r.match("("),r.skipWhitespace();let i={};for(;!r.isAtEnd()&&r.peek()!==")";){let o=this.scanIdentifier(r);if(r.skipWhitespace(),!r.match(":"))throw new K(`Expected ':' after argument name '${o}' in function '${e}'`);r.skipWhitespace(),i[o]=this.parseExpressionInternal(r,n+1),r.skipWhitespace(),r.peek()===","&&(r.advance(),r.skipWhitespace())}if(!r.match(")"))throw new K(`Expected ')' after function arguments for '${e}'`);return{call:e,args:i,returnType:"any"}}scanIdentifier(e){let r=e.pos;for(;!e.isAtEnd()&&Sc(e.peek());)e.advance();return e.input.substring(r,e.pos)}parseStringLiteral(e){let r=e.advance(),n="",i=!1;for(;!e.isAtEnd();){let o=e.advance();if(o==="\\"){if(e.isAtEnd())break;let s=e.advance();s==="n"?n+=`
6
+ `:s==="t"?n+=" ":s==="r"?n+="\r":n+=s}else if(o===r){i=!0;break}else n+=o}if(!i)throw new K(`Unclosed string literal: missing closing ${r}`);return n}isNumberStart(e){let r=0;return(e.peek()==="-"||e.peek()==="+")&&(r=1),this.isDigit(e.peek(r))?!0:e.peek(r)==="."&&this.isDigit(e.peek(r+1))}parseNumberLiteral(e){let r=e.pos;for((e.peek()==="-"||e.peek()==="+")&&e.advance();!e.isAtEnd()&&(this.isDigit(e.peek())||e.peek()===".");)e.advance();this.skipExponent(e);let n=e.input.substring(r,e.pos);if(!Cv.test(n))throw new K(`Invalid number literal: '${n}'`);let i=Number(n);if(!Number.isFinite(i))throw new K(`Number literal is out of range: '${n}'`);return i===0?0:i}skipExponent(e){if(!(e.isAtEnd()||e.peek()!=="e"&&e.peek()!=="E"))for(e.advance(),!e.isAtEnd()&&(e.peek()==="+"||e.peek()==="-")&&e.advance();!e.isAtEnd()&&this.isDigit(e.peek());)e.advance()}isDigit(e){return e>="0"&&e<="9"}};Ao.MAX_DEPTH=100;var wv=new RegExp("^\\p{XID_Continue}$","u");function Sc(t){return Array.from(t).length!==1?!1:wv.test(t)}var $s=class{constructor(e){this.input=e,this.pos=0}isAtEnd(){return this.pos>=this.input.length}peek(e=0){let r=this.pos+e;if(r>=this.input.length)return"\0";let n=this.input.codePointAt(r);return n===void 0?"\0":String.fromCodePoint(n)}advance(e){let r=e??(this.peek()==="\0"?1:this.peek().length),n=this.input.substring(this.pos,this.pos+r);return this.pos+=r,n}match(e){return this.peek()===e?(this.advance(),!0):!1}matches(e){return!!this.input.startsWith(e,this.pos)}matchesString(e){return this.peek()===e}matchesKeyword(e){if(this.input.startsWith(e,this.pos)){let r=this.peek(e.length);if(!Sc(r))return this.advance(e.length),!0}return!1}skipWhitespace(){for(;!this.isAtEnd()&&/\s/.test(this.peek());)this.advance()}};function $n(t){if(typeof t!="string")return;let e=t.trim();if(!e||e.startsWith("//")||e.startsWith("\\\\"))return;let r="https://example.invalid/",n;try{n=new URL(e,r)}catch{return}let i=(n.protocol==="http:"||n.protocol==="https:")&&(/^https?:\/\//i.test(e)||n.origin==="https://example.invalid"&&!/^https?:/i.test(e.replace(/[\t\n\r]/g,"")));if(!(n.protocol!=="data:"&&!i))return e}var Fe=function(){return Fe=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},Fe.apply(this,arguments)};function he(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){r.label=u[1];break}if(u[0]===6&&r.label<o[1]){r.label=o[1],o=u;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(u);break}o[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Ne(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function V(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function N(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}var gf={exports:{}};(function(t){(function(){var e=String.fromCodePoint||(function(){var i=String.fromCharCode,o=Math.floor;return function(){var a=16384,c=[],u,l,f=-1,h=arguments.length;if(!h)return"";for(var p="";++f<h;){var m=Number(arguments[f]);if(!isFinite(m)||m<0||m>1114111||o(m)!=m)throw RangeError("Invalid code point: "+m);m<=65535?c.push(m):(m-=65536,u=(m>>10)+55296,l=m%1024+56320,c.push(u,l)),(f+1==h||c.length>a)&&(p+=i.apply(null,c),c.length=0)}return p}})();function r(i,o,s){s||(s={});function a(g,b){return g.range[0]=b,g.raw=i.substring(b,g.range[1]),g}function c(g,b){return{type:"anchor",kind:g,range:[C-b,C],raw:i.substring(C-b,C)}}function u(g,b,v,x){return{type:"value",kind:g,codePoint:b,range:[v,x],raw:i.substring(v,x)}}function l(g,b,v,x){return x=x||0,u(g,b,C-(v.length+x),C)}function f(g){var b=g[0],v=b.charCodeAt(0);if(xe){var x;if(b.length===1&&v>=55296&&v<=56319&&(x=z().charCodeAt(0),x>=56320&&x<=57343))return C++,u("symbol",(v-55296)*1024+x-56320+65536,C-2,C)}return u("symbol",v,C-1,C)}function h(g,b,v){return{type:"disjunction",body:g,range:[b,v],raw:i.substring(b,v)}}function p(){return{type:"dot",range:[C-1,C],raw:"."}}function m(g){return{type:"characterClassEscape",value:g,range:[C-2,C],raw:i.substring(C-2,C)}}function y(g){var b=C-1-g.length;return{type:"reference",matchIndex:parseInt(g,10),range:[b,C],raw:i.substring(b,C)}}function A(g){var b=g.range[0]-3;return{type:"reference",name:g,range:[b,C],raw:i.substring(b,C)}}function D(g,b,v,x){return{type:"group",behavior:g,body:b,range:[v,x],raw:i.substring(v,x)}}function _(g,b,v,x,Z){return x==null&&(v=C-1,x=C),{type:"quantifier",min:g,max:b,greedy:!0,body:null,symbol:Z,range:[v,x],raw:i.substring(v,x)}}function q(g,b,v){return{type:"alternative",body:g,range:[b,v],raw:i.substring(b,v)}}function j(g,b,v,x){return{type:"characterClass",kind:g.kind,body:g.body,negative:b,range:[v,x],raw:i.substring(v,x)}}function I(g,b,v,x){return g.codePoint>b.codePoint&&X("invalid range in character class",g.raw+"-"+b.raw,v,x),{type:"characterClassRange",min:g,max:b,range:[v,x],raw:i.substring(v,x)}}function P(g,b,v){return{type:"classStrings",strings:g,range:[b,v],raw:i.substring(b,v)}}function M(g,b,v){return{type:"classString",characters:g,range:[b,v],raw:i.substring(b,v)}}function U(g){return g.type==="alternative"?g.body:[g]}function T(g){g=g||1,C+=g}function ae(g){var b=i.substring(C,C+=g);return b}function te(g){re(g)||X("character",g)}function re(g){var b=g.length;if(i.substring(C,C+b)===g)return T(b),g}function ne(g){if(i[C]===g)return C++,g}function z(){return i[C]}function J(g){return i[C]===g}function nt(g){var b=g.length;return i.substring(C,C+b)===g}function Re(g){return i[C+1]===g}function ue(g){var b=i.substring(C),v=b.match(g);return v&&(C+=v[0].length),v}function Ke(){var g=[],b=C;for(g.push(Me());ne("|");)g.push(Me());return g.length===1?g[0]:h(g,b,C)}function Me(){for(var g=[],b=C,v;v=Je();)g.push(v);return g.length===1?g[0]:q(g,b,C)}function Je(){if(C>=i.length||J("|")||J(")"))return null;var g=nr(),b;if(g){var v=C;if(b=_t()||!1,b){if(!xe&&g.type==="group")return b.body=U(g),a(b,g.range[0]),b;C=v,X("Expected atom")}return g}var x=Ue();if(x||(v=C,b=_t()||!1,b&&(C=v,X("Expected atom")),!xe&&ne("{")?x=f("{"):X("Expected atom")),b=_t()||!1,b){var Z=x.type,le=x.behavior;return Z==="group"&&(le==="negativeLookbehind"||le==="lookbehind")&&X("Invalid quantifier","",b.range[0],b.range[1]),b.body=U(x),a(b,x.range[0]),b}return x}function dt(g,b,v,x){var Z=null,le=C;if(re(g))Z=b;else if(re(v))Z=x;else return!1;return de(Z,le)}function de(g,b){var v=Ke();v||X("Expected disjunction"),te(")");var x=D(g,U(v),b,C);return g=="normal"&&ii&&Dr++,x}function nr(){switch(z()){case"^":return T(),c("start",1);case"$":return T(),c("end",1);case"\\":{if(Re("b"))return T(2),c("boundary",2);if(Re("B"))return T(2),c("not-boundary",2);break}case"(":return dt("(?=","lookahead","(?!","negativeLookahead");default:return}}function _t(){var g,b=C,v,x,Z;switch(z()){case"*":T(),v=_(0,void 0,void 0,void 0,"*");break;case"+":T(),v=_(1,void 0,void 0,void 0,"+");break;case"?":T(),v=_(0,1,void 0,void 0,"?");break;case"{":(g=ue(/^\{(\d+)\}/))?(x=parseInt(g[1],10),v=_(x,x,b,C)):(g=ue(/^\{(\d+),\}/))?(x=parseInt(g[1],10),v=_(x,void 0,b,C)):(g=ue(/^\{(\d+),(\d+)\}/))&&(x=parseInt(g[1],10),Z=parseInt(g[2],10),x>Z&&X("numbers out of order in {} quantifier","",b,C),v=_(x,Z,b,C)),(x&&!Number.isSafeInteger(x)||Z&&!Number.isSafeInteger(Z))&&X("iterations outside JS safe integer range in quantifier","",b,C)}return v&&ne("?")&&(v.greedy=!1,v.range[1]+=1),v}function Ue(){var g;switch(g=z()){case".":return T(),p();case"\\":{if(T(),g=ir(),!g){if(!xe&&z()=="c")return u("symbol",92,C-1,C);X("atomEscape")}return g}case"[":return It();case"(":{if(s.lookbehind&&(g=dt("(?<=","lookbehind","(?<!","negativeLookbehind")))return g;if(s.namedGroups&&re("(?<")){var b=Ce();te(">");var v=de("normal",b.range[0]-3);return v.name=b,v}else return s.modifiers&&nt("(?")&&i[C+2]!=":"?Mt():dt("(?:","ignore","(","normal")}case"]":case"}":if(!xe)return T(),f(g);break;case"^":case"$":case"*":case"+":case"?":case"{":case")":case"|":break;default:return T(),f(g)}}function Mt(){function g(qe){for(var Ft=0;Ft<qe.length;){if(qe.indexOf(qe[Ft],Ft+1)!=-1)return!0;Ft++}return!1}var b=C;T(2);var v=ue(/^[sim]+/),x;ne("-")&&z()!==":"?(x=ue(/^[sim]+/),x||X("Invalid flags for modifiers group")):v||X("Invalid flags for modifiers group"),v=v?v[0]:"",x=x?x[0]:"";var Z=v+x;(Z.length>3||g(Z))&&X("flags cannot be duplicated for modifiers group"),ne(":")||X("Invalid flags for modifiers group");var le=de("ignore",b);return le.modifierFlags={enabling:v,disabling:x},le}function Ye(g,b){if(b){var v,x;if(g.kind=="unicodeEscape"&&(v=g.codePoint)>=55296&&v<=56319&&J("\\")&&Re("u")){var Z=C;C++;var le=ze();le.kind=="unicodeEscape"&&(x=le.codePoint)>=56320&&x<=57343?(g.kind="unicodeCodePointEscape",g.codePoint=(v-55296)*1024+x-56320+65536,g.range[1]=C,g.raw=i.substring(g.range[0],C)):C=Z}}return g}function ze(){return ir(!0)}function ir(g){var b,v=C,x;switch(x=z()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return Lt(g);case"B":if(g){X("\\B not possible inside of CharacterClass","",v);break}else return ht();case"b":return g?(T(),l("singleEscape",8,"\\b")):ht();case"c":{if(g){if(!xe&&(b=ue(/^c(\d)/)))return l("controlLetter",b[1]+16,b[1],2);if(!xe&&re("c_"))return l("controlLetter",31,"_",2)}return ft()}case"d":case"D":case"w":case"W":case"s":case"S":return T(),m(x);case"k":return Xr()||ht();case"p":case"P":return Bt()||ht();case"-":return g&&xe?(T(),l("singleEscape",45,"\\-")):ht();default:return ft()}}function Lt(g){var b,v,x=C;if(b=ue(/^(?!0)\d+/)){v=b[0];var Z=parseInt(b[0],10);if(Z<=Dr&&!g)return y(b[0]);if(zi.push(Z),ii?Qr=!0:Le(x,C),T(-b[0].length),b=ue(/^[0-7]{1,3}/))return l("octal",parseInt(b[0],8),b[0],1);var le=C;return b=f(ue(/^[89]/)),a(b,le-1)}else if(b=ue(/^[0-7]{1,3}/))return v=b[0],v!=="0"&&Le(x,C),/^0{1,3}$/.test(v)?l("null",0,"0",v.length):l("octal",parseInt(v,8),v,1);return!1}function Le(g,b){xe&&X("Invalid decimal escape in unicode mode",null,g,b)}function Bt(){var g,b=C;return s.unicodePropertyEscape&&xe&&(g=ue(/^([pP])\{([^}]+)\}/))?{type:"unicodePropertyEscape",negative:g[1]==="P",value:g[2],range:[b-1,C],raw:i.substring(b-1,C)}:!1}function Xr(){if(s.namedGroups&&ue(/^k<(?=.*?>)/)){var g=Ce();return te(">"),A(g)}}function Vt(g){var b;if(b=ue(/^u([0-9a-fA-F]{4})/))return Ye(l("unicodeEscape",parseInt(b[1],16),b[1],2),g);if(g&&(b=ue(/^u\{([0-9a-fA-F]+)\}/)))return l("unicodeCodePointEscape",parseInt(b[1],16),b[1],4)}function ft(){var g,b=C;switch(z()){case"t":return T(),l("singleEscape",9,"\\t");case"n":return T(),l("singleEscape",10,"\\n");case"v":return T(),l("singleEscape",11,"\\v");case"f":return T(),l("singleEscape",12,"\\f");case"r":return T(),l("singleEscape",13,"\\r");case"c":if(g=ue(/^c([a-zA-Z])/))return l("controlLetter",g[1].charCodeAt(0)%32,g[1],2);break;case"x":if(g=ue(/^x([0-9a-fA-F]{2})/))return l("hexadecimalEscape",parseInt(g[1],16),g[1],2);break;case"u":if(g=Vt(xe))return(!g||g.codePoint>1114111)&&X("Invalid escape sequence",null,b,C),g;break}return ht()}function it(g){var b=z(),v=C;if(b==="\\"){T();var x=Vt(!0);return(!x||!g(x.codePoint))&&X("Invalid escape sequence",null,v,C),e(x.codePoint)}var Z=b.charCodeAt(0);if(Z>=55296&&Z<=56319){b+=i[C+1];var le=b.charCodeAt(1);le>=56320&&le<=57343&&(Z=(Z-55296)*1024+le-56320+65536)}if(g(Z))return T(),Z>65535&&T(),b}function Ce(){var g=C,b=it(ve);b||X("Invalid identifier");for(var v;v=it(pt);)b+=v;return{type:"identifier",value:b,range:[g,C],raw:i.substring(g,C)}}function ve(g){var b=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/;return g===36||g===95||g>=65&&g<=90||g>=97&&g<=122||g>=128&&b.test(e(g))}function pt(g){var b=/[\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD30-\uDD39\uDD40-\uDD49\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC66-\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDCF0-\uDCF9\uDD00-\uDD02\uDD27-\uDD34\uDD36-\uDD3F\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE-\uDDD9\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD0\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC50-\uDC59\uDC5E\uDCB0-\uDCC3\uDCD0-\uDCD9\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDE50-\uDE59\uDEAB-\uDEB7\uDEC0-\uDEC9\uDED0-\uDEE3\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC2C-\uDC3A\uDCE0-\uDCE9\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDD50-\uDD59\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99\uDF60-\uDF67\uDFF0-\uDFF9]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC50-\uDC59\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD50-\uDD59\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDDA0-\uDDA9\uDDE0-\uDDE9\uDEF3-\uDEF6\uDF00\uDF01\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD39]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDEF0-\uDEF4\uDF30-\uDF36\uDF50-\uDF59]|\uD81B[\uDD70-\uDD79\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDD40-\uDD49\uDEAE\uDEEC-\uDEF9]|\uD839[\uDCEC-\uDCF9\uDDEE\uDDEF\uDDF1-\uDDFA\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]|\uDB40[\uDD00-\uDDEF]/;return ve(g)||g>=48&&g<=57||g>=128&&b.test(e(g))}function ht(){var g,b=z();return xe&&/[\^$.*+?()\\[\]{}|/]/.test(b)||!xe&&b!=="c"?b==="k"&&s.lookbehind?null:(g=ae(1),l("identifier",g.charCodeAt(0),g,1)):null}function It(){var g,b=C;return(g=re("[^"))?(g=mt(),te("]"),j(g,!0,b,C)):ne("[")?(g=mt(),te("]"),j(g,!1,b,C)):null}function mt(){var g;return J("]")?{kind:"union",body:[]}:tn?Uo():(g=Lo(),g||X("nonEmptyClassRanges"),{kind:"union",body:g})}function Te(g){var b,v,x,Z,le;if(J("-")&&!Re("]")){b=g.range[0],T(),le=f("-"),Z=kt(),Z||X("classAtom"),v=C;var qe=mt();return qe||X("classContents"),!("codePoint"in g)||!("codePoint"in Z)?xe?X("invalid character class"):x=[g,le,Z]:x=[I(g,Z,b,v)],qe.type==="empty"?x:x.concat(qe.body)}return x=Bo(),x||X("nonEmptyClassRangesNoDash"),[g].concat(x)}function Lo(){var g=kt();return g||X("classAtom"),J("]")?[g]:Te(g)}function Bo(){var g=kt();return g||X("classAtom"),J("]")?g:Te(g)}function kt(){return ne("-")?f("-"):Vo()}function Vo(){var g;switch(g=z()){case"\\":{if(T(),g=ze(),!g){if(!xe&&z()=="c")return f("\\");X("classEscape")}return Ye(g,xe)}case"]":case"-":break;default:return T(),f(g)}}function Uo(){var g=[],b,v=ei(!0);for(g.push(v),v.type==="classRange"?b="union":J("&")?b="intersection":J("-")?b="subtraction":b="union";!J("]");)b==="intersection"?(te("&"),te("&"),J("&")&&X("&& cannot be followed by &. Wrap it in brackets: &&[&].")):b==="subtraction"&&(te("-"),te("-")),v=ei(b==="union"),g.push(v);return{kind:b,body:g}}function ei(g){var b=C,v,x;if(ne("\\")){if(re("q{"))return zo();if(x=ze())v=x;else{if(x=Ui())return x;X("Invalid escape","\\"+z(),b)}}else if(x=ri())v=x;else{if(x=It())return x;X("Invalid character",z())}if(g&&J("-")&&!Re("-")){if(T(),x=ti())return I(v,x,b,C);X("Invalid range end",z())}return v}function ti(){if(ne("\\")){var g,b=C;if(g=Ui())return g;X("Invalid escape","\\"+z(),b)}return ri()}function ri(){var g;if(ue(/^(?:&&|!!|##|\$\$|%%|\*\*|\+\+|,,|\.\.|::|;;|<<|==|>>|\?\?|@@|\^\^|``|~~)/)&&X("Invalid set operation in character class"),g=ue(/^[^()[\]{}/\-\\|]/))return f(g)}function Ui(){var g;if(ne("b"))return l("singleEscape",8,"\\b");if(ne("B"))X("\\B not possible inside of ClassContents","",C-2);else return(g=ue(/^[&\-!#%,:;<=>@`~]/))?l("identifier",g[0].codePointAt(0),g[0]):(g=ft())?g:null}function zo(){var g=C-3,b=[];do b.push(ni());while(ne("|"));return te("}"),P(b,g,C)}function ni(){for(var g=[],b=C,v;v=ti();)g.push(v);return M(g,b,C)}function X(g,b,v,x){v=v??C,x=x??v;var Z=Math.max(0,v-10),le=Math.min(x+10,i.length),qe=" "+i.substring(Z,le),Ft=" "+new Array(v-Z+1).join(" ")+"^";throw SyntaxError(g+" at position "+v+(b?": "+b:"")+`
7
+ `+qe+`
8
+ `+Ft)}var zi=[],Dr=0,ii=!0,Qr=!1,en=(o||"").indexOf("u")!==-1,tn=(o||"").indexOf("v")!==-1,xe=en||tn,C=0;if(tn&&!s.unicodeSet)throw new Error('The "v" flag is only supported when the .unicodeSet option is enabled.');if(en&&tn)throw new Error('The "u" and "v" flags are mutually exclusive.');i=String(i),i===""&&(i="(?:)");var Cr=Ke();return Cr.range[1]!==i.length&&X("Could not parse entire input - got stuck","",Cr.range[1]),Qr=Qr||zi.some(function(g){return g<=Dr}),Qr?(C=0,ii=!1,Ke()):Cr}var n={parse:r};t.exports?t.exports=n:window.regjsparser=n})()})(gf);var Ev=gf.exports;function yf(t,e){var r=Ev.parse(t,e?"u":"",{lookbehind:!0,unicodePropertyEscape:!0});return r}function _c(t){var e=t.length;return e?t[e-1]:null}function bf(t,e){var r;for(r=0;r<t.length&&r<e.length&&t[r]===e[r];r++);return{a:t.slice(r),b:e.slice(r)}}var af=["lookahead","lookbehind","negativeLookahead","negativeLookbehind"];function Sv(t,e,r,n){return"".concat(t.slice(0,r)).concat(e).concat(t.slice(n))}function cf(t){var e=t.after,r=t.offsets,n=t.shiftAmount;return new Set(N([],V(r),!1).map(function(i){return i>e?i+n:i}))}function _v(t){return t.symbol?"".concat(t.symbol).concat(t.greedy?"":"?"):t.min===t.max?"{".concat(t.min,"}"):"{".concat(t.min,",").concat(t.max||"","}").concat(t.greedy?"":"?")}function vf(t){if(t.type!=="alternative")return!1;var e=t.body;if(e.length<1)return!1;var r=V(e,1),n=r[0];if(n.type!=="quantifier"||n.min!==0||n.max!==void 0||n.greedy)return!1;var i=n.body[0];return!(i.type!=="characterClass"||(i.kind,i.body.length!==0)||!i.negative)}function Iv(t){if(vf(t))return!1;var e=function(r){var n,i;if(r.type==="anchor")return r.kind==="start"?"anchor":null;if(r.type==="quantifier"&&r.max===0)return null;if(r.type==="alternative"||r.type==="group"||r.type==="quantifier"){var o=r.type==="quantifier"&&r.min===0;try{for(var s=Ne(r.body),a=s.next();!a.done;a=s.next()){var c=a.value,u=e(c);if(u==="consumingNode")return"consumingNode";if(u==="anchor")return o?null:"anchor"}}catch(l){n={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return null}if(r.type==="disjunction"){var u=r.body.map(function(f){return e(f)});return u.some(function(f){return f==="consumingNode"})?"consumingNode":u.every(function(f){return f==="anchor"})?"anchor":null}return"consumingNode"};return e(t)==="consumingNode"}function kv(t){var e=new Map,r=function(i,o){var s=function(c,u){var l="";return c.forEach(function(f){l+=r(f,u+l.length)}),l};switch(i.type){case"anchor":case"characterClass":case"characterClassEscape":case"unicodePropertyEscape":case"value":case"dot":return i.raw;case"reference":return e.set(i,o),i.raw;case"group":switch(i.behavior){case"normal":return"(?:".concat(s(i.body,o+3),")");case"ignore":return"(?:".concat(s(i.body,o+3),")");case"lookahead":case"lookbehind":case"negativeLookahead":case"negativeLookbehind":return""}case"disjunction":{var a="";return i.body.forEach(function(c,u){u>0&&(a+="|"),a+=r(c,o+a.length)}),a}case"alternative":return s(i.body,o);case"quantifier":return"".concat(r(i.body[0],o)).concat(_v(i))}},n=r(t,0);return{referencesWithOffset:e,result:n}}function Fv(t){for(var e=t.pattern,r=t.unicode,n=function(c){var u=yf(c.pattern,r),l=[],f=!1,h=u.type==="disjunction",p=new Map,m=new Set,y=1,A=function(P,M){if(P.body.length!==1)return!1;var U=P.body[0];return U===M},D=function(P){var M=P.nodeStack,U=P.nodes,T=P.passedStartAnchor,ae=P.serial,te=null;U.forEach(function(re){ae?(_({immediatelyPrecedingLookahead:te,node:re,nodeStack:M,passedStartAnchor:T}),te=re.type==="group"&&re.behavior==="lookahead"?re:null):_({immediatelyPrecedingLookahead:te,node:re,nodeStack:M,passedStartAnchor:Fe({},T)})})},_=function(P){var M=P.immediatelyPrecedingLookahead,U=P.node,T=P.nodeStack,ae=P.passedStartAnchor,te=function(){ae.value||(f=!0)};switch(U.type){case"characterClass":case"characterClassEscape":case"unicodePropertyEscape":case"value":case"dot":te();return;case"anchor":{U.kind==="start"&&(ae.value=!0);return}case"group":{var re=null;U.behavior==="normal"&&(re=y,y++),D({nodeStack:N(N([],V(T),!1),[U],!1),nodes:U.body,passedStartAnchor:ae,serial:!0}),re!==null&&U.behavior==="normal"&&p.set(re,{group:U,stack:N([],V(T),!1)});return}case"disjunction":{D({nodeStack:N(N([],V(T),!1),[U],!1),nodes:U.body,passedStartAnchor:ae,serial:!1});return}case"alternative":{D({nodeStack:N(N([],V(T),!1),[U],!1),nodes:U.body,passedStartAnchor:ae,serial:!0});return}case"quantifier":{U.max!==0&&(U.max===void 0&&N([],V(T),!1).reverse().some(function(de){if(de.type==="group"){if(af.indexOf(de.behavior)>=0)return!0;m.add(de)}return!1}),D({nodeStack:N(N([],V(T),!1),[U],!1),nodes:U.body,passedStartAnchor:U.min===0?Fe({},ae):ae,serial:!0}));return}case"reference":{te();var ne=p.get(U.matchIndex);if(ne){var z=ne.group,J=ne.stack,nt=bf(J,T).a,Re=nt.flatMap(function(de){return de.type==="group"&&af.indexOf(de.behavior)>=0?[de]:[]}),ue=nt.some(function(de){return de.type==="disjunction"||de.type==="quantifier"&&de.min===0}),Ke=Re.length>0,Me=Re.every(function(de){return de.behavior!=="negativeLookahead"&&de.behavior!=="negativeLookbehind"});if(Me&&(Ke||m.has(z))){var Je=!!M&&A(M,z),dt=Ke&&ue;l.push({atomicOrOptional:Je?"atomic":dt?"optional":null,group:z,reference:U})}}return}}};_({immediatelyPrecedingLookahead:null,node:u,nodeStack:[],passedStartAnchor:{value:!1}});var q=c.pattern,j=new Set(c.atomicGroupOffsets),I=!1;return N([],V(l),!1).sort(function(P,M){return M.reference.range[0]-P.reference.range[0]}).forEach(function(P){var M=P.atomicOrOptional,U=P.group,T=V(P.reference.range,2),ae=T[0],te=T[1],re=kv(U),ne=re.result,z=re.referencesWithOffset;z.size>0&&(I=!0);var J=M==="optional"?"(?:".concat(ne,"?)"):ne;q=Sv(q,J,ae,te);var nt=J.length-(te-ae);j=cf({after:ae,offsets:j,shiftAmount:nt}),M==="atomic"&&j.add(ae),l.forEach(function(Re){var ue=Re.atomicOrOptional,Ke=Re.reference;if(ue==="atomic"){var Me=z.get(Ke);Me!==void 0&&j.add(ae+Me)}})}),f&&!vf(u)&&(h&&(q="(?:".concat(q,")")),q="[^]*?".concat(q),j=cf({after:-1,offsets:j,shiftAmount:h?8:5})),{needToRerun:I,result:{atomicGroupOffsets:j,pattern:q}}},i={atomicGroupOffsets:new Set,pattern:e};;){var o=n(i),s=o.result,a=o.needToRerun;if(i=s,!a)break}return i}function $v(t){return new FinalizationRegistry(t)}var Fc=Symbol("fork"),Rs=Symbol("pendingResults");function Rv(t){var e=new Set,r=$v(function(o){e.delete(o)}),n=function(){var o=t.next();e.forEach(function(s){return s(o)})},i=function(o){var s,a=(s={},s[Fc]=function(){return i(this[Rs])},s[Rs]=o.slice(0),s.next=function(l){if(l!==void 0)throw new Error("`ForkableIterator` `next()` cannot take a value");var f=this[Rs];return f.length||n(),f.shift()},s),c=new WeakRef(a),u=function(l){var f=c.deref();f?.[Rs].push(l)};return r.register(a,u),e.add(u),a};return i([])}function Ts(t){if(!t||!t[Fc])throw new Error("The provided value was not a `ForkableIterator` from `buildForkableIterator()`");return t[Fc]()}function Tv(){return he(this,function(t){return[2]})}function Oi(t){return Rv(t)}function Ov(t){var e,r,n,i,o,s,a;return he(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]),e=Ne(t),r=e.next(),c.label=1;case 1:if(r.done)return[3,5];n=r.value,i=void 0,c.label=2;case 2:return(i=n.next()).done?[3,4]:[4,i.value];case 3:return c.sent(),[3,2];case 4:return r=e.next(),[3,1];case 5:return[3,8];case 6:return o=c.sent(),s={error:o},[3,8];case 7:try{r&&!r.done&&(a=e.return)&&a.call(e)}finally{if(s)throw s.error}return[7];case 8:return[2]}})}function wo(t){return he(this,function(e){switch(e.label){case 0:return[5,Ne(t)];case 1:return e.sent(),[2]}})}function uf(t,e){var r=[];return t[0]<e[0]&&r.push([t[0],Math.min(e[0]-1,t[1])]),t[1]>e[1]&&r.push([Math.max(e[1]+1,t[0]),t[1]]),r}function Nv(t,e){var r=Math.max(t[0],e[0]),n=Math.min(t[1],e[1]);return r>n?null:[r,n]}function jv(t){for(var e=N([],V(t),!1).sort(function(c,u){return c-u}),r=[],n=0,i=0;i<e.length;i++){var o=e[n],s=e[i],a=i+1<e.length?e[i+1]:null;(a===null||a-o!==i-n+1)&&(r.push([o,s]),n=i+1)}return r}function Nc(t){for(var e=[],r=0;r<t.length+1;r++){var n=r-1>=0?t[r-1]:null,i=r<t.length?t[r]:null,o=n?n[1]+1:-1/0,s=i?i[0]-1:1/0;if(o-s!==1){if(o>s)throw new Error("Internal error: invalid ranges input");e.push([o,s])}}return e}function jc(t){return!t.rangesNegated&&!t.ranges.length&&!t.unicodePropertyEscapes.size}function Pc(t,e){var r,n,i,o,s,a;t.rangesNegated?e.rangesNegated?(a=!0,s=N(N([],V(t.ranges),!1),V(e.ranges),!1)):(a=!1,s=N([],V(e.ranges),!1),t.ranges.forEach(function(y){var A=[];s.forEach(function(D){A.push.apply(A,N([],V(uf(D,y)),!1))}),s=A})):e.rangesNegated?(a=!1,s=N([],V(t.ranges),!1),e.ranges.forEach(function(y){var A=[];s.forEach(function(D){A.push.apply(A,N([],V(uf(D,y)),!1))}),s=A})):(a=!1,s=[],t.ranges.forEach(function(y){e.ranges.forEach(function(A){var D=Nv(y,A);D&&s.push(D)})}));var c=new Set(N(N([],V(t.unicodePropertyEscapes.keys()),!1),V(e.unicodePropertyEscapes.keys()),!1)),u=new Map;try{for(var l=Ne(c),f=l.next();!f.done;f=l.next()){var h=f.value,p=(i=t.unicodePropertyEscapes.get(h))!==null&&i!==void 0?i:null,m=(o=e.unicodePropertyEscapes.get(h))!==null&&o!==void 0?o:null;p!==null&&m===null?u.set(h,p):p===null&&m!==null?u.set(h,m):p!==null&&m!==null&&p===m&&u.set(h,p)}}catch(y){r={error:y}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return{ranges:s,rangesNegated:a,unicodePropertyEscapes:u}}function Pv(t){return he(this,function(e){switch(e.label){case 0:return[4,{bounded:!1,offset:t,stack:[],subType:"end",type:ut}];case 1:throw e.sent(),new Error("Internal error: should not be reading after end")}})}function xf(t,e){var r=function(n,i,o){var s,a,c,u,l,f;return o===void 0&&(o=0),he(this,function(h){switch(h.label){case 0:s=0,h.label=1;case 1:return a=n(s,o),a!=="stop"?[3,2]:[2];case 2:return a!=="fork"?[3,4]:[4,{reader:function(){return Tv()},subType:null,type:zr}];case 3:h.sent(),h.label=4;case 4:c=!1,u=i(s),l=void 0,f=function(){var p,m,y,A;return he(this,function(D){switch(D.label){case 0:switch(p=l.value,m=p.type,m){case zr:return[3,1];case ut:return[3,3]}return[3,5];case 1:return y=s,A=o,[4,{reader:function(){return r(function(_,q){return _===0?"continue":n(_+y,q)},function(_){return _===0?p.reader():i(_+y)},A)},subType:p.subType,type:zr}];case 2:return D.sent(),[3,5];case 3:return p.subType!=="null"&&p.subType!=="start"&&p.subType!=="end"&&(c=!0),[4,p];case 4:return D.sent(),[3,5];case 5:return[2]}})},h.label=5;case 5:return(l=u.next()).done?[3,7]:[5,f()];case 6:return h.sent(),[3,5];case 7:o=c?0:o+1,h.label=8;case 8:return s++,[3,1];case 9:return[2]}})};return r(t,e)}function Os(t){var e=t.length;return xf(function(r){return r<e?"continue":"stop"},function(r){return t[r]()})}function $c(t){var e=t.caseInsensitive,r=t.dotAll,n=t.nodes;return Os(n.map(function(i){return function(){return Co({caseInsensitive:e,dotAll:r,node:i})}}))}function Rc(t,e){var r=function(n){var i,o;return he(this,function(s){switch(s.label){case 0:o=function(){var a,c;return he(this,function(u){switch(u.label){case 0:switch(a=i.value,c=a.type,c){case zr:return[3,1];case ut:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return r(a.reader())},subType:a.subType,type:zr}];case 2:return u.sent(),[3,5];case 3:return[4,e(a)];case 4:return u.sent(),[3,5];case 5:return[2]}})},s.label=1;case 1:return(i=n.next()).done?[3,3]:[5,o()];case 2:return s.sent(),[3,1];case 3:return[2]}})};return r(t)}function Mv(t){return new Set(t.flatMap(function(e){return e.type==="group"?[e.group]:[]}))}function Lv(t){var e,r,n=[];try{for(var i=Ne(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(s.type==="group"){var a=s.group,c=a.behavior;(c==="lookbehind"||c==="negativeLookbehind"||c==="negativeLookahead"||c==="lookahead")&&n.push(a)}}}catch(u){e={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}function Bv(t){var e=t.caseInsensitive,r=t.dotAll,n=t.node;switch(n.behavior){case"lookbehind":case"negativeLookbehind":case"lookahead":case"negativeLookahead":return wo([{reader:function(){return Os([function(){return Rc($c({caseInsensitive:e,dotAll:r,nodes:n.body}),function(i){return Fe(Fe({},i),{stack:N([{group:n,type:"group"}],V(i.stack),!1)})})},function(){return Pv(n.range[1])}])},subType:n.behavior,type:zr}]);case"ignore":case"normal":return Rc($c({caseInsensitive:e,dotAll:r,nodes:n.body}),function(i){return Fe(Fe({},i),{stack:N([{group:n,type:"group"}],V(i.stack),!1)})})}}function lf(t){return he(this,function(e){switch(e.label){case 0:return[4,{offset:t,stack:[],subType:"null",type:ut}];case 1:return e.sent(),[2]}})}function Do(t,e){if(!t.has(e))throw new Error("Internal error: map missing key");return t.get(e)}function Vv(t,e){var r=t.some(function(n){if(n.type!=="group"||n.group.behavior!=="normal")return!1;var i=Do(e.capturingGroupToIndex,n.group),o=e.reachableReferences.some(function(s){return s.matchIndex===i});return o});return r?new Set:new Set(t.flatMap(function(n){return n.type==="quantifier"?[n]:[]}).filter(function(n){var i=n.iteration,o=n.quantifier;return i>=1&&i>=o.min}).map(function(n){var i=n.quantifier;return i}))}function Uv(t){var e=new Map;return t.flatMap(function(r){return r.type==="quantifier"?[r]:[]}).forEach(function(r){var n=r.iteration,i=r.quantifier;return e.set(i,n)}),e}function zv(t){var e=t.caseInsensitive,r=t.dotAll,n=t.node,i=n.min,o=n.max,s=o===void 0?1/0:o;return Os([function(){return lf(n.body[0].range[0])},function(){return xf(function(a,c){return c>1||a>=s?"stop":a>=i?"fork":"continue"},function(a){return Rc(Os(N(N([],V(a>0?[function(){return lf(n.body[0].range[0])}]:[]),!1),[function(){return Co({caseInsensitive:e,dotAll:r,node:n.body[0]})}],!1)),function(c){return Fe(Fe({},c),{stack:N([{iteration:a,quantifier:n,type:"quantifier"}],V(c.stack),!1)})})})}])}function qv(t){var e;return he(this,function(r){switch(r.label){case 0:switch(e=t.kind,e){case"end":return[3,1];case"start":return[3,3];case"boundary":return[3,5];case"not-boundary":return[3,5]}return[3,6];case 1:return[4,{bounded:!0,offset:t.range[0],stack:[],subType:"end",type:ut}];case 2:throw r.sent(),new Error("Internal error: should not be reading after end");case 3:return[4,{offset:t.range[0],stack:[],subType:"start",type:ut}];case 4:return r.sent(),[3,6];case 5:return[3,6];case 6:return[2]}})}var Af=[[48,57]],Zv=Nc(Af),Df=[[48,57],[65,90],[95,95],[97,122]],Wv=Nc(Df),Cf=[[9,9],[10,10],[11,11],[12,12],[13,13],[32,32],[160,160],[5760,5760],[8192,8202],[8232,8233],[8239,8239],[8287,8287],[12288,12288],[65279,65279]],Gv=Nc(Cf);function wf(t){switch(t){case"d":case"D":return t==="d"?Af:Zv;case"w":case"W":return t==="w"?Df:Wv;case"s":case"S":return t==="s"?Cf:Gv}}function Hv(t){var e,r;return he(this,function(n){switch(n.label){case 0:return e=t.value,r=wf(e),[4,{characterGroups:{ranges:r,rangesNegated:!1,unicodePropertyEscapes:new Map},node:t,stack:[],subType:"groups",type:ut}];case 1:return n.sent(),[2]}})}function Kv(t){if(t.length>1)return null;var e=t.codePointAt(0);if(!e)throw new Error("Internal error: expected codepoint");return e}function Ef(t){var e=String.fromCodePoint(t).toUpperCase(),r=Kv(e);return r!==null?r:t}function Jv(t){var e=t.caseInsensitive,r=t.highCodePoint,n=t.lowCodePoint;if(!e)return[[n,r]];for(var i=new Set,o=n;o<=r;o++)i.add(Ef(o));return jv(i)}function Sf(t){var e=t.caseInsensitive,r=t.value,n=r.codePoint;return e?Ef(n):n}function Yv(t){var e=t.caseInsensitive,r=t.node,n=Sf({caseInsensitive:e,value:r});return wo([{characterGroups:{ranges:[[n,n]],rangesNegated:!1,unicodePropertyEscapes:new Map},node:r,stack:[],subType:"groups",type:ut}])}function Xv(t){var e,r,n=t.caseInsensitive,i=t.node,o=[],s=new Map,a=!1;try{e:for(var c=Ne(i.body),u=c.next();!u.done;u=c.next()){var l=u.value;switch(l.type){case"value":{var f=Sf({caseInsensitive:n,value:l});o.push([f,f]);break}case"characterClassRange":{o.push.apply(o,N([],V(Jv({caseInsensitive:n,highCodePoint:l.max.codePoint,lowCodePoint:l.min.codePoint})),!1));break}case"characterClassEscape":{var h=l.value;o.push.apply(o,N([],V(wf(h)),!1));break}case"unicodePropertyEscape":{var p=l.negative!==i.negative;if(s.get(l.value)===!p){a=!0;break e}s.set(l.value,p);break}}}}catch(m){e={error:m}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}return wo([{characterGroups:a?{ranges:[],rangesNegated:!0,unicodePropertyEscapes:new Map}:{ranges:o,rangesNegated:i.negative,unicodePropertyEscapes:s},node:i,stack:[],subType:"groups",type:ut}])}function Qv(t){var e=t.caseInsensitive,r=t.dotAll,n=t.node;return Ov([wo(n.body.slice(0,-1).map(function(i){return{reader:function(){return Co({caseInsensitive:e,dotAll:r,node:i})},subType:null,type:zr}})),Co({caseInsensitive:e,dotAll:r,node:n.body[n.body.length-1]})])}function e0(t){var e=t.dotAll,r=t.node;return he(this,function(n){switch(n.label){case 0:return[4,{characterGroups:{ranges:e?[]:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map},node:r,stack:[],subType:"groups",type:ut}];case 1:return n.sent(),[2]}})}function t0(t){return he(this,function(e){switch(e.label){case 0:return[4,{node:t,referenceIndex:t.matchIndex,stack:[],subType:"reference",type:ut}];case 1:return e.sent(),[2]}})}function r0(t){return wo([{characterGroups:{ranges:[],rangesNegated:!1,unicodePropertyEscapes:new Map([[t.value,t.negative]])},node:t,stack:[],subType:"groups",type:ut}])}var ut=Symbol("characterReaderTypeCharacterEntry"),zr=Symbol("characterReaderTypeSplit");function Co(t){var e=t.caseInsensitive,r=t.dotAll,n=t.node;switch(n.type){case"anchor":return qv(n);case"characterClass":return Xv({caseInsensitive:e,node:n});case"characterClassEscape":return Hv(n);case"unicodePropertyEscape":return r0(n);case"reference":return t0(n);case"value":return Yv({caseInsensitive:e,node:n});case"dot":return e0({dotAll:r,node:n});case"alternative":return $c({caseInsensitive:e,dotAll:r,nodes:n.body});case"disjunction":return Qv({caseInsensitive:e,dotAll:r,node:n});case"group":return Bv({caseInsensitive:e,dotAll:r,node:n});case"quantifier":return zv({caseInsensitive:e,dotAll:r,node:n})}}var _f=Symbol("characterReaderLevel2TypeSplit"),Tc=Symbol("characterReaderLevel1TypeEntry");function n0(t){var e=t.caseInsensitive,r=t.dotAll,n=t.node,i=function(o,s){var a,c,u;return he(this,function(l){switch(l.label){case 0:c=function(){var f,h,p,m;return he(this,function(y){switch(y.label){case 0:switch(f=a.value.type,f){case ut:return[3,1];case zr:return[3,10]}return[3,12];case 1:switch(h=a.value.subType,h){case"groups":return[3,2];case"reference":return[3,4];case"end":return[3,6];case"null":return[3,7];case"start":return[3,8]}return[3,9];case 2:return[4,{characterGroups:a.value.characterGroups,node:a.value.node,precedingZeroWidthEntries:s,stack:a.value.stack,subType:"groups",type:Tc}];case 3:return y.sent(),s=[],[3,9];case 4:return[4,{node:a.value.node,precedingZeroWidthEntries:s,referenceIndex:a.value.referenceIndex,stack:a.value.stack,subType:a.value.subType,type:Tc}];case 5:return y.sent(),s=[],[3,9];case 6:return[2,{value:{bounded:a.value.bounded,precedingZeroWidthEntries:s}}];case 7:return s=N(N([],V(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:"null"}],!1),[3,9];case 8:return s=N(N([],V(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:"start"}],!1),[3,9];case 9:return[3,12];case 10:return p=a.value,m=s,[4,{reader:function(){return i(p.reader(),m)},subType:p.subType,type:_f}];case 11:return y.sent(),[3,12];case 12:return[2]}})},l.label=1;case 1:return(a=o.next()).done?[3,3]:[5,c()];case 2:return u=l.sent(),typeof u=="object"?[2,u.value]:[3,1];case 3:return[2,{bounded:!1,precedingZeroWidthEntries:s}]}})};return i(Co({caseInsensitive:e,dotAll:r,node:n}),[])}var Mc=Symbol("characterReaderLevel2TypeSplit"),Ns=Symbol("characterReaderLevel2TypeEntry"),If=Symbol("internalReaderTypeSplit"),Lc=Symbol("internalReaderTypeEntry");function kf(t){var e,r;return he(this,function(n){switch(n.label){case 0:r=function(){var i,o;return he(this,function(s){switch(s.label){case 0:switch(i=e.value,o=i.type,o){case _f:return[3,1];case Tc:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return kf(i.reader())},subType:i.subType,type:If}];case 2:return s.sent(),[3,5];case 3:return[4,Fe(Fe({},i),{type:Lc})];case 4:return s.sent(),[3,5];case 5:return[2]}})},n.label=1;case 1:return(e=t.next()).done?[3,3]:[5,r()];case 2:return n.sent(),[3,1];case 3:return[2,e.value]}})}function i0(t,e){var r,n;try{for(var i=Ne(e),o=i.next();!o.done;o=i.next()){var s=V(o.value,2),a=s[0],c=s[1],u=t.get(a)||0;if(c-u>1)return!0}}catch(l){r={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1}function o0(t){var e,r,n,i,o,s,a,c,u,l=t.groupContentsStore,f=t.groups,h=t.groupsWithInfiniteSize,p=t.nodeExtra,m=t.value;return he(this,function(y){switch(y.label){case 0:if(e=Do(p.indexToCapturingGroup,m.referenceIndex),r=l.get(m.referenceIndex)||{contents:[],group:e},n=bf(Do(p.nodeToLookaheadStack,r.group),Do(p.nodeToLookaheadStack,m.node)).a,n.length){if(n.some(function(A){var D=A.behavior;return D==="negativeLookahead"||D==="negativeLookbehind"}))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];throw new Error("Unsupported reference (".concat(m.referenceIndex," at position ").concat(m.node.range[0],"). Pattern needs downgrading. See the `downgradePattern` option."))}if(f.has(r.group))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];if(h.has(m.referenceIndex))throw new Error("Unsupported reference to group ".concat(m.referenceIndex," as group is not a finite size. Pattern needs downgrading. See the `downgradePattern` option."));y.label=1;case 1:y.trys.push([1,6,7,8]),i=Ne(r.contents),o=i.next(),y.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,{characterGroups:s.characterGroups,node:s.node,precedingZeroWidthEntries:s.precedingZeroWidthEntries,stack:N(N(N([],V(s.stack),!1),[{reference:m.node,type:"reference"}],!1),V(m.stack),!1),subType:"groups",type:Lc}]);case 3:y.sent(),y.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return a=y.sent(),c={error:a},[3,8];case 7:try{o&&!o.done&&(u=i.return)&&u.call(i)}finally{if(c)throw c.error}return[7];case 8:return[2,{bounded:!1,precedingZeroWidthEntries:[]}]}})}function df(t){var e=t.caseInsensitive,r=t.dotAll,n=t.node,i=t.nodeExtra,o=function(s){var a,c;return he(this,function(u){switch(u.label){case 0:a=function(){var l,f,h,p,m,y,A,D,_,q,j,I,P,M,U,T,ae,te,re,ne,z,J,nt,Re,ue,Ke,Me,Je,dt,de,nr,_t,Ue,Mt,Ye,ze,ir,Lt,Le,Bt,Xr,Vt,ft;return he(this,function(it){switch(it.label){case 0:if(l=s.precedingZeroWidthEntries,f=s.groupsWithInfiniteSize,h=s.groupContentsStore,p=s.quantifierIterationsAtLastGroup,m=s.characterReader,y=s.referenceCharacterReaderWithReference,A=y?.reader||m,D=A.next(),D.done){if(y){if(D.value.bounded)throw new Error("Internal error: end of reference reader cannot be bounded");return s={characterReader:m,groupContentsStore:h,groupsWithInfiniteSize:f,precedingZeroWidthEntries:N(N([],V(l),!1),V(D.value.precedingZeroWidthEntries),!1),quantifierIterationsAtLastGroup:p,referenceCharacterReaderWithReference:null},[2,"continue-outer"]}return[2,{value:{bounded:D.value.bounded,precedingZeroWidthEntries:N(N([],V(l),!1),V(D.value.precedingZeroWidthEntries),!1),type:"end"}}]}switch(_=D.value,q=_.type,q){case If:return[3,1];case Lc:return[3,3]}return[3,7];case 1:if(y)throw new Error("Internal error: should not be seeing a split from a reference reader");return j=h,I=p,P=f,M=l,[4,{reader:function(){return o({characterReader:Oi(_.reader()),groupContentsStore:j,groupsWithInfiniteSize:P,precedingZeroWidthEntries:M,quantifierIterationsAtLastGroup:I,referenceCharacterReaderWithReference:y})},subType:_.subType,type:Mc}];case 2:return it.sent(),[3,7];case 3:switch(l=N(N([],V(l),!1),V(_.precedingZeroWidthEntries),!1),U=Uv(_.stack),T=Lv(_.stack),ae=Mv(_.stack),te=_.subType,te){case"reference":return[3,4];case"groups":return[3,5]}return[3,7];case 4:{if(y)throw new Error("Internal error: should not be seeing a reference from a reference reader");return i0(p,U)?[2,{value:{type:"abort"}}]:(re=Oi(o0({groupContentsStore:h,groups:ae,groupsWithInfiniteSize:f,nodeExtra:i,value:_})),s={characterReader:m,groupContentsStore:h,groupsWithInfiniteSize:f,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:p,referenceCharacterReaderWithReference:{reader:re,reference:_.node}},[3,7])}case 5:if(ne=new Map(h),!y)try{for(z=(Lt=void 0,Ne(h)),J=z.next();!J.done;J=z.next()){nt=V(J.value,2),Re=nt[0],ue=nt[1].group,Ke=N(N([],V(l.map(function(Ce){var ve=Ce.offset;return ve})),!1),[_.node.range[0]],!1);try{for(Me=(Bt=void 0,Ne(Ke)),Je=Me.next();!Je.done;Je=Me.next())if(dt=Je.value,ue.range[0]>=dt){ne.delete(Re);break}}catch(Ce){Bt={error:Ce}}finally{try{Je&&!Je.done&&(Xr=Me.return)&&Xr.call(Me)}finally{if(Bt)throw Bt.error}}}}catch(Ce){Lt={error:Ce}}finally{try{J&&!J.done&&(Le=z.return)&&Le.call(z)}finally{if(Lt)throw Lt.error}}de=!1,nr=N([],V(_.stack),!1).reverse(),_t=nr.findIndex(function(Ce){var ve=Ce.type;return ve==="reference"}),Ue=nr.slice(0,_t>=0?_t:_.stack.length),Mt=function(Ce){if(Ce.type==="quantifier"&&Ce.quantifier.max===void 0)return de=!0,"continue";if(Ce.type!=="group")return"continue";var ve=Ce.group;if(ve.behavior==="lookbehind"||ve.behavior==="negativeLookbehind"||ve.behavior==="negativeLookahead"||ve.behavior==="lookahead")return de=!1,"continue";if(ve.behavior!=="normal")return"continue";var pt=Do(i.capturingGroupToIndex,ve);if(de){var ht=new Set(f);ht.add(pt),f=ht}var It=ne.get(pt)||{contents:[],group:ve};ne.set(pt,Fe(Fe({},It),{contents:N(N([],V(It.contents),!1),[Fe(Fe({},_),{precedingZeroWidthEntries:l.filter(function(mt){var Te=mt.offset;return Te>=ve.range[0]&&Te<=ve.range[1]})})],!1)}))};try{for(Ye=(Vt=void 0,Ne(Ue)),ze=Ye.next();!ze.done;ze=Ye.next())ir=ze.value,Mt(ir)}catch(Ce){Vt={error:Ce}}finally{try{ze&&!ze.done&&(ft=Ye.return)&&ft.call(Ye)}finally{if(Vt)throw Vt.error}}return h=ne,p=U,[4,{characterGroups:_.characterGroups,groups:ae,lookaheadStack:T,node:_.node,precedingZeroWidthEntries:l,stack:_.stack,type:Ns}];case 6:return it.sent(),l=[],s={characterReader:m,groupContentsStore:h,groupsWithInfiniteSize:f,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:p,referenceCharacterReaderWithReference:y},[3,7];case 7:return[2]}})},u.label=1;case 1:return[5,a()];case 2:if(c=u.sent(),typeof c=="object")return[2,c.value];if(c==="continue-outer")return[3,3];u.label=3;case 3:return[3,1];case 4:return[2]}})};return o({characterReader:Oi(kf(n0({caseInsensitive:e,dotAll:r,node:n}))),groupContentsStore:new Map,groupsWithInfiniteSize:new Set,precedingZeroWidthEntries:[],quantifierIterationsAtLastGroup:new Map,referenceCharacterReaderWithReference:null})}var s0=(function(){function t(e,r){this._history=[],this._isEqual=e,r&&(this._history=N([],V(r.getHistory()),!1))}return t.prototype._isEntryEqual=function(e,r){return this._isEqual(e.left,r.left)&&this._isEqual(e.right,r.right)},t.prototype.append=function(e){this._history.push(e)},t.prototype.clone=function(){return new t(this._isEqual,this)},t.prototype.getHistory=function(){return N([],V(this._history),!1)},t.prototype.getRepeatingEntries=function(){var e=this._history.length;e:for(var r=1;r<=e/2;r++){for(var n=e-r*2,i=0;i<r;i++)if(!this._isEntryEqual(this._history[n+i],this._history[n+r+i]))continue e;return this._history.slice(n,n+r)}return null},t})();function Xt(t){var e=!1,r;return function(){return e||(e=!0,r=t()),r}}var Oc=Symbol("isUnboundedReaderTypeStep"),a0={ranges:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map};function ff(t){var e,r,n,i,o=t.multiLine,s=t.reader;return he(this,function(a){switch(a.label){case 0:e=Ts(s),r=[{get:Xt(function(){return e.next()}),reader:e}],n=function(){var c,u,l,f,h;return he(this,function(p){switch(p.label){case 0:return c=r.pop(),c?[4,{type:Oc}]:[2,"break"];case 1:if(p.sent(),u=c.get(),u.done){if(u.value.type==="end"&&!u.value.bounded)return[2,{value:!0}]}else switch(u.value.type){case Mc:{l=u.value,r.push({get:Xt(function(){return c.reader.next()}),reader:c.reader}),l.subType===null&&(f=l.reader(),r.push({get:Xt(function(){return f.next()}),reader:f}));break}case Ns:{o&&(h=jc(Pc(a0,u.value.characterGroups)),h&&r.push({get:Xt(function(){return c.reader.next()}),reader:c.reader}));break}}return[2]}})},a.label=1;case 1:return[5,n()];case 2:if(i=a.sent(),typeof i=="object")return[2,i.value];if(i==="break")return[3,4];a.label=3;case 3:return[3,1];case 4:return[2,!1]}})}function c0(t,e){return new Set(N(N([],V(t),!1),V(e),!1))}function u0(t,e){return t.size===e.size&&c0(t,e).size===t.size}var Ff=Symbol("checkerReaderTypeTrail");function l0(t,e){return t===e}function Ti(t,e){return t.map(function(r){switch(r.type){case"quantifier":return"q:".concat(r.quantifier.range[0],":").concat(e&&r.quantifier.max===void 0&&r.iteration>=r.quantifier.min?"*":"".concat(r.iteration));case"reference":return"r:".concat(r.reference.range[0]);case"group":return"g:".concat(r.group.range[0])}}).filter(Boolean).join(",")}function Ic(t,e){for(var r=new Set,n=0;n<t.length;n++){var i=t[n];i.type==="group"&&e.has(i.group.range[0])&&r.add(Ti(t.slice(0,n+1),!1))}return r}function d0(t){return[t.type,t.offset,Ti(t.stack,!1)].join(":")}function pf(t,e){return N(N([],V(t.precedingZeroWidthEntries.map(function(r){return{hash:["zw",d0(r)].join(":"),stack:r.stack}})),!1),[{hash:["s",e].join(":"),stack:t.stack}],!1)}function Ri(t,e){return t.hash===e.hash}function f0(t){var e,r,n,i,o,s,a,c,u,l,f,h,p,m,y,A,D,_;return he(this,function(q){switch(q.label){case 0:e=new Set,r=new Set,n=new Map,i=0,o=Date.now()+t.timeout,s=!1,a=!1,c=Oi(t.leftStreamReader),u=Oi(t.rightStreamReader),l=[{infiniteLoopTracker:new s0(l0),streamReadersWithGetters:[{get:Xt(function(){return c.next()}),reader:c},{get:Xt(function(){return u.next()}),reader:u}],trail:[]}],f=function(){var j,I,P,M,U,T,Le,ae,te,re,ne,z,J,nt,Re,ue,Ke,Me,Je,dt,de,nr,_t,Ue,Mt,Ye,ze,ir,Lt,Le,Bt,Xr,Vt,ft,it,Te,Ce,ve,pt,Te,ht,It,mt,Te,Lo,Bo,kt,Vo,Uo,ei,ti,ri,Ui,zo,ni,X,zi,Dr,ii,Qr,en,tn,xe,C,Cr,g;return he(this,function(b){switch(b.label){case 0:if(s=Date.now()>o,s||i>t.maxSteps)return[2,"break"];if(j=l.pop(),!j)return[2,"break"];for(I=j.streamReadersWithGetters,P=j.infiniteLoopTracker,M=j.trail,U=[],T=function(v){i+=.5;var x=I[v].get();if(!x.done&&x.value.type===Mc){var Z=x.value;l.push({infiniteLoopTracker:P,streamReadersWithGetters:I.map(function(qe,Ft){var qo=qe.reader,fa=qe.get;return{get:Ft===v?Xt(function(){return qo.next()}):fa,reader:qo}}),trail:M});var le=I.map(function(qe,Ft){var qo=qe.reader,fa=qe.get,pu=Ft===v?Oi(Z.reader()):Ts(qo);return{get:Ft<v?fa:Xt(function(){return pu.next()}),reader:pu}});return l.push({infiniteLoopTracker:P.clone(),streamReadersWithGetters:le,trail:M}),"continue-outer"}else U.push(x)},Le=0;Le<I.length;Le++)if(ae=T(Le),ae==="continue-outer")return[2,ae];if(te=V(U,2),re=te[0],ne=te[1],i>t.maxSteps||re.done||ne.done)return[2,"continue"];if(re.value.type!==Ns||ne.value.type!==Ns)throw new Error("Internal error: impossible leftValue/rightValue type");if(z=re.value,J=ne.value,nt=z.precedingZeroWidthEntries.some(function(v){var x=v.type;return x==="start"}),Re=J.precedingZeroWidthEntries.some(function(v){var x=v.type;return x==="start"}),ue=nt||Re,M.length>0&&ue)return[2,"continue"];if(Ke=_c(z.lookaheadStack),Me=_c(J.lookaheadStack),Ke!==Me)return[2,"continue"];if(Je=Pc(z.characterGroups,J.characterGroups),jc(Je))return[2,"continue"];if(dt=Ti(z.stack,!1),de=Ti(J.stack,!1),nr=[z.node.range[0],dt].join(":"),_t=[J.node.range[0],de].join(":"),Ue=_c(M),Mt=new Set(Ue?.left.atomicGroupsEnteredTogether),Ye=new Set(Ue?.right.atomicGroupsEnteredTogether),ze=!!Ue?.diverged,!ze)for(ir=pf(z,nr),Lt=pf(J,_t),Le=0;Le<Math.min(ir.length,Lt.length);Le++){if(Bt=ir[Le],Xr=Lt[Le],Bt.hash!==Xr.hash){ze=!0;break}Vt=Ic(Bt.stack,t.atomicGroupOffsets);try{for(ft=(en=void 0,Ne(Vt)),it=ft.next();!it.done;it=ft.next())Te=it.value,Mt.add(Te),Ye.add(Te)}catch(v){en={error:v}}finally{try{it&&!it.done&&(tn=ft.return)&&tn.call(ft)}finally{if(en)throw en.error}}}Ce=Ic(z.stack,t.atomicGroupOffsets);try{for(ve=(xe=void 0,Ne(Mt)),pt=ve.next();!pt.done;pt=ve.next())Te=pt.value,Ce.has(Te)||Mt.delete(Te)}catch(v){xe={error:v}}finally{try{pt&&!pt.done&&(C=ve.return)&&C.call(ve)}finally{if(xe)throw xe.error}}ht=Ic(J.stack,t.atomicGroupOffsets);try{for(It=(Cr=void 0,Ne(Ye)),mt=It.next();!mt.done;mt=It.next())Te=mt.value,ht.has(Te)||Ye.delete(Te)}catch(v){Cr={error:v}}finally{try{mt&&!mt.done&&(g=It.return)&&g.call(It)}finally{if(Cr)throw Cr.error}}if(Lo={atomicGroupsEnteredTogether:Mt,characterGroups:z.characterGroups,contextTrail:dt,hash:nr,node:z.node,stack:z.stack},Bo={atomicGroupsEnteredTogether:Ye,characterGroups:J.characterGroups,contextTrail:de,hash:_t,node:J.node,stack:J.stack},kt={diverged:ze,intersection:Je,left:Lo,right:Bo},M=N(N([],V(M),!1),[kt],!1),Vo=Vv(z.stack,t.nodeExtra),Vo.size>0&&(Uo=M.every(function(v){var x=v.left,Z=v.right;return Ri(x,Z)}),Uo))return[2,"continue"];if(ei={left:[z.node.range[0],Ti(z.stack,!0)].join(":"),right:[J.node.range[0],Ti(z.stack,!0)].join(":")},n.set(ei,kt),P.append(ei),ti=P.getRepeatingEntries(),ti){if(ri=n.get(ti[0]),!ri)throw new Error("Internal error: missing entry at start of loop");return r.add(ri),[2,"continue"]}if(!u0(kt.left.atomicGroupsEnteredTogether,kt.right.atomicGroupsEnteredTogether))return[2,"continue-outer"];if(Ui=Ri(kt.left,kt.right),Ui)return[3,2];{for(zo=ff({multiLine:t.multiLine,reader:Ts(I[0].reader)}),ni=void 0;!(ni=zo.next()).done;)switch(ni.value.type){case Oc:{if(i+=.5,i>t.maxSteps)return[2,"break-outer"];break}}if(X=ni.value,X)return[2,"continue"]}{for(zi=ff({multiLine:t.multiLine,reader:Ts(I[1].reader)}),Dr=void 0;!(Dr=zi.next()).done;)switch(Dr.value.type){case Oc:{if(i+=.5,i>t.maxSteps)return[2,"break-outer"];break}}if(ii=Dr.value,ii)return[2,"continue"]}return Qr=function(){var v=N([],V(e),!1).some(function(x){return x.length!==M.length?!1:x.every(function(Z,le){return Ri(Z.left,M[le].left)&&Ri(Z.right,M[le].right)})||x.every(function(Z,le){return Ri(Z.left,M[le].right)&&Ri(Z.right,M[le].left)})});return!v},Qr()?(e.add(M),[4,{trail:M,type:Ff}]):[3,2];case 1:b.sent(),b.label=2;case 2:return l.push({infiniteLoopTracker:P,streamReadersWithGetters:I.map(function(v){var x=v.reader;return{get:Xt(function(){return x.next()}),reader:x}}),trail:M}),[2]}})},q.label=1;case 1:return[5,f()];case 2:if(h=q.sent(),h==="break")return[3,4];switch(h){case"break-outer":return[3,4];case"continue-outer":return[3,3]}q.label=3;case 3:return[3,1];case 4:if(r.size>0)try{for(p=Ne(e),m=p.next();!m.done;m=p.next())if(y=m.value,y.some(function(j){return r.has(j)})){a=!0;break}}catch(j){D={error:j}}finally{try{m&&!m.done&&(_=p.return)&&_.call(p)}finally{if(D)throw D.error}}return A=i>t.maxSteps?"hitMaxSteps":s?"timedOut":null,[2,A?{error:A}:{error:null,infinite:a}]}})}var p0=["lookahead","lookbehind","negativeLookahead","negativeLookbehind"];function h0(t){var e=new Map,r=new Map,n=new Map,i=[],o=function(s,a,c){switch(s.type){case"anchor":case"characterClass":case"characterClassEscape":case"characterClassRange":case"unicodePropertyEscape":case"value":case"dot":return;case"reference":{n.set(s,a),c&&i.push(s);break}case"alternative":case"disjunction":{s.body.forEach(function(f){return o(f,a,c)});return}case"group":{if(s.behavior==="normal"){var u=e.size+1;e.set(s,u),r.set(u,s),n.set(s,a)}var l=N([],V(a),!1);s.behavior!=="normal"&&p0.indexOf(s.behavior)>=0&&l.push(s),s.body.forEach(function(f){return o(f,l,c)});return}case"quantifier":{s.body.forEach(function(f){return o(f,a,c&&s.max!==0)});return}}};return o(t,[],!0),{capturingGroupToIndex:e,indexToCapturingGroup:r,nodeToLookaheadStack:n,reachableReferences:i}}var m0=(function(){function t(){this._cache=new Map}return t.prototype.addResult=function(e,r,n){var i=this._cache.get(e)||new Map;i.set(r,n),this._cache.set(e,i);var o=this._cache.get(r)||new Map;o.set(e,n),this._cache.set(r,o)},t.prototype.getResult=function(e,r){var n;return(n=this._cache.get(e))===null||n===void 0?void 0:n.get(r)},t})(),$f=(function(){function t(e){this.decode=e,this.root=new Map,this.results=new Map,this._items=function(){return[]}}return t.prototype.add=function(e){var r=this.decode(e);if(r.length!==0){for(var n=this.results,i={children:this.root},o=r.length,s=0;s<o;s++){var a=r[s],c=s===o-1,u=i.children.get(a);if(u)i=u,c||n.delete(u);else{var l={children:new Map,value:a};i.children.set(a,l),i=l,c&&n.set(l,e)}}this._items=Xt(function(){return Array.from(n.values())})}},Object.defineProperty(t.prototype,"items",{get:function(){return this._items()},enumerable:!1,configurable:!0}),t})(),kc=25e3,g0=(function(){function t(e,r){this.trail=e,this.isEmptyCache=r,this.tree=new $f(function(n){return n.map(function(i){var o=i.hash;return o})}),this.inputStringSchema=e.map(function(n){var i=n.intersection;return i}),this.length=e.length,this.onNewTrail(this)}return Object.defineProperty(t.prototype,"matches",{get:function(){return this.tree.items},enumerable:!1,configurable:!0}),t.prototype.getLongestMatch=function(e,r){var n=this;if(r.length>e.length)throw new Error("Internal error: trail should be <= than input string schema");var i=r.findIndex(function(o,s){var a=n.isEmptyCache.getResult(o.characterGroups,e[s]);if(a!==void 0)return a;var c=jc(Pc(o.characterGroups,e[s]));return n.isEmptyCache.addResult(o.characterGroups,e[s],c),c});return i===-1?r:r.slice(0,i)},t.prototype.onNewTrail=function(e){var r,n,i=[],o=[];try{for(var s=Ne(e.trail),a=s.next();!a.done;a=s.next()){var c=a.value;i.push(c.left),o.push(c.right)}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}var u=this.getLongestMatch(this.inputStringSchema,i);u.length===this.length&&this.tree.add(u);var l=this.getLongestMatch(this.inputStringSchema,o);l.length===this.length&&this.tree.add(l)},t})();function y0(t){var e,r,n=t.atomicGroupOffsets,i=t.node,o=t.maxScore,s=t.maxSteps,a=t.multiLine,c=t.timeout,u=t.caseInsensitive,l=t.dotAll,f=new m0,h=h0(i),p={caseInsensitive:u,dotAll:l,node:i,nodeExtra:h},m=df(p),y=df(p),A=f0({atomicGroupOffsets:n,leftStreamReader:m,maxSteps:s,multiLine:a,nodeExtra:h,rightStreamReader:y,timeout:c}),D=new $f(function(te){var re=te.trail;return re}),_=1,q=0,j;e:for(;!(j=A.next()).done;)switch(j.value.type){case Ff:{var I=new g0(j.value.trail,f),P=function(te){var re=te.matches,ne=re.length;ne>_&&(_=ne)};if(q<kc){try{for(var M=(e=void 0,Ne(D.items)),U=M.next();!U.done;U=M.next()){var T=U.value;if(T.length===I.length){if(q+=I.length,q>=kc)break;I.onNewTrail(T),T.onNewTrail(I),P(T)}}}catch(te){e={error:te}}finally{try{U&&!U.done&&(r=M.return)&&r.call(M)}finally{if(e)throw e.error}}P(I)}if(q>=kc&&(_+=1),D.add(I),_>o)break e;break}}var ae=null;return j.done?j.value.error?(_=1/0,ae=j.value.error):j.value.infinite&&(_=1/0,ae="hitMaxScore"):(_=1/0,ae="hitMaxScore"),{error:ae,score:_,trails:D.items.map(function(te){var re=te.trail;return re})}}var b0=1/0,v0=200,x0=2e4,A0=!1,D0=!1,C0=!1,w0=!1;function js(t){return{end:{offset:t.range[1]},source:t.raw,start:{offset:t.range[0]}}}function hf(t){return t.flatMap(function(e){return e.type==="reference"?[e.reference]:[]}).reverse().map(function(e){return{index:e.matchIndex,node:js(e)}})}function mf(t){var e=N([],V(t),!1).reverse(),r=e.findIndex(function(i){var o=i.type;return o==="reference"}),n=e.slice(0,r>=0?r:t.length).reverse();return n.flatMap(function(i){return i.type==="quantifier"?[i]:[]}).map(function(i){var o=i.quantifier,s=i.iteration;return{iteration:s,node:js(o)}})}function Bc(t,e){var r=e===void 0?{}:e,n=r.atomicGroupOffsets,i=r.maxScore,o=i===void 0?v0:i,s=r.maxSteps,a=s===void 0?x0:s,c=r.multiLine,u=c===void 0?A0:c,l=r.timeout,f=l===void 0?b0:l,h=r.caseInsensitive,p=h===void 0?C0:h,m=r.dotAll,y=m===void 0?w0:m,A=r.unicode,D=A===void 0?D0:A,_=r.downgradePattern,q=_===void 0?!0:_;if(p&&D)throw new Error("`caseInsensitive` cannot be used with `unicode`.");if(q&&n)throw new Error("`atomicGroupOffsets` cannot be used with `downgradePattern: true`.");if(f<=0)throw new Error("`timeout` must be a positive number.");if(o<0)throw new Error("`maxScore` must be a positive number or 0.");if(a<=0)throw new Error("`maxSteps` must be a positive number.");var j=q?Fv({pattern:t,unicode:D}):{atomicGroupOffsets:new Set(n||[]),pattern:t},I=j.pattern,P=j.atomicGroupOffsets,M=q&&t!==I,U=yf(I,D);if(!q&&Iv(U))throw new Error("Pattern is not bounded at the start and needs downgrading. See the `downgradePattern` option.");var T=y0({atomicGroupOffsets:P,caseInsensitive:p,dotAll:y,maxScore:o,maxSteps:a,multiLine:u,node:U,timeout:f});return Fe(Fe({},T.error?{error:T.error,safe:!1}:{error:null,safe:!0}),{pattern:I,patternDowngraded:M,score:T.score===1/0?{infinite:!0}:{infinite:!1,value:T.score},trails:T.trails.map(function(ae){var te={trail:ae.map(function(re){var ne=re.left,z=re.right,J={a:{backreferenceStack:hf(z.stack),node:js(z.node),quantifierIterations:mf(z.stack)},b:{backreferenceStack:hf(ne.stack),node:js(ne.node),quantifierIterations:mf(ne.stack)}};return J})};return te})})}function Rf(t,e={}){if(t==null||typeof t!="string"||t.length===0)return!0;let r=e.maxPatternLength??256;if(t.length>r)return!1;try{return new RegExp(t),Bc(t).safe&&Bc(`^(?:${t})$`).safe}catch{return!1}}function _e(t,e){return{...e,tagName:t.tagName,element:t}}var Ps=globalThis,Ms=Ps.ShadowRoot&&(Ps.ShadyCSS===void 0||Ps.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vc=Symbol(),Tf=new WeakMap,Eo=class{constructor(e,r,n){if(this._$cssResult$=!0,n!==Vc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o,r=this.t;if(Ms&&e===void 0){let n=r!==void 0&&r.length===1;n&&(e=Tf.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Tf.set(r,e))}return e}toString(){return this.cssText}},Of=t=>new Eo(typeof t=="string"?t:t+"",void 0,Vc),Y=(t,...e)=>{let r=t.length===1?t[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new Eo(r,t,Vc)},Nf=(t,e)=>{if(Ms)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of e){let n=document.createElement("style"),i=Ps.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)}},Uc=Ms?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let n of e.cssRules)r+=n.cssText;return Of(r)})(t):t;var{is:E0,defineProperty:S0,getOwnPropertyDescriptor:_0,getOwnPropertyNames:I0,getOwnPropertySymbols:k0,getPrototypeOf:F0}=Object,Ls=globalThis,jf=Ls.trustedTypes,$0=jf?jf.emptyScript:"",R0=Ls.reactiveElementPolyfillSupport,So=(t,e)=>t,_o={toAttribute(t,e){switch(e){case Boolean:t=t?$0:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},Bs=(t,e)=>!E0(t,e),Pf={attribute:!0,type:String,converter:_o,reflect:!1,useDefault:!1,hasChanged:Bs};Symbol.metadata??=Symbol("metadata"),Ls.litPropertyMetadata??=new WeakMap;var vr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,r=Pf){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(e,r),!r.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,r);i!==void 0&&S0(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){let{get:i,set:o}=_0(this.prototype,e)??{get(){return this[r]},set(s){this[r]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Pf}static _$Ei(){if(this.hasOwnProperty(So("elementProperties")))return;let e=F0(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(So("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(So("properties"))){let r=this.properties,n=[...I0(r),...k0(r)];for(let i of n)this.createProperty(i,r[i])}let e=this[Symbol.metadata];if(e!==null){let r=litPropertyMetadata.get(e);if(r!==void 0)for(let[n,i]of r)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[r,n]of this.elementProperties){let i=this._$Eu(r,n);i!==void 0&&this._$Eh.set(i,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)r.unshift(Uc(i))}else e!==void 0&&r.push(Uc(e));return r}static _$Eu(e,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,r=this.constructor.elementProperties;for(let n of r.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nf(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$ET(e,r){let n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:_o).toAttribute(r,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,r){let n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=n.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:_o;this._$Em=i;let a=s.fromAttribute(r,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,r,n,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),n??=s.getPropertyOptions(e),!((n.hasChanged??Bs)(o,r)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,r,{useDefault:n,reflect:i,wrapped:o},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??r??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(r=void 0),this._$AL.set(e,r)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,o]of n){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(r)}willUpdate(e){}_$AE(e){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(r=>this._$ET(r,this[r])),this._$EM()}updated(e){}firstUpdated(e){}};vr.elementStyles=[],vr.shadowRootOptions={mode:"open"},vr[So("elementProperties")]=new Map,vr[So("finalized")]=new Map,R0?.({ReactiveElement:vr}),(Ls.reactiveElementVersions??=[]).push("2.1.2");var qc=globalThis,Mf=t=>t,Vs=qc.trustedTypes,Lf=Vs?Vs.createPolicy("lit-html",{createHTML:t=>t}):void 0,Zc="$lit$",xr=`lit$${Math.random().toFixed(9).slice(2)}$`,Wc="?"+xr,T0=`<${Wc}>`,On=document,ko=()=>On.createComment(""),Fo=t=>t===null||typeof t!="object"&&typeof t!="function",Gc=Array.isArray,Zf=t=>Gc(t)||typeof t?.[Symbol.iterator]=="function",zc=`[
9
+ \f\r]`,Io=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Bf=/-->/g,Vf=/>/g,Rn=RegExp(`>|${zc}(?:([^\\s"'>=/]+)(${zc}*=${zc}*(?:[^
10
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Uf=/'/g,zf=/"/g,Wf=/^(?:script|style|textarea|title)$/i,Hc=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),F=Hc(1),KI=Hc(2),JI=Hc(3),je=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),qf=new WeakMap,Tn=On.createTreeWalker(On,129);function Gf(t,e){if(!Gc(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Lf!==void 0?Lf.createHTML(e):e}var Hf=(t,e)=>{let r=t.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Io;for(let a=0;a<r;a++){let c=t[a],u,l,f=-1,h=0;for(;h<c.length&&(s.lastIndex=h,l=s.exec(c),l!==null);)h=s.lastIndex,s===Io?l[1]==="!--"?s=Bf:l[1]!==void 0?s=Vf:l[2]!==void 0?(Wf.test(l[2])&&(i=RegExp("</"+l[2],"g")),s=Rn):l[3]!==void 0&&(s=Rn):s===Rn?l[0]===">"?(s=i??Io,f=-1):l[1]===void 0?f=-2:(f=s.lastIndex-l[2].length,u=l[1],s=l[3]===void 0?Rn:l[3]==='"'?zf:Uf):s===zf||s===Uf?s=Rn:s===Bf||s===Vf?s=Io:(s=Rn,i=void 0);let p=s===Rn&&t[a+1].startsWith("/>")?" ":"";o+=s===Io?c+T0:f>=0?(n.push(u),c.slice(0,f)+Zc+c.slice(f)+xr+p):c+xr+(f===-2?a:p)}return[Gf(t,o+(t[r]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},$o=class t{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,c=this.parts,[u,l]=Hf(e,r);if(this.el=t.createElement(u,n),Tn.currentNode=this.el.content,r===2||r===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Tn.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(Zc)){let h=l[s++],p=i.getAttribute(f).split(xr),m=/([.?@])?(.*)/.exec(h);c.push({type:1,index:o,name:m[2],strings:p,ctor:m[1]==="."?zs:m[1]==="?"?qs:m[1]==="@"?Zs:jn}),i.removeAttribute(f)}else f.startsWith(xr)&&(c.push({type:6,index:o}),i.removeAttribute(f));if(Wf.test(i.tagName)){let f=i.textContent.split(xr),h=f.length-1;if(h>0){i.textContent=Vs?Vs.emptyScript:"";for(let p=0;p<h;p++)i.append(f[p],ko()),Tn.nextNode(),c.push({type:2,index:++o});i.append(f[h],ko())}}}else if(i.nodeType===8)if(i.data===Wc)c.push({type:2,index:o});else{let f=-1;for(;(f=i.data.indexOf(xr,f+1))!==-1;)c.push({type:7,index:o}),f+=xr.length-1}o++}}static createElement(e,r){let n=On.createElement("template");return n.innerHTML=e,n}};function Nn(t,e,r=t,n){if(e===je)return e;let i=n!==void 0?r._$Co?.[n]:r._$Cl,o=Fo(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(t),i._$AT(t,r,n)),n!==void 0?(r._$Co??=[])[n]=i:r._$Cl=i),i!==void 0&&(e=Nn(t,i._$AS(t,e.values),i,n)),e}var Us=class{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:r},parts:n}=this._$AD,i=(e?.creationScope??On).importNode(r,!0);Tn.currentNode=i;let o=Tn.nextNode(),s=0,a=0,c=n[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new Ni(o,o.nextSibling,this,e):c.type===1?u=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(u=new Ws(o,this,e)),this._$AV.push(u),c=n[++a]}s!==c?.index&&(o=Tn.nextNode(),s++)}return Tn.currentNode=On,i}p(e){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}},Ni=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,r,n,i){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=Nn(this,e,r),Fo(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==je&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Zf(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==E&&Fo(this._$AH)?this._$AA.nextSibling.data=e:this.T(On.createTextNode(e)),this._$AH=e}$(e){let{values:r,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=$o.createElement(Gf(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(r);else{let o=new Us(i,this),s=o.u(this.options);o.p(r),this.T(s),this._$AH=o}}_$AC(e){let r=qf.get(e.strings);return r===void 0&&qf.set(e.strings,r=new $o(e)),r}k(e){Gc(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,i=0;for(let o of e)i===r.length?r.push(n=new t(this.O(ko()),this.O(ko()),this,this.options)):n=r[i],n._$AI(o),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(e=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);e!==this._$AB;){let n=Mf(e).nextSibling;Mf(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},jn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,r,n,i,o){this.type=1,this._$AH=E,this._$AN=void 0,this.element=e,this.name=r,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=E}_$AI(e,r=this,n,i){let o=this.strings,s=!1;if(o===void 0)e=Nn(this,e,r,0),s=!Fo(e)||e!==this._$AH&&e!==je,s&&(this._$AH=e);else{let a=e,c,u;for(e=o[0],c=0;c<o.length-1;c++)u=Nn(this,a[n+c],r,c),u===je&&(u=this._$AH[c]),s||=!Fo(u)||u!==this._$AH[c],u===E?e=E:e!==E&&(e+=(u??"")+o[c+1]),this._$AH[c]=u}s&&!i&&this.j(e)}j(e){e===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},zs=class extends jn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}},qs=class extends jn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==E)}},Zs=class extends jn{constructor(e,r,n,i,o){super(e,r,n,i,o),this.type=5}_$AI(e,r=this){if((e=Nn(this,e,r,0)??E)===je)return;let n=this._$AH,i=e===E&&n!==E||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==E&&(n===E||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ws=class{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Nn(this,e)}},Kf={M:Zc,P:xr,A:Wc,C:1,L:Hf,R:Us,D:Zf,V:Nn,I:Ni,H:jn,N:qs,U:Zs,B:zs,F:Ws},O0=qc.litHtmlPolyfillSupport;O0?.($o,Ni),(qc.litHtmlVersions??=[]).push("3.3.3");var Jf=(t,e,r)=>{let n=r?.renderBefore??e,i=n._$litPart$;if(i===void 0){let o=r?.renderBefore??null;n._$litPart$=i=new Ni(e.insertBefore(ko(),o),o,void 0,r??{})}return i._$AI(t),i};var Kc=globalThis,Qt=class extends vr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Jf(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return je}};Qt._$litElement$=!0,Qt.finalized=!0,Kc.litElementHydrateSupport?.({LitElement:Qt});var N0=Kc.litElementPolyfillSupport;N0?.({LitElement:Qt});(Kc.litElementVersions??=[]).push("4.2.2");var Yf=t=>(e,r)=>{r!==void 0?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};var j0={attribute:!0,type:String,converter:_o,reflect:!1,hasChanged:Bs},P0=(t=j0,e,r)=>{let{kind:n,metadata:i}=r,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),n==="setter"&&((t=Object.create(t)).wrapped=!0),o.set(r.name,t),n==="accessor"){let{name:s}=r;return{set(a){let c=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,c,t,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,t,a),a}}}if(n==="setter"){let{name:s}=r;return function(a){let c=this[s];e.call(this,a),this.requestUpdate(s,c,t,!0,a)}}throw Error("Unsupported decorator location: "+n)};function Pn(t){return(e,r)=>typeof r=="object"?P0(t,e,r):((n,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,n),s?Object.getOwnPropertyDescriptor(i,o):void 0})(t,e,r)}function qr(t){return Pn({...t,state:!0,attribute:!1})}var er={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},lt=t=>(...e)=>({_$litDirective$:t,values:e}),rt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,n){this._$Ct=e,this._$AM=r,this._$Ci=n}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}};function Jc(t){return typeof t=="object"&&t!==null&&"tagName"in t&&typeof t.tagName=="string"&&"element"in t&&typeof t.element=="function"}var Xf=!1;function Yc(t){if(typeof customElements>"u"){Xf||(Xf=!0,console.error(`Cannot register "${t.tagName}": \`customElements\` is not available in this environment, so universal components will not render.`));return}let e=customElements.get(t.tagName);if(!e){customElements.define(t.tagName,t.element);return}if(e!==t.element)throw new Error(`Custom element tag name collision for "${t.tagName}": attempted to register ${t.element.name||"anonymous constructor"}, but tag name is already registered with ${e.name||"another constructor"}.`)}var Xc=class extends rt{render(e,r,n){return(!this.element||this.tagName!==e)&&(this.tagName=e,this.element=document.createElement(e)),this.element.node=n,this.element.context=r,this.element}},Qf=lt(Xc);function Ar(t,e){if(St(t))return M0(t);let r=t.componentModel.type,n=e?.components.get(r);return!n||!n.tagName?(console.warn(`Component implementation not found or missing tagName for type: ${r}`),E):(Jc(n)&&typeof customElements<"u"&&!customElements.get(n.tagName)&&Yc(n),Qf(n.tagName,t))}function M0(t){if(t.isPlaceholder||t.disposed||!t.context)return E;let e=t.impl;return e?.tagName?(Jc(e)&&Yc(e),Qf(e.tagName,t.context,t)):(console.warn(`Component implementation not found or missing tagName for type: ${t.type}`),E)}function L0(t){if(!t||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function Hs(t,e){return St(e)?e.dataPath!==t.dataPath?{id:e.componentId,basePath:e.dataPath}:e.componentId:e instanceof Ge?Hs(t,e.value):Array.isArray(e)?e.map(r=>Hs(t,r)):L0(e)?Qc(t,e):e}function Qc(t,e){let r={};for(let[n,i]of Object.entries(e))i instanceof Ge?(r[n]=Hs(t,i.value),r[`set${n.charAt(0).toUpperCase()}${n.slice(1)}`]=$i(i)?i.set:()=>{}):r[n]=Hs(t,i);return r}var Ro=class{get props(){return this._props}get metadata(){return this.metadataSubscribed=!0,this.host.isConnected&&this.ensureMetadataSubscription(),this.host.node?ce(this.host.node.metadata):this.host.context?.componentModel?.metadata}get extensions(){return this.metadata?.extensions}get surfaceMetadata(){return this.surfaceMetadataSubscribed=!0,this.host.isConnected&&this.ensureSurfaceMetadataSubscription(),(this.host.node?.context?.dataContext.surface??this.host.context?.dataContext.surface)?.metadata}get surfaceExtensions(){return this.surfaceMetadata?.extensions}constructor(e,r){this.host=e,this.metadataSubscribed=!1,this.surfaceMetadataSubscribed=!1,this.host.node?this._props=Qc(this.host.node,ce(this.host.node.props)):(this.binder=new Fi(this.host.context,r.schema),this._props=this.binder.snapshot),this.host.addController(this),this.host.isConnected&&this.hostConnected()}hostConnected(){if(this.ensureMetadataSubscription(),this.ensureSurfaceMetadataSubscription(),this.host.node){if(!this.nodeEffectCleanup){let e=this.host.node;this.nodeEffectCleanup=Nt(()=>{this._props=Qc(e,ye(e.props)),this.host.requestUpdate()})}return}!this.subscription&&this.binder&&(this.subscription=this.binder.subscribe(e=>{this._props=e,this.host.requestUpdate()})),this.componentsSubscription||(this.componentsSubscription=this.host.context.dataContext.surface?.componentsModel?.onCreated.subscribe(()=>{this.host.requestUpdate()}))}ensureMetadataSubscription(){if(this.metadataSubscribed){if(this.host.node){if(!this.metadataEffectCleanup){let e=this.host.node,r=!0;this.metadataEffectCleanup=Nt(()=>{if(ye(e.metadata),r){r=!1;return}this.host.requestUpdate()})}return}!this.metadataSubscription&&this.host.context?.componentModel&&(this.metadataSubscription=this.host.context.componentModel.onMetadataChanged.subscribe(()=>{this.host.requestUpdate()}))}}ensureSurfaceMetadataSubscription(){if(!this.surfaceMetadataSubscribed)return;let e=this.host.node?.context?.dataContext.surface??this.host.context?.dataContext.surface;!this.surfaceMetadataSubscription&&e&&(this.surfaceMetadataSubscription=e.onMetadataChanged.subscribe(()=>{this.host.requestUpdate()}))}hostDisconnected(){this.nodeEffectCleanup?.(),this.nodeEffectCleanup=void 0,this.metadataEffectCleanup?.(),this.metadataEffectCleanup=void 0,this.metadataSubscription?.unsubscribe(),this.metadataSubscription=void 0,this.surfaceMetadataSubscription?.unsubscribe(),this.surfaceMetadataSubscription=void 0,this.subscription?.unsubscribe(),this.subscription=void 0,this.componentsSubscription?.unsubscribe(),this.componentsSubscription=void 0}dispose(){this.hostDisconnected(),this.binder?.dispose()}};var ep=function(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o},Zr=class extends Qt{get controller(){return this._controller}get metadata(){return this._controller?.metadata}get extensions(){return this._controller?.extensions}get surfaceMetadata(){return this._controller?.surfaceMetadata}get surfaceExtensions(){return this._controller?.surfaceExtensions}adoptLightDomStyles(){if(typeof document>"u"||this.renderRoot!==this)return;let e=this.getRootNode(),r=this.constructor,n=r.styles;if(!n)return;let i=this.tagName.toLowerCase();if(!r._processedSheet&&r._processedCss===void 0){let c=(Array.isArray(n)?n:[n]).map(l=>l&&typeof l=="object"&&"cssText"in l?String(l.cssText):String(l)).join(`
11
+ `).replace(/:where\(:host\)/g,`:where(${i})`).replace(/:host\(([^)]+)\)/g,`${i}$1`).replace(/:host/g,i),u=c;try{let l=new CSSStyleSheet;l.replaceSync(c);let f=p=>{if(typeof CSSStyleRule<"u"&&p instanceof CSSStyleRule)return`${p.selectorText.split(",").map(y=>(y=y.trim(),y===i||y.startsWith(i+" ")||y.startsWith(i+".")||y.startsWith(i+":")||y.startsWith(i+"[")||y.startsWith(`:where(${i}`)||y.startsWith(`:is(${i}`)?y:`${i} ${y}`)).join(", ")} { ${p.style.cssText} }`;if(typeof CSSMediaRule<"u"&&p instanceof CSSMediaRule){let m=Array.from(p.cssRules).map(f).join(`
12
+ `);return`@media ${p.conditionText} {
13
+ ${m}
14
+ }`}return p.cssText};u=Array.from(l.cssRules).map(f).join(`
15
+ `);let h=new CSSStyleSheet;h.replaceSync(u),r._processedSheet=h}catch{}r._processedCss=u,r._processedStyle=Y([u]),r._adoptedRoots=new WeakSet}let o=typeof ShadowRoot<"u"&&e instanceof ShadowRoot?e:typeof document<"u"?document:void 0;o&&(r._adoptedRoots||(r._adoptedRoots=new WeakSet),r._adoptedRoots.has(o)||(r._adoptedRoots.add(o),r._processedSheet&&o.adoptedStyleSheets&&(o.adoptedStyleSheets=[...o.adoptedStyleSheets,r._processedSheet])))}connectedCallback(){super.connectedCallback(),this.adoptLightDomStyles()}createController(){let e=this.api??this.findCatalogApi();if(!e)throw new Error(`[A2uiLitElement] Either define 'protected readonly api = ...' on ${this.constructor.name} or override 'createController()'.`);return new Ro(this,e)}findCatalogApi(){if(this.node?.impl)return this.node.impl;let e=this.context?.componentModel;return e?e.catalog.components.get(e.type):void 0}renderNode(e,r){if(!e||!this.context?.dataContext)return E;let{surface:n,path:i}=this.context.dataContext;if(!n)return E;if(!!!n.componentsModel?.get(this.context.componentModel.id))return E;if(St(e)&&!r)return Ar(e);let s,a=r;if(typeof e=="object"?(s=e.id||e.componentId,a=a??e.basePath??e.path):s=e,!s||!n.componentsModel?.get(s))return E;if(a=a??i,this.node){let l=V0(this.node,s,a);if(l)return Ar(l)}let c=new ki(n,s,a),u=c.componentModel.catalog;return Ar(c,u)}willUpdate(e){super.willUpdate(e);let r=e.has("node")&&this.node!==this._controllerNode,n=e.has("context");if(e.has("node")&&this.node?.context&&this.node.context!==this.context&&(this.context=this.node.context,n=!0),(n||r)&&this.context){if(this._controller&&!r&&B0(this._controllerContext,this.context)){this._controllerContext=this.context;return}this._controller&&(this.removeController(this._controller),this._controller.dispose()),this._controller=this.createController(),this._controllerContext=this.context,this._controllerNode=this.node}}update(e){this._controller&&super.update(e)}};ep([Pn({type:Object})],Zr.prototype,"context",void 0);ep([Pn({type:Object})],Zr.prototype,"node",void 0);function B0(t,e){return t===e?!0:!t?.componentModel||!e?.componentModel||!t.dataContext||!e.dataContext?!1:t.componentModel===e.componentModel&&t.surfaceComponents===e.surfaceComponents&&t.theme===e.theme&&t.dataContext.surface===e.dataContext.surface&&t.dataContext.dataModel===e.dataContext.dataModel&&t.dataContext.path===e.dataContext.path&&t.dataContext.explicitIndex===e.dataContext.explicitIndex&&t.dataContext.parent===e.dataContext.parent}function V0(t,e,r){let n=i=>{if(St(i))return i.componentId===e&&i.dataPath===r?i:void 0;if(i instanceof Ge)return n(i.value);if(Array.isArray(i)){for(let o of i){let s=n(o);if(s)return s}return}if(i&&typeof i=="object"&&Object.getPrototypeOf(i)===Object.prototype)for(let o of Object.values(i)){let s=n(o);if(s)return s}};return n(ce(t.props))}var U0=`
16
+ :where(:root) {
17
+ color-scheme: light dark;
18
+ }
19
+
20
+ :where(.a2ui-dark) {
21
+ color-scheme: dark;
22
+ }
23
+
24
+ :where(.a2ui-light) {
25
+ color-scheme: light;
26
+ }
27
+
28
+ :where(:root), :where(.a2ui-dark), :where(.a2ui-light) {
29
+ --a2ui-color-background: light-dark(#eee, #111);
30
+ --a2ui-color-on-background: light-dark(#333, #eee);
31
+
32
+ --a2ui-color-surface: light-dark(
33
+ color-mix(in oklab, var(--a2ui-color-background) 85%, white),
34
+ color-mix(in oklab, var(--a2ui-color-background) 95%, white)
35
+ );
36
+ --a2ui-color-on-surface: light-dark(#333, #eee);
37
+
38
+ --a2ui-color-primary: #17e;
39
+ --a2ui-color-primary-light: ${tr("light",{colorVar:"--a2ui-color-primary"})};
40
+ --a2ui-color-primary-dark: ${tr("dark",{colorVar:"--a2ui-color-primary"})};
41
+ --a2ui-color-primary-hover: ${tr("hover",{darkVar:"--a2ui-color-primary-dark",lightVar:"--a2ui-color-primary-light"})};
42
+ --a2ui-color-on-primary: #fff;
43
+
44
+ --a2ui-color-secondary: light-dark(#ddd, #333);
45
+ --a2ui-color-secondary-light: ${tr("light",{colorVar:"--a2ui-color-secondary"})};
46
+ --a2ui-color-secondary-dark: ${tr("dark",{colorVar:"--a2ui-color-secondary",percentage:95})};
47
+ --a2ui-color-secondary-hover: ${tr("hover",{darkVar:"--a2ui-color-secondary-dark",lightVar:"--a2ui-color-secondary-light"})};
48
+ --a2ui-color-on-secondary: light-dark(#333, #eee);
49
+
50
+ --a2ui-border-radius: 0.25rem;
51
+ --a2ui-color-border: light-dark(#ccc, #444);
52
+ --a2ui-border-width: 1px;
53
+ --a2ui-border: 1px solid var(--a2ui-color-border, #ccc);
54
+
55
+ --a2ui-font-family-title: inherit;
56
+ --a2ui-font-family-monospace: monospace;
57
+ --a2ui-color-input: light-dark(#fff, #2a2a2a);
58
+ --a2ui-color-on-input: light-dark(#333, #eee);
59
+
60
+ --a2ui-grid-base: 0.5rem;
61
+ --a2ui-spacing-xs: calc(var(--a2ui-spacing-s) / 2);
62
+ --a2ui-spacing-s: calc(var(--a2ui-spacing-m) / 2);
63
+ --a2ui-spacing-m: var(--a2ui-grid-base);
64
+ --a2ui-spacing-l: calc(var(--a2ui-spacing-m) * 2);
65
+ --a2ui-spacing-xl: calc(var(--a2ui-spacing-l) * 2);
66
+
67
+ --a2ui-font-size: 1rem;
68
+ --a2ui-font-scale: 1.2;
69
+ --a2ui-font-size-xs: calc(var(--a2ui-font-size-s) / var(--a2ui-font-scale));
70
+ --a2ui-font-size-s: calc(var(--a2ui-font-size-m) / var(--a2ui-font-scale));
71
+ --a2ui-font-size-m: var(--a2ui-font-size);
72
+ --a2ui-font-size-l: calc(var(--a2ui-font-size-m) * var(--a2ui-font-scale));
73
+ --a2ui-font-size-xl: calc(var(--a2ui-font-size-l) * var(--a2ui-font-scale));
74
+ --a2ui-font-size-2xl: calc(var(--a2ui-font-size-xl) * var(--a2ui-font-scale));
75
+
76
+ --a2ui-line-height-headings: 1.2;
77
+ --a2ui-line-height-body: 1.5;
78
+ }
79
+ `,Ks;function z0(){return Ks||(Ks=new CSSStyleSheet,Ks.replaceSync(U0)),Ks}function tp(t){if(typeof document>"u")return;let e=z0(),r=typeof document<"u"?document.adoptedStyleSheets:null;if(r&&typeof r.includes=="function"&&!r.includes(e))try{document.adoptedStyleSheets=[...r,e]}catch{}if(t&&t!==document){let n=t.adoptedStyleSheets;if(n&&typeof n.includes=="function"&&!n.includes(e))try{t.adoptedStyleSheets=[...n,e]}catch{}}}function tr(t,e){switch(t){case"light":{let r=e;return`color-mix(in oklab, var(${r.colorVar}) ${r.percentage??85}%, ${r.mixColor??"white"})`}case"dark":{let r=e;return`color-mix(in oklab, var(${r.colorVar}) ${r.percentage??85}%, ${r.mixColor??"black"})`}case"hover":{let r=e;return`light-dark(var(${r.darkVar}), var(${r.lightVar}))`}}}var Js=fm(np(),1);var q0=/^var\(\s*--[a-zA-Z0-9_-]+(?:\s*,\s*[^)]+)?\s*\)$/;function eu(t){if(typeof t!="string"||!t.trim())return!1;let e=t.trim();if(q0.test(e))return!0;if(typeof CSS<"u"&&typeof CSS.supports=="function")return CSS.supports("color",e);let r=typeof Js.default=="function"?Js.default:Js.default?.default;return typeof r=="function"?r(e):!1}var ip=d.object({primaryColor:d.string().refine(t=>eu(t),"primaryColor must be a valid CSS color (e.g. '#00BFFF', '#17e', 'red', 'rgb(255, 0, 0)')").optional().describe("The primary brand color used for highlights (e.g., primary buttons, active borders). Renderers may generate variants of this color for different contexts. Format: Hexadecimal code, named color, or functional notation (e.g., '#00BFFF', 'red', 'rgb(255, 0, 0)')."),iconUrl:d.string().optional().describe("A URL for an image that identifies the agent or tool associated with the surface."),agentDisplayName:d.string().optional().describe("Text to be displayed next to the surface to identify the agent or tool that created it.")}).passthrough();var ee=class extends Zr{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),tp()}willUpdate(e){super.willUpdate(e);let r=this.controller?.props;r&&r.weight!==void 0?this.style.flex=String(r.weight):this.style.removeProperty("flex");let n=this.context?.theme?.primaryColor;typeof n=="string"&&eu(n)?(this.style.setProperty("--a2ui-color-primary",n),this.style.setProperty("--a2ui-color-primary-light",tr("light",{colorVar:"--a2ui-color-primary"})),this.style.setProperty("--a2ui-color-primary-dark",tr("dark",{colorVar:"--a2ui-color-primary"})),this.style.setProperty("--a2ui-color-primary-hover",tr("hover",{darkVar:"--a2ui-color-primary-dark",lightVar:"--a2ui-color-primary-light"}))):(this.style.removeProperty("--a2ui-color-primary"),this.style.removeProperty("--a2ui-color-primary-light"),this.style.removeProperty("--a2ui-color-primary-dark"),this.style.removeProperty("--a2ui-color-primary-hover")),this.applyAccessibilityAttributes(r?.accessibility)}renderValidationErrors(e){return e?.isValid===!1&&e.validationErrors?.length?e.validationErrors.map(r=>F`<div class="a2ui-error-message">${r}</div>`):E}applyAccessibilityAttributes(e){this.hasAttributeValue(e?.label)?this.setAttribute("aria-label",String(e?.label)):this.removeAttribute("aria-label"),this.hasAttributeValue(e?.description)?this.setAttribute("aria-description",String(e?.description)):this.removeAttribute("aria-description"),this.hasAttributeValue(e?.live)?this.setAttribute("aria-live",String(e?.live)):this.removeAttribute("aria-live"),typeof e?.hidden=="boolean"?this.setAttribute("aria-hidden",String(e.hidden)):this.removeAttribute("aria-hidden")}hasAttributeValue(e){return e!=null&&e!==""}};var Mn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=$n(e.url);return F`
80
+ <div class="a2ui-audio-player">
81
+ ${e.description?F`<div class="a2ui-audio-description">${e.description}</div>`:E}
82
+ <audio src=${r??E} controls class="a2ui-audio">
83
+ Your browser does not support the audio tag.
84
+ </audio>
85
+ </div>
86
+ `}};Mn.tagName="a2ui-audioplayer";Mn.styles=Y`
87
+ .a2ui-audio-player {
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: var(--a2ui-spacing-xs, 0.25rem);
91
+ background: var(--a2ui-audioplayer-background, transparent);
92
+ border-radius: var(--a2ui-audioplayer-border-radius, 0);
93
+ padding: var(--a2ui-audioplayer-padding, 0);
94
+ width: 100%;
95
+ }
96
+ .a2ui-audio-description {
97
+ font-size: var(--a2ui-font-size-s, 0.875rem);
98
+ color: var(
99
+ --a2ui-audioplayer-description-color,
100
+ var(--a2ui-text-caption-color, light-dark(#666, #aaa))
101
+ );
102
+ }
103
+ .a2ui-audio {
104
+ width: 100%;
105
+ }
106
+ `;var He=lt(class extends rt{constructor(t){if(super(t),t.type!==er.ATTRIBUTE||t.name!=="class"||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(this.st===void 0){this.st=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(let n in e)e[n]&&!this.nt?.has(n)&&this.st.add(n);return this.render(e)}let r=t.element.classList;for(let n of this.st)n in e||(r.remove(n),this.st.delete(n));for(let n in e){let i=!!e[n];i===this.st.has(n)||this.nt?.has(n)||(i?(r.add(n),this.st.add(n)):(r.remove(n),this.st.delete(n)))}return je}});var Ln=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.isValid===!1,i={"a2ui-button":!0,["a2ui-button-"+(e.variant??"default")]:!0};return F`
107
+ <button
108
+ type="button"
109
+ class=${He(i)}
110
+ @click=${()=>{r||e.action?.()}}
111
+ ?disabled=${r}
112
+ >
113
+ ${e.child?F`${this.renderNode(e.child)}`:E}
114
+ </button>
115
+ `}};Ln.tagName="a2ui-basic-button";Ln.styles=Y`
116
+ .a2ui-button {
117
+ padding: var(
118
+ --a2ui-button-padding,
119
+ var(--a2ui-spacing-m, 0.5rem) var(--a2ui-spacing-l, 1rem)
120
+ );
121
+ border-radius: var(--a2ui-button-border-radius, var(--a2ui-spacing-s, 0.25rem));
122
+ border: var(
123
+ --a2ui-button-border,
124
+ var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)
125
+ );
126
+ cursor: pointer;
127
+ margin: var(--a2ui-button-margin, var(--a2ui-spacing-m, 0.5rem));
128
+ background: var(--a2ui-button-background, var(--a2ui-color-surface, #fff));
129
+ box-shadow: var(--a2ui-button-box-shadow, none);
130
+ font-weight: var(--a2ui-button-font-weight, normal);
131
+ --_a2ui-text-margin: 0;
132
+ --_a2ui-text-color: var(--a2ui-color-on-secondary, #333);
133
+ color: var(--_a2ui-text-color);
134
+ }
135
+ .a2ui-button:hover {
136
+ background-color: var(--a2ui-color-secondary-hover, #ddd);
137
+ }
138
+ .a2ui-button.a2ui-button-primary {
139
+ background: var(--a2ui-color-primary, #17e);
140
+ --_a2ui-text-color: var(--a2ui-color-on-primary, #fff);
141
+ color: var(--_a2ui-text-color);
142
+ border: none;
143
+ }
144
+ .a2ui-button.a2ui-button-primary:hover {
145
+ background-color: var(--a2ui-color-primary-hover, #fbd);
146
+ }
147
+ .a2ui-button.a2ui-button-borderless {
148
+ background: none;
149
+ border: none;
150
+ padding: 0;
151
+ color: var(--a2ui-color-primary, #17e);
152
+ }
153
+ .a2ui-button:disabled {
154
+ cursor: not-allowed;
155
+ opacity: 0.5;
156
+ }
157
+ `;var Bn=class extends ee{render(){let e=this.controller.props;return e?F`
158
+ <div class="a2ui-card">${e.child?this.renderNode(e.child):E}</div>
159
+ `:E}};Bn.tagName="a2ui-card";Bn.styles=Y`
160
+ .a2ui-card {
161
+ padding: var(--a2ui-card-padding, var(--a2ui-spacing-m, 16px));
162
+ border-radius: var(--a2ui-card-border-radius, var(--a2ui-border-radius, 8px));
163
+ box-shadow: var(--a2ui-card-box-shadow, 0 2px 4px rgba(0, 0, 0, 0.1));
164
+ background: var(--a2ui-card-background, var(--a2ui-color-surface, #fff));
165
+ color: var(--a2ui-color-on-surface, #333);
166
+ border: var(
167
+ --a2ui-card-border,
168
+ var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)
169
+ );
170
+ margin: var(--a2ui-card-margin, var(--a2ui-spacing-m, 16px));
171
+ }
172
+ `;var Vn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.isValid===!1,n={"a2ui-checkbox":!0,"a2ui-invalid":r},i={"a2ui-invalid":r};return F`
173
+ <div class="a2ui-checkbox-container">
174
+ <label class=${He(n)}>
175
+ <input
176
+ type="checkbox"
177
+ class=${He(i)}
178
+ .checked=${e.value||!1}
179
+ @change=${o=>e.setValue?.(o.target.checked)}
180
+ />
181
+ <span class="a2ui-check-box-text">${e.label}</span>
182
+ </label>
183
+ ${this.renderValidationErrors(e)}
184
+ </div>
185
+ `}};Vn.tagName="a2ui-checkbox";Vn.styles=Y`
186
+ :host,
187
+ a2ui-checkbox {
188
+ display: block;
189
+ }
190
+ .a2ui-checkbox-container {
191
+ display: flex;
192
+ flex-direction: column;
193
+ margin: var(--a2ui-checkbox-margin, var(--a2ui-spacing-m));
194
+ }
195
+ label.a2ui-checkbox {
196
+ display: inline-flex;
197
+ align-items: center;
198
+ gap: var(--a2ui-checkbox-gap, var(--a2ui-spacing-s, 0.5rem));
199
+ font-size: var(
200
+ --a2ui-checkbox-label-font-size,
201
+ var(--a2ui-label-font-size, var(--a2ui-font-size-s))
202
+ );
203
+ font-weight: var(--a2ui-checkbox-label-font-weight, var(--a2ui-label-font-weight, bold));
204
+ cursor: pointer;
205
+ }
206
+ label.a2ui-invalid {
207
+ color: var(--a2ui-checkbox-color-error, red);
208
+ }
209
+ input {
210
+ width: var(--a2ui-checkbox-size, 1rem);
211
+ height: var(--a2ui-checkbox-size, 1rem);
212
+ background: var(--a2ui-checkbox-background, inherit);
213
+ border: var(--a2ui-checkbox-border, var(--a2ui-border));
214
+ border-radius: var(--a2ui-checkbox-border-radius, 4px);
215
+ }
216
+ input.a2ui-invalid {
217
+ outline: 1px solid var(--a2ui-checkbox-color-error, red);
218
+ }
219
+ .a2ui-error-message {
220
+ color: var(--a2ui-checkbox-color-error, red);
221
+ font-size: var(--a2ui-font-size-xs, 0.75rem);
222
+ margin-top: 4px;
223
+ }
224
+ `;var Z0=function(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o},Wr=class extends ee{constructor(){super(...arguments),this.filter=""}render(){let e=this.controller?.props;if(!e)return E;let r=e.value,n=Array.isArray(r)?r:typeof r=="string"?[r]:[],i=e.variant==="multipleSelection",o=e.displayStyle==="chips",s=p=>{let m=e.setValue;typeof m=="function"&&(i?n.includes(p)?m(n.filter(y=>y!==p)):m([...n,p]):m([p]))},a=(e.options||[]).filter(p=>!e.filterable||this.filter===""||String(p.label).toLowerCase().includes(this.filter.toLowerCase())),c=this.context?.dataContext?.surface?.id||"default",u=this.context?.componentModel?.id||"choice-picker",f=(this.context?.dataContext?.path||"/").replace(/[^a-zA-Z0-9-]/g,"_"),h=`a2ui-choice-${c}-${u}-${f}`;return F`
225
+ ${e.label?F`<label>${e.label}</label>`:E}
226
+ ${e.filterable?F`
227
+ <input
228
+ type="text"
229
+ class="a2ui-filter-input"
230
+ placeholder="Filter options..."
231
+ aria-label="Filter options"
232
+ .value=${this.filter}
233
+ @input=${p=>this.filter=p.target.value}
234
+ />
235
+ `:E}
236
+ <div
237
+ class=${He({"a2ui-choice-picker":!0,"a2ui-options-group":!o,"a2ui-chips-group":o})}
238
+ >
239
+ ${a.map(p=>o?F`
240
+ <button
241
+ type="button"
242
+ class=${He({"a2ui-chip":!0,"a2ui-chip-selected":n.includes(p.value)})}
243
+ aria-pressed=${n.includes(p.value)}
244
+ @click=${()=>s(p.value)}
245
+ >
246
+ ${p.label}
247
+ </button>
248
+ `:F`
249
+ <label class="a2ui-option-label">
250
+ <input
251
+ type=${i?"checkbox":"radio"}
252
+ name=${i?E:h}
253
+ value=${p.value}
254
+ .checked=${n.includes(p.value)}
255
+ @change=${()=>s(p.value)}
256
+ class="a2ui-option-input"
257
+ />
258
+ <span class="a2ui-option-text">${p.label}</span>
259
+ </label>
260
+ `)}
261
+ </div>
262
+ ${this.renderValidationErrors(e)}
263
+ `}};Wr.tagName="a2ui-choicepicker";Wr.styles=Y`
264
+ :host,
265
+ .a2ui-choice-picker {
266
+ display: flex;
267
+ flex-direction: column;
268
+ width: 100%;
269
+ gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));
270
+ padding: var(--a2ui-choicepicker-padding, 0);
271
+ }
272
+ .a2ui-options-group {
273
+ display: flex;
274
+ flex-direction: column;
275
+ gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));
276
+ }
277
+ label,
278
+ .a2ui-option-label {
279
+ display: flex;
280
+ align-items: center;
281
+ gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));
282
+ cursor: pointer;
283
+ color: var(--a2ui-text-color-text, var(--a2ui-choicepicker-label-color, inherit));
284
+ font-size: var(--a2ui-choicepicker-label-font-size, inherit);
285
+ }
286
+ :host,
287
+ a2ui-choicepicker > label {
288
+ font-size: var(
289
+ --a2ui-choicepicker-label-font-size,
290
+ var(--a2ui-label-font-size, var(--a2ui-font-size-s))
291
+ );
292
+ font-weight: var(--a2ui-choicepicker-label-font-weight, var(--a2ui-label-font-weight, bold));
293
+ }
294
+ .a2ui-filter-input {
295
+ background-color: var(--a2ui-color-input, #fff);
296
+ color: var(--a2ui-color-on-input, #333);
297
+ border: var(
298
+ --a2ui-textfield-border,
299
+ var(--a2ui-border, 1px solid var(--a2ui-color-border, #ccc))
300
+ );
301
+ border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m, 4px));
302
+ padding: var(
303
+ --a2ui-choicepicker-filter-padding,
304
+ var(--a2ui-spacing-xs, 4px) var(--a2ui-spacing-s, 8px)
305
+ );
306
+ margin-bottom: var(--a2ui-choicepicker-filter-margin-bottom, var(--a2ui-spacing-s, 0.25rem));
307
+ font-family: inherit;
308
+ }
309
+ .a2ui-filter-input:focus {
310
+ outline: none;
311
+ border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));
312
+ }
313
+ .a2ui-option-input {
314
+ width: var(--a2ui-choicepicker-checkbox-size, 1rem);
315
+ height: var(--a2ui-choicepicker-checkbox-size, 1rem);
316
+ }
317
+ .a2ui-chips-group {
318
+ display: flex;
319
+ flex-direction: row;
320
+ flex-wrap: wrap;
321
+ gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));
322
+ }
323
+ .a2ui-chip {
324
+ padding: var(
325
+ --a2ui-choicepicker-chip-padding,
326
+ var(--a2ui-spacing-s, 4px) var(--a2ui-spacing-m, 8px)
327
+ );
328
+ border-radius: var(--a2ui-choicepicker-chip-border-radius, 999px);
329
+ border: var(--a2ui-choicepicker-chip-border, 1px solid var(--a2ui-color-border, #ccc));
330
+ background-color: var(--a2ui-choicepicker-chip-background, var(--a2ui-color-surface, #fff));
331
+ color: var(--a2ui-color-on-surface, inherit);
332
+ cursor: pointer;
333
+ font-size: var(--a2ui-choicepicker-chip-font-size, var(--a2ui-font-size-xs, 0.75rem));
334
+ font-family: inherit;
335
+ font-weight: var(--a2ui-choicepicker-chip-font-weight, normal);
336
+ transition: all 0.2s;
337
+ }
338
+ .a2ui-chip.a2ui-chip-selected {
339
+ background-color: var(
340
+ --a2ui-choicepicker-chip-background-selected,
341
+ var(--a2ui-color-primary, #007bff)
342
+ );
343
+ color: var(--a2ui-color-on-primary, #fff);
344
+ border-color: var(
345
+ --a2ui-choicepicker-chip-background-selected,
346
+ var(--a2ui-color-primary, #007bff)
347
+ );
348
+ }
349
+ .a2ui-error-message {
350
+ color: var(--a2ui-choicepicker-color-error, red);
351
+ font-size: var(--a2ui-font-size-xs, 0.75rem);
352
+ }
353
+ `;Z0([qr()],Wr.prototype,"filter",void 0);var{I:W0}=Kf,op=t=>t;var ap=t=>t.strings===void 0,sp=()=>document.createComment(""),ji=(t,e,r)=>{let n=t._$AA.parentNode,i=e===void 0?t._$AB:e._$AA;if(r===void 0){let o=n.insertBefore(sp(),i),s=n.insertBefore(sp(),i);r=new W0(o,s,t,t.options)}else{let o=r._$AB.nextSibling,s=r._$AM,a=s!==t;if(a){let c;r._$AQ?.(t),r._$AM=t,r._$AP!==void 0&&(c=t._$AU)!==s._$AU&&r._$AP(c)}if(o!==i||a){let c=r._$AA;for(;c!==o;){let u=op(c).nextSibling;op(n).insertBefore(c,i),c=u}}}return r},Gr=(t,e,r=t)=>(t._$AI(e,r),t),G0={},cp=(t,e=G0)=>t._$AH=e,up=t=>t._$AH,Ys=t=>{t._$AR(),t._$AA.remove()};var lp=(t,e,r)=>{let n=new Map;for(let i=e;i<=r;i++)n.set(t[i],i);return n},Hr=lt(class extends rt{constructor(t){if(super(t),t.type!==er.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,r){let n;r===void 0?r=e:e!==void 0&&(n=e);let i=[],o=[],s=0;for(let a of t)i[s]=n?n(a,s):s,o[s]=r(a,s),s++;return{values:o,keys:i}}render(t,e,r){return this.dt(t,e,r).values}update(t,[e,r,n]){let i=up(t),{values:o,keys:s}=this.dt(e,r,n);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],c=[],u,l,f=0,h=i.length-1,p=0,m=o.length-1;for(;f<=h&&p<=m;)if(i[f]===null)f++;else if(i[h]===null)h--;else if(a[f]===s[p])c[p]=Gr(i[f],o[p]),f++,p++;else if(a[h]===s[m])c[m]=Gr(i[h],o[m]),h--,m--;else if(a[f]===s[m])c[m]=Gr(i[f],o[m]),ji(t,c[m+1],i[f]),f++,m--;else if(a[h]===s[p])c[p]=Gr(i[h],o[p]),ji(t,i[f],i[h]),h--,p++;else if(u===void 0&&(u=lp(s,p,m),l=lp(a,f,h)),u.has(a[f]))if(u.has(a[h])){let y=l.get(s[p]),A=y!==void 0?i[y]:null;if(A===null){let D=ji(t,i[f]);Gr(D,o[p]),c[p]=D}else c[p]=Gr(A,o[p]),ji(t,i[f],A),i[y]=null;p++}else Ys(i[h]),h--;else Ys(i[f]),f++;for(;p<=m;){let y=ji(t,c[m+1]);Gr(y,o[p]),c[p++]=y}for(;f<=h;){let y=i[f++];y!==null&&Ys(y)}return this.ut=s,cp(t,c),je}});var H0={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},K0={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"};function J0(t){return typeof t=="object"&&t!==null?`${t.basePath??""}/${t.id}`:String(t)}var Un=class extends ee{updated(e){super.updated(e);let r=this.controller.props;r&&(r.justify?this.style.justifyContent=H0[r.justify]??"flex-start":this.style.removeProperty("justify-content"),r.align?this.style.alignItems=K0[r.align]??"stretch":this.style.removeProperty("align-items"))}render(){let e=this.controller.props;if(!e)return E;let r=Array.isArray(e.children)?e.children:[];return F` ${Hr(r,J0,n=>F`${this.renderNode(n)}`)} `}};Un.tagName="a2ui-basic-column";Un.styles=Y`
354
+ :host,
355
+ a2ui-basic-column {
356
+ display: flex;
357
+ flex-direction: column;
358
+ width: var(--a2ui-column-width, 100%);
359
+ gap: var(--a2ui-column-gap, var(--a2ui-spacing-m));
360
+ }
361
+ `;function Y0(){let t=new Date,e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${e}-${r}-${n}`}function Pi(t,e){if(!t)return"";if(t.includes("T")){let[n,i]=t.split("T");switch(e){case"date":return n?.substring(0,10)??"";case"time":return i?.substring(0,5)??"";case"datetime-local":return`${n?.substring(0,10)??""}T${i?.substring(0,5)??""}`}}return e==="date"?t.includes("-")?t.substring(0,10):"":e==="time"&&t.includes(":")?t.substring(0,5):""}var zn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.enableTime??!1,n=e.enableDate??!r,i=typeof e.value=="string"?e.value:e.value?String(e.value):"",o=typeof e.min=="string"?e.min:e.min?String(e.min):"",s=typeof e.max=="string"?e.max:e.max?String(e.max):"",a=Pi(i,"date"),c=Pi(i,"time"),u=Pi(o,"date"),l=Pi(s,"date"),f=Pi(o,"time"),h=Pi(s,"time"),p=y=>{let A=y.target.value;if(r){let D=i.includes("T")?i.split("T")[1]:i.includes(":")?i:"00:00:00";e.setValue?.(`${A}T${D}`)}else e.setValue?.(A)},m=y=>{let A=y.target.value;if(n){let D=i.includes("T")?i.split("T")[0]:i.includes("-")?i:Y0();e.setValue?.(`${D}T${A}:00`)}else e.setValue?.(A)};return F`
362
+ <div class="a2ui-date-time-container">
363
+ ${e.label?F`<label class="a2ui-date-time-label">${e.label}</label>`:E}
364
+ <div class="a2ui-date-time-inputs">
365
+ ${n?F`
366
+ <input
367
+ type="date"
368
+ min=${u||E}
369
+ max=${l||E}
370
+ .value=${a}
371
+ @change=${p}
372
+ class="a2ui-date-time-input"
373
+ />
374
+ `:E}
375
+ ${r?F`
376
+ <input
377
+ type="time"
378
+ min=${f||E}
379
+ max=${h||E}
380
+ .value=${c}
381
+ @change=${m}
382
+ class="a2ui-date-time-input"
383
+ />
384
+ `:E}
385
+ </div>
386
+ ${this.renderValidationErrors(e)}
387
+ </div>
388
+ `}};zn.tagName="a2ui-datetimeinput";zn.styles=Y`
389
+ .a2ui-date-time-container {
390
+ display: flex;
391
+ flex-direction: column;
392
+ gap: var(--a2ui-spacing-xs, 4px);
393
+ width: var(--a2ui-datetimeinput-width, 100%);
394
+ }
395
+ input {
396
+ box-sizing: border-box;
397
+ width: 100%;
398
+ }
399
+ .a2ui-date-time-label {
400
+ font-size: var(
401
+ --a2ui-datetimeinput-label-font-size,
402
+ var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))
403
+ );
404
+ font-weight: var(--a2ui-datetimeinput-label-font-weight, bold);
405
+ color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));
406
+ }
407
+ .a2ui-date-time-inputs {
408
+ display: flex;
409
+ gap: var(--a2ui-spacing-s, 8px);
410
+ width: 100%;
411
+ }
412
+ .a2ui-date-time-input {
413
+ padding: var(--a2ui-datetimeinput-padding, 8px);
414
+ border-radius: var(--a2ui-datetimeinput-border-radius, 4px);
415
+ border: var(--a2ui-datetimeinput-border, 1px solid var(--a2ui-color-border, #ccc));
416
+ background-color: var(--a2ui-datetimeinput-background, var(--a2ui-color-input, #fff));
417
+ color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));
418
+ font-family: inherit;
419
+ flex: 1;
420
+ }
421
+ .a2ui-date-time-input::-webkit-datetime-edit,
422
+ .a2ui-date-time-input::-webkit-datetime-edit-fields-wrapper {
423
+ color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));
424
+ }
425
+ .a2ui-error-message {
426
+ color: var(--a2ui-datetimeinput-color-error, red);
427
+ font-size: var(--a2ui-font-size-xs, 0.75rem);
428
+ }
429
+ `;var qn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let n={"a2ui-divider":!0,["a2ui-divider-"+(e.axis??"horizontal")]:!0};return F`<hr class=${He(n)} />`}};qn.tagName="a2ui-divider";qn.styles=Y`
430
+ .a2ui-divider {
431
+ border: 0;
432
+ border-top: var(
433
+ --a2ui-divider-border,
434
+ var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)
435
+ );
436
+ margin: var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px)) 0;
437
+ width: 100%;
438
+ }
439
+ .a2ui-divider.a2ui-divider-vertical {
440
+ width: var(--a2ui-border-width, 1px);
441
+ height: 100%;
442
+ margin: 0 var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px));
443
+ border-top: 0;
444
+ border-left: var(
445
+ --a2ui-divider-border,
446
+ var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)
447
+ );
448
+ }
449
+ `;var dp={play:"play_arrow",rewind:"fast_rewind",favoriteOff:"favorite_border",starOff:"star_border"};function X0(t){return dp[t]?dp[t]:t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}var Zn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.name;if(typeof r=="object"&&r!==null&&"svgPath"in r){let o=r.svgPath;return F`
450
+ <svg class="a2ui-icon a2ui-icon-svg" viewBox="0 0 24 24">
451
+ <path d=${o}></path>
452
+ </svg>
453
+ `}let i=typeof r=="string"?X0(r):"";return F`<i class="material-icons a2ui-icon">${i}</i>`}};Zn.tagName="a2ui-icon";Zn.styles=Y`
454
+ .a2ui-icon {
455
+ display: inline-block;
456
+ width: var(--a2ui-icon-size, 24px);
457
+ height: var(--a2ui-icon-size, 24px);
458
+ font-size: var(--a2ui-icon-size, 24px);
459
+ font-style: normal;
460
+ font-weight: normal;
461
+ font-family: var(--a2ui-icon-font-family, 'Material Icons', 'Material Symbols Outlined');
462
+ color: var(
463
+ --a2ui-icon-color,
464
+ var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333))
465
+ );
466
+ font-variation-settings: var(--a2ui-icon-font-variation-settings, 'FILL' 1);
467
+ line-height: 1;
468
+ text-transform: none;
469
+ letter-spacing: normal;
470
+ word-wrap: normal;
471
+ white-space: nowrap;
472
+ direction: ltr;
473
+ -webkit-font-smoothing: antialiased;
474
+ text-rendering: optimizeLegibility;
475
+ -moz-osx-font-smoothing: grayscale;
476
+ font-feature-settings: 'liga';
477
+ vertical-align: middle;
478
+ }
479
+ .a2ui-icon.a2ui-icon-svg {
480
+ fill: currentColor;
481
+ }
482
+ `;var fp="important",Q0=" !"+fp,Xs=lt(class extends rt{constructor(t){if(super(t),t.type!==er.ATTRIBUTE||t.name!=="style"||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return n==null?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){let{style:r}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?r.removeProperty(n):r[n]=null);for(let n in e){let i=e[n];if(i!=null){this.ft.add(n);let o=typeof i=="string"&&i.endsWith(Q0);n.includes("-")||o?r.setProperty(n,o?i.slice(0,-11):i,o?fp:""):r[n]=i}}return je}});var ex={contain:"contain",cover:"cover",fill:"fill",none:"none",scaleDown:"scale-down"},Wn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.variant||"default",n=e.fit||"cover",i=ex[n]??n,o=$n(e.url);return F`<img
483
+ src=${o??E}
484
+ alt=${e.description||""}
485
+ style=${Xs({objectFit:i})}
486
+ class="a2ui-image a2ui-image-${r}"
487
+ />`}};Wn.tagName="a2ui-image";Wn.styles=Y`
488
+ .a2ui-image {
489
+ display: block;
490
+ max-width: 100%;
491
+ height: auto;
492
+ border-radius: var(--a2ui-image-border-radius, 0);
493
+ }
494
+ .a2ui-image.a2ui-image-icon {
495
+ width: var(--a2ui-image-icon-size, 24px);
496
+ height: var(--a2ui-image-icon-size, 24px);
497
+ }
498
+ .a2ui-image.a2ui-image-avatar {
499
+ width: var(--a2ui-image-avatar-size, 40px);
500
+ height: var(--a2ui-image-avatar-size, 40px);
501
+ border-radius: 50%;
502
+ }
503
+ .a2ui-image.a2ui-image-smallFeature {
504
+ max-width: var(--a2ui-image-small-feature-size, 100px);
505
+ }
506
+ .a2ui-image.a2ui-image-largeFeature {
507
+ max-height: var(--a2ui-image-large-feature-size, 400px);
508
+ }
509
+ .a2ui-image.a2ui-image-header {
510
+ height: var(--a2ui-image-header-size, 200px);
511
+ }
512
+ `;var tx={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"};function tu(t){return typeof t=="object"&&t!==null?`${t.basePath??""}/${t.id}`:String(t)}var Gn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=Array.isArray(e.children)?e.children:[],n=e.listStyle,i=e.direction||"vertical",o=e.align?tx[e.align]??"stretch":void 0,s=o?Xs({alignItems:o}):E;return n==="ordered"?F`
513
+ <ol class="a2ui-list a2ui-list-${i}" style=${s}>
514
+ ${Hr(r,tu,a=>F`<li>${this.renderNode(a)}</li>`)}
515
+ </ol>
516
+ `:n==="unordered"?F`
517
+ <ul class="a2ui-list a2ui-list-${i}" style=${s}>
518
+ ${Hr(r,tu,a=>F`<li>${this.renderNode(a)}</li>`)}
519
+ </ul>
520
+ `:F`
521
+ <div class="a2ui-list a2ui-list-${i}" style=${s}>
522
+ ${Hr(r,tu,a=>F`<div class="a2ui-list-item-none">${this.renderNode(a)}</div>`)}
523
+ </div>
524
+ `}};Gn.tagName="a2ui-list";Gn.styles=Y`
525
+ .a2ui-list {
526
+ display: flex;
527
+ padding-inline-start: var(--a2ui-list-padding, var(--a2ui-spacing-l, 24px));
528
+ margin: 0;
529
+ }
530
+ .a2ui-list.a2ui-list-vertical {
531
+ flex-direction: column;
532
+ gap: var(--a2ui-list-gap, var(--a2ui-spacing-s, 8px));
533
+ }
534
+ .a2ui-list.a2ui-list-horizontal {
535
+ flex-direction: row;
536
+ gap: var(--a2ui-list-gap, var(--a2ui-spacing-m, 16px));
537
+ list-style-position: inside;
538
+ }
539
+ .a2ui-list-item-none {
540
+ display: block;
541
+ }
542
+ .a2ui-list-horizontal .a2ui-list-item-none {
543
+ display: inline-block;
544
+ }
545
+ `;var rx=function(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o},Kr=class extends ee{constructor(){super(...arguments),this.isOpen=!1}openModal(){this.isOpen=!0}closeModal(){this.isOpen=!1}render(){let e=this.controller.props;return e?F`
546
+ <div class="a2ui-modal-wrapper">
547
+ <div @click=${()=>this.openModal()} class="a2ui-modal-trigger">
548
+ ${e.trigger?F`${this.renderNode(e.trigger)}`:E}
549
+ </div>
550
+ ${this.isOpen?F`
551
+ <div class="a2ui-modal-overlay" @click=${()=>this.closeModal()}>
552
+ <div
553
+ class="a2ui-modal-content"
554
+ role="dialog"
555
+ aria-modal="true"
556
+ @click=${r=>r.stopPropagation()}
557
+ >
558
+ <button
559
+ type="button"
560
+ class="a2ui-modal-close"
561
+ aria-label="Close"
562
+ @click=${()=>this.closeModal()}
563
+ >
564
+ &times;
565
+ </button>
566
+ ${e.content?F`${this.renderNode(e.content)}`:E}
567
+ </div>
568
+ </div>
569
+ `:E}
570
+ </div>
571
+ `:E}};Kr.tagName="a2ui-modal";Kr.styles=Y`
572
+ :host,
573
+ a2ui-modal {
574
+ display: inline-block;
575
+ }
576
+ .a2ui-modal-wrapper {
577
+ display: inline-block;
578
+ }
579
+ .a2ui-modal-trigger {
580
+ cursor: pointer;
581
+ }
582
+ .a2ui-modal-overlay {
583
+ position: fixed;
584
+ top: 0;
585
+ left: 0;
586
+ width: 100vw;
587
+ height: 100vh;
588
+ background: var(--a2ui-modal-backdrop-bg, rgba(0, 0, 0, 0.5));
589
+ display: flex;
590
+ justify-content: center;
591
+ align-items: center;
592
+ z-index: 1000;
593
+ }
594
+ .a2ui-modal-content {
595
+ background: var(--a2ui-modal-background, var(--a2ui-color-surface, #fff));
596
+ padding: var(--a2ui-modal-padding, var(--a2ui-spacing-xl, 32px));
597
+ border-radius: var(--a2ui-modal-border-radius, var(--a2ui-border-radius, 8px));
598
+ position: relative;
599
+ min-width: 300px;
600
+ max-width: 80%;
601
+ max-height: 80%;
602
+ overflow-y: auto;
603
+ box-shadow: var(--a2ui-modal-box-shadow, 0 10px 25px rgba(0, 0, 0, 0.2));
604
+ }
605
+ .a2ui-modal-close {
606
+ position: absolute;
607
+ top: 10px;
608
+ right: 15px;
609
+ border: none;
610
+ background: none;
611
+ font-size: 24px;
612
+ cursor: pointer;
613
+ color: var(--a2ui-text-caption-color, #999);
614
+ }
615
+ .a2ui-modal-close:hover {
616
+ color: var(--a2ui-text-color, #333);
617
+ }
618
+ `;rx([qr()],Kr.prototype,"isOpen",void 0);var nx={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},ix={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"};function ox(t){return typeof t=="object"&&t!==null?`${t.basePath??""}/${t.id}`:String(t)}var Hn=class extends ee{updated(e){super.updated(e);let r=this.controller.props;r&&(r.justify?this.style.justifyContent=nx[r.justify]??"flex-start":this.style.removeProperty("justify-content"),r.align?this.style.alignItems=ix[r.align]??"stretch":this.style.removeProperty("align-items"))}render(){let e=this.controller.props;if(!e)return E;let r=Array.isArray(e.children)?e.children:[];return F` ${Hr(r,ox,n=>F`${this.renderNode(n)}`)} `}};Hn.tagName="a2ui-basic-row";Hn.styles=Y`
619
+ :host,
620
+ a2ui-basic-row {
621
+ display: flex;
622
+ flex-direction: row;
623
+ gap: var(--a2ui-row-gap, var(--a2ui-spacing-m));
624
+ }
625
+ `;var Kn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.min??0,n=e.max??100,i="steps"in e?e.steps:void 0,o=typeof i=="number"&&i>0&&n>r?(n-r)/i:E;return F`
626
+ <div class="a2ui-slider-container">
627
+ <div class="a2ui-slider-header">
628
+ <span class="a2ui-slider-label">${e.label}</span>
629
+ <span class="a2ui-slider-value">${e.value}</span>
630
+ </div>
631
+ <input
632
+ type="range"
633
+ min=${r}
634
+ max=${n}
635
+ step=${o}
636
+ .value=${e.value?.toString()||"0"}
637
+ @input=${s=>e.setValue?.(Number(s.target.value))}
638
+ class="a2ui-slider"
639
+ />
640
+ ${this.renderValidationErrors(e)}
641
+ </div>
642
+ `}};Kn.tagName="a2ui-slider";Kn.styles=Y`
643
+ .a2ui-slider-container {
644
+ width: 100%;
645
+ display: flex;
646
+ flex-direction: column;
647
+ gap: var(--a2ui-spacing-xs, 4px);
648
+ margin: var(--a2ui-slider-margin, var(--a2ui-spacing-m, 16px));
649
+ }
650
+ .a2ui-slider-header {
651
+ display: flex;
652
+ justify-content: space-between;
653
+ font-size: var(
654
+ --a2ui-slider-label-font-size,
655
+ var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))
656
+ );
657
+ font-weight: var(--a2ui-slider-label-font-weight, bold);
658
+ color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));
659
+ }
660
+ .a2ui-slider {
661
+ width: 100%;
662
+ cursor: pointer;
663
+ accent-color: var(--a2ui-slider-thumb-color, var(--a2ui-color-primary, #007bff));
664
+ background: var(--a2ui-slider-track-color, var(--a2ui-color-secondary, #e9ecef));
665
+ }
666
+ .a2ui-error-message {
667
+ color: var(--a2ui-slider-color-error, red);
668
+ font-size: var(--a2ui-font-size-xs, 0.75rem);
669
+ }
670
+ `;var sx=function(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o},Jr=class extends ee{constructor(){super(...arguments),this.activeIndex=0}willUpdate(e){super.willUpdate(e);let r=this.controller?.props;r?.tabs&&this.activeIndex>=r.tabs.length&&(this.activeIndex=0)}render(){let e=this.controller?.props;return!e||!e.tabs?E:F`
671
+ <div class="a2ui-tabs">
672
+ <div class="a2ui-tab-bar">
673
+ ${e.tabs?.map((r,n)=>F`
674
+ <button
675
+ class=${He({"a2ui-tab-button":!0,"a2ui-tab-button-active":n===this.activeIndex})}
676
+ @click=${()=>this.activeIndex=n}
677
+ >
678
+ ${r.title}
679
+ </button>
680
+ `)}
681
+ </div>
682
+ <div class="a2ui-tab-content">
683
+ ${e.tabs[this.activeIndex]?F`${this.renderNode(e.tabs[this.activeIndex].child)}`:E}
684
+ </div>
685
+ </div>
686
+ `}};Jr.tagName="a2ui-tabs";Jr.styles=Y`
687
+ .a2ui-tabs {
688
+ display: flex;
689
+ flex-direction: column;
690
+ width: 100%;
691
+ }
692
+ .a2ui-tab-bar {
693
+ display: flex;
694
+ border-bottom: var(--a2ui-tabs-border, 2px solid var(--a2ui-color-border, #eee));
695
+ gap: var(--a2ui-spacing-m, 16px);
696
+ }
697
+ .a2ui-tab-button {
698
+ padding: var(--a2ui-spacing-s, 8px) var(--a2ui-spacing-m, 16px);
699
+ border: none;
700
+ background: var(--a2ui-tabs-header-background, transparent);
701
+ cursor: pointer;
702
+ font-weight: 500;
703
+ color: var(--a2ui-tabs-header-color, var(--a2ui-text-caption-color, #666));
704
+ border-bottom: 2px solid transparent;
705
+ margin-bottom: -2px;
706
+ }
707
+ .a2ui-tab-button.a2ui-tab-button-active {
708
+ background: var(--a2ui-tabs-header-background-active, transparent);
709
+ color: var(--a2ui-tabs-header-color-active, var(--a2ui-color-primary, #007bff));
710
+ border-bottom: 2px solid var(--a2ui-color-primary, #007bff);
711
+ }
712
+ .a2ui-tab-content {
713
+ padding: var(--a2ui-tabs-content-padding, var(--a2ui-spacing-m, 16px) 0);
714
+ }
715
+ `;sx([qr()],Jr.prototype,"activeIndex",void 0);var Jn=class extends Event{constructor(e,r,n,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=r,this.callback=n,this.subscribe=i??!1}};var Mi=class{constructor(e,r,n,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=e,r.context!==void 0){let o=r;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=r,this.callback=n,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Jn(this.context,this.host,this.t,this.subscribe))}};function ru({context:t,subscribe:e}){return(r,n)=>{typeof n=="object"?n.addInitializer((function(){new Mi(this,{context:t,callback:i=>{r.set.call(this,i)},subscribe:e})})):r.constructor.addInitializer((i=>{new Mi(i,{context:t,callback:o=>{i[n]=o},subscribe:e})}))}}var hp=Symbol.for("A2UIMarkdown");var mp={markdown:hp};var To=(t,e)=>{let r=t._$AN;if(r===void 0)return!1;for(let n of r)n._$AO?.(e,!1),To(n,e);return!0},Qs=t=>{let e,r;do{if((e=t._$AM)===void 0)break;r=e._$AN,r.delete(t),t=e}while(r?.size===0)},gp=t=>{for(let e;e=t._$AM;t=e){let r=e._$AN;if(r===void 0)e._$AN=r=new Set;else if(r.has(t))break;r.add(t),lx(e)}};function cx(t){this._$AN!==void 0?(Qs(this),this._$AM=t,gp(this)):this._$AM=t}function ux(t,e=!1,r=0){let n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let o=r;o<n.length;o++)To(n[o],!1),Qs(n[o]);else n!=null&&(To(n,!1),Qs(n));else To(this,t)}var lx=t=>{t.type==er.CHILD&&(t._$AP??=ux,t._$AQ??=cx)},ea=class extends rt{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,r,n){super._$AT(e,r,n),gp(this),this.isConnected=e._$AU}_$AO(e,r=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),r&&(To(this,e),Qs(this))}setValue(e){if(ap(this._$Ct))this._$Ct._$AI(e,this);else{let r=[...this._$Ct._$AH];r[this._$Ci]=e,this._$Ct._$AI(r,this,0)}}disconnected(){}reconnected(){}};var Oo=class extends rt{constructor(e){if(super(e),this.it=E,e.type!==er.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===E||e==null)return this._t=void 0,this.it=e;if(e===je)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let r=[e];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};Oo.directiveName="unsafeHTML",Oo.resultType=1;var yp=lt(Oo);var bp;var ta=class t extends ea{constructor(){super(...arguments),this.renderToken=0,this.lastValue=null,this.lastRenderer=void 0,this.lastTagClassMap=null}static resetWarningForTesting(){t.defaultMarkdownWarningLogged=!1}update(e,[r,n,i]){let o=n??bp,s=JSON.stringify(i?.tagClassMap);return this.lastValue===r&&this.lastRenderer===o&&s===this.lastTagClassMap?je:(this.lastValue=r,this.lastRenderer=o,this.lastTagClassMap=s,this.render(r,o,i))}render(e,r,n){let i=r??bp;if(i){let o=++this.renderToken;try{Promise.resolve(i(e,n)).then(s=>{this.isConnected&&o===this.renderToken&&this.setValue(yp(s))}).catch(s=>{console.error("[MarkdownDirective] Error rendering markdown:",s)})}catch(s){console.error("[MarkdownDirective] Synchronous error rendering markdown:",s)}return F`<span class="no-markdown-renderer">${e}</span>`}return t.defaultMarkdownWarningLogged||(console.warn("[MarkdownDirective]",`can't render markdown because no markdown renderer is configured.
716
+ `,"Use `@a2ui/markdown-it`, or your own markdown renderer."),t.defaultMarkdownWarningLogged=!0),F`<span class="no-markdown-renderer">${e}</span>`}};ta.defaultMarkdownWarningLogged=!1;var vp=lt(ta);var dx=function(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o},fx=new Set(["h1","h2","h3","h4","h5","caption"]),Yr=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.variant||"body",n=typeof e.text=="string"?e.text:String(e.text??""),i=typeof e.weight=="number"?`flex: ${e.weight};`:E;if(fx.has(r)){let s=F`${n}`;switch(r){case"h1":s=F`<h1>${n}</h1>`;break;case"h2":s=F`<h2>${n}</h2>`;break;case"h3":s=F`<h3>${n}</h3>`;break;case"h4":s=F`<h4>${n}</h4>`;break;case"h5":s=F`<h5>${n}</h5>`;break;case"caption":s=F`<em>${n}</em>`;break}return F`<span class="a2ui-text a2ui-text-${r}" style=${i}
717
+ >${s}</span
718
+ >`}let o=vp(n,this.markdownRenderer);return F`<span class="a2ui-text a2ui-text-${r}" style=${i}
719
+ >${o}</span
720
+ >`}};Yr.tagName="a2ui-basic-text";Yr.styles=Y`
721
+ :host {
722
+ display: contents;
723
+ }
724
+ .a2ui-text p,
725
+ .a2ui-text h1,
726
+ .a2ui-text h2,
727
+ .a2ui-text h3,
728
+ .a2ui-text h4,
729
+ .a2ui-text h5,
730
+ .a2ui-text h6,
731
+ .a2ui-text ol,
732
+ .a2ui-text ul,
733
+ .a2ui-text li,
734
+ .a2ui-text blockquote,
735
+ .a2ui-text pre {
736
+ margin: var(--_a2ui-text-margin, 0);
737
+ }
738
+ .a2ui-text {
739
+ color: var(--_a2ui-text-color, var(--a2ui-text-color-text, var(--a2ui-color-on-background)));
740
+ }
741
+ .a2ui-text h1,
742
+ .a2ui-text h2,
743
+ .a2ui-text h3,
744
+ .a2ui-text h4,
745
+ .a2ui-text h5,
746
+ .a2ui-text h6 {
747
+ font-family: var(--a2ui-font-family-title, inherit);
748
+ line-height: var(--a2ui-line-height-headings, 1.2);
749
+ }
750
+ .a2ui-text h1 {
751
+ font-size: var(--a2ui-font-size-2xl);
752
+ }
753
+ .a2ui-text h2 {
754
+ font-size: var(--a2ui-font-size-xl);
755
+ }
756
+ .a2ui-text h3 {
757
+ font-size: var(--a2ui-font-size-l);
758
+ }
759
+ .a2ui-text p,
760
+ .a2ui-text h4 {
761
+ font-size: var(--a2ui-font-size-m);
762
+ }
763
+ .a2ui-text h5 {
764
+ font-size: var(--a2ui-font-size-s);
765
+ }
766
+ .a2ui-text p {
767
+ line-height: var(--a2ui-line-height-body, 1.5);
768
+ }
769
+ .a2ui-text.a2ui-text-caption {
770
+ font-size: var(--a2ui-font-size-xs);
771
+ color: var(--a2ui-text-caption-color, light-dark(#666, #aaa));
772
+ }
773
+ .a2ui-text a {
774
+ color: var(--a2ui-text-a-color, inherit);
775
+ font-weight: var(--a2ui-text-a-font-weight, inherit);
776
+ }
777
+ `;dx([ru({context:mp.markdown,subscribe:!0})],Yr.prototype,"markdownRenderer",void 0);var Yn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=e.isValid===!1,n=a=>e.setValue?.(a.target.value),i="text";e.variant==="number"&&(i="number"),e.variant==="obscured"&&(i="password");let o={"a2ui-textfield":!0,"a2ui-invalid":r},s="placeholder"in e&&e.placeholder||E;return F`
778
+ ${e.label?F`<label>${e.label}</label>`:E}
779
+ ${e.variant==="longText"?F`<textarea
780
+ class=${He(o)}
781
+ placeholder=${s}
782
+ .value=${e.value||""}
783
+ @input=${n}
784
+ ></textarea>`:F`<input
785
+ type=${i}
786
+ class=${He(o)}
787
+ placeholder=${s}
788
+ .value=${e.value||""}
789
+ @input=${n}
790
+ />`}
791
+ ${this.renderValidationErrors(e)}
792
+ `}};Yn.tagName="a2ui-basic-textfield";Yn.styles=Y`
793
+ :host,
794
+ a2ui-basic-textfield {
795
+ display: flex;
796
+ flex-direction: column;
797
+ width: var(--a2ui-textfield-width, 100%);
798
+ gap: var(--a2ui-spacing-xs, 0.25rem);
799
+ }
800
+ .a2ui-textfield {
801
+ box-sizing: border-box;
802
+ width: 100%;
803
+ background-color: var(--a2ui-color-input, #fff);
804
+ color: var(--a2ui-color-on-input, #333);
805
+ border: var(--a2ui-textfield-border, var(--a2ui-border));
806
+ border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m));
807
+ padding: var(--a2ui-textfield-padding, var(--a2ui-spacing-m));
808
+ font-family: inherit;
809
+ }
810
+ .a2ui-textfield:focus {
811
+ outline: none;
812
+ border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));
813
+ }
814
+ .a2ui-textfield.a2ui-invalid {
815
+ border-color: var(--a2ui-textfield-color-error, red);
816
+ }
817
+ label {
818
+ font-size: var(
819
+ --a2ui-textfield-label-font-size,
820
+ var(--a2ui-label-font-size, var(--a2ui-font-size-s))
821
+ );
822
+ font-weight: var(--a2ui-textfield-label-font-weight, var(--a2ui-label-font-weight, bold));
823
+ }
824
+ .a2ui-error-message {
825
+ color: var(--a2ui-textfield-color-error, red);
826
+ font-size: var(--a2ui-font-size-xs, 0.75rem);
827
+ }
828
+ `;var Xn=class extends ee{render(){let e=this.controller.props;if(!e)return E;let r=$n(e.url),n="posterUrl"in e?$n(e.posterUrl):void 0;return F`
829
+ <div class="a2ui-video-container">
830
+ <video
831
+ src=${r??E}
832
+ poster=${n??E}
833
+ controls
834
+ class="a2ui-video"
835
+ >
836
+ Your browser does not support the video tag.
837
+ </video>
838
+ </div>
839
+ `}};Xn.tagName="a2ui-video";Xn.styles=Y`
840
+ .a2ui-video-container {
841
+ width: 100%;
842
+ max-width: 100%;
843
+ }
844
+ .a2ui-video {
845
+ width: 100%;
846
+ height: auto;
847
+ display: block;
848
+ border-radius: var(--a2ui-video-border-radius, 0);
849
+ }
850
+ `;var $e=pl("Weight",d.number().describe("The relative weight of this component within a Row or Column. This is similar to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column.")),xp={name:"Text",schema:W(d.object({text:Q.describe("REF:#/$defs/DynamicString|The text content to display. While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation."),variant:d.enum(["caption","body"]).default("body").describe("A hint for the base text style.").optional(),weight:$e.optional()}).strict(),{mixins:[]})},Ap={name:"Image",schema:W(d.object({url:Q.describe("REF:#/$defs/DynamicString|The URL of the image to display."),description:Q.describe("REF:#/$defs/DynamicString|Accessibility text for the image.").optional(),fit:d.enum(["contain","cover","fill","none","scaleDown"]).default("fill").describe("Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.").optional(),variant:d.enum(["icon","avatar","smallFeature","mediumFeature","largeFeature","header"]).default("mediumFeature").describe("A hint for the image size and style.").optional(),weight:$e.optional()}).strict(),{mixins:[]})},Dp={name:"Icon",schema:W(d.object({name:d.union([d.enum(["accountCircle","add","arrowBack","arrowForward","attachFile","calendarToday","call","camera","check","close","delete","download","edit","event","error","fastForward","favorite","favoriteOff","folder","help","home","info","locationOn","lock","lockOpen","mail","menu","moreVert","moreHoriz","notificationsOff","notifications","pause","payment","person","phone","photo","play","print","refresh","rewind","search","send","settings","share","shoppingCart","skipNext","skipPrevious","star","starHalf","starOff","stop","upload","visibility","visibilityOff","volumeDown","volumeMute","volumeOff","volumeUp","warning"]),W(d.object({svgPath:Q.describe("REF:#/$defs/DynamicString")}),{closure:"additionalProperties"}),wt.describe("REF:#/$defs/DataBinding")]).describe("The name of the icon to display."),weight:$e.optional()}).strict(),{mixins:[]})},Cp={name:"Video",schema:W(d.object({url:Q.describe("REF:#/$defs/DynamicString|The URL of the video to display."),posterUrl:Q.describe("REF:#/$defs/DynamicString|The URL of the poster image to display before the video plays.").optional(),weight:$e.optional()}).strict(),{mixins:[]})},wp={name:"AudioPlayer",schema:W(d.object({url:Q.describe("REF:#/$defs/DynamicString|The URL of the audio to be played."),description:Q.describe("REF:#/$defs/DynamicString|A description of the audio, such as a title or summary.").optional(),weight:$e.optional()}).strict(),{mixins:[]})},Ep={name:"Row",schema:W(d.object({children:po.describe("REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID."),justify:d.enum(["center","end","spaceAround","spaceBetween","spaceEvenly","start","stretch"]).default("start").describe("Defines the arrangement of children along the main axis (horizontally). Use 'spaceBetween' to push items to the edges, or 'start'/'end'/'center' to pack them together.").optional(),align:d.enum(["start","center","end","stretch"]).default("stretch").describe("Defines the alignment of children along the cross axis (vertically). This is similar to the CSS 'align-items' property, but uses camelCase values (e.g., 'start').").optional(),weight:$e.optional()}).describe("A layout component that arranges its children horizontally. To create a grid layout, nest Columns within this Row.").strict(),{mixins:[]})},Sp={name:"Column",schema:W(d.object({children:po.describe("REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID."),justify:d.enum(["start","center","end","spaceBetween","spaceAround","spaceEvenly","stretch"]).default("start").describe("Defines the arrangement of children along the main axis (vertically). Use 'spaceBetween' to push items to the edges (e.g. header at top, footer at bottom), or 'start'/'end'/'center' to pack them together.").optional(),align:d.enum(["center","end","start","stretch"]).default("stretch").describe("Defines the alignment of children along the cross axis (horizontally). This is similar to the CSS 'align-items' property.").optional(),weight:$e.optional()}).describe("A layout component that arranges its children vertically. To create a grid layout, nest Rows within this Column.").strict(),{mixins:[]})},_p={name:"List",schema:W(d.object({children:po.describe("REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list."),direction:d.enum(["vertical","horizontal"]).default("vertical").describe("The direction in which the list items are laid out.").optional(),align:d.enum(["start","center","end","stretch"]).default("stretch").describe("Defines the alignment of children along the cross axis.").optional(),weight:$e.optional()}).strict(),{mixins:[]})},Ip={name:"Card",schema:W(d.object({child:Ei.describe("REF:#/$defs/Child|The ID of the single child component to be rendered inside the card. To display multiple elements, you MUST wrap them in a layout component (like Column or Row) and pass that container's ID here. Do NOT pass multiple IDs or a non-existent ID."),weight:$e.optional()}).strict(),{mixins:[]})},kp={name:"Tabs",schema:W(d.object({tabs:d.array(W(d.object({title:Q.describe("REF:#/$defs/DynamicString|The tab title."),child:Ei.describe("REF:#/$defs/Child|The ID of the child component.")}),{closure:"additionalProperties"})).min(1).describe("An array of objects, where each object defines a tab with a title and a child component."),weight:$e.optional()}).strict(),{mixins:[]})},Fp={name:"Modal",schema:W(d.object({trigger:Ei.describe("REF:#/$defs/Child|The ID of the component that opens the modal when interacted with (e.g., a button)."),content:Ei.describe("REF:#/$defs/Child|The ID of the component to be displayed inside the modal."),weight:$e.optional()}).strict(),{mixins:[]})},$p={name:"Divider",schema:W(d.object({axis:d.enum(["horizontal","vertical"]).default("horizontal").describe("The orientation of the divider.").optional(),weight:$e.optional()}).strict(),{mixins:[]})},Rp={name:"Button",schema:W(d.object({checks:d.array(Pr.describe("REF:#/$defs/CheckRule")).describe("A list of validation check rules to perform on the component.").optional(),child:Ei.describe("REF:#/$defs/Child|The ID of the child component. Use a 'Text' component for a labeled button. Only use an 'Icon' if the requirements explicitly ask for an icon-only button."),variant:d.enum(["default","primary","borderless"]).default("default").describe("A hint for the button style. If omitted, a default button style is used. 'primary' indicates this is the main call-to-action button. 'borderless' means the button has no visual border or background, making its child content appear like a clickable link.").optional(),action:Cd.describe("REF:#/$defs/Action"),weight:$e.optional()}).strict(),{mixins:["Checkable"]})},Tp={name:"TextField",schema:W(d.object({checks:d.array(Pr.describe("REF:#/$defs/CheckRule")).describe("A list of validation check rules to perform on the component.").optional(),label:Q.describe("REF:#/$defs/DynamicString|The text label for the input field."),value:Q.describe("REF:#/$defs/DynamicString|The value of the text field.").optional(),placeholder:Q.describe("REF:#/$defs/DynamicString|The placeholder text for the input field.").optional(),variant:d.enum(["longText","number","shortText","obscured"]).default("shortText").describe("The type of input field to display.").optional(),weight:$e.optional()}).strict(),{mixins:["Checkable"]})},Op={name:"CheckBox",schema:W(d.object({checks:d.array(Pr.describe("REF:#/$defs/CheckRule")).describe("A list of validation check rules to perform on the component.").optional(),label:Q.describe("REF:#/$defs/DynamicString|The text to display next to the checkbox."),value:Kt.describe("REF:#/$defs/DynamicBoolean|The current state of the checkbox (true for checked, false for unchecked)."),weight:$e.optional()}).strict(),{mixins:["Checkable"]})},Np={name:"ChoicePicker",schema:W(d.object({checks:d.array(Pr.describe("REF:#/$defs/CheckRule")).describe("A list of validation check rules to perform on the component.").optional(),label:Q.describe("REF:#/$defs/DynamicString|The label for the group of options.").optional(),variant:d.enum(["multipleSelection","mutuallyExclusive"]).default("mutuallyExclusive").describe("A hint for how the choice picker should be displayed and behave.").optional(),options:d.array(W(d.object({label:Q.describe("REF:#/$defs/DynamicString|The text to display for this option."),value:d.string().describe("The stable value associated with this option.")}),{closure:"additionalProperties"})).describe("The list of available options to choose from."),value:rc.describe("REF:#/$defs/DynamicStringList|The list of currently selected values. This should be bound to a string array in the data model."),displayStyle:d.enum(["checkbox","chips"]).default("checkbox").describe("The display style of the component.").optional(),filterable:d.boolean().default(!1).describe("If true, displays a search input to filter the options.").optional(),weight:$e.optional()}).describe("A component that allows selecting one or more options from a list.").strict(),{mixins:["Checkable"]})},jp={name:"Slider",schema:W(d.object({checks:d.array(Pr.describe("REF:#/$defs/CheckRule")).describe("A list of validation check rules to perform on the component.").optional(),label:Q.describe("REF:#/$defs/DynamicString|The label for the slider.").optional(),min:d.number().default(0).describe("The minimum value of the slider.").optional(),max:d.number().describe("The maximum value of the slider."),value:jt.describe("REF:#/$defs/DynamicNumber|The current value of the slider."),steps:W(d.number().int().describe("The number of discrete divisions in the slider range. If specified, the slider will snap to discrete values."),{keywords:{minimum:1}}).optional(),weight:$e.optional()}).strict(),{mixins:["Checkable"],required:["value","max"]})},Pp={name:"DateTimeInput",schema:W(d.object({checks:d.array(Pr.describe("REF:#/$defs/CheckRule")).describe("A list of validation check rules to perform on the component.").optional(),value:Q.describe("REF:#/$defs/DynamicString|The selected date and/or time value in ISO 8601 format. If not yet set, initialize with an empty string."),enableDate:d.boolean().default(!1).describe("If true, allows the user to select a date.").optional(),enableTime:d.boolean().default(!1).describe("If true, allows the user to select a time.").optional(),min:W(Q.describe("REF:#/$defs/DynamicString|The minimum allowed date/time in ISO 8601 format."),{allOf:[{if:{type:"string"},then:{oneOf:[{format:"date"},{format:"time"},{format:"date-time"}]}}]}).optional(),max:W(Q.describe("REF:#/$defs/DynamicString|The maximum allowed date/time in ISO 8601 format."),{allOf:[{if:{type:"string"},then:{oneOf:[{format:"date"},{format:"time"},{format:"date-time"}]}}]}).optional(),label:Q.describe("REF:#/$defs/DynamicString|The text label for the input field.").optional(),weight:$e.optional()}).strict(),{mixins:["Checkable"]})};var Mp={schemaUri:"https://json-schema.org/draft/2020-12/schema",schemaId:"https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",title:"A2UI Basic Catalog",description:"Unified catalog of basic A2UI components and functions.",instructions:`For layout, use the Row and Column components to organize other components.
851
+
852
+ ## Catalog Guidelines
853
+
854
+ 1. String Concatenation & Formatting: A2UI does not support binary operators like '+' or formatting symbols. To concatenate strings or dynamically inject data bindings into text, you must use the catalog function \`formatString(value)\` where the value string contains placeholders formatted as \`\${expression}\`:
855
+ formatString("Hello \${/user/name}")
856
+
857
+ 2. Strict Hierarchy: You must strictly adhere to the requested component nesting and hierarchy. If the prompt specifies that a component is 'inside' or 'contained in' another component, you MUST place it as a child of that specific component, not as a sibling or in a different container.
858
+
859
+ 3. Validation Checks: When components support validation checks, specify any custom error messages directly as the 'message' inside the check. Do NOT create separate text-display components to display validation errors.
860
+
861
+ ## Examples
862
+
863
+ Example 1: Dynamic text form
864
+ \`\`\`json
865
+ [
866
+ {
867
+ "version": "1.0",
868
+ "createSurface": {
869
+ "surfaceId": "main",
870
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
871
+ "components": [
872
+ {
873
+ "id": "root",
874
+ "component": "Column",
875
+ "children": ["repField", "valueField"]
876
+ },
877
+ {
878
+ "id": "repField",
879
+ "component": "TextField",
880
+ "label": "Representative",
881
+ "value": {"@path": "/form/rep"},
882
+ "placeholder": "Enter name"
883
+ },
884
+ {
885
+ "id": "valueField",
886
+ "component": "TextField",
887
+ "label": "Deal Value",
888
+ "value": {"@path": "/form/value"},
889
+ "placeholder": "0.00",
890
+ "variant": "number",
891
+ "checks": [
892
+ {
893
+ "condition": {
894
+ "@call": "required",
895
+ "args": {"value": {"@path": "/form/value"}}
896
+ },
897
+ "message": "Deal value is required."
898
+ }
899
+ ]
900
+ }
901
+ ],
902
+ "dataModel": {
903
+ "form": {
904
+ "rep": "John Doe",
905
+ "value": 1500.00
906
+ }
907
+ }
908
+ }
909
+ }
910
+ ]
911
+ \`\`\`
912
+
913
+ Example 2: Dynamic list with templates
914
+ \`\`\`json
915
+ [
916
+ {
917
+ "version": "1.0",
918
+ "createSurface": {
919
+ "surfaceId": "main",
920
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
921
+ "components": [
922
+ {
923
+ "id": "root",
924
+ "component": "Card",
925
+ "child": "breedList"
926
+ },
927
+ {
928
+ "id": "breedList",
929
+ "component": "List",
930
+ "children": {
931
+ "path": "/breeds",
932
+ "componentId": "breedTemplate"
933
+ },
934
+ "direction": "horizontal"
935
+ },
936
+ {
937
+ "id": "breedTemplate",
938
+ "component": "Image",
939
+ "url": {"@path": "url"}
940
+ }
941
+ ],
942
+ "dataModel": {
943
+ "breeds": [
944
+ {
945
+ "url": "https://example.com/poodle.jpg"
946
+ },
947
+ {
948
+ "url": "https://example.com/lab.jpg"
949
+ }
950
+ ]
951
+ }
952
+ }
953
+ }
954
+ ]
955
+ \`\`\``,declaredProtocolVersion:"1.0",commonTypesUri:"common_types.json"};var Lp=_e(Mn,wp),Bp=_e(Ln,Rp),Vp=_e(Bn,Ip),Up=_e(Vn,Op),zp=_e(Wr,Np),qp=_e(Un,Sp),Zp=_e(zn,Pp),Wp=_e(qn,$p),Gp=_e(Zn,Dp),Hp=_e(Wn,Ap),Kp=_e(Gn,_p),Jp=_e(Kr,Fp),Yp=_e(Hn,Ep),Xp=_e(Kn,jp),Qp=_e(Jr,kp),eh=_e(Yr,xp),th=_e(Yn,Tp),rh=_e(Xn,Cp);var nh={name:"required",returnType:"validationResult",description:"Checks that the value is not null, undefined, or empty.",schema:W(d.object({value:d.any().refine(t=>t!==void 0,"Required").describe("The value to check.")}),{closure:"unevaluatedProperties"})},ih={name:"regex",returnType:"validationResult",description:"Checks that the value matches a regular expression string.",schema:W(d.object({value:Q.describe("REF:#/$defs/DynamicString"),pattern:d.string().describe("The regex pattern to match against.")}),{closure:"unevaluatedProperties"})},oh={name:"length",returnType:"validationResult",description:"Checks string length constraints.",schema:W(d.object({value:Q.describe("REF:#/$defs/DynamicString"),min:W(d.number().int().describe("The minimum allowed length."),{keywords:{minimum:0}}).optional(),max:W(d.number().int().describe("The maximum allowed length."),{keywords:{minimum:0}}).optional()}),{closure:"unevaluatedProperties",keywords:{anyOf:[{required:["min"]},{required:["max"]}]}})},sh={name:"numeric",returnType:"validationResult",description:"Checks numeric range constraints.",schema:W(d.object({value:jt.describe("REF:#/$defs/DynamicNumber"),min:d.number().describe("The minimum allowed value.").optional(),max:d.number().describe("The maximum allowed value.").optional()}),{closure:"unevaluatedProperties",keywords:{anyOf:[{required:["min"]},{required:["max"]}]}})},ah={name:"email",returnType:"validationResult",description:"Checks that the value is a valid email address.",schema:W(d.object({value:Q.describe("REF:#/$defs/DynamicString")}),{closure:"unevaluatedProperties"})},ch={name:"formatString",returnType:"string",description:"Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${expression}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and renderer-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\${`.",schema:W(d.object({value:Q.describe("REF:#/$defs/DynamicString")}),{closure:"unevaluatedProperties"})},uh={name:"formatNumber",returnType:"string",description:"Formats a number with the specified grouping and decimal precision.",schema:W(d.object({value:jt.describe("REF:#/$defs/DynamicNumber|The number to format."),decimals:jt.describe("REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.").optional(),grouping:Kt.describe("REF:#/$defs/DynamicBoolean|Optional. If true, uses locale-specific grouping separators (e.g. '1,000'). If false, returns raw digits (e.g. '1000'). Defaults to true.").optional()}),{closure:"unevaluatedProperties"})},lh={name:"formatCurrency",returnType:"string",description:"Formats a number as a currency string.",schema:W(d.object({value:jt.describe("REF:#/$defs/DynamicNumber|The monetary amount."),currency:Q.describe("REF:#/$defs/DynamicString|The ISO 4217 currency code (e.g., 'USD', 'EUR')."),decimals:jt.describe("REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.").optional(),grouping:Kt.describe("REF:#/$defs/DynamicBoolean|Optional. If true, uses locale-specific grouping separators (e.g. '1,000'). If false, returns raw digits (e.g. '1000'). Defaults to true.").optional()}),{required:["currency","value"],closure:"unevaluatedProperties"})},dh={name:"formatDate",returnType:"string",description:"Formats a timestamp into a string using a pattern.",schema:W(d.object({value:gs.describe("REF:#/$defs/DynamicValue|The date to format."),format:Q.describe(`REF:#/$defs/DynamicString|A Unicode TR35 date pattern string.
956
+
957
+ Token Reference:
958
+ - Year: 'yy' (26), 'yyyy' (2026)
959
+ - Month: 'M' (1), 'MM' (01), 'MMM' (Jan), 'MMMM' (January)
960
+ - Day: 'd' (1), 'dd' (01), 'E' (Tue), 'EEEE' (Tuesday)
961
+ - Hour (12h): 'h' (1-12), 'hh' (01-12) - requires 'a' for AM/PM
962
+ - Hour (24h): 'H' (0-23), 'HH' (00-23) - Military Time
963
+ - Minute: 'mm' (00-59)
964
+ - Second: 'ss' (00-59)
965
+ - Period: 'a' (AM/PM)
966
+
967
+ Examples:
968
+ - 'MMM dd, yyyy' -> 'Jan 16, 2026'
969
+ - 'HH:mm' -> '14:30' (Military)
970
+ - 'h:mm a' -> '2:30 PM'
971
+ - 'EEEE, d MMMM' -> 'Friday, 16 January'`)}),{required:["format","value"],closure:"unevaluatedProperties"})},fh={name:"pluralize",returnType:"string",description:"Returns a localized string based on the Common Locale Data Repository (CLDR) plural category of the count (zero, one, two, few, many, other). Requires an 'other' fallback. For English, just use 'one' and 'other'.",schema:W(d.object({value:jt.describe("REF:#/$defs/DynamicNumber|The numeric value used to determine the plural category."),zero:Q.describe("REF:#/$defs/DynamicString|String for the 'zero' category (e.g., 0 items).").optional(),one:Q.describe("REF:#/$defs/DynamicString|String for the 'one' category (e.g., 1 item).").optional(),two:Q.describe("REF:#/$defs/DynamicString|String for the 'two' category (used in Arabic, Welsh, etc.).").optional(),few:Q.describe("REF:#/$defs/DynamicString|String for the 'few' category (e.g., small groups in Slavic languages).").optional(),many:Q.describe("REF:#/$defs/DynamicString|String for the 'many' category (e.g., large groups in various languages).").optional(),other:Q.describe("REF:#/$defs/DynamicString|The default/fallback string (used for general plural cases).")}),{closure:"unevaluatedProperties"})},ph={name:"openUrl",returnType:"void",requiresUserActivation:!0,description:"Opens the specified URL in a browser or handler (requires user activation). This function has no return value.",schema:W(d.object({url:d.union([W(d.string(),{keywords:{format:"uri"}}),wt.describe("REF:#/$defs/DataBinding"),ct.describe("REF:#/$defs/FunctionCall")]).describe("The URL to open.")}),{closure:"unevaluatedProperties"})},hh={name:"and",returnType:"boolean",description:"Performs a logical AND operation on a list of boolean values.",schema:W(d.object({values:d.array(Kt.describe("REF:#/$defs/DynamicBoolean")).min(2).describe("The list of boolean values to evaluate.")}),{closure:"unevaluatedProperties"})},mh={name:"or",returnType:"boolean",description:"Performs a logical OR operation on a list of boolean values.",schema:W(d.object({values:d.array(Kt.describe("REF:#/$defs/DynamicBoolean")).min(2).describe("The list of boolean values to evaluate.")}),{closure:"unevaluatedProperties"})},gh={name:"not",returnType:"boolean",description:"Performs a logical NOT operation on a boolean value.",schema:W(d.object({value:Kt.describe("REF:#/$defs/DynamicBoolean|The boolean value to negate.")}),{closure:"unevaluatedProperties"})};var yh=nh,bh=ih,vh=oh,xh=sh,Ah=ah;var Qn="en-US";function ra(t){if(!t)return Qn;try{return Intl.NumberFormat.supportedLocalesOf(t).length>0?t:Qn}catch{return Qn}}function px(t){if(t==null)return"";if(typeof t=="object")try{return JSON.stringify(t)??String(t)}catch{return String(t)}return String(t)}function _h(t){let e=!0;return(t==null||typeof t=="string"&&t===""||Array.isArray(t)&&t.length===0)&&(e=!1),{valid:e,...e?{}:{message:"This field is required."}}}function Ih(t,e){if(!Rf(e))throw new K(`Unsafe regex pattern (catastrophic backtracking risk): ${e}`,"regex");try{let r=new RegExp(e).test(String(t??""));return{valid:r,...r?{}:{message:"Value does not match required pattern."}}}catch(r){throw new K(`Invalid regex pattern: ${e}`,"regex",r)}}function kh(t,e,r){let n=0;(typeof t=="string"||Array.isArray(t))&&(n=t.length);let i=!0,o;return e!==void 0&&!isNaN(e)&&n<e?(i=!1,o=`Minimum length is ${e}.`):r!==void 0&&!isNaN(r)&&n>r&&(i=!1,o=`Maximum length is ${r}.`),{valid:i,...o?{message:o}:{}}}function Fh(t,e,r){let n=Number(t);if(isNaN(n))return{valid:!1,message:"Value must be a valid number."};let i=!0,o;return e!==void 0&&!isNaN(e)&&n<e?(i=!1,o=`Minimum value is ${e}.`):r!==void 0&&!isNaN(r)&&n>r&&(i=!1,o=`Maximum value is ${r}.`),{valid:i,...o?{message:o}:{}}}var hx=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;function $h(t){let e=typeof t=="string"&&hx.test(t);return{valid:e,...e?{}:{code:"INVALID_EMAIL",severity:"error",message:"Please enter a valid email address (e.g. user@example.com)."}}}var Dh=new Map;function mx(t,e,r){let n=`${t}:${e??"undef"}:${r??"true"}`,i=Dh.get(n);return i||(i=new Intl.NumberFormat(t,{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:r}),Dh.set(n,i)),i}var Ch=new Map;function gx(t,e,r,n){let i=`${t}:${e}:${r??"undef"}:${n??"true"}`,o=Ch.get(i);return o||(o=new Intl.NumberFormat(t,{style:"currency",currency:e,minimumFractionDigits:r,maximumFractionDigits:r,useGrouping:n}),Ch.set(i,o)),o}var yx="USD",wh=new Map;function bx(t,e,r){let n=`${t}:${e??"undef"}:${r??"true"}`,i=wh.get(n);return i||(i=new Intl.NumberFormat(t,{style:"currency",currency:yx,currencyDisplay:"code",minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:r}),wh.set(n,i)),i}var Eh=new Map;function vx(t){let e=Eh.get(t);if(!e){let r=(o,s)=>{let a=new Intl.DateTimeFormat(t,{...o,timeZone:"UTC"});return s.map(c=>a.format(c))},n=Array.from({length:12},(o,s)=>new Date(Date.UTC(2021,s,15))),i=Array.from({length:7},(o,s)=>new Date(Date.UTC(2021,2,1+s)));e={monthsLong:r({month:"long"},n),monthsShort:r({month:"short"},n),weekdaysLong:r({weekday:"long"},i),weekdaysShort:r({weekday:"short"},i)},Eh.set(t,e)}return e}var xx=/yyyy|yy|MMMM|MMM|MM|M|EEEE|E|dd|d|HH|H|hh|h|mm|ss|a/g,Ax=/(?:Z|[+-]\d{2}:?\d{2})$/,Dx=/^([+-]?\d{4,6})-(\d{2})-(\d{2})(?:[T ](\d{2})(?::(\d{2})(?::(\d{2}))?)?)?/;function Cx(t){let e=Ax.test(t),r=new Date(e?t:`${t}Z`);if(isNaN(r.getTime()))return null;let n=0,i=/([+-])(\d{2}):?(\d{2})$/.exec(t);i&&(n=(i[1]==="-"?-1:1)*(Number(i[2])*60+Number(i[3])));let o=new Date(r.getTime()+n*6e4);return wx(t,o)?{shifted:o,instant:r}:null}function wx(t,e){let r=Dx.exec(t);if(!r)return!1;let n=i=>r[i]===void 0?void 0:Number(r[i]);return n(1)===e.getUTCFullYear()&&n(2)===e.getUTCMonth()+1&&n(3)===e.getUTCDate()&&(n(4)??e.getUTCHours())===e.getUTCHours()&&(n(5)??e.getUTCMinutes())===e.getUTCMinutes()&&(n(6)??e.getUTCSeconds())===e.getUTCSeconds()}var Sh=new Map;function Ex(t){let e=Sh.get(t);return e||(e=new Intl.PluralRules(t),Sh.set(t,e)),e}var Li=t=>!!t,na=t=>{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let e=t.valid;if(typeof e=="boolean")return e}return!!t};function Sx(t,e=Li){if(!Array.isArray(t)||t.length<2)throw new K("and requires at least 2 values","and");return t.every(e)}function _x(t,e=Li){if(!Array.isArray(t)||t.length<2)throw new K("or requires at least 2 values","or");return t.some(e)}function Ix(t,e=Li){return!e(t)}function Rh(t){if(typeof t!="object"||t===null||Array.isArray(t))return t;if("path"in t&&typeof t.path=="string"&&!("@path"in t))return{"@path":t.path};if("call"in t&&typeof t.call=="string"&&!("@call"in t)){let e={};if(t.args&&typeof t.args=="object")for(let[r,n]of Object.entries(t.args))e[r]=Rh(n);return{"@call":t.call,args:e,returnType:t.returnType}}return t}function kx(t,e){let n=new Ao().parse(t);if(n.length===0)return"";let i=oe(e.surface?.protocolVersion??e.surface?.defaultCatalog?.protocolVersion,"1.0"),o=n.map(s=>{if(typeof s!="object"||s===null||Array.isArray(s))return s;let a=i?Rh(s):s;return e.resolveSignal(a)});return at(()=>o.map(s=>px(Nr(s)?ye(s):s)).join(""))}function Fx(t,e,r,n=Qn){return isNaN(t)?"":mx(n,e,r).format(t)}function $x(t,e,r=2,n,i=Qn){if(isNaN(t))return"";let o=String(e).toUpperCase();try{return gx(i,o,r,n).format(t)}catch{return bx(i,r,n).formatToParts(t).map(s=>s.type==="currency"?o:s.value).join("")}}function Rx(t,e="yyyy-MM-dd",r=Qn){if(!t)return"";let n=Cx(String(t));if(!n)return"";let{shifted:i,instant:o}=n,s=e||"yyyy-MM-dd";if(s==="ISO")return o.toISOString();let a=vx(r),c=(i.getUTCDay()+6)%7,u=i.getUTCHours(),l=u%12||12;return s.replace(xx,f=>{switch(f){case"yyyy":return String(i.getUTCFullYear());case"yy":return String(i.getUTCFullYear()).slice(-2);case"MMMM":return a.monthsLong[i.getUTCMonth()];case"MMM":return a.monthsShort[i.getUTCMonth()];case"MM":return String(i.getUTCMonth()+1).padStart(2,"0");case"M":return String(i.getUTCMonth()+1);case"EEEE":return a.weekdaysLong[c];case"E":return a.weekdaysShort[c];case"dd":return String(i.getUTCDate()).padStart(2,"0");case"d":return String(i.getUTCDate());case"HH":return String(u).padStart(2,"0");case"H":return String(u);case"hh":return String(l).padStart(2,"0");case"h":return String(l);case"mm":return String(i.getUTCMinutes()).padStart(2,"0");case"ss":return String(i.getUTCSeconds()).padStart(2,"0");case"a":return u<12?"AM":"PM";default:return f}})}function Tx(t,e,r=Qn){let n;return t===0&&e.zero!==void 0?n="zero":t===1&&e.one!==void 0?n="one":t===2&&e.two!==void 0?n="two":n=Ex(r).select(t),String(e[n]??e.other??"")}function Ox(t){let e=typeof t=="string"?t:void 0;if(!e||typeof window>"u"||typeof window.open!="function")return;let r=typeof window<"u"&&typeof window.location<"u"&&window.location.href?window.location.href:void 0,n;try{n=r?new URL(e,r):new URL(e)}catch(i){throw new K(`Invalid URL specified: ${e}`,"openUrl",i)}if(n.protocol!=="https:"&&n.protocol!=="http:"&&n.protocol!=="mailto:"&&n.protocol!=="tel:")throw new K(`Unsupported URL scheme: ${n.protocol}`,"openUrl");window.open(n.href,"_blank","noopener,noreferrer")}function Th(t,{truthy:e=Li}={}){return ke(t,r=>Sx(r.values,e))}function Oh(t,{truthy:e=Li}={}){return ke(t,r=>_x(r.values,e))}function Nh(t,{truthy:e=Li}={}){return ke(t,r=>Ix(r.value,e))}function jh(t){return ke(t,(e,r)=>kx(e.value,r))}function Ph(t,e){let r=ra(e);return ke(t,n=>Fx(n.value,n.decimals,n.grouping,r))}function Mh(t,e){let r=ra(e);return ke(t,n=>$x(n.value,n.currency,n.decimals??2,n.grouping,r))}function Lh(t,e){let r=ra(e);return ke(t,n=>Rx(n.value,n.format,r))}function Bh(t,e){let r=ra(e);return ke(t,n=>Tx(n.value,n,r))}function Vh(t){return ke(t,e=>Ox(e.url))}var Nx=ke(yh,t=>_h(t.value)),jx=ke(bh,t=>Ih(t.value,t.pattern)),Px=ke(vh,t=>kh(t.value,t.min,t.max)),Mx=ke(xh,t=>Fh(t.value,t.min,t.max)),Lx=ke(Ah,t=>$h(t.value)),Uh=[Nx,jx,Px,Mx,Lx];var Bx=Th(hh,{truthy:na}),Vx=Oh(mh,{truthy:na}),Ux=Nh(gh,{truthy:na}),zx=jh(ch);function zh(t){return Ph(uh,t)}var ZR=zh();function qh(t){return Mh(lh,t)}var WR=qh();function Zh(t){return Lh(dh,t)}var GR=Zh();function Wh(t){return Bh(fh,t)}var HR=Wh(),qx=Vh(ph);function Zx(t){let e=t?.locale;return[...Uh,zx,zh(e),qh(e),Zh(e),Wh(e),qx,Bx,Vx,Ux,ho]}var Gh=Zx();var nu=new Ht("https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json","1.0",[eh,Hp,Gp,rh,Lp,Yp,qp,Kp,Vp,Qp,Jp,Wp,Bp,th,Up,zp,Xp,Zp],Gh,{themeSchema:ip,...Mp});var iu=function(t,e,r,n,i,o){function s(D){if(D!==void 0&&typeof D!="function")throw new TypeError("Function expected");return D}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",u=!e&&t?n.static?t:t.prototype:null,l=e||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),f,h=!1,p=r.length-1;p>=0;p--){var m={};for(var y in n)m[y]=y==="access"?{}:n[y];for(var y in n.access)m.access[y]=n.access[y];m.addInitializer=function(D){if(h)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(D||null))};var A=(0,r[p])(a==="accessor"?{get:l.get,set:l.set}:l[c],m);if(a==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(f=s(A.get))&&(l.get=f),(f=s(A.set))&&(l.set=f),(f=s(A.init))&&i.unshift(f)}else(f=s(A))&&(a==="field"?i.unshift(f):l[c]=f)}u&&Object.defineProperty(u,n.name,l),h=!0},No=function(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0},ou=(()=>{let t=[Yf("a2ui-surface")],e,r=[],n,i=Qt,o,s=[],a=[],c,u=[],l=[];var f=class extends i{static{n=this}constructor(){super(...arguments),this.#e=No(this,s,void 0),this.#t=(No(this,a),No(this,u,void 0)),this.unsubscribe=No(this,l)}static{let h=typeof Symbol=="function"&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;o=[Pn({type:Object})],c=[qr()],iu(this,null,o,{kind:"accessor",name:"surface",static:!1,private:!1,access:{has:p=>"surface"in p,get:p=>p.surface,set:(p,m)=>{p.surface=m}},metadata:h},s,a),iu(this,null,c,{kind:"accessor",name:"_rootNode",static:!1,private:!1,access:{has:p=>"_rootNode"in p,get:p=>p._rootNode,set:(p,m)=>{p._rootNode=m}},metadata:h},u,l),iu(null,e={value:n},t,{kind:"class",name:n.name,metadata:h},null,r),f=n=e.value,h&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),No(n,r)}#e;get surface(){return this.#e}set surface(h){this.#e=h}#t;get _rootNode(){return this.#t}set _rootNode(h){this.#t=h}get rootNode(){return this._rootNode}createRenderRoot(){return this}willUpdate(h){h.has("surface")&&this.subscribeToRoot()}connectedCallback(){super.connectedCallback(),this.surface&&!this.unsubscribe&&this.subscribeToRoot()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.unsubscribe=void 0,this._rootNode=void 0}subscribeToRoot(){if(this.unsubscribe?.(),this.unsubscribe=void 0,this._rootNode=void 0,!this.surface)return;let h=new Fs(this.surface),p=Nt(()=>{this._rootNode=ye(h.rootNode)});this.unsubscribe=()=>{p(),h.dispose()}}render(){if(!this.surface)return E;let h=this._rootNode;if(!h||h.isPlaceholder)return E;try{return Ar(h)}catch(p){return console.error("Error rendering root node:",p),F`<div>Error rendering surface</div>`}}};return f=n})();var Wx=Symbol.for("A2UIMarkdown");var Gx={bubbles:!0,cancelable:!0,composed:!0},Hh=class t extends CustomEvent{static{this.eventName="a2uiaction"}constructor(e){super(t.eventName,{detail:e,...Gx}),this.payload=e}};function Kh(t,e){return Object.is(t,e)}var Ie=null,jo=!1,ia=1,oa=Symbol("SIGNAL");function Bi(t){let e=Ie;return Ie=t,e}function Kx(){return Ie}function Jx(){return jo}var lu={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function aa(t){if(jo)throw new Error(typeof ngDevMode<"u"&&ngDevMode?"Assertion error: signal read during notification phase":"");if(Ie===null)return;Ie.consumerOnSignalRead(t);let e=Ie.nextProducerIndex++;if(Vi(Ie),e<Ie.producerNode.length&&Ie.producerNode[e]!==t&&cu(Ie)){let r=Ie.producerNode[e];ca(r,Ie.producerIndexOfThis[e])}Ie.producerNode[e]!==t&&(Ie.producerNode[e]=t,Ie.producerIndexOfThis[e]=cu(Ie)?Xh(t,Ie,e):0),Ie.producerLastReadVersion[e]=t.version}function Yx(){ia++}function Jh(t){if(!(!t.dirty&&t.lastCleanEpoch===ia)){if(!t.producerMustRecompute(t)&&!rA(t)){t.dirty=!1,t.lastCleanEpoch=ia;return}t.producerRecomputeValue(t),t.dirty=!1,t.lastCleanEpoch=ia}}function Yh(t){if(t.liveConsumerNode===void 0)return;let e=jo;jo=!0;try{for(let r of t.liveConsumerNode)r.dirty||Qx(r)}finally{jo=e}}function Xx(){return Ie?.consumerAllowSignalWrites!==!1}function Qx(t){t.dirty=!0,Yh(t),t.consumerMarkedDirty?.call(t.wrapper??t)}function eA(t){return t&&(t.nextProducerIndex=0),Bi(t)}function tA(t,e){if(Bi(e),!(!t||t.producerNode===void 0||t.producerIndexOfThis===void 0||t.producerLastReadVersion===void 0)){if(cu(t))for(let r=t.nextProducerIndex;r<t.producerNode.length;r++)ca(t.producerNode[r],t.producerIndexOfThis[r]);for(;t.producerNode.length>t.nextProducerIndex;)t.producerNode.pop(),t.producerLastReadVersion.pop(),t.producerIndexOfThis.pop()}}function rA(t){Vi(t);for(let e=0;e<t.producerNode.length;e++){let r=t.producerNode[e],n=t.producerLastReadVersion[e];if(n!==r.version||(Jh(r),n!==r.version))return!0}return!1}function Xh(t,e,r){if(du(t),Vi(t),t.liveConsumerNode.length===0){t.watched?.call(t.wrapper);for(let n=0;n<t.producerNode.length;n++)t.producerIndexOfThis[n]=Xh(t.producerNode[n],t,n)}return t.liveConsumerIndexOfThis.push(r),t.liveConsumerNode.push(e)-1}function ca(t,e){if(du(t),Vi(t),typeof ngDevMode<"u"&&ngDevMode&&e>=t.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${e} is out of bounds of ${t.liveConsumerNode.length} consumers)`);if(t.liveConsumerNode.length===1){t.unwatched?.call(t.wrapper);for(let n=0;n<t.producerNode.length;n++)ca(t.producerNode[n],t.producerIndexOfThis[n])}let r=t.liveConsumerNode.length-1;if(t.liveConsumerNode[e]=t.liveConsumerNode[r],t.liveConsumerIndexOfThis[e]=t.liveConsumerIndexOfThis[r],t.liveConsumerNode.length--,t.liveConsumerIndexOfThis.length--,e<t.liveConsumerNode.length){let n=t.liveConsumerIndexOfThis[e],i=t.liveConsumerNode[e];Vi(i),i.producerIndexOfThis[n]=e}}function cu(t){return t.consumerIsAlwaysLive||(t?.liveConsumerNode?.length??0)>0}function Vi(t){t.producerNode??=[],t.producerIndexOfThis??=[],t.producerLastReadVersion??=[]}function du(t){t.liveConsumerNode??=[],t.liveConsumerIndexOfThis??=[]}function Qh(t){if(Jh(t),aa(t),t.value===uu)throw t.error;return t.value}function nA(t){let e=Object.create(iA);e.computation=t;let r=()=>Qh(e);return r[oa]=e,r}var su=Symbol("UNSET"),au=Symbol("COMPUTING"),uu=Symbol("ERRORED"),iA={...lu,value:su,dirty:!0,error:null,equal:Kh,producerMustRecompute(t){return t.value===su||t.value===au},producerRecomputeValue(t){if(t.value===au)throw new Error("Detected cycle in computations.");let e=t.value;t.value=au;let r=eA(t),n,i=!1;try{n=t.computation.call(t.wrapper),i=e!==su&&e!==uu&&t.equal.call(t.wrapper,e,n)}catch(o){n=uu,t.error=o}finally{tA(t,r)}if(i){t.value=e;return}t.value=n,t.version++}};function oA(){throw new Error}var sA=oA;function aA(){sA()}function cA(t){let e=Object.create(dA);e.value=t;let r=()=>(aa(e),e.value);return r[oa]=e,r}function uA(){return aa(this),this.value}function lA(t,e){Xx()||aA(),t.equal.call(t.wrapper,t.value,e)||(t.value=e,fA(t))}var dA={...lu,equal:Kh,value:void 0};function fA(t){t.version++,Yx(),Yh(t)}var Pe=Symbol("node"),sa;(t=>{class e{[Pe];#e(){}static{t.isState=i=>typeof i=="object"&&#e in i}constructor(i,o={}){let a=cA(i)[oa];if(this[Pe]=a,a.wrapper=this,o){let c=o.equals;c&&(a.equal=c),a.watched=o[t.subtle.watched],a.unwatched=o[t.subtle.unwatched]}}get(){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return uA.call(this[Pe])}set(i){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(Jx())throw new Error("Writes to signals not permitted during Watcher callback");let o=this[Pe];lA(o,i)}}t.State=e;class r{[Pe];#e(){}static{t.isComputed=i=>typeof i=="object"&&#e in i}constructor(i,o){let a=nA(i)[oa];if(a.consumerAllowSignalWrites=!0,this[Pe]=a,a.wrapper=this,o){let c=o.equals;c&&(a.equal=c),a.watched=o[t.subtle.watched],a.unwatched=o[t.subtle.unwatched]}}get(){if(!(0,t.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return Qh(this[Pe])}}t.Computed=r,(n=>{function i(f){let h,p=null;try{p=Bi(null),h=f()}finally{Bi(p)}return h}n.untrack=i;function o(f){if(!(0,t.isComputed)(f)&&!(0,t.isWatcher)(f))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return f[Pe].producerNode?.map(h=>h.wrapper)??[]}n.introspectSources=o;function s(f){if(!(0,t.isComputed)(f)&&!(0,t.isState)(f))throw new TypeError("Called introspectSinks without a Signal argument");return f[Pe].liveConsumerNode?.map(h=>h.wrapper)??[]}n.introspectSinks=s;function a(f){if(!(0,t.isComputed)(f)&&!(0,t.isState)(f))throw new TypeError("Called hasSinks without a Signal argument");let h=f[Pe].liveConsumerNode;return h?h.length>0:!1}n.hasSinks=a;function c(f){if(!(0,t.isComputed)(f)&&!(0,t.isWatcher)(f))throw new TypeError("Called hasSources without a Computed or Watcher argument");let h=f[Pe].producerNode;return h?h.length>0:!1}n.hasSources=c;class u{[Pe];#e(){}static{t.isWatcher=h=>#e in h}constructor(h){let p=Object.create(lu);p.wrapper=this,p.consumerMarkedDirty=h,p.consumerIsAlwaysLive=!0,p.consumerAllowSignalWrites=!1,p.producerNode=[],this[Pe]=p}#t(h){for(let p of h)if(!(0,t.isComputed)(p)&&!(0,t.isState)(p))throw new TypeError("Called watch/unwatch without a Computed or State argument")}watch(...h){if(!(0,t.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");this.#t(h);let p=this[Pe];p.dirty=!1;let m=Bi(p);for(let y of h)aa(y[Pe]);Bi(m)}unwatch(...h){if(!(0,t.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");this.#t(h);let p=this[Pe];Vi(p);for(let m=p.producerNode.length-1;m>=0;m--)if(h.includes(p.producerNode[m].wrapper)){ca(p.producerNode[m],p.producerIndexOfThis[m]);let y=p.producerNode.length-1;if(p.producerNode[m]=p.producerNode[y],p.producerIndexOfThis[m]=p.producerIndexOfThis[y],p.producerNode.length--,p.producerIndexOfThis.length--,p.nextProducerIndex--,m<p.producerNode.length){let A=p.producerIndexOfThis[m],D=p.producerNode[m];du(D),D.liveConsumerIndexOfThis[A]=m}}}getPending(){if(!(0,t.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[Pe].producerNode.filter(p=>p.dirty).map(p=>p.wrapper)}}n.Watcher=u;function l(){return Kx()?.wrapper}n.currentComputed=l,n.watched=Symbol("watched"),n.unwatched=Symbol("unwatched")})(t.subtle||(t.subtle={}))})(sa||(sa={}));var rr=(t=null)=>new sa.State(t,{equals:()=>!1});var pA=new Set([Symbol.iterator,"concat","entries","every","filter","find","findIndex","flat","flatMap","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","values"]),hA=new Set(["fill","push","unshift"]);function em(t){if(typeof t=="symbol")return null;let e=Number(t);return isNaN(e)?null:e%1===0?e:null}var ua=class t{static from(e,r,n){return r?new t(Array.from(e,r,n)):new t(Array.from(e))}static of(...e){return new t(e)}constructor(e=[]){let r=e.slice(),n=this,i=new Map,o=!1;return new Proxy(r,{get(s,a){let c=em(a);if(c!==null)return n.#r(c),n.#e.get(),s[c];if(a==="length")return o?o=!1:n.#e.get(),s[a];if(hA.has(a)&&(o=!0),pA.has(a)){let u=i.get(a);return u===void 0&&(u=(...l)=>(n.#e.get(),s[a](...l)),i.set(a,u)),u}return s[a]},set(s,a,c){s[a]=c;let u=em(a);return u!==null?(n.#n(u),n.#e.set(null)):a==="length"&&n.#e.set(null),!0},getPrototypeOf(){return t.prototype}})}#e=rr();#t=new Map;#r(e){let r=this.#t.get(e);r===void 0&&(r=rr(),this.#t.set(e,r)),r.get()}#n(e){let r=this.#t.get(e);r&&r.set(null)}};Object.setPrototypeOf(ua.prototype,Array.prototype);var la=class{collection=rr();storages=new Map;vals;readStorageFor(e){let{storages:r}=this,n=r.get(e);n===void 0&&(n=rr(),r.set(e,n)),n.get()}dirtyStorageFor(e){let r=this.storages.get(e);r&&r.set(null)}constructor(e){this.vals=e?new Map(e):new Map}get(e){return this.readStorageFor(e),this.vals.get(e)}has(e){return this.readStorageFor(e),this.vals.has(e)}entries(){return this.collection.get(),this.vals.entries()}keys(){return this.collection.get(),this.vals.keys()}values(){return this.collection.get(),this.vals.values()}forEach(e){this.collection.get(),this.vals.forEach(e)}get size(){return this.collection.get(),this.vals.size}[Symbol.iterator](){return this.collection.get(),this.vals[Symbol.iterator]()}get[Symbol.toStringTag](){return this.vals[Symbol.toStringTag]}set(e,r){return this.dirtyStorageFor(e),this.collection.set(null),this.vals.set(e,r),this}delete(e){return this.dirtyStorageFor(e),this.collection.set(null),this.vals.delete(e)}clear(){this.storages.forEach(e=>e.set(null)),this.collection.set(null),this.vals.clear()}};Object.setPrototypeOf(la.prototype,Map.prototype);var da=class{collection=rr();storages=new Map;vals;storageFor(e){let r=this.storages,n=r.get(e);return n===void 0&&(n=rr(),r.set(e,n)),n}dirtyStorageFor(e){let r=this.storages.get(e);r&&r.set(null)}constructor(e){this.vals=new Set(e)}has(e){return this.storageFor(e).get(),this.vals.has(e)}entries(){return this.collection.get(),this.vals.entries()}keys(){return this.collection.get(),this.vals.keys()}values(){return this.collection.get(),this.vals.values()}forEach(e){this.collection.get(),this.vals.forEach(e)}get size(){return this.collection.get(),this.vals.size}[Symbol.iterator](){return this.collection.get(),this.vals[Symbol.iterator]()}get[Symbol.toStringTag](){return this.vals[Symbol.toStringTag]}add(e){return this.dirtyStorageFor(e),this.collection.set(null),this.vals.add(e),this}delete(e){return this.dirtyStorageFor(e),this.collection.set(null),this.vals.delete(e)}clear(){this.storages.forEach(e=>e.set(null)),this.collection.set(null),this.vals.clear()}};Object.setPrototypeOf(da.prototype,Set.prototype);customElements.get("a2ui-surface")||customElements.define("a2ui-surface",ou);var gA=new URLSearchParams(location.search).get("token"),tm=t=>t+"?token="+gA,fu=document.querySelector("#app"),Mo=document.querySelector("#status"),Po;function rm(){Po?.dispose(),fu.replaceChildren(),Po=new Es([nu],async t=>{try{if(!(await fetch(tm("/action"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok)throw Error("Action rejected");Mo.textContent="Sent to pi"}catch(e){Mo.textContent=e.message}},{version:"v1.0"}),Po.onSurfaceCreated(t=>{let e=document.createElement("a2ui-surface");e.surface=t,e.dataset.id=t.id,fu.append(e)}),Po.onSurfaceDeleted(t=>{for(let e of fu.children)e.dataset.id===t&&e.remove()})}rm();var nm=new EventSource(tm("/events"));nm.onmessage=t=>{try{let e=JSON.parse(t.data);e.reset&&rm(),Po.processMessages(e.messages),Mo.textContent="Live"}catch(e){Mo.textContent=e.message}};nm.onerror=()=>Mo.textContent="Disconnected \xB7 retrying\u2026";
972
+ /*! Bundled license information:
973
+
974
+ @a2ui/web_core/src/catalog/exclusive_union.js:
975
+ @a2ui/web_core/src/catalog/schema_serializer.js:
976
+ @a2ui/web_core/src/catalog/schema_generator.js:
977
+ (*
978
+ * @license
979
+ * Copyright 2024 Google LLC
980
+ *
981
+ * Licensed under the Apache License, Version 2.0 (the "License");
982
+ * you may not use this file except in compliance with the License.
983
+ * You may obtain a copy of the License at
984
+ *
985
+ * https://www.apache.org/licenses/LICENSE-2.0
986
+ *
987
+ * Unless required by applicable law or agreed to in writing, software
988
+ * distributed under the License is distributed on an "AS IS" BASIS,
989
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
990
+ * See the License for the specific language governing permissions and
991
+ * limitations under the License.
992
+ *)
993
+
994
+ @lit/reactive-element/css-tag.js:
995
+ (**
996
+ * @license
997
+ * Copyright 2019 Google LLC
998
+ * SPDX-License-Identifier: BSD-3-Clause
999
+ *)
1000
+
1001
+ @lit/reactive-element/reactive-element.js:
1002
+ lit-html/lit-html.js:
1003
+ lit-element/lit-element.js:
1004
+ @lit/reactive-element/decorators/custom-element.js:
1005
+ @lit/reactive-element/decorators/property.js:
1006
+ @lit/reactive-element/decorators/state.js:
1007
+ @lit/reactive-element/decorators/event-options.js:
1008
+ @lit/reactive-element/decorators/base.js:
1009
+ @lit/reactive-element/decorators/query.js:
1010
+ @lit/reactive-element/decorators/query-all.js:
1011
+ @lit/reactive-element/decorators/query-async.js:
1012
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
1013
+ lit-html/directive.js:
1014
+ lit-html/directives/repeat.js:
1015
+ @lit/context/lib/decorators/provide.js:
1016
+ lit-html/async-directive.js:
1017
+ lit-html/directives/unsafe-html.js:
1018
+ (**
1019
+ * @license
1020
+ * Copyright 2017 Google LLC
1021
+ * SPDX-License-Identifier: BSD-3-Clause
1022
+ *)
1023
+
1024
+ lit-html/is-server.js:
1025
+ @lit/context/lib/decorators/consume.js:
1026
+ (**
1027
+ * @license
1028
+ * Copyright 2022 Google LLC
1029
+ * SPDX-License-Identifier: BSD-3-Clause
1030
+ *)
1031
+
1032
+ @lit/reactive-element/decorators/query-assigned-elements.js:
1033
+ @lit/context/lib/context-request-event.js:
1034
+ @lit/context/lib/create-context.js:
1035
+ @lit/context/lib/controllers/context-consumer.js:
1036
+ @lit/context/lib/value-notifier.js:
1037
+ @lit/context/lib/controllers/context-provider.js:
1038
+ @lit/context/lib/context-root.js:
1039
+ (**
1040
+ * @license
1041
+ * Copyright 2021 Google LLC
1042
+ * SPDX-License-Identifier: BSD-3-Clause
1043
+ *)
1044
+
1045
+ lit-html/directives/class-map.js:
1046
+ lit-html/directives/style-map.js:
1047
+ (**
1048
+ * @license
1049
+ * Copyright 2018 Google LLC
1050
+ * SPDX-License-Identifier: BSD-3-Clause
1051
+ *)
1052
+
1053
+ lit-html/directive-helpers.js:
1054
+ (**
1055
+ * @license
1056
+ * Copyright 2020 Google LLC
1057
+ * SPDX-License-Identifier: BSD-3-Clause
1058
+ *)
1059
+
1060
+ signal-polyfill/dist/index.js:
1061
+ (**
1062
+ * @license
1063
+ * Copyright Google LLC All Rights Reserved.
1064
+ *
1065
+ * Use of this source code is governed by an MIT-style license that can be
1066
+ * found in the LICENSE file at https://angular.io/license
1067
+ *)
1068
+ (**
1069
+ * @license
1070
+ * Copyright 2024 Bloomberg Finance L.P.
1071
+ *
1072
+ * Licensed under the Apache License, Version 2.0 (the "License");
1073
+ * you may not use this file except in compliance with the License.
1074
+ * You may obtain a copy of the License at
1075
+ *
1076
+ * http://www.apache.org/licenses/LICENSE-2.0
1077
+ *
1078
+ * Unless required by applicable law or agreed to in writing, software
1079
+ * distributed under the License is distributed on an "AS IS" BASIS,
1080
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1081
+ * See the License for the specific language governing permissions and
1082
+ * limitations under the License.
1083
+ *)
1084
+ */