@cloudcrane/app-runtime 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/LICENSE +21 -0
- package/README.md +23 -2
- package/THIRD_PARTY_LICENSES.txt +980 -0
- package/dist/compiler/compile.d.ts +16 -0
- package/dist/compiler/compile.js +54 -0
- package/dist/compiler/runtime.generated.d.ts +3 -0
- package/dist/compiler/runtime.generated.js +4 -0
- package/dist/host.d.ts +3 -0
- package/dist/host.js +7 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/runtime/styles.d.ts +1 -0
- package/dist/runtime/styles.js +11 -0
- package/dist/runtime/theme.d.ts +5 -0
- package/dist/runtime/theme.js +45 -0
- package/package.json +68 -3
- package/runtime-lock.json +3 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.1.0";
|
|
2
|
+
export declare const RUNTIME_SHA256 = "41443c5b9131c9b69997de420b186a9a250c51f38393227409d3f799728032cf";
|
|
3
|
+
export declare const RUNTIME_JS = "var Jb=Object.create;var Bc=Object.defineProperty;var Yb=Object.getOwnPropertyDescriptor;var Xb=Object.getOwnPropertyNames;var Qb=Object.getPrototypeOf,ev=Object.prototype.hasOwnProperty;var kd=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},tv=(r,e)=>{for(var t in e)Bc(r,t,{get:e[t],enumerable:!0})},rv=(r,e,t,n)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let i of Xb(e))!ev.call(r,i)&&i!==t&&Bc(r,i,{get:()=>e[i],enumerable:!(n=Yb(e,i))||n.enumerable});return r};var $d=(r,e,t)=>(t=r!=null?Jb(Qb(r)):{},rv(e||!r||!r.__esModule?Bc(t,\"default\",{value:r,enumerable:!0}):t,r));var Kh=kd((AR,Gh)=>{Gh.exports=(function(r){var e={};function t(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return r[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=r,t.c=e,t.d=function(n,i,o){t.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:o})},t.r=function(n){typeof Symbol<\"u\"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(n,\"__esModule\",{value:!0})},t.t=function(n,i){if(1&i&&(n=t(n)),8&i||4&i&&typeof n==\"object\"&&n&&n.__esModule)return n;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,\"default\",{enumerable:!0,value:n}),2&i&&typeof n!=\"string\")for(var s in n)t.d(o,s,function(a){return n[a]}.bind(null,s));return o},t.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(i,\"a\",i),i},t.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},t.p=\"\",t(t.s=0)})([function(r,e,t){\"use strict\";t.r(e),t.d(e,\"validateHTMLColorName\",(function(){return s})),t.d(e,\"validateHTMLColorSpecialName\",(function(){return a})),t.d(e,\"validateHTMLColorHex\",(function(){return c})),t.d(e,\"validateHTMLColorRgb\",(function(){return h})),t.d(e,\"validateHTMLColorHsl\",(function(){return b})),t.d(e,\"validateHTMLColorHwb\",(function(){return v})),t.d(e,\"validateHTMLColorLab\",(function(){return x})),t.d(e,\"validateHTMLColorLch\",(function(){return $})),t.d(e,\"validateHTMLColor\",(function(){return V}));let n=S=>S&&typeof S==\"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=S=>{let N=!1;return n(S)&&i.map(P=>(S.toLowerCase()===P.toLowerCase()&&(N=!0),null)),N},a=S=>{let N=!1;return n(S)&&o.map(P=>(S.toLowerCase()===P.toLowerCase()&&(N=!0),null)),N},c=S=>n(S)?S&&/^#([\\da-f]{3}){1,2}$|^#([\\da-f]{4}){1,2}$/i.test(S):!1,u=\"(([\\\\d]{0,5})((\\\\.([\\\\d]{1,5}))?))\",l=`(${u}%)`,p=\"(([0-9]|[1-9][0-9]|100)%)\",f=`(${p}|(0?((\\\\.([\\\\d]{1,5}))?))|1)`,m=`([\\\\s]{0,5})\\\\)?)(([\\\\s]{0,5})(\\\\/?)([\\\\s]{1,5})${`(((${p}))|(0?((\\\\.([\\\\d]{1,5}))?))|1))?`}([\\\\s]{0,5})\\\\)`,g=\"(-?(([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)?)\",h=S=>{if(n(S)){let N=\"([\\\\s]{0,5})([\\\\d]{1,5})%?([\\\\s]{0,5}),?\",P=\"((([\\\\s]{0,5}),?([\\\\s]{0,5}))|(([\\\\s]{1,5})))\",B=new RegExp(`^(rgb)a?\\\\(${`${N}${P}`}${`${N}${P}`}${`${N}${P}`}((\\\\/?([\\\\s]{0,5})(0?\\\\.?([\\\\d]{1,5})%?([\\\\s]{0,5}))?|1|0))?\\\\)$`);return S&&B.test(S)}return!1},b=S=>{if(n(S)){let N=new RegExp(`^(hsl)a?\\\\((([\\\\s]{0,5})(${g}|(([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|${p})((([\\\\s]{0,5}),([\\\\s]{0,5}))|(([\\\\s]{1,5}))))(([\\\\s]{0,5})(0|${p})([\\\\s]{0,5})\\\\)?)(([\\\\s]{0,5})(\\\\/?|,?)([\\\\s]{0,5})(((${p}))|(0?((\\\\.([\\\\d]{1,5}))?))|1))?\\\\)$`);return S&&N.test(S)}return!1},v=S=>{if(n(S)){let N=new RegExp(`^(hwb\\\\(([\\\\s]{0,5})${g}([\\\\s]{1,5}))((0|${p})([\\\\s]{1,5}))((0|${p})${m}$`);return S&&N.test(S)}return!1},x=S=>{if(n(S)){let N=\"(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)?|160))\",P=new RegExp(`^(lab\\\\(([\\\\s]{0,5})${l}([\\\\s]{1,5})${N}([\\\\s]{1,5})${N}${m}$`);return S&&P.test(S)}return!1},$=S=>{if(n(S)){let N=\"((([0-9]|[1-9][0-9])?((\\\\.([\\\\d]{1,5}))?)|100)(%)?)\",P=\"\"+u,B=`((${g})|(0|${f})|(([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))`,O=`(\\\\/([\\\\s]{0,5})${f})`,J=new RegExp(`^lch\\\\(${`(([\\\\s]{0,5})${N}([\\\\s]{1,5})${P}([\\\\s]{1,5})${B}([\\\\s]{0,5})(${O})?)`}\\\\)$`);return S&&J.test(S)}return!1},V=S=>!!(S&&c(S)||h(S)||b(S)||v(S)||x(S)||$(S));e.default=S=>!!(S&&c(S)||s(S)||a(S)||h(S)||b(S)||v(S)||x(S)||$(S))}])});var Nb=kd((uL,Ob)=>{\"use strict\";Ob.exports=function r(e){if(typeof e==\"number\"&&isNaN(e))throw new Error(\"NaN is not allowed\");if(typeof e==\"number\"&&!isFinite(e))throw new Error(\"Infinity is not allowed\");return e===null||typeof e!=\"object\"?JSON.stringify(e):e.toJSON instanceof Function?r(e.toJSON()):Array.isArray(e)?`[${e.reduce((i,o,s)=>`${i}${s===0?\"\":\",\"}${r(o===void 0||typeof o==\"symbol\"?null:o)}`,\"\")}]`:`{${Object.keys(e).sort().reduce((n,i)=>{if(e[i]===void 0||typeof e[i]==\"symbol\")return n;let o=n.length===0?\"\":\",\";return`${n}${o}${r(i)}:${r(e[i])}`},\"\")}}`}});var $o,K,Od,nv,qr,Id,Nd,Md,Vc,Us,To,jd,Zc,Uc,zc,Pd,zs={},qs=[],iv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Io=Array.isArray;function Qt(r,e){for(var t in e)r[t]=e[t];return r}function Wc(r){r&&r.parentNode&&r.parentNode.removeChild(r)}function yt(r,e,t){var n,i,o,s={};for(o in e)o==\"key\"?n=e[o]:o==\"ref\"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?$o.call(arguments,2):t),typeof r==\"function\"&&r.defaultProps!=null)for(o in r.defaultProps)s[o]===void 0&&(s[o]=r.defaultProps[o]);return ko(r,s,n,i,null)}function ko(r,e,t,n,i){var o={type:r,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Od,__i:-1,__u:0};return i==null&&K.vnode!=null&&K.vnode(o),o}function Hc(){return{current:null}}function Ie(r){return r.children}function kt(r,e){this.props=r,this.context=e}function $n(r,e){if(e==null)return r.__?$n(r.__,r.__i+1):null;for(var t;e<r.__k.length;e++)if((t=r.__k[e])!=null&&t.__e!=null)return t.__e;return typeof r.type==\"function\"?$n(r):null}function ov(r){if(r.__P&&r.__d){var e=r.__v,t=e.__e,n=[],i=[],o=Qt({},e);o.__v=e.__v+1,K.vnode&&K.vnode(o),Gc(r.__P,o,e,r.__n,r.__P.namespaceURI,32&e.__u?[t]:null,n,t??$n(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,zd(n,o,i),e.__e=e.__=null,o.__e!=t&&Ld(o)}}function Ld(r){if((r=r.__)!=null&&r.__c!=null)return r.__e=r.__c.base=null,r.__k.some(function(e){if(e!=null&&e.__e!=null)return r.__e=r.__c.base=e.__e}),Ld(r)}function qc(r){(!r.__d&&(r.__d=!0)&&qr.push(r)&&!Zs.__r++||Id!=K.debounceRendering)&&((Id=K.debounceRendering)||Nd)(Zs)}function Zs(){try{for(var r,e=1;qr.length;)qr.length>e&&qr.sort(Md),r=qr.shift(),e=qr.length,ov(r)}finally{qr.length=Zs.__r=0}}function Bd(r,e,t,n,i,o,s,a,c,u,l){var p,f,m,g,h,b,v=n&&n.__k||qs,x=e.length;for(c=sv(t,e,v,c,x),p=0;p<x;p++)(m=t.__k[p])!=null&&(f=m.__i!=-1&&v[m.__i]||zs,m.__i=p,b=Gc(r,m,f,i,o,s,a,c,u,l),g=m.__e,m.ref&&f.ref!=m.ref&&(f.ref&&Kc(f.ref,null,m),l.push(m.ref,m.__c||g,m)),h==null&&g!=null&&(h=g),4&m.__u?(c=Vd(m,c,r),f.__e&&(f.__e=null)):typeof m.type==\"function\"&&b!==void 0?c=b:g&&(c=g.nextSibling),m.__u&=-7);return t.__e=h,c}function sv(r,e,t,n,i){var o,s,a,c,u,l=t.length,p=l,f=0;for(r.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!=\"boolean\"&&typeof s!=\"function\"?(typeof s==\"string\"||typeof s==\"number\"||typeof s==\"bigint\"||s.constructor==String?s=r.__k[o]=ko(null,s,null,null,null):Io(s)?s=r.__k[o]=ko(Ie,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=r.__k[o]=ko(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):r.__k[o]=s,c=o+f,s.__=r,s.__b=r.__b+1,a=null,(u=s.__i=av(s,t,c,p))!=-1&&(p--,(a=t[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(i>l?f--:i<l&&f++),typeof s.type!=\"function\"&&(s.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,s.__u|=4))):r.__k[o]=null;if(p)for(o=0;o<l;o++)(a=t[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=$n(a)),Zd(a,a));return n}function Vd(r,e,t){var n,i;if(typeof r.type==\"function\"){for(n=r.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=r,e=Vd(n[i],e,t));return e}r.__e!=e&&(e&&r.type&&!e.parentNode&&(e=$n(r)),e=t.insertBefore(r.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function er(r,e){return e=e||[],r==null||typeof r==\"boolean\"||(Io(r)?r.some(function(t){er(t,e)}):e.push(r)),e}function av(r,e,t,n){var i,o,s,a=r.key,c=r.type,u=e[t],l=u!=null&&(2&u.__u)==0;if(u===null&&a==null||l&&a==u.key&&c==u.type)return t;if(n>(l?1:0)){for(i=t-1,o=t+1;i>=0||o<e.length;)if((u=e[s=i>=0?i--:o++])!=null&&(2&u.__u)==0&&a==u.key&&c==u.type)return s}return-1}function Fd(r,e,t){e[0]==\"-\"?r.setProperty(e,t??\"\"):r[e]=t==null?\"\":typeof t!=\"number\"||iv.test(e)?t:t+\"px\"}function Vs(r,e,t,n,i){var o,s;e:if(e==\"style\")if(typeof t==\"string\")r.style.cssText=t;else{if(typeof n==\"string\"&&(r.style.cssText=n=\"\"),n)for(e in n)t&&e in t||Fd(r.style,e,\"\");if(t)for(e in t)n&&t[e]==n[e]||Fd(r.style,e,t[e])}else if(e[0]==\"o\"&&e[1]==\"n\")o=e!=(e=e.replace(jd,\"$1\")),s=e.toLowerCase(),e=s in r||e==\"onFocusOut\"||e==\"onFocusIn\"?s.slice(2):e.slice(2),r.l||(r.l={}),r.l[e+o]=t,t?n?t[To]=n[To]:(t[To]=Zc,r.addEventListener(e,o?zc:Uc,o)):r.removeEventListener(e,o?zc:Uc,o);else{if(i==\"http://www.w3.org/2000/svg\")e=e.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(e!=\"width\"&&e!=\"height\"&&e!=\"href\"&&e!=\"list\"&&e!=\"form\"&&e!=\"tabIndex\"&&e!=\"download\"&&e!=\"rowSpan\"&&e!=\"colSpan\"&&e!=\"role\"&&e!=\"popover\"&&e in r)try{r[e]=t??\"\";break e}catch{}typeof t==\"function\"||(t==null||t===!1&&e[4]!=\"-\"?r.removeAttribute(e):r.setAttribute(e,e==\"popover\"&&t==1?\"\":t))}}function Rd(r){return function(e){if(this.l){var t=this.l[e.type+r];if(e[Us]==null)e[Us]=Zc++;else if(e[Us]<t[To])return;return t(K.event?K.event(e):e)}}}function Gc(r,e,t,n,i,o,s,a,c,u){var l,p,f,m,g,h,b,v,x,$,V,S,N,P,B,O,J=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),o=[a=e.__e=t.__e]),(l=K.__b)&&l(e);e:if(typeof J==\"function\"){p=s.length;try{if(x=e.props,$=J.prototype&&J.prototype.render,V=(l=J.contextType)&&n[l.__c],S=l?V?V.props.value:l.__:n,t.__c?v=(f=e.__c=t.__c).__=f.__E:($?e.__c=f=new J(x,S):(e.__c=f=new kt(x,S),f.constructor=J,f.render=uv),V&&V.sub(f),f.state||(f.state={}),f.__n=n,m=f.__d=!0,f.__h=[],f._sb=[]),$&&f.__s==null&&(f.__s=f.state),$&&J.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Qt({},f.__s)),Qt(f.__s,J.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=e,m)$&&J.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),$&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if($&&J.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,S),e.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,S)===!1){e.__v!=t.__v&&(f.props=x,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Y){Y&&(Y.__=e)}),qs.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),a=$n(t);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,S),$&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,b)})}if(f.context=S,f.props=x,f.__P=r,f.__e=!1,N=K.__r,P=0,$)f.state=f.__s,f.__d=!1,N&&N(e),l=f.render(f.props,f.state,f.context),qs.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,N&&N(e),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(n=Qt(Qt({},n),f.getChildContext())),$&&!m&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(g,h)),B=l!=null&&l.type===Ie&&l.key==null?qd(l.props.children):l,a=Bd(r,Io(B)?B:[B],e,t,n,i,o,s,a,c,u),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(Y){if(s.length=p,e.__v=null,c||o!=null){if(Y.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o!=null&&(o[o.indexOf(a)]=null),e.__e=a}else if(o!=null)for(O=o.length;O--;)Wc(o[O])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),Y.then||Ud(e),K.__e(Y,e,t)}}else o==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=cv(t.__e,e,t,n,i,o,s,c,u);return(l=K.diffed)&&l(e),128&e.__u?void 0:a}function Ud(r){r&&(r.__c&&(r.__c.__e=!0),r.__k&&r.__k.some(Ud))}function zd(r,e,t){for(var n=0;n<t.length;n++)Kc(t[n],t[++n],t[++n]);K.__c&&K.__c(e,r),r.some(function(i){try{r=i.__h,i.__h=[],r.some(function(o){o.call(i)})}catch(o){K.__e(o,i.__v)}})}function qd(r){return typeof r!=\"object\"||r==null||r.__b>0?r:Io(r)?r.map(qd):r.constructor!==void 0?null:Qt({},r)}function cv(r,e,t,n,i,o,s,a,c){var u,l,p,f,m,g,h,b=t.props||zs,v=e.props,x=e.type;if(x==\"svg\"?i=\"http://www.w3.org/2000/svg\":x==\"math\"?i=\"http://www.w3.org/1998/Math/MathML\":i||(i=\"http://www.w3.org/1999/xhtml\"),o!=null){for(u=0;u<o.length;u++)if((m=o[u])&&\"setAttribute\"in m==!!x&&(x?m.localName==x:m.nodeType==3)){r=m,o[u]=null;break}}if(r==null){if(x==null)return document.createTextNode(v);r=document.createElementNS(i,x,v.is&&v),a&&(K.__m&&K.__m(e,o),a=!1),o=null}if(x==null)b===v||a&&r.data==v||(r.data=v);else{if(o=x==\"textarea\"&&v.defaultValue!=null?null:o&&$o.call(r.childNodes),!a&&o!=null)for(b={},u=0;u<r.attributes.length;u++)b[(m=r.attributes[u]).name]=m.value;for(u in b)m=b[u],u==\"dangerouslySetInnerHTML\"?p=m:u==\"children\"||u in v||u==\"value\"&&\"defaultValue\"in v||u==\"checked\"&&\"defaultChecked\"in v||Vs(r,u,null,m,i);for(u in v)m=v[u],u==\"children\"?f=m:u==\"dangerouslySetInnerHTML\"?l=m:u==\"value\"?g=m:u==\"checked\"?h=m:a&&typeof m!=\"function\"||b[u]===m||Vs(r,u,m,b[u],i);if(l)a||p&&(l.__html==p.__html||l.__html==r.innerHTML)||(r.innerHTML=l.__html),e.__k=[];else if(p&&(r.innerHTML=\"\"),Bd(e.type==\"template\"?r.content:r,Io(f)?f:[f],e,t,n,x==\"foreignObject\"?\"http://www.w3.org/1999/xhtml\":i,o,s,o?o[0]:t.__k&&$n(t,0),a,c),o!=null)for(u=o.length;u--;)Wc(o[u]);a&&x!=\"textarea\"||(u=\"value\",x==\"progress\"&&g==null?r.removeAttribute(\"value\"):g!=null&&(g!==r[u]||x==\"progress\"&&!g||x==\"option\"&&g!=b[u])&&Vs(r,u,g,b[u],i),u=\"checked\",h!=null&&h!=r[u]&&Vs(r,u,h,b[u],i))}return r}function Kc(r,e,t){try{if(typeof r==\"function\"){var n=typeof r.__u==\"function\";n&&r.__u(),n&&e==null||(r.__u=r(e))}else r.current=e}catch(i){K.__e(i,t)}}function Zd(r,e,t){var n,i;if(K.unmount&&K.unmount(r),(n=r.ref)&&(n.current&&n.current!=r.__e||Kc(n,null,e)),(n=r.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){K.__e(o,e)}n.base=n.__P=n.__n=null}if(n=r.__k)for(i=0;i<n.length;i++)n[i]&&Zd(n[i],e,t||typeof r.type!=\"function\");t||Wc(r.__e),r.__c=r.__=r.__e=void 0}function uv(r,e,t){return this.constructor(r,t)}function Zr(r,e,t){var n,i,o,s;e==document&&(e=document.documentElement),K.__&&K.__(r,e),i=(n=typeof t==\"function\")?null:t&&t.__k||e.__k,o=[],s=[],Gc(e,r=(!n&&t||e).__k=yt(Ie,null,[r]),i||zs,zs,e.namespaceURI,!n&&t?[t]:i?null:e.firstChild?$o.call(e.childNodes):null,o,!n&&t?t:i?i.__e:e.firstChild,n,s),zd(o,r,s),r.props.children=null}function Jc(r,e){Zr(r,e,Jc)}function Wd(r,e,t){var n,i,o,s,a=Qt({},r.props);for(o in r.type&&r.type.defaultProps&&(s=r.type.defaultProps),e)o==\"key\"?n=e[o]:o==\"ref\"?i=e[o]:a[o]=e[o]===void 0&&s!=null?s[o]:e[o];return arguments.length>2&&(a.children=arguments.length>3?$o.call(arguments,2):t),ko(r.type,a,n||r.key,i||r.ref,null)}function Fo(r){function e(t){var n,i;return this.getChildContext||(n=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&n.forEach(function(s){s.__e=!0,qc(s)})},this.sub=function(o){n.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){n&&n.delete(o),s&&s.call(o)}}),t.children}return e.__c=\"__cC\"+Pd++,e.__=r,e.Provider=e.__l=(e.Consumer=function(t,n){return t.children(n)}).contextType=e,e}$o=qs.slice,K={__e:function(r,e,t,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(r)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(r,n||{}),s=i.__d),s)return i.__E=i}catch(a){r=a}throw r}},Od=0,nv=function(r){return r!=null&&r.constructor===void 0},kt.prototype.setState=function(r,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Qt({},this.state),typeof r==\"function\"&&(r=r(Qt({},t),this.props)),r&&Qt(t,r),r!=null&&this.__v&&(e&&this._sb.push(e),qc(this))},kt.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),qc(this))},kt.prototype.render=Ie,qr=[],Nd=typeof Promise==\"function\"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Md=function(r,e){return r.__v.__b-e.__v.__b},Zs.__r=0,Vc=Math.random().toString(8),Us=\"__d\"+Vc,To=\"__a\"+Vc,jd=/(PointerCapture)$|Capture$/i,Zc=0,Uc=Rd(!1),zc=Rd(!0),Pd=0;var d={};tv(d,{BRAND:()=>Nv,DIRTY:()=>In,EMPTY_PATH:()=>pv,INVALID:()=>z,NEVER:()=>v0,OK:()=>Ge,ParseStatus:()=>Le,Schema:()=>ee,ZodAny:()=>Gr,ZodArray:()=>Dr,ZodBigInt:()=>Rn,ZodBoolean:()=>On,ZodBranded:()=>Oo,ZodCatch:()=>Zn,ZodDate:()=>Nn,ZodDefault:()=>qn,ZodDiscriminatedUnion:()=>Gs,ZodEffects:()=>Ft,ZodEnum:()=>Un,ZodError:()=>dt,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>Js,ZodIntersection:()=>Ln,ZodIssueCode:()=>E,ZodLazy:()=>Bn,ZodLiteral:()=>Vn,ZodMap:()=>Bi,ZodNaN:()=>Ui,ZodNativeEnum:()=>zn,ZodNever:()=>Bt,ZodNull:()=>jn,ZodNullable:()=>nr,ZodNumber:()=>Fn,ZodObject:()=>ft,ZodOptional:()=>$t,ZodParsedType:()=>R,ZodPipeline:()=>No,ZodPromise:()=>Kr,ZodReadonly:()=>Wn,ZodRecord:()=>Ks,ZodSchema:()=>ee,ZodSet:()=>Vi,ZodString:()=>Hr,ZodSymbol:()=>Pi,ZodTransformer:()=>Ft,ZodTuple:()=>rr,ZodType:()=>ee,ZodUndefined:()=>Mn,ZodUnion:()=>Pn,ZodUnknown:()=>Ar,ZodVoid:()=>Li,addIssueToContext:()=>I,any:()=>qv,array:()=>Gv,bigint:()=>Lv,boolean:()=>nf,coerce:()=>b0,custom:()=>ef,date:()=>Bv,datetimeRegex:()=>Xd,defaultErrorMap:()=>_r,discriminatedUnion:()=>Xv,effect:()=>l0,enum:()=>a0,function:()=>i0,getErrorMap:()=>Ni,getParsedType:()=>tr,instanceof:()=>jv,intersection:()=>Qv,isAborted:()=>Ws,isAsync:()=>Mi,isDirty:()=>Hs,isValid:()=>Wr,late:()=>Mv,lazy:()=>o0,literal:()=>s0,makeIssue:()=>Ro,map:()=>r0,nan:()=>Pv,nativeEnum:()=>c0,never:()=>Wv,null:()=>zv,nullable:()=>f0,number:()=>rf,object:()=>Kv,objectUtil:()=>Yc,oboolean:()=>y0,onumber:()=>g0,optional:()=>d0,ostring:()=>m0,pipeline:()=>h0,preprocess:()=>p0,promise:()=>u0,quotelessJson:()=>lv,record:()=>t0,set:()=>n0,setErrorMap:()=>fv,strictObject:()=>Jv,string:()=>tf,symbol:()=>Vv,transformer:()=>l0,tuple:()=>e0,undefined:()=>Uv,union:()=>Yv,unknown:()=>Zv,util:()=>ce,void:()=>Hv});var ce;(function(r){r.assertEqual=i=>{};function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},r.getValidEnumValues=i=>{let o=r.objectKeys(i).filter(a=>typeof i[i[a]]!=\"number\"),s={};for(let a of o)s[a]=i[a];return r.objectValues(s)},r.objectValues=i=>r.objectKeys(i).map(function(o){return i[o]}),r.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},r.find=(i,o)=>{for(let s of i)if(o(s))return s},r.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)}r.joinValues=n,r.jsonStringifyReplacer=(i,o)=>typeof o==\"bigint\"?o.toString():o})(ce||(ce={}));var Yc;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Yc||(Yc={}));var R=ce.arrayToEnum([\"string\",\"nan\",\"number\",\"integer\",\"float\",\"boolean\",\"date\",\"bigint\",\"symbol\",\"function\",\"undefined\",\"null\",\"array\",\"object\",\"unknown\",\"promise\",\"void\",\"never\",\"map\",\"set\"]),tr=r=>{switch(typeof r){case\"undefined\":return R.undefined;case\"string\":return R.string;case\"number\":return Number.isNaN(r)?R.nan:R.number;case\"boolean\":return R.boolean;case\"function\":return R.function;case\"bigint\":return R.bigint;case\"symbol\":return R.symbol;case\"object\":return Array.isArray(r)?R.array:r===null?R.null:r.then&&typeof r.then==\"function\"&&r.catch&&typeof r.catch==\"function\"?R.promise:typeof Map<\"u\"&&r instanceof Map?R.map:typeof Set<\"u\"&&r instanceof Set?R.set:typeof Date<\"u\"&&r instanceof Date?R.date:R.object;default:return R.unknown}};var E=ce.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\"]),lv=r=>JSON.stringify(r,null,2).replace(/\"([^\"]+)\":/g,\"$1:\"),dt=class r 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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=\"ZodError\",this.issues=e}format(e){let t=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(t(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(t(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];t[o]=t[o]||[],t[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};dt.create=r=>new dt(r);var dv=(r,e)=>{let t;switch(r.code){case E.invalid_type:r.received===R.undefined?t=\"Required\":t=`Expected ${r.expected}, received ${r.received}`;break;case E.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ce.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:t=`Unrecognized key(s) in object: ${ce.joinValues(r.keys,\", \")}`;break;case E.invalid_union:t=\"Invalid input\";break;case E.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ce.joinValues(r.options)}`;break;case E.invalid_enum_value:t=`Invalid enum value. Expected ${ce.joinValues(r.options)}, received '${r.received}'`;break;case E.invalid_arguments:t=\"Invalid function arguments\";break;case E.invalid_return_type:t=\"Invalid function return type\";break;case E.invalid_date:t=\"Invalid date\";break;case E.invalid_string:typeof r.validation==\"object\"?\"includes\"in r.validation?(t=`Invalid input: must include \"${r.validation.includes}\"`,typeof r.validation.position==\"number\"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):\"startsWith\"in r.validation?t=`Invalid input: must start with \"${r.validation.startsWith}\"`:\"endsWith\"in r.validation?t=`Invalid input: must end with \"${r.validation.endsWith}\"`:ce.assertNever(r.validation):r.validation!==\"regex\"?t=`Invalid ${r.validation}`:t=\"Invalid\";break;case E.too_small:r.type===\"array\"?t=`Array must contain ${r.exact?\"exactly\":r.inclusive?\"at least\":\"more than\"} ${r.minimum} element(s)`:r.type===\"string\"?t=`String must contain ${r.exact?\"exactly\":r.inclusive?\"at least\":\"over\"} ${r.minimum} character(s)`:r.type===\"number\"?t=`Number must be ${r.exact?\"exactly equal to \":r.inclusive?\"greater than or equal to \":\"greater than \"}${r.minimum}`:r.type===\"bigint\"?t=`Number must be ${r.exact?\"exactly equal to \":r.inclusive?\"greater than or equal to \":\"greater than \"}${r.minimum}`:r.type===\"date\"?t=`Date must be ${r.exact?\"exactly equal to \":r.inclusive?\"greater than or equal to \":\"greater than \"}${new Date(Number(r.minimum))}`:t=\"Invalid input\";break;case E.too_big:r.type===\"array\"?t=`Array must contain ${r.exact?\"exactly\":r.inclusive?\"at most\":\"less than\"} ${r.maximum} element(s)`:r.type===\"string\"?t=`String must contain ${r.exact?\"exactly\":r.inclusive?\"at most\":\"under\"} ${r.maximum} character(s)`:r.type===\"number\"?t=`Number must be ${r.exact?\"exactly\":r.inclusive?\"less than or equal to\":\"less than\"} ${r.maximum}`:r.type===\"bigint\"?t=`BigInt must be ${r.exact?\"exactly\":r.inclusive?\"less than or equal to\":\"less than\"} ${r.maximum}`:r.type===\"date\"?t=`Date must be ${r.exact?\"exactly\":r.inclusive?\"smaller than or equal to\":\"smaller than\"} ${new Date(Number(r.maximum))}`:t=\"Invalid input\";break;case E.custom:t=\"Invalid input\";break;case E.invalid_intersection_types:t=\"Intersection results could not be merged\";break;case E.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case E.not_finite:t=\"Number must be finite\";break;default:t=e.defaultError,ce.assertNever(r)}return{message:t}},_r=dv;var Hd=_r;function fv(r){Hd=r}function Ni(){return Hd}var Ro=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,o=[...t,...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}},pv=[];function I(r,e){let t=Ni(),n=Ro({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===_r?void 0:_r].filter(i=>!!i)});r.common.issues.push(n)}var Le=class r{constructor(){this.value=\"valid\"}dirty(){this.value===\"valid\"&&(this.value=\"dirty\")}abort(){this.value!==\"aborted\"&&(this.value=\"aborted\")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status===\"aborted\")return z;i.status===\"dirty\"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:o,value:s}=i;if(o.status===\"aborted\"||s.status===\"aborted\")return z;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}}},z=Object.freeze({status:\"aborted\"}),In=r=>({status:\"dirty\",value:r}),Ge=r=>({status:\"valid\",value:r}),Ws=r=>r.status===\"aborted\",Hs=r=>r.status===\"dirty\",Wr=r=>r.status===\"valid\",Mi=r=>typeof Promise<\"u\"&&r instanceof Promise;var j;(function(r){r.errToObj=e=>typeof e==\"string\"?{message:e}:e||{},r.toString=e=>typeof e==\"string\"?e:e?.message})(j||(j={}));var It=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,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}},Gd=(r,e)=>{if(Wr(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error(\"Validation failed but no issues detected.\");return{success:!1,get error(){if(this._error)return this._error;let t=new dt(r.common.issues);return this._error=t,this._error}}};function Q(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||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}=r;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??t??a.defaultError}},description:i}}var ee=class{get description(){return this._def.description}_getType(e){return tr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Mi(t))throw new Error(\"Synchronous parse encountered promise.\");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Gd(n,i)}\"~validate\"(e){let t={common:{issues:[],async:!!this[\"~standard\"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)};if(!this[\"~standard\"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Wr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes(\"encountered\")&&(this[\"~standard\"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Wr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(Mi(i)?i:Promise.resolve(i));return Gd(n,o)}refine(e,t){let n=i=>typeof t==\"string\"||typeof t>\"u\"?{message:t}:typeof t==\"function\"?t(i):t;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:E.custom,...n(i)});return typeof Promise<\"u\"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t==\"function\"?t(n,i):t),!1))}_refinement(e){return new Ft({schema:this,typeName:T.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:t=>this[\"~validate\"](t)}}optional(){return $t.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dr.create(this)}promise(){return Kr.create(this,this._def)}or(e){return Pn.create([this,e],this._def)}and(e){return Ln.create(this,e,this._def)}transform(e){return new Ft({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:\"transform\",transform:e}})}default(e){let t=typeof e==\"function\"?e:()=>e;return new qn({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Oo({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==\"function\"?e:()=>e;return new Zn({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return No.create(this,e)}readonly(){return Wn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},hv=/^c[^\\s-]{8,}$/i,mv=/^[0-9a-z]+$/,gv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yv=/^[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,bv=/^[a-z0-9_-]{21}$/i,vv=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,_v=/^[-+]?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)?)??$/,xv=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Av=\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",Xc,Dv=/^(?:(?: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])$/,Cv=/^(?:(?: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])$/,wv=/^(([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]))$/,Ev=/^(([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])$/,Sv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jd=\"((\\\\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])))\",kv=new RegExp(`^${Jd}$`);function Yd(r){let e=\"[0-5]\\\\d\";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=r.precision?\"+\":\"?\";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function $v(r){return new RegExp(`^${Yd(r)}$`)}function Xd(r){let e=`${Jd}T${Yd(r)}`,t=[];return t.push(r.local?\"Z?\":\"Z\"),r.offset&&t.push(\"([+-]\\\\d{2}:?\\\\d{2})\"),e=`${e}(${t.join(\"|\")})`,new RegExp(`^${e}$`)}function Iv(r,e){return!!((e===\"v4\"||!e)&&Dv.test(r)||(e===\"v6\"||!e)&&wv.test(r))}function Fv(r,e){if(!vv.test(r))return!1;try{let[t]=r.split(\".\");if(!t)return!1;let n=t.replace(/-/g,\"+\").replace(/_/g,\"/\").padEnd(t.length+(4-t.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 Rv(r,e){return!!((e===\"v4\"||!e)&&Cv.test(r)||(e===\"v6\"||!e)&&Ev.test(r))}var Hr=class r extends ee{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let o=this._getOrReturnCtx(e);return I(o,{code:E.invalid_type,expected:R.string,received:o.parsedType}),z}let n=new Le,i;for(let o of this._def.checks)if(o.kind===\"min\")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:E.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),I(i,{code:E.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?I(i,{code:E.too_big,maximum:o.value,type:\"string\",inclusive:!0,exact:!0,message:o.message}):a&&I(i,{code:E.too_small,minimum:o.value,type:\"string\",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind===\"email\")xv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"email\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"emoji\")Xc||(Xc=new RegExp(Av,\"u\")),Xc.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"emoji\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"uuid\")yv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"uuid\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"nanoid\")bv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"nanoid\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"cuid\")hv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cuid\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"cuid2\")mv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cuid2\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"ulid\")gv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"ulid\",code:E.invalid_string,message:o.message}),n.dirty());else if(o.kind===\"url\")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),I(i,{validation:\"url\",code:E.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),I(i,{validation:\"regex\",code:E.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),I(i,{code:E.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),I(i,{code:E.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind===\"endsWith\"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),I(i,{code:E.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind===\"datetime\"?Xd(o).test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:E.invalid_string,validation:\"datetime\",message:o.message}),n.dirty()):o.kind===\"date\"?kv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:E.invalid_string,validation:\"date\",message:o.message}),n.dirty()):o.kind===\"time\"?$v(o).test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:E.invalid_string,validation:\"time\",message:o.message}),n.dirty()):o.kind===\"duration\"?_v.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"duration\",code:E.invalid_string,message:o.message}),n.dirty()):o.kind===\"ip\"?Iv(e.data,o.version)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"ip\",code:E.invalid_string,message:o.message}),n.dirty()):o.kind===\"jwt\"?Fv(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"jwt\",code:E.invalid_string,message:o.message}),n.dirty()):o.kind===\"cidr\"?Rv(e.data,o.version)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cidr\",code:E.invalid_string,message:o.message}),n.dirty()):o.kind===\"base64\"?Sv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"base64\",code:E.invalid_string,message:o.message}),n.dirty()):o.kind===\"base64url\"?Tv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"base64url\",code:E.invalid_string,message:o.message}),n.dirty()):ce.assertNever(o);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:E.invalid_string,...j.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:\"email\",...j.errToObj(e)})}url(e){return this._addCheck({kind:\"url\",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:\"emoji\",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:\"uuid\",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:\"nanoid\",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:\"cuid\",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:\"cuid2\",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:\"ulid\",...j.errToObj(e)})}base64(e){return this._addCheck({kind:\"base64\",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:\"base64url\",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:\"jwt\",...j.errToObj(e)})}ip(e){return this._addCheck({kind:\"ip\",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:\"cidr\",...j.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,...j.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,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:\"duration\",...j.errToObj(e)})}regex(e,t){return this._addCheck({kind:\"regex\",regex:e,...j.errToObj(t)})}includes(e,t){return this._addCheck({kind:\"includes\",value:e,position:t?.position,...j.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:\"startsWith\",value:e,...j.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:\"endsWith\",value:e,...j.errToObj(t)})}min(e,t){return this._addCheck({kind:\"min\",value:e,...j.errToObj(t)})}max(e,t){return this._addCheck({kind:\"max\",value:e,...j.errToObj(t)})}length(e,t){return this._addCheck({kind:\"length\",value:e,...j.errToObj(t)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:\"trim\"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:\"toLowerCase\"}]})}toUpperCase(){return new r({...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 t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}};Hr.create=r=>new Hr({checks:[],typeName:T.ZodString,coerce:r?.coerce??!1,...Q(r)});function Ov(r,e){let t=(r.toString().split(\".\")[1]||\"\").length,n=(e.toString().split(\".\")[1]||\"\").length,i=t>n?t:n,o=Number.parseInt(r.toFixed(i).replace(\".\",\"\")),s=Number.parseInt(e.toFixed(i).replace(\".\",\"\"));return o%s/10**i}var Fn=class r extends ee{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)!==R.number){let o=this._getOrReturnCtx(e);return I(o,{code:E.invalid_type,expected:R.number,received:o.parsedType}),z}let n,i=new Le;for(let o of this._def.checks)o.kind===\"int\"?ce.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:E.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),I(n,{code:E.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),I(n,{code:E.too_big,maximum:o.value,type:\"number\",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind===\"multipleOf\"?Ov(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),I(n,{code:E.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind===\"finite\"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),I(n,{code:E.not_finite,message:o.message}),i.dirty()):ce.assertNever(o);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit(\"min\",e,!0,j.toString(t))}gt(e,t){return this.setLimit(\"min\",e,!1,j.toString(t))}lte(e,t){return this.setLimit(\"max\",e,!0,j.toString(t))}lt(e,t){return this.setLimit(\"max\",e,!1,j.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:j.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:\"int\",message:j.toString(e)})}positive(e){return this._addCheck({kind:\"min\",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:\"max\",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:\"max\",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:\"min\",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:\"multipleOf\",value:e,message:j.toString(t)})}finite(e){return this._addCheck({kind:\"finite\",message:j.toString(e)})}safe(e){return this._addCheck({kind:\"min\",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:\"max\",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===\"int\"||e.kind===\"multipleOf\"&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind===\"finite\"||n.kind===\"int\"||n.kind===\"multipleOf\")return!0;n.kind===\"min\"?(t===null||n.value>t)&&(t=n.value):n.kind===\"max\"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Fn.create=r=>new Fn({checks:[],typeName:T.ZodNumber,coerce:r?.coerce||!1,...Q(r)});var Rn=class r extends ee{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)!==R.bigint)return this._getInvalidInput(e);let n,i=new Le;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),I(n,{code:E.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),I(n,{code:E.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),I(n,{code:E.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ce.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:E.invalid_type,expected:R.bigint,received:t.parsedType}),z}gte(e,t){return this.setLimit(\"min\",e,!0,j.toString(t))}gt(e,t){return this.setLimit(\"min\",e,!1,j.toString(t))}lte(e,t){return this.setLimit(\"max\",e,!0,j.toString(t))}lt(e,t){return this.setLimit(\"max\",e,!1,j.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:j.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:\"multipleOf\",value:e,message:j.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}};Rn.create=r=>new Rn({checks:[],typeName:T.ZodBigInt,coerce:r?.coerce??!1,...Q(r)});var On=class extends ee{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let n=this._getOrReturnCtx(e);return I(n,{code:E.invalid_type,expected:R.boolean,received:n.parsedType}),z}return Ge(e.data)}};On.create=r=>new On({typeName:T.ZodBoolean,coerce:r?.coerce||!1,...Q(r)});var Nn=class r extends ee{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let o=this._getOrReturnCtx(e);return I(o,{code:E.invalid_type,expected:R.date,received:o.parsedType}),z}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:E.invalid_date}),z}let n=new Le,i;for(let o of this._def.checks)o.kind===\"min\"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:E.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),I(i,{code:E.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:\"date\"}),n.dirty()):ce.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:\"min\",value:e.getTime(),message:j.toString(t)})}max(e,t){return this._addCheck({kind:\"max\",value:e.getTime(),message:j.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Nn.create=r=>new Nn({checks:[],coerce:r?.coerce||!1,typeName:T.ZodDate,...Q(r)});var Pi=class extends ee{_parse(e){if(this._getType(e)!==R.symbol){let n=this._getOrReturnCtx(e);return I(n,{code:E.invalid_type,expected:R.symbol,received:n.parsedType}),z}return Ge(e.data)}};Pi.create=r=>new Pi({typeName:T.ZodSymbol,...Q(r)});var Mn=class extends ee{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return I(n,{code:E.invalid_type,expected:R.undefined,received:n.parsedType}),z}return Ge(e.data)}};Mn.create=r=>new Mn({typeName:T.ZodUndefined,...Q(r)});var jn=class extends ee{_parse(e){if(this._getType(e)!==R.null){let n=this._getOrReturnCtx(e);return I(n,{code:E.invalid_type,expected:R.null,received:n.parsedType}),z}return Ge(e.data)}};jn.create=r=>new jn({typeName:T.ZodNull,...Q(r)});var Gr=class extends ee{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Gr.create=r=>new Gr({typeName:T.ZodAny,...Q(r)});var Ar=class extends ee{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};Ar.create=r=>new Ar({typeName:T.ZodUnknown,...Q(r)});var Bt=class extends ee{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:E.invalid_type,expected:R.never,received:t.parsedType}),z}};Bt.create=r=>new Bt({typeName:T.ZodNever,...Q(r)});var Li=class extends ee{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return I(n,{code:E.invalid_type,expected:R.void,received:n.parsedType}),z}return Ge(e.data)}};Li.create=r=>new Li({typeName:T.ZodVoid,...Q(r)});var Dr=class r extends ee{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==R.array)return I(t,{code:E.invalid_type,expected:R.array,received:t.parsedType}),z;if(i.exactLength!==null){let s=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(s||a)&&(I(t,{code:s?E.too_big:E.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&&t.data.length<i.minLength.value&&(I(t,{code:E.too_small,minimum:i.minLength.value,type:\"array\",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(I(t,{code:E.too_big,maximum:i.maxLength.value,type:\"array\",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((s,a)=>i.type._parseAsync(new It(t,s,t.path,a)))).then(s=>Le.mergeArray(n,s));let o=[...t.data].map((s,a)=>i.type._parseSync(new It(t,s,t.path,a)));return Le.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:j.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:j.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:j.toString(t)}})}nonempty(e){return this.min(1,e)}};Dr.create=(r,e)=>new Dr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function ji(r){if(r instanceof ft){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=$t.create(ji(n))}return new ft({...r._def,shape:()=>e})}else return r instanceof Dr?new Dr({...r._def,type:ji(r.element)}):r instanceof $t?$t.create(ji(r.unwrap())):r instanceof nr?nr.create(ji(r.unwrap())):r instanceof rr?rr.create(r.items.map(e=>ji(e))):r}var ft=class r extends ee{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(),t=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let u=this._getOrReturnCtx(e);return I(u,{code:E.invalid_type,expected:R.object,received:u.parsedType}),z}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Bt&&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],p=i.data[u];c.push({key:{status:\"valid\",value:u},value:l._parse(new It(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Bt){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&&(I(i,{code:E.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 p=i.data[l];c.push({key:{status:\"valid\",value:l},value:u._parse(new It(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,f=await l.value;u.push({key:p,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Le.mergeObjectSync(n,u)):Le.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new r({...this._def,unknownKeys:\"strict\",...e!==void 0?{errorMap:(t,n)=>{let i=this._def.errorMap?.(t,n).message??n.defaultError;return t.code===\"unrecognized_keys\"?{message:j.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new r({...this._def,unknownKeys:\"strip\"})}passthrough(){return new r({...this._def,unknownKeys:\"passthrough\"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of ce.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of ce.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return ji(this)}partial(e){let t={};for(let n of ce.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of ce.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof $t;)o=o._def.innerType;t[n]=o}return new r({...this._def,shape:()=>t})}keyof(){return Qd(ce.objectKeys(this.shape))}};ft.create=(r,e)=>new ft({shape:()=>r,unknownKeys:\"strip\",catchall:Bt.create(),typeName:T.ZodObject,...Q(e)});ft.strictCreate=(r,e)=>new ft({shape:()=>r,unknownKeys:\"strict\",catchall:Bt.create(),typeName:T.ZodObject,...Q(e)});ft.lazycreate=(r,e)=>new ft({shape:r,unknownKeys:\"strip\",catchall:Bt.create(),typeName:T.ZodObject,...Q(e)});var Pn=class extends ee{_parse(e){let{ctx:t}=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 t.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new dt(a.ctx.common.issues));return I(t,{code:E.invalid_union,unionErrors:s}),z}if(t.common.async)return Promise.all(n.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...t,common:{...t.common,issues:[]},parent:null},l=c._parseSync({data:t.data,path:t.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 t.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new dt(c));return I(t,{code:E.invalid_union,unionErrors:a}),z}}get options(){return this._def.options}};Pn.create=(r,e)=>new Pn({options:r,typeName:T.ZodUnion,...Q(e)});var xr=r=>r instanceof Bn?xr(r.schema):r instanceof Ft?xr(r.innerType()):r instanceof Vn?[r.value]:r instanceof Un?r.options:r instanceof zn?ce.objectValues(r.enum):r instanceof qn?xr(r._def.innerType):r instanceof Mn?[void 0]:r instanceof jn?[null]:r instanceof $t?[void 0,...xr(r.unwrap())]:r instanceof nr?[null,...xr(r.unwrap())]:r instanceof Oo||r instanceof Wn?xr(r.unwrap()):r instanceof Zn?xr(r._def.innerType):[],Gs=class r extends ee{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return I(t,{code:E.invalid_type,expected:R.object,received:t.parsedType}),z;let n=this.discriminator,i=t.data[n],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(I(t,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let o of t){let s=xr(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 r({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Q(n)})}};function Qc(r,e){let t=tr(r),n=tr(e);if(r===e)return{valid:!0,data:r};if(t===R.object&&n===R.object){let i=ce.objectKeys(e),o=ce.objectKeys(r).filter(a=>i.indexOf(a)!==-1),s={...r,...e};for(let a of o){let c=Qc(r[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(t===R.array&&n===R.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<r.length;o++){let s=r[o],a=e[o],c=Qc(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return t===R.date&&n===R.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Ln=class extends ee{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Ws(o)||Ws(s))return z;let a=Qc(o.value,s.value);return a.valid?((Hs(o)||Hs(s))&&t.dirty(),{status:t.value,value:a.data}):(I(n,{code:E.invalid_intersection_types}),z)};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}))}};Ln.create=(r,e,t)=>new Ln({left:r,right:e,typeName:T.ZodIntersection,...Q(t)});var rr=class r extends ee{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return I(n,{code:E.invalid_type,expected:R.array,received:n.parsedType}),z;if(n.data.length<this._def.items.length)return I(n,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),z;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),t.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new It(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Le.mergeArray(t,s)):Le.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};rr.create=(r,e)=>{if(!Array.isArray(r))throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");return new rr({items:r,typeName:T.ZodTuple,rest:null,...Q(e)})};var Ks=class r extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return I(n,{code:E.invalid_type,expected:R.object,received:n.parsedType}),z;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new It(n,a,n.path,a)),value:s._parse(new It(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Le.mergeObjectAsync(t,i):Le.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ee?new r({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(n)}):new r({keyType:Hr.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},Bi=class extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return I(n,{code:E.invalid_type,expected:R.map,received:n.parsedType}),z;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new It(n,a,n.path,[u,\"key\"])),value:o._parse(new It(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 z;(u.status===\"dirty\"||l.status===\"dirty\")&&t.dirty(),a.set(u.value,l.value)}return{status:t.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 z;(u.status===\"dirty\"||l.status===\"dirty\")&&t.dirty(),a.set(u.value,l.value)}return{status:t.value,value:a}}}};Bi.create=(r,e,t)=>new Bi({valueType:e,keyType:r,typeName:T.ZodMap,...Q(t)});var Vi=class r extends ee{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return I(n,{code:E.invalid_type,expected:R.set,received:n.parsedType}),z;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(I(n,{code:E.too_small,minimum:i.minSize.value,type:\"set\",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(I(n,{code:E.too_big,maximum:i.maxSize.value,type:\"set\",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status===\"aborted\")return z;l.status===\"dirty\"&&t.dirty(),u.add(l.value)}return{status:t.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new It(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:j.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:j.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Vi.create=(r,e)=>new Vi({valueType:r,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var Js=class r extends ee{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return I(t,{code:E.invalid_type,expected:R.function,received:t.parsedType}),z;function n(a,c){return Ro({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ni(),_r].filter(u=>!!u),issueData:{code:E.invalid_arguments,argumentsError:c}})}function i(a,c){return Ro({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ni(),_r].filter(u=>!!u),issueData:{code:E.invalid_return_type,returnTypeError:c}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Kr){let a=this;return Ge(async function(...c){let u=new dt([]),l=await a._def.args.parseAsync(c,o).catch(m=>{throw u.addIssue(n(c,m)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(m=>{throw u.addIssue(i(p,m)),u})})}else{let a=this;return Ge(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new dt([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new dt([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:rr.create(e).rest(Ar.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||rr.create([]).rest(Ar.create()),returns:t||Ar.create(),typeName:T.ZodFunction,...Q(n)})}},Bn=class extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Bn.create=(r,e)=>new Bn({getter:r,typeName:T.ZodLazy,...Q(e)});var Vn=class extends ee{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:E.invalid_literal,expected:this._def.value}),z}return{status:\"valid\",value:e.data}}get value(){return this._def.value}};Vn.create=(r,e)=>new Vn({value:r,typeName:T.ZodLiteral,...Q(e)});function Qd(r,e){return new Un({values:r,typeName:T.ZodEnum,...Q(e)})}var Un=class r extends ee{_parse(e){if(typeof e.data!=\"string\"){let t=this._getOrReturnCtx(e),n=this._def.values;return I(t,{expected:ce.joinValues(n),received:t.parsedType,code:E.invalid_type}),z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return I(t,{received:t.data,code:E.invalid_enum_value,options:n}),z}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Un.create=Qd;var zn=class extends ee{_parse(e){let t=ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){let i=ce.objectValues(t);return I(n,{expected:ce.joinValues(i),received:n.parsedType,code:E.invalid_type}),z}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ce.objectValues(t);return I(n,{received:n.data,code:E.invalid_enum_value,options:i}),z}return Ge(e.data)}get enum(){return this._def.values}};zn.create=(r,e)=>new zn({values:r,typeName:T.ZodNativeEnum,...Q(e)});var Kr=class extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return I(t,{code:E.invalid_type,expected:R.promise,received:t.parsedType}),z;let n=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return Ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Kr.create=(r,e)=>new Kr({type:r,typeName:T.ZodPromise,...Q(e)});var Ft=class extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{I(n,s),s.fatal?t.abort():t.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(t.value===\"aborted\")return z;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status===\"aborted\"?z:c.status===\"dirty\"?In(c.value):t.value===\"dirty\"?In(c.value):c});{if(t.value===\"aborted\")return z;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status===\"aborted\"?z:a.status===\"dirty\"?In(a.value):t.value===\"dirty\"?In(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\"?z:(a.status===\"dirty\"&&t.dirty(),s(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status===\"aborted\"?z:(a.status===\"dirty\"&&t.dirty(),s(a.value).then(()=>({status:t.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 z;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:t.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:t.value,value:a})):z);ce.assertNever(i)}};Ft.create=(r,e,t)=>new Ft({schema:r,typeName:T.ZodEffects,effect:e,...Q(t)});Ft.createWithPreprocess=(r,e,t)=>new Ft({schema:e,effect:{type:\"preprocess\",transform:r},typeName:T.ZodEffects,...Q(t)});var $t=class extends ee{_parse(e){return this._getType(e)===R.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$t.create=(r,e)=>new $t({innerType:r,typeName:T.ZodOptional,...Q(e)});var nr=class extends ee{_parse(e){return this._getType(e)===R.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(r,e)=>new nr({innerType:r,typeName:T.ZodNullable,...Q(e)});var qn=class extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};qn.create=(r,e)=>new qn({innerType:r,typeName:T.ZodDefault,defaultValue:typeof e.default==\"function\"?e.default:()=>e.default,...Q(e)});var Zn=class extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Mi(i)?i.then(o=>({status:\"valid\",value:o.status===\"valid\"?o.value:this._def.catchValue({get error(){return new dt(n.common.issues)},input:n.data})})):{status:\"valid\",value:i.status===\"valid\"?i.value:this._def.catchValue({get error(){return new dt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Zn.create=(r,e)=>new Zn({innerType:r,typeName:T.ZodCatch,catchValue:typeof e.catch==\"function\"?e.catch:()=>e.catch,...Q(e)});var Ui=class extends ee{_parse(e){if(this._getType(e)!==R.nan){let n=this._getOrReturnCtx(e);return I(n,{code:E.invalid_type,expected:R.nan,received:n.parsedType}),z}return{status:\"valid\",value:e.data}}};Ui.create=r=>new Ui({typeName:T.ZodNaN,...Q(r)});var Nv=Symbol(\"zod_brand\"),Oo=class extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},No=class r extends ee{_parse(e){let{status:t,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\"?z:o.status===\"dirty\"?(t.dirty(),In(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\"?z:i.status===\"dirty\"?(t.dirty(),{status:\"dirty\",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:T.ZodPipeline})}},Wn=class extends ee{_parse(e){let t=this._def.innerType._parse(e),n=i=>(Wr(i)&&(i.value=Object.freeze(i.value)),i);return Mi(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};Wn.create=(r,e)=>new Wn({innerType:r,typeName:T.ZodReadonly,...Q(e)});function Kd(r,e){let t=typeof r==\"function\"?r(e):typeof r==\"string\"?{message:r}:r;return typeof t==\"string\"?{message:t}:t}function ef(r,e={},t){return r?Gr.create().superRefine((n,i)=>{let o=r(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Kd(e,n),c=a.fatal??t??!0;i.addIssue({code:\"custom\",...a,fatal:c})}});if(!o){let s=Kd(e,n),a=s.fatal??t??!0;i.addIssue({code:\"custom\",...s,fatal:a})}}):Gr.create()}var Mv={object:ft.lazycreate},T;(function(r){r.ZodString=\"ZodString\",r.ZodNumber=\"ZodNumber\",r.ZodNaN=\"ZodNaN\",r.ZodBigInt=\"ZodBigInt\",r.ZodBoolean=\"ZodBoolean\",r.ZodDate=\"ZodDate\",r.ZodSymbol=\"ZodSymbol\",r.ZodUndefined=\"ZodUndefined\",r.ZodNull=\"ZodNull\",r.ZodAny=\"ZodAny\",r.ZodUnknown=\"ZodUnknown\",r.ZodNever=\"ZodNever\",r.ZodVoid=\"ZodVoid\",r.ZodArray=\"ZodArray\",r.ZodObject=\"ZodObject\",r.ZodUnion=\"ZodUnion\",r.ZodDiscriminatedUnion=\"ZodDiscriminatedUnion\",r.ZodIntersection=\"ZodIntersection\",r.ZodTuple=\"ZodTuple\",r.ZodRecord=\"ZodRecord\",r.ZodMap=\"ZodMap\",r.ZodSet=\"ZodSet\",r.ZodFunction=\"ZodFunction\",r.ZodLazy=\"ZodLazy\",r.ZodLiteral=\"ZodLiteral\",r.ZodEnum=\"ZodEnum\",r.ZodEffects=\"ZodEffects\",r.ZodNativeEnum=\"ZodNativeEnum\",r.ZodOptional=\"ZodOptional\",r.ZodNullable=\"ZodNullable\",r.ZodDefault=\"ZodDefault\",r.ZodCatch=\"ZodCatch\",r.ZodPromise=\"ZodPromise\",r.ZodBranded=\"ZodBranded\",r.ZodPipeline=\"ZodPipeline\",r.ZodReadonly=\"ZodReadonly\"})(T||(T={}));var jv=(r,e={message:`Input not instance of ${r.name}`})=>ef(t=>t instanceof r,e),tf=Hr.create,rf=Fn.create,Pv=Ui.create,Lv=Rn.create,nf=On.create,Bv=Nn.create,Vv=Pi.create,Uv=Mn.create,zv=jn.create,qv=Gr.create,Zv=Ar.create,Wv=Bt.create,Hv=Li.create,Gv=Dr.create,Kv=ft.create,Jv=ft.strictCreate,Yv=Pn.create,Xv=Gs.create,Qv=Ln.create,e0=rr.create,t0=Ks.create,r0=Bi.create,n0=Vi.create,i0=Js.create,o0=Bn.create,s0=Vn.create,a0=Un.create,c0=zn.create,u0=Kr.create,l0=Ft.create,d0=$t.create,f0=nr.create,p0=Ft.createWithPreprocess,h0=No.create,m0=()=>tf().optional(),g0=()=>rf().optional(),y0=()=>nf().optional(),b0={string:(r=>Hr.create({...r,coerce:!0})),number:(r=>Fn.create({...r,coerce:!0})),boolean:(r=>On.create({...r,coerce:!0})),bigint:(r=>Rn.create({...r,coerce:!0})),date:(r=>Nn.create({...r,coerce:!0}))};var v0=z;var Jr=class extends Error{constructor(e,t=\"UNKNOWN_ERROR\"){super(e),this.name=this.constructor.name,this.code=t,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},U=class extends Jr{constructor(e,t,n=\"VALIDATION_ERROR\"){super(e,n),this.details=t}},rt=class extends Jr{constructor(e,t){super(e,\"DATA_ERROR\"),this.path=t}},de=class extends Jr{constructor(e,t,n){super(e,\"EXPRESSION_ERROR\"),this.expression=t,this.details=n}},Yr=class extends Jr{constructor(e){super(e,\"STATE_ERROR\")}},Fe=class extends Jr{constructor(e,t=\"CATALOG_ERROR\"){super(e,t)}},Vt=class extends U{constructor(e,t,n=\"INTEGRITY_ERROR\"){super(e,t,n),this.name=\"A2uiIntegrityError\"}},ir=class extends U{constructor(e,t,n=\"RECURSION_ERROR\"){super(e,t,n),this.name=\"A2uiRecursionError\"}},we;(function(r){r.INVALID_FUNCTION_CALL=\"INVALID_FUNCTION_CALL\",r.EXECUTION_ERROR=\"EXECUTION_ERROR\",r.UNKNOWN_FUNCTION=\"UNKNOWN_FUNCTION\",r.UNKNOWN_ERROR=\"UNKNOWN_ERROR\",r.TIMEOUT=\"TIMEOUT\",r.CANCELLED=\"CANCELLED\",r.DISPOSED=\"DISPOSED\",r.DUPLICATE=\"DUPLICATE\",r.NO_LISTENER=\"NO_LISTENER\"})(we||(we={}));var Ut=class extends Jr{constructor(e,t=we.UNKNOWN_ERROR,n,i){let o=t||we.UNKNOWN_ERROR;super(`[${o}] ${e}`,o),this.functionCallId=n,this.details=i,this.name=\"A2uiRpcError\"}};var _0=/^[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 Cr(r){if(!r||typeof r!=\"string\")return\"\";let e=r.trim().replace(/^[vV]/,\"\"),t=e.indexOf(\"-\"),n=e.indexOf(\"+\"),i=e.length;return t!==-1&&n!==-1?i=Math.min(t,n):t!==-1?i=t:n!==-1&&(i=n),`${e.slice(0,i).replace(/_/g,\".\")}${e.slice(i)}`}function x0(r){if(!r||typeof r!=\"string\")return null;let e=r.trim().match(_0);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 Xr(r){if(!r)return null;if(typeof r==\"object\"){let e=r;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 x0(Cr(r))}function ke(r){if(!r)return null;let e=Xr(r);if(!e)return null;if(e.patch===0&&e.prerelease.length===0&&e.build.length===0)return`${e.major}.${e.minor}`;let t=e.prerelease.length>0?`-${e.prerelease.join(\".\")}`:\"\",n=e.build.length>0?`+${e.build.join(\".\")}`:\"\";return`${e.major}.${e.minor}.${e.patch}${t}${n}`}function A0(r,e){let t=/^\\d+$/.test(r),n=/^\\d+$/.test(e);return t&&n?r.length!==e.length?r.length-e.length:r<e?-1:r>e?1:0:t?-1:n?1:r<e?-1:r>e?1:0}function D0(r,e){if(r.length===0&&e.length===0)return 0;if(r.length===0)return 1;if(e.length===0)return-1;let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let i=A0(r[n],e[n]);if(i!==0)return i}return r.length-e.length}function eu(r,e){let t=Xr(r),n=Xr(e);return!t&&!n?0:t?n?t.major!==n.major?t.major-n.major:t.minor!==n.minor?t.minor-n.minor:t.patch!==n.patch?t.patch-n.patch:D0(t.prerelease,n.prerelease):1:-1}function ge(r,e){if(!r)return!1;let t=Xr(r),n=Xr(e);return!t||!n?!1:eu(t,n)>=0}var Hn;(function(r){r.V0_8=\"v0.8\",r.V0_9=\"v0.9\",r.V0_9_1=\"v0.9.1\",r.V1_0=\"v1.0\"})(Hn||(Hn={}));function wr(r,e){return r._def.a2uiChildRef=e,r}function Qr(r){return r?._def?.a2uiChildRef}var Er=wr(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\"),Sr=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(r=>r[\"@path\"]!==void 0||r.path!==void 0,{message:\"Either '@path' or 'path' must be provided.\"}).describe(\"REF:common_types.json#/$defs/DataBinding\"),zt=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()}).refine(r=>r[\"@call\"]!==void 0||r.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.\"),zi=d.union([d.string(),Sr,zt]).describe(\"REF:common_types.json#/$defs/DynamicString|Represents a string\"),Mo=d.union([d.boolean(),Sr,zt]).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).\"),en=d.object({label:zi.optional(),description:zi.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:Mo.optional()}).describe(\"REF:common_types.json#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\"),of=d.record(d.string(),d.unknown()).superRefine((r,e)=>{for(let t in r)t.match(/^[\\p{XID_Start}_][\\p{XID_Continue}]*$/u)||e.addIssue({path:[t],code:d.ZodIssueCode.custom,message:`Invalid extension key \"${t}\": 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.\"),jo=d.object({id:Er,accessibility:en.optional(),catalogId:d.string().describe(\"The catalog ID for this component, overriding any surface-level default catalogId.\").optional(),metadata:d.object({extensions:of.optional()}).strict().describe(\"Optional component-level metadata for vendor extensions.\").optional()}).describe(\"REF:common_types.json#/$defs/ComponentCommon\"),Ys=wr(d.union([d.array(Er).describe(\"A static list of child component IDs.\"),d.object({componentId:Er,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\"),tu=d.union([d.string(),d.number(),d.boolean(),d.array(d.unknown()),Sr,zt,d.record(d.string(),d.unknown()).refine(r=>!r||!(\"@path\"in r)&&!(\"path\"in r)&&!(\"@call\"in r)&&!(\"call\"in r))]).describe(\"REF:common_types.json#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),Xs=d.union([d.number(),Sr,zt]).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.\"),ru=d.union([d.array(d.string()),Sr,zt]).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.\"),Qs=d.object({condition:d.union([Mo,Sr,zt]).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).\"),nu=d.object({checks:d.array(Qs).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.\"),iu=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:zt}).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:zi.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:zt}).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.\"),sf=d.string().describe(\"REF:common_types.json#/$defs/CallId|The unique identifier for a function call.\"),ou=Er,C0=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(r=>r[\"@call\"]!==void 0||r.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.\"),w0=d.object({call:d.literal(\"@index\").optional(),\"@call\":d.literal(\"@index\").optional(),args:d.object({offset:Xs.optional()}).optional()}).refine(r=>r[\"@call\"]!==void 0||r.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.\"),E0=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\\\\'.\"),S0=d.object({functionCallId:sf,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.\"),af={ComponentId:Er,DataBinding:Sr,FunctionCall:zt,DynamicString:zi,DynamicBoolean:Mo,AccessibilityAttributes:en,Extensions:of,ComponentCommon:jo,ChildList:Ys,DynamicValue:tu,DynamicNumber:Xs,DynamicStringList:ru,CheckRule:Qs,Checkable:nu,Action:iu,CallId:sf,Child:ou,FunctionCommon:C0,IndexSystemFunction:w0,Surface:E0,FunctionResponse:S0};var Po=new WeakMap;function Bo(r){return Po.get(r)}function lf(r,e){for(let[t,n]of Object.entries(e)){let i=!1,o;Object.defineProperty(r,t,{enumerable:!0,get(){return i||(o=n(),i=!0),o}})}}function cf(r){return typeof r==\"object\"&&r!==null&&!Array.isArray(r)}function uf(r){return Array.isArray(r)?r.filter(e=>typeof e==\"string\"):void 0}var ea=class{constructor(e,t,n){this.name=e,Po.set(this,t),lf(this,{schema:()=>n(t),allowedParents:()=>uf(t.allowedParents),allowedChildren:()=>uf(t.allowedChildren)}),Object.freeze(this)}get jsonSchema(){return Po.get(this)}},Lo=class{constructor(e,t,n){this.name=e,Po.set(this,t);let i=cf(t.properties)?t.properties:void 0,o=s=>{let a=i?.[s];return cf(a)?a.const:void 0};lf(this,{schema:()=>n(t),returnType:()=>{let s=t.returnType??o(\"returnType\");return typeof s==\"string\"?s:\"any\"},description:()=>typeof t.description==\"string\"?t.description:void 0,allowedCallers:()=>t.allowedCallers??o(\"allowedCallers\"),requiresUserActivation:()=>t.requiresUserActivation??o(\"requiresUserActivation\")}),Object.freeze(this)}get jsonSchema(){return Po.get(this)}};var ff=Symbol(\"Let zodToJsonSchema decide on which parser to use\");var df={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\"},pf=r=>typeof r==\"string\"?{...df,name:r}:{...df,...r};var hf=r=>{let e=pf(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,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 su(r,e,t,n){n?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t})}function le(r,e,t,n,i){r[e]=t,su(r,e,n,i)}var ta=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return[(r.length-t).toString(),...e.slice(t)].join(\"/\")};function ve(r){if(r.target!==\"openAi\")return{};let e=[...r.basePath,r.definitionPath,r.openAiAnyTypeName];return r.flags.hasReferencedOpenAiAnyType=!0,{$ref:r.$refStrategy===\"relative\"?ta(e,r.currentPath):e.join(\"/\")}}function mf(r,e){let t={type:\"array\"};return r.type?._def&&r.type?._def?.typeName!==T.ZodAny&&(t.items=W(r.type._def,{...e,currentPath:[...e.currentPath,\"items\"]})),r.minLength&&le(t,\"minItems\",r.minLength.value,r.minLength.message,e),r.maxLength&&le(t,\"maxItems\",r.maxLength.value,r.maxLength.message,e),r.exactLength&&(le(t,\"minItems\",r.exactLength.value,r.exactLength.message,e),le(t,\"maxItems\",r.exactLength.value,r.exactLength.message,e)),t}function gf(r,e){let t={type:\"integer\",format:\"int64\"};if(!r.checks)return t;for(let n of r.checks)switch(n.kind){case\"min\":e.target===\"jsonSchema7\"?n.inclusive?le(t,\"minimum\",n.value,n.message,e):le(t,\"exclusiveMinimum\",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),le(t,\"minimum\",n.value,n.message,e));break;case\"max\":e.target===\"jsonSchema7\"?n.inclusive?le(t,\"maximum\",n.value,n.message,e):le(t,\"exclusiveMaximum\",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),le(t,\"maximum\",n.value,n.message,e));break;case\"multipleOf\":le(t,\"multipleOf\",n.value,n.message,e);break}return t}function yf(){return{type:\"boolean\"}}function ra(r,e){return W(r.type._def,e)}var bf=(r,e)=>W(r.innerType._def,e);function au(r,e,t){let n=t??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,o)=>au(r,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 T0(r,e)}}var T0=(r,e)=>{let t={type:\"integer\",format:\"unix-time\"};if(e.target===\"openApi3\")return t;for(let n of r.checks)switch(n.kind){case\"min\":le(t,\"minimum\",n.value,n.message,e);break;case\"max\":le(t,\"maximum\",n.value,n.message,e);break}return t};function vf(r,e){return{...W(r.innerType._def,e),default:r.defaultValue()}}function _f(r,e){return e.effectStrategy===\"input\"?W(r.schema._def,e):ve(e)}function xf(r){return{type:\"string\",enum:Array.from(r.values)}}var k0=r=>\"type\"in r&&r.type===\"string\"?!1:\"allOf\"in r;function Af(r,e){let t=[W(r.left._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"0\"]}),W(r.right._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"1\"]})].filter(o=>!!o),n=e.target===\"jsonSchema2019-09\"?{unevaluatedProperties:!1}:void 0,i=[];return t.forEach(o=>{if(k0(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 Df(r,e){let t=typeof r.value;return t!==\"bigint\"&&t!==\"number\"&&t!==\"boolean\"&&t!==\"string\"?{type:Array.isArray(r.value)?\"array\":\"object\"}:e.target===\"openApi3\"?{type:t===\"bigint\"?\"integer\":t,enum:[r.value]}:{type:t===\"bigint\"?\"integer\":t,const:r.value}}var cu,qt={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:()=>(cu===void 0&&(cu=RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",\"u\")),cu),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 na(r,e){let t={type:\"string\"};if(r.checks)for(let n of r.checks)switch(n.kind){case\"min\":le(t,\"minLength\",typeof t.minLength==\"number\"?Math.max(t.minLength,n.value):n.value,n.message,e);break;case\"max\":le(t,\"maxLength\",typeof t.maxLength==\"number\"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case\"email\":switch(e.emailStrategy){case\"format:email\":Zt(t,\"email\",n.message,e);break;case\"format:idn-email\":Zt(t,\"idn-email\",n.message,e);break;case\"pattern:zod\":nt(t,qt.email,n.message,e);break}break;case\"url\":Zt(t,\"uri\",n.message,e);break;case\"uuid\":Zt(t,\"uuid\",n.message,e);break;case\"regex\":nt(t,n.regex,n.message,e);break;case\"cuid\":nt(t,qt.cuid,n.message,e);break;case\"cuid2\":nt(t,qt.cuid2,n.message,e);break;case\"startsWith\":nt(t,RegExp(`^${uu(n.value,e)}`),n.message,e);break;case\"endsWith\":nt(t,RegExp(`${uu(n.value,e)}$`),n.message,e);break;case\"datetime\":Zt(t,\"date-time\",n.message,e);break;case\"date\":Zt(t,\"date\",n.message,e);break;case\"time\":Zt(t,\"time\",n.message,e);break;case\"duration\":Zt(t,\"duration\",n.message,e);break;case\"length\":le(t,\"minLength\",typeof t.minLength==\"number\"?Math.max(t.minLength,n.value):n.value,n.message,e),le(t,\"maxLength\",typeof t.maxLength==\"number\"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case\"includes\":{nt(t,RegExp(uu(n.value,e)),n.message,e);break}case\"ip\":{n.version!==\"v6\"&&Zt(t,\"ipv4\",n.message,e),n.version!==\"v4\"&&Zt(t,\"ipv6\",n.message,e);break}case\"base64url\":nt(t,qt.base64url,n.message,e);break;case\"jwt\":nt(t,qt.jwt,n.message,e);break;case\"cidr\":{n.version!==\"v6\"&&nt(t,qt.ipv4Cidr,n.message,e),n.version!==\"v4\"&&nt(t,qt.ipv6Cidr,n.message,e);break}case\"emoji\":nt(t,qt.emoji(),n.message,e);break;case\"ulid\":{nt(t,qt.ulid,n.message,e);break}case\"base64\":{switch(e.base64Strategy){case\"format:binary\":{Zt(t,\"binary\",n.message,e);break}case\"contentEncoding:base64\":{le(t,\"contentEncoding\",\"base64\",n.message,e);break}case\"pattern:zod\":{nt(t,qt.base64,n.message,e);break}}break}case\"nanoid\":nt(t,qt.nanoid,n.message,e);case\"toLowerCase\":case\"toUpperCase\":case\"trim\":break;default:}return t}function uu(r,e){return e.patternStrategy===\"escape\"?I0(r):r}var $0=new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");function I0(r){let e=\"\";for(let t=0;t<r.length;t++)$0.has(r[t])||(e+=\"\\\\\"),e+=r[t];return e}function Zt(r,e,t,n){r.format||r.anyOf?.some(i=>i.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&n.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&n.errorMessages&&{errorMessage:{format:t}}})):le(r,\"format\",e,t,n)}function nt(r,e,t,n){r.pattern||r.allOf?.some(i=>i.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&n.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:Cf(e,n),...t&&n.errorMessages&&{errorMessage:{pattern:t}}})):le(r,\"pattern\",Cf(e,n),t,n)}function Cf(r,e){if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes(\"i\"),m:r.flags.includes(\"m\"),s:r.flags.includes(\"s\")},n=t.i?r.source.toLowerCase():r.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(t.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(t.m){if(n[c]===\"^\"){i+=`(^|(?<=[\\r\n]))`;continue}else if(n[c]===\"$\"){i+=`($|(?=[\\r\n]))`;continue}}if(t.s&&n[c]===\".\"){i+=s?`${n[c]}\\r\n`:`[${n[c]}\\r\n]`;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`),r.source}return i}function ia(r,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\"&&r.keyType?._def.typeName===T.ZodEnum)return{type:\"object\",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((n,i)=>({...n,[i]:W(r.valueType._def,{...e,currentPath:[...e.currentPath,\"properties\",i]})??ve(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:\"object\",additionalProperties:W(r.valueType._def,{...e,currentPath:[...e.currentPath,\"additionalProperties\"]})??e.allowedAdditionalProperties};if(e.target===\"openApi3\")return t;if(r.keyType?._def.typeName===T.ZodString&&r.keyType._def.checks?.length){let{type:n,...i}=na(r.keyType._def,e);return{...t,propertyNames:i}}else{if(r.keyType?._def.typeName===T.ZodEnum)return{...t,propertyNames:{enum:r.keyType._def.values}};if(r.keyType?._def.typeName===T.ZodBranded&&r.keyType._def.type._def.typeName===T.ZodString&&r.keyType._def.type._def.checks?.length){let{type:n,...i}=ra(r.keyType._def,e);return{...t,propertyNames:i}}}return t}function wf(r,e){if(e.mapStrategy===\"record\")return ia(r,e);let t=W(r.keyType._def,{...e,currentPath:[...e.currentPath,\"items\",\"items\",\"0\"]})||ve(e),n=W(r.valueType._def,{...e,currentPath:[...e.currentPath,\"items\",\"items\",\"1\"]})||ve(e);return{type:\"array\",maxItems:125,items:{type:\"array\",items:[t,n],minItems:2,maxItems:2}}}function Ef(r){let e=r.values,n=Object.keys(r.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 Sf(r){return r.target===\"openAi\"?void 0:{not:ve({...r,currentPath:[...r.currentPath,\"not\"]})}}function Tf(r){return r.target===\"openApi3\"?{enum:[\"null\"],nullable:!0}:{type:\"null\"}}var Vo={ZodString:\"string\",ZodNumber:\"number\",ZodBigInt:\"integer\",ZodBoolean:\"boolean\",ZodNull:\"null\"};function $f(r,e){if(e.target===\"openApi3\")return kf(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(n=>n._def.typeName in Vo&&(!n._def.checks||!n._def.checks.length))){let n=t.reduce((i,o)=>{let s=Vo[o._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:n.length>1?n:n[0]}}else if(t.every(n=>n._def.typeName===\"ZodLiteral\"&&!n.description)){let n=t.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===t.length){let i=n.filter((o,s,a)=>a.indexOf(o)===s);return{type:i.length>1?i:i[0],enum:t.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(t.every(n=>n._def.typeName===\"ZodEnum\"))return{type:\"string\",enum:t.reduce((n,i)=>[...n,...i._def.values.filter(o=>!n.includes(o))],[])};return kf(r,e)}var kf=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((n,i)=>W(n._def,{...e,currentPath:[...e.currentPath,\"anyOf\",`${i}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n==\"object\"&&Object.keys(n).length>0));return t.length?{anyOf:t}:void 0};function If(r,e){if([\"ZodString\",\"ZodNumber\",\"ZodBigInt\",\"ZodBoolean\",\"ZodNull\"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target===\"openApi3\"?{type:Vo[r.innerType._def.typeName],nullable:!0}:{type:[Vo[r.innerType._def.typeName],\"null\"]};if(e.target===\"openApi3\"){let n=W(r.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&\"$ref\"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let t=W(r.innerType._def,{...e,currentPath:[...e.currentPath,\"anyOf\",\"0\"]});return t&&{anyOf:[t,{type:\"null\"}]}}function Ff(r,e){let t={type:\"number\"};if(!r.checks)return t;for(let n of r.checks)switch(n.kind){case\"int\":t.type=\"integer\",su(t,\"type\",n.message,e);break;case\"min\":e.target===\"jsonSchema7\"?n.inclusive?le(t,\"minimum\",n.value,n.message,e):le(t,\"exclusiveMinimum\",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),le(t,\"minimum\",n.value,n.message,e));break;case\"max\":e.target===\"jsonSchema7\"?n.inclusive?le(t,\"maximum\",n.value,n.message,e):le(t,\"exclusiveMaximum\",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),le(t,\"maximum\",n.value,n.message,e));break;case\"multipleOf\":le(t,\"multipleOf\",n.value,n.message,e);break}return t}function Rf(r,e){let t=e.target===\"openAi\",n={type:\"object\",properties:{}},i=[],o=r.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=R0(c);u&&t&&(c._def.typeName===\"ZodOptional\"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=W(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=F0(r,e);return s!==void 0&&(n.additionalProperties=s),n}function F0(r,e){if(r.catchall._def.typeName!==\"ZodNever\")return W(r.catchall._def,{...e,currentPath:[...e.currentPath,\"additionalProperties\"]});switch(r.unknownKeys){case\"passthrough\":return e.allowedAdditionalProperties;case\"strict\":return e.rejectedAdditionalProperties;case\"strip\":return e.removeAdditionalStrategy===\"strict\"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function R0(r){try{return r.isOptional()}catch{return!0}}var Of=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return W(r.innerType._def,e);let t=W(r.innerType._def,{...e,currentPath:[...e.currentPath,\"anyOf\",\"1\"]});return t?{anyOf:[{not:ve(e)},t]}:ve(e)};var Nf=(r,e)=>{if(e.pipeStrategy===\"input\")return W(r.in._def,e);if(e.pipeStrategy===\"output\")return W(r.out._def,e);let t=W(r.in._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"0\"]}),n=W(r.out._def,{...e,currentPath:[...e.currentPath,\"allOf\",t?\"1\":\"0\"]});return{allOf:[t,n].filter(i=>i!==void 0)}};function Mf(r,e){return W(r.type._def,e)}function jf(r,e){let n={type:\"array\",uniqueItems:!0,items:W(r.valueType._def,{...e,currentPath:[...e.currentPath,\"items\"]})};return r.minSize&&le(n,\"minItems\",r.minSize.value,r.minSize.message,e),r.maxSize&&le(n,\"maxItems\",r.maxSize.value,r.maxSize.message,e),n}function Pf(r,e){return r.rest?{type:\"array\",minItems:r.items.length,items:r.items.map((t,n)=>W(t._def,{...e,currentPath:[...e.currentPath,\"items\",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[]),additionalItems:W(r.rest._def,{...e,currentPath:[...e.currentPath,\"additionalItems\"]})}:{type:\"array\",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,n)=>W(t._def,{...e,currentPath:[...e.currentPath,\"items\",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[])}}function Lf(r){return{not:ve(r)}}function Bf(r){return ve(r)}var Vf=(r,e)=>W(r.innerType._def,e);var Uf=(r,e,t)=>{switch(e){case T.ZodString:return na(r,t);case T.ZodNumber:return Ff(r,t);case T.ZodObject:return Rf(r,t);case T.ZodBigInt:return gf(r,t);case T.ZodBoolean:return yf();case T.ZodDate:return au(r,t);case T.ZodUndefined:return Lf(t);case T.ZodNull:return Tf(t);case T.ZodArray:return mf(r,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return $f(r,t);case T.ZodIntersection:return Af(r,t);case T.ZodTuple:return Pf(r,t);case T.ZodRecord:return ia(r,t);case T.ZodLiteral:return Df(r,t);case T.ZodEnum:return xf(r);case T.ZodNativeEnum:return Ef(r);case T.ZodNullable:return If(r,t);case T.ZodOptional:return Of(r,t);case T.ZodMap:return wf(r,t);case T.ZodSet:return jf(r,t);case T.ZodLazy:return()=>r.getter()._def;case T.ZodPromise:return Mf(r,t);case T.ZodNaN:case T.ZodNever:return Sf(t);case T.ZodEffects:return _f(r,t);case T.ZodAny:return ve(t);case T.ZodUnknown:return Bf(t);case T.ZodDefault:return vf(r,t);case T.ZodBranded:return ra(r,t);case T.ZodReadonly:return Vf(r,t);case T.ZodCatch:return bf(r,t);case T.ZodPipeline:return Nf(r,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(n=>{})(e)}};function W(r,e,t=!1){let n=e.seen.get(r);if(e.override){let a=e.override?.(r,e,n,t);if(a!==ff)return a}if(n&&!t){let a=O0(n,e);if(a!==void 0)return a}let i={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,i);let o=Uf(r,r.typeName,e),s=typeof o==\"function\"?W(o(),e):o;if(s&&N0(r,e,s),e.postProcess){let a=e.postProcess(s,r,e);return i.jsonSchema=s,a}return i.jsonSchema=s,s}var O0=(r,e)=>{switch(e.$refStrategy){case\"root\":return{$ref:r.path.join(\"/\")};case\"relative\":return{$ref:ta(e.currentPath,r.path)};case\"none\":case\"seen\":return r.path.length<e.currentPath.length&&r.path.every((t,n)=>e.currentPath[n]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join(\"/\")}! Defaulting to any`),ve(e)):e.$refStrategy===\"seen\"?ve(e):void 0}},N0=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);var bt=(r,e)=>{let t=hf(e),n=typeof e==\"object\"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:W(l._def,{...t,currentPath:[...t.basePath,t.definitionPath,u]},!0)??ve(t)}),{}):void 0,i=typeof e==\"string\"?e:e?.nameStrategy===\"title\"?void 0:e?.name,o=W(r._def,i===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,i]},!1)??ve(t),s=typeof e==\"object\"&&e.name!==void 0&&e.nameStrategy===\"title\"?e.name:void 0;s!==void 0&&(o.title=s),t.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[t.openAiAnyTypeName]||(n[t.openAiAnyTypeName]={type:[\"string\",\"number\",\"integer\",\"boolean\",\"array\",\"null\"],items:{$ref:t.$refStrategy===\"relative\"?\"1\":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join(\"/\")}}));let a=i===void 0?n?{...o,[t.definitionPath]:n}:o:{$ref:[...t.$refStrategy===\"relative\"?[]:t.basePath,t.definitionPath,i].join(\"/\"),[t.definitionPath]:{...n,[i]:o}};return t.target===\"jsonSchema7\"?a.$schema=\"http://json-schema.org/draft-07/schema#\":(t.target===\"jsonSchema2019-09\"||t.target===\"openAi\")&&(a.$schema=\"https://json-schema.org/draft/2019-09/schema#\"),t.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 lu=new WeakMap;function X(r,e){let t=r.describe(r.description);return lu.set(t,{...lu.get(r),...e}),t}function du(r,e,t={}){return X(e,{...t,defName:r})}function Uo(r){return typeof r==\"object\"&&r!==null?lu.get(r):void 0}var zf={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 qf={childRefNames:new Set([\"ComponentId\",\"Child\",\"ChildComponentId\"]),childListRefNames:new Set([\"ChildList\",\"TemplateChildList\",\"ChildrenItem\",\"TemplateItem\"])},oa={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 fu={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 tn=\"common_types.json\",Zf={\"0.8\":zf,\"0.9\":oa,\"0.9.1\":oa,\"1.0\":fu};function mu(r){if(r){let e=ke(r)??Cr(r);if(e in Zf)return Zf[e];if(ge(r,\"1.0\"))return fu}return oa}function Wf(r){return JSON.parse(JSON.stringify(r))}function sa(r){return typeof r==\"object\"&&r!==null&&!Array.isArray(r)}function Gn(r){return r._def}var pu=new Set([\"id\",\"component\"]);function Gf(r){return zo(r).mixins!==void 0}function Kf(r){return Object.keys(zo(r)).length>0}function zo(r){let e=[],t=r;for(;t&&typeof t==\"object\"&&\"_def\"in t;){let n=Uo(t);n&&e.push(n);let i=qo(t);if(!i)break;t=i}return e.reduceRight((n,i)=>({...n,...i}),{})}function qo(r){let e=Gn(r);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 Zo=class{constructor(e,t=tn){this.commonTypesUri=t,this.isV08=!ge(e,\"0.9\"),this.isV10=ge(e,\"1.0\"),this.standardDefs=mu(e)}componentSchema(e,t,n,i){let o=new Map,s;if(this.isV08){s=this.toJson(t);let a=s.properties;if(sa(a))for(let c of pu)delete a[c];if(Array.isArray(s.required)){let c=s.required.filter(u=>!pu.has(u));c.length>0?s.required=c:delete s.required}}else{let a=zo(t),c=a.mixins??[],u=new Set(pu),l=[];for(let v of c){l.push({$ref:this.mixinRef(v,o)});for(let x of this.mixinProperties(v))u.add(x)}let p=hu(t),f=M0(t),m=this.objectSchema(p,a,v=>!u.has(v)),g={component:{const:e},...m.properties},h=[\"component\",...m.required??[]],b={type:\"object\"};f!==void 0&&!this.isV10&&(b.description=f),b.properties=g,b.required=h,s={type:\"object\"},this.isV10?(f!==void 0&&(s.description=f),l.length>0?s.allOf=[...l,b]:(s.properties=g,s.required=h)):(s.allOf=[...l,b],s.unevaluatedProperties=!1)}return n&&n.length>0&&(s.allowedParents=[...n]),i&&i.length>0&&(s.allowedChildren=[...i]),{schema:s,catalogDefs:o}}functionSchema(e,t){let n=this.toJson(t.schema),i=Array.isArray(n.required)&&n.required.length>0,o={type:\"object\"};return t.description&&(o.description=t.description),this.isV10?(o.returnType=t.returnType,t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={\"@call\":{const:e},args:n},o.required=i?[\"@call\",\"args\"]:[\"@call\"],o):(t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={call:{const:e},args:n,returnType:{const:t.returnType}},o.required=i?[\"call\",\"args\"]:[\"call\"],o.unevaluatedProperties=!1,o)}defSchema(e){return this.toJson(e)}mixinRef(e,t){if(typeof e==\"string\")return`${this.commonTypesUri}#/$defs/${e}`;let n=zo(e).defName;if(n===void 0)throw new Error(\"A component mixin model must be named with specDef().\");return t.set(n,e),`#/$defs/${n}`}mixinProperties(e){if(typeof e!=\"string\"){let i=hu(e);return Gn(i).typeName===\"ZodObject\"?Object.keys(i.shape):[]}let t=[],n=(i,o)=>{if(!(!sa(i)||o.has(i))){o.add(i),sa(i.properties)&&t.push(...Object.keys(i.properties));for(let s of Array.isArray(i.allOf)?i.allOf:[]){let a=sa(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),t}toJson(e){let t=zo(e),n=Jf(e),i=j0(e),o,s=n;if(n!==void 0&&n.startsWith(\"REF:\")){let c=n.substring(4),u=c.indexOf(\"|\"),l=u===-1?c:c.substring(0,u);s=u===-1?void 0:c.substring(u+1),o={$ref:this.refTarget(l)}}else o=this.coreJson(hu(e),t);t.keywords&&Object.assign(o,Wf(t.keywords));let a=t.allOf?{allOf:[o,...t.allOf.map(c=>Wf(c))]}:o;return s&&(a.description=s),i!==void 0&&(a.default=i),a}refTarget(e){return e.startsWith(\"#/$defs/\")?`${this.commonTypesUri}${e}`:e}coreJson(e,t){let n=Gn(e);switch(n.typeName){case\"ZodObject\":return this.objectSchema(e,t,()=>!0);case\"ZodString\":return P0(n);case\"ZodNumber\":return L0(n);case\"ZodBoolean\":return{type:\"boolean\"};case\"ZodNull\":return{type:\"null\"};case\"ZodEnum\":return{type:\"string\",enum:[...n.values]};case\"ZodLiteral\":return{const:n.value};case\"ZodAny\":case\"ZodUnknown\":return{};case\"ZodNever\":return{not:{}};case\"ZodArray\":{let i={type:\"array\",items:this.toJson(n.type)},o=n.minLength,s=n.maxLength;return o&&(i.minItems=o.value),s&&(i.maxItems=s.value),i}case\"ZodUnion\":case\"ZodDiscriminatedUnion\":return{oneOf:[...n.options].map(o=>this.toJson(o))};case\"ZodRecord\":return{type:\"object\",additionalProperties:this.toJson(n.valueType)};case\"ZodLazy\":return this.toJson(n.getter());default:return B0(e)}}objectSchema(e,t,n){let i=Gn(e);if(i.typeName!==\"ZodObject\")return this.toJson(e);let o=e.shape,s={},a=[];for(let[g,h]of Object.entries(o))n(g)&&(s[g]=this.toJson(h),h.isOptional()||a.push(g));let c={type:\"object\",properties:s},u=t.required?.filter(g=>a.includes(g)),l=a.filter(g=>!u?.includes(g));a.length>0&&(c.required=u?[...u,...l]:a);let p=i.unknownKeys,f=i.catchall,m=t.closure??(p===\"strict\"?\"additionalProperties\":\"none\");return f&&Gn(f).typeName!==\"ZodNever\"?c[m===\"none\"?\"additionalProperties\":m]=this.toJson(f):m!==\"none\"&&(c[m]=p===\"passthrough\"),c}};function hu(r){let e=r;for(let t=qo(e);t;t=qo(e))e=t;return e}function Jf(r){for(let e=r;e;e=qo(e)){let t=Gn(e).description;if(typeof t==\"string\")return t}}function M0(r){let e=Jf(r);return e!==void 0&&!e.startsWith(\"REF:\")?e:void 0}function j0(r){for(let e=r;e;e=qo(e)){let t=Gn(e);if(t.typeName===\"ZodDefault\")return t.defaultValue()}}var Hf={email:\"email\",url:\"uri\",uuid:\"uuid\",datetime:\"date-time\",date:\"date\",time:\"time\"};function P0(r){let e={type:\"string\"};for(let t of r.checks??[])t.kind===\"regex\"?e.pattern=t.regex.source:t.kind===\"min\"?e.minLength=t.value:t.kind===\"max\"?e.maxLength=t.value:t.kind in Hf&&(e.format=Hf[t.kind]);return e}function L0(r){let e=r.checks??[],t={type:e.some(n=>n.kind===\"int\")?\"integer\":\"number\"};for(let n of e)n.kind===\"min\"?t[n.inclusive?\"minimum\":\"exclusiveMinimum\"]=n.value:n.kind===\"max\"&&(t[n.inclusive?\"maximum\":\"exclusiveMaximum\"]=n.value);return t}function B0(r){let e=bt(r,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});return delete e.$schema,delete e.definitions,delete e.$defs,e}var V0=new Set([\"anyComponent\",\"anyFunction\"]),vu=[\"theme\",\"themeSchema\",\"styles\"];function Re(r){return r===void 0?r:JSON.parse(JSON.stringify(r))}function rn(r){if(typeof r==\"object\"&&r!==null&&!Object.isFrozen(r)){Object.freeze(r);for(let e of Object.values(r))rn(e)}return r}function _u(r){return typeof r!=\"object\"||r===null||Object.isFrozen(r)?r:rn(Re(r))}function or(r){return typeof r==\"object\"&&r!==null&&!Array.isArray(r)}function aa(r,e){if(Array.isArray(r)){for(let n of r)aa(n,e);return}if(!or(r))return;let t=r.$ref;typeof t==\"string\"&&t.startsWith(\"#/$defs/\")&&e.add(t.slice(8).split(\"/\")[0].replace(/~1/g,\"/\").replace(/~0/g,\"~\"));for(let n of Object.values(r))aa(n,e)}function gu(r,e){let t=new Set,n=new Set;for(let i of r)aa(i,n);for(;n.size>0;){let[i]=n;n.delete(i),!t.has(i)&&(t.add(i),i in e&&aa(e[i],n))}return t}function yu(r,e){let t=Bo(r);if(!or(t))return;let n=e??{};for(let i of gu([t],n))if(!(i in n)&&!V0.has(i))return;return t}function Yf(r){return typeof r.name==\"string\"&&!(\"properties\"in r)}function ep(r,e,t,n){if(!r)return r;let i=l=>l.map(p=>yu(p,r)).filter(p=>p!==void 0),o=gu(i(e),r),s=Object.keys(r).filter(l=>!o.has(l)),a=gu([...i(t),n,...s.map(l=>r[l])],r),c={},u=!1;for(let[l,p]of Object.entries(r))!o.has(l)||a.has(l)?c[l]=p:u=!0;return u?c:r}function bu(r,e,t=tn){if(Array.isArray(r)){for(let n of r)bu(n,e,t);return}if(or(r)){if(typeof r.description==\"string\"&&r.description.startsWith(\"REF:\")){let n=r.description.substring(4),i=n.indexOf(\"|\"),o=i===-1?n:n.substring(0,i),s=i===-1?\"\":n.substring(i+1),a=r.default;for(let l of Object.keys(r))delete r[l];let c=o.split(/#\\/(?:\\$defs|definitions)\\//)[1],u=c?.split(\"/\")[0];r.$ref=u===void 0||o.startsWith(\"#\")&&e.has(u)?o:`${t}#/$defs/${c}`,a!==void 0&&(r.default=a),s&&(r.description=s);return}Array.isArray(r.anyOf)&&(r.oneOf=r.anyOf,delete r.anyOf);for(let n of[\"additionalProperties\",\"unevaluatedProperties\"]){let i=r[n];or(i)&&Object.keys(i).length===0&&(r[n]=!0)}delete r.$schema;for(let n of Object.values(r))bu(n,e,t)}}function xu(r,e,t=tn){if(!r||typeof r!=\"object\"||!(\"safeParse\"in r))return{type:\"object\",properties:{}};let n=bt(r,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});return delete n.definitions,delete n.$defs,bu(n,e,t),n}function U0(r){if(r.type!==\"object\")return;let e=r.unevaluatedProperties??r.additionalProperties;delete r.additionalProperties,r.unevaluatedProperties=typeof e==\"boolean\"||or(e)?e:!1}function z0(r,e,t,n=tn){let i=xu(e.schema,t,n),{component:o,id:s,...a}=or(i.properties)?i.properties:{},c=Array.isArray(i.required)?i.required.filter(p=>p!==\"component\"&&p!==\"id\"):[],u=i.unevaluatedProperties??i.additionalProperties,l={type:\"object\",properties:{component:{const:r},...a},required:[\"component\",...c],unevaluatedProperties:typeof u==\"boolean\"||or(u)?u:!1};return e.allowedParents&&e.allowedParents.length>0&&(l.allowedParents=[...e.allowedParents]),e.allowedChildren&&e.allowedChildren.length>0&&(l.allowedChildren=[...e.allowedChildren]),l}function Xf(r,e,t,n,i,o=tn){let s=xu(e.schema,t,o);if(i)return{name:r,...e.description?{description:e.description}:{},returnType:e.returnType,parameters:s,...e.allowedCallers?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{}};U0(s);let a=Array.isArray(s.required)&&s.required.length>0,c={type:\"object\"};return e.description&&(c.description=e.description),n?(c.returnType=e.returnType,e.allowedCallers&&(c.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(c.requiresUserActivation=e.requiresUserActivation),c.properties={\"@call\":{const:r},args:s},c.required=a?[\"@call\",\"args\"]:[\"@call\"],c):(e.allowedCallers&&(c.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(c.requiresUserActivation=e.requiresUserActivation),c.properties={call:{const:r},args:s,returnType:{const:e.returnType}},c.required=a?[\"call\",\"args\"]:[\"call\"],c.unevaluatedProperties=!1,c)}function q0(r,e,t=tn){let n=xu(r,e,t);return{type:\"object\",properties:or(n.properties)?n.properties:{},...Array.isArray(n.required)&&n.required.length>0?{required:n.required}:{},additionalProperties:n.additionalProperties!==void 0?n.additionalProperties:!0}}var tp={not:{}};function Au(r){let e=[...r].map(t=>({$ref:`#/components/${rp(t)}`}));return e.length===0?{...tp}:{oneOf:e,discriminator:{propertyName:\"component\"}}}function Du(r){let e=[...r].map(t=>({$ref:`#/functions/${rp(t)}`}));return e.length===0?{...tp}:{oneOf:e}}function rp(r){return r.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}var Qf=new WeakMap;function Cu(r){let e=Qf.get(r);return e||(e=Z0(r),Qf.set(r,e)),e}function Z0(r){let e=new Zo(r.protocolVersion,r.commonTypesUri),t=new Map,n=new Map;for(let[c,u]of r.components){if(Bo(u)||!Gf(u.schema))continue;let{schema:l,catalogDefs:p}=e.componentSchema(c,u.schema,u.allowedParents,u.allowedChildren);n.set(c,rn(l));for(let[f,m]of p)t.set(f,m)}for(let c of r.defModels??[]){let u=Uo(c)?.defName;if(u===void 0)throw new Error(\"A catalog definition model must be named with specDef().\");t.set(u,c)}let i={...r.defs};for(let[c,u]of t)c in i||(i[c]=e.defSchema(u));let o={...r.extensionFields};if(r.themeLocation===\"styles\"&&r.themeSchema&&!np(r)){let c=e.defSchema(r.themeSchema);o.styles=or(c.properties)?c.properties:{}}let s=new Map;for(let[c,u]of r.components)s.set(c,n.get(c)??yu(u,i));let a=new Map;for(let[c,u]of r.functions){let l=yu(u,i);a.set(c,l??(!Bo(u)&&Kf(u.schema)?rn(e.functionSchema(c,u)):void 0))}return{components:s,functions:a,defs:rn(i),extensionFields:rn(o)}}function np(r){return or(r.defs?.theme)||vu.some(e=>r.extensionFields?.[e]!==void 0)}function ip(r){let e=ge(r.protocolVersion,\"1.0\"),t=Cu(r),n=new Set(Object.keys(t.defs)),i={};r.schemaUri!==void 0&&(i.$schema=r.schemaUri),r.schemaId!==void 0&&(i.$id=r.schemaId),typeof r.declaredProtocolVersion==\"string\"?i.protocolVersion=r.declaredProtocolVersion:r.declaredProtocolVersion===void 0&&(i.protocolVersion=ke(r.protocolVersion)??r.protocolVersion),r.title!==void 0&&(i.title=r.title),r.description!==void 0&&(i.description=r.description),r.declaresCatalogId!==!1&&(i.catalogId=r.id),r.instructions!==void 0&&(i.instructions=r.instructions);let o=r.commonTypesUri??tn;if(r.declaresComponents!==!1||r.components.size>0){let p={};for(let[f,m]of r.components){let g=t.components.get(f);p[f]=g?Re(g):z0(f,m,n,o)}i.components=p}let s=[...r.functions].filter(([p,f])=>Bo(f)!==void 0||!p.startsWith(\"@\")),a=s.map(([p])=>p);if(r.functionsLayout===\"list\")i.functions=s.map(([p,f])=>{let m=t.functions.get(p);return m&&Yf(m)?Re(m):Xf(p,f,n,e,!0,o)});else if(r.functionsLayout===\"map\"||s.length>0){let p={};for(let[f,m]of s){let g=t.functions.get(f);p[f]=g&&!Yf(g)?Re(g):Xf(f,m,n,e,!1,o)}i.functions=p}for(let[p,f]of Object.entries(t.extensionFields))p in i||(i[p]=Re(f));let c=Re({...t.defs});(r.themeLocation??(e?void 0:\"defs\"))===\"defs\"&&r.themeSchema&&!np(t)&&(c.theme=Uo(r.themeSchema)?new Zo(r.protocolVersion,r.commonTypesUri).defSchema(r.themeSchema):q0(r.themeSchema,n,o));let l=r.unions??{anyComponent:e||r.components.size>0,anyFunction:e||a.length>0};if(l.anyComponent&&!(\"anyComponent\"in c)){let p=c.anyFunction;p!==void 0&&delete c.anyFunction,c.anyComponent=Au(r.components.keys()),p!==void 0&&(c.anyFunction=p)}return l.anyFunction&&!(\"anyFunction\"in c)&&(c.anyFunction=Du(a)),(r.defs!==void 0||Object.keys(c).length>0)&&(i.$defs=c),i}var W0=/^[\\p{XID_Start}_][\\p{XID_Continue}]*$/u;function wu(r,e=!1){if(!r)return!1;let t=e&&r.startsWith(\"@\")?r.slice(1):r;return W0.test(t)}function Wo(r,e,t=!1){if(!wu(r,t))throw new Fe(`Invalid UAX #31 ${e}`)}var H0=\"0.9\",gp={DynamicString:zi,DynamicNumber:Xs,DynamicBoolean:Mo,DynamicStringList:ru,DynamicValue:tu,ComponentId:Er,Child:ou,ChildList:Ys,Action:iu,CheckRule:Qs,Checkable:nu,AccessibilityAttributes:en,DataBinding:Sr,FunctionCall:zt},yp=\"common_types.json\",Eu=\"catalog.json\";function bp(r,e){return r===e||r.endsWith(`/${e}`)}function op(r){return r.slice(r.lastIndexOf(\"/\")+1)}function Su(r){let e=r.indexOf(\"#\");return e<0?{doc:r,fragment:\"\"}:{doc:r.slice(0,e),fragment:r.slice(e)}}function vp(r){return typeof r.toJson==\"function\"}function sp(r){if(vp(r))return{id:r.id,schemaId:r.schemaId};let e=r.catalogId,t=r.$id;return{id:typeof e==\"string\"?e:void 0,schemaId:typeof t==\"string\"?t:void 0}}function ap(r,e){if(!r)return{kind:\"self\"};if(bp(r,yp))return{kind:\"commonTypes\"};if(r===Eu)return{kind:\"self\"};for(let n of e){let{id:i,schemaId:o}=sp(n);for(let s of[i,o])if(s&&(r===s||s.endsWith(`/${r}`)||r.endsWith(`/${s}`)))return{kind:\"peer\",peer:n}}if(r.endsWith(`/${Eu}`))return{kind:\"self\"};let t=op(r);for(let n of e){let{id:i,schemaId:o}=sp(n);for(let s of[o,i])if(s&&op(s)===t)return{kind:\"peer\",peer:n}}return{kind:\"unresolved\"}}function da(r){if(Array.isArray(r))return r.some(da);if(!r||typeof r!=\"object\")return!1;for(let[e,t]of Object.entries(r))if(e===\"$ref\"&&typeof t==\"string\"){let{doc:n}=Su(t);if(n&&n!==Eu&&!bp(n,yp))return!0}else if(da(t))return!0;return!1}var cp=new WeakMap,G0=0;function K0(r){let e=cp.get(r);return e===void 0&&(e=G0++,cp.set(r,e)),e}var fa=class{constructor(e=[]){this.peers=e,this.documents=new Map}documentOf(e){if(!vp(e))return e;let t=this.documents.get(e);return t||(t=e.toJson(),this.documents.set(e,t)),t}resolve(e,t){let{doc:n,fragment:i}=Su(e);if(!i.startsWith(\"#/\"))return;let o=ap(n,this.peers);if(o.kind===\"self\")return{doc:t,pointer:i,key:`${K0(t)}:${i}`,isPeer:!1};if(o.kind===\"peer\")return{doc:this.documentOf(o.peer),pointer:i,key:e,isPeer:!0}}assertResolvable(e){ap(Su(e).doc,this.peers).kind===\"unresolved\"&&ma(e)}};function ma(r){throw new Fe(`Unresolvable schema reference: '${r}'`)}var Tr=class extends Map{constructor(e=[]){super(),this.scope=new fa(e)}},pa=new WeakMap;function Tu(r,e){let t=pa.get(r);return t?t(e):r}function _p(r){let e={};for(let[t,n]of Object.entries(r))t===\"unevaluatedProperties\"||t===\"additionalProperties\"||t===\"title\"||(e[t]=n);if(e.properties&&typeof e.properties==\"object\"&&!Array.isArray(e.properties)){let t={};for(let[n,i]of Object.entries(e.properties))ha(n)||(t[n]=i);e.properties=t}if(Array.isArray(e.required)&&(e.required=e.required.filter(t=>typeof t==\"string\"&&!ha(t))),Array.isArray(e.allOf)){let t=[],n=[];for(let i of e.allOf)if(i&&typeof i==\"object\"&&!Array.isArray(i)){let o=i,s=o.properties,a=!!s&&typeof s==\"object\"&&!Array.isArray(s)&&\"component\"in s,c=_p(o);a?t.push(c):n.push(c)}else n.push(i);e.allOf=[...t,...n]}return e}function xp(r,e){return!e.startsWith(\"#/components/\")||e.slice(2).split(\"/\").length!==2?r:_p(r)}function ku(r){let e=r.doc,t=Zi(e,r.pointer);return t?{doc:e,target:xp(t,r.pointer)}:void 0}function Ko(r,e,t=[],n={}){return Ho(r,e,new fa(t),n.inlineLocalDefs??!0,n.visited??new Set)}function Ho(r,e,t,n,i){if(Array.isArray(r))return r.map(a=>Ho(a,e,t,n,i));if(!r||typeof r!=\"object\")return r;let o=r;if(typeof o.$ref==\"string\"){let a=t.resolve(o.$ref,e);if(a&&!a.isPeer){let c=a.pointer.split(\"/\").pop()??\"\";(a.pointer.startsWith(\"#/$defs/\")&&(c in gp||c===\"ComponentCommon\")||!n&&a.pointer.startsWith(\"#/$defs/\"))&&(a=void 0)}if(a&&!i.has(a.key)){let c=Zi(a.doc,a.pointer);if(c){let u=new Set(i);u.add(a.key);let l=Ho(c,a.doc,t,a.isPeer?!0:n,u);if(l&&typeof l==\"object\"&&!Array.isArray(l)){let f={...xp(l,a.pointer)};for(let[m,g]of Object.entries(o)){if(m===\"$ref\")continue;let h=Ho(g,e,t,n,i);if(m in f&&f[m]&&typeof f[m]==\"object\"&&!Array.isArray(f[m])&&h&&typeof h==\"object\"&&!Array.isArray(h))f[m]={...f[m],...h};else if(Array.isArray(f[m])&&Array.isArray(h)){let b=f[m];f[m]=[...b,...h.filter(v=>!b.includes(v))]}else f[m]=h}return f}return l}}}let s={};for(let[a,c]of Object.entries(o))s[a]=Ho(c,e,t,n,i);return s}function Zi(r,e){if(!e.startsWith(\"#/\"))return;let t=e.slice(2).split(\"/\").map(i=>i.replace(/~1/g,\"/\").replace(/~0/g,\"~\")),n=r;for(let i of t)if(n&&typeof n==\"object\"&&i in n)n=n[i];else return;return typeof n==\"object\"&&n!==null?n:void 0}function Ap(r){let e=r.split(/#\\/(?:\\$defs|definitions)\\//)[1];return e?gp[e]:void 0}function J0(r){return r.length===0?d.unknown():r.every(e=>typeof e==\"string\")?d.enum(r):r.length===1?d.literal(r[0]):d.union(r.map(e=>d.literal(e)))}function Go(r){return r===null||typeof r!=\"object\"?JSON.stringify(r):Array.isArray(r)?`[${r.map(Go).join(\",\")}]`:`{${Object.keys(r).sort().map(n=>`${JSON.stringify(n)}:${Go(r[n])}`).join(\",\")}}`}function nn(r,e,t,n,i){let o=r;if(e.not&&typeof e.not==\"object\"){let s=qi(e.not,t,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 Y0(r,e,t,n,i){let o=Ap(r);if(o){let f=r.split(/#\\/(?:\\$defs|definitions)\\//)[1],m=typeof e.description==\"string\"?`REF:common_types.json#/$defs/${f}|${e.description}`:o.description;return m?o.describe(m):o}if(!t)return;let s=i.scope.resolve(r,t);if(!s){i.scope.assertResolvable(r);return}let a,c;if(s.isPeer){let f=ku(s);f||ma(r),{doc:a,target:c}=f}else if(a=t,c=Zi(t,s.pointer),!c)return r.startsWith(\"#\")?d.unknown().superRefine((f,m)=>{m.addIssue({code:d.ZodIssueCode.custom,message:`Unresolvable schema reference: '${r}'`})}):void 0;let u=s.key,l=c;if(n.has(u)){let f=i.get(u);return d.lazy(()=>(f||(f=i.get(u)??qi(l,a,new Set([u]),i),i.set(u,f)),f))}let p=i.get(u);if(!p){let f=new Set(n);f.add(u),p=qi(l,a,f,i),i.set(u,p)}return typeof e.description==\"string\"&&(p=p.describe(e.description)),p}function X0(r,e,t,n){let i=Array.isArray(r.oneOf),s=(r.oneOf||r.anyOf).filter(f=>typeof f==\"object\"&&f!==null);if(s.length===0)return;let a=s.find(f=>Array.isArray(f.enum)),c=s.some(f=>typeof f.$ref==\"string\"&&f.$ref.includes(\"DataBinding\")),u=s.map(f=>qi(f,e,new Set(t),n)),l;if(u.length===1)l=u[0];else{let f=d.union([u[0],u[1],...u.slice(2)]);l=i?d.any().superRefine((m,g)=>{let h=0;for(let b of u)if(b.safeParse(m).success&&++h>1){g.addIssue({code:d.ZodIssueCode.custom,message:\"Value matched more than one schema in oneOf\"});return}}).pipe(f):f}r.default!==void 0&&(l=l.default(r.default));let p=(typeof r.description==\"string\"?r.description:void 0)||(a&&c?\"REF:common_types.json#/$defs/DynamicString\":void 0);return p?l.describe(p):l}function qi(r,e,t=new Set,n=new Tr){if(!r||typeof r!=\"object\")return d.unknown();if(r instanceof d.ZodType)return r;if(r.$ref&&typeof r.$ref==\"string\"){let i=Y0(r.$ref,r,e,t,n);if(i)return i}if(Array.isArray(r.oneOf)||Array.isArray(r.anyOf)){let i=X0(r,e,t,n);if(i)return i}if(r.const!==void 0){let i=d.literal(r.const);return nn(i,r,e,t,n)}if(Array.isArray(r.enum)&&r.enum.length>0){let i=J0(r.enum);return nn(i,r,e,t,n)}if(r.type===\"array\"){let i=r.items&&typeof r.items==\"object\"?qi(r.items,e,new Set(t),n):d.unknown(),o=d.array(i);return typeof r.minItems==\"number\"&&(o=o.min(r.minItems)),typeof r.maxItems==\"number\"&&(o=o.max(r.maxItems)),r.uniqueItems===!0&&(o=o.refine(s=>new Set(s.map(Go)).size===s.length,{message:\"Array items must be unique\"})),nn(o,r,e,t,n)}switch(r.type){case\"string\":{let i=d.string();if(typeof r.minLength==\"number\"&&(i=i.min(r.minLength)),typeof r.maxLength==\"number\"&&(i=i.max(r.maxLength)),typeof r.pattern==\"string\")try{i=i.regex(new RegExp(r.pattern,\"u\"))}catch{}return nn(i,r,e,t,n)}case\"integer\":case\"number\":{let i=r.type===\"integer\"?d.number().int():d.number();return typeof r.minimum==\"number\"&&(i=i.min(r.minimum)),typeof r.maximum==\"number\"&&(i=i.max(r.maximum)),typeof r.exclusiveMinimum==\"number\"&&(i=i.gt(r.exclusiveMinimum)),typeof r.exclusiveMaximum==\"number\"&&(i=i.lt(r.exclusiveMaximum)),typeof r.multipleOf==\"number\"&&(i=i.multipleOf(r.multipleOf)),nn(i,r,e,t,n)}case\"boolean\":return nn(d.boolean(),r,e,t,n);case\"object\":{let i=r.properties,o;if(typeof i==\"object\"&&i!==null){let s=Array.isArray(r.required)?new Set(r.required.filter(u=>typeof u==\"string\")):new Set,a=d.object($u(i,s,!1,e,t,n));o=r.additionalProperties===!1||r.unevaluatedProperties===!1?a.strict():a.passthrough()}else o=d.record(d.unknown());return nn(o,r,e,t,n)}default:return nn(d.unknown(),r,e,t,n)}}function ha(r){return r===\"id\"||r===\"component\"||r===\"catalogId\"}function $u(r,e,t=!1,n,i,o=new Tr){let s={};for(let[a,c]of Object.entries(r)){if(t&&ha(a))continue;let u=qi(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 ua(r,e,t,n=new Set,i=!1){if(!r||typeof r!=\"object\")return[];let o=[],s=[],a=[];if(Array.isArray(r.allOf)){for(let u of r.allOf)if(!(!u||typeof u!=\"object\"))if(typeof u.$ref==\"string\"){let l=u.$ref;if(l.includes(\"common_types.json\")&&l.includes(\"ComponentCommon\")){let{accessibility:p,metadata:f}=jo.shape;o.push({kind:\"zod\",properties:i?{accessibility:p,metadata:f}:{accessibility:p}})}else{let p=l.startsWith(\"#/\")?void 0:Ap(l),f=p instanceof d.ZodObject?void 0:t.resolve(l,e);if(p instanceof d.ZodObject)o.push({kind:\"zod\",properties:{...p.shape}});else if(!f)t.assertResolvable(l);else if(f.isPeer){if(!n.has(f.key)){let m=ku(f);m||ma(l);let g=new Set(n).add(f.key);s.push(...ua(m.target,m.doc,t,g,i))}}else if(!n.has(f.key)){n.add(f.key);let m=Zi(e,f.pointer);m&&s.push(...ua(m,e,t,n,i))}}}else a.push(...ua(u,e,t,n,i))}let c=[...o,...s,...a];return r.properties&&c.push({kind:\"json\",schema:r,rootDoc:e}),c}function Dp(r,e,t=!0,n=new Tr,i=!1){let o={},s=ua(r,e,n.scope,void 0,i),a=new Set;for(let l of s)l.kind===\"json\"&&Array.isArray(l.schema.required)&&l.schema.required.forEach(p=>{typeof p==\"string\"&&a.add(p)});for(let l of s){if(l.kind===\"zod\"){for(let[f,m]of Object.entries(l.properties))t&&ha(f)||(o[f]=m);continue}let p=$u(l.schema.properties||{},a,t,l.rootDoc,void 0,n);Object.assign(o,p)}let c=d.object(o);return r.unevaluatedProperties===!0||typeof r.unevaluatedProperties==\"object\"&&r.unevaluatedProperties!==null||r.additionalProperties===!0||typeof r.additionalProperties==\"object\"&&r.additionalProperties!==null?c.passthrough():c.strict()}function Iu(r){if(!r||typeof r!=\"object\"||Array.isArray(r))return!1;let e=r;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(t=>t!==null&&(typeof t==\"object\"||typeof t==\"boolean\"))}function up(r){return r.unevaluatedProperties===!0||typeof r.unevaluatedProperties==\"object\"&&r.unevaluatedProperties!==null||r.additionalProperties===!0||typeof r.additionalProperties==\"object\"&&r.additionalProperties!==null}function la(r,e,t,n=new Set){let i={schemas:[],hasUnresolvable:!1};if(!r||typeof r!=\"object\"||Array.isArray(r))return i;if(Iu(r))return i.schemas.push({schema:{type:\"object\",properties:r},doc:e}),i;let o=s=>{i.schemas.push(...s.schemas),s.hasUnresolvable&&(i.hasUnresolvable=!0)};if(typeof r.$ref==\"string\"){let s=r.$ref,a=e?t.resolve(s,e):void 0;if(!a||!e)e&&t.assertResolvable(s),i.hasUnresolvable=!0;else if(a.isPeer){if(!n.has(a.key)){let c=ku(a);c||ma(s);let u=new Set(n).add(a.key);o(la(c.target,c.doc,t,u))}}else if(!n.has(a.key)){n.add(a.key);let c=Zi(e,a.pointer);c?o(la(c,e,t,n)):i.hasUnresolvable=!0}}if(Array.isArray(r.allOf))for(let s of r.allOf)s&&typeof s==\"object\"&&!Array.isArray(s)&&o(la(s,e,t,n));return(Array.isArray(r.anyOf)||Array.isArray(r.oneOf))&&(i.hasUnresolvable=!0),(r.properties||r.required||r.additionalProperties!==void 0||r.unevaluatedProperties!==void 0)&&i.schemas.push({schema:r,doc:e}),i}function lp(r,e,t=new Tr){let n=la(r,e,t.scope),i=new Set;for(let{schema: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{schema:c,doc:u}of n.schemas)if(c.properties&&typeof c.properties==\"object\"&&!Array.isArray(c.properties)){let l=$u(c.properties,i,!1,u,void 0,t);Object.assign(o,l)}let s=d.object(o);return n.hasUnresolvable||n.schemas.some(({schema:c})=>up(c))||up(r)?s.passthrough():s.strict()}function dp(r,e){if(!r||typeof r!=\"object\"||Array.isArray(r))return[];let t=r,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=Zi(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 t.properties&&typeof t.properties==\"object\"&&t.properties!==null&&!Array.isArray(t.properties)||Array.isArray(t.allOf)||typeof t.$ref==\"string\"?(o(t),n):Iu(t)?Object.keys(t):[]}function Q0(r,e,t,n=!1){let i=[];if(!r)return i;let o=(s,a)=>{if(n){Wo(s,`function identifier: '${s}'`);for(let c of a)Wo(c,`argument identifier: '${c}' in function '${s}'`)}};if(Array.isArray(r)){for(let s of r)if(s&&typeof s==\"object\"&&typeof s.name==\"string\"){let a=dp(s.parameters,e);if(o(s.name,a),t&&!t.has(s.name))continue;let c=u=>{let l=new Lo(s.name,s,p=>p.parameters&&typeof p.parameters==\"object\"?lp(p.parameters,e,new Tr(u)):d.record(d.unknown()));return pa.set(l,c),l};i.push(c([]))}return i}if(typeof r==\"object\"&&r!==null)for(let[s,a]of Object.entries(r)){let u=fp(a&&typeof a==\"object\"?a:{}),l=dp(u,e);if(o(s,l),t&&!t.has(s)||!a||typeof a!=\"object\")continue;let p=f=>{let m=new Lo(s,a,g=>{let h=fp(g);return h?lp(h,e,new Tr(f)):d.record(d.unknown())});return pa.set(m,p),m};i.push(p([]))}return i}function fp(r){let e=r.properties&&typeof r.properties==\"object\"&&r.properties!==null&&!Array.isArray(r.properties)?r.properties:void 0,t=e?.args??r.args??r.parameters;return!t&&e&&!(\"call\"in e)&&!(\"@call\"in e)&&!(\"function\"in e)?t=r:Iu(t)&&(t={type:\"object\",properties:t,required:r.required,additionalProperties:r.additionalProperties}),t&&typeof t==\"object\"&&!Array.isArray(t)?t:void 0}function pp(r,e){if(!Array.isArray(r))return;let t=new Set;for(let n of r)if(typeof n?.$ref==\"string\"&&n.$ref.startsWith(e)){let o=n.$ref.slice(e.length).replace(/~([01])/g,(s,a)=>a===\"1\"?\"/\":\"~\");t.add(o)}return t}function e_(r,e,t,n){let i=[];for(let[o,s]of Object.entries(r)){let a=s||{};if(t){Wo(o,`component identifier: '${o}'`);let u=a.properties;if(u&&typeof u==\"object\")for(let l of Object.keys(u))Wo(l,`property identifier: '${l}' in component '${o}'`)}if(n&&!n.has(o))continue;let c=u=>{let l=new ea(o,a,p=>Dp(p,e,!0,new Tr(u),t));return pa.set(l,c),l};i.push(c([]))}return i}function t_(r,e){let t=r.theme??r.themeSchema??r.styles??e?.theme;if(t&&typeof t==\"object\"){let n=t,i=\"properties\"in n||\"allOf\"in n||n.type===\"object\"?n:{type:\"object\",properties:n},o=Dp(i,r,!1);return i.additionalProperties===!1||i.unevaluatedProperties===!1?o:o.passthrough()}}function Cp(r,e,t){let n=Re(r),i=t??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=pp(s?.oneOf,\"#/components/\"),c=e??n.protocolVersion??H0,u=ge(c,\"1.0\"),l=n.components??{},p=e_(l,n,u,a),f=o?.anyFunction,m=pp(f?.oneOf,\"#/functions/\"),g=Q0(n.functions,n,m,u),h=t_(n,o);return rn(n),{id:i,protocolVersion:c,components:p,functions:g,themeSchema:h,...n_(n,p,g)}}var hp={$schema:\"schemaUri\",$id:\"schemaId\",title:\"title\",description:\"description\",instructions:\"instructions\"},r_=new Set([\"protocolVersion\",\"catalogId\",\"components\"]);function ca(r){return typeof r==\"object\"&&r!==null&&!Array.isArray(r)}function mp(r,e){return Go(r)===Go(e)}function n_(r,e,t){let n={},i={};for(let[o,s]of Object.entries(r))if(o in hp&&typeof s==\"string\")n[hp[o]]=s;else if(o===\"protocolVersion\"&&typeof s==\"string\")n.declaredProtocolVersion=s;else if(o===\"functions\"&&(Array.isArray(s)||ca(s)))n.functionsLayout=Array.isArray(s)?\"list\":\"map\";else if(o===\"$defs\"&&ca(s)){let a=mp(s.anyComponent,Au(e.map(l=>l.name))),c=mp(s.anyFunction,Du(t.map(l=>l.name)));n.unions={anyComponent:a,anyFunction:c};let u={};for(let[l,p]of Object.entries(s))l===\"anyComponent\"&&a||l===\"anyFunction\"&&c||(u[l]=p);n.defs=Object.freeze(u)}else(!r_.has(o)||o===\"components\"&&!ca(s))&&(i[o]=s);return n.declaredProtocolVersion??=null,n.declaresCatalogId=typeof r.catalogId==\"string\",n.declaresComponents=ca(r.components),n.unions??={anyComponent:!1,anyFunction:!1},Object.keys(i).length>0&&(n.extensionFields=Object.freeze(i)),n}function i_(r,e){return e?.standardDefs?e.standardDefs:mu(e?.protocolVersion??r.protocolVersion)}var Ou=/^[^#]+#\\/(?:\\$defs|definitions)\\/([^/]+)(\\/.*)?$/;function Ep(r){let e=Ou.exec(r);return e?`#/$defs/${e[1]}${e[2]??\"\"}`:`#/$defs/${r.split(\"/\").pop()}`}function o_(r){if(r.startsWith(\"#/$defs/\"))return r.substring(8).split(\"/\")[0].replace(/~1/g,\"/\").replace(/~0/g,\"~\")}function s_(r){if(typeof r.description!=\"string\"||!r.description.startsWith(\"REF:\"))return!1;let e=r.description.substring(4),t=e.indexOf(\"|\"),n=t===-1?e:e.substring(0,t),i=t===-1?\"\":e.substring(t+1),o=r.default;for(let s of Object.keys(r))delete r[s];return r.$ref=n.startsWith(\"#\")?n:Ep(n),o!==void 0&&(r.default=o),i&&(r.description=i),!0}function a_(r,e={}){if(Array.isArray(r.allOf)){let t=r.allOf.filter(i=>!(typeof i==\"object\"&&i!==null&&Object.keys(i).length===0)),n=t.length===1?t[0]:void 0;typeof n==\"object\"&&n!==null&&!Array.isArray(n)&&Object.keys(n).every(i=>!(i in r)||i===\"allOf\")?(delete r.allOf,Object.assign(r,n)):t.length===0?delete r.allOf:r.allOf=t}Array.isArray(r.anyOf)&&(r.oneOf=r.anyOf,delete r.anyOf),e.stripAdditionalProperties?(delete r.additionalProperties,delete r.unevaluatedProperties):(r.additionalProperties&&typeof r.additionalProperties==\"object\"&&Object.keys(r.additionalProperties).length===0&&(r.additionalProperties=!0),r.unevaluatedProperties&&typeof r.unevaluatedProperties==\"object\"&&Object.keys(r.unevaluatedProperties).length===0&&(r.unevaluatedProperties=!0)),\"$schema\"in r&&delete r.$schema}function kr(r,e=new Set,t={}){if(typeof r!=\"object\"||r===null||e.has(r))return;if(e.add(r),Array.isArray(r)){for(let i of r)kr(i,e,t);return}let n=r;if(!s_(n)){a_(n,t);for(let i of Object.keys(n))kr(n[i],e,t)}}function it(r){return typeof r==\"object\"&&r!==null&&!Array.isArray(r)}var c_=new Set([\"description\",\"title\",\"default\",\"deprecated\",\"readOnly\",\"writeOnly\",\"examples\"]),wp=new Set([\"id\",\"component\",\"catalogId\"]),u_=new Set([\"anyComponent\",\"anyFunction\",\"theme\"]),l_=/^(?:([^#]*common_types\\.json))?#\\/\\$defs\\/([^/]+)(\\/.*)?$/,d_=/\\/(ComponentCommon|Checkable)$/;function Fu(r,e,t,n=\"\"){if(r.$ref=`#/$defs/${e}${n}`,n||r.description!==void 0)return;let i=t[e];it(i)&&typeof i.description==\"string\"&&(r.description=i.description)}function Jo(r,e,t){if(Array.isArray(r)){for(let o of r)Jo(o,e,t);return}if(!it(r))return;let n=r.$ref,i=typeof n==\"string\"?l_.exec(n):null;if(i){let[,o,s,a]=i;if(o!==void 0||s in e){if(t){for(let c of Object.keys(r))c!==\"$ref\"&&!c_.has(c)&&delete r[c];Fu(r,s,e,a);return}Fu(r,s,e,a)}}for(let o of Object.values(r))Jo(o,e,t)}function f_(r,e){if(!e.startsWith(\"#/\"))return;let t=r;for(let n of e.substring(2).split(\"/\")){let i=n.replace(/~([01])/g,(o,s)=>s===\"1\"?\"/\":\"~\");if(!it(t)||!(i in t))return;t=t[i]}return t}function ga(r,e,t){let n=[],i=[],o=[];for(let a of Array.isArray(r.allOf)?r.allOf:[]){if(!it(a))continue;let c=a.$ref;if(typeof c!=\"string\"){n.push(...ga(a,e,t));continue}let u=d_.exec(c)?.[1],l=c.startsWith(\"#/\")?f_(e.rootDoc,c):void 0;if(u===void 0&&it(l)){t.has(c)||(t.add(c),i.push(...ga(l,e,t)));continue}if(u===void 0&&!c.startsWith(\"#/\")&&e.peers.length>0&&!t.has(c)){let g=Ko(a,e.rootDoc,e.peers,{inlineLocalDefs:!1,visited:t});if(it(g)&&g.$ref!==c){let h=new Set(t);h.add(c),i.push(...ga(g,e,h));continue}}let p=Ou.exec(c),f=u??(p&&!p[2]?p[1]:void 0),m=f!==void 0?e.standardDefs[f]:void 0;it(m)&&it(m.properties)&&o.push({properties:Re(m.properties),...Array.isArray(m.required)?{required:m.required}:{}})}let s=[...o,...i,...n];return(\"properties\"in r||\"description\"in r)&&s.push(r),s}function p_(r,e){let t=ga(r,e,new Set),n,i={},o=new Set;for(let a of t)if(typeof a.description==\"string\"&&(n=a.description),it(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(wp.has(a))continue;let u=Ko(Re(c),e.rootDoc,e.peers,{inlineLocalDefs:!1});Jo(u,e.standardDefs,!0),s[a]=u}return{props:s,required:[...o].filter(a=>!wp.has(a)).sort(),...n!==void 0?{description:n}:{}}}function h_(r,e){let t=e.model.functions.get(r);if(!t)return;let n=it(t.properties)?t.properties:void 0,i=n?.args??t.args??t.parameters;if(i!==void 0)return it(i)?Object.keys(i).length>0&&!(\"properties\"in i)&&!(\"type\"in i)?{type:\"object\",properties:i,...t.required!==void 0?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.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:p,...f}=t;return f}function m_(r){let e=vu.map(t=>r.extensionFields[t]).find(t=>t!==void 0)??r.defs.theme;if(it(e))return\"properties\"in e||\"allOf\"in e||e.type===\"object\"?e:{type:\"object\",properties:e}}function g_(r){return(ke(r.protocolVersion)??r.protocolVersion)===\"0.8\"||r.id.includes(\"v0_8\")||r.id.includes(\"v0.8\")}function y_(r,e,t,n){if(!r.themeSchema)return;let i=g_(r),o=m_(n.model);if(o){let u=Re({...o});!i&&u.additionalProperties===void 0&&u.unevaluatedProperties===void 0&&(u.additionalProperties=!0),e.theme=u;return}let s=bt(r.themeSchema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});kr(s),Nu(s,e,t);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}};t.push(c),e.theme=c}function Nu(r,e,t){let n=it(r.definitions)?r.definitions:it(r.$defs)?r.$defs:void 0;delete r.definitions,delete r.$defs,n&&(Object.assign(e,n),t.push(n))}function b_(r,e,t){if(!r.schema||typeof r.schema!=\"object\"||!(\"safeParse\"in r.schema))return{props:{},reqList:[],additionalProps:void 0};let n=bt(r.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});kr(n),Nu(n,e,t);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\"||it(s)?s:void 0;return{props:i,reqList:o,additionalProps:a}}function v_(r){let e=r.schema?.description;return typeof e==\"string\"&&!e.startsWith(\"REF:\")?e:void 0}function __(r){return r.unevaluatedProperties??r.additionalProperties}function x_(r,e,t,n,i,o){let s,a,c,u,l=i.model.components.get(r);if(l)({props:s,required:a,description:c}=p_(l,i)),u=__(l)??(i.isV10?void 0:!1);else{let b=b_(e,t,n),{component:v,id:x,...$}=b.props;n.push($),s=$,a=b.reqList,c=v_(e),u=i.isV10?void 0:b.additionalProps??!1}let p={};Fu(p,\"ComponentId\",i.standardDefs);let f={id:p,...s,component:{const:r}},m=[\"id\",...a,\"component\"],g=u!==void 0?{unevaluatedProperties:u}:{},h;return o?.componentEnvelopeRef?h={...c!==void 0?{description:c}:{},allOf:[{$ref:o.componentEnvelopeRef},{type:\"object\",properties:f,required:m}],...g}:h={type:\"object\",...c!==void 0?{description:c}:{},properties:f,required:m,...g},e.allowedParents&&e.allowedParents.length>0&&(h.allowedParents=e.allowedParents),e.allowedChildren&&e.allowedChildren.length>0&&(h.allowedChildren=e.allowedChildren),h}function A_(r,e,t,n,i,o){if(r.components.size===0){e.components={};return}let s={};for(let[a,c]of r.components.entries())s[a]=x_(a,c,t,n,i,o);e.components=s,t.anyComponent={oneOf:Array.from(r.components.keys()).map(a=>({$ref:`#/components/${a}`})),discriminator:{propertyName:\"component\"}}}function D_(r,e,t,n,i){let o,s=h_(r,i);if(s)o=Ko(Re(s),i.rootDoc,i.peers,{inlineLocalDefs:!1}),Jo(o,i.standardDefs,!1);else if(e.schema&&typeof e.schema==\"object\"&&\"safeParse\"in e.schema){let a=bt(e.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});kr(a),Nu(a,t,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 C_(r,e,t,n,i){let o=D_(r,e,t,n,i),s=Array.isArray(o.required)&&o.required.length>0,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:r},args:o},required:c}:{type:\"object\",...e.description?{description:e.description}:{},properties:{call:{const:r},args:o,returnType:{const:e.returnType}},required:c,unevaluatedProperties:!1}}function w_(r,e,t,n,i){let o=Array.from(r.functions.keys()).filter(a=>!a.startsWith(\"@\"));if(o.length===0)return;let s={};for(let a of o)s[a]=C_(a,r.functions.get(a),t,n,i);e.functions=s,t.anyFunction={oneOf:o.map(a=>({$ref:`#/functions/${a}`}))}}var E_=new Map(Object.values(af).flatMap(r=>{let e=r.description;if(typeof e!=\"string\"||!e.startsWith(\"REF:\"))return[];let t=e.substring(4),n=t.indexOf(\"|\");return n===-1?[]:[[t.substring(0,n).split(\"/\").pop(),t.substring(n+1)]]}));function Wi(r,e,t=new Set){if(typeof r!=\"object\"||r===null||t.has(r))return;if(t.add(r),Array.isArray(r)){for(let o of r)Wi(o,e,t);return}let n=r,i=n.$ref;if(typeof i==\"string\"&&!i.startsWith(\"#\")&&i!==e){if(!Ou.test(i))throw new Error(`Cannot bundle the external schema reference '${i}'.`);n.$ref=Ep(i)}for(let o of Object.values(n))Wi(o,e,t)}function Ru(r,e,t=new Set){if(typeof r!=\"object\"||r===null||t.has(r))return;if(t.add(r),Array.isArray(r)){for(let o of r)Ru(o,e,t);return}let n=r,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===E_.get(o);s&&a&&(typeof s.description==\"string\"?n.description=s.description:delete n.description)}for(let o of Object.values(n))Ru(o,e,t)}function ya(r,e,t=new Set){if(!(typeof r!=\"object\"||r===null)&&!t.has(r)){if(t.add(r),typeof r.$ref==\"string\"){let n=o_(r.$ref);n!==void 0&&e.add(n)}if(Array.isArray(r))for(let n of r)ya(n,e,t);else for(let n of Object.values(r))ya(n,e,t)}}function Sp(r,e){let t={$schema:\"https://json-schema.org/draft/2020-12/schema\",...typeof r.declaredProtocolVersion==\"string\"?{protocolVersion:r.declaredProtocolVersion.trim().replace(/^[vV](?=\\d)/,\"\")}:{},catalogId:r.id};r.instructions&&(t.instructions=r.instructions);let n=i_(r,e),i=e?.protocolVersion??r.protocolVersion,o=Cu(r),s=o.defs,a={standardDefs:n,model:o,defs:s,rootDoc:{$defs:s,components:Object.fromEntries(o.components),functions:Object.fromEntries(o.functions)},peers:r.peerCatalogs??[],isV10:!!i&&ge(i,\"1.0\")},c={},u=[];y_(r,c,u,a),A_(r,t,c,u,a,e),w_(r,t,c,u,a),Wi(t,e?.componentEnvelopeRef),Wi(c);for(let p of u)Ru(p,n);let l;do{l=Object.keys(c).length;let p=new Set;ya(t,p),ya(c,p),(p.has(\"DynamicString\")||p.has(\"DynamicNumber\")||p.has(\"DynamicBoolean\")||p.has(\"DynamicValue\"))&&(p.add(\"DataBinding\"),p.add(\"FunctionCall\"));for(let f of p)if(!(f in c)){if(f in n){let m=Re(n[f]);Wi(m),c[f]=m}else if(!u_.has(f)&&f in s){let m=Re(s[f]);Jo(m,n,!1),Wi(m),c[f]=m}}p.has(\"anyFunction\")&&!(\"anyFunction\"in c)&&(c.anyFunction={not:{}})}while(Object.keys(c).length>l);return Object.keys(c).length>0&&(t.$defs=c),t}function Kn(r){if(!r)return\"\";let e=r.lastIndexOf(\"#\");return(e!==-1?r.slice(e+1):r).split(\"/\").filter(Boolean).pop()??\"\"}function Tp(r,e){if(!r?._def)return null;if(e){if(e.has(r))return null;e.add(r)}switch(r._def.typeName){case\"ZodOptional\":case\"ZodNullable\":case\"ZodDefault\":case\"ZodReadonly\":return r._def.innerType;case\"ZodBranded\":return r._def.type;case\"ZodEffects\":return r._def.schema;case\"ZodLazy\":return r._def.getter();default:return null}}function S_(r){let e=[],t=new Set,n=r;for(;n;){n.description&&e.push(n.description),n._def?.description&&e.push(n._def.description);let i=Tp(n,t);if(!i)break;n=i}return e}function Jn(r){let e=new Set,t=r;for(;t;){let n=Tp(t,e);if(!n)break;t=n}return t}function T_(r,e){if(!r)return null;let t=Kn(r),n=e.childListRefNames,i=e.childRefNames;return n.has(t)?{isChild:!1,isChildList:!0}:i.has(t)?{isChild:!0,isChildList:!1}:null}function k_(r,e){let t=!1;for(let n of r){if(typeof n!=\"object\"||n===null)continue;let i=Mu(n,e);if(i.isChildList)return{isChild:!1,isChildList:!0};i.isChild&&(t=!0)}return t?{isChild:!0,isChildList:!1}:null}function $_(r,e){let t=!1;for(let n of[\"oneOf\",\"anyOf\",\"allOf\"]){let i=r[n];if(!Array.isArray(i))continue;let o=k_(i,e);if(o?.isChildList)return o;o?.isChild&&(t=!0)}return t?{isChild:!0,isChildList:!1}:null}function Mu(r,e){let t=typeof r.$ref==\"string\"?r.$ref:\"\",n=T_(t,e);if(n)return n;if(r.type===\"array\"&&r.items){let o=Mu(r.items,e);if(o.isChild||o.isChildList)return{isChild:!1,isChildList:!0}}let i=$_(r,e);return i||(r.type===\"object\"&&r.properties&&(\"componentId\"in r.properties&&(\"path\"in r.properties||\"dataBinding\"in r.properties)||\"explicitList\"in r.properties||\"template\"in r.properties)?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1})}function I_(r){if(r?._def?.typeName===\"ZodObject\"&&typeof r._def.shape==\"function\"){let e=r._def.shape();return!!(e.componentId&&(e.path||e.dataBinding)||e.explicitList||e.template)}return!1}function F_(r,e){if(r?._def?.typeName===\"ZodArray\"){let t=Jn(r._def.type);return Yn(t,e).isChild}return!1}function R_(r,e){let t=!1,n=!1,i=!1;for(let o of r){let s=Jn(o);I_(s)&&(t=!0),F_(s,e)&&(n=!0);let a=Yn(s,e);if(a.isChildList)return{isChild:!1,isChildList:!0};a.isChild&&(i=!0)}return t||n?{isChild:!1,isChildList:!0}:i?{isChild:!0,isChildList:!1}:{isChild:!1,isChildList:!1}}function O_(r,e){if(!r)return!1;if(r.startsWith(\"REF:\")){let i=Kn(r.substring(4).split(\"|\")[0]);if(e.has(i))return!0}let t=Kn(r.split(\"|\")[0]);if(t&&e.has(t))return!0;let n=r.trim();return!!e.has(n)}function N_(r,e){if(!r)return!1;if(r.startsWith(\"REF:\")){let i=Kn(r.substring(4).split(\"|\")[0]);if(e.has(i))return!0}let t=Kn(r.split(\"|\")[0]);if(t&&e.has(t))return!0;let n=r.trim();return!!e.has(n)}function M_(r,e){let t=e.childListRefNames,n=e.childRefNames;for(let i of r){if(O_(i,t))return{isChild:!1,isChildList:!0};if(N_(i,n))return{isChild:!0,isChildList:!1}}return null}function j_(r,e){let t=Yn(r,e);return t.isChild||t.isChildList?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1}}function Yn(r,e){if(!r||typeof r!=\"object\")return{isChild:!1,isChildList:!1};let t=Qr(r);if(t===\"component-id\")return{isChild:!0,isChildList:!1};if(t===\"child-list\")return{isChild:!1,isChildList:!0};let n=M_(S_(r),e);if(n)return n;let i=Jn(r);if(!i?._def)return Mu(r,e);let o=Qr(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=Jn(i._def.type);return j_(a,e)}if(s===\"ZodUnion\"){let a=i._def.options??[];return R_(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 kp(r,e,t){let n=r.nestedRefs[e];if(n){n.add(t);return}r.nestedRefs[e]=new Set([t])}function P_(r,e,t,n){let i=Yn(e,n);if(i.isChildList){t.listRefs.add(r);return}if(i.isChild){t.singleRefs.add(r);return}let o=Jn(e);if(o?._def?.typeName!==\"ZodArray\")return;let s=Jn(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=Yn(u,n);(l.isChild||l.isChildList)&&(t.listRefs.add(r),kp(t,r,c))}}function L_(r){if(typeof r!=\"object\"||r===null)return null;let e=r;if(e.type!==\"array\"&&!(\"items\"in e))return null;let t=e.items;if(typeof t!=\"object\"||t===null)return null;let n=t.properties;return typeof n!=\"object\"||n===null?null:n}function B_(r,e,t){for(let[n,i]of Object.entries(r)){let o=Yn(i,t);if(o.isChildList){e.listRefs.add(n);continue}if(o.isChild){e.singleRefs.add(n);continue}let s=L_(i);if(s)for(let[a,c]of Object.entries(s)){let u=Yn(c,t);(u.isChild||u.isChildList)&&(e.listRefs.add(n),kp(e,n,a))}}}function V_(r,e,t){if(!r)return;let n=Jn(r);if(n?._def?.typeName===\"ZodObject\"&&typeof n._def.shape==\"function\"){let i=n._def.shape();for(let[o,s]of Object.entries(i))P_(o,s,e,t);return}if(typeof r==\"object\"&&r!==null&&\"properties\"in r){let i=r.properties;typeof i==\"object\"&&i!==null&&B_(i,e,t)}}function $p(r,e){let t={},n=typeof r?.components?.values==\"function\"?Array.from(r.components.values()):Array.isArray(r)?r:Array.from(r.values());for(let i of n){let o={singleRefs:new Set,listRefs:new Set,nestedRefs:{}};V_(i.schema,o,e),t[i.name]={singleRefs:o.singleRefs,listRefs:o.listRefs,nestedRefs:o.nestedRefs}}return t}var U_=Symbol.for(\"preact-signals\");function xa(){if($r>1)$r--;else{var r,e=!1;for((function(){var i=va;for(va=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}})();Xo!==void 0;){var t=Xo;for(Xo=void 0,ba++;t!==void 0;){var n=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&Op(t))try{t.c()}catch(i){e||(r=i,e=!0)}t=n}}if(ba=0,$r--,e)throw r}}function Ip(r){if($r>0)return r();ju=++z_,$r++;try{return r()}finally{xa()}}var Yo,_e=void 0;function Aa(r){var e=_e,t=Yo;_e=void 0,Yo=void 0;try{return r()}finally{_e=e,Yo=t}}var Xo=void 0,$r=0,ba=0,z_=0,ju=0,va=void 0,_a=0;function Fp(r){if(_e!==void 0){var e=r.n;if(e===void 0||e.t!==_e)return e={i:0,S:r,p:_e.s,n:void 0,t:_e,e:void 0,x:void 0,r:e},_e.s!==void 0&&(_e.s.n=e),_e.s=e,r.n=e,32&_e.f&&r.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=_e.s,e.n=void 0,_e.s.n=e,_e.s=e),e}}function ot(r,e){this.v=r,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}ot.prototype.brand=U_;ot.prototype.h=function(){return!0};ot.prototype.S=function(r){var e=this,t=this.t;t!==r&&r.e===void 0&&(r.x=t,this.t=r,t!==void 0?t.e=r:Aa(function(){var n;(n=e.W)==null||n.call(e)}))};ot.prototype.U=function(r){var e=this;if(this.t!==void 0){var t=r.e,n=r.x;t!==void 0&&(t.x=n,r.e=void 0),n!==void 0&&(n.e=t,r.x=void 0),r===this.t&&(this.t=n,n===void 0&&Aa(function(){var i;(i=e.Z)==null||i.call(e)}))}};ot.prototype.subscribe=function(r){var e=this;return Lu(function(){var t=e.value;Aa(function(){return r(t)})},{name:\"sub\"})};ot.prototype.valueOf=function(){return this.value};ot.prototype.toString=function(){return this.value+\"\"};ot.prototype.toJSON=function(){return this.value};ot.prototype.peek=function(){var r=this;return Aa(function(){return r.value})};Object.defineProperty(ot.prototype,\"value\",{get:function(){var r=Fp(this);return r!==void 0&&(r.i=this.i),this.v},set:function(r){if(r!==this.v){if(ba>100)throw new Error(\"Cycle detected\");(function(t){$r!==0&&ba===0&&t.l!==ju&&(t.l=ju,va={S:t,v:t.v,i:t.i,o:va})})(this),this.v=r,this.i++,_a++,$r++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{xa()}}}});function Rp(r,e){return new ot(r,e)}function Op(r){for(var e=r.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 Np(r){for(var e=r.s;e!==void 0;e=e.n){var t=e.S.n;if(t!==void 0&&(e.r=t),e.S.n=e,e.i=-1,e.n===void 0){r.s=e;break}}}function Mp(r){for(var e=r.s,t=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)):t=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}r.s=t}function Ir(r,e){ot.call(this,void 0,e),this.x=r,this.s=void 0,this.g=_a-1,this.f=4}Ir.prototype=new ot;Ir.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===_a))return!0;if(this.g=_a,this.f|=1,this.i>0&&!Op(this))return this.f&=-2,!0;var r=_e;try{Np(this),_e=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return _e=r,Mp(this),this.f&=-2,!0};Ir.prototype.S=function(r){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}ot.prototype.S.call(this,r)};Ir.prototype.U=function(r){if(this.t!==void 0&&(ot.prototype.U.call(this,r),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Ir.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var r=this.t;r!==void 0;r=r.x)r.t.N()}};Object.defineProperty(Ir.prototype,\"value\",{get:function(){if(1&this.f)throw new Error(\"Cycle detected\");var r=Fp(this);if(this.h(),r!==void 0&&(r.i=this.i),16&this.f)throw this.v;return this.v}});function jp(r,e){return new Ir(r,e)}function Pp(r){var e=r.j;if(r.j=void 0,typeof e==\"function\"){$r++;var t=_e;_e=void 0;try{e()}catch(n){throw r.f&=-2,r.f|=8,Pu(r),n}finally{_e=t,xa()}}}function Pu(r){for(var e=r.s;e!==void 0;e=e.n)e.S.U(e);r.x=void 0,r.s=void 0,Pp(r)}function q_(r){if(_e!==this)throw new Error(\"Out-of-order effect\");Mp(this),_e=r,this.f&=-2;try{8&this.f&&Pu(this)}finally{xa()}}function Hi(r,e){this.x=r,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name,Yo&&Yo.push(this)}Hi.prototype.c=function(){var r=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e==\"function\"&&(this.j=e)}finally{r()}};Hi.prototype.S=function(){if(1&this.f)throw new Error(\"Cycle detected\");this.f|=1,this.f&=-9,Pp(this),Np(this),$r++;var r=_e;return _e=this,q_.bind(this,r)};Hi.prototype.N=function(){2&this.f||(this.f|=2,this.u=Xo,Xo=this)};Hi.prototype.d=function(){this.f|=8,1&this.f||Pu(this)};Hi.prototype.dispose=function(){this.d()};function Lu(r,e){var t=new Hi(r,e);try{t.c()}catch(i){throw t.d(),i}var n=t.d.bind(t);return n[Symbol.dispose]=n,n}var Lp,Bp,Vp,Up,zp,qp,Zp,Wp,Hp={signal:Rp,computed:jp,effect:Lu,batchWrite:Ip,isSignal:r=>!!r&&typeof r==\"object\"&&\"value\"in r&&\"peek\"in r,getValue:r=>r.value,setValue:(r,e)=>{r instanceof Ir||(r.value=e)},peekValue:r=>r.peek()};Gp(Hp);function Gp(r){Lp=r.signal,Bp=r.computed,Vp=r.effect,Up=r.batchWrite,zp=r.isSignal,qp=r.getValue,Zp=r.setValue,Wp=r.peekValue}function Ke(r){return Lp(r)}function Xn(r){return Bp(r)}function sr(r){return Vp(r)}function Da(r){return Up(r)}function Fr(r){return zp(r)}function Be(r){return qp(r)}function Je(r,e){Zp(r,e)}function Ye(r){return Wp(r)}function Qo(r){return/^(0|[1-9]\\d*)$/.test(r)}var on=1e4,Z_=new Set([\"__proto__\",\"constructor\",\"prototype\"]),sn=class{constructor(e={}){this.data={},this.signals=new Map,this.subscriptions=new Set,this.data=e}getSignal(e){let t=this.normalizePath(e);return this.signals.has(t)||this.signals.set(t,Ke(this.get(t))),this.signals.get(t)}set(e,t){if(e==null)throw new rt(\"Path cannot be null or undefined.\");let n=this.parsePath(e);if(n.length===0)return this.data=t??{},this.notifyAllSignals(),this;let i=n.pop();if(t==null&&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 rt(`Cannot set path '${e}': the data model root is a primitive value.`,e);let o=this.data;for(let s=0;s<n.length;s++){let a=n[s];if(Array.isArray(o)){if(!Qo(a))throw new rt(`Cannot use non-numeric segment '${a}' on an array in path '${e}'.`,e);let c=parseInt(a,10);if(c>on)throw new rt(`Cannot set path '${e}': array index '${a}' exceeds maximum supported index (${on}).`,e);let u=o[c];if(u!=null&&typeof u!=\"object\")throw new rt(`Cannot set path '${e}': segment '${a}' is a primitive value.`,e);if(u==null){let l=s<n.length-1?n[s+1]:i;if(Qo(l)){if(parseInt(l,10)>on)throw new rt(`Cannot set path '${e}': array index '${l}' exceeds maximum supported index (${on}).`,e);o[c]=[]}else o[c]={}}}else{let c=Object.prototype.hasOwnProperty.call(o,a);if(c){let u=o[a];if(u!=null&&typeof u!=\"object\")throw new rt(`Cannot set path '${e}': segment '${a}' is a primitive value.`,e)}if(!c||o[a]===void 0||o[a]===null){let u=s<n.length-1?n[s+1]:i;if(Qo(u)){if(parseInt(u,10)>on)throw new rt(`Cannot set path '${e}': array index '${u}' exceeds maximum supported index (${on}).`,e);o[a]=[]}else o[a]={}}}o=o[a]}if(Array.isArray(o)){if(!Qo(i))throw new rt(`Cannot use non-numeric segment '${i}' on an array in path '${e}'.`,e);if(parseInt(i,10)>on)throw new rt(`Cannot set path '${e}': array index '${i}' exceeds maximum supported index (${on}).`,e)}if(t==null)if(Array.isArray(o)){let s=parseInt(i,10);s<o.length&&(o[s]=void 0)}else delete o[i];else o[i]=t;return this.notifySignals(e),this}delete(e){return this.set(e,void 0)}static resolvePath(e,t){return e.startsWith(\"/\")?e:t?`${t.endsWith(\"/\")?t:`${t}/`}${e}`:`/${e}`}get(e){if(e==null)throw new rt(\"Path cannot be null or undefined.\");if(e===\"/\"||e===\"\")return this.data;let t=this.parsePath(e),n=this.data;for(let i of t){if(n==null||typeof n!=\"object\")return;if(Array.isArray(n)){if(!Qo(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,t){let n=this.getSignal(e),i=!0,o=Ye(n),s=sr(()=>{let a=Be(n);o=a,i||t(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 t=e.split(\"/\").filter(n=>n.length>0);return t.length===0?\"/\":`/${t.join(\"/\")}`}parsePath(e){return e.split(\"/\").filter(t=>t.length>0).map(t=>{let n=t.replace(/~([01])/g,(i,o)=>o===\"1\"?\"/\":\"~\");if(Z_.has(n))throw new rt(`Forbidden path segment '${n}' in path '${e}'.`,e);return n})}notifySignals(e){let t=this.normalizePath(e);Da(()=>{this.updateSignal(t);let n=t;for(;n!==\"/\"&&n!==\"\";)n=n.substring(0,n.lastIndexOf(\"/\"))||\"/\",this.updateSignal(n);for(let i of this.signals.keys())this.isDescendant(i,t)&&this.updateSignal(i)})}updateSignal(e){let t=this.signals.get(e);if(t){let n=this.get(e);Array.isArray(n)?Je(t,n.slice()):typeof n==\"object\"&&n!==null?Je(t,{...n}):Je(t,n)}}notifyAllSignals(){Da(()=>{for(let e of this.signals.keys())this.updateSignal(e)})}isDescendant(e,t){return t===\"/\"||t===\"\"?e!==\"/\":e.startsWith(t+\"/\")}};var Gi=1e3;var T1=d.object({component:d.string().describe(\"The type name of the component.\"),id:d.lazy(()=>Er).optional(),weight:d.number().optional()}).passthrough().describe(\"A generic A2UI component definition.\");function es(r,e,t){if(e!==void 0){let n=r.availableCatalogs?.get(e);if(!n)throw new Fe(`Catalog not found: ${e}`);return n}if(!r.defaultCatalog)throw new Fe(`${t} names no catalogId and surface '${r.id}' has no default catalogId.`);return r.defaultCatalog}var Bu=new WeakMap,W_=\"a2ui:system-functions\",Kp;function H_(){return Kp??=new Ot(W_,Hn.V1_0,[],Qp),Kp}function Ji(r){if(Bu.has(r))return Bu.get(r);let e=(()=>{let t=r;for(;t;){if(t instanceof d.ZodObject||t._def?.typeName===\"ZodObject\"){if(t._def?.unknownKeys===\"passthrough\")return null;let n=typeof t.shape==\"function\"?t.shape():t.shape;return n&&typeof n==\"object\"?new Set(Object.keys(n)):null}if(t instanceof d.ZodEffects||t._def?.typeName===\"ZodEffects\"){t=t._def.schema;continue}if(t instanceof d.ZodOptional||t instanceof d.ZodNullable||t._def?.typeName===\"ZodOptional\"||t._def?.typeName===\"ZodNullable\"){t=t._def.innerType;continue}if(t instanceof d.ZodDefault||t._def?.typeName===\"ZodDefault\"){t=t._def.innerType;continue}if(t instanceof d.ZodCatch||t._def?.typeName===\"ZodCatch\"){t=t._def.innerType;continue}if(t instanceof d.ZodIntersection||t._def?.typeName===\"ZodIntersection\"){let n=Ji(t._def.left),i=Ji(t._def.right);return!n||!i?null:new Set([...n,...i])}if(t instanceof d.ZodUnion||t._def?.typeName===\"ZodUnion\"){let n=t._def.options,i=new Set;for(let o of n){let s=Ji(o);if(!s)return null;for(let a of s)i.add(a)}return i}return null}return null})();return Bu.set(r,e),e}function Jp(r,e,t){if(!e||typeof e!=\"object\"||Array.isArray(e))return;let n=Object.keys(e);if(n.length>Gi)throw new de(`Function call '${r}' exceeds maximum allowed arguments count (${Gi})`,r);let i=t?.functions?.get?.(r)??(r===\"@index\"&&t?.protocolVersion&&ge(t.protocolVersion,Hn.V1_0)?Yi:void 0);if(!i?.schema)return;let o=Ji(i.schema);if(o){for(let s of n)if(!o.has(s))throw new de(`Unknown argument '${s}' passed to function '${r}'`,r);if(n.length>o.size)throw new de(`Too many arguments for function '${r}': expected at most ${o.size}, received ${n.length}`,r)}}function G_(r){return r.startsWith(\"@\")&&!r.startsWith(\"@@\")}function Yp(r){return r.startsWith(\"@@\")?r.slice(1):r}var Xp=new Set([\"@path\",\"@call\"]);function Ca(r,e){if(ge(e,\"1.0\")){for(let t of r)if(G_(t)&&!Xp.has(t))throw new U(`Unrecognized reserved protocol directive '${t}' in v1.0 dynamic object. Reserved keys must be in ${Array.from(Xp).join(\", \")}, or escaped with prefix doubling (e.g. '@${t}').`,void 0,\"INVALID_RESERVED_KEY\")}}function Vu(r){let e=r;for(;e;){if(e.explicitIndex!==void 0&&Number.isFinite(e.explicitIndex))return e.explicitIndex;if(!(e instanceof Rt)&&typeof e.getIndex==\"function\"){let t=e.getIndex();if(t!==void 0&&Number.isFinite(t))return t}if(!(e instanceof Rt)&&typeof e.index==\"number\"&&Number.isFinite(e.index))return e.index;if(typeof e.path==\"string\"){let t=e.path.split(\"/\").filter(Boolean);if(t.length>0&&/^\\d+$/.test(t[t.length-1]))return parseInt(t[t.length-1],10)}e=e.parent}}var Ki=1e3,Rt=class r{constructor(e,t,n,i){this.path=t,this._isUserActivated=!1,this._isPassiveEvaluation=!1,e instanceof sn?(this.surface=void 0,this.dataModel=e,this.functionInvoker=()=>{}):(this.surface=e,this.dataModel=e.dataModel,this.functionInvoker=e.defaultCatalog?.invoker??((o,...s)=>es(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 Vu(this)}get index(){return this.getIndex()}set(e,t){let n=this.resolvePath(e);this.dataModel.set(n,t)}get surfaceProtocolVersion(){return this.surface?.protocolVersion??this.surface?.defaultCatalog?.protocolVersion}get atLeastV10(){return this._cachedAtLeastV10===void 0&&(this._cachedAtLeastV10=ge(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\")return!1;if(Array.isArray(e))return e.some(n=>this.containsDynamicValue(n));let t=e;if(this.isDataBindingObject(t)||this.isFunctionCallObject(t))return!0;if(this.atLeastV10){for(let n of Object.keys(t))if(n.startsWith(\"@\"))return!0}return Object.values(t).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,t=0,n=!1){if(t>Ki){let o=new de(`Maximum dynamic value nesting depth exceeded (${Ki})`);this.dispatchExpressionError(o,\"DynamicValue\");return}if(e===null||typeof e!=\"object\")return e;if(Array.isArray(e))return this.containsDynamicValue(e)?e.map(o=>this.resolveDynamicValue(o,t+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,t,n):this.resolvePlainObjectValue(i,t)}resolveFunctionCallValue(e,t=0,n=!1){let i=e[\"@call\"]??e.call,o=this.resolveCallCatalog(i,e);if(!o)return;try{Jp(i,e.args,o)}catch(l){this.dispatchExpressionError(l,i);return}let s={};for(let[l,p]of Object.entries(e.args??{}))s[l]=this.resolveDynamicValue(p,t+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 Fr(u)?Ye(u):u}resolvePlainObjectValue(e,t=0){if(this.atLeastV10&&Ca(Object.keys(e),this.surfaceProtocolVersion),!this.containsDynamicValue(e))return e;let n={};for(let[i,o]of Object.entries(e)){let s=this.atLeastV10?Yp(i):i;n[s]=this.resolveDynamicValue(o,t+1)}return n}subscribeDynamicValue(e,t){let n=this.resolveSignal(e),i=!0,o=Ye(n),s=sr(()=>{let a=Be(n);o=a,i||t(a)});return i=!1,{get value(){return o},unsubscribe:()=>{s(),n.unsubscribe?.()}}}resolveSignal(e,t=0){if(t>Ki){let a=new de(`Maximum dynamic value nesting depth exceeded (${Ki})`);return this.dispatchExpressionError(a,typeof e==\"object\"&&e&&(\"@call\"in e||\"call\"in e)?e[\"@call\"]??e.call:\"DynamicValue\"),Ke(void 0)}if(typeof e!=\"object\"||e===null)return Ke(e);if(Array.isArray(e)){if(!this.containsDynamicValue(e))return Ke(e);let a=e.map(u=>this.resolveSignal(u,t+1)),c=Xn(()=>a.map(u=>Be(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 Ke(void 0);try{Jp(c,a.args,u)}catch(v){return this.dispatchExpressionError(v,c),Ke(void 0)}let l={};for(let[v,x]of Object.entries(a.args??{}))l[v]=this.resolveSignal(x,t+1);if(Object.keys(l).length===0){let v=new AbortController,x=this.evaluateFunctionPassive({name:c,args:{},abortSignal:v.signal,invoker:u.invoker}),$=Fr(x)?x:Ke(x);return $.unsubscribe=()=>v.abort(),$}let p=Object.keys(l),f=Ke(void 0),m,g,h=Xn(()=>{let v={};for(let x=0;x<p.length;x++)v[p[x]]=Be(l[p[x]]);return v}),b=sr(()=>{try{let v=Be(h);m&&m.abort(),g&&(g(),g=void 0),m=new AbortController;let x=this.evaluateFunctionPassive({name:c,args:v,abortSignal:m.signal,invoker:u.invoker});Fr(x)?g=sr(()=>{Je(f,Be(x))}):Je(f,x)}catch(v){this.dispatchExpressionError(v,c),Je(f,void 0)}});return f.unsubscribe=()=>{b(),g&&g(),m&&m.abort();for(let v=0;v<p.length;v++)l[p[v]].unsubscribe?.()},f}if(this.atLeastV10&&Ca(Object.keys(n),this.surfaceProtocolVersion),!this.containsDynamicValue(n))return Ke(e);let i=Object.entries(n).map(([a,c])=>[this.atLeastV10?Yp(a):a,this.resolveSignal(c,t+1)]),o=Xn(()=>{let a={};for(let[c,u]of i)a[c]=Be(u);return a}),s=o.unsubscribe?.bind(o);return o.unsubscribe=()=>{s?.();for(let[,a]of i)a.unsubscribe?.()},o}resolveAction(e){if(\"event\"in e&&typeof e.event==\"object\"&&e.event!==null){let t={},n=e.event;if(n.context&&typeof n.context==\"object\"&&!Array.isArray(n.context))for(let[o,s]of Object.entries(n.context))t[o]=this.resolveDynamicValue(s);let i={...n,context:t};return n.userMessage!==void 0&&(i.userMessage=this.resolveDynamicValue(n.userMessage)),{...e,event:i}}if(\"name\"in e){let t=e,n={};if(t.context&&typeof t.context==\"object\"&&!Array.isArray(t.context))for(let[o,s]of Object.entries(t.context))n[o]=this.resolveDynamicValue(s);let i={...t,context:n};return t.userMessage!==void 0&&(i.userMessage=this.resolveDynamicValue(t.userMessage)),i}return\"functionCall\"in e?this.resolveDynamicValue(e.functionCall,0,!0):\"call\"in e?this.resolveDynamicValue(e,0,!0):e}resolveFunctionCatalog(e,t,n){if(this.atLeastV10&&e.startsWith(\"@\")){if(n)throw new de(`System function '${e}' belongs to no catalog and must not name a catalogId.`,e);return H_()}if(!this.surface)throw new Fe(`No surface available to resolve catalog: ${t??\"default\"}`);return es(this.surface,this.atLeastV10?t:void 0,`Function call '${e}'`)}resolveCallCatalog(e,t){try{return this.resolveFunctionCatalog(e,t.catalogId,\"catalogId\"in t)}catch(n){n instanceof Fe&&this.surface?this.surface.dispatchError({code:\"CATALOG_ERROR\",message:n.message,expression:e}):this.dispatchExpressionError(n,e);return}}evaluateFunctionPassive(e){let{name:t,args:n,invoker:i,abortSignal:o}=e,s=this._isPassiveEvaluation;this._isPassiveEvaluation=!0;try{return this.evaluateFunctionReactive(t,n,i,o)}finally{this._isPassiveEvaluation=s}}evaluateFunctionReactive(e,t,n,i){try{return n(e,t,this,i)}catch(o){this.dispatchExpressionError(o,e);return}}dispatchExpressionError(e,t){if(this.surface)if(e instanceof d.ZodError||typeof e==\"object\"&&e!==null&&e.name===\"ZodError\"){let n=e,i=new de(`Validation failed for function '${t}': ${n.message}`,t,n.errors??n.issues);this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:i.message,expression:t,details:i.details})}else if(e instanceof de)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:\"EXPRESSION_ERROR\",message:n.message??`An unexpected error occurred in function ${t}.`,expression:t})}}nested(e,t){let n=this.resolvePath(e);return new r(this.surface??this.dataModel,n,t,this)}resolvePath(e){if(e.startsWith(\"/\"))return e;let t=this.path;return t.endsWith(\"/\")&&t.length>1&&(t=t.slice(0,-1)),e===\"\"||e===\".\"?t||\"/\":(t===\"/\"&&(t=\"\"),`${t}/${e}`)}};var ts=wr(d.string().describe(\"REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),Uu=d.string().describe(\"REF:#/$defs/CallId|The unique identifier for a function call.\"),an=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(r=>r[\"@path\"]!==void 0||r.path!==void 0,{message:\"Either '@path' or 'path' must be provided.\"}).describe(\"REF:#/$defs/DataBinding\"),K_=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(r=>r[\"@call\"]!==void 0||r.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.\"),Wt=d.record(d.string(),d.any()).and(d.intersection(K_,d.any())).describe(\"REF:#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition.\"),wa=d.union([d.string(),an,Wt]).describe(\"REF:#/$defs/DynamicString|Represents a string\"),eh=d.union([d.boolean(),an,Wt]).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).\"),J_=d.object({label:wa.optional(),description:wa.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:eh.optional()}).strict().describe(\"REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\"),zu=d.record(d.string(),d.unknown()).superRefine((r,e)=>{for(let t in r)t.match(/^[\\p{XID_Start}_][\\p{XID_Continue}:-]*$/u)||e.addIssue({path:[t],code:d.ZodIssueCode.custom,message:`Invalid extension key \"${t}\": 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.\"),th=d.object({id:ts,catalogId:d.string().describe(\"The catalog ID for this component, overriding any surface-level default catalogId.\").optional(),accessibility:J_.optional(),metadata:d.object({extensions:zu.optional()}).strict().describe(\"Optional component-level metadata for vendor extensions.\").optional()}).describe(\"REF:#/$defs/ComponentCommon\");var Y_=wr(d.union([d.array(ts).describe(\"A static list of child component IDs.\"),d.object({componentId:ts,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\"),rh=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),d.record(d.string(),d.unknown()).refine(r=>!r||!(\"@path\"in r)&&!(\"path\"in r)&&!(\"@call\"in r)&&!(\"call\"in r)),an,Wt]).describe(\"REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),nh=d.union([d.number(),an,Wt]).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.\"),X_=d.union([d.array(d.string()),an,Wt]).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.\"),Z1=d.object({\"@call\":d.literal(\"@index\").optional(),call:d.literal(\"@index\").optional(),args:d.object({offset:nh.optional()}).optional()}).refine(r=>r[\"@call\"]!==void 0||r.call!==void 0,{message:\"Either '@call' or 'call' must be '@index'.\"}).describe(\"REF:#/$defs/IndexSystemFunction\"),Q_=d.object({condition:d.union([an,Wt]).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).\"),W1=d.object({checks:d.array(Q_).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.\"),H1=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the agent.\"),userMessage:wa.optional(),context:d.record(d.string(),rh).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:Wt}).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.\"),G1=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'.\"),ih=d.object({functionCallId:Uu,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((r,e)=>{let t=\"value\"in r,n=\"error\"in r;(t&&n||!t&&!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 Yi={name:\"@index\",returnType:\"number\",allowedCallers:\"rendererOnly\",schema:d.object({offset:d.union([an,Wt,d.coerce.number()]).optional()})},qu=Ae(Yi,(r,e)=>{let t=typeof r.offset==\"number\"&&Number.isFinite(r.offset)?r.offset:0,n=Vu(e);if(n===void 0||!Number.isFinite(n))throw new U(\"@index function can only be evaluated inside a collection template iteration scope.\");return n+t}),Qp=[qu];function Ae(r,e){return{name:r.name,returnType:r.returnType,schema:r.schema,allowedCallers:r.allowedCallers,requiresUserActivation:r.requiresUserActivation,description:r.description,execute:e}}var Ot=class r{get peerCatalogs(){return this._peerCatalogs}withPeerCatalogs(e){let t=Ea(this),n=new Set([t]),i=[],o=u=>{if(!u)return;let l=Ea(u);n.has(l)||(n.add(l),i.push(l))};for(let u of this._peerCatalogs)o(u);for(let u of e)o(u._sourceCatalog),o(u);if(i.length===this._peerCatalogs.length&&i.every((u,l)=>u===this._peerCatalogs[l]))return this;let s=new Map;for(let[u,l]of this.components)s.set(u,Tu(l,i));let a=new Map;for(let[u,l]of this.functions)a.set(u,Tu(l,i));let c=Object.create(Object.getPrototypeOf(this));return Object.assign(c,this,{components:s,functions:a,invoker:sh(this.id,this.protocolVersion,a),cachedValidationSchema:void 0,_componentRefMap:void 0,_peerCatalogs:Object.freeze(i),_linkedFrom:t}),c}get validationSchema(){return this.cachedValidationSchema||(this.cachedValidationSchema=Sp(this)),Re(this.cachedValidationSchema)}get catalogSchema(){return this.validationSchema}toJson(){return this.cachedDocument||(this.cachedDocument=ip(this)),Re(this.cachedDocument)}withEntries(e,t){let n=e.length!==this.components.size||e.some(c=>this.components.get(c.name)!==c),i=t.length!==this.functions.size||t.some(c=>this.functions.get(c.name)!==c),o=this.defs;if(o&&(n||i)){let c={...o};n&&delete c.anyComponent,i&&delete c.anyFunction,o=c}let s=this.unions?{anyComponent:this.unions.anyComponent||n,anyFunction:this.unions.anyFunction||i}:void 0,a=new r(this.id,this.protocolVersion,e,t,{themeSchema:this.themeSchema,instructions:this.instructions,schemaUri:this.schemaUri,schemaId:this.schemaId,title:this.title,description:this.description,declaredProtocolVersion:this.declaredProtocolVersion,declaresCatalogId:this.declaresCatalogId,declaresComponents:this.declaresComponents,functionsLayout:this.functionsLayout,unions:s,defs:ep(o,[...this.components.values(),...this.functions.values()],[...e,...t],this.extensionFields),extensionFields:this.extensionFields,commonTypesUri:this.commonTypesUri,themeLocation:this.themeLocation,defModels:this.defModels});return a._sourceCatalog=this._sourceCatalog??Ea(this),this._peerCatalogs.length>0?a.withPeerCatalogs(this._peerCatalogs):a}get componentRefMap(){return this._componentRefMap||(this._componentRefMap=$p(this,qf)),this._componentRefMap}constructor(e,t,n=[],i=[],o,s){if(this._peerCatalogs=[],!t)throw new Fe(\"protocolVersion must be provided.\");this.id=e,this.protocolVersion=t;let a=new Map;for(let l of n)a.set(l.name,l);this.components=a;let c=new Map;for(let l of i)c.set(l.name,l);this.functions=c;let u=tx(o)?{themeSchema:o}:o??{};this.themeSchema=u.themeSchema,this.instructions=u.instructions??s,this.schemaUri=u.schemaUri,this.schemaId=u.schemaId,this.title=u.title,this.description=u.description,this.declaredProtocolVersion=u.declaredProtocolVersion,this.declaresCatalogId=u.declaresCatalogId??!0,this.declaresComponents=u.declaresComponents??!0,this.functionsLayout=u.functionsLayout,this.unions=u.unions?Object.freeze({...u.unions}):void 0,this.defs=_u(u.defs),this.extensionFields=_u(u.extensionFields),this.commonTypesUri=u.commonTypesUri,this.themeLocation=u.themeLocation,this.defModels=u.defModels?Object.freeze([...u.defModels]):void 0,this.invoker=sh(this.id,this.protocolVersion,this.functions)}static fromJson(e,t,n){let{id:i,protocolVersion:o,components:s,functions:a,...c}=Cp(e,t,n);return new r(i,o,s,a,c)}static fromSchema(e,t){return r.fromJson(e,t)}};function Ea(r){return r._linkedFrom??r}var oh=new WeakMap;function ex(r){let e=Ea(r),t=oh.get(e);return t===void 0&&(t=da(e.toJson()),oh.set(e,t)),t}function ah(r,e=[]){let t=Array.from(r),n=Array.from(e);return t.length+n.length<2?t:t.map((i,o)=>{if(typeof i.withPeerCatalogs!=\"function\"||!ex(i))return i;let s=[...n,...t.filter((a,c)=>c!==o&&a!==i)];return i.withPeerCatalogs(s)})}function tx(r){return typeof r==\"object\"&&r!==null&&typeof r.safeParse==\"function\"}function sh(r,e,t){return(n,i,o,s)=>{let a=t.get(n)??(ge(e,Hn.V1_0)&&n===\"@index\"?qu:void 0);if(!a)throw new de(`Function not found in catalog '${r}': ${n}`,n);rx(a,o);let c=a.execute;if(typeof c!=\"function\")throw new de(`Function '${n}' in catalog '${r}' is schema-only and has no implementation.`,n);try{let u=a.schema.parse(i);return c.call(a,u,o,s)}catch(u){throw u?.name===\"ZodError\"||u instanceof d.ZodError?new de(`Validation failed for function '${n}': ${u.message}`,n,u.errors??u.issues):u}}}function rx(r,e){if(!r.requiresUserActivation)return;let t=!!e?.isPassiveEvaluation,i=!!!e?.isUserActivated&&typeof navigator<\"u\"&&!(navigator.userActivation?.isActive??!0);if(t||i)throw new de(`Function '${r.name}' requires user activation and cannot be evaluated without an active user gesture.`,r.name)}var Ve=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),{unsubscribe:()=>this.listeners.delete(e)}}async emit(e){for(let t of this.listeners)try{await t(e)}catch(n){console.error(\"EventEmitter error:\",n)}}dispose(){this.listeners.clear()}};var ka=50,Sa=5,nx=/^(?:(?:\\/(?:[^~/]|~[01])*)*|(?:[^~/]|~[01])+(?:\\/(?:[^~/]|~[01])*)*)$/;function*Ta(r,e,t){if(typeof r==\"string\")yield[r,e];else if(Array.isArray(r))for(let n=0;n<r.length;n++){let i=r[n],o=`${e}[${n}]`;yield*Ta(i,o,t)}else if(typeof r==\"object\"&&r!==null){let n=r;if(\"componentId\"in n&&typeof n.componentId==\"string\"&&(\"path\"in n||\"dataBinding\"in n))yield[n.componentId,`${e}.componentId`];else if(t?.size)for(let i of t)i in n&&(yield*Ta(n[i],`${e}.${i}`));else for(let[i,o]of Object.entries(n))yield*Ta(o,`${e}.${i}`)}}function ix(r){return r.componentRefMap}function*$a(r,e){if(!r||typeof r!=\"object\")return;let t=e instanceof Ot?ix(e):e,n=r.component,i=\"\",o=r;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=t[i],a=s?s.singleRefs:new Set,c=s?s.listRefs:new Set,u=s?.nestedRefs;for(let[l,p]of Object.entries(o))(a.has(l)||c.has(l))&&(yield*Ta(p,l,u?.[l]))}var ox=Object.freeze({allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1}),sx=Object.freeze({allowOrphanComponents:!0,allowDanglingReferences:!0,allowMissingRoot:!0,allowUnknownElements:!0});function Qn(r,e,t){if(e>ka)throw new ir(`Global recursion limit exceeded: Depth > ${ka}`);if(Array.isArray(r)){for(let n of r)Qn(n,e+1,t);return}if(typeof r==\"object\"&&r!==null){let n=r;for(let s of[n.path,n[\"@path\"]])if(typeof s==\"string\"&&!nx.test(s))throw new U(`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(t>=Sa)throw new ir(`Recursion limit exceeded: functionCall depth > ${Sa}`);for(let[s,a]of Object.entries(n))s===\"functionCall\"?Qn(a,e+1,t+1):Qn(a,e+1,t)}else if(o){if(t>=Sa)throw new ir(`Recursion limit exceeded: functionCall depth > ${Sa}`);for(let[s,a]of Object.entries(n))s===\"args\"?Qn(a,e+1,t+1):Qn(a,e+1,t)}else for(let s of Object.values(n))Qn(s,e+1,t)}}function ch(r){Qn(r,0,0)}var Xi=class{constructor(e){this.components=new Map,this._onCreated=new Ve,this._onDeleted=new Ve,this.onCreated=this._onCreated,this.onDeleted=this._onDeleted,e&&this.setCatalog(e)}setCatalog(e){this.refMap=e instanceof Ot?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 Yr(`Component with id '${e.id}' already exists.`);this.components.set(e.id,e),this._onCreated.emit(e)}removeComponent(e){let t=this.components.get(e);t&&(this.components.delete(e),t.dispose(),this._onDeleted.emit(e))}getChildReferences(e){let t=this.components.get(e);if(!t)return[];let n=t.catalog.components.size?t.catalog.componentRefMap:this.refMap??t.catalog.componentRefMap;return Array.from($a(t.componentTree,n))}getChildIds(e){return this.getChildReferences(e).map(([t])=>t)}detectCycles(e={}){let t=e.rootId??\"root\",n=e.maxDepth??ka,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 ir(`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 ir(`Global recursion limit exceeded: logical depth > ${n}`);o.add(c),s.add(c);let l=this.getChildIds(c);for(let p of l)if(this.components.has(p)){if(!o.has(p))a(p,u+1);else if(s.has(p))throw new ir(`Circular reference detected involving component '${p}'`)}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(t)&&a(t,0);return o}validateTopology(e={}){if(this.components.size===0)return;let t=e.rootId??\"root\",n=e.allowMissingRoot??!1,i=e.allowDanglingReferences??!1,o=e.allowOrphanComponents??!1;if(!n&&!this.components.has(t))throw new Vt(`Missing root component: No component has id='${t}'`);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 Vt(`Component '${a.id}' references non-existent component '${c}' in field '${u}' (Dangling reference '${c}' in component '${a.id}')`)}let s=this.detectCycles({rootId:t,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 Vt(`Component '${a[0]}' is not reachable from '${t}' (Orphaned component '${a[0]}' is not reachable from root)`)}}validateReferences(e={}){let t=[];try{this.validateTopology(e)}catch(n){n instanceof U?t.push(n):n instanceof Error&&t.push(new U(n.message))}return t}dispose(){for(let e of this.components.values())e.dispose();this.components.clear(),this._onCreated.dispose(),this._onDeleted.dispose()}};function ax(r){if(!r)return;let e=ke(r);return e?`v${e}`:r}var ei=class{constructor(e,t,n=new Map,i={},o=!1,s,a=\"root\",c,u){if(this.id=e,this.defaultCatalog=t,this.theme=i,this.sendDataModel=o,this.rootId=a,this.metadata=c,this._onAction=new Ve,this._onError=new Ve,this._onWarning=new Ve,this.onAction=this._onAction,this.onError=this._onError,this.onWarning=this._onWarning,this.protocolVersion=ax(u??t?.protocolVersion),n!=null&&!(n instanceof Map))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.\");let l=new Map(n??[]);t?.id&&!l.has(t.id)&&l.set(t.id,t),this.availableCatalogs=l,this.dataModel=s??new sn({}),this.componentsModel=new Xi(t)}get catalog(){return this.defaultCatalog}resolveCatalog(e,t=\"Item\"){return es(this,e,t)}async dispatchAction(e,t){if(!e||typeof e!=\"object\")return;let n=cx(e);if(!n)return;let i=n.name;if(!i||typeof i!=\"string\")return;let o=n.context,s=o&&typeof o==\"object\"&&!Array.isArray(o)?o:{},a={name:i,surfaceId:this.id,sourceComponentId:t,timestamp:new Date().toISOString(),context:s},c=n.catalogId??e.catalogId;typeof c==\"string\"&&c&&(a.catalogId=c),typeof n.userMessage==\"string\"&&n.userMessage.length>0&&(a.userMessage=n.userMessage),await this._onAction.emit(a)}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()}};function cx(r){return\"event\"in r&&r.event&&typeof r.event==\"object\"?r.event:\"name\"in r&&typeof r.name==\"string\"?r:null}var Ia=class{constructor(){this.surfaces=new Map,this.surfaceUnsubscribers=new Map,this._onSurfaceCreated=new Ve,this._onSurfaceDeleted=new Ve,this._onAction=new Ve,this.onSurfaceCreated=this._onSurfaceCreated,this.onSurfaceDeleted=this._onSurfaceDeleted,this.onAction=this._onAction}addSurface(e){if(this.surfaces.has(e.id)){console.warn(`Surface ${e.id} already exists. Ignoring.`);return}this.surfaces.set(e.id,e);let t=e.onAction.subscribe(n=>this._onAction.emit(n));this.surfaceUnsubscribers.set(e.id,t),this._onSurfaceCreated.emit(e)}deleteSurface(e){let t=this.surfaces.get(e);if(t){let n=this.surfaceUnsubscribers.get(e);n&&(n.unsubscribe(),this.surfaceUnsubscribers.delete(e)),this.surfaces.delete(e),t.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()}};var cn=class{constructor(e,t,n,i,o){this.id=e,this.type=t,this.catalog=i,this.metadata=o,this._onUpdated=new Ve,this.onUpdated=this._onUpdated,this._properties=n}get properties(){return this._properties}set properties(e){this._properties=e,this._onUpdated.emit(this)}dispose(){this._onUpdated.dispose()}get componentTree(){return{...this._properties,id:this.id,component:this.type,...this.metadata!==void 0?{metadata:this.metadata}:{}}}};function Rr(r){let e=r.path.join(\".\")||\"root\";switch(r.code){case d.ZodIssueCode.invalid_union:{let t=r.unionErrors?.flatMap(n=>n.issues);return t&&t.length>0?t.map(Rr).join(\"; \"):`${e}: Invalid union`}case d.ZodIssueCode.unrecognized_keys:{let t=r.keys.map(n=>`'${n}'`).join(\", \");return`${e}: Unrecognized key(s) in object: ${t}`}case d.ZodIssueCode.invalid_enum_value:{let t=r,n=t.options.map(i=>String(i)).join(\" | \");return`${e}: Invalid enum value. Expected ${n}, received '${String(t.received)}'`}case d.ZodIssueCode.invalid_type:{let t=r;return`${e}: Expected ${t.expected}, received ${t.received}`}case d.ZodIssueCode.custom:return`${e}: ${r.message}`;default:return r.message?`${e}: ${r.message}`:`${e}: Validation error (${r.code})`}}var ux={\"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 ar(r,e,t=ux){if(!r||!e)return!1;let n=ke(r),i=ke(e);if(n&&i){if(n===i)return!0;let a=t[i];if(a&&a.has(n))return!0;let c=Xr(r),u=Xr(e);return!!(c&&u&&c.major>=1&&c.major===u.major)}if(typeof r!=\"string\"||typeof e!=\"string\")return!1;let o=Cr(r),s=Cr(e);return o.length>0&&o===s}var Zu;function uh(r){Zu=r}function lx(r,e){for(let t of e){let n=r[t];if(n&&typeof n==\"object\"){let i=n;if(\"surfaceId\"in i&&i.surfaceId!==void 0&&typeof i.surfaceId!=\"string\")throw new U(\"surfaceId must be a string\")}}}var un=class{get compatibleCatalogVersions(){let e=ke(this.version);return e?new Set([e]):new Set}get validActions(){return new Set(this.getNativeActionKeys())}isCatalogCompatible(e){return e?ar(e,this.version):!1}extractOperations(e){if(!e||typeof e!=\"object\")return[];if(Array.isArray(e))return e.flatMap(a=>this.extractOperations(a));let t=e;if(Array.isArray(t.messages))return this.extractOperations(t.messages);let n=this.getNativeActionKeys();lx(t,n);let i=n.filter(a=>a in t).sort();if(i.length>1)throw new U(`Message contains multiple conflicting update actions: ${i.join(\", \")}.`);if(i.length===0){let a=Zu?Zu():new Set(n),c=Object.keys(t).find(l=>a.has(l)&&!n.includes(l)),u=n.slice().sort().join(\", \");throw c?new U(`Invalid ${this.version} message: action '${c}' is not supported in protocol version ${this.version}. Allowed actions: ${u}.`):new U(`Invalid ${this.version} message: message must contain exactly one update action: ${u}.`)}let o=this.preparePayloadForValidation(t),s=this.schema.safeParse(o);if(!s.success){let a=s.error.errors.map(Rr).join(\"; \");throw new U(`Invalid ${this.version} message: ${a}`,s.error)}return this.extractOperationsFromObject(t)}preparePayloadForValidation(e){return\"version\"in e?e:{version:this.version,...e}}};var cr=(r,e)=>{let t=Object.keys(r).filter(n=>r[n]!==void 0);t.length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Must define exactly one property, found ${t.length} (${t.join(\", \")}).`})},Nt=d.object({path:d.string().optional(),literalString:d.string().optional(),literal:d.string().optional()}).strict().superRefine(cr),lh=d.lazy(()=>d.object({key:d.string(),valueString:d.string().optional(),valueNumber:d.number().optional(),valueBoolean:d.boolean().optional(),valueMap:d.array(lh).optional()}).strict().superRefine((r,e)=>{let t=0;r.valueString!==void 0&&t++,r.valueNumber!==void 0&&t++,r.valueBoolean!==void 0&&t++,r.valueMap!==void 0&&t++,t!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Value map item must have exactly one value property (valueString, valueNumber, valueBoolean, valueMap), found ${t}.`})}));function dx(r={}){let e=r.maxDepth??5;return lh.superRefine((t,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(t,1)})}var dh=dx(),L$=d.object({path:d.string().optional(),literalNumber:d.number().optional(),literal:d.number().optional()}).strict().superRefine(cr),B$=d.object({path:d.string().optional(),literalBoolean:d.boolean().optional(),literal:d.boolean().optional()}).strict().superRefine(cr),fx=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(cr)})).describe(\"A key-value map of data bindings to be resolved when the action is triggered.\").optional()}),V$=d.object({text:Nt,usageHint:d.enum([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\",\"body\"]).optional()}),U$=d.object({url:Nt,usageHint:d.enum([\"icon\",\"avatar\",\"smallFeature\",\"mediumFeature\",\"largeFeature\",\"header\"]).optional(),fit:d.enum([\"contain\",\"cover\",\"fill\",\"none\",\"scale-down\"]).optional(),altText:Nt.optional()}),z$=d.object({name:Nt}),q$=d.object({url:Nt}),Z$=d.object({url:Nt,description:Nt.optional().describe(\"A label, title, or placeholder text.\")}),W$=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((r,e)=>{r.title||e.addIssue({code:d.ZodIssueCode.custom,message:\"Tab item is missing 'title'.\"}),r.child||e.addIssue({code:d.ZodIssueCode.custom,message:\"Tab item is missing 'child'.\"}),r.title&&cr(r.title,e)})).describe(\"A list of tabs, each with a title and a child component ID.\")}),H$=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.\")}),G$=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.\")}),K$=d.object({child:d.string().describe(\"The ID of the component to display as the button's content.\"),action:fx.describe(\"Represents a user-initiated action.\"),primary:d.boolean().optional().describe(\"Indicates if this button should be styled as the primary action.\")}),J$=d.object({label:Nt,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(cr)}),Y$=d.object({text:Nt.optional(),label:Nt.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.\")}),X$=d.object({value:Nt,enableDate:d.boolean().optional(),enableTime:d.boolean().optional(),outputFormat:d.string().optional().describe(\"The string format for the output (e.g., 'YYYY-MM-DD').\")}),Q$=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(cr),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(cr),value:d.string()})).optional(),maxAllowedSelections:d.number().optional(),type:d.enum([\"checkbox\",\"chips\"]).optional(),filterable:d.boolean().optional()}),eI=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(cr),minValue:d.number().optional(),maxValue:d.number().optional(),label:Nt.optional()}),px=d.object({componentId:d.string(),dataBinding:d.string()}),Wu=d.object({explicitList:d.array(d.string()).optional(),template:px.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(cr),tI=d.object({children:Wu,distribution:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),rI=d.object({children:Wu,distribution:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),nI=d.object({children:Wu,direction:d.enum([\"vertical\",\"horizontal\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),iI=d.object({child:d.string().describe(\"The ID of the component to be rendered inside the card.\")});var hx=dh.describe(\"A single data entry. Exactly one 'value*' property should be provided alongside the key.\"),mx=d.record(d.any()).refine(r=>Object.keys(r).length===1,\"A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading').\");var gx=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:mx.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.\"),yx=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.\"),bx=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(gx).min(1).describe(\"A list containing all UI components for the surface.\")}).strict().superRefine((r,e)=>{let t=new Set;for(let i of r.components)i.id&&(t.has(i.id)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Duplicate component ID found: ${i.id}`,path:[\"components\"]}),t.add(i.id));let n=(i,o)=>{for(let s of i)s&&!t.has(s)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${o}' references non-existent component ID '${s}'.`,path:[\"components\"]})};for(let i of r.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.\"),vx=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(hx).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.\"),_x=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'.\"),fh=d.object({beginRendering:yx.optional(),surfaceUpdate:bx.optional(),dataModelUpdate:vx.optional(),deleteSurface:_x.optional()}).strict().superRefine((r,e)=>{Object.keys(r).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 ph(r){if(!r||typeof r!=\"object\")return{id:\"\",component:\"\"};let e=r,t=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){t=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:t}}var Fa=class extends un{constructor(){super(...arguments),this.version=\"v0.8\",this.schema=fh}getNativeActionKeys(){return[\"beginRendering\",\"surfaceUpdate\",\"dataModelUpdate\",\"deleteSurface\"]}preparePayloadForValidation(e){let t={...e};return delete t.version,t}extractOperationsFromObject(e){let t=[];if(\"beginRendering\"in e){let n=e.beginRendering;t.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(ph):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;t.push({type:\"updateComponents\",surfaceId:String(n?.surfaceId??\"\"),components:Array.isArray(n?.components)?n.components.map(ph):[]})}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(/^\\/+/,\"\"),p=l===\".\"||l===\"\"?s||\"/\":`${s}/${l}`;t.push({type:\"updateDataModel\",surfaceId:i,path:p,value:u})}}else t.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;t.push({type:\"deleteSurface\",surfaceId:String(n?.surfaceId??\"\")})}return t}};var xx=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(),Ax=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(),Dx=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(),Cx=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(),Hu=d.union([xx,Ax,Dx,Cx]),wx=d.array(Hu).describe(\"A list of messages.\"),pI=d.object({messages:wx}).strict().describe(\"An object wrapping a list of messages.\");var rs=class extends un{constructor(){super(...arguments),this.version=\"v0.9\",this.schema=Hu}get compatibleCatalogVersions(){return new Set([\"0.9\",\"0.9.1\"])}getNativeActionKeys(){return[\"createSurface\",\"updateComponents\",\"updateDataModel\",\"deleteSurface\"]}extractOperationsFromObject(e){let t=[];if(\"createSurface\"in e){let n=e.createSurface;t.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;t.push({type:\"updateComponents\",surfaceId:String(n?.surfaceId||\"\"),components:Array.isArray(n?.components)?n.components:[]})}if(\"updateDataModel\"in e){let n=e.updateDataModel;t.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;t.push({type:\"deleteSurface\",surfaceId:String(n?.surfaceId||\"\")})}return t}};var Gu=[\"createSurface\",\"updateComponents\",\"updateDataModel\",\"deleteSurface\",\"callRendererFunction\",\"agentFunctionResponse\"];function hh(r){return typeof r==\"object\"&&r!==null&&\"type\"in r&&typeof r.type==\"string\"&&Gu.includes(r.type)}var xI=d.object({componentId:d.lazy(()=>ts),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 Ex=d.lazy(()=>th.extend({component:d.string()}).passthrough().refine(r=>r.component!==\"Surface\",{message:'Component type cannot be \"Surface\". \"Surface\" is a top-level protocol container defined in createSurface, not a child component.'})),Ku=d.array(Ex).min(1),AI=d.record(d.string(),d.any());var Sx=d.object({version:d.literal(\"v1.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:Ku.optional(),dataModel:d.record(d.string(),d.any()).describe(\"The initial root data model object for the surface.\").optional(),metadata:d.object({extensions:zu.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. When this message is sent, the renderer expects 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId to define the component tree.\")}).strict(),Tx=d.object({version:d.literal(\"v1.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:Ku}).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(),kx=d.object({version:d.literal(\"v1.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(),$x=d.object({version:d.literal(\"v1.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(),Ix=d.object({version:d.literal(\"v1.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:Uu,callFunction:d.intersection(Wt,d.object({catalogId:d.string()}).passthrough())}).strict().describe(\"Signals the renderer to execute a function locally on behalf of the agent.\")}).strict(),Fx=d.object({version:d.literal(\"v1.0\"),agentFunctionResponse:ih}).strict(),mh=d.union([Sx,Tx,kx,$x,Ix,Fx]);var Ra=class extends un{constructor(){super(...arguments),this.version=\"v1.0\",this.schema=mh}getNativeActionKeys(){return[...Gu]}extractOperationsFromObject(e){let t=[];if(\"createSurface\"in e){let n=e.createSurface;t.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;t.push({type:\"updateComponents\",surfaceId:String(n?.surfaceId||\"\"),components:Array.isArray(n?.components)?n.components:[]})}if(\"updateDataModel\"in e){let n=e.updateDataModel;t.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;t.push({type:\"deleteSurface\",surfaceId:String(n?.surfaceId||\"\")})}if(\"callRendererFunction\"in e){let n=e.callRendererFunction,i=n?.callFunction||{};t.push({type:\"callRendererFunction\",surfaceId:typeof n?.surfaceId==\"string\"?n.surfaceId:void 0,functionCallId:String(n?.functionCallId||\"\"),call:String(i?.[\"@call\"]||i?.call||\"\"),version:this.version,catalogId:typeof i?.catalogId==\"string\"?i.catalogId:void 0,args:i?.args&&typeof i.args==\"object\"&&!Array.isArray(i.args)?i.args:{}})}if(\"agentFunctionResponse\"in e){let n=e.agentFunctionResponse;t.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 t}};var Ju=class{constructor(){this.adapters=new Map([[\"0.8\",new Fa],[\"0.9\",new rs],[\"0.9.1\",new rs],[\"1.0\",new Ra]])}getAllKnownActions(){let e=new Set;for(let t of this.adapters.values())if(t.validActions)for(let n of t.validActions)e.add(n);return e}registerAdapter(e){let t=ke(e.version)??Cr(e.version);this.adapters.set(t,e)}getAdapter(e){let t=ke(e)??Cr(e),n=this.adapters.get(t);if(!n){let i=Array.from(new Set(Array.from(this.adapters.keys()).map(o=>o.startsWith(\"v\")?o:`v${o}`))).sort().join(\", \");throw new U(`[VersionAdapterFactory] Unsupported protocol version '${e}'. Supported versions: ${i}.`)}return n}resolveFromPayload(e){let t=Array.isArray(e)?e[0]:e;if(typeof t==\"object\"&&t!==null){if(\"messages\"in t&&Array.isArray(t.messages))return this.resolveFromPayload(t.messages);if(\"version\"in t){let n=t.version;if(typeof n!=\"string\")throw new U(`[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 t||\"surfaceUpdate\"in t||\"dataModelUpdate\"in t||\"deleteSurface\"in t)return this.getAdapter(\"v0.8\")}throw new U(\"[VersionAdapterFactory] Message payload is missing a valid 'version' string.\")}static registerAdapter(e){ti.registerAdapter(e)}static getAdapter(e){return ti.getAdapter(e)}static resolveFromPayload(e){return ti.resolveFromPayload(e)}static getAllKnownActions(){return ti.getAllKnownActions()}},ti=new Ju;uh(()=>ti.getAllKnownActions());var Rx=[\"id\",\"component\",\"catalogId\",\"metadata\"];function Ox(r){return r===Yi.name?Yi:void 0}function Nx(r,e){if(e.catalogId!==void 0)throw new U(`System function '${r}' belongs to no catalog and must not name a catalogId.`)}function Yu(r){return`Function call '${r}' has a non-string 'catalogId'.`}function Xu(r,e,{catalogIsDefault:t}){return r===void 0?t:r===e}var ln=class{constructor(e,t){this.catalog=e,this.config=t,this.enforceIdentifiers=ge(e.protocolVersion,\"1.0\")}get allowUnknown(){return this.config?this.config.allowUnknownElements??!1:!0}validateComponent(e,t){let n=e.id;if(typeof n!=\"string\"||!n)throw new U(`Component '${e.component}' is missing an 'id'; entries require a valid string 'id'.`);this.assertIdentifier(n,`Component id '${n}' must be a valid UAX #31 identifier`);let i=e.component,o=typeof i==\"string\"?i:t;if(!o)throw new U(`Cannot create component ${n} without a type.`);let s=e.catalogId,a=typeof s==\"string\"?s:void 0,c=Mx(e),u=this.catalog.components.get(o);if(!u){if(!this.allowUnknown)throw new U(`Unknown component type '${o}' not found in catalog '${this.catalog.id}'.`);this.validateNestedFunctions(c,a);return}let l=Ji(u.schema);this.validateCommonEnvelopeFields(c,l,o,n,a);let p=u.schema.safeParse(c);if(!p.success){let f=p.error.errors.map(Rr).join(\", \");throw new U(`Validation failed for component '${o}' (${n}): ${f}`,p.error.issues)}this.validateNestedFunctions(c,a)}validateCommonEnvelopeFields(e,t,n,i,o){if(\"accessibility\"in e&&!t?.has(\"accessibility\")){let s=e.accessibility;delete e.accessibility;let a=en.optional().safeParse(s);if(!a.success){let c=a.error.errors.map(Rr).join(\", \");throw new U(`Validation failed for component '${n}' (${i}): ${c}`,a.error.issues)}this.validateNestedFunctions(s,o)}if(\"metadata\"in e&&!t?.has(\"metadata\")){let s=e.metadata;delete e.metadata;let a=jo.shape.metadata.safeParse(s);if(!a.success){let c=a.error.errors.map(Rr).join(\", \");throw new U(`Validation failed for component '${n}' (${i}): ${c}`,a.error.issues)}}}assertFunctionIdentifiers(e,t){if(this.assertIdentifier(e,`Function name '${e}' must be a valid UAX #31 identifier`,!0),this.enforceIdentifiers&&t!==void 0&&t!==null&&(typeof t!=\"object\"||Array.isArray(t)))throw new U(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?\"array\":typeof t}`);if(t&&typeof t==\"object\"&&!Array.isArray(t)){let n=Object.keys(t);if(n.length>Gi)throw new U(`Function call '${e}' exceeds maximum allowed arguments count (${Gi})`);for(let i of n)this.assertIdentifier(i,`Function argument '${i}' in function '${e}' must be a valid UAX #31 identifier`)}}validateNestedFunctions(e,t){if(Array.isArray(e)){for(let o of e)this.validateNestedFunctions(o,t);return}if(typeof e!=\"object\"||e===null)return;let n=e;this.enforceIdentifiers&&Ca(Object.keys(n),this.catalog.protocolVersion);let i=this.enforceIdentifiers?n[\"@call\"]:n.call??n.function;if(typeof i==\"string\"&&(this.enforceIdentifiers||i.length>0)){let o=n.args,s=o!==void 0?o:{};if(!this.enforceIdentifiers)this.validateFunction(i,s);else if(i.startsWith(\"@\"))Nx(i,n),this.validateFunction(i,s);else{let a=n.catalogId;if(a!==void 0&&typeof a!=\"string\")throw new U(Yu(i));Xu(a,this.catalog.id,{catalogIsDefault:t===void 0})?this.validateFunction(i,s):this.assertFunctionIdentifiers(i,s)}}for(let o of Object.values(n))this.validateNestedFunctions(o,t)}validateFunction(e,t){this.assertFunctionIdentifiers(e,t);let n=this.enforceIdentifiers&&e.startsWith(\"@\")?Ox(e):this.catalog.functions.get(e);if(!n){if(!this.allowUnknown)throw new U(`Unrecognized function '${e}'`);return t??{}}if(!n.schema){if(t!==void 0&&(typeof t!=\"object\"||t===null||Array.isArray(t)))throw new U(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?\"array\":typeof t}`);return t??{}}let i=n.schema.safeParse(t??{});if(!i.success){let o=i.error.errors.map(Rr).join(\", \");throw new U(`Validation failed for function '${e}': ${o}`,i.error.issues)}return i.data}validateTheme(e){let t=this.catalog.themeSchema;if(!t)return e;let n=t.safeParse(e);if(!n.success){let i=n.error.errors.map(Rr).join(\", \");throw new U(`Validation failed for theme: ${i}`,n.error.issues)}return n.data}assertIdentifier(e,t,n=!1){if(this.enforceIdentifiers&&!wu(e,n))throw new U(t)}};function Mx(r){let e={};for(let[t,n]of Object.entries(r))Rx.includes(t)||(e[t]=n);return e}var Oa=class{constructor(e,t){if(this.pendingAgentCalls=new Map,this.isDisposed=!1,Array.isArray(e))this.catalogs=e,this.outboundListener=t,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,t,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&&t?.surface?.id!==a){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,`Surface not found: ${a}`,o);return await this.emitOutboundResponse($),$}let l=u[\"@call\"]??u.call,{catalogId:p,args:f}=u,m=this.resolveFunctionImplementation(p,l,t,o);if(\"error\"in m){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,m.error,o);return await this.emitOutboundResponse($),$}let g=this.checkExecutionPermissions(m.funcImpl,l,n);if(g){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,g,o);return await this.emitOutboundResponse($),$}let h=this.ensureDataContext(t,m.catalog,c),b=this.resolveDynamicArguments(f,h,n);if(\"error\"in b){let $=this.createResponseError(c,we.EXECUTION_ERROR,b.error,o);return await this.emitOutboundResponse($),$}let v=this.parseArguments(m.catalog,m.funcImpl,b.args,l);if(\"error\"in v){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,v.error,o);return await this.emitOutboundResponse($),$}let x=await this.executeFunctionSafely(m.funcImpl,v.args,h,c,o);return await this.emitOutboundResponse(x),x}handleAgentFunctionResponse(e){if(!e||!e.agentFunctionResponse)return;let{functionCallId:t,value:n,error:i}=e.agentFunctionResponse,o=this.pendingAgentCalls.get(t);if(o)if(this.pendingAgentCalls.delete(t),i){let s=i.code??we.UNKNOWN_ERROR,a=i.message??\"Agent function execution failed\";o.reject(new Ut(a,s,t,i))}else o.resolve(n)}callAgentFunction(e,t,n){if(this.isDisposed)return Promise.reject(new Ut(\"RpcHandler has been disposed.\",we.DISPOSED));if(!this.outboundListener)return Promise.reject(new Ut(\"Cannot call agent function without outboundListener configured.\",we.NO_LISTENER));let i=t?.[\"@call\"]??t?.call;if(!t||!i)return Promise.reject(new Ut(\"Missing or invalid function call name.\",we.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 Ut(`A call with functionCallId '${s}' is already pending.`,we.DUPLICATE,s));let c={functionCallId:s,call:t,effectiveTimeoutMs:a,version:o.version};return this.dispatchAgentCall(e,c)}dispose(){if(!this.isDisposed){this.isDisposed=!0;for(let[e,t]of this.pendingAgentCalls.entries())t.reject(new Ut(`RpcHandler disposed while call '${e}' was pending.`,we.CANCELLED,e));this.pendingAgentCalls.clear()}}async emitOutboundResponse(e){if(this.outboundListener)try{let t=this.outboundListener(e);t&&typeof t.catch==\"function\"&&await t}catch{}}validateInboundMessage(e){if(!e)return this.createResponseError(\"unknown\",we.INVALID_FUNCTION_CALL,\"Inbound message is null or undefined.\",\"unknown\");let t=e.version;return this.isDisposed?this.createResponseError(e.callRendererFunction?.functionCallId??\"unknown\",we.DISPOSED,\"RpcHandler has been disposed.\",t):e.callRendererFunction?.callFunction?null:this.createResponseError(e.callRendererFunction?.functionCallId??\"unknown\",we.INVALID_FUNCTION_CALL,\"Malformed message: missing callRendererFunction or callFunction.\",t)}resolveFunctionImplementation(e,t,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&&!ar(o.protocolVersion,i))return{error:`Catalog '${o.id}' specification version (${o.protocolVersion}) does not match message protocol version (${i}).`};let s=o.functions?.get(t);return s?{funcImpl:s,catalog:o}:{error:`Function not found: ${t}`}}ensureDataContext(e,t,n){if(e instanceof Rt&&e.surface)return e;let i=new Map;for(let s of this.catalogs)t.protocolVersion&&s.protocolVersion&&ar(t.protocolVersion,s.protocolVersion)&&i.set(s.id,s);i.set(t.id,t);let o=new ei(`_rpc_fallback_${n||\"default\"}`,t,i);return new Rt(o,\"/\")}resolveDynamicArguments(e,t,n){if(e===void 0||typeof e!=\"object\"||e===null||Array.isArray(e))return{args:e};let i={},o,s=t.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]=t.resolveDynamicValue(c,0,n)}catch(a){o=this.extractErrorMessage(a)||\"An error occurred during function execution.\"}finally{s?.unsubscribe()}return o?{error:o}:{args:i}}checkExecutionPermissions(e,t,n){let i=e.allowedCallers??\"rendererOnly\";return i===\"rendererOrAgent\"||i===\"agentOnly\"?e.requiresUserActivation&&!n?`Function '${t}' requires user activation context to execute.`:null:`Function '${t}' cannot be called by agent (allowedCallers is ${i}).`}parseArguments(e,t,n,i){try{return{args:new ln(e,{allowUnknownElements:!1}).validateFunction(i,n)}}catch(o){let s=this.extractErrorMessage(o);return{error:`Invalid function arguments for '${i}': ${s}`}}}async executeFunctionSafely(e,t,n,i,o){let s=o||\"v1.0\";try{let a=await Promise.resolve(e.execute(t,n)),c=Fr(a)?Be(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:we.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,t){let{functionCallId:n,call:i,effectiveTimeoutMs:o,version:s}=t;return new Promise((a,c)=>{let u,l=()=>{u&&(clearTimeout(u),u=void 0),this.pendingAgentCalls.delete(n)},p=(i[\"@call\"]??i.call)||\"unknown\";u=this.createTimeoutTimer(n,p,o,l,c),this.pendingAgentCalls.set(n,{resolve:f=>{l(),a(f)},reject:f=>{l(),c(f)}}),this.sendOutboundMessage(e,n,i,s,l,c)})}createTimeoutTimer(e,t,n,i,o){if(!(n<=0))return setTimeout(()=>{this.pendingAgentCalls.delete(e)&&(i(),o(new Ut(`Agent function call '${t}' timed out after ${n}ms.`,we.TIMEOUT,e)))},n)}sendOutboundMessage(e,t,n,i,o,s){let a={version:i||\"v1.0\",callAgentFunction:{surfaceId:e,functionCallId:t,callFunction:n}};try{let c=this.outboundListener(a);c&&typeof c.catch==\"function\"&&c.catch(u=>{o(),s(u)})}catch(c){o(),s(c)}}extractErrorMessage(e){return e instanceof Error?e.message:String(e)}createResponseError(e,t,n,i){return{version:i||\"v1.0\",rendererFunctionResponse:{functionCallId:e,error:{code:t,message:n}}}}};var Na=class{constructor(e,t,n){this.actionHandler=t,this.catalogs=ah(e),this.model=new Ia,this.adapterRegistry=n?.adapterRegistry??ti,this.rpc=new Oa({catalogs:this.catalogs,outboundListener:n?.outboundListener,defaultTimeoutMs:n?.defaultTimeoutMs}),n?.validationConfig?this.validationConfig={allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1,...n.validationConfig}:this.validationConfig=void 0,this.actionHandler&&this.model.onAction.subscribe(this.actionHandler)}callAgentFunction(e,t,n){return this.rpc.callAgentFunction(e,t,n)}dispose(){this.rpc.dispose()}getRendererCapabilities(e){if(!e?.versions||e.versions.length===0)throw new U(\"At least one protocol version must be provided in CapabilitiesOptions to generate renderer capabilities.\");let t=e.versions,n={};for(let i of t){let o={supportedCatalogIds:this.catalogs.map(a=>a.id)},s=e?.includeInlineCatalogs?this.catalogs.map(a=>eu(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){return this.getRendererCapabilities(e)}generateInlineCatalog(e){let t=e.toJson();t.catalogId=e.id;let n=typeof t.protocolVersion==\"string\"?t.protocolVersion:ke(e.protocolVersion)??e.protocolVersion;return t.protocolVersion=n.trim().replace(/^[vV](?=\\d)/,\"\"),t}generateLegacyInlineCatalog(e,t=\"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 m=bt(a.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});kr(m,void 0,{stripAdditionalProperties:!0}),c=m.properties||{},u=Array.isArray(m.required)?m.required.filter(g=>g!==\"component\"&&g!==\"id\"):[]}let{component:l,id:p,...f}=c;n[s]={allOf:[{$ref:t},{properties:{component:{const:s},...f},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=bt(s.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});kr(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=bt(e.themeSchema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});kr(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 t=Array.from(this.model.surfacesMap.values()).filter(s=>s.sendDataModel);if(t.length===0)return;if(e!==void 0){let s={};for(let a of t){let c=a.protocolVersion;(!c||ar(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 t)if(s.protocolVersion){let a=ke(s.protocolVersion),c=a?`v${a}`:s.protocolVersion;n.add(c)}if(n.size>1)throw new U(`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:\"v1.0\",o={};for(let s of t)o[s.id]=s.dataModel.get(\"/\");return{version:i,surfaces:o}}getClientDataModel(e){return this.getRendererDataModel(e)}resolvePath(e,t){return sn.resolvePath(e,t)}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,t){let n=this.prepareOperations(e);for(let i of n)this.processOperation(i,t)}async processMessagesAsync(e,t){let n=this.prepareOperations(e),i=[];for(let o of n){let s=await this.processOperationAsync(o,t);s&&i.push(s)}return i}prepareOperations(e){return!e||Array.isArray(e)&&e.length===0?[]:(this.validationConfig&&ch(e),this.validationConfig?.targetVersion&&this.validateTargetVersion(e),hh(e)?[e]:this.adapterRegistry.resolveFromPayload(e).extractOperations(e))}validateTargetVersion(e){let t=this.validationConfig?.targetVersion;if(!t)return;let n=i=>{if(typeof i==\"object\"&&i!==null&&\"version\"in i){let o=i.version;if(o){let s=ke(o)??o,a=ke(t)??t;if(s!==a)throw new U(`Message version '${o}' does not match expected target version '${t}'`)}}};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 U(`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??\"v1.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 Rt(o,\"/\"):void 0}let t=e.catalogId?this.catalogs.find(o=>o.id===e.catalogId):void 0;if(!t)return;let n=`_rpc_fallback_${e.functionCallId||\"default\"}`,i=new Map;for(let o of this.catalogs)t?.protocolVersion&&o.protocolVersion&&ar(t.protocolVersion,o.protocolVersion)&&i.set(o.id,o);return t&&i.set(t.id,t),new Rt(new ei(n,t,i),\"/\")}processOperation(e,t){if(e.type===\"callRendererFunction\"){let n=this.resolveRpcDataContext(e),i=t?.isUserActivated??e.isUserActivated??!1,o={version:e.version??\"v1.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.applyStateOperation(e)}async processOperationAsync(e,t){if(e.type===\"callRendererFunction\"){let n=this.resolveRpcDataContext(e),i=t?.isUserActivated??e.isUserActivated??!1,o={version:e.version??\"v1.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.applyStateOperation(e),null}processCreateSurfaceOp(e){let{surfaceId:t,catalogId:n,theme:i,sendDataModel:o,components:s,dataModel:a}=e,c=e.version,u=n===void 0&&c!==void 0&&ge(c,\"1.0\"),l=u?void 0:Px(this.catalogs,n,c);if(!l&&!u)throw n!==void 0?new Fe(`Catalog not found: ${n}`):new Fe(`No default catalog available for surface '${t}'.`);if(l?.protocolVersion&&c&&!ar(l.protocolVersion,c))throw new U(`Surface '${t}' catalog '${n??l.id}' specification version (${l.protocolVersion}) does not match message protocol version (${c}).`);if(this.model.getSurface(t))throw new Vt(`Surface ${t} already exists.`);let p=i;if(i&&l?.themeSchema)try{p=new ln(l,this.validationConfig).validateTheme(i)}catch(h){throw h instanceof U?new U(h.message.replace(/^Validation failed for theme:/,`Validation failed for theme on surface '${t}':`),h.details):h}let f=l?.protocolVersion??c,m=new Map(this.catalogs.filter(h=>ar(h.protocolVersion,f)).map(h=>[h.id,h])),g=new ei(t,l,m,p,o??!1,void 0,e.rootId??\"root\",e.metadata,f);this.model.addSurface(g),a&&g.dataModel.set(\"/\",a),s&&s.length>0&&this.processUpdateComponentsOp({type:\"updateComponents\",surfaceId:t,components:s})}processDeleteSurfaceOp(e){e.surfaceId&&this.model.deleteSurface(e.surfaceId)}validateComponentProperties(e,t){let{id:n,component:i}=e;if(typeof n!=\"string\"||!n)throw new U(`Component '${i}' is missing an 'id'; entries require a valid string 'id'.`);let o=this.resolveComponentCatalog(e,t),s=t.componentsModel.get(n);new ln(o,this.validationConfig).validateComponent(this.componentPayloadForValidation(e,t,o),s?.type),this.validateNestedFunctionCalls(e,t,o)}componentPayloadForValidation(e,t,n){let{catalogId:i,...o}=e;return ge(t.protocolVersion,\"1.0\")&&n!==t.defaultCatalog&&(o.catalogId=n.id),o}resolveComponentCatalog(e,t){let{id:n,component:i,catalogId:o}=e,s=`Component '${n}'`,a=ge(t.protocolVersion,\"1.0\");if(typeof o==\"string\"&&(o||a))return this.resolveSurfaceItemCatalog(t,o,s);if(!a){let c=typeof n==\"string\"?t.componentsModel.get(n):void 0;if(c&&(typeof i!=\"string\"||!i||i===c.type))return c.catalog}return this.resolveSurfaceItemCatalog(t,void 0,s)}validateNestedFunctionCalls(e,t,n){if(!ge(t.protocolVersion,\"1.0\"))return;let i=o=>{if(Array.isArray(o)){o.forEach(i);return}if(typeof o!=\"object\"||o===null)return;let s=o,a=s[\"@call\"];if(typeof a==\"string\"&&!a.startsWith(\"@\")){let c=s.catalogId;if(c!==void 0&&typeof c!=\"string\")throw new U(Yu(a));let u=c,l=this.resolveSurfaceItemCatalog(t,u,`Function call '${a}'`);if(!Xu(u,n.id,{catalogIsDefault:n===t.defaultCatalog})){let f=s.args;new ln(l,this.validationConfig).validateFunction(a,f??{})}}Object.values(s).forEach(i)};for(let[o,s]of Object.entries(e))o===\"id\"||o===\"component\"||o===\"catalogId\"||o===\"metadata\"||i(s)}resolveSurfaceItemCatalog(e,t,n){if(t!==void 0&&!e.availableCatalogs.has(t)){let i=this.catalogs.find(o=>o.id===t);if(i)throw new Fe(`${n} names catalog '${t}', whose specification version (${i.protocolVersion}) does not match surface '${e.id}' version (${e.protocolVersion}).`)}return e.resolveCatalog(t,n)}applyComponentUpdate(e,t){let{id:n,component:i,catalogId:o,metadata:s,...a}=e;if(typeof n!=\"string\")return;let c=jx(s),u=this.resolveComponentCatalog(e,t),l=t.componentsModel.get(n);if(l){let p=typeof i==\"string\"?i:l.type;if(p!==l.type||l.catalog.id!==u.id){t.componentsModel.removeComponent(n);let f=new cn(n,p,a,u,c);t.componentsModel.addComponent(f)}else l.metadata=c,l.properties=a}else{if(typeof i!=\"string\"||!i)throw new U(`Cannot create component ${n} without a type.`);let p=new cn(n,i,a,u,c);t.componentsModel.addComponent(p)}}processUpdateComponentsOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new Vt(`Surface not found for message: ${e.surfaceId}`);let n=new Set;for(let i of e.components){if(i&&typeof i==\"object\"&&typeof i.id==\"string\"){if(n.has(i.id))throw new Vt(`Duplicate component ID: '${i.id}'`,[i.id]);n.add(i.id)}this.validateComponentProperties(i,t)}this.validateCompositionConstraints(t,e.components),this.validateCandidateTopology(t,e.components);for(let i of e.components)this.applyComponentUpdate(i,t)}processUpdateDataModelOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new Vt(`Surface not found for message: ${e.surfaceId}`);let n=e.path||\"/\",i=e.value;t.dataModel.set(n,i)}validateParentConstraints(e,t,n,i){if(!i||i.length===0){if((e===\"root\"||this.validationConfig&&this.validationConfig.allowOrphanComponents===!1)&&!n.includes(\"Surface\"))throw new U(`Component '${e}' (${t}) cannot be placed under parent 'Surface' (Surface). Allowed parents: ${JSON.stringify(n)}.`,void 0,\"UNALLOWED_PARENT\");return}for(let o of i)if(!n.includes(o.parentType))throw new U(`Component '${e}' (${t}) cannot be placed under parent '${o.parentId}' (${o.parentType||\"unknown\"}). Allowed parents: ${JSON.stringify(n)}.`,void 0,\"UNALLOWED_PARENT\")}validateChildConstraints(e,t,n,i,o){for(let s of i){let a=o.get(s);if(a&&!n.includes(a))throw new U(`Container '${e}' (${t}) cannot contain child '${s}' (${a}). Allowed children: ${JSON.stringify(n)}.`,void 0,\"UNALLOWED_CHILD\")}}buildCompositionTopology(e,t){let n=new Map,i=new Map,o=new Map;for(let[a,c]of e.componentsModel.entries){n.set(a,c.type),i.set(a,c.catalog);let u=e.componentsModel.getChildIds(a);u.length>0&&o.set(a,u)}for(let a of t){let{id:c,component:u,...l}=a;if(typeof c!=\"string\")continue;let p=this.resolveComponentCatalog(a,e);i.set(c,p);let f=e.componentsModel.get(c),m=(typeof u==\"string\"?u:f?.type)??\"\";m&&n.set(c,m);let g={id:c,component:m,...l},h=Array.from($a(g,p)).map(([b])=>b);h.length>0?o.set(c,h):o.delete(c)}let s=new Map;for(let[a,c]of o.entries()){let u=n.get(a)||\"Unknown\";for(let l of c){let p=s.get(l)??[];p.push({parentId:a,parentType:u}),s.set(l,p)}}return{typeMap:n,compCatalogMap:i,childMap:o,parentMap:s}}validateCompositionConstraints(e,t){let{typeMap:n,compCatalogMap:i,childMap:o,parentMap:s}=this.buildCompositionTopology(e,t);for(let[a,c]of n.entries()){let l=i.get(a)?.components.get(c);l&&(l.allowedParents&&l.allowedParents.length>0&&this.validateParentConstraints(a,c,l.allowedParents,s.get(a)),l.allowedChildren&&l.allowedChildren.length>0&&this.validateChildConstraints(a,c,l.allowedChildren,o.get(a)||[],n))}}validateCandidateTopology(e,t){if(!this.validationConfig)return;let n=new Xi(e.defaultCatalog);for(let[i,o]of e.componentsModel.entries)n.addComponent(new cn(i,o.type,o.properties,o.catalog));for(let i of t){let{id:o,component:s,...a}=i;if(typeof o!=\"string\"||!o)continue;let c=this.resolveComponentCatalog(i,e);delete a.catalogId,delete a.metadata;let u=n.get(o),l=(typeof s==\"string\"?s:u?.type)||\"\";l&&(u?l!==u.type||u.catalog.id!==c.id?(n.removeComponent(o),n.addComponent(new cn(o,l,a,c))):u.properties=a:n.addComponent(new cn(o,l,a,c)))}n.validateTopology({...this.validationConfig,rootId:this.validationConfig.rootId??e.rootId})}};function jx(r){if(r&&typeof r==\"object\"&&!Array.isArray(r))return r}function Px(r,e,t){return e!==void 0?r.find(n=>n.id===e):r.find(n=>t?ar(n.protocolVersion,t):!0)??r[0]}var Qi=class{constructor(e,t,n=\"/\",i,o){let s=e.componentsModel.get(t);if(!s)throw new Yr(`Component not found: ${t}`);this.componentModel=s,this.surfaceComponents=e.componentsModel,this.theme=e.theme,this.dataContext=new Rt(e,n,o,i),this._actionDispatcher=a=>e.dispatchAction(a,this.componentModel.id)}dispatchAction(e){return this._actionDispatcher(e)}};var gh=new WeakMap;function el(r){let e=gh.get(r);if(e)return e;let t=Ma(r),n=t.type===\"OBJECT\"&&t.shape&&!(\"accessibility\"in t.shape)?{...t,shape:{...t.shape,accessibility:Ma(en)}}:t;return gh.set(r,n),n}function ns(r){let e=r;for(;e;){let t=e._def?.typeName;if(t===\"ZodOptional\"||t===\"ZodNullable\"||t===\"ZodDefault\"||t===\"ZodReadonly\")e=e._def.innerType;else if(t===\"ZodEffects\")e=e._def.schema;else if(t===\"ZodBranded\")e=e._def.type;else if(t===\"ZodLazy\")e=e._def.getter();else break}return e}function dn(r){let e=r,t=\"\";for(;e&&(t=e.description??e._def?.description??\"\",!t);){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(!t||!t.startsWith(\"REF:\"))return\"\";let n=t.slice(4);return Kn(n.split(\"|\")[0])}function Lx(r){let e=dn(r);if(e===\"Checkable\"||e===\"CheckRule\")return!0;let t=ns(r);if(t?._def?.typeName===\"ZodArray\"){let n=t._def.type;if(dn(n)===\"CheckRule\")return!0}return!1}function Bx(r){if(dn(r)===\"Action\")return!0;let t=ns(r)._def;return t?.typeName===\"ZodObject\"&&!!t.shape?.().event}function Vx(r){let e=dn(r);if(e===\"DataBinding\"||e===\"FunctionCall\"||e.startsWith(\"Dynamic\"))return!0;let n=ns(r)._def;if(n?.typeName!==\"ZodObject\")return!1;let i=n.shape?.()||{},o=Object.values(i).some(s=>dn(s)===\"ComponentId\");return(!!i[\"@path\"]||!!i.path||!!i[\"@call\"]||!!i.call)&&!o}function Ux(r){if(Qr(r)===\"child-list\"||dn(r)===\"ChildList\")return!0;let t=ns(r)._def;if(t?.typeName!==\"ZodObject\")return!1;let n=t.shape?.()||{};return Object.values(n).some(i=>dn(i)===\"ComponentId\")}function zx(r,e){return(r===\"DataBinding\"||r===\"FunctionCall\"||r.startsWith(\"Dynamic\"))&&e!==\"ZodObject\"&&e!==\"ZodArray\"}function qx(r){if(r.some(Bx))return{type:\"ACTION\"};if(r.some(Vx))return{type:\"DYNAMIC\"};if(r.some(Ux))return{type:\"STRUCTURAL\"}}function Zx(r){let e={};for(let[t,n]of Object.entries(r))e[t]=Ma(n);return e}function Ma(r){let e=dn(r);if(Lx(r))return{type:\"CHECKABLE\"};if(e===\"Action\")return{type:\"ACTION\"};let t=ns(r);if(Qr(t)===\"child-list\"||e===\"ChildList\")return{type:\"STRUCTURAL\"};if(zx(e,t._def?.typeName))return{type:\"DYNAMIC\"};if(t._def.typeName===\"ZodUnion\"){let n=qx(t._def.options);if(n)return n}return t._def.typeName===\"ZodArray\"?{type:\"ARRAY\",element:Ma(t._def.type)}:t._def.typeName===\"ZodObject\"?{type:\"OBJECT\",shape:Zx(t._def.shape())}:{type:\"STATIC\"}}var yh=1e4;function tl(r){return Array.isArray(r)?r.length>yh?r.slice(0,yh):r:[]}var Or=class{constructor(e,t){this.dataListeners=[],this.propsListeners=[],this.currentProps={},this.isConnected=!1,this.actionClosures=new Map,this.context=e,this.behaviorTree=el(t),this.behaviorTree.type!==\"OBJECT\"&&(this.behaviorTree={type:\"OBJECT\",shape:{}}),this.resolveInitialProps()}resolveInitialProps(){let e=this.context.componentModel.properties,t=this.resolveAndBind(e,this.behaviorTree,[],!0);this.currentProps={...this.currentProps,...t||{}}}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,t=this.resolveAndBind(e,this.behaviorTree,[],!1);this.currentProps={...this.currentProps,...t||{}},this.notify()}bindDynamicValue(e,t,n){let i=this.context.dataContext.subscribeDynamicValue(e,o=>{this.updateDeepValue(t,o),this.notify()});return n?i.unsubscribe():this.dataListeners.push(()=>i.unsubscribe()),i.value}resolveDeepSync(e,t=0){if(typeof e!=\"object\"||e===null)return e;if(t>Ki)return;if(\"path\"in e||\"call\"in e||\"@path\"in e||\"@call\"in e)return this.context.dataContext.resolveDynamicValue(e,t);if(Array.isArray(e))return e.map(i=>this.resolveDeepSync(i,t+1));let n={};for(let[i,o]of Object.entries(e))n[i]=this.resolveDeepSync(o,t+1);return n}resolveActionContext(e){if(typeof e!=\"object\"||e===null||Array.isArray(e))return;let t={};for(let[n,i]of Object.entries(e))t[n]=this.resolveDeepSync(i,1);return t}resolveEventAction(e){if(typeof e!=\"object\"||e===null)return e;let t=e;if(\"event\"in t&&typeof t.event==\"object\"&&t.event!==null){let n=t.event,i={...n,context:n.context?this.resolveActionContext(n.context):void 0};return n.userMessage!==void 0&&(i.userMessage=this.resolveDeepSync(n.userMessage,1)),{...t,event:i}}if(\"name\"in t){let n={...t,context:t.context?this.resolveActionContext(t.context):void 0};return t.userMessage!==void 0&&(n.userMessage=this.resolveDeepSync(t.userMessage,1)),n}return this.resolveDeepSync(e,0)}bindAction(e,t){let n=t.join(\"/\"),i=this.actionClosures.get(n);if(i&&Qu(i.raw,e))return i.closure;let o=async()=>{if(e&&typeof e==\"object\"){let s=e,a=!!(s.functionCall&&typeof s.functionCall==\"object\"),c=a?s.functionCall:s,u=c[\"@call\"]??c.call;if(typeof u==\"string\"){let l=a&&!(\"@call\"in c)?{\"@call\":u,...c}:c;await this.context.dataContext.resolveDynamicValue(l,0,!0);return}}return this.context.dispatchAction(this.resolveEventAction(e))};return this.actionClosures.set(n,{raw:e,closure:o}),o}mapTemplateChildren(e,t,n){let i=tl(e),o=this.context.dataContext.nested(n);return i.map((s,a)=>({id:t,basePath:o.nested(String(a)).path}))}bindStructuralTemplate(e,t,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=ge(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 p=this.mapTemplateChildren(l,s,o);this.updateDeepValue(t,p),this.notify()});return n?u.unsubscribe():this.dataListeners.push(()=>u.unsubscribe()),this.mapTemplateChildren(u.value,s,o)}extractValidationResult(e,t){if(typeof e==\"object\"&&e!==null&&\"valid\"in e){let n=e,i=n.message,o=n.severity===\"warning\"||n.severity===\"info\"?n.severity:\"error\",s=typeof n.code==\"string\"?n.code:void 0;return{valid:!!n.valid,message:i!=null?String(i):t,...s!==void 0?{code:s}:{},severity:o}}return{valid:!!e,message:t,severity:\"error\"}}bindCheckable(e,t,n){let i=Array.isArray(e)?e:[],o=i.map(()=>({valid:!0,message:\"\",severity:\"error\"})),s=t.slice(0,-1),a=()=>{let u=o.filter(p=>!p.valid&&p.severity===\"error\").map(p=>p.message),l=o.filter(p=>!p.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 p=typeof u==\"object\"&&u!==null?u:void 0,f=p&&p.condition!==void 0?p.condition:u,m=typeof p?.message==\"string\"?p.message:\"Validation failed\";o[l].message=m;let g=this.context.dataContext.subscribeDynamicValue(f,h=>{o[l]=this.extractValidationResult(h,m),c()});n?g.unsubscribe():this.dataListeners.push(()=>g.unsubscribe()),o[l]=this.extractValidationResult(g.value,m)}),a(),e}bindObject(e,t,n,i){let o={};for(let[s,a]of Object.entries(e)){let c=t[s]||{type:\"STATIC\"};o[s]=this.resolveAndBind(a,c,[...n,s],i)}for(let[s,a]of Object.entries(t))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 p=u,f=this.context.dataContext.atLeastV10?\"@path\":\"path\",m=p[f];typeof m==\"string\"&&(this.context.dataContext.atLeastV10||!(\"componentId\"in p))&&this.context.dataContext.set(m,l)}}}return o}resolveAndBind(e,t,n,i){if(e==null)return e;switch(t.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,t.element,[...n,s.toString()],i)):e;case\"OBJECT\":return typeof e!=\"object\"?e:this.bindObject(e,t.shape,n,i)}}updateDeepValue(e,t){this.currentProps=this.cloneAndUpdate(this.currentProps,e,t)}cloneAndUpdate(e,t,n){if(t.length===0)return n;let[i,...o]=t;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(t=>t!==e),this.propsListeners.length===0&&this.dispose()}}}get snapshot(){return this.currentProps}};function Qu(r,e){if(Object.is(r,e))return!0;if(typeof r!=\"object\"||typeof e!=\"object\"||r===null||e===null)return!1;if(Array.isArray(r)||Array.isArray(e))return!Array.isArray(r)||!Array.isArray(e)||r.length!==e.length?!1:r.every((i,o)=>Qu(i,e[o]));let t=Object.keys(r),n=Object.keys(e);return t.length!==n.length?!1:t.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Qu(r[i],e[i]))}var st=class{constructor(e){this.value=e}},is=class extends st{constructor(e,t,n){super(e),this.set=t,this.path=n}};function eo(r){return r instanceof is}function vh(r,e){return eo(r)!==eo(e)||eo(r)&&eo(e)&&r.path!==e.path?!1:rl(r.value,e.value)}function rl(r,e){if(Object.is(r,e))return!0;if(Array.isArray(r)&&Array.isArray(e))return r.length===e.length&&r.every((t,n)=>rl(t,e[n]));if(bh(r)&&bh(e)){let t=Object.keys(r),n=Object.keys(e);return t.length===n.length&&t.every(i=>i in e&&rl(r[i],e[i]))}return!1}function bh(r){if(typeof r!=\"object\"||r===null)return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null}var _h=Symbol.for(\"a2ui.nodeId\");function xh(){let r=globalThis,e=(r[_h]??0)+1;return r[_h]=e,`a2ui-n${e}`}var Pa=\"Placeholder\";function vt(r){return r instanceof fn}var fn=class{constructor(e,t,n,i,o,s,a,c=\"resolved\"){this.id=xh(),this._onDestroyed=new Ve,this.onDestroyed=this._onDestroyed,this.cleanups=[],this._disposed=!1,this.instanceId=e,this.componentId=t,this.type=n,this.dataPath=i,this.props=Ke(o),this.impl=s,this.context=a,this.state=c}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},t=Ye(this.props);for(let[n,i]of Object.entries(t))e[n]=ja(i);return e}setProps(e){if(this._disposed)return;let t=Ye(this.props);Wx(t,e)||Je(this.props,e)}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.cleanups)try{e()}catch(t){console.error(`ComponentNode cleanup error (${this.instanceId}):`,t)}this.cleanups=[],this._onDestroyed.emit(),this._onDestroyed.dispose()}}};function ja(r){if(vt(r))return r.toJSON();if(r instanceof st)return ja(r.value);if(typeof r==\"function\")return\"<Action>\";if(Array.isArray(r))return r.map(ja);if(r&&typeof r==\"object\"){let e={};for(let[t,n]of Object.entries(r))e[t]=ja(n);return e}return r}function Wx(r,e){if(Object.is(r,e))return!0;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;for(let i of t)if(!Object.is(r[i],e[i]))return!1;return!0}var Hx=\"REF:common_types.json#/$defs/ComponentId\",Gx=\"REF:common_types.json#/$defs/ChildList\",Ah=new Map,nl=new WeakMap;function Dh(r){let e=nl.get(r);if(e)return e;let t=La(r);if(t.schema._def.typeName!==\"ZodObject\")return nl.set(r,Ah),Ah;let n=new Map,i=t.schema.shape;for(let[s,a]of Object.entries(i)){let c=La(a);if(Kx(c)||Jx(c.schema)){n.set(s,{kind:\"list\"});continue}if(il(c)){n.set(s,{kind:\"single\"});continue}if(c.schema._def.typeName===\"ZodArray\"){let u=La(c.schema._def.type);if(il(u)){n.set(s,{kind:\"list\"});continue}if(u.schema._def.typeName===\"ZodObject\"){let l=new Set,p=u.schema.shape;for(let[f,m]of Object.entries(p))il(La(m))&&l.add(f);l.size>0&&n.set(s,{kind:\"nested\",keys:l})}}}let o=n;return nl.set(r,o),o}function La(r){let e=[],t=new Set,n=r;for(;;){n.description&&e.push(n.description);let i=Qr(n);i&&t.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:t}}}function il(r){return r.refs.has(\"component-id\")||Ch(r.descriptions,Hx)}function Kx(r){return r.refs.has(\"child-list\")||Ch(r.descriptions,Gx)}function Ch(r,e){return r.some(t=>t.startsWith(e))}function Jx(r){return r._def.typeName!==\"ZodUnion\"?!1:r._def.options.some(t=>{if(t._def.typeName!==\"ZodObject\")return!1;let n=t.shape;return n.componentId&&n.path})}var Yx=\"root\",sl=\"/\",ol=new Map,Va=class{constructor(e,t=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,t!==e.defaultCatalog)throw new Yr(\"NodeResolver requires the same catalog instance its surface was constructed with.\");this.surface=e,this.rootId=e.rootId??Yx,this.rootNode=Ke(void 0),this.modelSubs.push(e.componentsModel.onCreated.subscribe(n=>this.onComponentCreated(n))),this.modelSubs.push(e.componentsModel.onDeleted.subscribe(n=>this.onComponentDeleted(n))),e.componentsModel.get(this.rootId)&&this.buildRoot()}dispatchOnce(e,t,n,i){let o=this.dispatchedErrors.get(t);o||(o=new Map,this.dispatchedErrors.set(t,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,t){let n=this.dispatchedErrors.get(e);n?.delete(t)&&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,Je(this.rootNode,void 0)}}buildRoot(){if(this.rootRecord)return;let e=`>${_t(this.rootId)}>${_t(this.rootId)}@/`,t=this.createNode(this.rootId,sl,e,void 0);this.rootRecord=this.records.get(t),Je(this.rootNode,t)}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||Je(this.rootNode,void 0)),n&&this.buildRoot()}let t=this.pendingParents.get(e.id);if(t){this.pendingParents.delete(e.id);for(let n of t){let i=this.records.get(n);i&&!n.disposed&&this.materialize(i)}}}onComponentDeleted(e){if(this._disposed)return;this.dispatchedErrors.delete(e);let t=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&&(t?this.rootRecord.componentModel!==t&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,this.buildRoot()):(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,Je(this.rootNode,void 0)));for(let s of i){let a=this.records.get(s);a&&!s.disposed&&this.materialize(a)}}createNode(e,t,n,i,o=1){let s=this.surface.componentsModel.get(e);if(!s){let f=this.registerNode(new fn(Ba(e,t,o),e,Pa,t,{},void 0,void 0,\"pending\"),{edgeKey:n,parent:i,occurrence:o,refFields:ol});return i&&this.registerPendingParent(e,i),f.node}let a=this.catalogFor(s),c=a.components.get(s.type);if(!c)return this.dispatchOnce(\"UNKNOWN_COMPONENT_TYPE\",e,t,`Component '${e}' has type '${s.type}', which is not in catalog '${a.id}'.`),this.registerNode(new fn(Ba(e,t,o),e,s.type,t,{},void 0,void 0,\"unknown-type\"),{edgeKey:n,parent:i,occurrence:o,refFields:ol,componentModel:s}).node;this.clearDispatched(e,t);let u=new Qi(this.surface,e,t,i?.context?.dataContext),l=new Or(u,c.schema),p=this.registerNode(new fn(Ba(e,t,o),e,s.type,t,{},c,u),{edgeKey:n,parent:i,occurrence:o,refFields:Dh(c.schema),behavior:el(c.schema),componentModel:s,binder:l});return p.binderSub=l.subscribe(f=>{p.lastBinderProps=f,this.materialize(p)}),p.lastBinderProps=l.snapshot,this.materialize(p),p.node}catalogFor(e){return e.catalog}registerNode(e,t){let n={node:e,edgeKey:t.edgeKey,parent:t.parent,occurrence:t.occurrence,refFields:t.refFields,behavior:t.behavior,componentModel:t.componentModel,binder:t.binder,childEdges:new Map};this.records.set(e,n),this.nodesByEdge.set(t.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,t,n,i,o=1){let s=this.nodesByEdge.get(n);if(this.isCyclic(e,t,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,t,`Component '${e}' at '${t}' is referenced by one of its own descendants; rendering a placeholder instead.`),this.registerNode(new fn(Ba(e,t,o),e,Pa,t,{},void 0,void 0,\"cyclic\"),{edgeKey:n,parent:i,occurrence:o,refFields:ol}).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===t&&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,t,n,i,o)}registerPendingParent(e,t){let n=this.pendingParents.get(e);n||(n=new Set,this.pendingParents.set(e,n)),n.add(t)}isCyclic(e,t,n){for(let i=n;i;i=this.records.get(i)?.parent)if(i.componentId===e&&i.dataPath===t)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,p,f)=>{let m=`${_t(p)}@${_t(f)}`,g=(s.get(m)??0)+1;s.set(m,g);let h=`${e.edgeKey}>${l}>${m}`,b=this.childNode(p,f,h,e.node,g);return i.set(h,b),b};for(let[l,p]of e.refFields)switch(p.kind){case\"single\":{let f=n[l];typeof f==\"string\"&&f&&(n[l]=a(_t(l),f,e.node.dataPath));break}case\"list\":{let f=n[l];if(!Array.isArray(f))break;let m=tl(f);n[l]=m.map((g,h)=>{if(typeof g==\"string\"&&g)return a(`${_t(l)}[${h}]`,g,e.node.dataPath);if(g&&typeof g==\"object\"&&!Array.isArray(g)){let b=g;if(typeof b.id==\"string\"&&typeof b.basePath==\"string\")return a(`${_t(l)}[${h}]`,b.id,b.basePath);if(typeof b.componentId==\"string\"&&b.componentId)return a(`${_t(l)}[${h}]`,b.componentId,e.node.dataPath)}return g});break}case\"nested\":{let f=n[l];if(!Array.isArray(f))break;n[l]=f.map((m,g)=>{if(!m||typeof m!=\"object\"||Array.isArray(m))return m;let h={...m},b=!1;for(let v of p.keys){let x=h[v];typeof x==\"string\"&&x&&(h[v]=a(`${_t(l)}[${g}].${_t(v)}`,x,e.node.dataPath),b=!0)}return b?h:m});break}}for(let[l,p]of e.childEdges)if(!i.has(l)&&(this.disposeNode(p),p.isPlaceholder&&![...i.values()].some(m=>m.isPlaceholder&&m.componentId===p.componentId))){let m=this.pendingParents.get(p.componentId);m&&(m.delete(e.node),m.size===0&&this.pendingParents.delete(p.componentId))}e.childEdges=i;let c=e.behavior&&e.node.context?al(n,e.behavior,o??{},e.node.context.dataContext):n,u=Ye(e.node.props);for(let l of Object.keys(c))c[l]=cl(u[l],c[l]);e.node.setProps(c)}disposeNode(e){if(e.disposed)return;let t=this.records.get(e);if(t){for(let i of t.childEdges.values())this.disposeNode(i);t.childEdges.clear(),t.binderSub?.unsubscribe(),t.binderSub=void 0,this.nodesByEdge.get(t.edgeKey)===e&&this.nodesByEdge.delete(t.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()}},Xx={\"~\":\"~0\",\"#\":\"~1\",\"[\":\"~2\",\"]\":\"~3\",\">\":\"~4\",\"@\":\"~5\"};function _t(r){return r.replace(/[~#[\\]>@]/g,e=>Xx[e])}function Ba(r,e,t){let n=e.replace(/\\/+$/,\"\")||sl,i=e===sl?_t(r):`${_t(r)}-[${_t(n)}]`;return t>1?`${i}#${t}`:i}function al(r,e,t,n){switch(e.type){case\"DYNAMIC\":{let i=n.atLeastV10?\"@path\":\"path\",o=t&&typeof t==\"object\"&&!Array.isArray(t)?t:void 0,s=o&&typeof o[i]==\"string\"&&!(\"componentId\"in o)?o[i]:void 0;return s===void 0?new st(r):new is(r,a=>n.set(s,a),s)}case\"ARRAY\":{if(!Array.isArray(r))return r;let i=Array.isArray(t)?t:[];return r.map((o,s)=>al(o,e.element,i[s],n))}case\"OBJECT\":{if(!r||typeof r!=\"object\"||Array.isArray(r))return r;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=t&&typeof t==\"object\"&&!Array.isArray(t)?t:{},s={};for(let[a,c]of Object.entries(r))i.has(a)||(s[a]=al(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 st(void 0));return s}default:return r}}function cl(r,e){if(Object.is(r,e))return e;if(r instanceof st&&e instanceof st)return vh(r,e)?r:e;if(vt(r)||vt(e))return e;if(Array.isArray(r)&&Array.isArray(e)&&r.length===e.length){let t=!0,n=e.map((i,o)=>{let s=cl(r[o],i);return Object.is(s,r[o])||(t=!1),s});return t?r:n}if(wh(r)&&wh(e)){let t=Object.keys(r),n=Object.keys(e);if(t.length===n.length){let i=!0,o={};for(let s of n){let a=cl(r[s],e[s]);o[s]=a,(!(s in r)||!Object.is(a,r[s]))&&(i=!1)}return i?r:o}}return e}function wh(r){if(!r||typeof r!=\"object\"||Array.isArray(r)||vt(r))return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null}var ur=wr(d.string().describe(\"REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),pn=d.object({path:d.string().describe(\"A JSON Pointer path to a value in the data model.\")}).strict().describe(\"REF:#/$defs/DataBinding\"),os=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),pn,d.lazy(()=>ri)]).describe(\"REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),ri=d.object({call:d.string().describe(\"The name of the function to call.\"),args:d.record(d.string(),d.union([os,d.record(d.string(),d.any()).describe(\"A literal object argument (e.g. configuration).\")])).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.\").default(\"boolean\")}).describe(\"REF:#/$defs/FunctionCall|Invokes a named function on the client.\"),fe=d.union([d.string(),pn,ri]).describe(\"REF:#/$defs/DynamicString|Represents a string\"),Se=d.object({label:fe.optional(),description:fe.optional()}).describe(\"REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers.\"),Qx=d.object({id:ur,accessibility:Se.optional()}).describe(\"REF:#/$defs/ComponentCommon\"),ss=wr(d.union([d.array(ur).describe(\"A static list of child component IDs.\"),d.object({componentId:ur,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\"),lr=d.union([d.number(),pn,ri]).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.\"),dr=d.union([d.boolean(),pn,ri]).describe(\"REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean.\"),ul=d.union([d.array(d.string()),pn,ri]).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.\"),Nr=d.object({condition:dr,message:d.string().describe(\"The error message to display if the check fails.\")}).strict().describe(\"REF:#/$defs/CheckRule|A single validation rule applied to an input component.\"),eA=d.object({checks:d.array(Nr).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional()}).describe(\"REF:#/$defs/Checkable|Properties for components that support client-side checks.\"),ll=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(),os).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:ri}).strict().describe(\"Executes a local client-side function.\")]).describe(\"REF:#/$defs/Action|Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.\"),fr={ComponentId:ur,DataBinding:pn,DynamicValue:os,FunctionCall:ri,DynamicString:fe,AccessibilityAttributes:Se,ComponentCommon:Qx,ChildList:ss,DynamicNumber:lr,DynamicBoolean:dr,DynamicStringList:ul,CheckRule:Nr,Checkable:eA,Action:ll};function $e(r,e){return{...e,tagName:r.tagName,element:r}}var Ua=globalThis,za=Ua.ShadowRoot&&(Ua.ShadyCSS===void 0||Ua.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,dl=Symbol(),Eh=new WeakMap,as=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==dl)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(za&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Eh.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Eh.set(t,e))}return e}toString(){return this.cssText}},Sh=r=>new as(typeof r==\"string\"?r:r+\"\",void 0,dl),re=(r,...e)=>{let t=r.length===1?r[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)+r[o+1],r[0]);return new as(t,r,dl)},Th=(r,e)=>{if(za)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement(\"style\"),i=Ua.litNonce;i!==void 0&&n.setAttribute(\"nonce\",i),n.textContent=t.cssText,r.appendChild(n)}},fl=za?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t=\"\";for(let n of e.cssRules)t+=n.cssText;return Sh(t)})(r):r;var{is:tA,defineProperty:rA,getOwnPropertyDescriptor:nA,getOwnPropertyNames:iA,getOwnPropertySymbols:oA,getPrototypeOf:sA}=Object,qa=globalThis,kh=qa.trustedTypes,aA=kh?kh.emptyScript:\"\",cA=qa.reactiveElementPolyfillSupport,cs=(r,e)=>r,us={toAttribute(r,e){switch(e){case Boolean:r=r?aA:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Za=(r,e)=>!tA(r,e),$h={attribute:!0,type:String,converter:us,reflect:!1,useDefault:!1,hasChanged:Za};Symbol.metadata??=Symbol(\"metadata\"),qa.litPropertyMetadata??=new WeakMap;var Mr=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,t=$h){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&rA(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=nA(this.prototype,e)??{get(){return this[t]},set(s){this[t]=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)??$h}static _$Ei(){if(this.hasOwnProperty(cs(\"elementProperties\")))return;let e=sA(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(cs(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(cs(\"properties\"))){let t=this.properties,n=[...iA(t),...oA(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(fl(i))}else e!==void 0&&t.push(fl(e));return t}static _$Eu(e,t){let n=t.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,t=this.constructor.elementProperties;for(let n of t.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 Th(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,t,n){this._$AK(e,n)}_$ET(e,t){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:us).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){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:us;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,n,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),n??=s.getPropertyOptions(e),!((n.hasChanged??Za)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:o},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}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,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.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(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Mr.elementStyles=[],Mr.shadowRootOptions={mode:\"open\"},Mr[cs(\"elementProperties\")]=new Map,Mr[cs(\"finalized\")]=new Map,cA?.({ReactiveElement:Mr}),(qa.reactiveElementVersions??=[]).push(\"2.1.2\");var hl=globalThis,Ih=r=>r,Wa=hl.trustedTypes,Fh=Wa?Wa.createPolicy(\"lit-html\",{createHTML:r=>r}):void 0,ml=\"$lit$\",jr=`lit$${Math.random().toFixed(9).slice(2)}$`,gl=\"?\"+jr,uA=`<${gl}>`,oi=document,ds=()=>oi.createComment(\"\"),fs=r=>r===null||typeof r!=\"object\"&&typeof r!=\"function\",yl=Array.isArray,Ph=r=>yl(r)||typeof r?.[Symbol.iterator]==\"function\",pl=`[ \t\n\\f\\r]`,ls=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,Rh=/-->/g,Oh=/>/g,ni=RegExp(`>|${pl}(?:([^\\\\s\"'>=/]+)(${pl}*=${pl}*(?:[^ \t\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),Nh=/'/g,Mh=/\"/g,Lh=/^(?:script|style|textarea|title)$/i,bl=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),F=bl(1),cF=bl(2),uF=bl(3),Ue=Symbol.for(\"lit-noChange\"),k=Symbol.for(\"lit-nothing\"),jh=new WeakMap,ii=oi.createTreeWalker(oi,129);function Bh(r,e){if(!yl(r)||!r.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return Fh!==void 0?Fh.createHTML(e):e}var Vh=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?\"<svg>\":e===3?\"<math>\":\"\",s=ls;for(let a=0;a<t;a++){let c=r[a],u,l,p=-1,f=0;for(;f<c.length&&(s.lastIndex=f,l=s.exec(c),l!==null);)f=s.lastIndex,s===ls?l[1]===\"!--\"?s=Rh:l[1]!==void 0?s=Oh:l[2]!==void 0?(Lh.test(l[2])&&(i=RegExp(\"</\"+l[2],\"g\")),s=ni):l[3]!==void 0&&(s=ni):s===ni?l[0]===\">\"?(s=i??ls,p=-1):l[1]===void 0?p=-2:(p=s.lastIndex-l[2].length,u=l[1],s=l[3]===void 0?ni:l[3]==='\"'?Mh:Nh):s===Mh||s===Nh?s=ni:s===Rh||s===Oh?s=ls:(s=ni,i=void 0);let m=s===ni&&r[a+1].startsWith(\"/>\")?\" \":\"\";o+=s===ls?c+uA:p>=0?(n.push(u),c.slice(0,p)+ml+c.slice(p)+jr+m):c+jr+(p===-2?a:m)}return[Bh(r,o+(r[t]||\"<?>\")+(e===2?\"</svg>\":e===3?\"</math>\":\"\")),n]},ps=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,c=this.parts,[u,l]=Vh(e,t);if(this.el=r.createElement(u,n),ii.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ii.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(ml)){let f=l[s++],m=i.getAttribute(p).split(jr),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:g[2],strings:m,ctor:g[1]===\".\"?Ga:g[1]===\"?\"?Ka:g[1]===\"@\"?Ja:ai}),i.removeAttribute(p)}else p.startsWith(jr)&&(c.push({type:6,index:o}),i.removeAttribute(p));if(Lh.test(i.tagName)){let p=i.textContent.split(jr),f=p.length-1;if(f>0){i.textContent=Wa?Wa.emptyScript:\"\";for(let m=0;m<f;m++)i.append(p[m],ds()),ii.nextNode(),c.push({type:2,index:++o});i.append(p[f],ds())}}}else if(i.nodeType===8)if(i.data===gl)c.push({type:2,index:o});else{let p=-1;for(;(p=i.data.indexOf(jr,p+1))!==-1;)c.push({type:7,index:o}),p+=jr.length-1}o++}}static createElement(e,t){let n=oi.createElement(\"template\");return n.innerHTML=e,n}};function si(r,e,t=r,n){if(e===Ue)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=fs(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=si(r,i._$AS(r,e.values),i,n)),e}var Ha=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??oi).importNode(t,!0);ii.currentNode=i;let o=ii.nextNode(),s=0,a=0,c=n[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new to(o,o.nextSibling,this,e):c.type===1?u=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(u=new Ya(o,this,e)),this._$AV.push(u),c=n[++a]}s!==c?.index&&(o=ii.nextNode(),s++)}return ii.currentNode=oi,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},to=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=si(this,e,t),fs(e)?e===k||e==null||e===\"\"?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==Ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ph(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!==k&&fs(this._$AH)?this._$AA.nextSibling.data=e:this.T(oi.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n==\"number\"?this._$AC(e):(n.el===void 0&&(n.el=ps.createElement(Bh(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Ha(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=jh.get(e.strings);return t===void 0&&jh.set(e.strings,t=new ps(e)),t}k(e){yl(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(ds()),this.O(ds()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ih(e).nextSibling;Ih(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ai=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,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=k}_$AI(e,t=this,n,i){let o=this.strings,s=!1;if(o===void 0)e=si(this,e,t,0),s=!fs(e)||e!==this._$AH&&e!==Ue,s&&(this._$AH=e);else{let a=e,c,u;for(e=o[0],c=0;c<o.length-1;c++)u=si(this,a[n+c],t,c),u===Ue&&(u=this._$AH[c]),s||=!fs(u)||u!==this._$AH[c],u===k?e=k:e!==k&&(e+=(u??\"\")+o[c+1]),this._$AH[c]=u}s&&!i&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??\"\")}},Ga=class extends ai{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},Ka=class extends ai{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ja=class extends ai{constructor(e,t,n,i,o){super(e,t,n,i,o),this.type=5}_$AI(e,t=this){if((e=si(this,e,t,0)??k)===Ue)return;let n=this._$AH,i=e===k&&n!==k||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==k&&(n===k||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)}},Ya=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){si(this,e)}},Uh={M:ml,P:jr,A:gl,C:1,L:Vh,R:Ha,D:Ph,V:si,I:to,H:ai,N:Ka,U:Ja,B:Ga,F:Ya},lA=hl.litHtmlPolyfillSupport;lA?.(ps,to),(hl.litHtmlVersions??=[]).push(\"3.3.3\");var zh=(r,e,t)=>{let n=t?.renderBefore??e,i=n._$litPart$;if(i===void 0){let o=t?.renderBefore??null;n._$litPart$=i=new to(e.insertBefore(ds(),o),o,void 0,t??{})}return i._$AI(r),i};var vl=globalThis,hn=class extends Mr{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 t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=zh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ue}};hn._$litElement$=!0,hn.finalized=!0,vl.litElementHydrateSupport?.({LitElement:hn});var dA=vl.litElementPolyfillSupport;dA?.({LitElement:hn});(vl.litElementVersions??=[]).push(\"4.2.2\");var fA={attribute:!0,type:String,converter:us,reflect:!1,hasChanged:Za},pA=(r=fA,e,t)=>{let{kind:n,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),n===\"setter\"&&((r=Object.create(r)).wrapped=!0),o.set(t.name,r),n===\"accessor\"){let{name:s}=t;return{set(a){let c=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,c,r,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,r,a),a}}}if(n===\"setter\"){let{name:s}=t;return function(a){let c=this[s];e.call(this,a),this.requestUpdate(s,c,r,!0,a)}}throw Error(\"Unsupported decorator location: \"+n)};function hs(r){return(e,t)=>typeof t==\"object\"?pA(r,e,t):((n,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,n),s?Object.getOwnPropertyDescriptor(i,o):void 0})(r,e,t)}function ro(r){return hs({...r,state:!0,attribute:!1})}var pr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},xt=r=>(...e)=>({_$litDirective$:r,values:e}),pt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};function mn(r){return typeof r==\"object\"&&r!==null&&\"tagName\"in r&&typeof r.tagName==\"string\"&&\"element\"in r&&typeof r.element==\"function\"}var qh=!1;function no(r){if(typeof customElements>\"u\"){qh||(qh=!0,console.error(`Cannot register \"${r.tagName}\": \\`customElements\\` is not available in this environment, so universal components will not render.`));return}let e=customElements.get(r.tagName);if(!e){customElements.define(r.tagName,r.element);return}if(e!==r.element)throw new Error(`Custom element tag name collision for \"${r.tagName}\": attempted to register ${r.element.name||\"anonymous constructor\"}, but tag name is already registered with ${e.name||\"another constructor\"}.`)}var _l=class extends pt{render(e,t,n){return(!this.element||this.tagName!==e)&&(this.tagName=e,this.element=document.createElement(e)),this.element.node=n,this.element.context=t,this.element}},Zh=xt(_l);function xl(r,e){if(vt(r))return hA(r);let t=r.componentModel.type,n=e?.components.get(t);return!n||!n.tagName?(console.warn(`Component implementation not found or missing tagName for type: ${t}`),k):(mn(n)&&typeof customElements<\"u\"&&!customElements.get(n.tagName)&&no(n),Zh(n.tagName,r))}function hA(r){if(r.isPlaceholder||r.disposed||!r.context)return k;let e=r.impl;return e?.tagName?(mn(e)&&no(e),Zh(e.tagName,r.context,r)):(console.warn(`Component implementation not found or missing tagName for type: ${r.type}`),k)}var Qa=class{get props(){return this._props}constructor(e,t){this.host=e,this.binder=new Or(this.host.context,t.schema),this._props=this.binder.snapshot,this.host.addController(this),this.host.isConnected&&this.hostConnected()}hostConnected(){this.subscription||(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()}))}hostDisconnected(){this.subscription?.unsubscribe(),this.subscription=void 0,this.componentsSubscription?.unsubscribe(),this.componentsSubscription=void 0}dispose(){this.hostDisconnected(),this.binder.dispose()}};var Wh=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ci=class extends hn{get controller(){return this._controller}adoptLightDomStyles(){if(typeof document>\"u\")return;let e=this.getRootNode(),t=this.constructor,n=t.styles;if(!n)return;let i=this.tagName.toLowerCase();if(!t._processedSheet&&t._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(`\n`).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 p=m=>{if(typeof CSSStyleRule<\"u\"&&m instanceof CSSStyleRule)return`${m.selectorText.split(\",\").map(h=>(h=h.trim(),h===i||h.startsWith(i+\" \")||h.startsWith(i+\".\")||h.startsWith(i+\":\")||h.startsWith(i+\"[\")||h.startsWith(`:where(${i}`)||h.startsWith(`:is(${i}`)?h:`${i} ${h}`)).join(\", \")} { ${m.style.cssText} }`;if(typeof CSSMediaRule<\"u\"&&m instanceof CSSMediaRule){let g=Array.from(m.cssRules).map(p).join(`\n`);return`@media ${m.conditionText} {\n${g}\n}`}return m.cssText};u=Array.from(l.cssRules).map(p).join(`\n`);let f=new CSSStyleSheet;f.replaceSync(u),t._processedSheet=f}catch{}t._processedCss=u,t._processedStyle=re([u]),t._adoptedRoots=new WeakSet}let o=typeof ShadowRoot<\"u\"&&e instanceof ShadowRoot?e:typeof document<\"u\"?document:void 0;o&&(t._adoptedRoots||(t._adoptedRoots=new WeakSet),t._adoptedRoots.has(o)||(t._adoptedRoots.add(o),t._processedSheet&&o.adoptedStyleSheets&&(o.adoptedStyleSheets=[...o.adoptedStyleSheets,t._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 Qa(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,t){if(!e||!this.context?.dataContext)return k;let{surface:n,path:i}=this.context.dataContext;if(!n)return k;if(!!!n.componentsModel?.get(this.context.componentModel.id))return k;let s,a=t;if(typeof e==\"object\"?(s=e.id||e.componentId,a=a??e.basePath??e.path):s=e,!s||!n.componentsModel?.get(s))return k;if(a=a??i,this.node){let l=gA(this.node,s,a);if(l)return xl(l)}let c=new Qi(n,s,a),u=c.componentModel.catalog;return xl(c,u)}willUpdate(e){super.willUpdate(e);let t=e.has(\"context\");if(e.has(\"node\")&&this.node?.context&&this.node.context!==this.context&&(this.context=this.node.context,t=!0),t&&this.context){if(this._controller&&mA(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}}update(e){this._controller&&super.update(e)}};Wh([hs({type:Object})],ci.prototype,\"context\",void 0);Wh([hs({type:Object})],ci.prototype,\"node\",void 0);function mA(r,e){return r===e?!0:!r?.componentModel||!e?.componentModel||!r.dataContext||!e.dataContext?!1:r.componentModel===e.componentModel&&r.surfaceComponents===e.surfaceComponents&&r.theme===e.theme&&r.dataContext.surface===e.dataContext.surface&&r.dataContext.dataModel===e.dataContext.dataModel&&r.dataContext.path===e.dataContext.path&&r.dataContext.explicitIndex===e.dataContext.explicitIndex&&r.dataContext.parent===e.dataContext.parent}function gA(r,e,t){let n=i=>{if(vt(i))return i.componentId===e&&i.dataPath===t?i:void 0;if(i instanceof st)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(Ye(r.props))}var yA=`\n :where(:root) {\n color-scheme: light dark;\n }\n\n :where(.a2ui-dark) {\n color-scheme: dark;\n }\n\n :where(.a2ui-light) {\n color-scheme: light;\n }\n\n :where(:root), :where(.a2ui-dark), :where(.a2ui-light) {\n --a2ui-color-background: light-dark(#eee, #111);\n --a2ui-color-on-background: light-dark(#333, #eee);\n\n --a2ui-color-surface: light-dark(\n color-mix(in oklab, var(--a2ui-color-background) 85%, white),\n color-mix(in oklab, var(--a2ui-color-background) 95%, white)\n );\n --a2ui-color-on-surface: light-dark(#333, #eee);\n\n --a2ui-color-primary: #17e;\n --a2ui-color-primary-light: ${hr(\"light\",{colorVar:\"--a2ui-color-primary\"})};\n --a2ui-color-primary-dark: ${hr(\"dark\",{colorVar:\"--a2ui-color-primary\"})};\n --a2ui-color-primary-hover: ${hr(\"hover\",{darkVar:\"--a2ui-color-primary-dark\",lightVar:\"--a2ui-color-primary-light\"})};\n --a2ui-color-on-primary: #fff;\n\n --a2ui-color-secondary: light-dark(#ddd, #333);\n --a2ui-color-secondary-light: ${hr(\"light\",{colorVar:\"--a2ui-color-secondary\"})};\n --a2ui-color-secondary-dark: ${hr(\"dark\",{colorVar:\"--a2ui-color-secondary\",percentage:95})};\n --a2ui-color-secondary-hover: ${hr(\"hover\",{darkVar:\"--a2ui-color-secondary-dark\",lightVar:\"--a2ui-color-secondary-light\"})};\n --a2ui-color-on-secondary: light-dark(#333, #eee);\n\n --a2ui-border-radius: 0.25rem;\n --a2ui-color-border: light-dark(#ccc, #444);\n --a2ui-border-width: 1px;\n --a2ui-border: 1px solid var(--a2ui-color-border, #ccc);\n\n --a2ui-font-family-title: inherit;\n --a2ui-font-family-monospace: monospace;\n --a2ui-color-input: light-dark(#fff, #2a2a2a);\n --a2ui-color-on-input: light-dark(#333, #eee);\n\n --a2ui-grid-base: 0.5rem;\n --a2ui-spacing-xs: calc(var(--a2ui-spacing-s) / 2);\n --a2ui-spacing-s: calc(var(--a2ui-spacing-m) / 2);\n --a2ui-spacing-m: var(--a2ui-grid-base);\n --a2ui-spacing-l: calc(var(--a2ui-spacing-m) * 2);\n --a2ui-spacing-xl: calc(var(--a2ui-spacing-l) * 2);\n\n --a2ui-font-size: 1rem;\n --a2ui-font-scale: 1.2;\n --a2ui-font-size-xs: calc(var(--a2ui-font-size-s) / var(--a2ui-font-scale));\n --a2ui-font-size-s: calc(var(--a2ui-font-size-m) / var(--a2ui-font-scale));\n --a2ui-font-size-m: var(--a2ui-font-size);\n --a2ui-font-size-l: calc(var(--a2ui-font-size-m) * var(--a2ui-font-scale));\n --a2ui-font-size-xl: calc(var(--a2ui-font-size-l) * var(--a2ui-font-scale));\n --a2ui-font-size-2xl: calc(var(--a2ui-font-size-xl) * var(--a2ui-font-scale));\n\n --a2ui-line-height-headings: 1.2;\n --a2ui-line-height-body: 1.5;\n }\n`,ec;function bA(){return ec||(ec=new CSSStyleSheet,ec.replaceSync(yA)),ec}function Hh(r){if(typeof document>\"u\")return;let e=bA(),t=typeof document<\"u\"?document.adoptedStyleSheets:null;if(t&&typeof t.includes==\"function\"&&!t.includes(e))try{document.adoptedStyleSheets=[...t,e]}catch{}if(r&&r!==document){let n=r.adoptedStyleSheets;if(n&&typeof n.includes==\"function\"&&!n.includes(e))try{r.adoptedStyleSheets=[...n,e]}catch{}}}function hr(r,e){switch(r){case\"light\":{let t=e;return`color-mix(in oklab, var(${t.colorVar}) ${t.percentage??85}%, ${t.mixColor??\"white\"})`}case\"dark\":{let t=e;return`color-mix(in oklab, var(${t.colorVar}) ${t.percentage??85}%, ${t.mixColor??\"black\"})`}case\"hover\":{let t=e;return`light-dark(var(${t.darkVar}), var(${t.lightVar}))`}}}var tc=$d(Kh(),1);var vA=/^var\\(\\s*--[a-zA-Z0-9_-]+(?:\\s*,\\s*[^)]+)?\\s*\\)$/;function Al(r){if(typeof r!=\"string\"||!r.trim())return!1;let e=r.trim();if(vA.test(e))return!0;if(typeof CSS<\"u\"&&typeof CSS.supports==\"function\")return CSS.supports(\"color\",e);let t=typeof tc.default==\"function\"?tc.default:tc.default?.default;return typeof t==\"function\"?t(e):!1}var Jh=d.object({primaryColor:d.string().refine(r=>Al(r),\"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 oe=class extends ci{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Hh()}willUpdate(e){super.willUpdate(e);let t=this.controller?.props;t&&t.weight!==void 0?this.style.flex=String(t.weight):this.style.removeProperty(\"flex\");let n=this.context?.theme?.primaryColor;typeof n==\"string\"&&Al(n)?(this.style.setProperty(\"--a2ui-color-primary\",n),this.style.setProperty(\"--a2ui-color-primary-light\",hr(\"light\",{colorVar:\"--a2ui-color-primary\"})),this.style.setProperty(\"--a2ui-color-primary-dark\",hr(\"dark\",{colorVar:\"--a2ui-color-primary\"})),this.style.setProperty(\"--a2ui-color-primary-hover\",hr(\"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(t?.accessibility)}renderValidationErrors(e){return e?.isValid===!1&&e.validationErrors?.length?e.validationErrors.map(t=>F`<div class=\"a2ui-error-message\">${t}</div>`):k}applyAccessibilityAttributes(e){this.setOrRemoveAttribute(\"aria-label\",e?.label),this.setOrRemoveAttribute(\"aria-description\",e?.description),this.setOrRemoveAttribute(\"aria-live\",e?.live),typeof e?.hidden==\"boolean\"?this.setAttribute(\"aria-hidden\",String(e.hidden)):this.removeAttribute(\"aria-hidden\")}setOrRemoveAttribute(e,t){t!=null&&t!==\"\"?this.setAttribute(e,String(t)):this.removeAttribute(e)}};var ui=class extends oe{render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-audio-player\">\n ${e.description?F`<div class=\"a2ui-audio-description\">${e.description}</div>`:k}\n <audio src=${e.url||k} controls class=\"a2ui-audio\">\n Your browser does not support the audio tag.\n </audio>\n </div>\n `:k}};ui.tagName=\"a2ui-audioplayer\";ui.styles=re`\n .a2ui-audio-player {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 0.25rem);\n background: var(--a2ui-audioplayer-background, transparent);\n border-radius: var(--a2ui-audioplayer-border-radius, 0);\n padding: var(--a2ui-audioplayer-padding, 0);\n width: 100%;\n }\n .a2ui-audio-description {\n font-size: var(--a2ui-font-size-s, 0.875rem);\n color: var(\n --a2ui-audioplayer-description-color,\n var(--a2ui-text-caption-color, light-dark(#666, #aaa))\n );\n }\n .a2ui-audio {\n width: 100%;\n }\n `;var at=xt(class extends pt{constructor(r){if(super(r),r.type!==pr.ATTRIBUTE||r.name!==\"class\"||r.strings?.length>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(r){return\" \"+Object.keys(r).filter(e=>r[e]).join(\" \")+\" \"}update(r,[e]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.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 t=r.element.classList;for(let n of this.st)n in e||(t.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?(t.add(n),this.st.add(n)):(t.remove(n),this.st.delete(n)))}return Ue}});var li=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,i={\"a2ui-button\":!0,[\"a2ui-button-\"+(e.variant??\"default\")]:!0};return F`\n <button\n type=\"button\"\n class=${at(i)}\n @click=${()=>{t||e.action?.()}}\n ?disabled=${t}\n >\n ${e.child?F`${this.renderNode(e.child)}`:k}\n </button>\n `}};li.tagName=\"a2ui-basic-button\";li.styles=re`\n .a2ui-button {\n padding: var(\n --a2ui-button-padding,\n var(--a2ui-spacing-m, 0.5rem) var(--a2ui-spacing-l, 1rem)\n );\n border-radius: var(--a2ui-button-border-radius, var(--a2ui-spacing-s, 0.25rem));\n border: var(\n --a2ui-button-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n cursor: pointer;\n margin: var(--a2ui-button-margin, var(--a2ui-spacing-m, 0.5rem));\n background: var(--a2ui-button-background, var(--a2ui-color-surface, #fff));\n box-shadow: var(--a2ui-button-box-shadow, none);\n font-weight: var(--a2ui-button-font-weight, normal);\n --_a2ui-text-margin: 0;\n --_a2ui-text-color: var(--a2ui-color-on-secondary, #333);\n color: var(--_a2ui-text-color);\n }\n .a2ui-button:hover {\n background-color: var(--a2ui-color-secondary-hover, #ddd);\n }\n .a2ui-button.a2ui-button-primary {\n background: var(--a2ui-color-primary, #17e);\n --_a2ui-text-color: var(--a2ui-color-on-primary, #fff);\n color: var(--_a2ui-text-color);\n border: none;\n }\n .a2ui-button.a2ui-button-primary:hover {\n background-color: var(--a2ui-color-primary-hover, #fbd);\n }\n .a2ui-button.a2ui-button-borderless {\n background: none;\n border: none;\n padding: 0;\n color: var(--a2ui-color-primary, #17e);\n }\n .a2ui-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n `;var di=class extends oe{render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-card\">${e.child?this.renderNode(e.child):k}</div>\n `:k}};di.tagName=\"a2ui-card\";di.styles=re`\n .a2ui-card {\n padding: var(--a2ui-card-padding, var(--a2ui-spacing-m, 16px));\n border-radius: var(--a2ui-card-border-radius, var(--a2ui-border-radius, 8px));\n box-shadow: var(--a2ui-card-box-shadow, 0 2px 4px rgba(0, 0, 0, 0.1));\n background: var(--a2ui-card-background, var(--a2ui-color-surface, #fff));\n color: var(--a2ui-color-on-surface, #333);\n border: var(\n --a2ui-card-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n margin: var(--a2ui-card-margin, var(--a2ui-spacing-m, 16px));\n }\n `;var fi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,n={\"a2ui-checkbox\":!0,\"a2ui-invalid\":t},i={\"a2ui-invalid\":t};return F`\n <div class=\"a2ui-checkbox-container\">\n <label class=${at(n)}>\n <input\n type=\"checkbox\"\n class=${at(i)}\n .checked=${e.value||!1}\n @change=${o=>e.setValue?.(o.target.checked)}\n />\n <span class=\"a2ui-check-box-text\">${e.label}</span>\n </label>\n ${this.renderValidationErrors(e)}\n </div>\n `}};fi.tagName=\"a2ui-checkbox\";fi.styles=re`\n :host,\n a2ui-checkbox {\n display: block;\n }\n .a2ui-checkbox-container {\n display: flex;\n flex-direction: column;\n margin: var(--a2ui-checkbox-margin, var(--a2ui-spacing-m));\n }\n label.a2ui-checkbox {\n display: inline-flex;\n align-items: center;\n gap: var(--a2ui-checkbox-gap, var(--a2ui-spacing-s, 0.5rem));\n font-size: var(\n --a2ui-checkbox-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-checkbox-label-font-weight, var(--a2ui-label-font-weight, bold));\n cursor: pointer;\n }\n label.a2ui-invalid {\n color: var(--a2ui-checkbox-color-error, red);\n }\n input {\n width: var(--a2ui-checkbox-size, 1rem);\n height: var(--a2ui-checkbox-size, 1rem);\n background: var(--a2ui-checkbox-background, inherit);\n border: var(--a2ui-checkbox-border, var(--a2ui-border));\n border-radius: var(--a2ui-checkbox-border-radius, 4px);\n }\n input.a2ui-invalid {\n outline: 1px solid var(--a2ui-checkbox-color-error, red);\n }\n .a2ui-error-message {\n color: var(--a2ui-checkbox-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n margin-top: 4px;\n }\n `;var _A=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},gn=class extends oe{constructor(){super(...arguments),this.filter=\"\"}render(){let e=this.controller?.props;if(!e)return k;let t=e.value,n=Array.isArray(t)?t:typeof t==\"string\"?[t]:[],i=e.variant===\"multipleSelection\",o=e.displayStyle===\"chips\",s=m=>{let g=e.setValue;typeof g==\"function\"&&(i?n.includes(m)?g(n.filter(h=>h!==m)):g([...n,m]):g([m]))},a=(e.options||[]).filter(m=>!e.filterable||this.filter===\"\"||String(m.label).toLowerCase().includes(this.filter.toLowerCase())),c=this.context?.dataContext?.surface?.id||\"default\",u=this.context?.componentModel?.id||\"choice-picker\",p=(this.context?.dataContext?.path||\"/\").replace(/[^a-zA-Z0-9-]/g,\"_\"),f=`a2ui-choice-${c}-${u}-${p}`;return F`\n ${e.label?F`<label>${e.label}</label>`:k}\n ${e.filterable?F`\n <input\n type=\"text\"\n class=\"a2ui-filter-input\"\n placeholder=\"Filter options...\"\n aria-label=\"Filter options\"\n .value=${this.filter}\n @input=${m=>this.filter=m.target.value}\n />\n `:k}\n <div\n class=${at({\"a2ui-choice-picker\":!0,\"a2ui-options-group\":!o,\"a2ui-chips-group\":o})}\n >\n ${a.map(m=>o?F`\n <button\n type=\"button\"\n class=${at({\"a2ui-chip\":!0,\"a2ui-chip-selected\":n.includes(m.value)})}\n aria-pressed=${n.includes(m.value)}\n @click=${()=>s(m.value)}\n >\n ${m.label}\n </button>\n `:F`\n <label class=\"a2ui-option-label\">\n <input\n type=${i?\"checkbox\":\"radio\"}\n name=${i?k:f}\n value=${m.value}\n .checked=${n.includes(m.value)}\n @change=${()=>s(m.value)}\n class=\"a2ui-option-input\"\n />\n <span class=\"a2ui-option-text\">${m.label}</span>\n </label>\n `)}\n </div>\n ${this.renderValidationErrors(e)}\n `}};gn.tagName=\"a2ui-choicepicker\";gn.styles=re`\n :host,\n .a2ui-choice-picker {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n padding: var(--a2ui-choicepicker-padding, 0);\n }\n .a2ui-options-group {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n }\n label,\n .a2ui-option-label {\n display: flex;\n align-items: center;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n cursor: pointer;\n color: var(--a2ui-text-color-text, var(--a2ui-choicepicker-label-color, inherit));\n font-size: var(--a2ui-choicepicker-label-font-size, inherit);\n }\n :host,\n a2ui-choicepicker > label {\n font-size: var(\n --a2ui-choicepicker-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-choicepicker-label-font-weight, var(--a2ui-label-font-weight, bold));\n }\n .a2ui-filter-input {\n background-color: var(--a2ui-color-input, #fff);\n color: var(--a2ui-color-on-input, #333);\n border: var(\n --a2ui-textfield-border,\n var(--a2ui-border, 1px solid var(--a2ui-color-border, #ccc))\n );\n border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m, 4px));\n padding: var(\n --a2ui-choicepicker-filter-padding,\n var(--a2ui-spacing-xs, 4px) var(--a2ui-spacing-s, 8px)\n );\n margin-bottom: var(--a2ui-choicepicker-filter-margin-bottom, var(--a2ui-spacing-s, 0.25rem));\n font-family: inherit;\n }\n .a2ui-filter-input:focus {\n outline: none;\n border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));\n }\n .a2ui-option-input {\n width: var(--a2ui-choicepicker-checkbox-size, 1rem);\n height: var(--a2ui-choicepicker-checkbox-size, 1rem);\n }\n .a2ui-chips-group {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n }\n .a2ui-chip {\n padding: var(\n --a2ui-choicepicker-chip-padding,\n var(--a2ui-spacing-s, 4px) var(--a2ui-spacing-m, 8px)\n );\n border-radius: var(--a2ui-choicepicker-chip-border-radius, 999px);\n border: var(--a2ui-choicepicker-chip-border, 1px solid var(--a2ui-color-border, #ccc));\n background-color: var(--a2ui-choicepicker-chip-background, var(--a2ui-color-surface, #fff));\n color: var(--a2ui-color-on-surface, inherit);\n cursor: pointer;\n font-size: var(--a2ui-choicepicker-chip-font-size, var(--a2ui-font-size-xs, 0.75rem));\n font-family: inherit;\n font-weight: var(--a2ui-choicepicker-chip-font-weight, normal);\n transition: all 0.2s;\n }\n .a2ui-chip.a2ui-chip-selected {\n background-color: var(\n --a2ui-choicepicker-chip-background-selected,\n var(--a2ui-color-primary, #007bff)\n );\n color: var(--a2ui-color-on-primary, #fff);\n border-color: var(\n --a2ui-choicepicker-chip-background-selected,\n var(--a2ui-color-primary, #007bff)\n );\n }\n .a2ui-error-message {\n color: var(--a2ui-choicepicker-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;_A([ro()],gn.prototype,\"filter\",void 0);var{I:xA}=Uh,Yh=r=>r;var Qh=r=>r.strings===void 0,Xh=()=>document.createComment(\"\"),io=(r,e,t)=>{let n=r._$AA.parentNode,i=e===void 0?r._$AB:e._$AA;if(t===void 0){let o=n.insertBefore(Xh(),i),s=n.insertBefore(Xh(),i);t=new xA(o,s,r,r.options)}else{let o=t._$AB.nextSibling,s=t._$AM,a=s!==r;if(a){let c;t._$AQ?.(r),t._$AM=r,t._$AP!==void 0&&(c=r._$AU)!==s._$AU&&t._$AP(c)}if(o!==i||a){let c=t._$AA;for(;c!==o;){let u=Yh(c).nextSibling;Yh(n).insertBefore(c,i),c=u}}}return t},yn=(r,e,t=r)=>(r._$AI(e,t),r),AA={},em=(r,e=AA)=>r._$AH=e,tm=r=>r._$AH,rc=r=>{r._$AR(),r._$AA.remove()};var rm=(r,e,t)=>{let n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},bn=xt(class extends pt{constructor(r){if(super(r),r.type!==pr.CHILD)throw Error(\"repeat() can only be used in text expressions\")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);let i=[],o=[],s=0;for(let a of r)i[s]=n?n(a,s):s,o[s]=t(a,s),s++;return{values:o,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){let i=tm(r),{values:o,keys:s}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],c=[],u,l,p=0,f=i.length-1,m=0,g=o.length-1;for(;p<=f&&m<=g;)if(i[p]===null)p++;else if(i[f]===null)f--;else if(a[p]===s[m])c[m]=yn(i[p],o[m]),p++,m++;else if(a[f]===s[g])c[g]=yn(i[f],o[g]),f--,g--;else if(a[p]===s[g])c[g]=yn(i[p],o[g]),io(r,c[g+1],i[p]),p++,g--;else if(a[f]===s[m])c[m]=yn(i[f],o[m]),io(r,i[p],i[f]),f--,m++;else if(u===void 0&&(u=rm(s,m,g),l=rm(a,p,f)),u.has(a[p]))if(u.has(a[f])){let h=l.get(s[m]),b=h!==void 0?i[h]:null;if(b===null){let v=io(r,i[p]);yn(v,o[m]),c[m]=v}else c[m]=yn(b,o[m]),io(r,i[p],b),i[h]=null;m++}else rc(i[f]),f--;else rc(i[p]),p++;for(;m<=g;){let h=io(r,c[g+1]);yn(h,o[m]),c[m++]=h}for(;p<=f;){let h=i[p++];h!==null&&rc(h)}return this.ut=s,em(r,c),Ue}});var DA={start:\"flex-start\",center:\"center\",end:\"flex-end\",spaceBetween:\"space-between\",spaceAround:\"space-around\",spaceEvenly:\"space-evenly\",stretch:\"stretch\"},CA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function wA(r){return typeof r==\"object\"&&r!==null?`${r.basePath??\"\"}/${r.id}`:String(r)}var pi=class extends oe{updated(e){super.updated(e);let t=this.controller.props;t&&(t.justify?this.style.justifyContent=DA[t.justify]??\"flex-start\":this.style.removeProperty(\"justify-content\"),t.align?this.style.alignItems=CA[t.align]??\"stretch\":this.style.removeProperty(\"align-items\"))}render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[];return F` ${bn(t,wA,n=>F`${this.renderNode(n)}`)} `}};pi.tagName=\"a2ui-basic-column\";pi.styles=re`\n :host,\n a2ui-basic-column {\n display: flex;\n flex-direction: column;\n width: var(--a2ui-column-width, 100%);\n gap: var(--a2ui-column-gap, var(--a2ui-spacing-m));\n }\n `;function EA(){let r=new Date,e=r.getFullYear(),t=String(r.getMonth()+1).padStart(2,\"0\"),n=String(r.getDate()).padStart(2,\"0\");return`${e}-${t}-${n}`}function oo(r,e){if(!r)return\"\";if(r.includes(\"T\")){let[n,i]=r.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\"?r.includes(\"-\")?r.substring(0,10):\"\":e===\"time\"&&r.includes(\":\")?r.substring(0,5):\"\"}var hi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.enableTime??!1,n=e.enableDate??!t,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=oo(i,\"date\"),c=oo(i,\"time\"),u=oo(o,\"date\"),l=oo(s,\"date\"),p=oo(o,\"time\"),f=oo(s,\"time\"),m=h=>{let b=h.target.value;if(t){let v=i.includes(\"T\")?i.split(\"T\")[1]:i.includes(\":\")?i:\"00:00:00\";e.setValue?.(`${b}T${v}`)}else e.setValue?.(b)},g=h=>{let b=h.target.value;if(n){let v=i.includes(\"T\")?i.split(\"T\")[0]:i.includes(\"-\")?i:EA();e.setValue?.(`${v}T${b}:00`)}else e.setValue?.(b)};return F`\n <div class=\"a2ui-date-time-container\">\n ${e.label?F`<label class=\"a2ui-date-time-label\">${e.label}</label>`:k}\n <div class=\"a2ui-date-time-inputs\">\n ${n?F`\n <input\n type=\"date\"\n min=${u||k}\n max=${l||k}\n .value=${a}\n @change=${m}\n class=\"a2ui-date-time-input\"\n />\n `:k}\n ${t?F`\n <input\n type=\"time\"\n min=${p||k}\n max=${f||k}\n .value=${c}\n @change=${g}\n class=\"a2ui-date-time-input\"\n />\n `:k}\n </div>\n ${this.renderValidationErrors(e)}\n </div>\n `}};hi.tagName=\"a2ui-datetimeinput\";hi.styles=re`\n .a2ui-date-time-container {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 4px);\n width: var(--a2ui-datetimeinput-width, 100%);\n }\n input {\n box-sizing: border-box;\n width: 100%;\n }\n .a2ui-date-time-label {\n font-size: var(\n --a2ui-datetimeinput-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))\n );\n font-weight: var(--a2ui-datetimeinput-label-font-weight, bold);\n color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));\n }\n .a2ui-date-time-inputs {\n display: flex;\n gap: var(--a2ui-spacing-s, 8px);\n width: 100%;\n }\n .a2ui-date-time-input {\n padding: var(--a2ui-datetimeinput-padding, 8px);\n border-radius: var(--a2ui-datetimeinput-border-radius, 4px);\n border: var(--a2ui-datetimeinput-border, 1px solid var(--a2ui-color-border, #ccc));\n background-color: var(--a2ui-datetimeinput-background, var(--a2ui-color-input, #fff));\n color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));\n font-family: inherit;\n flex: 1;\n }\n .a2ui-date-time-input::-webkit-datetime-edit,\n .a2ui-date-time-input::-webkit-datetime-edit-fields-wrapper {\n color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));\n }\n .a2ui-error-message {\n color: var(--a2ui-datetimeinput-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var mi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let n={\"a2ui-divider\":!0,[\"a2ui-divider-\"+(e.axis??\"horizontal\")]:!0};return F`<hr class=${at(n)} />`}};mi.tagName=\"a2ui-divider\";mi.styles=re`\n .a2ui-divider {\n border: 0;\n border-top: var(\n --a2ui-divider-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n margin: var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px)) 0;\n width: 100%;\n }\n .a2ui-divider.a2ui-divider-vertical {\n width: var(--a2ui-border-width, 1px);\n height: 100%;\n margin: 0 var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px));\n border-top: 0;\n border-left: var(\n --a2ui-divider-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n }\n `;var nm={play:\"play_arrow\",rewind:\"fast_rewind\",favoriteOff:\"favorite_border\",starOff:\"star_border\"};function SA(r){return nm[r]?nm[r]:r.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}var gi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.name;if(typeof t==\"object\"&&t!==null&&\"svgPath\"in t){let o=t.svgPath;return F`\n <svg class=\"a2ui-icon a2ui-icon-svg\" viewBox=\"0 0 24 24\">\n <path d=${o}></path>\n </svg>\n `}let i=typeof t==\"string\"?SA(t):\"\";return F`<i class=\"material-icons a2ui-icon\">${i}</i>`}};gi.tagName=\"a2ui-icon\";gi.styles=re`\n .a2ui-icon {\n display: inline-block;\n width: var(--a2ui-icon-size, 24px);\n height: var(--a2ui-icon-size, 24px);\n font-size: var(--a2ui-icon-size, 24px);\n font-style: normal;\n font-weight: normal;\n font-family: var(--a2ui-icon-font-family, 'Material Icons', 'Material Symbols Outlined');\n color: var(\n --a2ui-icon-color,\n var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333))\n );\n font-variation-settings: var(--a2ui-icon-font-variation-settings, 'FILL' 1);\n line-height: 1;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: normal;\n white-space: nowrap;\n direction: ltr;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n font-feature-settings: 'liga';\n vertical-align: middle;\n }\n .a2ui-icon.a2ui-icon-svg {\n fill: currentColor;\n }\n `;var im=\"important\",TA=\" !\"+im,nc=xt(class extends pt{constructor(r){if(super(r),r.type!==pr.ATTRIBUTE||r.name!==\"style\"||r.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(r){return Object.keys(r).reduce((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.includes(\"-\")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${n};`},\"\")}update(r,[e]){let{style:t}=r.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(\"-\")?t.removeProperty(n):t[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(TA);n.includes(\"-\")||o?t.setProperty(n,o?i.slice(0,-11):i,o?im:\"\"):t[n]=i}}return Ue}});var kA={contain:\"contain\",cover:\"cover\",fill:\"fill\",none:\"none\",scaleDown:\"scale-down\"},yi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.variant||\"default\",n=e.fit||\"cover\",i=kA[n]??n;return F`<img\n src=${e.url}\n alt=${e.description||\"\"}\n style=${nc({objectFit:i})}\n class=\"a2ui-image a2ui-image-${t}\"\n />`}};yi.tagName=\"a2ui-image\";yi.styles=re`\n .a2ui-image {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: var(--a2ui-image-border-radius, 0);\n }\n .a2ui-image.a2ui-image-icon {\n width: var(--a2ui-image-icon-size, 24px);\n height: var(--a2ui-image-icon-size, 24px);\n }\n .a2ui-image.a2ui-image-avatar {\n width: var(--a2ui-image-avatar-size, 40px);\n height: var(--a2ui-image-avatar-size, 40px);\n border-radius: 50%;\n }\n .a2ui-image.a2ui-image-smallFeature {\n max-width: var(--a2ui-image-small-feature-size, 100px);\n }\n .a2ui-image.a2ui-image-largeFeature {\n max-height: var(--a2ui-image-large-feature-size, 400px);\n }\n .a2ui-image.a2ui-image-header {\n height: var(--a2ui-image-header-size, 200px);\n }\n `;var $A={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function Dl(r){return typeof r==\"object\"&&r!==null?`${r.basePath??\"\"}/${r.id}`:String(r)}var bi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[],n=e.listStyle,i=e.direction||\"vertical\",o=e.align?$A[e.align]??\"stretch\":void 0,s=o?nc({alignItems:o}):k;return n===\"ordered\"?F`\n <ol class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${bn(t,Dl,a=>F`<li>${this.renderNode(a)}</li>`)}\n </ol>\n `:n===\"unordered\"?F`\n <ul class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${bn(t,Dl,a=>F`<li>${this.renderNode(a)}</li>`)}\n </ul>\n `:F`\n <div class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${bn(t,Dl,a=>F`<div class=\"a2ui-list-item-none\">${this.renderNode(a)}</div>`)}\n </div>\n `}};bi.tagName=\"a2ui-list\";bi.styles=re`\n .a2ui-list {\n display: flex;\n padding-inline-start: var(--a2ui-list-padding, var(--a2ui-spacing-l, 24px));\n margin: 0;\n }\n .a2ui-list.a2ui-list-vertical {\n flex-direction: column;\n gap: var(--a2ui-list-gap, var(--a2ui-spacing-s, 8px));\n }\n .a2ui-list.a2ui-list-horizontal {\n flex-direction: row;\n gap: var(--a2ui-list-gap, var(--a2ui-spacing-m, 16px));\n list-style-position: inside;\n }\n .a2ui-list-item-none {\n display: block;\n }\n .a2ui-list-horizontal .a2ui-list-item-none {\n display: inline-block;\n }\n `;var IA=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},vn=class extends oe{constructor(){super(...arguments),this.isOpen=!1}openModal(){this.isOpen=!0}closeModal(){this.isOpen=!1}render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-modal-wrapper\">\n <div @click=${()=>this.openModal()} class=\"a2ui-modal-trigger\">\n ${e.trigger?F`${this.renderNode(e.trigger)}`:k}\n </div>\n ${this.isOpen?F`\n <div class=\"a2ui-modal-overlay\" @click=${()=>this.closeModal()}>\n <div\n class=\"a2ui-modal-content\"\n role=\"dialog\"\n aria-modal=\"true\"\n @click=${t=>t.stopPropagation()}\n >\n <button\n type=\"button\"\n class=\"a2ui-modal-close\"\n aria-label=\"Close\"\n @click=${()=>this.closeModal()}\n >\n ×\n </button>\n ${e.content?F`${this.renderNode(e.content)}`:k}\n </div>\n </div>\n `:k}\n </div>\n `:k}};vn.tagName=\"a2ui-modal\";vn.styles=re`\n :host,\n a2ui-modal {\n display: inline-block;\n }\n .a2ui-modal-wrapper {\n display: inline-block;\n }\n .a2ui-modal-trigger {\n cursor: pointer;\n }\n .a2ui-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: var(--a2ui-modal-backdrop-bg, rgba(0, 0, 0, 0.5));\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n }\n .a2ui-modal-content {\n background: var(--a2ui-modal-background, var(--a2ui-color-surface, #fff));\n padding: var(--a2ui-modal-padding, var(--a2ui-spacing-xl, 32px));\n border-radius: var(--a2ui-modal-border-radius, var(--a2ui-border-radius, 8px));\n position: relative;\n min-width: 300px;\n max-width: 80%;\n max-height: 80%;\n overflow-y: auto;\n box-shadow: var(--a2ui-modal-box-shadow, 0 10px 25px rgba(0, 0, 0, 0.2));\n }\n .a2ui-modal-close {\n position: absolute;\n top: 10px;\n right: 15px;\n border: none;\n background: none;\n font-size: 24px;\n cursor: pointer;\n color: var(--a2ui-text-caption-color, #999);\n }\n .a2ui-modal-close:hover {\n color: var(--a2ui-text-color, #333);\n }\n `;IA([ro()],vn.prototype,\"isOpen\",void 0);var FA={start:\"flex-start\",center:\"center\",end:\"flex-end\",spaceBetween:\"space-between\",spaceAround:\"space-around\",spaceEvenly:\"space-evenly\",stretch:\"stretch\"},RA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function OA(r){return typeof r==\"object\"&&r!==null?`${r.basePath??\"\"}/${r.id}`:String(r)}var vi=class extends oe{updated(e){super.updated(e);let t=this.controller.props;t&&(t.justify?this.style.justifyContent=FA[t.justify]??\"flex-start\":this.style.removeProperty(\"justify-content\"),t.align?this.style.alignItems=RA[t.align]??\"stretch\":this.style.removeProperty(\"align-items\"))}render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[];return F` ${bn(t,OA,n=>F`${this.renderNode(n)}`)} `}};vi.tagName=\"a2ui-basic-row\";vi.styles=re`\n :host,\n a2ui-basic-row {\n display: flex;\n flex-direction: row;\n gap: var(--a2ui-row-gap, var(--a2ui-spacing-m));\n }\n `;var _i=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.min??0,n=e.max??100,i=\"steps\"in e?e.steps:void 0,o=typeof i==\"number\"&&i>0&&n>t?(n-t)/i:k;return F`\n <div class=\"a2ui-slider-container\">\n <div class=\"a2ui-slider-header\">\n <span class=\"a2ui-slider-label\">${e.label}</span>\n <span class=\"a2ui-slider-value\">${e.value}</span>\n </div>\n <input\n type=\"range\"\n min=${t}\n max=${n}\n step=${o}\n .value=${e.value?.toString()||\"0\"}\n @input=${s=>e.setValue?.(Number(s.target.value))}\n class=\"a2ui-slider\"\n />\n ${this.renderValidationErrors(e)}\n </div>\n `}};_i.tagName=\"a2ui-slider\";_i.styles=re`\n .a2ui-slider-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 4px);\n margin: var(--a2ui-slider-margin, var(--a2ui-spacing-m, 16px));\n }\n .a2ui-slider-header {\n display: flex;\n justify-content: space-between;\n font-size: var(\n --a2ui-slider-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))\n );\n font-weight: var(--a2ui-slider-label-font-weight, bold);\n color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));\n }\n .a2ui-slider {\n width: 100%;\n cursor: pointer;\n accent-color: var(--a2ui-slider-thumb-color, var(--a2ui-color-primary, #007bff));\n background: var(--a2ui-slider-track-color, var(--a2ui-color-secondary, #e9ecef));\n }\n .a2ui-error-message {\n color: var(--a2ui-slider-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var NA=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_n=class extends oe{constructor(){super(...arguments),this.activeIndex=0}willUpdate(e){super.willUpdate(e);let t=this.controller?.props;t?.tabs&&this.activeIndex>=t.tabs.length&&(this.activeIndex=0)}render(){let e=this.controller?.props;return!e||!e.tabs?k:F`\n <div class=\"a2ui-tabs\">\n <div class=\"a2ui-tab-bar\">\n ${e.tabs?.map((t,n)=>F`\n <button\n class=${at({\"a2ui-tab-button\":!0,\"a2ui-tab-button-active\":n===this.activeIndex})}\n @click=${()=>this.activeIndex=n}\n >\n ${t.title}\n </button>\n `)}\n </div>\n <div class=\"a2ui-tab-content\">\n ${e.tabs[this.activeIndex]?F`${this.renderNode(e.tabs[this.activeIndex].child)}`:k}\n </div>\n </div>\n `}};_n.tagName=\"a2ui-tabs\";_n.styles=re`\n .a2ui-tabs {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n .a2ui-tab-bar {\n display: flex;\n border-bottom: var(--a2ui-tabs-border, 2px solid var(--a2ui-color-border, #eee));\n gap: var(--a2ui-spacing-m, 16px);\n }\n .a2ui-tab-button {\n padding: var(--a2ui-spacing-s, 8px) var(--a2ui-spacing-m, 16px);\n border: none;\n background: var(--a2ui-tabs-header-background, transparent);\n cursor: pointer;\n font-weight: 500;\n color: var(--a2ui-tabs-header-color, var(--a2ui-text-caption-color, #666));\n border-bottom: 2px solid transparent;\n margin-bottom: -2px;\n }\n .a2ui-tab-button.a2ui-tab-button-active {\n background: var(--a2ui-tabs-header-background-active, transparent);\n color: var(--a2ui-tabs-header-color-active, var(--a2ui-color-primary, #007bff));\n border-bottom: 2px solid var(--a2ui-color-primary, #007bff);\n }\n .a2ui-tab-content {\n padding: var(--a2ui-tabs-content-padding, var(--a2ui-spacing-m, 16px) 0);\n }\n `;NA([ro()],_n.prototype,\"activeIndex\",void 0);var xi=class extends Event{constructor(e,t,n,i){super(\"context-request\",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=i??!1}};var so=class{constructor(e,t,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,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=t,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 xi(this.context,this.host,this.t,this.subscribe))}};function Cl({context:r,subscribe:e}){return(t,n)=>{typeof n==\"object\"?n.addInitializer((function(){new so(this,{context:r,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new so(i,{context:r,callback:o=>{i[n]=o},subscribe:e})}))}}var om=Symbol.for(\"A2UIMarkdown\");var sm={markdown:om};var ms=(r,e)=>{let t=r._$AN;if(t===void 0)return!1;for(let n of t)n._$AO?.(e,!1),ms(n,e);return!0},ic=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},am=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),BA(e)}};function PA(r){this._$AN!==void 0?(ic(this),this._$AM=r,am(this)):this._$AM=r}function LA(r,e=!1,t=0){let n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let o=t;o<n.length;o++)ms(n[o],!1),ic(n[o]);else n!=null&&(ms(n,!1),ic(n));else ms(this,r)}var BA=r=>{r.type==pr.CHILD&&(r._$AP??=LA,r._$AQ??=PA)},oc=class extends pt{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),am(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(ms(this,e),ic(this))}setValue(e){if(Qh(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var gs=class extends pt{constructor(e){if(super(e),this.it=k,e.type!==pr.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===Ue)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 t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};gs.directiveName=\"unsafeHTML\",gs.resultType=1;var cm=xt(gs);var wl;function El(r){wl=r}var sc=class r extends oc{constructor(){super(...arguments),this.renderToken=0,this.lastValue=null,this.lastRenderer=void 0,this.lastTagClassMap=null}static resetWarningForTesting(){r.defaultMarkdownWarningLogged=!1}update(e,[t,n,i]){let o=n??wl,s=JSON.stringify(i?.tagClassMap);return this.lastValue===t&&this.lastRenderer===o&&s===this.lastTagClassMap?Ue:(this.lastValue=t,this.lastRenderer=o,this.lastTagClassMap=s,this.render(t,o,i))}render(e,t,n){let i=t??wl;if(i){let o=++this.renderToken;try{Promise.resolve(i(e,n)).then(s=>{this.isConnected&&o===this.renderToken&&this.setValue(cm(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 r.defaultMarkdownWarningLogged||(console.warn(\"[MarkdownDirective]\",`can't render markdown because no markdown renderer is configured.\n`,\"Use `@a2ui/markdown-it`, or your own markdown renderer.\"),r.defaultMarkdownWarningLogged=!0),F`<span class=\"no-markdown-renderer\">${e}</span>`}};sc.defaultMarkdownWarningLogged=!1;var Sl=xt(sc);var VA=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},UA=new Set([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\"]),xn=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.variant||\"body\",n=typeof e.text==\"string\"?e.text:String(e.text??\"\"),i=typeof e.weight==\"number\"?`flex: ${e.weight};`:k;if(UA.has(t)){let s=F`${n}`;switch(t){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-${t}\" style=${i}\n >${s}</span\n >`}let o=Sl(n,this.markdownRenderer);return F`<span class=\"a2ui-text a2ui-text-${t}\" style=${i}\n >${o}</span\n >`}};xn.tagName=\"a2ui-basic-text\";xn.styles=re`\n :host {\n display: contents;\n }\n .a2ui-text p,\n .a2ui-text h1,\n .a2ui-text h2,\n .a2ui-text h3,\n .a2ui-text h4,\n .a2ui-text h5,\n .a2ui-text h6,\n .a2ui-text ol,\n .a2ui-text ul,\n .a2ui-text li,\n .a2ui-text blockquote,\n .a2ui-text pre {\n margin: var(--_a2ui-text-margin, 0);\n }\n .a2ui-text {\n color: var(--_a2ui-text-color, var(--a2ui-text-color-text, var(--a2ui-color-on-background)));\n }\n .a2ui-text h1,\n .a2ui-text h2,\n .a2ui-text h3,\n .a2ui-text h4,\n .a2ui-text h5,\n .a2ui-text h6 {\n font-family: var(--a2ui-font-family-title, inherit);\n line-height: var(--a2ui-line-height-headings, 1.2);\n }\n .a2ui-text h1 {\n font-size: var(--a2ui-font-size-2xl);\n }\n .a2ui-text h2 {\n font-size: var(--a2ui-font-size-xl);\n }\n .a2ui-text h3 {\n font-size: var(--a2ui-font-size-l);\n }\n .a2ui-text p,\n .a2ui-text h4 {\n font-size: var(--a2ui-font-size-m);\n }\n .a2ui-text h5 {\n font-size: var(--a2ui-font-size-s);\n }\n .a2ui-text p {\n line-height: var(--a2ui-line-height-body, 1.5);\n }\n .a2ui-text.a2ui-text-caption {\n font-size: var(--a2ui-font-size-xs);\n color: var(--a2ui-text-caption-color, light-dark(#666, #aaa));\n }\n .a2ui-text a {\n color: var(--a2ui-text-a-color, inherit);\n font-weight: var(--a2ui-text-a-font-weight, inherit);\n }\n `;VA([Cl({context:sm.markdown,subscribe:!0})],xn.prototype,\"markdownRenderer\",void 0);var Ai=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=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\":t},s=\"placeholder\"in e&&e.placeholder||k;return F`\n ${e.label?F`<label>${e.label}</label>`:k}\n ${e.variant===\"longText\"?F`<textarea\n class=${at(o)}\n placeholder=${s}\n .value=${e.value||\"\"}\n @input=${n}\n ></textarea>`:F`<input\n type=${i}\n class=${at(o)}\n placeholder=${s}\n .value=${e.value||\"\"}\n @input=${n}\n />`}\n ${this.renderValidationErrors(e)}\n `}};Ai.tagName=\"a2ui-basic-textfield\";Ai.styles=re`\n :host,\n a2ui-basic-textfield {\n display: flex;\n flex-direction: column;\n width: var(--a2ui-textfield-width, 100%);\n gap: var(--a2ui-spacing-xs, 0.25rem);\n }\n .a2ui-textfield {\n box-sizing: border-box;\n width: 100%;\n background-color: var(--a2ui-color-input, #fff);\n color: var(--a2ui-color-on-input, #333);\n border: var(--a2ui-textfield-border, var(--a2ui-border));\n border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m));\n padding: var(--a2ui-textfield-padding, var(--a2ui-spacing-m));\n font-family: inherit;\n }\n .a2ui-textfield:focus {\n outline: none;\n border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));\n }\n .a2ui-textfield.a2ui-invalid {\n border-color: var(--a2ui-textfield-color-error, red);\n }\n label {\n font-size: var(\n --a2ui-textfield-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-textfield-label-font-weight, var(--a2ui-label-font-weight, bold));\n }\n .a2ui-error-message {\n color: var(--a2ui-textfield-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var Di=class extends oe{render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-video-container\">\n <video\n src=${e.url||k}\n poster=${\"posterUrl\"in e&&e.posterUrl||k}\n controls\n class=\"a2ui-video\"\n >\n Your browser does not support the video tag.\n </video>\n </div>\n `:k}};Di.tagName=\"a2ui-video\";Di.styles=re`\n .a2ui-video-container {\n width: 100%;\n max-width: 100%;\n }\n .a2ui-video {\n width: 100%;\n height: auto;\n display: block;\n border-radius: var(--a2ui-video-border-radius, 0);\n }\n `;var ue=du(\"CatalogComponentCommon\",d.object({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.\").optional()})),zA=du(\"theme\",d.object({primaryColor:d.string().regex(new RegExp(\"^#[0-9a-fA-F]{6}$\")).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 (e.g., '#00BFFF').\").optional(),iconUrl:X(d.string().describe(\"A URL for an image that identifies the agent or tool associated with the surface.\"),{keywords:{format:\"uri\"}}).optional(),agentDisplayName:d.string().describe(\"Text to be displayed next to the surface to identify the agent or tool that created it.\").optional()}),{keywords:{additionalProperties:!0}}),um={name:\"Text\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),text:fe.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([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\",\"body\"]).default(\"body\").describe(\"A hint for the base text style.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},lm={name:\"Image\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the image to display.\"),description:fe.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()}).strict(),{mixins:[\"ComponentCommon\",ue]})},dm={name:\"Icon\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),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\"]),X(d.object({svgPath:d.string()}),{closure:\"additionalProperties\"}),pn.describe(\"REF:#/$defs/DataBinding\")]).describe(\"The name of the icon to display.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},fm={name:\"Video\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the video to display.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},pm={name:\"AudioPlayer\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the audio to be played.\"),description:fe.describe(\"REF:#/$defs/DynamicString|A description of the audio, such as a title or summary.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},hm={name:\"Row\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:ss.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()}).describe(\"A layout component that arranges its children horizontally. To create a grid layout, nest Columns within this Row.\").strict(),{mixins:[\"ComponentCommon\",ue]})},mm={name:\"Column\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:ss.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()}).describe(\"A layout component that arranges its children vertically. To create a grid layout, nest Rows within this Column.\").strict(),{mixins:[\"ComponentCommon\",ue]})},gm={name:\"List\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:ss.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()}).strict(),{mixins:[\"ComponentCommon\",ue]})},ym={name:\"Card\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),child:ur.describe(\"REF:#/$defs/ComponentId|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.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},bm={name:\"Tabs\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),tabs:d.array(X(d.object({title:fe.describe(\"REF:#/$defs/DynamicString|The tab title.\"),child:ur.describe(\"REF:#/$defs/ComponentId|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.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},vm={name:\"Modal\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),trigger:ur.describe(\"REF:#/$defs/ComponentId|The ID of the component that opens the modal when interacted with (e.g., a button).\"),content:ur.describe(\"REF:#/$defs/ComponentId|The ID of the component to be displayed inside the modal.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},_m={name:\"Divider\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),axis:d.enum([\"horizontal\",\"vertical\"]).default(\"horizontal\").describe(\"The orientation of the divider.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},xm={name:\"Button\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(Nr.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),child:ur.describe(\"REF:#/$defs/ComponentId|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:ll.describe(\"REF:#/$defs/Action\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Am={name:\"TextField\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(Nr.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text label for the input field.\"),value:fe.describe(\"REF:#/$defs/DynamicString|The value of the text field.\").optional(),variant:d.enum([\"longText\",\"number\",\"shortText\",\"obscured\"]).default(\"shortText\").describe(\"The type of input field to display.\").optional(),validationRegexp:d.string().describe(\"A regular expression used for client-side validation of the input.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Dm={name:\"CheckBox\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(Nr.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text to display next to the checkbox.\"),value:dr.describe(\"REF:#/$defs/DynamicBoolean|The current state of the checkbox (true for checked, false for unchecked).\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Cm={name:\"ChoicePicker\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(Nr.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.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(X(d.object({label:fe.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:ul.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()}).describe(\"A component that allows selecting one or more options from a list.\").strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},wm={name:\"Slider\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(Nr.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.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:lr.describe(\"REF:#/$defs/DynamicNumber|The current value of the slider.\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"],required:[\"value\",\"max\"]})},Em={name:\"DateTimeInput\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(Nr.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),value:fe.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:X(fe.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:X(fe.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:fe.describe(\"REF:#/$defs/DynamicString|The text label for the input field.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})};var Sm={schemaUri:\"https://json-schema.org/draft/2020-12/schema\",schemaId:\"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json\",title:\"A2UI Basic Catalog\",description:\"Unified catalog of basic A2UI components and functions.\",declaredProtocolVersion:null,commonTypesUri:\"https://a2ui.org/specification/v0_9/common_types.json\",defModels:[zA]};var Tm=$e(ui,pm),km=$e(li,xm),$m=$e(di,ym),Im=$e(fi,Dm),Fm=$e(gn,Cm),Rm=$e(pi,mm),Om=$e(hi,Em),Nm=$e(mi,_m),Mm=$e(gi,dm),jm=$e(yi,lm),Pm=$e(bi,gm),Lm=$e(vn,vm),Bm=$e(vi,hm),Vm=$e(_i,wm),Um=$e(_n,bm),zm=$e(xn,um),qm=$e(Ai,Am),Zm=$e(Di,fm);var Wm={name:\"required\",returnType:\"boolean\",description:\"Checks that the value is not null, undefined, or empty.\",schema:X(d.object({value:d.any().refine(r=>r!==void 0,\"Required\").describe(\"The value to check.\")}),{closure:\"additionalProperties\"})},Hm={name:\"regex\",returnType:\"boolean\",description:\"Checks that the value matches a regular expression string.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\"),pattern:d.string().describe(\"The regex pattern to match against.\")}),{closure:\"unevaluatedProperties\"})},Gm={name:\"length\",returnType:\"boolean\",description:\"Checks string length constraints.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\"),min:X(d.number().int().describe(\"The minimum allowed length.\"),{keywords:{minimum:0}}).optional(),max:X(d.number().int().describe(\"The maximum allowed length.\"),{keywords:{minimum:0}}).optional()}),{closure:\"unevaluatedProperties\",keywords:{anyOf:[{required:[\"min\"]},{required:[\"max\"]}]}})},Km={name:\"numeric\",returnType:\"boolean\",description:\"Checks numeric range constraints.\",schema:X(d.object({value:lr.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\"]}]}})},Jm={name:\"email\",returnType:\"boolean\",description:\"Checks that the value is a valid email address.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\")}),{closure:\"unevaluatedProperties\"})},Ym={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 client-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:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\")}),{closure:\"unevaluatedProperties\"})},Xm={name:\"formatNumber\",returnType:\"string\",description:\"Formats a number with the specified grouping and decimal precision.\",schema:X(d.object({value:lr.describe(\"REF:#/$defs/DynamicNumber|The number to format.\"),decimals:lr.describe(\"REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.\").optional(),grouping:dr.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\"})},Qm={name:\"formatCurrency\",returnType:\"string\",description:\"Formats a number as a currency string.\",schema:X(d.object({value:lr.describe(\"REF:#/$defs/DynamicNumber|The monetary amount.\"),currency:fe.describe(\"REF:#/$defs/DynamicString|The ISO 4217 currency code (e.g., 'USD', 'EUR').\"),decimals:lr.describe(\"REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.\").optional(),grouping:dr.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\"})},eg={name:\"formatDate\",returnType:\"string\",description:\"Formats a timestamp into a string using a pattern.\",schema:X(d.object({value:os.describe(\"REF:#/$defs/DynamicValue|The date to format.\"),format:fe.describe(`REF:#/$defs/DynamicString|A Unicode TR35 date pattern string.\n\nToken Reference:\n- Year: 'yy' (26), 'yyyy' (2026)\n- Month: 'M' (1), 'MM' (01), 'MMM' (Jan), 'MMMM' (January)\n- Day: 'd' (1), 'dd' (01), 'E' (Tue), 'EEEE' (Tuesday)\n- Hour (12h): 'h' (1-12), 'hh' (01-12) - requires 'a' for AM/PM\n- Hour (24h): 'H' (0-23), 'HH' (00-23) - Military Time\n- Minute: 'mm' (00-59)\n- Second: 'ss' (00-59)\n- Period: 'a' (AM/PM)\n\nExamples:\n- 'MMM dd, yyyy' -> 'Jan 16, 2026'\n- 'HH:mm' -> '14:30' (Military)\n- 'h:mm a' -> '2:30 PM'\n- 'EEEE, d MMMM' -> 'Friday, 16 January'`)}),{required:[\"format\",\"value\"],closure:\"unevaluatedProperties\"})},tg={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:X(d.object({value:lr.describe(\"REF:#/$defs/DynamicNumber|The numeric value used to determine the plural category.\"),zero:fe.describe(\"REF:#/$defs/DynamicString|String for the 'zero' category (e.g., 0 items).\").optional(),one:fe.describe(\"REF:#/$defs/DynamicString|String for the 'one' category (e.g., 1 item).\").optional(),two:fe.describe(\"REF:#/$defs/DynamicString|String for the 'two' category (used in Arabic, Welsh, etc.).\").optional(),few:fe.describe(\"REF:#/$defs/DynamicString|String for the 'few' category (e.g., small groups in Slavic languages).\").optional(),many:fe.describe(\"REF:#/$defs/DynamicString|String for the 'many' category (e.g., large groups in various languages).\").optional(),other:fe.describe(\"REF:#/$defs/DynamicString|The default/fallback string (used for general plural cases).\")}),{closure:\"unevaluatedProperties\"})},rg={name:\"openUrl\",returnType:\"void\",description:\"Opens the specified URL in a browser or handler. This function has no return value.\",schema:X(d.object({url:X(d.string().describe(\"The URL to open.\"),{keywords:{format:\"uri\"}})}),{closure:\"additionalProperties\"})},ng={name:\"and\",returnType:\"boolean\",description:\"Performs a logical AND operation on a list of boolean values.\",schema:X(d.object({values:d.array(dr.describe(\"REF:#/$defs/DynamicBoolean\")).min(2).describe(\"The list of boolean values to evaluate.\")}),{closure:\"unevaluatedProperties\"})},ig={name:\"or\",returnType:\"boolean\",description:\"Performs a logical OR operation on a list of boolean values.\",schema:X(d.object({values:d.array(dr.describe(\"REF:#/$defs/DynamicBoolean\")).min(2).describe(\"The list of boolean values to evaluate.\")}),{closure:\"unevaluatedProperties\"})},og={name:\"not\",returnType:\"boolean\",description:\"Performs a logical NOT operation on a boolean value.\",schema:X(d.object({value:dr.describe(\"REF:#/$defs/DynamicBoolean|The boolean value to negate.\")}),{closure:\"unevaluatedProperties\"})};var sg=1e4,ag=1e3,qA=/^[+-]?(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,ys=class r{parse(e,t=0){if(t>r.MAX_DEPTH)throw new de(\"Max recursion depth reached in parse\");if(e&&e.length>sg)throw new de(`Expression template length (${e.length}) exceeds maximum limit (${sg})`);if(!e)return[];if(!e.includes(\"${\"))return[e];let n=[],i=new ac(e);for(;!i.isAtEnd();){if(n.length>=ag)throw new de(`Expression parts count exceeds maximum limit (${ag})`);if(i.matches(\"${\")){i.advance(2);let o=this.extractInterpolationContent(i),s=this.parseExpression(o,t+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 t=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 de(\"Unclosed interpolation: missing '}'\");return e.input.substring(t,e.pos-1)}parseExpression(e,t=0){if(e=e.trim(),!e)return\"\";let n=new ac(e),i=this.parseExpressionInternal(n,t);if(!n.isAtEnd())throw new de(`Unexpected characters at end of expression: '${n.input.substring(n.pos)}'`);return i}parseExpressionInternal(e,t){if(t>r.MAX_DEPTH)throw new de(\"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,t+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);return e.skipWhitespace(),e.peek()===\"(\"?this.parseFunctionCall(n,e,t):n?{path:n}:\"\"}scanPathOrIdentifier(e){let t=e.pos;for(;!e.isAtEnd();){let n=e.peek();if(Tl(n)||n===\"/\"||n===\".\"||n===\"-\")e.advance();else break}return e.input.substring(t,e.pos)}parseFunctionCall(e,t,n){t.match(\"(\"),t.skipWhitespace();let i={};for(;!t.isAtEnd()&&t.peek()!==\")\";){let o=this.scanIdentifier(t);if(t.skipWhitespace(),!t.match(\":\"))throw new de(`Expected ':' after argument name '${o}' in function '${e}'`);t.skipWhitespace(),i[o]=this.parseExpressionInternal(t,n+1),t.skipWhitespace(),t.peek()===\",\"&&(t.advance(),t.skipWhitespace())}if(!t.match(\")\"))throw new de(`Expected ')' after function arguments for '${e}'`);return{call:e,args:i,returnType:\"any\"}}scanIdentifier(e){let t=e.pos;for(;!e.isAtEnd()&&Tl(e.peek());)e.advance();return e.input.substring(t,e.pos)}parseStringLiteral(e){let t=e.advance(),n=\"\";for(;!e.isAtEnd();){let i=e.advance();if(i===\"\\\\\"){let o=e.advance();o===\"n\"?n+=`\n`:o===\"t\"?n+=\"\t\":o===\"r\"?n+=\"\\r\":n+=o}else{if(i===t)break;n+=i}}return n}isNumberStart(e){let t=0;return(e.peek()===\"-\"||e.peek()===\"+\")&&(t=1),this.isDigit(e.peek(t))?!0:e.peek(t)===\".\"&&this.isDigit(e.peek(t+1))}parseNumberLiteral(e){let t=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(t,e.pos);if(!qA.test(n))throw new de(`Invalid number literal: '${n}'`);let i=Number(n);if(!Number.isFinite(i))throw new de(`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\"}};ys.MAX_DEPTH=100;var ZA=/^\\p{XID_Continue}$/u;function Tl(r){return Array.from(r).length!==1?!1:ZA.test(r)}var ac=class{constructor(e){this.input=e,this.pos=0}isAtEnd(){return this.pos>=this.input.length}peek(e=0){let t=this.pos+e;if(t>=this.input.length)return\"\\0\";let n=this.input.codePointAt(t);return n===void 0?\"\\0\":String.fromCodePoint(n)}advance(e){let t=e??(this.peek()===\"\\0\"?1:this.peek().length),n=this.input.substring(this.pos,this.pos+t);return this.pos+=t,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 t=this.peek(e.length);if(!Tl(t))return this.advance(e.length),!0}return!1}skipWhitespace(){for(;!this.isAtEnd()&&/\\s/.test(this.peek());)this.advance()}};var Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Oe.apply(this,arguments)};function xe(r,e){var t={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]&&(t=0)),t;)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 t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}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 ze(r){var e=typeof Symbol==\"function\"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length==\"number\")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}function q(r,e){var t=typeof Symbol==\"function\"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),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&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}function L(r,e,t){if(t||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 r.concat(o||Array.prototype.slice.call(e))}var yg={exports:{}};(function(r){(function(){var e=String.fromCodePoint||(function(){var i=String.fromCharCode,o=Math.floor;return function(){var a=16384,c=[],u,l,p=-1,f=arguments.length;if(!f)return\"\";for(var m=\"\";++p<f;){var g=Number(arguments[p]);if(!isFinite(g)||g<0||g>1114111||o(g)!=g)throw RangeError(\"Invalid code point: \"+g);g<=65535?c.push(g):(g-=65536,u=(g>>10)+55296,l=g%1024+56320,c.push(u,l)),(p+1==f||c.length>a)&&(m+=i.apply(null,c),c.length=0)}return m}})();function t(i,o,s){s||(s={});function a(y,_){return y.range[0]=_,y.raw=i.substring(_,y.range[1]),y}function c(y,_){return{type:\"anchor\",kind:y,range:[w-_,w],raw:i.substring(w-_,w)}}function u(y,_,A,D){return{type:\"value\",kind:y,codePoint:_,range:[A,D],raw:i.substring(A,D)}}function l(y,_,A,D){return D=D||0,u(y,_,w-(A.length+D),w)}function p(y){var _=y[0],A=_.charCodeAt(0);if(Ee){var D;if(_.length===1&&A>=55296&&A<=56319&&(D=Z().charCodeAt(0),D>=56320&&D<=57343))return w++,u(\"symbol\",(A-55296)*1024+D-56320+65536,w-2,w)}return u(\"symbol\",A,w-1,w)}function f(y,_,A){return{type:\"disjunction\",body:y,range:[_,A],raw:i.substring(_,A)}}function m(){return{type:\"dot\",range:[w-1,w],raw:\".\"}}function g(y){return{type:\"characterClassEscape\",value:y,range:[w-2,w],raw:i.substring(w-2,w)}}function h(y){var _=w-1-y.length;return{type:\"reference\",matchIndex:parseInt(y,10),range:[_,w],raw:i.substring(_,w)}}function b(y){var _=y.range[0]-3;return{type:\"reference\",name:y,range:[_,w],raw:i.substring(_,w)}}function v(y,_,A,D){return{type:\"group\",behavior:y,body:_,range:[A,D],raw:i.substring(A,D)}}function x(y,_,A,D,G){return D==null&&(A=w-1,D=w),{type:\"quantifier\",min:y,max:_,greedy:!0,body:null,symbol:G,range:[A,D],raw:i.substring(A,D)}}function $(y,_,A){return{type:\"alternative\",body:y,range:[_,A],raw:i.substring(_,A)}}function V(y,_,A,D){return{type:\"characterClass\",kind:y.kind,body:y.body,negative:_,range:[A,D],raw:i.substring(A,D)}}function S(y,_,A,D){return y.codePoint>_.codePoint&&ie(\"invalid range in character class\",y.raw+\"-\"+_.raw,A,D),{type:\"characterClassRange\",min:y,max:_,range:[A,D],raw:i.substring(A,D)}}function N(y,_,A){return{type:\"classStrings\",strings:y,range:[_,A],raw:i.substring(_,A)}}function P(y,_,A){return{type:\"classString\",characters:y,range:[_,A],raw:i.substring(_,A)}}function B(y){return y.type===\"alternative\"?y.body:[y]}function O(y){y=y||1,w+=y}function J(y){var _=i.substring(w,w+=y);return _}function Y(y){se(y)||ie(\"character\",y)}function se(y){var _=y.length;if(i.substring(w,w+_)===y)return O(_),y}function ae(y){if(i[w]===y)return w++,y}function Z(){return i[w]}function te(y){return i[w]===y}function mt(y){var _=y.length;return i.substring(w,w+_)===y}function je(y){return i[w+1]===y}function pe(y){var _=i.substring(w),A=_.match(y);return A&&(w+=A[0].length),A}function ct(){var y=[],_=w;for(y.push(We());ae(\"|\");)y.push(We());return y.length===1?y[0]:f(y,_,w)}function We(){for(var y=[],_=w,A;A=ut();)y.push(A);return y.length===1?y[0]:$(y,_,w)}function ut(){if(w>=i.length||te(\"|\")||te(\")\"))return null;var y=br(),_;if(y){var A=w;if(_=Mt()||!1,_){if(!Ee&&y.type===\"group\")return _.body=B(y),a(_,y.range[0]),_;w=A,ie(\"Expected atom\")}return y}var D=Qe();if(D||(A=w,_=Mt()||!1,_&&(w=A,ie(\"Expected atom\")),!Ee&&ae(\"{\")?D=p(\"{\"):ie(\"Expected atom\")),_=Mt()||!1,_){var G=D.type,he=D.behavior;return G===\"group\"&&(he===\"negativeLookbehind\"||he===\"lookbehind\")&&ie(\"Invalid quantifier\",\"\",_.range[0],_.range[1]),_.body=B(D),a(_,D.range[0]),_}return D}function Ct(y,_,A,D){var G=null,he=w;if(se(y))G=_;else if(se(A))G=D;else return!1;return me(G,he)}function me(y,_){var A=ct();A||ie(\"Expected disjunction\"),Y(\")\");var D=v(y,B(A),_,w);return y==\"normal\"&&Oi&&Ur++,D}function br(){switch(Z()){case\"^\":return O(),c(\"start\",1);case\"$\":return O(),c(\"end\",1);case\"\\\\\":{if(je(\"b\"))return O(2),c(\"boundary\",2);if(je(\"B\"))return O(2),c(\"not-boundary\",2);break}case\"(\":return Ct(\"(?=\",\"lookahead\",\"(?!\",\"negativeLookahead\");default:return}}function Mt(){var y,_=w,A,D,G;switch(Z()){case\"*\":O(),A=x(0,void 0,void 0,void 0,\"*\");break;case\"+\":O(),A=x(1,void 0,void 0,void 0,\"+\");break;case\"?\":O(),A=x(0,1,void 0,void 0,\"?\");break;case\"{\":(y=pe(/^\\{(\\d+)\\}/))?(D=parseInt(y[1],10),A=x(D,D,_,w)):(y=pe(/^\\{(\\d+),\\}/))?(D=parseInt(y[1],10),A=x(D,void 0,_,w)):(y=pe(/^\\{(\\d+),(\\d+)\\}/))&&(D=parseInt(y[1],10),G=parseInt(y[2],10),D>G&&ie(\"numbers out of order in {} quantifier\",\"\",_,w),A=x(D,G,_,w)),(D&&!Number.isSafeInteger(D)||G&&!Number.isSafeInteger(G))&&ie(\"iterations outside JS safe integer range in quantifier\",\"\",_,w)}return A&&ae(\"?\")&&(A.greedy=!1,A.range[1]+=1),A}function Qe(){var y;switch(y=Z()){case\".\":return O(),m();case\"\\\\\":{if(O(),y=vr(),!y){if(!Ee&&Z()==\"c\")return u(\"symbol\",92,w-1,w);ie(\"atomEscape\")}return y}case\"[\":return jt();case\"(\":{if(s.lookbehind&&(y=Ct(\"(?<=\",\"lookbehind\",\"(?<!\",\"negativeLookbehind\")))return y;if(s.namedGroups&&se(\"(?<\")){var _=Te();Y(\">\");var A=me(\"normal\",_.range[0]-3);return A.name=_,A}else return s.modifiers&&mt(\"(?\")&&i[w+2]!=\":\"?Kt():Ct(\"(?:\",\"ignore\",\"(\",\"normal\")}case\"]\":case\"}\":if(!Ee)return O(),p(y);break;case\"^\":case\"$\":case\"*\":case\"+\":case\"?\":case\"{\":case\")\":case\"|\":break;default:return O(),p(y)}}function Kt(){function y(tt){for(var Lt=0;Lt<tt.length;){if(tt.indexOf(tt[Lt],Lt+1)!=-1)return!0;Lt++}return!1}var _=w;O(2);var A=pe(/^[sim]+/),D;ae(\"-\")&&Z()!==\":\"?(D=pe(/^[sim]+/),D||ie(\"Invalid flags for modifiers group\")):A||ie(\"Invalid flags for modifiers group\"),A=A?A[0]:\"\",D=D?D[0]:\"\";var G=A+D;(G.length>3||y(G))&&ie(\"flags cannot be duplicated for modifiers group\"),ae(\":\")||ie(\"Invalid flags for modifiers group\");var he=me(\"ignore\",_);return he.modifierFlags={enabling:A,disabling:D},he}function lt(y,_){if(_){var A,D;if(y.kind==\"unicodeEscape\"&&(A=y.codePoint)>=55296&&A<=56319&&te(\"\\\\\")&&je(\"u\")){var G=w;w++;var he=et();he.kind==\"unicodeEscape\"&&(D=he.codePoint)>=56320&&D<=57343?(y.kind=\"unicodeCodePointEscape\",y.codePoint=(A-55296)*1024+D-56320+65536,y.range[1]=w,y.raw=i.substring(y.range[0],w)):w=G}}return y}function et(){return vr(!0)}function vr(y){var _,A=w,D;switch(D=Z()){case\"0\":case\"1\":case\"2\":case\"3\":case\"4\":case\"5\":case\"6\":case\"7\":case\"8\":case\"9\":return Jt(y);case\"B\":if(y){ie(\"\\\\B not possible inside of CharacterClass\",\"\",A);break}else return St();case\"b\":return y?(O(),l(\"singleEscape\",8,\"\\\\b\")):St();case\"c\":{if(y){if(!Ee&&(_=pe(/^c(\\d)/)))return l(\"controlLetter\",_[1]+16,_[1],2);if(!Ee&&se(\"c_\"))return l(\"controlLetter\",31,\"_\",2)}return wt()}case\"d\":case\"D\":case\"w\":case\"W\":case\"s\":case\"S\":return O(),g(D);case\"k\":return En()||St();case\"p\":case\"P\":return Yt()||St();case\"-\":return y&&Ee?(O(),l(\"singleEscape\",45,\"\\\\-\")):St();default:return wt()}}function Jt(y){var _,A,D=w;if(_=pe(/^(?!0)\\d+/)){A=_[0];var G=parseInt(_[0],10);if(G<=Ur&&!y)return h(_[0]);if(So.push(G),Oi?Sn=!0:He(D,w),O(-_[0].length),_=pe(/^[0-7]{1,3}/))return l(\"octal\",parseInt(_[0],8),_[0],1);var he=w;return _=p(pe(/^[89]/)),a(_,he-1)}else if(_=pe(/^[0-7]{1,3}/))return A=_[0],A!==\"0\"&&He(D,w),/^0{1,3}$/.test(A)?l(\"null\",0,\"0\",A.length):l(\"octal\",parseInt(A,8),A,1);return!1}function He(y,_){Ee&&ie(\"Invalid decimal escape in unicode mode\",null,y,_)}function Yt(){var y,_=w;return s.unicodePropertyEscape&&Ee&&(y=pe(/^([pP])\\{([^}]+)\\}/))?{type:\"unicodePropertyEscape\",negative:y[1]===\"P\",value:y[2],range:[_-1,w],raw:i.substring(_-1,w)}:!1}function En(){if(s.namedGroups&&pe(/^k<(?=.*?>)/)){var y=Te();return Y(\">\"),b(y)}}function Xt(y){var _;if(_=pe(/^u([0-9a-fA-F]{4})/))return lt(l(\"unicodeEscape\",parseInt(_[1],16),_[1],2),y);if(y&&(_=pe(/^u\\{([0-9a-fA-F]+)\\}/)))return l(\"unicodeCodePointEscape\",parseInt(_[1],16),_[1],4)}function wt(){var y,_=w;switch(Z()){case\"t\":return O(),l(\"singleEscape\",9,\"\\\\t\");case\"n\":return O(),l(\"singleEscape\",10,\"\\\\n\");case\"v\":return O(),l(\"singleEscape\",11,\"\\\\v\");case\"f\":return O(),l(\"singleEscape\",12,\"\\\\f\");case\"r\":return O(),l(\"singleEscape\",13,\"\\\\r\");case\"c\":if(y=pe(/^c([a-zA-Z])/))return l(\"controlLetter\",y[1].charCodeAt(0)%32,y[1],2);break;case\"x\":if(y=pe(/^x([0-9a-fA-F]{2})/))return l(\"hexadecimalEscape\",parseInt(y[1],16),y[1],2);break;case\"u\":if(y=Xt(Ee))return(!y||y.codePoint>1114111)&&ie(\"Invalid escape sequence\",null,_,w),y;break}return St()}function gt(y){var _=Z(),A=w;if(_===\"\\\\\"){O();var D=Xt(!0);return(!D||!y(D.codePoint))&&ie(\"Invalid escape sequence\",null,A,w),e(D.codePoint)}var G=_.charCodeAt(0);if(G>=55296&&G<=56319){_+=i[w+1];var he=_.charCodeAt(1);he>=56320&&he<=57343&&(G=(G-55296)*1024+he-56320+65536)}if(y(G))return O(),G>65535&&O(),_}function Te(){var y=w,_=gt(Ce);_||ie(\"Invalid identifier\");for(var A;A=gt(Et);)_+=A;return{type:\"identifier\",value:_,range:[y,w],raw:i.substring(y,w)}}function Ce(y){var _=/[\\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 y===36||y===95||y>=65&&y<=90||y>=97&&y<=122||y>=128&&_.test(e(y))}function Et(y){var _=/[\\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 Ce(y)||y>=48&&y<=57||y>=128&&_.test(e(y))}function St(){var y,_=Z();return Ee&&/[\\^$.*+?()\\\\[\\]{}|/]/.test(_)||!Ee&&_!==\"c\"?_===\"k\"&&s.lookbehind?null:(y=J(1),l(\"identifier\",y.charCodeAt(0),y,1)):null}function jt(){var y,_=w;return(y=se(\"[^\"))?(y=Tt(),Y(\"]\"),V(y,!0,_,w)):ae(\"[\")?(y=Tt(),Y(\"]\"),V(y,!1,_,w)):null}function Tt(){var y;return te(\"]\")?{kind:\"union\",body:[]}:kn?Ps():(y=Ns(),y||ie(\"nonEmptyClassRanges\"),{kind:\"union\",body:y})}function Pe(y){var _,A,D,G,he;if(te(\"-\")&&!je(\"]\")){_=y.range[0],O(),he=p(\"-\"),G=Pt(),G||ie(\"classAtom\"),A=w;var tt=Tt();return tt||ie(\"classContents\"),!(\"codePoint\"in y)||!(\"codePoint\"in G)?Ee?ie(\"invalid character class\"):D=[y,he,G]:D=[S(y,G,_,A)],tt.type===\"empty\"?D:D.concat(tt.body)}return D=Ms(),D||ie(\"nonEmptyClassRangesNoDash\"),[y].concat(D)}function Ns(){var y=Pt();return y||ie(\"classAtom\"),te(\"]\")?[y]:Pe(y)}function Ms(){var y=Pt();return y||ie(\"classAtom\"),te(\"]\")?y:Pe(y)}function Pt(){return ae(\"-\")?p(\"-\"):js()}function js(){var y;switch(y=Z()){case\"\\\\\":{if(O(),y=et(),!y){if(!Ee&&Z()==\"c\")return p(\"\\\\\");ie(\"classEscape\")}return lt(y,Ee)}case\"]\":case\"-\":break;default:return O(),p(y)}}function Ps(){var y=[],_,A=$i(!0);for(y.push(A),A.type===\"classRange\"?_=\"union\":te(\"&\")?_=\"intersection\":te(\"-\")?_=\"subtraction\":_=\"union\";!te(\"]\");)_===\"intersection\"?(Y(\"&\"),Y(\"&\"),te(\"&\")&&ie(\"&& cannot be followed by &. Wrap it in brackets: &&[&].\")):_===\"subtraction\"&&(Y(\"-\"),Y(\"-\")),A=$i(_===\"union\"),y.push(A);return{kind:_,body:y}}function $i(y){var _=w,A,D;if(ae(\"\\\\\")){if(se(\"q{\"))return Ls();if(D=et())A=D;else{if(D=Eo())return D;ie(\"Invalid escape\",\"\\\\\"+Z(),_)}}else if(D=Fi())A=D;else{if(D=jt())return D;ie(\"Invalid character\",Z())}if(y&&te(\"-\")&&!je(\"-\")){if(O(),D=Ii())return S(A,D,_,w);ie(\"Invalid range end\",Z())}return A}function Ii(){if(ae(\"\\\\\")){var y,_=w;if(y=Eo())return y;ie(\"Invalid escape\",\"\\\\\"+Z(),_)}return Fi()}function Fi(){var y;if(pe(/^(?:&&|!!|##|\\$\\$|%%|\\*\\*|\\+\\+|,,|\\.\\.|::|;;|<<|==|>>|\\?\\?|@@|\\^\\^|``|~~)/)&&ie(\"Invalid set operation in character class\"),y=pe(/^[^()[\\]{}/\\-\\\\|]/))return p(y)}function Eo(){var y;if(ae(\"b\"))return l(\"singleEscape\",8,\"\\\\b\");if(ae(\"B\"))ie(\"\\\\B not possible inside of ClassContents\",\"\",w-2);else return(y=pe(/^[&\\-!#%,:;<=>@`~]/))?l(\"identifier\",y[0].codePointAt(0),y[0]):(y=wt())?y:null}function Ls(){var y=w-3,_=[];do _.push(Ri());while(ae(\"|\"));return Y(\"}\"),N(_,y,w)}function Ri(){for(var y=[],_=w,A;A=Ii();)y.push(A);return P(y,_,w)}function ie(y,_,A,D){A=A??w,D=D??A;var G=Math.max(0,A-10),he=Math.min(D+10,i.length),tt=\" \"+i.substring(G,he),Lt=\" \"+new Array(A-G+1).join(\" \")+\"^\";throw SyntaxError(y+\" at position \"+A+(_?\": \"+_:\"\")+`\n`+tt+`\n`+Lt)}var So=[],Ur=0,Oi=!0,Sn=!1,Tn=(o||\"\").indexOf(\"u\")!==-1,kn=(o||\"\").indexOf(\"v\")!==-1,Ee=Tn||kn,w=0;if(kn&&!s.unicodeSet)throw new Error('The \"v\" flag is only supported when the .unicodeSet option is enabled.');if(Tn&&kn)throw new Error('The \"u\" and \"v\" flags are mutually exclusive.');i=String(i),i===\"\"&&(i=\"(?:)\");var zr=ct();return zr.range[1]!==i.length&&ie(\"Could not parse entire input - got stuck\",\"\",zr.range[1]),Sn=Sn||So.some(function(y){return y<=Ur}),Sn?(w=0,Oi=!1,ct()):zr}var n={parse:t};r.exports?r.exports=n:window.regjsparser=n})()})(yg);var WA=yg.exports;function bg(r,e){var t=WA.parse(r,e?\"u\":\"\",{lookbehind:!0,unicodePropertyEscape:!0});return t}function kl(r){var e=r.length;return e?r[e-1]:null}function vg(r,e){var t;for(t=0;t<r.length&&t<e.length&&r[t]===e[t];t++);return{a:r.slice(t),b:e.slice(t)}}var cg=[\"lookahead\",\"lookbehind\",\"negativeLookahead\",\"negativeLookbehind\"];function HA(r,e,t,n){return\"\".concat(r.slice(0,t)).concat(e).concat(r.slice(n))}function ug(r){var e=r.after,t=r.offsets,n=r.shiftAmount;return new Set(L([],q(t),!1).map(function(i){return i>e?i+n:i}))}function GA(r){return r.symbol?\"\".concat(r.symbol).concat(r.greedy?\"\":\"?\"):r.min===r.max?\"{\".concat(r.min,\"}\"):\"{\".concat(r.min,\",\").concat(r.max||\"\",\"}\").concat(r.greedy?\"\":\"?\")}function _g(r){if(r.type!==\"alternative\")return!1;var e=r.body;if(e.length<1)return!1;var t=q(e,1),n=t[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 KA(r){if(_g(r))return!1;var e=function(t){var n,i;if(t.type===\"anchor\")return t.kind===\"start\"?\"anchor\":null;if(t.type===\"quantifier\"&&t.max===0)return null;if(t.type===\"alternative\"||t.type===\"group\"||t.type===\"quantifier\"){var o=t.type===\"quantifier\"&&t.min===0;try{for(var s=ze(t.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(t.type===\"disjunction\"){var u=t.body.map(function(p){return e(p)});return u.some(function(p){return p===\"consumingNode\"})?\"consumingNode\":u.every(function(p){return p===\"anchor\"})?\"anchor\":null}return\"consumingNode\"};return e(r)===\"consumingNode\"}function JA(r){var e=new Map,t=function(i,o){var s=function(c,u){var l=\"\";return c.forEach(function(p){l+=t(p,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+=t(c,o+a.length)}),a}case\"alternative\":return s(i.body,o);case\"quantifier\":return\"\".concat(t(i.body[0],o)).concat(GA(i))}},n=t(r,0);return{referencesWithOffset:e,result:n}}function YA(r){for(var e=r.pattern,t=r.unicode,n=function(c){var u=bg(c.pattern,t),l=[],p=!1,f=u.type===\"disjunction\",m=new Map,g=new Set,h=1,b=function(N,P){if(N.body.length!==1)return!1;var B=N.body[0];return B===P},v=function(N){var P=N.nodeStack,B=N.nodes,O=N.passedStartAnchor,J=N.serial,Y=null;B.forEach(function(se){J?(x({immediatelyPrecedingLookahead:Y,node:se,nodeStack:P,passedStartAnchor:O}),Y=se.type===\"group\"&&se.behavior===\"lookahead\"?se:null):x({immediatelyPrecedingLookahead:Y,node:se,nodeStack:P,passedStartAnchor:Oe({},O)})})},x=function(N){var P=N.immediatelyPrecedingLookahead,B=N.node,O=N.nodeStack,J=N.passedStartAnchor,Y=function(){J.value||(p=!0)};switch(B.type){case\"characterClass\":case\"characterClassEscape\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":Y();return;case\"anchor\":{B.kind===\"start\"&&(J.value=!0);return}case\"group\":{var se=null;B.behavior===\"normal\"&&(se=h,h++),v({nodeStack:L(L([],q(O),!1),[B],!1),nodes:B.body,passedStartAnchor:J,serial:!0}),se!==null&&B.behavior===\"normal\"&&m.set(se,{group:B,stack:L([],q(O),!1)});return}case\"disjunction\":{v({nodeStack:L(L([],q(O),!1),[B],!1),nodes:B.body,passedStartAnchor:J,serial:!1});return}case\"alternative\":{v({nodeStack:L(L([],q(O),!1),[B],!1),nodes:B.body,passedStartAnchor:J,serial:!0});return}case\"quantifier\":{B.max!==0&&(B.max===void 0&&L([],q(O),!1).reverse().some(function(me){if(me.type===\"group\"){if(cg.indexOf(me.behavior)>=0)return!0;g.add(me)}return!1}),v({nodeStack:L(L([],q(O),!1),[B],!1),nodes:B.body,passedStartAnchor:B.min===0?Oe({},J):J,serial:!0}));return}case\"reference\":{Y();var ae=m.get(B.matchIndex);if(ae){var Z=ae.group,te=ae.stack,mt=vg(te,O).a,je=mt.flatMap(function(me){return me.type===\"group\"&&cg.indexOf(me.behavior)>=0?[me]:[]}),pe=mt.some(function(me){return me.type===\"disjunction\"||me.type===\"quantifier\"&&me.min===0}),ct=je.length>0,We=je.every(function(me){return me.behavior!==\"negativeLookahead\"&&me.behavior!==\"negativeLookbehind\"});if(We&&(ct||g.has(Z))){var ut=!!P&&b(P,Z),Ct=ct&&pe;l.push({atomicOrOptional:ut?\"atomic\":Ct?\"optional\":null,group:Z,reference:B})}}return}}};x({immediatelyPrecedingLookahead:null,node:u,nodeStack:[],passedStartAnchor:{value:!1}});var $=c.pattern,V=new Set(c.atomicGroupOffsets),S=!1;return L([],q(l),!1).sort(function(N,P){return P.reference.range[0]-N.reference.range[0]}).forEach(function(N){var P=N.atomicOrOptional,B=N.group,O=q(N.reference.range,2),J=O[0],Y=O[1],se=JA(B),ae=se.result,Z=se.referencesWithOffset;Z.size>0&&(S=!0);var te=P===\"optional\"?\"(?:\".concat(ae,\"?)\"):ae;$=HA($,te,J,Y);var mt=te.length-(Y-J);V=ug({after:J,offsets:V,shiftAmount:mt}),P===\"atomic\"&&V.add(J),l.forEach(function(je){var pe=je.atomicOrOptional,ct=je.reference;if(pe===\"atomic\"){var We=Z.get(ct);We!==void 0&&V.add(J+We)}})}),p&&!_g(u)&&(f&&($=\"(?:\".concat($,\")\")),$=\"[^]*?\".concat($),V=ug({after:-1,offsets:V,shiftAmount:f?8:5})),{needToRerun:S,result:{atomicGroupOffsets:V,pattern:$}}},i={atomicGroupOffsets:new Set,pattern:e};;){var o=n(i),s=o.result,a=o.needToRerun;if(i=s,!a)break}return i}function XA(r){return new FinalizationRegistry(r)}var Fl=Symbol(\"fork\"),cc=Symbol(\"pendingResults\");function QA(r){var e=new Set,t=XA(function(o){e.delete(o)}),n=function(){var o=r.next();e.forEach(function(s){return s(o)})},i=function(o){var s,a=(s={},s[Fl]=function(){return i(this[cc])},s[cc]=o.slice(0),s.next=function(l){if(l!==void 0)throw new Error(\"`ForkableIterator` `next()` cannot take a value\");var p=this[cc];return p.length||n(),p.shift()},s),c=new WeakRef(a),u=function(l){var p=c.deref();p?.[cc].push(l)};return t.register(a,u),e.add(u),a};return i([])}function uc(r){if(!r||!r[Fl])throw new Error(\"The provided value was not a `ForkableIterator` from `buildForkableIterator()`\");return r[Fl]()}function eD(){return xe(this,function(r){return[2]})}function uo(r){return QA(r)}function tD(r){var e,t,n,i,o,s,a;return xe(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]),e=ze(r),t=e.next(),c.label=1;case 1:if(t.done)return[3,5];n=t.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 t=e.next(),[3,1];case 5:return[3,8];case 6:return o=c.sent(),s={error:o},[3,8];case 7:try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(s)throw s.error}return[7];case 8:return[2]}})}function _s(r){return xe(this,function(e){switch(e.label){case 0:return[5,ze(r)];case 1:return e.sent(),[2]}})}function lg(r,e){var t=[];return r[0]<e[0]&&t.push([r[0],Math.min(e[0]-1,r[1])]),r[1]>e[1]&&t.push([Math.max(e[1]+1,r[0]),r[1]]),t}function rD(r,e){var t=Math.max(r[0],e[0]),n=Math.min(r[1],e[1]);return t>n?null:[t,n]}function nD(r){for(var e=L([],q(r),!1).sort(function(c,u){return c-u}),t=[],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)&&(t.push([o,s]),n=i+1)}return t}function jl(r){for(var e=[],t=0;t<r.length+1;t++){var n=t-1>=0?r[t-1]:null,i=t<r.length?r[t]: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 Pl(r){return!r.rangesNegated&&!r.ranges.length&&!r.unicodePropertyEscapes.size}function Ll(r,e){var t,n,i,o,s,a;r.rangesNegated?e.rangesNegated?(a=!0,s=L(L([],q(r.ranges),!1),q(e.ranges),!1)):(a=!1,s=L([],q(e.ranges),!1),r.ranges.forEach(function(h){var b=[];s.forEach(function(v){b.push.apply(b,L([],q(lg(v,h)),!1))}),s=b})):e.rangesNegated?(a=!1,s=L([],q(r.ranges),!1),e.ranges.forEach(function(h){var b=[];s.forEach(function(v){b.push.apply(b,L([],q(lg(v,h)),!1))}),s=b})):(a=!1,s=[],r.ranges.forEach(function(h){e.ranges.forEach(function(b){var v=rD(h,b);v&&s.push(v)})}));var c=new Set(L(L([],q(r.unicodePropertyEscapes.keys()),!1),q(e.unicodePropertyEscapes.keys()),!1)),u=new Map;try{for(var l=ze(c),p=l.next();!p.done;p=l.next()){var f=p.value,m=(i=r.unicodePropertyEscapes.get(f))!==null&&i!==void 0?i:null,g=(o=e.unicodePropertyEscapes.get(f))!==null&&o!==void 0?o:null;m!==null&&g===null?u.set(f,m):m===null&&g!==null?u.set(f,g):m!==null&&g!==null&&m===g&&u.set(f,m)}}catch(h){t={error:h}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return{ranges:s,rangesNegated:a,unicodePropertyEscapes:u}}function iD(r){return xe(this,function(e){switch(e.label){case 0:return[4,{bounded:!1,offset:r,stack:[],subType:\"end\",type:At}];case 1:throw e.sent(),new Error(\"Internal error: should not be reading after end\")}})}function xg(r,e){var t=function(n,i,o){var s,a,c,u,l,p;return o===void 0&&(o=0),xe(this,function(f){switch(f.label){case 0:s=0,f.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 eD()},subType:null,type:An}];case 3:f.sent(),f.label=4;case 4:c=!1,u=i(s),l=void 0,p=function(){var m,g,h,b;return xe(this,function(v){switch(v.label){case 0:switch(m=l.value,g=m.type,g){case An:return[3,1];case At:return[3,3]}return[3,5];case 1:return h=s,b=o,[4,{reader:function(){return t(function(x,$){return x===0?\"continue\":n(x+h,$)},function(x){return x===0?m.reader():i(x+h)},b)},subType:m.subType,type:An}];case 2:return v.sent(),[3,5];case 3:return m.subType!==\"null\"&&m.subType!==\"start\"&&m.subType!==\"end\"&&(c=!0),[4,m];case 4:return v.sent(),[3,5];case 5:return[2]}})},f.label=5;case 5:return(l=u.next()).done?[3,7]:[5,p()];case 6:return f.sent(),[3,5];case 7:o=c?0:o+1,f.label=8;case 8:return s++,[3,1];case 9:return[2]}})};return t(r,e)}function lc(r){var e=r.length;return xg(function(t){return t<e?\"continue\":\"stop\"},function(t){return r[t]()})}function Rl(r){var e=r.caseInsensitive,t=r.dotAll,n=r.nodes;return lc(n.map(function(i){return function(){return vs({caseInsensitive:e,dotAll:t,node:i})}}))}function Ol(r,e){var t=function(n){var i,o;return xe(this,function(s){switch(s.label){case 0:o=function(){var a,c;return xe(this,function(u){switch(u.label){case 0:switch(a=i.value,c=a.type,c){case An:return[3,1];case At:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return t(a.reader())},subType:a.subType,type:An}];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 t(r)}function oD(r){return new Set(r.flatMap(function(e){return e.type===\"group\"?[e.group]:[]}))}function sD(r){var e,t,n=[];try{for(var i=ze(r),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&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n}function aD(r){var e=r.caseInsensitive,t=r.dotAll,n=r.node;switch(n.behavior){case\"lookbehind\":case\"negativeLookbehind\":case\"lookahead\":case\"negativeLookahead\":return _s([{reader:function(){return lc([function(){return Ol(Rl({caseInsensitive:e,dotAll:t,nodes:n.body}),function(i){return Oe(Oe({},i),{stack:L([{group:n,type:\"group\"}],q(i.stack),!1)})})},function(){return iD(n.range[1])}])},subType:n.behavior,type:An}]);case\"ignore\":case\"normal\":return Ol(Rl({caseInsensitive:e,dotAll:t,nodes:n.body}),function(i){return Oe(Oe({},i),{stack:L([{group:n,type:\"group\"}],q(i.stack),!1)})})}}function dg(r){return xe(this,function(e){switch(e.label){case 0:return[4,{offset:r,stack:[],subType:\"null\",type:At}];case 1:return e.sent(),[2]}})}function bs(r,e){if(!r.has(e))throw new Error(\"Internal error: map missing key\");return r.get(e)}function cD(r,e){var t=r.some(function(n){if(n.type!==\"group\"||n.group.behavior!==\"normal\")return!1;var i=bs(e.capturingGroupToIndex,n.group),o=e.reachableReferences.some(function(s){return s.matchIndex===i});return o});return t?new Set:new Set(r.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 uD(r){var e=new Map;return r.flatMap(function(t){return t.type===\"quantifier\"?[t]:[]}).forEach(function(t){var n=t.iteration,i=t.quantifier;return e.set(i,n)}),e}function lD(r){var e=r.caseInsensitive,t=r.dotAll,n=r.node,i=n.min,o=n.max,s=o===void 0?1/0:o;return lc([function(){return dg(n.body[0].range[0])},function(){return xg(function(a,c){return c>1||a>=s?\"stop\":a>=i?\"fork\":\"continue\"},function(a){return Ol(lc(L(L([],q(a>0?[function(){return dg(n.body[0].range[0])}]:[]),!1),[function(){return vs({caseInsensitive:e,dotAll:t,node:n.body[0]})}],!1)),function(c){return Oe(Oe({},c),{stack:L([{iteration:a,quantifier:n,type:\"quantifier\"}],q(c.stack),!1)})})})}])}function dD(r){var e;return xe(this,function(t){switch(t.label){case 0:switch(e=r.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:r.range[0],stack:[],subType:\"end\",type:At}];case 2:throw t.sent(),new Error(\"Internal error: should not be reading after end\");case 3:return[4,{offset:r.range[0],stack:[],subType:\"start\",type:At}];case 4:return t.sent(),[3,6];case 5:return[3,6];case 6:return[2]}})}var Ag=[[48,57]],fD=jl(Ag),Dg=[[48,57],[65,90],[95,95],[97,122]],pD=jl(Dg),Cg=[[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]],hD=jl(Cg);function wg(r){switch(r){case\"d\":case\"D\":return r===\"d\"?Ag:fD;case\"w\":case\"W\":return r===\"w\"?Dg:pD;case\"s\":case\"S\":return r===\"s\"?Cg:hD}}function mD(r){var e,t;return xe(this,function(n){switch(n.label){case 0:return e=r.value,t=wg(e),[4,{characterGroups:{ranges:t,rangesNegated:!1,unicodePropertyEscapes:new Map},node:r,stack:[],subType:\"groups\",type:At}];case 1:return n.sent(),[2]}})}function gD(r){if(r.length>1)return null;var e=r.codePointAt(0);if(!e)throw new Error(\"Internal error: expected codepoint\");return e}function Eg(r){var e=String.fromCodePoint(r).toUpperCase(),t=gD(e);return t!==null?t:r}function yD(r){var e=r.caseInsensitive,t=r.highCodePoint,n=r.lowCodePoint;if(!e)return[[n,t]];for(var i=new Set,o=n;o<=t;o++)i.add(Eg(o));return nD(i)}function Sg(r){var e=r.caseInsensitive,t=r.value,n=t.codePoint;return e?Eg(n):n}function bD(r){var e=r.caseInsensitive,t=r.node,n=Sg({caseInsensitive:e,value:t});return _s([{characterGroups:{ranges:[[n,n]],rangesNegated:!1,unicodePropertyEscapes:new Map},node:t,stack:[],subType:\"groups\",type:At}])}function vD(r){var e,t,n=r.caseInsensitive,i=r.node,o=[],s=new Map,a=!1;try{e:for(var c=ze(i.body),u=c.next();!u.done;u=c.next()){var l=u.value;switch(l.type){case\"value\":{var p=Sg({caseInsensitive:n,value:l});o.push([p,p]);break}case\"characterClassRange\":{o.push.apply(o,L([],q(yD({caseInsensitive:n,highCodePoint:l.max.codePoint,lowCodePoint:l.min.codePoint})),!1));break}case\"characterClassEscape\":{var f=l.value;o.push.apply(o,L([],q(wg(f)),!1));break}case\"unicodePropertyEscape\":{var m=l.negative!==i.negative;if(s.get(l.value)===!m){a=!0;break e}s.set(l.value,m);break}}}}catch(g){e={error:g}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return _s([{characterGroups:a?{ranges:[],rangesNegated:!0,unicodePropertyEscapes:new Map}:{ranges:o,rangesNegated:i.negative,unicodePropertyEscapes:s},node:i,stack:[],subType:\"groups\",type:At}])}function _D(r){var e=r.caseInsensitive,t=r.dotAll,n=r.node;return tD([_s(n.body.slice(0,-1).map(function(i){return{reader:function(){return vs({caseInsensitive:e,dotAll:t,node:i})},subType:null,type:An}})),vs({caseInsensitive:e,dotAll:t,node:n.body[n.body.length-1]})])}function xD(r){var e=r.dotAll,t=r.node;return xe(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:t,stack:[],subType:\"groups\",type:At}];case 1:return n.sent(),[2]}})}function AD(r){return xe(this,function(e){switch(e.label){case 0:return[4,{node:r,referenceIndex:r.matchIndex,stack:[],subType:\"reference\",type:At}];case 1:return e.sent(),[2]}})}function DD(r){return _s([{characterGroups:{ranges:[],rangesNegated:!1,unicodePropertyEscapes:new Map([[r.value,r.negative]])},node:r,stack:[],subType:\"groups\",type:At}])}var At=Symbol(\"characterReaderTypeCharacterEntry\"),An=Symbol(\"characterReaderTypeSplit\");function vs(r){var e=r.caseInsensitive,t=r.dotAll,n=r.node;switch(n.type){case\"anchor\":return dD(n);case\"characterClass\":return vD({caseInsensitive:e,node:n});case\"characterClassEscape\":return mD(n);case\"unicodePropertyEscape\":return DD(n);case\"reference\":return AD(n);case\"value\":return bD({caseInsensitive:e,node:n});case\"dot\":return xD({dotAll:t,node:n});case\"alternative\":return Rl({caseInsensitive:e,dotAll:t,nodes:n.body});case\"disjunction\":return _D({caseInsensitive:e,dotAll:t,node:n});case\"group\":return aD({caseInsensitive:e,dotAll:t,node:n});case\"quantifier\":return lD({caseInsensitive:e,dotAll:t,node:n})}}var Tg=Symbol(\"characterReaderLevel2TypeSplit\"),Nl=Symbol(\"characterReaderLevel1TypeEntry\");function CD(r){var e=r.caseInsensitive,t=r.dotAll,n=r.node,i=function(o,s){var a,c,u;return xe(this,function(l){switch(l.label){case 0:c=function(){var p,f,m,g;return xe(this,function(h){switch(h.label){case 0:switch(p=a.value.type,p){case At:return[3,1];case An:return[3,10]}return[3,12];case 1:switch(f=a.value.subType,f){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:Nl}];case 3:return h.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:Nl}];case 5:return h.sent(),s=[],[3,9];case 6:return[2,{value:{bounded:a.value.bounded,precedingZeroWidthEntries:s}}];case 7:return s=L(L([],q(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:\"null\"}],!1),[3,9];case 8:return s=L(L([],q(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:\"start\"}],!1),[3,9];case 9:return[3,12];case 10:return m=a.value,g=s,[4,{reader:function(){return i(m.reader(),g)},subType:m.subType,type:Tg}];case 11:return h.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(vs({caseInsensitive:e,dotAll:t,node:n}),[])}var Bl=Symbol(\"characterReaderLevel2TypeSplit\"),dc=Symbol(\"characterReaderLevel2TypeEntry\"),kg=Symbol(\"internalReaderTypeSplit\"),Vl=Symbol(\"internalReaderTypeEntry\");function $g(r){var e,t;return xe(this,function(n){switch(n.label){case 0:t=function(){var i,o;return xe(this,function(s){switch(s.label){case 0:switch(i=e.value,o=i.type,o){case Tg:return[3,1];case Nl:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return $g(i.reader())},subType:i.subType,type:kg}];case 2:return s.sent(),[3,5];case 3:return[4,Oe(Oe({},i),{type:Vl})];case 4:return s.sent(),[3,5];case 5:return[2]}})},n.label=1;case 1:return(e=r.next()).done?[3,3]:[5,t()];case 2:return n.sent(),[3,1];case 3:return[2,e.value]}})}function wD(r,e){var t,n;try{for(var i=ze(e),o=i.next();!o.done;o=i.next()){var s=q(o.value,2),a=s[0],c=s[1],u=r.get(a)||0;if(c-u>1)return!0}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!1}function ED(r){var e,t,n,i,o,s,a,c,u,l=r.groupContentsStore,p=r.groups,f=r.groupsWithInfiniteSize,m=r.nodeExtra,g=r.value;return xe(this,function(h){switch(h.label){case 0:if(e=bs(m.indexToCapturingGroup,g.referenceIndex),t=l.get(g.referenceIndex)||{contents:[],group:e},n=vg(bs(m.nodeToLookaheadStack,t.group),bs(m.nodeToLookaheadStack,g.node)).a,n.length){if(n.some(function(b){var v=b.behavior;return v===\"negativeLookahead\"||v===\"negativeLookbehind\"}))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];throw new Error(\"Unsupported reference (\".concat(g.referenceIndex,\" at position \").concat(g.node.range[0],\"). Pattern needs downgrading. See the `downgradePattern` option.\"))}if(p.has(t.group))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];if(f.has(g.referenceIndex))throw new Error(\"Unsupported reference to group \".concat(g.referenceIndex,\" as group is not a finite size. Pattern needs downgrading. See the `downgradePattern` option.\"));h.label=1;case 1:h.trys.push([1,6,7,8]),i=ze(t.contents),o=i.next(),h.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,{characterGroups:s.characterGroups,node:s.node,precedingZeroWidthEntries:s.precedingZeroWidthEntries,stack:L(L(L([],q(s.stack),!1),[{reference:g.node,type:\"reference\"}],!1),q(g.stack),!1),subType:\"groups\",type:Vl}]);case 3:h.sent(),h.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return a=h.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 fg(r){var e=r.caseInsensitive,t=r.dotAll,n=r.node,i=r.nodeExtra,o=function(s){var a,c;return xe(this,function(u){switch(u.label){case 0:a=function(){var l,p,f,m,g,h,b,v,x,$,V,S,N,P,B,O,J,Y,se,ae,Z,te,mt,je,pe,ct,We,ut,Ct,me,br,Mt,Qe,Kt,lt,et,vr,Jt,He,Yt,En,Xt,wt;return xe(this,function(gt){switch(gt.label){case 0:if(l=s.precedingZeroWidthEntries,p=s.groupsWithInfiniteSize,f=s.groupContentsStore,m=s.quantifierIterationsAtLastGroup,g=s.characterReader,h=s.referenceCharacterReaderWithReference,b=h?.reader||g,v=b.next(),v.done){if(h){if(v.value.bounded)throw new Error(\"Internal error: end of reference reader cannot be bounded\");return s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:L(L([],q(l),!1),q(v.value.precedingZeroWidthEntries),!1),quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:null},[2,\"continue-outer\"]}return[2,{value:{bounded:v.value.bounded,precedingZeroWidthEntries:L(L([],q(l),!1),q(v.value.precedingZeroWidthEntries),!1),type:\"end\"}}]}switch(x=v.value,$=x.type,$){case kg:return[3,1];case Vl:return[3,3]}return[3,7];case 1:if(h)throw new Error(\"Internal error: should not be seeing a split from a reference reader\");return V=f,S=m,N=p,P=l,[4,{reader:function(){return o({characterReader:uo(x.reader()),groupContentsStore:V,groupsWithInfiniteSize:N,precedingZeroWidthEntries:P,quantifierIterationsAtLastGroup:S,referenceCharacterReaderWithReference:h})},subType:x.subType,type:Bl}];case 2:return gt.sent(),[3,7];case 3:switch(l=L(L([],q(l),!1),q(x.precedingZeroWidthEntries),!1),B=uD(x.stack),O=sD(x.stack),J=oD(x.stack),Y=x.subType,Y){case\"reference\":return[3,4];case\"groups\":return[3,5]}return[3,7];case 4:{if(h)throw new Error(\"Internal error: should not be seeing a reference from a reference reader\");return wD(m,B)?[2,{value:{type:\"abort\"}}]:(se=uo(ED({groupContentsStore:f,groups:J,groupsWithInfiniteSize:p,nodeExtra:i,value:x})),s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:{reader:se,reference:x.node}},[3,7])}case 5:if(ae=new Map(f),!h)try{for(Z=(Jt=void 0,ze(f)),te=Z.next();!te.done;te=Z.next()){mt=q(te.value,2),je=mt[0],pe=mt[1].group,ct=L(L([],q(l.map(function(Te){var Ce=Te.offset;return Ce})),!1),[x.node.range[0]],!1);try{for(We=(Yt=void 0,ze(ct)),ut=We.next();!ut.done;ut=We.next())if(Ct=ut.value,pe.range[0]>=Ct){ae.delete(je);break}}catch(Te){Yt={error:Te}}finally{try{ut&&!ut.done&&(En=We.return)&&En.call(We)}finally{if(Yt)throw Yt.error}}}}catch(Te){Jt={error:Te}}finally{try{te&&!te.done&&(He=Z.return)&&He.call(Z)}finally{if(Jt)throw Jt.error}}me=!1,br=L([],q(x.stack),!1).reverse(),Mt=br.findIndex(function(Te){var Ce=Te.type;return Ce===\"reference\"}),Qe=br.slice(0,Mt>=0?Mt:x.stack.length),Kt=function(Te){if(Te.type===\"quantifier\"&&Te.quantifier.max===void 0)return me=!0,\"continue\";if(Te.type!==\"group\")return\"continue\";var Ce=Te.group;if(Ce.behavior===\"lookbehind\"||Ce.behavior===\"negativeLookbehind\"||Ce.behavior===\"negativeLookahead\"||Ce.behavior===\"lookahead\")return me=!1,\"continue\";if(Ce.behavior!==\"normal\")return\"continue\";var Et=bs(i.capturingGroupToIndex,Ce);if(me){var St=new Set(p);St.add(Et),p=St}var jt=ae.get(Et)||{contents:[],group:Ce};ae.set(Et,Oe(Oe({},jt),{contents:L(L([],q(jt.contents),!1),[Oe(Oe({},x),{precedingZeroWidthEntries:l.filter(function(Tt){var Pe=Tt.offset;return Pe>=Ce.range[0]&&Pe<=Ce.range[1]})})],!1)}))};try{for(lt=(Xt=void 0,ze(Qe)),et=lt.next();!et.done;et=lt.next())vr=et.value,Kt(vr)}catch(Te){Xt={error:Te}}finally{try{et&&!et.done&&(wt=lt.return)&&wt.call(lt)}finally{if(Xt)throw Xt.error}}return f=ae,m=B,[4,{characterGroups:x.characterGroups,groups:J,lookaheadStack:O,node:x.node,precedingZeroWidthEntries:l,stack:x.stack,type:dc}];case 6:return gt.sent(),l=[],s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:h},[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:uo($g(CD({caseInsensitive:e,dotAll:t,node:n}))),groupContentsStore:new Map,groupsWithInfiniteSize:new Set,precedingZeroWidthEntries:[],quantifierIterationsAtLastGroup:new Map,referenceCharacterReaderWithReference:null})}var SD=(function(){function r(e,t){this._history=[],this._isEqual=e,t&&(this._history=L([],q(t.getHistory()),!1))}return r.prototype._isEntryEqual=function(e,t){return this._isEqual(e.left,t.left)&&this._isEqual(e.right,t.right)},r.prototype.append=function(e){this._history.push(e)},r.prototype.clone=function(){return new r(this._isEqual,this)},r.prototype.getHistory=function(){return L([],q(this._history),!1)},r.prototype.getRepeatingEntries=function(){var e=this._history.length;e:for(var t=1;t<=e/2;t++){for(var n=e-t*2,i=0;i<t;i++)if(!this._isEntryEqual(this._history[n+i],this._history[n+t+i]))continue e;return this._history.slice(n,n+t)}return null},r})();function mr(r){var e=!1,t;return function(){return e||(e=!0,t=r()),t}}var Ml=Symbol(\"isUnboundedReaderTypeStep\"),TD={ranges:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map};function pg(r){var e,t,n,i,o=r.multiLine,s=r.reader;return xe(this,function(a){switch(a.label){case 0:e=uc(s),t=[{get:mr(function(){return e.next()}),reader:e}],n=function(){var c,u,l,p,f;return xe(this,function(m){switch(m.label){case 0:return c=t.pop(),c?[4,{type:Ml}]:[2,\"break\"];case 1:if(m.sent(),u=c.get(),u.done){if(u.value.type===\"end\"&&!u.value.bounded)return[2,{value:!0}]}else switch(u.value.type){case Bl:{l=u.value,t.push({get:mr(function(){return c.reader.next()}),reader:c.reader}),l.subType===null&&(p=l.reader(),t.push({get:mr(function(){return p.next()}),reader:p}));break}case dc:{o&&(f=Pl(Ll(TD,u.value.characterGroups)),f&&t.push({get:mr(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 kD(r,e){return new Set(L(L([],q(r),!1),q(e),!1))}function $D(r,e){return r.size===e.size&&kD(r,e).size===r.size}var Ig=Symbol(\"checkerReaderTypeTrail\");function ID(r,e){return r===e}function co(r,e){return r.map(function(t){switch(t.type){case\"quantifier\":return\"q:\".concat(t.quantifier.range[0],\":\").concat(e&&t.quantifier.max===void 0&&t.iteration>=t.quantifier.min?\"*\":\"\".concat(t.iteration));case\"reference\":return\"r:\".concat(t.reference.range[0]);case\"group\":return\"g:\".concat(t.group.range[0])}}).filter(Boolean).join(\",\")}function $l(r,e){for(var t=new Set,n=0;n<r.length;n++){var i=r[n];i.type===\"group\"&&e.has(i.group.range[0])&&t.add(co(r.slice(0,n+1),!1))}return t}function FD(r){return[r.type,r.offset,co(r.stack,!1)].join(\":\")}function hg(r,e){return L(L([],q(r.precedingZeroWidthEntries.map(function(t){return{hash:[\"zw\",FD(t)].join(\":\"),stack:t.stack}})),!1),[{hash:[\"s\",e].join(\":\"),stack:r.stack}],!1)}function ao(r,e){return r.hash===e.hash}function RD(r){var e,t,n,i,o,s,a,c,u,l,p,f,m,g,h,b,v,x;return xe(this,function($){switch($.label){case 0:e=new Set,t=new Set,n=new Map,i=0,o=Date.now()+r.timeout,s=!1,a=!1,c=uo(r.leftStreamReader),u=uo(r.rightStreamReader),l=[{infiniteLoopTracker:new SD(ID),streamReadersWithGetters:[{get:mr(function(){return c.next()}),reader:c},{get:mr(function(){return u.next()}),reader:u}],trail:[]}],p=function(){var V,S,N,P,B,O,He,J,Y,se,ae,Z,te,mt,je,pe,ct,We,ut,Ct,me,br,Mt,Qe,Kt,lt,et,vr,Jt,He,Yt,En,Xt,wt,gt,Pe,Te,Ce,Et,Pe,St,jt,Tt,Pe,Ns,Ms,Pt,js,Ps,$i,Ii,Fi,Eo,Ls,Ri,ie,So,Ur,Oi,Sn,Tn,kn,Ee,w,zr,y;return xe(this,function(_){switch(_.label){case 0:if(s=Date.now()>o,s||i>r.maxSteps)return[2,\"break\"];if(V=l.pop(),!V)return[2,\"break\"];for(S=V.streamReadersWithGetters,N=V.infiniteLoopTracker,P=V.trail,B=[],O=function(A){i+=.5;var D=S[A].get();if(!D.done&&D.value.type===Bl){var G=D.value;l.push({infiniteLoopTracker:N,streamReadersWithGetters:S.map(function(tt,Lt){var Bs=tt.reader,Lc=tt.get;return{get:Lt===A?mr(function(){return Bs.next()}):Lc,reader:Bs}}),trail:P});var he=S.map(function(tt,Lt){var Bs=tt.reader,Lc=tt.get,Td=Lt===A?uo(G.reader()):uc(Bs);return{get:Lt<A?Lc:mr(function(){return Td.next()}),reader:Td}});return l.push({infiniteLoopTracker:N.clone(),streamReadersWithGetters:he,trail:P}),\"continue-outer\"}else B.push(D)},He=0;He<S.length;He++)if(J=O(He),J===\"continue-outer\")return[2,J];if(Y=q(B,2),se=Y[0],ae=Y[1],i>r.maxSteps||se.done||ae.done)return[2,\"continue\"];if(se.value.type!==dc||ae.value.type!==dc)throw new Error(\"Internal error: impossible leftValue/rightValue type\");if(Z=se.value,te=ae.value,mt=Z.precedingZeroWidthEntries.some(function(A){var D=A.type;return D===\"start\"}),je=te.precedingZeroWidthEntries.some(function(A){var D=A.type;return D===\"start\"}),pe=mt||je,P.length>0&&pe)return[2,\"continue\"];if(ct=kl(Z.lookaheadStack),We=kl(te.lookaheadStack),ct!==We)return[2,\"continue\"];if(ut=Ll(Z.characterGroups,te.characterGroups),Pl(ut))return[2,\"continue\"];if(Ct=co(Z.stack,!1),me=co(te.stack,!1),br=[Z.node.range[0],Ct].join(\":\"),Mt=[te.node.range[0],me].join(\":\"),Qe=kl(P),Kt=new Set(Qe?.left.atomicGroupsEnteredTogether),lt=new Set(Qe?.right.atomicGroupsEnteredTogether),et=!!Qe?.diverged,!et)for(vr=hg(Z,br),Jt=hg(te,Mt),He=0;He<Math.min(vr.length,Jt.length);He++){if(Yt=vr[He],En=Jt[He],Yt.hash!==En.hash){et=!0;break}Xt=$l(Yt.stack,r.atomicGroupOffsets);try{for(wt=(Tn=void 0,ze(Xt)),gt=wt.next();!gt.done;gt=wt.next())Pe=gt.value,Kt.add(Pe),lt.add(Pe)}catch(A){Tn={error:A}}finally{try{gt&&!gt.done&&(kn=wt.return)&&kn.call(wt)}finally{if(Tn)throw Tn.error}}}Te=$l(Z.stack,r.atomicGroupOffsets);try{for(Ce=(Ee=void 0,ze(Kt)),Et=Ce.next();!Et.done;Et=Ce.next())Pe=Et.value,Te.has(Pe)||Kt.delete(Pe)}catch(A){Ee={error:A}}finally{try{Et&&!Et.done&&(w=Ce.return)&&w.call(Ce)}finally{if(Ee)throw Ee.error}}St=$l(te.stack,r.atomicGroupOffsets);try{for(jt=(zr=void 0,ze(lt)),Tt=jt.next();!Tt.done;Tt=jt.next())Pe=Tt.value,St.has(Pe)||lt.delete(Pe)}catch(A){zr={error:A}}finally{try{Tt&&!Tt.done&&(y=jt.return)&&y.call(jt)}finally{if(zr)throw zr.error}}if(Ns={atomicGroupsEnteredTogether:Kt,characterGroups:Z.characterGroups,contextTrail:Ct,hash:br,node:Z.node,stack:Z.stack},Ms={atomicGroupsEnteredTogether:lt,characterGroups:te.characterGroups,contextTrail:me,hash:Mt,node:te.node,stack:te.stack},Pt={diverged:et,intersection:ut,left:Ns,right:Ms},P=L(L([],q(P),!1),[Pt],!1),js=cD(Z.stack,r.nodeExtra),js.size>0&&(Ps=P.every(function(A){var D=A.left,G=A.right;return ao(D,G)}),Ps))return[2,\"continue\"];if($i={left:[Z.node.range[0],co(Z.stack,!0)].join(\":\"),right:[te.node.range[0],co(Z.stack,!0)].join(\":\")},n.set($i,Pt),N.append($i),Ii=N.getRepeatingEntries(),Ii){if(Fi=n.get(Ii[0]),!Fi)throw new Error(\"Internal error: missing entry at start of loop\");return t.add(Fi),[2,\"continue\"]}if(!$D(Pt.left.atomicGroupsEnteredTogether,Pt.right.atomicGroupsEnteredTogether))return[2,\"continue-outer\"];if(Eo=ao(Pt.left,Pt.right),Eo)return[3,2];{for(Ls=pg({multiLine:r.multiLine,reader:uc(S[0].reader)}),Ri=void 0;!(Ri=Ls.next()).done;)switch(Ri.value.type){case Ml:{if(i+=.5,i>r.maxSteps)return[2,\"break-outer\"];break}}if(ie=Ri.value,ie)return[2,\"continue\"]}{for(So=pg({multiLine:r.multiLine,reader:uc(S[1].reader)}),Ur=void 0;!(Ur=So.next()).done;)switch(Ur.value.type){case Ml:{if(i+=.5,i>r.maxSteps)return[2,\"break-outer\"];break}}if(Oi=Ur.value,Oi)return[2,\"continue\"]}return Sn=function(){var A=L([],q(e),!1).some(function(D){return D.length!==P.length?!1:D.every(function(G,he){return ao(G.left,P[he].left)&&ao(G.right,P[he].right)})||D.every(function(G,he){return ao(G.left,P[he].right)&&ao(G.right,P[he].left)})});return!A},Sn()?(e.add(P),[4,{trail:P,type:Ig}]):[3,2];case 1:_.sent(),_.label=2;case 2:return l.push({infiniteLoopTracker:N,streamReadersWithGetters:S.map(function(A){var D=A.reader;return{get:mr(function(){return D.next()}),reader:D}}),trail:P}),[2]}})},$.label=1;case 1:return[5,p()];case 2:if(f=$.sent(),f===\"break\")return[3,4];switch(f){case\"break-outer\":return[3,4];case\"continue-outer\":return[3,3]}$.label=3;case 3:return[3,1];case 4:if(t.size>0)try{for(m=ze(e),g=m.next();!g.done;g=m.next())if(h=g.value,h.some(function(V){return t.has(V)})){a=!0;break}}catch(V){v={error:V}}finally{try{g&&!g.done&&(x=m.return)&&x.call(m)}finally{if(v)throw v.error}}return b=i>r.maxSteps?\"hitMaxSteps\":s?\"timedOut\":null,[2,b?{error:b}:{error:null,infinite:a}]}})}var OD=[\"lookahead\",\"lookbehind\",\"negativeLookahead\",\"negativeLookbehind\"];function ND(r){var e=new Map,t=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(p){return o(p,a,c)});return}case\"group\":{if(s.behavior===\"normal\"){var u=e.size+1;e.set(s,u),t.set(u,s),n.set(s,a)}var l=L([],q(a),!1);s.behavior!==\"normal\"&&OD.indexOf(s.behavior)>=0&&l.push(s),s.body.forEach(function(p){return o(p,l,c)});return}case\"quantifier\":{s.body.forEach(function(p){return o(p,a,c&&s.max!==0)});return}}};return o(r,[],!0),{capturingGroupToIndex:e,indexToCapturingGroup:t,nodeToLookaheadStack:n,reachableReferences:i}}var MD=(function(){function r(){this._cache=new Map}return r.prototype.addResult=function(e,t,n){var i=this._cache.get(e)||new Map;i.set(t,n),this._cache.set(e,i);var o=this._cache.get(t)||new Map;o.set(e,n),this._cache.set(t,o)},r.prototype.getResult=function(e,t){var n;return(n=this._cache.get(e))===null||n===void 0?void 0:n.get(t)},r})(),Fg=(function(){function r(e){this.decode=e,this.root=new Map,this.results=new Map,this._items=function(){return[]}}return r.prototype.add=function(e){var t=this.decode(e);if(t.length!==0){for(var n=this.results,i={children:this.root},o=t.length,s=0;s<o;s++){var a=t[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=mr(function(){return Array.from(n.values())})}},Object.defineProperty(r.prototype,\"items\",{get:function(){return this._items()},enumerable:!1,configurable:!0}),r})(),Il=25e3,jD=(function(){function r(e,t){this.trail=e,this.isEmptyCache=t,this.tree=new Fg(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(r.prototype,\"matches\",{get:function(){return this.tree.items},enumerable:!1,configurable:!0}),r.prototype.getLongestMatch=function(e,t){var n=this;if(t.length>e.length)throw new Error(\"Internal error: trail should be <= than input string schema\");var i=t.findIndex(function(o,s){var a=n.isEmptyCache.getResult(o.characterGroups,e[s]);if(a!==void 0)return a;var c=Pl(Ll(o.characterGroups,e[s]));return n.isEmptyCache.addResult(o.characterGroups,e[s],c),c});return i===-1?t:t.slice(0,i)},r.prototype.onNewTrail=function(e){var t,n,i=[],o=[];try{for(var s=ze(e.trail),a=s.next();!a.done;a=s.next()){var c=a.value;i.push(c.left),o.push(c.right)}}catch(p){t={error:p}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.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)},r})();function PD(r){var e,t,n=r.atomicGroupOffsets,i=r.node,o=r.maxScore,s=r.maxSteps,a=r.multiLine,c=r.timeout,u=r.caseInsensitive,l=r.dotAll,p=new MD,f=ND(i),m={caseInsensitive:u,dotAll:l,node:i,nodeExtra:f},g=fg(m),h=fg(m),b=RD({atomicGroupOffsets:n,leftStreamReader:g,maxSteps:s,multiLine:a,nodeExtra:f,rightStreamReader:h,timeout:c}),v=new Fg(function(Y){var se=Y.trail;return se}),x=1,$=0,V;e:for(;!(V=b.next()).done;)switch(V.value.type){case Ig:{var S=new jD(V.value.trail,p),N=function(Y){var se=Y.matches,ae=se.length;ae>x&&(x=ae)};if($<Il){try{for(var P=(e=void 0,ze(v.items)),B=P.next();!B.done;B=P.next()){var O=B.value;if(O.length===S.length){if($+=S.length,$>=Il)break;S.onNewTrail(O),O.onNewTrail(S),N(O)}}}catch(Y){e={error:Y}}finally{try{B&&!B.done&&(t=P.return)&&t.call(P)}finally{if(e)throw e.error}}N(S)}if($>=Il&&(x+=1),v.add(S),x>o)break e;break}}var J=null;return V.done?V.value.error?(x=1/0,J=V.value.error):V.value.infinite&&(x=1/0,J=\"hitMaxScore\"):(x=1/0,J=\"hitMaxScore\"),{error:J,score:x,trails:v.items.map(function(Y){var se=Y.trail;return se})}}var LD=1/0,BD=200,VD=2e4,UD=!1,zD=!1,qD=!1,ZD=!1;function fc(r){return{end:{offset:r.range[1]},source:r.raw,start:{offset:r.range[0]}}}function mg(r){return r.flatMap(function(e){return e.type===\"reference\"?[e.reference]:[]}).reverse().map(function(e){return{index:e.matchIndex,node:fc(e)}})}function gg(r){var e=L([],q(r),!1).reverse(),t=e.findIndex(function(i){var o=i.type;return o===\"reference\"}),n=e.slice(0,t>=0?t:r.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:fc(o)}})}function Ul(r,e){var t=e===void 0?{}:e,n=t.atomicGroupOffsets,i=t.maxScore,o=i===void 0?BD:i,s=t.maxSteps,a=s===void 0?VD:s,c=t.multiLine,u=c===void 0?UD:c,l=t.timeout,p=l===void 0?LD:l,f=t.caseInsensitive,m=f===void 0?qD:f,g=t.dotAll,h=g===void 0?ZD:g,b=t.unicode,v=b===void 0?zD:b,x=t.downgradePattern,$=x===void 0?!0:x;if(m&&v)throw new Error(\"`caseInsensitive` cannot be used with `unicode`.\");if($&&n)throw new Error(\"`atomicGroupOffsets` cannot be used with `downgradePattern: true`.\");if(p<=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 V=$?YA({pattern:r,unicode:v}):{atomicGroupOffsets:new Set(n||[]),pattern:r},S=V.pattern,N=V.atomicGroupOffsets,P=$&&r!==S,B=bg(S,v);if(!$&&KA(B))throw new Error(\"Pattern is not bounded at the start and needs downgrading. See the `downgradePattern` option.\");var O=PD({atomicGroupOffsets:N,caseInsensitive:m,dotAll:h,maxScore:o,maxSteps:a,multiLine:u,node:B,timeout:p});return Oe(Oe({},O.error?{error:O.error,safe:!1}:{error:null,safe:!0}),{pattern:S,patternDowngraded:P,score:O.score===1/0?{infinite:!0}:{infinite:!1,value:O.score},trails:O.trails.map(function(J){var Y={trail:J.map(function(se){var ae=se.left,Z=se.right,te={a:{backreferenceStack:mg(Z.stack),node:fc(Z.node),quantifierIterations:gg(Z.stack)},b:{backreferenceStack:mg(ae.stack),node:fc(ae.node),quantifierIterations:gg(ae.stack)}};return te})};return Y})})}function Rg(r,e={}){if(r==null||typeof r!=\"string\"||r.length===0)return!0;let t=e.maxPatternLength??256;if(r.length>t)return!1;try{return new RegExp(r),Ul(r).safe&&Ul(`^(?:${r})$`).safe}catch{return!1}}var Ci=\"en-US\";function pc(r){if(!r)return Ci;try{return Intl.NumberFormat.supportedLocalesOf(r).length>0?r:Ci}catch{return Ci}}function WD(r){if(r==null)return\"\";if(typeof r==\"object\")try{return JSON.stringify(r)??String(r)}catch{return String(r)}return String(r)}function Lg(r){let e=!0;return(r==null||typeof r==\"string\"&&r===\"\"||Array.isArray(r)&&r.length===0)&&(e=!1),{valid:e,...e?{}:{message:\"This field is required.\"}}}function Bg(r,e){if(!Rg(e))throw new de(`Unsafe regex pattern (catastrophic backtracking risk): ${e}`,\"regex\");try{let t=new RegExp(e).test(String(r??\"\"));return{valid:t,...t?{}:{message:\"Value does not match required pattern.\"}}}catch(t){throw new de(`Invalid regex pattern: ${e}`,\"regex\",t)}}function Vg(r,e,t){let n=0;(typeof r==\"string\"||Array.isArray(r))&&(n=r.length);let i=!0,o;return e!==void 0&&!isNaN(e)&&n<e?(i=!1,o=`Minimum length is ${e}.`):t!==void 0&&!isNaN(t)&&n>t&&(i=!1,o=`Maximum length is ${t}.`),{valid:i,...o?{message:o}:{}}}function Ug(r,e,t){let n=Number(r);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}.`):t!==void 0&&!isNaN(t)&&n>t&&(i=!1,o=`Maximum value is ${t}.`),{valid:i,...o?{message:o}:{}}}var HD=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;function zg(r){let e=typeof r==\"string\"&&HD.test(r);return{valid:e,...e?{}:{message:\"Must be a valid email address.\"}}}var Og=new Map;function GD(r,e,t){let n=`${r}:${e??\"undef\"}:${t??\"true\"}`,i=Og.get(n);return i||(i=new Intl.NumberFormat(r,{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:t}),Og.set(n,i)),i}var Ng=new Map;function KD(r,e,t,n){let i=`${r}:${e}:${t??\"undef\"}:${n??\"true\"}`,o=Ng.get(i);return o||(o=new Intl.NumberFormat(r,{style:\"currency\",currency:e,minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:n}),Ng.set(i,o)),o}var JD=\"USD\",Mg=new Map;function YD(r,e,t){let n=`${r}:${e??\"undef\"}:${t??\"true\"}`,i=Mg.get(n);return i||(i=new Intl.NumberFormat(r,{style:\"currency\",currency:JD,currencyDisplay:\"code\",minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:t}),Mg.set(n,i)),i}var jg=new Map;function XD(r){let e=jg.get(r);if(!e){let t=(o,s)=>{let a=new Intl.DateTimeFormat(r,{...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:t({month:\"long\"},n),monthsShort:t({month:\"short\"},n),weekdaysLong:t({weekday:\"long\"},i),weekdaysShort:t({weekday:\"short\"},i)},jg.set(r,e)}return e}var QD=/yyyy|yy|MMMM|MMM|MM|M|EEEE|E|dd|d|HH|H|hh|h|mm|ss|a/g,eC=/(?:Z|[+-]\\d{2}:?\\d{2})$/,tC=/^([+-]?\\d{4,6})-(\\d{2})-(\\d{2})(?:[T ](\\d{2})(?::(\\d{2})(?::(\\d{2}))?)?)?/;function rC(r){let e=eC.test(r),t=new Date(e?r:`${r}Z`);if(isNaN(t.getTime()))return null;let n=0,i=/([+-])(\\d{2}):?(\\d{2})$/.exec(r);i&&(n=(i[1]===\"-\"?-1:1)*(Number(i[2])*60+Number(i[3])));let o=new Date(t.getTime()+n*6e4);return nC(r,o)?{shifted:o,instant:t}:null}function nC(r,e){let t=tC.exec(r);if(!t)return!1;let n=i=>t[i]===void 0?void 0:Number(t[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 Pg=new Map;function iC(r){let e=Pg.get(r);return e||(e=new Intl.PluralRules(r),Pg.set(r,e)),e}var lo=r=>!!r;function oC(r,e=lo){if(!Array.isArray(r)||r.length<2)throw new de(\"and requires at least 2 values\",\"and\");return r.every(e)}function sC(r,e=lo){if(!Array.isArray(r)||r.length<2)throw new de(\"or requires at least 2 values\",\"or\");return r.some(e)}function aC(r,e=lo){return!e(r)}function qg(r){if(typeof r!=\"object\"||r===null||Array.isArray(r))return r;if(\"path\"in r&&typeof r.path==\"string\"&&!(\"@path\"in r))return{\"@path\":r.path};if(\"call\"in r&&typeof r.call==\"string\"&&!(\"@call\"in r)){let e={};if(r.args&&typeof r.args==\"object\")for(let[t,n]of Object.entries(r.args))e[t]=qg(n);return{\"@call\":r.call,args:e,returnType:r.returnType}}return r}function cC(r,e){let n=new ys().parse(r);if(n.length===0)return\"\";let i=ge(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?qg(s):s;return e.resolveSignal(a)});return Xn(()=>o.map(s=>WD(Fr(s)?Be(s):s)).join(\"\"))}function uC(r,e,t,n=Ci){return isNaN(r)?\"\":GD(n,e,t).format(r)}function lC(r,e,t=2,n,i=Ci){if(isNaN(r))return\"\";let o=String(e).toUpperCase();try{return KD(i,o,t,n).format(r)}catch{return YD(i,t,n).formatToParts(r).map(s=>s.type===\"currency\"?o:s.value).join(\"\")}}function dC(r,e=\"yyyy-MM-dd\",t=Ci){if(!r)return\"\";let n=rC(String(r));if(!n)return\"\";let{shifted:i,instant:o}=n,s=e||\"yyyy-MM-dd\";if(s===\"ISO\")return o.toISOString();let a=XD(t),c=(i.getUTCDay()+6)%7,u=i.getUTCHours(),l=u%12||12;return s.replace(QD,p=>{switch(p){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 p}})}function fC(r,e,t=Ci){let n;return r===0&&e.zero!==void 0?n=\"zero\":r===1&&e.one!==void 0?n=\"one\":r===2&&e.two!==void 0?n=\"two\":n=iC(t).select(r),String(e[n]??e.other??\"\")}function pC(r){let e=typeof r==\"string\"?r:void 0;if(!e||typeof window>\"u\"||typeof window.open!=\"function\")return;let t=typeof window<\"u\"&&typeof window.location<\"u\"&&window.location.href?window.location.href:void 0,n;try{n=t?new URL(e,t):new URL(e)}catch(i){throw new de(`Invalid URL specified: ${e}`,\"openUrl\",i)}if(n.protocol!==\"https:\"&&n.protocol!==\"http:\"&&n.protocol!==\"mailto:\"&&n.protocol!==\"tel:\")throw new de(`Unsupported URL scheme: ${n.protocol}`,\"openUrl\");window.open(n.href,\"_blank\",\"noopener,noreferrer\")}function Zg(r,{truthy:e=lo}={}){return Ae(r,t=>oC(t.values,e))}function Wg(r,{truthy:e=lo}={}){return Ae(r,t=>sC(t.values,e))}function Hg(r,{truthy:e=lo}={}){return Ae(r,t=>aC(t.value,e))}function Gg(r){return Ae(r,(e,t)=>cC(e.value,t))}function Kg(r,e){let t=pc(e);return Ae(r,n=>uC(n.value,n.decimals,n.grouping,t))}function Jg(r,e){let t=pc(e);return Ae(r,n=>lC(n.value,n.currency,n.decimals??2,n.grouping,t))}function Yg(r,e){let t=pc(e);return Ae(r,n=>dC(n.value,n.format,t))}function Xg(r,e){let t=pc(e);return Ae(r,n=>fC(n.value,n,t))}function Qg(r){return Ae(r,e=>pC(e.url))}var hC=Zg(ng),mC=Wg(ig),gC=Hg(og),yC=Ae(Wm,r=>Lg(r.value).valid),bC=Ae(Hm,r=>Bg(r.value,r.pattern).valid),vC=Ae(Gm,r=>Vg(r.value,r.min,r.max).valid),_C=Ae(Km,r=>Ug(r.value,r.min,r.max).valid),xC=Ae(Jm,r=>zg(r.value).valid),AC=Gg(Ym);function ey(r){return Kg(Xm,r)}var YM=ey();function ty(r){return Jg(Qm,r)}var XM=ty();function ry(r){return Yg(eg,r)}var QM=ry();function ny(r){return Xg(tg,r)}var ej=ny(),DC=Qg(rg);function CC(r){let e=r?.locale;return[yC,bC,vC,_C,xC,AC,ey(e),ty(e),ry(e),ny(e),DC,hC,mC,gC]}var iy=CC();var fo=new Ot(\"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json\",\"0.9\",[zm,jm,Mm,Zm,Tm,Bm,Rm,Pm,$m,Um,Lm,Nm,km,qm,Im,Fm,Vm,Om],iy,{themeSchema:Jh,...Sm});var Dn,be,zl,oy,po=0,py=[],De=K,sy=De.__b,ay=De.__r,cy=De.diffed,uy=De.__c,ly=De.unmount,dy=De.__;function ho(r,e){De.__h&&De.__h(be,r,po||e),po=0;var t=be.__H||(be.__H={__:[],__h:[]});return r>=t.__.length&&t.__.push({}),t.__[r]}function mc(r){return po=1,gc(hy,r)}function gc(r,e,t){var n=ho(Dn++,2);if(n.t=r,!n.__c&&(n.__=[t?t(e):hy(void 0,e),function(a){var c=n.__N?n.__N[0]:n.__[0],u=n.t(c,a);c!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=be,!be.__f)){var i=function(a,c,u){if(!n.__c.__H)return!0;var l=!1,p=n.__c.props!==a;if(n.__c.__H.__.some(function(m){if(m.__N){l=!0;var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(p=!0)}}),o){var f=o.call(this,a,c,u);return l?f||p:f}return!l||p};be.__f=!0;var o=be.shouldComponentUpdate,s=be.componentWillUpdate;be.componentWillUpdate=function(a,c,u){if(this.__e){var l=o;o=void 0,i(a,c,u),o=l}s&&s.call(this,a,c,u)},be.shouldComponentUpdate=i}return n.__N||n.__}function gr(r,e){var t=ho(Dn++,3);!De.__s&&Gl(t.__H,e)&&(t.__=r,t.u=e,be.__H.__h.push(t))}function Cn(r,e){var t=ho(Dn++,4);!De.__s&&Gl(t.__H,e)&&(t.__=r,t.u=e,be.__h.push(t))}function Pr(r){return po=5,Lr(function(){return{current:r}},[])}function Zl(r,e,t){po=6,Cn(function(){if(typeof r==\"function\"){var n=r(e());return function(){r(null),n&&typeof n==\"function\"&&n()}}if(r)return r.current=e(),function(){return r.current=null}},t==null?t:t.concat(r))}function Lr(r,e){var t=ho(Dn++,7);return Gl(t.__H,e)&&(t.__=r(),t.__H=e,t.__h=r),t.__}function Xe(r,e){return po=8,Lr(function(){return r},e)}function xs(r){var e=be.context[r.__c],t=ho(Dn++,9);return t.c=r,e?(t.__==null&&(t.__=!0,e.sub(be)),e.props.value):r.__}function Wl(r,e){De.useDebugValue&&De.useDebugValue(e?e(r):r)}function Hl(){var r=ho(Dn++,11);if(!r.__){for(var e=be.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var t=e.__m||(e.__m=[0,0]);r.__=\"P\"+t[0]+\"-\"+t[1]++}return r.__}function wC(){for(var r;r=py.shift();){var e=r.__H;if(r.__P&&e)try{e.__h.some(hc),e.__h.some(ql),e.__h=[]}catch(t){e.__h=[],De.__e(t,r.__v)}}}De.__b=function(r){be=null,sy&&sy(r)},De.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),dy&&dy(r,e)},De.__r=function(r){ay&&ay(r),Dn=0;var e=(be=r.__c).__H;e&&(zl===be?(e.__h=[],be.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some(hc),e.__h.some(ql),e.__h=[],Dn=0)),zl=be},De.diffed=function(r){cy&&cy(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(py.push(e)!==1&&oy===De.requestAnimationFrame||((oy=De.requestAnimationFrame)||EC)(wC)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),zl=be=null},De.__c=function(r,e){e.some(function(t){try{t.__h.some(hc),t.__h=t.__h.filter(function(n){return!n.__||ql(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],De.__e(n,t.__v)}}),uy&&uy(r,e)},De.unmount=function(r){ly&&ly(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.some(function(n){try{hc(n)}catch(i){e=i}}),t.__H=void 0,e&&De.__e(e,t.__v))};var fy=typeof requestAnimationFrame==\"function\";function EC(r){var e,t=function(){clearTimeout(n),fy&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,35);fy&&(e=requestAnimationFrame(t))}function hc(r){var e=be,t=r.__c;typeof t==\"function\"&&(r.__c=void 0,t()),be=e}function ql(r){var e=be;r.__c=r.__(),be=e}function Gl(r,e){return!r||r.length!==e.length||e.some(function(t,n){return t!==r[n]})}function hy(r,e){return typeof e==\"function\"?e(r):e}function Dy(r,e){for(var t in e)r[t]=e[t];return r}function Jl(r,e){for(var t in r)if(t!==\"__source\"&&!(t in e))return!0;for(var n in e)if(n!==\"__source\"&&r[n]!==e[n])return!0;return!1}function wi(r,e){var t=e(),n=mc({t:{__:t,u:e}}),i=n[0].t,o=n[1];return Cn(function(){i.__=t,i.u=e,Kl(i)&&o({t:i})},[r,t,e]),gr(function(){return Kl(i)&&o({t:i}),r(function(){Kl(i)&&o({t:i})})},[r]),t}function Kl(r){try{return!((e=r.__)===(t=r.u())&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}var e,t}function Cy(r){r()}function wy(r){return r}function Ey(){return[!1,Cy]}var Sy=Cn;function Yl(r,e){this.props=r,this.context=e}function mo(r,e){function t(i){var o=this.props.ref;return o!=i.ref&&o&&(typeof o==\"function\"?o(null):o.current=null),e?!e(this.props,i)||o!=i.ref:Jl(this.props,i)}function n(i){return this.shouldComponentUpdate=t,yt(r,i)}return n.displayName=\"Memo(\"+(r.displayName||r.name)+\")\",n.__f=n.prototype.isReactComponent=!0,n.type=r,n}(Yl.prototype=new kt).isPureReactComponent=!0,Yl.prototype.shouldComponentUpdate=function(r,e){return Jl(this.props,r)||Jl(this.state,e)};var my=K.__b;K.__b=function(r){r.type&&r.type.__f&&r.ref&&(r.props.ref=r.ref,r.ref=null),my&&my(r)};var SC=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function TC(r){function e(t){var n=Dy({},t);return delete n.ref,r(n,t.ref||null)}return e.$$typeof=SC,e.render=r,e.prototype.isReactComponent=e.__f=!0,e.displayName=\"ForwardRef(\"+(r.displayName||r.name)+\")\",e}var gy=function(r,e){return r==null?null:er(er(r).map(e))},kC={map:gy,forEach:gy,count:function(r){return r?er(r).length:0},only:function(r){var e=er(r);if(e.length!==1)throw\"Children.only\";return e[0]},toArray:er},$C=K.__e;K.__e=function(r,e,t,n){if(r.then){for(var i,o=e;o=o.__;)if((i=o.__c)&&i.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k||[]),i.__c(r,e)}$C(r,e,t,n)};var yy=K.unmount;function Ty(r,e,t){return r&&(r.__c&&r.__c.__H&&(r.__c.__H.__.forEach(function(n){typeof n.__c==\"function\"&&n.__c()}),r.__c.__H=null),(r=Dy({},r)).__c!=null&&(r.__c.__P===t&&(r.__c.__P=e),r.__c.__e=!0,r.__c=null),r.__k=r.__k&&r.__k.map(function(n){return Ty(n,e,t)})),r}function ky(r,e,t){return r&&t&&(r.__v=null,r.__k=r.__k&&r.__k.map(function(n){return ky(n,e,t)}),r.__c&&r.__c.__P===e&&(r.__e&&t.appendChild(r.__e),r.__c.__e=!0,r.__c.__P=t)),r}function yc(){this.__u=0,this.o=null,this.__b=null}function $y(r){var e=r.__&&r.__.__c;return e&&e.__a&&e.__a(r)}function IC(r){var e,t,n,i=null;function o(s){if(e||(e=r()).then(function(a){a&&(i=a.default||a),n=!0},function(a){t=a,n=!0}),t)throw t;if(!n)throw e;return i?yt(i,s):null}return o.displayName=\"Lazy\",o.__f=!0,o}function As(){this.i=null,this.l=null}K.unmount=function(r){var e=r.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&r.__u&&(r.type=null),yy&&yy(r)},(yc.prototype=new kt).__c=function(r,e){var t=e.__c,n=this;n.o==null&&(n.o=[]),n.o.push(t);var i=$y(n.__v),o=!1,s=function(){o||n.__z||(o=!0,t.__R=null,i?i(c):c())};t.__R=s;var a=t.__P;t.__P=null;var c=function(){if(!--n.__u){if(n.state.__a){var u=n.state.__a;n.__v.__k[0]=ky(u,u.__c.__P,u.__c.__O)}var l;for(n.setState({__a:n.__b=null});l=n.o.pop();)l.__P=a,l.forceUpdate()}};n.__u++||32&e.__u||n.setState({__a:n.__b=n.__v.__k[0]}),r.then(s,s)},yc.prototype.componentWillUnmount=function(){this.o=[]},yc.prototype.render=function(r,e){if(this.__b){if(this.__v.__k){var t=document.createElement(\"div\"),n=this.__v.__k[0].__c;this.__v.__k[0]=Ty(this.__b,t,n.__O=n.__P)}this.__b=null}var i=e.__a&&yt(Ie,null,r.fallback);return i&&(i.__u&=-33),[yt(Ie,null,e.__a?null:r.children),i]};var by=function(r,e,t){if(++t[1]===t[0]&&r.l.delete(e),r.props.revealOrder&&(r.props.revealOrder[0]!==\"t\"||!r.l.size))for(t=r.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;r.i=t=t[2]}};function FC(r){return this.getChildContext=function(){return r.context},r.children}function RC(r){var e=this,t=r.h;if(e.componentWillUnmount=function(){Zr(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var n=e.__v;n!==null&&!n.__m&&n.__!==null;)n=n.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:n.__m},contains:function(){return!0},namespaceURI:t.namespaceURI,insertBefore:function(i,o){this.childNodes.push(i),e.h.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),e.h.removeChild(i)}}}Zr(yt(FC,{context:e.context},r.__v),e.v)}function Xl(r,e){var t=yt(RC,{__v:r,h:e});return t.containerInfo=e,t}(As.prototype=new kt).__a=function(r){var e=this,t=$y(e.__v),n=e.l.get(r);return n[0]++,function(i){var o=function(){e.props.revealOrder?(n.push(i),by(e,r,n)):i()};t?t(o):o()}},As.prototype.render=function(r){this.i=null,this.l=new Map;var e=er(r.children);r.revealOrder&&r.revealOrder[0]===\"b\"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return r.children},As.prototype.componentDidUpdate=As.prototype.componentDidMount=function(){var r=this;this.l.forEach(function(e,t){by(r,t,e)})};var Iy=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.element\")||60103,OC=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,NC=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,MC=/[A-Z0-9]/g,jC=typeof document<\"u\",PC=function(r){return(typeof Symbol<\"u\"&&typeof Symbol()==\"symbol\"?/fil|che|rad/:/fil|che|ra/).test(r)};function LC(r,e,t){return e.__k==null&&(e.textContent=\"\"),Zr(r,e),typeof t==\"function\"&&t(),r?r.__c:null}function BC(r,e,t){return Jc(r,e),typeof t==\"function\"&&t(),r?r.__c:null}kt.prototype.isReactComponent=!0,[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(r){Object.defineProperty(kt.prototype,r,{configurable:!0,get:function(){return this[\"UNSAFE_\"+r]},set:function(e){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:e})}})});var vy=K.event;K.event=function(r){return vy&&(r=vy(r)),r.persist=function(){},r.isPropagationStopped=function(){return this.cancelBubble},r.isDefaultPrevented=function(){return this.defaultPrevented},r.nativeEvent=r};var Ql,VC={configurable:!0,get:function(){return this.class}},_y=K.vnode;K.vnode=function(r){typeof r.type==\"string\"&&(function(e){var t=e.props,n=e.type,i={},o=n.indexOf(\"-\")==-1;for(var s in t){var a=t[s];if(!(s===\"value\"&&\"defaultValue\"in t&&a==null||jC&&s===\"children\"&&n===\"noscript\"||s===\"class\"||s===\"className\")){var c=s.toLowerCase();s===\"defaultValue\"&&\"value\"in t&&t.value==null?s=\"value\":s===\"download\"&&a===!0?a=\"\":c===\"translate\"&&a===\"no\"?a=!1:c[0]===\"o\"&&c[1]===\"n\"?c===\"ondoubleclick\"?s=\"ondblclick\":c!==\"onchange\"||n!==\"input\"&&n!==\"textarea\"||PC(t.type)?c===\"onfocus\"?s=\"onfocusin\":c===\"onblur\"?s=\"onfocusout\":NC.test(s)&&(s=c):c=s=\"oninput\":o&&OC.test(s)?s=s.replace(MC,\"-$&\").toLowerCase():a===null&&(a=void 0),c===\"oninput\"&&i[s=c]&&(s=\"oninputCapture\"),i[s]=a}}n==\"select\"&&(i.multiple&&Array.isArray(i.value)&&(i.value=er(t.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=er(t.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,\"className\",VC)):t.className&&(i.class=i.className=t.className),e.props=i})(r),r.$$typeof=Iy,_y&&_y(r)};var xy=K.__r;K.__r=function(r){xy&&xy(r),Ql=r.__c};var Ay=K.diffed;K.diffed=function(r){Ay&&Ay(r);var e=r.props,t=r.__e;t!=null&&r.type===\"textarea\"&&\"value\"in e&&e.value!==t.value&&(t.value=e.value==null?\"\":e.value),Ql=null};var UC={ReactCurrentDispatcher:{current:{readContext:function(r){return Ql.__n[r.__c].props.value},useCallback:Xe,useContext:xs,useDebugValue:Wl,useDeferredValue:wy,useEffect:gr,useId:Hl,useImperativeHandle:Zl,useInsertionEffect:Sy,useLayoutEffect:Cn,useMemo:Lr,useReducer:gc,useRef:Pr,useState:mc,useSyncExternalStore:wi,useTransition:Ey}}};function zC(r){return yt.bind(null,r)}function bc(r){return!!r&&r.$$typeof===Iy}function qC(r){return bc(r)&&r.type===Ie}function ZC(r){return!!r&&typeof r.displayName==\"string\"&&r.displayName.indexOf(\"Memo(\")==0}function WC(r){return bc(r)?Wd.apply(null,arguments):r}function HC(r){return!!r.__k&&(Zr(null,r),!0)}function GC(r){return r&&(r.base||r.nodeType===1&&r)||null}var KC=function(r,e){return r(e)},JC=function(r,e){var t,n=K.debounceRendering;K.debounceRendering=function(o){t=o};try{var i=r(e);return t&&t(),i}finally{K.debounceRendering=n}},YC=bc,Fy={useState:mc,useId:Hl,useReducer:gc,useEffect:gr,useLayoutEffect:Cn,useInsertionEffect:Sy,useTransition:Ey,useDeferredValue:wy,useSyncExternalStore:wi,startTransition:Cy,useRef:Pr,useImperativeHandle:Zl,useMemo:Lr,useCallback:Xe,useContext:xs,useDebugValue:Wl,version:\"18.3.1\",Children:kC,render:LC,hydrate:BC,unmountComponentAtNode:HC,createPortal:Xl,createElement:yt,createContext:Fo,createFactory:zC,cloneElement:WC,createRef:Hc,Fragment:Ie,isValidElement:bc,isElement:YC,isFragment:qC,isMemo:ZC,findDOMNode:GC,Component:kt,PureComponent:Yl,memo:mo,forwardRef:TC,flushSync:JC,unstable_batchedUpdates:KC,StrictMode:Ie,Suspense:yc,SuspenseList:As,lazy:IC,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:UC};var XC=0;function ne(r,e,t,n,i,o){e||(e={});var s,a,c=e;if(\"ref\"in c)for(a in c={},e)a==\"ref\"?s=e[a]:c[a]=e[a];var u={type:r,props:c,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--XC,__i:-1,__u:0,__source:i,__self:o};if(typeof r==\"function\"&&(s=r.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return K.vnode&&K.vnode(u),u}var QC=class{},td=new WeakMap;function ew(r,e){td.set(r,e)}function tw(r){return td.has(r)}function rw(r){let e=r.parentNode;for(;e;){let t=e instanceof Element?td.get(e):void 0;if(t)return t;e=e instanceof ShadowRoot?e.host:e.parentNode}return null}var Ly=class vc{static registries=new WeakMap;static forSurface(e){let t=vc.registries.get(e);return t||(t=new vc,vc.registries.set(e,t)),t}hosts=new Map;snapshots=new Map;listeners=new Map;add(e,t,n){let i=this.hosts.get(e);i&&i.entry.node===t&&i.owner===n||(this.hosts.set(e,{entry:{host:e,node:t},owner:n}),i&&i.owner!==n&&this.publish(i.owner),this.publish(n))}delete(e){let t=this.hosts.get(e);t&&(this.hosts.delete(e),this.publish(t.owner))}has(e){return this.hosts.has(e)}entries(){return[...this.hosts.values()].map(({entry:e})=>e)}subscribe(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>{n.delete(t)}}getSnapshot(e){let t=this.snapshots.get(e);return t||(t=this.compute(e),this.snapshots.set(e,t)),t}compute(e){let t=[];for(let{entry:n,owner:i}of this.hosts.values())i===e&&t.push(n);return t}publish(e){this.snapshots.set(e,this.compute(e));for(let t of this.listeners.get(e)??[])t()}},nw=class extends HTMLElement{context;_node;registry;connectedCallback(){this.style.display=\"contents\",this.register()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.registry?.delete(this),this.registry=void 0)})}set node(r){this._node=r,this.context=r?.context,this.register()}get node(){return this._node}register(){let r=this._node,e=r?.context?.dataContext.surface;if(!this.isConnected||!r||!e||tw(this))return;let t=Ly.forSurface(e);this.registry!==t&&(this.registry?.delete(this),this.registry=t),t.add(this,r,rw(this))}},Ry=new WeakMap,Oy=new Map;function iw(r){let e=`a2ui-react-${r.toLowerCase()}`,t=(Oy.get(e)??0)+1;return Oy.set(e,t),t===1?e:`${e}-${t}`}function ow(r){if(mn(r))return r;let e=Ry.get(r);if(e)return e;let t={...r,tagName:iw(r.name),element:class extends nw{}};return Ry.set(r,t),t}var Ny=new WeakSet;function My(r){if(Ny.has(r))return;Ny.add(r);let e=r.components;for(let[t,n]of e)mn(n)||e.set(t,ow(n))}function sw(r){r.defaultCatalog&&My(r.defaultCatalog);for(let e of r.availableCatalogs.values())My(e)}function jy(r,e){r.context=e.context,r.node=e}var ed=mo(({node:r,owner:e,children:t})=>{let n=r.impl;if(!mn(n))throw new Error(`A2UI catalog entry '${r.type}' has no element. A2uiSurface prepares the surface's default and available catalogs; this entry came from another catalog.`);no(n);let i=Pr(null),o=Pr(r);o.current=r;let s=Xe(a=>{i.current=a,a&&(e&&ew(a,e),jy(a,o.current))},[e]);return gr(()=>{i.current&&jy(i.current,r)},[r]),Fy.createElement(n.tagName,{ref:s},t)});ed.displayName=\"WebComponentNode\";function By(r){if(!r.context)throw new Error(`A2UI views render only resolved nodes; '${r.componentId}' has no context.`);return r.context}var Vy=({componentId:r})=>ne(\"div\",{style:{color:\"gray\",padding:\"4px\"},children:[\"[Loading \",r,\"...]\"]}),Py=new WeakMap,Uy=({surface:r,id:e,requestedPath:t,detail:n})=>{let i=`Unresolved child reference '${e}' at '${t}': ${n}`;return gr(()=>{let o=Py.get(r);o||(o=new Set,Py.set(r,o));let s=JSON.stringify([e,t]);o.has(s)||(o.add(s),r.dispatchError({code:\"UNRESOLVED_CHILD_REFERENCE\",message:i}))},[r,e,t,i]),ne(\"div\",{style:{color:\"red\"},children:i})};function zy(r){let e=Xe(n=>sr(()=>{Be(r),n()}),[r]),t=Xe(()=>Ye(r),[r]);return wi(e,t)}function aw(r,e){return r.set(e.id,e),e.id}function _c(r,e,t){if(vt(e)){let n=aw(t,e);return e.dataPath!==r.dataPath?{id:n,basePath:e.dataPath}:n}return e instanceof st?_c(r,e.value,t):Array.isArray(e)?e.map(n=>_c(r,n,t)):cw(e)?qy(r,e,t):e}function cw(r){if(!r||typeof r!=\"object\")return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null}function qy(r,e,t){let n={};for(let[i,o]of Object.entries(e))o instanceof st?(n[i]=_c(r,o.value,t),n[`set${i.charAt(0).toUpperCase()}${i.slice(1)}`]=eo(o)?o.set:()=>{}):n[i]=_c(r,o,t);return n}function Zy(r,e){let t=By(r),n=t.dataContext.surface,i=zy(r.props),{viewProps:o,childIndex:s}=Lr(()=>{let u=new Map;return{viewProps:qy(r,i,u),childIndex:u}},[r,i]),a=Xe((u,l)=>{let p=l??r.dataPath,f=[...s.values()].filter(h=>h.componentId===u),m=f.find(h=>h.dataPath===p);if(m)return e(m,l);let g=[...new Set(f.map(h=>h.dataPath))];return g.length>0?ne(Uy,{surface:n,id:u,requestedPath:p,detail:`instances exist at ${g.join(\", \")}. Instances are created only at the data paths the payload implies; buildChild selects among them.`},JSON.stringify([u,p])):e(u,l)},[e,r,n,s]),c=Xe((u,l)=>{let p=s.get(u);return p?e(p,l):a(u,l)},[e,a,s]);return{viewProps:o,context:t,viewBuildChild:c,rawBuildChild:a}}var uw=({node:r,impl:e,buildChild:t})=>{let{context:n,rawBuildChild:i}=Zy(r,t),o=e.render;return ne(o,{context:n,buildChild:i})},rd=mo(({node:r})=>{let e=Lr(()=>new QC,[]);if(r.state===\"unknown-type\")return ne(\"div\",{style:{color:\"red\"},children:[\"Unknown component type: \",r.type]});if(r.isPlaceholder||!r.impl||!r.context)return ne(Vy,{componentId:r.componentId});if(\"render\"in r.impl)return ne(ed,{node:r,owner:e,children:ne(nd,{node:r})});let t=r.context.dataContext.surface;return ne(Ie,{children:[ne(ed,{node:r,owner:e}),ne(Wy,{surface:t,owner:e})]})});rd.displayName=\"ChildElement\";var Wy=({surface:r,owner:e})=>{let t=Ly.forSurface(r),n=Xe(s=>t.subscribe(e,s),[t,e]),i=Xe(()=>t.getSnapshot(e),[t,e]),o=wi(n,i);return ne(Ie,{children:o.map(({host:s,node:a})=>Xl(ne(nd,{node:a}),s,a.id))})},nd=mo(({node:r})=>{let e=By(r).dataContext.surface,t=Xe((o,s)=>{if(vt(o))return ne(rd,{node:o},o.id);let a=s??r.dataPath,c=e.componentsModel.get(o)?\"the component exists, but the catalog schema does not mark the referencing property as a component id. Use componentId() or childList() from @a2ui/web_core.\":\"no component with this id exists on the surface.\";return ne(Uy,{surface:e,id:o,requestedPath:a,detail:c},JSON.stringify([o,a]))},[e,r]),n=r.impl;if(r.disposed||!n||!(\"render\"in n))return null;let i=n.view;return i?ne(i,{node:r,buildChild:t}):ne(uw,{node:r,impl:n,buildChild:t})});nd.displayName=\"NodeContent\";var Hy=Fo(void 0),Gy=()=>xs(Hy),id=({surface:r})=>{let e=Gy();Cn(()=>{e&&El(e)},[e]);let t=Lr(()=>({resolver:void 0}),[r]),n=Xe(s=>{sw(r);let a=new Va(r,r.defaultCatalog);t.resolver=a;let c=sr(()=>{Be(a.rootNode),s()});return()=>{c(),a.dispose(),t.resolver===a&&(t.resolver=void 0)}},[r,t]),i=Xe(()=>t.resolver?Ye(t.resolver.rootNode):void 0,[t]),o=wi(n,i);return o?ne(Ie,{children:[ne(rd,{node:o}),ne(Wy,{surface:r,owner:null})]}):ne(Vy,{componentId:\"root\"})};function Ds(r,e){let t=mo(e,(o,s)=>!(o.props!==s.props||o.buildChild!==s.buildChild||o.context.componentModel.id!==s.context.componentModel.id||o.context.dataContext.path!==s.context.dataContext.path)),n=({context:o,buildChild:s})=>{let a=Pr(null);a.current?a.current.context!==o&&(a.current.dispose(),a.current=new Or(o,r.schema)):a.current=new Or(o,r.schema);let c=a.current,u=Xe(f=>{let m=c.subscribe(f);return()=>m.unsubscribe()},[c]),l=Xe(()=>c.snapshot,[c]),p=wi(u,l);return gr(()=>()=>c.dispose(),[c]),ne(t,{props:p||{},buildChild:s,context:o})},i=({node:o,buildChild:s})=>{let{viewProps:a,context:c,viewBuildChild:u}=Zy(o,s);return ne(t,{props:a,buildChild:u,context:c})};return i.displayName=`${r.name}.view`,{name:r.name,schema:r.schema,render:n,view:i}}var go=class extends Error{#e;#t;#n;#i;constructor({name:e,code:t,message:n,node:i,cause:o,range:s}){super(n,o?{cause:o}:void 0),this.name=e,this.#t=t,this.#i=n,this.#e=i,this.#n=s&&od(s)||od(i),i?.input&&(this.message=Ky(this.#i,i,this.#n))}get node(){return this.#e}get code(){return this.#t}get range(){return this.#n}get summary(){return this.#i}withAst(e){return this.#e||!e?.input?this:(this.#e=e,this.#n??=od(e),this.message=Ky(this.#i,e,this.#n),this)}};function sd(r,e,t,n,i){if(typeof t==\"string\")return{name:r,code:e,message:t,node:n,cause:i};let o=t;if(typeof o!=\"object\")throw new Error(\"First param to error must be a string or object\");return{name:r,code:o.code||e,message:o.message,node:o.node,cause:o.cause,range:o.range}}var Cs=class extends go{constructor(e,t,n){super(sd(\"ParseError\",\"parse_error\",e,t,n))}},Ei=class extends go{constructor(e,t,n){super(sd(\"EvaluationError\",\"evaluation_error\",e,t,n))}},ws=class extends go{constructor(e,t,n){super(sd(\"TypeError\",\"type_error\",e,t,n))}};function qe(r,e,t){return typeof r==\"object\"?new Cs(r):new Cs({code:r,message:e,node:t})}function H(r,e,t){return typeof r==\"object\"?new Ei(r):new Ei({code:r,message:e,node:t})}function Jy(r,e,t){return typeof r==\"object\"?new ws(r):new ws({code:r,message:e,node:t})}function od(r){let e=r?.pos??r?.start;if(typeof e!=\"number\")return;let t=typeof r.end==\"number\"?r.end:e;return{start:e,end:t}}function Ky(r,e,t){let n=e.pos??t?.start;if(typeof n!=\"number\")return r;let i=e.input,o=1,s=0,a=0;for(;s<n;)i[s]===`\n`?(o++,a=0):a++,s++;let c=n,u=n;for(;c>0&&i[c-1]!==`\n`;)c--;for(;u<i.length&&i[u]!==`\n`;)u++;let l=i.slice(c,u),p=`> ${`${o}`.padStart(4,\" \")} | ${l}\n${\" \".repeat(9+a)}^`;return`${r}\n\n${p}`}function Es(r,e){return r instanceof go?r.withAst(e):r}var Dt=class r{#e;constructor(e){this.#e=e}static of(e){return e===void 0?Ss:new r(e)}static none(){return Ss}hasValue(){return this.#e!==void 0}value(){if(this.#e===void 0)throw H(\"optional_value_missing\",\"Optional value is not present\");return this.#e}or(e){if(this.#e!==void 0)return this;if(e instanceof r)return e;throw H(\"invalid_optional_argument\",\"Optional.or must be called with an Optional argument\")}orValue(e){return this.#e===void 0?e:this.#e}get[Symbol.toStringTag](){return\"optional\"}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.#e===void 0?\"Optional { none }\":`Optional { value: ${JSON.stringify(this.#e)} }`}},Ss=Object.freeze(new Dt),xc=class{},Yy=new xc;function Xy(r,e){let t=e?Yy:void 0;r.deleteVariable(\"optional\"),r.registerConstant(\"optional\",\"OptionalNamespace\",t)}function Qy(r){let e={async:!1},t=(f,m)=>r.registerFunctionOverload(f,m,e),n=r.enableOptionalTypes?Yy:void 0;r.registerType(\"OptionalNamespace\",xc),r.registerConstant(\"optional\",\"OptionalNamespace\",n),t(\"optional.hasValue(): bool\",f=>f.hasValue()),t(\"optional<A>.value(): A\",f=>f.value()),r.registerFunctionOverload(\"OptionalNamespace.none(): optional<T>\",()=>Dt.none()),t(\"OptionalNamespace.of(A): optional<A>\",(f,m)=>Dt.of(m));function i(f,m,g){if(f instanceof Dt)return f;throw H(\"optional_expected\",`${g} must be optional`,m)}function o(f,m,g){let h=f.run(m.receiver,g);return h instanceof Promise?h.then(b=>s(b,f,m,g)):s(h,f,m,g)}function s(f,m,g,h){let b=i(f,g.receiver,`${g.functionDesc} receiver`);return b.hasValue()?g.onHasValue(b):g.onEmpty(m,g,h)}function a(f,m,g,h){let b=f.check(m,g);if(b.kind===\"optional\")return b;if(b.kind===\"dyn\")return f.getType(\"optional\");throw f.createError(\"optional_expected\",`${h} must be optional, got '${b}'`,m)}function c({functionDesc:f,evaluate:m,typeCheck:g,onHasValue:h,onEmpty:b}){return({ast:v,args:x,receiver:$})=>({ast:v,functionDesc:f,receiver:$,arg:x[0],evaluate:m,typeCheck:g,onHasValue:h,onEmpty:b})}let u=\"optional.orValue() receiver\",l=\"optional.or(optional) receiver\",p=\"optional.or(optional) argument\";r.registerFunctionOverload(\"optional.or(ast): optional<dyn>\",c({functionDesc:\"optional.or(optional)\",evaluate:o,typeCheck(f,m,g){let h=a(f,m.receiver,g,l),b=a(f,m.arg,g,p);m.receiver.maybeAsync||m.arg.maybeAsync||m.ast.setMeta(\"async\",!1);let v=h.unify(f.registry,b);if(v)return v;throw f.createError(\"incompatible_argument_type\",`${m.functionDesc} argument must be compatible type, got '${h}' and '${b}'`,m.arg)},onHasValue:f=>f,onEmpty(f,m,g){let h=m.arg,b=f.run(h,g);return b instanceof Promise?b.then(v=>i(v,h,p)):i(b,h,p)}})),r.registerFunctionOverload(\"optional.orValue(ast): dyn\",c({functionDesc:\"optional.orValue(value)\",onHasValue:f=>f.value(),onEmpty(f,m,g){return f.run(m.arg,g)},evaluate:o,typeCheck(f,m,g){let h=a(f,m.receiver,g,u).valueType,b=f.check(m.arg,g);m.receiver.maybeAsync||m.arg.maybeAsync||m.ast.setMeta(\"async\",!1);let v=h.unify(f.registry,b);if(v)return v;throw f.createError(\"incompatible_argument_type\",`${m.functionDesc} argument must be compatible type, got '${h}' and '${b}'`,m.arg)}}))}var yo=Object.hasOwn,Ze=Object.keys,Ht=Object.freeze,eb=Object.entries,Si=Array.isArray,ad=Array.from,Ti=0n,tb=18446744073709551615n,Ac=9223372036854775807n,Dc=-9223372036854775808n;function Ts(r,e){return r?.[Symbol.toStringTag]===\"AsyncFunction\"?!0:typeof e==\"boolean\"?e:!0}var bo=new Set([\"as\",\"break\",\"const\",\"continue\",\"else\",\"for\",\"function\",\"if\",\"import\",\"let\",\"loop\",\"package\",\"namespace\",\"return\",\"var\",\"void\",\"while\",\"__proto__\",\"prototype\"]);var Ne=class{#e;constructor(e){this.verify(typeof e==\"bigint\"?e:BigInt(e))}get value(){return this.#e}valueOf(){return this.#e}toString(){return`${this.#e}`}verify(e){if(e<Ti||e>tb)throw H(\"numeric_overflow\",\"Unsigned integer overflow\");this.#e=e}get[Symbol.toStringTag](){return`value = ${this.#e}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return`UnsignedInteger { value: ${this.#e} }`}},vo=1e9,_o=1000000000n,lw={h:3600000000000n,m:60000000000n,s:_o,ms:1000000n,us:1000n,\u00B5s:1000n,ns:1n},wn=class r{#e;#t;constructor(e,t=0){this.#e=BigInt(e),this.#t=t}get seconds(){return this.#e}get nanos(){return this.#t}valueOf(){return Number(this.#e)*1e3+this.#t/1e6}static fromMilliseconds(e){let t=BigInt(Math.trunc(e*1e6)),n=t/_o,i=Number(t%_o);return new r(n,i)}addDuration(e){let t=this.#t+e.nanos;return new r(this.#e+e.seconds+BigInt(Math.floor(t/vo)),t%vo)}subtractDuration(e){let t=this.#t-e.nanos;return new r(this.#e-e.seconds+BigInt(Math.floor(t/vo)),(t+vo)%vo)}extendTimestamp(e){return new Date(e.getTime()+Number(this.#e)*1e3+Math.floor(this.#t/1e6))}subtractTimestamp(e){return new Date(e.getTime()-Number(this.#e)*1e3-Math.floor(this.#t/1e6))}toString(){let e=this.#t?(this.#t/vo).toLocaleString(\"en-US\",{useGrouping:!1,maximumFractionDigits:9}).slice(1):\"\";return`${this.#e}${e}s`}getHours(){return this.#e/3600n}getMinutes(){return this.#e/60n}getSeconds(){return this.#e}getMilliseconds(){return this.#e*1000n+BigInt(Math.floor(this.#t/1e6))}get[Symbol.toStringTag](){return\"google.protobuf.Duration\"}[Symbol.for(\"nodejs.util.inspect.custom\")](){return`google.protobuf.Duration { seconds: ${this.#e}, nanos: ${this.#t} }`}};function nb(r){let e={async:!1},t=(h,b)=>r.registerFunctionOverload(h,b,e),n=h=>h;t(\"dyn(dyn): dyn\",n);for(let h in Br){let b=Br[h];b instanceof Me&&t(`type(${b.name}): type`,()=>b)}t(\"bool(bool): bool\",n),t(\"bool(string): bool\",h=>{switch(h){case\"1\":case\"t\":case\"true\":case\"TRUE\":case\"True\":return!0;case\"0\":case\"f\":case\"false\":case\"FALSE\":case\"False\":return!1;default:throw H(\"bool_conversion_error\",`bool() conversion error: invalid string value \"${h}\"`)}}),t(\"size(string): int\",h=>BigInt(rb(h))),t(\"size(bytes): int\",h=>BigInt(h.length)),t(\"size(list): int\",h=>BigInt(h.length??h.size)),t(\"size(map): int\",h=>BigInt(h instanceof Map?h.size:Ze(h).length)),t(\"string.size(): int\",h=>BigInt(rb(h))),t(\"bytes.size(): int\",h=>BigInt(h.length)),t(\"list.size(): int\",h=>BigInt(h.length??h.size)),t(\"map.size(): int\",h=>BigInt(h instanceof Map?h.size:Ze(h).length)),t(\"bytes(string): bytes\",h=>s.fromString(h)),t(\"bytes(bytes): bytes\",n),t(\"double(double): double\",n),t(\"double(int): double\",h=>Number(h)),t(\"double(uint): double\",h=>Number(h)),t(\"double(string): double\",h=>{if(!h||h!==h.trim())throw H(\"double_conversion_error\",\"double() type error: cannot convert to double\");switch(h.toLowerCase()){case\"inf\":case\"+inf\":case\"infinity\":case\"+infinity\":return Number.POSITIVE_INFINITY;case\"-inf\":case\"-infinity\":return Number.NEGATIVE_INFINITY;case\"nan\":return Number.NaN;default:{let v=Number(h);if(!Number.isNaN(v))return v;throw H(\"double_conversion_error\",\"double() type error: cannot convert to double\")}}}),t(\"int(int): int\",n),t(\"int(double): int\",h=>{if(Number.isFinite(h))return BigInt(Math.trunc(h));throw H(\"numeric_overflow\",\"int() type error: integer overflow\")}),t(\"int(string): int\",h=>{if(h!==h.trim()||h.length>20||h.includes(\"0x\"))throw H(\"int_conversion_error\",\"int() type error: cannot convert to int\");try{let b=BigInt(h);if(b<=Ac&&b>=Dc)return b}catch{}throw H(\"int_conversion_error\",\"int() type error: cannot convert to int\")}),t(\"uint(uint): uint\",n),t(\"uint(int): uint\",h=>{try{return new Ne(h)}catch{throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\")}}),t(\"uint(double): uint\",h=>{try{return new Ne(Math.trunc(h))}catch{throw H(\"numeric_overflow\",\"uint() type error: unsigned integer overflow\")}}),t(\"uint(string): uint\",h=>{if(h!==h.trim()||h.length>20||h.includes(\"0x\"))throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\");try{return new Ne(h)}catch{throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\")}}),t(\"string(string): string\",n),t(\"string(bool): string\",h=>`${h}`),t(\"string(int): string\",h=>`${h}`),t(\"string(uint): string\",h=>`${h}`),t(\"string(bytes): string\",h=>s.toUtf8(h)),t(\"string(double): string\",h=>h===1/0?\"+Inf\":h===-1/0?\"-Inf\":`${h}`),t(\"string.startsWith(string): bool\",(h,b)=>h.startsWith(b)),t(\"string.endsWith(string): bool\",(h,b)=>h.endsWith(b)),t(\"string.contains(string): bool\",(h,b)=>h.includes(b)),t(\"string.lowerAscii(): string\",h=>h.toLowerCase()),t(\"string.upperAscii(): string\",h=>h.toUpperCase()),t(\"string.trim(): string\",h=>h.trim()),t(\"string.indexOf(string): int\",(h,b)=>BigInt(h.indexOf(b))),t(\"string.indexOf(string, int): int\",(h,b,v)=>{if(b===\"\")return v;if(v=Number(v),v<0||v>=h.length)throw H(\"index_out_of_range\",\"string.indexOf(search, fromIndex): fromIndex out of range\");return BigInt(h.indexOf(b,v))}),t(\"string.lastIndexOf(string): int\",(h,b)=>BigInt(h.lastIndexOf(b))),t(\"string.lastIndexOf(string, int): int\",(h,b,v)=>{if(b===\"\")return v;if(v=Number(v),v<0||v>=h.length)throw H(\"index_out_of_range\",\"string.lastIndexOf(search, fromIndex): fromIndex out of range\");return BigInt(h.lastIndexOf(b,v))}),t(\"string.substring(int): string\",(h,b)=>{if(b=Number(b),b<0||b>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): start index out of range\");return h.substring(b)}),t(\"string.substring(int, int): string\",(h,b,v)=>{if(b=Number(b),b<0||b>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): start index out of range\");if(v=Number(v),v<b||v>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): end index out of range\");return h.substring(b,v)}),t(\"string.matches(string): bool\",(h,b)=>{try{return new RegExp(b).test(h)}catch{throw H(\"invalid_regular_expression\",`Invalid regular expression: ${b}`)}}),t(\"string.split(string): list<string>\",(h,b)=>h.split(b)),t(\"string.split(string, int): list<string>\",(h,b,v)=>{if(v=Number(v),v===0)return[];let x=h.split(b);if(v<0||x.length<=v)return x;let $=x.slice(0,v-1);return $.push(x.slice(v-1).join(b)),$}),t(\"list<string>.join(): string\",h=>{for(let b=0;b<h.length;b++)if(typeof h[b]!=\"string\")throw H(\"invalid_list_element_type\",\"string.join(): list must contain only strings\");return h.join(\"\")}),t(\"list<string>.join(string): string\",(h,b)=>{for(let v=0;v<h.length;v++)if(typeof h[v]!=\"string\")throw H(\"invalid_list_element_type\",\"string.join(separator): list must contain only strings\");return h.join(b)});let i=new TextEncoder(\"utf8\"),o=new TextDecoder(\"utf8\"),s=typeof Buffer<\"u\"?{byteLength:h=>Buffer.byteLength(h),fromString:h=>Buffer.from(h,\"utf8\"),toHex:h=>Buffer.prototype.hexSlice.call(h,0,h.length),toBase64:h=>Buffer.prototype.base64Slice.call(h,0,h.length),toUtf8:h=>Buffer.prototype.utf8Slice.call(h,0,h.length),jsonParse:h=>JSON.parse(h)}:{textEncoder:new TextEncoder(\"utf8\"),byteLength:h=>i.encode(h).length,fromString:h=>i.encode(h),toHex:Uint8Array.prototype.toHex?h=>h.toHex():h=>ad(h,b=>b.toString(16).padStart(2,\"0\")).join(\"\"),toBase64:Uint8Array.prototype.toBase64?h=>h.toBase64():h=>btoa(ad(h,b=>String.fromCodePoint(b)).join(\"\")),toUtf8:h=>o.decode(h),jsonParse:h=>JSON.parse(i.decode(h))};t(\"bytes.json(): map\",s.jsonParse),t(\"bytes.hex(): string\",s.toHex),t(\"bytes.string(): string\",s.toUtf8),t(\"bytes.base64(): string\",s.toBase64),t(\"bytes.at(int): int\",(h,b)=>{if(b<0||b>=h.length)throw H(\"index_out_of_range\",\"Bytes index out of range\");return BigInt(h[b])});let a=\"google.protobuf.Timestamp\",c=\"google.protobuf.Duration\",u=r.registerType(a,Date).typeType,l=r.registerType(c,wn).typeType;r.registerConstant(\"google\",\"map<string, map<string, type>>\",{protobuf:{Duration:l,Timestamp:u}});function p(h,b){return new Date(h.toLocaleString(\"en-US\",{timeZone:b}))}function f(h,b){let v=b?p(h,b):new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),x=new Date(v.getFullYear(),0,0);return BigInt(Math.floor((v-x)/864e5)-1)}t(`timestamp(string): ${a}`,h=>{if(h.length<20||h.length>30)throw H(\"invalid_timestamp\",\"timestamp() requires a string in ISO 8601 format\");let b=new Date(h);if(b<=0xe677d21fdbff&&b>=-621355968e5)return b;throw H(\"invalid_timestamp\",\"timestamp() requires a string in ISO 8601 format\")}),t(`timestamp(int): ${a}`,h=>{if(h=Number(h)*1e3,h<=0xe677d21fdbff&&h>=-621355968e5)return new Date(h);throw H(\"invalid_timestamp\",\"timestamp() requires a valid integer unix timestamp\")}),t(`${a}.getDate(): int`,h=>BigInt(h.getUTCDate())),t(`${a}.getDate(string): int`,(h,b)=>BigInt(p(h,b).getDate())),t(`${a}.getDayOfMonth(): int`,h=>BigInt(h.getUTCDate()-1)),t(`${a}.getDayOfMonth(string): int`,(h,b)=>BigInt(p(h,b).getDate()-1)),t(`${a}.getDayOfWeek(): int`,h=>BigInt(h.getUTCDay())),t(`${a}.getDayOfWeek(string): int`,(h,b)=>BigInt(p(h,b).getDay())),t(`${a}.getDayOfYear(): int`,f),t(`${a}.getDayOfYear(string): int`,f),t(`${a}.getFullYear(): int`,h=>BigInt(h.getUTCFullYear())),t(`${a}.getFullYear(string): int`,(h,b)=>BigInt(p(h,b).getFullYear())),t(`${a}.getHours(): int`,h=>BigInt(h.getUTCHours())),t(`${a}.getHours(string): int`,(h,b)=>BigInt(p(h,b).getHours())),t(`${a}.getMilliseconds(): int`,h=>BigInt(h.getUTCMilliseconds())),t(`${a}.getMilliseconds(string): int`,h=>BigInt(h.getUTCMilliseconds())),t(`${a}.getMinutes(): int`,h=>BigInt(h.getUTCMinutes())),t(`${a}.getMinutes(string): int`,(h,b)=>BigInt(p(h,b).getMinutes())),t(`${a}.getMonth(): int`,h=>BigInt(h.getUTCMonth())),t(`${a}.getMonth(string): int`,(h,b)=>BigInt(p(h,b).getMonth())),t(`${a}.getSeconds(): int`,h=>BigInt(h.getUTCSeconds())),t(`${a}.getSeconds(string): int`,(h,b)=>BigInt(p(h,b).getSeconds()));let m=/(\\d*\\.?\\d*)(ns|us|\u00B5s|ms|s|m|h)/;function g(h){if(!h)throw H(\"invalid_duration\",\"Invalid duration string: ''\");let b=h[0]===\"-\";(h[0]===\"-\"||h[0]===\"+\")&&(h=h.slice(1));let v=BigInt(0);for(;;){let V=m.exec(h);if(!V)throw H(\"invalid_duration\",`Invalid duration string: ${h}`);if(V.index!==0)throw H(\"invalid_duration\",`Invalid duration string: ${h}`);h=h.slice(V[0].length);let S=lw[V[2]],[N=\"0\",P=\"\"]=V[1].split(\".\"),B=BigInt(N)*S,O=P?BigInt(P.slice(0,13).padEnd(13,\"0\"))*S/10000000000000n:0n;if(v+=B+O,h===\"\")break}let x=v>=_o?v/_o:0n,$=Number(v%_o);return b?new wn(-x,-$):new wn(x,$)}t(\"duration(string): google.protobuf.Duration\",h=>g(h)),t(\"google.protobuf.Duration.getHours(): int\",h=>h.getHours()),t(\"google.protobuf.Duration.getMinutes(): int\",h=>h.getMinutes()),t(\"google.protobuf.Duration.getSeconds(): int\",h=>h.getSeconds()),t(\"google.protobuf.Duration.getMilliseconds(): int\",h=>h.getMilliseconds()),Qy(r)}function rb(r){let e=0;for(let t of r)e++;return e}var Me=class{#e;constructor(e){this.#e=e,Ht(this)}get name(){return this.#e}get[Symbol.toStringTag](){return`Type<${this.#e}>`}toString(){return`Type<${this.#e}>`}},Br={string:new Me(\"string\"),bool:new Me(\"bool\"),int:new Me(\"int\"),uint:new Me(\"uint\"),double:new Me(\"double\"),map:new Me(\"map\"),list:new Me(\"list\"),bytes:new Me(\"bytes\"),null_type:new Me(\"null\"),type:new Me(\"type\")},dw=new Me(\"optional\"),Ec={dyn(r,e){switch(typeof r){case\"string\":case\"bigint\":case\"number\":case\"boolean\":return!0;case\"object\":switch(r&&r.constructor){case null:case void 0:case Object:case Map:case Array:case Set:return!0;default:if(e.objectTypesByConstructor.get(r.constructor))return!0}}return!!e.debugType(r)},string(r){return typeof r==\"string\"},int(r){return typeof r==\"bigint\"},double(r){return typeof r==\"number\"},bool(r){return typeof r==\"boolean\"},null(r){return r===null},bytes(r){return r instanceof Uint8Array},uint(r){return r instanceof Ne},type(r){return r instanceof Me},list(r){switch(r?.constructor){case Array:case Set:return!0;default:return!1}},map(r){switch(typeof r==\"object\"&&r?r.constructor:null){case void 0:case Object:case Map:return!0;default:return!1}},optional(r){return r instanceof Dt},message(r,e){return this===e.debugType(r)}};Ec.param=Ec.dyn;var Gt=class{#e=new WeakMap;constructor({kind:e,type:t,name:n,keyType:i,valueType:o}){this.kind=e,this.type=t,this.name=n,this.keyType=i,this.valueType=o,this.unwrappedType=e===\"dyn\"&&o?o.unwrappedType:this,this.wrappedType=e===\"dyn\"?this:cb(this.unwrappedType),this.hasDynType=this.kind===\"dyn\"||this.valueType?.hasDynType||this.keyType?.hasDynType||!1,this.hasPlaceholderType=this.kind===\"param\"||this.keyType?.hasPlaceholderType||this.valueType?.hasPlaceholderType||!1,e===\"list\"?this.fieldLazy=this.#s:e===\"map\"?this.fieldLazy=this.#i:e===\"message\"?this.fieldLazy=this.#n:e===\"optional\"&&(this.fieldLazy=this.#t),this.matchesValueType=Ec[n]||Ec[e],Ht(this)}isDynOrBool(){return this.type===\"bool\"||this.kind===\"dyn\"}isEmpty(){return this.valueType&&this.valueType.kind===\"param\"}unify(e,t){let n=this;if(n===t||n.kind===\"dyn\"||t.kind===\"param\")return n;if(t.kind===\"dyn\"||n.kind===\"param\")return t;if(n.kind!==t.kind||!(n.hasPlaceholderType||t.hasPlaceholderType||n.hasDynType||t.hasDynType))return null;let i=n.valueType.unify(e,t.valueType);if(!i)return null;switch(n.kind){case\"optional\":return e.getOptionalType(i);case\"list\":return e.getListType(i);case\"map\":let o=n.keyType.unify(e,t.keyType);return o?e.getMapType(o,i):null}}templated(e,t){if(!this.hasPlaceholderType)return this;switch(this.kind){case\"dyn\":return this.valueType.templated(e,t);case\"param\":return t?.get(this.name)||this;case\"map\":return e.getMapType(this.keyType.templated(e,t),this.valueType.templated(e,t));case\"list\":return e.getListType(this.valueType.templated(e,t));case\"optional\":return e.getOptionalType(this.valueType.templated(e,t));default:return this}}toString(){return this.name}#t(e,t,n,i){if(e=e instanceof Dt?e.orValue():e,e===void 0)return Ss;let o=i.debugType(e);try{return Dt.of(o.fieldLazy(e,t,n,i))}catch(s){if(s instanceof Ei)return Ss;throw s}}#n(e,t,n,i){let o=e?i.objectTypesByConstructor.get(e.constructor):void 0;if(!o)return;let s=o.fields?o.fields[t]:ht;if(!s)return;let a=e instanceof Map?e.get(t):e[t];if(a!==void 0){if(s.matchesValueType(a,i))return a;throw H(\"field_type_mismatch\",`Field '${t}' is not of type '${s}', got '${i.debugType(a)}'`,n)}}#i(e,t,n,i){let o=e instanceof Map?e.get(t):e&&yo(e,t)?e[t]:void 0;if(o!==void 0){if(this.valueType.matchesValueType(o,i))return o;throw H(\"field_type_mismatch\",`Field '${t}' is not of type '${this.valueType}', got '${i.debugType(o)}'`,n)}}#o(e,t){switch(e?.constructor){case Array:return e[t];case Set:{let n=0;for(let i of e)if(n++===t)return i}}}#s(e,t,n,i){if(typeof t==\"bigint\")t=Number(t);else if(typeof t!=\"number\")return;let o=this.#o(e,t);if(o===void 0){if(!e)return;throw H(\"index_out_of_bounds\",`No such key: index out of bounds, index ${t} ${t<0?\"< 0\":`>= size ${e.length||e.size}`}`,n)}if(this.valueType.matchesValueType(o,i))return o;throw H(\"list_item_type_mismatch\",`List item with index '${t}' is not of type '${this.valueType}', got '${i.debugType(o)}'`,n)}fieldLazy(){}field(e,t,n,i){let o=this.fieldLazy(e,t,n,i);if(o!==void 0)return o;throw H(\"no_such_key\",`No such key: ${t}`,n)}matchesBoth(e){return this.matches(e)&&e.matches(this)}matches(e){let t=this.unwrappedType;return e=e.unwrappedType,t===e||t.kind===\"dyn\"||e.kind===\"dyn\"||e.kind===\"param\"?!0:this.#e.get(e)??this.#e.set(e,this.#r(t,e)).get(e)}#r(e,t){switch(e.kind){case\"dyn\":case\"param\":return!0;case\"list\":return t.kind===\"list\"&&e.valueType.matches(t.valueType);case\"map\":return t.kind===\"map\"&&e.keyType.matches(t.keyType)&&e.valueType.matches(t.valueType);case\"optional\":return t.kind===\"optional\"&&e.valueType.matches(t.valueType);default:return e.name===t.name}}},fw=\"have a .callAst property or .evaluate(checker, macro, ctx) method.\",pw=\"have a .callAst property or .typeCheck(checker, macro, ctx) method.\";function hw(r,e){let t=`Macro '${r}' must`;return function(i){let o=e(i);if(!o||typeof o!=\"object\")throw new Error(`${t} return an object.`);if(o.callAst)return o;if(!o.evaluate)throw new Error(`${t} ${fw}`);if(!o.typeCheck)throw new Error(`${t} ${pw}`);return o}}var ks=class{constructor(e,t,n,i){this.name=e,this.type=t,this.description=n??null,this.constant=i!==void 0,this.value=i,Ht(this)}},ud=class{constructor({name:e,receiverType:t,returnType:n,handler:i,description:o,params:s,async:a}){if(typeof e!=\"string\")throw new Error(\"name must be a string\");if(typeof i!=\"function\")throw new Error(\"handler must be a function\");this.name=e,this.async=Ts(i,a),this.receiverType=t??null,this.returnType=n,this.description=o??null,this.params=s,this.argTypes=s.map(u=>u.type),this.macro=this.argTypes.includes(lb);let c=t?`${t}.`:\"\";this.signature=`${c}${e}(${this.argTypes.join(\", \")}): ${n}`,this.handler=this.macro?hw(this.signature,i):i,this.partitionKey=`${t?\"rcall\":\"call\"}:${e}:${s.length}`,this.hasPlaceholderType=this.returnType.hasPlaceholderType||this.receiverType?.hasPlaceholderType||this.argTypes.some(u=>u.hasPlaceholderType)||!1,Ht(this)}matchesArgs(e){return e.length===this.argTypes.length&&this.argTypes.every((t,n)=>t.matches(e[n]))?this:null}},ki=class{constructor({op:e,leftType:t,rightType:n,handler:i,returnType:o,async:s}){this.operator=e,this.leftType=t,this.rightType=n||null,this.handler=i,this.async=Ts(i,s),this.returnType=o,n?this.signature=`${t} ${e} ${n}: ${o}`:this.signature=`${e}${t}: ${o}`,this.hasPlaceholderType=this.leftType.hasPlaceholderType||this.rightType?.hasPlaceholderType||!1,Ht(this)}equals(e){return this.operator===e.operator&&this.leftType===e.leftType&&this.rightType===e.rightType}};function pd(r){return new Gt({kind:\"list\",name:`list<${r}>`,type:\"list\",valueType:r})}function Vr(r){return new Gt({kind:\"primitive\",name:r,type:r})}function mw(r){return new Gt({kind:\"message\",name:r,type:r})}function cb(r){let e=r?`dyn<${r}>`:\"dyn\";return new Gt({kind:\"dyn\",name:e,type:e,valueType:r})}function ub(r){let e=`optional<${r}>`;return new Gt({kind:\"optional\",name:e,type:\"optional\",valueType:r})}function hd(r,e){return new Gt({kind:\"map\",name:`map<${r}, ${e}>`,type:\"map\",keyType:r,valueType:e})}function gw(r){return new Gt({kind:\"param\",name:r,type:r})}var ht=cb(),lb=Vr(\"ast\"),ib=pd(ht),ob=hd(ht,ht),ye={string:Vr(\"string\"),bool:Vr(\"bool\"),int:Vr(\"int\"),uint:Vr(\"uint\"),double:Vr(\"double\"),bytes:Vr(\"bytes\"),dyn:ht,null:Vr(\"null\"),type:Vr(\"type\"),optional:ub(ht),list:ib,\"list<dyn>\":ib,map:ob,\"map<dyn, dyn>\":ob};for(let r of[ye.string,ye.double,ye.int]){let e=pd(r),t=hd(ye.string,r);ye[e.name]=e,ye[t.name]=t}Object.freeze(ye);var ld=class{returnType=null;async=!1;macro=!1;#e=null;#t=null;declarations=[];constructor(e){this.registry=e}[Symbol.iterator](){return this.declarations[Symbol.iterator]()}add(e){this.returnType=(this.returnType||e.returnType).unify(this.registry,e.returnType)||ht,e.macro&&(this.macro=e),e.async&&!this.async&&(this.async=!0),this.declarations.push(e),this.#e?.clear(),this.#t?.clear()}findFunction(e,t=null){for(let n=0;n<this.declarations.length;n++){let i=this.#a(this.declarations[n],e,t);if(i)return i}return null}findUnaryOverload(e){let t=(this.#e??=new Map).get(e);if(t!==void 0)return t;let n=!1;for(let i of this.declarations)if(i.leftType===e){n=i;break}return this.#e.set(e,n),n}findBinaryOverload(e,t){return e.kind===\"dyn\"&&e.valueType?t=t.wrappedType:t.kind===\"dyn\"&&t.valueType&&(e=e.wrappedType),(this.#e??=new Map).get(e)?.get(t)??this.#n(this.#e,e,t,this.#i(e,t))}checkBinaryOverload(e,t){return(this.#t??=new Map).get(e)?.get(t)??this.#n(this.#t,e,t,this.#o(e,t))}#n(e,t,n,i){return(e.get(t)||e.set(t,new Map).get(t)).set(n,i),i}#i(e,t){let n=this.#s(e,t);if(n.length===0)return!1;if(n.length===1)return n[0];throw new Error(`Operator overload '${n[0].signature}' overlaps with '${n[1].signature}'.`)}#o(e,t){let n=this.#s(e,t);if(n.length===0)return!1;let i=n[0].returnType;for(let o=1;o<n.length;o++)i=i.unify(this.registry,n[o].returnType)||ht;return i}#s(e,t){let n=[];for(let i of this.declarations){if(i.leftType===e&&i.rightType===t)return[i];let o=this.#r(i,e,t);o&&n.push(o)}if(n.length===0){let i=this.declarations[0]?.operator;if((i===\"==\"||i===\"!=\")&&e.kind===\"dyn\")return vw[i]}return n}#r(e,t,n){let i=e.hasPlaceholderType?new Map:null,o=this.#u(e.leftType,t,i);if(!o)return;let s=this.#u(e.rightType,n,i);if(s)return(e.operator===\"==\"||e.operator===\"!=\")&&e.leftType.kind===\"dyn\"&&e.leftType.valueType&&t.kind!==\"dyn\"&&n.kind!==\"dyn\"?!1:e.hasPlaceholderType?{async:e.async,signature:e.signature,handler:e.handler,leftType:o,rightType:s,returnType:e.returnType.templated(this.registry,i)}:e}#a(e,t,n){if(e.hasPlaceholderType)return this.#d(e,t,n);if(!(n&&e.receiverType&&!n.matches(e.receiverType)))return e.matchesArgs(t)}#d(e,t,n){let i=new Map;if(n&&e.receiverType&&!this.#u(e.receiverType,n,i))return null;for(let o=0;o<t.length;o++)if(!this.#u(e.argTypes[o],t[o],i))return null;return{async:e.async,handler:e.handler,signature:e.signature,returnType:e.returnType.templated(this.registry,i)}}#u(e,t,n){if(!e.hasPlaceholderType)return t.matches(e)?t:null;let i=t.kind===\"dyn\";return this.#l(e,t,n,i)&&(i||t.matches(e.templated(this.registry,n)))?t:null}#l(e,t,n,i=!1){if(!e.hasPlaceholderType)return!0;if(!t)return!1;let o=i||t.kind===\"dyn\";switch(t=t.unwrappedType,e.kind){case\"param\":{let s=o?ht:t,a=n.get(e.name);return a?a.kind===\"dyn\"||s.kind===\"dyn\"?!0:a.matchesBoth(s):n.set(e.name,s)&&!0}case\"list\":return t.name===\"dyn\"&&(t=e),t.kind!==\"list\"?!1:this.#l(e.valueType,t.valueType,n,o);case\"map\":return t.name===\"dyn\"&&(t=e),t.kind!==\"map\"?!1:this.#l(e.keyType,t.keyType,n,o)&&this.#l(e.valueType,t.valueType,n,o);case\"optional\":return t.name===\"dyn\"&&(t=e),t.kind!==\"optional\"?!1:this.#l(e.valueType,t.valueType,n,o)}return!0}};function sb(r){let e=[],t=\"\",n=0;for(let i of r){if(i===\"<\")n++;else if(i===\">\")n--;else if(i===\",\"&&n===0){e.push(t.trim()),t=\"\";continue}t+=i}return t&&e.push(t.trim()),e}var db=[[Ne,\"uint\",Br.uint,ye.uint],[Me,\"type\",Br.type,ye.type],[Dt,\"optional\",dw,ye.optional],[Uint8Array,\"bytes\",Br.bytes,ye.bytes],...typeof Buffer<\"u\"?[[Buffer,\"bytes\",Br.bytes,ye.bytes]]:[]].map(([r,e,t,n])=>Object.freeze({name:e,typeType:t,type:n,ctor:r})),yw=db.map(r=>[r.name,r]),bw=db.map(r=>[r.ctor,r]),Cc=r=>new Error(`Invalid variable declaration: ${r}`),wc=r=>new Error(`Invalid type declaration: ${r}`),vw={\"==\":[{handler:(r,e)=>r===e,returnType:ye.bool}],\"!=\":[{handler:(r,e)=>r!==e,returnType:ye.bool}]},dd=class r{#e=null;#t;#n=!0;#i=null;#o=null;#s=null;#r=null;#a=null;#d=null;#u=null;#l=null;#f=!1;constructor(e={}){this.enableOptionalTypes=e.enableOptionalTypes??!1,this.unlistedVariablesAreDyn=e.unlistedVariablesAreDyn??!1;let t=e.parent instanceof r?e.parent:null;if(t){this.#e=t;let n=t;for(;n&&!n.#i;)n=n.#e;let i=t;for(;i&&!i.#o;)i=i.#e;this.#s=t.#s,this.#r=t.#r,this.#l={operators:n.#i,functions:i.#o},this.objectTypes=new Map(t.objectTypes),this.objectTypesByConstructor=new Map(t.objectTypesByConstructor),this.variables=t.variables,this.#n=!1,this.#t=t.#t,this.#a=t.#a,this.#d=t.#d,this.#u=t.#u,(this.enableOptionalTypes!==t.enableOptionalTypes||this.unlistedVariablesAreDyn!==t.unlistedVariablesAreDyn)&&Xy(this,this.enableOptionalTypes)}else{this.#i=[],this.#o=[],this.objectTypes=new Map(yw),this.objectTypesByConstructor=new Map(bw),this.#t=new Map(eb(ye)),this.#a=new Map,this.#d=new Map,this.#u=new Map,this.variables=new Map,this.variables.dyn=this.unlistedVariablesAreDyn;for(let n in Br)this.registerConstant(n,\"type\",Br[n])}}#v(){this.#n||(this.variables=new Map(this.variables),this.variables.dyn=this.unlistedVariablesAreDyn,this.#n=!0)}deleteVariable(e){this.#v(),this.variables.delete(e)}#g(e){this.#i||(this.#s=null),this.operatorCandidates(e.operator).add(e),this.#i.push(e)}#A(e){this.#o||(this.#r=null),this.#y(e.partitionKey).add(e),this.#o.push(e)}#p(e,t){return e.get(t)||e.set(t,new ld(this)).get(t)}#D(){return this.#i?this.#i:this.#i=[...this.#l.operators]}#_(){return this.#o?this.#o:this.#o=[...this.#l.functions]}operatorCandidates(e){if(this.#s)return this.#p(this.#s,e);let t=this.#s=new Map;for(let n of this.#D())this.#p(t,n.operator).add(n);return this.#p(t,e)}functionCandidates(e,t,n){return this.#y(`${e?\"rcall\":\"call\"}:${t}:${n}`)}#y(e){if(this.#r)return this.#p(this.#r,e);let t=this.#r=new Map;for(let n of this.#_())this.#p(t,n.partitionKey).add(n);return this.#p(t,e)}registerVariable(e,t,n){if(this.#f)throw new Error(\"Cannot modify frozen registry\");let i=n?.description,o;if(typeof e==\"string\"&&typeof t==\"object\"&&!(t instanceof Gt)?(i=t.description,o=t.value,t.schema?t=this.registerType({name:`$${e}`,schema:t.schema}).type:t=t.type):typeof e==\"object\"&&(e.schema?t=this.registerType({name:`$${e.name}`,schema:e.schema}).type:t=e.type,i=e.description,o=e.value,e=e.name),typeof e!=\"string\"||!e)throw Cc(\"name must be a string\");if(bo.has(e))throw Cc(`'${e}' is a reserved name`);if(this.variables.get(e)!==void 0)throw Cc(`'${e}' is already registered`);if(typeof t==\"string\")t=this.getType(t);else if(!(t instanceof Gt))throw Cc(\"type is required\");return this.#v(),this.variables.set(e,new ks(e,t,i,o)),this}#C(e,t){let n=Object.create(null);for(let i of Ze(t)){let o=t[i];if(typeof o==\"object\"&&o)n[i]=this.registerType({name:`${e}.${i}`,schema:o}).type.name;else if(typeof o==\"string\")n[i]=o;else throw new Error(`Invalid field definition for '${e}.${i}'`)}return n}registerConstant(e,t,n){return typeof e==\"object\"?this.registerVariable(e):this.registerVariable({name:e,type:t,value:n}),this}getType(e){return this.#c(e,!0)}getListType(e){return this.#a.get(e)||this.#a.set(e,this.#c(`list<${e}>`,!0)).get(e)}getMapType(e,t){return this.#d.get(e)?.get(t)||(this.#d.get(e)||this.#d.set(e,new Map).get(e)).set(t,this.#c(`map<${e}, ${t}>`,!0)).get(t)}getOptionalType(e){return this.#u.get(e)||this.#u.set(e,this.#c(`optional<${e}>`,!0)).get(e)}assertType(e,t,n){try{return this.#c(e,!0)}catch(i){throw i.message=`Invalid ${t} '${i.unknownType||e}' in '${n}'`,i}}getFunctionType(e){if(e===\"ast\")return lb;let t=this.#c(e,!0);if(t.kind===\"dyn\"&&t.valueType)throw new Error(`type '${t.name}' is not supported`);return t}registerType(e,t){if(this.#f)throw new Error(\"Cannot modify frozen registry\");if(typeof e==\"object\"&&(t=e,e=t.fullName||t.name||t.ctor?.name),typeof e==\"string\"&&e[0]===\".\"&&(e=e.slice(1)),typeof e!=\"string\"||e.length<2||bo.has(e))throw wc(`name '${e}' is not valid`);if(this.objectTypes.has(e))throw wc(`type '${e}' already registered`);let n=this.#c(e,!1);if(n.kind!==\"message\")throw wc(`type '${e}' is not valid`);let i={name:e,typeType:new Me(e),type:n,ctor:typeof t==\"function\"?t:t?.ctor,convert:typeof t==\"function\"?void 0:t?.convert,fields:typeof t?.schema==\"object\"?this.#x(e,this.#C(e,t.schema)):this.#x(e,typeof t==\"function\"?void 0:t?.fields)};if(typeof i.ctor!=\"function\"){if(!i.fields)throw wc(`type '${e}' requires a constructor or fields`);Object.assign(i,this.#S(e,i.fields))}return this.objectTypes.set(e,Object.freeze(i)),this.objectTypesByConstructor.set(i.ctor,i),this.registerFunctionOverload(`type(${e}): type`,()=>i.typeType,{async:!1}),i}#c(e,t=!0){let n=this.#t.get(e);if(n)return n;if(typeof e!=\"string\"||!e.length)throw new Error(\"Invalid type: must be a string\");if(n=e.match(/^[A-Z]$/),n)return this.#h(gw,e,e);if(n=e.match(/^(dyn|list|map|optional)<(.+)>$/),!n){if(t){let s=new Error(`Unknown type: ${e}`);throw s.unknownType=e,s}return this.#h(mw,e,e)}let i=n[1],o=n[2].trim();switch(i){case\"dyn\":{let s=this.#c(o,t).wrappedType;return this.#t.set(s.name,s),s}case\"list\":{let s=this.#c(o,t);return this.#h(pd,`list<${s}>`,s)}case\"map\":{let s=sb(o);if(s.length!==2)throw new Error(`Invalid map type: ${e}`);let a=this.#c(s[0],t),c=this.#c(s[1],t);return this.#h(hd,`map<${a}, ${c}>`,a,c)}case\"optional\":{let s=this.#c(o,t);return this.#h(ub,`optional<${s}>`,s)}}}#h(e,t,...n){return this.#t.get(t)||this.#t.set(t,e(...n)).get(t)}findMacro(e,t,n){return this.functionCandidates(t,e,n).macro}findUnaryOverload(e,t){return this.operatorCandidates(e).findUnaryOverload(t)}findBinaryOverload(e,t,n){return this.operatorCandidates(e).findBinaryOverload(t,n)}#w(e){return typeof e==\"string\"?{type:e}:e.id?_w(e):e}#E(e,t,n,i=!1){try{let o=this.#w(t[n]);if(typeof o?.type!=\"string\")throw new Error(\"unsupported declaration\");return this.#c(o.type,i)}catch(o){throw o.message=`Field '${n}' in type '${e}' has unsupported declaration: ${JSON.stringify(t[n])}`,o}}#x(e,t){if(!t)return;let n=Object.create(null);for(let i of Ze(t))n[i]=this.#E(e,t,i);return n}#S(e,t){let n=Ze(t),i=Object.create(null);for(let s of n){let a=t[s],c=a.kind===\"message\"&&this.objectTypes.get(a.name);c===!1?i[s]=!1:i[s]=c.convert?c:!1}let o={[e]:class extends Map{#m;constructor(s){super(),this.#m=s}[Symbol.iterator](){if(this.size!==n.length)for(let s of n)this.get(s);return super[Symbol.iterator]()}get(s){let a=super.get(s);if(a!==void 0||this.has(s))return a;let c=i[s];if(c!==void 0){if(a=this.#m instanceof Map?this.#m.get(s):this.#m?.[s],c&&a&&typeof a==\"object\")switch(a.constructor){case void 0:case Object:case Map:a=c.convert(a)}return super.set(s,a),a}}}}[e];return{ctor:o,convert(s){if(s)return s.constructor===o?s:new o(s)}}}clone(e){return this.#f=!0,new r({parent:this,unlistedVariablesAreDyn:e.unlistedVariablesAreDyn,enableOptionalTypes:e.enableOptionalTypes})}getDefinitions(){let e=[],t=[];for(let[,n]of this.variables)n&&e.push({name:n.name,description:n.description||null,type:n.type.name});for(let n of this.#_())t.push({signature:n.signature,name:n.name,description:n.description,receiverType:n.receiverType?n.receiverType.name:null,returnType:n.returnType.name,params:n.params.map(i=>({name:i.name,type:i.type.name,description:i.description}))});return{variables:e,functions:t}}#T(e){if(typeof e!=\"string\")throw new Error(\"Invalid signature: must be a string\");let t=e.match(/^(?:([a-zA-Z0-9.<>]+)\\.)?(\\w+)\\(([^)]*)\\):(.*)$/);if(!t)throw new Error(`Invalid signature: ${e}`);let n=t[4].trim();if(!n)throw new Error(`Invalid signature: ${e}`);return{receiverType:t[1]||null,name:t[2],argTypes:sb(t[3]),returnType:n}}#k(e,t){return e.name!==t.name||e.argTypes.length!==t.argTypes.length||(e.receiverType||t.receiverType)&&(!e.receiverType||!t.receiverType)?!1:!(e.receiverType!==t.receiverType&&e.receiverType!==ht&&t.receiverType!==ht)&&(t.macro||e.macro||t.argTypes.every((i,o)=>{let s=e.argTypes[o];return i===s||i===ht||s===ht}))}#$(e){for(let t of this.#y(e.partitionKey))if(this.#k(t,e))throw new Error(`Function signature '${e.signature}' overlaps with existing overload '${t.signature}'.`)}#I(e,t,n){if(!n)return{type:this.getFunctionType(t),name:`arg${e}`,description:null};let i=n.type||t;if(!i)throw new Error(`params[${e}].type is required`);if(t&&i!==t)throw new Error(`params[${e}].type not equal to signature type`);return{name:n.name||`arg${e}`,type:this.getFunctionType(i),description:n.description??null}}registerFunctionOverload(e,t,n){if(this.#f)throw new Error(\"Cannot modify frozen registry\");typeof e==\"object\"?n=e:typeof t==\"object\"?n=t:n||(n={});let i=typeof e==\"string\"?e:n.signature??void 0,o=i!==void 0?this.#T(i):void 0,s=o?.name||n.name,a=o?.receiverType||n.receiverType,c=o?.argTypes,u=o?.returnType||n.returnType,l=n.params;t=typeof t==\"function\"?t:n.handler;let p;try{if(!s)throw new Error(\"signature or name are required\");if(!u)throw new Error(\"must have a returnType\");if(l){if(c&&l.length!==c.length)throw new Error(\"mismatched length in params and args in signature\")}else if(!c)throw new Error(\"signature or params are required\");p=new ud({name:s,async:n?.async,receiverType:a?this.getType(a):null,returnType:this.getType(u),handler:t,description:n.description,params:(c||l).map((f,m)=>this.#I(m,c?.[m],l?.[m]))})}catch(f){throw typeof i==\"string\"?f.message=`Invalid function declaration '${i}': ${f.message}`:s?f.message=`Invalid function declaration '${s}': ${f.message}`:f.message=`Invalid function declaration: ${f.message}`,f}this.#$(p),this.#A(p)}registerOperatorOverload(e,t,n){let i=e.match(/^([-!])([\\w.<>]+)(?::\\s*([\\w.<>]+))?$/);if(i){let[,l,p,f]=i;return this.unaryOverload(l,p,t,f,n?.async)}let o=e.match(/^([\\w.<>]+) ([-+*%/]|==|!=|<|<=|>|>=|in) ([\\w.<>]+)(?::\\s*([\\w.<>]+))?$/);if(!o)throw new Error(`Operator overload invalid: ${e}`);let[,s,a,c,u]=o;return this.binaryOverload(s,a,c,t,u)}unaryOverload(e,t,n,i,o){if(this.#f)throw new Error(\"Cannot modify frozen registry\");let s=this.assertType(t,\"type\",`${e}${t}`),a=this.assertType(i||t,\"return type\",`${e}${t}: ${i||t}`),c=new ki({op:`${e}_`,leftType:s,returnType:a,handler:n,async:o});this.#g(this.#b(c))}#F(e){for(let t of this.operatorCandidates(e.operator))if(e.equals(t))return!0;return!1}#b(e){if(!this.#F(e))return e;throw new Error(`Operator overload already registered: ${e.signature}`)}binaryOverload(e,t,n,i,o,s){if(this.#f)throw new Error(\"Cannot modify frozen registry\");o??=ab.has(t)?\"bool\":e;let a=`${e} ${t} ${n}: ${o}`,c=this.assertType(e,\"left type\",a),u=this.assertType(n,\"right type\",a),l=this.assertType(o,\"return type\",a);if(c.kind===\"dyn\"&&c.valueType?u=u.wrappedType:u.kind===\"dyn\"&&u.valueType&&(c=c.wrappedType),ab.has(t)&&l.type!==\"bool\")throw new Error(`Comparison operator '${t}' must return 'bool', got '${l.type}'`);let p=new ki({op:t,leftType:c,rightType:u,returnType:l,handler:i,async:s});if(p.hasPlaceholderType&&!(u.hasPlaceholderType&&c.hasPlaceholderType))throw new Error(`Operator overload with placeholders must use them in both left and right types: ${a}`);if(this.#b(p),t===\"==\"){let f=[new ki({op:\"!=\",leftType:c,rightType:u,handler(m,g,h,b){return!i(m,g,h,b)},returnType:l,async:s})];c!==u&&f.push(new ki({op:\"==\",leftType:u,rightType:c,handler(m,g,h,b){return i(g,m,h,b)},returnType:l,async:s}),new ki({op:\"!=\",leftType:u,rightType:c,handler(m,g,h,b){return!i(g,m,h,b)},returnType:l,async:s}));for(let m of f)this.#b(m);for(let m of f)this.#g(m)}this.#g(p)}},ab=new Set([\"<\",\"<=\",\">\",\">=\",\"==\",\"!=\",\"in\"]);function fb(r){return new dd(r)}var xo=class{#e;#t;#n;#i;constructor(e,t){if(this.#e=e.variables,t!=null){if(typeof t!=\"object\")throw H(\"invalid_context\",\"Context must be an object\");t instanceof Map?this.#n=t:this.#t=t}}getValue(e){return this.#i?.get(e)||(this.#t?this.#t[e]:this.#n?.get(e))}getVariable(e){return this.#e.get(e)??(this.#e.dyn&&!bo.has(e)?new ks(e,ht):void 0)}getCheckedValue(e,t){let n=this.getValue(t.args);if(n===void 0)throw e.createError(\"unknown_variable\",`Unknown variable: ${t.args}`,t);if(t.checkedType.matchesValueType(n,e))return n;let i=t.checkedType,o=e.debugType(n);if(i.kind===\"message\"&&o.kind===\"map\"){let s=e.objectTypes.get(i.name)?.convert?.(n);if(s)return(this.#i??=new Map).set(t.args,s),s}throw e.createError(\"variable_type_mismatch\",`Variable '${t.args}' is not of type '${i}', got '${o}'`,t)}forkWithVariable(e,t){return new fd(this,e,t)}},fd=class r{#e;accuType;accuValue;iterValue;constructor(e,t,n){this.#e=e,this.iterVar=t,this.iterType=n}forkWithVariable(e,t){return new r(this,e,t)}reuse(e){if(!this.async)return this.#e=e,this;let t=new r(e,this.iterVar,this.iterType);return t.accuType=this.accuType,t}setIterValue(e,t){if(this.iterType.matchesValueType(e,t))return this.iterValue=e,this;let n=this.iterType,i=t.debugType(e);if(n.kind===\"message\"&&i.kind===\"map\"){let o=t.objectTypes.get(n.name)?.convert?.(e);if(o)return this.iterValue=o,this}throw t.createError(\"variable_type_mismatch\",`Variable '${this.iterVar}' is not of type '${n}', got '${i}'`)}setAccuType(e){return this.accuType=e,this}setAccuValue(e){return this.accuValue=e,this}getValue(e){return this.iterVar===e?this.iterValue:this.#e.getValue(e)}getCheckedValue(e,t){return this.iterVar===t.args?this.iterValue:this.#e.getCheckedValue(e,t)}getVariable(e){return this.iterVar===e?new ks(e,this.iterType):this.#e.getVariable(e)}};function _w(r){let e;if(r.map){let t=cd(r.keyType,r.resolvedKeyType),n=cd(r.type,r.resolvedType);e=`map<${t}, ${n}>`}else e=cd(r.type,r.resolvedType);return{type:r.repeated?`list<${e}>`:e}}function cd(r,e){switch(r){case\"string\":return\"string\";case\"bytes\":return\"bytes\";case\"bool\":return\"bool\";case\"double\":case\"float\":case\"int32\":case\"int64\":case\"sint32\":case\"sint64\":case\"sfixed32\":case\"sfixed64\":case\"uint32\":case\"uint64\":case\"fixed32\":case\"fixed64\":return\"double\";default:switch(e?.constructor.name){case\"Type\":return e.fullName.slice(1);case\"Enum\":return\"int\"}return r?.includes(\".\")?r:\"dyn\"}}var Db=ye.dyn,Do=class{dynType=ye.dyn;optionalType=ye.optional;stringType=ye.string;intType=ye.int;doubleType=ye.double;boolType=ye.bool;nullType=ye.null;listType=ye.list;mapType=ye.map;constructor(e){this.opts=e.opts,this.registry=e.registry,this.objectTypes=this.registry.objectTypes,this.objectTypesByConstructor=this.registry.objectTypesByConstructor}getType(e){return this.registry.getType(e)}debugType(e){switch(typeof e){case\"string\":return this.stringType;case\"bigint\":return this.intType;case\"number\":return this.doubleType;case\"boolean\":return this.boolType;case\"object\":if(e===null)return this.nullType;switch(e.constructor){case void 0:case Object:case Map:return this.mapType;case Array:case Set:return this.listType;default:return this.objectTypesByConstructor.get(e.constructor)?.type||gd(this,e.constructor?.name||typeof e)}default:gd(this,typeof e)}}};function gd(r,e){throw r.createError(\"unsupported_type\",`Unsupported type: ${e}`)}var pb=r=>Array.isArray(r)?r.some(e=>e.maybeAsync):!1;function yr(r,e,t){return e===!0||e&&(e?.maybeAsync||pb(e))?xw(t):r===!0||r&&(r?.maybeAsync||pb(r))?Aw(t):t}function xw(r){return r.__asyncBoth??=function(t,n,i,o){return t instanceof Promise||n instanceof Promise?n instanceof Promise?t instanceof Promise?Promise.all([t,n]).then(s=>r(s[0],s[1],i,o)):n.then(s=>r(t,s,i,o)):t.then(s=>r(s,n,i,o)):r(t,n,i,o)}}function Aw(r){return r.__asyncFirst??=function(t,n,i,o){return t instanceof Promise?t.then(s=>r(s,n,i,o)):r(t,n,i,o)}}function hb(r,e,t){e.right=e.args[1];let n=r.check(e.left=e.args[0],t);return e.op===\"[]\"&&r.check(e.right,t),e.handle=yr(e.left,e.op===\"[]\"?e.right:!1,n!==Db?Pw:Bw),n.kind!==\"optional\"?r.checkAccessOnType(e,t,n):r.registry.getOptionalType(r.checkAccessOnType(e,t,n.valueType,!0))}function mb(r,e,t){e.right=e.args[1];let n=r.check(e.left=e.args[0],t);e.op===\"[?]\"&&r.check(e.right,t),e.handle=yr(e.left,e.op===\"[?]\"?e.right:!1,jw);let i=n.kind===\"optional\"?n.valueType:n;return r.registry.getOptionalType(r.checkAccessOnType(e,t,i,!0))}var Dw={heterogeneous_list_element:\"List elements must have the same type,\",heterogeneous_map_key:\"Map key uses wrong type,\",heterogeneous_map_value:\"Map value uses wrong type,\"};function gb(r,e,t,n,i){let o=r.check(n,e);if(o===t||t.isEmpty())return o;if(o.isEmpty())return t;throw r.createError(i,`${Dw[i]} expected type '${r.formatType(t)}' but found '${r.formatType(o)}'`,n)}function yb(r,e,t,n){return t.unify(r.registry,r.check(n,e))||Db}function Cw(r,e,t){let n=r.debugRuntimeType(e);return r.createError(\"invalid_condition_type\",`${t.meta.label||\"Ternary condition must be bool\"}, got '${n}'`,t)}function ww(r,e,t,n){if(r===!0)return e.run(t.left,n);if(r===!1)return e.run(t.right,n);throw Cw(e,r,t.condition)}function bd(r,e,t){let n=r.debugRuntimeType(e);return r.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${n}'`,t)}function Cb(r,e,t){return e instanceof Error?e:bd(r,e,t)}function Ao(r,e,t,n,i){if(i===r)return r;if(i===!r){if(n===i)return i;throw Cb(e,n,t.left)}if(i instanceof Promise)return i.then(o=>Ew(r,e,t,n,o));throw bd(e,i,t.left)}function Ew(r,e,t,n,i){if(i===r)return r;if(typeof i!=\"boolean\")throw bd(e,i,t.right);if(typeof n!=\"boolean\")throw Cb(e,n,t.left);return!r}function bb(r,e,t){let n=r.check(e.left=e.args[0],t),i=r.check(e.right=e.args[1],t);if(!n.isDynOrBool())throw r.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${r.formatType(n)}'`,e);if(!i.isDynOrBool())throw r.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${r.formatType(i)}'`,e);return r.boolType}function vb(r,e,t){let n=e.op,i=r.check(e.args,t);if(e.candidates=r.registry.operatorCandidates(n),i.kind===\"dyn\")return e.handle=yr(e.args,!1,Sw),e.candidates.returnType;let o=e.candidates.findUnaryOverload(i);if(!o)throw r.createError(\"no_such_overload\",`no such overload: ${n[0]}${r.formatType(i)}`,e);return e.handle=yr(e.args,!1,o.handler),o.returnType}function Sw(r,e,t){let n=t.debugRuntimeType(r,e.args.checkedType),i=e.candidates.findUnaryOverload(n);if(i)return i.handler(r);throw t.createError(\"no_such_overload\",`no such overload: ${e.op[0]}${n}`,e)}function _b(r,e,t){return e.handle(r.run(e.args,t),e,r)}function Tw(r,e,t){let n=e.op,i=r.check(e.left=e.args[0],t),o=r.check(e.right=e.args[1],t);e.candidates=r.registry.operatorCandidates(n);let s=i.hasDynType||o.hasDynType?void 0:e.candidates.findBinaryOverload(i,o);if(e.handle=yr(e.left,e.right,s?.handler||kw),s)return s.returnType;let a=e.candidates.checkBinaryOverload(i,o);if(i.hasDynType||(e.leftStaticType=i),o.hasDynType||(e.rightStaticType=o),a)return a;throw r.createError(\"no_such_overload\",`no such overload: ${r.formatType(i)} ${n} ${r.formatType(o)}`,e)}function yd(r,e,t){return e.handle(r.run(e.left,t),r.run(e.right,t),e,r)}function xb(r,e,t){return e.handle(r.run(e.left,t),e.right,e,r)}function kw(r,e,t,n){let i=t.leftStaticType||n.debugTypeDeep(r).wrappedType,o=t.rightStaticType||n.debugTypeDeep(e).wrappedType,s=t.candidates.findBinaryOverload(i,o);if(s)return s.handler(r,e,t,n);throw n.createError(\"no_such_overload\",`no such overload: ${i} ${t.op} ${o}`,t)}function Sc(r,e,t,n){try{let i=r.apply(e,t);return i instanceof Promise?i.catch(o=>{throw Es(o,n)}):i}catch(i){throw Es(i,n)}}function $w(r,e,t){let n=e.args[1],i=e.argTypes,o=n.length;for(;o--;)i[o]=t.debugRuntimeType(r[o],n[o].checkedType);let s=e.candidates.findFunction(i);if(s)return Sc(s.handler,t,r,e);throw t.createError(\"no_matching_overload\",`found no matching overload for '${e.args[0]}(${i.map(a=>a.unwrappedType).join(\", \")})'`,e)}function Iw(r,e,t){let[,n,i]=t.args,o=t.argTypes;for(let c=0;c<o.length;c++)o[c]=e.debugRuntimeType(r[c+1],i[c].checkedType);let s=e.debugRuntimeType(r[0],n.checkedType),a=t.candidates.findFunction(o,s);if(a)return Sc(a.handler,e,r,t);throw e.createError(\"no_matching_overload\",`found no matching overload for '${s.type}.${t.args[0]}(${o.map(c=>c.unwrappedType).join(\", \")})'`,t)}function md(r,e,t,n=e.length){if(n===0)return[];let i,o=new Array(n);for(;n--;)(o[n]=r.run(e[n],t))instanceof Promise&&(i??=!0);return i?Promise.all(o):o}function Ab(r){let e={};for(let t=0;t<r.length;t++){let[n,i]=r[t];n===\"__proto__\"||n===\"constructor\"||n===\"prototype\"||(e[n]=i)}return e}function Fw(r,e,t){let n=r.check(e,t);if(n.kind===\"dyn\")return n;if(n.kind===\"list\")return n.valueType;if(n.kind===\"map\")return n.keyType;throw r.createError(\"invalid_comprehension_range\",`Expression of type '${r.formatType(n)}' cannot be range of a comprehension (must be list, map, or dynamic).`,e)}function wb(r,e,t){if(t instanceof Set)return[...t];if(t instanceof Map)return[...t.keys()];if(t&&typeof t==\"object\")return Ze(t);throw r.createError(\"invalid_comprehension_range\",`Expression of type '${r.debugType(t)}' cannot be range of a comprehension (must be list, map, or dynamic).`,e.iterable)}function Rw(r,e,t,n){Si(r)||(r=wb(t,e,r));let i=t.run(e.init,n=e.iterCtx.reuse(n));return n.accuValue=i,n===e.iterCtx?Mw(t,n,e,r,i,0):Sb(t,n,e,r,i,0)}function Ow(r,e,t,n){Si(r)||(r=wb(t,e,r));let i=t.run(e.init,n=e.iterCtx.reuse(n));return n.accuValue=i,n===e.iterCtx?Nw(t,n,e,r,i,0):Eb(t,n,e,r,i,0)}function Nw(r,e,t,n,i,o){let s=t.condition,a=t.step,c=n.length;for(;o<c&&!(s&&!s(i));)if(i=r.run(a,e.setIterValue(n[o++],r)),i instanceof Promise)return Eb(r,e,t,n,i,o);return t.result(i)}async function Eb(r,e,t,n,i,o){e===t.iterCtx&&(e.async=!0);let s=t.condition,a=t.step,c=n.length;for(i=await i;o<c;){if(s&&!s(i))return t.result(i);i=r.run(a,e.setIterValue(n[o++],r)),i instanceof Promise&&(i=await i)}return t.result(i)}function Mw(r,e,t,n,i,o,s,a){let c=t.condition,u=t.step,l=n.length;for(;o<l;){if(!c(i))return t.result(i);if(a=r.tryEval(u,e.setIterValue(n[o++],r)),a instanceof Promise)return Sb(r,e,t,n,i,o,s,a);a instanceof Error&&(s??=a)||(i=a)}if(s&&c(i))throw s;return t.result(i)}async function Sb(r,e,t,n,i,o,s,a){e===t.iterCtx&&(e.async=!0);let c=t.condition,u=t.step,l=n.length;for(a=await a,a instanceof Error?s??=a:i=a;o<l;){if(!c(i))return t.result(i);a=r.tryEval(u,e.setIterValue(n[o++],r)),a instanceof Promise&&(a=await a),!(a instanceof Error&&(s??=a))&&(i=a)}if(s&&c(i))throw s;return t.result(i)}function jw(r,e,t,n){return n.optionalType.field(r,e,t,n)}function Pw(r,e,t,n){return t.left.checkedType.field(r,e,t,n)}var Lw=Object.create(null);function Bw(r,e,t,n){switch(r?.constructor){case void 0:case Object:{let o=yo(r||Lw,e)?r[e]:void 0;if(o!==void 0)return n.debugType(o),o;break}case Map:{let o=r.get(e);if(o!==void 0)return n.debugType(o),o;break}case Array:case Set:return n.listType.field(r,e,t,n);default:let i=n.objectTypesByConstructor.get(r.constructor);if(i)return i.type.field(r,e,t,n);typeof r==\"object\"&&gd(n,r.constructor.name)}throw n.createError(\"no_such_key\",`No such key: ${e}`,t)}var Vw=()=>[],Uw=()=>({}),M={value:{check(r,e){return r.debugType(e.args)},evaluate(r,e){return e.args}},id:{check(r,e,t){let n=t.getVariable(e.args);if(!n)throw r.createError(\"unknown_variable\",`Unknown variable: ${e.args}`,e);if(n.constant){let i=e.clone(M.value,n.value);return e.setMeta(\"alternate\",i),r.check(i,t)}return n.type},evaluate(r,e,t){return t.getCheckedValue(r,e)}},\".\":{alias:\"fieldAccess\",check:hb,evaluate:xb},\".?\":{alias:\"optionalFieldAccess\",check:mb,evaluate:xb},\"[]\":{alias:\"bracketAccess\",check:hb,evaluate:yd},\"[?]\":{alias:\"optionalBracketAccess\",check:mb,evaluate:yd},call:{check(r,e,t){let[n,i]=e.args,o=e.candidates=r.registry.functionCandidates(!1,n,i.length),s=e.argTypes=i.map(u=>r.check(u,t)),a=o.findFunction(s);if(!a)throw r.createError(\"no_matching_overload\",`found no matching overload for '${n}(${r.formatTypeList(s)})'`,e);let c=s.some(u=>u.hasDynType)?$w:a.handler.__handle??=(u,l,p)=>Sc(a.handler,p,u,l);return e.handle=yr(i,!1,c),a.returnType},evaluate(r,e,t){return e.handle(md(r,e.args[1],t),e,r)}},rcall:{check(r,e,t){let[n,i,o]=e.args,s=r.check(i,t),a=e.candidates=r.registry.functionCandidates(!0,n,o.length),c=e.argTypes=o.map(l=>r.check(l,t));if(e.receiverWithArgs=[i,...o],e.handle=yr(e.receiverWithArgs,!1,Iw),s.kind===\"dyn\"&&a.returnType)return a.returnType;let u=a.findFunction(c,s);if(!u)throw r.createError(\"no_matching_overload\",`found no matching overload for '${s.type}.${n}(${r.formatTypeList(c)})'`,e);if(!s.hasPlaceholderType&&!c.some(l=>l.hasDynType)){let l=u.handler,p=l.__handle??=(f,m,g)=>Sc(l,m,f,g);e.handle=yr(e.receiverWithArgs,!1,p)}return u.returnType},evaluate(r,e,t){return e.handle(md(r,e.receiverWithArgs,t),r,e)}},list:{check(r,e,t){let n=e.args,i=n.length;if(i===0)return e.setMeta(\"evaluate\",Vw)&&r.getType(\"list<T>\");let o=r.check(n[0],t),s=r.opts.homogeneousAggregateLiterals?gb:yb;for(let a=1;a<i;a++)o=s(r,t,o,n[a],\"heterogeneous_list_element\");return r.registry.getListType(o)},evaluate(r,e,t){return md(r,e.args,t)}},map:{check(r,e,t){let n=e.args,i=n.length;if(i===0)return e.setMeta(\"evaluate\",Uw)&&r.getType(\"map<K, V>\");let o=r.opts.homogeneousAggregateLiterals?gb:yb,s=r.check(n[0][0],t),a=r.check(n[0][1],t);for(let c=1;c<i;c++){let u=n[c];s=o(r,t,s,u[0],\"heterogeneous_map_key\"),a=o(r,t,a,u[1],\"heterogeneous_map_value\")}return r.registry.getMapType(s,a)},evaluate(r,e,t){let n=e.args,i=n.length,o=new Array(i),s;for(let a=0;a<i;a++){let c=n[a],u=r.run(c[0],t),l=r.run(c[1],t);u instanceof Promise||l instanceof Promise?(o[a]=Promise.all([u,l]),s??=!0):o[a]=[u,l]}return s?Promise.all(o).then(Ab):Ab(o)}},comprehension:{check(r,e,t){let n=e.args;n.iterCtx=t.forkWithVariable(n.iterVarName,Fw(r,n.iterable,t)).setAccuType(r.check(n.init,t));let i=r.check(n.step,n.iterCtx),o=n.errorsAreFatal?Ow:Rw;return e.handle=yr(n.iterable,!1,o),n.kind===\"quantifier\"?r.boolType:i},evaluate(r,e,t){return e.handle(r.run(e.args.iterable,t),e.args,r,t)}},accuValue:{check(r,e,t){return t.accuType},evaluate(r,e,t){return t.accuValue}},accuInc:{check(r,e,t){return t.accuType},evaluate(r,e,t){return t.accuValue+=1}},accuPush:{check(r,e,t){let n=t.accuType,i=r.check(e.args,t);return e.args.maybeAsync||e.setMeta(\"evaluate\",M.accuPush.evaluateSync),n.kind===\"list\"&&n.valueType.kind!==\"param\"?n:r.registry.getListType(i)},evaluateSync(r,e,t){return t.accuValue.push(r.run(e.args,t)),t.accuValue},evaluate(r,e,t){let n=t.accuValue,i=r.run(e.args,t);return i instanceof Promise?i.then(o=>n.push(o)&&n):(n.push(i),n)}},\"?:\":{alias:\"ternary\",check(r,e,t){let n=e.condition=e.args[0],i=e.left=e.args[1],o=e.right=e.args[2],s=r.check(n,t);if(!s.isDynOrBool())throw r.createError(\"invalid_condition_type\",`${n.meta.label||\"Ternary condition must be bool\"}, got '${r.formatType(s)}'`,n);let a=r.check(i,t),c=r.check(o,t),u=a.unify(r.registry,c);if(e.handle=yr(n,!1,ww),u)return u;throw r.createError(\"incompatible_ternary_branches\",`Ternary branches must have the same type, got '${r.formatType(a)}' and '${r.formatType(c)}'`,e)},evaluate(r,e,t){return e.handle(r.run(e.condition,t),r,e,t)}},\"||\":{check:bb,evaluate(r,e,t){let n=r.tryEval(e.left,t);if(n===!0)return!0;if(n===!1){let i=r.run(e.right,t);return typeof i==\"boolean\"?i:Ao(!0,r,e,n,i)}return n instanceof Promise?n.then(i=>i===!0?i:Ao(!0,r,e,i,r.run(e.right,t))):Ao(!0,r,e,n,r.run(e.right,t))}},\"&&\":{check:bb,evaluate(r,e,t){let n=r.tryEval(e.left,t);if(n===!1)return!1;if(n===!0){let i=r.run(e.right,t);return typeof i==\"boolean\"?i:Ao(!1,r,e,n,i)}return n instanceof Promise?n.then(i=>i===!1?i:Ao(!1,r,e,i,r.run(e.right,t))):Ao(!1,r,e,n,r.run(e.right,t))}},\"!_\":{alias:\"unaryNot\",check:vb,evaluate:_b},\"-_\":{alias:\"unaryMinus\",check:vb,evaluate:_b}},zw=[\"!=\",\"==\",\"in\",\"+\",\"-\",\"*\",\"/\",\"%\",\"<\",\"<=\",\">\",\">=\"];for(let r of zw)M[r]={check:Tw,evaluate:yd};for(let r of Ze(M)){let e=M[r];e.name=r,e.alias&&(M[e.alias]=e)}var Tc=r=>r;function kc(r,e){if(r.op===\"id\")return r.args;throw qe(\"invalid_macro_argument\",e,r)}function Tb(r){let e=r?\"map(var, filter, transform)\":\"map(var, transform)\",t=`${e} invalid predicate iteration variable`,n=`${e} filter predicate must return bool`;return({args:i,receiver:o,ast:s})=>{let[a,c,u]=r?i:[i[0],null,i[1]],l=u.clone(M.accuPush,u);if(c){let p=c.clone(M.accuValue);l=c.clone(M.ternary,[c.setMeta(\"label\",n),l,p])}return{callAst:s.clone(M.comprehension,{errorsAreFatal:!0,iterable:o,iterVarName:kc(a,t),init:s.clone(M.list,[]),step:l,result:Tc})}}}function qw(){let r=\"filter(var, predicate)\",e=`${r} invalid predicate iteration variable`,t=`${r} predicate must return bool`;return({args:n,receiver:i,ast:o})=>{let s=kc(n[0],e),a=o.clone(M.accuValue),c=n[1].setMeta(\"label\",t),u=o.clone(M.accuPush,o.clone(M.id,s)),l=c.clone(M.ternary,[c,u,a]);return{callAst:o.clone(M.comprehension,{errorsAreFatal:!0,iterable:i,iterVarName:s,init:o.clone(M.list,[]),step:l,result:Tc})}}}function vd(r){let e=`${r.name}(var, predicate) invalid predicate iteration variable`,t=`${r.name}(var, predicate) predicate must return bool`;return({args:n,receiver:i,ast:o})=>{let s=n[1].setMeta(\"label\",t),a=r.transform({args:n,ast:o,predicate:s,opts:r});return{callAst:o.clone(M.comprehension,{kind:\"quantifier\",errorsAreFatal:r.errorsAreFatal||!1,iterable:i,iterVarName:kc(n[0],e),init:a.init,condition:a.condition,step:a.step,result:a.result||Tc})}}}function Zw(){let r=\"has() invalid argument\";function e(n,i,o){let s=i.macroHasProps,a=s.length,c=n.run(s[--a],o),u;for(;a--;){let l=s[a];if(l.op===\".?\"&&(u??=!0),c=n.debugType(c).fieldLazy(c,l.args[1],l,n),c===void 0){if(!(!u&&a&&l.op===\".\"))break;throw H(\"no_such_key\",`No such key: ${l.args[1]}`,l)}}return c!==void 0}function t(n,i,o){let s=i.args[0];if(s.op!==\".\")throw n.createError(\"invalid_macro_argument\",r,s);if(!i.macroHasProps){let a=[];for(;s.op===\".\"||s.op===\".?\";)s=a.push(s)&&s.args[0];if(s.op!==\"id\")throw n.createError(\"invalid_macro_argument\",r,s);n.check(s,o),a.push(s),i.macroHasProps=a}return n.getType(\"bool\")}return function({args:n}){return{args:n,evaluate:e,typeCheck:t,async:!1}}}function kb(r){let e=(c,u)=>r.registerFunctionOverload(c,u);e(\"has(ast): bool\",Zw()),e(\"list.all(ast, ast): bool\",vd({name:\"all\",transform({ast:c,predicate:u,opts:l}){return{init:c.clone(M.value,!0),condition:Tc,step:u.clone(M.ternary,[u,u.clone(M.value,!0),u.clone(M.value,!1)])}}})),e(\"list.exists(ast, ast): bool\",vd({name:\"exists\",condition(c){return!c},transform({ast:c,predicate:u,opts:l}){return{init:c.clone(M.value,!1),condition:l.condition,step:u.clone(M.ternary,[u,u.clone(M.value,!0),u.clone(M.value,!1)])}}})),e(\"list.exists_one(ast, ast): bool\",vd({name:\"exists_one\",errorsAreFatal:!0,result(c){return c===1},transform({ast:c,predicate:u,opts:l}){let p=c.clone(M.accuValue);return{init:c.clone(M.value,0),step:u.clone(M.ternary,[u,c.clone(M.accuInc),p]),result:l.result}}})),e(\"list.map(ast, ast): list<dyn>\",Tb(!1)),e(\"list.map(ast, ast, ast): list<dyn>\",Tb(!0)),e(\"list.filter(ast, ast): list<dyn>\",qw());class t{}let n=new t;r.registerType(\"CelNamespace\",t),r.registerConstant(\"cel\",\"CelNamespace\",n);function i(c,u,l){u.bindCtx=l.forkWithVariable(u.var,c.check(u.val,l));let p=c.check(u.exp,u.bindCtx);return u.val.maybeAsync||u.exp.maybeAsync||(u.ast.setMeta(\"async\",!1),u.evaluate=a),p}function o(c,u,l,p,f){let m=c.run(u,p=l.reuse(p).setIterValue(f,c));return m instanceof Promise&&p===l&&(p.async=!0),m}function s(c,{val:u,exp:l,bindCtx:p},f){let m=c.run(u,f);return m instanceof Promise?m.then(g=>o(c,l,p,f,g)):o(c,l,p,f,m)}function a(c,{val:u,exp:l,bindCtx:p},f){return c.run(l,p.reuse(f).setIterValue(c.run(u,f),c))}e(\"CelNamespace.bind(ast, dyn, ast): dyn\",({ast:c,args:u})=>({ast:c,var:kc(u[0],\"invalid variable argument\"),val:u[1],exp:u[2],bindCtx:void 0,typeCheck:i,evaluate:s}))}function $b(r){let e=(p,f,m,g)=>r.unaryOverload(p,f,m,g,!1),t=(p,f,m,g,h)=>r.binaryOverload(p,f,m,g,h,!1);function n(p,f){if(p<=Ac&&p>=Dc)return p;throw H(\"numeric_overflow\",`integer overflow: ${p}`,f)}function i(p){throw H(\"division_by_zero\",\"division by zero\",p)}function o(p){throw H(\"modulo_by_zero\",\"modulo by zero\",p)}e(\"!\",\"bool\",p=>!p),e(\"-\",\"int\",p=>-p),t(\"dyn<int>\",\"==\",\"double\",(p,f)=>p==f),t(\"dyn<int>\",\"==\",\"uint\",(p,f)=>p==f.valueOf()),t(\"int\",\"*\",\"int\",(p,f,m)=>n(p*f,m)),t(\"int\",\"+\",\"int\",(p,f,m)=>n(p+f,m)),t(\"int\",\"-\",\"int\",(p,f,m)=>n(p-f,m)),t(\"int\",\"/\",\"int\",(p,f,m)=>f===Ti?i(m):p/f),t(\"int\",\"%\",\"int\",(p,f,m)=>f===Ti?o(m):p%f),e(\"-\",\"double\",p=>-p),t(\"double\",\"*\",\"double\",(p,f)=>p*f),t(\"double\",\"+\",\"double\",(p,f)=>p+f),t(\"double\",\"-\",\"double\",(p,f)=>p-f),t(\"double\",\"/\",\"double\",(p,f)=>p/f),t(\"string\",\"+\",\"string\",(p,f)=>p+f),t(\"list<V>\",\"+\",\"list<V>\",(p,f)=>[...p,...f]),t(\"bytes\",\"+\",\"bytes\",(p,f)=>{if(!p.length)return f;if(!f.length)return p;let m=new Uint8Array(p.length+f.length);return m.set(p,0),m.set(f,p.length),m});let s=\"google.protobuf.Duration\";t(s,\"+\",s,(p,f)=>p.addDuration(f)),t(s,\"-\",s,(p,f)=>p.subtractDuration(f)),t(s,\"==\",s,(p,f)=>p.seconds===f.seconds&&p.nanos===f.nanos);let a=\"google.protobuf.Timestamp\";t(a,\"==\",a,(p,f)=>p.getTime()===f.getTime()),t(a,\"-\",a,(p,f)=>wn.fromMilliseconds(p.getTime()-f.getTime()),s),t(a,\"-\",s,(p,f)=>f.subtractTimestamp(p)),t(a,\"+\",s,(p,f)=>f.extendTimestamp(p)),t(s,\"+\",a,(p,f)=>p.extendTimestamp(f));function c(p,f,m,g){if(f instanceof Set&&f.has(p))return!0;for(let h of f)if($s(p,h,m,g))return!0;return!1}function u(p,f){return f instanceof Map?f.get(p)!==void 0:yo(f,p)?f[p]!==void 0:!1}function l(p,f,m,g){return c(p,f,m,g)}t(\"V\",\"in\",\"list<V>\",l),t(\"K\",\"in\",\"map<K, V>\",u);for(let p of[\"type\",\"null\",\"bool\",\"string\",\"int\",\"double\"])t(p,\"==\",p,(f,m)=>f===m);t(\"bytes\",\"==\",\"bytes\",(p,f)=>{if(p===f)return!0;let m=p.length;if(m!==f.length)return!1;for(;m--;)if(p[m]!==f[m])return!1;return!0}),t(\"list<V>\",\"==\",\"list<V>\",(p,f,m,g)=>{if(p===f)return!0;if(Si(p)&&Si(f)){let v=p.length;if(v!==f.length)return!1;for(let x=0;x<v;x++)if(!$s(p[x],f[x],m,g))return!1;return!0}if(p instanceof Set&&f instanceof Set){if(p.size!==f.size)return!1;for(let v of p)if(!f.has(v))return!1;return!0}let h=p instanceof Set?f:p,b=p instanceof Set?p:f;if(!Si(h)||h.length!==b?.size)return!1;for(let v=0;v<h.length;v++)if(!b.has(h[v]))return!1;return!0}),t(\"map<K, V>\",\"==\",\"map<K, V>\",(p,f,m,g)=>{if(p===f)return!0;if(p instanceof Map&&f instanceof Map){if(p.size!==f.size)return!1;for(let[v,x]of p)if(!(f.has(v)&&$s(x,f.get(v),m,g)))return!1;return!0}if(p instanceof Map||f instanceof Map){let v=p instanceof Map?f:p,x=p instanceof Map?p:f,$=Ze(v);if(x.size!==$.length)return!1;for(let[V,S]of x)if(!(V in v&&$s(S,v[V],m,g)))return!1;return!0}let h=Ze(p),b=Ze(f);if(h.length!==b.length)return!1;for(let v=0;v<h.length;v++){let x=h[v];if(!(x in f&&$s(p[x],f[x],m,g)))return!1}return!0}),t(\"uint\",\"==\",\"uint\",(p,f)=>p.valueOf()===f.valueOf()),t(\"dyn<uint>\",\"==\",\"double\",(p,f)=>p.valueOf()==f),t(\"uint\",\"+\",\"uint\",(p,f)=>new Ne(p.valueOf()+f.valueOf())),t(\"uint\",\"-\",\"uint\",(p,f)=>new Ne(p.valueOf()-f.valueOf())),t(\"uint\",\"*\",\"uint\",(p,f)=>new Ne(p.valueOf()*f.valueOf())),t(\"uint\",\"/\",\"uint\",(p,f,m)=>f.valueOf()===Ti?i(m):new Ne(p.valueOf()/f.valueOf())),t(\"uint\",\"%\",\"uint\",(p,f,m)=>f.valueOf()===Ti?o(m):new Ne(p.valueOf()%f.valueOf()));for(let[p,f]of[[\"bool\",\"bool\"],[\"int\",\"int\"],[\"uint\",\"uint\"],[\"double\",\"double\"],[\"string\",\"string\"],[\"google.protobuf.Timestamp\",\"google.protobuf.Timestamp\"],[\"google.protobuf.Duration\",\"google.protobuf.Duration\"],[\"int\",\"uint\"],[\"int\",\"double\"],[\"double\",\"int\"],[\"double\",\"uint\"],[\"uint\",\"int\"],[\"uint\",\"double\"]])t(p,\"<\",f,(m,g)=>m<g),t(p,\"<=\",f,(m,g)=>m<=g),t(p,\">\",f,(m,g)=>m>g),t(p,\">=\",f,(m,g)=>m>=g)}function $s(r,e,t,n){if(r===e)return!0;switch(typeof r){case\"undefined\":case\"string\":case\"boolean\":return!1;case\"bigint\":return typeof e==\"number\"?r==e:!1;case\"number\":return typeof e==\"bigint\"?r==e:!1;case\"object\":if(typeof e!=\"object\")return!1;let i=n.debugType(r),o=n.debugType(e);if(i!==o)return!1;let s=n.registry.findBinaryOverload(\"==\",i,o);return s?s.handler(r,e,t,n):!1}throw H(\"invalid_comparison_type\",`Cannot compare values of type ${typeof r}`,t)}var Ww=new Map().set(\"A\",\"dyn\").set(\"T\",\"dyn\").set(\"K\",\"dyn\").set(\"V\",\"dyn\"),Is=class extends Do{constructor(e,t){super(e),this.createError=t?H:Jy}check(e,t){try{return e.checkedType??=e.check(this,e,t)}catch(n){throw Es(n,e)}}checkAccessOnType(e,t,n,i=!1){if(n===this.dynType)return n;let o=(e.op===\"[]\"||e.op===\"[?]\"?this.check(e.args[1],t):this.stringType).type;if(n.kind===\"list\"){if(o===\"int\"||o===\"dyn\")return n.valueType;throw this.createError(\"invalid_index_type\",`List index must be int, got '${o}'`,e)}if(n.kind===\"map\")return n.valueType;let s=this.objectTypes.get(n.name);if(s){if(!(o===\"string\"||o===\"dyn\"))throw this.createError(\"invalid_index_type\",`Cannot index type '${n.name}' with type '${o}'`,e);if(s.fields){let a;if(e.op===\".\"||e.op===\".?\"?a=e.args[1]:e.args[1].op===\"value\"&&(a=e.args[1].args),typeof a==\"string\"){let c=s.fields[a];if(c)return c;if(i)return this.dynType;throw this.createError(\"no_such_key\",`No such key: ${a}`,e)}}return this.dynType}throw this.createError(\"cannot_index_type\",`Cannot index type '${this.formatType(n)}'`,e)}formatType(e){return e.hasPlaceholderType?e.templated(this.registry,Ww).name:e.name}formatTypeList(e){return e.map(t=>this.formatType(t)).join(\", \")}};var C={EOF:0,NUMBER:1,STRING:2,BOOLEAN:3,NULL:4,IDENTIFIER:5,PLUS:6,MINUS:7,MULTIPLY:8,DIVIDE:9,MODULO:10,EQ:11,NE:12,LT:13,LE:14,GT:15,GE:16,AND:17,OR:18,NOT:19,IN:20,LPAREN:21,RPAREN:22,LBRACKET:23,RBRACKET:24,LBRACE:25,RBRACE:26,DOT:27,COMMA:28,COLON:29,QUESTION:30,BYTES:31},$c={[C.EQ]:M[\"==\"],[C.PLUS]:M[\"+\"],[C.MINUS]:M[\"-\"],[C.MULTIPLY]:M[\"*\"],[C.DIVIDE]:M[\"/\"],[C.MODULO]:M[\"%\"],[C.LE]:M[\"<=\"],[C.LT]:M[\"<\"],[C.GE]:M[\">=\"],[C.GT]:M[\">\"],[C.NE]:M[\"!=\"],[C.IN]:M.in},Ic={};for(let r in C)Ic[C[r]]=r;var Fb=new Uint8Array(128);for(let r of\"0123456789abcdefABCDEF\")Fb[r.charCodeAt(0)]=1;var Hw={bytes_unicode_escape:r=>`\\\\${r} not allowed in bytes literals`,invalid_unicode_escape:r=>`Invalid Unicode escape: \\\\${r}`,invalid_unicode_surrogate:r=>`Invalid Unicode surrogate: \\\\${r}`,invalid_hex_escape:r=>`Invalid hex escape: \\\\${r}`,invalid_octal_escape:()=>\"Octal escape must be 3 digits\",octal_escape_out_of_range:r=>`Octal escape out of range: \\\\${r}`,invalid_escape_sequence:r=>`Invalid escape sequence: \\\\${r}`},Ib={\"\\\\\":\"\\\\\",\"?\":\"?\",'\"':'\"',\"'\":\"'\",\"`\":\"`\",a:\"\\x07\",b:\"\\b\",f:\"\\f\",n:`\n`,r:\"\\r\",t:\"\t\",v:\"\\v\"},_d=class r{#e;#t;constructor(e,t,n,i,o,s){this.#e={check:o.check,evaluate:o.evaluate},this.#t=e,this.op=o.name,this.args=s,this.pos=t,this.start=n,this.end=i}clone(e,t){return new r(this.#t,this.pos,this.start,this.end,e,t)}get meta(){return this.#e}get input(){return this.#t}#n(){let e=this.#e.alternate??this;switch(e.op){case\"value\":case\"id\":case\"accuValue\":case\"accuInc\":return!1;case\"accuPush\":return e.args.maybeAsync;case\"!_\":case\"-_\":return e.candidates?.async!==!1?!0:e.args.maybeAsync;case\"!=\":case\"==\":case\"in\":case\"+\":case\"-\":case\"*\":case\"/\":case\"%\":case\"<\":case\"<=\":case\">\":case\">=\":return e.candidates?.async!==!1?!0:e.args.some(t=>t.maybeAsync);case\"call\":case\"rcall\":return e.candidates?.async!==!1?!0:(e.receiverWithArgs||e.args[1]).some(t=>t.maybeAsync);case\"comprehension\":return e.args.iterable.maybeAsync||e.args.step.maybeAsync;case\".\":case\".?\":return e.args[0].maybeAsync;case\"?:\":case\"list\":case\"[]\":case\"[?]\":return e.args.some(t=>t.maybeAsync);case\"||\":case\"&&\":return e.args.some(t=>t.maybeAsync);case\"map\":return e.args.some(t=>t[0].maybeAsync||t[1].maybeAsync);default:return!0}}get maybeAsync(){return this.#e.async??=this.#n()}check(e,t,n){let i=this.#e;return i.alternate?e.check(i.alternate,n):i.macro?i.macro.typeCheck(e,i.macro,n):i.check(e,t,n)}evaluate(e,t,n){let i=this.#e;return i.alternate?this.evaluate=this.#i:i.macro?this.evaluate=this.#o:this.evaluate=i.evaluate,this.evaluate(e,t,n)}#i(e,t,n){return(t=this.#e.alternate).evaluate(e,t,n)}#o(e,t,n){return(t=this.#e.macro).evaluate(e,t,n)}setMeta(e,t){return this.#e[e]=t,this}get range(){return{start:this.start,end:this.end}}toOldStructure(){let e=Array.isArray(this.args)?this.args:[this.args];return[this.op,...e.map(t=>t instanceof r?t.toOldStructure():t)]}},xd=class{input;pos;length;tokenPos;tokenType;tokenValue;reset(e){return this.pos=0,this.input=e,this.length=e.length,e}token(e,t,n){return this.tokenPos=e,this.tokenType=t,this.tokenValue=n,this}nextToken(){for(;;){let{pos:e,input:t,length:n}=this;if(e>=n)return this.token(e,C.EOF);let i=t[e];switch(i){case\" \":case\"\t\":case`\n`:case\"\\r\":this.pos++;continue;case\"=\":if(t[e+1]!==\"=\")break;return this.token((this.pos+=2)-2,C.EQ);case\"&\":if(t[e+1]!==\"&\")break;return this.token((this.pos+=2)-2,C.AND);case\"|\":if(t[e+1]!==\"|\")break;return this.token((this.pos+=2)-2,C.OR);case\"+\":return this.token(this.pos++,C.PLUS);case\"-\":return this.token(this.pos++,C.MINUS);case\"*\":return this.token(this.pos++,C.MULTIPLY);case\"/\":if(t[e+1]===\"/\"){for(;this.pos<n&&this.input[this.pos]!==`\n`;)this.pos++;continue}return this.token(this.pos++,C.DIVIDE);case\"%\":return this.token(this.pos++,C.MODULO);case\"<\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,C.LE):this.token(this.pos++,C.LT);case\">\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,C.GE):this.token(this.pos++,C.GT);case\"!\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,C.NE):this.token(this.pos++,C.NOT);case\"(\":return this.token(this.pos++,C.LPAREN);case\")\":return this.token(this.pos++,C.RPAREN);case\"[\":return this.token(this.pos++,C.LBRACKET);case\"]\":return this.token(this.pos++,C.RBRACKET);case\"{\":return this.token(this.pos++,C.LBRACE);case\"}\":return this.token(this.pos++,C.RBRACE);case\".\":return this.token(this.pos++,C.DOT);case\",\":return this.token(this.pos++,C.COMMA);case\":\":return this.token(this.pos++,C.COLON);case\"?\":return this.token(this.pos++,C.QUESTION);case'\"':case\"'\":return this.readString(i);case\"b\":case\"B\":case\"r\":case\"R\":{let o=t[e+1];return o==='\"'||o===\"'\"?++this.pos&&this.readString(o,i):this.readIdentifier()}default:{let o=i.charCodeAt(0);if(o<=57&&o>=48)return this.readNumber();if(this._isIdentifierCharCode(o))return this.readIdentifier()}}throw qe(\"unexpected_character\",`Unexpected character: ${i}`,{pos:e,start:e,end:e+1,input:t})}}_isIdentifierCharCode(e){return e<48||e>122?!1:e>=97||e>=65&&e<=90||e<=57||e===95}_parseAsDouble(e,t){let n=Number(this.input.substring(e,t));if(Number.isFinite(n))return this.token(e,C.NUMBER,n);throw qe(\"invalid_number\",`Invalid number: ${n}`,{pos:e,start:e,end:t,input:this.input})}_parseAsBigInt(e,t,n,i){let o=this.input.substring(e,t);if(i===\"u\"||i===\"U\"){this.pos++;try{return this.token(e,C.NUMBER,new Ne(o))}catch{}}else try{return this.token(e,C.NUMBER,BigInt(o))}catch{}throw qe(n?\"invalid_hex_integer\":\"invalid_integer\",n?`Invalid hex integer: ${o}`:`Invalid integer: ${o}`,{pos:e,start:e,end:this.pos,input:this.input})}_readDigits(e,t,n,i){for(;n<t&&(i=e.charCodeAt(n))&&!(i>57||i<48);)n++;return n}_readExponent(e,t,n){let i=n<t&&e[n];if(i===\"e\"||i===\"E\"){i=++n<t&&e[n],(i===\"-\"||i===\"+\")&&n++;let o=n;if(n=this._readDigits(e,t,n),o===n)throw qe(\"invalid_exponent\",\"Invalid exponent\",{pos:n,start:n,end:Math.min(n+1,e.length),input:e})}return n}readNumber(){let{input:e,length:t,pos:n}=this,i=n;if(e[i]===\"0\"&&(e[i+1]===\"x\"||e[i+1]===\"X\")){for(i+=2;i<t&&Fb[e[i].charCodeAt(0)];)i++;return this._parseAsBigInt(n,this.pos=i,!0,e[i])}if(i=this._readDigits(e,t,i),i+1<t){let o=!1,s=e[i]===\".\"?this._readDigits(e,t,i+1):i+1;if(s!==i+1&&(o=!0)&&(i=s),s=this._readExponent(e,t,i),s!==i&&(o=!0)&&(i=s),o)return this._parseAsDouble(n,this.pos=i)}return this._parseAsBigInt(n,this.pos=i,!1,e[i])}readString(e,t){let{input:n,pos:i}=this;return n[i+1]===e&&n[i+2]===e?this.readTripleQuotedString(e,t):this.readSingleQuotedString(e,t)}_closeQuotedString(e,t,n,i){switch(n){case\"b\":case\"B\":{let o=this.processEscapes(e,t,!0),s=new Uint8Array(o.length);for(let a=0;a<o.length;a++)s[a]=o.charCodeAt(a)&255;return this.token(i-1,C.BYTES,s)}case\"r\":case\"R\":return this.token(i-1,C.STRING,t);default:{let o=this.processEscapes(e,t,!1);return this.token(i,C.STRING,o)}}}readSingleQuotedString(e,t){let{input:n,length:i,pos:o}=this,s,a=this.pos+1;for(;a<i&&(s=n[a]);){switch(s){case e:let c=o+1,u=n.slice(c,a);return this.pos=++a,this._closeQuotedString(c,u,t,o);case`\n`:case\"\\r\":throw qe(\"newline_in_string\",\"Newlines not allowed in single-quoted strings\",{pos:a,start:a,end:a+1,input:n});case\"\\\\\":a++}a++}throw qe(\"unterminated_string\",\"Unterminated string\",{pos:o,start:o,end:n.length,input:n})}readTripleQuotedString(e,t){let{input:n,length:i,pos:o}=this,s,a=this.pos+3;for(;a<i&&(s=n[a]);){switch(s){case e:if(n[a+1]===e&&n[a+2]===e){let c=o+3,u=n.slice(c,a);return this.pos=a+3,this._closeQuotedString(c,u,t,o)}break;case\"\\\\\":a++}a++}throw qe(\"unterminated_triple_quoted_string\",\"Unterminated triple-quoted string\",{pos:o,start:o,end:n.length,input:n})}#e(e,t,n,i,o,s){let a=t+i;return qe(e,Hw[e](s),{input:this.input,pos:a,start:a,end:Math.min(a+o,t+n)})}processEscapes(e,t,n){if(!t.includes(\"\\\\\"))return t;let i=t.length,o=\"\",s=0;for(;s<i;){if(t[s]!==\"\\\\\"||s+1>=i){o+=t[s++];continue}let a=t[s+1];if(Ib[a])o+=Ib[a],s+=2;else if(a===\"u\"||a===\"U\"){if(n)throw this.#e(\"bytes_unicode_escape\",e,i,s,2,a);let c=a===\"u\"?4:8,u=t.substring(s+2,s+2+c),l=Number.parseInt(u,16);if(u.length!==c||!/^[0-9a-fA-F]+$/.test(u)||l>1114111)throw this.#e(\"invalid_unicode_escape\",e,i,s,2+c,a+u);if(l>=55296&&l<=57343)throw this.#e(\"invalid_unicode_surrogate\",e,i,s,2+c,a+u);o+=String.fromCodePoint(l),s+=2+c}else if(a===\"x\"||a===\"X\"){let c=t.substring(s+2,s+4);if(!/^[0-9a-fA-F]{2}$/.test(c))throw this.#e(\"invalid_hex_escape\",e,i,s,4,a+c);o+=String.fromCharCode(Number.parseInt(c,16)),s+=4}else if(a>=\"0\"&&a<=\"7\"){let c=t.substring(s+1,s+4);if(!/^[0-7]{3}$/.test(c))throw this.#e(\"invalid_octal_escape\",e,i,s,4);let u=Number.parseInt(c,8);if(u>255)throw this.#e(\"octal_escape_out_of_range\",e,i,s,4,c);o+=String.fromCharCode(u),s+=4}else throw this.#e(\"invalid_escape_sequence\",e,i,s,2,a)}return o}readIdentifier(){let{pos:e,input:t,length:n}=this,i=e;for(;i<n&&this._isIdentifierCharCode(t[i].charCodeAt(0));)i++;let o=t.substring(e,this.pos=i);switch(o){case\"true\":return this.token(e,C.BOOLEAN,!0);case\"false\":return this.token(e,C.BOOLEAN,!1);case\"null\":return this.token(e,C.NULL,null);case\"in\":return this.token(e,C.IN);default:return this.token(e,C.IDENTIFIER,o)}}},Gw=new xd,Fc=class{lexer=Gw;input=null;maxDepthRemaining=null;astNodesRemaining=null;type=null;pos=null;constructor(e,t){this.limits=e,this.registry=t}#e(e,t=this.pos){throw qe(\"limit_exceeded\",`Exceeded ${e} (${this.limits[e]})`,{pos:t,start:t,end:t,input:this.input})}#t(e,t,n,i,o=e){let s=new _d(this.input,o,e,t,n,i);return this.astNodesRemaining--||this.#e(\"maxAstNodes\",o),s}#n(e,t,n){return this.#t(t.start,n.end,e,[t,n])}#i(e,t,n){return this.#t(e.start,n.end,M.ternary,[e,t,n])}#o(e,t,n){return this.#t(e,n.end,t,n)}#s(e,t,n,i,o=t.start){return this.#t(t.start,i,e,[t,n],o)}#r(e=this.pos){let t=this.lexer.nextToken();return this.pos=t.tokenPos,this.type=t.tokenType,e}get value(){return this.lexer.tokenValue}consume(e){if(this.type===e)return this.#r();throw qe(\"expected_token\",`Expected ${Ic[e]}, got ${Ic[this.type]}`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}match(e){return this.type===e}parse(e){if(typeof e!=\"string\")throw qe(\"expression_must_be_string\",\"Expression must be a string\");this.input=this.lexer.reset(e),this.#r(),this.maxDepthRemaining=this.limits.maxDepth,this.astNodesRemaining=this.limits.maxAstNodes;let t=this.parseExpression();if(this.match(C.EOF))return t;throw qe(\"unexpected_character\",`Unexpected character: '${this.input[this.lexer.pos-1]}'`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}#a(e,t,n,i){let o=i[0],s=n===M.rcall?i[1]:null,a=n===M.rcall?i[2]:i[1],c=this.registry.findMacro(o,!!s,a.length),u=this.#t(e,t,n,i);if(!c)return u;let l=c.handler({ast:u,args:a,receiver:s,methodName:o,parser:this});return l.callAst?u.setMeta(\"alternate\",l.callAst):u.setMeta(\"macro\",l).setMeta(\"async\",Ts(l.evaluate,l.async))}parseExpression(){this.maxDepthRemaining--||this.#e(\"maxDepth\");let e=this.parseLogicalOr();if(!this.match(C.QUESTION))return++this.maxDepthRemaining&&e;this.#r();let t=this.parseExpression();this.consume(C.COLON);let n=this.parseExpression();return this.maxDepthRemaining++,this.#i(e,t,n)}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(C.OR);)this.#r(),e=this.#n(M[\"||\"],e,this.parseLogicalAnd());return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(C.AND);)this.#r(),e=this.#n(M[\"&&\"],e,this.parseEquality());return e}parseEquality(){let e=this.parseRelational();for(;this.match(C.EQ)||this.match(C.NE);){let t=$c[this.type];this.#r(),e=this.#n(t,e,this.parseRelational())}return e}parseRelational(){let e=this.parseAdditive();for(;this.match(C.LT)||this.match(C.LE)||this.match(C.GT)||this.match(C.GE)||this.match(C.IN);){let t=$c[this.type];this.#r(),e=this.#n(t,e,this.parseAdditive())}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(C.PLUS)||this.match(C.MINUS);){let t=$c[this.type];this.#r(),e=this.#n(t,e,this.parseMultiplicative())}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(C.MULTIPLY)||this.match(C.DIVIDE)||this.match(C.MODULO);){let t=$c[this.type];this.#r(),e=this.#n(t,e,this.parseUnary())}return e}parseUnary(){return this.type===C.NOT?this.#o(this.#r(),M.unaryNot,this.parseUnary()):this.type===C.MINUS?this.#o(this.#r(),M.unaryMinus,this.parseUnary()):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary(),t=this.maxDepthRemaining;for(;;){if(this.match(C.DOT)){let n=this.#r();this.maxDepthRemaining--||this.#e(\"maxDepth\",n);let i=this.match(C.QUESTION)&&this.registry.enableOptionalTypes&&this.#r()?M.optionalFieldAccess:M.fieldAccess,o=this.value,s=this.pos,a=this.lexer.pos;if(this.consume(C.IDENTIFIER),i===M.fieldAccess&&this.match(C.LPAREN)&&this.#r()){let c=this.parseArgumentList(),u=this.lexer.pos;this.consume(C.RPAREN),e=this.#a(e.start,u,M.rcall,[o,e,c])}else e=this.#s(i,e,o,a,s);continue}if(this.match(C.LBRACKET)){let n=this.#r();this.maxDepthRemaining--||this.#e(\"maxDepth\",n);let i=this.match(C.QUESTION)&&this.registry.enableOptionalTypes&&this.#r()?M.optionalBracketAccess:M.bracketAccess,o=this.parseExpression(),s=this.lexer.pos;this.consume(C.RBRACKET),e=this.#s(i,e,o,s);continue}break}return this.maxDepthRemaining=t,e}parsePrimary(){switch(this.type){case C.NUMBER:case C.STRING:case C.BYTES:case C.BOOLEAN:case C.NULL:return this.#d();case C.IDENTIFIER:return this.#u();case C.LPAREN:return this.#l();case C.LBRACKET:return this.parseList();case C.LBRACE:return this.parseMap()}throw qe(\"unexpected_token\",`Unexpected token: ${Ic[this.type]}`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}#d(){return this.#r(this.#t(this.pos,this.lexer.pos,M.value,this.value))}#u(){let e=this.value,t=this.lexer.pos,n=this.consume(C.IDENTIFIER);if(bo.has(e))throw qe(\"reserved_identifier\",`Reserved identifier: ${e}`,{pos:n,start:n,end:t,input:this.input});if(!this.match(C.LPAREN))return this.#t(n,t,M.id,e);this.#r();let i=this.parseArgumentList(),o=this.lexer.pos;return this.consume(C.RPAREN),this.#a(n,o,M.call,[e,i])}#l(){this.consume(C.LPAREN);let e=this.parseExpression();return this.consume(C.RPAREN),e}parseList(){let e=this.consume(C.LBRACKET),t=[],n=this.limits.maxListElements;if(!this.match(C.RBRACKET))for(t.push(this.parseExpression()),n--||this.#e(\"maxListElements\",t.at(-1).pos);this.match(C.COMMA)&&(this.#r(),!this.match(C.RBRACKET));)t.push(this.parseExpression()),n--||this.#e(\"maxListElements\",t.at(-1).pos);let i=this.lexer.pos;return this.consume(C.RBRACKET),this.#t(e,i,M.list,t)}parseMap(){let e=this.consume(C.LBRACE),t=[],n=this.limits.maxMapEntries;if(!this.match(C.RBRACE))for(t.push(this.parseProperty()),n--||this.#e(\"maxMapEntries\",t.at(-1)[0].pos);this.match(C.COMMA)&&(this.#r(),!this.match(C.RBRACE));)t.push(this.parseProperty()),n--||this.#e(\"maxMapEntries\",t.at(-1)[0].pos);let i=this.lexer.pos;return this.consume(C.RBRACE),this.#t(e,i,M.map,t)}parseProperty(){return[this.parseExpression(),(this.consume(C.COLON),this.parseExpression())]}parseArgumentList(){let e=[],t=this.limits.maxCallArguments;if(!this.match(C.RPAREN))for(e.push(this.parseExpression()),t--||this.#e(\"maxCallArguments\",e.at(-1).pos);this.match(C.COMMA)&&(this.#r(),!this.match(C.RPAREN));)e.push(this.parseExpression()),t--||this.#e(\"maxCallArguments\",e.at(-1).pos);return e}};var Dd=Ht({maxAstNodes:1e5,maxDepth:250,maxListElements:1e3,maxMapEntries:1e3,maxCallArguments:32}),Kw=new Set(Ze(Dd));function Jw(r,e=Dd){let t=r?Ze(r):void 0;if(!t?.length)return e;let n={...e};for(let i of t){if(!Kw.has(i))throw new TypeError(`Unknown limits option: ${i}`);let o=r[i];typeof o==\"number\"&&(n[i]=o)}return Ht(n)}var Yw=Ht({unlistedVariablesAreDyn:!1,homogeneousAggregateLiterals:!0,enableOptionalTypes:!1,limits:Dd});function Ad(r,e,t){let n=r?.[t]??e?.[t];if(typeof n!=\"boolean\")throw new TypeError(`Invalid option: ${t}`);return n}function Rb(r,e=Yw){return r?Ht({unlistedVariablesAreDyn:Ad(r,e,\"unlistedVariablesAreDyn\"),homogeneousAggregateLiterals:Ad(r,e,\"homogeneousAggregateLiterals\"),enableOptionalTypes:Ad(r,e,\"enableOptionalTypes\"),limits:Jw(r.limits,e.limits)}):e}var Rc=fb({enableOptionalTypes:!1});nb(Rc);$b(Rc);kb(Rc);var Co=class r{#e;#t;#n;#i;#o;constructor(e,t){this.opts=Rb(e,t?.opts),this.#e=(t instanceof r?t.#e:Rc).clone(this.opts);let n={registry:this.#e,opts:this.opts};this.#n=new Is(n),this.#i=new Is(n,!0),this.#t=new Cd(n),this.#o=new Fc(this.opts.limits,this.#e),Object.freeze(this)}clone(e){return new r(e,this)}registerFunction(e,t,n){return this.#e.registerFunctionOverload(e,t,n),this}registerOperator(e,t,n){return this.#e.registerOperatorOverload(e,t,n),this}registerType(e,t){return this.#e.registerType(e,t),this}registerVariable(e,t,n){return this.#e.registerVariable(e,t,n),this}registerConstant(e,t,n){return this.#e.registerConstant(e,t,n),this}hasVariable(e){return this.#e.variables.has(e)}getDefinitions(){return this.#e.getDefinitions()}check(e){try{return this.#s(this.#o.parse(e))}catch(t){return{valid:!1,error:t}}}#s(e){try{let t=this.#n.check(e,new xo(this.#e));return{valid:!0,type:this.#r(t)}}catch(t){return{valid:!1,error:t}}}#r(e){return e.name===\"list<dyn>\"?\"list\":e.name===\"map<dyn, dyn>\"?\"map\":e.name}parse(e){let t=this.#o.parse(e),n=this.#a.bind(this,t);return n.check=this.#s.bind(this,t),n.ast=t,n}evaluate(e,t){return this.#a(this.#o.parse(e),t)}#a(e,t){return e.checkedType?e.evaluate(this.#t,e,new xo(this.#e,t)):(this.#i.check(e,t=new xo(this.#e,t)),e.evaluate(this.#t,e,t))}},Cd=class extends Do{constructor(e){super(e),this.createError=H}#e(e){if(e instanceof Map)return e.entries().next().value;for(let t in e)return[t,e[t]]}debugRuntimeType(e,t){return t?.hasDynType===!1?t:this.debugTypeDeep(e)}debugTypeDeep(e){let t=this.debugType(e);switch(t.kind){case\"list\":{let n=e instanceof Array?e[0]:e.values().next().value;return n===void 0?t:this.registry.getListType(this.debugTypeDeep(n))}case\"map\":{let n=this.#e(e);return n?this.registry.getMapType(t.keyType.hasDynType?this.debugTypeDeep(n[0]):t.keyType,t.valueType.hasDynType?this.debugTypeDeep(n[1]):t.valueType):t}default:return t}}tryEval(e,t){try{let n=this.run(e,t);return n instanceof Promise?n.catch(i=>i):n}catch(n){return n}}run(e,t){return e.evaluate(this,e,t)}},KP=new Co({unlistedVariablesAreDyn:!0});var Xw=$d(Nb(),1);var Mb=3660,Qw=64,eE=/^(\\d{4})-(\\d{2})-(\\d{2})$/;function Fs(r){return typeof r==\"number\"&&Number.isInteger(r)?BigInt(r):Array.isArray(r)?r.map(Fs):r&&typeof r==\"object\"?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Fs(t)])):r}function Rs(r){return typeof r==\"bigint\"?Number(r):Array.isArray(r)?r.map(Rs):r instanceof Map?Object.fromEntries([...r].map(([e,t])=>[String(e),Rs(t)])):r&&typeof r==\"object\"?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Rs(t)])):r}function wo(r){let e=eE.exec(r);if(!e)throw new Error(`not a day: ${r}`);let[t,n,i]=[Number(e[1]),Number(e[2]),Number(e[3])],o=Date.UTC(t,n-1,i),s=new Date(o);if(s.getUTCFullYear()!==t||s.getUTCMonth()!==n-1||s.getUTCDate()!==i)throw new Error(`not a day: ${r}`);return o/864e5}var wd=r=>new Date(r*864e5).toISOString().slice(0,10),Oc={addDays:(r,e)=>wd(wo(r)+Number(e)),daysBetween:(r,e)=>BigInt(wo(e)-wo(r)),weekStart:r=>{let e=wo(r);return wd(e-(new Date(e*864e5).getUTCDay()+6)%7)},dateRange:(r,e)=>{let[t,n]=[wo(r),wo(e)];if(n-t>Mb)throw new Error(`a range of at most ${Mb} days`);let i=[];for(let o=t;o<n;o++)i.push(wd(o));return i}};var Nc=class{constructor(e){this.logic=e;this.consts=Fs(e.consts);let t=new Co({unlistedVariablesAreDyn:!0,homogeneousAggregateLiterals:!1});t.registerFunction(\"addDays(string, int): string\",Oc.addDays),t.registerFunction(\"daysBetween(string, string): int\",Oc.daysBetween),t.registerFunction(\"weekStart(string): string\",Oc.weekStart),t.registerFunction(\"dateRange(string, string): list<string>\",Oc.dateRange),t.registerFunction(\"list.sort(): list\",n=>[...n].sort((i,o)=>i<o?-1:i>o?1:0)),t.registerFunction(\"fold(list, dyn, string): dyn\",(n,i,o)=>{if(!(o in e.functions))throw new Error(`fold: no function ${o}`);return n.reduce((s,a)=>this.call(o,[s,a]),i)});for(let[n,i]of Object.entries(e.functions))t.registerFunction(`${n}(${i.params.map(()=>\"dyn\").join(\", \")}): dyn`,(...o)=>this.call(n,o));this.env=t}logic;env;consts;depth=0;call(e,t){let n=this.logic.functions[e];if(++this.depth>Qw)throw this.depth=0,new Error(\"calls nest too deep\");try{return this.env.evaluate(n.cel,{...this.consts,...Object.fromEntries(n.params.map((i,o)=>[i,t[o]??null]))})}finally{this.depth--}}evaluate(e,t={}){try{return this.depth=0,Rs(this.env.evaluate(e,{...this.consts,...Fs(t)}))}catch{return null}}apply(e,t){try{return this.depth=0,Rs(this.call(e,t.map(Fs)))}catch{return null}}parseError(e){try{return this.env.parse(e),null}catch(t){return t.message.split(`\n`)[0]??\"doesn't parse\"}}};var jb=r=>r===void 0?r:structuredClone(r);function Os(r,e,t){if(!(typeof e.path!=\"string\"||!e.path.startsWith(\"/\"))){if(e.op===\"set\")r.set(e.path,jb(e.value));else if(e.op===\"push\"){let n=r.get(e.path);r.set(e.path,[...Array.isArray(n)?n:[],jb(e.value)])}else if(e.op===\"removeAt\"){let n=r.get(e.path);if(!Array.isArray(n)||t===void 0||t<0||t>=n.length)return;let i=n.slice();i.splice(t,1),r.set(e.path,i)}}}function Pb(r,e,t){for(let n of e)Os(r,n,t)}function Lb(r,e,t){return Object.keys(e).sort().map(n=>[n,r.evaluate(e[n],t)])}function Bb(r=new Date){let e=t=>String(t).padStart(2,\"0\");return`${r.getFullYear()}-${e(r.getMonth()+1)}-${e(r.getDate())}`}var tE=\"button, input, select, textarea, [role=button], [role=checkbox]\";function Vb(r){for(let e of r.querySelectorAll(\"[aria-label]\")){if(!e.tagName.startsWith(\"A2UI-\"))continue;let t=e.querySelector(tE);if(!t||t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\"))continue;t.setAttribute(\"aria-label\",e.getAttribute(\"aria-label\"));let n=e.getAttribute(\"aria-description\");n&&!t.hasAttribute(\"aria-description\")&&t.setAttribute(\"aria-description\",n)}}function Ub(r){Vb(r),new MutationObserver(()=>Vb(r)).observe(r,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[\"aria-label\"]})}var rE={name:\"DateStrip\",schema:d.object({days:d.number().int().min(2).max(60).optional(),today:fr.DynamicString,value:fr.DynamicString,statuses:fr.DynamicValue.optional()})},zb=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],nE=[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],iE={complete:\"var(--a2ui-color-success, #10b981)\",partial:\"var(--a2ui-color-warning, #fbbf24)\",incomplete:\"var(--a2ui-color-error, #ef4444)\",active:\"var(--a2ui-color-primary)\"},qb=r=>{let[e,t,n]=r.split(\"-\").map(Number);return new Date(Date.UTC(e,t-1,n))},Zb=r=>r.toISOString().slice(0,10),Wb=Ds(rE,({props:r})=>{let e=r,t=Pr(null);gr(()=>{t.current&&(t.current.scrollLeft=t.current.scrollWidth)},[]);let n=typeof e.today==\"string\"&&/^\\d{4}-\\d{2}-\\d{2}$/.test(e.today)?e.today:Zb(new Date),i=e.days??14,o=qb(n),s=Array.from({length:i},(c,u)=>Zb(new Date(o.getTime()-(i-1-u)*864e5))),a=new Map;if(Array.isArray(e.statuses))for(let c of e.statuses)typeof c?.day==\"string\"&&typeof c?.status==\"string\"&&a.set(c.day,c.status);return ne(\"div\",{class:\"cc-datestrip\",ref:t,role:\"group\",\"aria-label\":\"Days\",children:s.map(c=>{let u=qb(c),l=c===e.value,p=c===n,f=a.get(c);return ne(\"button\",{type:\"button\",class:`cc-day${l?\" cc-on\":\"\"}${p?\" cc-today\":\"\"}`,\"aria-pressed\":l,\"aria-label\":`${p?\"Today, \":\"\"}${zb[u.getUTCDay()]} ${u.getUTCDate()} ${nE[u.getUTCMonth()]}${f?`, ${f}`:\"\"}`,onClick:()=>e.setValue?.(c),children:[ne(\"span\",{class:\"cc-wd\",children:p?\"Today\":zb[u.getUTCDay()]}),ne(\"span\",{class:\"cc-n\",children:u.getUTCDate()}),ne(\"span\",{class:\"cc-dot\",style:{background:f?l&&f===\"active\"?\"var(--a2ui-color-on-primary, #fff)\":iE[f]:\"transparent\"}})]},c)})})});var oE=fo.components.get(\"TextField\"),Hb=Ds(oE,({props:r})=>{let e=r,t=e.variant===\"number\"?\"number\":e.variant===\"obscured\"?\"password\":\"text\",n=e.isValid===!1,i=o=>e.setValue?.(o.target.value);return ne(\"label\",{class:`cc-field${n?\" cc-invalid\":\"\"}`,children:[e.label?ne(\"span\",{class:\"cc-field-label\",children:e.label}):null,e.variant===\"longText\"?ne(\"textarea\",{value:e.value??\"\",onInput:i,\"aria-invalid\":n||void 0}):ne(\"input\",{type:t,inputMode:t===\"number\"?\"numeric\":void 0,value:e.value??\"\",onInput:i,\"aria-invalid\":n||void 0}),n&&e.validationErrors?.length?ne(\"span\",{class:\"cc-field-error\",children:e.validationErrors[0]}):null]})});var Ed=r=>!!r&&typeof r==\"object\"&&!Array.isArray(r);function Gb(r,e,t){let n=c=>({saved:structuredClone(e.initial),version:e.version,note:c});if(r===null)return n(\"new\");let i;try{i=JSON.parse(r)}catch{return n(\"unreadable\")}if(!Ed(i)||typeof i.v!=\"number\")return n(\"unreadable\");let{v:o,...s}=i;if(o===e.version)return{saved:s,version:o,note:\"loaded\"};if(o>e.version)return{saved:s,version:o,note:\"newer\"};let a=s;for(let c=o;c<e.version;c++){let u=e.migrations.find(p=>p.from===c);if(!u)return n(\"unreadable\");let l=t.evaluate(u.cel,{saved:a});if(!Ed(l))return n(\"unreadable\");a=l}return{saved:a,version:e.version,note:\"migrated\"}}function Kb(r,e,t){return e.note===\"newer\"?null:JSON.stringify({v:t.version,...Ed(r)?r:{}})}var sE=r=>r.replace(/~/g,\"~0\").replace(/\\//g,\"~1\"),Sd=(r,e)=>JSON.stringify(r)===JSON.stringify(e),Mc=r=>r===void 0?r:structuredClone(r);function aE(r,e){return r.replace(/\\$\\{(\\/[^}]*)\\}/g,(t,n)=>sE(String(e.get(n)??\"\")))}var jc=class{constructor(e){this.views=e}views;last=new Map;sync(e){let t=!1;for(let n of this.views){let i=aE(n.source,e),o=e.get(n.path),s=this.last.get(n.path);if(s!==void 0&&s.source===i&&!Sd(o,s.value)){let c=e.get(i);!(c===void 0&&Array.isArray(o)&&o.length===0)&&!Sd(c,o)&&(e.set(i,Mc(o)),t=!0),this.last.set(n.path,{source:i,value:Mc(o)})}else{let c=e.get(i),u=c===void 0?[]:c;Sd(o,u)||(e.set(n.path,Mc(u)),t=!0),this.last.set(n.path,{source:i,value:Mc(u)})}}return t}};var cE=\"https://cloudcrane.ai/catalogs/app/v1.json\",Pc=r=>({get:e=>r.dataModel.get(e),set:(e,t)=>r.dataModel.set(e,t)}),uE=[Ae({name:\"set\",returnType:\"void\",schema:d.object({path:fr.DynamicString,value:fr.DynamicValue}),allowedCallers:\"rendererOnly\"},(r,e)=>Os(Pc(e),{op:\"set\",path:r.path,value:r.value},void 0)),Ae({name:\"push\",returnType:\"void\",schema:d.object({path:fr.DynamicString,value:fr.DynamicValue}),allowedCallers:\"rendererOnly\"},(r,e)=>Os(Pc(e),{op:\"push\",path:r.path,value:r.value},void 0)),Ae({name:\"removeAt\",returnType:\"void\",schema:d.object({path:fr.DynamicString}),allowedCallers:\"rendererOnly\"},(r,e)=>{let t=e;Os(Pc(t),{op:\"removeAt\",path:r.path},t.getIndex())}),Ae({name:\"batch\",returnType:\"void\",schema:d.object({steps:d.array(d.record(d.unknown()))}),allowedCallers:\"rendererOnly\"},(r,e)=>{let t=e,n=r.steps.map(i=>({op:i.op,path:t.resolveDynamicValue(i.target),value:t.resolveDynamicValue(i.value)}));Pb(Pc(t),n,t.getIndex())})];function lE(){let r=JSON.parse(document.getElementById(\"cc-spec\").textContent),e=new Nc(r.logic),t=null;try{t=localStorage.getItem(r.data.key)}catch{t=null}let n=Gb(t,r.data,e),i=[...fo.components.values()].filter(x=>x.name!==\"TextField\"),o=new Ot(cE,\"v0.9\",[...i,Hb,Wb],[...fo.functions.values(),...uE]),s=new Na([o]);s.processMessages(r.surface.messages);let a=[...s.model.surfacesMap.values()][0],c=a.dataModel;a.onError.subscribe(x=>console.error(\"[a2ui]\",JSON.stringify(x))),a.onWarning.subscribe(x=>console.warn(\"[a2ui]\",JSON.stringify(x)));let u=r.data.persist,l=window.__ccToday??Bb();c.set(\"/today\",l),(c.get(\"/ui/selected\")??\"\")===\"\"&&c.set(\"/ui/selected\",l),c.set(u,n.saved);let p=new jc(r.data.views),f={get:x=>c.get(x),set:(x,$)=>c.set(x,$)},m=!1,g=()=>{if(!m){m=!0;try{for(let x=0;x<5&&(p.sync(f)||h());x++);}finally{m=!1}}},h=()=>{let x=!1,$={saved:c.get(u),ui:c.get(\"/ui\"),today:l};for(let[V,S]of Lb(e,r.logic.computed,$))JSON.stringify(c.get(V))!==JSON.stringify(S)&&(c.set(V,S),x=!0);return x},b=()=>{let x=Kb(c.get(u),n,r.data);if(x!==null)try{localStorage.setItem(r.data.key,x)}catch{}};g(),c.subscribe(u,()=>{g(),b()}),c.subscribe(\"/ui\",g),n.note===\"migrated\"&&b(),window.appState=()=>({data:c.get(\"/\"),today:l,loaded:n.note});let v=document.getElementById(\"app\");Zr(yt(id,{surface:a}),v),Ub(v)}lE();export{cE as CLOUDCRANE_CATALOG_ID};\n";
|