@maggioli-rd/aicore-agent-chat 1.2.0 → 1.3.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.
Files changed (129) hide show
  1. package/README.md +22 -5
  2. package/dist/aicore-agent-chat.js +52 -34
  3. package/dist/aicore-agent-chat.js.map +1 -1
  4. package/dist/bundle/a2ui-C3GhjTrJ.js +113 -0
  5. package/dist/bundle/abnfDiagram-S7VZAUFO-DxkzIS8G.js +1 -0
  6. package/dist/bundle/architecture-WOLXFQ4H-BXMyXdT1.js +1 -0
  7. package/dist/bundle/architectureDiagram-YGSQEFNW-BmsDn6Ho.js +36 -0
  8. package/dist/bundle/blockDiagram-APKKGZFW-bG_MVPzT.js +140 -0
  9. package/dist/bundle/bpmnIcons-APHXDYXF-C0jbCElo.js +1 -0
  10. package/dist/bundle/c4Diagram-KJ2TOQU5-BVad-wQe.js +38 -0
  11. package/dist/bundle/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  12. package/dist/bundle/chunk-5VM5RSS4-CwNG0iBi.js +15 -0
  13. package/dist/bundle/chunk-6MUBBAK2-CeH4cZO-.js +2 -0
  14. package/dist/bundle/chunk-AXFCVDMN-D0Vqm50X.js +62 -0
  15. package/dist/bundle/chunk-BG4553SI-DUBI9JbR.js +127 -0
  16. package/dist/bundle/chunk-DQASFODM-DBWVlIjs.js +10 -0
  17. package/dist/bundle/chunk-DUW6YSOI-ChybIQ82.js +1 -0
  18. package/dist/bundle/chunk-HFQBQIA3-D2xPptW8.js +1 -0
  19. package/dist/bundle/chunk-J5ZVWO5B-DHB__t6z.js +1 -0
  20. package/dist/bundle/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  21. package/dist/bundle/chunk-KQLB2F66-BRGnyo9e.js +1 -0
  22. package/dist/bundle/chunk-KS47KZWR-DV3Gxewa.js +1 -0
  23. package/dist/bundle/chunk-LEVMRMFU-BdDTT4pw.js +1 -0
  24. package/dist/bundle/chunk-M57EVK23-BRqFqW5o.js +1 -0
  25. package/dist/bundle/chunk-NGNAAXSQ-DreF1ykJ.js +214 -0
  26. package/dist/bundle/chunk-OY52VR5R-BamrP8d_.js +88 -0
  27. package/dist/bundle/chunk-QB3YPZ4I-BqUUL29j.js +213 -0
  28. package/dist/bundle/chunk-R3KSYZAL-gmtEjdKU.js +1 -0
  29. package/dist/bundle/chunk-STOXU5M4-DdqxXfKq.js +72 -0
  30. package/dist/bundle/chunk-TU62E6Q5-B4GgWjUW.js +1 -0
  31. package/dist/bundle/chunk-X4PVCEUW-BcN5Aq5G.js +1 -0
  32. package/dist/bundle/chunk-XXDRQBXY-BIvjAdC_.js +1 -0
  33. package/dist/bundle/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  34. package/dist/bundle/classDiagram-v2-L25IHNXF-Dw7so3mk.js +217 -0
  35. package/dist/bundle/cose-bilkent-JH36ORCC-DUvnuVrm.js +1 -0
  36. package/dist/bundle/cynefin-EF2NZ3EQ-CcVPiRLN.js +1 -0
  37. package/dist/bundle/cynefinDiagram-L36ESFBY-eO6Z3Kvn.js +62 -0
  38. package/dist/bundle/cytoscape.esm-CsT4DLSP.js +321 -0
  39. package/dist/bundle/d3-hierarchy-i5r04UUG.js +1 -0
  40. package/dist/bundle/d3-scale-BEO6F4Sh.js +1 -0
  41. package/dist/bundle/d3-scale-chromatic-DhHjp77O.js +1 -0
  42. package/dist/bundle/d3-selection-CBFxn8wf.js +1 -0
  43. package/dist/bundle/d3-shape-v1Y4qR5e.js +1 -0
  44. package/dist/bundle/dagre-SPEB5RXH-ByBZqBaT.js +4 -0
  45. package/dist/bundle/diagram-3B7GL73J-BkQkIpxz.js +200 -0
  46. package/dist/bundle/diagram-DNEMPZML-DYthXzRv.js +24 -0
  47. package/dist/bundle/diagram-L3MUGCDN-D4DIzfHH.js +41 -0
  48. package/dist/bundle/diagram-LA4NIPWU-C2P-hZD1.js +24 -0
  49. package/dist/bundle/diagram-MHCOC4E2-BwauFnTV.js +3 -0
  50. package/dist/bundle/diagram-XPFHEONP-DC_v3Llc.js +30 -0
  51. package/dist/bundle/dist-CwuaKeLF.js +1 -0
  52. package/dist/bundle/ebnfDiagram-UZSYDL2S-CmwGlC8L.js +1 -0
  53. package/dist/bundle/elk-XV6XMXQE-CTlty3p3.js +27 -0
  54. package/dist/bundle/erDiagram-EYBAPDEH-Bu6phvJH.js +99 -0
  55. package/dist/bundle/eventmodeling-K75KTNOO-B1q0nOJE.js +1 -0
  56. package/dist/bundle/flowDiagram-MALGAFMO-D9D_AzXh.js +1 -0
  57. package/dist/bundle/ganttDiagram-23REXITY-COK7rxO4.js +292 -0
  58. package/dist/bundle/gitGraph-VSP46ZUC-DS7S_jKI.js +1 -0
  59. package/dist/bundle/gitGraphDiagram-STJD7YCW-DhVK8Hqh.js +106 -0
  60. package/dist/bundle/graphlib-Bgy7WbC7.js +1 -0
  61. package/dist/bundle/info-OHQRW6UA-BjEWvFlW.js +1 -0
  62. package/dist/bundle/infoDiagram-KBXO4MBG-Dg3zWdHP.js +2 -0
  63. package/dist/bundle/ishikawaDiagram-M35NCXHK-C2g8ghrV.js +70 -0
  64. package/dist/bundle/journeyDiagram-OPLOXDXO-DMZkL-i1.js +139 -0
  65. package/dist/bundle/kanban-definition-BZKZHSQY-Dr43IiJD.js +89 -0
  66. package/dist/bundle/katex-rAoShGnF.js +257 -0
  67. package/dist/bundle/math-Cx-Q-b8s.js +262 -0
  68. package/dist/bundle/mermaid-DaDuEHir.js +43 -0
  69. package/dist/bundle/mermaid-parser.core-Bv_Zx_ZE.js +6 -0
  70. package/dist/bundle/mindmap-definition-I2QAS2VK-BXCWJ_1R.js +98 -0
  71. package/dist/bundle/packet-JDAUHWVQ-CgB2qE5t.js +1 -0
  72. package/dist/bundle/pegDiagram-FD4XPPHP-CR58gOgF.js +1 -0
  73. package/dist/bundle/pie-XZMESJXO-CvXWTfIG.js +1 -0
  74. package/dist/bundle/pieDiagram-J4AKIIQI-D0GhbNJg.js +39 -0
  75. package/dist/bundle/quadrantDiagram-XTYBLID2-BKBEdwvC.js +7 -0
  76. package/dist/bundle/radar-ABXABTNO-8V_xx_AB.js +1 -0
  77. package/dist/bundle/railroad-I3PHUGI6-Bvb0GUva.js +1 -0
  78. package/dist/bundle/railroad-abnf-LNEFI6M7-D8xGcObq.js +1 -0
  79. package/dist/bundle/railroad-ebnf-DWYD2UWJ-Ch8wBawI.js +1 -0
  80. package/dist/bundle/railroad-peg-JR7BVNR7-CGndbjed.js +1 -0
  81. package/dist/bundle/railroadDiagram-MRQ6NCDL-DvqHkO2C.js +1 -0
  82. package/dist/bundle/requirementDiagram-Y7LWUY3S-bCLAM9sl.js +84 -0
  83. package/dist/bundle/rolldown-runtime-BNaE-Ejt.js +1 -0
  84. package/dist/bundle/rough.esm-Dy-Kn_BL.js +1 -0
  85. package/dist/bundle/sankeyDiagram-WGJFYUXA-8ehuPvHQ.js +40 -0
  86. package/dist/bundle/sequenceDiagram-5NDRBG5M-Cdg1YzMw.js +169 -0
  87. package/dist/bundle/sizeCapture-INFHLROL-Ct7XApxm.js +1 -0
  88. package/dist/bundle/stateDiagram-v2-FJ4FJNEA-B69v2YYC.js +291 -0
  89. package/dist/bundle/swimlanes-UMQ2AFYF-C_qI6rnK.js +1 -0
  90. package/dist/bundle/swimlanesDiagram-OMPLPG4O-CS11qSCX.js +8 -0
  91. package/dist/bundle/timeline-definition-SEUHKTQE-BCU0-H8D.js +120 -0
  92. package/dist/bundle/treeView-D4JQ5SDB-CpjURS-c.js +1 -0
  93. package/dist/bundle/treemap-SAJKECNS-CFFTaiIN.js +1 -0
  94. package/dist/bundle/usecaseDiagram-AFA6YXN4-46V1jsea.js +476 -0
  95. package/dist/bundle/vega-eBn1AexV.js +33 -0
  96. package/dist/bundle/vennDiagram-NNMJR3RB-q4Q4x2Q6.js +34 -0
  97. package/dist/bundle/wardley-7MLQ67FV-DhnATL7b.js +1 -0
  98. package/dist/bundle/wardleyDiagram-S7YFUSEH-BHIufnZW.js +78 -0
  99. package/dist/bundle/xychartDiagram-GGNKY7IX-CxAjpN3O.js +7 -0
  100. package/dist/chunks/a2ui-BLaPxJ9N.js +961 -0
  101. package/dist/chunks/a2ui-BLaPxJ9N.js.map +1 -0
  102. package/dist/chunks/math-D5IXRTov.js +86 -0
  103. package/dist/chunks/math-D5IXRTov.js.map +1 -0
  104. package/dist/chunks/mermaid-j9RNkOnL.js +197 -0
  105. package/dist/chunks/mermaid-j9RNkOnL.js.map +1 -0
  106. package/dist/chunks/rich-C2iN_5zh.js +156 -0
  107. package/dist/chunks/rich-C2iN_5zh.js.map +1 -0
  108. package/dist/chunks/sanitize-COLQzplk.js +240 -0
  109. package/dist/chunks/sanitize-COLQzplk.js.map +1 -0
  110. package/dist/chunks/{src-CYXMXds2.js → src-Blgo9nVC.js} +360 -68
  111. package/dist/chunks/src-Blgo9nVC.js.map +1 -0
  112. package/dist/chunks/vega-BkX1Fjq6.js +301 -0
  113. package/dist/chunks/vega-BkX1Fjq6.js.map +1 -0
  114. package/dist/define.js +1 -1
  115. package/dist/index.js +1 -1
  116. package/dist/types/element/i18n.d.ts +21 -2
  117. package/dist/types/element/markdown.d.ts +6 -3
  118. package/dist/types/element/rich/a2ui-format.d.ts +45 -0
  119. package/dist/types/element/rich/a2ui-icons.d.ts +1 -0
  120. package/dist/types/element/rich/a2ui-views.d.ts +37 -0
  121. package/dist/types/element/rich/a2ui.d.ts +2 -0
  122. package/dist/types/element/rich/index.d.ts +66 -0
  123. package/dist/types/element/rich/math.d.ts +4 -0
  124. package/dist/types/element/rich/mermaid.d.ts +2 -0
  125. package/dist/types/element/rich/vega.d.ts +2 -0
  126. package/dist/types/element/sanitize.d.ts +34 -0
  127. package/dist/types/element/styles.d.ts +1 -1
  128. package/package.json +9 -3
  129. package/dist/chunks/src-CYXMXds2.js.map +0 -1
@@ -0,0 +1,113 @@
1
+ import{i as e,t}from"./rolldown-runtime-BNaE-Ejt.js";import{a as n,f as r,i,m as a,n as o,o as s,p as c,r as l,t as u}from"../aicore-agent-chat.js";var d;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(d||={});var f;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(f||={});var p=d.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),m=e=>{switch(typeof e){case`undefined`:return p.undefined;case`string`:return p.string;case`number`:return Number.isNaN(e)?p.nan:p.number;case`boolean`:return p.boolean;case`function`:return p.function;case`bigint`:return p.bigint;case`symbol`:return p.symbol;case`object`:return Array.isArray(e)?p.array:e===null?p.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?p.promise:typeof Map<`u`&&e instanceof Map?p.map:typeof Set<`u`&&e instanceof Set?p.set:typeof Date<`u`&&e instanceof Date?p.date:p.object;default:return p.unknown}},h=d.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`]),g=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};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(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,d.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};g.create=e=>new g(e);var _=(e,t)=>{let n;switch(e.code){case h.invalid_type:n=e.received===p.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,d.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:n=`Unrecognized key(s) in object: ${d.joinValues(e.keys,`, `)}`;break;case h.invalid_union:n=`Invalid input`;break;case h.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${d.joinValues(e.options)}`;break;case h.invalid_enum_value:n=`Invalid enum value. Expected ${d.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:n=`Invalid function arguments`;break;case h.invalid_return_type:n=`Invalid function return type`;break;case h.invalid_date:n=`Invalid date`;break;case h.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:d.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case h.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case h.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case h.custom:n=`Invalid input`;break;case h.invalid_intersection_types:n=`Intersection results could not be merged`;break;case h.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,d.assertNever(e)}return{message:n}},v=_;function y(){return v}var b=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function x(e,t){let n=y(),r=b({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===_?void 0:_].filter(e=>!!e)});e.common.issues.push(r)}var S=class e{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 r of t){if(r.status===`aborted`)return C;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return C;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},C=Object.freeze({status:`aborted`}),w=e=>({status:`dirty`,value:e}),T=e=>({status:`valid`,value:e}),ee=e=>e.status===`aborted`,te=e=>e.status===`dirty`,ne=e=>e.status===`valid`,re=e=>typeof Promise<`u`&&e instanceof Promise,E;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(E||={});var D=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},ie=(e,t)=>{if(ne(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new g(e.common.issues);return this._error=t,this._error}}};function O(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var k=class{get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(re(t))throw 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:m(e)};return ie(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ne(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>ne(e)?{value:e.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:m(e)},r=this._parse({data:e,path:n.path,parent:n});return ie(n,await(re(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:h.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new it({schema:this,typeName:N.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:e=>this[`~validate`](e)}}optional(){return at.create(this,this._def)}nullable(){return ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ve.create(this)}promise(){return rt.create(this,this._def)}or(e){return We.create([this,e],this._def)}and(e){return Ke.create(this,e,this._def)}transform(e){return new it({...O(this._def),schema:this,typeName:N.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new st({...O(this._def),innerType:this,defaultValue:t,typeName:N.ZodDefault})}brand(){return new ut({typeName:N.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new ct({...O(this._def),innerType:this,catchValue:t,typeName:N.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return ft.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ae=/^c[^\s-]{8,}$/i,oe=/^[0-9a-z]+$/,se=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ce=/^[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,le=/^[a-z0-9_-]{21}$/i,ue=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,de=/^[-+]?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)?)??$/,fe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,me,he=/^(?:(?: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])$/,ge=/^(?:(?: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])$/,_e=/^(([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]))$/,ve=/^(([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])$/,ye=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,be=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xe=`((\\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])))`,Se=RegExp(`^${xe}$`);function Ce(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function we(e){return RegExp(`^${Ce(e)}$`)}function Te(e){let t=`${xe}T${Ce(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Ee(e,t){return!((t!==`v4`&&t||!he.test(e))&&(t!==`v6`&&t||!_e.test(e)))}function De(e,t){if(!ue.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Oe(e,t){return!((t!==`v4`&&t||!ge.test(e))&&(t!==`v6`&&t||!ve.test(e)))}var ke=class e extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.string,received:t.parsedType}),C}let t=new S,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?x(n,{code:h.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&x(n,{code:h.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)fe.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`email`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)me||=new RegExp(pe,`u`),me.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`emoji`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)ce.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`uuid`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)le.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`nanoid`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ae.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)oe.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cuid2`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)se.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ulid`,code:h.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),x(n,{validation:`url`,code:h.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`regex`,code:h.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Te(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Se.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?we(r).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?de.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`duration`,code:h.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Ee(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`ip`,code:h.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?De(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`jwt`,code:h.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Oe(e.data,r.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`cidr`,code:h.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?ye.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64`,code:h.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?be.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:`base64url`,code:h.invalid_string,message:r.message}),t.dirty()):d.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...E.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...E.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...E.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...E.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...E.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...E.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...E.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...E.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...E.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...E.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...E.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...E.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:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...E.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:e?.precision===void 0?null:e?.precision,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...E.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...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}};ke.create=e=>new ke({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...O(e)});function Ae(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var je=class e extends k{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)!==p.number){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.number,received:t.parsedType}),C}let t,n=new S;for(let r of this._def.checks)r.kind===`int`?d.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:h.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Ae(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:h.not_finite,message:r.message}),n.dirty()):d.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,E.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,E.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,E.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,E.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:E.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:E.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:E.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:E.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:E.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`&&d.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;else 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)}};je.create=e=>new je({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...O(e)});var Me=class e extends k{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)!==p.bigint)return this._getInvalidInput(e);let t,n=new S;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):d.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.bigint,received:t.parsedType}),C}gte(e,t){return this.setLimit(`min`,e,!0,E.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,E.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,E.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,E.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:E.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:E.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}};Me.create=e=>new Me({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...O(e)});var Ne=class extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.boolean,received:t.parsedType}),C}return T(e.data)}};Ne.create=e=>new Ne({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...O(e)});var Pe=class e extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.date,received:t.parsedType}),C}if(Number.isNaN(e.data.getTime()))return x(this._getOrReturnCtx(e),{code:h.invalid_date}),C;let t=new S,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):d.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:E.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?null:new Date(e)}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?null:new Date(e)}};Pe.create=e=>new Pe({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...O(e)});var Fe=class extends k{_parse(e){if(this._getType(e)!==p.symbol){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.symbol,received:t.parsedType}),C}return T(e.data)}};Fe.create=e=>new Fe({typeName:N.ZodSymbol,...O(e)});var Ie=class extends k{_parse(e){if(this._getType(e)!==p.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.undefined,received:t.parsedType}),C}return T(e.data)}};Ie.create=e=>new Ie({typeName:N.ZodUndefined,...O(e)});var Le=class extends k{_parse(e){if(this._getType(e)!==p.null){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.null,received:t.parsedType}),C}return T(e.data)}};Le.create=e=>new Le({typeName:N.ZodNull,...O(e)});var Re=class extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};Re.create=e=>new Re({typeName:N.ZodAny,...O(e)});var A=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};A.create=e=>new A({typeName:N.ZodUnknown,...O(e)});var ze=class extends k{_parse(e){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.never,received:t.parsedType}),C}};ze.create=e=>new ze({typeName:N.ZodNever,...O(e)});var Be=class extends k{_parse(e){if(this._getType(e)!==p.undefined){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.void,received:t.parsedType}),C}return T(e.data)}};Be.create=e=>new Be({typeName:N.ZodVoid,...O(e)});var Ve=class e extends k{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==p.array)return x(t,{code:h.invalid_type,expected:p.array,received:t.parsedType}),C;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(x(t,{code:e?h.too_big:h.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(x(t,{code:h.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(x(t,{code:h.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new D(t,e,t.path,n)))).then(e=>S.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new D(t,e,t.path,n)));return S.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:E.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:E.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:E.toString(n)}})}nonempty(e){return this.min(1,e)}};Ve.create=(e,t)=>new Ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...O(t)});function He(e){if(e instanceof Ue){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=at.create(He(r))}return new Ue({...e._def,shape:()=>t})}return e instanceof Ve?new Ve({...e._def,type:He(e.element)}):e instanceof at?at.create(He(e.unwrap())):e instanceof ot?ot.create(He(e.unwrap())):e instanceof qe?qe.create(e.items.map(e=>He(e))):e}var Ue=class e extends k{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=d.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.object,received:t.parsedType}),C}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ze&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new D(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ze){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(x(n,{code:h.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new D(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>S.mergeObjectSync(t,e)):S.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return E.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:E.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:N.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of d.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of d.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return He(this)}partial(t){let n={};for(let e of d.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of d.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof at;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return et(d.objectKeys(this.shape))}};Ue.create=(e,t)=>new Ue({shape:()=>e,unknownKeys:`strip`,catchall:ze.create(),typeName:N.ZodObject,...O(t)}),Ue.strictCreate=(e,t)=>new Ue({shape:()=>e,unknownKeys:`strict`,catchall:ze.create(),typeName:N.ZodObject,...O(t)}),Ue.lazycreate=(e,t)=>new Ue({shape:e,unknownKeys:`strip`,catchall:ze.create(),typeName:N.ZodObject,...O(t)});var We=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new g(e.ctx.common.issues));return x(t,{code:h.invalid_union,unionErrors:n}),C}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new g(e));return x(t,{code:h.invalid_union,unionErrors:i}),C}}get options(){return this._def.options}};We.create=(e,t)=>new We({options:e,typeName:N.ZodUnion,...O(t)});var j=e=>e instanceof Qe?j(e.schema):e instanceof it?j(e.innerType()):e instanceof $e?[e.value]:e instanceof tt?e.options:e instanceof nt?d.objectValues(e.enum):e instanceof st?j(e._def.innerType):e instanceof Ie?[void 0]:e instanceof Le?[null]:e instanceof at?[void 0,...j(e.unwrap())]:e instanceof ot?[null,...j(e.unwrap())]:e instanceof ut||e instanceof ft?j(e.unwrap()):e instanceof ct?j(e._def.innerType):[],M=class e extends k{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return x(t,{code:h.invalid_type,expected:p.object,received:t.parsedType}),C;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=/* @__PURE__ */ new Map;for(let e of n){let n=j(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...O(r)})}};function Ge(e,t){let n=m(e),r=m(t);if(e===t)return{valid:!0,data:e};if(n===p.object&&r===p.object){let n=d.objectKeys(t),r=d.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ge(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===p.array&&r===p.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ge(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===p.date&&r===p.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ke=class extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ee(e)||ee(r))return C;let i=Ge(e.value,r.value);return i.valid?((te(e)||te(r))&&t.dirty(),{status:t.value,value:i.data}):(x(n,{code:h.invalid_intersection_types}),C)};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(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ke.create=(e,t,n)=>new Ke({left:e,right:t,typeName:N.ZodIntersection,...O(n)});var qe=class e extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return x(n,{code:h.invalid_type,expected:p.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return x(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),C;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new D(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>S.mergeArray(t,e)):S.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};qe.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new qe({items:e,typeName:N.ZodTuple,rest:null,...O(t)})};var Je=class e extends k{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!==p.object)return x(n,{code:h.invalid_type,expected:p.object,received:n.parsedType}),C;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new D(n,e,n.path,e)),value:a._parse(new D(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?S.mergeObjectAsync(t,r):S.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof k?new e({keyType:t,valueType:n,typeName:N.ZodRecord,...O(r)}):new e({keyType:ke.create(),valueType:t,typeName:N.ZodRecord,...O(n)})}},Ye=class extends k{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!==p.map)return x(n,{code:h.invalid_type,expected:p.map,received:n.parsedType}),C;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new D(n,e,n.path,[a,`key`])),value:i._parse(new D(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=/* @__PURE__ */ new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=/* @__PURE__ */ new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return C;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Ye.create=(e,t,n)=>new Ye({valueType:t,keyType:e,typeName:N.ZodMap,...O(n)});var Xe=class e extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return x(n,{code:h.invalid_type,expected:p.set,received:n.parsedType}),C;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(x(n,{code:h.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(x(n,{code:h.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=/* @__PURE__ */ new Set;for(let r of e){if(r.status===`aborted`)return C;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new D(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:E.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:E.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Xe.create=(e,t)=>new Xe({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...O(t)});var Ze=class e extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return x(t,{code:h.invalid_type,expected:p.function,received:t.parsedType}),C;function n(e,n){return b({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,y(),_].filter(e=>!!e),issueData:{code:h.invalid_arguments,argumentsError:n}})}function r(e,n){return b({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,y(),_].filter(e=>!!e),issueData:{code:h.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof rt){let e=this;return T(async function(...t){let o=new g([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return T(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new g([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new g([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:qe.create(t).rest(A.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||qe.create([]).rest(A.create()),returns:n||A.create(),typeName:N.ZodFunction,...O(r)})}},Qe=class extends k{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})}};Qe.create=(e,t)=>new Qe({getter:e,typeName:N.ZodLazy,...O(t)});var $e=class extends k{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),C}return{status:`valid`,value:e.data}}get value(){return this._def.value}};$e.create=(e,t)=>new $e({value:e,typeName:N.ZodLiteral,...O(t)});function et(e,t){return new tt({values:e,typeName:N.ZodEnum,...O(t)})}var tt=class e extends k{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{expected:d.joinValues(n),received:t.parsedType,code:h.invalid_type}),C}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{received:t.data,code:h.invalid_enum_value,options:n}),C}return T(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(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};tt.create=et;var nt=class extends k{_parse(e){let t=d.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){let e=d.objectValues(t);return x(n,{expected:d.joinValues(e),received:n.parsedType,code:h.invalid_type}),C}if(this._cache||=new Set(d.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=d.objectValues(t);return x(n,{received:n.data,code:h.invalid_enum_value,options:e}),C}return T(e.data)}get enum(){return this._def.values}};nt.create=(e,t)=>new nt({values:e,typeName:N.ZodNativeEnum,...O(t)});var rt=class extends k{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==p.promise&&t.common.async===!1?(x(t,{code:h.invalid_type,expected:p.promise,received:t.parsedType}),C):T((t.parsedType===p.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};rt.create=(e,t)=>new rt({type:e,typeName:N.ZodPromise,...O(t)});var it=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{x(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return C;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?w(r.value):r});{if(t.value===`aborted`)return C;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?C:r.status===`dirty`||t.value===`dirty`?w(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?C:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?C:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ne(e))return C;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>ne(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):C)}d.assertNever(r)}};it.create=(e,t,n)=>new it({schema:e,typeName:N.ZodEffects,effect:t,...O(n)}),it.createWithPreprocess=(e,t,n)=>new it({schema:t,effect:{type:`preprocess`,transform:e},typeName:N.ZodEffects,...O(n)});var at=class extends k{_parse(e){return this._getType(e)===p.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};at.create=(e,t)=>new at({innerType:e,typeName:N.ZodOptional,...O(t)});var ot=class extends k{_parse(e){return this._getType(e)===p.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ot.create=(e,t)=>new ot({innerType:e,typeName:N.ZodNullable,...O(t)});var st=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};st.create=(e,t)=>new st({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...O(t)});var ct=class extends k{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return re(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new g(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new g(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ct.create=(e,t)=>new ct({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...O(t)});var lt=class extends k{_parse(e){if(this._getType(e)!==p.nan){let t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.nan,received:t.parsedType}),C}return{status:`valid`,value:e.data}}};lt.create=e=>new lt({typeName:N.ZodNaN,...O(e)});var ut=class extends k{_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}},dt=class e extends k{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),w(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?C:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:N.ZodPipeline})}},ft=class extends k{_parse(e){let t=this._def.innerType._parse(e),n=e=>(ne(e)&&(e.value=Object.freeze(e.value)),e);return re(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};ft.create=(e,t)=>new ft({innerType:e,typeName:N.ZodReadonly,...O(t)}),Ue.lazycreate;var N;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(N||={});var P=ke.create,F=je.create;lt.create,Me.create;var pt=Ne.create;Pe.create,Fe.create,Ie.create,Le.create;var mt=Re.create,ht=A.create;ze.create,Be.create;var I=Ve.create,L=Ue.create;Ue.strictCreate;var R=We.create;M.create;var gt=Ke.create;qe.create;var _t=Je.create;Ye.create,Xe.create,Ze.create;var vt=Qe.create,yt=$e.create,z=tt.create;nt.create,rt.create,it.create,at.create,ot.create;var bt=it.createWithPreprocess;dt.create;var xt={string:(e=>ke.create({...e,coerce:!0})),number:(e=>je.create({...e,coerce:!0})),boolean:(e=>Ne.create({...e,coerce:!0})),bigint:(e=>Me.create({...e,coerce:!0})),date:(e=>Pe.create({...e,coerce:!0}))},St=class extends Error{constructor(e,t=`UNKNOWN_ERROR`,n){super(e),this.name=this.constructor.name,this.code=t,n?.path!==void 0&&(this.path=n.path),n?.surfaceId!==void 0&&(this.surfaceId=n.surfaceId),n?.functionCallId!==void 0&&(this.functionCallId=n.functionCallId),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},B=class extends St{constructor(e,t,n=`VALIDATION_ERROR`,r){super(e,n,r),this.details=t}},Ct=class extends St{constructor(e,t,n){super(e,`DATA_ERROR`,{path:t,surfaceId:n})}},V=class extends St{constructor(e,t,n,r){super(e,`EXPRESSION_ERROR`,r),this.expression=t,this.details=n}},wt=class extends St{constructor(e,t){super(e,`STATE_ERROR`,t)}},Tt=class extends St{constructor(e,t=`CATALOG_ERROR`,n){super(e,t,n)}},Et=class extends B{constructor(e,t,n=`INTEGRITY_ERROR`,r){super(e,t,n,r),this.name=`A2uiIntegrityError`}},Dt=class extends B{constructor(e,t,n=`RECURSION_ERROR`,r){super(e,t,n,r),this.name=`A2uiRecursionError`}},Ot;(function(e){e.INVALID_FUNCTION_CALL=`INVALID_FUNCTION_CALL`,e.EXECUTION_ERROR=`EXECUTION_ERROR`,e.UNKNOWN_FUNCTION=`UNKNOWN_FUNCTION`,e.UNKNOWN_ERROR=`UNKNOWN_ERROR`,e.TIMEOUT=`TIMEOUT`,e.CANCELLED=`CANCELLED`,e.DISPOSED=`DISPOSED`,e.DUPLICATE=`DUPLICATE`,e.NO_LISTENER=`NO_LISTENER`})(Ot||={});var kt=class extends St{constructor(e,t=Ot.UNKNOWN_ERROR,n,r){let i=t||Ot.UNKNOWN_ERROR;super(`[${i}] ${e}`,i),this.functionCallId=n,this.details=r,this.name=`A2uiRpcError`}},At=/^[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 jt(e){if(!e||typeof e!=`string`)return``;let t=e.trim().replace(/^[vV]/,``),n=t.indexOf(`-`),r=t.indexOf(`+`),i=t.length;return n!==-1&&r!==-1?i=Math.min(n,r):n===-1?r!==-1&&(i=r):i=n,`${t.slice(0,i).replace(/_/g,`.`)}${t.slice(i)}`}function Mt(e){if(!e||typeof e!=`string`)return null;let t=e.trim().match(At);return t?{major:parseInt(t[1],10),minor:parseInt(t[2],10),patch:t[3]===void 0?0:parseInt(t[3],10),prerelease:t[4]?t[4].split(`.`):[],build:t[5]?t[5].split(`.`):[]}:null}function Nt(e){if(!e)return null;if(typeof e==`object`){let t=e;return typeof t.major!=`number`||!Number.isInteger(t.major)||t.major<0||typeof t.minor==`number`&&(!Number.isInteger(t.minor)||t.minor<0)||typeof t.patch==`number`&&(!Number.isInteger(t.patch)||t.patch<0)?null:{major:t.major,minor:typeof t.minor==`number`?t.minor:0,patch:typeof t.patch==`number`?t.patch:0,prerelease:Array.isArray(t.prerelease)?t.prerelease:[],build:Array.isArray(t.build)?t.build:[]}}return Mt(jt(e))}function Pt(e){if(!e)return null;let t=Nt(e);if(!t)return null;if(t.patch===0&&t.prerelease.length===0&&t.build.length===0)return`${t.major}.${t.minor}`;let n=t.prerelease.length>0?`-${t.prerelease.join(`.`)}`:``,r=t.build.length>0?`+${t.build.join(`.`)}`:``;return`${t.major}.${t.minor}.${t.patch}${n}${r}`}function Ft(e,t){let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?e.length===t.length?e<t?-1:+(e>t):e.length-t.length:n?-1:r?1:e<t?-1:+(e>t)}function It(e,t){if(e.length===0&&t.length===0)return 0;if(e.length===0)return 1;if(t.length===0)return-1;let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=Ft(e[r],t[r]);if(n!==0)return n}return e.length-t.length}function Lt(e,t){let n=Nt(e),r=Nt(t);return!n&&!r?0:n?r?n.major===r.major?n.minor===r.minor?n.patch===r.patch?It(n.prerelease,r.prerelease):n.patch-r.patch:n.minor-r.minor:n.major-r.major:1:-1}function H(e,t){if(!e)return!1;let n=Nt(e),r=Nt(t);return!n||!r?!1:Lt(n,r)>=0}function Rt(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function zt(e){if(Array.isArray(e)||typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Bt(e){if(Rt(e))return Promise.resolve(e).then(Bt);if(Array.isArray(e)){let t=e.map(Bt);return t.some(Rt)?Promise.all(t):e}if(zt(e)){let t=Object.entries(e).map(([e,t])=>[e,Bt(t)]);return t.some(([,e])=>Rt(e))?Promise.all(t.map(([,e])=>e)).then(e=>Object.fromEntries(t.map(([t],n)=>[t,e[n]]))):e}return e}var Vt;(function(e){e.V0_8=`v0.8`,e.V0_9=`v0.9`,e.V0_9_1=`v0.9.1`,e.V1_0=`1.0`})(Vt||={});var Ht=/* @__PURE__ */ RegExp(`^[\\p{XID_Start}_][\\p{XID_Continue}]*$`,`u`);function Ut(e,t=!1){if(!e)return!1;let n=t&&e.startsWith(`@`)?e.slice(1):e;return Ht.test(n)}function Wt(e,t,n=!1){if(!Ut(e,n))throw new Tt(`Invalid UAX #31 ${t}`)}function Gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kt(e){if(!Gt(e))throw new B(`Invalid metadata.extensions: expected a plain object.`);for(let t of Object.keys(e))if(!Ut(t))throw new B(`Invalid UAX #31 extension identifier: "${t}". Keys MUST be Unicode identifiers (UAX #31).`)}function qt(e){if(e!==void 0){if(!Gt(e))throw new B(`Invalid metadata: expected a plain object.`);for(let t of Object.keys(e))if(t!==`extensions`)throw new B(`Unexpected property "${t}" in metadata; only "extensions" is allowed.`);`extensions`in e&&e.extensions!==void 0&&Kt(e.extensions)}}function Jt(e){if(Array.isArray(e)){let t=e.map(e=>Jt(e));return Object.freeze(t)}if(Gt(e)){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&Object.defineProperty(t,n,{value:Jt(r),enumerable:!0,configurable:!0,writable:!0});return Object.freeze(t)}return e}function Yt(e,t){if(qt(e),qt(t),e===void 0&&t===void 0)return;if(e===void 0)return Xt(t);if(t===void 0)return Xt(e);let n={};if(Gt(e.extensions))for(let[t,r]of Object.entries(e.extensions))Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0});if(Gt(t.extensions))for(let[e,r]of Object.entries(t.extensions))Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0});return Xt(Object.keys(n).length>0?{extensions:n}:{})}function Xt(e){if(e!==void 0&&(qt(e),e.extensions&&Object.keys(e.extensions).length!==0))return Jt(e)}function Zt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!$t(e[n],t[n]))return!1;return!0}function Qt(e,t){let n=Object.keys(e).filter(t=>e[t]!==void 0),r=Object.keys(t).filter(e=>t[e]!==void 0);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!$t(e[r],t[r]))return!1;return!0}function $t(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?Zt(e,t):Gt(e)&&Gt(t)?Qt(e,t):!1}function en(e,t){return $t(e,t)}function tn(e,t){return e._def.a2uiChildRef=t,e}function nn(e){return e?._def?.a2uiChildRef}var rn=tn(P().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`),an=L({path:P().describe(`A JSON Pointer path to a value in the data model.`).optional(),"@path":P().describe(`A JSON Pointer path to a value in the data model.`).optional()}).refine(e=>e[`@path`]!==void 0||e.path!==void 0,{message:`Either '@path' or 'path' must be provided.`}).describe(`REF:common_types.json#/$defs/DataBinding`),on=L({call:P().describe(`The name of the function to call.`).optional(),"@call":P().describe(`The name of the function to call.`).optional(),args:_t(P(),ht()).describe(`Arguments passed to the function.`).optional(),returnType:z([`string`,`number`,`boolean`,`array`,`object`,`any`,`void`]).describe(`The expected return type of the function call.`).optional(),catalogId:P().describe(`The catalog ID for this function, overriding any surface-level default catalogId.`).optional()}).strict().refine(e=>e[`@call`]!==void 0||e.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.`),sn=R([P(),an,on]).describe(`REF:common_types.json#/$defs/DynamicString|Represents a string`),cn=R([pt(),an,on]).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).`),ln=L({label:sn.optional(),description:sn.optional(),live:z([`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:cn.optional()}).describe(`REF:common_types.json#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.`),un=_t(P(),ht()).superRefine((e,t)=>{for(let n in e)Ut(n)||t.addIssue({path:[n],code:h.custom,message:`Invalid extension key "${n}": 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.`),dn=L({id:rn,accessibility:ln.optional(),catalogId:P().describe(`The catalog ID for this component, overriding any surface-level default catalogId.`).optional(),metadata:L({extensions:un.optional()}).strict().describe(`Optional component-level metadata for vendor extensions.`).optional()}).describe(`REF:common_types.json#/$defs/ComponentCommon`),fn=tn(R([I(rn).describe(`A static list of child component IDs.`),L({componentId:rn,path:P().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`),pn=R([P(),F(),pt(),I(ht()),an,on,_t(P(),ht()).refine(e=>!e||!(`@path`in e)&&!(`path`in e)&&!(`@call`in e)&&!(`call`in e))]).describe(`REF:common_types.json#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.`),mn=R([F(),an,on]).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.`),hn=R([I(P()),an,on]).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.`),gn=L({condition:R([cn,an,on]).describe(`Path or function call evaluating to a structured validation result object or a boolean.`),message:P().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).`),_n=L({checks:I(gn).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.`),vn=R([L({event:L({name:P().describe(`The name of the action to be dispatched to the server.`),context:_t(P(),ht()).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.`),L({functionCall:on}).strict().describe(`Executes a local client-side function.`),L({event:L({name:P().describe(`The name of the action to be dispatched to the agent.`),userMessage:sn.optional(),context:_t(P(),ht()).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.`),L({functionCall:on}).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.`),yn=P().describe(`REF:common_types.json#/$defs/CallId|The unique identifier for a function call.`),bn={ComponentId:rn,DataBinding:an,FunctionCall:on,DynamicString:sn,DynamicBoolean:cn,AccessibilityAttributes:ln,Extensions:un,ComponentCommon:dn,ChildList:fn,DynamicValue:pn,DynamicNumber:mn,DynamicStringList:hn,CheckRule:gn,Checkable:_n,Action:vn,CallId:yn,Child:rn,FunctionCommon:L({call:P().describe(`The name of the function to call.`).optional(),"@call":P().describe(`The name of the function to call.`).optional(),catalogId:P().describe(`The catalog ID for this function, overriding any surface-level default catalogId.`).optional()}).refine(e=>e[`@call`]!==void 0||e.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.`),IndexSystemFunction:L({call:yt(`@index`).optional(),"@call":yt(`@index`).optional(),args:L({offset:mn.optional()}).optional()}).refine(e=>e[`@call`]!==void 0||e.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.`),Surface:L({component:yt(`Surface`).optional(),child:yt(`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\\'.`),FunctionResponse:L({functionCallId:yn,value:ht().describe(`The return value of the function.`).optional(),error:L({code:P(),message:P()}).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.`)},xn=Symbol(`Let zodToJsonSchema decide on which parser to use`),Sn={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`},Cn=e=>typeof e==`string`?{...Sn,name:e}:{...Sn,...e},wn=e=>{let t=Cn(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Tn(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function U(e,t,n,r,i){e[t]=n,Tn(e,t,r,i)}var En=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function Dn(e){if(e.target!==`openAi`)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy===`relative`?En(t,e.currentPath):t.join(`/`)}}function On(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==N.ZodAny&&(n.items=W(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&U(n,`minItems`,e.minLength.value,e.minLength.message,t),e.maxLength&&U(n,`maxItems`,e.maxLength.value,e.maxLength.message,t),e.exactLength&&(U(n,`minItems`,e.exactLength.value,e.exactLength.message,t),U(n,`maxItems`,e.exactLength.value,e.exactLength.message,t)),n}function kn(e,t){let n={type:`integer`,format:`int64`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`min`:t.target===`jsonSchema7`?r.inclusive?U(n,`minimum`,r.value,r.message,t):U(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),U(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?U(n,`maximum`,r.value,r.message,t):U(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),U(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:U(n,`multipleOf`,r.value,r.message,t)}return n}function An(){return{type:`boolean`}}function jn(e,t){return W(e.type._def,t)}var Mn=(e,t)=>W(e.innerType._def,t);function Nn(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>Nn(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return Pn(e,t)}}var Pn=(e,t)=>{let n={type:`integer`,format:`unix-time`};if(t.target===`openApi3`)return n;for(let r of e.checks)switch(r.kind){case`min`:U(n,`minimum`,r.value,r.message,t);break;case`max`:U(n,`maximum`,r.value,r.message,t)}return n};function Fn(e,t){return{...W(e.innerType._def,t),default:e.defaultValue()}}function In(e,t){return t.effectStrategy===`input`?W(e.schema._def,t):Dn(t)}function Ln(e){return{type:`string`,enum:Array.from(e.values)}}var Rn=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function zn(e,t){let n=[W(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),W(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=t.target===`jsonSchema2019-09`?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(e=>{if(Rn(e))i.push(...e.allOf),e.unevaluatedProperties===void 0&&(r=void 0);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}}),i.length?{allOf:i,...r}:void 0}function Bn(e,t){let n=typeof e.value;return n!==`bigint`&&n!==`number`&&n!==`boolean`&&n!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:t.target===`openApi3`?{type:n===`bigint`?`integer`:n,enum:[e.value]}:{type:n===`bigint`?`integer`:n,const:e.value}}var Vn=void 0,Hn={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:()=>(Vn===void 0&&(Vn=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),Vn),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 Un(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:U(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t);break;case`max`:U(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`email`:switch(t.emailStrategy){case`format:email`:qn(n,`email`,r.message,t);break;case`format:idn-email`:qn(n,`idn-email`,r.message,t);break;case`pattern:zod`:Jn(n,Hn.email,r.message,t)}break;case`url`:qn(n,`uri`,r.message,t);break;case`uuid`:qn(n,`uuid`,r.message,t);break;case`regex`:Jn(n,r.regex,r.message,t);break;case`cuid`:Jn(n,Hn.cuid,r.message,t);break;case`cuid2`:Jn(n,Hn.cuid2,r.message,t);break;case`startsWith`:Jn(n,RegExp(`^${Wn(r.value,t)}`),r.message,t);break;case`endsWith`:Jn(n,RegExp(`${Wn(r.value,t)}$`),r.message,t);break;case`datetime`:qn(n,`date-time`,r.message,t);break;case`date`:qn(n,`date`,r.message,t);break;case`time`:qn(n,`time`,r.message,t);break;case`duration`:qn(n,`duration`,r.message,t);break;case`length`:U(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t),U(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`includes`:Jn(n,RegExp(Wn(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&qn(n,`ipv4`,r.message,t),r.version!==`v4`&&qn(n,`ipv6`,r.message,t);break;case`base64url`:Jn(n,Hn.base64url,r.message,t);break;case`jwt`:Jn(n,Hn.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&Jn(n,Hn.ipv4Cidr,r.message,t),r.version!==`v4`&&Jn(n,Hn.ipv6Cidr,r.message,t);break;case`emoji`:Jn(n,Hn.emoji(),r.message,t);break;case`ulid`:Jn(n,Hn.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:qn(n,`binary`,r.message,t);break;case`contentEncoding:base64`:U(n,`contentEncoding`,`base64`,r.message,t);break;case`pattern:zod`:Jn(n,Hn.base64,r.message,t)}break;case`nanoid`:Jn(n,Hn.nanoid,r.message,t)}return n}function Wn(e,t){return t.patternStrategy===`escape`?Kn(e):e}var Gn=/* @__PURE__ */ new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function Kn(e){let t=``;for(let n=0;n<e.length;n++)Gn.has(e[n])||(t+=`\\`),t+=e[n];return t}function qn(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):U(e,`format`,t,n,r)}function Jn(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:Yn(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):U(e,`pattern`,Yn(t,r),n,r)}function Yn(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++)if(a)i+=r[e],a=!1;else{if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
2
+ ]))`;continue}if(r[e]===`$`){i+=`($|(?=[\r
3
+ ]))`;continue}}n.s&&r[e]===`.`?i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`:(i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0))}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function Xn(e,t){if(t.target===`openAi`&&console.warn(`Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.`),t.target===`openApi3`&&e.keyType?._def.typeName===N.ZodEnum)return{type:`object`,required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:W(e.valueType._def,{...t,currentPath:[...t.currentPath,`properties`,r]})??Dn(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:`object`,additionalProperties:W(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(t.target===`openApi3`)return n;if(e.keyType?._def.typeName===N.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=Un(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===N.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===N.ZodBranded&&e.keyType._def.type._def.typeName===N.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=jn(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Zn(e,t){return t.mapStrategy===`record`?Xn(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[W(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||Dn(t),W(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||Dn(t)],minItems:2,maxItems:2}}}function Qn(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function $n(e){return e.target===`openAi`?void 0:{not:Dn({...e,currentPath:[...e.currentPath,`not`]})}}function er(e){return e.target===`openApi3`?{enum:[`null`],nullable:!0}:{type:`null`}}var tr={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function nr(e,t){if(t.target===`openApi3`)return rr(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in tr&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=tr[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return rr(e,t)}var rr=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>W(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function ir(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target===`openApi3`?{type:tr[e.innerType._def.typeName],nullable:!0}:{type:[tr[e.innerType._def.typeName],`null`]};if(t.target===`openApi3`){let n=W(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&`$ref`in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let n=W(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function ar(e,t){let n={type:`number`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`int`:n.type=`integer`,Tn(n,`type`,r.message,t);break;case`min`:t.target===`jsonSchema7`?r.inclusive?U(n,`minimum`,r.value,r.message,t):U(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),U(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?U(n,`maximum`,r.value,r.message,t):U(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),U(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:U(n,`multipleOf`,r.value,r.message,t)}return n}function or(e,t){let n=t.target===`openAi`,r={type:`object`,properties:{}},i=[],a=e.shape();for(let e in a){let o=a[e];if(o===void 0||o._def===void 0)continue;let s=cr(o);s&&n&&(o._def.typeName===`ZodOptional`&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let c=W(o._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});c!==void 0&&(r.properties[e]=c,s||i.push(e))}i.length&&(r.required=i);let o=sr(e,t);return o!==void 0&&(r.additionalProperties=o),r}function sr(e,t){if(e.catchall._def.typeName!==`ZodNever`)return W(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function cr(e){try{return e.isOptional()}catch{return!0}}var lr=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return W(e.innerType._def,t);let n=W(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:Dn(t)},n]}:Dn(t)},ur=(e,t)=>{if(t.pipeStrategy===`input`)return W(e.in._def,t);if(t.pipeStrategy===`output`)return W(e.out._def,t);let n=W(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,W(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function dr(e,t){return W(e.type._def,t)}function fr(e,t){let n={type:`array`,uniqueItems:!0,items:W(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&U(n,`minItems`,e.minSize.value,e.minSize.message,t),e.maxSize&&U(n,`maxItems`,e.maxSize.value,e.maxSize.message,t),n}function pr(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>W(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:W(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>W(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function mr(e){return{not:Dn(e)}}function hr(e){return Dn(e)}var gr=(e,t)=>W(e.innerType._def,t),_r=(e,t,n)=>{switch(t){case N.ZodString:return Un(e,n);case N.ZodNumber:return ar(e,n);case N.ZodObject:return or(e,n);case N.ZodBigInt:return kn(e,n);case N.ZodBoolean:return An();case N.ZodDate:return Nn(e,n);case N.ZodUndefined:return mr(n);case N.ZodNull:return er(n);case N.ZodArray:return On(e,n);case N.ZodUnion:case N.ZodDiscriminatedUnion:return nr(e,n);case N.ZodIntersection:return zn(e,n);case N.ZodTuple:return pr(e,n);case N.ZodRecord:return Xn(e,n);case N.ZodLiteral:return Bn(e,n);case N.ZodEnum:return Ln(e);case N.ZodNativeEnum:return Qn(e);case N.ZodNullable:return ir(e,n);case N.ZodOptional:return lr(e,n);case N.ZodMap:return Zn(e,n);case N.ZodSet:return fr(e,n);case N.ZodLazy:return()=>e.getter()._def;case N.ZodPromise:return dr(e,n);case N.ZodNaN:case N.ZodNever:return $n(n);case N.ZodEffects:return In(e,n);case N.ZodAny:return Dn(n);case N.ZodUnknown:return hr(n);case N.ZodDefault:return Fn(e,n);case N.ZodBranded:return jn(e,n);case N.ZodReadonly:return gr(e,n);case N.ZodCatch:return Mn(e,n);case N.ZodPipeline:return ur(e,n);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return(e=>void 0)(t)}};function W(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==xn)return i}if(r&&!n){let e=vr(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=_r(e,e.typeName,t),o=typeof a==`function`?W(a(),t):a;if(o&&yr(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var vr=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:En(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),Dn(t)):t.$refStrategy===`seen`?Dn(t):void 0}},yr=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),br=(e,t)=>{let n=wn(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:W(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??Dn(n)}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=W(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??Dn(n),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o),n.flags.hasReferencedOpenAiAnyType&&(r||={},r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:[`string`,`number`,`integer`,`boolean`,`array`,`null`],items:{$ref:n.$refStrategy===`relative`?`1`:[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join(`/`)}}));let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return n.target===`jsonSchema7`?s.$schema=`http://json-schema.org/draft-07/schema#`:(n.target===`jsonSchema2019-09`||n.target===`openAi`)&&(s.$schema=`https://json-schema.org/draft/2019-09/schema#`),n.target===`openAi`&&(`anyOf`in s||`oneOf`in s||`allOf`in s||`type`in s&&Array.isArray(s.type))&&console.warn(`Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.`),s},xr=/* @__PURE__ */ new WeakSet;function Sr(e){let t=mt().superRefine((t,n)=>{let r=0;for(let i of e)if(i.safeParse(t).success&&++r>1){n.addIssue({code:h.custom,message:`Value matched more than one schema in oneOf`});return}});return xr.add(t._def),t.pipe(R(e))}var Cr=(e,t)=>{let n=e;if(!n.in||!n.out||!xr.has(n.in._def))return xn;let r=n.out._def.options.map((e,n)=>W(e._def,{...t,currentPath:[...t.currentPath,`oneOf`,`${n}`]})).filter(e=>e!==void 0);return e.description===void 0?{oneOf:r}:{oneOf:r,description:e.description}},wr=/* @__PURE__ */ new WeakMap;function Tr(e){return wr.get(e)}function Er(e,t){for(let[n,r]of Object.entries(t)){let t=!1,i;Object.defineProperty(e,n,{enumerable:!0,get(){return t||=(i=r(),!0),i}})}}function Dr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Or(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):void 0}var kr=class{constructor(e,t,n){this.name=e,wr.set(this,t),Er(this,{schema:()=>n(t),allowedParents:()=>Or(t.allowedParents),allowedChildren:()=>Or(t.allowedChildren),metadata:()=>Dr(t.metadata)?t.metadata:void 0}),Object.freeze(this)}get jsonSchema(){return wr.get(this)}},Ar=class{constructor(e,t,n){this.name=e,wr.set(this,t);let r=Dr(t.properties)?t.properties:void 0,i=e=>{let t=r?.[e];return Dr(t)?t.const:void 0};Er(this,{schema:()=>n(t),returnType:()=>{let e=t.returnType??i(`returnType`);return typeof e==`string`?e:`any`},description:()=>typeof t.description==`string`?t.description:void 0,allowedCallers:()=>t.allowedCallers??i(`allowedCallers`),requiresUserActivation:()=>t.requiresUserActivation??i(`requiresUserActivation`)}),Object.freeze(this)}get jsonSchema(){return wr.get(this)}},jr=/* @__PURE__ */ new WeakMap;function Mr(e,t,n=e.description){let r=k.prototype.describe.call(e,n);return jr.set(r,t),r.describe=e=>Mr(r,jr.get(r)??t,e),r}function G(e,t){let n=k.prototype.describe.call(e,e.description);return jr.set(n,{...jr.get(e),...t}),n}function Nr(e,t,n={}){let r=Mr(t,{...jr.get(t),...n,defName:e});return jr.set(r,{...jr.get(r),defName:e,defModel:r}),r}function Pr(e){return typeof e==`object`&&e?jr.get(e):void 0}var Fr={childRefNames:/* @__PURE__ */ new Set([`ComponentId`,`Child`,`ChildComponentId`]),childListRefNames:/* @__PURE__ */ new Set([`ChildList`,`TemplateChildList`]),childPropertyNames:/* @__PURE__ */ new Set([`child`,`entryPointChild`,`contentChild`])},Ir={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:/* @__PURE__ */ `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`.split(`.`),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`}},Lr={childRefNames:/* @__PURE__ */ new Set([`ComponentId`,`Child`,`ChildComponentId`]),childListRefNames:/* @__PURE__ */ new Set([`ChildList`,`TemplateChildList`,`ChildrenItem`,`TemplateItem`])},Rr={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}]}},zr={childRefNames:/* @__PURE__ */ new Set([`ComponentId`,`Child`,`ChildComponentId`]),childListRefNames:/* @__PURE__ */ new Set([`ChildList`,`TemplateChildList`,`ChildrenItem`,`TemplateItem`])},Br={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}},Vr=`common_types.json`,Hr={"0.8":Ir,"0.9":Rr,"0.9.1":Rr,"1.0":Br};function Ur(e){if(e){let t=Pt(e)??jt(e);if(t in Hr)return Hr[t];if(H(e,`1.0`))return Br}return Rr}function Wr(e){return JSON.parse(JSON.stringify(e))}function Gr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Kr=8;function qr(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function Jr(e,t,n){let r=e;for(let e=0;Gr(r)&&typeof r.$ref==`string`;e++){if(e+n>Kr)return;r=t(r.$ref)}return Gr(r)?r:void 0}function Yr(e){let t=e.type;if(typeof t==`string`||Array.isArray(t))return new Set([].concat(t).map(e=>e===`integer`?`number`:String(e)));if(Object.hasOwn(e,`const`))return/* @__PURE__ */ new Set([qr(e.const)]);if(Array.isArray(e.enum))return new Set(e.enum.map(qr))}function Xr(e){let t;if(Object.hasOwn(e,`const`))t=[e.const];else if(Array.isArray(e.enum))t=e.enum;else return;if(!t.some(e=>typeof e==`object`&&!!e))return t.map(e=>JSON.stringify(e))}function Zr(e,t,n){let r=/* @__PURE__ */ new Set;if(Array.isArray(e.required))for(let t of e.required)r.add(String(t));if(n<Kr&&Array.isArray(e.allOf))for(let i of e.allOf){let e=Jr(i,t,n+1);if(e)for(let i of Zr(e,t,n+1))r.add(i)}return r}function Qr(e){if(e.additionalProperties!==!1||Object.hasOwn(e,`patternProperties`))return;let t=e.properties;return new Set(Gr(t)?Object.keys(t):[])}function $r(e,t){let n=e.properties;return Gr(n)?n[t]:void 0}function ei(e,t,n,r=0){if(r>Kr)return!1;let i=Jr(e,n,r),a=Jr(t,n,r);if(!i||!a)return!1;let o=Yr(i),s=Yr(a);if(o&&s&&![...o].some(e=>s.has(e)))return!0;let c=Xr(i),l=Xr(a);if(c&&l&&!c.some(e=>l.includes(e)))return!0;let u=e=>e!==void 0&&e.size===1&&e.has(`object`);if(!u(o)||!u(s))return!1;let d=Zr(i,n,r),f=Zr(a,n,r),p=Qr(i),m=Qr(a);return p&&[...f].some(e=>!p.has(e))||m&&[...d].some(e=>!m.has(e))?!0:[...d].some(e=>f.has(e)&&ei($r(i,e),$r(a,e),n,r+1))}function ti(e){return e._def}var ni=/* @__PURE__ */ new Set([`id`,`component`]);function ri(e){return oi(e).mixins!==void 0}function ii(e){return Object.keys(oi(e)).length>0}function ai(e,t,n=/* @__PURE__ */ new Set){if(!Gr(e)||e.default!==void 0)return!1;if(Array.isArray(e.required)&&e.required.length>0||typeof e.minProperties==`number`&&e.minProperties>0)return!0;let r=e.$ref;if(typeof r==`string`&&t&&r.startsWith(`#/$defs/`)&&!n.has(r)){let e=t;for(let t of r.slice(8).split(`/`)){let n=t.replace(/~1/g,`/`).replace(/~0/g,`~`);e=Gr(e)&&Object.hasOwn(e,n)?e[n]:void 0}if(e!==void 0&&ai(e,t,new Set(n).add(r)))return!0}return!!(Array.isArray(e.allOf)&&e.allOf.some(e=>ai(e,t,n))||Array.isArray(e.oneOf)&&e.oneOf.length>0&&e.oneOf.every(e=>ai(e,t,n))||Array.isArray(e.anyOf)&&e.anyOf.length>0&&e.anyOf.every(e=>ai(e,t,n)))}function oi(e,t){let n=[],r=t?Pr(t):void 0,i=e;for(;i&&typeof i==`object`&&`_def`in i;){let e=Pr(i);if(t!==void 0&&(i===t||e&&e===r))break;e&&n.push(e);let a=si(i);if(!a)break;i=a}return n.reduceRight((e,t)=>({...e,...t}),{})}function si(e){let t=ti(e);switch(t.typeName){case`ZodOptional`:case`ZodDefault`:case`ZodCatch`:case`ZodReadonly`:return t.innerType;case`ZodEffects`:return t.schema;case`ZodBranded`:return t.type;default:return}}var ci=class{constructor(e,t=Vr){this.commonTypesUri=t,this.standardDefsInCatalog=/* @__PURE__ */ new Map,this.isV08=!H(e,`0.9`),this.isV10=H(e,`1.0`),this.standardDefs=Ur(e)}componentSchema(e,t,n,r){let i=/* @__PURE__ */ new Map,a;if(this.isV08){a=this.toJson(t,i);let e=a.properties;if(Gr(e))for(let t of ni)delete e[t];if(Array.isArray(a.required)){let e=a.required.filter(e=>!ni.has(e));e.length>0?a.required=e:delete a.required}}else{let n=oi(t),r=n.mixins??[],o=new Set(ni),s=[];for(let e of r){s.push({$ref:this.mixinRef(e,i)});for(let t of this.mixinProperties(e))o.add(t)}let c=li(t),l=di(t),u=this.objectSchema(c,n,e=>!o.has(e),i),d={component:{const:e},...u.properties},f=[`component`,...u.required??[]],p={type:`object`};l!==void 0&&!this.isV10&&(p.description=l),p.properties=d,p.required=f,a={type:`object`},this.isV10?(l!==void 0&&(a.description=l),s.length>0?a.allOf=[...s,p]:(a.properties=d,a.required=f)):(a.allOf=[...s,p],a.unevaluatedProperties=!1)}return n&&n.length>0&&(a.allowedParents=[...n]),r&&r.length>0&&(a.allowedChildren=[...r]),{schema:a,catalogDefs:i}}functionSchema(e,t,n,r){let i=this.toJson(t.schema,r),a=ai(i,n),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:i},o.required=a?[`@call`,`args`]:[`@call`],o):(t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={call:{const:e},args:i,returnType:{const:t.returnType}},o.required=a?[`call`,`args`]:[`call`],o.unevaluatedProperties=!1,o)}defSchema(e,t){return this.toJson(e,t,!0)}mixinRef(e,t){if(typeof e==`string`)return`${this.commonTypesUri}#/$defs/${e}`;let n=oi(e).defName;if(n===void 0)throw Error(`A component mixin model must be named with specDef().`);return t.set(n,e),`#/$defs/${n}`}mixinProperties(e){if(typeof e!=`string`){let t=li(e);return ti(t).typeName===`ZodObject`?Object.keys(t.shape):[]}let t=[],n=(e,r)=>{if(Gr(e)&&!r.has(e)){r.add(e),Gr(e.properties)&&t.push(...Object.keys(e.properties));for(let t of Array.isArray(e.allOf)?e.allOf:[]){let e=Gr(t)?t.$ref:void 0,i=typeof e==`string`&&e.startsWith(`#/$defs/`)?this.standardDefs[e.substring(8)]:t;n(i,r)}}};return n(this.standardDefs[e],/* @__PURE__ */ new Set),t}toJson(e,t,n=!1){let r=oi(e),i=ui(e),a=fi(e),o=r,s=a,c,l=i;if(!n&&t!==void 0&&r.defName!==void 0&&r.defModel!==void 0)t.set(r.defName,r.defModel),c={$ref:`#/$defs/${r.defName}`},o=oi(e,r.defModel),l=i===ui(r.defModel)?void 0:i,s=a===fi(r.defModel)?void 0:a;else if(i!==void 0&&i.startsWith(`REF:`)){let e=i.substring(4),t=e.indexOf(`|`),n=t===-1?e:e.substring(0,t);l=t===-1?void 0:e.substring(t+1),c={$ref:this.refTarget(n)}}else c=this.coreJson(li(e),r,t);o.keywords&&Object.assign(c,Wr(o.keywords));let u=o.allOf?{allOf:[c,...o.allOf.map(e=>Wr(e))]}:c;return l&&(u.description=l),s!==void 0&&(u.default=s),u}resolveStandardRef(e){let t=`${this.commonTypesUri}#/$defs/`;if(!e.startsWith(t))return;let n=e.substring(t.length);if(n.includes(`/`)||!Object.hasOwn(this.standardDefs,n))return;let r=this.standardDefsInCatalog.get(n);if(r)return r;let i=this.standardDefs[n];if(!Gr(i))return;let a=this.withCatalogRefs(i);return this.standardDefsInCatalog.set(n,a),a}withCatalogRefs(e){if(Array.isArray(e))return e.map(e=>this.withCatalogRefs(e));if(!Gr(e))return e;let t={};for(let[n,r]of Object.entries(e))t[n]=n===`$ref`&&typeof r==`string`?this.refTarget(r):this.withCatalogRefs(r);return t}refTarget(e){return e.startsWith(`#/$defs/`)?`${this.commonTypesUri}${e}`:e}coreJson(e,t,n){let r=ti(e);switch(r.typeName){case`ZodObject`:return this.objectSchema(e,t,()=>!0,n);case`ZodString`:return mi(r);case`ZodNumber`:return hi(r);case`ZodBoolean`:return{type:`boolean`};case`ZodNull`:return{type:`null`};case`ZodEnum`:return{type:`string`,enum:[...r.values]};case`ZodLiteral`:return{const:r.value};case`ZodAny`:case`ZodUnknown`:return{};case`ZodNever`:return{not:{}};case`ZodArray`:{let e={type:`array`,items:this.toJson(r.type,n)},t=r.minLength,i=r.maxLength;return t&&(e.minItems=t.value),i&&(e.maxItems=i.value),e}case`ZodUnion`:case`ZodDiscriminatedUnion`:{let e=[...r.options].map(e=>this.toJson(e,n)),t=e=>{if(e.startsWith(`#/$defs/`)&&n!==void 0){let t=e.substring(8),r=n.get(t);if(r!==void 0)return this.defSchema(r,n)}return this.resolveStandardRef(e)};return{[e.every((n,r)=>e.slice(r+1).every(e=>ei(n,e,t)))?`oneOf`:`anyOf`]:e}}case`ZodRecord`:return{type:`object`,additionalProperties:this.toJson(r.valueType,n)};case`ZodLazy`:return this.toJson(r.getter(),n);default:return gi(e)}}objectSchema(e,t,n,r){let i=ti(e);if(i.typeName!==`ZodObject`)return this.toJson(e,r);let a=e.shape,o={},s=[];for(let[e,t]of Object.entries(a))n(e)&&(o[e]=this.toJson(t,r),t.isOptional()||s.push(e));let c={type:`object`,properties:o},l=t.required?.filter(e=>s.includes(e)),u=s.filter(e=>!l?.includes(e));s.length>0&&(c.required=l?[...l,...u]:s);let d=i.unknownKeys,f=i.catchall,p=t.closure??(d===`strict`?`additionalProperties`:`none`);return f&&ti(f).typeName!==`ZodNever`?c[p===`none`?`additionalProperties`:p]=this.toJson(f,r):p!==`none`&&(c[p]=d===`passthrough`),c}};function li(e){let t=e;for(let e=si(t);e;e=si(t))t=e;return t}function ui(e){for(let t=e;t;t=si(t)){let e=ti(t).description;if(typeof e==`string`)return e}}function di(e){let t=ui(e);return t!==void 0&&!t.startsWith(`REF:`)?t:void 0}function fi(e){for(let t=e;t;t=si(t)){let e=ti(t);if(e.typeName===`ZodDefault`)return e.defaultValue()}}var pi={email:`email`,url:`uri`,uuid:`uuid`,datetime:`date-time`,date:`date`,time:`time`};function mi(e){let t={type:`string`};for(let n of e.checks??[])n.kind===`regex`?t.pattern=n.regex.source:n.kind===`min`?t.minLength=n.value:n.kind===`max`?t.maxLength=n.value:n.kind in pi&&(t.format=pi[n.kind]);return t}function hi(e){let t=e.checks??[],n={type:t.some(e=>e.kind===`int`)?`integer`:`number`};for(let e of t)e.kind===`min`?n[e.inclusive?`minimum`:`exclusiveMinimum`]=e.value:e.kind===`max`&&(n[e.inclusive?`maximum`:`exclusiveMaximum`]=e.value);return n}function gi(e){let t=br(e,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});return delete t.$schema,delete t.definitions,delete t.$defs,t}var _i=/* @__PURE__ */ new Set([`anyComponent`,`anyFunction`]),vi=[`theme`,`themeSchema`,`styles`];function yi(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function bi(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.values(e))bi(t)}return e}function xi(e){return typeof e!=`object`||!e||Object.isFrozen(e)?e:bi(yi(e))}function Si(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ci(e,t){if(Array.isArray(e)){for(let n of e)Ci(n,t);return}if(!Si(e))return;let n=e.$ref;typeof n==`string`&&n.startsWith(`#/$defs/`)&&t.add(n.slice(8).split(`/`)[0].replace(/~1/g,`/`).replace(/~0/g,`~`));for(let n of Object.values(e))Ci(n,t)}function wi(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set;for(let t of e)Ci(t,r);for(;r.size>0;){let[e]=r;r.delete(e),n.has(e)||(n.add(e),e in t&&Ci(t[e],r))}return n}function Ti(e,t){let n=Tr(e);if(!Si(n))return;let r=t??{};for(let e of wi([n],r))if(!(e in r)&&!_i.has(e))return;return n}function Ei(e){return typeof e.name==`string`&&!(`properties`in e)}function Di(e,t,n,r){if(!e)return e;let i=t=>t.map(t=>Ti(t,e)).filter(e=>e!==void 0),a=wi(i(t),e),o=Object.keys(e).filter(e=>!a.has(e)),s=wi([...i(n),r,...o.map(t=>e[t])],e),c={},l=!1;for(let[t,n]of Object.entries(e))!a.has(t)||s.has(t)?c[t]=n:l=!0;return l?c:e}function Oi(e,t,n=Vr){if(Array.isArray(e))for(let r of e)Oi(r,t,n);else if(Si(e)){if(typeof e.description==`string`&&e.description.startsWith(`REF:`)){let r=e.description.substring(4),i=r.indexOf(`|`),a=i===-1?r:r.substring(0,i),o=i===-1?``:r.substring(i+1),s=e.default;for(let t of Object.keys(e))delete e[t];let c=a.split(/#\/(?:\$defs|definitions)\//)[1],l=c?.split(`/`)[0];e.$ref=l===void 0||a.startsWith(`#`)&&t.has(l)?a:`${n}#/$defs/${c}`,s!==void 0&&(e.default=s),o&&(e.description=o)}else{for(let t of[`additionalProperties`,`unevaluatedProperties`]){let n=e[t];Si(n)&&Object.keys(n).length===0&&(e[t]=!0)}delete e.$schema;for(let r of Object.values(e))Oi(r,t,n)}}}function ki(e,t,n=Vr){if(!e||typeof e!=`object`||!(`safeParse`in e))return{type:`object`,properties:{}};let r=br(e,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});return delete r.definitions,delete r.$defs,Oi(r,t,n),r}function Ai(e){if(e.type!==`object`)return;let t=e.unevaluatedProperties??e.additionalProperties;delete e.additionalProperties,e.unevaluatedProperties=typeof t==`boolean`||Si(t)?t:!1}function ji(e,t,n,r=Vr){let i=ki(t.schema,n,r),{component:a,id:o,...s}=Si(i.properties)?i.properties:{},c=Array.isArray(i.required)?i.required.filter(e=>e!==`component`&&e!==`id`):[],l=i.unevaluatedProperties??i.additionalProperties,u={type:`object`,properties:{component:{const:e},...s},required:[`component`,...c],unevaluatedProperties:typeof l==`boolean`||Si(l)?l:!1};return t.allowedParents&&t.allowedParents.length>0&&(u.allowedParents=[...t.allowedParents]),t.allowedChildren&&t.allowedChildren.length>0&&(u.allowedChildren=[...t.allowedChildren]),t.metadata!==void 0&&(u.metadata=yi(t.metadata)),u}function Mi(e,t,n,r,i,a=Vr,o){let s=ki(t.schema,n,a);if(i)return{name:e,...t.description?{description:t.description}:{},returnType:t.returnType,parameters:s,...t.allowedCallers?{allowedCallers:t.allowedCallers}:{},...t.requiresUserActivation===void 0?{}:{requiresUserActivation:t.requiresUserActivation}};Ai(s);let c=ai(s,o),l={type:`object`};return t.description&&(l.description=t.description),r?(l.returnType=t.returnType,t.allowedCallers&&(l.allowedCallers=t.allowedCallers),t.requiresUserActivation!==void 0&&(l.requiresUserActivation=t.requiresUserActivation),l.properties={"@call":{const:e},args:s},l.required=c?[`@call`,`args`]:[`@call`],l):(t.allowedCallers&&(l.allowedCallers=t.allowedCallers),t.requiresUserActivation!==void 0&&(l.requiresUserActivation=t.requiresUserActivation),l.properties={call:{const:e},args:s,returnType:{const:t.returnType}},l.required=c?[`call`,`args`]:[`call`],l.unevaluatedProperties=!1,l)}function Ni(e,t,n=Vr){let r=ki(e,t,n);return{type:`object`,properties:Si(r.properties)?r.properties:{},...Array.isArray(r.required)&&r.required.length>0?{required:r.required}:{},additionalProperties:r.additionalProperties===void 0||r.additionalProperties}}var Pi={not:{}};function Fi(e){let t=[...e].map(e=>({$ref:`#/components/${Li(e)}`}));return t.length===0?{...Pi}:{oneOf:t,discriminator:{propertyName:`component`}}}function Ii(e){let t=[...e].map(e=>({$ref:`#/functions/${Li(e)}`}));return t.length===0?{...Pi}:{oneOf:t}}function Li(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}var Ri=/* @__PURE__ */ new WeakMap;function zi(e){let t=Ri.get(e);return t||(t=Bi(e),Ri.set(e,t)),t}function Bi(e){let t=new ci(e.protocolVersion,e.commonTypesUri),n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let[i,a]of e.components){if(Tr(a)||!ri(a.schema))continue;let{schema:e,catalogDefs:o}=t.componentSchema(i,a.schema,a.allowedParents,a.allowedChildren);a.metadata!==void 0&&(e.metadata=yi(a.metadata)),r.set(i,bi(e));for(let[e,t]of o)n.set(e,t)}for(let t of e.defModels??[]){let e=Pr(t)?.defName;if(e===void 0)throw Error(`A catalog definition model must be named with specDef().`);n.set(e,t)}let i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map;for(let[r,i]of e.functions)!Tr(i)&&ii(i.schema)&&(a.set(r,i),t.toJson(i.schema,n));let o={...e.defs},s=/* @__PURE__ */ new Set;for(;[...n.keys()].some(e=>!s.has(e)&&!(e in o));)for(let[e,r]of[...n])s.has(e)||e in o||(s.add(e),o[e]=t.defSchema(r,n));let c={...e.extensionFields};if(e.themeLocation===`styles`&&e.themeSchema&&!Vi(e)){let n=t.defSchema(e.themeSchema);c.styles=Si(n.properties)?n.properties:{}}let l=/* @__PURE__ */ new Map;for(let[t,n]of e.components)l.set(t,r.get(t)??Ti(n,o));for(let[r,s]of e.functions){let e=Ti(s,o);i.set(r,e??(a.has(r)?bi(t.functionSchema(r,s,o,n)):void 0))}return{components:l,functions:i,defs:bi(o),extensionFields:bi(c)}}function Vi(e){return Si(e.defs?.theme)||vi.some(t=>e.extensionFields?.[t]!==void 0)}function Hi(e){let t=H(e.protocolVersion,`1.0`),n=zi(e),r=new Set(Object.keys(n.defs)),i={};e.schemaUri!==void 0&&(i.$schema=e.schemaUri),e.schemaId!==void 0&&(i.$id=e.schemaId),typeof e.declaredProtocolVersion==`string`?i.protocolVersion=e.declaredProtocolVersion:e.declaredProtocolVersion===void 0&&(i.protocolVersion=Pt(e.protocolVersion)??e.protocolVersion),e.title!==void 0&&(i.title=e.title),e.description!==void 0&&(i.description=e.description),e.declaresCatalogId!==!1&&(i.catalogId=e.id),e.instructions!==void 0&&(i.instructions=e.instructions);let a=e.commonTypesUri??`common_types.json`;if(e.declaresComponents!==!1||e.components.size>0){let t={};for(let[i,o]of e.components){let e=n.components.get(i);t[i]=e?yi(e):ji(i,o,r,a)}i.components=t}let o=[...e.functions].filter(([e,t])=>Tr(t)!==void 0||!e.startsWith(`@`)),s=o.map(([e])=>e);if(e.functionsLayout===`list`)i.functions=o.map(([e,i])=>{let o=n.functions.get(e);return o&&Ei(o)?yi(o):Mi(e,i,r,t,!0,a,n.defs)});else if(e.functionsLayout===`map`||o.length>0){let e={};for(let[i,s]of o){let o=n.functions.get(i);e[i]=o&&!Ei(o)?yi(o):Mi(i,s,r,t,!1,a,n.defs)}i.functions=e}for(let[e,t]of Object.entries(n.extensionFields))e in i||(i[e]=yi(t));let c=yi({...n.defs});(e.themeLocation??(t?void 0:`defs`))===`defs`&&e.themeSchema&&!Vi(n)&&(c.theme=Pr(e.themeSchema)?new ci(e.protocolVersion,e.commonTypesUri).defSchema(e.themeSchema):Ni(e.themeSchema,r,a));let l=e.unions??{anyComponent:t||e.components.size>0,anyFunction:t||s.length>0};if(l.anyComponent&&!(`anyComponent`in c)){let t=c.anyFunction;t!==void 0&&delete c.anyFunction,c.anyComponent=Fi(e.components.keys()),t!==void 0&&(c.anyFunction=t)}return l.anyFunction&&!(`anyFunction`in c)&&(c.anyFunction=Ii(s)),(e.defs!==void 0||Object.keys(c).length>0)&&(i.$defs=c),i}function Ui(e,t){if(!t.startsWith(`#/`))return;let n=t.slice(2).split(`/`).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return typeof r==`object`&&r?r:void 0}function Wi(e){let t=e.split(/#\/(?:\$defs|definitions)\//)[1];return t&&Object.hasOwn(bn,t)?bn[t]:void 0}function Gi(e){return e.length===0?ht():e.every(e=>typeof e==`string`)?z(e):e.length===1?yt(e[0]):R(e.map(e=>yt(e)))}function Ki(e){return typeof e!=`object`||!e?JSON.stringify(e):Array.isArray(e)?`[${e.map(Ki).join(`,`)}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Ki(e[t])}`).join(`,`)}}`}function qi(e,t,n,r,i){let a=e;if(t.not&&typeof t.not==`object`){let e=Zi(t.not,n,new Set(r),i);a=a.refine(t=>!e.safeParse(t).success,{message:`Value matched prohibited "not" schema`})}return t.default!==void 0&&(a=a.default(t.default)),typeof t.description==`string`&&(a=a.describe(t.description)),a}function Ji(e,t,n,r,i){let a=Wi(e);if(a){let n=e.split(/#\/(?:\$defs|definitions)\//)[1],r=typeof t.description==`string`?`REF:common_types.json#/$defs/${n}|${t.description}`:a.description;return r?a.describe(r):a}if(n&&e.startsWith(`#/`)){let a=Ui(n,e);if(!a)return ht().superRefine((t,n)=>{n.addIssue({code:h.custom,message:`Unresolvable schema reference: '${e}'`})});if(r.has(e)){let t=i.get(e);return vt(()=>(t||(t=i.get(e)??Zi(a,n,/* @__PURE__ */ new Set([e]),i),i.set(e,t)),t))}let o=i.get(e);if(!o){let t=new Set(r);t.add(e),o=Zi(a,n,t,i),i.set(e,o)}return typeof t.description==`string`&&(o=o.describe(t.description)),o}}function Yi(e,t,n,r){let i=Array.isArray(e.oneOf),a=(e.oneOf||e.anyOf).filter(e=>typeof e==`object`&&!!e);if(a.length===0)return;let o=a.find(e=>Array.isArray(e.enum)),s=a.some(e=>typeof e.$ref==`string`&&e.$ref.includes(`DataBinding`)),c=a.map(e=>Zi(e,t,new Set(n),r)),l;if(c.length===1)l=c[0];else{let e=[c[0],c[1],...c.slice(2)];l=i?Sr(e):R(e)}e.default!==void 0&&(l=l.default(e.default));let u=(typeof e.description==`string`?e.description:void 0)||(o&&s?`REF:common_types.json#/$defs/DynamicString`:void 0);return u?l.describe(u):l}function Xi(e,t,n,r){let i=e.allOf.filter(e=>typeof e==`object`&&!!e);if(i.length===0)return;if(t){let i=ea(e,t,new Set(n),!1);if(i.length>0){let a=/* @__PURE__ */ new Set;for(let e of i)if(e.kind===`json`&&Array.isArray(e.schema.required))for(let t of e.schema.required)typeof t==`string`&&a.add(t);if(Array.isArray(e.required))for(let t of e.required)typeof t==`string`&&a.add(t);let o={};for(let e of i){if(e.kind===`zod`){Object.assign(o,e.properties);continue}let i=$i(e.schema.properties||{},a,!1,t,new Set(n),r);Object.assign(o,i)}let s=L(o);return qi(e.additionalProperties===!1||e.unevaluatedProperties===!1||i.some(e=>e.kind===`json`&&(e.schema.additionalProperties===!1||e.schema.unevaluatedProperties===!1))?s.strict():s.passthrough(),e,t,n,r)}}let a=i.map(e=>Zi(e,t,new Set(n),r)),o=a[0];for(let e=1;e<a.length;e++)o=o.and(a[e]);return qi(o,e,t,n,r)}function Zi(e,t,n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return ht();if(e instanceof k)return e;if(e.$ref&&typeof e.$ref==`string`){let i=Ji(e.$ref,e,t,n,r);if(i)return i}if(Array.isArray(e.oneOf)||Array.isArray(e.anyOf)){let i=Yi(e,t,n,r);if(i)return i}if(Array.isArray(e.allOf)&&e.allOf.length>0){let i=Xi(e,t,n,r);if(i)return i}if(e.const!==void 0)return qi(yt(e.const),e,t,n,r);if(Array.isArray(e.enum)&&e.enum.length>0)return qi(Gi(e.enum),e,t,n,r);if(e.type===`array`){let i=I(e.items&&typeof e.items==`object`?Zi(e.items,t,new Set(n),r):ht());return typeof e.minItems==`number`&&(i=i.min(e.minItems)),typeof e.maxItems==`number`&&(i=i.max(e.maxItems)),e.uniqueItems===!0&&(i=i.refine(e=>new Set(e.map(Ki)).size===e.length,{message:`Array items must be unique`})),qi(i,e,t,n,r)}switch(e.type){case`string`:{let i=P();if(typeof e.minLength==`number`&&(i=i.min(e.minLength)),typeof e.maxLength==`number`&&(i=i.max(e.maxLength)),typeof e.pattern==`string`)try{i=i.regex(new RegExp(e.pattern,`u`))}catch{}return qi(i,e,t,n,r)}case`integer`:case`number`:{let i=e.type===`integer`?F().int():F();return typeof e.minimum==`number`&&(i=i.min(e.minimum)),typeof e.maximum==`number`&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum==`number`&&(i=i.gt(e.exclusiveMinimum)),typeof e.exclusiveMaximum==`number`&&(i=i.lt(e.exclusiveMaximum)),typeof e.multipleOf==`number`&&(i=i.multipleOf(e.multipleOf)),qi(i,e,t,n,r)}case`boolean`:return qi(pt(),e,t,n,r);case`object`:{let i=e.properties,a;if(typeof i==`object`&&i){let o=L($i(i,Array.isArray(e.required)?new Set(e.required.filter(e=>typeof e==`string`)):/* @__PURE__ */ new Set,!1,t,n,r));a=e.additionalProperties===!1||e.unevaluatedProperties===!1?o.strict():o.passthrough()}else a=_t(ht());return qi(a,e,t,n,r)}default:return qi(ht(),e,t,n,r)}}function Qi(e){return e===`id`||e===`component`||e===`catalogId`}function $i(e,t,n=!1,r,i,a=/* @__PURE__ */ new Map){let o={};for(let[s,c]of Object.entries(e)){if(n&&Qi(s))continue;let e=Zi(typeof c==`object`&&c?c:{},r,i?new Set(i):/* @__PURE__ */ new Set,a);o[s]=t.has(s)?e.safeParse(void 0).success?e.refine(e=>e!==void 0,{message:`Required`}):e:e.optional()}return o}function ea(e,t,n=/* @__PURE__ */ new Set,r=!1){if(!e||typeof e!=`object`)return[];let i=[],a=[],o=[];if(Array.isArray(e.allOf)){for(let s of e.allOf)if(s&&typeof s==`object`){if(typeof s.$ref==`string`){let e=s.$ref;if(e.includes(`common_types.json`)&&e.includes(`ComponentCommon`)){let{accessibility:e,metadata:t}=dn.shape;i.push({kind:`zod`,properties:r?{accessibility:e,metadata:t}:{accessibility:e}})}else if(e.startsWith(`#/`)){if(!n.has(e)){n.add(e);let i=Ui(t,e);i&&a.push(...ea(i,t,n,r))}}else{let t=Wi(e);t instanceof Ue&&i.push({kind:`zod`,properties:{...t.shape}})}}else o.push(...ea(s,t,n,r))}}let s=[...i,...a,...o];return e.properties&&s.push({kind:`json`,schema:e}),s}function ta(e,t,n=!0,r=/* @__PURE__ */ new Map,i=!1){let a={},o=ea(e,t,void 0,i),s=/* @__PURE__ */ new Set;for(let e of o)e.kind===`json`&&Array.isArray(e.schema.required)&&e.schema.required.forEach(e=>{typeof e==`string`&&s.add(e)});for(let e of o){if(e.kind===`zod`){for(let[t,r]of Object.entries(e.properties))n&&Qi(t)||(a[t]=r);continue}let i=$i(e.schema.properties||{},s,n,t,void 0,r);Object.assign(a,i)}let c=L(a);return e.unevaluatedProperties===!0||typeof e.unevaluatedProperties==`object`&&e.unevaluatedProperties!==null||e.additionalProperties===!0||typeof e.additionalProperties==`object`&&e.additionalProperties!==null?c.passthrough():c.strict()}function na(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).length>0&&t.properties===void 0&&typeof t.type!=`string`&&!(`$ref`in t)&&!(`allOf`in t)&&!(`oneOf`in t)&&!(`anyOf`in t)&&!(`not`in t)&&Object.values(t).every(e=>e!==null&&(typeof e==`object`||typeof e==`boolean`))}function ra(e){return e.unevaluatedProperties===!0||typeof e.unevaluatedProperties==`object`&&e.unevaluatedProperties!==null||e.additionalProperties===!0||typeof e.additionalProperties==`object`&&e.additionalProperties!==null}function ia(e,t,n=/* @__PURE__ */ new Set){let r={schemas:[],hasUnresolvable:!1};if(!e||typeof e!=`object`||Array.isArray(e))return r;if(na(e))return r.schemas.push({type:`object`,properties:e}),r;if(typeof e.$ref==`string`){let i=e.$ref;if(i.startsWith(`#/`)){if(!t)r.hasUnresolvable=!0;else if(!n.has(i)){n.add(i);let e=Ui(t,i);if(e){let i=ia(e,t,n);r.schemas.push(...i.schemas),i.hasUnresolvable&&(r.hasUnresolvable=!0)}else r.hasUnresolvable=!0}}else r.hasUnresolvable=!0}if(Array.isArray(e.allOf)){for(let i of e.allOf)if(i&&typeof i==`object`&&!Array.isArray(i)){let e=ia(i,t,n);r.schemas.push(...e.schemas),e.hasUnresolvable&&(r.hasUnresolvable=!0)}}return(Array.isArray(e.anyOf)||Array.isArray(e.oneOf))&&(r.hasUnresolvable=!0),(e.properties||e.required||e.additionalProperties!==void 0||e.unevaluatedProperties!==void 0)&&r.schemas.push(e),r}function aa(e,t,n=/* @__PURE__ */ new Map){let r=ia(e,t),i=/* @__PURE__ */ new Set;for(let e of r.schemas)if(Array.isArray(e.required))for(let t of e.required)typeof t==`string`&&i.add(t);let a={};for(let e of r.schemas)if(e.properties&&typeof e.properties==`object`&&!Array.isArray(e.properties)){let r=$i(e.properties,i,!1,t,void 0,n);Object.assign(a,r)}let o=L(a);return r.hasUnresolvable||r.schemas.some(ra)||ra(e)?o.passthrough():o.strict()}function oa(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return[];let n=e,r=[],i=/* @__PURE__ */ new Set,a=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let n=e;if(typeof n.$ref==`string`&&t&&n.$ref.startsWith(`#/`)&&!i.has(n.$ref)){i.add(n.$ref);let e=Ui(t,n.$ref);e&&a(e)}if(n.properties&&typeof n.properties==`object`&&n.properties!==null&&!Array.isArray(n.properties)&&r.push(...Object.keys(n.properties)),Array.isArray(n.allOf))for(let e of n.allOf)a(e)};return n.properties&&typeof n.properties==`object`&&n.properties!==null&&!Array.isArray(n.properties)||Array.isArray(n.allOf)||typeof n.$ref==`string`?(a(n),r):na(n)?Object.keys(n):[]}function sa(e,t,n,r=!1){let i=[];if(!e)return i;let a=/* @__PURE__ */ new Map,o=(e,t)=>{if(r){Wt(e,`function identifier: '${e}'`);for(let n of t)Wt(n,`argument identifier: '${n}' in function '${e}'`)}};if(Array.isArray(e)){for(let r of e)if(r&&typeof r==`object`&&typeof r.name==`string`){let e=oa(r.parameters,t);if(o(r.name,e),n&&!n.has(r.name))continue;i.push(new Ar(r.name,r,e=>e.parameters&&typeof e.parameters==`object`?aa(e.parameters,t,a):_t(ht())))}return i}if(typeof e==`object`&&e)for(let[r,s]of Object.entries(e))o(r,oa(ca(s&&typeof s==`object`?s:{}),t)),(!n||n.has(r))&&s&&typeof s==`object`&&i.push(new Ar(r,s,e=>{let n=ca(e);return n?aa(n,t,a):_t(ht())}));return i}function ca(e){let t=e.properties&&typeof e.properties==`object`&&e.properties!==null&&!Array.isArray(e.properties)?e.properties:void 0,n=t?.args??e.args??e.parameters;return!n&&t&&!(`call`in t)&&!(`@call`in t)&&!(`function`in t)?n=e:na(n)&&(n={type:`object`,properties:n,required:e.required,additionalProperties:e.additionalProperties}),n&&typeof n==`object`&&!Array.isArray(n)?n:void 0}function la(e,t){if(!Array.isArray(e))return;let n=/* @__PURE__ */ new Set;for(let r of e)if(typeof r?.$ref==`string`&&r.$ref.startsWith(t)){let e=r.$ref.slice(t.length).replace(/~([01])/g,(e,t)=>t===`1`?`/`:`~`);n.add(e)}return n}function ua(e,t,n,r){let i=[],a=/* @__PURE__ */ new Map;for(let[o,s]of Object.entries(e)){let e=s||{};if(n){Wt(o,`component identifier: '${o}'`);let t=e.properties;if(t&&typeof t==`object`)for(let e of Object.keys(t))Wt(e,`property identifier: '${e}' in component '${o}'`);let n=e.metadata;if(n!==void 0)try{qt(n)}catch(e){throw new Tt(e instanceof Error?e.message:String(e))}}(!r||r.has(o))&&i.push(new kr(o,e,e=>ta(e,t,!0,a,n)))}return i}function da(e,t){let n=e.theme??e.themeSchema??e.styles??t?.theme;if(n&&typeof n==`object`){let t=n,r=`properties`in t||`allOf`in t||t.type===`object`?t:{type:`object`,properties:t},i=ta(r,e,!1);return r.additionalProperties===!1||r.unevaluatedProperties===!1?i:i.passthrough()}}function fa(e){if(e.startsWith(`#`))return!0;let t=e.indexOf(`#`),n=t===-1?e:e.slice(0,t);return n===`catalog.json`||n.split(`/`).pop()===`common_types.json`}function pa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ma(e,t){if(Array.isArray(e))e.forEach((e,n)=>ma(e,`${t}/${n}`));else if(va(e))for(let[n,r]of Object.entries(e)){let e=`${t}/${pa(n)}`;if(n===`$ref`&&typeof r==`string`&&!fa(r))throw new Tt(`Unsupported external $ref '${r}' at ${e}: a v1.0 catalog may only reference its own components and functions (#/...) or common_types.json.`);ma(r,e)}}function ha(e,t,n){let r=yi(e),i=n??r.catalogId??r.$id??r.id;if(!i||typeof i!=`string`)throw Error(`Catalog ID must be specified via catalog metadata ('catalogId' or '$id').`);let a=r.$defs,o=a?.anyComponent,s=la(o?.oneOf,`#/components/`),c=t??r.protocolVersion??`0.9`,l=H(c,`1.0`);l&&ma(r,``);let u=ua(r.components??{},r,l,s),d=a?.anyFunction,f=la(d?.oneOf,`#/functions/`),p=sa(r.functions,r,f,l),m=da(r,a);return bi(r),{id:i,protocolVersion:c,components:u,functions:p,themeSchema:m,...ba(r,u,p)}}var ga={$schema:`schemaUri`,$id:`schemaId`,title:`title`,description:`description`,instructions:`instructions`},_a=/* @__PURE__ */ new Set([`protocolVersion`,`catalogId`,`components`]);function va(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ya(e,t){return Ki(e)===Ki(t)}function ba(e,t,n){let r={},i={};for(let[a,o]of Object.entries(e))if(a in ga&&typeof o==`string`)r[ga[a]]=o;else if(a===`protocolVersion`&&typeof o==`string`)r.declaredProtocolVersion=o;else if(a===`functions`&&(Array.isArray(o)||va(o)))r.functionsLayout=Array.isArray(o)?`list`:`map`;else if(a===`$defs`&&va(o)){let e=ya(o.anyComponent,Fi(t.map(e=>e.name))),i=ya(o.anyFunction,Ii(n.map(e=>e.name)));r.unions={anyComponent:e,anyFunction:i};let a={};for(let[t,n]of Object.entries(o))t===`anyComponent`&&e||t===`anyFunction`&&i||(a[t]=n);r.defs=Object.freeze(a)}else(!_a.has(a)||a===`components`&&!va(o))&&(i[a]=o);return r.declaredProtocolVersion??=null,r.declaresCatalogId=typeof e.catalogId==`string`,r.declaresComponents=va(e.components),r.unions??={anyComponent:!1,anyFunction:!1},Object.keys(i).length>0&&(r.extensionFields=Object.freeze(i)),r}function xa(e,t){return t?.standardDefs?t.standardDefs:Ur(t?.protocolVersion??e.protocolVersion)}var Sa=/^[^#]+#\/(?:\$defs|definitions)\/([^/]+)(\/.*)?$/;function Ca(e){let t=Sa.exec(e);return t?`#/$defs/${t[1]}${t[2]??``}`:`#/$defs/${e.split(`/`).pop()}`}function wa(e){if(e.startsWith(`#/$defs/`))return e.substring(8).split(`/`)[0].replace(/~1/g,`/`).replace(/~0/g,`~`)}function Ta(e){if(typeof e.description!=`string`||!e.description.startsWith(`REF:`))return!1;let t=e.description.substring(4),n=t.indexOf(`|`),r=n===-1?t:t.substring(0,n),i=n===-1?``:t.substring(n+1),a=e.default;for(let t of Object.keys(e))delete e[t];return e.$ref=r.startsWith(`#`)?r:Ca(r),a!==void 0&&(e.default=a),i&&(e.description=i),!0}function Ea(e,t={}){if(Array.isArray(e.allOf)){let t=e.allOf.filter(e=>!(typeof e==`object`&&e&&Object.keys(e).length===0)),n=t.length===1?t[0]:void 0;typeof n==`object`&&n&&!Array.isArray(n)&&Object.keys(n).every(t=>!(t in e)||t===`allOf`)?(delete e.allOf,Object.assign(e,n)):t.length===0?delete e.allOf:e.allOf=t}t.stripAdditionalProperties?(delete e.additionalProperties,delete e.unevaluatedProperties):(e.additionalProperties&&typeof e.additionalProperties==`object`&&Object.keys(e.additionalProperties).length===0&&(e.additionalProperties=!0),e.unevaluatedProperties&&typeof e.unevaluatedProperties==`object`&&Object.keys(e.unevaluatedProperties).length===0&&(e.unevaluatedProperties=!0)),`$schema`in e&&delete e.$schema}function Da(e,t=/* @__PURE__ */ new Set,n={}){if(typeof e!=`object`||!e||t.has(e))return;if(t.add(e),Array.isArray(e)){for(let r of e)Da(r,t,n);return}let r=e;if(!Ta(r)){Ea(r,n);for(let e of Object.keys(r))Da(r[e],t,n)}}function Oa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ka=/* @__PURE__ */ new Set([`description`,`title`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`]),Aa=/* @__PURE__ */ new Set([`id`,`component`,`catalogId`]),ja=/* @__PURE__ */ new Set([`anyComponent`,`anyFunction`,`theme`]),Ma=/^(?:([^#]*common_types\.json))?#\/\$defs\/([^/]+)(\/.*)?$/,Na=/\/(ComponentCommon|Checkable)$/;function Pa(e,t,n,r=``){if(e.$ref=`#/$defs/${t}${r}`,r||e.description!==void 0)return;let i=n[t];Oa(i)&&typeof i.description==`string`&&(e.description=i.description)}function Fa(e,t,n){if(Array.isArray(e)){for(let r of e)Fa(r,t,n);return}if(!Oa(e))return;let r=e.$ref,i=typeof r==`string`?Ma.exec(r):null;if(i){let[,r,a,o]=i;if(r!==void 0||a in t){if(n){for(let t of Object.keys(e))t!==`$ref`&&!ka.has(t)&&delete e[t];Pa(e,a,t,o);return}Pa(e,a,t,o)}}for(let r of Object.values(e))Fa(r,t,n)}function Ia(e,t){if(!t.startsWith(`#/`))return;let n=e;for(let e of t.substring(2).split(`/`)){let t=e.replace(/~([01])/g,(e,t)=>t===`1`?`/`:`~`);if(!Oa(n)||!(t in n))return;n=n[t]}return n}function La(e,t,n){let r=[],i=[],a=[];for(let o of Array.isArray(e.allOf)?e.allOf:[]){if(!Oa(o))continue;let e=o.$ref;if(typeof e!=`string`){r.push(...La(o,t,n));continue}let s=Na.exec(e)?.[1],c=e.startsWith(`#/`)?Ia(t.rootDoc,e):void 0;if(s===void 0&&Oa(c)){n.has(e)||(n.add(e),i.push(...La(c,t,n)));continue}let l=Sa.exec(e),u=s??(l&&!l[2]?l[1]:void 0),d=u===void 0?void 0:t.standardDefs[u];Oa(d)&&Oa(d.properties)&&a.push({properties:yi(d.properties),...Array.isArray(d.required)?{required:d.required}:{}})}let o=[...a,...i,...r];return(`properties`in e||`description`in e)&&o.push(e),o}function Ra(e,t){let n=La(e,t,/* @__PURE__ */ new Set),r,i={},a=/* @__PURE__ */ new Set;for(let e of n)if(typeof e.description==`string`&&(r=e.description),Oa(e.properties)&&Object.assign(i,e.properties),Array.isArray(e.required))for(let t of e.required)typeof t==`string`&&a.add(t);let o={};for(let[e,n]of Object.entries(i)){if(Aa.has(e))continue;let r=yi(n);Fa(r,t.standardDefs,!0),o[e]=r}return{props:o,required:[...a].filter(e=>!Aa.has(e)).sort(),...r===void 0?{}:{description:r}}}function za(e,t){let n=t.model.functions.get(e);if(!n)return;let r=Oa(n.properties)?n.properties:void 0,i=r?.args??n.args??n.parameters;if(i!==void 0)return Oa(i)?na(i)?{type:`object`,properties:i,...n.required===void 0?{}:{required:n.required},...n.additionalProperties===void 0?{}:{additionalProperties:n.additionalProperties}}:i:{};let a=r&&(`call`in r||`@call`in r||`function`in r);if(!r||a)return{};let{description:o,title:s,name:c,returnType:l,allowedCallers:u,requiresUserActivation:d,...f}=n;return f}function Ba(e){let t=vi.map(t=>e.extensionFields[t]).find(e=>e!==void 0)??e.defs.theme;if(Oa(t))return`properties`in t||`allOf`in t||t.type===`object`?t:{type:`object`,properties:t}}function Va(e){return(Pt(e.protocolVersion)??e.protocolVersion)===`0.8`||e.id.includes(`v0_8`)||e.id.includes(`v0.8`)}function Ha(e,t,n,r){if(!e.themeSchema)return;let i=Va(e),a=Ba(r.model);if(a){let e=yi({...a});!i&&e.additionalProperties===void 0&&e.unevaluatedProperties===void 0&&(e.additionalProperties=!0),t.theme=e;return}let o=br(e.themeSchema,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});Da(o),Ua(o,t,n);let s=o.additionalProperties===!1,c={type:`object`,...typeof o.description==`string`&&!o.description.startsWith(`REF:`)?{description:o.description}:{},properties:o.properties||{},...Array.isArray(o.required)&&o.required.length>0?{required:o.required}:{},...s?{additionalProperties:!1}:i?{}:{additionalProperties:o.additionalProperties===void 0||o.additionalProperties}};n.push(c),t.theme=c}function Ua(e,t,n){let r=Oa(e.definitions)?e.definitions:Oa(e.$defs)?e.$defs:void 0;delete e.definitions,delete e.$defs,r&&(Object.assign(t,r),n.push(r))}function Wa(e,t,n){if(!e.schema||typeof e.schema!=`object`||!(`safeParse`in e.schema))return{props:{},reqList:[],additionalProps:void 0};let r=br(e.schema,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});Da(r),Ua(r,t,n);let i=r.properties||{},a=Array.isArray(r.required)?r.required.filter(e=>e!==`component`&&e!==`id`):[],o=r.unevaluatedProperties??r.additionalProperties;return{props:i,reqList:a,additionalProps:typeof o==`boolean`||Oa(o)?o:void 0}}function Ga(e){let t=e.schema?.description;return typeof t==`string`&&!t.startsWith(`REF:`)?t:void 0}function Ka(e){return e.unevaluatedProperties??e.additionalProperties}function qa(e,t,n,r,i,a){let o,s,c,l,u=i.model.components.get(e);if(u)({props:o,required:s,description:c}=Ra(u,i)),l=Ka(u)??(i.isV10?void 0:!1);else{let e=Wa(t,n,r),{component:a,id:u,...d}=e.props;r.push(d),o=d,s=e.reqList,c=Ga(t),l=i.isV10?void 0:e.additionalProps??!1}let d={};Pa(d,`ComponentId`,i.standardDefs);let f={id:d,...o,component:{const:e}},p=[`id`,...s,`component`],m=l===void 0?{}:{unevaluatedProperties:l},h;return h=a?.componentEnvelopeRef?{...c===void 0?{}:{description:c},allOf:[{$ref:a.componentEnvelopeRef},{type:`object`,properties:f,required:p}],...m}:{type:`object`,...c===void 0?{}:{description:c},properties:f,required:p,...m},t.allowedParents&&t.allowedParents.length>0&&(h.allowedParents=t.allowedParents),t.allowedChildren&&t.allowedChildren.length>0&&(h.allowedChildren=t.allowedChildren),h}function Ja(e,t,n,r,i,a){if(e.components.size===0){t.components={};return}let o={};for(let[t,s]of e.components.entries())o[t]=qa(t,s,n,r,i,a);t.components=o,n.anyComponent={oneOf:Array.from(e.components.keys()).map(e=>({$ref:`#/components/${e}`})),discriminator:{propertyName:`component`}}}function Ya(e,t,n,r,i){let a,o=za(e,i);if(o)a=yi(o),Fa(a,i.standardDefs,!1);else if(t.schema&&typeof t.schema==`object`&&`safeParse`in t.schema){let e=br(t.schema,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});Da(e),Ua(e,n,r),r.push(e),a=e}else a={type:`object`,properties:{}};if(a.type===`object`){let e=a.additionalProperties;delete a.additionalProperties,a.unevaluatedProperties=a.unevaluatedProperties??e??!1}return a}function Xa(e,t,n,r,i){let a=Ya(e,t,n,r,i),o=ai(a,{...i.defs,...n}),s=i.isV10?`@call`:`call`,c=o?[s,`args`]:[s];return i.isV10?{type:`object`,...t.description?{description:t.description}:{},returnType:t.returnType,...t.allowedCallers===void 0?{}:{allowedCallers:t.allowedCallers},...t.requiresUserActivation===void 0?{}:{requiresUserActivation:t.requiresUserActivation},properties:{"@call":{const:e},args:a},required:c}:{type:`object`,...t.description?{description:t.description}:{},properties:{call:{const:e},args:a,returnType:{const:t.returnType}},required:c,unevaluatedProperties:!1}}function Za(e,t,n,r,i){let a=Array.from(e.functions.keys()).filter(e=>!e.startsWith(`@`));if(a.length===0)return;let o={};for(let t of a)o[t]=Xa(t,e.functions.get(t),n,r,i);t.functions=o,n.anyFunction={oneOf:a.map(e=>({$ref:`#/functions/${e}`}))}}var Qa=new Map(Object.values(bn).flatMap(e=>{let t=e.description;if(typeof t!=`string`||!t.startsWith(`REF:`))return[];let n=t.substring(4),r=n.indexOf(`|`);return r===-1?[]:[[n.substring(0,r).split(`/`).pop(),n.substring(r+1)]]}));function $a(e,t,n=/* @__PURE__ */ new Set){if(typeof e!=`object`||!e||n.has(e))return;if(n.add(e),Array.isArray(e)){for(let r of e)$a(r,t,n);return}let r=e,i=r.$ref;if(typeof i==`string`&&!i.startsWith(`#`)&&i!==t){if(!Sa.test(i))throw Error(`Cannot bundle the external schema reference '${i}'.`);r.$ref=Ca(i)}for(let e of Object.values(r))$a(e,t,n)}function eo(e,t,n=/* @__PURE__ */ new Set){if(typeof e!=`object`||!e||n.has(e))return;if(n.add(e),Array.isArray(e)){for(let r of e)eo(r,t,n);return}let r=e,i=r.$ref;if(typeof i==`string`&&i.startsWith(`#/$defs/`)){let e=i.substring(8),n=e.includes(`/`)?void 0:t[e],a=r.description===void 0||r.description===Qa.get(e);n&&a&&(typeof n.description==`string`?r.description=n.description:delete r.description)}for(let e of Object.values(r))eo(e,t,n)}function to(e,t,n=/* @__PURE__ */ new Set){if(typeof e==`object`&&e&&!n.has(e)){if(n.add(e),typeof e.$ref==`string`){let n=wa(e.$ref);n!==void 0&&t.add(n)}if(Array.isArray(e))for(let r of e)to(r,t,n);else for(let r of Object.values(e))to(r,t,n)}}function no(e,t){let n={$schema:`https://json-schema.org/draft/2020-12/schema`,...typeof e.declaredProtocolVersion==`string`?{protocolVersion:e.declaredProtocolVersion.trim().replace(/^[vV](?=\d)/,``)}:{},catalogId:e.id};e.instructions&&(n.instructions=e.instructions);let r=xa(e,t),i=t?.protocolVersion??e.protocolVersion,a=zi(e),o=a.defs,s={standardDefs:r,model:a,defs:o,rootDoc:{$defs:o},isV10:!!i&&H(i,`1.0`)},c={},l=[];Ha(e,c,l,s),Ja(e,n,c,l,s,t),Za(e,n,c,l,s),$a(n,t?.componentEnvelopeRef),$a(c);for(let e of l)eo(e,r);let u;do{u=Object.keys(c).length;let e=/* @__PURE__ */ new Set;to(n,e),to(c,e),(e.has(`DynamicString`)||e.has(`DynamicNumber`)||e.has(`DynamicBoolean`)||e.has(`DynamicValue`))&&(e.add(`DataBinding`),e.add(`FunctionCall`));for(let t of e)if(!(t in c)){if(t in r){let e=yi(r[t]);$a(e),c[t]=e}else if(!ja.has(t)&&t in o){let e=yi(o[t]);Fa(e,r,!1),$a(e),c[t]=e}}e.has(`anyFunction`)&&!(`anyFunction`in c)&&(c.anyFunction={not:{}})}while(Object.keys(c).length>u);return Object.keys(c).length>0&&(n.$defs=c),n}function ro(e){if(!e)return``;let t=e.lastIndexOf(`#`);return(t===-1?e:e.slice(t+1)).split(`/`).filter(Boolean).pop()??``}function io(e,t){if(!e?._def)return null;if(t){if(t.has(e))return null;t.add(e)}switch(e._def.typeName){case`ZodOptional`:case`ZodNullable`:case`ZodDefault`:case`ZodReadonly`:return e._def.innerType;case`ZodBranded`:return e._def.type;case`ZodEffects`:return e._def.schema;case`ZodLazy`:return e._def.getter();default:return null}}function ao(e){let t=[],n=/* @__PURE__ */ new Set,r=e;for(;r;){r.description&&t.push(r.description),r._def?.description&&t.push(r._def.description);let e=io(r,n);if(!e)break;r=e}return t}function oo(e){let t=/* @__PURE__ */ new Set,n=e;for(;n;){let e=io(n,t);if(!e)break;n=e}return n}function so(e,t){if(!e)return null;let n=ro(e),r=t.childListRefNames,i=t.childRefNames;return r.has(n)?{isChild:!1,isChildList:!0}:i.has(n)?{isChild:!0,isChildList:!1}:null}function co(e,t){let n=!1;for(let r of e){if(typeof r!=`object`||!r)continue;let e=uo(r,t);if(e.isChildList)return{isChild:!1,isChildList:!0};e.isChild&&(n=!0)}return n?{isChild:!0,isChildList:!1}:null}function lo(e,t){let n=!1;for(let r of[`oneOf`,`anyOf`,`allOf`]){let i=e[r];if(!Array.isArray(i))continue;let a=co(i,t);if(a?.isChildList)return a;a?.isChild&&(n=!0)}return n?{isChild:!0,isChildList:!1}:null}function uo(e,t){let n=so(typeof e.$ref==`string`?e.$ref:``,t);if(n)return n;if(e.type===`array`&&e.items){let n=uo(e.items,t);if(n.isChild||n.isChildList)return{isChild:!1,isChildList:!0}}return lo(e,t)||(e.type===`object`&&e.properties&&(`componentId`in e.properties&&(`path`in e.properties||`dataBinding`in e.properties)||`explicitList`in e.properties||`template`in e.properties)?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1})}function fo(e){if(e?._def?.typeName===`ZodObject`&&typeof e._def.shape==`function`){let t=e._def.shape();return!!(t.componentId&&(t.path||t.dataBinding)||t.explicitList||t.template)}return!1}function po(e,t){return e?._def?.typeName===`ZodArray`&&yo(oo(e._def.type),t).isChild}function mo(e,t){let n=!1,r=!1,i=!1;for(let a of e){let e=oo(a);fo(e)&&(n=!0),po(e,t)&&(r=!0);let o=yo(e,t);if(o.isChildList)return{isChild:!1,isChildList:!0};o.isChild&&(i=!0)}return n||r?{isChild:!1,isChildList:!0}:i?{isChild:!0,isChildList:!1}:{isChild:!1,isChildList:!1}}function ho(e,t){if(!e)return!1;if(e.startsWith(`REF:`)){let n=ro(e.substring(4).split(`|`)[0]);if(t.has(n))return!0}let n=ro(e.split(`|`)[0]);if(n&&t.has(n))return!0;let r=e.trim();return!!t.has(r)}function go(e,t){if(!e)return!1;if(e.startsWith(`REF:`)){let n=ro(e.substring(4).split(`|`)[0]);if(t.has(n))return!0}let n=ro(e.split(`|`)[0]);if(n&&t.has(n))return!0;let r=e.trim();return!!t.has(r)}function _o(e,t){let n=t.childListRefNames,r=t.childRefNames;for(let t of e){if(ho(t,n))return{isChild:!1,isChildList:!0};if(go(t,r))return{isChild:!0,isChildList:!1}}return null}function vo(e,t){let n=yo(e,t);return n.isChild||n.isChildList?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1}}function yo(e,t){if(!e||typeof e!=`object`)return{isChild:!1,isChildList:!1};let n=nn(e);if(n===`component-id`)return{isChild:!0,isChildList:!1};if(n===`child-list`)return{isChild:!1,isChildList:!0};let r=_o(ao(e),t);if(r)return r;let i=oo(e);if(!i?._def)return uo(e,t);let a=nn(i);if(a===`component-id`)return{isChild:!0,isChildList:!1};if(a===`child-list`)return{isChild:!1,isChildList:!0};let o=i._def.typeName;if(o===`ZodArray`)return vo(oo(i._def.type),t);if(o===`ZodUnion`)return mo(i._def.options??[],t);if(o===`ZodObject`&&typeof i._def.shape==`function`){let e=i._def.shape();if(e.componentId&&(e.path||e.dataBinding)||e.explicitList||e.template)return{isChild:!1,isChildList:!0}}return{isChild:!1,isChildList:!1}}function bo(e,t,n){let r=e.nestedRefs[t];r?r.add(n):e.nestedRefs[t]=/* @__PURE__ */ new Set([n])}function xo(e,t,n,r){let i=yo(t,r);if(i.isChildList){n.listRefs.add(e);return}if(i.isChild){n.singleRefs.add(e);return}let a=oo(t);if(r.childPropertyNames?.has(e)&&a?._def?.typeName===`ZodString`){n.singleRefs.add(e);return}if(a?._def?.typeName!==`ZodArray`)return;let o=oo(a._def.type);if(o?._def?.typeName!==`ZodObject`||typeof o._def.shape!=`function`)return;let s=o._def.shape();for(let[t,i]of Object.entries(s)){let a=yo(i,r),o=oo(i);(a.isChild||a.isChildList||r.childPropertyNames?.has(t)&&o?._def?.typeName===`ZodString`)&&(n.listRefs.add(e),bo(n,e,t))}}function So(e){if(typeof e!=`object`||!e)return null;let t=e;if(t.type!==`array`&&!(`items`in t))return null;let n=t.items;if(typeof n!=`object`||!n)return null;let r=n.properties;return typeof r!=`object`||!r?null:r}function Co(e,t,n){for(let[r,i]of Object.entries(e)){let e=yo(i,n);if(e.isChildList){t.listRefs.add(r);continue}if(e.isChild||n.childPropertyNames?.has(r)&&typeof i==`object`&&i&&i.type===`string`){t.singleRefs.add(r);continue}let a=So(i);if(a)for(let[e,i]of Object.entries(a)){let a=yo(i,n);(a.isChild||a.isChildList||n.childPropertyNames?.has(e)&&typeof i==`object`&&i&&i.type===`string`)&&(t.listRefs.add(r),bo(t,r,e))}}}function wo(e,t,n){if(!e)return;let r=oo(e);if(r?._def?.typeName===`ZodObject`&&typeof r._def.shape==`function`){let e=r._def.shape();for(let[r,i]of Object.entries(e))xo(r,i,t,n)}else if(typeof e==`object`&&e&&`properties`in e){let r=e.properties;typeof r==`object`&&r&&Co(r,t,n)}}function To(e,t){let n={},r=typeof e?.components?.values==`function`?Array.from(e.components.values()):Array.isArray(e)?e:Array.from(e.values());for(let e of r){let r={singleRefs:/* @__PURE__ */ new Set,listRefs:/* @__PURE__ */ new Set,nestedRefs:{}};wo(e.schema,r,t),n[e.name]={singleRefs:r.singleRefs,listRefs:r.listRefs,nestedRefs:r.nestedRefs}}return n}var Eo=Symbol.for(`preact-signals`);function Do(){if(Mo>1)Mo--;else{var e,t=!1;for((function(){var e=Io;for(Io=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();jo!==void 0;){var n=jo;for(jo=void 0,No++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Vo(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(No=0,Mo--,t)throw e}}function Oo(e){if(Mo>0)return e();Fo=++Po,Mo++;try{return e()}finally{Do()}}var ko,K=void 0;function Ao(e){var t=K,n=ko;K=void 0,ko=void 0;try{return e()}finally{K=t,ko=n}}var jo=void 0,Mo=0,No=0,Po=0,Fo=0,Io=void 0,Lo=0;function Ro(e){if(K!==void 0){var t=e.n;if(t===void 0||t.t!==K)return t={i:0,S:e,p:K.s,n:void 0,t:K,e:void 0,x:void 0,r:t},K.s!==void 0&&(K.s.n=t),K.s=t,e.n=t,32&K.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=K.s,t.n=void 0,K.s.n=t,K.s=t),t}}function zo(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}zo.prototype.brand=Eo,zo.prototype.h=function(){return!0},zo.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?Ao(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},zo.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Ao(function(){var e;(e=t.Z)==null||e.call(t)}))}},zo.prototype.subscribe=function(e){var t=this;return Xo(function(){var n=t.value;Ao(function(){return e(n)})},{name:`sub`})},zo.prototype.valueOf=function(){return this.value},zo.prototype.toString=function(){return this.value+``},zo.prototype.toJSON=function(){return this.value},zo.prototype.peek=function(){var e=this;return Ao(function(){return e.value})},Object.defineProperty(zo.prototype,"value",{get:function(){var e=Ro(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(No>100)throw Error(`Cycle detected`);(function(e){Mo!==0&&No===0&&e.l!==Fo&&(e.l=Fo,Io={S:e,v:e.v,i:e.i,o:Io})})(this),this.v=e,this.i++,Lo++,Mo++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Do()}}}});function Bo(e,t){return new zo(e,t)}function Vo(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Ho(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Uo(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Wo(e,t){zo.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Lo-1,this.f=4}Wo.prototype=new zo,Wo.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Lo))return!0;if(this.g=Lo,this.f|=1,this.i>0&&!Vo(this))return this.f&=-2,!0;var e=K;try{Ho(this),K=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return K=e,Uo(this),this.f&=-2,!0},Wo.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}zo.prototype.S.call(this,e)},Wo.prototype.U=function(e){if(this.t!==void 0&&(zo.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Wo.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Wo.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=Ro(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Go(e,t){return new Wo(e,t)}function Ko(e){var t=e.j;if(e.j=void 0,typeof t==`function`){Mo++;var n=K;K=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,qo(e),t}finally{K=n,Do()}}}function qo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ko(e)}function Jo(e){if(K!==this)throw Error(`Out-of-order effect`);Uo(this),K=e,this.f&=-2;try{8&this.f&&qo(this)}finally{Do()}}function Yo(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,ko&&ko.push(this)}Yo.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.j=t)}finally{e()}},Yo.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Ko(this),Ho(this),Mo++;var e=K;return K=this,Jo.bind(this,e)},Yo.prototype.N=function(){2&this.f||(this.f|=2,this.u=jo,jo=this)},Yo.prototype.d=function(){this.f|=8,1&this.f||qo(this)},Yo.prototype.dispose=function(){this.d()};function Xo(e,t){var n=new Yo(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Zo,Qo,$o,es,ts,ns,rs,is;as({signal:Bo,computed:Go,effect:Xo,batchWrite:Oo,isSignal:e=>typeof e==`function`||!!e&&typeof e==`object`&&(`value`in e||`peek`in e),getValue:e=>typeof e==`function`?e():e.value,setValue:(e,t)=>{if(typeof e?.set==`function`)e.set(t);else{if(e instanceof Wo||typeof e==`function`)throw TypeError(`Cannot set value of a read-only computed signal.`);e.value=t}},peekValue:e=>typeof e?.peek==`function`?e.peek():typeof e==`function`?e():e&&typeof e==`object`&&`value`in e?e.value:e});function as(e){Zo=e.signal,Qo=e.computed,$o=e.effect,es=e.batchWrite,ts=e.isSignal,ns=e.getValue,rs=e.setValue,is=e.peekValue}function os(e){return Zo(e)}function ss(e){return Qo(e)}function cs(e){return $o(e)}function ls(e){return es(e)}function us(e){return ts(e)}function ds(e){return ns(e)}function fs(e,t){rs(e,t)}function ps(e){return is(e)}function ms(e){return/^(0|[1-9]\d*)$/.test(e)}var hs=1e4,gs=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]),_s=class{constructor(e={}){this.data={},this.signals=/* @__PURE__ */ new Map,this.subscriptions=/* @__PURE__ */ new Set,this.data=e}getSignal(e){let t=this.normalizePath(e);return this.signals.has(t)||this.signals.set(t,os(this.get(t))),this.signals.get(t)}set(e,t,n=!1){if(e==null)throw new Ct(`Path cannot be null or undefined.`);let r=this.parsePath(e);if(r.length===0)return this.data=t??{},this.notifyAllSignals(),this;let i=r.pop(),a=t===void 0||!n&&t===null;if(a&&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 Ct(`Cannot set path '${e}': the data model root is a primitive value.`,e);let o=this.data;for(let t=0;t<r.length;t++){let n=r[t];if(Array.isArray(o)){if(!ms(n))throw new Ct(`Cannot use non-numeric segment '${n}' on an array in path '${e}'.`,e);let a=parseInt(n,10);if(a>1e4)throw new Ct(`Cannot set path '${e}': array index '${n}' exceeds maximum supported index (${hs}).`,e);let s=o[a];if(s!=null&&typeof s!=`object`)throw new Ct(`Cannot set path '${e}': segment '${n}' is a primitive value.`,e);if(s==null){let n=t<r.length-1?r[t+1]:i;if(ms(n)){if(parseInt(n,10)>1e4)throw new Ct(`Cannot set path '${e}': array index '${n}' exceeds maximum supported index (${hs}).`,e);o[a]=[]}else o[a]={}}}else{let a=Object.prototype.hasOwnProperty.call(o,n);if(a){let t=o[n];if(t!=null&&typeof t!=`object`)throw new Ct(`Cannot set path '${e}': segment '${n}' is a primitive value.`,e)}if(!a||o[n]===void 0||o[n]===null){let a=t<r.length-1?r[t+1]:i;if(ms(a)){if(parseInt(a,10)>1e4)throw new Ct(`Cannot set path '${e}': array index '${a}' exceeds maximum supported index (${hs}).`,e);o[n]=[]}else o[n]={}}}o=o[n]}if(Array.isArray(o)){if(!ms(i))throw new Ct(`Cannot use non-numeric segment '${i}' on an array in path '${e}'.`,e);if(parseInt(i,10)>1e4)throw new Ct(`Cannot set path '${e}': array index '${i}' exceeds maximum supported index (${hs}).`,e)}if(a){if(Array.isArray(o)){let e=parseInt(i,10);e<o.length&&(o[e]=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 Ct(`Path cannot be null or undefined.`);if(e===`/`||e===``)return this.data;let t=this.parsePath(e),n=this.data;for(let e of t){if(typeof n!=`object`||!n)return;if(Array.isArray(n)){if(!ms(e))return;let t=parseInt(e,10);if(t<0||t>=n.length)return;n=n[t]}else{if(!Object.prototype.hasOwnProperty.call(n,e))return;n=n[e]}}return n}hasPath(e){return e!=null&&this.get(e)!==void 0}subscribe(e,t){let n=this.getSignal(e),r=!0,i=ps(n),a=cs(()=>{let e=ds(n);i=e,r||t(e)});return r=!1,this.subscriptions.add(a),{get value(){return i},unsubscribe:()=>{a(),this.subscriptions.delete(a)}}}dispose(){for(let e of this.subscriptions)e();this.subscriptions.clear(),this.signals.clear()}normalizePath(e){let t=e.split(`/`).filter(e=>e.length>0);return t.length===0?`/`:`/${t.join(`/`)}`}parsePath(e){return e.split(`/`).filter(e=>e.length>0).map(t=>{let n=t.replace(/~([01])/g,(e,t)=>t===`1`?`/`:`~`);if(gs.has(n))throw new Ct(`Forbidden path segment '${n}' in path '${e}'.`,e);return n})}notifySignals(e){let t=this.normalizePath(e);ls(()=>{this.updateSignal(t);let e=t;for(;e!==`/`&&e!==``;)e=e.substring(0,e.lastIndexOf(`/`))||`/`,this.updateSignal(e);for(let e of this.signals.keys())this.isDescendant(e,t)&&this.updateSignal(e)})}updateSignal(e){let t=this.signals.get(e);if(t){let n=this.get(e);Array.isArray(n)?fs(t,n.slice()):typeof n==`object`&&n?fs(t,{...n}):fs(t,n)}}notifyAllSignals(){ls(()=>{for(let e of this.signals.keys())this.updateSignal(e)})}isDescendant(e,t){return t===`/`||t===``?e!==`/`:e.startsWith(t+`/`)}},vs=1e3;L({component:P().describe(`The type name of the component.`),id:vt(()=>rn).optional(),weight:F().optional()}).passthrough().describe(`A generic A2UI component definition.`);function ys(e,t,n){if(t!==void 0){let n=e.availableCatalogs?.get(t);if(!n)throw new Tt(`Catalog not found: ${t}`);return n}if(!e.defaultCatalog)throw new Tt(`${n} names no catalogId and surface '${e.id}' has no default catalogId.`);return e.defaultCatalog}var bs=/* @__PURE__ */ new WeakMap,xs=`a2ui:system-functions`,Ss;function Cs(){return Ss??=new nc(xs,Vt.V1_0,[],Js),Ss}function ws(e){if(bs.has(e))return bs.get(e);let t=(()=>{let t=e;for(;t;){if(t instanceof Ue||t._def?.typeName===`ZodObject`){if(t._def?.unknownKeys===`passthrough`)return null;let e=typeof t.shape==`function`?t.shape():t.shape;return e&&typeof e==`object`?new Set(Object.keys(e)):null}if(t instanceof it||t._def?.typeName===`ZodEffects`)t=t._def.schema;else if(t instanceof at||t instanceof ot||t._def?.typeName===`ZodOptional`||t._def?.typeName===`ZodNullable`)t=t._def.innerType;else if(t instanceof st||t._def?.typeName===`ZodDefault`)t=t._def.innerType;else if(t instanceof ct||t._def?.typeName===`ZodCatch`)t=t._def.innerType;else{if(t instanceof Ke||t._def?.typeName===`ZodIntersection`){let e=ws(t._def.left),n=ws(t._def.right);return!e||!n?null:/* @__PURE__ */ new Set([...e,...n])}if(t instanceof We||t._def?.typeName===`ZodUnion`){let e=t._def.options,n=/* @__PURE__ */ new Set;for(let t of e){let e=ws(t);if(!e)return null;for(let t of e)n.add(t)}return n}return null}}return null})();return bs.set(e,t),t}function Ts(e,t,n){if(!t||typeof t!=`object`||Array.isArray(t))return;let r=Object.keys(t);if(r.length>1e3)throw new V(`Function call '${e}' exceeds maximum allowed arguments count (${vs})`,e);let i=n?.functions?.get?.(e)??(e===`@index`&&n?.protocolVersion&&H(n.protocolVersion,Vt.V1_0)?Ks:void 0);if(!i?.schema)return;let a=ws(i.schema);if(a){for(let t of r)if(!a.has(t))throw new V(`Unknown argument '${t}' passed to function '${e}'`,e);if(r.length>a.size)throw new V(`Too many arguments for function '${e}': expected at most ${a.size}, received ${r.length}`,e)}}function Es(e){return e.startsWith(`@`)&&!e.startsWith(`@@`)}function Ds(e){return e.startsWith(`@@`)?e.slice(1):e}var Os=/* @__PURE__ */ new Set([`@path`,`@call`]);function ks(e,t){if(H(t,`1.0`)){for(let t of e)if(Es(t)&&!Os.has(t))throw new B(`Unrecognized reserved protocol directive '${t}' in v1.0 dynamic object. Reserved keys must be in ${Array.from(Os).join(`, `)}, or escaped with prefix doubling (e.g. '@${t}').`,void 0,`INVALID_RESERVED_KEY`)}}function As(e){let t=e;for(;t;){if(t.explicitIndex!==void 0&&Number.isFinite(t.explicitIndex))return t.explicitIndex;if(!(t instanceof Ms)&&typeof t.getIndex==`function`){let e=t.getIndex();if(e!==void 0&&Number.isFinite(e))return e}if(!(t instanceof Ms)&&typeof t.index==`number`&&Number.isFinite(t.index))return t.index;if(typeof t.path==`string`){let e=t.path.split(`/`).filter(Boolean);if(e.length>0&&/^\d+$/.test(e[e.length-1]))return parseInt(e[e.length-1],10)}t=t.parent}}var js=1e3,Ms=class e{constructor(e,t,n,r){this.path=t,this._isUserActivated=!1,this._isPassiveEvaluation=!1,this._isActionExecution=!1,e instanceof _s?(this.surface=void 0,this.dataModel=e,this.functionInvoker=()=>void 0):(this.surface=e,this.dataModel=e.dataModel,this.functionInvoker=e.defaultCatalog?.invoker??((t,...n)=>ys(e,void 0,`Function call '${t}'`).invoker(t,...n))),this.explicitIndex=n,this.parent=r,this.warnedPaths=r?r.warnedPaths:/* @__PURE__ */ new Set}get isUserActivated(){return this._isUserActivated||!!this.parent?.isUserActivated}get isPassiveEvaluation(){return this._isPassiveEvaluation||!!this.parent?.isPassiveEvaluation}getIndex(){return As(this)}get index(){return this.getIndex()}set(e,t){let n=this.resolvePath(e),r=!(!this.surfaceProtocolVersion||this.atLeastV10);this.dataModel.set(n,t,r)}get surfaceProtocolVersion(){return this.surface?.protocolVersion??this.surface?.defaultCatalog?.protocolVersion}get atLeastV10(){return this._cachedAtLeastV10===void 0&&(this._cachedAtLeastV10=H(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(typeof e!=`object`||!e||Rt(e))return!1;if(Array.isArray(e))return e.some(e=>this.containsDynamicValue(e));let t=e;if(this.isDataBindingObject(t)||this.isFunctionCallObject(t))return!0;if(this.atLeastV10){for(let e of Object.keys(t))if(e.startsWith(`@`))return!0}return Object.values(t).some(e=>this.containsDynamicValue(e))}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>1e3){let e=new V(`Maximum dynamic value nesting depth exceeded (${js})`);this.dispatchExpressionError(e,`DynamicValue`);return}if(typeof e!=`object`||!e||Rt(e))return e;if(Array.isArray(e))return this.containsDynamicValue(e)?e.map(e=>this.resolveDynamicValue(e,t+1,n)):e;let r=e;if(this.isDataBindingObject(r)){let e=r[`@path`]??r.path,t=this.resolvePath(e),n=this.dataModel.get(t);return n===void 0&&this.emitMissingDataBindingWarning(t),n}return this.isFunctionCallObject(r)?this.resolveFunctionCallValue(r,t,n):this.resolvePlainObjectValue(r,t,n)}resolveFunctionCallValue(e,t=0,n=!1){let r=e[`@call`]??e.call,i=this.resolveCallCatalog(r,e);if(!i)return;try{Ts(r,e.args,i)}catch(e){this.dispatchExpressionError(e,r);return}let a={};for(let[r,i]of Object.entries(e.args??{}))a[r]=this.resolveDynamicValue(i,t+1,n);let o=new AbortController,s=this._isUserActivated;this._isUserActivated=s||n;let c;try{c=this.evaluateFunctionReactive(r,a,i.invoker,o.signal)}finally{this._isUserActivated=s}if(c!==void 0)return Rt(c)?t>0?c:Promise.resolve(c).then(e=>e,e=>{this.dispatchExpressionError(e,r)}):us(c)?ps(c):c}resolvePlainObjectValue(e,t=0,n=!1){if(this.atLeastV10&&ks(Object.keys(e),this.surfaceProtocolVersion),!this.containsDynamicValue(e))return e;let r={};for(let[i,a]of Object.entries(e)){let e=this.atLeastV10?Ds(i):i;r[e]=this.resolveDynamicValue(a,t+1,n)}return r}subscribeDynamicValue(e,t){let n=this.resolveSignal(e),r=!0,i=ps(n),a=cs(()=>{let e=ds(n);i=e,r||t(e)});return r=!1,{get value(){return i},unsubscribe:()=>{a(),n.unsubscribe?.()}}}resolveSignal(e,t=0){if(t>1e3){let t=new V(`Maximum dynamic value nesting depth exceeded (${js})`);return this.dispatchExpressionError(t,typeof e==`object`&&e&&(`@call`in e||`call`in e)?e[`@call`]??e.call:`DynamicValue`),os(void 0)}if(typeof e!=`object`||!e)return os(e);if(Rt(e)){let t=os(void 0);return this.settleIntoSignal(t,e,`DynamicValue`),t}if(Array.isArray(e)){if(!this.containsDynamicValue(e))return os(e);let n=e.map(e=>this.resolveSignal(e,t+1)),r=ss(()=>n.map(e=>ds(e)));return r.unsubscribe=()=>{for(let e of n)e.unsubscribe?.()},r}let n=e;if(this.isDataBindingObject(n)){let e=n[`@path`]??n.path,t=this.resolvePath(e);return this.emitMissingDataBindingWarning(t),this.dataModel.getSignal(t)}if(this.isFunctionCallObject(n)){let e=n,r=e[`@call`]??e.call,i=this.resolveCallCatalog(r,e);if(!i)return os(void 0);try{Ts(r,e.args,i)}catch(e){return this.dispatchExpressionError(e,r),os(void 0)}let a={};for(let[n,r]of Object.entries(e.args??{}))a[n]=this.resolveSignal(r,t+1);if(Object.keys(a).length===0){let e=new AbortController,t=this.evaluateFunctionPassive({name:r,args:{},abortSignal:e.signal,invoker:i.invoker}),n;if(us(t))n=t;else if(Rt(t)){let i=os(void 0);this.settleIntoSignal(i,t,r,e.signal),n=i}else n=os(t);return n.unsubscribe=()=>e.abort(),n}let o=Object.keys(a),s=os(void 0),c,l,u=ss(()=>{let e={};for(let t=0;t<o.length;t++)e[o[t]]=ds(a[o[t]]);return e}),d=cs(()=>{try{let e=ds(u);c&&c.abort(),l&&=(l(),void 0),c=new AbortController;let t=this.evaluateFunctionPassive({name:r,args:e,abortSignal:c.signal,invoker:i.invoker});us(t)?(fs(s,ps(t)),l=cs(()=>{fs(s,ds(t))})):Rt(t)?this.settleIntoSignal(s,t,r,c.signal):fs(s,t)}catch(e){this.dispatchExpressionError(e,r),fs(s,void 0)}});return s.unsubscribe=()=>{d(),l&&l(),c&&c.abort();for(let e=0;e<o.length;e++)a[o[e]].unsubscribe?.()},s}if(this.atLeastV10&&ks(Object.keys(n),this.surfaceProtocolVersion),!this.containsDynamicValue(n))return os(e);let r=Object.entries(n).map(([e,n])=>[this.atLeastV10?Ds(e):e,this.resolveSignal(n,t+1)]),i=ss(()=>{let e={};for(let[t,n]of r)e[t]=ds(n);return e}),a=i.unsubscribe?.bind(i);return i.unsubscribe=()=>{a?.();for(let[,e]of r)e.unsubscribe?.()},i}handleInvalidAction(e){this.surface?.dispatchError({code:`INVALID_ACTION`,surfaceId:this.surface?.id,message:e})}resolveActionEventObject(e){if(typeof e.name!=`string`||e.name.length===0)return this.handleInvalidAction(`Action event is missing required 'name' string.`);let t;if(e.context&&typeof e.context==`object`&&!Array.isArray(e.context)){t={};for(let[n,r]of Object.entries(e.context))t[n]=this.resolveDynamicValue(r)}let n={...e,...t===void 0?{}:{context:t}};if(e.context===void 0&&delete n.context,e.userMessage!==void 0){let t=this.resolveDynamicValue(e.userMessage);if(typeof t!=`string`)return this.handleInvalidAction(`Action event 'userMessage' must resolve to a string.`);n.userMessage=t}return n}executeActionFunctionCall(e,t){let n=`functionCall`in e?e.functionCall:e;if(n&&typeof n==`object`){let e=n[`@call`]??n.call;typeof e==`string`&&(n=this.atLeastV10&&!(`@call`in n)?{"@call":e,...n}:!this.atLeastV10&&!(`call`in n)?{call:e,...n}:n)}let r=t?.userActivation??!0,i=this._isActionExecution,a=this._isPassiveEvaluation;this._isActionExecution=!0,t?.userActivation===!1&&(this._isPassiveEvaluation=!0);try{return this.resolveDynamicValue(n,0,r)}finally{this._isActionExecution=i,this._isPassiveEvaluation=a}}resolveAction(e,t){if(`event`in e&&typeof e.event==`object`&&e.event!==null){let t=this.resolveActionEventObject(e.event);return t===void 0?void 0:{...e,event:t}}return`name`in e?this.resolveActionEventObject(e):`functionCall`in e||`call`in e||`@call`in e?this.executeActionFunctionCall(e,t):e}resolveFunctionCatalog(e,t,n){if(this.atLeastV10&&e.startsWith(`@`)){if(n)throw new V(`System function '${e}' belongs to no catalog and must not name a catalogId.`,e);return Cs()}if(!this.surface)throw new Tt(`No surface available to resolve catalog: ${t??`default`}`);return ys(this.surface,this.atLeastV10?t:void 0,`Function call '${e}'`)}resolveCallCatalog(e,t){try{return this.resolveFunctionCatalog(e,t.catalogId,`catalogId`in t)}catch(t){t instanceof Tt&&this.surface?this.surface.dispatchError({code:`CATALOG_ERROR`,message:t.message,expression:e}):this.dispatchExpressionError(t,e);return}}evaluateFunctionPassive(e){let{name:t,args:n,invoker:r,abortSignal:i}=e,a=this._isPassiveEvaluation;this._isPassiveEvaluation=!0;try{return this.evaluateFunctionReactive(t,n,r,i)}finally{this._isPassiveEvaluation=a}}evaluateFunctionReactive(e,t,n,r){try{return n(e,t,this,r)}catch(t){this.dispatchExpressionError(t,e);return}}settleIntoSignal(e,t,n,r){Promise.resolve(t).then(t=>{r?.aborted||fs(e,t)},t=>{r?.aborted||(this.dispatchExpressionError(t,n),fs(e,void 0))})}dispatchExpressionError(e,t){if(this.surface){if(e instanceof g||typeof e==`object`&&e&&e.name===`ZodError`){let n=e,r=new V(`Validation failed for function '${t}': ${n.message}`,t,n.errors??n.issues);this.surface.dispatchError({code:`EXPRESSION_ERROR`,message:r.message,expression:t,details:r.details})}else if(e instanceof V)this.surface.dispatchError({code:`EXPRESSION_ERROR`,message:e.message,expression:e.expression,details:e.details});else{let n=typeof e==`object`&&e?e:{};this.surface.dispatchError({code:this._isActionExecution?`EXECUTION_ERROR`:`EXPRESSION_ERROR`,message:n.message??`An unexpected error occurred in function ${t}.`,expression:t})}}}nested(t,n){let r=this.resolvePath(t);return new e(this.surface??this.dataModel,r,n,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}`)}},Ns=tn(P().describe(`REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.`),`component-id`),Ps=P().describe(`REF:#/$defs/CallId|The unique identifier for a function call.`),Fs=L({"@path":P().describe(`A JSON Pointer path to a value in the data model.`).optional(),path:P().describe(`A JSON Pointer path to a value in the data model.`).optional()}).refine(e=>e[`@path`]!==void 0||e.path!==void 0,{message:`Either '@path' or 'path' must be provided.`}).describe(`REF:#/$defs/DataBinding`),Is=L({"@call":P().describe(`The name of the function to call.`).optional(),call:P().describe(`The name of the function to call.`).optional(),catalogId:P().describe(`The catalog ID for this function, overriding any surface-level default catalogId.`).optional()}).refine(e=>e[`@call`]!==void 0||e.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.`),Ls=_t(P(),mt()).and(gt(Is,mt())).describe(`REF:#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition.`),Rs=R([P(),Fs,Ls]).describe(`REF:#/$defs/DynamicString|Represents a string`),zs=R([pt(),Fs,Ls]).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).`),Bs=L({label:Rs.optional(),description:Rs.optional(),live:z([`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:zs.optional()}).strict().describe(`REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.`),Vs=_t(P(),ht()).superRefine((e,t)=>{for(let n in e)Ut(n)||t.addIssue({path:[n],code:h.custom,message:`Invalid extension key "${n}": 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.`),Hs=L({id:Ns,catalogId:P().describe(`The catalog ID for this component, overriding any surface-level default catalogId.`).optional(),accessibility:Bs.optional(),metadata:L({extensions:Vs.optional()}).strict().describe(`Optional component-level metadata for vendor extensions.`).optional()}).describe(`REF:#/$defs/ComponentCommon`);tn(R([I(Ns).describe(`A static list of child component IDs.`),L({componentId:Ns,path:P().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`);var Us=R([P(),F(),pt(),I(mt()),_t(P(),ht()).refine(e=>!e||!(`@path`in e)&&!(`path`in e)&&!(`@call`in e)&&!(`call`in e)),Fs,Ls]).describe(`REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.`),Ws=R([F(),Fs,Ls]).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.`);R([I(P()),Fs,Ls]).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.`),L({"@call":yt(`@index`).optional(),call:yt(`@index`).optional(),args:L({offset:Ws.optional()}).optional()}).refine(e=>e[`@call`]!==void 0||e.call!==void 0,{message:`Either '@call' or 'call' must be '@index'.`}).describe(`REF:#/$defs/IndexSystemFunction`),L({checks:I(L({condition:R([Fs,Ls]).describe(`Path or function call evaluating to a structured validation result object or a boolean.`),message:P().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).`)).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.`),R([L({event:L({name:P().describe(`The name of the action to be dispatched to the agent.`),userMessage:Rs.optional(),context:_t(P(),Us).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.`),L({functionCall:Ls}).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.`),L({component:yt(`Surface`).optional(),child:yt(`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'.`);var Gs=L({functionCallId:Ps,value:mt().describe(`The return value of the function.`).optional(),error:L({code:P(),message:P()}).strict().describe(`An error object indicating failure of the function execution.`).optional()}).strict().superRefine((e,t)=>{let n=`value`in e,r=`error`in e;(n&&r||!n&&!r)&&t.addIssue({code:h.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.`),Ks={name:`@index`,returnType:`number`,allowedCallers:`rendererOnly`,schema:L({offset:R([Fs,Ls,xt.number()]).optional()})},qs=q(Ks,(e,t)=>{let n=typeof e.offset==`number`&&Number.isFinite(e.offset)?e.offset:0,r=As(t);if(r===void 0||!Number.isFinite(r))throw new B(`@index function can only be evaluated inside a collection template iteration scope.`);return r+n}),Js=[qs],Ys=/^REF:[^|#]*#\/\$defs\/DynamicBoolean(?:\||$)/;function Xs(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.valid;return typeof t==`boolean`?t:void 0}function Zs(e){let t=e._def;switch(t.typeName){case`ZodOptional`:case`ZodNullable`:case`ZodDefault`:case`ZodCatch`:case`ZodBranded`:case`ZodReadonly`:return t.innerType;case`ZodEffects`:return t.schema;case`ZodLazy`:return t.getter?.();default:return}}function Qs(e){let t=e;for(;t;){if(typeof t.description==`string`&&Ys.test(t.description))return!0;t=Zs(t)}return!1}function $s(e){let t=e;for(let e=Zs(t);e;e=Zs(t))t=e;return t}function ec(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tc(e,t){if(typeof t!=`object`||!t)return t;if(Qs(e))return Xs(t)??t;let n=$s(e),r=n._def;if(r.typeName===`ZodArray`&&Array.isArray(t)&&r.type){let e=r.type,n=!1,i=t.map(t=>{let r=tc(e,t);return n||=r!==t,r});return n?i:t}if(r.typeName===`ZodObject`&&ec(t)){let e=n.shape,r=!1,i={};for(let[n,a]of Object.entries(t)){let t=e[n],o=t?tc(t,a):a;r||=o!==a,i[n]=o}return r?i:t}return t}function q(e,t){return{name:e.name,returnType:e.returnType,schema:e.schema,allowedCallers:e.allowedCallers,requiresUserActivation:e.requiresUserActivation,description:e.description,execute:t}}var nc=class e{get validationSchema(){return this.cachedValidationSchema||=no(this),yi(this.cachedValidationSchema)}get catalogSchema(){return this.validationSchema}toJson(){return this.cachedDocument||=Hi(this),yi(this.cachedDocument)}withEntries(e,t){return this.rebuild(e,t,{id:this.id,schemaId:this.schemaId,title:this.title,description:this.description,instructions:this.instructions})}derive(e){let t=(t,n,r)=>r===void 0?[...n.values()]:r.map(r=>{if(typeof r!=`string`)return r;let i=n.get(r);if(!i)throw new Tt(`Catalog '${this.id}' has no ${t} '${r}' to derive catalog '${e.catalogId}' from.`);return i});return this.rebuild(t(`component`,this.components,e.components),t(`function`,this.functions,e.functions),{id:e.catalogId,instructions:e.instructions})}rebuild(t,n,r){let i=t.length!==this.components.size||t.some(e=>this.components.get(e.name)!==e),a=n.length!==this.functions.size||n.some(e=>this.functions.get(e.name)!==e),o=this.defs;if(o&&(i||a)){let e={...o};i&&delete e.anyComponent,a&&delete e.anyFunction,o=e}let s=this.unions?{anyComponent:this.unions.anyComponent||i,anyFunction:this.unions.anyFunction||a}:void 0;return new e(r.id,this.protocolVersion,t,n,{themeSchema:this.themeSchema,instructions:r.instructions,schemaUri:this.schemaUri,schemaId:r.schemaId,title:r.title,description:r.description,declaredProtocolVersion:this.declaredProtocolVersion,declaresCatalogId:this.declaresCatalogId,declaresComponents:this.declaresComponents,functionsLayout:this.functionsLayout,unions:s,defs:Di(o,[...this.components.values(),...this.functions.values()],[...t,...n],this.extensionFields),extensionFields:this.extensionFields,commonTypesUri:this.commonTypesUri,themeLocation:this.themeLocation,defModels:this.defModels})}get componentRefMap(){if(!this._componentRefMap){let e=H(this.protocolVersion,`1.0`)?zr:H(this.protocolVersion,`0.9`)?Lr:Fr;this._componentRefMap=To(this,e)}return this._componentRefMap}constructor(e,t,n,r,i,a){let o,s,c,l,u;if(typeof t==`string`?(o=t,s=n??[],c=r??[],l=i,u=a):(o=`0.9`,s=t??[],c=n??[],l=r,u=i),!o)throw new Tt(`protocolVersion must be provided.`);this.id=e,this.protocolVersion=o;let d=/* @__PURE__ */ new Map;for(let e of s)d.set(e.name,e);this.components=d;let f=/* @__PURE__ */ new Map;for(let e of c)f.set(e.name,e);this.functions=f;let p=rc(l)?{themeSchema:l}:l??{};this.themeSchema=p.themeSchema,this.instructions=p.instructions??u,this.schemaUri=p.schemaUri,this.schemaId=p.schemaId,this.title=p.title,this.description=p.description,this.declaredProtocolVersion=p.declaredProtocolVersion,this.declaresCatalogId=p.declaresCatalogId??!0,this.declaresComponents=p.declaresComponents??!0,this.functionsLayout=p.functionsLayout,this.unions=p.unions?Object.freeze({...p.unions}):void 0,this.defs=xi(p.defs),this.extensionFields=xi(p.extensionFields),this.commonTypesUri=p.commonTypesUri,this.themeLocation=p.themeLocation,this.defModels=p.defModels?Object.freeze([...p.defModels]):void 0,this.invoker=ic(this.id,this.protocolVersion,this.functions)}static fromJson(t,n,r){let{id:i,protocolVersion:a,components:o,functions:s,...c}=ha(t,n,r);return new e(i,a,o,s,c)}static fromSchema(t,n){return e.fromJson(t,n)}};function rc(e){return typeof e==`object`&&!!e&&typeof e.safeParse==`function`}function ic(e,t,n){return(r,i,a,o)=>{let s=n.get(r)??(H(t,Vt.V1_0)&&r===`@index`?qs:void 0);if(!s)throw new V(`Function not found in catalog '${e}': ${r}`,r);ac(s),oc(s,a);let c=s.execute;if(typeof c!=`function`)throw new V(`Function '${r}' in catalog '${e}' is schema-only and has no implementation.`,r);let l=e=>{try{let n=H(t,Vt.V1_0)?tc(s.schema,e):e,r=s.schema.parse(n);return c.call(s,r,a,o)}catch(e){throw e?.name===`ZodError`||e instanceof g?new V(`Validation failed for function '${r}': ${e.message}`,r,e.errors??e.issues):e}},u=Bt(i);return Rt(u)?Promise.resolve(u).then(e=>o?.aborted?void 0:l(e)):l(u)}}function ac(e){if(e.allowedCallers===`agentOnly`)throw new V(`Function '${e.name}' cannot be called by renderer (allowedCallers is agentOnly).`,e.name)}function oc(e,t){if(!e.requiresUserActivation)return;let n=!!t?.isPassiveEvaluation,r=!t?.isUserActivated&&typeof navigator<`u`&&!(navigator.userActivation?.isActive??!0);if(n||r)throw new V(`Function '${e.name}' requires user activation and cannot be evaluated without an active user gesture.`,e.name)}var sc=class{constructor(){this.listeners=/* @__PURE__ */ new Set}subscribe(e){return this.listeners.add(e),{unsubscribe:()=>this.listeners.delete(e)}}async emit(e){for(let t of this.listeners)try{let n=t(e);n&&typeof n.then==`function`&&await n}catch(e){console.error(`EventEmitter error:`,e)}}dispose(){this.listeners.clear()}},cc=/^(?:(?:\/(?:[^~/]|~[01])*)*|(?:[^~/]|~[01])+(?:\/(?:[^~/]|~[01])*)*)$/;function*lc(e,t,n){if(typeof e==`string`)yield[e,t];else if(Array.isArray(e))for(let r=0;r<e.length;r++){let i=e[r];yield*lc(i,`${t}[${r}]`,n)}else if(typeof e==`object`&&e){let r=e;if(`componentId`in r&&typeof r.componentId==`string`&&(`path`in r||`dataBinding`in r))yield[r.componentId,`${t}.componentId`];else if(n?.size)for(let e of n)e in r&&(yield*lc(r[e],`${t}.${e}`));else for(let[e,n]of Object.entries(r))yield*lc(n,`${t}.${e}`)}}function uc(e){return e.componentRefMap}function*dc(e,t){if(!e||typeof e!=`object`)return;let n=t instanceof nc?uc(t):t,r=e.component,i=``,a=e;if(typeof r==`string`)i=r;else if(typeof r==`object`&&r){let e=r;i=Object.keys(e)[0]??``,a=e[i]??{}}if(!i||typeof a!=`object`||!a)return;let o=n[i],s=o?o.singleRefs:/* @__PURE__ */ new Set,c=o?o.listRefs:/* @__PURE__ */ new Set,l=o?.nestedRefs;for(let[e,t]of Object.entries(a))(s.has(e)||c.has(e))&&(yield*lc(t,e,l?.[e]))}Object.freeze({allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1}),Object.freeze({allowOrphanComponents:!0,allowDanglingReferences:!0,allowMissingRoot:!0,allowUnknownElements:!0});function fc(e,t,n){if(t>50)throw new Dt(`Global recursion limit exceeded: Depth > 50`);if(Array.isArray(e))for(let r of e)fc(r,t+1,n);else if(typeof e==`object`&&e){let r=e;for(let e of[r.path,r[`@path`]])if(typeof e==`string`&&!cc.test(e))throw new B(`Invalid path syntax: '${e}'`);let i=`functionCall`in r&&typeof r.functionCall==`object`&&r.functionCall!==null,a=(`call`in r||`@call`in r)&&`args`in r;if(i){if(n>=5)throw new Dt(`Recursion limit exceeded: functionCall depth > 5`);for(let[e,i]of Object.entries(r))e===`functionCall`?fc(i,t+1,n+1):fc(i,t+1,n)}else if(a){if(n>=5)throw new Dt(`Recursion limit exceeded: functionCall depth > 5`);for(let[e,i]of Object.entries(r))e===`args`?fc(i,t+1,n+1):fc(i,t+1,n)}else for(let e of Object.values(r))fc(e,t+1,n)}}function pc(e){fc(e,0,0)}var mc=class{constructor(e){this.components=/* @__PURE__ */ new Map,this._onCreated=new sc,this._onDeleted=new sc,this.onCreated=this._onCreated,this.onDeleted=this._onDeleted,e&&this.setCatalog(e)}setCatalog(e){this.refMap=e instanceof nc?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 wt(`Component with id '${e.id}' already exists.`);this.components.set(e.id,e),this._onCreated.emit(e)}insertComponent(e,t){if(this.components.has(t.id))throw new wt(`Component with id '${t.id}' already exists.`);if(e<this.components.size){let n=[...this.components].slice(Math.max(0,e));for(let[e]of n)this.components.delete(e);this.components.set(t.id,t);for(let[e,t]of n)this.components.set(e,t)}else this.components.set(t.id,t);this._onCreated.emit(t)}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(dc(t.componentTree,n))}getChildIds(e){return this.getChildReferences(e).map(([e])=>e)}detectCycles(e={}){let t=e.rootId??`root`,n=e.maxDepth??50,r=e.allowMissingRoot??!1;for(let e of this.components.values())for(let[t,n]of this.getChildReferences(e.id))if(t===e.id)throw new Dt(`Circular reference detected: Component '${e.id}' references itself in field '${n}' (Self-reference detected)`);let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set,o=(e,t)=>{if(t>n)throw new Dt(`Global recursion limit exceeded: logical depth > ${n}`);i.add(e),a.add(e);let r=this.getChildIds(e);for(let e of r)if(this.components.has(e)){if(!i.has(e))o(e,t+1);else if(a.has(e))throw new Dt(`Circular reference detected involving component '${e}'`)}a.delete(e)};if(r){let e=Array.from(this.components.keys()).sort();for(let t of e)i.has(t)||o(t,0)}else this.components.has(t)&&o(t,0);return i}validateTopology(e={}){if(this.components.size===0)return;let t=e.rootId??`root`,n=e.allowMissingRoot??!1,r=e.allowDanglingReferences??!1,i=e.allowOrphanComponents??!1;if(!n&&!this.components.has(t))throw new Et(`Missing root component: No component has id='${t}'`);if(!r){for(let e of this.components.values())for(let[t,n]of this.getChildReferences(e.id))if(!this.components.has(t))throw new Et(`Component '${e.id}' references non-existent component '${t}' in field '${n}' (Dangling reference '${t}' in component '${e.id}')`)}let a=this.detectCycles({rootId:t,allowMissingRoot:n,maxDepth:e.maxDepth});if(!i&&!n&&a.size<this.components.size){let e=Array.from(this.components.keys()).filter(e=>!a.has(e)).sort();if(e.length>0)throw new Et(`Component '${e[0]}' is not reachable from '${t}' (Orphaned component '${e[0]}' is not reachable from root)`)}}validateReferences(e={}){let t=[];try{this.validateTopology(e)}catch(e){e instanceof B?t.push(e):e instanceof Error&&t.push(new B(e.message))}return t}dispose(){let e=Array.from(this.components.keys());for(let e of this.components.values())e.dispose();this.components.clear();for(let t of e)this._onDeleted.emit(t);this._onCreated.dispose(),this._onDeleted.dispose()}};function hc(e){if(!e)return;let t=Pt(e);return t?H(t,`1.0`)?t:`v${t}`:e}var gc=class{constructor(e,t,n=/* @__PURE__ */ new Map,r={},i=!1,a,o=`root`,s,c){this.id=e,this.defaultCatalog=t,this.rootId=o,this._onAction=new sc,this._onError=new sc,this._onWarning=new sc,this._onMetadataChanged=new sc,this.onAction=this._onAction,this.onError=this._onError,this.onWarning=this._onWarning,this.onMetadataChanged=this._onMetadataChanged,this._metadataSignal=os(Xt(s)),this.metadataSignal=ss(()=>ds(this._metadataSignal)),this.protocolVersion=hc(c??t?.protocolVersion);let l,u={},d=!1;if(n!=null&&!(n instanceof Map)){if(typeof n==`object`&&!Array.isArray(n))u=n,d=r===!0,a=i instanceof _s?i:void 0,l=void 0;else throw TypeError(`availableCatalogs must be a Map, or undefined/null. Note that availableCatalogs is now the 3rd argument to SurfaceModel and theme is the 4th argument.`)}else l=n,u=r??{},d=!!i;this.theme=u,this.sendDataModel=d;let f=new Map(l??[]);t?.id&&!f.has(t.id)&&f.set(t.id,t),this.availableCatalogs=f,this.dataModel=a??new _s({}),this.componentsModel=new mc(t)}get catalog(){return this.defaultCatalog}resolveCatalog(e,t=`Item`){return ys(this,e,t)}get metadata(){return ps(this._metadataSignal)}set metadata(e){let t=Xt(e);en(ps(this._metadataSignal),t)||(fs(this._metadataSignal,t),this._onMetadataChanged.emit(t))}get extensions(){return ps(this._metadataSignal)?.extensions}setExtension(e,t){if(t===void 0){this.removeExtension(e);return}let n=ps(this._metadataSignal),r={...n?.extensions??{},[e]:t};this.metadata={...n??{},extensions:r}}removeExtension(e){let t=ps(this._metadataSignal),n=t?.extensions;if(!n||!(e in n))return;let r={...n};delete r[e];let i={...t};delete i.extensions,this.metadata=Object.keys(r).length>0?{...i,extensions:r}:Object.keys(i).length>0?i:void 0}async dispatchAction(e,t,n){if(!e||typeof e!=`object`)return;let r=_c(e);if(!r)return;let i=r.name;if(!i||typeof i!=`string`)return;let a=r.context,o=a&&typeof a==`object`&&!Array.isArray(a)?a:{},s={name:i,surfaceId:this.id,sourceComponentId:t,timestamp:(/* @__PURE__ */ new Date()).toISOString(),context:o},c=r.catalogId??e.catalogId;typeof c==`string`&&c&&(s.catalogId=c),typeof r.userMessage==`string`&&r.userMessage.length>0&&(s.userMessage=r.userMessage);let l=Yt(r.metadata??e.metadata,n);l!==void 0&&(s.metadata=l),await this._onAction.emit(s)}async dispatchError(e){await this._onError.emit({...e,surfaceId:this.id})}async dispatchWarning(e){await this._onWarning.emit({...e,surfaceId:this.id})}dispose(){this.dataModel.dispose(),this.componentsModel.dispose(),this._onAction.dispose(),this._onError.dispose(),this._onWarning.dispose(),this._onMetadataChanged.dispose()}};function _c(e){return`event`in e&&e.event&&typeof e.event==`object`?e.event:`name`in e&&typeof e.name==`string`?e:null}var vc=class{constructor(){this.surfaces=/* @__PURE__ */ new Map,this.surfaceUnsubscribers=/* @__PURE__ */ new Map,this.surfaceErrorUnsubscribers=/* @__PURE__ */ new Map,this._onSurfaceCreated=new sc,this._onSurfaceDeleted=new sc,this._onAction=new sc,this._onError=new sc,this.onSurfaceCreated=this._onSurfaceCreated,this.onSurfaceDeleted=this._onSurfaceDeleted,this.onAction=this._onAction,this.onError=this._onError}emitError(e){this._onError.emit(e)}addSurface(e){if(this.surfaces.has(e.id)){console.warn(`Surface ${e.id} already exists. Ignoring.`);return}this.surfaces.set(e.id,e);let t=e.onAction.subscribe(e=>{this._onAction.emit(e)});this.surfaceUnsubscribers.set(e.id,t);let n=e.onError.subscribe(e=>{this._onError.emit(e)});this.surfaceErrorUnsubscribers.set(e.id,n),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));let r=this.surfaceErrorUnsubscribers.get(e);r&&(r.unsubscribe(),this.surfaceErrorUnsubscribers.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(),this._onError.dispose()}},yc=class{constructor(e,t,n,r,i){this.id=e,this.type=t,this._onUpdated=new sc,this._onMetadataChanged=new sc,this.onUpdated=this._onUpdated,this.onMetadataChanged=this._onMetadataChanged,this._properties=n,this.catalog=r,this._metadataSignal=os(Xt(i))}get metadataSignal(){return this._metadataSignal}get metadata(){return ps(this._metadataSignal)}set metadata(e){let t=Xt(e);en(ps(this._metadataSignal),t)||(fs(this._metadataSignal,t),this._onMetadataChanged.emit(t))}get extensions(){return ps(this._metadataSignal)?.extensions}setExtension(e,t){if(t===void 0){this.removeExtension(e);return}let n=ps(this._metadataSignal),r={...n?.extensions??{},[e]:t};this.metadata={...n??{},extensions:r}}removeExtension(e){let t=ps(this._metadataSignal),n=t?.extensions;if(!n||!(e in n))return;let r={...n};delete r[e];let i={...t};delete i.extensions,this.metadata=Object.keys(r).length>0?{...i,extensions:r}:Object.keys(i).length>0?i:void 0}get properties(){return this._properties}set properties(e){this._properties=e,this._onUpdated.emit(this)}applyUpdate(e,t){let n=Xt(t),r=!$t(this._properties,e),i=!en(ps(this._metadataSignal),n);r&&(this._properties=e),i&&fs(this._metadataSignal,n),r&&this._onUpdated.emit(this),i&&this._onMetadataChanged.emit(n)}dispose(){this._onUpdated.dispose(),this._onMetadataChanged.dispose()}get componentTree(){let e=this.metadata;return{...this._properties,id:this.id,component:this.type,...e===void 0?{}:{metadata:e}}}},bc=[`createSurface`,`updateComponents`,`updateDataModel`,`deleteSurface`,`callRendererFunction`,`agentFunctionResponse`,`beginRendering`,`surfaceUpdate`,`dataModelUpdate`];function xc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Sc(e,t){if(!xc(e))return{version:t};let n=typeof e.version==`string`?e.version:t,r=bc.find(t=>Object.hasOwn(e,t));if(!r)return{version:n};let i=r===`callRendererFunction`,a=e[r];return xc(a)?{surfaceId:typeof a.surfaceId==`string`?a.surfaceId:void 0,functionCallId:typeof a.functionCallId==`string`?a.functionCallId:void 0,actionType:r,isCallRendererFunction:i,version:n}:{actionType:r,isCallRendererFunction:i,version:n}}function Cc(e){return e.length>0&&bc.includes(e[0])?e.slice(1):e}function wc(e){if(!e)return;if(e.startsWith(`/`))return e;let t=e.replace(/\[(\d+)\]/g,`/$1`).replace(/\./g,`/`).replace(/^\/+/,``);if(!t)return`/`;let n=Cc(t.split(`/`).filter(Boolean));return n.length>0?`/${n.join(`/`)}`:void 0}function Tc(e,t){let n=[];for(let r of e)if(r.code===h.invalid_union&&`unionErrors`in r){let e=r.unionErrors.flatMap(e=>e.issues);n.push(...Tc(e,t))}else n.push(r);if(!t)return n;let r=n.filter(e=>e.path[0]===t&&e.path.length>1);return r.length>0?r:n}function Ec(e,t){let n;if(e instanceof g)n=e.issues;else if(Array.isArray(e)&&e.length>0){let t=e[0];if(typeof t?.path==`string`)return wc(t.path);Array.isArray(t?.path)&&(n=e)}if(!n||n.length===0)return;let r=Tc(n,t)[0];if(!r)return;let i=r.path.map(e=>String(e).replace(/~/g,`~0`).replace(/\//g,`~1`));r.code===h.unrecognized_keys&&`keys`in r&&Array.isArray(r.keys)&&r.keys.length>0&&i.push(String(r.keys[0]).replace(/~/g,`~0`).replace(/\//g,`~1`));let a=Cc(i);return a.length>0?`/${a.join(`/`)}`:void 0}function Dc(e){return e===`v0.8`||e===`0.8`?`v0.8`:e===`v0.9.1`||e===`0.9.1`?`v0.9.1`:e&&H(e,`1.0`)?`1.0`:`v0.9`}function Oc(e,t){return e instanceof Dt?`RECURSION_LIMIT_EXCEEDED`:e instanceof Et||e instanceof wt?`INTEGRITY_ERROR`:e instanceof Tt?`CATALOG_NOT_FOUND`:e instanceof Ct?`DATA_ERROR`:e instanceof V?`EXPRESSION_ERROR`:e instanceof B?(e.code===`UNALLOWED_PARENT`||e.code===`UNALLOWED_CHILD`)&&t?e.code:`VALIDATION_FAILED`:e instanceof St&&e.code||`INTERNAL_ERROR`}function kc(e,t={}){let n=Dc(t.version),r=n===`1.0`,i=e instanceof St?e:void 0,a=e instanceof Error?e.message:String(e),o=i?.functionCallId??t.functionCallId;if(e instanceof kt||r&&(t.isCallRendererFunction||t.actionType===`callRendererFunction`||o!==void 0)){let r=e instanceof kt?e.code:`INVALID_FUNCTION_CALL`;return o===void 0?{version:n,error:{code:r,surfaceId:i?.surfaceId??t.surfaceId??``,message:a}}:{version:n,error:{code:r,functionCallId:o,message:a}}}let s=Oc(e,r),c=i?.surfaceId??t.surfaceId??``,l=wc(i?.path??(e instanceof B?Ec(e.details,t.actionType):void 0));return l===void 0&&(s===`VALIDATION_FAILED`||s===`UNALLOWED_PARENT`||s===`UNALLOWED_CHILD`)&&(l=`/`),{version:n,error:{code:s,surfaceId:c,...l===void 0?{}:{path:l},message:a}}}var Ac=class e{constructor(){this.children=/* @__PURE__ */ new Map,this.parents=/* @__PURE__ */ new Map,this.heights=/* @__PURE__ */ new Map,this.maxHeight=0}static of(t){let n=new e;for(let[e,r]of t)n.setChildren(e,r);let r=/* @__PURE__ */ new Set;for(let e of t.keys()){if(n.heights.has(e))continue;let i=[{id:e,childIndex:0,height:0}];for(r.add(e);i.length>0;){let e=i[i.length-1],a=n.children.get(e.id)??[],o=!0;for(;e.childIndex<a.length;){let s=a[e.childIndex];if(e.childIndex++,!t.has(s))continue;let c=n.heights.get(s);if(c===void 0){if(r.has(s))return;e.childIndex--,i.push({id:s,childIndex:0,height:0}),r.add(s),o=!1;break}c>=e.height&&(e.height=c+1)}o&&(n.heights.set(e.id,e.height),e.height>n.maxHeight&&(n.maxHeight=e.height),r.delete(e.id),i.pop())}}return n}childrenOf(e){return this.children.get(e)??[]}parentsOf(e){return this.parents.get(e)??/* @__PURE__ */ new Set}setChildren(e,t){for(let t of this.children.get(e)??[])this.parents.get(t)?.delete(e);for(let n of t){let t=this.parents.get(n);t||(t=/* @__PURE__ */ new Set,this.parents.set(n,t)),t.add(e)}this.children.set(e,t)}admits(e,t,n){for(let[t,n]of e)this.setChildren(t,n);if(this.maxHeight>t)return!1;for(let[t,n]of e)if(n.includes(t))return!1;let r=t=>e.has(t)||n(t),i=[];for(let[t,n]of e){let e=0;for(let t of n){let n=this.heights.get(t)??0;r(t)&&n>=e&&(e=n+1)}this.heights.set(t,e),i.push(t)}for(let e=0;e<i.length;e++){let n=i[e],r=this.heights.get(n)??0;if(r>t)return!1;r>this.maxHeight&&(this.maxHeight=r);for(let e of this.parents.get(n)??[])(this.heights.get(e)??0)<=r&&(this.heights.set(e,r+1),i.push(e))}return!0}},jc=class e{constructor(){this.count=0,this.seenCatalogs=/* @__PURE__ */ new Set}static of(t){let n=Mc.get(t);return n||(n=new e,n.watch(t),Mc.set(t,n)),n}get changes(){return this.count}get catalogs(){return this.seenCatalogs}watch(e){let t=/* @__PURE__ */ new Map,n=()=>{this.count++},r=e=>{this.seenCatalogs.add(e.catalog),t.get(e.id)?.unsubscribe(),t.set(e.id,e.onUpdated.subscribe(n))};for(let t of e.values)r(t);e.onCreated.subscribe(e=>{this.count++,r(e)}),e.onDeleted.subscribe(e=>{this.count++,t.get(e)?.unsubscribe(),t.delete(e)})}},Mc=/* @__PURE__ */ new WeakMap,Nc=/* @__PURE__ */ new WeakMap;function Pc(e,t,n,r,i){let a=e.componentsModel,o=i.get(a);if(i.delete(a),!n||!Ic(n)){Wc(e,t,r,n),Gc(e,t,r,n);return}let s=Lc(e,t,r),c=n.rootId??e.rootId;if(s&&o&&o.changes===jc.of(a).changes&&(n.allowMissingRoot||s.children.has(c)||a.has(c))){let{bound:i}=o,c=/* @__PURE__ */ new Map;for(let e of s.children.keys())c.set(e,i.childrenOf(e));let l=i.admits(s.children,n.maxDepth??50,e=>a.has(e));if(Rc(e,s,c,i,n)||Wc(e,t,r,n),l)return i;let u=Gc(e,t,r,n,!0);return u?Ac.of(u):void 0}Wc(e,t,r,n);let l=Gc(e,t,r,n,!0);return l?Ac.of(l):void 0}function Fc(e,t,n){n.set(e,{bound:t,changes:jc.of(e).changes})}function Ic(e){return e!==void 0&&e.allowDanglingReferences===!0&&(e.allowOrphanComponents===!0||e.allowMissingRoot===!0)}function Lc(e,t,n){let r={children:/* @__PURE__ */ new Map,types:/* @__PURE__ */ new Map,catalogs:/* @__PURE__ */ new Map};for(let i of t){let{id:t,component:a,...o}=i;if(typeof t!=`string`||!t)continue;let s=n(i,e);delete o.catalogId,delete o.metadata;let c=(typeof a==`string`?a:e.componentsModel.get(t)?.type)||``;if(!c||s.components.size===0)return;let l=Array.from(dc({...o,id:t,component:c},s.componentRefMap),([e])=>e);r.children.set(t,l),r.types.set(t,c),r.catalogs.set(t,s)}return r}function Rc(e,t,n,r,i){if(!zc(e,t.catalogs.values(),i))return!0;let a=Bc(e,i),o=e.componentsModel,s={get:e=>t.types.get(e)??o.get(e)?.type},c=/* @__PURE__ */ new Set,l=/* @__PURE__ */ new Map;for(let[e,i]of t.children){for(let e of i)t.children.has(e)||c.add(e);for(let r of n.get(e)??[])t.children.has(r)||c.add(r);for(let n of r.parentsOf(e)){if(t.children.has(n))continue;let r=l.get(n);r?r.push(e):l.set(n,[e])}}let u=e=>{let n=s.get(e);if(!n)return;let r=(t.catalogs.get(e)??o.get(e)?.catalog)?.components.get(n);return r?{componentType:n,componentApi:r}:void 0},d=e=>{let t=u(e);if(!t)return;let{componentType:n,componentApi:i}=t;if(i.allowedParents&&i.allowedParents.length>0){let t=Array.from(r.parentsOf(e),e=>({parentId:e,parentType:s.get(e)||`Unknown`}));Vc(e,n,i.allowedParents,t,a)}},f=(e,t)=>{let n=u(e);if(!n)return;let{componentType:r,componentApi:i}=n;i.allowedChildren&&i.allowedChildren.length>0&&Hc(e,r,i.allowedChildren,t,s)};try{for(let e of t.children.keys())d(e),f(e,r.childrenOf(e));for(let e of c)d(e);for(let[e,t]of l)f(e,t)}catch{return!1}return!0}function zc(e,t,n){let r=e=>{let t=Nc.get(e);return t===void 0&&(t=Array.from(e.components.values()).some(e=>e.allowedParents!==void 0&&e.allowedParents.length>0||e.allowedChildren!==void 0&&e.allowedChildren.length>0),Nc.set(e,t)),t};for(let e of t)if(r(e))return!0;if(Ic(n)){for(let t of jc.of(e.componentsModel).catalogs)if(r(t))return!0;return!1}let i=new Set(e.availableCatalogs.values());e.defaultCatalog&&i.add(e.defaultCatalog);for(let e of i)if(r(e))return!0;for(let t of e.componentsModel.values)if(!i.has(t.catalog)&&r(t.catalog))return!0;return!1}function Bc(e,t){return t?.rootId??e.rootId??`root`}function Vc(e,t,n,r,i,a,o,s){if(e===i&&!n.includes(`Surface`)){let r=o===void 0?`/components`:`/components/${o}`,i=`Component '${e}' (${t}) cannot be placed under parent 'Surface' (Surface). Allowed parents: ${JSON.stringify(n)}.`;throw new B(i,[{path:r,code:`UNALLOWED_PARENT`,message:i,...a===void 0?{}:{surfaceId:a}}],`UNALLOWED_PARENT`,{path:r,surfaceId:a})}for(let i of r??[])if(!n.includes(i.parentType)){let r=o??s?.get(i.parentId),c=r===void 0?`/components`:`/components/${r}`,l=`Component '${e}' (${t}) cannot be placed under parent '${i.parentId}' (${i.parentType||`unknown`}). Allowed parents: ${JSON.stringify(n)}.`;throw new B(l,[{path:c,code:`UNALLOWED_PARENT`,message:l,...a===void 0?{}:{surfaceId:a}}],`UNALLOWED_PARENT`,{path:c,surfaceId:a})}}function Hc(e,t,n,r,i,a,o,s,c){for(let l of r){let r=i.get(l);if(r&&!n.includes(r)){let i;if(o!==void 0){let e=(s?.get(l)??`children`).replace(/\[(\d+)\]/g,`/$1`).replace(/\./g,`/`).replace(/^\/+/,``);i=`/components/${o}${e?`/${e}`:``}`}else{let e=c?.get(l);i=e===void 0?`/components`:`/components/${e}`}let u=`Container '${e}' (${t}) cannot contain child '${l}' (${r}). Allowed children: ${JSON.stringify(n)}.`;throw new B(u,[{path:i,code:`UNALLOWED_CHILD`,message:u,...a===void 0?{}:{surfaceId:a}}],`UNALLOWED_CHILD`,{path:i,surfaceId:a})}}}function Uc(e,t,n){let r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Map;for(let[t,n]of e.componentsModel.entries){r.set(t,n.type),i.set(t,n.catalog);let s=e.componentsModel.getChildReferences(t);s.length>0&&(a.set(t,s.map(([e])=>e)),o.set(t,new Map(s)))}for(let c=0;c<t.length;c++){let l=t[c],{id:u,component:d,...f}=l;if(typeof u!=`string`)continue;s.set(u,c);let p=n(l,e);i.set(u,p);let m=e.componentsModel.get(u),h=(typeof d==`string`?d:m?.type)??``;h&&r.set(u,h);let g={id:u,component:h,...f},_=Array.from(dc(g,p));_.length>0?(a.set(u,_.map(([e])=>e)),o.set(u,new Map(_))):(a.delete(u),o.delete(u))}let c=/* @__PURE__ */ new Map;for(let[e,t]of a.entries()){let n=r.get(e)||`Unknown`;for(let r of t){let t=c.get(r)??[];t.push({parentId:e,parentType:n}),c.set(r,t)}}return{typeMap:r,compCatalogMap:i,childMap:a,childPathMap:o,parentMap:c,compIndexMap:s}}function Wc(e,t,n,r){if(!zc(e,t.filter(e=>typeof e.id==`string`).map(t=>n(t,e)),r))return;let{typeMap:i,compCatalogMap:a,childMap:o,childPathMap:s,parentMap:c,compIndexMap:l}=Uc(e,t,n),u=Bc(e,r);for(let[t,n]of i.entries()){let r=a.get(t)?.components.get(n);r&&(r.allowedParents&&r.allowedParents.length>0&&Vc(t,n,r.allowedParents,c.get(t),u,e.id,l.get(t),l),r.allowedChildren&&r.allowedChildren.length>0&&Hc(t,n,r.allowedChildren,o.get(t)||[],i,e.id,l.get(t),s.get(t),l))}}function Gc(e,t,n,r,i=!1){if(!r)return;let a=new mc(e.defaultCatalog);for(let[t,n]of e.componentsModel.entries)a.addComponent(new yc(t,n.type,n.properties,n.catalog));for(let r of t){let{id:t,component:i,...o}=r;if(typeof t!=`string`||!t)continue;let s=n(r,e);delete o.catalogId,delete o.metadata;let c=a.get(t),l=(typeof i==`string`?i:c?.type)||``;l&&(c?l!==c.type||c.catalog.id!==s.id?(a.removeComponent(t),a.addComponent(new yc(t,l,o,s))):c.properties=o:a.addComponent(new yc(t,l,o,s)))}if(a.validateTopology({...r,rootId:r.rootId??e.rootId}),!i)return;let o=/* @__PURE__ */ new Map;for(let e of a.keys)o.set(e,a.getChildIds(e));return o}function Kc(e){let t=e.path.join(`.`)||`root`;switch(e.code){case h.invalid_union:{let n=e.unionErrors?.flatMap(e=>e.issues);return n&&n.length>0?n.map(Kc).join(`; `):`${t}: Invalid union`}case h.unrecognized_keys:return`${t}: Unrecognized key(s) in object: ${e.keys.map(e=>`'${e}'`).join(`, `)}`;case h.invalid_enum_value:{let n=e;return`${t}: Invalid enum value. Expected ${n.options.map(e=>String(e)).join(` | `)}, received '${String(n.received)}'`}case h.invalid_type:{let n=e;return`${t}: Expected ${n.expected}, received ${n.received}`}case h.custom:return`${t}: ${e.message}`;default:return e.message?`${t}: ${e.message}`:`${t}: Validation error (${e.code})`}}var qc={"0.8":/* @__PURE__ */ new Set([`0.8`]),"0.9":/* @__PURE__ */ new Set([`0.9`,`0.9.1`]),"0.9.1":/* @__PURE__ */ new Set([`0.9.1`,`0.9`]),"1.0":/* @__PURE__ */ new Set([`1.0`])};function Jc(e,t,n=qc){if(!e||!t)return!1;let r=Pt(e),i=Pt(t);if(r&&i){if(r===i)return!0;let a=n[i];if(a&&a.has(r))return!0;let o=Nt(e),s=Nt(t);return!!(o&&s&&o.major>=1&&o.major===s.major)}if(typeof e!=`string`||typeof t!=`string`)return!1;let a=jt(e),o=jt(t);return a.length>0&&a===o}var Yc;function Xc(e){Yc=e}function Zc(e,t){for(let n of t){let t=e[n];if(t&&typeof t==`object`){let e=t;if(`surfaceId`in e&&e.surfaceId!==void 0&&typeof e.surfaceId!=`string`){let e=`surfaceId must be a string`;throw new B(e,[{path:`/${n}/surfaceId`,code:`type_mismatch`,message:e}],`VALIDATION_ERROR`,{path:`/surfaceId`})}}}}var Qc=class{get compatibleCatalogVersions(){let e=Pt(this.version);return e?/* @__PURE__ */ new Set([e]):/* @__PURE__ */ new Set}get validActions(){return new Set(this.getNativeActionKeys())}isCatalogCompatible(e){return e?Jc(e,this.version):!1}extractOperations(e){if(!e||typeof e!=`object`)return[];if(Array.isArray(e))return e.flatMap(e=>this.extractOperations(e));let t=e;if(Array.isArray(t.messages))return this.extractOperations(t.messages);let n=this.getNativeActionKeys();Zc(t,n);let r=n.filter(e=>e in t).sort();if(r.length>1)throw new B(`Message contains multiple conflicting update actions: ${r.join(`, `)}.`);if(r.length===0){let e=Yc?Yc():new Set(n),r=Object.keys(t).find(t=>e.has(t)&&!n.includes(t)),i=n.slice().sort().join(`, `);if(r){let e=`Invalid ${this.version} message: action '${r}' is not supported in protocol version ${this.version}. Allowed actions: ${i}.`;throw new B(e,[{path:`/version`,code:`invalid_value`,message:e}],`VALIDATION_ERROR`,{path:`/version`})}throw new B(`Invalid ${this.version} message: message must contain exactly one update action: ${i}.`)}let i=this.preparePayloadForValidation(t),a=this.schema.safeParse(i);if(!a.success){let e=a.error.errors.map(Kc).join(`; `),n=Sc(t,this.version),r=new B(`Invalid ${this.version} message: ${e}`,a.error,`VALIDATION_ERROR`),i=kc(r,n);throw r.path=i.error.path,r.surfaceId=i.error.surfaceId||void 0,r.functionCallId=i.error.functionCallId,r}return this.extractOperationsFromObject(t)}preparePayloadForValidation(e){return`version`in e?e:{version:this.version,...e}}},$c=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==void 0);n.length!==1&&t.addIssue({code:h.custom,message:`Must define exactly one property, found ${n.length} (${n.join(`, `)}).`})},el=L({path:P().optional(),literalString:P().optional(),literal:P().optional()}).strict().superRefine($c),tl=vt(()=>L({key:P(),valueString:P().optional(),valueNumber:F().optional(),valueBoolean:pt().optional(),valueMap:I(tl).optional()}).strict().superRefine((e,t)=>{let n=0;e.valueString!==void 0&&n++,e.valueNumber!==void 0&&n++,e.valueBoolean!==void 0&&n++,e.valueMap!==void 0&&n++,n!==1&&t.addIssue({code:h.custom,message:`Value map item must have exactly one value property (valueString, valueNumber, valueBoolean, valueMap), found ${n}.`})}));function nl(e={}){let t=e.maxDepth??5;return tl.superRefine((e,n)=>{let r=(e,i)=>{if(i>t)n.addIssue({code:h.custom,message:`valueMap recursion exceeded maximum depth of ${t}.`});else if(e.valueMap&&Array.isArray(e.valueMap))for(let t of e.valueMap)r(t,i+1)};r(e,1)})}var rl=nl();L({path:P().optional(),literalNumber:F().optional(),literal:F().optional()}).strict().superRefine($c),L({path:P().optional(),literalBoolean:pt().optional(),literal:pt().optional()}).strict().superRefine($c);var il=L({name:P().describe(`A unique name identifying the action (e.g., 'submitForm').`),context:I(L({key:P(),value:L({path:P().describe(`A data binding reference to a location in the data model (e.g., '/user/name').`).optional(),literalString:P().describe(`A fixed, hardcoded string value.`).optional(),literalNumber:F().optional(),literalBoolean:pt().optional()}).describe(`The dynamic value. Define EXACTLY ONE of the nested properties.`).strict().superRefine($c)})).describe(`A key-value map of data bindings to be resolved when the action is triggered.`).optional()});L({text:el,usageHint:z([`h1`,`h2`,`h3`,`h4`,`h5`,`caption`,`body`]).optional()}),L({url:el,usageHint:z([`icon`,`avatar`,`smallFeature`,`mediumFeature`,`largeFeature`,`header`]).optional(),fit:z([`contain`,`cover`,`fill`,`none`,`scale-down`]).optional(),altText:el.optional()}),L({name:el}),L({url:el}),L({url:el,description:el.optional().describe(`A label, title, or placeholder text.`)}),L({tabItems:I(L({title:L({path:P().describe(`A data binding reference to a location in the data model (e.g., '/user/name').`).optional(),literalString:P().describe(`A fixed, hardcoded string value.`).optional()}),child:P().describe(`A reference to a component instance by its unique ID.`)}).strict().superRefine((e,t)=>{e.title||t.addIssue({code:h.custom,message:`Tab item is missing 'title'.`}),e.child||t.addIssue({code:h.custom,message:`Tab item is missing 'child'.`}),e.title&&$c(e.title,t)})).describe(`A list of tabs, each with a title and a child component ID.`)}),L({axis:z([`horizontal`,`vertical`]).optional().describe(`The orientation.`),color:P().optional().describe(`The color of the divider (e.g., hex code or semantic name).`),thickness:F().optional().describe(`The thickness of the divider.`)}),L({entryPointChild:P().describe(`The ID of the component (e.g., a button) that triggers the modal.`),contentChild:P().describe(`The ID of the component to display as the modal's content.`)}),L({child:P().describe(`The ID of the component to display as the button's content.`),action:il.describe(`Represents a user-initiated action.`),primary:pt().optional().describe(`Indicates if this button should be styled as the primary action.`)}),L({label:el,value:L({path:P().describe(`A data binding reference to a location in the data model (e.g., '/user/name').`).optional(),literalBoolean:pt().optional()}).strict().superRefine($c)}),L({text:el.optional(),label:el.describe(`A label, title, or placeholder text.`),textFieldType:z([`shortText`,`number`,`date`,`longText`,`obscured`]).optional(),validationRegexp:P().optional().describe(`A regex string to validate the input.`)}),L({value:el,enableDate:pt().optional(),enableTime:pt().optional(),outputFormat:P().optional().describe(`The string format for the output (e.g., 'YYYY-MM-DD').`)}),L({selections:L({path:P().describe(`A data binding reference to a location in the data model (e.g., '/user/name').`).optional(),literalArray:I(P()).optional()}).strict().superRefine($c),options:I(L({label:L({path:P().describe(`A data binding reference to a location in the data model (e.g., '/user/name').`).optional(),literalString:P().describe(`A fixed, hardcoded string value.`).optional()}).strict().superRefine($c),value:P()})).optional(),maxAllowedSelections:F().optional(),type:z([`checkbox`,`chips`]).optional(),filterable:pt().optional()}),L({value:L({path:P().describe(`A data binding reference to a location in the data model (e.g., '/user/name').`).optional(),literalNumber:F().optional()}).strict().superRefine($c),minValue:F().optional(),maxValue:F().optional(),label:el.optional()});var al=L({componentId:P(),dataBinding:P()}),ol=L({explicitList:I(P()).optional(),template:al.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($c);L({children:ol,distribution:z([`start`,`center`,`end`,`spaceBetween`,`spaceAround`,`spaceEvenly`]).optional(),alignment:z([`start`,`center`,`end`,`stretch`]).optional()}),L({children:ol,distribution:z([`start`,`center`,`end`,`spaceBetween`,`spaceAround`,`spaceEvenly`]).optional(),alignment:z([`start`,`center`,`end`,`stretch`]).optional()}),L({children:ol,direction:z([`vertical`,`horizontal`]).optional(),alignment:z([`start`,`center`,`end`,`stretch`]).optional()}),L({child:P().describe(`The ID of the component to be rendered inside the card.`)});var sl=rl.describe(`A single data entry. Exactly one 'value*' property should be provided alongside the key.`),cl=_t(mt()).refine(e=>Object.keys(e).length===1,`A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading').`),ll=L({id:P().describe(`The unique identifier for this component.`),weight:F().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:cl.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.`),ul=L({surfaceId:P().describe(`The unique identifier for the UI surface to be rendered.`),catalogId:P().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:P().describe(`The ID of the root component to render.`),styles:L({font:P().optional().describe(`The primary font for the UI.`),primaryColor:P().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.`),dl=L({surfaceId:P().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:I(ll).min(1).describe(`A list containing all UI components for the surface.`)}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let r of e.components)r.id&&(n.has(r.id)&&t.addIssue({code:h.custom,message:`Duplicate component ID found: ${r.id}`,path:[`components`]}),n.add(r.id));let r=(e,r)=>{for(let i of e)i&&!n.has(i)&&t.addIssue({code:h.custom,message:`Component '${r}' references non-existent component ID '${i}'.`,path:[`components`]})};for(let n of e.components){if(!n.id||!n.component)continue;let e=Object.keys(n.component);if(e.length!==1)continue;let i=e[0],a=n.component[i];switch(i){case`Row`:case`Column`:case`List`:if(a.children&&!Array.isArray(a.children)){let e=!!a.children.explicitList,i=!!a.children.template;(e&&i||!e&&!i)&&t.addIssue({code:h.custom,message:`Component '${n.id}' must have either 'explicitList' or 'template' in children, but not both or neither.`}),e&&r(a.children.explicitList,n.id),i&&r([a.children.template?.componentId],n.id)}break;case`Card`:a.child&&r([a.child],n.id);break;case`Tabs`:a.tabItems&&Array.isArray(a.tabItems)&&a.tabItems.forEach(e=>{e.child&&r([e.child],n.id)});break;case`Modal`:r([a.entryPointChild,a.contentChild],n.id);break;case`Button`:a.child&&r([a.child],n.id)}}}).describe(`Updates a surface with a new set of components.`),fl=L({surfaceId:P().describe(`The unique identifier for the UI surface this data model update applies to.`),path:P().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:I(sl).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.`),pl=L({surfaceId:P().describe(`The unique identifier for the UI surface to be deleted.`)}).strict().describe(`Signals the client to delete the surface identified by 'surfaceId'.`),ml=L({beginRendering:ul.optional(),surfaceUpdate:dl.optional(),dataModelUpdate:fl.optional(),deleteSurface:pl.optional()}).strict().superRefine((e,t)=>{Object.keys(e).filter(e=>[`beginRendering`,`surfaceUpdate`,`dataModelUpdate`,`deleteSurface`].includes(e)).length!==1&&t.addIssue({code:h.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 hl(e){if(!e||typeof e!=`object`)return{id:``,component:``};let t=e,n=typeof t.component==`string`?t.component:``,r={};for(let[e,n]of Object.entries(t))e!==`component`&&e!==`id`&&(r[e]=n);if(t.component&&typeof t.component==`object`){let e=t.component,i=Object.keys(e);if(i.length>0){n=i[0];let t=e[i[0]];t&&typeof t==`object`&&t&&!Array.isArray(t)&&Object.assign(r,t)}}return{...r,id:String(t.id??``),component:n}}var gl=class extends Qc{constructor(){super(...arguments),this.version=`v0.8`,this.schema=ml}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(hl):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(hl):[]})}if(`dataModelUpdate`in e){let n=e.dataModelUpdate,r=String(n?.surfaceId??``),i=typeof n?.path==`string`?n.path.trim():``,a=i&&i!==`/`?(i.startsWith(`/`)?i:`/${i}`).replace(/\/+$/,``):``,o=e=>{if(`valueNumber`in e)return e.valueNumber;if(`valueString`in e)return e.valueString;if(`valueBoolean`in e)return e.valueBoolean;if(`valueObject`in e)return e.valueObject;if(`valueArray`in e)return e.valueArray;if(Array.isArray(e.valueMap)){let t={};for(let n of e.valueMap)n&&typeof n==`object`&&typeof n.key==`string`&&(t[n.key]=o(n));return t}return e.value};if(Array.isArray(n?.contents)){for(let e of n.contents)if(e&&typeof e==`object`&&typeof e.key==`string`){let n=o(e),i=e.key.replace(/^\/+/,``),s=i===`.`||i===``?a||`/`:`${a}/${i}`;t.push({type:`updateDataModel`,surfaceId:r,path:s,value:n})}}else t.push({type:`updateDataModel`,surfaceId:r,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}},_l=R([L({version:z([`v0.9`,`v0.9.1`]),createSurface:L({surfaceId:P().describe(`The unique identifier for the UI surface to be rendered.`),catalogId:P().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:mt().optional(),sendDataModel:pt().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(),L({version:z([`v0.9`,`v0.9.1`]),updateComponents:L({surfaceId:P().describe(`The unique identifier for the UI surface to be updated.`),components:I(_t(P(),mt())).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(),L({version:z([`v0.9`,`v0.9.1`]),updateDataModel:L({surfaceId:P().describe(`The unique identifier for the UI surface this data model update applies to.`),path:P().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:mt().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(),L({version:z([`v0.9`,`v0.9.1`]),deleteSurface:L({surfaceId:P().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()]);L({messages:I(_l).describe(`A list of messages.`)}).strict().describe(`An object wrapping a list of messages.`);var vl=class extends Qc{constructor(){super(...arguments),this.version=`v0.9`,this.schema=_l}get compatibleCatalogVersions(){return/* @__PURE__ */ 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}},yl=[`createSurface`,`updateComponents`,`updateDataModel`,`deleteSurface`,`callRendererFunction`,`agentFunctionResponse`];function bl(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&yl.includes(e.type)}L({componentId:vt(()=>Ns),path:P().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 xl=I(vt(()=>Hs.extend({component:P()}).passthrough().refine(e=>e.component!==`Surface`,{message:`Component type cannot be "Surface". "Surface" is a top-level protocol container defined in createSurface, not a child component.`}))).min(1);_t(P(),mt());var Sl=R([L({version:yt(`1.0`),createSurface:L({surfaceId:P().describe(`The unique identifier for the UI surface to be rendered. It must be globally unique for the renderer's lifetime.`),catalogId:P().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:pt().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:xl.optional(),dataModel:_t(P(),mt()).describe(`The initial root data model object for the surface.`).optional(),metadata:L({extensions:Vs.optional()}).strict().describe(`Optional surface-level metadata.`).optional()}).strict().describe(`Signals the renderer to create a new surface and begin rendering it. Creating a surface implicitly instantiates the canonical 'Surface' container component ('common_types.json#/$defs/Surface') with 'child': 'root'. It is an error to try to create a surface with an existing ID without first deleting it; surfaceId MUST be globally unique for the renderer's lifetime. The component tree and initial data model may be provided inline via 'components' and 'dataModel', or sent later in 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId.`)}).strict(),L({version:yt(`1.0`),updateComponents:L({surfaceId:P().describe(`The unique identifier for the UI surface to be updated. It must be globally unique for the renderer's lifetime.`),components:xl}).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(),L({version:yt(`1.0`),updateDataModel:L({surfaceId:P().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:P().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:mt().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(),L({version:yt(`1.0`),deleteSurface:L({surfaceId:P().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(),L({version:yt(`1.0`),callRendererFunction:L({surfaceId:P().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:Ps,callFunction:gt(Ls,L({catalogId:P()}).passthrough())}).strict().describe(`Signals the renderer to execute a function locally on behalf of the agent.`)}).strict(),L({version:yt(`1.0`),agentFunctionResponse:Gs}).strict()]);function Cl(e,t,n){if(Object.hasOwn(e,`args`)&&e.args!==void 0&&(typeof e.args!=`object`||e.args===null||Array.isArray(e.args)))throw new B(`Invalid ${t} message: callRendererFunction.callFunction.args: Expected object, received ${Array.isArray(e.args)?`array`:typeof e.args}`,void 0,`VALIDATION_ERROR`,{functionCallId:n||void 0})}function wl(e,t){let n=e?.callFunction||{},r=String(e?.functionCallId||``);return Cl(n,t,r),{type:`callRendererFunction`,surfaceId:typeof e?.surfaceId==`string`?e.surfaceId:void 0,functionCallId:r,call:String(n?.[`@call`]||n?.call||``),version:t,catalogId:typeof n?.catalogId==`string`?n?.catalogId:void 0,args:n?.args&&typeof n.args==`object`&&!Array.isArray(n.args)?n.args:{}}}var Tl=class extends Qc{constructor(){super(...arguments),this.version=`1.0`,this.schema=Sl}getNativeActionKeys(){return[...yl]}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&&t.push(wl(e.callRendererFunction,this.version)),`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}},El=new class{constructor(){this.adapters=/* @__PURE__ */ new Map([[`0.8`,new gl],[`0.9`,new vl],[`0.9.1`,new vl],[`1.0`,new Tl]])}getAllKnownActions(){let e=/* @__PURE__ */ 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=Pt(e.version)??jt(e.version);this.adapters.set(t,e)}getAdapter(e){let t=Pt(e)??jt(e),n=this.adapters.get(t);if(!n)throw new B(`[VersionAdapterFactory] Unsupported protocol version '${e}'. Supported versions: ${Array.from(new Set(Array.from(this.adapters.entries()).map(([e,t])=>e===`0.9.1`?`v0.9.1`:t.version))).sort().join(`, `)}.`);return n}resolveFromPayload(e){let t=Array.isArray(e)?e[0]:e;if(typeof t==`object`&&t){if(`messages`in t&&Array.isArray(t.messages))return this.resolveFromPayload(t.messages);if(`version`in t){let e=t.version;if(typeof e!=`string`)throw new B(`[VersionAdapterFactory] Message payload is missing a valid 'version' string: 'version' property must be a string, got ${typeof e}.`);return this.getAdapter(e)}if(`beginRendering`in t||`surfaceUpdate`in t||`dataModelUpdate`in t||`deleteSurface`in t)return this.getAdapter(`v0.8`)}throw new B(`[VersionAdapterFactory] Message payload is missing a valid 'version' string.`)}static registerAdapter(e){El.registerAdapter(e)}static getAdapter(e){return El.getAdapter(e)}static resolveFromPayload(e){return El.resolveFromPayload(e)}static getAllKnownActions(){return El.getAllKnownActions()}};Xc(()=>El.getAllKnownActions());var Dl=[`id`,`component`,`catalogId`,`metadata`];function Ol(e){return e===Ks.name?Ks:void 0}function kl(e,t){if(t.catalogId!==void 0)throw new B(`System function '${e}' belongs to no catalog and must not name a catalogId.`)}function Al(e){return`Function call '${e}' has a non-string 'catalogId'.`}function jl(e,t,{catalogIsDefault:n}){return e===void 0?n:e===t}var Ml=class{constructor(e,t){this.catalog=e,this.config=t,this.enforceIdentifiers=H(e.protocolVersion,`1.0`)}get allowUnknown(){return this.config?this.config.allowUnknownElements??!1:!0}validateComponent(e,t,n){let r=e.id;if(typeof r!=`string`||!r){let t=`Component '${e.component}' is missing an 'id'; entries require a valid string 'id'.`;throw new B(t,[{path:`/id`,code:`missing_field`,message:t}],`VALIDATION_ERROR`,{path:`/id`})}this.assertIdentifier(r,`Component id '${r}' must be a valid UAX #31 identifier`,!1,`/id`);let i=e.component,a=typeof i==`string`?i:t;if(!a){let e=`Cannot create component ${r} without a type.`;throw new B(e,[{path:`/component`,code:`missing_field`,message:e}],`VALIDATION_ERROR`,{path:`/component`})}let o=e.catalogId,s=typeof o==`string`?o:void 0,c=Pl(e),l=this.catalog.components.get(a);if(!l){if(!this.allowUnknown){let e=`Unknown component type '${a}' not found in catalog '${this.catalog.id}'.`;throw new B(e,[{path:`/component`,code:`invalid_value`,message:e}],`VALIDATION_ERROR`,{path:`/component`})}n?.skipNestedFunctions||this.validateNestedFunctions(c,s);return}let u=ws(l.schema);this.validateCommonEnvelopeFields(c,u,a,r,s);let d=l.schema.safeParse(c);if(!d.success){let e=d.error.errors.map(Kc).join(`, `),t=Nl(d.error.issues),n=new Set(t.map(e=>e.path)).size===1?t[0]?.path:void 0;throw new B(`Validation failed for component '${a}' (${r}): ${e}`,t,`VALIDATION_ERROR`,{path:n&&n!==`/`?n:void 0})}n?.skipNestedFunctions||this.validateNestedFunctions(c,s)}validateCommonEnvelopeFields(e,t,n,r,i){if(`accessibility`in e&&!t?.has(`accessibility`)){let t=e.accessibility;delete e.accessibility;let a=ln.optional().safeParse(t);if(!a.success){let e=a.error.errors.map(Kc).join(`, `),t=Nl(a.error.issues,`/accessibility`);throw new B(`Validation failed for component '${n}' (${r}): ${e}`,t,`VALIDATION_ERROR`,{path:t[0]?.path})}this.validateNestedFunctions(t,i,`/accessibility`)}if(`metadata`in e&&!t?.has(`metadata`)){let t=e.metadata;delete e.metadata;let i=dn.shape.metadata.safeParse(t);if(!i.success){let e=i.error.errors.map(Kc).join(`, `),t=Nl(i.error.issues,`/metadata`);throw new B(`Validation failed for component '${n}' (${r}): ${e}`,t,`VALIDATION_ERROR`,{path:t[0]?.path})}}}assertFunctionIdentifiers(e,t){if(this.assertIdentifier(e,`Function name '${e}' must be a valid UAX #31 identifier`,!0),this.enforceIdentifiers&&t!=null&&(typeof t!=`object`||Array.isArray(t)))throw new B(`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>1e3)throw new B(`Function call '${e}' exceeds maximum allowed arguments count (${vs})`);for(let t of n)this.assertIdentifier(t,`Function argument '${t}' in function '${e}' must be a valid UAX #31 identifier`)}}checkNestedCallRecord(e,t,n){let r=e.args,i=r===void 0?{}:r;if(!this.enforceIdentifiers){this.validateFunction(t,i);return}if(t.startsWith(`@`)){kl(t,e),this.validateFunction(t,i);return}let a=e.catalogId;if(a!==void 0&&typeof a!=`string`)throw new B(Al(t));jl(a,this.catalog.id,{catalogIsDefault:n===void 0})?this.validateFunction(t,i):this.assertFunctionIdentifiers(t,i)}validateNestedFunctions(e,t,n=``){if(Array.isArray(e)){for(let r=0;r<e.length;r++)this.validateNestedFunctions(e[r],t,`${n}/${r}`);return}if(typeof e!=`object`||!e)return;let r=e;this.enforceIdentifiers&&ks(Object.keys(r),this.catalog.protocolVersion);let i=this.enforceIdentifiers?r[`@call`]:r.call??r.function;if(typeof i==`string`&&(this.enforceIdentifiers||i.length>0))try{this.checkNestedCallRecord(r,i,t)}catch(e){throw e instanceof B&&n&&(e.path=e.path&&e.path!==`/`?`${n}${e.path}`:n),e}for(let[e,i]of Object.entries(r))this.validateNestedFunctions(i,t,`${n}/${e}`)}validateFunction(e,t){this.assertFunctionIdentifiers(e,t);let n=this.enforceIdentifiers&&e.startsWith(`@`)?Ol(e):this.catalog.functions.get(e);if(!n){if(!this.allowUnknown)throw new B(`Unrecognized function '${e}'`);return t??{}}if(!n.schema){if(t!==void 0&&(typeof t!=`object`||!t||Array.isArray(t)))throw new B(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?`array`:typeof t}`,void 0,`VALIDATION_ERROR`,{path:`/args`});return t??{}}let r=n.schema.safeParse(t??{});if(!r.success){let t=r.error.errors.map(Kc).join(`, `),n=Nl(r.error.issues,`/args`);throw new B(`Validation failed for function '${e}': ${t}`,n,`VALIDATION_ERROR`,{path:n[0]?.path})}return r.data}validateTheme(e){let t=this.catalog.themeSchema;if(!t)return e;let n=t.safeParse(e);if(!n.success){let e=n.error.errors.map(Kc).join(`, `),t=Nl(n.error.issues,`/theme`);throw new B(`Validation failed for theme: ${e}`,t,`VALIDATION_ERROR`,{path:t[0]?.path??`/theme`})}return n.data}assertIdentifier(e,t,n=!1,r){if(this.enforceIdentifiers&&!Ut(e,n))throw new B(t,r?[{path:r,code:`invalid_value`,message:t}]:void 0,`VALIDATION_ERROR`,{path:r})}};function Nl(e,t=``){return e.map(e=>{let n=e.path.map(e=>String(e).replace(/~/g,`~0`).replace(/\//g,`~1`));return e.code===`unrecognized_keys`&&`keys`in e&&Array.isArray(e.keys)&&e.keys.length>0&&n.push(String(e.keys[0]).replace(/~/g,`~0`).replace(/\//g,`~1`)),{path:`${t}${n.length>0?`/${n.join(`/`)}`:``}`||`/`,code:e.code===`invalid_type`&&`received`in e&&e.received===`undefined`||e.message===`Required`?`missing_field`:`invalid_value`,message:e.message}})}function Pl(e){let t={};for(let[n,r]of Object.entries(e))Dl.includes(n)||(t[n]=r);return t}var Fl=class{constructor(e,t){if(this.pendingAgentCalls=/* @__PURE__ */ new Map,this.isDisposed=!1,Array.isArray(e))this.catalogs=e,this.outboundListener=t,this.defaultTimeoutMs=3e4;else{let t=e??{};this.catalogs=t.catalogs??[],this.outboundListener=t.outboundListener,this.defaultTimeoutMs=t.defaultTimeoutMs??3e4}}get disposed(){return this.isDisposed}async handleCallRendererFunction(e,t,n=!1){let r=this.validateInboundMessage(e);if(r)return await this.emitOutboundResponse(r),r;let{version:i,callRendererFunction:a}=e,{surfaceId:o,functionCallId:s,callFunction:c}=a;if(o!==void 0&&t?.surface?.id!==o){let e=this.createResponseError(s,Ot.INVALID_FUNCTION_CALL,`Surface not found: ${o}`,i);return await this.emitOutboundResponse(e),e}let l=c[`@call`]??c.call,{catalogId:u,args:d}=c,f=this.resolveFunctionImplementation(u,l,t,i);if(`error`in f){let e=this.createResponseError(s,Ot.INVALID_FUNCTION_CALL,f.error,i);return await this.emitOutboundResponse(e),e}let p=this.checkExecutionPermissions(f.funcImpl,l,n);if(p){let e=this.createResponseError(s,Ot.INVALID_FUNCTION_CALL,p,i);return await this.emitOutboundResponse(e),e}let m=this.ensureDataContext(t,f.catalog,s),h=this.resolveDynamicArguments(d,m,n);if(`error`in h){let e=this.createResponseError(s,Ot.EXECUTION_ERROR,h.error,i);return await this.emitOutboundResponse(e),e}let g;try{g=await Bt(h.args)}catch(e){let t=this.createResponseError(s,Ot.EXECUTION_ERROR,this.extractErrorMessage(e)||`An error occurred during function execution.`,i);return await this.emitOutboundResponse(t),t}let _=this.parseArguments(f.catalog,f.funcImpl,g,l);if(`error`in _){let e=this.createResponseError(s,Ot.INVALID_FUNCTION_CALL,_.error,i);return await this.emitOutboundResponse(e),e}let v=await this.executeFunctionSafely(f.funcImpl,_.args,m,s,i);return await this.emitOutboundResponse(v),v}handleAgentFunctionResponse(e){if(!e||!e.agentFunctionResponse)return;let{functionCallId:t,value:n,error:r}=e.agentFunctionResponse,i=this.pendingAgentCalls.get(t);if(i){if(this.pendingAgentCalls.delete(t),r){let e=r.code??Ot.UNKNOWN_ERROR,n=r.message??`Agent function execution failed`;i.reject(new kt(n,e,t,r))}else i.resolve(n)}}callAgentFunction(e,t,n){if(this.isDisposed)return Promise.reject(new kt(`RpcHandler has been disposed.`,Ot.DISPOSED));if(!this.outboundListener)return Promise.reject(new kt(`Cannot call agent function without outboundListener configured.`,Ot.NO_LISTENER));let r=t?.[`@call`]??t?.call;if(!t||!r)return Promise.reject(new kt(`Missing or invalid function call name.`,Ot.INVALID_FUNCTION_CALL));let i=n??{},a=i.functionCallId??this.generateFunctionCallId(),o=i.timeoutMs??this.defaultTimeoutMs;if(this.pendingAgentCalls.has(a))return Promise.reject(new kt(`A call with functionCallId '${a}' is already pending.`,Ot.DUPLICATE,a));let s={functionCallId:a,call:t,effectiveTimeoutMs:o,version:i.version};return this.dispatchAgentCall(e,s)}dispose(){if(!this.isDisposed){this.isDisposed=!0;for(let[e,t]of this.pendingAgentCalls.entries())t.reject(new kt(`RpcHandler disposed while call '${e}' was pending.`,Ot.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`,Ot.INVALID_FUNCTION_CALL,`Inbound message is null or undefined.`,`unknown`);let t=e.version;return this.isDisposed?this.createResponseError(e.callRendererFunction?.functionCallId??`unknown`,Ot.DISPOSED,`RpcHandler has been disposed.`,t):e.callRendererFunction?.callFunction?null:this.createResponseError(e.callRendererFunction?.functionCallId??`unknown`,Ot.INVALID_FUNCTION_CALL,`Malformed message: missing callRendererFunction or callFunction.`,t)}resolveFunctionImplementation(e,t,n,r){let i;if(e&&(i=n?.surface?.availableCatalogs?.get(e)??this.catalogs.find(t=>t.id===e),!i))return{error:`Catalog not found: ${e}`};if(!i)return{error:`No catalog available for function resolution.`};if(i.protocolVersion&&r&&!Jc(i.protocolVersion,r))return{error:`Catalog '${i.id}' specification version (${i.protocolVersion}) does not match message protocol version (${r}).`};let a=i.functions?.get(t);return a?{funcImpl:a,catalog:i}:{error:`Function not found: ${t}`}}ensureDataContext(e,t,n){if(e instanceof Ms&&e.surface)return e;let r=/* @__PURE__ */ new Map;for(let e of this.catalogs)t.protocolVersion&&e.protocolVersion&&Jc(t.protocolVersion,e.protocolVersion)&&r.set(e.id,e);return r.set(t.id,t),new Ms(new gc(`_rpc_fallback_${n||`default`}`,t,r),`/`)}resolveDynamicArguments(e,t,n){if(e===void 0||typeof e!=`object`||!e||Array.isArray(e))return{args:e};let r={},i,a=t.surface?.onError.subscribe(e=>{!i&&e?.code===`EXPRESSION_ERROR`&&(i=e.message||`An error occurred during function execution.`)});try{for(let[i,a]of Object.entries(e))r[i]=t.resolveDynamicValue(a,1,n)}catch(e){i=this.extractErrorMessage(e)||`An error occurred during function execution.`}finally{a?.unsubscribe()}return i?{error:i}:{args:r}}checkExecutionPermissions(e,t,n){let r=e.allowedCallers??`rendererOnly`;return r!==`rendererOrAgent`&&r!==`agentOnly`?`Function '${t}' cannot be called by agent (allowedCallers is ${r}).`:e.requiresUserActivation&&!n?`Function '${t}' requires user activation context to execute.`:null}parseArguments(e,t,n,r){try{return{args:new Ml(e,{allowUnknownElements:!1}).validateFunction(r,n)}}catch(e){return{error:`Invalid function arguments for '${r}': ${this.extractErrorMessage(e)}`}}}async executeFunctionSafely(e,t,n,r,i){let a=i||`1.0`;try{let i=await Promise.resolve(e.execute(t,n)),o=us(i)?ds(i):i;return{version:a,rendererFunctionResponse:{functionCallId:r,value:o===void 0?null:o}}}catch(e){let t=this.extractErrorMessage(e);return{version:a,rendererFunctionResponse:{functionCallId:r,error:{code:Ot.EXECUTION_ERROR,message:t||`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:r,effectiveTimeoutMs:i,version:a}=t;return new Promise((t,o)=>{let s,c=()=>{s&&=(clearTimeout(s),void 0),this.pendingAgentCalls.delete(n)},l=(r[`@call`]??r.call)||`unknown`;s=this.createTimeoutTimer(n,l,i,c,o),this.pendingAgentCalls.set(n,{resolve:e=>{c(),t(e)},reject:e=>{c(),o(e)}}),this.sendOutboundMessage(e,n,r,a,c,o)})}createTimeoutTimer(e,t,n,r,i){if(!(n<=0))return setTimeout(()=>{this.pendingAgentCalls.delete(e)&&(r(),i(new kt(`Agent function call '${t}' timed out after ${n}ms.`,Ot.TIMEOUT,e)))},n)}sendOutboundMessage(e,t,n,r,i,a){let{call:o,"@call":s,...c}=n,l={"@call":s??o,...c},u={version:r||`1.0`,callAgentFunction:{surfaceId:e,functionCallId:t,callFunction:l}};try{let e=this.outboundListener(u);e&&typeof e.catch==`function`&&e.catch(e=>{i(),a(e)})}catch(e){i(),a(e)}}extractErrorMessage(e){return e instanceof Error?e.message:String(e)}createResponseError(e,t,n,r){return{version:r||`1.0`,rendererFunctionResponse:{functionCallId:e,error:{code:t,message:n}}}}},Il=class{constructor(e,t,n){this.actionHandler=t,this.graphBounds=/* @__PURE__ */ new WeakMap,this.registeredCatalogs=e,this.model=new vc,this.adapterRegistry=n?.adapterRegistry??El,this.defaultVersion=n?.version,this.errorHandler=n?.errorHandler,this.reportErrorsOnly=n?.reportErrorsOnly??!1,this.rpc=new Fl({catalogs:this.registeredCatalogs,outboundListener:n?.outboundListener,defaultTimeoutMs:n?.defaultTimeoutMs}),this.validationConfig=n?.validationConfig?zl(n.validationConfig):void 0,this.actionHandler&&this.model.onAction.subscribe(this.actionHandler)}get catalogs(){return[...this.registeredCatalogs]}callAgentFunction(e,t,n){return this.rpc.callAgentFunction(e,t,n)}dispose(){this.rpc.dispose()}getRendererCapabilities(e){let t=e?.versions??(e?.version?[e.version]:void 0);if(!t||t.length===0)throw new B(`At least one protocol version must be provided in CapabilitiesOptions to generate renderer capabilities.`);let n={};for(let r of t){let t={supportedCatalogIds:this.registeredCatalogs.map(e=>e.id)},i=e?.includeInlineCatalogs?this.registeredCatalogs.map(t=>Lt(r,`1.0`)>=0?this.generateInlineCatalog(t):this.generateLegacyInlineCatalog(t,e?.componentEnvelopeRef??`common_types.json#/$defs/ComponentCommon`)):void 0;i&&(t.inlineCatalogs=i),n[r]=t}return n}getClientCapabilities(e){let t=e?.versions&&e.versions.length>0?e.versions:[e?.version??`v0.9`];return this.getRendererCapabilities({...e,versions:t})}generateInlineCatalog(e){let t=e.toJson();return t.catalogId=e.id,t.protocolVersion=(typeof t.protocolVersion==`string`?t.protocolVersion:Pt(e.protocolVersion)??e.protocolVersion).trim().replace(/^[vV](?=\d)/,``),t}generateLegacyInlineCatalog(e,t=`common_types.json#/$defs/ComponentCommon`){let n={};for(let[r,i]of e.components.entries()){let e={},a=[];if(i.schema&&typeof i.schema==`object`&&`safeParse`in i.schema){let t=br(i.schema,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});Da(t,void 0,{stripAdditionalProperties:!0}),e=t.properties||{},a=Array.isArray(t.required)?t.required.filter(e=>e!==`component`&&e!==`id`):[]}let{component:o,id:s,...c}=e;n[r]={allOf:[{$ref:t},{properties:{component:{const:r},...c},required:[`component`,...a]}]}}let r=[];for(let t of e.functions.values()){let e={type:`object`,properties:{}};if(t.schema&&typeof t.schema==`object`&&`safeParse`in t.schema){let n=br(t.schema,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});Da(n,void 0,{stripAdditionalProperties:!0}),e=n}r.push({name:t.name,...t.description?{description:t.description}:{},returnType:t.returnType,parameters:e})}let i;if(e.themeSchema){let t=br(e.themeSchema,{target:`jsonSchema2019-09`,$refStrategy:`none`,override:Cr});Da(t,void 0,{stripAdditionalProperties:!0}),i=t.properties||void 0}return{catalogId:e.id,...Object.keys(n).length>0?{components:n}:{},...r.length>0?{functions:r}:{},...i?{theme:i}:{}}}getRendererDataModel(e){let t=Array.from(this.model.surfacesMap.values()).filter(e=>e.sendDataModel);if(t.length===0)return;if(e!==void 0){let n={};for(let r of t){let t=r.protocolVersion;(!t||Jc(t,e))&&(n[r.id]=r.dataModel.get(`/`))}return Object.keys(n).length===0?void 0:{version:e,surfaces:n}}let n=/* @__PURE__ */ new Set;for(let e of t)if(e.protocolVersion){let t=Pt(e.protocolVersion),r=t?Lt(t,`1.0`)>=0?t:`v${t}`:e.protocolVersion;n.add(r)}if(n.size>1)throw new B(`Multiple protocol versions detected among active surfaces: ${Array.from(n).sort().join(`, `)}. Specify a target protocol version in getRendererDataModel(version).`);let r=n.size===1?n.values().next().value:`1.0`,i={};for(let e of t)i[e.id]=e.dataModel.get(`/`);return{version:r,surfaces:i}}getClientDataModel(e){return this.getRendererDataModel(e)}resolvePath(e,t){return _s.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){this.withValidationConfig(t,()=>{let n=Sc(Array.isArray(e)?e[0]:e,this.defaultVersion),r=n;try{let i=this.prepareOperations(e,e=>{r=e});for(let e of i)r=this.contextFromOperation(e,n),this.processOperation(e,t)}catch(e){if(this.handleProcessingError(e,r),!this.reportErrorsOnly)throw e}})}processMessagesWithErrors(e,t){return this.withValidationConfig(t,()=>{let n=Array.isArray(e)?e:[e],r=[];for(let e of n){let n=Sc(e,this.defaultVersion),i=n;try{let r=this.prepareOperations(e,e=>{i=e});for(let e of r)i=this.contextFromOperation(e,n),this.processOperation(e,t)}catch(e){r.push(this.handleProcessingError(e,i))}}return r})}async processMessagesAsync(e,t){let n=Sc(Array.isArray(e)?e[0]:e,this.defaultVersion),r=n;try{let i=this.withValidationConfig(t,()=>this.prepareOperations(e,e=>{r=e})),a=[];for(let e of i){r=this.contextFromOperation(e,n);let i=await this.processOperationAsync(e,t);i&&a.push(i)}return a}catch(e){if(this.handleProcessingError(e,r),!this.reportErrorsOnly)throw e;return[]}}contextFromOperation(e,t){let n=e.envelopeContext??t,r=`surfaceId`in e&&e.surfaceId?e.surfaceId:n.surfaceId,i=`functionCallId`in e&&e.functionCallId?e.functionCallId:n.functionCallId,a=`version`in e?e.version:void 0,o=r?this.model.getSurface(r)?.protocolVersion:void 0;return{surfaceId:r,functionCallId:i,actionType:e.type,version:a??o??n.version??this.defaultVersion}}handleProcessingError(e,t){let n=kc(e,t),r={code:n.error.code,message:n.error.message,surfaceId:n.error.surfaceId,details:e instanceof B?e.details:void 0},i=n.error.surfaceId?this.model.getSurface(n.error.surfaceId):void 0;return i?i.dispatchError(r):this.model.emitError(r),this.errorHandler?.(n),n}extractSingleMessageOperations(e){let t=Sc(e,this.defaultVersion),n;try{n=this.adapterRegistry.resolveFromPayload(e)}catch(t){if(this.isImplicitV09Payload(e)){let e=this.catalogs.some(e=>e.protocolVersion===`0.9.1`||e.protocolVersion===`v0.9.1`);n=this.adapterRegistry.getAdapter(e?`v0.9.1`:`v0.9`)}else throw t}let r=n.extractOperations(e),i=t.version;for(let e of r)i&&Pt(i)&&(`version`in e&&e.version||(e.version=i)),e.envelopeContext=t;return r}withValidationConfig(e,t){let n=e?.validationConfig;if(!n)return t();let r=this.validationConfig;this.validationConfig=zl(n);try{return t()}finally{this.validationConfig=r}}prepareSingleItem(e,t){return t?.(Sc(e,this.defaultVersion)),this.validationConfig&&pc(e),this.validationConfig?.targetVersion&&this.validateTargetVersion(e),bl(e)?[e]:this.extractSingleMessageOperations(e)}prepareOperations(e,t){return!e||Array.isArray(e)&&e.length===0?[]:Array.isArray(e)?e.flatMap(e=>this.prepareSingleItem(e,t)):this.prepareSingleItem(e,t)}isImplicitV09Payload(e){if(this.validationConfig||this.catalogs.length===0||this.catalogs.some(e=>H(e.protocolVersion,`1.0`)))return!1;let t=Array.isArray(e)?e[0]:e;return typeof t==`object`&&t&&`messages`in t&&Array.isArray(t.messages)&&(t=t.messages[0]),typeof t!=`object`||!t||`version`in t?!1:[`createSurface`,`updateComponents`,`updateDataModel`,`deleteSurface`].some(e=>e in t)}validateTargetVersion(e){let t=this.validationConfig?.targetVersion;if(!t)return;let n=e=>{if(typeof e==`object`&&e&&`version`in e){let n=e.version;if(n&&(Pt(n)??n)!==(Pt(t)??t))throw new B(`Message version '${n}' does not match expected target version '${t}'`)}};if(Array.isArray(e))for(let t of e)n(t);else n(e)}applyStateOperation(e){if(this.validationConfig?.allowedMessages&&!this.validationConfig.allowedMessages.includes(e.type))throw new B(`Operation '${e.type}' is not permitted by ValidationConfig.allowedMessages`);switch(e.type){case`createSurface`:this.processCreateSurfaceOp(e);break;case`deleteSurface`:this.processDeleteSurfaceOp(e);break;case`updateComponents`:this.processUpdateComponentsOp(e);break;case`updateDataModel`:this.processUpdateDataModelOp(e);break;case`agentFunctionResponse`:this.rpc.handleAgentFunctionResponse({version:e.version??`1.0`,agentFunctionResponse:{functionCallId:e.functionCallId,value:e.value,error:e.error}})}}resolveRpcDataContext(e){if(e.surfaceId!==void 0){let t=this.model.surfacesMap.get(e.surfaceId);return t?new Ms(t,`/`):void 0}let t=e.catalogId?this.registeredCatalogs.find(t=>t.id===e.catalogId):void 0;if(!t)return;let n=`_rpc_fallback_${e.functionCallId||`default`}`,r=/* @__PURE__ */ new Map;for(let e of this.registeredCatalogs)t?.protocolVersion&&e.protocolVersion&&Jc(t.protocolVersion,e.protocolVersion)&&r.set(e.id,e);return t&&r.set(t.id,t),new Ms(new gc(n,t,r),`/`)}processOperation(e,t){if(e.type===`callRendererFunction`){let n=this.resolveRpcDataContext(e),r=t?.isUserActivated??e.isUserActivated??!1,i={version:e.version??`1.0`,callRendererFunction:{...e.surfaceId===void 0?{}:{surfaceId:e.surfaceId},functionCallId:e.functionCallId,callFunction:{"@call":e.call,catalogId:e.catalogId,args:e.args}}};this.rpc.handleCallRendererFunction(i,n,r).catch(t=>{console.error(`Unhandled error in callRendererFunction (${e.call}):`,t)})}else this.withValidationConfig(t,()=>this.applyStateOperation(e))}async processOperationAsync(e,t){if(e.type===`callRendererFunction`){let n=this.resolveRpcDataContext(e),r=t?.isUserActivated??e.isUserActivated??!1,i={version:e.version??`1.0`,callRendererFunction:{...e.surfaceId===void 0?{}:{surfaceId:e.surfaceId},functionCallId:e.functionCallId,callFunction:{"@call":e.call,catalogId:e.catalogId,args:e.args}}};return await this.rpc.handleCallRendererFunction(i,n,r)}return this.withValidationConfig(t,()=>this.applyStateOperation(e)),null}validateSurfaceTheme(e,t,n){if(!e||!t?.themeSchema)return e;try{return new Ml(t,this.validationConfig).validateTheme(e)}catch(e){if(e instanceof B){let t=Array.isArray(e.details)?e.details.map(e=>typeof e==`object`&&e?{...e,surfaceId:n}:e):e.details;throw new B(e.message.replace(/^Validation failed for theme:/,`Validation failed for theme on surface '${n}':`),t,e.code,{path:e.path,surfaceId:n})}throw e}}processCreateSurfaceOp(e){let{surfaceId:t,catalogId:n,theme:r,sendDataModel:i,components:a,dataModel:o}=e,s=e.version,c=n===void 0&&s!==void 0&&H(s,`1.0`),l=c?void 0:Rl(this.registeredCatalogs,n,s);if(!l&&!c)throw n===void 0?new Tt(`No default catalog available for surface '${t}'.`,`CATALOG_ERROR`,{surfaceId:t}):new Tt(`Catalog not found: ${n}`,`CATALOG_ERROR`,{surfaceId:t});if(l?.protocolVersion&&s&&!Jc(l.protocolVersion,s)){let e=`Surface '${t}' catalog '${n??l.id}' specification version (${l.protocolVersion}) does not match message protocol version (${s}).`;throw H(s,`1.0`)?new Tt(e,`CATALOG_ERROR`,{surfaceId:t}):new B(e,void 0,`VALIDATION_ERROR`,{surfaceId:t})}if(this.model.getSurface(t))throw new Et(`Surface ${t} already exists.`,void 0,`INTEGRITY_ERROR`,{surfaceId:t});let u=this.validateSurfaceTheme(r,l,t),d=l?.protocolVersion??s,f=new gc(t,l,new Map(this.registeredCatalogs.filter(e=>Jc(e.protocolVersion,d)).map(e=>[e.id,e])),u,i??!1,void 0,e.rootId??`root`,e.metadata,d);this.model.addSurface(f),o&&f.dataModel.set(`/`,o),a&&a.length>0&&this.processUpdateComponentsOp({type:`updateComponents`,surfaceId:t,components:a})}processDeleteSurfaceOp(e){e.surfaceId&&this.model.deleteSurface(e.surfaceId)}validateComponentProperties(e,t){let{id:n,component:r}=e;if(typeof n!=`string`||!n)throw new B(`Component '${r}' is missing an 'id'; entries require a valid string 'id'.`);let i=this.resolveComponentCatalog(e,t);`metadata`in e&&e.metadata!==void 0&&qt(e.metadata);let a=t.componentsModel.get(n),o=!this.validationConfig&&!H(t.protocolVersion,`1.0`);new Ml(i,this.validationConfig).validateComponent(this.componentPayloadForValidation(e,t,i),a?.type,{skipNestedFunctions:o}),o||this.validateNestedFunctionCalls(e,t,i)}componentPayloadForValidation(e,t,n){let{catalogId:r,...i}=e;return H(t.protocolVersion,`1.0`)&&n!==t.defaultCatalog&&(i.catalogId=n.id),i}resolveComponentCatalog(e,t){let{id:n,component:r,catalogId:i}=e,a=`Component '${n}'`,o=H(t.protocolVersion,`1.0`);if(typeof i==`string`&&(i||o))return this.resolveSurfaceItemCatalog(t,i,a);if(!o){let e=typeof n==`string`?t.componentsModel.get(n):void 0;if(e&&(typeof r!=`string`||!r||r===e.type))return e.catalog}return this.resolveSurfaceItemCatalog(t,void 0,a)}validateSingleNestedCall(e,t,n,r,i){let a=e.catalogId;if(a!==void 0&&typeof a!=`string`)throw new B(Al(t),void 0,`VALIDATION_ERROR`,{path:i||void 0,surfaceId:n.id});let o=this.resolveNestedCallCatalog(n,a,t,i);jl(a,r.id,{catalogIsDefault:r===n.defaultCatalog})||this.validateExternalCatalogFunction(o,t,e.args,n.id,i)}resolveNestedCallCatalog(e,t,n,r){try{return this.resolveSurfaceItemCatalog(e,t,`Function call '${n}'`)}catch(t){throw t instanceof St&&(t.surfaceId=e.id,r&&(t.path=r)),t}}validateExternalCatalogFunction(e,t,n,r,i){try{new Ml(e,this.validationConfig).validateFunction(t,n??{})}catch(e){throw e instanceof St&&(e.surfaceId=r,i&&(e.path=e.path&&e.path!==`/`?`${i}${e.path}`:i)),e}}validateNestedFunctionCalls(e,t,n){if(!H(t.protocolVersion,`1.0`))return;let r=(e,i)=>{if(Array.isArray(e)){for(let t=0;t<e.length;t++)r(e[t],`${i}/${t}`);return}if(typeof e!=`object`||!e)return;let a=e,o=a[`@call`];typeof o==`string`&&!o.startsWith(`@`)&&this.validateSingleNestedCall(a,o,t,n,i);for(let[e,t]of Object.entries(a))r(t,`${i}/${e}`)};for(let[t,n]of Object.entries(e))t!==`id`&&t!==`component`&&t!==`catalogId`&&t!==`metadata`&&r(n,`/${t}`)}resolveSurfaceItemCatalog(e,t,n){if(t!==void 0&&!e.availableCatalogs.has(t)){let r=this.registeredCatalogs.find(e=>e.id===t);if(r)throw new Tt(`${n} names catalog '${t}', whose specification version (${r.protocolVersion}) does not match surface '${e.id}' version (${e.protocolVersion}).`)}return e.resolveCatalog(t,n)}applyComponentUpdate(e,t){let{id:n,component:r,catalogId:i,metadata:a,...o}=e;if(typeof n!=`string`)return;let s=Ll(a),c=this.resolveComponentCatalog(e,t),l=t.componentsModel.get(n);if(l){let e=typeof r==`string`?r:l.type;if(e!==l.type||l.catalog.id!==c.id){t.componentsModel.removeComponent(n);let r=new yc(n,e,o,c,s);t.componentsModel.addComponent(r)}else ls(()=>{l.applyUpdate(o,s)})}else{if(typeof r!=`string`||!r)throw new B(`Cannot create component ${n} without a type.`);let e=new yc(n,r,o,c,s);t.componentsModel.addComponent(e)}}rebaseComponentValidationError(e,t,n){if(e instanceof St&&(e.surfaceId||=n,e instanceof B&&(e.path=e.path&&e.path!==`/`?`/components/${t}${e.path}`:`/components/${t}`,Array.isArray(e.details))))for(let t of e.details)typeof t==`object`&&t&&!(`surfaceId`in t)&&(t.surfaceId=n)}validateComponentsBatch(e,t){let n=/* @__PURE__ */ new Set;for(let r=0;r<e.components.length;r++){let i=e.components[r];if(i&&typeof i==`object`&&typeof i.id==`string`){if(n.has(i.id))throw new Et(`Duplicate component ID: '${i.id}'`,[i.id],`INTEGRITY_ERROR`,{surfaceId:e.surfaceId,path:`/components/${r}/id`});n.add(i.id)}try{this.validateComponentProperties(i,t)}catch(t){throw this.rebaseComponentValidationError(t,r,e.surfaceId),t}}}validateSurfaceComponentGraph(e,t){try{return Pc(t,e.components,this.validationConfig,(e,t)=>this.resolveComponentCatalog(e,t),this.graphBounds)}catch(t){throw t instanceof St&&!t.surfaceId&&(t.surfaceId=e.surfaceId),t}}processUpdateComponentsOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new Et(`Surface not found for message: ${e.surfaceId}`,void 0,`INTEGRITY_ERROR`,{surfaceId:e.surfaceId});this.validateComponentsBatch(e,t);let n=this.validateSurfaceComponentGraph(e,t);ls(()=>{for(let n of e.components)this.applyComponentUpdate(n,t)}),n&&Fc(t.componentsModel,n,this.graphBounds)}processUpdateDataModelOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new Et(`Surface not found for message: ${e.surfaceId}`,void 0,`INTEGRITY_ERROR`,{surfaceId:e.surfaceId});if(e.path!==void 0&&e.path!==``&&(!e.path.startsWith(`/`)||!cc.test(e.path))){let t=`Invalid path syntax: '${e.path}' (path must be a valid RFC 6901 JSON Pointer starting with '/')`;throw new B(t,[{path:`/path`,code:`invalid_value`,message:t,surfaceId:e.surfaceId}],`VALIDATION_ERROR`,{path:`/path`,surfaceId:e.surfaceId})}let n=e.path||`/`,r=e.value;try{t.dataModel.set(n,r)}catch(t){throw t instanceof Ct&&!t.surfaceId&&(t.surfaceId=e.surfaceId),t}}};function Ll(e){if(e&&typeof e==`object`&&!Array.isArray(e))return e}function Rl(e,t,n){return t===void 0?e.find(e=>!n||Jc(e.protocolVersion,n))??e[0]:e.find(e=>e.id===t)}function zl(e){return{allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1,...e}}var Bl=class{constructor(e,t,n=`/`,r,i){let a=e.componentsModel.get(t);if(!a)throw new wt(`Component not found: ${t}`);this.componentModel=a,this.surfaceComponents=e.componentsModel,this.theme=e.theme,this.dataContext=new Ms(e,n,i,r),this._actionDispatcher=(t,n)=>e.dispatchAction(t,this.componentModel.id,n)}dispatchAction(e,t){return this._actionDispatcher(e,t)}},Vl=/* @__PURE__ */ new WeakMap;function Hl(e){let t=Vl.get(e);if(t)return t;let n=Ql(e),r=n.type===`OBJECT`&&n.shape&&!(`accessibility`in n.shape)?{...n,shape:{...n.shape,accessibility:Ql(ln)}}:n;return Vl.set(e,r),r}function Ul(e){let t=e;for(;t;){let e=t._def?.typeName;if(e===`ZodOptional`||e===`ZodNullable`||e===`ZodDefault`||e===`ZodReadonly`)t=t._def.innerType;else if(e===`ZodEffects`)t=t._def.schema;else if(e===`ZodBranded`)t=t._def.type;else if(e===`ZodLazy`)t=t._def.getter();else break}return t}function Wl(e){let t=e,n=``;for(;t&&(n=t.description??t._def?.description??``,!n);){let e=t._def?.typeName;if(e===`ZodOptional`||e===`ZodNullable`||e===`ZodDefault`||e===`ZodReadonly`)t=t._def.innerType;else if(e===`ZodEffects`)t=t._def.schema;else if(e===`ZodBranded`)t=t._def.type;else if(e===`ZodLazy`)t=t._def.getter();else break}return!n||!n.startsWith(`REF:`)?``:ro(n.slice(4).split(`|`)[0])}function Gl(e){let t=Wl(e);if(t===`Checkable`||t===`CheckRule`)return!0;let n=Ul(e);if(n?._def?.typeName===`ZodArray`){let e=n._def.type;if(Wl(e)===`CheckRule`)return!0}return!1}function Kl(e){if(Wl(e)===`Action`)return!0;let t=Ul(e)._def;return t?.typeName===`ZodObject`&&!!t.shape?.().event}function ql(e){let t=Wl(e);if(t===`DataBinding`||t===`FunctionCall`||t.startsWith(`Dynamic`))return!0;let n=Ul(e)._def;if(n?.typeName!==`ZodObject`)return!1;let r=n.shape?.()||{},i=Object.values(r).some(e=>Wl(e)===`ComponentId`);return(!!r[`@path`]||!!r.path||!!r[`@call`]||!!r.call)&&!i}function Jl(e){if(nn(e)===`child-list`||Wl(e)===`ChildList`)return!0;let t=Ul(e)._def;if(t?.typeName!==`ZodObject`)return!1;let n=t.shape?.()||{};return Object.values(n).some(e=>Wl(e)===`ComponentId`)}function Yl(e,t){return(e===`DataBinding`||e===`FunctionCall`||e.startsWith(`Dynamic`))&&t!==`ZodObject`&&t!==`ZodArray`}function Xl(e){if(e.some(Kl))return{type:`ACTION`};if(e.some(ql))return{type:`DYNAMIC`};if(e.some(Jl))return{type:`STRUCTURAL`}}function Zl(e){let t={};for(let[n,r]of Object.entries(e))t[n]=Ql(r);return t}function Ql(e){let t=Wl(e);if(Gl(e))return{type:`CHECKABLE`};if(t===`Action`)return{type:`ACTION`};let n=Ul(e);if(nn(n)===`child-list`||t===`ChildList`)return{type:`STRUCTURAL`};if(Yl(t,n._def?.typeName))return{type:`DYNAMIC`};if(n._def.typeName===`ZodUnion`){let e=Xl(n._def.options);if(e)return e}return n._def.typeName===`ZodArray`?{type:`ARRAY`,element:Ql(n._def.type)}:n._def.typeName===`ZodObject`?{type:`OBJECT`,shape:Zl(n._def.shape())}:{type:`STATIC`}}var $l=1e4;function eu(e){return Array.isArray(e)?e.length>1e4?e.slice(0,$l):e:[]}var tu=class{constructor(e,t){this.dataListeners=[],this.propsListeners=[],this.currentProps={},this.isConnected=!1,this.actionClosures=/* @__PURE__ */ new Map,this.context=e,this.behaviorTree=Hl(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(e=>e()),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 r=this.context.dataContext.subscribeDynamicValue(e,e=>{this.updateDeepValue(t,e),this.notify()});return n?r.unsubscribe():this.dataListeners.push(()=>r.unsubscribe()),r.value}resolveDeepSync(e,t=0){if(typeof e!=`object`||!e)return e;if(t>1e3)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(e=>this.resolveDeepSync(e,t+1));let n={};for(let[r,i]of Object.entries(e))n[r]=this.resolveDeepSync(i,t+1);return n}bindAction(e,t){let n=t.join(`/`),r=this.actionClosures.get(n);if(r&&nu(r.raw,e))return r.closure;let i=async t=>{if(!e||typeof e!=`object`)return;let n=e;if(n.functionCall&&typeof n.functionCall==`object`||`call`in n||`@call`in n){await this.context.dataContext.resolveAction(e,{userActivation:!0});return}let r=this.context.dataContext.resolveAction(e,{userActivation:!0});r!==void 0&&await this.context.dispatchAction(r,t?.metadata)};return this.actionClosures.set(n,{raw:e,closure:i}),i}mapTemplateChildren(e,t,n){let r=eu(e),i=this.context.dataContext.nested(n);return r.map((e,n)=>({id:t,basePath:i.nested(String(n)).path}))}bindStructuralTemplate(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return e;let r=e,i=typeof r.path==`string`?r.path:void 0,a=typeof r.componentId==`string`?r.componentId:void 0;if(!i||!a)return e;let o=H(this.context.dataContext.surface?.protocolVersion??this.context.dataContext.surface?.defaultCatalog?.protocolVersion,`1.0`)?{"@path":i}:{path:i},s=this.context.dataContext.subscribeDynamicValue(o,e=>{let n=this.mapTemplateChildren(e,a,i);this.updateDeepValue(t,n),this.notify()});return n?s.unsubscribe():this.dataListeners.push(()=>s.unsubscribe()),this.mapTemplateChildren(s.value,a,i)}extractValidationResult(e,t,n=`Validation failed`){if(typeof e==`object`&&e&&`valid`in e){let r=e,i=r.message,a=r.severity===`warning`||r.severity===`info`?r.severity:`error`,o=typeof r.code==`string`?r.code:void 0,s=t===void 0?i==null?n:String(i):t;return{valid:!!r.valid,message:s,...o===void 0?{}:{code:o},severity:a}}return{valid:!!e,message:t??n,severity:`error`}}bindCheckable(e,t,n){let r=Array.isArray(e)?e:[],i=r.map(()=>({valid:!0,message:``,severity:`error`})),a=t.slice(0,-1),o=()=>{let e=i.filter(e=>!e.valid&&e.severity===`error`).map(e=>e.message),t=i.filter(e=>!e.valid);this.updateDeepValue([...a,`isValid`],e.length===0),this.updateDeepValue([...a,`validationErrors`],e),this.updateDeepValue([...a,`validationResults`],t)},s=()=>{o(),this.notify()};return r.forEach((e,t)=>{let r=typeof e==`object`&&e?e:void 0,a=r&&r.condition!==void 0?r.condition:e,o=typeof r?.message==`string`?r.message:void 0,c=this.isPathBoundCondition(a)?void 0:o,l=o??`Validation failed`;i[t].message=l;let u=this.context.dataContext.subscribeDynamicValue(a,e=>{i[t]=this.extractValidationResult(e,c,l),s()});n?u.unsubscribe():this.dataListeners.push(()=>u.unsubscribe()),i[t]=this.extractValidationResult(u.value,c,l)}),o(),e}isPathBoundCondition(e){if(typeof e!=`object`||!e)return!1;let t=e;return this.context.dataContext.atLeastV10?typeof t[`@path`]==`string`&&!(`@call`in t):typeof t.path==`string`&&!(`call`in t)}bindObject(e,t,n,r){let i={};for(let[a,o]of Object.entries(e)){let e=t[a]||{type:`STATIC`};i[a]=this.resolveAndBind(o,e,[...n,a],r)}for(let[n,r]of Object.entries(t))if(r.type===`DYNAMIC`){let t=`set${n.charAt(0).toUpperCase()+n.slice(1)}`,r=e[n];i[t]=e=>{if(r&&typeof r==`object`){let t=r,n=t[this.context.dataContext.atLeastV10?`@path`:`path`];typeof n==`string`&&(this.context.dataContext.atLeastV10||!(`componentId`in t))&&this.context.dataContext.set(n,e)}}}return i}resolveAndBind(e,t,n,r){if(e==null)return e;switch(t.type){case`DYNAMIC`:return this.bindDynamicValue(e,n,r);case`ACTION`:return this.bindAction(e,n);case`STRUCTURAL`:return this.bindStructuralTemplate(e,n,r);case`CHECKABLE`:return this.bindCheckable(e,n,r);case`STATIC`:return e;case`ARRAY`:return Array.isArray(e)?e.map((e,i)=>this.resolveAndBind(e,t.element,[...n,i.toString()],r)):e;case`OBJECT`:return typeof e==`object`?this.bindObject(e,t.shape,n,r):e}}updateDeepValue(e,t){this.currentProps=this.cloneAndUpdate(this.currentProps,e,t)}cloneAndUpdate(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(Array.isArray(e)){let t=[...e];return t[Number(r)]=this.cloneAndUpdate(t[Number(r)],i,n),t}{let t=typeof e==`object`&&e?e:{};return{...t,[r]:this.cloneAndUpdate(t[r],i,n)}}}dispose(){this.isConnected&&(this.isConnected=!1,this.dataListeners.forEach(e=>e()),this.dataListeners=[],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 nu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>nu(e,t[n]));let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&nu(e[n],t[n]))}var ru=tn(P().describe(`REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.`),`component-id`),iu=L({path:P().describe(`A JSON Pointer path to a value in the data model.`)}).strict().describe(`REF:#/$defs/DataBinding`),au=R([P(),F(),pt(),I(mt()),iu,vt(()=>ou)]).describe(`REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.`),ou=L({call:P().describe(`The name of the function to call.`),args:_t(P(),R([au,_t(P(),mt()).describe(`A literal object argument (e.g. configuration).`)])).describe(`Arguments passed to the function.`).optional(),returnType:z([`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.`),J=R([P(),iu,ou]).describe(`REF:#/$defs/DynamicString|Represents a string`),su=L({label:J.optional(),description:J.optional()}).describe(`REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers.`);L({id:ru,accessibility:su.optional()}).describe(`REF:#/$defs/ComponentCommon`);var cu=tn(R([I(ru).describe(`A static list of child component IDs.`),L({componentId:ru,path:P().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`),lu=R([F(),iu,ou]).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.`),uu=R([pt(),iu,ou]).describe(`REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean.`),du=R([I(P()),iu,ou]).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.`),fu=L({condition:uu,message:P().describe(`The error message to display if the check fails.`)}).strict().describe(`REF:#/$defs/CheckRule|A single validation rule applied to an input component.`);L({checks:I(fu).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.`);var pu=R([L({event:L({name:P().describe(`The name of the action to be dispatched to the server.`),context:_t(P(),au).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.`),L({functionCall:ou}).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.`),mu=/* @__PURE__ */ e((/* @__PURE__ */ t(((e,t)=>{t.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&typeof e==`object`&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&typeof e!=`string`)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=0)}([function(e,t,n){n.r(t),n.d(t,`validateHTMLColorName`,(function(){return o})),n.d(t,`validateHTMLColorSpecialName`,(function(){return s})),n.d(t,`validateHTMLColorHex`,(function(){return c})),n.d(t,`validateHTMLColorRgb`,(function(){return p})),n.d(t,`validateHTMLColorHsl`,(function(){return m})),n.d(t,`validateHTMLColorHwb`,(function(){return h})),n.d(t,`validateHTMLColorLab`,(function(){return g})),n.d(t,`validateHTMLColorLch`,(function(){return _})),n.d(t,`validateHTMLColor`,(function(){return v}));let r=e=>e&&typeof e==`string`,i=/* @__PURE__ */ `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`.split(`.`),a=[`currentColor`,`inherit`,`transparent`],o=e=>{let t=!1;return r(e)&&i.map(n=>(e.toLowerCase()===n.toLowerCase()&&(t=!0),null)),t},s=e=>{let t=!1;return r(e)&&a.map(n=>(e.toLowerCase()===n.toLowerCase()&&(t=!0),null)),t},c=e=>r(e)?e&&/^#([\da-f]{3}){1,2}$|^#([\da-f]{4}){1,2}$/i.test(e):!1,l=`(([0-9]|[1-9][0-9]|100)%)`,u=`(${l}|(0?((\\.([\\d]{1,5}))?))|1)`,d=`([\\s]{0,5})\\)?)(([\\s]{0,5})(\\/?)([\\s]{1,5})${`(((${l}))|(0?((\\.([\\d]{1,5}))?))|1))?`}([\\s]{0,5})\\)`,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)(deg)?)`,p=e=>{if(r(e)){let t=`([\\s]{0,5})([\\d]{1,5})%?([\\s]{0,5}),?`,n=`((([\\s]{0,5}),?([\\s]{0,5}))|(([\\s]{1,5})))`,r=RegExp(`^(rgb)a?\\(${`${t}${n}`}${`${t}${n}`}${`${t}${n}`}((\\/?([\\s]{0,5})(0?\\.?([\\d]{1,5})%?([\\s]{0,5}))?|1|0))?\\)$`);return e&&r.test(e)}return!1},m=e=>{if(r(e)){let t=RegExp(`^(hsl)a?\\((([\\s]{0,5})(${f}|(([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|${l})((([\\s]{0,5}),([\\s]{0,5}))|(([\\s]{1,5}))))(([\\s]{0,5})(0|${l})([\\s]{0,5})\\)?)(([\\s]{0,5})(\\/?|,?)([\\s]{0,5})(((${l}))|(0?((\\.([\\d]{1,5}))?))|1))?\\)$`);return e&&t.test(e)}return!1},h=e=>{if(r(e)){let t=RegExp(`^(hwb\\(([\\s]{0,5})${f}([\\s]{1,5}))((0|${l})([\\s]{1,5}))((0|${l})${d}$`);return e&&t.test(e)}return!1},g=e=>{if(r(e)){let t=`(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])((\\.([\\d]{1,5}))?)?|160))`,n=RegExp(`^(lab\\(([\\s]{0,5})((([\\d]{0,5})((\\.([\\d]{1,5}))?))%)([\\s]{1,5})${t}([\\s]{1,5})${t}${d}$`);return e&&n.test(e)}return!1},_=e=>{if(r(e)){let t=`((${f})|(0|${u})|(([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))`,n=`(\\/([\\s]{0,5})${u})`,r=RegExp(`^lch\\(${`(([\\s]{0,5})((([0-9]|[1-9][0-9])?((\\.([\\d]{1,5}))?)|100)(%)?)([\\s]{1,5})(([\\d]{0,5})((\\.([\\d]{1,5}))?))([\\s]{1,5})${t}([\\s]{0,5})(${n})?)`}\\)$`);return e&&r.test(e)}return!1},v=e=>!!(e&&c(e)||p(e)||m(e)||h(e)||g(e)||_(e));t.default=e=>!!(e&&c(e)||o(e)||s(e)||p(e)||m(e)||h(e)||g(e)||_(e))}])})))(),1),hu=/^var\(\s*--[a-zA-Z0-9_-]+(?:\s*,\s*[^)]+)?\s*\)$/;function gu(e){if(typeof e!=`string`||!e.trim())return!1;let t=e.trim();if(hu.test(t))return!0;if(typeof CSS<`u`&&typeof CSS.supports==`function`)return CSS.supports(`color`,t);let n=typeof mu.default==`function`?mu.default:mu.default?.default;return typeof n==`function`&&n(t)}var _u=L({primaryColor:P().refine(e=>gu(e),`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:P().optional().describe(`A URL for an image that identifies the agent or tool associated with the surface.`),agentDisplayName:P().optional().describe(`Text to be displayed next to the surface to identify the agent or tool that created it.`)}).passthrough(),Y=Nr(`CatalogComponentCommon`,L({weight:F().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()}));Nr(`theme`,L({primaryColor:P().regex(/* @__PURE__ */ 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:G(P().describe(`A URL for an image that identifies the agent or tool associated with the surface.`),{keywords:{format:`uri`}}).optional(),agentDisplayName:P().describe(`Text to be displayed next to the surface to identify the agent or tool that created it.`).optional()}),{keywords:{additionalProperties:!0}});var vu={name:`Text`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),text:J.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:z([`h1`,`h2`,`h3`,`h4`,`h5`,`caption`,`body`]).default(`body`).describe(`A hint for the base text style.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y]})},yu={name:`Image`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),url:J.describe(`REF:#/$defs/DynamicString|The URL of the image to display.`),description:J.describe(`REF:#/$defs/DynamicString|Accessibility text for the image.`).optional(),fit:z([`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:z([`icon`,`avatar`,`smallFeature`,`mediumFeature`,`largeFeature`,`header`]).default(`mediumFeature`).describe(`A hint for the image size and style.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y]})},bu={name:`Icon`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),name:R([z(/* @__PURE__ */ `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`.split(`.`)),G(L({svgPath:P()}),{closure:`additionalProperties`}),iu.describe(`REF:#/$defs/DataBinding`)]).describe(`The name of the icon to display.`)}).strict(),{mixins:[`ComponentCommon`,Y]})},xu={name:`Video`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),url:J.describe(`REF:#/$defs/DynamicString|The URL of the video to display.`)}).strict(),{mixins:[`ComponentCommon`,Y]})},Su={name:`AudioPlayer`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),url:J.describe(`REF:#/$defs/DynamicString|The URL of the audio to be played.`),description:J.describe(`REF:#/$defs/DynamicString|A description of the audio, such as a title or summary.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y]})},Cu={name:`Row`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),children:cu.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:z([`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:z([`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`,Y]})},wu={name:`Column`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),children:cu.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:z([`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:z([`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`,Y]})},Tu={name:`List`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),children:cu.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:z([`vertical`,`horizontal`]).default(`vertical`).describe(`The direction in which the list items are laid out.`).optional(),align:z([`start`,`center`,`end`,`stretch`]).default(`stretch`).describe(`Defines the alignment of children along the cross axis.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y]})},Eu={name:`Card`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),child:ru.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`,Y]})},Du={name:`Tabs`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),tabs:I(G(L({title:J.describe(`REF:#/$defs/DynamicString|The tab title.`),child:ru.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`,Y]})},Ou={name:`Modal`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),trigger:ru.describe(`REF:#/$defs/ComponentId|The ID of the component that opens the modal when interacted with (e.g., a button).`),content:ru.describe(`REF:#/$defs/ComponentId|The ID of the component to be displayed inside the modal.`)}).strict(),{mixins:[`ComponentCommon`,Y]})},ku={name:`Divider`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),axis:z([`horizontal`,`vertical`]).default(`horizontal`).describe(`The orientation of the divider.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y]})},Au={name:`Button`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),checks:I(fu.describe(`REF:#/$defs/CheckRule`)).describe(`A list of checks to perform. These are function calls that must return a boolean indicating validity.`).optional(),child:ru.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:z([`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:pu.describe(`REF:#/$defs/Action`)}).strict(),{mixins:[`ComponentCommon`,Y,`Checkable`]})},ju={name:`TextField`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),checks:I(fu.describe(`REF:#/$defs/CheckRule`)).describe(`A list of checks to perform. These are function calls that must return a boolean indicating validity.`).optional(),label:J.describe(`REF:#/$defs/DynamicString|The text label for the input field.`),value:J.describe(`REF:#/$defs/DynamicString|The value of the text field.`).optional(),variant:z([`longText`,`number`,`shortText`,`obscured`]).default(`shortText`).describe(`The type of input field to display.`).optional(),validationRegexp:P().describe(`A regular expression used for client-side validation of the input.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y,`Checkable`]})},Mu={name:`CheckBox`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),checks:I(fu.describe(`REF:#/$defs/CheckRule`)).describe(`A list of checks to perform. These are function calls that must return a boolean indicating validity.`).optional(),label:J.describe(`REF:#/$defs/DynamicString|The text to display next to the checkbox.`),value:uu.describe(`REF:#/$defs/DynamicBoolean|The current state of the checkbox (true for checked, false for unchecked).`)}).strict(),{mixins:[`ComponentCommon`,Y,`Checkable`]})},Nu={name:`ChoicePicker`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),checks:I(fu.describe(`REF:#/$defs/CheckRule`)).describe(`A list of checks to perform. These are function calls that must return a boolean indicating validity.`).optional(),label:J.describe(`REF:#/$defs/DynamicString|The label for the group of options.`).optional(),variant:z([`multipleSelection`,`mutuallyExclusive`]).default(`mutuallyExclusive`).describe(`A hint for how the choice picker should be displayed and behave.`).optional(),options:I(G(L({label:J.describe(`REF:#/$defs/DynamicString|The text to display for this option.`),value:P().describe(`The stable value associated with this option.`)}),{closure:`additionalProperties`})).describe(`The list of available options to choose from.`),value:du.describe(`REF:#/$defs/DynamicStringList|The list of currently selected values. This should be bound to a string array in the data model.`),displayStyle:z([`checkbox`,`chips`]).default(`checkbox`).describe(`The display style of the component.`).optional(),filterable:pt().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`,Y,`Checkable`]})},Pu={name:`Slider`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),checks:I(fu.describe(`REF:#/$defs/CheckRule`)).describe(`A list of checks to perform. These are function calls that must return a boolean indicating validity.`).optional(),label:J.describe(`REF:#/$defs/DynamicString|The label for the slider.`).optional(),min:F().default(0).describe(`The minimum value of the slider.`).optional(),max:F().describe(`The maximum value of the slider.`),value:lu.describe(`REF:#/$defs/DynamicNumber|The current value of the slider.`)}).strict(),{mixins:[`ComponentCommon`,Y,`Checkable`],required:[`value`,`max`]})},Fu={name:`DateTimeInput`,schema:G(L({...Y.shape,accessibility:su.describe(`REF:#/$defs/AccessibilityAttributes`).optional(),checks:I(fu.describe(`REF:#/$defs/CheckRule`)).describe(`A list of checks to perform. These are function calls that must return a boolean indicating validity.`).optional(),value:J.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:pt().default(!1).describe(`If true, allows the user to select a date.`).optional(),enableTime:pt().default(!1).describe(`If true, allows the user to select a time.`).optional(),min:G(J.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:G(J.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:J.describe(`REF:#/$defs/DynamicString|The text label for the input field.`).optional()}).strict(),{mixins:[`ComponentCommon`,Y,`Checkable`]})},Iu={name:`required`,returnType:`boolean`,description:`Checks that the value is not null, undefined, or empty.`,schema:G(L({value:mt().refine(e=>e!==void 0,`Required`).describe(`The value to check.`)}),{closure:`additionalProperties`})},Lu={name:`regex`,returnType:`boolean`,description:`Checks that the value matches a regular expression string.`,schema:G(L({value:J.describe(`REF:#/$defs/DynamicString`),pattern:P().describe(`The regex pattern to match against.`)}),{closure:`unevaluatedProperties`})},Ru={name:`length`,returnType:`boolean`,description:`Checks string length constraints.`,schema:G(L({value:J.describe(`REF:#/$defs/DynamicString`),min:G(F().int().describe(`The minimum allowed length.`),{keywords:{minimum:0}}).optional(),max:G(F().int().describe(`The maximum allowed length.`),{keywords:{minimum:0}}).optional()}),{closure:`unevaluatedProperties`,keywords:{anyOf:[{required:[`min`]},{required:[`max`]}]}})},zu={name:`numeric`,returnType:`boolean`,description:`Checks numeric range constraints.`,schema:G(L({value:lu.describe(`REF:#/$defs/DynamicNumber`),min:F().describe(`The minimum allowed value.`).optional(),max:F().describe(`The maximum allowed value.`).optional()}),{closure:`unevaluatedProperties`,keywords:{anyOf:[{required:[`min`]},{required:[`max`]}]}})},Bu={name:`email`,returnType:`boolean`,description:`Checks that the value is a valid email address.`,schema:G(L({value:J.describe(`REF:#/$defs/DynamicString`)}),{closure:`unevaluatedProperties`})},Vu={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:G(L({value:J.describe(`REF:#/$defs/DynamicString`)}),{closure:`unevaluatedProperties`})},Hu={name:`formatNumber`,returnType:`string`,description:`Formats a number with the specified grouping and decimal precision.`,schema:G(L({value:lu.describe(`REF:#/$defs/DynamicNumber|The number to format.`),decimals:lu.describe(`REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.`).optional(),grouping:uu.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`})},Uu={name:`formatCurrency`,returnType:`string`,description:`Formats a number as a currency string.`,schema:G(L({value:lu.describe(`REF:#/$defs/DynamicNumber|The monetary amount.`),currency:J.describe(`REF:#/$defs/DynamicString|The ISO 4217 currency code (e.g., 'USD', 'EUR').`),decimals:lu.describe(`REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.`).optional(),grouping:uu.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`})},Wu={name:`formatDate`,returnType:`string`,description:`Formats a timestamp into a string using a pattern.`,schema:G(L({value:au.describe(`REF:#/$defs/DynamicValue|The date to format.`),format:J.describe(`REF:#/$defs/DynamicString|A Unicode TR35 date pattern string.
4
+
5
+ Token Reference:
6
+ - Year: 'yy' (26), 'yyyy' (2026)
7
+ - Month: 'M' (1), 'MM' (01), 'MMM' (Jan), 'MMMM' (January)
8
+ - Day: 'd' (1), 'dd' (01), 'E' (Tue), 'EEEE' (Tuesday)
9
+ - Hour (12h): 'h' (1-12), 'hh' (01-12) - requires 'a' for AM/PM
10
+ - Hour (24h): 'H' (0-23), 'HH' (00-23) - Military Time
11
+ - Minute: 'mm' (00-59)
12
+ - Second: 'ss' (00-59)
13
+ - Period: 'a' (AM/PM)
14
+
15
+ Examples:
16
+ - 'MMM dd, yyyy' -> 'Jan 16, 2026'
17
+ - 'HH:mm' -> '14:30' (Military)
18
+ - 'h:mm a' -> '2:30 PM'
19
+ - 'EEEE, d MMMM' -> 'Friday, 16 January'`)}),{required:[`format`,`value`],closure:`unevaluatedProperties`})},Gu={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:G(L({value:lu.describe(`REF:#/$defs/DynamicNumber|The numeric value used to determine the plural category.`),zero:J.describe(`REF:#/$defs/DynamicString|String for the 'zero' category (e.g., 0 items).`).optional(),one:J.describe(`REF:#/$defs/DynamicString|String for the 'one' category (e.g., 1 item).`).optional(),two:J.describe(`REF:#/$defs/DynamicString|String for the 'two' category (used in Arabic, Welsh, etc.).`).optional(),few:J.describe(`REF:#/$defs/DynamicString|String for the 'few' category (e.g., small groups in Slavic languages).`).optional(),many:J.describe(`REF:#/$defs/DynamicString|String for the 'many' category (e.g., large groups in various languages).`).optional(),other:J.describe(`REF:#/$defs/DynamicString|The default/fallback string (used for general plural cases).`)}),{closure:`unevaluatedProperties`})},Ku={name:`openUrl`,returnType:`void`,description:`Opens the specified URL in a browser or handler. This function has no return value.`,schema:G(L({url:G(P().describe(`The URL to open.`),{keywords:{format:`uri`}})}),{closure:`additionalProperties`})},qu={name:`and`,returnType:`boolean`,description:`Performs a logical AND operation on a list of boolean values.`,schema:G(L({values:I(uu.describe(`REF:#/$defs/DynamicBoolean`)).min(2).describe(`The list of boolean values to evaluate.`)}),{closure:`unevaluatedProperties`})},Ju={name:`or`,returnType:`boolean`,description:`Performs a logical OR operation on a list of boolean values.`,schema:G(L({values:I(uu.describe(`REF:#/$defs/DynamicBoolean`)).min(2).describe(`The list of boolean values to evaluate.`)}),{closure:`unevaluatedProperties`})},Yu={name:`not`,returnType:`boolean`,description:`Performs a logical NOT operation on a boolean value.`,schema:G(L({value:uu.describe(`REF:#/$defs/DynamicBoolean|The boolean value to negate.`)}),{closure:`unevaluatedProperties`})},Xu=()=>bt(e=>e===null?void 0:e,xt.number()),Zu=()=>bt(e=>e==null?void 0:String(e),P()),Qu=()=>mt().refine(e=>e!==void 0,`Required`),$u={name:`add`,returnType:`number`,schema:L({a:Xu(),b:Xu()})},ed={name:`subtract`,returnType:`number`,schema:L({a:Xu(),b:Xu()})},td={name:`multiply`,returnType:`number`,schema:L({a:Xu(),b:Xu()})},nd={name:`divide`,returnType:`number`,schema:L({a:Xu(),b:Xu()})},rd={name:`equals`,returnType:`boolean`,schema:L({a:Qu(),b:Qu()})},id={name:`not_equals`,returnType:`boolean`,schema:L({a:Qu(),b:Qu()})},ad={name:`greater_than`,returnType:`boolean`,schema:L({a:Xu(),b:Xu()})},od={name:`less_than`,returnType:`boolean`,schema:L({a:Xu(),b:Xu()})},sd={name:`contains`,returnType:`boolean`,schema:L({string:Zu(),substring:Zu()})},cd={name:`starts_with`,returnType:`boolean`,schema:L({string:Zu(),prefix:Zu()})},ld={name:`ends_with`,returnType:`boolean`,schema:L({string:Zu(),suffix:Zu()})},ud=1e4,dd=1e3,fd=/^[+-]?(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,pd=class e{parse(t,n=0){if(n>e.MAX_DEPTH)throw new V(`Max recursion depth reached in parse`);if(t&&t.length>1e4)throw new V(`Expression template length (${t.length}) exceeds maximum limit (${ud})`);if(!t)return[];if(!t.includes("${"))return[t];let r=[],i=new gd(t);for(;!i.isAtEnd();){if(r.length>=1e3)throw new V(`Expression parts count exceeds maximum limit (${dd})`);if(i.matches("${")){i.advance(2);let e=this.extractInterpolationContent(i),t=this.parseExpression(e,n+1);t!==null&&r.push(t)}else if(i.peek()===`\\`&&i.peek(1)===`$`&&i.peek(2)===`{`)i.advance(),r.push("${"),i.advance(2);else{let e=i.pos;for(;!i.isAtEnd()&&!(i.matches("${")||i.peek()===`\\`&&i.peek(1)===`$`&&i.peek(2)===`{`);)i.advance();r.push(i.input.substring(e,i.pos))}}return r.filter(e=>e!==null&&e!==``)}extractInterpolationContent(e){let t=e.pos,n=1;for(;!e.isAtEnd()&&n>0;){let t=e.advance();if(t===`{`)n++;else if(t===`}`)n--;else if(t===`'`||t===`"`){let n=t;for(;!e.isAtEnd();){let t=e.advance();if(t===`\\`)e.advance();else if(t===n)break}}}if(n>0)throw new V(`Unclosed interpolation: missing '}'`);return e.input.substring(t,e.pos-1)}parseExpression(e,t=0){if(e=e.trim(),!e)return``;let n=new gd(e),r=this.parseExpressionInternal(n,t);if(!n.isAtEnd())throw new V(`Unexpected characters at end of expression: '${n.input.substring(n.pos)}'`);return r}parseExpressionInternal(t,n){if(n>e.MAX_DEPTH)throw new V(`Max recursion depth reached in parse`);if(t.skipWhitespace(),t.isAtEnd())return``;if(t.matches("${")){t.advance(2);let e=this.extractInterpolationContent(t);return this.parseExpression(e,n+1)}if(t.matchesString(`'`)||t.matchesString(`"`))return this.parseStringLiteral(t);if(this.isNumberStart(t))return this.parseNumberLiteral(t);if(t.matchesKeyword(`true`))return!0;if(t.matchesKeyword(`false`))return!1;if(t.matchesKeyword(`null`))return``;let r=this.scanPathOrIdentifier(t);if(t.skipWhitespace(),t.peek()===`(`)return this.parseFunctionCall(r,t,n);if(r.startsWith(`@`))throw new V(`Expected '(' after function name '${r}'`);return r?{path:r}:``}scanPathOrIdentifier(e){let t=e.pos;if(e.peek()===`@`){let n=e.peek(1);if(!n||!/[A-Za-z_]/.test(n))throw new V(`Invalid identifier starting with '@' in expression`);for(e.advance();!e.isAtEnd();){let t=e.peek();if(/[A-Za-z0-9_]/.test(t))e.advance();else break}return e.input.substring(t,e.pos)}for(;!e.isAtEnd();){let t=e.peek();if(hd(t)||t===`/`||t===`.`||t===`-`)e.advance();else break}return e.input.substring(t,e.pos)}parseFunctionCall(e,t,n){t.match(`(`),t.skipWhitespace();let r={};for(;!t.isAtEnd()&&t.peek()!==`)`;){let i=this.scanIdentifier(t);if(t.skipWhitespace(),!t.match(`:`))throw new V(`Expected ':' after argument name '${i}' in function '${e}'`);t.skipWhitespace(),r[i]=this.parseExpressionInternal(t,n+1),t.skipWhitespace(),t.peek()===`,`&&(t.advance(),t.skipWhitespace())}if(!t.match(`)`))throw new V(`Expected ')' after function arguments for '${e}'`);return{call:e,args:r,returnType:`any`}}scanIdentifier(e){let t=e.pos;for(;!e.isAtEnd()&&hd(e.peek());)e.advance();return e.input.substring(t,e.pos)}parseStringLiteral(e){let t=e.advance(),n=``,r=!1;for(;!e.isAtEnd();){let i=e.advance();if(i===`\\`){if(e.isAtEnd())break;let t=e.advance();n+=t===`n`?`
20
+ `:t===`t`?` `:t===`r`?`\r`:t}else if(i===t){r=!0;break}else n+=i}if(!r)throw new V(`Unclosed string literal: missing closing ${t}`);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(!fd.test(n))throw new V(`Invalid number literal: '${n}'`);let r=Number(n);if(!Number.isFinite(r))throw new V(`Number literal is out of range: '${n}'`);return r===0?0:r}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`}};pd.MAX_DEPTH=100;var md=/* @__PURE__ */ RegExp(`^\\p{XID_Continue}$`,`u`);function hd(e){return Array.from(e).length===1&&md.test(e)}var gd=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)}matches(e){return!!this.input.startsWith(e,this.pos)}matchesString(e){return this.peek()===e}matchesKeyword(e){return this.input.startsWith(e,this.pos)&&!hd(this.peek(e.length))?(this.advance(e.length),!0):!1}skipWhitespace(){for(;!this.isAtEnd()&&/\s/.test(this.peek());)this.advance()}},_d=function(){return _d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_d.apply(this,arguments)};function X(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function vd(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Z(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Q(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var yd={exports:{}};(function(e){(function(){var t=String.fromCodePoint||function(){var e=String.fromCharCode,t=Math.floor;return function(){var n=16384,r=[],i,a,o=-1,s=arguments.length;if(!s)return``;for(var c=``;++o<s;){var l=Number(arguments[o]);if(!isFinite(l)||l<0||l>1114111||t(l)!=l)throw RangeError(`Invalid code point: `+l);l<=65535?r.push(l):(l-=65536,i=(l>>10)+55296,a=l%1024+56320,r.push(i,a)),(o+1==s||r.length>n)&&(c+=e.apply(null,r),r.length=0)}return c}}();function n(e,n,r){r||={};function i(t,n){return t.range[0]=n,t.raw=e.substring(n,t.range[1]),t}function a(t,n){return{type:`anchor`,kind:t,range:[M-n,M],raw:e.substring(M-n,M)}}function o(t,n,r,i){return{type:`value`,kind:t,codePoint:n,range:[r,i],raw:e.substring(r,i)}}function s(e,t,n,r){return r||=0,o(e,t,M-(n.length+r),M)}function c(e){var t=e[0],n=t.charCodeAt(0);if(j){var r;if(t.length===1&&n>=55296&&n<=56319&&(r=te().charCodeAt(0),r>=56320&&r<=57343))return M++,o(`symbol`,(n-55296)*1024+r-56320+65536,M-2,M)}return o(`symbol`,n,M-1,M)}function l(t,n,r){return{type:`disjunction`,body:t,range:[n,r],raw:e.substring(n,r)}}function u(){return{type:`dot`,range:[M-1,M],raw:`.`}}function d(t){return{type:`characterClassEscape`,value:t,range:[M-2,M],raw:e.substring(M-2,M)}}function f(t){var n=M-1-t.length;return{type:`reference`,matchIndex:parseInt(t,10),range:[n,M],raw:e.substring(n,M)}}function p(t){var n=t.range[0]-3;return{type:`reference`,name:t,range:[n,M],raw:e.substring(n,M)}}function m(t,n,r,i){return{type:`group`,behavior:t,body:n,range:[r,i],raw:e.substring(r,i)}}function h(t,n,r,i,a){return i??=(r=M-1,M),{type:`quantifier`,min:t,max:n,greedy:!0,body:null,symbol:a,range:[r,i],raw:e.substring(r,i)}}function g(t,n,r){return{type:`alternative`,body:t,range:[n,r],raw:e.substring(n,r)}}function _(t,n,r,i){return{type:`characterClass`,kind:t.kind,body:t.body,negative:n,range:[r,i],raw:e.substring(r,i)}}function v(t,n,r,i){return t.codePoint>n.codePoint&&A(`invalid range in character class`,t.raw+`-`+n.raw,r,i),{type:`characterClassRange`,min:t,max:n,range:[r,i],raw:e.substring(r,i)}}function y(t,n,r){return{type:`classStrings`,strings:t,range:[n,r],raw:e.substring(n,r)}}function b(t,n,r){return{type:`classString`,characters:t,range:[n,r],raw:e.substring(n,r)}}function x(e){return e.type===`alternative`?e.body:[e]}function S(e){e||=1,M+=e}function C(t){return e.substring(M,M+=t)}function w(e){T(e)||A(`character`,e)}function T(t){var n=t.length;if(e.substring(M,M+n)===t)return S(n),t}function ee(t){if(e[M]===t)return M++,t}function te(){return e[M]}function ne(t){return e[M]===t}function re(t){var n=t.length;return e.substring(M,M+n)===t}function E(t){return e[M+1]===t}function D(t){var n=e.substring(M).match(t);return n&&(M+=n[0].length),n}function ie(){var e=[],t=M;for(e.push(O());ee(`|`);)e.push(O());return e.length===1?e[0]:l(e,t,M)}function O(){for(var e=[],t=M,n;n=k();)e.push(n);return e.length===1?e[0]:g(e,t,M)}function k(){if(M>=e.length||ne(`|`)||ne(`)`))return null;var t=se(),n;if(t){var r=M;if(n=ce()||!1,n){if(!j&&t.type===`group`)return n.body=x(t),i(n,t.range[0]),n;M=r,A(`Expected atom`)}return t}var a=le();if(a||(r=M,n=ce()||!1,n&&(M=r,A(`Expected atom`)),!j&&ee(`{`)?a=c(`{`):A(`Expected atom`)),n=ce()||!1,n){var o=a.type,s=a.behavior;return o===`group`&&(s===`negativeLookbehind`||s===`lookbehind`)&&A(`Invalid quantifier`,``,n.range[0],n.range[1]),n.body=x(a),i(n,a.range[0]),n}return a}function ae(e,t,n,r){var i=null,a=M;if(T(e))i=t;else if(T(n))i=r;else return!1;return oe(i,a)}function oe(e,t){var n=ie();n||A(`Expected disjunction`),w(`)`);var r=m(e,x(n),t,M);return e==`normal`&&Ve&&Be++,r}function se(){switch(te()){case`^`:return S(),a(`start`,1);case`$`:return S(),a(`end`,1);case`\\`:if(E(`b`))return S(2),a(`boundary`,2);if(E(`B`))return S(2),a(`not-boundary`,2);break;case`(`:return ae(`(?=`,`lookahead`,`(?!`,`negativeLookahead`);default:return}}function ce(){var e,t=M,n,r,i;switch(te()){case`*`:S(),n=h(0,void 0,void 0,void 0,`*`);break;case`+`:S(),n=h(1,void 0,void 0,void 0,`+`);break;case`?`:S(),n=h(0,1,void 0,void 0,`?`);break;case`{`:(e=D(/^\{(\d+)\}/))?(r=parseInt(e[1],10),n=h(r,r,t,M)):(e=D(/^\{(\d+),\}/))?(r=parseInt(e[1],10),n=h(r,void 0,t,M)):(e=D(/^\{(\d+),(\d+)\}/))&&(r=parseInt(e[1],10),i=parseInt(e[2],10),r>i&&A(`numbers out of order in {} quantifier`,``,t,M),n=h(r,i,t,M)),(r&&!Number.isSafeInteger(r)||i&&!Number.isSafeInteger(i))&&A(`iterations outside JS safe integer range in quantifier`,``,t,M)}return n&&ee(`?`)&&(n.greedy=!1,n.range[1]+=1),n}function le(){var t;switch(t=te()){case`.`:return S(),u();case`\\`:if(S(),t=pe(),!t){if(!j&&te()==`c`)return o(`symbol`,92,M-1,M);A(`atomEscape`)}return t;case`[`:return Te();case`(`:if(r.lookbehind&&(t=ae(`(?<=`,`lookbehind`,`(?<!`,`negativeLookbehind`)))return t;if(r.namedGroups&&T(`(?<`)){var n=xe();w(`>`);var i=oe(`normal`,n.range[0]-3);return i.name=n,i}return r.modifiers&&re(`(?`)&&e[M+2]!=`:`?ue():ae(`(?:`,`ignore`,`(`,`normal`);case`]`:case`}`:if(!j)return S(),c(t);break;case`^`:case`$`:case`*`:case`+`:case`?`:case`{`:case`)`:case`|`:break;default:return S(),c(t)}}function ue(){function e(e){for(var t=0;t<e.length;){if(e.indexOf(e[t],t+1)!=-1)return!0;t++}return!1}var t=M;S(2);var n=D(/^[sim]+/),r;ee(`-`)&&te()!==`:`?(r=D(/^[sim]+/),r||A(`Invalid flags for modifiers group`)):n||A(`Invalid flags for modifiers group`),n=n?n[0]:``,r=r?r[0]:``;var i=n+r;(i.length>3||e(i))&&A(`flags cannot be duplicated for modifiers group`),ee(`:`)||A(`Invalid flags for modifiers group`);var a=oe(`ignore`,t);return a.modifierFlags={enabling:n,disabling:r},a}function de(t,n){if(n){var r,i;if(t.kind==`unicodeEscape`&&(r=t.codePoint)>=55296&&r<=56319&&ne(`\\`)&&E(`u`)){var a=M;M++;var o=fe();o.kind==`unicodeEscape`&&(i=o.codePoint)>=56320&&i<=57343?(t.kind=`unicodeCodePointEscape`,t.codePoint=(r-55296)*1024+i-56320+65536,t.range[1]=M,t.raw=e.substring(t.range[0],M)):M=a}}return t}function fe(){return pe(!0)}function pe(e){var t,n=M,r;switch(r=te()){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return me(e);case`B`:if(e){A(`\\B not possible inside of CharacterClass`,``,n);break}return we();case`b`:return e?(S(),s(`singleEscape`,8,`\\b`)):we();case`c`:if(e){if(!j&&(t=D(/^c(\d)/)))return s(`controlLetter`,t[1]+16,t[1],2);if(!j&&T(`c_`))return s(`controlLetter`,31,`_`,2)}return ye();case`d`:case`D`:case`w`:case`W`:case`s`:case`S`:return S(),d(r);case`k`:return _e()||we();case`p`:case`P`:return ge()||we();case`-`:return e&&j?(S(),s(`singleEscape`,45,`\\-`)):we();default:return ye()}}function me(e){var t,n,r=M;if(t=D(/^(?!0)\d+/)){n=t[0];var a=parseInt(t[0],10);if(a<=Be&&!e)return f(t[0]);if(ze.push(a),Ve?He=!0:he(r,M),S(-t[0].length),t=D(/^[0-7]{1,3}/))return s(`octal`,parseInt(t[0],8),t[0],1);var o=M;return t=c(D(/^[89]/)),i(t,o-1)}return(t=D(/^[0-7]{1,3}/))?(n=t[0],n!==`0`&&he(r,M),/^0{1,3}$/.test(n)?s(`null`,0,`0`,n.length):s(`octal`,parseInt(n,8),n,1)):!1}function he(e,t){j&&A(`Invalid decimal escape in unicode mode`,null,e,t)}function ge(){var t,n=M;return r.unicodePropertyEscape&&j&&(t=D(/^([pP])\{([^}]+)\}/))?{type:`unicodePropertyEscape`,negative:t[1]===`P`,value:t[2],range:[n-1,M],raw:e.substring(n-1,M)}:!1}function _e(){if(r.namedGroups&&D(/^k<(?=.*?>)/)){var e=xe();return w(`>`),p(e)}}function ve(e){var t;if(t=D(/^u([0-9a-fA-F]{4})/))return de(s(`unicodeEscape`,parseInt(t[1],16),t[1],2),e);if(e&&(t=D(/^u\{([0-9a-fA-F]+)\}/)))return s(`unicodeCodePointEscape`,parseInt(t[1],16),t[1],4)}function ye(){var e,t=M;switch(te()){case`t`:return S(),s(`singleEscape`,9,`\\t`);case`n`:return S(),s(`singleEscape`,10,`\\n`);case`v`:return S(),s(`singleEscape`,11,`\\v`);case`f`:return S(),s(`singleEscape`,12,`\\f`);case`r`:return S(),s(`singleEscape`,13,`\\r`);case`c`:if(e=D(/^c([a-zA-Z])/))return s(`controlLetter`,e[1].charCodeAt(0)%32,e[1],2);break;case`x`:if(e=D(/^x([0-9a-fA-F]{2})/))return s(`hexadecimalEscape`,parseInt(e[1],16),e[1],2);break;case`u`:if(e=ve(j))return(!e||e.codePoint>1114111)&&A(`Invalid escape sequence`,null,t,M),e}return we()}function be(n){var r=te(),i=M;if(r===`\\`){S();var a=ve(!0);return a&&n(a.codePoint)||A(`Invalid escape sequence`,null,i,M),t(a.codePoint)}var o=r.charCodeAt(0);if(o>=55296&&o<=56319){r+=e[M+1];var s=r.charCodeAt(1);s>=56320&&s<=57343&&(o=(o-55296)*1024+s-56320+65536)}if(n(o))return S(),o>65535&&S(),r}function xe(){var t=M,n=be(Se);n||A(`Invalid identifier`);for(var r;r=be(Ce);)n+=r;return{type:`identifier`,value:n,range:[t,M],raw:e.substring(t,M)}}function Se(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=128&&/[\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]/.test(t(e))}function Ce(e){return Se(e)||e>=48&&e<=57||e>=128&&/[\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]/.test(t(e))}function we(){var e,t=te();return j&&/[\^$.*+?()\\[\]{}|/]/.test(t)||!j&&t!==`c`?t===`k`&&r.lookbehind?null:(e=C(1),s(`identifier`,e.charCodeAt(0),e,1)):null}function Te(){var e,t=M;return(e=T(`[^`))?(e=Ee(),w(`]`),_(e,!0,t,M)):ee(`[`)?(e=Ee(),w(`]`),_(e,!1,t,M)):null}function Ee(){var e;return ne(`]`)?{kind:`union`,body:[]}:We?Me():(e=Oe(),e||A(`nonEmptyClassRanges`),{kind:`union`,body:e})}function De(e){var t,n,r,i,a;if(ne(`-`)&&!E(`]`)){t=e.range[0],S(),a=c(`-`),i=Ae(),i||A(`classAtom`),n=M;var o=Ee();return o||A(`classContents`),!(`codePoint`in e)||!(`codePoint`in i)?j?A(`invalid character class`):r=[e,a,i]:r=[v(e,i,t,n)],o.type===`empty`?r:r.concat(o.body)}return r=ke(),r||A(`nonEmptyClassRangesNoDash`),[e].concat(r)}function Oe(){var e=Ae();return e||A(`classAtom`),ne(`]`)?[e]:De(e)}function ke(){var e=Ae();return e||A(`classAtom`),ne(`]`)?e:De(e)}function Ae(){return ee(`-`)?c(`-`):je()}function je(){var e;switch(e=te()){case`\\`:if(S(),e=fe(),!e){if(!j&&te()==`c`)return c(`\\`);A(`classEscape`)}return de(e,j);case`]`:case`-`:break;default:return S(),c(e)}}function Me(){var e=[],t,n=Ne(!0);for(e.push(n),t=n.type===`classRange`?`union`:ne(`&`)?`intersection`:ne(`-`)?`subtraction`:`union`;!ne(`]`);)t===`intersection`?(w(`&`),w(`&`),ne(`&`)&&A(`&& cannot be followed by &. Wrap it in brackets: &&[&].`)):t===`subtraction`&&(w(`-`),w(`-`)),n=Ne(t===`union`),e.push(n);return{kind:t,body:e}}function Ne(e){var t=M,n,r;if(ee(`\\`)){if(T(`q{`))return Le();if(r=fe())n=r;else if(r=Ie())return r;else A(`Invalid escape`,`\\`+te(),t)}else if(r=Fe())n=r;else if(r=Te())return r;else A(`Invalid character`,te());if(e&&ne(`-`)&&!E(`-`)){if(S(),r=Pe())return v(n,r,t,M);A(`Invalid range end`,te())}return n}function Pe(){if(ee(`\\`)){var e,t=M;if(e=Ie())return e;A(`Invalid escape`,`\\`+te(),t)}return Fe()}function Fe(){var e;if(D(/^(?:&&|!!|##|\$\$|%%|\*\*|\+\+|,,|\.\.|::|;;|<<|==|>>|\?\?|@@|\^\^|``|~~)/)&&A(`Invalid set operation in character class`),e=D(/^[^()[\]{}/\-\\|]/))return c(e)}function Ie(){var e;if(ee(`b`))return s(`singleEscape`,8,`\\b`);if(ee(`B`))A(`\\B not possible inside of ClassContents`,``,M-2);else if(e=D(/^[&\-!#%,:;<=>@`~]/))return s(`identifier`,e[0].codePointAt(0),e[0]);else if(e=ye())return e;else return null}function Le(){var e=M-3,t=[];do t.push(Re());while(ee(`|`));return w(`}`),y(t,e,M)}function Re(){for(var e=[],t=M,n;n=Pe();)e.push(n);return b(e,t,M)}function A(t,n,r,i){r??=M,i??=r;var a=Math.max(0,r-10),o=Math.min(i+10,e.length),s=` `+e.substring(a,o),c=` `+Array(r-a+1).join(` `)+`^`;throw SyntaxError(t+` at position `+r+(n?`: `+n:``)+`
21
+ `+s+`
22
+ `+c)}var ze=[],Be=0,Ve=!0,He=!1,Ue=(n||``).indexOf(`u`)!==-1,We=(n||``).indexOf(`v`)!==-1,j=Ue||We,M=0;if(We&&!r.unicodeSet)throw Error(`The "v" flag is only supported when the .unicodeSet option is enabled.`);if(Ue&&We)throw Error(`The "u" and "v" flags are mutually exclusive.`);e=String(e),e===``&&(e=`(?:)`);var Ge=ie();return Ge.range[1]!==e.length&&A(`Could not parse entire input - got stuck`,``,Ge.range[1]),He||=ze.some(function(e){return e<=Be}),He?(M=0,Ve=!1,ie()):Ge}var r={parse:n};e.exports?e.exports=r:window.regjsparser=r})()})(yd);var bd=yd.exports;function xd(e,t){return bd.parse(e,t?`u`:``,{lookbehind:!0,unicodePropertyEscape:!0})}function Sd(e){var t=e.length;return t?e[t-1]:null}function Cd(e,t){for(var n=0;n<e.length&&n<t.length&&e[n]===t[n];n++);return{a:e.slice(n),b:t.slice(n)}}var wd=[`lookahead`,`lookbehind`,`negativeLookahead`,`negativeLookbehind`];function Td(e,t,n,r){return`${e.slice(0,n)}${t}${e.slice(r)}`}function Ed(e){var t=e.after,n=e.offsets,r=e.shiftAmount;return new Set(Q([],Z(n),!1).map(function(e){return e>t?e+r:e}))}function Dd(e){return e.symbol?`${e.symbol}${e.greedy?``:`?`}`:e.min===e.max?`{${e.min}}`:`{${e.min},${e.max||``}}${e.greedy?``:`?`}`}function Od(e){if(e.type!==`alternative`)return!1;var t=e.body;
23
+ /* istanbul ignore next */
24
+ if(t.length<1)return!1;var n=Z(t,1)[0];if(n.type!==`quantifier`||n.min!==0||n.max!==void 0||n.greedy)return!1;var r=n.body[0];return!(r.type!==`characterClass`||(r.kind,r.body.length!==0)||!r.negative)}function kd(e){if(Od(e))return!1;var t=function(e){var n,r;if(e.type===`anchor`)return e.kind===`start`?`anchor`:null;if(e.type===`quantifier`&&e.max===0)return null;if(e.type===`alternative`||e.type===`group`||e.type===`quantifier`){var i=e.type===`quantifier`&&e.min===0;try{for(var a=vd(e.body),o=a.next();!o.done;o=a.next()){var s=o.value,c=t(s);if(c===`consumingNode`)return`consumingNode`;if(c===`anchor`)return i?null:`anchor`}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return null}if(e.type===`disjunction`){var c=e.body.map(function(e){return t(e)});return c.some(function(e){return e===`consumingNode`})?`consumingNode`:c.every(function(e){return e===`anchor`})?`anchor`:null}return`consumingNode`};return t(e)===`consumingNode`}function Ad(e){var t=/* @__PURE__ */ new Map,n=function(e,r){var i=function(e,t){var r=``;return e.forEach(function(e){r+=n(e,t+r.length)}),r};switch(e.type){case`anchor`:case`characterClass`:case`characterClassEscape`:case`unicodePropertyEscape`:case`value`:case`dot`:return e.raw;case`reference`:return t.set(e,r),e.raw;case`group`:switch(e.behavior){case`normal`:return`(?:${i(e.body,r+3)})`;case`ignore`:return`(?:${i(e.body,r+3)})`;case`lookahead`:case`lookbehind`:case`negativeLookahead`:case`negativeLookbehind`:return``}case`disjunction`:var a=``;return e.body.forEach(function(e,t){t>0&&(a+=`|`),a+=n(e,r+a.length)}),a;case`alternative`:return i(e.body,r);case`quantifier`:return`${n(e.body[0],r)}${Dd(e)}`}};return{referencesWithOffset:t,result:n(e,0)}}function jd(e){for(var t=e.pattern,n=e.unicode,r=function(e){var t=xd(e.pattern,n),r=[],i=!1,a=t.type===`disjunction`,o=/* @__PURE__ */ new Map,s=/* @__PURE__ */ new Set,c=1,l=function(e,t){return e.body.length===1&&e.body[0]===t},u=function(e){var t=e.nodeStack,n=e.nodes,r=e.passedStartAnchor,i=e.serial,a=null;n.forEach(function(e){i?(d({immediatelyPrecedingLookahead:a,node:e,nodeStack:t,passedStartAnchor:r}),a=e.type===`group`&&e.behavior===`lookahead`?e:null):d({immediatelyPrecedingLookahead:a,node:e,nodeStack:t,passedStartAnchor:_d({},r)})})},d=function(e){var t=e.immediatelyPrecedingLookahead,n=e.node,a=e.nodeStack,d=e.passedStartAnchor,f=function(){d.value||(i=!0)};switch(n.type){case`characterClass`:case`characterClassEscape`:case`unicodePropertyEscape`:case`value`:case`dot`:f();return;case`anchor`:n.kind===`start`&&(d.value=!0);return;case`group`:var p=null;n.behavior===`normal`&&(p=c,c++),u({nodeStack:Q(Q([],Z(a),!1),[n],!1),nodes:n.body,passedStartAnchor:d,serial:!0}),p!==null&&n.behavior===`normal`&&o.set(p,{group:n,stack:Q([],Z(a),!1)});return;case`disjunction`:u({nodeStack:Q(Q([],Z(a),!1),[n],!1),nodes:n.body,passedStartAnchor:d,serial:!1});return;case`alternative`:u({nodeStack:Q(Q([],Z(a),!1),[n],!1),nodes:n.body,passedStartAnchor:d,serial:!0});return;case`quantifier`:n.max!==0&&(n.max===void 0&&Q([],Z(a),!1).reverse().some(function(e){if(e.type===`group`){if(wd.indexOf(e.behavior)>=0)return!0;s.add(e)}return!1}),u({nodeStack:Q(Q([],Z(a),!1),[n],!1),nodes:n.body,passedStartAnchor:n.min===0?_d({},d):d,serial:!0}));return;case`reference`:f();var m=o.get(n.matchIndex);if(m){var h=m.group,g=m.stack,_=Cd(g,a).a,v=_.flatMap(function(e){return e.type===`group`&&wd.indexOf(e.behavior)>=0?[e]:[]}),y=_.some(function(e){return e.type===`disjunction`||e.type===`quantifier`&&e.min===0}),b=v.length>0;if(v.every(function(e){return e.behavior!==`negativeLookahead`&&e.behavior!==`negativeLookbehind`})&&(b||s.has(h))){var x=!!t&&l(t,h),S=b&&y;r.push({atomicOrOptional:x?`atomic`:S?`optional`:null,group:h,reference:n})}}return}};d({immediatelyPrecedingLookahead:null,node:t,nodeStack:[],passedStartAnchor:{value:!1}});var f=e.pattern,p=new Set(e.atomicGroupOffsets),m=!1;return Q([],Z(r),!1).sort(function(e,t){return t.reference.range[0]-e.reference.range[0]}).forEach(function(e){var t=e.atomicOrOptional,n=e.group,i=Z(e.reference.range,2),a=i[0],o=i[1],s=Ad(n),c=s.result,l=s.referencesWithOffset;l.size>0&&(m=!0);var u=t===`optional`?`(?:${c}?)`:c;f=Td(f,u,a,o);var d=u.length-(o-a);p=Ed({after:a,offsets:p,shiftAmount:d}),t===`atomic`&&p.add(a),r.forEach(function(e){var t=e.atomicOrOptional,n=e.reference;if(t===`atomic`){var r=l.get(n);r!==void 0&&p.add(a+r)}})}),i&&!Od(t)&&(a&&(f=`(?:${f})`),f=`[^]*?${f}`,p=Ed({after:-1,offsets:p,shiftAmount:a?8:5})),{needToRerun:m,result:{atomicGroupOffsets:p,pattern:f}}},i={atomicGroupOffsets:/* @__PURE__ */ new Set,pattern:t};;){var a=r(i),o=a.result,s=a.needToRerun;if(i=o,!s)break}return i}function Md(e){return new FinalizationRegistry(e)}var Nd=Symbol(`fork`),Pd=Symbol(`pendingResults`);function Fd(e){var t=/* @__PURE__ */ new Set,n=Md(function(e){t.delete(e)}),r=function(){var n=e.next();t.forEach(function(e){return e(n)})},i=function(e){var a={},o=(a[Nd]=function(){return i(this[Pd])},a[Pd]=e.slice(0),a.next=function(e){if(e!==void 0)throw Error("`ForkableIterator` `next()` cannot take a value");var t=this[Pd];return t.length||r(),t.shift()},a),s=new WeakRef(o),c=function(e){
25
+ /* istanbul ignore next */
26
+ s.deref()?.[Pd].push(e)};return n.register(o,c),t.add(c),o};return i([])}function Id(e){if(!e||!e[Nd])throw Error("The provided value was not a `ForkableIterator` from `buildForkableIterator()`");return e[Nd]()}function Ld(){return X(this,function(e){return[2]})}function Rd(e){return Fd(e)}function zd(e){var t,n,r,i,a,o,s;return X(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]),t=vd(e),n=t.next(),c.label=1;case 1:if(n.done)return[3,5];r=n.value,i=void 0,c.label=2;case 2:return(i=r.next()).done?[3,4]:[4,i.value];case 3:return c.sent(),[3,2];case 4:return n=t.next(),[3,1];case 5:return[3,8];case 6:return a=c.sent(),o={error:a},[3,8];case 7:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.error}return[7];case 8:return[2]}})}function Bd(e){return X(this,function(t){switch(t.label){case 0:return[5,vd(e)];case 1:return t.sent(),[2]}})}function Vd(e,t){var n=[];return e[0]<t[0]&&n.push([e[0],Math.min(t[0]-1,e[1])]),e[1]>t[1]&&n.push([Math.max(t[1]+1,e[0]),e[1]]),n}function Hd(e,t){var n=Math.max(e[0],t[0]),r=Math.min(e[1],t[1]);return n>r?null:[n,r]}function Ud(e){for(var t=Q([],Z(e),!1).sort(function(e,t){return e-t}),n=[],r=0,i=0;i<t.length;i++){var a=t[r],o=t[i],s=i+1<t.length?t[i+1]:null;(s===null||s-a!==i-r+1)&&(n.push([a,o]),r=i+1)}return n}function Wd(e){for(var t=[],n=0;n<e.length+1;n++){var r=n-1>=0?e[n-1]:null,i=n<e.length?e[n]:null,a=r?r[1]+1:-1/0,o=i?i[0]-1:1/0;if(a-o!==1){if(a>o)throw Error(`Internal error: invalid ranges input`);t.push([a,o])}}return t}function Gd(e){return!e.rangesNegated&&!e.ranges.length&&!e.unicodePropertyEscapes.size}function Kd(e,t){var n,r,i,a;e.rangesNegated?t.rangesNegated?(a=!0,i=Q(Q([],Z(e.ranges),!1),Z(t.ranges),!1)):(a=!1,i=Q([],Z(t.ranges),!1),e.ranges.forEach(function(e){var t=[];i.forEach(function(n){t.push.apply(t,Q([],Z(Vd(n,e)),!1))}),i=t})):t.rangesNegated?(a=!1,i=Q([],Z(e.ranges),!1),t.ranges.forEach(function(e){var t=[];i.forEach(function(n){t.push.apply(t,Q([],Z(Vd(n,e)),!1))}),i=t})):(a=!1,i=[],e.ranges.forEach(function(e){t.ranges.forEach(function(t){var n=Hd(e,t);n&&i.push(n)})}));var o=new Set(Q(Q([],Z(e.unicodePropertyEscapes.keys()),!1),Z(t.unicodePropertyEscapes.keys()),!1)),s=/* @__PURE__ */ new Map;try{for(var c=vd(o),l=c.next();!l.done;l=c.next()){var u=l.value,d=e.unicodePropertyEscapes.get(u)??null,f=t.unicodePropertyEscapes.get(u)??null;d!==null&&f===null?s.set(u,d):d===null&&f!==null?s.set(u,f):d!==null&&f!==null&&d===f&&s.set(u,d)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return{ranges:i,rangesNegated:a,unicodePropertyEscapes:s}}function qd(e){return X(this,function(t){switch(t.label){case 0:return[4,{bounded:!1,offset:e,stack:[],subType:`end`,type:Ef}];case 1:
27
+ /* istanbul ignore next */
28
+ throw t.sent(),Error(`Internal error: should not be reading after end`)}})}function Jd(e,t){var n=function(e,t,r){var i,a,o,s,c,l;return r===void 0&&(r=0),X(this,function(u){switch(u.label){case 0:i=0,u.label=1;case 1:return a=e(i,r),a===`stop`?[2]:[3,2];case 2:return a===`fork`?[4,{reader:function(){return Ld()},subType:null,type:Df}]:[3,4];case 3:u.sent(),u.label=4;case 4:o=!1,s=t(i),c=void 0,l=function(){var a,s,l,u;return X(this,function(d){switch(d.label){case 0:switch(a=c.value,s=a.type,s){case Df:return[3,1];case Ef:return[3,3]}return[3,5];case 1:return l=i,u=r,[4,{reader:function(){return n(function(t,n){return t===0?`continue`:e(t+l,n)},function(e){return e===0?a.reader():t(e+l)},u)},subType:a.subType,type:Df}];case 2:return d.sent(),[3,5];case 3:return a.subType!==`null`&&a.subType!==`start`&&a.subType!==`end`&&(o=!0),[4,a];case 4:return d.sent(),[3,5];case 5:return[2]}})},u.label=5;case 5:return(c=s.next()).done?[3,7]:[5,l()];case 6:return u.sent(),[3,5];case 7:r=o?0:r+1,u.label=8;case 8:return i++,[3,1];case 9:return[2]}})};return n(e,t)}function Yd(e){var t=e.length;return Jd(function(e){return e<t?`continue`:`stop`},function(t){return e[t]()})}function Xd(e){var t=e.caseInsensitive,n=e.dotAll,r=e.nodes;return Yd(r.map(function(e){return function(){return Of({caseInsensitive:t,dotAll:n,node:e})}}))}function Zd(e,t){var n=function(e){var r,i;return X(this,function(a){switch(a.label){case 0:i=function(){var e,i;return X(this,function(a){switch(a.label){case 0:switch(e=r.value,i=e.type,i){case Df:return[3,1];case Ef:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return n(e.reader())},subType:e.subType,type:Df}];case 2:return a.sent(),[3,5];case 3:return[4,t(e)];case 4:return a.sent(),[3,5];case 5:return[2]}})},a.label=1;case 1:return(r=e.next()).done?[3,3]:[5,i()];case 2:return a.sent(),[3,1];case 3:return[2]}})};return n(e)}function Qd(e){return new Set(e.flatMap(function(e){return e.type===`group`?[e.group]:[]}))}function $d(e){var t,n,r=[];try{for(var i=vd(e),a=i.next();!a.done;a=i.next()){var o=a.value;if(o.type===`group`){var s=o.group,c=s.behavior;(c===`lookbehind`||c===`negativeLookbehind`||c===`negativeLookahead`||c===`lookahead`)&&r.push(s)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}function ef(e){var t=e.caseInsensitive,n=e.dotAll,r=e.node;switch(r.behavior){case`lookbehind`:case`negativeLookbehind`:case`lookahead`:case`negativeLookahead`:return Bd([{reader:function(){return Yd([function(){return Zd(Xd({caseInsensitive:t,dotAll:n,nodes:r.body}),function(e){return _d(_d({},e),{stack:Q([{group:r,type:`group`}],Z(e.stack),!1)})})},function(){return qd(r.range[1])}])},subType:r.behavior,type:Df}]);case`ignore`:case`normal`:return Zd(Xd({caseInsensitive:t,dotAll:n,nodes:r.body}),function(e){return _d(_d({},e),{stack:Q([{group:r,type:`group`}],Z(e.stack),!1)})})}}function tf(e){return X(this,function(t){switch(t.label){case 0:return[4,{offset:e,stack:[],subType:`null`,type:Ef}];case 1:return t.sent(),[2]}})}function nf(e,t){if(!e.has(t))throw Error(`Internal error: map missing key`);return e.get(t)}function rf(e,t){return e.some(function(e){if(e.type!==`group`||e.group.behavior!==`normal`)return!1;var n=nf(t.capturingGroupToIndex,e.group);return t.reachableReferences.some(function(e){return e.matchIndex===n})})?/* @__PURE__ */ new Set:new Set(e.flatMap(function(e){return e.type===`quantifier`?[e]:[]}).filter(function(e){var t=e.iteration,n=e.quantifier;return t>=1&&t>=n.min}).map(function(e){return e.quantifier}))}function af(e){var t=/* @__PURE__ */ new Map;return e.flatMap(function(e){return e.type===`quantifier`?[e]:[]}).forEach(function(e){var n=e.iteration,r=e.quantifier;return t.set(r,n)}),t}function of(e){var t=e.caseInsensitive,n=e.dotAll,r=e.node,i=r.min,a=r.max,o=a===void 0?1/0:a;return Yd([function(){return tf(r.body[0].range[0])},function(){return Jd(function(e,t){return t>1||e>=o?`stop`:e>=i?`fork`:`continue`},function(e){return Zd(Yd(Q(Q([],Z(e>0?[function(){return tf(r.body[0].range[0])}]:[]),!1),[function(){return Of({caseInsensitive:t,dotAll:n,node:r.body[0]})}],!1)),function(t){return _d(_d({},t),{stack:Q([{iteration:e,quantifier:r,type:`quantifier`}],Z(t.stack),!1)})})})}])}function sf(e){var t;return X(this,function(n){switch(n.label){case 0:switch(t=e.kind,t){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:e.range[0],stack:[],subType:`end`,type:Ef}];case 2:
29
+ /* istanbul ignore next */
30
+ throw n.sent(),Error(`Internal error: should not be reading after end`);case 3:return[4,{offset:e.range[0],stack:[],subType:`start`,type:Ef}];case 4:return n.sent(),[3,6];case 5:return[3,6];case 6:return[2]}})}var cf=[[48,57]],lf=Wd(cf),uf=[[48,57],[65,90],[95,95],[97,122]],df=Wd(uf),ff=[[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]],pf=Wd(ff);function mf(e){switch(e){case`d`:case`D`:return e===`d`?cf:lf;case`w`:case`W`:return e===`w`?uf:df;case`s`:case`S`:return e===`s`?ff:pf}}function hf(e){var t,n;return X(this,function(r){switch(r.label){case 0:return t=e.value,n=mf(t),[4,{characterGroups:{ranges:n,rangesNegated:!1,unicodePropertyEscapes:/* @__PURE__ */ new Map},node:e,stack:[],subType:`groups`,type:Ef}];case 1:return r.sent(),[2]}})}function gf(e){if(e.length>1)return null;var t=e.codePointAt(0);
31
+ /* istanbul ignore next */
32
+ if(!t)throw Error(`Internal error: expected codepoint`);return t}function _f(e){var t=gf(String.fromCodePoint(e).toUpperCase());return t===null?e:t}function vf(e){var t=e.caseInsensitive,n=e.highCodePoint,r=e.lowCodePoint;if(!t)return[[r,n]];for(var i=/* @__PURE__ */ new Set,a=r;a<=n;a++)i.add(_f(a));return Ud(i)}function yf(e){var t=e.caseInsensitive,n=e.value.codePoint;return t?_f(n):n}function bf(e){var t=e.caseInsensitive,n=e.node,r=yf({caseInsensitive:t,value:n});return Bd([{characterGroups:{ranges:[[r,r]],rangesNegated:!1,unicodePropertyEscapes:/* @__PURE__ */ new Map},node:n,stack:[],subType:`groups`,type:Ef}])}function xf(e){var t,n,r=e.caseInsensitive,i=e.node,a=[],o=/* @__PURE__ */ new Map,s=!1;try{outer:for(var c=vd(i.body),l=c.next();!l.done;l=c.next()){var u=l.value;switch(u.type){case`value`:var d=yf({caseInsensitive:r,value:u});a.push([d,d]);break;case`characterClassRange`:a.push.apply(a,Q([],Z(vf({caseInsensitive:r,highCodePoint:u.max.codePoint,lowCodePoint:u.min.codePoint})),!1));break;case`characterClassEscape`:var f=u.value;a.push.apply(a,Q([],Z(mf(f)),!1));break;case`unicodePropertyEscape`:var p=u.negative!==i.negative;if(o.get(u.value)===!p){s=!0;break outer}o.set(u.value,p)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return Bd([{characterGroups:s?{ranges:[],rangesNegated:!0,unicodePropertyEscapes:/* @__PURE__ */ new Map}:{ranges:a,rangesNegated:i.negative,unicodePropertyEscapes:o},node:i,stack:[],subType:`groups`,type:Ef}])}function Sf(e){var t=e.caseInsensitive,n=e.dotAll,r=e.node;return zd([Bd(r.body.slice(0,-1).map(function(e){return{reader:function(){return Of({caseInsensitive:t,dotAll:n,node:e})},subType:null,type:Df}})),Of({caseInsensitive:t,dotAll:n,node:r.body[r.body.length-1]})])}function Cf(e){var t=e.dotAll,n=e.node;return X(this,function(e){switch(e.label){case 0:return[4,{characterGroups:{ranges:t?[]:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:/* @__PURE__ */ new Map},node:n,stack:[],subType:`groups`,type:Ef}];case 1:return e.sent(),[2]}})}function wf(e){return X(this,function(t){switch(t.label){case 0:return[4,{node:e,referenceIndex:e.matchIndex,stack:[],subType:`reference`,type:Ef}];case 1:return t.sent(),[2]}})}function Tf(e){return Bd([{characterGroups:{ranges:[],rangesNegated:!1,unicodePropertyEscapes:/* @__PURE__ */ new Map([[e.value,e.negative]])},node:e,stack:[],subType:`groups`,type:Ef}])}var Ef=Symbol(`characterReaderTypeCharacterEntry`),Df=Symbol(`characterReaderTypeSplit`);function Of(e){var t=e.caseInsensitive,n=e.dotAll,r=e.node;switch(r.type){case`anchor`:return sf(r);case`characterClass`:return xf({caseInsensitive:t,node:r});case`characterClassEscape`:return hf(r);case`unicodePropertyEscape`:return Tf(r);case`reference`:return wf(r);case`value`:return bf({caseInsensitive:t,node:r});case`dot`:return Cf({dotAll:n,node:r});case`alternative`:return Xd({caseInsensitive:t,dotAll:n,nodes:r.body});case`disjunction`:return Sf({caseInsensitive:t,dotAll:n,node:r});case`group`:return ef({caseInsensitive:t,dotAll:n,node:r});case`quantifier`:return of({caseInsensitive:t,dotAll:n,node:r})}}var kf=Symbol(`characterReaderLevel2TypeSplit`),Af=Symbol(`characterReaderLevel1TypeEntry`);function jf(e){var t=e.caseInsensitive,n=e.dotAll,r=e.node,i=function(e,t){var n,r,a;return X(this,function(o){switch(o.label){case 0:r=function(){var e,r,a,o;return X(this,function(s){switch(s.label){case 0:switch(e=n.value.type,e){case Ef:return[3,1];case Df:return[3,10]}return[3,12];case 1:switch(r=n.value.subType,r){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:n.value.characterGroups,node:n.value.node,precedingZeroWidthEntries:t,stack:n.value.stack,subType:`groups`,type:Af}];case 3:return s.sent(),t=[],[3,9];case 4:return[4,{node:n.value.node,precedingZeroWidthEntries:t,referenceIndex:n.value.referenceIndex,stack:n.value.stack,subType:n.value.subType,type:Af}];case 5:return s.sent(),t=[],[3,9];case 6:return[2,{value:{bounded:n.value.bounded,precedingZeroWidthEntries:t}}];case 7:return t=Q(Q([],Z(t),!1),[{offset:n.value.offset,stack:n.value.stack,type:`null`}],!1),[3,9];case 8:return t=Q(Q([],Z(t),!1),[{offset:n.value.offset,stack:n.value.stack,type:`start`}],!1),[3,9];case 9:return[3,12];case 10:return a=n.value,o=t,[4,{reader:function(){return i(a.reader(),o)},subType:a.subType,type:kf}];case 11:return s.sent(),[3,12];case 12:return[2]}})},o.label=1;case 1:return(n=e.next()).done?[3,3]:[5,r()];case 2:return a=o.sent(),typeof a==`object`?[2,a.value]:[3,1];case 3:return[2,{bounded:!1,precedingZeroWidthEntries:t}]}})};return i(Of({caseInsensitive:t,dotAll:n,node:r}),[])}var Mf=Symbol(`characterReaderLevel2TypeSplit`),Nf=Symbol(`characterReaderLevel2TypeEntry`),Pf=Symbol(`internalReaderTypeSplit`),Ff=Symbol(`internalReaderTypeEntry`);function If(e){var t,n;return X(this,function(r){switch(r.label){case 0:n=function(){var e,n;return X(this,function(r){switch(r.label){case 0:switch(e=t.value,n=e.type,n){case kf:return[3,1];case Af:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return If(e.reader())},subType:e.subType,type:Pf}];case 2:return r.sent(),[3,5];case 3:return[4,_d(_d({},e),{type:Ff})];case 4:return r.sent(),[3,5];case 5:return[2]}})},r.label=1;case 1:return(t=e.next()).done?[3,3]:[5,n()];case 2:return r.sent(),[3,1];case 3:return[2,t.value]}})}function Lf(e,t){var n,r;try{for(var i=vd(t),a=i.next();!a.done;a=i.next()){var o=Z(a.value,2),s=o[0];if(o[1]-(e.get(s)||0)>1)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}function Rf(e){var t,n,r,i,a,o,s,c,l,u=e.groupContentsStore,d=e.groups,f=e.groupsWithInfiniteSize,p=e.nodeExtra,m=e.value;return X(this,function(e){switch(e.label){case 0:if(t=nf(p.indexToCapturingGroup,m.referenceIndex),n=u.get(m.referenceIndex)||{contents:[],group:t},r=Cd(nf(p.nodeToLookaheadStack,n.group),nf(p.nodeToLookaheadStack,m.node)).a,r.length){if(r.some(function(e){var t=e.behavior;return t===`negativeLookahead`||t===`negativeLookbehind`}))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];throw Error(`Unsupported reference (${m.referenceIndex} at position ${m.node.range[0]}). Pattern needs downgrading. See the \`downgradePattern\` option.`)}if(d.has(n.group))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];if(f.has(m.referenceIndex))throw Error(`Unsupported reference to group ${m.referenceIndex} as group is not a finite size. Pattern needs downgrading. See the \`downgradePattern\` option.`);e.label=1;case 1:e.trys.push([1,6,7,8]),i=vd(n.contents),a=i.next(),e.label=2;case 2:return a.done?[3,5]:(o=a.value,[4,{characterGroups:o.characterGroups,node:o.node,precedingZeroWidthEntries:o.precedingZeroWidthEntries,stack:Q(Q(Q([],Z(o.stack),!1),[{reference:m.node,type:`reference`}],!1),Z(m.stack),!1),subType:`groups`,type:Ff}]);case 3:e.sent(),e.label=4;case 4:return a=i.next(),[3,2];case 5:return[3,8];case 6:return s=e.sent(),c={error:s},[3,8];case 7:try{a&&!a.done&&(l=i.return)&&l.call(i)}finally{if(c)throw c.error}return[7];case 8:return[2,{bounded:!1,precedingZeroWidthEntries:[]}]}})}function zf(e){var t=e.caseInsensitive,n=e.dotAll,r=e.node,i=e.nodeExtra,a=function(e){var t,n;return X(this,function(r){switch(r.label){case 0:t=function(){var t,n,r,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,ee,te,ne,re,E,D,ie,O,k,ae,oe,se,ce,le,ue,de,fe,pe,me,he;return X(this,function(ge){switch(ge.label){case 0:if(t=e.precedingZeroWidthEntries,n=e.groupsWithInfiniteSize,r=e.groupContentsStore,o=e.quantifierIterationsAtLastGroup,s=e.characterReader,c=e.referenceCharacterReaderWithReference,l=c?.reader||s,u=l.next(),u.done){if(c){
33
+ /* istanbul ignore next */
34
+ if(u.value.bounded)throw Error(`Internal error: end of reference reader cannot be bounded`);return e={characterReader:s,groupContentsStore:r,groupsWithInfiniteSize:n,precedingZeroWidthEntries:Q(Q([],Z(t),!1),Z(u.value.precedingZeroWidthEntries),!1),quantifierIterationsAtLastGroup:o,referenceCharacterReaderWithReference:null},[2,`continue-outer`]}return[2,{value:{bounded:u.value.bounded,precedingZeroWidthEntries:Q(Q([],Z(t),!1),Z(u.value.precedingZeroWidthEntries),!1),type:`end`}}]}switch(d=u.value,f=d.type,f){case Pf:return[3,1];case Ff:return[3,3]}return[3,7];case 1:
35
+ /* istanbul ignore next */
36
+ if(c)throw Error(`Internal error: should not be seeing a split from a reference reader`);return p=r,m=o,h=n,g=t,[4,{reader:function(){return a({characterReader:Rd(d.reader()),groupContentsStore:p,groupsWithInfiniteSize:h,precedingZeroWidthEntries:g,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:c})},subType:d.subType,type:Mf}];case 2:return ge.sent(),[3,7];case 3:switch(t=Q(Q([],Z(t),!1),Z(d.precedingZeroWidthEntries),!1),_=af(d.stack),v=$d(d.stack),y=Qd(d.stack),b=d.subType,b){case`reference`:return[3,4];case`groups`:return[3,5]}return[3,7];case 4:
37
+ /* istanbul ignore next */
38
+ if(c)throw Error(`Internal error: should not be seeing a reference from a reference reader`);return Lf(o,_)?[2,{value:{type:`abort`}}]:(x=Rd(Rf({groupContentsStore:r,groups:y,groupsWithInfiniteSize:n,nodeExtra:i,value:d})),e={characterReader:s,groupContentsStore:r,groupsWithInfiniteSize:n,precedingZeroWidthEntries:t,quantifierIterationsAtLastGroup:o,referenceCharacterReaderWithReference:{reader:x,reference:d.node}},[3,7]);case 5:if(S=new Map(r),!c)try{for(C=(ue=void 0,vd(r)),w=C.next();!w.done;w=C.next()){T=Z(w.value,2),ee=T[0],te=T[1].group,ne=Q(Q([],Z(t.map(function(e){return e.offset})),!1),[d.node.range[0]],!1);try{for(re=(fe=void 0,vd(ne)),E=re.next();!E.done;E=re.next())if(D=E.value,te.range[0]>=D){S.delete(ee);break}}catch(e){fe={error:e}}finally{try{E&&!E.done&&(pe=re.return)&&pe.call(re)}finally{if(fe)throw fe.error}}}}catch(e){ue={error:e}}finally{try{w&&!w.done&&(de=C.return)&&de.call(C)}finally{if(ue)throw ue.error}}ie=!1,O=Q([],Z(d.stack),!1).reverse(),k=O.findIndex(function(e){return e.type===`reference`}),ae=O.slice(0,k>=0?k:d.stack.length),oe=function(e){if(e.type===`quantifier`&&e.quantifier.max===void 0)return ie=!0,`continue`;if(e.type!==`group`)return`continue`;var r=e.group;if(r.behavior===`lookbehind`||r.behavior===`negativeLookbehind`||r.behavior===`negativeLookahead`||r.behavior===`lookahead`)return ie=!1,`continue`;if(r.behavior!==`normal`)return`continue`;var a=nf(i.capturingGroupToIndex,r);if(ie){var o=new Set(n);o.add(a),n=o}var s=S.get(a)||{contents:[],group:r};S.set(a,_d(_d({},s),{contents:Q(Q([],Z(s.contents),!1),[_d(_d({},d),{precedingZeroWidthEntries:t.filter(function(e){var t=e.offset;return t>=r.range[0]&&t<=r.range[1]})})],!1)}))};try{for(se=(me=void 0,vd(ae)),ce=se.next();!ce.done;ce=se.next())le=ce.value,oe(le)}catch(e){me={error:e}}finally{try{ce&&!ce.done&&(he=se.return)&&he.call(se)}finally{if(me)throw me.error}}return r=S,o=_,[4,{characterGroups:d.characterGroups,groups:y,lookaheadStack:v,node:d.node,precedingZeroWidthEntries:t,stack:d.stack,type:Nf}];case 6:return ge.sent(),t=[],e={characterReader:s,groupContentsStore:r,groupsWithInfiniteSize:n,precedingZeroWidthEntries:t,quantifierIterationsAtLastGroup:o,referenceCharacterReaderWithReference:c},[3,7];case 7:return[2]}})},r.label=1;case 1:return[5,t()];case 2:if(n=r.sent(),typeof n==`object`)return[2,n.value];if(n===`continue-outer`)return[3,3];r.label=3;case 3:return[3,1];case 4:return[2]}})};return a({characterReader:Rd(If(jf({caseInsensitive:t,dotAll:n,node:r}))),groupContentsStore:/* @__PURE__ */ new Map,groupsWithInfiniteSize:/* @__PURE__ */ new Set,precedingZeroWidthEntries:[],quantifierIterationsAtLastGroup:/* @__PURE__ */ new Map,referenceCharacterReaderWithReference:null})}var Bf=function(){function e(e,t){this._history=[],this._isEqual=e,t&&(this._history=Q([],Z(t.getHistory()),!1))}return e.prototype._isEntryEqual=function(e,t){return this._isEqual(e.left,t.left)&&this._isEqual(e.right,t.right)},e.prototype.append=function(e){this._history.push(e)},e.prototype.clone=function(){return new e(this._isEqual,this)},e.prototype.getHistory=function(){return Q([],Z(this._history),!1)},e.prototype.getRepeatingEntries=function(){var e=this._history.length;outer:for(var t=1;t<=e/2;t++){for(var n=e-t*2,r=0;r<t;r++)if(!this._isEntryEqual(this._history[n+r],this._history[n+t+r]))continue outer;return this._history.slice(n,n+t)}return null},e}();function Vf(e){var t=!1,n;return function(){return t||(t=!0,n=e()),n}}var Hf=Symbol(`isUnboundedReaderTypeStep`),Uf={ranges:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:/* @__PURE__ */ new Map};function Wf(e){var t,n,r,i,a=e.multiLine,o=e.reader;return X(this,function(e){switch(e.label){case 0:t=Id(o),n=[{get:Vf(function(){return t.next()}),reader:t}],r=function(){var e,t,r,i,o;return X(this,function(s){switch(s.label){case 0:return e=n.pop(),e?[4,{type:Hf}]:[2,`break`];case 1:if(s.sent(),t=e.get(),t.done){if(t.value.type===`end`&&!t.value.bounded)return[2,{value:!0}]}else switch(t.value.type){case Mf:r=t.value,n.push({get:Vf(function(){return e.reader.next()}),reader:e.reader}),r.subType===null&&(i=r.reader(),n.push({get:Vf(function(){return i.next()}),reader:i}));break;case Nf:a&&(o=Gd(Kd(Uf,t.value.characterGroups)),o&&n.push({get:Vf(function(){return e.reader.next()}),reader:e.reader}))}return[2]}})},e.label=1;case 1:return[5,r()];case 2:if(i=e.sent(),typeof i==`object`)return[2,i.value];if(i===`break`)return[3,4];e.label=3;case 3:return[3,1];case 4:return[2,!1]}})}function Gf(e,t){return new Set(Q(Q([],Z(e),!1),Z(t),!1))}function Kf(e,t){return e.size===t.size&&Gf(e,t).size===e.size}var qf=Symbol(`checkerReaderTypeTrail`);function Jf(e,t){return e===t}function Yf(e,t){return e.map(function(e){switch(e.type){case`quantifier`:return`q:${e.quantifier.range[0]}:${t&&e.quantifier.max===void 0&&e.iteration>=e.quantifier.min?`*`:`${e.iteration}`}`;case`reference`:return`r:${e.reference.range[0]}`;case`group`:return`g:${e.group.range[0]}`}}).filter(Boolean).join(`,`)}function Xf(e,t){for(var n=/* @__PURE__ */ new Set,r=0;r<e.length;r++){var i=e[r];i.type===`group`&&t.has(i.group.range[0])&&n.add(Yf(e.slice(0,r+1),!1))}return n}function Zf(e){return[e.type,e.offset,Yf(e.stack,!1)].join(`:`)}function Qf(e,t){return Q(Q([],Z(e.precedingZeroWidthEntries.map(function(e){return{hash:[`zw`,Zf(e)].join(`:`),stack:e.stack}})),!1),[{hash:[`s`,t].join(`:`),stack:e.stack}],!1)}function $f(e,t){return e.hash===t.hash}function ep(e){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v;return X(this,function(y){switch(y.label){case 0:t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map,i=0,a=Date.now()+e.timeout,o=!1,s=!1,c=Rd(e.leftStreamReader),l=Rd(e.rightStreamReader),u=[{infiniteLoopTracker:new Bf(Jf),streamReadersWithGetters:[{get:Vf(function(){return c.next()}),reader:c},{get:Vf(function(){return l.next()}),reader:l}],trail:[]}],d=function(){var s,c,l,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,ee,te,ne,re,E,D,ie,O,k,ae,oe,m,se,ce,le,ue,de,fe,pe,me,he,fe,ge,_e,ve,fe,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,A,ze;return X(this,function(Be){switch(Be.label){case 0:if(o=Date.now()>a,o||i>e.maxSteps||(s=u.pop(),!s))return[2,`break`];for(c=s.streamReadersWithGetters,l=s.infiniteLoopTracker,d=s.trail,f=[],p=function(e){i+=.5;var t=c[e].get();if(!t.done&&t.value.type===Mf){var n=t.value;u.push({infiniteLoopTracker:l,streamReadersWithGetters:c.map(function(t,n){var r=t.reader,i=t.get;return{get:n===e?Vf(function(){return r.next()}):i,reader:r}}),trail:d});var r=c.map(function(t,r){var i=t.reader,a=t.get,o=r===e?Rd(n.reader()):Id(i);return{get:r<e?a:Vf(function(){return o.next()}),reader:o}});return u.push({infiniteLoopTracker:l.clone(),streamReadersWithGetters:r,trail:d}),`continue-outer`}f.push(t)},m=0;m<c.length;m++)if(h=p(m),h===`continue-outer`)return[2,h];if(g=Z(f,2),_=g[0],v=g[1],i>e.maxSteps||_.done||v.done)return[2,`continue`];
39
+ /* istanbul ignore next */
40
+ if(_.value.type!==Nf||v.value.type!==Nf)throw Error(`Internal error: impossible leftValue/rightValue type`);if(y=_.value,b=v.value,x=y.precedingZeroWidthEntries.some(function(e){return e.type===`start`}),S=b.precedingZeroWidthEntries.some(function(e){return e.type===`start`}),C=x||S,d.length>0&&C||(w=Sd(y.lookaheadStack),T=Sd(b.lookaheadStack),w!==T)||(ee=Kd(y.characterGroups,b.characterGroups),Gd(ee)))return[2,`continue`];if(te=Yf(y.stack,!1),ne=Yf(b.stack,!1),re=[y.node.range[0],te].join(`:`),E=[b.node.range[0],ne].join(`:`),D=Sd(d),ie=new Set(D?.left.atomicGroupsEnteredTogether),O=new Set(D?.right.atomicGroupsEnteredTogether),k=!!D?.diverged,!k)for(ae=Qf(y,re),oe=Qf(b,E),m=0;m<Math.min(ae.length,oe.length);m++){if(se=ae[m],ce=oe[m],se.hash!==ce.hash){k=!0;break}le=Xf(se.stack,e.atomicGroupOffsets);try{for(ue=(Fe=void 0,vd(le)),de=ue.next();!de.done;de=ue.next())fe=de.value,ie.add(fe),O.add(fe)}catch(e){Fe={error:e}}finally{try{de&&!de.done&&(Ie=ue.return)&&Ie.call(ue)}finally{if(Fe)throw Fe.error}}}pe=Xf(y.stack,e.atomicGroupOffsets);try{for(me=(Le=void 0,vd(ie)),he=me.next();!he.done;he=me.next())fe=he.value,pe.has(fe)||ie.delete(fe)}catch(e){Le={error:e}}finally{try{he&&!he.done&&(Re=me.return)&&Re.call(me)}finally{if(Le)throw Le.error}}ge=Xf(b.stack,e.atomicGroupOffsets);try{for(_e=(A=void 0,vd(O)),ve=_e.next();!ve.done;ve=_e.next())fe=ve.value,ge.has(fe)||O.delete(fe)}catch(e){A={error:e}}finally{try{ve&&!ve.done&&(ze=_e.return)&&ze.call(_e)}finally{if(A)throw A.error}}if(ye={atomicGroupsEnteredTogether:ie,characterGroups:y.characterGroups,contextTrail:te,hash:re,node:y.node,stack:y.stack},be={atomicGroupsEnteredTogether:O,characterGroups:b.characterGroups,contextTrail:ne,hash:E,node:b.node,stack:b.stack},xe={diverged:k,intersection:ee,left:ye,right:be},d=Q(Q([],Z(d),!1),[xe],!1),Se=rf(y.stack,e.nodeExtra),Se.size>0&&(Ce=d.every(function(e){var t=e.left,n=e.right;return $f(t,n)}),Ce))return[2,`continue`];if(we={left:[y.node.range[0],Yf(y.stack,!0)].join(`:`),right:[b.node.range[0],Yf(y.stack,!0)].join(`:`)},r.set(we,xe),l.append(we),Te=l.getRepeatingEntries(),Te){
41
+ /* istanbul ignore next */
42
+ if(Ee=r.get(Te[0]),!Ee)throw Error(`Internal error: missing entry at start of loop`);return n.add(Ee),[2,`continue`]}if(!Kf(xe.left.atomicGroupsEnteredTogether,xe.right.atomicGroupsEnteredTogether))return[2,`continue-outer`];if(De=$f(xe.left,xe.right),De)return[3,2];for(Oe=Wf({multiLine:e.multiLine,reader:Id(c[0].reader)}),ke=void 0;!(ke=Oe.next()).done;)switch(ke.value.type){case Hf:if(i+=.5,i>e.maxSteps)return[2,`break-outer`]}if(Ae=ke.value,Ae)return[2,`continue`];for(je=Wf({multiLine:e.multiLine,reader:Id(c[1].reader)}),Me=void 0;!(Me=je.next()).done;)switch(Me.value.type){case Hf:
43
+ /* istanbul ignore next */
44
+ if(i+=.5,i>e.maxSteps)return[2,`break-outer`]}return Ne=Me.value,Ne?[2,`continue`]:(Pe=function(){return!Q([],Z(t),!1).some(function(e){return e.length===d.length?e.every(function(e,t){return $f(e.left,d[t].left)&&$f(e.right,d[t].right)})||e.every(function(e,t){return $f(e.left,d[t].right)&&$f(e.right,d[t].left)}):!1})},Pe()?(t.add(d),[4,{trail:d,type:qf}]):[3,2]);case 1:Be.sent(),Be.label=2;case 2:return u.push({infiniteLoopTracker:l,streamReadersWithGetters:c.map(function(e){var t=e.reader;return{get:Vf(function(){return t.next()}),reader:t}}),trail:d}),[2]}})},y.label=1;case 1:return[5,d()];case 2:if(f=y.sent(),f===`break`)return[3,4];switch(f){case`break-outer`:return[3,4];case`continue-outer`:return[3,3]}y.label=3;case 3:return[3,1];case 4:if(n.size>0)try{for(p=vd(t),m=p.next();!m.done;m=p.next())if(h=m.value,h.some(function(e){return n.has(e)})){s=!0;break}}catch(e){_={error:e}}finally{try{m&&!m.done&&(v=p.return)&&v.call(p)}finally{if(_)throw _.error}}return g=i>e.maxSteps?`hitMaxSteps`:o?`timedOut`:null,[2,g?{error:g}:{error:null,infinite:s}]}})}var tp=[`lookahead`,`lookbehind`,`negativeLookahead`,`negativeLookbehind`];function np(e){var t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=[],a=function(e,o,s){switch(e.type){case`anchor`:case`characterClass`:case`characterClassEscape`:case`characterClassRange`:case`unicodePropertyEscape`:case`value`:case`dot`:return;case`reference`:r.set(e,o),s&&i.push(e);break;case`alternative`:case`disjunction`:e.body.forEach(function(e){return a(e,o,s)});return;case`group`:if(e.behavior===`normal`){var c=t.size+1;t.set(e,c),n.set(c,e),r.set(e,o)}var l=Q([],Z(o),!1);e.behavior!==`normal`&&tp.indexOf(e.behavior)>=0&&l.push(e),e.body.forEach(function(e){return a(e,l,s)});return;case`quantifier`:e.body.forEach(function(t){return a(t,o,s&&e.max!==0)});return}};return a(e,[],!0),{capturingGroupToIndex:t,indexToCapturingGroup:n,nodeToLookaheadStack:r,reachableReferences:i}}var rp=function(){function e(){this._cache=/* @__PURE__ */ new Map}return e.prototype.addResult=function(e,t,n){var r=this._cache.get(e)||/* @__PURE__ */ new Map;r.set(t,n),this._cache.set(e,r);var i=this._cache.get(t)||/* @__PURE__ */ new Map;i.set(e,n),this._cache.set(t,i)},e.prototype.getResult=function(e,t){return this._cache.get(e)?.get(t)},e}(),ip=function(){function e(e){this.decode=e,this.root=/* @__PURE__ */ new Map,this.results=/* @__PURE__ */ new Map,this._items=function(){return[]}}return e.prototype.add=function(e){var t=this.decode(e);if(t.length!==0){for(var n=this.results,r={children:this.root},i=t.length,a=0;a<i;a++){var o=t[a],s=a===i-1,c=r.children.get(o);if(c)r=c,s||n.delete(c);else{var l={children:/* @__PURE__ */ new Map,value:o};r.children.set(o,l),r=l,s&&n.set(l,e)}}this._items=Vf(function(){return Array.from(n.values())})}},Object.defineProperty(e.prototype,"items",{get:function(){return this._items()},enumerable:!1,configurable:!0}),e}(),ap=25e3,op=function(){function e(e,t){this.trail=e,this.isEmptyCache=t,this.tree=new ip(function(e){return e.map(function(e){return e.hash})}),this.inputStringSchema=e.map(function(e){return e.intersection}),this.length=e.length,this.onNewTrail(this)}return Object.defineProperty(e.prototype,"matches",{get:function(){return this.tree.items},enumerable:!1,configurable:!0}),e.prototype.getLongestMatch=function(e,t){var n=this;
45
+ /* istanbul ignore next */
46
+ if(t.length>e.length)throw Error(`Internal error: trail should be <= than input string schema`);var r=t.findIndex(function(t,r){var i=n.isEmptyCache.getResult(t.characterGroups,e[r]);if(i!==void 0)return i;var a=Gd(Kd(t.characterGroups,e[r]));return n.isEmptyCache.addResult(t.characterGroups,e[r],a),a});return r===-1?t:t.slice(0,r)},e.prototype.onNewTrail=function(e){var t,n,r=[],i=[];try{for(var a=vd(e.trail),o=a.next();!o.done;o=a.next()){var s=o.value;r.push(s.left),i.push(s.right)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}var c=this.getLongestMatch(this.inputStringSchema,r);c.length===this.length&&this.tree.add(c);var l=this.getLongestMatch(this.inputStringSchema,i);l.length===this.length&&this.tree.add(l)},e}();function sp(e){var t,n,r=e.atomicGroupOffsets,i=e.node,a=e.maxScore,o=e.maxSteps,s=e.multiLine,c=e.timeout,l=e.caseInsensitive,u=e.dotAll,d=new rp,f=np(i),p={caseInsensitive:l,dotAll:u,node:i,nodeExtra:f},m=ep({atomicGroupOffsets:r,leftStreamReader:zf(p),maxSteps:o,multiLine:s,nodeExtra:f,rightStreamReader:zf(p),timeout:c}),h=new ip(function(e){return e.trail}),g=1,_=0,v;outer:for(;!(v=m.next()).done;)switch(v.value.type){case qf:var y=new op(v.value.trail,d),b=function(e){var t=e.matches.length;t>g&&(g=t)};if(_<ap){try{for(var x=(t=void 0,vd(h.items)),S=x.next();!S.done;S=x.next()){var C=S.value;if(C.length===y.length){if(_+=y.length,_>=ap)break;y.onNewTrail(C),C.onNewTrail(y),b(C)}}}catch(e){t={error:e}}finally{try{S&&!S.done&&(n=x.return)&&n.call(x)}finally{if(t)throw t.error}}b(y)}if(_>=ap&&(g+=1),h.add(y),g>a)break outer}var w=null;return v.done?v.value.error?(g=1/0,w=v.value.error):v.value.infinite&&(g=1/0,w=`hitMaxScore`):(g=1/0,w=`hitMaxScore`),{error:w,score:g,trails:h.items.map(function(e){return e.trail})}}var cp=1/0,lp=2e4;function up(e){return{end:{offset:e.range[1]},source:e.raw,start:{offset:e.range[0]}}}function dp(e){return e.flatMap(function(e){return e.type===`reference`?[e.reference]:[]}).reverse().map(function(e){return{index:e.matchIndex,node:up(e)}})}function fp(e){var t=Q([],Z(e),!1).reverse(),n=t.findIndex(function(e){return e.type===`reference`});return t.slice(0,n>=0?n:e.length).reverse().flatMap(function(e){return e.type===`quantifier`?[e]:[]}).map(function(e){var t=e.quantifier;return{iteration:e.iteration,node:up(t)}})}function pp(e,t){var n=t===void 0?{}:t,r=n.atomicGroupOffsets,i=n.maxScore,a=i===void 0?200:i,o=n.maxSteps,s=o===void 0?lp:o,c=n.multiLine,l=c!==void 0&&c,u=n.timeout,d=u===void 0?cp:u,f=n.caseInsensitive,p=f!==void 0&&f,m=n.dotAll,h=m!==void 0&&m,g=n.unicode,_=g!==void 0&&g,v=n.downgradePattern,y=v===void 0||v;if(p&&_)throw Error("`caseInsensitive` cannot be used with `unicode`.");if(y&&r)throw Error("`atomicGroupOffsets` cannot be used with `downgradePattern: true`.");if(d<=0)throw Error("`timeout` must be a positive number.");if(a<0)throw Error("`maxScore` must be a positive number or 0.");if(s<=0)throw Error("`maxSteps` must be a positive number.");var b=y?jd({pattern:e,unicode:_}):{atomicGroupOffsets:new Set(r||[]),pattern:e},x=b.pattern,S=b.atomicGroupOffsets,C=y&&e!==x,w=xd(x,_);if(!y&&kd(w))throw Error("Pattern is not bounded at the start and needs downgrading. See the `downgradePattern` option.");var T=sp({atomicGroupOffsets:S,caseInsensitive:p,dotAll:h,maxScore:a,maxSteps:s,multiLine:l,node:w,timeout:d});return _d(_d({},T.error?{error:T.error,safe:!1}:{error:null,safe:!0}),{pattern:x,patternDowngraded:C,score:T.score===1/0?{infinite:!0}:{infinite:!1,value:T.score},trails:T.trails.map(function(e){return{trail:e.map(function(e){var t=e.left,n=e.right;return{a:{backreferenceStack:dp(n.stack),node:up(n.node),quantifierIterations:fp(n.stack)},b:{backreferenceStack:dp(t.stack),node:up(t.node),quantifierIterations:fp(t.stack)}}})}})})}function mp(e,t={}){if(e==null||typeof e!=`string`||e.length===0)return!0;let n=t.maxPatternLength??256;if(e.length>n)return!1;try{return new RegExp(e),pp(e).safe&&pp(`^(?:${e})$`).safe}catch{return!1}}var hp=`en-US`;function gp(e){if(!e)return hp;try{return Intl.NumberFormat.supportedLocalesOf(e).length>0?e:hp}catch{return hp}}function _p(e){if(e==null)return``;if(typeof e==`object`)try{return JSON.stringify(e)??String(e)}catch{return String(e)}return String(e)}function vp(e){let t=!0;return(e==null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)&&(t=!1),{valid:t,...t?{}:{message:`This field is required.`}}}function yp(e,t){if(!mp(t))throw new V(`Unsafe regex pattern (catastrophic backtracking risk): ${t}`,`regex`);try{let n=new RegExp(t).test(String(e??``));return{valid:n,...n?{}:{message:`Value does not match required pattern.`}}}catch(e){throw new V(`Invalid regex pattern: ${t}`,`regex`,e)}}function bp(e,t,n){let r=0;(typeof e==`string`||Array.isArray(e))&&(r=e.length);let i=!0,a;return t!==void 0&&!isNaN(t)&&r<t?(i=!1,a=`Minimum length is ${t}.`):n!==void 0&&!isNaN(n)&&r>n&&(i=!1,a=`Maximum length is ${n}.`),{valid:i,...a?{message:a}:{}}}function xp(e,t,n){let r=Number(e);if(isNaN(r))return{valid:!1,message:`Value must be a valid number.`};let i=!0,a;return t!==void 0&&!isNaN(t)&&r<t?(i=!1,a=`Minimum value is ${t}.`):n!==void 0&&!isNaN(n)&&r>n&&(i=!1,a=`Maximum value is ${n}.`),{valid:i,...a?{message:a}:{}}}var Sp=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;function Cp(e){let t=typeof e==`string`&&Sp.test(e);return{valid:t,...t?{}:{code:`INVALID_EMAIL`,severity:`error`,message:`Please enter a valid email address (e.g. user@example.com).`}}}var wp=/* @__PURE__ */ new Map;function Tp(e,t,n){let r=`${e}:${t??`undef`}:${n??`true`}`,i=wp.get(r);return i||(i=new Intl.NumberFormat(e,{minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:n}),wp.set(r,i)),i}var Ep=/* @__PURE__ */ new Map;function Dp(e,t,n,r){let i=`${e}:${t}:${n??`undef`}:${r??`true`}`,a=Ep.get(i);return a||(a=new Intl.NumberFormat(e,{style:`currency`,currency:t,minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:r}),Ep.set(i,a)),a}var Op=`USD`,kp=/* @__PURE__ */ new Map;function Ap(e,t,n){let r=`${e}:${t??`undef`}:${n??`true`}`,i=kp.get(r);return i||(i=new Intl.NumberFormat(e,{style:`currency`,currency:Op,currencyDisplay:`code`,minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:n}),kp.set(r,i)),i}var jp=/* @__PURE__ */ new Map;function Mp(e){let t=jp.get(e);if(!t){let n=(t,n)=>{let r=new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`});return n.map(e=>r.format(e))},r=Array.from({length:12},(e,t)=>new Date(Date.UTC(2021,t,15))),i=Array.from({length:7},(e,t)=>new Date(Date.UTC(2021,2,1+t)));t={monthsLong:n({month:`long`},r),monthsShort:n({month:`short`},r),weekdaysLong:n({weekday:`long`},i),weekdaysShort:n({weekday:`short`},i)},jp.set(e,t)}return t}var Np=/yyyy|yy|MMMM|MMM|MM|M|EEEE|E|dd|d|HH|H|hh|h|mm|ss|a/g,Pp=/(?:Z|[+-]\d{2}:?\d{2})$/,Fp=/^([+-]?\d{4,6})-(\d{2})-(\d{2})(?:[T ](\d{2})(?::(\d{2})(?::(\d{2}))?)?)?/;function Ip(e){let t=Pp.test(e),n=new Date(t?e:`${e}Z`);if(isNaN(n.getTime()))return null;let r=0,i=/([+-])(\d{2}):?(\d{2})$/.exec(e);i&&(r=(i[1]===`-`?-1:1)*(Number(i[2])*60+Number(i[3])));let a=new Date(n.getTime()+r*6e4);return Lp(e,a)?{shifted:a,instant:n}:null}function Lp(e,t){let n=Fp.exec(e);if(!n)return!1;let r=e=>n[e]===void 0?void 0:Number(n[e]);return r(1)===t.getUTCFullYear()&&r(2)===t.getUTCMonth()+1&&r(3)===t.getUTCDate()&&(r(4)??t.getUTCHours())===t.getUTCHours()&&(r(5)??t.getUTCMinutes())===t.getUTCMinutes()&&(r(6)??t.getUTCSeconds())===t.getUTCSeconds()}var Rp=/* @__PURE__ */ new Map;function zp(e){let t=Rp.get(e);return t||(t=new Intl.PluralRules(e),Rp.set(e,t)),t}var Bp=e=>!!e;function Vp(e,t=Bp){if(!Array.isArray(e)||e.length<2)throw new V(`and requires at least 2 values`,`and`);return e.every(t)}function Hp(e,t=Bp){if(!Array.isArray(e)||e.length<2)throw new V(`or requires at least 2 values`,`or`);return e.some(t)}function Up(e,t=Bp){return!t(e)}function Wp(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;if(`path`in e&&typeof e.path==`string`&&!(`@path`in e))return{"@path":e.path};if(`call`in e&&typeof e.call==`string`&&!(`@call`in e)){let t={};if(e.args&&typeof e.args==`object`)for(let[n,r]of Object.entries(e.args))t[n]=Wp(r);return{"@call":e.call,args:t,returnType:e.returnType}}return e}function Gp(e,t){let n=new pd().parse(e);if(n.length===0)return``;let r=H(t.surface?.protocolVersion??t.surface?.defaultCatalog?.protocolVersion,`1.0`),i=n.map(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return e;let n=r?Wp(e):e;return t.resolveSignal(n)});return ss(()=>i.map(e=>_p(us(e)?ds(e):e)).join(``))}function Kp(e,t,n,r=hp){return isNaN(e)?``:Tp(r,t,n).format(e)}function qp(e,t,n=2,r,i=hp){if(isNaN(e))return``;let a=String(t).toUpperCase();try{return Dp(i,a,n,r).format(e)}catch{return Ap(i,n,r).formatToParts(e).map(e=>e.type===`currency`?a:e.value).join(``)}}function Jp(e,t=`yyyy-MM-dd`,n=hp){if(!e)return``;let r=Ip(String(e));if(!r)return``;let{shifted:i,instant:a}=r,o=t||`yyyy-MM-dd`;if(o===`ISO`)return a.toISOString();let s=Mp(n),c=(i.getUTCDay()+6)%7,l=i.getUTCHours(),u=l%12||12;return o.replace(Np,e=>{switch(e){case`yyyy`:return String(i.getUTCFullYear());case`yy`:return String(i.getUTCFullYear()).slice(-2);case`MMMM`:return s.monthsLong[i.getUTCMonth()];case`MMM`:return s.monthsShort[i.getUTCMonth()];case`MM`:return String(i.getUTCMonth()+1).padStart(2,`0`);case`M`:return String(i.getUTCMonth()+1);case`EEEE`:return s.weekdaysLong[c];case`E`:return s.weekdaysShort[c];case`dd`:return String(i.getUTCDate()).padStart(2,`0`);case`d`:return String(i.getUTCDate());case`HH`:return String(l).padStart(2,`0`);case`H`:return String(l);case`hh`:return String(u).padStart(2,`0`);case`h`:return String(u);case`mm`:return String(i.getUTCMinutes()).padStart(2,`0`);case`ss`:return String(i.getUTCSeconds()).padStart(2,`0`);case`a`:return l<12?`AM`:`PM`;default:return e}})}function Yp(e,t,n=hp){let r;return r=e===0&&t.zero!==void 0?`zero`:e===1&&t.one!==void 0?`one`:e===2&&t.two!==void 0?`two`:zp(n).select(e),String(t[r]??t.other??``)}function Xp(e){let t=typeof e==`string`?e:void 0;if(!t||typeof window>`u`||typeof window.open!=`function`)return;let n=typeof window<`u`&&window.location!==void 0&&window.location.href?window.location.href:void 0,r;try{r=n?new URL(t,n):new URL(t)}catch(e){throw new V(`Invalid URL specified: ${t}`,`openUrl`,e)}if(r.protocol!==`https:`&&r.protocol!==`http:`&&r.protocol!==`mailto:`&&r.protocol!==`tel:`)throw new V(`Unsupported URL scheme: ${r.protocol}`,`openUrl`);window.open(r.href,`_blank`,`noopener,noreferrer`)}function Zp(e,{truthy:t=Bp}={}){return q(e,e=>Vp(e.values,t))}function Qp(e,{truthy:t=Bp}={}){return q(e,e=>Hp(e.values,t))}function $p(e,{truthy:t=Bp}={}){return q(e,e=>Up(e.value,t))}function em(e){return q(e,(e,t)=>Gp(e.value,t))}function tm(e,t){let n=gp(t);return q(e,e=>Kp(e.value,e.decimals,e.grouping,n))}function nm(e,t){let n=gp(t);return q(e,e=>qp(e.value,e.currency,e.decimals??2,e.grouping,n))}function rm(e,t){let n=gp(t);return q(e,e=>Jp(e.value,e.format,n))}function im(e,t){let n=gp(t);return q(e,e=>Yp(e.value,e,n))}function am(e){return q(e,e=>Xp(e.url))}var om=[q($u,e=>e.a+e.b),q(ed,e=>e.a-e.b),q(td,e=>e.a*e.b),q(nd,e=>{let t=Number(e.a),n=Number(e.b);return Number.isNaN(t)||Number.isNaN(n)?NaN:n===0?1/0:t/n}),q(rd,e=>e.a===e.b),q(id,e=>e.a!==e.b),q(ad,e=>e.a>e.b),q(od,e=>e.a<e.b),q(sd,e=>e.string.includes(e.substring)),q(cd,e=>e.string.startsWith(e.prefix)),q(ld,e=>e.string.endsWith(e.suffix))],sm=Zp(qu),cm=Qp(Ju),lm=$p(Yu),um=q(Iu,e=>vp(e.value).valid),dm=q(Lu,e=>yp(e.value,e.pattern).valid),fm=q(Ru,e=>bp(e.value,e.min,e.max).valid),pm=q(zu,e=>xp(e.value,e.min,e.max).valid),mm=q(Bu,e=>Cp(e.value).valid),hm=em(Vu);function gm(e){return tm(Hu,e)}gm();function _m(e){return nm(Uu,e)}_m();function vm(e){return rm(Wu,e)}vm();function ym(e){return im(Gu,e)}ym();var bm=am(Ku);function xm(e){let t=e?.locale;return[um,dm,fm,pm,mm,hm,gm(t),_m(t),vm(t),ym(t),bm,sm,cm,lm]}var Sm=xm();function Cm(e){return[...om,...xm(e)]}Cm();var wm={accountCircle:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 4c1.93 0 3.5 1.57 3.5 3.5S13.93 13 12 13s-3.5-1.57-3.5-3.5S10.07 6 12 6zm0 14c-2.03 0-4.43-.82-6.14-2.88a9.947 9.947 0 0 1 12.28 0C16.43 19.18 14.03 20 12 20z`,add:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`,arrowBack:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z`,arrowForward:`m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z`,attachFile:`M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z`,calendarToday:`M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z`,call:`M20.01 15.38c-1.23 0-2.42-.2-3.53-.56a.977.977 0 0 0-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z`,camera:`M12 8.8a3.2 3.2 0 1 0 0 6.4 3.2 3.2 0 1 0 0-6.4z M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z`,check:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`,close:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`,delete:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z`,download:`M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z`,edit:`M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z`,error:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`,event:`M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z`,fastForward:`m4 18 8.5-6L4 6v12zm9-12v12l8.5-6L13 6z`,favorite:`m12 21.35-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z`,favoriteOff:`M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z`,folder:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`,help:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z`,home:`M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z`,info:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z`,locationOn:`M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5z`,lock:`M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z`,lockOpen:`M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10z`,mail:`M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z`,menu:`M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z`,moreHoriz:`M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z`,moreVert:`M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z`,notifications:`M12 22c1.1 0 2-.9 2-2h-4a2 2 0 0 0 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z`,notificationsOff:`M20 18.69 7.84 6.14 5.27 3.49 4 4.76l2.8 2.8v.01c-.52.99-.8 2.16-.8 3.42v5l-2 2v1h13.73l2 2L21 19.72l-1-1.03zM12 22c1.11 0 2-.89 2-2h-4c0 1.11.89 2 2 2zm6-7.32V11c0-3.08-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68c-.15.03-.29.08-.42.12-.1.03-.2.07-.3.11h-.01c-.01 0-.01 0-.02.01-.23.09-.46.2-.68.31 0 0-.01 0-.01.01L18 14.68z`,pause:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`,payment:`M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z`,person:`M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z`,phone:`M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z`,photo:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z`,play:`M8 5v14l11-7z`,print:`M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z`,refresh:`M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z`,rewind:`M11 18V6l-8.5 6 8.5 6zm.5-6 8.5 6V6l-8.5 6z`,search:`M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`,send:`M2.01 21 23 12 2.01 3 2 10l15 2-15 2z`,settings:`M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z`,share:`M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z`,shoppingCart:`M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1.003 1.003 0 0 0 20 4H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z`,skipNext:`m6 18 8.5-6L6 6v12zM16 6v12h2V6h-2z`,skipPrevious:`M6 6h2v12H6zm3.5 6 8.5 6V6z`,star:`M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z`,starHalf:`m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4V6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z`,starOff:`m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z`,stop:`M6 6h12v12H6z`,upload:`M5 20h14v-2H5v2zm0-10h4v6h6v-6h4l-7-7-7 7z`,visibility:`M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z`,visibilityOff:`M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46A11.804 11.804 0 0 0 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z`,volumeDown:`M18.5 12A4.5 4.5 0 0 0 16 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z`,volumeMute:`M7 9v6h4l5 5V4l-5 5H7z`,volumeOff:`M16.5 12A4.5 4.5 0 0 0 14 7.97v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51A8.796 8.796 0 0 0 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06a8.99 8.99 0 0 0 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4 9.91 6.09 12 8.18V4z`,volumeUp:`M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z`,warning:`M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z`};function $(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n!==void 0&&(r.textContent=n),r}function Tm(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function Em(e,t){e.style.flex=typeof t==`number`?String(t):``}function Dm(e){let t=e.accessibility;if(a(t)&&typeof t.label==`string`)return t.label||void 0}function Om(e,t,n){n===void 0?e.removeAttribute(t):e.setAttribute(t,n)}function km(e,t){let n=Dm(t);Om(e,`role`,n===void 0?void 0:`group`),Om(e,`aria-label`,n)}function Am(e){let t=e.validationErrors;return Array.isArray(t)?t.map(Tm).join(` `):``}function jm(e,t,n){let r=Am(n);e.textContent=r,e.hidden=r===``,Om(t,`aria-invalid`,r===``?void 0:`true`)}function Mm(e,t){let n=$(`p`,`a2ui-error`);return n.id=e.uid(),n.hidden=!0,t.setAttribute(`aria-describedby`,n.id),n}function Nm(e){let t=Tm(e);return/^https?:\/\//i.test(t)?t:null}function Pm(e,t){return typeof e==`string`?{id:e,path:t}:a(e)&&typeof e.id==`string`?{id:e.id,path:typeof e.basePath==`string`?e.basePath:t}:null}function Fm(e,t){let n=/* @__PURE__ */ new Map;return{sync(r,i){let a=/* @__PURE__ */ new Map,o=[];for(let r of Array.isArray(i)?i:[i]){let i=Pm(r,t);if(!i)continue;let s=`${i.id}@${i.path}`,c=a.get(s)??n.get(s)??e.mount(i.id,i.path);a.set(s,c),o.push(c.el)}for(let[e,t]of n)a.has(e)||t.dispose();n=a;let s=r.children;(o.length!==s.length||o.some((e,t)=>e!==s[t]))&&r.replaceChildren(...o)},dispose(){for(let e of n.values())e.dispose();n.clear()}}}var Im=[`h1`,`h2`,`h3`,`h4`,`h5`],Lm=e=>{let t=$(`div`,`a2ui-text`),r=null;return{el:t,update(i){Em(t,i.weight);let a=Tm(i.variant)||`body`,o=Tm(i.text),s=`${a}\n${o}`;if(s===r)return;r=s;let c=Im.find(e=>e===a);if(c)t.replaceChildren($(c,`a2ui-title`,o));else if(a===`caption`)t.replaceChildren($(`span`,`a2ui-caption`,o));else{let r=$(`div`,`markdown`);n(r,o,{host:e.env.host,widgets:!1,lang:e.env.lang,strings:e.strings});for(let e of r.querySelectorAll(`a`))e.replaceWith(...e.childNodes);t.replaceChildren(r)}}}},Rm=`http://www.w3.org/2000/svg`,zm=()=>{let e=$(`span`,`a2ui-icon`);return{el:e,update(t){let n=t.name,r=typeof n==`string`?wm[n]:a(n)&&typeof n.svgPath==`string`?n.svgPath:void 0;if(r===void 0){e.replaceChildren();return}let i=document.createElementNS(Rm,`svg`);i.setAttribute(`viewBox`,`0 0 24 24`);let o=document.createElementNS(Rm,`path`);o.setAttribute(`d`,r),o.setAttribute(`fill`,`currentColor`),i.append(o),e.replaceChildren(i);let s=Dm(t);Om(e,`role`,s===void 0?void 0:`img`),Om(e,`aria-label`,s),Om(e,`aria-hidden`,s===void 0?`true`:void 0)}}},Bm=e=>()=>{let t=$(`span`,`a2ui-media a2ui-${e}`);return{el:t,update(e){Em(t,e.weight),t.textContent=Tm(e.description)||(Dm(e)??Nm(e.url)??``)}}},Vm=e=>(t,n)=>{let r=$(`div`,`a2ui-${e}`),i=Fm(t,n);return{el:r,update(t){Em(r,t.weight),km(r,t),r.dataset.justify=Tm(t.justify)||`start`,r.dataset.align=Tm(t.align)||`stretch`,e===`list`&&(r.dataset.direction=Tm(t.direction)||`vertical`),i.sync(r,t.children)},dispose:()=>i.dispose()}},Hm=(e,t)=>{let n=$(`div`,`a2ui-card`),r=Fm(e,t);return{el:n,update(e){Em(n,e.weight),km(n,e),r.sync(n,e.child)},dispose:()=>r.dispose()}},Um=()=>{let e=$(`hr`,`a2ui-divider`);return{el:e,update(t){let n=t.axis===`vertical`;e.classList.toggle(`vertical`,n),Om(e,`aria-orientation`,n?`vertical`:void 0)}}},Wm=(e,t)=>{let n=$(`div`,`a2ui-tabs`),r=$(`div`,`a2ui-tablist`);r.setAttribute(`role`,`tablist`),r.setAttribute(`aria-label`,e.strings.a2uiTabs);let i=$(`div`,`a2ui-tabpanel`);i.id=e.uid(),i.setAttribute(`role`,`tabpanel`),n.append(r,i);let o=Fm(e,t),s=0,c={},l=()=>{let e=Array.isArray(c.tabs)?c.tabs.filter(a):[];n.hidden=e.length===0,s>=e.length&&(s=0),r.replaceChildren(...e.map((e,t)=>{let n=$(`button`,`a2ui-tab`,Tm(e.title));return n.type=`button`,n.setAttribute(`role`,`tab`),n.setAttribute(`aria-selected`,String(t===s)),n.setAttribute(`aria-controls`,i.id),n.addEventListener(`click`,()=>{s=t,l()}),n})),o.sync(i,e[s]?.child)};return{el:n,update(e){Em(n,e.weight),c=e,l()},dispose:()=>o.dispose()}},Gm=(e,t)=>{let n=$(`span`,`a2ui-modal`),r=$(`span`,`a2ui-modal-trigger`),i=$(`dialog`,`a2ui-dialog`),a=$(`h2`,`a2ui-title`,e.strings.a2uiDetails);a.id=e.uid(),i.setAttribute(`aria-labelledby`,a.id);let o=$(`div`,`a2ui-dialog-body`),s=$(`button`,`a2ui-button`,e.strings.close);s.type=`button`,s.dataset.variant=`default`;let c=$(`div`,`a2ui-dialog-footer`);c.append(s),i.append(a,o,c),n.append(r,i);let l=Fm(e,t),u=Fm(e,t),d={};return r.addEventListener(`click`,()=>{u.sync(o,d.content),i.showModal()}),s.addEventListener(`click`,()=>i.close()),i.addEventListener(`close`,()=>u.sync(o,[])),{el:n,update(e){d=e,l.sync(r,e.trigger),i.open&&u.sync(o,e.content)},dispose(){l.dispose(),u.dispose()}}},Km=(e,t)=>{let n=$(`button`,`a2ui-button`);n.type=`button`;let r=Fm(e,t),i={};return e.control(n,()=>i.isValid===!1),n.addEventListener(`click`,()=>{let e=i.action;typeof e==`function`&&e()}),{el:n,update(t){i=t,Em(n,t.weight),n.dataset.variant=Tm(t.variant)||`default`,Om(n,`aria-label`,Dm(t)),r.sync(n,t.child),e.refresh(n)},dispose:()=>r.dispose()}};function qm(e,t=`setValue`){let n=e[t];return typeof n==`function`?n:()=>void 0}function Jm(e,t){let n=$(`div`,`a2ui-field`),r=$(`label`,`a2ui-label`);t.id=e.uid(),r.htmlFor=t.id;let i=Mm(e,t);return n.append(r,t,i),e.control(t),{el:n,label:r,errors:i}}var Ym=e=>{let t=null,n=null,r=``,i={},a=$(`div`,`a2ui-field-wrapper`);return{el:a,update(o){i=o;let s=Tm(o.variant)||`shortText`;if(s!==r||!t||!n){if(r=s,s===`longText`)t=$(`textarea`,`a2ui-input`);else{let e=$(`input`,`a2ui-input`);e.type=s===`number`?`number`:s===`obscured`?`password`:`text`,t=e}t.addEventListener(`input`,e=>{qm(i)(e.target.value)}),n=Jm(e,t),a.replaceChildren(n.el)}Em(a,o.weight),n.label.textContent=Tm(o.label),Om(t,`aria-label`,Dm(o));let c=Tm(o.value);t.value!==c&&(t.value=c),jm(n.errors,t,o)}}},Xm=e=>{let t=$(`div`,`a2ui-field`),n=$(`label`,`a2ui-check`),r=$(`input`);r.type=`checkbox`;let i=$(`span`);n.append(r,i);let a=Mm(e,r);t.append(n,a),e.control(r);let o={};return r.addEventListener(`change`,()=>qm(o)(r.checked)),{el:t,update(e){o=e,Em(t,e.weight),i.textContent=Tm(e.label),r.checked=e.value===!0,jm(a,r,e)}}},Zm=e=>{let t=$(`fieldset`,`a2ui-choices`),n=$(`legend`,`a2ui-label`),r=$(`div`,`a2ui-options`),i=Mm(e,t);t.append(n,r,i);let o=e.uid(),s={},c=``,l=e=>{let t=e.value;return Array.isArray(t)?t.filter(e=>typeof e==`string`):typeof t==`string`?[t]:[]},u=(e,t)=>{let n=s.variant===`multipleSelection`,r=l(s).filter(t=>t!==e);qm(s)(n?t?[...r,e]:r:t?[e]:[])};return{el:t,update(d){s=d,Em(t,d.weight),n.textContent=Tm(d.label),n.hidden=n.textContent===``,Om(t,`aria-label`,Dm(d));let f=(Array.isArray(d.options)?d.options:[]).filter(a).map(e=>({value:Tm(e.value),label:Tm(e.label)})),p=Tm(d.displayStyle),m=d.variant===`multipleSelection`,h=JSON.stringify([p,m,f]),g=l(d);h!==c&&(c=h,r.dataset.style=p===`chips`?`chips`:`list`,r.replaceChildren(...f.map(t=>{if(p===`chips`){let n=$(`button`,`a2ui-chip`,t.label);return n.type=`button`,n.dataset.value=t.value,n.addEventListener(`click`,()=>u(t.value,n.getAttribute(`aria-pressed`)!==`true`)),e.control(n),n}let n=$(`label`,`a2ui-check`),r=$(`input`);return r.type=m?`checkbox`:`radio`,r.name=o,r.dataset.value=t.value,r.addEventListener(`change`,()=>u(t.value,r.checked)),e.control(r),n.append(r,$(`span`,void 0,t.label)),n})));for(let e of r.querySelectorAll(`.a2ui-chip`))e.setAttribute(`aria-pressed`,String(g.includes(e.dataset.value??``)));for(let e of r.querySelectorAll(`input`))e.checked=g.includes(e.dataset.value??``);jm(i,t,d)}}},Qm=e=>{let t=$(`input`,`a2ui-range`);t.type=`range`;let n=Jm(e,t),r={};return t.addEventListener(`input`,()=>qm(r)(Number(t.value))),{el:n.el,update(e){r=e,Em(n.el,e.weight);let i=typeof e.value==`number`?e.value:void 0,a=Tm(e.label)||(Dm(e)??``);n.label.textContent=i===void 0?a:a?`${a}: ${i}`:String(i);let o=typeof e.min==`number`?e.min:0;t.min=String(o),t.max=typeof e.max==`number`?String(e.max):``;let s=String(i??o);t.value!==s&&(t.value=s),jm(n.errors,t,e)}}};function $m(e,t){if(!e)return``;let[n=``,r=``]=e.includes(`T`)?e.split(`T`,2):e.includes(`-`)?[e,``]:[``,e],i=n.slice(0,10),a=r.includes(`:`)?r.slice(0,5):``;return t===`date`?i:t===`time`?a:i?`${i}T${a||`00:00`}`:``}var eh={Text:Lm,Image:Bm(`image`),Icon:zm,Video:Bm(`video`),AudioPlayer:Bm(`audio`),Row:Vm(`row`),Column:Vm(`column`),List:Vm(`list`),Card:Hm,Tabs:Wm,Modal:Gm,Divider:Um,Button:Km,TextField:Ym,CheckBox:Xm,ChoicePicker:Zm,Slider:Qm,DateTimeInput:e=>{let t=$(`input`,`a2ui-input`),n=Jm(e,t),r={};return t.addEventListener(`input`,()=>qm(r)(t.value)),{el:n.el,update(e){r=e,Em(n.el,e.weight);let i=e.enableTime===!0,a=(typeof e.enableDate==`boolean`?e.enableDate:!i)&&i?`datetime-local`:i?`time`:`date`;t.type!==a&&(t.type=a),n.label.textContent=Tm(e.label),Om(t,`aria-label`,Dm(e));let o=$m(Tm(e.value),a);t.value!==o&&(t.value=o),Om(t,`min`,$m(Tm(e.min),a)||void 0),Om(t,`max`,$m(Tm(e.max),a)||void 0),jm(n.errors,t,e)}}}},th=`https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json`,nh=Sm.filter(e=>e.name!==`openUrl`),rh=new nc(th,`0.9`,[vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu],nh,{themeSchema:_u}),ih=/^https:\/\/a2ui\.org\/specification\/v0_9(?:_\d+)?\/catalogs\/basic\/catalog\.json$/;function ah(e){return e.map(e=>{let t=e.createSurface;return!a(t)||typeof t.catalogId!=`string`||t.catalogId===th||!ih.test(t.catalogId)?e:{...e,createSurface:{...t,catalogId:th}}})}function oh(e,t){return e.map(e=>{let n=e.updateComponents;if(!a(n)||!Array.isArray(n.components))return e;let r=n.components,i=r.map(e=>a(e)?t(e):e);return i.some((e,t)=>e!==r[t])?{...e,updateComponents:{...n,components:i}}:e})}function sh(e){return oh(e,e=>e.component===`Icon`&&typeof e.name==`string`&&!(e.name in wm)?{id:e.id,component:`Text`,text:``}:e)}function ch(e){let t=e;for(let e=0;e<16&&t?._def;e++){let e=t._def,n=e.innerType??e.schema??(e.getter?e.getter():void 0);if(!n)return t;t=n}return t}var lh=/* @__PURE__ */ new Map;function uh(e){let t=lh.get(e);if(t)return t;t=/* @__PURE__ */ new Map;let n=ch(rh.components.get(e)?.schema)?._def?.shape?.()??{};for(let[e,r]of Object.entries(n)){let n=ch(r)?._def;n?.typeName===`ZodEnum`&&Array.isArray(n.values)&&t.set(e,n.values)}return lh.set(e,t),t}var dh=e=>e.toLowerCase().replace(/[^a-z0-9]/g,``);function fh(e,t){let n=dh(e);return t.find(e=>{let t=dh(e);return t===n||t===`space${n}`||n===`flex${t}`})}function ph(e){return oh(e,e=>{if(typeof e.component!=`string`)return e;let t=uh(e.component),n;for(let[r,i]of Object.entries(e)){let a=t.get(r);if(typeof i!=`string`||!a||a.includes(i))continue;n??={...e};let o=fh(i,a);o===void 0?delete n[r]:n[r]=o}return n??e})}function mh(e,t){if(a(e)){if(a(e.error)&&typeof e.error.message==`string`)return e.error.message;if(typeof e.message==`string`)return e.message}return t}var hh=`
47
+ .a2ui { display: flex; flex-direction: column; gap: 8px; margin-block: 0 0.75em; padding: 20px; border: 1px solid var(--_border); border-radius: var(--_radius-sm); background: var(--_bg); overflow-x: auto; }
48
+ .a2ui[data-disabled] .a2ui-surface { opacity: 0.75; }
49
+ .a2ui-surface { display: flex; flex-direction: column; gap: 8px; }
50
+ .a2ui-row, .a2ui-column, .a2ui-list { display: flex; gap: 8px; min-inline-size: 0; }
51
+ .a2ui-row { flex-direction: row; flex-wrap: wrap; }
52
+ .a2ui-column, .a2ui-list { flex-direction: column; }
53
+ .a2ui-list[data-direction="horizontal"] { flex-direction: row; overflow-x: auto; }
54
+ [data-justify="center"] { justify-content: center; }
55
+ [data-justify="end"] { justify-content: flex-end; }
56
+ [data-justify="spaceBetween"] { justify-content: space-between; }
57
+ [data-justify="spaceAround"] { justify-content: space-around; }
58
+ [data-justify="spaceEvenly"] { justify-content: space-evenly; }
59
+ [data-justify="stretch"] { justify-content: stretch; }
60
+ [data-align="start"] { align-items: flex-start; }
61
+ [data-align="center"] { align-items: center; }
62
+ [data-align="end"] { align-items: flex-end; }
63
+ [data-align="stretch"] { align-items: stretch; }
64
+ .a2ui-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--_border); border-radius: var(--_radius-sm); background: var(--_bg); }
65
+ .a2ui-title { margin: 0; line-height: 1.3; }
66
+ h1.a2ui-title { font-size: 1.4em; } h2.a2ui-title { font-size: 1.25em; } h3.a2ui-title { font-size: 1.1em; }
67
+ h4.a2ui-title, h5.a2ui-title { font-size: 1em; }
68
+ .a2ui-caption { color: var(--_muted); font-size: 0.85em; }
69
+ .a2ui-icon { display: inline-flex; }
70
+ .a2ui-icon svg { inline-size: 24px; block-size: 24px; }
71
+ .a2ui-button .a2ui-icon svg { inline-size: 18px; block-size: 18px; }
72
+ .a2ui-divider { inline-size: 100%; margin: 4px 0; border: 0; border-block-start: 1px solid var(--_border); }
73
+ .a2ui-divider.vertical { inline-size: 1px; align-self: stretch; margin: 0; border: 0; background: var(--_border); }
74
+ .a2ui-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-block-size: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--_radius-sm); font-weight: 600; }
75
+ .a2ui-button[data-variant="primary"] { background: var(--_accent); color: var(--_on-accent); }
76
+ .a2ui-button[data-variant="primary"]:not(:disabled):hover { background: var(--_accent-hover); }
77
+ .a2ui-button[data-variant="default"] { background: var(--_accent-soft); color: var(--_accent-fg); }
78
+ .a2ui-button[data-variant="borderless"] { color: var(--_accent-fg); }
79
+ .a2ui-button[data-variant="borderless"]:not(:disabled):hover { background: var(--_raised); }
80
+ .a2ui-button .markdown p, .a2ui-button .a2ui-text { margin: 0; }
81
+ .a2ui-field, .a2ui-field-wrapper { display: flex; flex-direction: column; gap: 4px; min-inline-size: 0; }
82
+ .a2ui-label { font-weight: 600; font-size: 0.9em; padding: 0; }
83
+ .a2ui-input { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid var(--_border); border-radius: var(--_radius-sm); background: var(--_bg); }
84
+ textarea.a2ui-input { min-block-size: 5em; resize: vertical; }
85
+ .a2ui-input:focus-visible, .a2ui-range:focus-visible, .a2ui-check input:focus-visible, .a2ui-chip:focus-visible, .a2ui-button:focus-visible, .a2ui-tab:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }
86
+ .a2ui-input[aria-invalid="true"] { border-color: var(--_danger); }
87
+ .a2ui-error { margin: 0; color: var(--_danger); font-size: 0.85em; }
88
+ .a2ui-check { display: inline-flex; align-items: center; gap: 8px; }
89
+ .a2ui-check input { accent-color: var(--_accent); margin: 0; }
90
+ .a2ui-range { accent-color: var(--_accent); }
91
+ .a2ui-choices { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
92
+ .a2ui-options { display: flex; flex-direction: column; gap: 6px; }
93
+ .a2ui-options[data-style="chips"] { flex-direction: row; flex-wrap: wrap; gap: 8px; }
94
+ .a2ui-chip { padding: 4px 12px; border: 1px solid var(--_border); border-radius: 999px; }
95
+ .a2ui-chip[aria-pressed="true"] { background: var(--_accent-soft); border-color: var(--_accent); color: var(--_accent-fg); }
96
+ .a2ui-tabs { display: flex; flex-direction: column; gap: 12px; }
97
+ .a2ui-tablist { display: flex; gap: 4px; border-block-end: 1px solid var(--_border); }
98
+ .a2ui-tab { padding: 6px 12px; border-block-end: 2px solid transparent; color: var(--_muted); }
99
+ .a2ui-tab[aria-selected="true"] { color: var(--_fg); border-block-end-color: var(--_accent); }
100
+ .a2ui-modal-trigger { display: contents; }
101
+ .a2ui-dialog { max-inline-size: min(560px, 90vw); padding: 20px; border: 1px solid var(--_border); border-radius: var(--_radius); background: var(--_bg); color: var(--_fg); }
102
+ .a2ui-dialog::backdrop { background: rgb(0 0 0 / 0.3); }
103
+ .a2ui-dialog-body { display: flex; flex-direction: column; gap: 8px; margin-block: 12px; }
104
+ .a2ui-dialog-footer { display: flex; justify-content: flex-end; }
105
+ .a2ui-sent { margin: 0; color: var(--_accent-fg); font-size: 0.85em; font-weight: 600; }
106
+ .a2ui-refused { margin: 0 0 4px; color: var(--_danger); font-size: 0.85em; font-weight: 600; }
107
+ .a2ui-placeholder { display: flex; flex-direction: column; gap: 8px; }
108
+ .a2ui-placeholder span { block-size: 12px; border-radius: 4px; background: var(--_raised); }
109
+ .a2ui-placeholder span:nth-child(1) { inline-size: 40%; }
110
+ .a2ui-placeholder span:nth-child(2) { block-size: 48px; }
111
+ .a2ui-placeholder span:nth-child(3) { inline-size: 30%; }
112
+ .a2ui-placeholder p { margin: 0; color: var(--_muted); font-size: 0.85em; }
113
+ `,gh;function _h(e){if(gh===void 0)try{gh=new CSSStyleSheet,gh.replaceSync(hh)}catch{gh=null}gh&&e.root!==document&&s(e.root,gh)}var vh=0;function yh(e){let t=document.createElement(`div`);t.className=`a2ui a2ui-placeholder`,t.setAttribute(`role`,`status`),t.append(document.createElement(`span`),document.createElement(`span`),document.createElement(`span`));let n=document.createElement(`p`);return n.textContent=e.strings.a2uiPreparing,t.append(n),t}function bh(e){let t=document.createElement(`pre`),n=document.createElement(`code`);return n.className=`language-a2ui`,n.textContent=`${e}\n`,t.append(n),t}function xh(e,t,n){let r=document.createElement(`div`),i=document.createElement(`p`);return i.className=`a2ui-refused`,i.setAttribute(`role`,`alert`),i.textContent=n.strings.a2uiRefused(t),r.append(i,bh(e)),r}function Sh(e,t){let n=o(e);if(!n)return t.live?yh(t):null;_h(t);let a=t.interface??{working:t.live,sent:/* @__PURE__ */ new Map},s=!1,d=i(n),f=()=>s||d.some(e=>a.sent.has(e)),p=()=>f()||a.working||!a.send,m=new Il([rh],e=>{let t=a.send;!p()&&t&&t(u({name:e.name,surfaceId:e.surfaceId,sourceComponentId:e.sourceComponentId,timestamp:e.timestamp,context:e.context}))&&(s=!0,S())}),h;try{h=m.processMessagesWithErrors(sh(ph(ah(n))))}catch(e){h=[e]}if(h.length>0)return m.dispose(),xh(e,mh(h[0],t.strings.a2uiInvalid),t);let g=d.flatMap(e=>{let t=a.sent.get(e);return t?l(n,t):[]});if(g.length>0)try{m.processMessagesWithErrors(g)}catch{}let _=document.createElement(`div`);_.className=`a2ui`;let v=/* @__PURE__ */ new Map,y=(e,t)=>{e.disabled=p()||t()},b=[];for(let e of m.model.surfacesMap.values()){let n=Ch(e,t,{control(e,t=()=>!1){v.set(e,t),y(e,t)},refresh(e){let t=v.get(e);t&&y(e,t)}}).mount(e.rootId,`/`),r=document.createElement(`div`);r.className=`a2ui-surface`,r.append(n.el),_.append(r),b.push(n)}let x=document.createElement(`p`);x.className=`a2ui-sent`,x.textContent=t.strings.a2uiSent,_.append(x);function S(){_.toggleAttribute(`data-disabled`,p()),x.hidden=!f();for(let[e,t]of v)_.contains(e)?y(e,t):v.delete(e)}return S(),c.set(_,e=>{a=e,S()}),r.set(_,()=>{for(let e of b)e.dispose();m.dispose(),c.delete(_)}),_}function Ch(e,t,n){let r={env:t,strings:t.strings,...n,uid:()=>`a2ui-${++vh}`,mount(t,n){let i=e.componentsModel.get(t),a=i&&rh.components.get(i.type),o=i&&eh[i.type];if(!i||!a||!o){let e=document.createElement(`span`);return e.hidden=!0,{el:e,dispose:()=>void 0}}let s=new Bl(e,t,n),c=new tu(s,a.schema),l=o(r,s.dataContext.path);l.update(c.snapshot);let u=c.subscribe(e=>l.update(e));return{el:l.el,dispose(){u.unsubscribe(),c.dispose(),l.dispose?.()}}}};return r}export{Sh as draw};