@coopcli/specsketch 2026.826.3 → 2026.902.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +967 -1560
- package/dist/client/assets/abnfDiagram-VCTEODGH-BRSPbDe2.js +1 -0
- package/dist/client/assets/arc-CydpUA4x.js +1 -0
- package/dist/client/assets/architecture-7GRP2DOG-DN-gDuKL.js +1 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-BnAWQ9BF.js +36 -0
- package/dist/client/assets/array-BifhSqXX.js +1 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-BLfEm7nQ.js +129 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BiGdyDb3.js +38 -0
- package/dist/client/assets/channel-CViH2Cbt.js +1 -0
- package/dist/client/assets/chunk-2E4U76K2-B7jDhluq.js +2 -0
- package/dist/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/client/assets/chunk-4HAMMTFA-CeU3f92U.js +62 -0
- package/dist/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/client/assets/chunk-75Z2AOVW-4JCVdQWY.js +2 -0
- package/dist/client/assets/chunk-CLGD4ZFX-BOVbR6kW.js +1 -0
- package/dist/client/assets/chunk-DU6HZSFF-CIXLDUI_.js +127 -0
- package/dist/client/assets/chunk-F27PBJKO-B5GmXBLb.js +1 -0
- package/dist/client/assets/chunk-FOHPRMQF-CyTuVbu3.js +161 -0
- package/dist/client/assets/chunk-GMAD6QVW-D6jp_rLd.js +72 -0
- package/dist/client/assets/chunk-GVQU2GXP-BSS01C8s.js +1 -0
- package/dist/client/assets/chunk-IMKFNOWR-RYwZN0Xs.js +231 -0
- package/dist/client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/client/assets/chunk-L3NEJ4N5-D0rNlikd.js +1 -0
- package/dist/client/assets/chunk-LNGE3PJU-DNNNwF8Y.js +34 -0
- package/dist/client/assets/chunk-OSK3NFVY-CxtLTZDw.js +10 -0
- package/dist/client/assets/chunk-P2QGCYS3-CYiUdWzq.js +1 -0
- package/dist/client/assets/chunk-POPQ4Y6H-DgkPLssL.js +1 -0
- package/dist/client/assets/chunk-PWAF6VOD-Db4-4OsA.js +1 -0
- package/dist/client/assets/chunk-SHT3W25Y-Ji-xYakZ.js +168 -0
- package/dist/client/assets/chunk-SVP7TREG-cmFzvno3.js +88 -0
- package/dist/client/assets/chunk-TICWLB2K-Cx1Qs9wQ.js +206 -0
- package/dist/client/assets/chunk-TLUHSLCS-BLXY086M.js +2 -0
- package/dist/client/assets/chunk-XXDRQBXY--jdiETSF.js +1 -0
- package/dist/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-BFPBK_Z1.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BFPBK_Z1.js +1 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-Ba6yLkVt.js +1 -0
- package/dist/client/assets/cynefin-OW5HDTMX-ra_KnFP6.js +1 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Ct-LNR_1.js +62 -0
- package/dist/client/assets/cytoscape.esm-B3I8pqwA.js +321 -0
- package/dist/client/assets/dagre-BJJUWK_n.js +1 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DJi473sw.js +4 -0
- package/dist/client/assets/defaultLocale-C8Fc0cco.js +1 -0
- package/dist/client/assets/diagram-S7CK7UJ4-kMRGU2Fv.js +30 -0
- package/dist/client/assets/diagram-UQ7AKVKN-YvBZDAJN.js +41 -0
- package/dist/client/assets/diagram-VSXAHHWV-DDK4yWa2.js +3 -0
- package/dist/client/assets/diagram-VX7I27RA-DGg18jEl.js +24 -0
- package/dist/client/assets/diagram-Z3DM3KII-i5D_IxwV.js +24 -0
- package/dist/client/assets/dist-fh2zfMMY.js +1 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-lD2h9EBl.js +1 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-xW2abP7i.js +99 -0
- package/dist/client/assets/eventmodeling-NTZA5JFV-DNmj4472.js +1 -0
- package/dist/client/assets/flowDiagram-HODETNUW-Df4CErRm.js +1 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BeymYKLD.js +292 -0
- package/dist/client/assets/gitGraph-4MIJSDKK-BEWLgvm2.js +1 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BUDPc-8k.js +106 -0
- package/dist/client/assets/graphlib-B8gBHxth.js +1 -0
- package/dist/client/assets/index-5LnLmZOs.css +1 -0
- package/dist/client/assets/index-BWHy8TXM.js +1549 -0
- package/dist/client/assets/info-A6RAGUB7-CKfM1Jkg.js +1 -0
- package/dist/client/assets/infoDiagram-27XIBGKW-Ad-Gyaye.js +2 -0
- package/dist/client/assets/init-D6jRqBbL.js +1 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-KbTiiaHC.js +70 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CN2MkzPK.js +139 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-DhEzOLN4.js +89 -0
- package/dist/client/assets/katex-CddkPoXu.js +257 -0
- package/dist/client/assets/line-B90f4k6X.js +1 -0
- package/dist/client/assets/linear-CW7Oi12O.js +1 -0
- package/dist/client/assets/mermaid-parser.core-C9nLZzv4.js +7 -0
- package/dist/client/assets/mermaid.core-DQoThCaK.js +11 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-J048QoEO.js +96 -0
- package/dist/client/assets/ordinal-hYBb2elL.js +1 -0
- package/dist/client/assets/packet-AYTQ26CC-BKj_BZVA.js +1 -0
- package/dist/client/assets/path-BWPyau1x.js +1 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-DG0kAfWm.js +1 -0
- package/dist/client/assets/pie-WAS4IAKB-DE_LVWU7.js +1 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-Z3FhwRXc.js +39 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dw3TFUlr.js +7 -0
- package/dist/client/assets/radar-RG4KPBEZ-BtwXXEfu.js +1 -0
- package/dist/client/assets/railroad-74A4TZTK-CBKff9R-.js +1 -0
- package/dist/client/assets/railroad-abnf-HS5TGJTU-Bv7gdzGQ.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-CCPDJ5pu.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-PBEP962D.js +1 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Cf_GxnJ6.js +1 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-DeSfKgO1.js +84 -0
- package/dist/client/assets/rough.esm-CSKSodPl.js +1 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-ZJbsUmhM.js +40 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CZV-uNwY.js +162 -0
- package/dist/client/assets/sizeCapture-INFHLROL-B0uUizjq.js +1 -0
- package/dist/client/assets/src-CKIr8zwz.js +1 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-S2gUXjCW.js +1 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BEJXWTYJ.js +1 -0
- package/dist/client/assets/swimlanes-42K2YHIH-D9K5izOo.js +1 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-ze5UMZmc.js +8 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-o1QNGpc1.js +120 -0
- package/dist/client/assets/treeView-Q6P3EWNA-shNxWNdU.js +1 -0
- package/dist/client/assets/treemap-WGGIJYW6-CTnOzBS1.js +1 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-C74kYmI6.js +34 -0
- package/dist/client/assets/wardley-WFR3VGLG-wa25fBU8.js +1 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DMCFZZJI.js +78 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-CZzaBxU9.js +7 -0
- package/dist/client/index.html +2 -2
- package/package.json +78 -87
- package/dist/client/assets/MarkdownEditorImpl-B7fANsTl.js +0 -16
- package/dist/client/assets/index-CLLS_dcT.css +0 -1
- package/dist/client/assets/index-DzRQXC_d.js +0 -197
|
@@ -0,0 +1,1549 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DQoThCaK.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-CKIr8zwz.js","assets/chunk-DU6HZSFF-CIXLDUI_.js","assets/chunk-75Z2AOVW-4JCVdQWY.js","assets/dist-fh2zfMMY.js","assets/chunk-CLGD4ZFX-BOVbR6kW.js","assets/chunk-PWAF6VOD-Db4-4OsA.js","assets/chunk-GMAD6QVW-D6jp_rLd.js","assets/chunk-P2QGCYS3-CYiUdWzq.js","assets/chunk-4HAMMTFA-CeU3f92U.js","assets/rough.esm-CSKSodPl.js","assets/chunk-GVQU2GXP-BSS01C8s.js","assets/chunk-OSK3NFVY-CxtLTZDw.js","assets/line-B90f4k6X.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-L3NEJ4N5-D0rNlikd.js","assets/chunk-TLUHSLCS-BLXY086M.js","assets/chunk-2E4U76K2-B7jDhluq.js","assets/graphlib-B8gBHxth.js","assets/chunk-LNGE3PJU-DNNNwF8Y.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var S={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function re(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ie(e,t){return re(e.type,t,e.props)}function ae(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function oe(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var se=/\/+/g;function ce(e,t){return typeof e==`object`&&e&&e.key!=null?oe(``+e.key):t.toString(36)}function le(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ue(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ue(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ce(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(se,`$&/`)+`/`),ue(o,r,i,``,function(e){return e})):o!=null&&(ae(o)&&(o=ie(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(se,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ce(a,u),c+=ue(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ce(a,u++),c+=ue(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ue(le(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function C(e,t,n){if(e==null)return e;var r=[],i=0;return ue(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function de(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var w=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},T={map:C,forEach:function(e,t,n){C(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return C(e,function(){t++}),t},toArray:function(e){return C(e,function(e){return e})||[]},only:function(e){if(!ae(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=T,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ne.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return re(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ne.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return re(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ae,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:de}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),i=S.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,w)}catch(e){w(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),S.T=t}},e.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},e.use=function(e){return S.H.use(e)},e.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},e.useCallback=function(e,t){return S.H.useCallback(e,t)},e.useContext=function(e){return S.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return S.H.useEffect(e,t)},e.useEffectEvent=function(e){return S.H.useEffectEvent(e)},e.useId=function(){return S.H.useId()},e.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return S.H.useMemo(e,t)},e.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},e.useRef=function(e){return S.H.useRef(e)},e.useState=function(e){return S.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return S.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}var ee=!1,te=-1,S=5,ne=-1;function re(){return g?!0:!(e.unstable_now()-ne<S)}function ie(){if(g=!1,ee){var t=e.unstable_now();ne=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):S=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),ne=Symbol.for(`react.suspense`),re=Symbol.for(`react.suspense_list`),ie=Symbol.for(`react.memo`),ae=Symbol.for(`react.lazy`),oe=Symbol.for(`react.activity`),se=Symbol.for(`react.memo_cache_sentinel`),ce=Symbol.iterator;function le(e){return typeof e!=`object`||!e?null:(e=ce&&e[ce]||e[`@@iterator`],typeof e==`function`?e:null)}var ue=Symbol.for(`react.client.reference`);function C(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case ne:return`Suspense`;case re:return`SuspenseList`;case oe:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ie:return t=e.displayName||null,t===null?C(e.type)||`Memo`:t;case ae:t=e._payload,e=e._init;try{return C(e(t))}catch{}}return null}var de=Array.isArray,w=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},pe=[],me=-1;function he(e){return{current:e}}function ge(e){0>me||(e.current=pe[me],pe[me]=null,me--)}function E(e,t){me++,pe[me]=e.current,e.current=t}var _e=he(null),ve=he(null),ye=he(null),be=he(null);function xe(e,t){switch(E(ye,t),E(ve,e),E(_e,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ge(_e),E(_e,e)}function Se(){ge(_e),ge(ve),ge(ye)}function Ce(e){e.memoizedState!==null&&E(be,e);var t=_e.current,n=Kd(t,e.type);t!==n&&(E(ve,e),E(_e,n))}function we(e){ve.current===e&&(ge(_e),ge(ve)),be.current===e&&(ge(be),$f._currentValue=fe)}var Te,Ee;function De(e){if(Te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Te=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+Te+e+Ee}var Oe=!1;function ke(e,t){if(!e||Oe)return``;Oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Oe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?De(n):``}function Ae(e,t){switch(e.tag){case 26:case 27:case 5:return De(e.type);case 16:return De(`Lazy`);case 13:return e.child!==t&&t!==null?De(`Suspense Fallback`):De(`Suspense`);case 19:return De(`SuspenseList`);case 0:case 15:return ke(e.type,!1);case 11:return ke(e.type.render,!1);case 1:return ke(e.type,!0);case 31:return De(`Activity`);default:return``}}function je(e){try{var t=``,n=null;do t+=Ae(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var Me=Object.prototype.hasOwnProperty,Ne=t.unstable_scheduleCallback,D=t.unstable_cancelCallback,Pe=t.unstable_shouldYield,Fe=t.unstable_requestPaint,Ie=t.unstable_now,Le=t.unstable_getCurrentPriorityLevel,Re=t.unstable_ImmediatePriority,ze=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,Ve=t.unstable_LowPriority,He=t.unstable_IdlePriority,Ue=t.log,We=t.unstable_setDisableYieldValue,Ge=null,Ke=null;function qe(e){if(typeof Ue==`function`&&We(e),Ke&&typeof Ke.setStrictMode==`function`)try{Ke.setStrictMode(Ge,e)}catch{}}var Je=Math.clz32?Math.clz32:Ze,Ye=Math.log,Xe=Math.LN2;function Ze(e){return e>>>=0,e===0?32:31-(Ye(e)/Xe|0)|0}var Qe=256,$e=262144,et=4194304;function tt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function nt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=tt(n))):i=tt(o):i=tt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=tt(n))):i=tt(o)):i=tt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function rt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function it(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=et;return et<<=1,!(et&62914560)&&(et=4194304),e}function ot(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function st(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ct(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&<(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function lt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ut(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function dt(e,t){var n=t&-t;return n=n&42?1:ft(n),(n&(e.suspendedLanes|t))===0?n:0}function ft(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function pt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function mt(){var e=T.p;return e===0?(e=window.event,e===void 0?32:hp(e.type)):e}function ht(e,t){var n=T.p;try{return T.p=e,t()}finally{T.p=n}}var gt=Math.random().toString(36).slice(2),_t=`__reactFiber$`+gt,vt=`__reactProps$`+gt,yt=`__reactContainer$`+gt,bt=`__reactEvents$`+gt,xt=`__reactListeners$`+gt,St=`__reactHandles$`+gt,Ct=`__reactResources$`+gt,wt=`__reactMarker$`+gt;function Tt(e){delete e[_t],delete e[vt],delete e[bt],delete e[xt],delete e[St]}function Et(e){var t=e[_t];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[_t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[_t])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function Dt(e){if(e=e[_t]||e[yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ot(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function kt(e){var t=e[Ct];return t||=e[Ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function At(e){e[wt]=!0}var jt=new Set,Mt={};function Nt(e,t){Pt(e,t),Pt(e+`Capture`,t)}function Pt(e,t){for(Mt[e]=t,e=0;e<t.length;e++)jt.add(t[e])}var Ft=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),It={},Lt={};function Rt(e){return Me.call(Lt,e)?!0:Me.call(It,e)?!1:Ft.test(e)?Lt[e]=!0:(It[e]=!0,!1)}function zt(e,t,n){if(Rt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Bt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Vt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ht(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ut(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Wt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gt(e){if(!e._valueTracker){var t=Ut(e)?`checked`:`value`;e._valueTracker=Wt(e,t,``+e[t])}}function Kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ut(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function qt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Jt=/[\n"\\]/g;function Yt(e){return e.replace(Jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Xt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ht(t)):e.value!==``+Ht(t)&&(e.value=``+Ht(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Qt(e,o,Ht(n)):Qt(e,o,Ht(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ht(s):e.removeAttribute(`name`)}function Zt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Gt(e);return}n=n==null?``:``+Ht(n),t=t==null?n:``+Ht(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Gt(e)}function Qt(e,t,n){t===`number`&&qt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function $t(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Ht(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function en(e,t,n){if(t!=null&&(t=``+Ht(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ht(n)}function tn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(de(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ht(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Gt(e)}function nn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var rn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function an(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||rn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function on(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&an(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&an(e,o,t[o])}function sn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var cn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),ln=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function un(e){return ln.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function dn(){}var fn=null;function pn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mn=null,hn=null;function gn(e){var t=Dt(e);if(t&&(e=t.stateNode)){var n=e[vt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Xt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Yt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[vt]||null;if(!a)throw Error(i(90));Xt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Kt(r)}break a;case`textarea`:en(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&$t(e,!!n.multiple,t,!1)}}}var _n=!1;function vn(e,t,n){if(_n)return e(t,n);_n=!0;try{return e(t)}finally{if(_n=!1,(mn!==null||hn!==null)&&(Du(),mn&&(t=mn,e=hn,hn=mn=null,gn(t),e)))for(t=0;t<e.length;t++)gn(e[t])}}function yn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[vt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var bn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),xn=!1;if(bn)try{var Sn={};Object.defineProperty(Sn,"passive",{get:function(){xn=!0}}),window.addEventListener(`test`,Sn,Sn),window.removeEventListener(`test`,Sn,Sn)}catch{xn=!1}var Cn=null,wn=null,Tn=null;function En(){if(Tn)return Tn;var e,t=wn,n=t.length,r,i=`value`in Cn?Cn.value:Cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Tn=i.slice(e,1<r?1-r:void 0)}function Dn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function On(){return!0}function kn(){return!1}function An(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?On:kn,this.isPropagationStopped=kn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=On)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=On)},persist:function(){},isPersistent:On}),t}var jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mn=An(jn),Nn=h({},jn,{view:0,detail:0}),Pn=An(Nn),Fn,In,Ln,Rn=h({},Nn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Ln&&(Ln&&e.type===`mousemove`?(Fn=e.screenX-Ln.screenX,In=e.screenY-Ln.screenY):In=Fn=0,Ln=e),Fn)},movementY:function(e){return`movementY`in e?e.movementY:In}}),zn=An(Rn),Bn=An(h({},Rn,{dataTransfer:0})),Vn=An(h({},Nn,{relatedTarget:0})),Hn=An(h({},jn,{animationName:0,elapsedTime:0,pseudoElement:0})),Un=An(h({},jn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Wn=An(h({},jn,{data:0})),Gn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Kn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},qn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qn[e])?!!t[e]:!1}function Yn(){return Jn}var Xn=An(h({},Nn,{key:function(e){if(e.key){var t=Gn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Dn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yn,charCode:function(e){return e.type===`keypress`?Dn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Dn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Zn=An(h({},Rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Qn=An(h({},Nn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yn})),$n=An(h({},jn,{propertyName:0,elapsedTime:0,pseudoElement:0})),er=An(h({},Rn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),tr=An(h({},jn,{newState:0,oldState:0})),nr=[9,13,27,32],rr=bn&&`CompositionEvent`in window,ir=null;bn&&`documentMode`in document&&(ir=document.documentMode);var ar=bn&&`TextEvent`in window&&!ir,or=bn&&(!rr||ir&&8<ir&&11>=ir),sr=` `,cr=!1;function lr(e,t){switch(e){case`keyup`:return nr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ur(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var dr=!1;function fr(e,t){switch(e){case`compositionend`:return ur(t);case`keypress`:return t.which===32?(cr=!0,sr):null;case`textInput`:return e=t.data,e===sr&&cr?null:e;default:return null}}function pr(e,t){if(dr)return e===`compositionend`||!rr&&lr(e,t)?(e=En(),Tn=wn=Cn=null,dr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return or&&t.locale!==`ko`?null:t.data;default:return null}}var mr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!mr[e.type]:t===`textarea`}function gr(e,t,n,r){mn?hn?hn.push(r):hn=[r]:mn=r,t=jd(t,`onChange`),0<t.length&&(n=new Mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var _r=null,vr=null;function yr(e){Td(e,0)}function br(e){if(Kt(Ot(e)))return e}function xr(e,t){if(e===`change`)return t}var Sr=!1;if(bn){var Cr;if(bn){var wr=`oninput`in document;if(!wr){var Tr=document.createElement(`div`);Tr.setAttribute(`oninput`,`return;`),wr=typeof Tr.oninput==`function`}Cr=wr}else Cr=!1;Sr=Cr&&(!document.documentMode||9<document.documentMode)}function Er(){_r&&(_r.detachEvent(`onpropertychange`,Dr),vr=_r=null)}function Dr(e){if(e.propertyName===`value`&&br(vr)){var t=[];gr(t,vr,e,pn(e)),vn(yr,t)}}function Or(e,t,n){e===`focusin`?(Er(),_r=t,vr=n,_r.attachEvent(`onpropertychange`,Dr)):e===`focusout`&&Er()}function kr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return br(vr)}function Ar(e,t){if(e===`click`)return br(t)}function jr(e,t){if(e===`input`||e===`change`)return br(t)}function Mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Nr=typeof Object.is==`function`?Object.is:Mr;function Pr(e,t){if(Nr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Me.call(t,i)||!Nr(e[i],t[i]))return!1}return!0}function Fr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ir(e,t){var n=Fr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Fr(n)}}function Lr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Rr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=qt(e.document)}return t}function zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Br=bn&&`documentMode`in document&&11>=document.documentMode,Vr=null,Hr=null,Ur=null,Wr=!1;function Gr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wr||Vr==null||Vr!==qt(r)||(r=Vr,`selectionStart`in r&&zr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ur&&Pr(Ur,r)||(Ur=r,r=jd(Hr,`onSelect`),0<r.length&&(t=new Mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Vr)))}function Kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var qr={animationend:Kr(`Animation`,`AnimationEnd`),animationiteration:Kr(`Animation`,`AnimationIteration`),animationstart:Kr(`Animation`,`AnimationStart`),transitionrun:Kr(`Transition`,`TransitionRun`),transitionstart:Kr(`Transition`,`TransitionStart`),transitioncancel:Kr(`Transition`,`TransitionCancel`),transitionend:Kr(`Transition`,`TransitionEnd`)},Jr={},Yr={};bn&&(Yr=document.createElement(`div`).style,`AnimationEvent`in window||(delete qr.animationend.animation,delete qr.animationiteration.animation,delete qr.animationstart.animation),`TransitionEvent`in window||delete qr.transitionend.transition);function Xr(e){if(Jr[e])return Jr[e];if(!qr[e])return e;var t=qr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Yr)return Jr[e]=t[n];return e}var Zr=Xr(`animationend`),Qr=Xr(`animationiteration`),$r=Xr(`animationstart`),ei=Xr(`transitionrun`),ti=Xr(`transitionstart`),ni=Xr(`transitioncancel`),ri=Xr(`transitionend`),ii=new Map,ai=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);ai.push(`scrollEnd`);function oi(e,t){ii.set(e,t),Nt(t,[e])}var si=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ci=[],li=0,ui=0;function di(){for(var e=li,t=ui=li=0;t<e;){var n=ci[t];ci[t++]=null;var r=ci[t];ci[t++]=null;var i=ci[t];ci[t++]=null;var a=ci[t];if(ci[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&hi(n,i,a)}}function fi(e,t,n,r){ci[li++]=e,ci[li++]=t,ci[li++]=n,ci[li++]=r,ui|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function pi(e,t,n,r){return fi(e,t,n,r),gi(e)}function mi(e,t){return fi(e,null,null,t),gi(e)}function hi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function gi(e){if(50<vu)throw vu=0,yu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var _i={};function vi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(e,t,n,r){return new vi(e,t,n,r)}function bi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xi(e,t){var n=e.alternate;return n===null?(n=yi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Si(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ci(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)bi(e)&&(s=1);else if(typeof e==`string`)s=Q(e,n,_e.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case oe:return e=yi(31,n,t,a),e.elementType=oe,e.lanes=o,e;case y:return wi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=yi(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case ne:return e=yi(13,n,t,a),e.elementType=ne,e.lanes=o,e;case re:return e=yi(19,n,t,a),e.elementType=re,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case te:s=10;break a;case ee:s=9;break a;case S:s=11;break a;case ie:s=14;break a;case ae:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=yi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function wi(e,t,n,r){return e=yi(7,e,r,t),e.lanes=n,e}function Ti(e,t,n){return e=yi(6,e,null,t),e.lanes=n,e}function Ei(e){var t=yi(18,null,null,0);return t.stateNode=e,t}function Di(e,t,n){return t=yi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Oi=new WeakMap;function ki(e,t){if(typeof e==`object`&&e){var n=Oi.get(e);return n===void 0?(t={value:e,source:t,stack:je(t)},Oi.set(e,t),t):n}return{value:e,source:t,stack:je(t)}}var Ai=[],ji=0,Mi=null,Ni=0,Pi=[],Fi=0,Ii=null,Li=1,Ri=``;function zi(e,t){Ai[ji++]=Ni,Ai[ji++]=Mi,Mi=e,Ni=t}function Bi(e,t,n){Pi[Fi++]=Li,Pi[Fi++]=Ri,Pi[Fi++]=Ii,Ii=e;var r=Li;e=Ri;var i=32-Je(r)-1;r&=~(1<<i),n+=1;var a=32-Je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Li=1<<32-Je(t)+i|n<<i|r,Ri=a+e}else Li=1<<a|n<<i|r,Ri=e}function Vi(e){e.return!==null&&(zi(e,1),Bi(e,1,0))}function Hi(e){for(;e===Mi;)Mi=Ai[--ji],Ai[ji]=null,Ni=Ai[--ji],Ai[ji]=null;for(;e===Ii;)Ii=Pi[--Fi],Pi[Fi]=null,Ri=Pi[--Fi],Pi[Fi]=null,Li=Pi[--Fi],Pi[Fi]=null}function Ui(e,t){Pi[Fi++]=Li,Pi[Fi++]=Ri,Pi[Fi++]=Ii,Li=t.id,Ri=t.overflow,Ii=e}var Wi=null,Gi=null,O=!1,Ki=null,qi=!1,Ji=Error(i(519));function Yi(e){throw ta(ki(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ji}function Xi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[_t]=e,t[vt]=r,n){case`dialog`:K(`cancel`,t),K(`close`,t);break;case`iframe`:case`object`:case`embed`:K(`load`,t);break;case`video`:case`audio`:for(n=0;n<Cd.length;n++)K(Cd[n],t);break;case`source`:K(`error`,t);break;case`img`:case`image`:case`link`:K(`error`,t),K(`load`,t);break;case`details`:K(`toggle`,t);break;case`input`:K(`invalid`,t),Zt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:K(`invalid`,t);break;case`textarea`:K(`invalid`,t),tn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Id(t.textContent,n)?(r.popover!=null&&(K(`beforetoggle`,t),K(`toggle`,t)),r.onScroll!=null&&K(`scroll`,t),r.onScrollEnd!=null&&K(`scrollend`,t),r.onClick!=null&&(t.onclick=dn),t=!0):t=!1,t||Yi(e,!0)}function Zi(e){for(Wi=e.return;Wi;)switch(Wi.tag){case 5:case 31:case 13:qi=!1;return;case 27:case 3:qi=!0;return;default:Wi=Wi.return}}function Qi(e){if(e!==Wi)return!1;if(!O)return Zi(e),O=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Gi&&Yi(e),Zi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Gi=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Gi=mf(e)}else t===27?(t=Gi,tf(e.type)?(e=pf,pf=null,Gi=e):Gi=t):Gi=Wi?ff(e.stateNode.nextSibling):null;return!0}function $i(){Gi=Wi=null,O=!1}function ea(){var e=Ki;return e!==null&&(au===null?au=e:au.push.apply(au,e),Ki=null),e}function ta(e){Ki===null?Ki=[e]:Ki.push(e)}var na=he(null),ra=null,ia=null;function aa(e,t,n){E(na,t._currentValue),t._currentValue=n}function oa(e){e._currentValue=na.current,ge(na)}function sa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ca(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),sa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),sa(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function la(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Nr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===be.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[$f]:e.push($f))}a=a.return}e!==null&&ca(t,e,n,r),t.flags|=262144}function ua(e){for(e=e.firstContext;e!==null;){if(!Nr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function da(e){ra=e,ia=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function fa(e){return ma(ra,e)}function pa(e,t){return ra===null&&da(e),ma(e,t)}function ma(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ia===null){if(e===null)throw Error(i(308));ia=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ia=ia.next=t;return n}var ha=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ga=t.unstable_scheduleCallback,_a=t.unstable_NormalPriority,va={$$typeof:te,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ya(){return{controller:new ha,data:new Map,refCount:0}}function ba(e){e.refCount--,e.refCount===0&&ga(_a,function(){e.controller.abort()})}var xa=null,Sa=0,Ca=0,wa=null;function Ta(e,t){if(xa===null){var n=xa=[];Sa=0,Ca=_d(),wa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Sa++,t.then(Ea,Ea),t}function Ea(){if(--Sa===0&&xa!==null){wa!==null&&(wa.status=`fulfilled`);var e=xa;xa=null,Ca=0,wa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Da(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Oa=w.S;w.S=function(e,t){cu=Ie(),typeof t==`object`&&t&&typeof t.then==`function`&&Ta(e,t),Oa!==null&&Oa(e,t)};var ka=he(null);function Aa(){var e=ka.current;return e===null?R.pooledCache:e}function ja(e,t){t===null?E(ka,ka.current):E(ka,t.pool)}function Ma(){var e=Aa();return e===null?null:{parent:va._currentValue,pool:e}}var Na=Error(i(460)),Pa=Error(i(474)),Fa=Error(i(542)),Ia={then:function(){}};function La(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ra(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(dn,dn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ha(e),e;default:if(typeof t.status==`string`)t.then(dn,dn);else{if(e=R,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ha(e),e}throw Ba=t,Na}}function za(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ba=e,Na):e}}var Ba=null;function Va(){if(Ba===null)throw Error(i(459));var e=Ba;return Ba=null,e}function Ha(e){if(e===Na||e===Fa)throw Error(i(483))}var Ua=null,Wa=0;function Ga(e){var t=Wa;return Wa+=1,Ua===null&&(Ua=[]),Ra(Ua,e,t)}function Ka(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function qa(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ja(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=xi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ti(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ae&&za(i)===t.type)?(t=a(t,n.props),Ka(t,n),t.return=e,t):(t=Ci(n.type,n.key,n.props,null,e.mode,r),Ka(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Di(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=wi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ti(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=Ci(t.type,t.key,t.props,null,e.mode,n),Ka(n,t),n.return=e,n;case v:return t=Di(t,e.mode,n),t.return=e,t;case ae:return t=za(t),f(e,t,n)}if(de(t)||le(t))return t=wi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ga(t),n);if(t.$$typeof===te)return f(e,pa(e,t),n);qa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case ae:return n=za(n),p(e,t,n,r)}if(de(n)||le(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ga(n),r);if(n.$$typeof===te)return p(e,t,pa(e,n),r);qa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ae:return r=za(r),m(e,t,n,r,i)}if(de(r)||le(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ga(r),i);if(r.$$typeof===te)return m(e,t,n,pa(t,r),i);qa(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),O&&zi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return O&&zi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),O&&zi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),O&&zi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return O&&zi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),O&&zi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ae&&za(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ka(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=wi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=Ci(o.type,o.key,o.props,null,e.mode,c),Ka(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=Di(o,e.mode,c),c.return=e,e=c}return s(e);case ae:return o=za(o),b(e,r,o,c)}if(de(o))return h(e,r,o,c);if(le(o)){if(l=le(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ga(o),c);if(o.$$typeof===te)return b(e,r,pa(e,o),c);qa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ti(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Wa=0;var i=b(e,t,n,r);return Ua=null,i}catch(t){if(t===Na||t===Fa)throw t;var a=yi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ya=Ja(!0),Xa=Ja(!1),Za=!1;function Qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $a(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function eo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function to(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,L&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=gi(e),hi(e,null,n),t}return fi(e,r,t,n),gi(e)}function no(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}function ro(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var io=!1;function ao(){if(io){var e=wa;if(e!==null)throw e}}function oo(e,t,n,r){io=!1;var i=e.updateQueue;Za=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(B&f)===f:(r&f)===f){f!==0&&f===Ca&&(io=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Za=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),H|=o,e.lanes=o,e.memoizedState=d}}function so(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function co(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)so(n[e],t)}var lo=he(null),uo=he(0);function fo(e,t){e=$l,E(uo,e),E(lo,t),$l=e|t.baseLanes}function po(){E(uo,$l),E(lo,lo.current)}function mo(){$l=uo.current,ge(lo),ge(uo)}var ho=he(null),go=null;function _o(e){var t=e.alternate;E(So,So.current&1),E(ho,e),go===null&&(t===null||lo.current!==null||t.memoizedState!==null)&&(go=e)}function vo(e){E(So,So.current),E(ho,e),go===null&&(go=e)}function yo(e){e.tag===22?(E(So,So.current),E(ho,e),go===null&&(go=e)):bo(e)}function bo(){E(So,So.current),E(ho,ho.current)}function xo(e){ge(ho),go===e&&(go=null),ge(So)}var So=he(0);function Co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var wo=0,k=null,To=null,Eo=null,Do=!1,Oo=!1,ko=!1,Ao=0,jo=0,Mo=null,No=0;function Po(){throw Error(i(321))}function Fo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nr(e[n],t[n]))return!1;return!0}function Io(e,t,n,r,i,a){return wo=a,k=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,w.H=e===null||e.memoizedState===null?Ys:Xs,ko=!1,a=n(r,i),ko=!1,Oo&&(a=Ro(t,n,r,i)),Lo(e),a}function Lo(e){w.H=Js;var t=To!==null&&To.next!==null;if(wo=0,Eo=To=k=null,Do=!1,jo=0,Mo=null,t)throw Error(i(300));e===null||pc||(e=e.dependencies,e!==null&&ua(e)&&(pc=!0))}function Ro(e,t,n,r){k=e;var a=0;do{if(Oo&&(Mo=null),jo=0,Oo=!1,25<=a)throw Error(i(301));if(a+=1,Eo=To=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}w.H=Zs,o=t(n,r)}while(Oo);return o}function zo(){var e=w.H,t=e.useState()[0];return t=typeof t.then==`function`?Ko(t):t,e=e.useState()[0],(To===null?null:To.memoizedState)!==e&&(k.flags|=1024),t}function Bo(){var e=Ao!==0;return Ao=0,e}function Vo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ho(e){if(Do){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Do=!1}wo=0,Eo=To=k=null,Oo=!1,jo=Ao=0,Mo=null}function Uo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Eo===null?k.memoizedState=Eo=e:Eo=Eo.next=e,Eo}function Wo(){if(To===null){var e=k.alternate;e=e===null?null:e.memoizedState}else e=To.next;var t=Eo===null?k.memoizedState:Eo.next;if(t!==null)Eo=t,To=e;else{if(e===null)throw k.alternate===null?Error(i(467)):Error(i(310));To=e,e={memoizedState:To.memoizedState,baseState:To.baseState,baseQueue:To.baseQueue,queue:To.queue,next:null},Eo===null?k.memoizedState=Eo=e:Eo=Eo.next=e}return Eo}function Go(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ko(e){var t=jo;return jo+=1,Mo===null&&(Mo=[]),e=Ra(Mo,e,t),t=k,(Eo===null?t.memoizedState:Eo.next)===null&&(t=t.alternate,w.H=t===null||t.memoizedState===null?Ys:Xs),e}function qo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ko(e);if(e.$$typeof===te)return fa(e)}throw Error(i(438,String(e)))}function Jo(e){var t=null,n=k.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=k.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Go(),k.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=se;return t.index++,n}function Yo(e,t){return typeof t==`function`?t(e):t}function Xo(e){return Zo(Wo(),To,e)}function Zo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(wo&f)===f:(B&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ca&&(d=!0);else if((wo&p)===p){u=u.next,p===Ca&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,k.lanes|=p,H|=p;f=u.action,ko&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,k.lanes|=f,H|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Nr(o,e.memoizedState)&&(pc=!0,d&&(n=wa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Qo(e){var t=Wo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Nr(o,t.memoizedState)||(pc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function $o(e,t,n){var r=k,a=Wo(),o=O;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Nr((To||a).memoizedState,n);if(s&&(a.memoizedState=n,pc=!0),a=a.queue,bs(ns.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||Eo!==null&&Eo.memoizedState.tag&1){if(r.flags|=2048,hs(9,{destroy:void 0},ts.bind(null,r,a,n,t),null),R===null)throw Error(i(349));o||wo&127||es(r,t,n)}return n}function es(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=k.updateQueue,t===null?(t=Go(),k.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ts(e,t,n,r){t.value=n,t.getSnapshot=r,rs(t)&&is(e)}function ns(e,t,n){return n(function(){rs(t)&&is(e)})}function rs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nr(e,n)}catch{return!0}}function is(e){var t=mi(e,2);t!==null&&Su(t,e,2)}function as(e){var t=Uo();if(typeof e==`function`){var n=e;if(e=n(),ko){qe(!0);try{n()}finally{qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:e},t}function os(e,t,n,r){return e.baseState=n,Zo(e,To,typeof r==`function`?r:Yo)}function ss(e,t,n,r,a){if(Gs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};w.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,cs(t,o)):(o.next=n.next,t.pending=n.next=o)}}function cs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=w.T,o={};w.T=o;try{var s=n(i,r),c=w.S;c!==null&&c(o,s),ls(e,t,s)}catch(n){ds(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),w.T=a}}else try{a=n(i,r),ls(e,t,a)}catch(n){ds(e,t,n)}}function ls(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){us(e,t,n)},function(n){return ds(e,t,n)}):us(e,t,n)}function us(e,t,n){t.status=`fulfilled`,t.value=n,A(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,cs(e,n)))}function ds(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,A(t),t=t.next;while(t!==r)}e.action=null}function A(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function fs(e,t){return t}function ps(e,t){if(O){var n=R.formState;if(n!==null){a:{var r=k;if(O){if(Gi){b:{for(var i=Gi,a=qi;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Gi=ff(i.nextSibling),r=i.data===`F!`;break a}}Yi(r)}r=!1}r&&(t=n[0])}}return n=Uo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:t},n.queue=r,n=Hs.bind(null,k,r),r.dispatch=n,r=as(!1),a=Ws.bind(null,k,!1,r.queue),r=Uo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ss.bind(null,k,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function j(e){return ms(Wo(),To,e)}function ms(e,t,n){if(t=Zo(e,t,fs)[0],e=Xo(Yo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ko(t)}catch(e){throw e===Na?Fa:e}else r=t;t=Wo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(k.flags|=2048,hs(9,{destroy:void 0},M.bind(null,i,n),null)),[r,a,e]}function M(e,t){e.action=t}function N(e){var t=Wo(),n=To;if(n!==null)return ms(t,n,e);Wo(),t=t.memoizedState,n=Wo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function hs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=k.updateQueue,t===null&&(t=Go(),k.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function gs(){return Wo().memoizedState}function _s(e,t,n,r){var i=Uo();k.flags|=e,i.memoizedState=hs(1|t,{destroy:void 0},n,r===void 0?null:r)}function vs(e,t,n,r){var i=Wo();r=r===void 0?null:r;var a=i.memoizedState.inst;To!==null&&r!==null&&Fo(r,To.memoizedState.deps)?i.memoizedState=hs(t,a,n,r):(k.flags|=e,i.memoizedState=hs(1|t,a,n,r))}function ys(e,t){_s(8390656,8,e,t)}function bs(e,t){vs(2048,8,e,t)}function xs(e){k.flags|=4;var t=k.updateQueue;if(t===null)t=Go(),k.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ss(e){var t=Wo().memoizedState;return xs({ref:t,nextImpl:e}),function(){if(L&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Cs(e,t){return vs(4,2,e,t)}function ws(e,t){return vs(4,4,e,t)}function Ts(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Es(e,t,n){n=n==null?null:n.concat([e]),vs(4,4,Ts.bind(null,t,e),n)}function Ds(){}function Os(e,t){var n=Wo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Fo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ks(e,t){var n=Wo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Fo(t,r[1]))return r[0];if(r=e(),ko){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[r,t],r}function As(e,t,n){return n===void 0||wo&1073741824&&!(B&261930)?e.memoizedState=t:(e.memoizedState=n,e=xu(),k.lanes|=e,H|=e,n)}function js(e,t,n,r){return Nr(n,t)?n:lo.current===null?!(wo&42)||wo&1073741824&&!(B&261930)?(pc=!0,e.memoizedState=n):(e=xu(),k.lanes|=e,H|=e,t):(e=As(e,n,r),Nr(e,t)||(pc=!0),e)}function Ms(e,t,n,r,i){var a=T.p;T.p=a!==0&&8>a?a:8;var o=w.T,s={};w.T=s,Ws(e,!1,t,n);try{var c=i(),l=w.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Us(e,t,Da(c,r),bu(e)):Us(e,t,r,bu(e))}catch(n){Us(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{T.p=a,o!==null&&s.types!==null&&(o.types=s.types),w.T=o}}function Ns(){}function Ps(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Fs(e).queue;Ms(e,a,t,fe,n===null?Ns:function(){return Is(e),n(r)})}function Fs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:fe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Is(e){var t=Fs(e);t.next===null&&(t=e.alternate.memoizedState),Us(e,t.next.queue,{},bu())}function Ls(){return fa($f)}function Rs(){return Wo().memoizedState}function zs(){return Wo().memoizedState}function Bs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=eo(n);var r=to(t,e,n);r!==null&&(Su(r,t,n),no(r,t,n)),t={cache:ya()},e.payload=t;return}t=t.return}}function Vs(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Gs(e)?Ks(t,n):(n=pi(e,t,n,r),n!==null&&(Su(n,e,r),qs(n,t,r)))}function Hs(e,t,n){Us(e,t,n,bu())}function Us(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Gs(e))Ks(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Nr(s,o))return fi(e,t,i,0),R===null&&di(),!1}catch{}if(n=pi(e,t,i,r),n!==null)return Su(n,e,r),qs(n,t,r),!0}return!1}function Ws(e,t,n,r){if(r={lane:2,revertLane:_d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Gs(e)){if(t)throw Error(i(479))}else t=pi(e,n,r,2),t!==null&&Su(t,e,2)}function Gs(e){var t=e.alternate;return e===k||t!==null&&t===k}function Ks(e,t){Oo=Do=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}var Js={readContext:fa,use:qo,useCallback:Po,useContext:Po,useEffect:Po,useImperativeHandle:Po,useLayoutEffect:Po,useInsertionEffect:Po,useMemo:Po,useReducer:Po,useRef:Po,useState:Po,useDebugValue:Po,useDeferredValue:Po,useTransition:Po,useSyncExternalStore:Po,useId:Po,useHostTransitionStatus:Po,useFormState:Po,useActionState:Po,useOptimistic:Po,useMemoCache:Po,useCacheRefresh:Po};Js.useEffectEvent=Po;var Ys={readContext:fa,use:qo,useCallback:function(e,t){return Uo().memoizedState=[e,t===void 0?null:t],e},useContext:fa,useEffect:ys,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),_s(4194308,4,Ts.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _s(4194308,4,e,t)},useInsertionEffect:function(e,t){_s(4,2,e,t)},useMemo:function(e,t){var n=Uo();t=t===void 0?null:t;var r=e();if(ko){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Uo();if(n!==void 0){var i=n(t);if(ko){qe(!0);try{n(t)}finally{qe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Vs.bind(null,k,e),[r.memoizedState,e]},useRef:function(e){var t=Uo();return e={current:e},t.memoizedState=e},useState:function(e){e=as(e);var t=e.queue,n=Hs.bind(null,k,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ds,useDeferredValue:function(e,t){return As(Uo(),e,t)},useTransition:function(){var e=as(!1);return e=Ms.bind(null,k,e.queue,!0,!1),Uo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=k,a=Uo();if(O){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),R===null)throw Error(i(349));B&127||es(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ys(ns.bind(null,r,o,e),[e]),r.flags|=2048,hs(9,{destroy:void 0},ts.bind(null,r,o,n,t),null),n},useId:function(){var e=Uo(),t=R.identifierPrefix;if(O){var n=Ri,r=Li;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Ao++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=No++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ls,useFormState:ps,useActionState:ps,useOptimistic:function(e){var t=Uo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ws.bind(null,k,!0,n),n.dispatch=t,[e,t]},useMemoCache:Jo,useCacheRefresh:function(){return Uo().memoizedState=Bs.bind(null,k)},useEffectEvent:function(e){var t=Uo(),n={impl:e};return t.memoizedState=n,function(){if(L&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Xs={readContext:fa,use:qo,useCallback:Os,useContext:fa,useEffect:bs,useImperativeHandle:Es,useInsertionEffect:Cs,useLayoutEffect:ws,useMemo:ks,useReducer:Xo,useRef:gs,useState:function(){return Xo(Yo)},useDebugValue:Ds,useDeferredValue:function(e,t){return js(Wo(),To.memoizedState,e,t)},useTransition:function(){var e=Xo(Yo)[0],t=Wo().memoizedState;return[typeof e==`boolean`?e:Ko(e),t]},useSyncExternalStore:$o,useId:Rs,useHostTransitionStatus:Ls,useFormState:j,useActionState:j,useOptimistic:function(e,t){return os(Wo(),To,e,t)},useMemoCache:Jo,useCacheRefresh:zs};Xs.useEffectEvent=Ss;var Zs={readContext:fa,use:qo,useCallback:Os,useContext:fa,useEffect:bs,useImperativeHandle:Es,useInsertionEffect:Cs,useLayoutEffect:ws,useMemo:ks,useReducer:Qo,useRef:gs,useState:function(){return Qo(Yo)},useDebugValue:Ds,useDeferredValue:function(e,t){var n=Wo();return To===null?As(n,e,t):js(n,To.memoizedState,e,t)},useTransition:function(){var e=Qo(Yo)[0],t=Wo().memoizedState;return[typeof e==`boolean`?e:Ko(e),t]},useSyncExternalStore:$o,useId:Rs,useHostTransitionStatus:Ls,useFormState:N,useActionState:N,useOptimistic:function(e,t){var n=Wo();return To===null?(n.baseState=e,[e,n.queue.dispatch]):os(n,To,e,t)},useMemoCache:Jo,useCacheRefresh:zs};Zs.useEffectEvent=Ss;function Qs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $s={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bu(),i=eo(r);i.payload=t,n!=null&&(i.callback=n),t=to(e,i,r),t!==null&&(Su(t,e,r),no(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bu(),i=eo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=to(e,i,r),t!==null&&(Su(t,e,r),no(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bu(),r=eo(n);r.tag=2,t!=null&&(r.callback=t),t=to(e,r,n),t!==null&&(Su(t,e,n),no(t,e,n))}};function ec(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Pr(n,r)||!Pr(i,a):!0}function tc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&$s.enqueueReplaceState(t,t.state,null)}function nc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function rc(e){si(e)}function ic(e){console.error(e)}function ac(e){si(e)}function oc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function sc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function cc(e,t,n){return n=eo(n),n.tag=3,n.payload={element:null},n.callback=function(){oc(e,t)},n}function lc(e){return e=eo(e),e.tag=3,e}function uc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){sc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){sc(t,n,r),typeof i!=`function`&&(uu===null?uu=new Set([this]):uu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function dc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&la(t,n,a,!0),n=ho.current,n!==null){switch(n.tag){case 31:case 13:return go===null?Pu():n.alternate===null&&V===0&&(V=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ia?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Qu(e,r,a)),!1;case 22:return n.flags|=65536,r===Ia?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Qu(e,r,a)),!1}throw Error(i(435,n.tag))}return Qu(e,r,a),Pu(),!1}if(O)return t=ho.current,t===null?(r!==Ji&&(t=Error(i(423),{cause:r}),ta(ki(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ki(r,n),a=cc(e.stateNode,r,a),ro(e,a),V!==4&&(V=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ji&&(e=Error(i(422),{cause:r}),ta(ki(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ki(o,n),iu===null?iu=[o]:iu.push(o),V!==4&&(V=2),t===null)return!0;r=ki(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=cc(n.stateNode,r,e),ro(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(uu===null||!uu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=lc(a),uc(a,e,n,r),ro(n,a),!1}n=n.return}while(n!==null);return!1}var fc=Error(i(461)),pc=!1;function mc(e,t,n,r){t.child=e===null?Xa(t,null,n,r):Ya(t,e.child,n,r)}function hc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return da(t),r=Io(e,t,n,o,a,i),s=Bo(),e!==null&&!pc?(Vo(e,t,i),Rc(e,t,i)):(O&&s&&Vi(t),t.flags|=1,mc(e,t,r,i),t.child)}function gc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!bi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,P(e,t,a,r,i)):(e=Ci(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!zc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Pr:n,n(o,r)&&e.ref===t.ref)return Rc(e,t,i)}return t.flags|=1,e=xi(a,r),e.ref=t.ref,e.return=t,t.child=e}function P(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Pr(a,r)&&e.ref===t.ref)if(pc=!1,t.pendingProps=r=a,zc(e,i))e.flags&131072&&(pc=!0);else return t.lanes=e.lanes,Rc(e,t,i)}return wc(e,t,n,r,i)}function _c(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return yc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ja(t,a===null?null:a.cachePool),a===null?po():fo(t,a),yo(t);else return r=t.lanes=536870912,yc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ja(t,null),po(),bo(t)):(ja(t,a.cachePool),fo(t,a),bo(t),t.memoizedState=null);return mc(e,t,i,n),t.child}function vc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function yc(e,t,n,r,i){var a=Aa();return a=a===null?null:{parent:va._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ja(t,null),po(),yo(t),e!==null&&la(e,t,r,!0),t.childLanes=i,null}function bc(e,t){return t=Nc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function xc(e,t,n){return Ya(t,e.child,null,n),e=bc(t,t.pendingProps),e.flags|=2,xo(t),t.memoizedState=null,e}function Sc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(O){if(r.mode===`hidden`)return e=bc(t,r),t.lanes=536870912,vc(null,e);if(vo(t),(e=Gi)?(e=cf(e,qi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ii===null?null:{id:Li,overflow:Ri},retryLane:536870912,hydrationErrors:null},n=Ei(e),n.return=t,t.child=n,Wi=t,Gi=null)):e=null,e===null)throw Yi(t);return t.lanes=536870912,null}return bc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(vo(t),a)if(t.flags&256)t.flags&=-257,t=xc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(pc||la(e,t,n,!1),a=(n&e.childLanes)!==0,pc||a){if(r=R,r!==null&&(s=dt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,mi(e,s),Su(r,e,s),fc;Pu(),t=xc(e,t,n)}else e=o.treeContext,Gi=ff(s.nextSibling),Wi=t,O=!0,Ki=null,qi=!1,e!==null&&Ui(t,e),t=bc(t,r),t.flags|=4096;return t}return e=xi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Cc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function wc(e,t,n,r,i){return da(t),n=Io(e,t,n,r,void 0,i),r=Bo(),e!==null&&!pc?(Vo(e,t,i),Rc(e,t,i)):(O&&r&&Vi(t),t.flags|=1,mc(e,t,n,i),t.child)}function Tc(e,t,n,r,i,a){return da(t),t.updateQueue=null,n=Ro(t,r,n,i),Lo(e),r=Bo(),e!==null&&!pc?(Vo(e,t,a),Rc(e,t,a)):(O&&r&&Vi(t),t.flags|=1,mc(e,t,n,a),t.child)}function Ec(e,t,n,r,i){if(da(t),t.stateNode===null){var a=_i,o=n.contextType;typeof o==`object`&&o&&(a=fa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=$s,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Qa(t),o=n.contextType,a.context=typeof o==`object`&&o?fa(o):_i,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Qs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&$s.enqueueReplaceState(a,a.state,null),oo(t,r,a,i),ao(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=nc(n,s);a.props=c;var l=a.context,u=n.contextType;o=_i,typeof u==`object`&&u&&(o=fa(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&tc(t,a,r,o),Za=!1;var f=t.memoizedState;a.state=f,oo(t,r,a,i),ao(),l=t.memoizedState,s||f!==l||Za?(typeof d==`function`&&(Qs(t,n,d,r),l=t.memoizedState),(c=Za||ec(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,$a(e,t),o=t.memoizedProps,u=nc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=_i,typeof l==`object`&&l&&(c=fa(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&tc(t,a,r,c),Za=!1,f=t.memoizedState,a.state=f,oo(t,r,a,i),ao();var p=t.memoizedState;o!==d||f!==p||Za||e!==null&&e.dependencies!==null&&ua(e.dependencies)?(typeof s==`function`&&(Qs(t,n,s,r),p=t.memoizedState),(u=Za||ec(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ua(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Cc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ya(t,e.child,null,i),t.child=Ya(t,null,n,i)):mc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Rc(e,t,i),e}function Dc(e,t,n,r){return $i(),t.flags|=256,mc(e,t,n,r),t.child}var Oc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kc(e){return{baseLanes:e,cachePool:Ma()}}function Ac(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=nu),e}function jc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(So.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(O){if(a?_o(t):bo(t),(e=Gi)?(e=cf(e,qi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ii===null?null:{id:Li,overflow:Ri},retryLane:536870912,hydrationErrors:null},n=Ei(e),n.return=t,t.child=n,Wi=t,Gi=null)):e=null,e===null)throw Yi(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(bo(t),a=t.mode,c=Nc({mode:`hidden`,children:c},a),r=wi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=kc(n),r.childLanes=Ac(e,s,n),t.memoizedState=Oc,vc(null,r)):(_o(t),Mc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(_o(t),t.flags&=-257,t=Pc(e,t,n)):t.memoizedState===null?(bo(t),c=r.fallback,a=t.mode,r=Nc({mode:`visible`,children:r.children},a),c=wi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ya(t,e.child,null,n),r=t.child,r.memoizedState=kc(n),r.childLanes=Ac(e,s,n),t.memoizedState=Oc,t=vc(null,r)):(bo(t),t.child=e.child,t.flags|=128,t=null);else if(_o(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,ta({value:r,source:null,stack:null}),t=Pc(e,t,n)}else if(pc||la(e,t,n,!1),s=(n&e.childLanes)!==0,pc||s){if(s=R,s!==null&&(r=dt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,mi(e,r),Su(s,e,r),fc;lf(c)||Pu(),t=Pc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Gi=ff(c.nextSibling),Wi=t,O=!0,Ki=null,qi=!1,e!==null&&Ui(t,e),t=Mc(t,r.children),t.flags|=4096);return t}return a?(bo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=xi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=wi(c,a,n,null),c.flags|=2):c=xi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,vc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=kc(n):(a=c.cachePool,a===null?a=Ma():(l=va._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Ac(e,s,n),t.memoizedState=Oc,vc(e.child,r)):(_o(t),n=e.child,e=n.sibling,n=xi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Mc(e,t){return t=Nc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Nc(e,t){return e=yi(22,e,null,t),e.lanes=0,e}function Pc(e,t,n){return Ya(t,e.child,null,n),e=Mc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),sa(e.return,t,n)}function Ic(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Lc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=So.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,E(So,o),mc(e,t,r,n),r=O?Ni:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fc(e,n,t);else if(e.tag===19)Fc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ic(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ic(t,!0,n,null,a,r);break;case`together`:Ic(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Rc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),H|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(la(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=xi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function zc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&ua(e))):!0}function F(e,t,n){switch(t.tag){case 3:xe(t,t.stateNode.containerInfo),aa(t,va,e.memoizedState.cache),$i();break;case 27:case 5:Ce(t);break;case 4:xe(t,t.stateNode.containerInfo);break;case 10:aa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,vo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(_o(t),e=Rc(e,t,n),e===null?null:e.sibling):jc(e,t,n):(_o(t),t.flags|=128,null);_o(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(la(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Lc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),E(So,So.current),r)break;return null;case 22:return t.lanes=0,_c(e,t,n,t.pendingProps);case 24:aa(t,va,e.memoizedState.cache)}return Rc(e,t,n)}function Bc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)pc=!0;else{if(!zc(e,n)&&!(t.flags&128))return pc=!1,F(e,t,n);pc=!!(e.flags&131072)}else pc=!1,O&&t.flags&1048576&&Bi(t,Ni,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=za(t.elementType),t.type=e,typeof e==`function`)bi(e)?(r=nc(e,r),t.tag=1,t=Ec(null,t,e,r,n)):(t.tag=0,t=wc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=hc(null,t,e,r,n);break a}else if(a===ie){t.tag=14,t=gc(null,t,e,r,n);break a}}throw t=C(e)||e,Error(i(306,t,``))}}return t;case 0:return wc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=nc(r,t.pendingProps),Ec(e,t,r,a,n);case 3:a:{if(xe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,$a(e,t),oo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,aa(t,va,r),r!==o.cache&&ca(t,[va],n,!0),ao(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Dc(e,t,r,n);break a}else if(r!==a){a=ki(Error(i(424)),t),ta(a),t=Dc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Gi=ff(e.firstChild),Wi=t,O=!0,Ki=null,qi=!0,n=Xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if($i(),r===a){t=Rc(e,t,n);break a}mc(e,t,r,n)}t=t.child}return t;case 26:return Cc(e,t),e===null?(n=jf(t.type,null,t.pendingProps,null))?t.memoizedState=n:O||(n=t.type,e=t.pendingProps,r=Wd(ye.current).createElement(n),r[_t]=t,r[vt]=e,Rd(r,n,e),At(r),t.stateNode=r):t.memoizedState=jf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ce(t),e===null&&O&&(r=t.stateNode=gf(t.type,t.pendingProps,ye.current),Wi=t,qi=!0,a=Gi,tf(t.type)?(pf=a,Gi=ff(r.firstChild)):Gi=a),mc(e,t,t.pendingProps.children,n),Cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&O&&((a=r=Gi)&&(r=of(r,t.type,t.pendingProps,qi),r===null?a=!1:(t.stateNode=r,Wi=t,Gi=ff(r.firstChild),qi=!1,a=!0)),a||Yi(t)),Ce(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Io(e,t,zo,null,null,n),$f._currentValue=a),Cc(e,t),mc(e,t,r,n),t.child;case 6:return e===null&&O&&((e=n=Gi)&&(n=sf(n,t.pendingProps,qi),n===null?e=!1:(t.stateNode=n,Wi=t,Gi=null,e=!0)),e||Yi(t)),null;case 13:return jc(e,t,n);case 4:return xe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ya(t,null,r,n):mc(e,t,r,n),t.child;case 11:return hc(e,t,t.type,t.pendingProps,n);case 7:return mc(e,t,t.pendingProps,n),t.child;case 8:return mc(e,t,t.pendingProps.children,n),t.child;case 12:return mc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,aa(t,t.type,r.value),mc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,da(t),a=fa(a),r=r(a),t.flags|=1,mc(e,t,r,n),t.child;case 14:return gc(e,t,t.type,t.pendingProps,n);case 15:return P(e,t,t.type,t.pendingProps,n);case 19:return Lc(e,t,n);case 31:return Sc(e,t,n);case 22:return _c(e,t,n,t.pendingProps);case 24:return da(t),r=fa(va),e===null?(a=Aa(),a===null&&(a=R,o=ya(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Qa(t),aa(t,va,a)):((e.lanes&n)!==0&&($a(e,t),oo(t,null,null,n),ao()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,aa(t,va,r),r!==a.cache&&ca(t,[va],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),aa(t,va,r))),mc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Vc(e){e.flags|=4}function Hc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(ju())e.flags|=8192;else throw Ba=Ia,Pa}else e.flags&=-16777217}function Uc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Gf(t))if(ju())e.flags|=8192;else throw Ba=Ia,Pa}function Wc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:at(),e.lanes|=t,ru|=t)}function Gc(e,t){if(!O)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Kc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function qc(e,t,n){var r=t.pendingProps;switch(Hi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kc(t),null;case 1:return Kc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),oa(va),Se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Qi(t)?Vc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ea())),Kc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Vc(t),o===null?(Kc(t),Hc(t,a,null,r,n)):(Kc(t),Uc(t,o))):o?o===e.memoizedState?(Kc(t),t.flags&=-16777217):(Vc(t),Kc(t),Uc(t,o)):(e=e.memoizedProps,e!==r&&Vc(t),Kc(t),Hc(t,a,e,r,n)),null;case 27:if(we(t),n=ye.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Vc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Kc(t),null}e=_e.current,Qi(t)?Xi(t,e):(e=gf(a,r,n),t.stateNode=e,Vc(t))}return Kc(t),null;case 5:if(we(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Vc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Kc(t),null}if(o=_e.current,Qi(t))Xi(t,o);else{var s=Wd(ye.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[_t]=t,o[vt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Rd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Vc(t)}}return Kc(t),Hc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Vc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ye.current,Qi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Wi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[_t]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Yi(t,!0)}else e=Wd(e).createTextNode(r),e[_t]=t,t.stateNode=e}return Kc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Qi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[_t]=t}else $i(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kc(t),e=!1}else n=ea(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(xo(t),t):(xo(t),null);if(t.flags&128)throw Error(i(558))}return Kc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Qi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[_t]=t}else $i(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kc(t),a=!1}else a=ea(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(xo(t),t):(xo(t),null)}return xo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Wc(t,t.updateQueue),Kc(t),null);case 4:return Se(),e===null&&Od(t.stateNode.containerInfo),Kc(t),null;case 10:return oa(t.type),Kc(t),null;case 19:if(ge(So),r=t.memoizedState,r===null)return Kc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Gc(r,!1);else{if(V!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Co(e),o!==null){for(t.flags|=128,Gc(r,!1),e=o.updateQueue,t.updateQueue=e,Wc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Si(n,e),n=n.sibling;return E(So,So.current&1|2),O&&zi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ie()>lu&&(t.flags|=128,a=!0,Gc(r,!1),t.lanes=4194304)}else{if(!a)if(e=Co(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Wc(t,e),Gc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!O)return Kc(t),null}else 2*Ie()-r.renderingStartTime>lu&&n!==536870912&&(t.flags|=128,a=!0,Gc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Kc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ie(),e.sibling=null,n=So.current,E(So,a?n&1|2:n&1),O&&zi(t,r.treeForkCount),e);case 22:case 23:return xo(t),mo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Kc(t),t.subtreeFlags&6&&(t.flags|=8192)):Kc(t),n=t.updateQueue,n!==null&&Wc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ge(ka),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),oa(va),Kc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Jc(e,t){switch(Hi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return oa(va),Se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return we(t),null;case 31:if(t.memoizedState!==null){if(xo(t),t.alternate===null)throw Error(i(340));$i()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));$i()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(So),null;case 4:return Se(),null;case 10:return oa(t.type),null;case 22:case 23:return xo(t),mo(),e!==null&&ge(ka),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return oa(va),null;case 25:return null;default:return null}}function Yc(e,t){switch(Hi(t),t.tag){case 3:oa(va),Se();break;case 26:case 27:case 5:we(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&xo(t);break;case 13:xo(t);break;case 19:ge(So);break;case 10:oa(t.type);break;case 22:case 23:xo(t),mo(),e!==null&&ge(ka);break;case 24:oa(va)}}function Xc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){W(t,t.return,e)}}function Zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){W(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){W(t,t.return,e)}}function Qc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{co(t,n)}catch(t){W(e,e.return,t)}}}function $c(e,t,n){n.props=nc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){W(e,t,n)}}function el(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){W(e,t,n)}}function tl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){W(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){W(e,t,n)}else n.current=null}function nl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){W(e,e.return,t)}}function rl(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[vt]=t}catch(t){W(e,e.return,t)}}function il(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function al(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||il(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ol(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=dn));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(ol(e,t,n),e=e.sibling;e!==null;)ol(e,t,n),e=e.sibling}function sl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(sl(e,t,n),e=e.sibling;e!==null;)sl(e,t,n),e=e.sibling}function cl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[_t]=e,t[vt]=n}catch(t){W(e,e.return,t)}}var ll=!1,ul=!1,dl=!1,fl=typeof WeakSet==`function`?WeakSet:Set,pl=null;function ml(e,t){if(e=e.containerInfo,Hd=cp,e=Rr(e),zr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},cp=!1,pl=t;pl!==null;)if(t=pl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,pl=e;else for(;pl!==null;){switch(t=pl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=nc(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){W(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,pl=e;break}pl=t.return}}function hl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Al(e,n),r&4&&Xc(5,n);break;case 1:if(Al(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){W(n,n.return,e)}else{var i=nc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){W(n,n.return,e)}}r&64&&Qc(n),r&512&&el(n,n.return);break;case 3:if(Al(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{co(e,t)}catch(e){W(n,n.return,e)}}break;case 27:t===null&&r&4&&cl(n);case 26:case 5:Al(e,n),t===null&&r&4&&nl(n),r&512&&el(n,n.return);break;case 12:Al(e,n);break;case 31:Al(e,n),r&4&&xl(e,n);break;case 13:Al(e,n),r&4&&Sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=td.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||ll,!r){t=t!==null&&t.memoizedState!==null||ul,i=ll;var a=ul;ll=r,(ul=t)&&!a?Ml(e,n,(n.subtreeFlags&8772)!=0):Al(e,n),ll=i,ul=a}break;case 30:break;default:Al(e,n)}}function gl(e){var t=e.alternate;t!==null&&(e.alternate=null,gl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Tt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var _l=null,vl=!1;function yl(e,t,n){for(n=n.child;n!==null;)bl(e,t,n),n=n.sibling}function bl(e,t,n){if(Ke&&typeof Ke.onCommitFiberUnmount==`function`)try{Ke.onCommitFiberUnmount(Ge,n)}catch{}switch(n.tag){case 26:ul||tl(n,t),yl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ul||tl(n,t);var r=_l,i=vl;tf(n.type)&&(_l=n.stateNode,vl=!1),yl(e,t,n),_f(n.stateNode),_l=r,vl=i;break;case 5:ul||tl(n,t);case 6:if(r=_l,i=vl,_l=null,yl(e,t,n),_l=r,vl=i,_l!==null)if(vl)try{(_l.nodeType===9?_l.body:_l.nodeName===`HTML`?_l.ownerDocument.body:_l).removeChild(n.stateNode)}catch(e){W(n,t,e)}else try{_l.removeChild(n.stateNode)}catch(e){W(n,t,e)}break;case 18:_l!==null&&(vl?(e=_l,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Pp(e)):nf(_l,n.stateNode));break;case 4:r=_l,i=vl,_l=n.stateNode.containerInfo,vl=!0,yl(e,t,n),_l=r,vl=i;break;case 0:case 11:case 14:case 15:Zc(2,n,t),ul||Zc(4,n,t),yl(e,t,n);break;case 1:ul||(tl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&$c(n,t,r)),yl(e,t,n);break;case 21:yl(e,t,n);break;case 22:ul=(r=ul)||n.memoizedState!==null,yl(e,t,n),ul=r;break;default:yl(e,t,n)}}function xl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pp(e)}catch(e){W(t,t.return,e)}}}function Sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pp(e)}catch(e){W(t,t.return,e)}}function Cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fl),t;default:throw Error(i(435,e.tag))}}function wl(e,t){var n=Cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=G.bind(null,e,t);t.then(r,r)}})}function Tl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){_l=c.stateNode,vl=!1;break a}break;case 5:_l=c.stateNode,vl=!1;break a;case 3:case 4:_l=c.stateNode.containerInfo,vl=!0;break a}c=c.return}if(_l===null)throw Error(i(160));bl(o,s,a),_l=null,vl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Dl(t,e),t=t.sibling}var El=null;function Dl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Tl(t,e),Ol(e),r&4&&(Zc(3,e,e.return),Xc(3,e),Zc(5,e,e.return));break;case 1:Tl(t,e),Ol(e),r&512&&(ul||n===null||tl(n,n.return)),r&64&&ll&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=El;if(Tl(t,e),Ol(e),r&512&&(ul||n===null||tl(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[wt]||o[_t]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Rd(o,r,n),o[_t]=e,At(o),r=o;break a;case`link`:var s=Uf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Uf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[_t]=e,At(o),r=o}e.stateNode=r}else Wf(a,e.type,e.stateNode);else e.stateNode=Rf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&rl(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Wf(a,e.type,e.stateNode):Rf(a,r,e.memoizedProps))}break;case 27:Tl(t,e),Ol(e),r&512&&(ul||n===null||tl(n,n.return)),n!==null&&r&4&&rl(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Tl(t,e),Ol(e),r&512&&(ul||n===null||tl(n,n.return)),e.flags&32){a=e.stateNode;try{nn(a,``)}catch(t){W(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,rl(e,a,n===null?a:n.memoizedProps)),r&1024&&(dl=!0);break;case 6:if(Tl(t,e),Ol(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){W(e,e.return,t)}}break;case 3:if(Hf=null,a=El,El=bf(t.containerInfo),Tl(t,e),El=a,Ol(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pp(t.containerInfo)}catch(t){W(e,e.return,t)}dl&&(dl=!1,kl(e));break;case 4:r=El,El=bf(e.stateNode.containerInfo),Tl(t,e),Ol(e),El=r;break;case 12:Tl(t,e),Ol(e);break;case 31:Tl(t,e),Ol(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,wl(e,r)));break;case 13:Tl(t,e),Ol(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(su=Ie()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,wl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=ll,d=ul;if(ll=u||a,ul=d||l,Tl(t,e),ul=d,ll=u,Ol(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||ll||ul||jl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){W(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){W(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){W(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,wl(e,n))));break;case 19:Tl(t,e),Ol(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,wl(e,r)));break;case 30:break;case 21:break;default:Tl(t,e),Ol(e)}}function Ol(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(il(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;sl(e,al(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(nn(o,``),n.flags&=-33),sl(e,al(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;ol(e,al(e),s);break;default:throw Error(i(161))}}catch(t){W(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function kl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;kl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Al(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)hl(e,t.alternate,t),t=t.sibling}function jl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Zc(4,t,t.return),jl(t);break;case 1:tl(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&$c(t,t.return,n),jl(t);break;case 27:_f(t.stateNode);case 26:case 5:tl(t,t.return),jl(t);break;case 22:t.memoizedState===null&&jl(t);break;case 30:jl(t);break;default:jl(t)}e=e.sibling}}function Ml(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Ml(i,a,n),Xc(4,a);break;case 1:if(Ml(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){W(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)so(c[i],s)}catch(e){W(r,r.return,e)}}n&&o&64&&Qc(a),el(a,a.return);break;case 27:cl(a);case 26:case 5:Ml(i,a,n),n&&r===null&&o&4&&nl(a),el(a,a.return);break;case 12:Ml(i,a,n);break;case 31:Ml(i,a,n),n&&o&4&&xl(i,a);break;case 13:Ml(i,a,n),n&&o&4&&Sl(i,a);break;case 22:a.memoizedState===null&&Ml(i,a,n),el(a,a.return);break;case 30:break;default:Ml(i,a,n)}t=t.sibling}}function Nl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ba(n))}function Pl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ba(e))}function Fl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Il(e,t,n,r),t=t.sibling}function Il(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Fl(e,t,n,r),i&2048&&Xc(9,t);break;case 1:Fl(e,t,n,r);break;case 3:Fl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ba(e)));break;case 12:if(i&2048){Fl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){W(t,t.return,e)}}else Fl(e,t,n,r);break;case 31:Fl(e,t,n,r);break;case 13:Fl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Fl(e,t,n,r):(a._visibility|=2,Ll(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Fl(e,t,n,r):Rl(e,t),i&2048&&Nl(o,t);break;case 24:Fl(e,t,n,r),i&2048&&Pl(t.alternate,t);break;default:Fl(e,t,n,r)}}function Ll(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ll(a,o,s,c,i),Xc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ll(a,o,s,c,i)):u._visibility&2?Ll(a,o,s,c,i):Rl(a,o),i&&l&2048&&Nl(o.alternate,o);break;case 24:Ll(a,o,s,c,i),i&&l&2048&&Pl(o.alternate,o);break;default:Ll(a,o,s,c,i)}t=t.sibling}}function Rl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Rl(n,r),i&2048&&Nl(r.alternate,r);break;case 24:Rl(n,r),i&2048&&Pl(r.alternate,r);break;default:Rl(n,r)}t=t.sibling}}var zl=8192;function Bl(e,t,n){if(e.subtreeFlags&zl)for(e=e.child;e!==null;)Vl(e,t,n),e=e.sibling}function Vl(e,t,n){switch(e.tag){case 26:Bl(e,t,n),e.flags&zl&&e.memoizedState!==null&&Kf(n,El,e.memoizedState,e.memoizedProps);break;case 5:Bl(e,t,n);break;case 3:case 4:var r=El;El=bf(e.stateNode.containerInfo),Bl(e,t,n),El=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=zl,zl=16777216,Bl(e,t,n),zl=r):Bl(e,t,n));break;default:Bl(e,t,n)}}function I(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Hl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pl=r,Gl(r,e)}I(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ul(e),e=e.sibling}function Ul(e){switch(e.tag){case 0:case 11:case 15:Hl(e),e.flags&2048&&Zc(9,e,e.return);break;case 3:Hl(e);break;case 12:Hl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Wl(e)):Hl(e);break;default:Hl(e)}}function Wl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pl=r,Gl(r,e)}I(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Zc(8,t,t.return),Wl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Wl(t));break;default:Wl(t)}e=e.sibling}}function Gl(e,t){for(;pl!==null;){var n=pl;switch(n.tag){case 0:case 11:case 15:Zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ba(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,pl=r;else a:for(n=e;pl!==null;){r=pl;var i=r.sibling,a=r.return;if(gl(r),r===n){pl=null;break a}if(i!==null){i.return=a,pl=i;break a}pl=a}}}var Kl={getCacheForType:function(e){var t=fa(va),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return fa(va).controller.signal}},ql=typeof WeakMap==`function`?WeakMap:Map,L=0,R=null,z=null,B=0,Jl=0,Yl=null,Xl=!1,Zl=!1,Ql=!1,$l=0,V=0,H=0,eu=0,tu=0,nu=0,ru=0,iu=null,au=null,ou=!1,su=0,cu=0,lu=1/0,U=null,uu=null,du=0,fu=null,pu=null,mu=0,hu=0,gu=null,_u=null,vu=0,yu=null;function bu(){return L&2&&B!==0?B&-B:w.T===null?mt():_d()}function xu(){if(nu===0)if(!(B&536870912)||O){var e=$e;$e<<=1,!($e&3932160)&&($e=262144),nu=e}else nu=536870912;return e=ho.current,e!==null&&(e.flags|=32),nu}function Su(e,t,n){(e===R&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)&&(ku(e,0),Eu(e,B,nu,!1)),st(e,n),(!(L&2)||e!==R)&&(e===R&&(!(L&2)&&(eu|=n),V===4&&Eu(e,B,nu,!1)),ld(e))}function Cu(e,t,n){if(L&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||rt(e,t),a=r?Lu(e,t):Fu(e,t,!0),o=r;do{if(a===0){Zl&&!r&&Eu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Tu(n)){a=Fu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=iu;var l=c.current.memoizedState.isDehydrated;if(l&&(ku(c,s).flags|=256),s=Fu(c,s,!1),s!==2){if(Ql&&!l){c.errorRecoveryDisabledLanes|=o,eu|=o,a=4;break a}o=au,au=a,o!==null&&(au===null?au=o:au.push.apply(au,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ku(e,0),Eu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Eu(r,t,nu,!Xl);break a;case 2:au=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=su+300-Ie(),10<a)){if(Eu(r,t,nu,!Xl),nt(r,0,!0)!==0)break a;mu=t,r.timeoutHandle=Xd(wu.bind(null,r,n,au,U,ou,t,nu,eu,ru,Xl,o,`Throttled`,-0,0),a);break a}wu(r,n,au,U,ou,t,nu,eu,ru,Xl,o,null,-0,0)}}break}while(1);ld(e)}function wu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:dn},Vl(t,a,d);var m=(a&62914560)===a?su-Ie():(a&4194048)===a?cu-Ie():0;if(m=Jf(d,m),m!==null){mu=a,e.cancelPendingCommit=m(Wu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Eu(e,a,o,!l);return}}Wu(e,t,a,n,r,i,o,s,c)}function Tu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Nr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Eu(e,t,n,r){t&=~tu,t&=~eu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&<(e,n,t)}function Du(){return L&6?!0:(ud(0,!1),!1)}function Ou(){if(z!==null){if(Jl===0)var e=z.return;else e=z,ia=ra=null,Ho(e),Ua=null,Wa=0,e=z;for(;e!==null;)Yc(e.alternate,e),e=e.return;z=null}}function ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mu=0,Ou(),R=e,z=n=xi(e.current,null),B=t,Jl=0,Yl=null,Xl=!1,Zl=rt(e,t),Ql=!1,ru=nu=tu=eu=H=V=0,au=iu=null,ou=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Je(r),a=1<<i;t|=e[i],r&=~a}return $l=t,di(),n}function Au(e,t){k=null,w.H=Js,t===Na||t===Fa?(t=Va(),Jl=3):t===Pa?(t=Va(),Jl=4):Jl=t===fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Yl=t,z===null&&(V=1,oc(e,ki(t,e.current)))}function ju(){var e=ho.current;return e===null?!0:(B&4194048)===B?go===null:(B&62914560)===B||B&536870912?e===go:!1}function Mu(){var e=w.H;return w.H=Js,e===null?Js:e}function Nu(){var e=w.A;return w.A=Kl,e}function Pu(){V=4,Xl||(B&4194048)!==B&&ho.current!==null||(Zl=!0),!(H&134217727)&&!(eu&134217727)||R===null||Eu(R,B,nu,!1)}function Fu(e,t,n){var r=L;L|=2;var i=Mu(),a=Nu();(R!==e||B!==t)&&(U=null,ku(e,t)),t=!1;var o=V;a:do try{if(Jl!==0&&z!==null){var s=z,c=Yl;switch(Jl){case 8:Ou(),o=6;break a;case 3:case 2:case 9:case 6:ho.current===null&&(t=!0);var l=Jl;if(Jl=0,Yl=null,Vu(e,s,c,l),n&&Zl){o=0;break a}break;default:l=Jl,Jl=0,Yl=null,Vu(e,s,c,l)}}Iu(),o=V;break}catch(t){Au(e,t)}while(1);return t&&e.shellSuspendCounter++,ia=ra=null,L=r,w.H=i,w.A=a,z===null&&(R=null,B=0,di()),o}function Iu(){for(;z!==null;)zu(z)}function Lu(e,t){var n=L;L|=2;var r=Mu(),a=Nu();R!==e||B!==t?(U=null,lu=Ie()+500,ku(e,t)):Zl=rt(e,t);a:do try{if(Jl!==0&&z!==null){t=z;var o=Yl;b:switch(Jl){case 1:Jl=0,Yl=null,Vu(e,t,o,1);break;case 2:case 9:if(La(o)){Jl=0,Yl=null,Bu(t);break}t=function(){Jl!==2&&Jl!==9||R!==e||(Jl=7),ld(e)},o.then(t,t);break a;case 3:Jl=7;break a;case 4:Jl=5;break a;case 7:La(o)?(Jl=0,Yl=null,Bu(t)):(Jl=0,Yl=null,Vu(e,t,o,7));break;case 5:var s=null;switch(z.tag){case 26:s=z.memoizedState;case 5:case 27:var c=z;if(s?Gf(s):c.stateNode.complete){Jl=0,Yl=null;var l=c.sibling;if(l!==null)z=l;else{var u=c.return;u===null?z=null:(z=u,Hu(u))}break b}}Jl=0,Yl=null,Vu(e,t,o,5);break;case 6:Jl=0,Yl=null,Vu(e,t,o,6);break;case 8:Ou(),V=6;break a;default:throw Error(i(462))}}Ru();break}catch(t){Au(e,t)}while(1);return ia=ra=null,w.H=r,w.A=a,L=n,z===null?(R=null,B=0,di(),V):0}function Ru(){for(;z!==null&&!Pe();)zu(z)}function zu(e){var t=Bc(e.alternate,e,$l);e.memoizedProps=e.pendingProps,t===null?Hu(e):z=t}function Bu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Tc(n,t,t.pendingProps,t.type,void 0,B);break;case 11:t=Tc(n,t,t.pendingProps,t.type.render,t.ref,B);break;case 5:Ho(t);default:Yc(n,t),t=z=Si(t,$l),t=Bc(n,t,$l)}e.memoizedProps=e.pendingProps,t===null?Hu(e):z=t}function Vu(e,t,n,r){ia=ra=null,Ho(t),Ua=null,Wa=0;var i=t.return;try{if(dc(e,i,t,n,B)){V=1,oc(e,ki(n,e.current)),z=null;return}}catch(t){if(i!==null)throw z=i,t;V=1,oc(e,ki(n,e.current)),z=null;return}t.flags&32768?(O||r===1?e=!0:Zl||B&536870912?e=!1:(Xl=e=!0,(r===2||r===9||r===3||r===6)&&(r=ho.current,r!==null&&r.tag===13&&(r.flags|=16384))),Uu(t,e)):Hu(t)}function Hu(e){var t=e;do{if(t.flags&32768){Uu(t,Xl);return}e=t.return;var n=qc(t.alternate,t,$l);if(n!==null){z=n;return}if(t=t.sibling,t!==null){z=t;return}z=t=e}while(t!==null);V===0&&(V=5)}function Uu(e,t){do{var n=Jc(e.alternate,e);if(n!==null){n.flags&=32767,z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){z=e;return}z=e=n}while(e!==null);V=6,z=null}function Wu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Yu();while(du!==0);if(L&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=ui,ct(e,n,o,s,c,l),e===R&&(z=R=null,B=0),pu=t,fu=e,mu=n,hu=o,gu=a,_u=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,nd(Be,function(){return Xu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=w.T,w.T=null,a=T.p,T.p=2,s=L,L|=4;try{ml(e,t,n)}finally{L=s,T.p=a,w.T=r}}du=1,Gu(),Ku(),qu()}}function Gu(){if(du===1){du=0;var e=fu,t=pu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=w.T,w.T=null;var r=T.p;T.p=2;var i=L;L|=4;try{Dl(t,e);var a=Ud,o=Rr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Lr(s.ownerDocument.documentElement,s)){if(c!==null&&zr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Ir(s,h),v=Ir(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}cp=!!Hd,Ud=Hd=null}finally{L=i,T.p=r,w.T=n}}e.current=t,du=2}}function Ku(){if(du===2){du=0;var e=fu,t=pu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=w.T,w.T=null;var r=T.p;T.p=2;var i=L;L|=4;try{hl(e,t.alternate,t)}finally{L=i,T.p=r,w.T=n}}du=3}}function qu(){if(du===4||du===3){du=0,Fe();var e=fu,t=pu,n=mu,r=_u;t.subtreeFlags&10256||t.flags&10256?du=5:(du=0,pu=fu=null,Ju(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(uu=null),pt(n),t=t.stateNode,Ke&&typeof Ke.onCommitFiberRoot==`function`)try{Ke.onCommitFiberRoot(Ge,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=w.T,i=T.p,T.p=2,w.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{w.T=t,T.p=i}}mu&3&&Yu(),ld(e),i=e.pendingLanes,n&261930&&i&42?e===yu?vu++:(vu=0,yu=e):vu=0,ud(0,!1)}}function Ju(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ba(t)))}function Yu(){return Gu(),Ku(),qu(),Xu()}function Xu(){if(du!==5)return!1;var e=fu,t=hu;hu=0;var n=pt(mu),r=w.T,a=T.p;try{T.p=32>n?32:n,w.T=null,n=gu,gu=null;var o=fu,s=mu;if(du=0,pu=fu=null,mu=0,L&6)throw Error(i(331));var c=L;if(L|=4,Ul(o.current),Il(o,o.current,s,n),L=c,ud(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot==`function`)try{Ke.onPostCommitFiberRoot(Ge,o)}catch{}return!0}finally{T.p=a,w.T=r,Ju(e,t)}}function Zu(e,t,n){t=ki(n,t),t=cc(e.stateNode,t,2),e=to(e,t,2),e!==null&&(st(e,2),ld(e))}function W(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(uu===null||!uu.has(r))){e=ki(n,e),n=lc(2),r=to(t,n,2),r!==null&&(uc(n,r,t,e),st(r,2),ld(r));break}}t=t.return}}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ql;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ql=!0,i.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,R===e&&(B&n)===n&&(V===4||V===3&&(B&62914560)===B&&300>Ie()-su?!(L&2)&&ku(e,0):tu|=n,ru===B&&(ru=0)),ld(e)}function ed(e,t){t===0&&(t=at()),e=mi(e,t),e!==null&&(st(e,t),ld(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ed(e,n)}function G(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),ed(e,n)}function nd(e,t){return Ne(e,t)}var rd=null,id=null,ad=!1,od=!1,sd=!1,cd=0;function ld(e){e!==id&&e.next===null&&(id===null?rd=id=e:id=id.next=e),od=!0,ad||(ad=!0,gd())}function ud(e,t){if(!sd&&od){sd=!0;do for(var n=!1,r=rd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,hd(r,a))}else a=B,a=nt(r,r===R?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||rt(r,a)||(n=!0,hd(r,a));r=r.next}while(n);sd=!1}}function dd(){fd()}function fd(){od=ad=!1;var e=0;cd!==0&&Yd()&&(e=cd);for(var t=Ie(),n=null,r=rd;r!==null;){var i=r.next,a=pd(r,t);a===0?(r.next=null,n===null?rd=i:n.next=i,i===null&&(id=n)):(n=r,(e!==0||a&3)&&(od=!0)),r=i}du!==0&&du!==5||ud(e,!1),cd!==0&&(cd=0)}function pd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=it(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=R,n=B,n=nt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&D(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||rt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&D(r),pt(n)){case 2:case 8:n=ze;break;case 32:n=Be;break;case 268435456:n=He;break;default:n=Be}return r=md.bind(null,e),n=Ne(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&D(r),e.callbackPriority=2,e.callbackNode=null,2}function md(e,t){if(du!==0&&du!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Yu()&&e.callbackNode!==n)return null;var r=B;return r=nt(e,e===R?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Cu(e,r,t),pd(e,Ie()),e.callbackNode!=null&&e.callbackNode===n?md.bind(null,e):null)}function hd(e,t){if(Yu())return null;Cu(e,t,!0)}function gd(){$d(function(){L&6?Ne(Re,dd):fd()})}function _d(){if(cd===0){var e=Ca;e===0&&(e=Qe,Qe<<=1,!(Qe&261888)&&(Qe=256)),cd=e}return cd}function vd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:un(``+e)}function yd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function bd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=vd((i[vt]||null).action),o=r.submitter;o&&(t=(t=o[vt]||null)?vd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(cd!==0){var e=o?yd(i,o):new FormData(i);Ps(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?yd(i,o):new FormData(i),Ps(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var xd=0;xd<ai.length;xd++){var Sd=ai[xd];oi(Sd.toLowerCase(),`on`+(Sd[0].toUpperCase()+Sd.slice(1)))}oi(Zr,`onAnimationEnd`),oi(Qr,`onAnimationIteration`),oi($r,`onAnimationStart`),oi(`dblclick`,`onDoubleClick`),oi(`focusin`,`onFocus`),oi(`focusout`,`onBlur`),oi(ei,`onTransitionRun`),oi(ti,`onTransitionStart`),oi(ni,`onTransitionCancel`),oi(ri,`onTransitionEnd`),Pt(`onMouseEnter`,[`mouseout`,`mouseover`]),Pt(`onMouseLeave`,[`mouseout`,`mouseover`]),Pt(`onPointerEnter`,[`pointerout`,`pointerover`]),Pt(`onPointerLeave`,[`pointerout`,`pointerover`]),Nt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Nt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Nt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Nt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Nt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Nt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Cd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),wd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Cd));function Td(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){si(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){si(e)}i.currentTarget=null,a=c}}}}function K(e,t){var n=t[bt];n===void 0&&(n=t[bt]=new Set);var r=e+`__bubble`;n.has(r)||(kd(t,e,2,!1),n.add(r))}function Ed(e,t,n){var r=0;t&&(r|=4),kd(n,e,r,t)}var Dd=`_reactListening`+Math.random().toString(36).slice(2);function Od(e){if(!e[Dd]){e[Dd]=!0,jt.forEach(function(t){t!==`selectionchange`&&(wd.has(t)||Ed(t,!1,e),Ed(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Dd]||(t[Dd]=!0,Ed(`selectionchange`,!1,t))}}function kd(e,t,n,r){switch(hp(t)){case 2:var i=lp;break;case 8:i=up;break;default:i=dp}n=i.bind(null,t,n,e),i=void 0,!xn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function q(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Et(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}vn(function(){var r=a,i=pn(n),s=[];a:{var c=ii.get(e);if(c!==void 0){var l=Mn,u=e;switch(e){case`keypress`:if(Dn(n)===0)break a;case`keydown`:case`keyup`:l=Xn;break;case`focusin`:u=`focus`,l=Vn;break;case`focusout`:u=`blur`,l=Vn;break;case`beforeblur`:case`afterblur`:l=Vn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=zn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Bn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Qn;break;case Zr:case Qr:case $r:l=Hn;break;case ri:l=$n;break;case`scroll`:case`scrollend`:l=Pn;break;case`wheel`:l=er;break;case`copy`:case`cut`:case`paste`:l=Un;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Zn;break;case`toggle`:case`beforetoggle`:l=tr}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=yn(m,p),g!=null&&d.push(Ad(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==fn&&(u=n.relatedTarget||n.fromElement)&&(Et(u)||u[yt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?Et(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=zn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Ot(l),h=u==null?c:Ot(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,Et(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Md,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Nd(s,c,l,d,!1),u!==null&&f!==null&&Nd(s,f,u,d,!0)}}a:{if(c=r?Ot(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=xr;else if(hr(c))if(Sr)v=jr;else{v=kr;var y=Or}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&sn(r.elementType)&&(v=xr):v=Ar;if(v&&=v(e,r)){gr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Qt(c,`number`,c.value)}switch(y=r?Ot(r):window,e){case`focusin`:(hr(y)||y.contentEditable===`true`)&&(Vr=y,Hr=r,Ur=null);break;case`focusout`:Ur=Hr=Vr=null;break;case`mousedown`:Wr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Wr=!1,Gr(s,n,i);break;case`selectionchange`:if(Br)break;case`keydown`:case`keyup`:Gr(s,n,i)}var b;if(rr)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else dr?lr(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(or&&n.locale!==`ko`&&(dr||x!==`onCompositionStart`?x===`onCompositionEnd`&&dr&&(b=En()):(Cn=i,wn=`value`in Cn?Cn.value:Cn.textContent,dr=!0)),y=jd(r,x),0<y.length&&(x=new Wn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=ur(n),b!==null&&(x.data=b)))),(b=ar?fr(e,n):pr(e,n))&&(x=jd(r,`onBeforeInput`),0<x.length&&(y=new Wn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),bd(s,e,r,n,i)}Td(s,t)})}function Ad(e,t,n){return{instance:e,listener:t,currentTarget:n}}function jd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=yn(e,n),i!=null&&r.unshift(Ad(e,i,a)),i=yn(e,t),i!=null&&r.push(Ad(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Md(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Nd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=yn(n,a),l!=null&&o.unshift(Ad(n,l,c))):i||(l=yn(n,a),l!=null&&o.push(Ad(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var J=/\r\n?/g,Pd=/\u0000|\uFFFD/g;function Fd(e){return(typeof e==`string`?e:``+e).replace(J,`
|
|
10
|
+
`).replace(Pd,``)}function Id(e,t){return t=Fd(t),Fd(e)===t}function Y(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||nn(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&nn(e,``+r);break;case`className`:Bt(e,`class`,r);break;case`tabIndex`:Bt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Bt(e,n,r);break;case`style`:on(e,r,o);break;case`data`:if(t!==`object`){Bt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=un(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Y(e,t,`name`,a.name,a,null),Y(e,t,`formEncType`,a.formEncType,a,null),Y(e,t,`formMethod`,a.formMethod,a,null),Y(e,t,`formTarget`,a.formTarget,a,null)):(Y(e,t,`encType`,a.encType,a,null),Y(e,t,`method`,a.method,a,null),Y(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=un(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=dn);break;case`onScroll`:r!=null&&K(`scroll`,e);break;case`onScrollEnd`:r!=null&&K(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=un(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:K(`beforetoggle`,e),K(`toggle`,e),zt(e,`popover`,r);break;case`xlinkActuate`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Vt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:zt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=cn.get(n)||n,zt(e,n,r))}}function Ld(e,t,n,r,a,o){switch(n){case`style`:on(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?nn(e,r):(typeof r==`number`||typeof r==`bigint`)&&nn(e,``+r);break;case`onScroll`:r!=null&&K(`scroll`,e);break;case`onScrollEnd`:r!=null&&K(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=dn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Mt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[vt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):zt(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:K(`error`,e),K(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Y(e,t,o,s,n,null)}}a&&Y(e,t,`srcSet`,n.srcSet,n,null),r&&Y(e,t,`src`,n.src,n,null);return;case`input`:K(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Y(e,t,r,d,n,null)}}Zt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in K(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Y(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&$t(e,!!r,n,!0):$t(e,!!r,t,!1);return;case`textarea`:for(s in K(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Y(e,t,s,c,n,null)}tn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Y(e,t,l,r,n,null)}return;case`dialog`:K(`beforetoggle`,e),K(`toggle`,e),K(`cancel`,e),K(`close`,e);break;case`iframe`:case`object`:K(`load`,e);break;case`video`:case`audio`:for(r=0;r<Cd.length;r++)K(Cd[r],e);break;case`image`:K(`error`,e),K(`load`,e);break;case`details`:K(`toggle`,e);break;case`embed`:case`source`:case`link`:K(`error`,e),K(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Y(e,t,u,r,n,null)}return;default:if(sn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Y(e,t,c,r,n,null))}function zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Y(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Y(e,t,p,m,r,f)}}Xt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Y(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Y(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?$t(e,!!n,n?[]:``,!1):$t(e,!!n,t,!0)):$t(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Y(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Y(e,t,s,a,r,o)}en(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Y(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Y(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Y(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Y(e,t,u,p,r,m)}return;default:if(sn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Y(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Y(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Bd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Bd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Kd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Pp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[wt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Pp(t)}function rf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:af(n),Tt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[wt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function ff(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Tt(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=T.d;T.d={f:X,r:Sf,D:wf,C:Tf,L:Ef,m:Df,X:kf,S:Of,M:Af};function X(){var e=xf.f(),t=Du();return e||t}function Sf(e){var t=Dt(e);t!==null&&t.tag===5&&t.type===`form`?Is(t):xf.r(e)}var Cf=typeof document>`u`?null:document;function Z(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=Yt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),At(t),r.head.appendChild(t)))}}function wf(e){xf.D(e),Z(`dns-prefetch`,e,null)}function Tf(e,t){xf.C(e,t),Z(`preconnect`,e,t)}function Ef(e,t,n){xf.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Yt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Yt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Yt(n.imageSizes)+`"]`)):i+=`[href="`+Yt(e)+`"]`;var a=i;switch(t){case`style`:a=Mf(e);break;case`script`:a=If(e)}vf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Nf(a))||t===`script`&&r.querySelector(Lf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),At(t),r.head.appendChild(t)))}}function Df(e,t){xf.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Yt(r)+`"][href="`+Yt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=If(e)}if(!vf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Lf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),At(r),n.head.appendChild(r)}}}function Of(e,t,n){xf.S(e,t,n);var r=Cf;if(r&&e){var i=kt(r).hoistableStyles,a=Mf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Nf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);At(c),Rd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kf(e,t){xf.X(e,t);var n=Cf;if(n&&e){var r=kt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=h({src:e,async:!0},t),(t=vf.get(i))&&Vf(e,t),a=n.createElement(`script`),At(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t){xf.M(e,t);var n=Cf;if(n&&e){var r=kt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Vf(e,t),a=n.createElement(`script`),At(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t,n,r){var a=(a=ye.current)?bf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Mf(n.href),n=kt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Mf(n.href);var o=kt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Nf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),o||Ff(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=If(n),n=kt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mf(e){return`href="`+Yt(e)+`"`}function Nf(e){return`link[rel="stylesheet"][`+e+`]`}function Pf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Ff(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Rd(t,`link`,n),At(t),e.head.appendChild(t))}function If(e){return`[src="`+Yt(e)+`"]`}function Lf(e){return`script[async]`+e}function Rf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Yt(n.href)+`"]`);if(r)return t.instance=r,At(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),At(r),Rd(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Mf(n.href);var o=e.querySelector(Nf(a));if(o)return t.state.loading|=4,t.instance=o,At(o),o;r=Pf(n),(a=vf.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),At(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=If(n.src),(a=e.querySelector(Lf(o)))?(t.instance=a,At(a),a):(r=n,(a=vf.get(o))&&(r=h({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),At(a),Rd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Hf=null;function Uf(e,t,n){if(Hf===null){var r=new Map,i=Hf=new Map;i.set(n,r)}else i=Hf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[wt]||a[_t]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Wf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Q(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Gf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Kf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Mf(r.href),a=t.querySelector(Nf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Yf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,At(a);return}a=t.ownerDocument||t,r=Pf(r),(i=vf.get(i))&&Bf(r,i),a=a.createElement(`link`),At(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Yf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var qf=0;function Jf(e,t){return e.stylesheets&&e.count===0&&Zf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&qf===0&&(qf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Yf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xf=null;function Zf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xf=new Map,t.forEach(Qf,e),Xf=null,Yf.call(e))}function Qf(e,t){if(!(t.state.loading&4)){var n=Xf.get(e);if(n)var r=n.get(null);else{n=new Map,Xf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Yf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var $f={$$typeof:te,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function ep(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ot(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ot(0),this.hiddenUpdates=ot(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function tp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ep(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=yi(3,null,null,t),e.current=a,a.stateNode=e,t=ya(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Qa(a),e}function np(e){return e?(e=_i,e):_i}function rp(e,t,n,r,i,a){i=np(i),r.context===null?r.context=i:r.pendingContext=i,r=eo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=to(e,r,t),n!==null&&(Su(n,e,t),no(n,e,t))}function ip(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ap(e,t){ip(e,t),(e=e.alternate)&&ip(e,t)}function op(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&Su(t,e,67108864),ap(e,67108864)}}function sp(e){if(e.tag===13||e.tag===31){var t=bu();t=ft(t);var n=mi(e,t);n!==null&&Su(n,e,t),ap(e,t)}}var cp=!0;function lp(e,t,n,r){var i=w.T;w.T=null;var a=T.p;try{T.p=2,dp(e,t,n,r)}finally{T.p=a,w.T=i}}function up(e,t,n,r){var i=w.T;w.T=null;var a=T.p;try{T.p=8,dp(e,t,n,r)}finally{T.p=a,w.T=i}}function dp(e,t,n,r){if(cp){var i=fp(r);if(i===null)q(e,t,r,pp,n),wp(e,r);else if(Ep(i,e,t,n,r))r.stopPropagation();else if(wp(e,r),t&4&&-1<Cp.indexOf(e)){for(;i!==null;){var a=Dt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=tt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Je(o);s.entanglements[1]|=c,o&=~c}ld(a),!(L&6)&&(lu=Ie()+500,ud(0,!1))}}break;case 31:case 13:s=mi(a,2),s!==null&&Su(s,a,2),Du(),ap(a,2)}if(a=fp(r),a===null&&q(e,t,r,pp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else q(e,t,r,null,n)}}function fp(e){return e=pn(e),mp(e)}var pp=null;function mp(e){if(pp=null,e=Et(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return pp=e,null}function hp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Le()){case Re:return 2;case ze:return 8;case Be:case Ve:return 32;case He:return 268435456;default:return 32}default:return 32}}var gp=!1,_p=null,vp=null,yp=null,bp=new Map,xp=new Map,Sp=[],Cp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function wp(e,t){switch(e){case`focusin`:case`focusout`:_p=null;break;case`dragenter`:case`dragleave`:vp=null;break;case`mouseover`:case`mouseout`:yp=null;break;case`pointerover`:case`pointerout`:bp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:xp.delete(t.pointerId)}}function Tp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Dt(t),t!==null&&op(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ep(e,t,n,r,i){switch(t){case`focusin`:return _p=Tp(_p,e,t,n,r,i),!0;case`dragenter`:return vp=Tp(vp,e,t,n,r,i),!0;case`mouseover`:return yp=Tp(yp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return bp.set(a,Tp(bp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,xp.set(a,Tp(xp.get(a)||null,e,t,n,r,i)),!0}return!1}function Dp(e){var t=Et(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ht(e.priority,function(){sp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ht(e.priority,function(){sp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Op(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);fn=r,n.target.dispatchEvent(r),fn=null}else return t=Dt(n),t!==null&&op(t),e.blockedOn=n,!1;t.shift()}return!0}function kp(e,t,n){Op(e)&&n.delete(t)}function Ap(){gp=!1,_p!==null&&Op(_p)&&(_p=null),vp!==null&&Op(vp)&&(vp=null),yp!==null&&Op(yp)&&(yp=null),bp.forEach(kp),xp.forEach(kp)}function jp(e,n){e.blockedOn===n&&(e.blockedOn=null,gp||(gp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ap)))}var Mp=null;function Np(e){Mp!==e&&(Mp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Mp===e&&(Mp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(mp(r||n)===null)continue;break}var a=Dt(n);a!==null&&(e.splice(t,3),t-=3,Ps(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Pp(e){function t(t){return jp(t,e)}_p!==null&&jp(_p,e),vp!==null&&jp(vp,e),yp!==null&&jp(yp,e),bp.forEach(t),xp.forEach(t);for(var n=0;n<Sp.length;n++){var r=Sp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Sp.length&&(n=Sp[0],n.blockedOn===null);)Dp(n),n.blockedOn===null&&Sp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[vt]||null;if(typeof a==`function`)o||Np(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[vt]||null)s=o.formAction;else if(mp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Np(n)}}}function Fp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Ip(e){this._internalRoot=e}Lp.prototype.render=Ip.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;rp(n,bu(),e,t,null,null)},Lp.prototype.unmount=Ip.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rp(e.current,2,null,e,null,null),Du(),t[yt]=null}};function Lp(e){this._internalRoot=e}Lp.prototype.unstable_scheduleHydration=function(e){if(e){var t=mt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Sp.length&&t!==0&&t<Sp[n].priority;n++);Sp.splice(n,0,e),n===0&&Dp(e)}};var Rp=n.version;if(Rp!==`19.2.7`)throw Error(i(527,Rp,`19.2.7`));T.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var zp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:w,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bp.isDisabled&&Bp.supportsFiber)try{Ge=Bp.inject(zp),Ke=Bp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=rc,s=ic,c=ac;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=tp(e,1,!1,null,null,n,r,null,o,s,c,Fp),e[yt]=t.current,Od(e),new Ip(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=u(),v=g(),y=[`subscription`,`api-key`,`ant-auth`],b={subscription:`Claude Code subscription login`,"api-key":`ANTHROPIC_API_KEY`,"ant-auth":`ant auth token`},x={subscription:`bills your Max/Pro subscription`,"api-key":`bills API credits`,"ant-auth":`bills API credits, NOT your subscription`},ee=[`not-installed`,`installed-not-authenticated`,`present-but-rejected`];function te(e,t){switch(t){case`not-installed`:return e===`subscription`?`Claude Code is not installed on this machine`:e===`api-key`?`ANTHROPIC_API_KEY is not set in this environment`:`no ant auth token or credentials profile is present`;case`installed-not-authenticated`:return e===`subscription`?"Claude Code is installed but not logged in — run `claude login`":e===`api-key`?`ANTHROPIC_API_KEY is set but empty`:"an ant auth profile exists but holds no usable token — run `ant auth login`";case`present-but-rejected`:return`a credential is present but the last run was rejected — investigate before reusing it`}}function S(e,t){return{id:e,label:b[e],status:t,detail:t.kind===`available`?x[e]:te(e,t.reason)}}function ne(e,t){if(t!==null){let n=e.rows.find(e=>e.id===t);return n&&n.status.kind===`available`?{kind:`in-use`,source:t,reason:{kind:`explicit-selection`}}:e.defaultPick===null?{kind:`no-model`,droppedSelection:t}:{kind:`in-use`,source:e.defaultPick,reason:{kind:`selection-unavailable`,selected:t}}}return e.defaultPick===null?{kind:`no-model`,droppedSelection:null}:{kind:`in-use`,source:e.defaultPick,reason:{kind:`default-precedence`}}}function re(e){if(e.kind===`no-model`)return e.droppedSelection===null?`No model is available on this machine.`:`No model is available: your selected source (${b[e.droppedSelection]}) is unusable and nothing else resolved.`;let t=b[e.source];switch(e.reason.kind){case`default-precedence`:return`${t} — in use by the default precedence.`;case`explicit-selection`:return`${t} — in use by your explicit selection.`;case`selection-unavailable`:return`${t} — in use by the default precedence; your selected source (${b[e.reason.selected]}) is no longer usable.`}}var ie=`specsketch.workbench.agent.credential-source`;function ae(e){return y.includes(e)}function oe(e){let t=e.getItem(ie);return t===null||!ae(t)?null:t}function se(e,t){e.setItem(ie,t)}function ce(e){e.removeItem(ie)}function le(e){let t=new URLSearchParams(e),n=t.get(`cred`);if(n===null)return{rows:[S(`subscription`,{kind:`available`}),S(`api-key`,{kind:`available`}),S(`ant-auth`,{kind:`unavailable`,reason:`not-installed`})],defaultPick:`subscription`};let r=new Map;for(let e of n.split(`,`)){let[t,n]=e.split(`:`);if(t===void 0||n===void 0||!ae(t))throw Error(`?cred entry "${e}" names no known credential source`);if(n===`available`)r.set(t,{kind:`available`});else if(ee.includes(n))r.set(t,{kind:`unavailable`,reason:n});else throw Error(`?cred entry "${e}" names no known availability state`)}let i=t.get(`pick`);if(i!==null&&!ae(i))throw Error(`?pick=${i} names no known credential source`);return{rows:y.map(e=>S(e,r.get(e)??{kind:`unavailable`,reason:`not-installed`})),defaultPick:i}}var ue=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),C=o(((e,t)=>{t.exports=ue()}))();function de(e){let t=(0,_.useRef)(null);(0,_.useEffect)(()=>{t.current?.focus()},[]);let n=e.credential.kind===`in-use`?e.credential.source:null;return(0,C.jsxs)(`div`,{className:`rail-settings`,"data-testid":`credential-settings`,role:`group`,"aria-label":`Model credential`,tabIndex:-1,ref:t,onKeyDown:t=>{t.key===`Escape`&&e.onClose()},children:[(0,C.jsxs)(`div`,{className:`rail-settings-head`,children:[(0,C.jsx)(`span`,{className:`rail-settings-title`,children:`model credential`}),(0,C.jsx)(`button`,{type:`button`,className:`rail-close`,"data-testid":`credential-settings-close`,"aria-label":`Close model credential settings`,onClick:e.onClose,children:`close`})]}),(0,C.jsx)(`p`,{className:`rail-settings-inuse`,"data-testid":`credential-reason`,children:re(e.credential)}),(0,C.jsx)(`ul`,{className:`rail-settings-list`,"data-testid":`credential-sources`,children:e.machine.rows.map(t=>{let r=t.status.kind===`available`;return(0,C.jsxs)(`li`,{className:r?`cred-row`:`cred-row cred-row-out`,"data-testid":`credential-source-${t.id}`,"data-available":r?`true`:`false`,"data-in-use":n===t.id?`true`:`false`,"data-selected":e.selection===t.id?`true`:`false`,...t.status.kind===`unavailable`?{"data-reason":t.status.reason}:{},children:[(0,C.jsxs)(`span`,{className:`cred-name`,children:[t.label,n===t.id?(0,C.jsxs)(`span`,{className:`cred-inuse`,"data-testid":`credential-in-use-${t.id}`,children:[` `,`· in use`]}):null]}),(0,C.jsx)(`span`,{className:`cred-detail`,"data-testid":`credential-detail-${t.id}`,children:r?t.detail:`unavailable — ${t.detail}`}),r?(0,C.jsx)(`button`,{type:`button`,className:`cred-use`,"data-testid":`credential-use-${t.id}`,"aria-label":`Use ${t.label}`,disabled:e.selection===t.id,onClick:()=>e.onSelect(t.id),children:e.selection===t.id?`selected`:`use this`}):null]},t.id)})}),e.selection===null?null:(0,C.jsx)(`button`,{type:`button`,className:`cred-clear`,"data-testid":`credential-clear`,"aria-label":`Clear the explicit selection of ${b[e.selection]}`,onClick:e.onClear,children:`clear selection — return to the default precedence`})]})}var w;function T(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var fe=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},pe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(w=globalThis).__zod_globalConfig??(w.__zod_globalConfig={});var me=globalThis.__zod_globalConfig;function he(e){return e&&Object.assign(me,e),me}function ge(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function E(e,t){return typeof t==`bigint`?t.toString():t}function _e(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function ve(e){return e==null}function ye(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var be=Symbol(`evaluating`);function xe(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==be)return r===void 0&&(r=be,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Se(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ce(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function we(e){return JSON.stringify(e)}function Te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ee=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function De(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Oe=_e(()=>{if(me.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ke(e){if(De(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(De(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ae(e){return ke(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var je=new Set([`string`,`number`,`symbol`]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ne(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Pe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Ne(e,Ce(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Se(this,`shape`,e),e},checks:[]}))}function Ie(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Ne(e,Ce(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Se(this,`shape`,r),r},checks:[]}))}function Le(e,t){if(!ke(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ne(e,Ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Se(this,`shape`,n),n}}))}function Re(e,t){if(!ke(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ne(e,Ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Se(this,`shape`,n),n}}))}function ze(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ne(e,Ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Se(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Be(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Ne(t,Ce(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Se(this,`shape`,i),i},checks:[]}))}function Ve(e,t,n){return Ne(t,Ce(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Se(this,`shape`,i),i}}))}function He(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ue(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function We(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ge(e){return typeof e==`string`?e:e?.message}function Ke(e,t,n){let r=e.message?e.message:Ge(e.inst?._zod.def?.error?.(e))??Ge(t?.error?.(e))??Ge(n.customError?.(e))??Ge(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function qe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Je(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ye=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,E,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Xe=T(`$ZodError`,Ye),Ze=T(`$ZodError`,Ye,{Parent:Error});function Qe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function $e(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var et=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new fe;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ke(e,a,he())));throw Ee(t,i?.callee),t}return o.value},tt=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ke(e,a,he())));throw Ee(t,i?.callee),t}return o.value},nt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new fe;return a.issues.length?{success:!1,error:new(e??Xe)(a.issues.map(e=>Ke(e,i,he())))}:{success:!0,data:a.value}},rt=nt(Ze),it=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ke(e,i,he())))}:{success:!0,data:a.value}},at=it(Ze),ot=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return et(e)(t,n,i)},st=e=>(t,n,r)=>et(e)(t,n,r),ct=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return tt(e)(t,n,i)},lt=e=>async(t,n,r)=>tt(e)(t,n,r),ut=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nt(e)(t,n,i)},dt=e=>(t,n,r)=>nt(e)(t,n,r),ft=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return it(e)(t,n,i)},pt=e=>async(t,n,r)=>it(e)(t,n,r),mt=/^[cC][0-9a-z]{6,}$/,ht=/^[0-9a-z]+$/,gt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_t=/^[0-9a-vA-V]{20}$/,vt=/^[A-Za-z0-9]{27}$/,yt=/^[a-zA-Z0-9_-]{21}$/,bt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,St=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ct=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Tt(){return new RegExp(wt,`u`)}var Et=/^(?:(?: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])$/,Dt=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Ot=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,kt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,At=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jt=/^[A-Za-z0-9_-]*$/,Mt=/^https?$/,Nt=/^\+[1-9]\d{6,14}$/,Pt=`(?:(?:\\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])))`,Ft=RegExp(`^${Pt}$`);function It(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Lt(e){return RegExp(`^${It(e)}$`)}function Rt(e){let t=It({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Pt}T(?:${r})$`)}var zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Bt=/^[^A-Z]*$/,Vt=/^[^a-z]*$/,Ht=T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ut=T(`$ZodCheckMaxLength`,(e,t)=>{var n;Ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ve(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=qe(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wt=T(`$ZodCheckMinLength`,(e,t)=>{var n;Ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ve(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=qe(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Gt=T(`$ZodCheckLengthEquals`,(e,t)=>{var n;Ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ve(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=qe(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Kt=T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Ht.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),qt=T(`$ZodCheckRegex`,(e,t)=>{Kt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Jt=T(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Bt,Kt.init(e,t)}),Yt=T(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Vt,Kt.init(e,t)}),Xt=T(`$ZodCheckIncludes`,(e,t)=>{Ht.init(e,t);let n=Me(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Zt=T(`$ZodCheckStartsWith`,(e,t)=>{Ht.init(e,t);let n=RegExp(`^${Me(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qt=T(`$ZodCheckEndsWith`,(e,t)=>{Ht.init(e,t);let n=RegExp(`.*${Me(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),$t=T(`$ZodCheckOverwrite`,(e,t)=>{Ht.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),en=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
11
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
12
|
+
`))}},tn={major:4,minor:4,patch:3},nn=T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=He(e),i;for(let a of t){if(a._zod.def.when){if(Ue(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new fe;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=He(e,t))});else{if(e.issues.length===t)continue;r||=He(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(He(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new fe;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new fe;return o.then(e=>t(e,r,a))}return t(o,r,a)}}xe(e,`~standard`,()=>({validate:t=>{try{let n=rt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return at(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),rn=T(`$ZodString`,(e,t)=>{nn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),an=T(`$ZodStringFormat`,(e,t)=>{Kt.init(e,t),rn.init(e,t)}),on=T(`$ZodGUID`,(e,t)=>{t.pattern??=xt,an.init(e,t)}),sn=T(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=St(e)}else t.pattern??=St();an.init(e,t)}),cn=T(`$ZodEmail`,(e,t)=>{t.pattern??=Ct,an.init(e,t)}),ln=T(`$ZodURL`,(e,t)=>{an.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Mt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),un=T(`$ZodEmoji`,(e,t)=>{t.pattern??=Tt(),an.init(e,t)}),dn=T(`$ZodNanoID`,(e,t)=>{t.pattern??=yt,an.init(e,t)}),fn=T(`$ZodCUID`,(e,t)=>{t.pattern??=mt,an.init(e,t)}),pn=T(`$ZodCUID2`,(e,t)=>{t.pattern??=ht,an.init(e,t)}),mn=T(`$ZodULID`,(e,t)=>{t.pattern??=gt,an.init(e,t)}),hn=T(`$ZodXID`,(e,t)=>{t.pattern??=_t,an.init(e,t)}),gn=T(`$ZodKSUID`,(e,t)=>{t.pattern??=vt,an.init(e,t)}),_n=T(`$ZodISODateTime`,(e,t)=>{t.pattern??=Rt(t),an.init(e,t)}),vn=T(`$ZodISODate`,(e,t)=>{t.pattern??=Ft,an.init(e,t)}),yn=T(`$ZodISOTime`,(e,t)=>{t.pattern??=Lt(t),an.init(e,t)}),bn=T(`$ZodISODuration`,(e,t)=>{t.pattern??=bt,an.init(e,t)}),xn=T(`$ZodIPv4`,(e,t)=>{t.pattern??=Et,an.init(e,t),e._zod.bag.format=`ipv4`}),Sn=T(`$ZodIPv6`,(e,t)=>{t.pattern??=Dt,an.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Cn=T(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ot,an.init(e,t)}),wn=T(`$ZodCIDRv6`,(e,t)=>{t.pattern??=kt,an.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Tn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var En=T(`$ZodBase64`,(e,t)=>{t.pattern??=At,an.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Tn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Dn(e){if(!jt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Tn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var On=T(`$ZodBase64URL`,(e,t)=>{t.pattern??=jt,an.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Dn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),kn=T(`$ZodE164`,(e,t)=>{t.pattern??=Nt,an.init(e,t)});function An(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var jn=T(`$ZodJWT`,(e,t)=>{an.init(e,t),e._zod.check=n=>{An(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Mn=T(`$ZodUnknown`,(e,t)=>{nn.init(e,t),e._zod.parse=e=>e}),Nn=T(`$ZodNever`,(e,t)=>{nn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Pn(e,t,n){e.issues.length&&t.issues.push(...We(n,e.issues)),t.value[n]=e.value}var Fn=T(`$ZodArray`,(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Pn(t,n,e))):Pn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function In(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...We(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Ln(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Pe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Rn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>In(e,n,i,t,u,d))):In(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var zn=T(`$ZodObject`,(e,t)=>{if(nn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=_e(()=>Ln(t));xe(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=De,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>In(n,t,e,s,r,i))):In(a,t,e,s,r,i)}return i?Rn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Bn=T(`$ZodObjectJIT`,(e,t)=>{zn.init(e,t);let n=e._zod.parse,r=_e(()=>Ln(t)),i=e=>{let t=new en([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=we(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=we(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
13
|
+
if (${n}.issues.length) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
16
|
+
...iss,
|
|
17
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
18
|
+
})));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (${n}.value === undefined) {
|
|
23
|
+
if (${o} in input) {
|
|
24
|
+
newResult[${o}] = undefined;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
newResult[${o}] = ${n}.value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
`):c?t.write(`
|
|
31
|
+
if (${n}.issues.length) {
|
|
32
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
33
|
+
...iss,
|
|
34
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
35
|
+
})));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (${n}.value === undefined) {
|
|
39
|
+
if (${o} in input) {
|
|
40
|
+
newResult[${o}] = undefined;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
newResult[${o}] = ${n}.value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
`):t.write(`
|
|
47
|
+
const ${n}_present = ${o} in input;
|
|
48
|
+
if (${n}.issues.length) {
|
|
49
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
50
|
+
...iss,
|
|
51
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
54
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
55
|
+
payload.issues.push({
|
|
56
|
+
code: "invalid_type",
|
|
57
|
+
expected: "nonoptional",
|
|
58
|
+
input: undefined,
|
|
59
|
+
path: [${o}]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (${n}_present) {
|
|
64
|
+
if (${n}.value === undefined) {
|
|
65
|
+
newResult[${o}] = undefined;
|
|
66
|
+
} else {
|
|
67
|
+
newResult[${o}] = ${n}.value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=De,s=!me.jitless,c=s&&Oe.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Rn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Vn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!He(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ke(e,r,he())))}),t)}var Hn=T(`$ZodUnion`,(e,t)=>{nn.init(e,t),xe(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),xe(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),xe(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),xe(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ye(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Vn(t,r,e,i)):Vn(o,r,e,i)}}),Un=T(`$ZodIntersection`,(e,t)=>{nn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Gn(e,t,n)):Gn(e,i,a)}});function Wn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ke(e)&&ke(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Wn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Wn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Gn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),He(e))return e;let o=Wn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Kn=T(`$ZodEnum`,(e,t)=>{nn.init(e,t);let n=ge(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>je.has(typeof e)).map(e=>typeof e==`string`?Me(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),qn=T(`$ZodTransform`,(e,t)=>{nn.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new pe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new fe;return n.value=i,n.fallback=!0,n}});function Jn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Yn=T(`$ZodOptional`,(e,t)=>{nn.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,xe(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),xe(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ye(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Jn(e,r)):Jn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Xn=T(`$ZodExactOptional`,(e,t)=>{Yn.init(e,t),xe(e._zod,`values`,()=>t.innerType._zod.values),xe(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zn=T(`$ZodNullable`,(e,t)=>{nn.init(e,t),xe(e._zod,`optin`,()=>t.innerType._zod.optin),xe(e._zod,`optout`,()=>t.innerType._zod.optout),xe(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ye(e.source)}|null)$`):void 0}),xe(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Qn=T(`$ZodDefault`,(e,t)=>{nn.init(e,t),e._zod.optin=`optional`,xe(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>$n(e,t)):$n(r,t)}});function $n(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var er=T(`$ZodPrefault`,(e,t)=>{nn.init(e,t),e._zod.optin=`optional`,xe(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),tr=T(`$ZodNonOptional`,(e,t)=>{nn.init(e,t),xe(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>nr(t,e)):nr(i,e)}});function nr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var rr=T(`$ZodCatch`,(e,t)=>{nn.init(e,t),e._zod.optin=`optional`,xe(e._zod,`optout`,()=>t.innerType._zod.optout),xe(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ke(e,n,he()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ke(e,n,he()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),ir=T(`$ZodPipe`,(e,t)=>{nn.init(e,t),xe(e._zod,`values`,()=>t.in._zod.values),xe(e._zod,`optin`,()=>t.in._zod.optin),xe(e._zod,`optout`,()=>t.out._zod.optout),xe(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ar(e,t.in,n)):ar(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ar(e,t.out,n)):ar(r,t.out,n)}});function ar(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var or=T(`$ZodReadonly`,(e,t)=>{nn.init(e,t),xe(e._zod,`propValues`,()=>t.innerType._zod.propValues),xe(e._zod,`values`,()=>t.innerType._zod.values),xe(e._zod,`optin`,()=>t.innerType?._zod?.optin),xe(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(sr):sr(r)}});function sr(e){return e.value=Object.freeze(e.value),e}var cr=T(`$ZodCustom`,(e,t)=>{Ht.init(e,t),nn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>lr(t,n,r,e));lr(i,n,r,e)}});function lr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Je(e))}}var ur,dr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fr(){return new dr}(ur=globalThis).__zod_globalRegistry??(ur.__zod_globalRegistry=fr());var pr=globalThis.__zod_globalRegistry;function mr(e,t){return new e({type:`string`,...D(t)})}function hr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...D(t)})}function gr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...D(t)})}function _r(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...D(t)})}function vr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...D(t)})}function yr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...D(t)})}function br(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...D(t)})}function xr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...D(t)})}function Sr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...D(t)})}function Cr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...D(t)})}function wr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...D(t)})}function Tr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...D(t)})}function Er(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...D(t)})}function Dr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...D(t)})}function Or(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...D(t)})}function kr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...D(t)})}function Ar(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...D(t)})}function jr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...D(t)})}function Mr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...D(t)})}function Nr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...D(t)})}function Pr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...D(t)})}function Fr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...D(t)})}function Ir(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...D(t)})}function Lr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...D(t)})}function Rr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...D(t)})}function zr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...D(t)})}function Br(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...D(t)})}function Vr(e){return new e({type:`unknown`})}function Hr(e,t){return new e({type:`never`,...D(t)})}function Ur(e,t){return new Ut({check:`max_length`,...D(t),maximum:e})}function Wr(e,t){return new Wt({check:`min_length`,...D(t),minimum:e})}function Gr(e,t){return new Gt({check:`length_equals`,...D(t),length:e})}function Kr(e,t){return new qt({check:`string_format`,format:`regex`,...D(t),pattern:e})}function qr(e){return new Jt({check:`string_format`,format:`lowercase`,...D(e)})}function Jr(e){return new Yt({check:`string_format`,format:`uppercase`,...D(e)})}function Yr(e,t){return new Xt({check:`string_format`,format:`includes`,...D(t),includes:e})}function Xr(e,t){return new Zt({check:`string_format`,format:`starts_with`,...D(t),prefix:e})}function Zr(e,t){return new Qt({check:`string_format`,format:`ends_with`,...D(t),suffix:e})}function Qr(e){return new $t({check:`overwrite`,tx:e})}function $r(e){return Qr(t=>t.normalize(e))}function ei(){return Qr(e=>e.trim())}function ti(){return Qr(e=>e.toLowerCase())}function ni(){return Qr(e=>e.toUpperCase())}function ri(){return Qr(e=>Te(e))}function ii(e,t,n){return new e({type:`array`,element:t,...D(n)})}function ai(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...D(n)})}function oi(e,t){let n=si(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Je(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Je(r))}},e(t.value,t)),t);return n}function si(e,t){let n=new Ht({check:`custom`,...D(t)});return n._zod.check=e,n}function ci(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??pr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function li(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,li(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&fi(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ui(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
72
|
+
|
|
73
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function di(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:mi(t,`input`,e.processors),output:mi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function fi(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return fi(r.element,n);if(r.type===`set`)return fi(r.valueType,n);if(r.type===`lazy`)return fi(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return fi(r.innerType,n);if(r.type===`intersection`)return fi(r.left,n)||fi(r.right,n);if(r.type===`record`||r.type===`map`)return fi(r.keyType,n)||fi(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:fi(r.in,n)||fi(r.out,n);if(r.type===`object`){for(let e in r.shape)if(fi(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(fi(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(fi(e,n))return!0;return!!(r.rest&&fi(r.rest,n))}return!1}var pi=(e,t={})=>n=>{let r=ci({...n,processors:t});return li(e,r),ui(r,e),di(r,e)},mi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ci({...i??{},target:a,io:t,processors:n});return li(e,o),ui(o,e),di(o,e)},hi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},gi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=hi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},_i=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},vi=(e,t,n,r)=>{n.type=`boolean`},yi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Si=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Ci=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},wi=(e,t,n,r)=>{n.not={}},Ti=(e,t,n,r)=>{},Ei=(e,t,n,r)=>{},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Oi=(e,t,n,r)=>{let i=e._zod.def,a=ge(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ki=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ai=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},ji=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Mi=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Ni=(e,t,n,r)=>{n.type=`boolean`},Pi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Ii=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Li=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Ri=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},zi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=li(a.element,t,{...r,path:[...r.path,`items`]})},Bi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=li(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=li(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Vi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>li(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Hi=(e,t,n,r)=>{let i=e._zod.def,a=li(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=li(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ui=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>li(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?li(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Wi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=li(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=li(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=li(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Gi=(e,t,n,r)=>{let i=e._zod.def,a=li(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},O=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ki=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},qi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ji=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Yi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;li(o,t,r);let s=t.seen.get(e);s.ref=o},Xi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Zi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qi=(e,t,n,r)=>{let i=e._zod.def;li(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$i={string:gi,number:_i,boolean:vi,bigint:yi,symbol:bi,null:xi,undefined:Si,void:Ci,never:wi,any:Ti,unknown:Ei,date:Di,enum:Oi,literal:ki,nan:Ai,template_literal:ji,file:Mi,success:Ni,custom:Pi,function:Fi,transform:Ii,map:Li,set:Ri,array:zi,object:Bi,union:Vi,intersection:Hi,tuple:Ui,record:Wi,nullable:Gi,nonoptional:O,default:Ki,prefault:qi,catch:Ji,pipe:Yi,readonly:Xi,promise:Zi,optional:Qi,lazy:(e,t,n,r)=>{let i=e._zod.innerType;li(i,t,r);let a=t.seen.get(e);a.ref=i}};function ea(e,t){if(`_idmap`in e){let n=e,r=ci({...t,processors:$i}),i={};for(let e of n._idmap.entries()){let[t,n]=e;li(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;ui(r,n),a[t]=di(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ci({...t,processors:$i});return li(e,n),ui(n,e),di(n,e)}var ta=T(`ZodISODateTime`,(e,t)=>{_n.init(e,t),Oa.init(e,t)});function na(e){return Lr(ta,e)}var ra=T(`ZodISODate`,(e,t)=>{vn.init(e,t),Oa.init(e,t)});function ia(e){return Rr(ra,e)}var aa=T(`ZodISOTime`,(e,t)=>{yn.init(e,t),Oa.init(e,t)});function oa(e){return zr(aa,e)}var sa=T(`ZodISODuration`,(e,t)=>{bn.init(e,t),Oa.init(e,t)});function ca(e){return Br(sa,e)}var la=T(`ZodError`,(e,t)=>{Xe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>$e(e,t)},flatten:{value:t=>Qe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,E,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,E,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ua=et(la),da=tt(la),fa=nt(la),pa=it(la),ma=ot(la),ha=st(la),ga=ct(la),_a=lt(la),va=ut(la),ya=dt(la),ba=ft(la),xa=pt(la),Sa=new WeakMap;function Ca(e,t,n){let r=Object.getPrototypeOf(e),i=Sa.get(r);if(i||(i=new Set,Sa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var wa=T(`ZodType`,(e,t)=>(nn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:mi(e,`input`),output:mi(e,`output`)}}),e.toJSONSchema=pi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>ua(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>fa(e,t,n),e.parseAsync=async(t,n)=>da(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>pa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ma(e,t,n),e.decode=(t,n)=>ha(e,t,n),e.encodeAsync=async(t,n)=>ga(e,t,n),e.decodeAsync=async(t,n)=>_a(e,t,n),e.safeEncode=(t,n)=>va(e,t,n),e.safeDecode=(t,n)=>ya(e,t,n),e.safeEncodeAsync=async(t,n)=>ba(e,t,n),e.safeDecodeAsync=async(t,n)=>xa(e,t,n),Ca(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ce(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ne(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ko(e,t))},superRefine(e,t){return this.check(Ao(e,t))},overwrite(e){return this.check(Qr(e))},optional(){return fo(this)},exactOptional(){return mo(this)},nullable(){return go(this)},nullish(){return fo(go(this))},nonoptional(e){return So(this,e)},array(){return $a(this)},or(e){return ro([this,e])},and(e){return ao(this,e)},transform(e){return To(this,lo(e))},default(e){return vo(this,e)},prefault(e){return bo(this,e)},catch(e){return wo(this,e)},pipe(e){return To(this,e)},readonly(){return Do(this)},describe(e){let t=this.clone();return pr.add(t,{description:e}),t},meta(...e){if(e.length===0)return pr.get(this);let t=this.clone();return pr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return pr.get(e)?.description},configurable:!0}),e)),Ta=T(`_ZodString`,(e,t)=>{rn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ca(e,`_ZodString`,{regex(...e){return this.check(Kr(...e))},includes(...e){return this.check(Yr(...e))},startsWith(...e){return this.check(Xr(...e))},endsWith(...e){return this.check(Zr(...e))},min(...e){return this.check(Wr(...e))},max(...e){return this.check(Ur(...e))},length(...e){return this.check(Gr(...e))},nonempty(...e){return this.check(Wr(1,...e))},lowercase(e){return this.check(qr(e))},uppercase(e){return this.check(Jr(e))},trim(){return this.check(ei())},normalize(...e){return this.check($r(...e))},toLowerCase(){return this.check(ti())},toUpperCase(){return this.check(ni())},slugify(){return this.check(ri())}})}),Ea=T(`ZodString`,(e,t)=>{rn.init(e,t),Ta.init(e,t),e.email=t=>e.check(hr(ka,t)),e.url=t=>e.check(xr(Ma,t)),e.jwt=t=>e.check(Ir(qa,t)),e.emoji=t=>e.check(Sr(Na,t)),e.guid=t=>e.check(gr(Aa,t)),e.uuid=t=>e.check(_r(ja,t)),e.uuidv4=t=>e.check(vr(ja,t)),e.uuidv6=t=>e.check(yr(ja,t)),e.uuidv7=t=>e.check(br(ja,t)),e.nanoid=t=>e.check(Cr(Pa,t)),e.guid=t=>e.check(gr(Aa,t)),e.cuid=t=>e.check(wr(Fa,t)),e.cuid2=t=>e.check(Tr(Ia,t)),e.ulid=t=>e.check(Er(La,t)),e.base64=t=>e.check(Nr(Wa,t)),e.base64url=t=>e.check(Pr(Ga,t)),e.xid=t=>e.check(Dr(Ra,t)),e.ksuid=t=>e.check(Or(za,t)),e.ipv4=t=>e.check(kr(Ba,t)),e.ipv6=t=>e.check(Ar(Va,t)),e.cidrv4=t=>e.check(jr(Ha,t)),e.cidrv6=t=>e.check(Mr(Ua,t)),e.e164=t=>e.check(Fr(Ka,t)),e.datetime=t=>e.check(na(t)),e.date=t=>e.check(ia(t)),e.time=t=>e.check(oa(t)),e.duration=t=>e.check(ca(t))});function Da(e){return mr(Ea,e)}var Oa=T(`ZodStringFormat`,(e,t)=>{an.init(e,t),Ta.init(e,t)}),ka=T(`ZodEmail`,(e,t)=>{cn.init(e,t),Oa.init(e,t)}),Aa=T(`ZodGUID`,(e,t)=>{on.init(e,t),Oa.init(e,t)}),ja=T(`ZodUUID`,(e,t)=>{sn.init(e,t),Oa.init(e,t)}),Ma=T(`ZodURL`,(e,t)=>{ln.init(e,t),Oa.init(e,t)}),Na=T(`ZodEmoji`,(e,t)=>{un.init(e,t),Oa.init(e,t)}),Pa=T(`ZodNanoID`,(e,t)=>{dn.init(e,t),Oa.init(e,t)}),Fa=T(`ZodCUID`,(e,t)=>{fn.init(e,t),Oa.init(e,t)}),Ia=T(`ZodCUID2`,(e,t)=>{pn.init(e,t),Oa.init(e,t)}),La=T(`ZodULID`,(e,t)=>{mn.init(e,t),Oa.init(e,t)}),Ra=T(`ZodXID`,(e,t)=>{hn.init(e,t),Oa.init(e,t)}),za=T(`ZodKSUID`,(e,t)=>{gn.init(e,t),Oa.init(e,t)}),Ba=T(`ZodIPv4`,(e,t)=>{xn.init(e,t),Oa.init(e,t)}),Va=T(`ZodIPv6`,(e,t)=>{Sn.init(e,t),Oa.init(e,t)}),Ha=T(`ZodCIDRv4`,(e,t)=>{Cn.init(e,t),Oa.init(e,t)}),Ua=T(`ZodCIDRv6`,(e,t)=>{wn.init(e,t),Oa.init(e,t)}),Wa=T(`ZodBase64`,(e,t)=>{En.init(e,t),Oa.init(e,t)}),Ga=T(`ZodBase64URL`,(e,t)=>{On.init(e,t),Oa.init(e,t)}),Ka=T(`ZodE164`,(e,t)=>{kn.init(e,t),Oa.init(e,t)}),qa=T(`ZodJWT`,(e,t)=>{jn.init(e,t),Oa.init(e,t)}),Ja=T(`ZodUnknown`,(e,t)=>{Mn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ya(){return Vr(Ja)}var Xa=T(`ZodNever`,(e,t)=>{Nn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Za(e){return Hr(Xa,e)}var Qa=T(`ZodArray`,(e,t)=>{Fn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.element=t.element,Ca(e,`ZodArray`,{min(e,t){return this.check(Wr(e,t))},nonempty(e){return this.check(Wr(1,e))},max(e,t){return this.check(Ur(e,t))},length(e,t){return this.check(Gr(e,t))},unwrap(){return this.element}})});function $a(e,t){return ii(Qa,e,t)}var eo=T(`ZodObject`,(e,t)=>{Bn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),xe(e,`shape`,()=>t.shape),Ca(e,`ZodObject`,{keyof(){return so(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ya()})},loose(){return this.clone({...this._zod.def,catchall:Ya()})},strict(){return this.clone({...this._zod.def,catchall:Za()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Le(this,e)},safeExtend(e){return Re(this,e)},merge(e){return ze(this,e)},pick(e){return Fe(this,e)},omit(e){return Ie(this,e)},partial(...e){return Be(uo,this,e[0])},required(...e){return Ve(xo,this,e[0])}})});function to(e,t){return new eo({type:`object`,shape:e??{},...D(t)})}var no=T(`ZodUnion`,(e,t)=>{Hn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.options=t.options});function ro(e,t){return new no({type:`union`,options:e,...D(t)})}var io=T(`ZodIntersection`,(e,t)=>{Un.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r)});function ao(e,t){return new io({type:`intersection`,left:e,right:t})}var oo=T(`ZodEnum`,(e,t)=>{Kn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new oo({...t,checks:[],...D(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new oo({...t,checks:[],...D(r),entries:i})}});function so(e,t){return new oo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...D(t)})}var co=T(`ZodTransform`,(e,t)=>{qn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new pe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Je(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Je(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function lo(e){return new co({type:`transform`,transform:e})}var uo=T(`ZodOptional`,(e,t)=>{Yn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fo(e){return new uo({type:`optional`,innerType:e})}var po=T(`ZodExactOptional`,(e,t)=>{Xn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mo(e){return new po({type:`optional`,innerType:e})}var ho=T(`ZodNullable`,(e,t)=>{Zn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function go(e){return new ho({type:`nullable`,innerType:e})}var _o=T(`ZodDefault`,(e,t)=>{Qn.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vo(e,t){return new _o({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ae(t)}})}var yo=T(`ZodPrefault`,(e,t)=>{er.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e,t){return new yo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ae(t)}})}var xo=T(`ZodNonOptional`,(e,t)=>{tr.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>O(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e,t){return new xo({type:`nonoptional`,innerType:e,...D(t)})}var Co=T(`ZodCatch`,(e,t)=>{rr.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wo(e,t){return new Co({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var k=T(`ZodPipe`,(e,t)=>{ir.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.in=t.in,e.out=t.out});function To(e,t){return new k({type:`pipe`,in:e,out:t})}var Eo=T(`ZodReadonly`,(e,t)=>{or.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Do(e){return new Eo({type:`readonly`,innerType:e})}var Oo=T(`ZodCustom`,(e,t)=>{cr.init(e,t),wa.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r)});function ko(e,t={}){return ai(Oo,e,t)}function Ao(e,t){return oi(e,t)}var jo=[`proposal.md`,`design.md`,`tasks.md`],Mo=/^specs\/([a-z0-9]+(?:-[a-z0-9]+)*)\/spec\.md$/,No=to({tool:so([{name:`edit_artifact`,description:"Propose a markdown edit to one artifact of this change. `artifact` is one of `proposal.md`, `design.md`, `tasks.md`, or `specs/<capability>/spec.md` — it must be an artifact the change already has. `text` is the markdown, exactly as it should sit in the file. `mode` is `replace` for the whole file or `append` to add at the end."},{name:`add_task_group`,description:"Propose a group of implementation tasks, appended to `tasks.md`. `title` and `tasks` are required; one group per coherent area, each task a single concrete action. `capability` + `requirement` are optional and go together — name both to cite the requirement the group implements, or neither for a chore group."},{name:`add_requirement`,description:"Propose a requirement, appended to a delta spec. `capability` must be one the change already has a delta spec for. `block` must be full markdown: a `### Requirement:` heading, RFC-2119 SHALL text, and at least one `#### Scenario:` with WHEN/THEN steps."}].map(e=>e.name)).describe(`Which kind of edit to propose.`),artifact:Da().optional().describe(`edit_artifact: the artifact this edit is against.`),mode:Da().optional().describe("edit_artifact: `replace` or `append`. Defaults to append."),text:Da().optional().describe(`edit_artifact: the markdown, exactly as it should read.`),title:Da().optional().describe(`add_task_group: the group heading.`),tasks:$a(Da()).optional().describe(`add_task_group: task titles, one per task, each one concrete action.`),capability:Da().optional().describe(`add_requirement: the delta spec’s capability. add_task_group: the citation’s.`),requirement:Da().optional().describe("add_task_group: the exact requirement name, as it appears after `### Requirement:`."),block:Da().optional().describe(`add_requirement: the complete requirement block, in markdown.`)});ea(to({answer:Da().describe(`Brief prose for the author: what you proposed and why, or your answer if nothing.`),proposals:$a(No).describe(`The edits to propose. Empty when the turn only answers.`)}),{target:`draft-7`});function Po(e){return e.artifacts===void 0?e.buffers===void 0?e.openCapabilities===void 0?null:[...jo,...e.openCapabilities.map(e=>`specs/${e}/spec.md`)]:Object.keys(e.buffers):e.artifacts}function Fo(e,t){let n=Po(e);return n===null?!0:n.includes(t)}function Io(e){return e.replace(/^\s*\d+(?:\.\d+)*[.)]?\s+/,``).trim()}function Lo(e,t,n){return[n?`## ${e} — implements \`${n.capability}\`: \`${n.key}\``:`## ${e}`,``,...t.map(e=>`- [ ] ${e}`)].join(`
|
|
74
|
+
`)}function Ro(e,t,n){switch(e){case`edit_artifact`:{let r=String(t.artifact??``).trim();if(!(jo.includes(r)||Mo.test(r)))return{kind:`refused`,tool:e,missing:`\`${r}\` is not an artifact of an OpenSpec change`};if(!Fo(n,r))return{kind:`refused`,tool:e,missing:`this change has no \`${r}\``};let i=String(t.text??``);return i.trim()===``?{kind:`refused`,tool:e,missing:`the markdown to write`}:{kind:`artifact-edit`,artifact:r,mode:String(t.mode??``).trim()===`replace`?`replace`:`append`,text:i,tool:e}}case`add_task_group`:{if(!Fo(n,`tasks.md`))return{kind:`refused`,tool:e,missing:"this change has no `tasks.md`"};let r=Io(String(t.title??``)),i=Array.isArray(t.tasks)?t.tasks.map(e=>Io(String(e))).filter(e=>e!==``):[];if(r===``||i.length===0)return{kind:`refused`,tool:e,missing:`a title and at least one task`};let a=String(t.capability??``).trim(),o=String(t.requirement??``).trim();if(a===``&&o===``)return{kind:`artifact-edit`,artifact:`tasks.md`,mode:`append`,text:Lo(r,i,null),tool:e};if(a===``||o===``)return{kind:`refused`,tool:e,missing:`both a capability and a requirement name, or neither`};if(n.citable!==void 0&&!n.citable.some(e=>e.capability===a&&e.key===o))return{kind:`refused`,tool:e,missing:`\`${o}\` in \`${a}\` is not a requirement this change declares`};let s={capability:a,key:o};return{kind:`artifact-edit`,artifact:`tasks.md`,mode:`append`,text:Lo(r,i,s),tool:e,cites:s}}case`add_requirement`:{let r=String(t.capability??``).trim(),i=`specs/${r}/spec.md`;if(r===``||!Mo.test(i))return{kind:`refused`,tool:e,missing:`a capability name`};if(!Fo(n,i))return{kind:`refused`,tool:e,missing:`this change has no delta spec for \`${r}\``};let a=String(t.block??``).trim();return/^###[ \t]+Requirement:/m.test(a)?{kind:`artifact-edit`,artifact:i,mode:`append`,text:a,tool:e}:{kind:`refused`,tool:e,missing:"a `### Requirement:` heading"}}default:return{kind:`refused`,tool:e,missing:`no such tool \`${e}\``}}}function zo(e,t){return t.kind===`refused`?e:t.mode===`replace`||e===``?t.text:`${e.replace(/\s*$/,``)}\n\n${t.text}\n`}function Bo(e,t){let n=e===``?[]:e.split(`
|
|
75
|
+
`),r=t===``?[]:t.split(`
|
|
76
|
+
`),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a+=1;return[...n.slice(Math.max(0,i-2),i).map(e=>({kind:`context`,text:e})),...n.slice(i,n.length-a).map(e=>({kind:`removed`,text:e})),...r.slice(i,r.length-a).map(e=>({kind:`added`,text:e})),...n.slice(n.length-a,n.length-a+2).map(e=>({kind:`context`,text:e}))]}function Vo(e){let{proposal:t}=e;if(t.kind===`refused`)return(0,C.jsx)(`div`,{className:`proposal-card proposal-refused`,"data-testid":`agent-proposal-refused`,role:`note`,children:(0,C.jsxs)(`p`,{"data-testid":`agent-proposal-refused-text`,children:[`refused — `,(0,C.jsx)(`code`,{children:t.tool}),` needs `,t.missing,`. Nothing was proposed and nothing was written.`]})});let n=zo(e.current,t);return(0,C.jsxs)(`div`,{className:`proposal-card`,"data-testid":`agent-proposal`,"data-artifact":t.artifact,children:[(0,C.jsxs)(`p`,{className:`proposal-target`,"data-testid":`agent-proposal-target`,children:[`a markdown edit to `,(0,C.jsx)(`code`,{children:t.artifact}),t.cites?(0,C.jsxs)(C.Fragment,{children:[` `,`— implements `,(0,C.jsx)(`code`,{children:t.cites.key})]}):null]}),(0,C.jsx)(`pre`,{className:`proposal-diff`,"data-testid":`agent-proposal-diff-${e.testId}`,children:Bo(e.current,n).map((e,t)=>(0,C.jsxs)(`div`,{className:`diff-line diff-${e.kind}`,"data-diff":e.kind,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,children:e.kind===`added`?`+`:e.kind===`removed`?`-`:` `}),e.text]},t))}),(0,C.jsxs)(`div`,{className:`proposal-actions`,children:[(0,C.jsx)(`button`,{type:`button`,"data-testid":`agent-accept-${e.testId}`,disabled:e.settled!==null,onClick:e.onAccept,children:e.settled===`accepted`?`accepted`:`accept`}),(0,C.jsx)(`button`,{type:`button`,"data-testid":`agent-decline-${e.testId}`,disabled:e.settled!==null,onClick:e.onDecline,children:`decline`})]})]})}var Ho=`change`,Uo=`folded`,Wo=[`proposal.md`,`design.md`,`tasks.md`];function Go(e){let t=0;for(let n of e.split(`
|
|
77
|
+
`))/^###[ \t]+Requirement:/.test(n)&&(t+=1);return t}function Ko(e){let t=0,n=0;for(let r of e.split(`
|
|
78
|
+
`)){let e=/^\s*[-*+]\s+\[([ xX])\]\s/.exec(r);e&&(n+=1,e[1].toLowerCase()===`x`&&(t+=1))}return{done:t,total:n}}function qo(e){let t=0;for(let n of e.split(`
|
|
79
|
+
`))/^#{1,6}[ \t]+\S/.test(n)&&(t+=1);return t}function Jo(e,t){if(e===`tasks.md`){let{done:e,total:n}=Ko(t);return`${e}/${n}`}return e.endsWith(`/spec.md`)?`${Go(t)} req`:`${qo(t)} sections`}function Yo(e){return/^specs\/([^/]+)\/spec\.md$/.exec(e)?.[1]??null}function Xo(e){let t=Wo.flatMap(t=>{let n=e.find(e=>e.artifact===t);return n===void 0?[]:[{id:`${Ho}:${t}`,label:t,status:Jo(t,n.content),directory:!1,artifact:t,readOnly:!1,children:[]}]}),n=e.flatMap(e=>{let t=Yo(e.artifact);return t===null?[]:[{capability:t,buffer:e}]}).sort((e,t)=>e.capability<t.capability?-1:+(e.capability>t.capability)),r=n.length===0?[]:[{id:`${Ho}:specs`,label:`specs/`,status:`${n.length}`,directory:!0,artifact:null,readOnly:!1,children:n.map(({capability:e,buffer:t})=>({id:`${Ho}:specs/${e}`,label:`${e}/`,status:`1`,directory:!0,artifact:null,readOnly:!1,children:[{id:`${Ho}:${t.artifact}`,label:`spec.md`,status:Jo(t.artifact,t.content),directory:!1,artifact:t.artifact,readOnly:!1,children:[]}]}))}],i=t.filter(e=>e.artifact===`tasks.md`);return[...t.filter(e=>e.artifact!==`tasks.md`),...r,...i]}function Zo(e){return[...e].sort((e,t)=>e.capability<t.capability?-1:+(e.capability>t.capability)).map(e=>({id:`${Uo}:${e.capability}`,label:`${e.capability}/`,status:`1`,directory:!0,artifact:null,readOnly:!0,children:[{id:`${Uo}:${e.capability}/spec.md`,label:`spec.md`,status:Jo(`specs/x/spec.md`,e.content),directory:!1,artifact:`${Uo}:${e.capability}/spec.md`,readOnly:!0,children:[]}]}))}function Qo(e){let t=Xo(e.artifacts),n=Zo(e.folded);return[{id:Ho,label:e.changeId,status:`change`,directory:!0,artifact:null,readOnly:!1,children:t},{id:Uo,label:`openspec/specs/`,status:`folded — read only`,directory:!0,artifact:null,readOnly:!0,children:n}]}function $o(e){return e.flatMap(e=>[e,...$o(e.children)])}function es(e,t){return $o(e).find(e=>e.id===t)??null}var ts=Object.freeze({file:`proposal.md`,ofChange:!0,capability:null});function ns(e){return/^specs\/([^/]+)\/spec\.md$/.exec(e)?.[1]??null}function rs(e){let t=e.artifact;if(t.startsWith(`folded:`)){let e=t.slice(Uo.length+1);return{file:`openspec/specs/${e}`,ofChange:!1,capability:e.split(`/`)[0]??null}}return{file:t,ofChange:!0,capability:ns(t)}}function is(e,t){if(t===null)return ts;let n=es(e,t);if(n===null)return ts;if(n.artifact!==null)return rs(n);let r=$o(n.children).find(e=>e.artifact!==null);return r===void 0?ts:rs(r)}function as(e){return e.ofChange?e.file:`${e.file} (folded, read only)`}var os={id:`openspec-conventions`,label:`What does an OpenSpec change contain?`};function ss(e){return e.ofChange?e.file===`proposal.md`?[{id:`reconcile-proposal`,label:`Reconcile this draft against the proposal template`},{id:`summarize-why`,label:`Summarize why this change exists`},os]:e.file===`design.md`?[{id:`scaffold-design`,label:`Scaffold this design document`},os]:e.file===`tasks.md`?[{id:`plan-implementation`,label:`Plan the implementation of this change`},{id:`summarize-tasks`,label:`Summarize the remaining tasks`},os]:[{id:`draft-requirement`,label:`Draft a requirement into this delta spec`},{id:`folded-requirements`,label:`What does the folded capability already require?`},os]:[{id:`folded-requirements`,label:`What does this folded capability already require?`},{id:`reuse-folded`,label:`Which of these requirements can this change consume?`},os]}function cs(e){return Math.min(32,Math.max(8,e))}var ls={change:`this change's`,folded:`folded, for reference`,setting:`a setting`,derived:`derived from the change`};function us(e){let[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)({}),[d,f]=(0,_.useState)(16),p=(0,_.useRef)(null),m=(0,_.useRef)(!1),h=ne(e.machine,e.selection),g=h.kind===`in-use`,v=(0,_.useCallback)(e=>{if(!m.current)return;let t=(window.innerHeight-e.clientY)/16;f(cs(t))},[]),y=(0,_.useCallback)(()=>{m.current=!1},[]);(0,_.useEffect)(()=>(window.addEventListener(`pointermove`,v),window.addEventListener(`pointerup`,y),()=>{window.removeEventListener(`pointermove`,v),window.removeEventListener(`pointerup`,y)}),[v,y]);let b=()=>{n(!1),p.current?.focus()},x=async t=>{if(!(t===``||!e.onRunTurn||s)){c(!0),o(``);try{let n=await e.onRunTurn(t);i(e=>[...e,{kind:`turn`,prompt:t,turn:n}])}catch(e){i(n=>[...n,{kind:`turn`,prompt:t,turn:{kind:`failed`,answer:``,served:``,proposals:[],reason:e instanceof Error?e.message:String(e)}}])}finally{c(!1)}}},ee=[...e.entries,...r];return(0,C.jsxs)(`aside`,{className:`workbench-rail`,"data-testid":`rail`,"aria-label":`Agent rail`,style:{"--rail-height":`${d}rem`},children:[(0,C.jsx)(`div`,{className:`rail-resize`,"data-testid":`rail-resize`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize the agent rail`,onPointerDown:e=>{m.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},onKeyDown:e=>{e.key===`ArrowUp`&&f(e=>cs(e+2)),e.key===`ArrowDown`&&f(e=>cs(e-2))},tabIndex:0}),(0,C.jsxs)(`div`,{className:`rail-head`,children:[(0,C.jsx)(`span`,{className:`workbench-col-label`,children:`Agent`}),(0,C.jsxs)(`p`,{className:`rail-scope`,"data-testid":`rail-scope`,children:[`scoped to `,(0,C.jsx)(`code`,{children:as(e.scope)})]}),(0,C.jsxs)(`div`,{className:`rail-head-actions`,children:[e.onOpenSettings===void 0?null:(0,C.jsx)(`button`,{type:`button`,className:`rail-settings-open`,"data-testid":`settings-open`,"aria-label":`Workbench settings`,onClick:e.onOpenSettings,children:`settings…`}),(0,C.jsx)(`button`,{type:`button`,className:`rail-settings-open`,"data-testid":`rail-settings`,"aria-label":`Model credential settings`,"aria-expanded":t,ref:p,onClick:()=>t?b():n(!0),children:`credential`}),(0,C.jsx)(`button`,{type:`button`,className:`rail-close`,"data-testid":`rail-close`,onClick:e.onClose,children:`close`})]})]}),t?(0,C.jsx)(de,{machine:e.machine,credential:h,selection:e.selection,onSelect:e.onSelectSource,onClear:e.onClearSelection,onClose:b}):null,g?null:(0,C.jsxs)(`div`,{className:`rail-no-model`,"data-testid":`rail-no-model`,role:`note`,children:[(0,C.jsx)(`p`,{children:`No model is available on this machine, so the rail cannot answer. This is not an empty transcript — nothing ran.`}),(0,C.jsx)(`ul`,{className:`rail-no-model-why`,"data-testid":`rail-no-model-why`,children:e.machine.rows.map(e=>(0,C.jsxs)(`li`,{"data-testid":`rail-no-model-${e.id}`,children:[e.label,` —`,` `,e.status.kind===`available`?e.detail:`unavailable, ${e.detail}`]},e.id))})]}),e.handoff===void 0?null:(0,C.jsxs)(`div`,{className:`rail-context`,"data-testid":`rail-context`,children:[(0,C.jsx)(`span`,{className:`rail-context-label`,children:e.handoff.inputs.length===0?`this stage reads nothing, and writes nothing`:`before this turn, the rail will read`}),(0,C.jsx)(`ul`,{className:`rail-context-pills`,"data-testid":`rail-context-pills`,children:e.handoff.inputs.map(t=>(0,C.jsxs)(`li`,{className:`rail-context-pill`,"data-testid":`rail-context-${t.name}`,"data-kind":t.kind,"data-present":t.present?`true`:`false`,children:[(0,C.jsx)(`button`,{type:`button`,className:`rail-context-open`,disabled:e.onOpenFile===void 0||!t.present,onClick:()=>e.onOpenFile?.(t.name),children:t.name}),(0,C.jsx)(`span`,{className:`rail-context-kind`,children:ls[t.kind]}),t.present?null:(0,C.jsx)(`span`,{className:`rail-context-absent`,"data-testid":`rail-context-absent-${t.name}`,children:`absent`})]},t.name))}),e.handoff.reduced===null?null:(0,C.jsx)(`p`,{className:`rail-context-reduced`,"data-testid":`rail-context-reduced`,role:`note`,children:e.handoff.reduced})]}),(0,C.jsx)(`div`,{className:`rail-transcript`,"data-testid":`rail-transcript`,children:ee.map((t,n)=>t.kind===`note`?(0,C.jsx)(`div`,{className:`rail-exchange rail-note`,"data-testid":`rail-note`,children:(0,C.jsx)(`p`,{children:t.text})},n):t.kind===`refusal`?(0,C.jsx)(`div`,{className:`rail-exchange rail-refusal`,"data-testid":`rail-refusal`,children:(0,C.jsx)(`p`,{children:t.text})},n):(0,C.jsxs)(`div`,{className:`rail-exchange`,"data-testid":`agent-live-exchange`,children:[(0,C.jsx)(`p`,{className:`rail-q`,children:t.prompt}),(0,C.jsx)(`p`,{className:`rail-answer`,"data-testid":`agent-live-answer`,children:t.turn.kind===`failed`?`the turn failed — ${t.turn.reason??`no reason given`}`:t.turn.kind===`no-credential`?`no model is configured, so no turn ran`:t.turn.answer}),t.turn.kind===`cut-short`?(0,C.jsx)(`p`,{className:`rail-cut-short`,"data-testid":`agent-cut-short`,role:`alert`,children:`cut short — the agent was still working when the tool-round limit was reached`}):null,(t.turn.read??[]).length===0?(0,C.jsx)(`p`,{className:`rail-unsourced`,"data-testid":`agent-unsourced`,children:`unsourced — this answer read no file, and is the model's own knowledge rather than a reading of this repository`}):(0,C.jsxs)(`div`,{className:`rail-sources`,"data-testid":`agent-sources`,children:[(0,C.jsx)(`span`,{className:`rail-sources-label`,children:`read`}),(0,C.jsx)(`ul`,{children:(t.turn.read??[]).map(t=>(0,C.jsx)(`li`,{children:(0,C.jsx)(`button`,{type:`button`,className:`rail-source-open`,"data-testid":`agent-source-${t}`,disabled:e.onOpenFile===void 0,onClick:()=>e.onOpenFile?.(t),children:t})},t))})]}),t.turn.assumed===void 0?null:(0,C.jsxs)(`p`,{className:`rail-assumed`,"data-testid":`agent-assumed`,role:`note`,children:[`assumed, in place of reading — `,t.turn.assumed]}),(0,C.jsx)(`p`,{className:`rail-served`,"data-testid":`agent-live-served`,children:t.turn.served===``?`nothing served this turn`:`served by ${t.turn.served}`}),t.turn.proposals.map((t,r)=>{let i=`${n}-${r}`,a=t.kind===`refused`?``:t.artifact;return l[i]===`declined`?null:(0,C.jsx)(Vo,{testId:i,proposal:t,current:e.buffers[a]??``,settled:l[i]??null,onAccept:()=>{l[i]===void 0&&(e.onAccept(t),u(e=>({...e,[i]:`accepted`})))},onDecline:()=>u(e=>({...e,[i]:`declined`}))},i)})]},n))}),(0,C.jsx)(`div`,{className:`rail-prompts`,"data-testid":`rail-prompts`,children:ss(e.scope).map(t=>(0,C.jsx)(`button`,{type:`button`,"data-testid":`rail-prompt-${t.id}`,disabled:!g||s||!e.onRunTurn,onClick:()=>void x(t.label),children:t.label},t.id))}),(0,C.jsxs)(`div`,{className:`rail-ask`,"data-testid":`rail-ask`,children:[(0,C.jsx)(`textarea`,{"data-testid":`rail-ask-input`,disabled:!g||s||!e.onRunTurn,onChange:e=>o(e.target.value),placeholder:g?`ask about ${e.scope.file}…`:`no model is configured`,rows:2,value:a}),(0,C.jsx)(`button`,{"aria-busy":s,"data-state":s?`thinking`:`idle`,"data-testid":`rail-ask-send`,disabled:!g||s||a.trim()===``||!e.onRunTurn,onClick:()=>void x(a.trim()),type:`button`,children:s?`thinking…`:`ask`})]})]})}var ds=Object.freeze([]),A=class{type;isNamed;isError;isMissing;startOffset;endOffset;startRow;startCol;endRow;endCol;_children=null;parent=null;_childIndex=-1;_fields=null;_childFieldNames=null;_namedChildren=null;_source;constructor(e,t,n,r,i,a,o=!0,s=!1,c=!1){this.type=e,this._source=t,this.startOffset=n,this.endOffset=r,this.startRow=i.row,this.startCol=i.column,this.endRow=a.row,this.endCol=a.column,this.isNamed=o,this.isError=s,this.isMissing=c}get text(){return this._source.slice(this.startOffset,this.endOffset)}get startPosition(){return{row:this.startRow,column:this.startCol}}set startPosition(e){this.startRow=e.row,this.startCol=e.column}get endPosition(){return{row:this.endRow,column:this.endCol}}set endPosition(e){this.endRow=e.row,this.endCol=e.column}get children(){return this._children??ds}set children(e){this._children=e}get namedChildren(){return this._namedChildren||=this.children.filter(e=>e.isNamed),this._namedChildren}get previousSibling(){return!this.parent||this._childIndex<=0?null:this.parent.children[this._childIndex-1]}get nextSibling(){if(!this.parent)return null;let e=this.parent.children;return this._childIndex<e.length-1?e[this._childIndex+1]:null}childForFieldName(e){if(!this._fields)return null;let t=this._fields.get(e);return!t||t.length===0?null:this.children[t[0]]??null}childrenForFieldName(e){if(!this._fields)return[];let t=this._fields.get(e);return t?t.map(e=>this.children[e]).filter(Boolean):[]}get hasError(){return this.isError||this.isMissing?!0:this.children.some(e=>e.hasError)}fieldNameForChild(e){if(!this._fields)return null;if(!this._childFieldNames){this._childFieldNames=new Map;for(let[e,t]of this._fields)for(let n of t)this._childFieldNames.set(n,e)}return this._childFieldNames.get(e)??null}appendChild(e,t){this._children||=[];let n=this._children.length;if(e.parent=this,e._childIndex=n,this._children.push(e),this.endRow=e.endRow,this.endCol=e.endCol,this.endOffset=e.endOffset,t){this._fields||=new Map;let e=this._fields.get(t);e||(e=[],this._fields.set(t,e)),e.push(n)}}finalize(){}toSExp(){return fs(this)}toVerboseSExp(){return ps(this,0)}};function fs(e){let t=[];for(let n=0;n<e.children.length;n++){let r=e.children[n];if(!r.isNamed&&!r.isError&&!r.isMissing)continue;let i=e.fieldNameForChild(n),a=r.children.length>0||r.isError?fs(r):r.isMissing?`(MISSING ${r.type})`:`(${r.type})`;i?t.push(`${i}: ${a}`):t.push(a)}return e.isError?t.length===0?`(ERROR)`:`(ERROR ${t.join(` `)})`:e.isMissing?`(MISSING ${e.type})`:t.length===0?`(${e.type})`:`(${e.type} ${t.join(` `)})`}function ps(e,t){let n=` `.repeat(t);if(e.isMissing)return`${n}(MISSING ${JSON.stringify(e.type)})`;if(e.isError&&e.children.length===0)return`${n}(ERROR)`;if(e.children.length===0){let t=e.text,r=t.length>20?t.slice(0,20)+`…`:t,i=JSON.stringify(r);return`${n}(${e.type} ${i})`}let r=[];for(let n of e.children)r.push(ps(n,t+1));return`${n}(${e.type}\n${r.join(`
|
|
80
|
+
`)})`}var j;(function(e){e.NEWLINE=`NEWLINE`,e.INDENT=`INDENT`,e.DEDENT=`DEDENT`,e.EOF=`EOF`,e.ID=`ID`,e.NUMBER=`NUMBER`,e.STRING=`STRING`,e.STRING_CONTENT=`STRING_CONTENT`,e.ESCAPE_SEQUENCE=`ESCAPE_SEQUENCE`,e.DATETIME=`DATETIME`,e.TEMPLATE_CONTENT=`TEMPLATE_CONTENT`,e.PLUS=`PLUS`,e.MINUS=`MINUS`,e.STAR=`STAR`,e.SLASH=`SLASH`,e.DOT=`DOT`,e.COMMA=`COMMA`,e.COLON=`COLON`,e.EQ=`EQ`,e.EQEQ=`EQEQ`,e.NEQ=`NEQ`,e.LT=`LT`,e.GT=`GT`,e.LTE=`LTE`,e.GTE=`GTE`,e.ARROW=`ARROW`,e.ELLIPSIS=`ELLIPSIS`,e.PERCENT=`PERCENT`,e.PIPE=`PIPE`,e.AT=`AT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACKET=`LBRACKET`,e.RBRACKET=`RBRACKET`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.TEMPLATE_EXPR_START=`TEMPLATE_EXPR_START`,e.DASH_SPACE=`DASH_SPACE`,e.DQUOTE=`DQUOTE`,e.COMMENT=`COMMENT`,e.ERROR_TOKEN=`ERROR_TOKEN`})(j||={});function ms(e,t){return e.kind===t}function M(e){return{start:{line:e.startRow,character:e.startCol},end:{line:e.endRow,character:e.endCol}}}var N;(function(e){e[e.Error=1]=`Error`,e[e.Warning=2]=`Warning`,e[e.Information=3]=`Information`,e[e.Hint=4]=`Hint`})(N||={});var hs;(function(e){e[e.Unnecessary=1]=`Unnecessary`,e[e.Deprecated=2]=`Deprecated`})(hs||={});var gs=[`len`,`max`,`min`,`json_path`,`lower`,`upper`,`to_json`,`from_json`];new Set(gs);var _s=`Invariant failed`;function vs(e,t){if(!e)throw Error(_s)}var ys=9,bs=10,xs=13,Ss=32,Cs=33,ws=34,Ts=35,Es=45,Ds=46,Os=48,ks=57,As=60,js=61,Ms=62,Ns=65,Ps=90,Fs=92,Is=95,Ls=97,Rs=122,zs=123,Bs=0;function Vs(e){return e>=Ns&&e<=Ps||e>=Ls&&e<=Rs||e===Is}function Hs(e){return Vs(e)||e>=Os&&e<=ks}function Us(e){return e>=Os&&e<=ks}function Ws(e){return e===Ss||e===ys}var Gs=Array(128).fill(0);Gs[43]=j.PLUS,Gs[Es]=j.MINUS,Gs[42]=j.STAR,Gs[47]=j.SLASH,Gs[Ds]=j.DOT,Gs[44]=j.COMMA,Gs[58]=j.COLON,Gs[61]=j.EQ,Gs[60]=j.LT,Gs[Ms]=j.GT,Gs[124]=j.PIPE,Gs[64]=j.AT,Gs[40]=j.LPAREN,Gs[41]=j.RPAREN,Gs[91]=j.LBRACKET,Gs[93]=j.RBRACKET,Gs[zs]=j.LBRACE,Gs[125]=j.RBRACE;var Ks=class{source;offset=0;row=0;col=0;tokens=[];indentStack=[0];onTemplateLine=!1;templateBaseIndent=-1;templateExprBraceDepth=-1;get inTemplateExpr(){return this.templateExprBraceDepth>=0}constructor(e){this.source=e}tokenize(){this.tokens=[];let e=this.source.length/8|0;for(e>64&&(this.tokens.length=e,this.tokens.length=0),this.offset=0,this.row=0,this.col=0,this.indentStack=[0];this.hasMore;)this.tokenizeLine();for(;this.indentStack.length>1;)this.indentStack.pop(),this.emitVirtual(j.DEDENT);return this.emitVirtual(j.EOF),this.tokens}tokenizeLine(){let e=this.consumeIndentation();if(this.consumeNewline())return;let t=this.peekCharCode();if(t===Ts&&(!this.onTemplateLine||e<=this.templateBaseIndent)){let t=this.indentStack[this.indentStack.length-1];if(e>t){if(this.peekNextContentIndent()<e)return this.emitIndentation(t),this.tokenizeComment()}else if(e<t){let t=this.peekNextContentIndent();if(t>e)return this.emitIndentation(t),this.tokenizeComment()}else if(this.peekNextContentIndent()>e)return this.tokenizeComment();return this.emitIndentation(e),this.tokenizeComment()}let n=this.indentStack[this.indentStack.length-1];if(this.onTemplateLine&&e>this.templateBaseIndent&&n>this.templateBaseIndent&&e!==n?this.emitIndentation(n):this.emitIndentation(e),!this.onTemplateLine&&t===Es){let e=this.peekCharCode(1),t=this.offset+1>=this.source.length;(e===Ss||this.atNewline(1)||t)&&this.emit(j.DASH_SPACE,e===Ss?`- `:`-`)}for(;this.hasMore;){if(this.onTemplateLine&&!this.inTemplateExpr){if(this.tokenizeTemplateContent())return;continue}let e=this.peekCharCode();if(this.consumeNewline())return;if(e===xs){vs(!this.atNewline()),this.advance();continue}if(Ws(e)){this.advance();continue}if(e===Fs&&this.atNewline(1)){for(this.advance(),vs(this.consumeNewline());Ws(this.peekCharCode());)this.advance();continue}if(e===Ts)return this.tokenizeComment();this.tokenizeToken()}}emitIndentation(e){let t=this.indentStack[this.indentStack.length-1];if(e>t)this.indentStack.push(e),this.emitVirtual(j.INDENT);else if(e<t){for(e<=this.templateBaseIndent&&(this.onTemplateLine=!1,this.templateExprBraceDepth=-1);this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>e;)this.indentStack.pop(),this.emitVirtual(j.DEDENT);this.emitVirtual(j.NEWLINE)}else e<=this.templateBaseIndent&&(this.onTemplateLine=!1,this.templateExprBraceDepth=-1),this.tokens.length>0&&this.emitVirtual(j.NEWLINE)}tokenizeToken(){let e=this.peekCharCode();if(Us(e)){if(this.tryDatetime())return;this.tokenizeNumber();return}if(Vs(e)){this.tokenizeId();return}if(e===ws){this.tokenizeString();return}if(e===zs&&this.peekCharCode(1)===Cs){this.templateExprBraceDepth=0,this.emit(j.TEMPLATE_EXPR_START,`{!`);return}if(e===Ds){if(this.peekCharCode(1)===Ds&&this.peekCharCode(2)===Ds){this.emit(j.ELLIPSIS,`...`);return}if(Us(this.peekCharCode(1))){let e=this.tokens[this.tokens.length-1];if(!(e!==void 0&&(e.kind===j.ID||e.kind===j.NUMBER||e.kind===j.RPAREN||e.kind===j.RBRACKET))){this.tokenizeNumber();return}}}if(e===Es&&this.peekCharCode(1)===Ms)return this.emit(j.ARROW,`->`);if(this.peekCharCode(1)===js){if(e===js)return this.emit(j.EQEQ,`==`);if(e===Cs)return this.emit(j.NEQ,`!=`);if(e===As)return this.emit(j.LTE,`<=`);if(e===Ms)return this.emit(j.GTE,`>=`)}let t=e<128?Gs[e]:0;if(t){switch(this.emitSpan(t,1),t){case j.PIPE:this.onTemplateLine=!0,this.templateBaseIndent=this.indentStack[this.indentStack.length-1];break;case j.LBRACE:this.inTemplateExpr&&this.templateExprBraceDepth++;break;case j.RBRACE:this.inTemplateExpr&&this.templateExprBraceDepth--;break}return}this.emitSpan(j.ERROR_TOKEN,1)}tokenizeId(){let e=0;for(;Hs(this.peekCharCode(e));e++);this.emitSpan(j.ID,e)}tokenizeNumber(){let e=0,t=this.peekCharCode(e)===Ds;for(t&&e++;Us(this.peekCharCode(e));)e++;for(!t&&this.peekCharCode(e)===Ds&&e++;Us(this.peekCharCode(e));)e++;this.emitSpan(j.NUMBER,e)}tryDatetime(){if(this.source.length-this.offset<10||this.source.charCodeAt(this.offset+4)!==Es||this.source.charCodeAt(this.offset+7)!==Es)return!1;let e=this.source.slice(this.offset,this.offset+30).match(/^\d{4}-\d{2}-\d{2}(T\d{1,2}(:\d{2})?(:\d{2})?(\.\d+)?Z?)?/);if(!e)return!1;let t=e[0];return t.length<10?!1:(this.emit(j.DATETIME,t),!0)}tokenizeString(){let e=this.position,t=this.offset,n=this.peekCharCode();for(this.advance();this.hasMore;){let r=this.peekCharCode();if(r===n){this.advance();let n=this.source.slice(t,this.offset);this.tokens.push(this.makeToken(j.STRING,n,e,this.position,t));return}if(r===Fs){this.advance(2);continue}if(this.atNewline())break;if(r===xs){vs(!this.atNewline()),this.advance();continue}if(r===Bs)break;this.advance()}let r=this.source.slice(t,this.offset);this.tokens.push(this.makeToken(j.STRING,r,e,this.position,t))}tokenizeComment(){let e=this.position,t=this.offset;for(;this.hasMore&&!this.atNewline();)this.advance();let n=this.source.slice(t,this.offset);this.tokens.push(this.makeToken(j.COMMENT,n,e,this.position,t)),this.consumeNewline()}tokenizeTemplateContent(){let e=this.position,t=this.offset;for(;this.hasMore;){let n=this.peekCharCode();if(this.atNewline()||n===xs)return this.flushTemplateContent(t,e),this.consumeNewline()||this.advance(),!0;if(n===zs&&this.peekCharCode(1)===Cs)return this.flushTemplateContent(t,e),this.templateExprBraceDepth=0,this.emit(j.TEMPLATE_EXPR_START,`{!`),!1;this.advance()}return this.flushTemplateContent(t,e),!0}flushTemplateContent(e,t){if(this.offset<=e)return;let n=this.source.slice(e,this.offset);this.tokens.push(this.makeToken(j.TEMPLATE_CONTENT,n,t,this.position,e))}consumeIndentation(){let e=0;for(;this.hasMore;){let t=this.peekCharCode();if(t===Ss)e+=1,this.advance();else if(t===ys)e+=3,this.advance();else if(t===xs)e=0,this.advance();else break}return e}peekNextContentIndent(){let e=this.position,t=this.offset;for(;this.hasMore&&!this.consumeNewline();)this.advance();for(;this.hasMore;){let n=this.consumeIndentation();if(!this.consumeNewline()){if(this.peekCharCode()===Ts){for(;this.hasMore&&!this.consumeNewline();)this.advance();continue}return this.offset=t,this.row=e.row,this.col=e.column,n}}return this.offset=t,this.row=e.row,this.col=e.column,-1}peekCharCode(e=0){return this.source.charCodeAt(this.offset+e)}get hasMore(){return this.offset<this.source.length&&this.offset>=0}advance(e=1){e=Math.max(0,Math.min(e,this.source.length-this.offset)),this.col+=e;for(let t=0;t<e;t++)this.peekCharCode(t)===bs&&(this.row++,this.col=e-t-1);return this.offset+=e,e}consumeNewline(){let e=this.atNewline();return e>0?(vs(this.advance(e)),!0):!1}atNewline(e=0){let t=this.peekCharCode(e);return t===bs?1:t===xs&&this.peekCharCode(e+1)===bs?2:0}get position(){return{row:this.row,column:this.col}}emitSpan(e,t){let n=this.source.slice(this.offset,this.offset+t);return this.emit(e,n)}emit(e,t){let n=this.position,r=this.offset;vs(t===this.source.slice(r,r+t.length),`expected '${t}' but got ${this.source.slice(r,r+t.length)} at offset ${r}`),this.advance(t.length),this.tokens.push(this.makeToken(e,t,n,this.position,r))}emitVirtual(e){return this.emit(e,``)}makeToken(e,t,n,r,i){return{kind:e,text:t,start:n,end:r,startOffset:i}}};function qs(e,t,n,r,i,a){let o=new A(`ERROR`,e,n,r,i,a,!0,!0);for(let e of t)o.appendChild(e);return o}function Js(e,t,n,r){return new A(Zs(e),t,r,r+e.text.length,e.start,e.end,n)}var Ys=new Set([j.ID,j.NUMBER,j.STRING,j.DATETIME,j.COMMENT,j.ELLIPSIS]);function Xs(e,t,n){return Js(e,t,Ys.has(e.kind),n)}function Zs(e){switch(e.kind){case j.ID:return`id`;case j.NUMBER:return`number`;case j.STRING:return`string`;case j.DATETIME:return`datetime_literal`;case j.COMMENT:return`comment`;case j.ELLIPSIS:return`ellipsis`;default:return e.text}}function Qs(e){return e===j.NEWLINE||e===j.DEDENT||e===j.EOF}function $s(e){let t=e.peekOffset(),n=e.peek().start;return new A(`ERROR`,e.source,t,t,n,n,!0,!0)}function ec(e,t){let n=$s(e),r=new A(`atom`,e.source,n.startOffset,n.endOffset,n.startPosition,n.endPosition);r.appendChild(n);let i=new A(`expression`,e.source,r.startOffset,r.endOffset,r.startPosition,r.endPosition);i.appendChild(r),t.appendChild(i,`target`)}function tc(e,t){let n=e.peekOffset(),r=e.peek().start;return new A(t,e.source,n,n,r,r,!0,!1,!0)}function nc(e,t){let n=e.peekOffset(),r=e.peek().start,i=[],a=e.consume(),o=e.currentOffset();for(i.push(new A(a.text,e.source,o,o+a.text.length,a.start,a.end,!1));!e.isAtSyncPoint()&&!dc(e)&&e.peekKind()!==j.COLON;)e.consume();if(e.peekKind()===j.COLON&&e.consume(),e.peekKind()===j.INDENT){e.consume();let n=t(e);if(n)for(let e of n.namedChildren)i.push(e);for(;e.peekKind()===j.COMMENT||e.peekKind()===j.NEWLINE;)e.peekKind()===j.COMMENT?i.push(e.consumeNamed(`comment`)):e.consume();e.peekKind()===j.DEDENT&&e.consume()}e.peekKind()===j.NEWLINE&&e.consume();let s=i.length>0?i[i.length-1].endOffset:e.peekOffset(),c=i.length>0?i[i.length-1].endPosition:e.peek().start;return qs(e.source,i,n,s,r,c)}function rc(e,t){for(;!dc(e)&&e.peekKind()!==j.DEDENT;){if(e.peekKind()===j.NEWLINE){e.consume();continue}if(e.peekKind()===j.INDENT){e.consume(),rc(e,t),e.peekKind()===j.DEDENT&&e.consume();continue}let n=sc(e);if(n)t.appendChild(n);else break}}function ic(e,t){if(e.isAtSyncPoint()||dc(e)||t&&t(e.peekKind(),e.peek().start.row))return null;let n=e.peekOffset(),r=e.peek().start,i=[];for(;!e.isAtSyncPoint()&&!dc(e)&&!(t&&t(e.peekKind(),e.peek().start.row));){let t=e.consume();i.push(Xs(t,e.source,e.currentOffset()))}if(i.length===0)return null;let a=i[i.length-1];return qs(e.source,i,n,a.endOffset,r,a.endPosition)}function ac(e,t){return ic(e,(e,n)=>e===j.INDENT||e===j.COLON||n!==t)}function oc(e,t){return ic(e,(e,n)=>e===j.INDENT||n!==t)}function sc(e){return ic(e)}function cc(e){for(;e.peekKind()===j.NEWLINE;)e.consume()}function lc(e){for(;e.peekKind()===j.NEWLINE||e.peekKind()===j.INDENT||e.peekKind()===j.DEDENT;)e.consume()}function uc(e,t){for(;;)if(e.peekKind()===j.COMMENT)t.appendChild(e.consumeNamed(`comment`));else if(e.peekKind()===j.NEWLINE)e.consume();else break}function dc(e){return e.peekKind()===j.EOF}function fc(e){let t=0;for(;t<50;){let n=e.peekAt(t);if(n.kind===j.EOF||n.kind===j.DEDENT)return!0;if(n.kind===j.COMMENT||n.kind===j.NEWLINE){t++;continue}return!1}return!1}var pc=new Set([`"`,`'`,`\\`,`n`,`r`,`t`,`0`]),mc=new Set([`if`,`else`,`run`,`set`,`with`,`to`,`transition`,`available`,`and`,`or`,`not`,`is`,`True`,`False`,`None`,`mutable`,`linked`,`empty`]);function hc(e){let t=e.peekOffset(),n=e.peek().start,r=new A(`id`,e.source,t,t,n,n,!0,!1,!0),i=new A(`atom`,e.source,t,t,n,n);i.appendChild(r);let a=new A(`expression`,e.source,t,t,n,n);return a.appendChild(i),a}function gc(e){let t=e.peek(),n=e.peekOffset();return new A(`ERROR`,e.source,n,n,t.start,t.start,!0,!0)}function P(e,t=0){let n=_c(e);if(!n)return null;for(;;){let r=e.peekKind();if(r===j.NEWLINE||r===j.DEDENT||r===j.EOF)break;let i=kc(e);if(i<t)break;let a=Ac(e,n,i);if(!a)break;n=a}return n}function _c(e){let t=e.peek();if(t.kind===j.ID&&t.text===`not`)return vc(e,`not`,3);if(t.kind===j.PLUS||t.kind===j.MINUS){let n=t.text;return vc(e,n,7)}return t.kind===j.DASH_SPACE?vc(e,`-`,7):t.kind===j.STAR?yc(e):t.kind===j.LPAREN?bc(e):xc(e)}function vc(e,t,n){let r=e.peek(),i=e.startNode(`unary_expression`);e.addAnonymousChild(i,e.consume());let a=P(e,n+1);return a&&i.appendChild(F(e,a)),e.finishNode(i,r),i}function yc(e){let t=e.peek(),n=e.startNode(`spread_expression`);e.addAnonymousChild(n,e.consume());let r=P(e,8);return r&&n.appendChild(F(e,r),`expression`),e.finishNode(n,t),n}function bc(e){let t=e.peek(),n=e.startNode(`parenthesized_expression`);e.addAnonymousChild(n,e.consume()),lc(e);let r=P(e,0);return r?n.appendChild(F(e,r),`expression`):e.peekKind()===j.RPAREN&&n.appendChild(hc(e),`expression`),lc(e),e.peekKind()===j.RPAREN?e.addAnonymousChild(n,e.consume()):n.appendChild(gc(e)),e.finishNode(n,t),n}function xc(e){let t=e.peek();if(t.kind===j.ID&&(t.text===`True`||t.text===`False`||t.text===`None`)){let n=e.startNode(`atom`);return e.addAnonymousChild(n,e.consume()),e.finishNode(n,t),n}if(t.kind===j.ID&&t.text===`empty`){let n=e.startNode(`empty_keyword`);return e.addAnonymousChild(n,e.consume()),e.finishNode(n,t),n}return t.kind===j.AT?Sc(e):t.kind===j.ID?e.consumeNamed(`id`):t.kind===j.NUMBER?e.consumeNamed(`number`):t.kind===j.DATETIME?e.consumeNamed(`datetime_literal`):t.kind===j.STRING?Cc(e):t.kind===j.ELLIPSIS?e.consumeNamed(`ellipsis`):t.kind===j.LBRACKET?wc(e):t.kind===j.LBRACE?Tc(e):null}function Sc(e){let t=e.peek(),n=e.startNode(`at_id`);return e.addAnonymousChild(n,e.consume()),e.peekKind()===j.ID?n.appendChild(e.consumeNamed(`id`)):n.appendChild(gc(e)),e.finishNode(n,t),n}function Cc(e){let t=e.peek(),n=t,r=e.startNode(`string`),i=t.text,a=e.peekOffset();e.consume();let o=n.start.row,s=n.start.column;r.appendChild(new A(`"`,e.source,a,a+1,{row:o,column:s},{row:o,column:s+1},!1));let c=1,l=i[0],u=i.length>1&&i[i.length-1]===l,d=u?i.length-1:i.length,f=c;for(;c<d;)if(i[c]===`\\`&&c+1<d&&pc.has(i[c+1]))c>f&&r.appendChild(new A(`string_content`,e.source,a+f,a+c,{row:o,column:s+f},{row:o,column:s+c})),r.appendChild(new A(`escape_sequence`,e.source,a+c,a+c+2,{row:o,column:s+c},{row:o,column:s+c+2})),c+=2,f=c;else if(i[c]===`\\`&&c+1<d&&!pc.has(i[c+1])){c>f&&r.appendChild(new A(`string_content`,e.source,a+f,a+c,{row:o,column:s+f},{row:o,column:s+c}));let t=c;for(c+=2;c<d&&/[a-zA-Z0-9_]/.test(i[c]);)c++;let n=new A(`ERROR`,e.source,a+t,a+c,{row:o,column:s+t},{row:o,column:s+c},!0,!0);r.appendChild(n),f=c}else c++;if(c>f&&r.appendChild(new A(`string_content`,e.source,a+f,a+c,{row:o,column:s+f},{row:o,column:s+c})),u)r.appendChild(new A(l,e.source,a+i.length-1,a+i.length,{row:o,column:s+i.length-1},{row:o,column:s+i.length},!1));else{let t=a+i.length,n={row:o,column:s+i.length};r.appendChild(new A(l,e.source,t,t,n,n,!1,!1,!0))}return e.finishNode(r,n),r}function wc(e){let t=e.peek(),n=e.startNode(`list`);for(e.addAnonymousChild(n,e.consume());e.peekKind()!==j.RBRACKET&&e.peekKind()!==j.EOF&&(lc(e),!(e.peekKind()===j.RBRACKET||e.peekKind()===j.EOF));){let t=P(e,0);if(t)n.appendChild(F(e,t));else break;if(lc(e),e.peekKind()===j.COMMA)e.addAnonymousChild(n,e.consume());else break}return lc(e),e.peekKind()===j.RBRACKET?e.addAnonymousChild(n,e.consume()):n.appendChild(gc(e)),e.finishNode(n,t),n}function Tc(e){let t=e.peek(),n=e.startNode(`dictionary`);for(e.addAnonymousChild(n,e.consume());e.peekKind()!==j.RBRACE&&e.peekKind()!==j.EOF&&(lc(e),!(e.peekKind()===j.RBRACE||e.peekKind()===j.EOF));){let t=Ec(e);if(t)n.appendChild(t);else break;if(lc(e),e.peekKind()===j.COMMA)e.addAnonymousChild(n,e.consume());else break}return lc(e),e.peekKind()===j.RBRACE?e.addAnonymousChild(n,e.consume()):n.appendChild(gc(e)),e.finishNode(n,t),n}function Ec(e){let t=e.peek();if(!Bc(e))return null;let n=e.startNode(`dictionary_pair`),r=Uc(e);r&&n.appendChild(r,`key`),e.peekKind()===j.COLON&&e.addAnonymousChild(n,e.consume());let i=P(e,0);return i&&n.appendChild(F(e,i),`value`),e.finishNode(n,t),n}var Dc=new Map([[j.LPAREN,8],[j.DOT,8],[j.LBRACKET,8],[j.EQEQ,4],[j.NEQ,4],[j.LT,4],[j.GT,4],[j.LTE,4],[j.GTE,4],[j.PLUS,5],[j.MINUS,5],[j.STAR,6],[j.SLASH,6]]),Oc=new Map([[`if`,0],[`or`,1],[`and`,2],[`is`,4]]);function kc(e){let t=e.peek();return t.kind===j.ID?Oc.get(t.text)??-2:Dc.get(t.kind)??-2}function Ac(e,t,n){let r=e.peek();return r.kind===j.LPAREN&&n===8?jc(e,t):r.kind===j.DOT&&n===8?Mc(e,t):r.kind===j.LBRACKET&&n===8?Nc(e,t):r.kind===j.ID&&r.text===`if`?Fc(e,t):r.kind===j.ID&&r.text===`is`?Ic(e,t):Lc(e,t,n)}function jc(e,t){let n=e.peek(),r=e.startNodeAt(`call_expression`,t);for(r.appendChild(F(e,t),`function`),e.addAnonymousChild(r,e.consume());e.peekKind()!==j.RPAREN&&e.peekKind()!==j.EOF&&(lc(e),!(e.peekKind()===j.RPAREN||e.peekKind()===j.EOF));){let t=P(e,0);if(t)r.appendChild(F(e,t),`argument`);else break;if(lc(e),e.peekKind()===j.COMMA){if(e.addAnonymousChild(r,e.consume()),lc(e),e.peekKind()===j.RPAREN){r.appendChild(hc(e),`argument`);break}}else break}return e.peekKind()===j.RPAREN?e.addAnonymousChild(r,e.consume()):r.appendChild(gc(e)),e.finishNode(r,n),r}function Mc(e,t){let n=e.peek(),r=e.startNodeAt(`member_expression`,t);if(r.appendChild(F(e,t)),e.addAnonymousChild(r,e.consume()),e.peekKind()===j.ID)r.appendChild(e.consumeNamed(`id`));else if(e.peekKind()===j.NUMBER){let t=e.consumeNamed(`number`),n=new A(`ERROR`,e.source,t.startOffset,t.endOffset,t.startPosition,t.endPosition,!0,!0);n.appendChild(t),r.appendChild(n)}else r.appendChild(gc(e));return e.finishNode(r,n),r}function Nc(e,t){let n=e.peek(),r=e.startNodeAt(`subscript_expression`,t);r.appendChild(F(e,t)),e.addAnonymousChild(r,e.consume()),lc(e);let i=e.peekKind()===j.COLON?null:P(e,0);return lc(e),e.peekKind()===j.COLON?r.appendChild(Pc(e,i)):i&&r.appendChild(F(e,i)),lc(e),e.peekKind()===j.RBRACKET?e.addAnonymousChild(r,e.consume()):r.appendChild(gc(e)),e.finishNode(r,n),r}function Pc(e,t){let n=e.peek(),r=t?e.startNodeAt(`slice_expression`,t):e.startNode(`slice_expression`);t&&r.appendChild(F(e,t),`start`),e.addAnonymousChild(r,e.consume()),lc(e);let i=P(e,0);i&&r.appendChild(F(e,i),`stop`),lc(e);let a=null;if(e.peekKind()===j.COLON&&(e.addAnonymousChild(r,e.consume()),lc(e),a=P(e,0),a&&r.appendChild(F(e,a),`step`),lc(e)),e.finishNode(r,n),!t&&!i&&!a){let t=new A(`ERROR`,e.source,r.startOffset,r.endOffset,r.startPosition,r.endPosition);return t.appendChild(r),t}return r}function Fc(e,t){let n=e.peek(),r=e.startNodeAt(`ternary_expression`,t);r.appendChild(F(e,t),`consequence`),e.addAnonymousChild(r,e.consume());let i=P(e,1);if(i&&r.appendChild(F(e,i),`condition`),e.peekKind()===j.ID&&e.peek().text===`else`){e.addAnonymousChild(r,e.consume());let t=P(e,0);t&&r.appendChild(F(e,t),`alternative`)}else r.appendChild(gc(e));return e.finishNode(r,n),r}function Ic(e,t){let n=e.peek(),r=e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`not`,i=e.startNodeAt(`comparison_expression`,t);i.appendChild(F(e,t)),e.addAnonymousChild(i,e.consume()),r&&e.addAnonymousChild(i,e.consume());let a=P(e,5);return a&&i.appendChild(F(e,a)),e.finishNode(i,n),i}function Lc(e,t,n){let r=e.peek(),i=r,a=r.kind===j.EQEQ||r.kind===j.NEQ||r.kind===j.LT||r.kind===j.GT||r.kind===j.LTE||r.kind===j.GTE||r.kind===j.EQ?`comparison_expression`:`binary_expression`,o=e.startNodeAt(a,t);o.appendChild(F(e,t)),e.addAnonymousChild(o,e.consume());let s=P(e,n+1);return s?o.appendChild(F(e,s)):o.appendChild(gc(e)),e.finishNode(o,i),o}var Rc=new Set([`expression`,`ERROR`]),zc=new Set([`id`,`number`,`string`,`datetime_literal`,`at_id`,`list`,`dictionary`,`ellipsis`]);function F(e,t){if(Rc.has(t.type))return t;let n=t;if(zc.has(t.type)){let r=new A(`atom`,e.source,t.startOffset,t.endOffset,t.startPosition,t.endPosition);r.appendChild(t),n=r}let r=new A(`expression`,e.source,n.startOffset,n.endOffset,n.startPosition,n.endPosition);return r.appendChild(n),r}function Bc(e){return Vc(e.peek().kind)}function Vc(e){return e===j.ID||e===j.STRING||e===j.NUMBER}function Hc(e){return Vc(e)||e===j.MINUS||e===j.DOT}function Uc(e){if(!Bc(e))return null;let t=e.peek(),n=e.startNode(`key`);if(e.peekKind()===j.NUMBER){let t=e.consumeNamed(`number`),r=new A(`ERROR`,e.source,t.startOffset,t.endOffset,t.startPosition,t.endPosition,!0,!0);n.appendChild(r),e.peekKind()===j.ID&&n.appendChild(e.consumeNamed(`id`))}else e.peekKind()===j.STRING?n.appendChild(Cc(e)):n.appendChild(e.consumeNamed(`id`));if(e.peekKind()===j.ID&&!e.isAtSyncPoint()&&e.peek().start.row===t.start.row){let t=e.peek().text;mc.has(t)||n.appendChild(e.consumeNamed(`id`))}return e.finishNode(n,t),n}function Wc(e){let t=e.peek(),n=e.startNode(`sequence`);for(;e.peekKind()===j.DASH_SPACE;){let t=Gc(e);t&&n.appendChild(t),cc(e)}for(;!dc(e)&&e.peekKind()!==j.DEDENT&&e.peekKind()!==j.DASH_SPACE&&(cc(e),!(dc(e)||e.peekKind()===j.DEDENT));){let t=Cl(e,e=>Wc(e));if(t){let r=qs(e.source,[t],t.startOffset,t.endOffset,t.startPosition,t.endPosition);n.appendChild(r)}else{let t=sc(e);t?n.appendChild(t):e.consume()}}return e.finishNode(n,t),n}function Gc(e){let t=e.peek(),n=e.startNode(`sequence_element`);e.addAnonymousChild(n,e.consume());let r=e=>Wc(e);if(wl(e)){let t=Tl(e);if(t&&n.appendChild(t,`colinear_mapping_element`),e.peekKind()===j.NEWLINE&&e.consume(),e.peekKind()===j.INDENT){e.consume();let t=Sl(e,r);t&&n.appendChild(t,`block_value`),e.peekKind()===j.DEDENT&&e.consume()}}else if(e.peekKind()===j.NEWLINE||e.peekKind()===j.EOF||e.peekKind()===j.INDENT){if(e.peekKind()===j.NEWLINE&&e.consume(),e.peekKind()===j.INDENT){e.consume();let t=Sl(e,r);t&&n.appendChild(t,`block_value`),e.peekKind()===j.DEDENT&&e.consume()}}else{let t=El(e);t&&(t.errorPrefix&&n.appendChild(t.errorPrefix),n.appendChild(t.value,`colinear_value`)),e.peekKind()===j.COMMENT&&n.appendChild(e.consumeNamed(`comment`)),e.peekKind()===j.NEWLINE&&e.consume()}return e.finishNode(n,t),n}function Kc(e){let t=e.peek();if(t.kind!==j.ID)return!1;switch(t.text){case`if`:case`run`:case`set`:case`transition`:case`escalate`:return!0;case`with`:return e.peekAt(1).kind!==j.COLON;case`when`:return e.peekAt(1).kind!==j.COLON;case`render`:case`show_and_return`:return e.peekAt(1).kind===j.COLON;case`available`:return e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`when`;case`ask`:return e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`for`;default:return!1}}function qc(e,t){let n=e.peek(),r=e.startNode(`procedure`);for(;!dc(e)&&e.peekKind()!==j.DEDENT&&(cc(e),!(dc(e)||e.peekKind()===j.DEDENT||e.peekKind()===j.COMMENT&&fc(e)));){let n=Jc(e,t);if(n)r.appendChild(n);else{let t=sc(e);t?r.appendChild(t):!dc(e)&&e.peekKind()!==j.DEDENT&&e.consume()}}return r.namedChildren.length===0&&r.appendChild($s(e)),e.finishNode(r,n),r}function Jc(e,t){let n=e.peek();if(n.kind===j.ID)switch(n.text){case`if`:return Xc(e,t);case`run`:return $c(e,t);case`set`:return tl(e);case`transition`:return nl(e);case`escalate`:return rl(e);case`ask`:if(e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`for`)return el(e,t);break;case`with`:return il(e);case`when`:if(e.peekAt(1).kind!==j.COLON)return ol(e,t);break;case`render`:if(e.peekAt(1).kind===j.COLON)return sl(e,t);break;case`show_and_return`:if(e.peekAt(1).kind===j.COLON)return cl(e);break;case`available`:if(e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`when`)return ll(e);break;case`else`:case`for`:return nc(e,e=>qc(e,t))}if(n.kind===j.PIPE&&t)return t(e);if(n.kind===j.COMMENT){let t=e.consumeNamed(`comment`);return e.peekKind()===j.NEWLINE&&e.consume(),t}let r=P(e,0);if(r){let t=F(e,r);return e.peekKind()===j.NEWLINE&&e.consume(),t}return null}function Yc(e,t,n,r,i){e.peekKind()===j.COLON?e.addAnonymousChild(t,e.consume()):r&&t.appendChild($s(e)),e.peekKind()===j.COMMENT&&t.appendChild(e.consumeNamed(`comment`));let a=oc(e,n);if(a&&t.appendChild(a),e.peekKind()===j.INDENT){e.consume();let n=qc(e,i);n&&t.appendChild(n,`consequence`),uc(e,t),e.peekKind()===j.DEDENT&&e.consume()}else r&&(e.peekKind()===j.NEWLINE||e.isAtSyncPoint())&&t.appendChild($s(e));e.peekKind()===j.NEWLINE&&e.consume()}function Xc(e,t){let n=e.peek(),r=e.startNode(`if_statement`);e.addAnonymousChild(r,e.consume());let i=P(e,0);if(i&&e.peekKind()===j.EQ){let t=e.consume(),n=P(e,5);if(n){let r=e.startNodeAt(`comparison_expression`,i);r.appendChild(F(e,i));let a=new A(`=`,e.source,t.startOffset,t.startOffset+1,t.start,t.end,!1),o=qs(e.source,[a],t.startOffset,t.startOffset+1,t.start,t.end);r.appendChild(o),r.appendChild(F(e,n)),r.finalize(),i=r}}if(i&&r.appendChild(F(e,i),`condition`),i&&e.peekKind()!==j.COLON&&!e.isAtSyncPoint()&&e.peekKind()!==j.INDENT){let t=n.start.row,i=ac(e,t);i&&r.appendChild(i)}for(Yc(e,r,n.start.row,!0,t);e.peekKind()===j.ID&&e.peek().text===`else`&&e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`if`;){let n=Zc(e,t);n&&r.appendChild(n,`alternative`)}if(e.peekKind()===j.ID&&e.peek().text===`else`){let n=Qc(e,t);n&&r.appendChild(n,`alternative`)}return e.finishNode(r,n),r}function Zc(e,t){let n=e.peek(),r=e.startNode(`else_if_clause`);e.addAnonymousChild(r,e.consume()),e.addAnonymousChild(r,e.consume());let i=P(e,0);if(i&&r.appendChild(F(e,i),`condition`),i&&e.peekKind()!==j.COLON&&!e.isAtSyncPoint()&&e.peekKind()!==j.INDENT){let t=n.start.row,i=ac(e,t);i&&r.appendChild(i)}return Yc(e,r,n.start.row,!1,t),e.finishNode(r,n),r}function Qc(e,t){let n=e.peek(),r=e.startNode(`else_clause`);return e.addAnonymousChild(r,e.consume()),Yc(e,r,n.start.row,!1,t),e.finishNode(r,n),r}function $c(e,t){let n=e.peek(),r=e.startNode(`run_statement`);if(e.addAnonymousChild(r,e.consume()),e.isAtSyncPoint())ec(e,r);else{let t=P(e,0);t?r.appendChild(F(e,t),`target`):ec(e,r)}if(e.peekKind()===j.INDENT){e.consume(),uc(e,r);let n=qc(e,t);if(n)if(n.namedChildren.some(e=>e.isError&&e.children.some(e=>e.type===`with`)))for(let e of n.namedChildren)r.appendChild(e);else r.appendChild(n,`block_value`);uc(e,r),e.peekKind()===j.DEDENT&&e.consume()}return e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(r,n),r}function el(e,t){let n=e.peek(),r=e.startNode(`collect_statement`);if(e.addAnonymousChild(r,e.consume()),e.addAnonymousChild(r,e.consume()),e.peekKind()===j.AT&&e.peekAt(1).kind===j.ELLIPSIS){let t=e.consume(),n=Xs(t,e.source,t.startOffset);r.appendChild(qs(e.source,[n],t.startOffset,t.startOffset+t.text.length,t.start,t.end));let i=P(e,0);i&&r.appendChild(F(e,i),`target`)}else if(e.isAtSyncPoint())ec(e,r);else{let t=P(e,0);t?r.appendChild(F(e,t),`target`):ec(e,r)}if(e.peekKind()===j.COMMENT&&r.appendChild(e.consumeNamed(`comment`)),e.peekKind()===j.INDENT){e.consume(),uc(e,r);let t=Sl(e,Wc);t&&r.appendChild(t,`body`),uc(e,r),e.peekKind()===j.DEDENT&&e.consume()}else r.appendChild($s(e));return e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(r,n),r}function tl(e){let t=e.peek(),n=e.startNode(`set_statement`);e.addAnonymousChild(n,e.consume());let r=P(e,5);if(e.peekKind()===j.EQEQ){let t=e.consume(),n=P(e,0);if(r&&n){let i=e.startNodeAt(`comparison_expression`,F(e,r));i.appendChild(F(e,r)),i.appendChild(new A(t.text,e.source,t.startOffset,t.startOffset+2,t.start,t.end,!1)),i.appendChild(F(e,n)),i.finalize();let a=F(e,i);return e.peekKind()===j.NEWLINE&&e.consume(),qs(e.source,[a],a.startOffset,a.endOffset,a.startPosition,a.endPosition)}}if(r&&n.appendChild(F(e,r),`target`),e.peekKind()===j.EQ){e.addAnonymousChild(n,e.consume());let t=P(e,0);t&&n.appendChild(F(e,t),`value`)}return e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(n,t),n}function nl(e){let t=e.peek(),n=e.startNode(`transition_statement`);e.addAnonymousChild(n,e.consume());let r=ul(e);if(r)n.appendChild(r,`with_to_statement_list`);else if(!e.isAtSyncPoint()&&e.peekKind()!==j.NEWLINE&&e.peekKind()!==j.EOF){let t=e.startNode(`with_to_statement_list`),r=e.startNode(`to_statement`);r.appendChild(tc(e,`to`));let i=P(e,0);i&&r.appendChild(F(e,i),`target`),r.finalize(),t.appendChild(r),t.finalize(),n.appendChild(t,`with_to_statement_list`)}return e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(n,t),n}function rl(e){let t=e.peek(),n=e.startNode(`escalate_statement`);return e.addAnonymousChild(n,e.consume()),e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(n,t),n}function il(e){let t=e.peek();if(e.peekAt(1).kind!==j.ID&&e.peekAt(1).kind!==j.STRING){let t=e.consume(),n=e.currentOffset(),r=new A(`with`,e.source,n,n+4,t.start,t.end,!1);return qs(e.source,[r],n,n+4,t.start,t.end)}let n=e.startNode(`with_statement`);return e.addAnonymousChild(n,e.consume()),al(e,n),e.peekKind()===j.COMMENT&&n.appendChild(e.consumeNamed(`comment`)),e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(n,t),n}function al(e,t){for(;!e.isAtSyncPoint();){if(e.peekKind()===j.ID||e.peekKind()===j.STRING)e.peekKind()===j.STRING?t.appendChild(Cc(e),`param`):t.appendChild(e.consumeNamed(`id`),`param`);else{let n=sc(e);n&&t.appendChild(n);return}e.peekKind()===j.EQ?e.addAnonymousChild(t,e.consume()):t.appendChild(tc(e,`=`));let n=P(e,0);if(n&&t.appendChild(F(e,n),`value`),e.peekKind()===j.COMMA)e.addAnonymousChild(t,e.consume());else break}}function ol(e,t){let n=e.peek(),r=e.startNode(`when_statement`);e.addAnonymousChild(r,e.consume());let i=P(e,0);if(i&&r.appendChild(F(e,i),`subject`),e.peekKind()===j.INDENT){e.consume(),uc(e,r);let n=qc(e,t);n&&r.appendChild(n,`body`),uc(e,r),e.peekKind()===j.DEDENT&&e.consume()}return e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(r,n),r}function sl(e,t){let n=e.peek(),r=e.startNode(`render_statement`);e.addAnonymousChild(r,e.consume()),e.peekKind()===j.COLON&&e.addAnonymousChild(r,e.consume());let i=P(e,0);if(i&&r.appendChild(F(e,i),`value`),e.peekKind()===j.INDENT){e.consume(),uc(e,r);let n=qc(e,t);n&&r.appendChild(n,`body`),uc(e,r),e.peekKind()===j.DEDENT&&e.consume()}return e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(r,n),r}function cl(e){let t=e.peek(),n=e.startNode(`show_and_return_statement`);e.addAnonymousChild(n,e.consume()),e.peekKind()===j.COLON&&e.addAnonymousChild(n,e.consume());let r=P(e,0);return r&&n.appendChild(F(e,r),`value`),e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(n,t),n}function ll(e){let t=e.peek(),n=e.startNode(`available_when_statement`);e.addAnonymousChild(n,e.consume()),e.addAnonymousChild(n,e.consume());let r=P(e,0);return r&&n.appendChild(F(e,r),`condition`),e.peekKind()===j.NEWLINE&&e.consume(),e.finishNode(n,t),n}function ul(e){let t=e.peek();if(!ms(t,j.ID)||![`with`,`to`].includes(t.text))return null;let n=t,r=e.startNode(`with_to_statement_list`);for(;!e.isAtSyncPoint();){if(e.peekKind()===j.ID&&e.peek().text===`with`)r.appendChild(dl(e));else if(e.peekKind()===j.ID&&e.peek().text===`to`)r.appendChild(fl(e));else break;if(e.peekKind()===j.COMMA)e.addAnonymousChild(r,e.consume());else break}return r.children.length===0?null:(e.finishNode(r,n),r)}function dl(e){let t=e.peek(),n=e.startNode(`with_statement`);return e.addAnonymousChild(n,e.consume()),al(e,n),e.finishNode(n,t),n}function fl(e){let t=e.peek(),n=e.startNode(`to_statement`);e.addAnonymousChild(n,e.consume());let r=P(e,0);return r?n.appendChild(F(e,r),`target`):n.appendChild($s(e)),e.finishNode(n,t),n}function pl(e){let t=e.peek(),n=e.startNode(`template`),r=e.peekOffset(),i=r;for(;i>0&&e.source.charCodeAt(i-1)!==10;)i--;let a=0;for(let t=i;t<r;t++){let n=e.source.charCodeAt(t);if(n===32)a+=1;else if(n===9)a+=3;else break}let o=e.consume();if(e.addAnonymousChild(n,o),!dc(e)&&e.peekKind()!==j.NEWLINE&&e.peekKind()!==j.INDENT&&e.peekKind()!==j.DEDENT&&_l(e,n,o.startOffset+1,o.end),e.peekKind()===j.NEWLINE&&e.consume(),e.peekKind()===j.INDENT){e.consume();let t=1;for(;!dc(e);){let r=e.peek();if(r.kind===j.DEDENT){if(t--,e.consume(),t<=0){if(hl(e,a)){t=0;continue}break}}else if(r.kind===j.INDENT)t++,e.consume();else if(r.kind===j.NEWLINE)e.consume();else{if(t<=0&&!hl(e,a))break;let r=n.children.length>0?n.children[n.children.length-1]:null,i=r&&r.endOffset<e.peekOffset()?r.endOffset:void 0;_l(e,n,i,i===void 0?void 0:r.endPosition)}}}return gl(e,n),e.finishNode(n,t),n}function ml(e){return pl(e)}function hl(e,t){let n=0;for(;e.peekAt(n).kind===j.NEWLINE;)n++;let r=e.peekAt(n);if(r.kind===j.EOF||r.kind===j.DEDENT)return!1;if(r.start.column>t)return!0;if(r.kind===j.PIPE)return!1;if(r.kind===j.ID||r.kind===j.STRING){let t=e.peekAt(n+1);if(t.kind===j.COLON||t.kind===j.ID&&e.peekAt(n+2).kind===j.COLON)return!1}if(r.kind===j.ID)switch(r.text){case`if`:case`else`:case`run`:case`set`:case`transition`:return!1;case`with`:if(e.peekAt(n+1).kind!==j.COLON)return!1;break;case`available`:if(e.peekAt(n+1).kind===j.ID&&e.peekAt(n+1).text===`when`)return!1;break;case`ask`:if(e.peekAt(n+1).kind===j.ID&&e.peekAt(n+1).text===`for`)return!1;break}return!(r.kind===j.DASH_SPACE||r.kind===j.COMMENT)}function gl(e,t){let n=[],r=0;for(;r<t.children.length;){let i=t.children[r];if(i.type===`template_content`){let a=r+1;for(;a<t.children.length&&t.children[a].type===`template_content`;)a++;if(a>r+1){let i=t.children[r],o=t.children[a-1],s=new A(`template_content`,e.source,i.startOffset,o.endOffset,i.startPosition,o.endPosition);s.parent=t,n.push(s),r=a}else n.push(i),r++}else n.push(i),r++}t.children=n}function _l(e,t,n,r){for(;!dc(e);){let i=e.peek();if(i.kind===j.NEWLINE||i.kind===j.DEDENT||i.kind===j.INDENT||i.kind===j.EOF)break;if(i.kind===j.TEMPLATE_EXPR_START){n!==void 0&&n<i.startOffset&&t.appendChild(new A(`template_content`,e.source,n,i.startOffset,r,i.start)),n=void 0,r=void 0;let a=vl(e);t.appendChild(a);continue}if(i.kind===j.TEMPLATE_CONTENT){let a=n!==void 0&&n<i.startOffset?n:i.startOffset,o=r!==void 0&&n!==void 0&&n<i.startOffset?r:i.start;t.appendChild(new A(`template_content`,e.source,a,i.startOffset+i.text.length,o,i.end)),n=void 0,r=void 0,e.consume();continue}e.consume()}}function vl(e){let t=e.peek(),n=e.startNode(`template_expression`);e.addAnonymousChild(n,e.consume());let r=P(e,0);if(r?n.appendChild(F(e,r),`expression`):n.appendChild($s(e)),e.peekKind()!==j.RBRACE&&!e.isAtSyncPoint()){let t=sc(e);t&&n.appendChild(t)}return e.peekKind()===j.RBRACE?e.addAnonymousChild(n,e.consume()):n.appendChild(tc(e,`}`)),e.finishNode(n,t),n}var yl=10;function bl(e,t){if(xl(e))return Sl(e,t);let n=P(e,0);if(!n)return null;if(ms(e.peek(),j.EQ)){let t=e.startNodeAt(`assignment_expression`,n);t.appendChild(F(e,n),`left`),e.addAnonymousChild(t,e.consumeKind(j.EQ));let r=P(e,0);return r&&t.appendChild(F(e,r),`right`),t}return F(e,n)}function xl(e){let t=e.peek();if(t.kind===j.COMMENT||t.kind===j.PIPE||t.kind===j.ID&&Kc(e))return!0;if(!Vc(t.kind))return!1;let n=t.start.row;for(let t=1;t<yl;t++){let r=e.peekAt(t);if(r.kind===j.COLON||r.kind===j.INDENT||r.kind===j.ARROW||r.kind===j.AT||t===1&&(r.kind===j.STRING||r.kind===j.NUMBER))return!0;if(r.kind===j.EOF||r.start.row!==n||!Hc(r.kind))return!1}return!1}function Sl(e,t){let n=e.startNode(`mapping`);for(;!dc(e);){cc(e);let r=e.peek();if(r.kind===j.DEDENT||r.kind===j.EOF||r.kind===j.COMMENT&&fc(e))break;let i=Cl(e,t);if(i)n.appendChild(i);else{let t=sc(e);t?n.appendChild(t):!dc(e)&&e.peekKind()!==j.DEDENT&&e.consume()}}return n}function Cl(e,t){let n=e.peek();if(n.kind===j.ID)switch(n.text){case`if`:return Xc(e,e=>pl(e));case`run`:return $c(e,e=>pl(e));case`set`:return tl(e);case`transition`:return nl(e);case`ask`:if(e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`for`)return el(e,e=>pl(e));break;case`with`:if(e.peekAt(1).kind!==j.COLON)return il(e);break;case`when`:if(e.peekAt(1).kind!==j.COLON)return ol(e,e=>pl(e));break;case`render`:if(e.peekAt(1).kind===j.COLON)return sl(e,e=>pl(e));break;case`show_and_return`:if(e.peekAt(1).kind===j.COLON)return cl(e);break;case`available`:if(e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`when`)return ll(e);break}return n.kind===j.PIPE?pl(e):n.kind===j.COMMENT?e.consumeNamed(`comment`):n.kind===j.ID&&(n.text===`else`||n.text===`for`)?nc(e,e=>qc(e,e=>pl(e))):Bc(e)?Al(e,t):null}function wl(e){if(!Bc(e))return!1;let t=e.peek();if(e.peekAt(1).kind===j.ID&&e.peekAt(1).start.row===t.start.row){let n=e.peekAt(2);if(n.kind===j.COLON&&n.start.row===t.start.row)return!0}let n=e.peekAt(1);return n.kind===j.COLON&&n.start.row===t.start.row}function Tl(e){let t=e.peek(),n=e.startNode(`mapping_element`),r=Uc(e);r&&n.appendChild(r,`key`),e.peekKind()===j.COLON&&e.addAnonymousChild(n,e.consume());let i=El(e);return i&&(i.errorPrefix&&n.appendChild(i.errorPrefix),n.appendChild(i.value,`colinear_value`)),e.finishNode(n,t),n}function El(e){let t=e.peek();if(t.kind===j.PIPE)return{value:ml(e)};if(t.kind===j.ID&&(t.text===`mutable`||t.text===`linked`))return{value:Nl(e)};if(t.kind===j.ID&&Ol(t.text))return{value:kl(e)};let n=P(e,0);if(!n)return null;if((n.type===`number`||n.type===`id`&&/^[0-9]/.test(n.text))&&e.peekKind()===j.ID&&e.peek().start.row===n.startRow){let t=qs(e.source,[F(e,n)],n.startOffset,n.endOffset,n.startPosition,n.endPosition),r=El(e);if(r)return{value:r.value,errorPrefix:t}}let r=ul(e);if(r){let t=e.startNodeAt(`expression_with_to`,n);return t.appendChild(F(e,n),`expression`),t.appendChild(r,`with_to_statement_list`),t.finalize(),{value:t}}if(e.peekKind()===j.EQ){let t=e.startNodeAt(`assignment_expression`,n);t.appendChild(F(e,n),`left`),e.addAnonymousChild(t,e.consume());let r=P(e,0);return r&&t.appendChild(F(e,r),`right`),t.finalize(),{value:t}}let i=e.startNodeAt(`expression_with_to`,n);return i.appendChild(F(e,n),`expression`),{value:i}}function Dl(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array.from({length:r+1}).fill(0));for(let e=0;e<=n;e++)i[e][0]=e;for(let e=0;e<=r;e++)i[0][e]=e;for(let a=1;a<=n;a++)for(let n=1;n<=r;n++){let r=e[a-1]===t[n-1]?0:1;i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+r)}return i[n][r]}function Ol(e){return Dl(e,`mutable`)<=2||Dl(e,`linked`)<=2}function kl(e){let t=e.peek(),n=e.startNode(`variable_declaration`),r=e.consume(),i=r.startOffset+r.text.length,a=Xs(r,e.source,r.startOffset),o=qs(e.source,[a],r.startOffset,i,r.start,r.end);n.appendChild(o);let s=P(e,0);if(s&&n.appendChild(F(e,s),`type`),e.peekKind()===j.EQ){e.addAnonymousChild(n,e.consume());let t=P(e,0);t&&n.appendChild(F(e,t),`default`)}return e.finishNode(n,t),n}function Al(e,t){let n=e.peek(),r=e.startNode(`mapping_element`),i=Uc(e);if(vs(i!=null,`We must be at a key start`),r.appendChild(i,`key`),e.peekKind()===j.COLON)e.addAnonymousChild(r,e.consumeKind(j.COLON));else if(e.peekKind()===j.INDENT||e.peekKind()===j.ARROW||e.peekKind()===j.ID||e.peekKind()===j.AT||e.peekKind()===j.STRING||e.peekKind()===j.NUMBER)r.appendChild(tc(e,`:`));else return r;return e.peekKind()===j.ARROW?Ml(e,r):e.peekKind()===j.INDENT?Pl(e,r,t):jl(e,r,n.start.row,t),r}function jl(e,t,n,r){let i=El(e);if(i&&(i.errorPrefix&&t.appendChild(i.errorPrefix),t.appendChild(i.value,`colinear_value`)),e.peekKind()===j.COMMENT&&t.appendChild(e.consumeNamed(`comment`)),i){let r=oc(e,n);r&&t.appendChild(r)}else if(!e.isAtSyncPoint()&&e.peekKind()!==j.INDENT){let n=sc(e);n&&t.appendChild(n)}if(i?.value.type===`expression_with_to`&&!i.value.childForFieldName(`with_to_statement_list`)&&e.peekKind()===j.INDENT&&e.peekAt(1).kind===j.ID&&e.peekAt(1).text===`to`){e.consumeKind(j.INDENT);let n=ul(e);n&&(i.value.appendChild(n,`with_to_statement_list`),t.endOffset=i.value.endOffset,t.endPosition=i.value.endPosition),e.consumeKind(j.DEDENT)}else e.peekKind()===j.INDENT&&Pl(e,t,r)}function Ml(e,t){if(e.addAnonymousChild(t,e.consume()),e.peekKind()===j.COMMENT&&t.appendChild(e.consumeNamed(`comment`)),e.peekKind()===j.INDENT){e.consume(),uc(e,t);let n=qc(e,e=>pl(e));n&&t.appendChild(n,`block_value`),uc(e,t),e.peekKind()===j.DEDENT&&e.consume()}else{let n=e.startNode(`procedure`);n.appendChild($s(e)),e.finishNode(n,e.peek()),t.appendChild(n,`block_value`)}}function Nl(e){let t=e.peek(),n=e.startNode(`variable_declaration`);if(e.addAnonymousChild(n,e.consume()),e.peekKind()===j.ID&&(e.peek().text===`mutable`||e.peek().text===`linked`)){let t=P(e,0);if(t){let r=F(e,t),i=qs(e.source,[r],r.startOffset,r.endOffset,r.startPosition,r.endPosition);n.appendChild(i)}}let r=P(e,0);if(r&&n.appendChild(F(e,r),`type`),e.peekKind()===j.EQ){e.addAnonymousChild(n,e.consume());let t=P(e,0);t&&n.appendChild(F(e,t),`default`)}return e.finishNode(n,t),n}function Pl(e,t,n){e.consume(),uc(e,t);let r=Fl(e,n);r&&t.appendChild(r,`block_value`),uc(e,t),rc(e,t),e.peekKind()===j.DEDENT&&e.consume()}function Fl(e,t){let n=e.peek();if(n.kind===j.DASH_SPACE)return t(e);if(n.kind===j.ID&&n.text===`empty`){let t=e.startNode(`empty_keyword`);return e.addAnonymousChild(t,e.consume()),e.finishNode(t,n),t}return xl(e)?Sl(e,t):Il(e)}function Il(e){let t=P(e,0);if(!t)return null;if(zc.has(t.type)){let n=new A(`atom`,e.source,t.startOffset,t.endOffset,t.startPosition,t.endPosition);return n.appendChild(t),n}return t}var Ll=class{source;tokens;pos=0;_eof;constructor(e){this.source=e;let t=new Ks(e);this.tokens=t.tokenize()}parse(){return this.parseSourceFile()}peek(){return this.peekAt(0)}peekAt(e){return this.peekAtIndex(this.pos+e)}peekAtIndex(e){return this.tokens[e]??this.eofToken()}peekKind(){return this.peek().kind}consume(){let e=this.peek();return this.pos++,e}consumeKind(e){let t=this.peek();return vs(ms(t,e),`Expected token kind ${e} but got ${t.kind}`),this.pos++,t}consumeNamed(e){let t=this.consume(),n=t.startOffset;return new A(e,this.source,n,n+t.text.length,t.start,t.end)}currentOffset(){let e=this.pos>0?this.pos-1:0;return this.peekAtIndex(e).startOffset}peekOffset(){return this.peek().startOffset}isAtSyncPoint(){return Qs(this.peekKind())}startNode(e){let t=this.peek(),n=t.startOffset;return new A(e,this.source,n,n,t.start,t.end)}startNodeAt(e,t){return new A(e,this.source,t.startOffset,t.endOffset,t.startPosition,t.endPosition)}finishNode(e,t){}addAnonymousChild(e,t){let n=t.startOffset,r=new A(t.text,this.source,n,n+t.text.length,t.start,t.end,!1);e.appendChild(r)}parseSourceFile(){let e=this.startNode(`source_file`);if(cc(this),this.peekKind()===j.INDENT&&this.consume(),uc(this,e),this.peekKind()===j.DASH_SPACE)e.appendChild(Wc(this));else{let t=bl(this,e=>Wc(e));t&&e.appendChild(t)}for(uc(this,e);!dc(this);){if(this.peekKind()===j.NEWLINE||this.peekKind()===j.DEDENT){this.consume();continue}if(this.peekKind()===j.COMMENT){e.appendChild(this.consumeNamed(`comment`));continue}let t=sc(this);t?e.appendChild(t):this.consume()}return e.startOffset=0,e.startPosition={row:0,column:0},e.endOffset=this.source.length,e.endPosition=this.eofToken().end,e}eofToken(){if(!this._eof){let e=this.tokens[this.tokens.length-1],t=e?e.end:{row:0,column:0};this._eof={kind:j.EOF,text:``,start:t,end:t,startOffset:this.source.length}}return this._eof}};function Rl(e){return{rootNode:new Ll(e).parse()}}function zl(e,t=`leading`){return{value:e.text.slice(1),attachment:t,range:M(e)}}function Bl(e,t){return e[t]}function Vl(e,t){let n=e[t];if(!n||typeof n!=`object`)return;let r=n;if(typeof r.value==`string`)return r.value;if(typeof r.name==`string`)return r.name}function I(e,t){let n=e.__diagnostics;return Object.assign(e,{__cst:{node:t,range:M(t)},__diagnostics:n??[]})}var Hl=class{__diagnostics=[];__cst;__comments},Ul=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function Wl(e){if(e.type===`id`)return e.text;if(e.type===`string`){let t=``;for(let n of e.namedChildren)n.type===`string_content`?t+=n.text:n.type===`escape_sequence`&&(n.text===`\\"`?t+=`"`:n.text===`\\'`?t+=`'`:n.text===`\\\\`?t+=`\\`:n.text===`\\n`?t+=`
|
|
81
|
+
`:n.text===`\\r`?t+=`\r`:n.text===`\\t`?t+=` `:n.text===`\\0`&&(t+=`\0`));return t}return e.text}function Gl(e){return Ul.test(e)?e:Kl(e)}function Kl(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\t/g,`\\t`).replace(/\0/g,`\\0`)}"`}function ql(e){return e.type===`id`||e.type===`string`}function L(e){return{blockValue:e.childForFieldName(`block_value`),colinearValue:e.childForFieldName(`colinear_value`)??e.childForFieldName(`expression`),procedure:e.childForFieldName(`procedure`)}}function R(e){return` `.repeat(e.indent*(e.tabSize??4))}function z(e){return e?.__comments?.filter(e=>e.attachment===`leading`)??[]}function B(e){return e?.__comments?.filter(e=>e.attachment===`trailing`)??[]}function Jl(e){return e?.__comments?.filter(e=>e.attachment===`inline`)??[]}function Yl(e,t){let n=R(t);return e.value.trim().length===0?`${n}#`:`${n}${e.range?`#`:`# `}${e.value}`}function Xl(e){return e.value.trim().length===0?`#`:`${e.range?`#`:`# `}${e.value}`}function Zl(e,t){let n=e.indexOf(`
|
|
82
|
+
`);return n===-1?`${e} ${t}`:`${e.slice(0,n)} ${t}${e.slice(n)}`}function Ql(e,t){return!e||e.length===0?``:e.map(e=>Yl(e,t)).join(`
|
|
83
|
+
`)}function $l(e,t,n,r){if(!t||!t.__comments?.length)return e;let i=z(t),a=Jl(t),o=B(t),s=[],c=Ql(i,n);if(c&&s.push(c),e)if(a.length>0){let t=a.map(e=>Xl(e)).join(` `);s.push(Zl(e,t))}else s.push(e);if(o.length>0){let e=r==null?n:{...n,indent:n.indent+r},t=o.map(t=>Yl(t,e)).join(`
|
|
84
|
+
`);t&&s.push(t)}return s.join(`
|
|
85
|
+
`)}var V;(function(e){e[e.File=1]=`File`,e[e.Module=2]=`Module`,e[e.Namespace=3]=`Namespace`,e[e.Package=4]=`Package`,e[e.Class=5]=`Class`,e[e.Method=6]=`Method`,e[e.Property=7]=`Property`,e[e.Field=8]=`Field`,e[e.Constructor=9]=`Constructor`,e[e.Enum=10]=`Enum`,e[e.Interface=11]=`Interface`,e[e.Function=12]=`Function`,e[e.Variable=13]=`Variable`,e[e.Constant=14]=`Constant`,e[e.String=15]=`String`,e[e.Number=16]=`Number`,e[e.Boolean=17]=`Boolean`,e[e.Array=18]=`Array`,e[e.Object=19]=`Object`,e[e.Key=20]=`Key`,e[e.Null=21]=`Null`,e[e.EnumMember=22]=`EnumMember`,e[e.Struct=23]=`Struct`,e[e.Event=24]=`Event`,e[e.Operator=25]=`Operator`,e[e.TypeParameter=26]=`TypeParameter`})(V||={});function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eu(e){if(typeof e!=`object`||!e)return!1;let t=e.__cst;return typeof t==`object`&&!!t&&`range`in t}function tu(e,t){return{value:e,diagnostics:t}}var nu=`__wildcardPrefixes__`;function ru(e,t){Object.defineProperty(e,nu,{value:t,enumerable:!1,writable:!1,configurable:!1})}function iu(e){return e[nu]??[]}function au(e,t){for(let n of iu(e))if(t.startsWith(n.prefix)&&t.length>n.prefix.length)return n}function ou(e){return e.map(e=>e.keyword)}function su(e){return!!e.discriminantField&&!!e.resolveSchemaForDiscriminant}function cu(e){return Array.isArray(e)?e[0]:e}var lu=Symbol.for(`agentscript.NamedMap`);function U(e){return typeof e!=`object`||!e?!1:Object.prototype.hasOwnProperty.call(e,lu)&&Reflect.get(e,lu)===!0}function uu(e){return!0}function du(e){return e.__isCollection===!0}function fu(e){return`__isNamedCollection`in e&&e.__isNamedCollection===!0}function pu(e){let t=new Map;for(let[n,r]of Object.entries(e))if(`kind`in r&&typeof r.kind==`string`&&t.set(r.kind,n),fu(r)){let e=r.entryBlock.kind;e&&t.set(e,n)}return t}function mu(e){return e!==void 0&&e.list===!0&&e.elementFields!==void 0}var hu=class{key;_fieldType;entryName;__keyRange;__type=`field`;_value;__elementText;__elementColumn;constructor(e,t,n,r,i){this.key=e,this._fieldType=n,this.entryName=r,this.__keyRange=i,this._value=t}get value(){return this._value}set value(e){this._value=e,this.__elementText=void 0,this.__elementColumn=void 0}__emit(e){if(this.__elementText!=null&&this.__elementColumn!=null)return Su(this.__elementText,this.__elementColumn,e);let t=this.value,n,r=t;if(this.entryName&&ku(t))return n=t.emitWithKey(this.key,e),$l(n,r,e,1);if(this._fieldType.emitField)return n=this._fieldType.emitField(this.key,t,e),$l(n,r,e,1);let i=`${R(e)}${this.key}: `;return n=`${i}${this._fieldType.emit(t,{...e,continuationColumn:i.length})}`,$l(n,r,e,1)}};function gu(e,t){e.__elementText=xu(t.text,t.startPosition.column),e.__elementColumn=t.startPosition.column}var _u=class{name;__type=`map_entry`;value;__elementText;__elementColumn;constructor(e,t){this.name=e,this.value=t}__emit(e){if(this.__elementText!=null&&this.__elementColumn!=null)return Su(this.__elementText,this.__elementColumn,e);let t=this.value;return Au(t)?$l(t.__emit(e),t,e):(t!=null&&console.warn(`MapEntryChild '${this.name}': value is non-null but missing __emit — entry will be dropped from emission`),``)}},vu=class{ensure(e){let t=new Map;for(let n of e)n instanceof _u&&t.set(n.name,n);return t}},yu=class{__type=`sequence_item`;value;constructor(e){this.value=e}__emit(e){let t=R(e),n={...e,indent:e.indent+1},r=R(n),i=this.value;if(Au(i)&&`__symbol`in i){let e=i.__emit(n).split(`
|
|
86
|
+
`);e[0]=`${t}- ${e[0].slice(r.length)}`;let a=t+` `;for(let t=1;t<e.length;t++)e[t].startsWith(r)&&(e[t]=a+e[t].slice(r.length));return e.join(`
|
|
87
|
+
`)}return Au(i)?`${t}- ${i.__emit({...e,indent:0})}`:``}};function bu(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===32||r===9)t++;else break}return t}function xu(e,t){let n=e.split(`
|
|
88
|
+
`);for(;n.length>0&&n[n.length-1].trim()===``;)n.pop();if(n.length<=1)return n.join(`
|
|
89
|
+
`);for(let e=1;e<n.length;e++){let r=n[e];bu(r)>=t?n[e]=r.slice(t):n[e]=r.trimStart()}return n.join(`
|
|
90
|
+
`)}function Su(e,t,n){let r=R(n);return e.split(`
|
|
91
|
+
`).map((e,t)=>{if(t===0){let t=e.replace(/^\s*/,``);return t?r+t:``}let n=e.replace(/^\s*/,``);if(!n)return``;let i=e.length-e.trimStart().length;return r+` `.repeat(i)+n}).join(`
|
|
92
|
+
`)}var Cu=class{__type=`error`;__kind=`ErrorBlock`;__diagnostics=[];__cst;rawText;originalIndent;constructor(e,t){this.rawText=xu(e,t),this.originalIndent=t}__emit(e){return Su(this.rawText,this.originalIndent,e)}},wu=class{key;__type=`untyped`;__kind=`UntypedBlock`;__diagnostics=[];__cst;__comments;__children=[];rawText;originalIndent;__blockName;get name(){return this.__blockName}constructor(e,t,n,r=0){this.key=e,this.__blockName=t,this.rawText=n==null?void 0:xu(n,r),this.originalIndent=r}__emit(e){if(this.rawText!=null)return Su(this.rawText,this.originalIndent,e);let t=R(e),n=this.__blockName?`${this.key} ${this.__blockName}:`:`${this.key}:`;if(this.__children.length===0)return`${t}${n}`;let r={...e,indent:e.indent+1},i=this.__children.map(e=>e.__emit(r)).filter(Boolean).join(`
|
|
93
|
+
`);return i?`${t}${n}\n${i}`:`${t}${n}`}};function Tu(e,t){let n=xu(e,t);return{__fieldKind:`Primitive`,__accepts:[],parse:()=>{throw Error(`UntypedFieldType cannot parse`)},emit:(e,t)=>Au(e)?e.__emit(t):String(e??``),emitField:(e,r,i)=>Su(n,t,i)}}var Eu=class{__type=`value`;value;constructor(e){this.value=e}__emit(e){return``}},Du=class{__type=`statement`;value;constructor(e){this.value=e}__emit(e){let t=this.value;return Au(t)?$l(t.__emit(e),t,e):``}};function Ou(e){return typeof e==`object`&&!!e&&`__type`in e}function ku(e){return typeof e==`object`&&!!e&&`__kind`in e&&`emitWithKey`in e&&typeof e.emitWithKey==`function`}function Au(e){return typeof e==`object`&&!!e&&`__emit`in e&&typeof e.__emit==`function`}function ju(e,t,n=`
|
|
94
|
+
`){return e.map(e=>e.__emit(t)).filter(Boolean).join(n)}function Mu(e,t){let n=new Set;for(let r of t){if(r.__type!==`field`)continue;let t=r;t.entryName||n.has(t.key)||(n.add(t.key),Object.defineProperty(e,t.key,{get(){return t.value},set(e){t.value=e},enumerable:!0,configurable:!0}))}}function Nu(e,t,n){for(let[t,r]of Object.entries(n))U(r)&&(e[t]=r);Mu(e,t)}function Pu(e,t,n,r){if(t)return Nu(e,t,n),t;let i=[];for(let[e,t]of Object.entries(r)){let r=n[e];r!==void 0&&i.push(new hu(e,r,t))}return Nu(e,i,n),i}function Fu(e){let{__children:t,...n}=e;return{fields:n,children:t}}var Iu=new Map([[`"`,`"`],[`'`,`'`],[`\\`,`\\`],[`n`,`
|
|
95
|
+
`],[`t`,` `],[`r`,`\r`],[`0`,`\0`]]);function Lu(e){return Iu.get(e)}var Ru=new Map([...Iu].filter(([e])=>e!==`'`).map(([e,t])=>[t,`\\${e}`])),zu=RegExp(`[`+[...Ru.keys()].map(e=>`\\x`+e.charCodeAt(0).toString(16).padStart(2,`0`)).join(``)+`]`,`g`);function Bu(e){return e.replace(zu,e=>Ru.get(e))}var Vu=class extends Hl{__describe(){return`expression ${this.__emit({indent:0})}`}},Hu=class e extends Hl{value;static kind=`TemplateText`;__kind=e.kind;constructor(e){super(),this.value=e}__describe(){return`template text "${this.value.slice(0,20)}${this.value.length>20?`...`:``}"`}__emit(e){return this.value}},Uu=class e extends Hl{expression;static kind=`TemplateInterpolation`;__kind=e.kind;constructor(e){super(),this.expression=e}__describe(){return`interpolation {!${this.expression.__describe()}}`}__emit(e){return`{!${this.expression.__emit(e)}}`}};new Set([Hu,Uu].map(e=>e.kind));function Wu(e,t){let n=[],r=[];for(let i of e.namedChildren)if(i.type===`template_content`)n.push(I(new Hu(i.text),i));else if(i.type===`template_expression`){let e=i.childForFieldName(`expression`);e?n.push(I(new Uu(t(e)),i)):(r.push(Md(i,`Malformed template interpolation: missing expression`,N.Warning,`malformed-interpolation`)),n.push(I(new Hu(i.text),i)))}else r.push(Md(i,`Unexpected node in template: ${i.type}`,N.Warning,`unexpected-template-node`));return Gu(n,e),{parts:n,diagnostics:r}}function Gu(e,t){let n=e.map(e=>e instanceof Hu?e.value:`X`).join(``);if(n.indexOf(`
|
|
96
|
+
`)!==-1){let r=n.split(`
|
|
97
|
+
`),i=t.startPosition?.column,a,o=1/0;for(let e=1;e<r.length;e++){if(r[e].trim().length===0)continue;let t=r[e].search(/\S/);t>=0&&(o=Math.min(o,t))}if(i!==void 0)if(r[0].trimEnd().length>0){let e=r[0].match(/^(\s*)/)?.[1]?.length??0;a=i+1+e}else a=o===1/0?0:o;else a=o===1/0?0:o;if(a>0){let t=0,n=!0;for(let r of e){if(!(r instanceof Hu)){n=!1;continue}let e=r.value.split(`
|
|
98
|
+
`);for(let r=0;r<e.length;r++)if(r>0&&(t++,n=!0),n&&t>0&&e[r].length>0){let t=e[r].search(/\S|$/);e[r]=e[r].slice(Math.min(t,a))}n=e[e.length-1].length===0,r.value=e.join(`
|
|
99
|
+
`)}}}Ku(e)}function Ku(e){if(e.length===0)return;let t=e.find(e=>e instanceof Hu);if(t){let e=t.value.startsWith(`
|
|
100
|
+
`);t.value=qu(t.value),e||(t.value=Ju(t.value))}Yu(e),Xu(e)}function qu(e){let t=e.match(/^\n+/)?.[0]?.length??0,n=e.replace(/^\n+/,``);return t>=2?`
|
|
101
|
+
`+n:n}function Ju(e){let t=e.indexOf(`
|
|
102
|
+
`);return t===-1?e.trimStart():e.slice(0,t).trimStart()+e.slice(t)}function Yu(e){for(let t of e){if(!(t instanceof Hu))continue;let e=t,n=e.value.split(`
|
|
103
|
+
`);for(let e=1;e<n.length;e++)n[e].trim().length===0&&(n[e]=``);e.value=n.join(`
|
|
104
|
+
`)}}function Xu(e){let t=e[e.length-1];t instanceof Hu&&(t.value=t.value.trimEnd())}var Zu=class e extends Vu{parts;static kind=`TemplateExpression`;__kind=e.kind;barePipeMultiline=!1;spaceAfterPipe=!1;constructor(e){super(),this.parts=e}get content(){return this.parts.map(e=>e.__emit({indent:0})).join(``)}__describe(){let e=this.content;return`template "${e.slice(0,20)}${e.length>20?`...`:``}"`}__emit(e){let t=this.parts.map(t=>t.__emit(e)).join(``).split(`
|
|
105
|
+
`),n=this.spaceAfterPipe?` `:``,r=R({...e,indent:e.indent+1});if(this.barePipeMultiline&&t.length>0)return`|\n${t.map(e=>e.trim().length===0?``:r+e).join(`
|
|
106
|
+
`)}`;let i=e.continuationColumn==null?r:` `.repeat(e.continuationColumn+1+n.length);return t.map((e,t)=>t===0?e.length>0?`|${n}${e}`:`|`:e.trim().length===0?``:`${i}${e}`).join(`
|
|
107
|
+
`)}static parse(t,n){let{parts:r,diagnostics:i}=Wu(t,n),a=I(new e(r),t),o=t.text;if(o&&r.length>0){let e=o.slice(1),t=e.search(/\S/);t>0&&e.slice(0,t).includes(`
|
|
108
|
+
`)&&(a.barePipeMultiline=!0),!a.barePipeMultiline&&e.length>0&&e[0]===` `&&(a.spaceAfterPipe=!0)}return a.__diagnostics.push(...i),a}},W=class e extends Vu{value;static kind=`StringLiteral`;__kind=e.kind;constructor(e){super(),this.value=e}__describe(){return`string "${this.value}"`}__emit(e){let t=this.__cst?.node?.text;if(t){let e=t[0];if((e===`"`||e===`'`)&&t.length>1&&t.endsWith(e))return t}return`"${Bu(this.value)}"`}static parse(t){let n=``;for(let e of t.namedChildren)if(e.type===`string_content`)n+=e.text;else if(e.type===`escape_sequence`){let t=Lu(e.text[1]);t!==void 0&&(n+=t)}let r=I(new e(n),t);return t.startRow!==t.endRow&&(r.__diagnostics=[Md(t,`String literals must not contain raw newlines. Use template syntax (| ...) for multi-line content.`,N.Error,`string-contains-newline`)]),r}},Qu=class e extends Vu{value;static kind=`NumberLiteral`;__kind=e.kind;constructor(e){super(),this.value=e}__describe(){return`number ${this.value}`}__emit(e){return this.__cst?this.__cst.node.text:String(this.value)}static parse(t){return I(new e(Number(t.text)),t)}},$u=class e extends Vu{value;static kind=`BooleanLiteral`;__kind=e.kind;constructor(e){super(),this.value=e}__describe(){return this.value?`True`:`False`}__emit(e){return this.value?`True`:`False`}static parse(t){return I(new e(t.text===`True`),t)}};function ed(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return e;if(typeof e!=`object`||!e)return;let t=e;if(t.__kind===W.kind&&typeof t.value==`string`||t.__kind===Qu.kind&&typeof t.value==`number`||t.__kind===$u.kind&&typeof t.value==`boolean`)return t.value}var td=class e extends Vu{static kind=`NoneLiteral`;__kind=e.kind;__describe(){return`None`}__emit(e){return`None`}static parse(t){return I(new e,t)}},G=class e extends Vu{name;static kind=`Identifier`;__kind=e.kind;constructor(e){super(),this.name=e}__describe(){return`identifier "${this.name}"`}__emit(e){return this.name}static parse(t){return I(new e(t.text),t)}},nd=class e extends Vu{rawText;static kind=`ErrorValue`;__kind=e.kind;constructor(e){super(),this.rawText=e}__describe(){return`error value: ${this.rawText}`}__emit(e){return this.rawText}},rd=class e extends Vu{name;static kind=`AtIdentifier`;__kind=e.kind;constructor(e){super(),this.name=e}__describe(){return`reference @${this.name}`}__emit(e){return`@${this.name}`}static parse(t){let n=t.namedChildren.find(e=>e.type===`id`)?.text??t.text.slice(1);return I(new e(n),t)}},id=class e extends Vu{object;property;static kind=`MemberExpression`;__kind=e.kind;constructor(e,t){super(),this.object=e,this.property=t}__emit(e){return`${this.object.__emit(e)}.${this.property}`}static parse(t,n){let r=t.namedChildren,i=r[0],a=r.find(e=>e.type===`id`),o=n(i),s=a?.text??``;return I(new e(o,s),t)}},ad=class e extends Vu{object;index;static kind=`SubscriptExpression`;__kind=e.kind;constructor(e,t){super(),this.object=e,this.index=t}__emit(e){return`${this.object.__emit(e)}[${this.index.__emit(e)}]`}static parse(t,n){let r=t.namedChildren,i=n(r[0]),a=r[1],o=a.type===`slice_expression`?od.parse(a,n):n(a);return I(new e(i,o),t)}},od=class e extends Vu{start;stop;step;static kind=`SliceExpression`;__kind=e.kind;constructor(e,t,n){super(),this.start=e,this.stop=t,this.step=n}__emit(e){let t=this.start?this.start.__emit(e):``,n=this.stop?this.stop.__emit(e):``;return this.step?`${t}:${n}:${this.step.__emit(e)}`:`${t}:${n}`}static parse(t,n){let r=t.childForFieldName(`start`),i=t.childForFieldName(`stop`),a=t.childForFieldName(`step`);return I(new e(r?n(r):void 0,i?n(i):void 0,a?n(a):void 0),t)}},sd=class e extends Vu{left;operator;right;static kind=`BinaryExpression`;__kind=e.kind;constructor(e,t,n){super(),this.left=e,this.operator=t,this.right=n}__emit(e){return`${this.left.__emit(e)} ${this.operator} ${this.right.__emit(e)}`}static parse(t,n){let r=t.namedChildren,i=n(r[0]),a=n(r[1]),o=[`+`,`-`,`*`,`/`,`and`,`or`],s=`+`;for(let e of t.children){if(e.isNamed)continue;let t=o.find(t=>t===e.text);if(t){s=t;break}}return I(new e(i,s,a),t)}},cd=class e extends Vu{operator;operand;static kind=`UnaryExpression`;__kind=e.kind;constructor(e,t){super(),this.operator=e,this.operand=t}__emit(e){return this.operator===`not`?`not ${this.operand.__emit(e)}`:`${this.operator}${this.operand.__emit(e)}`}static parse(t,n){let r=t.namedChildren,i=n(r[0]),a=`not`;return t.text.startsWith(`not `)?a=`not`:t.text.startsWith(`-`)?a=`-`:t.text.startsWith(`+`)&&(a=`+`),I(new e(a,i),t)}},ld=class e extends Vu{left;operator;right;static kind=`ComparisonExpression`;__kind=e.kind;constructor(e,t,n){super(),this.left=e,this.operator=t,this.right=n}__emit(e){return`${this.left.__emit(e)} ${this.operator} ${this.right.__emit(e)}`}static parse(t,n){let r=t.namedChildren.filter(e=>!e.isError),i=n(r[0]),a=r.length>1?n(r[1]):i,o=[];for(let e of t.children)e===r[0]||e===r[1]||(e.isError?o.push(e.text.trim()):e.isNamed||o.push(e.text.trim()));let s=o.filter(e=>e.length>0).join(` `)||`==`;return I(new e(i,s,a),t)}},ud=class e extends Vu{elements;static kind=`ListLiteral`;__kind=e.kind;constructor(e){super(),this.elements=e}__describe(){return`list ${this.__emit({indent:0})}`}__emit(e){return`[${this.elements.map(t=>t.__emit(e)).join(`, `)}]`}static parse(t,n){let r=[];for(let e of t.namedChildren)r.push(n(e));return I(new e(r),t)}},dd=class e extends Vu{entries;static kind=`DictLiteral`;__kind=e.kind;constructor(e){super(),this.entries=e}__describe(){return`dictionary ${this.__emit({indent:0})}`}__emit(e){return`{${this.entries.map(t=>`${t.key.__emit(e)}: ${t.value.__emit(e)}`).join(`, `)}}`}static parse(t,n){let r=[];for(let e of t.namedChildren)if(e.type===`dictionary_pair`){let t=e.childForFieldName(`key`),i=t?.type===`key`&&t.namedChildren.length>0?t.namedChildren[0]:t,a=e.childForFieldName(`value`);i&&a&&r.push(I({key:n(i),value:n(a)},e))}return I(new e(r),t)}},fd=class e extends Vu{func;args;static kind=`CallExpression`;__kind=e.kind;constructor(e,t){super(),this.func=e,this.args=t}__describe(){return`call ${this.__emit({indent:0})}`}__emit(e){let t=this.args.map(t=>t.__emit(e)).join(`, `);return`${this.func.__emit(e)}(${t})`}static parse(t,n){let r=t.childForFieldName(`function`),i=r?n(r):new G(``),a=[];for(let e of t.childrenForFieldName(`argument`))a.push(n(e));return I(new e(i,a),t)}},pd=class e extends Vu{consequence;condition;alternative;static kind=`TernaryExpression`;__kind=e.kind;constructor(e,t,n){super(),this.consequence=e,this.condition=t,this.alternative=n}__emit(e){return`${this.consequence.__emit(e)} if ${this.condition.__emit(e)} else ${this.alternative.__emit(e)}`}static parse(t,n){let r=t.childForFieldName(`consequence`),i=t.childForFieldName(`condition`),a=t.childForFieldName(`alternative`),o=r?n(r):new G(``),s=i?n(i):new G(``),c=a?n(a):new G(``);return I(new e(o,s,c),t)}},md=class e extends Vu{static kind=`Ellipsis`;__kind=e.kind;__describe(){return`ellipsis (...)`}__emit(e){return`...`}static parse(t){return I(new e,t)}},hd=class e extends Vu{expression;static kind=`SpreadExpression`;__kind=e.kind;constructor(e){super(),this.expression=e}__describe(){return`spread *${this.expression.__describe()}`}__emit(e){return`*${this.expression.__emit(e)}`}static parse(t,n){let r=t.childForFieldName(`expression`);if(r)return I(new e(n(r)),t);let i=I(new nd(``),t);return i.__diagnostics.push(Md(t,"Spread operator `*` requires an expression to unpack",N.Error,`spread-missing-expression`)),I(new e(i),t)}};function gd(e){return e instanceof id}function _d(e){return e instanceof rd}function vd(e,t){return!gd(e)||!e.property?null:_d(e.object)||t&&e.object instanceof G&&t.has(e.object.name)?{namespace:e.object.name,property:e.property}:null}function yd(e){return vd(e)}function bd(e){if(!gd(e))return null;let t=[],n=e;for(;gd(n);){if(!n.property)return null;t.unshift(n.property),n=n.object}return _d(n)?{namespace:n.name,path:t}:null}var xd=new Set([W,Zu,Qu,$u,td,G,rd,id,ad,od,sd,cd,ld,pd,fd,ud,dd,md,hd].map(e=>e.kind)),Sd=new Map([[W.kind,`a string`],[Zu.kind,`a template`],[Qu.kind,`a number`],[$u.kind,`True or False`],[td.kind,`None`],[G.kind,`an identifier`],[rd.kind,`a reference (e.g., @Foo)`],[id.kind,`a reference (e.g., @Foo.Bar)`],[ad.kind,`a subscript expression`],[od.kind,`a slice`],[sd.kind,`a binary expression`],[cd.kind,`a unary expression`],[ld.kind,`a comparison`],[pd.kind,`a ternary expression`],[fd.kind,`a function call`],[ud.kind,`a list`],[dd.kind,`a dictionary`],[md.kind,`an ellipsis (...)`],[hd.kind,`a spread expression`]]),Cd=xd;function wd(e){return Cd.has(e)}var Td={string:e=>W.parse(e),template:(e,t)=>Zu.parse(e,t),number:e=>Qu.parse(e),True:e=>$u.parse(e),False:e=>$u.parse(e),None:e=>td.parse(e),ellipsis:e=>md.parse(e),id:e=>G.parse(e),at_id:e=>rd.parse(e),member_expression:(e,t)=>id.parse(e,t),subscript_expression:(e,t)=>ad.parse(e,t),slice_expression:(e,t)=>od.parse(e,t),binary_expression:(e,t)=>sd.parse(e,t),unary_expression:(e,t)=>cd.parse(e,t),comparison_expression:(e,t)=>ld.parse(e,t),ternary_expression:(e,t)=>pd.parse(e,t),call_expression:(e,t)=>fd.parse(e,t),list:(e,t)=>ud.parse(e,t),dictionary:(e,t)=>dd.parse(e,t),spread_expression:(e,t)=>hd.parse(e,t)},K=`agentscript-lint`;function Ed(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;e.length>t.length&&([e,t]=[t,e]);let n=e.length,r=t.length,i=Array(n+1),a=Array(n+1);for(let e=0;e<=n;e++)i[e]=e;for(let o=1;o<=r;o++){a[0]=o;for(let r=1;r<=n;r++){let n=e[r-1]===t[o-1]?0:1;a[r]=Math.min(a[r-1]+1,i[r]+1,i[r-1]+n)}[i,a]=[a,i]}return i[n]}function Dd(e,t,n=``){return t?`${e}. Did you mean '${n}${t}'?`:e}function Od(e,t){if(t.length===0)return;let n,r=1/0;for(let i of t){let t=Ed(e.toLowerCase(),i.toLowerCase());t<r&&(r=t,n=i)}if(!n)return;let i=Math.max(e.length,n.length);if(!(r/i>.4))return r===0&&e===n?void 0:n}function kd(e){let t=yd(e.value);return!t||t.namespace!==`actions`?null:t.property}function q(e,t,n,r,i){return{range:e,message:t,severity:n,code:r,source:K,...i?.tags?{tags:i.tags}:{},...i?.suggestion?{data:{suggestion:i.suggestion}}:{}}}function Ad(e){let t=yd(e);if(!t||t.namespace!==`outputs`)return null;let n=H(e)?e.__cst:void 0;return{name:t.property,...n?{cst:n}:{}}}function jd(e){let t=yd(e);return!t||t.namespace!==`variables`?null:t.property}function Md(e,t,n=N.Error,r,i){let a;if(eu(e))a=e.__cst.range;else if(`startPosition`in e)a=M(e);else if(`start`in e&&`end`in e)a=e;else throw Error(`createDiagnostic: expected Range, SyntaxNode, or Parsed node with __cst`);return{range:a,message:t,severity:n,code:r,source:`agentscript-schema`,...i?{data:i}:{}}}function Nd(e,t,n,r,i){return{range:e,message:Dd(t,r),severity:N.Error,code:`undefined-reference`,source:`agentscript-lint`,data:{referenceName:n,...r?{suggestion:r}:{},...i&&i.length>0?{expected:i}:{}}}}function J(e,t){let n=e.__diagnostics;if(Array.isArray(n)){n.push(t);return}throw Error(`attachDiagnostic: target node lacks __diagnostics array (kind: ${e.__kind??`unknown`}). Ensure the node was created via withCst(), createNode(), or extends AstNodeBase.`)}function Pd(e,t,n){return{range:`startPosition`in e?M(e):e,message:t,severity:N.Error,code:n,source:`parser`}}function Fd(e,t,n,r,i=`agentscript-schema`){return{range:e,message:t,severity:N.Error,code:`type-mismatch`,source:i,data:{expectedType:n,actualType:r}}}var Id=class{range;message;severity=N.Warning;code=`deprecated-field`;source=`agentscript`;tags=[hs.Deprecated];data;constructor(e,t,n){this.range=e,this.message=t,n&&(this.data={replacement:n})}},Y=class{all=[];own=[];add(e){this.all.push(e),this.own.push(e)}merge(e){this.all.push(...e.diagnostics)}mergeAll(e){this.all.push(...e)}};function Ld(e){return e.range!==void 0}function Rd(e){return typeof e==`object`&&!!e&&`statements`in e&&Array.isArray(e.statements)}var zd=class{_pending=[];_lastTarget;pushLeading(e){this._pending.push(e)}pushLeadingNode(e){this._pending.push(zl(e,`leading`))}tryAttachInline(e,t){if(!t?.__cst)return!1;let{__cst:n}=t;return e.startRow===n.range.end.line?(Bd(t,[zl(e,`inline`)]),!0):!1}consumeOnto(e,t){let n=t?[...this._pending,...t]:this._pending;n.length>0&&Bd(e,n),this._pending=[],this._lastTarget=e}consumeOntoFirst(e,t){if(e.length===0)return;let n=t?[...this._pending,...t]:this._pending;n.length>0&&Bd(e[0],n),this._pending=[],this._lastTarget=e[e.length-1]}get hasPending(){return this._pending.length>0}clearPending(){this._pending=[]}drainAsErrorBlocks(e){for(let t of this._pending){let n=`${t.range?`#`:`# `}${t.value}`;e.push(new Cu(n,0))}this._pending=[]}setPending(e){this._pending=e}get lastTarget(){return this._lastTarget}set lastTarget(e){this._lastTarget=e}flush(){if(this._pending.length>0&&this._lastTarget){let e=this._pending.map(e=>({...e,attachment:`trailing`}));Bd(this._lastTarget,e),this._pending=[]}}};function Bd(e,t){!e||t.length===0||(e.__comments=[...e.__comments??[],...t])}function Vd(e){return e.children.filter(t=>t.type===`comment`&&t.startRow===e.startRow).map(e=>zl(e,`inline`))}function Hd(e){return e.children.filter(e=>e.type===`comment`).map(e=>zl(e))}function Ud(e,t){if(!t)return{beforeBody:e,afterBody:[]};let n=[],r=[];for(let i of e){let e=i.range?.start.line;if(e===void 0){n.push(i);continue}if(e<t.startRow){n.push(i);continue}if(e>t.endRow){let e={...i,attachment:`trailing`};Ld(e)&&r.push(e);continue}n.push(i)}return{beforeBody:n,afterBody:r}}function Wd(e,t){if(t.length===0||!U(e))return;let n=e.entries().next();n.done||Bd(n.value[1],t)}function Gd(e,t){t.length!==0&&Rd(e)&&Bd(e.statements[0],t)}function Kd(e,t){if(t.length===0||!Rd(e))return!1;let n=e.statements[e.statements.length-1];return Bd(n,t.map(e=>({...e,attachment:`trailing`}))),!0}var qd=class e extends Hl{parts;__kind=`Template`;barePipeMultiline=!1;spaceAfterPipe=!1;constructor(e){super(),this.parts=e}get content(){return this.parts.map(e=>e.__emit({indent:0})).join(``)}__emit(e){let t=R(e),n=this.parts.map(t=>t.__emit(e)).join(``),r=R({...e,indent:e.indent+1}),i=n.split(`
|
|
109
|
+
`);if(this.barePipeMultiline&&i.length>0)return`${t}|\n${i.map(e=>e.trim().length===0?``:r+e).join(`
|
|
110
|
+
`)}`;let a=t+(this.spaceAfterPipe?` `:` `),o=i.map((e,t)=>t===0?e:e.trim().length===0?``:a+e).join(`
|
|
111
|
+
`),s=this.spaceAfterPipe?` `:``;return`${o.length>0?`${t}|${s}`:`${t}|`}${o}`}static parse(t,n){let{parts:r,diagnostics:i}=Wu(t,n),a=I(new e(r),t),o=t.text;if(o&&r.length>0){let e=o.slice(1),t=e.search(/\S/);t>0&&e.slice(0,t).includes(`
|
|
112
|
+
`)&&(a.barePipeMultiline=!0),!a.barePipeMultiline&&e.length>0&&e[0]===` `&&(a.spaceAfterPipe=!0)}return a.__diagnostics.push(...i),a}},Jd=class e extends Hl{param;value;__kind=`WithClause`;__paramCstNode;constructor(e,t){super(),this.param=e,this.value=t}__emit(e){let t=R(e);if(this.value instanceof md&&!this.value.__cst&&this.__cst)return`${t}with ${Gl(this.param)}`;let n=this.__cst?.node?.text?.includes(` = `)??!0?` = `:`=`;return`${t}with ${Gl(this.param)}${n}${this.value.__emit(e)}`}static parse(t,n){let r=t.childForFieldName(`param`),i=t.childForFieldName(`value`),a=r?Wl(r):``,o=i?n(i):new md,s=I(new e(a,o),t);return r&&(s.__paramCstNode=r),s}static parseAll(t,n){let r=t.childrenForFieldName(`param`),i=t.childrenForFieldName(`value`);if(r.length<=1)return[e.parse(t,n)];let a=[];for(let o=0;o<r.length;o++){let s=r[o],c=i[o],l=s?Wl(s):``,u=c?n(c):new md,d=I(new e(l,u),t);d.__paramCstNode=s,s&&c&&(d.__cst.range={start:M(s).start,end:M(c).end}),a.push(d)}return a}},Yd=class e extends Hl{target;value;__kind=`SetClause`;constructor(e,t){super(),this.target=e,this.value=t}__emit(e){let t=R(e);if(!this.target||!this.value){let e=this.__cst?.node?.text?.trim();return e?`${t}${e}`:`${t}set`}let n=this.__cst?.node?.text?.includes(` = `)??!0?` = `:`=`;return`${t}set ${this.target.__emit(e)}${n}${this.value.__emit(e)}`}static parse(t,n){let r=t.childForFieldName(`target`),i=t.childForFieldName(`value`),a=r?n(r):null,o=i?n(i):null;return I(new e(a,o),t)}},Xd=class e extends Hl{target;__kind=`ToClause`;constructor(e){super(),this.target=e}__emit(e){return`${R(e)}to ${this.target.__emit(e)}`}static parse(t,n){let r=t.childForFieldName(`target`),i=r?n(r):null;return I(new e(i),t)}},Zd=class e extends Hl{condition;__kind=`AvailableWhen`;constructor(e){super(),this.condition=e}__emit(e){return`${R(e)}available when ${this.condition?this.condition.__emit(e):this.__cst?.node?.childForFieldName(`condition`)?.text??``}`}static parse(t,n){let r=t.childForFieldName(`condition`),i=r?n(r):null;return I(new e(i),t)}},Qd=class e extends Hl{value;body;__kind=`RenderStatement`;constructor(e,t=[]){super(),this.value=e,this.body=t}__emit(e){let t=`${R(e)}render: ${this.value?this.value.__emit(e):this.__cst?.node?.childForFieldName(`value`)?.text??``}`;if(this.body.length===0)return t;let n={...e,indent:e.indent+1};return`${t}\n${this.body.map(e=>$l(e.__emit(n),e,n)).join(`
|
|
113
|
+
`)}`}static parse(t,n,r){let i=t.childForFieldName(`value`),a=t.childForFieldName(`body`),o=i?n(i):null,s=a?r(a):[];return I(new e(o,s),t)}},$d=class e extends Hl{value;__kind=`ShowAndReturnStatement`;constructor(e){super(),this.value=e}__emit(e){return`${R(e)}show_and_return: ${this.value?this.value.__emit(e):this.__cst?.node?.childForFieldName(`value`)?.text??``}`}static parse(t,n){let r=t.childForFieldName(`value`),i=r?n(r):null;return I(new e(i),t)}},ef=class e extends Hl{subject;body;__kind=`WhenStatement`;constructor(e,t){super(),this.subject=e,this.body=t}__emit(e){let t=`${R(e)}when ${this.subject?this.subject.__emit(e):this.__cst?.node?.childForFieldName(`subject`)?.text??``}`;if(this.body.length===0)return t;let n={...e,indent:e.indent+1};return`${t}\n${this.body.map(e=>$l(e.__emit(n),e,n)).join(`
|
|
114
|
+
`)}`}static parse(t,n,r){let i=t.childForFieldName(`subject`),a=t.childForFieldName(`body`),o=i?n(i):null,s=a?r(a):[];return I(new e(o,s),t)}},tf=class e extends Hl{target;body;__kind=`RunStatement`;constructor(e,t){super(),this.target=e,this.body=t}__emit(e){let t=R(e),n=this.target?this.target.__emit(e):this.__cst?.node?.childForFieldName(`target`)?.text??``;if(!n.trim()&&this.__cst?.node){let e=this.__cst.node.text?.trim();if(e)return e.split(`
|
|
115
|
+
`).map(e=>`${t}${e.trim()}`).join(`
|
|
116
|
+
`)}let r=`${t}run ${n}`;if(this.body.length>0){r+=`
|
|
117
|
+
`;let t={...e,indent:e.indent+1};r+=this.body.map(e=>$l(e.__emit(t),e,t)).join(`
|
|
118
|
+
`)}return r}static parse(t,n,r){let i=t.childForFieldName(`target`),a=t.childForFieldName(`block_value`),o=[];for(let e of t.children){if(e.type!==`ERROR`||!e.children.some(e=>e.type===`with`))continue;for(let t of e.namedChildren)if(t.type===`expression`||t.type===`member_expression`||t.type===`atom`){i=t;break}let n=e.children.find(e=>e.type===`with`),r=t.children.indexOf(e);for(let i=r+1;i<t.children.length;i++){let r=t.children[i];if(r.type===`expression`){let t=n?M(n).start:M(e).start;o.push(Md({start:t,end:M(r).end},`Invalid \`with\` clause: \`with ${r.text}\`. \`with\` requires named arguments (e.g., \`with name=@variables.name\`).`,N.Error,`syntax-error`));break}}break}let s=i?n(i):null,c=[],l=new zd,u=t.children.filter(e=>e.type===`comment`).map(e=>zl(e,`leading`));if(a){let e=u.filter(e=>{let t=e.range?.start.line;return t!==void 0&&t<a.startRow});for(let t of e)l.pushLeading(t);for(let e of a.children){if(e.type===`comment`){l.tryAttachInline(e,c[c.length-1])||l.pushLeadingNode(e);continue}let t=r(e);if(t)if(Array.isArray(t)){let e=t.filter(e=>e!==null);if(e.length===0)continue;l.consumeOntoFirst(e),c.push(...e)}else l.consumeOnto(t),c.push(t)}let t=u.filter(e=>{let t=e.range?.start.line;return t!==void 0&&t>a.endRow}).map(e=>({...e,attachment:`trailing`}));t.length>0&&c.length>0&&Bd(c[c.length-1],t)}let d=``,f=null;for(let e of t.children)if(e.isError){let t=e.text?.trim();t&&(f&&e.startRow===f.startRow?d+=` `+t:(d&&f&&c.push(I(new sf(d),f)),d=t,f=e))}else d&&f&&(c.push(I(new sf(d),f)),d=``,f=null);d&&f&&c.push(I(new sf(d),f)),l.flush();let p=I(new e(s,c),t);return o.length>0&&p.__diagnostics.push(...o),p}},nf=class e extends Hl{condition;body;orelse;__kind=`IfStatement`;constructor(e,t,n=[]){super(),this.condition=e,this.body=t,this.orelse=n}__emit(e){return this.__emitConditional(e,`if`)}__emitConditional(t,n){let r=R(t);if(this.body.length===0&&this.orelse.length===0&&this.__cst?.node){let e=this.__cst.node.text?.trim();if(e)return e.split(`
|
|
119
|
+
`).map(e=>`${r}${e.trim()}`).join(`
|
|
120
|
+
`)}let i=this.condition?this.condition.__emit(t):this.__cst?.node?.childForFieldName(`condition`)?.text??``;if(this.__cst?.node){let e=(this.__cst.node.text?.split(`
|
|
121
|
+
`)[0]?.trim()??``).match(/^(?:if|else\s+if)\s+(.*?):\s*$/);e&&e[1].length>i.trim().length&&(i=e[1])}let a=`${r}${n} ${i}:\n`,o={...t,indent:t.indent+1};return a+=this.body.map(e=>$l(e.__emit(o),e,o)).join(`
|
|
122
|
+
`),this.orelse.length>0&&(this.orelse.length===1&&this.orelse[0]instanceof e?a+=`
|
|
123
|
+
`+this.orelse[0].__emitConditional(t,`else if`):(a+=`
|
|
124
|
+
${r}else:\n`,a+=this.orelse.map(e=>$l(e.__emit(o),e,o)).join(`
|
|
125
|
+
`))),a}static parse(t,n,r){let i=t.childForFieldName(`condition`),a=t.childForFieldName(`consequence`),o=i?n(i):null,s=a?r(a):[],c=t.childrenForFieldName(`alternative`),l=[];for(let t=c.length-1;t>=0;t--){let i=c[t];if(i.type===`else_clause`){let e=i.childForFieldName(`consequence`);l=e?r(e):[]}else if(i.type===`else_if_clause`){let t=n(i.childForFieldName(`condition`)),a=i.childForFieldName(`consequence`),o=a?r(a):[];l=[I(new e(t,o,l),i)]}}return I(new e(o,s,l),t)}},rf=class e extends Hl{clauses;__kind=`TransitionStatement`;constructor(e){super(),this.clauses=e}__emit(e){return`${R(e)}transition ${this.clauses.map(t=>t.__emit({...e,indent:0})).join(`, `)}`}static parse(t,n){let r=[],i=t.childForFieldName(`with_to_statement_list`);if(i){for(let e of i.namedChildren)if(e.type===`to_statement`)r.push(Xd.parse(e,n));else if(e.type===`with_statement`){let t=Jd.parseAll(e,n);Array.isArray(t)?r.push(...t):r.push(t)}}return I(new e(r),t)}},af=class e extends Hl{target;instructions;__kind=`CollectClause`;constructor(e,t){super(),this.target=e,this.instructions=t}__emit(e){let t=R(e),n=R({...e,indent:e.indent+1});return`${t}ask for ${this.target?this.target.__emit({...e,indent:0}):this.__cst?.node?.childForFieldName(`target`)?.text??``}\n${n}instructions: ${this.instructions?this.instructions.__emit({...e,indent:0}):``}`}static parse(t,n){let r=t.childForFieldName(`target`),i=r?n(r):null,a=null,o=!1,s=[],c=t.childForFieldName(`body`);if(c)for(let e of c.namedChildren){if(e.type!==`mapping_element`)continue;let t=e.childForFieldName(`key`)?.namedChildren[0],r=t?Wl(t):``;if(r===`message`){o=!0,s.push(Md(t??e,"`message:` has been replaced by `instructions:`.",N.Error,`collect-message-removed`));continue}if(r!==`instructions`)continue;let i=e.childForFieldName(`colinear_value`)??e.childForFieldName(`expression`);i&&(a=n(i))}!a&&!o&&s.push(Md(t,"`ask for` requires an `instructions:` field.",N.Error,`collect-missing-instructions`));let l=I(new e(i,a),t);return l.__diagnostics.push(...s),l}},of=class e extends Hl{__kind=`EscalateStatement`;__emit(e){return`${R(e)}escalate`}static parse(t){return I(new e,t)}},sf=class extends Hl{text;__kind=`UnknownStatement`;constructor(e){super(),this.text=e}__emit(e){let t=R(e);return this.text.split(`
|
|
126
|
+
`).map(e=>`${t}${e}`).join(`
|
|
127
|
+
`)}},cf={template:(e,t)=>qd.parse(e,t),with_statement:(e,t)=>Jd.parseAll(e,t),set_statement:(e,t)=>Yd.parse(e,t),to_statement:(e,t)=>Xd.parse(e,t),available_when_statement:(e,t)=>Zd.parse(e,t),transition_statement:(e,t)=>rf.parse(e,t),escalate_statement:e=>of.parse(e),collect_statement:(e,t)=>af.parse(e,t),run_statement:(e,t,n,r)=>tf.parse(e,t,r),if_statement:(e,t,n)=>nf.parse(e,t,n),render_statement:(e,t,n)=>Qd.parse(e,t,n),show_and_return_statement:(e,t)=>$d.parse(e,t),when_statement:(e,t,n)=>ef.parse(e,t,n)};function lf(e,t){if(!Number.isFinite(e))throw Error(`${t}() requires a finite number, got ${e}`)}function uf(e,t){if(lf(e,t),e<0||!Number.isInteger(e))throw Error(`${t}() requires a non-negative integer, got ${e}`)}function df(e,t){if(lf(e,t),e<=0)throw Error(`${t}() requires a positive number, got ${e}`)}var ff=class{baseType;__fieldKind;__metadata={};__constraintCategories;emitField;constructor(e,t,n){this.baseType=e,this.__fieldKind=e.__fieldKind,this.emitField=e.emitField,t&&Object.assign(this.__metadata,t),n&&(this.__constraintCategories=n);for(let[t,n]of Object.entries(e))t in this||Object.defineProperty(this,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}parse(e,t,n){return this.baseType.parse(e,t,n)}emit(e,t){return this.baseType.emit(e,t)}get schema(){return this.baseType.schema}};function pf(e,t,n){let r=t??[],i=n?.factory===!0;function a(e,t,n){let a=e=>o({...t,...e},n),s=e=>o({...t,constraints:{...t.constraints,...e}},n);if(i||(e.describe=e=>a({description:e}),e.example=e=>a({example:e}),e.minVersion=e=>a({minVersion:e}),e.deprecated=(e,t)=>a({deprecated:{message:e,...t}}),e.experimental=()=>a({experimental:!0}),e.required=()=>a({required:!0})),e.hidden=()=>a({hidden:!0}),e.omitArrow=()=>{let e=Object.create(n);return e.emitField=(e,t,n)=>{let r=R(n),i={...n,indent:n.indent+1};return Au(t)?`${r}${e}:\n${t.__emit(i)}`:`${r}${e}:\n`},o({...t,omitArrow:!0},e)},e.disallowTemplates=e=>{let r=Object.create(n),i=n.parse.bind(n),a=`Template statements (|) are not allowed in this procedure block.`+(e?` ${e}`:``);function s(e,t,n){for(let r of e){if(r.__kind===`Template`){let e=r.__cst?.range??n;t.push(Md(e,a,N.Error,`template-in-deterministic-procedure`))}r instanceof nf&&(s(r.body,t,n),r.orelse.length>0&&s(r.orelse,t,n)),r instanceof tf&&s(r.body,t,n)}}return r.parse=function(e,t,n){let r=i(e,t,n),a=[...r.diagnostics];if(r.value&&`statements`in r.value){let t=r.value,n=t.__cst?.range??e;return s(t.statements,a,n),{value:r.value,diagnostics:a}}return r},o({...t,disallowTemplates:!0},r)},e.accepts=e=>{let r=Object.create(n);return r.__accepts=[...e],o(t,r)},e.suggest=e=>a({suggestions:[...e]}),e.allowedNamespaces=e=>s({allowedNamespaces:e}),e.resolvedType=e=>s({resolvedType:e}),e.connectionRef=e=>s({connectionRef:e}),!i){e.crossBlockReferenceable=()=>a({crossBlockReferenceable:!0}),e.transitionContainer=()=>a({transitionContainer:!0}),e.predicateField=()=>a({predicateField:!0}),e.outputNameField=()=>a({outputNameField:!0}),e.displayLabelField=()=>a({displayLabelField:!0}),e.structuredOutputField=()=>a({structuredOutputField:!0}),e.pick=e=>{if(`pick`in n&&typeof n.pick==`function`)return o(t,n.pick(e));throw Error(`Base type does not support pick()`)};let r=n;for(let i of[`extend`,`omit`,`withProperties`,`extendProperties`,`withKeyPattern`]){let a=r[i];typeof a==`function`?e[i]=(...e)=>o(t,a.apply(n,e)):e[i]=()=>{throw Error(`Base type does not support ${i}()`)}}e.clone=()=>o({...t},n)}r.includes(`number`)&&(e.min=e=>(lf(e,`min`),s({minimum:e})),e.max=e=>(lf(e,`max`),s({maximum:e})),e.exclusiveMin=e=>(lf(e,`exclusiveMin`),s({exclusiveMinimum:e})),e.exclusiveMax=e=>(lf(e,`exclusiveMax`),s({exclusiveMaximum:e})),e.multipleOf=e=>(df(e,`multipleOf`),s({multipleOf:e}))),r.includes(`string`)&&(e.minLength=e=>(uf(e,`minLength`),s({minLength:e})),e.maxLength=e=>(uf(e,`maxLength`),s({maxLength:e})),e.pattern=e=>s({pattern:e instanceof RegExp?e.source:e})),r.includes(`generic`)&&(e.enum=e=>s({enum:e}),e.const=e=>s({const:e})),r.includes(`sequence`)&&(e.minItems=e=>(uf(e,`minItems`),s({minItems:e})),e.maxItems=e=>(uf(e,`maxItems`),s({maxItems:e})))}function o(t,n=e){let i=new ff(n,t,r.length>0?r:void 0);return a(i,t,n),i}return a(e,{},e),e}var mf=[{keyword:`string`,description:`A text value, such as a name, message, or ID.`},{keyword:`number`,description:`A numeric value that can include decimals (e.g., 3.14).`},{keyword:`boolean`,description:`A True or False value.`},{keyword:`object`,description:`A collection of named values (key-value pairs).`},{keyword:`currency`,description:`A monetary amount.`},{keyword:`date`,description:`A calendar date without a time (e.g., 2025-03-15).`},{keyword:`datetime`,description:`A date and time with timezone (e.g., 2025-03-15T10:30:00Z).`},{keyword:`time`,description:`A time of day without a date (e.g., 14:30).`},{keyword:`timestamp`,description:`A point in time represented as a Unix epoch value.`},{keyword:`id`,description:`A unique record identifier.`,metadata:{deprecated:{message:`Use string instead.`,replacement:`string`}}},{keyword:`integer`,description:`A whole number with no decimal part (e.g., 42).`},{keyword:`long`,description:`A large whole number for values that may exceed normal integer range.`}],hf=[{keyword:`mutable`,description:"A variable that can be changed during the conversation. Use `set` to update its value."},{keyword:`linked`,description:`A variable whose value comes from an external system (e.g., a CRM record). Cannot be changed directly.`}],gf=new Set([`StringLiteral`,`TemplateExpression`]),_f=Array.from(gf),vf=[`StringLiteral`,`NoneLiteral`],yf=new Set(vf);function bf(e,t){return e.__cst?e:I(e,t)}function xf(e,t,n){if(e.type===`template`&&n.includes(`TemplateExpression`))return{expr:Zu.parse(e,e=>t.parseExpression(e)),diagnostics:[]};let r=t.parseExpression(e);if(!new Set(n).has(r.__kind)){let t=n.map(e=>Sd.get(e)??e).join(` or `);return{expr:bf(r,e),diagnostics:[Fd(M(e),`Expected ${t}, got ${r.__describe()}`,n.join(` | `),r.__kind)]}}return{expr:bf(r,e),diagnostics:[]}}var X=pf({__fieldKind:`Primitive`,__accepts:[..._f],parse(e,t){let n=this.__accepts??_f,r=gf,{expr:i,diagnostics:a}=xf(e,t,n.filter(e=>r.has(e)));return a.length>0?tu(I(new W(``),e),a):tu(i,[])},emit:(e,t)=>e.__emit(t)},[`string`,`generic`]),Sf=pf({__fieldKind:`Primitive`,__accepts:[...vf],parse(e,t){let{expr:n,diagnostics:r}=xf(e,t,(this.__accepts??vf).filter(e=>yf.has(e)));return r.length>0?tu(I(new W(``),e),r):tu(n,[])},emit:(e,t)=>e.__emit(t)},[`string`,`generic`]),Cf=pf(class e extends Hl{value;static __fieldKind=`Primitive`;static __accepts=[`NumberLiteral`];__kind=`NumberValue`;constructor(e){super(),this.value=e}__emit(e){return String(this.value)}static parse(t,n){let{expr:r,diagnostics:i}=xf(t,n,[`NumberLiteral`]);if(i.length>0)return tu(I(new e(0),t),i);let a=r instanceof Qu?r.value:0;return tu(I(new e(a),t),[])}static emit(e,t){return e.__emit(t)}},[`number`,`generic`]),Z=pf(class e extends Hl{value;static __fieldKind=`Primitive`;static __accepts=[`BooleanLiteral`];__kind=`BooleanValue`;constructor(e){super(),this.value=e}__emit(e){return this.value?`True`:`False`}static parse(t,n){let{expr:r,diagnostics:i}=xf(t,n,[`BooleanLiteral`]);if(i.length>0){if(r instanceof W){let n=r.value.toUpperCase();if(n===`TRUE`||n===`FALSE`)return tu(I(new e(n===`TRUE`),t),[])}return tu(I(new e(!1),t),i)}let a=r instanceof $u?r.value:!1;return tu(I(new e(a),t),[])}static emit(e,t){return e.__emit(t)}},[`generic`]),wf=pf(class e extends Hl{statements;static __fieldKind=`Primitive`;__kind=`ProcedureValue`;constructor(e){super(),this.statements=e}__emit(e){return this.statements.map(t=>$l(t.__emit(e),t,e)).join(`
|
|
128
|
+
`)}static parse(t,n){let r=new Set([`procedure`,`mapping`,`template`]),i=new Y;r.has(t.type)||i.add(Md(t,`Expected procedure (->) or template (|) syntax, got '${t.text}'`,N.Error,`invalid-procedure-value`));let a=n.parseProcedure(t);return tu(I(new e(a),t),i.all)}static emit(e,t){return e.__emit(t)}static emitField(e,t,n){let r=R(n);if(t.statements.length===1&&t.statements[0].__kind===`Template`){let i=t.__cst?.node?.type;if(i===`template`){let i=t.statements[0],a=`${r}${e}: `,o=i.spaceAfterPipe?` `:``,s=i.content.split(`
|
|
129
|
+
`),c=` `.repeat(a.length+1+o.length);if(i.barePipeMultiline){let e=R({...n,indent:n.indent+1});return`${a}|\n${s.map(t=>t.trim().length===0?``:e+t).join(`
|
|
130
|
+
`)}`}return`${a}|${o}${s.map((e,t)=>t===0?e:e.trim().length===0?``:`${c}${e}`).join(`
|
|
131
|
+
`)}`}if(i===`mapping`){let i={...n,indent:n.indent+1};return`${r}${e}:\n${t.statements[0].__emit(i)}`}}let i={...n,indent:n.indent+1},a=t.__emit(i);return a?`${r}${e}: ->\n${a}`:`${r}${e}: ->`}}),Tf=pf({__fieldKind:`Primitive`,parse:(e,t)=>{let n=t.parseExpression(e);return tu(n.__cst?n:I(n,e),[])},emit:(e,t)=>e==null?``:e.__emit(t)}),Ef=pf({__fieldKind:`Primitive`,__accepts:[`MemberExpression`],parse:(e,t)=>{let{expr:n,diagnostics:r}=xf(e,t,[`MemberExpression`]);return r.length>0?tu(I(new id(new rd(``),``),e),r):n instanceof id&&n.__cst?tu(n,[]):tu(I(new id(new rd(``),``),e),[])},emit:(e,t)=>e.__emit(t)});function Df(...e){let t=xd,n=[...new Set(e.flatMap(e=>e.__accepts??[]))].filter(e=>t.has(e));return{__fieldKind:`Primitive`,__accepts:n,parse:(e,t)=>{let{expr:r,diagnostics:i}=xf(e,t,n);return tu(r,i)},emit:(e,t)=>e.__emit(t)}}var Of=class extends Hl{__kind=`Sequence`;__children=[];inline=!1;get items(){let e=[];for(let t of this.__children)t instanceof yu&&e.push(t.value);return e}set items(e){this.__children=e.map(e=>new yu(e))}constructor(e){super(),e&&(this.__children=e.map(e=>new yu(e)))}__emit(e){return this.inline?`[${this.items.map(t=>Au(t)?t.__emit({...e,indent:0}):String(t)).join(`, `)}]`:ju(this.__children,e)}};function kf(e){let t=[],n=e.childForFieldName(`colinear_mapping_element`);n&&t.push(n);let r=e.childForFieldName(`block_value`);if(r)for(let e of r.namedChildren)e.type===`mapping_element`&&t.push(e);return t}function Af(e){return!!(e.childForFieldName(`colinear_mapping_element`)||e.childForFieldName(`block_value`))}function jf(e,t){return pf({__fieldKind:`Sequence`,schema:e?.schema,parse(n,r){let i=[],a=new Y;if(!n.namedChildren.some(e=>e.type===`sequence_element`)&&n.type!==`sequence`){let e=r.parseExpression(n);e instanceof ud?i.push(...e.elements):i.push(e);let t=I(new Of(i),n);return t.inline=!0,tu(t,a.all)}for(let o of n.namedChildren){if(o.type!==`sequence_element`)continue;if(Af(o)){if(e){let t=kf(o),n=r.parseMappingElements(t,e.schema,o),{fields:s,children:c}=Fu(n.value),l=e.fromParsedFields(s,o,n.diagnostics,c);i.push(l.value),a.merge(n)}else{a.add(Md(o,`Mapping elements are not supported in expression-only sequences. Use simple values (e.g., - "value").`,N.Error,`invalid-sequence-element`));let e=o.childForFieldName(`colinear_value`);if(e)if(t){let n=t.parse(e,r);i.push(n.value),a.merge(n)}else i.push(r.parseExpression(e))}continue}let n=o.childForFieldName(`colinear_value`);if(n)if(t){let e=t.parse(n,r);i.push(e.value),a.merge(e)}else i.push(r.parseExpression(n))}return tu(I(new Of(i),n),a.all)},emit(e,t){return e.__emit(t)},emitField(e,t,n){let r=R(n);if(t.inline)return`${r}${e}: ${t.__emit({...n,indent:0})}`;let i={...n,indent:n.indent+1};return`${r}${e}:\n${t.__emit(i)}`}},[`sequence`])}function Mf(e){return jf(e)}function Nf(e){return jf(void 0,e)}var Pf=class{__symbol;__children=[];__diagnostics=[];__cst;__comments};function Ff(e){return`${e}Collection`}var If=class e{[lu]=!0;__kind;__symbol;__children=[];__diagnostics=[];__cst;__comments;_mapIndex=new vu;static forCollection(t,n){return new e(Ff(t),n)}constructor(e,t){if(this.__kind=e,this.__symbol=t?.symbol,t?.entries)for(let[e,n]of t.entries)this.set(e,n)}get size(){return this._mapIndex.ensure(this.__children).size}get(e){return this._mapIndex.ensure(this.__children).get(e)?.value}has(e){return this._mapIndex.ensure(this.__children).has(e)}set(e,t){let n=this._mapIndex.ensure(this.__children).get(e);if(n)n.value=t;else{let n=new _u(e,t);this.__children.push(n)}return this}delete(e){let t=this._mapIndex.ensure(this.__children).get(e);if(!t)return!1;let n=this.__children.indexOf(t);return n!==-1&&this.__children.splice(n,1),!0}clear(){this.__children=[]}*_entries(){for(let e of this.__children)e instanceof _u&&(yield e)}*entries(){for(let e of this._entries())yield[e.name,e.value]}*keys(){for(let e of this._entries())yield e.name}*values(){for(let e of this._entries())yield e.value}forEach(e){for(let t of this._entries())e(t.value,t.name,this)}[Symbol.iterator](){return this.entries()}toJSON(){let e={};for(let[t,n]of this)e[t]=n;return e}__emit(e){return ju(this.__children,e)}},Lf=class extends Hl{type;defaultValue;properties;__children=[];constructor(e){super(),this.type=e.type,this.defaultValue=e.defaultValue,this.properties=e.properties}},Rf=class extends Lf{__kind=`VariableDeclaration`;__symbol={kind:V.Variable,noRecurse:!0};modifier;constructor(e){super(e),this.modifier=e.modifier}},zf=class extends Lf{__kind=`ParameterDeclaration`;__symbol={kind:V.Field,noRecurse:!0};typeInBlock=!1;constructor(e){super(e)}};function Bf(e){return H(e)&&(e.__kind===`VariableDeclaration`||e.__kind===`ParameterDeclaration`)}function Vf(e){let t=e,n=e=>(t.__metadata={...t.__metadata,...e},t);t.describe=e=>n({description:e}),t.example=e=>n({example:e}),t.required=()=>n({required:!0}),t.minVersion=e=>n({minVersion:e}),t.deprecated=(e,t)=>n({deprecated:{message:e,...t}}),t.experimental=()=>n({experimental:!0}),t.crossBlockReferenceable=()=>n({crossBlockReferenceable:!0}),t.transitionContainer=()=>n({transitionContainer:!0}),t.predicateField=()=>n({predicateField:!0}),t.outputNameField=()=>n({outputNameField:!0}),t.displayLabelField=()=>n({displayLabelField:!0}),t.structuredOutputField=()=>n({structuredOutputField:!0}),t.singular=()=>n({singular:!0}),t.clone=()=>{let e=t.__clone;if(typeof e!=`function`)throw Error(`Factory does not support clone()`);let n=e();return t.__metadata&&(n.__metadata={...t.__metadata}),n};for(let e of[`extend`,`omit`,`pick`,`withProperties`,`extendProperties`,`withKeyPattern`]){let n=t[e];typeof n==`function`&&(t[e]=(...e)=>{let r=n.apply(t,e);if(r!=null&&t.__metadata){let e=r;e.__metadata={...t.__metadata,...e.__metadata}}return r})}}function Hf(e,t){if(t?.discriminant&&!(t.discriminant in e)){let{discriminant:e,variants:n,...r}=t;return r}return t}function Uf(e){let t={};for(let[n,r]of Object.entries(e))t[n]=Array.isArray(r)?Df(...r):r;return t}function Wf(e){for(let t of Object.keys(e))if(t.startsWith(`__`))throw Error(`Field name '${t}' is invalid - field names cannot start with '__' (reserved for internal properties)`)}function Q(e,t,n){let r=Uf(t??{});n?.wildcardPrefixes?.length&&ru(r,n.wildcardPrefixes);let i=Object.freeze(r);Wf(i);let a=n?.discriminant,o=n?.variants,s=n?.variantMatchers,c,l,u;if(a){if(!i[a])throw Error(`Block '${e}': discriminant field '${a}' not found in base schema`);if(o&&Object.keys(o).length>0&&(l=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=Object.freeze({...i,...Uf(t)});return Wf(n),[e,n]}))),s&&s.length>0&&(u=s.map(e=>{let t=Object.freeze({...i,...Uf(e.schema)});return Wf(t),{name:e.name,test:e.test,schema:t}})),l||u){let e=[];l&&e.push(...Object.keys(l)),u&&e.push(...u.map(e=>e.name)),c={field:a,variants:l??{},variantMatchers:u,validValues:e}}}let d=n?.symbol??{kind:V.Object};class f extends Pf{static __fieldKind=`Block`;__kind=e;__symbol=d;static kind=e;static schema=i;static isNamed=!1;static capabilities=n?.capabilities;constructor(e,t){super(),this.__children=Pu(this,t,e,i)}static fromParsedFields(e,t,n,r,i){let a=I(new f(e,r),t);return a.__diagnostics=i??n,tu(a,n)}static parse(e,t,n){let r=t.parseMapping(e,i,n,{discriminant:c}),a=r.value.__diagnostics,{fields:o,children:s}=Fu(r.value);return f.fromParsedFields(o,e,r.diagnostics,s,a)}static emit(e,t){return e.__emit(t)}static emitField(e,t,n){let r=R(n),i={...n,indent:n.indent+1},a=t.__emit(i);return a?`${r}${e}:\n${a}`:`${r}${e}:`}__emit(e){return ju(this.__children,e)}}let p=pf(f,void 0,{factory:!0});n?.description&&Object.defineProperty(p,"__metadata",{value:{description:n.description},writable:!0,enumerable:!0,configurable:!0}),Object.defineProperty(p,"extend",{value:(t,r)=>{let a=r?{...n,...r}:n;return Q(e,{...i,...t},a)},writable:!0,configurable:!0,enumerable:!0}),Object.defineProperty(p,"omit",{value:(...t)=>{let r={...i};for(let e of t)delete r[e];return Q(e,r,Hf(r,n))},writable:!0,configurable:!0,enumerable:!0}),Object.defineProperty(p,"pick",{value:t=>{let r={},a=new Map;for(let e of t){let t=e.indexOf(`.`);if(t===-1)e in i&&(r[e]=i[e]);else{let n=e.slice(0,t),r=e.slice(t+1);a.has(n)||a.set(n,[]),a.get(n).push(r)}}for(let[e,t]of a){let n=i[e];n&&`pick`in n&&typeof n.pick==`function`&&(r[e]=n.pick(t))}return Q(e,r,Hf(r,n))},writable:!0,configurable:!0,enumerable:!0}),Object.defineProperty(p,"__clone",{value:()=>Q(e,{...i},n),writable:!0,configurable:!0,enumerable:!0});let m=(e,t)=>Object.defineProperty(p,e,{value:t,writable:!0,configurable:!0,enumerable:!0});return m(`discriminantField`,a),c&&m(`discriminantValues`,c.validValues),m(`resolveSchemaForDiscriminant`,e=>{let t=l?.[e];if(t)return t;let n=u?.find(t=>t.test(e));return n?n.schema:i}),m(`discriminant`,r=>Q(e,t??{},{...n,discriminant:r})),m(`variant`,(r,i)=>{let a={...n?.variants??{},[r]:i};return Q(e,t??{},{...n,variants:a})}),m(`variantMatch`,(r,i,a)=>{let o=[...n?.variantMatchers??[],{name:r,test:i,schema:a}];return Q(e,t??{},{...n,variantMatchers:o})}),Vf(p),p}function Gf(e,t,n){let r=Object.freeze(Uf(t??{}));Wf(r);let i=n?.colinear,a=n?.body,o=n?.symbol??{kind:V.Class},s=n?.scopeAlias,c=n?.variants,l=c?Object.fromEntries(Object.entries(c).map(([e,t])=>{let n=Object.freeze({...r,...Uf(t)});return Wf(n),[e,n]})):void 0,u=n?.variantMatchers,d=u?u.map(e=>{let t=Object.freeze({...r,...Uf(e.schema)});return Wf(t),{name:e.name,test:e.test,schema:t}}):void 0,f=(()=>{let e=[];return l&&e.push(...Object.keys(l)),d&&e.push(...d.map(e=>e.name)),e.length>0?e:void 0})(),p=n?.discriminant,m;if(p){if(!r[p])throw Error(`NamedBlock '${e}': discriminant field '${p}' not found in base schema`);let t=!!l&&Object.keys(l).length>0,n=!!d&&d.length>0;(t||n)&&(m={field:p,variants:l??{},variantMatchers:d,validValues:f??[]})}function h(e,t){if(m)return{effectiveSchema:r,discriminantConfig:m,earlyDiagnostics:[]};if(!l)return{effectiveSchema:r,discriminantConfig:void 0,earlyDiagnostics:[]};let n=l[e];return n?{effectiveSchema:n,discriminantConfig:void 0,earlyDiagnostics:[]}:{effectiveSchema:r,discriminantConfig:void 0,earlyDiagnostics:[Md(t,`Unknown variant '${e}'. Valid variants: ${f.join(`, `)}`,N.Error,`unknown-variant`)]}}class g extends Pf{__kind=e;__symbol=o;__name;__scope=s;_valueChild;get value(){return this._valueChild?.value}set value(e){if(this._valueChild)this._valueChild.value=e;else{let t=new Eu(e);this._valueChild=t,this.__children.unshift(t)}}get statements(){let e=[];for(let t of this.__children)t instanceof Du&&e.push(t.value);return e.length>0?e:void 0}set statements(e){if(this.__children=this.__children.filter(e=>e.__type!==`statement`),e)for(let t of e)this.__children.push(new Du(t))}static kind=e;static schema=r;static isNamed=!0;static allowAnonymous=n?.allowAnonymous??!1;static scopeAlias=s;static colinearType=i;static hasColinear=!!i;static hasBody=!!a;static capabilities=n?.capabilities;constructor(e,t,n){super(),Object.defineProperty(this,"_valueChild",{value:void 0,writable:!0,enumerable:!1,configurable:!0}),this.__name=e,this.__children=Pu(this,n,t,r)}static fromParsedFields(e,t,n,r,i,a){let o=I(new g(e,t,i),n);return o.__diagnostics=a??r,tu(o,r)}static parse(e,t,n,r){return i||a?g.parseColinear(e,t,n,r):g.parseMapping(e,t,n,r)}static parseMapping(e,t,n,r){let{effectiveSchema:i,discriminantConfig:a,earlyDiagnostics:o}=h(t,e);if(o.length>0)return g.fromParsedFields(t,{},e,o);let s=n.parseMapping(e,i,r,a?{discriminant:a}:void 0),c=s.value.__diagnostics,{fields:l,children:u}=Fu(s.value);return g.fromParsedFields(t,l,e,s.diagnostics,u,c)}static parseColinear(e,t,n,r){let{effectiveSchema:a,discriminantConfig:o,earlyDiagnostics:s}=h(t,e);if(s.length>0)return g.fromParsedFields(t,{},e,s);let c=e.parent,l=c?.childForFieldName(`colinear_value`)??c?.childForFieldName(`expression`),u=c?.childForFieldName(`block_value`)??c?.childForFieldName(`procedure`),d=new Y,f;if(i&&l){let e=l.childForFieldName(`expression`)??l,t=i.parse(e,n);f=t.value,d.merge(t)}let p,m={},_,v=[],y=o?{discriminant:o}:void 0;if(u){let e=n.parseBlockContent(u,a,y),t=Fu(e.fields);m=t.fields,_=t.children,e.statements.length>0&&(p=e.statements),d.mergeAll(e.diagnostics),v=e.fields.__diagnostics??[]}else if(r&&r.length>0){let t=n.parseMappingElements(r,a,e,o),i=Fu(t.value);m=i.fields,_=i.children,d.merge(t),v=t.value.__diagnostics??[];let s=n.parseStatementNodes(r);s.length>0&&(p=[...p??[],...s])}let b=[...l?.childForFieldName(`with_to_statement_list`)?.namedChildren??[],...c?.children.filter(e=>e.type===`ERROR`).flatMap(e=>e.namedChildren)??[]];if(b.length>0){let e=e=>`${e.startRow}:${e.startCol}-${e.endRow}:${e.endCol}`,t=new Set((p??[]).filter(e=>e.__cst?.node).map(t=>e(t.__cst.node))),r=n.parseStatementNodes(b).filter(n=>n.__cst?.node?!t.has(e(n.__cst.node)):!0);r.length>0&&(p=[...p??[],...r])}let x=new g(t,m,_);f!==void 0&&(x.value=f),p&&(x.statements=p);let ee=I(x,e);return ee.__diagnostics=v,tu(ee,d.all)}__emit(e){return i&&this.value!=null?this.emitColinear(e):this.emitAsEntry(e)}emitWithKey(e,t){let n=`${R(t)}${e} ${Gl(this.__name)}:`,r={...t,indent:t.indent+1},i=ju(this.__children,r);return i?`${n}\n${i}`:n}emitAsEntry(e){let t=`${R(e)}${Gl(this.__name)}:`,n={...e,indent:e.indent+1},r=ju(this.__children,n);return r?`${t}\n${r}`:t}static emit(e,t){return e.__emit(t)}static emitField(e,t,n){if(!t.__children||t.__children.length===0)return t.__cst?`${R(n)}${e}:`:``;let r=R(n),i={...n,indent:n.indent+1},a=ju(t.__children,i);return a?`${r}${e}:\n${a}`:``}emitColinear(e){let t=`${R(e)}${Gl(this.__name)}: ${i.emit(this.value,e)}`,n={...e,indent:e.indent+1},r=[];for(let e of this.__children){if(e.__type===`value`)continue;if(e instanceof Du){let i=e.value;if(i.__kind===`ToClause`){let e=this.value,a=e instanceof Hl?e.__cst?.node?.endPosition?.row:void 0,o=i.__cst?.node?.startPosition?.row;a!=null&&o!=null&&o>a?r.push(i.__emit(n)):t+=` `+i.__emit({indent:0})}else r.push(i.__emit(n));continue}let i=e.__emit(n);i&&r.push(i)}return r.length>0&&(t+=`
|
|
132
|
+
`+r.join(`
|
|
133
|
+
`)),t}}let _=pf(g,void 0,{factory:!0}),v=(e,t)=>Object.defineProperty(_,e,{value:t,writable:!0,configurable:!0,enumerable:!0});return n?.description&&v(`__metadata`,{description:n.description}),v(`resolveSchemaForName`,e=>l?.[e]??r),l&&v(`__variantNames`,Object.keys(l)),v(`extend`,(t,i)=>{let a=i?{...n,...i}:n;return Gf(e,{...r,...t},a)}),v(`omit`,(...t)=>{let i={...r};for(let e of t)delete i[e];return Gf(e,i,Hf(i,n))}),v(`pick`,t=>{let i={},a=new Map;for(let e of t){let t=e.indexOf(`.`);if(t===-1)e in r&&(i[e]=r[e]);else{let n=e.slice(0,t),r=e.slice(t+1);a.has(n)||a.set(n,[]),a.get(n).push(r)}}for(let[e,t]of a){let n=r[e];n&&`pick`in n&&typeof n.pick==`function`&&(i[e]=n.pick(t))}return Gf(e,i,Hf(i,n))}),v(`variant`,(r,i)=>{let a={...n?.variants??{},[r]:i};return Gf(e,t??{},{...n,variants:a})}),v(`variantMatch`,(r,i,a)=>{let o=[...n?.variantMatchers??[],{name:r,test:i,schema:a}];return Gf(e,t??{},{...n,variantMatchers:o})}),v(`discriminant`,r=>Gf(e,t??{},{...n,discriminant:r})),v(`discriminantField`,p),p&&f&&v(`discriminantValues`,f),v(`resolveSchemaForDiscriminant`,e=>{let t=l?.[e];if(t)return t;let n=d?.find(t=>t.test(e));return n?n.schema:r}),v(`__clone`,()=>Gf(e,{...r},n)),Vf(_),_}function Kf(e,t,n,r){if(t+1>=e.length)return;let i=e[t+1],a=i.childForFieldName(`key`)?.namedChildren.filter(ql)??[];if(!(a.length<1||a[0].startRow!==n.startRow))return{errorPrefix:r instanceof G?r.name:n.text,declType:I(new G(Wl(a[0])),a[0]),mergedElement:i,mergedKeyRemainder:a.length>=2?Wl(a[1]):void 0}}function qf(e,t){let n=[],r,i=t.startRow,a=t.startCol;for(let t of e.namedChildren)t.type===`ERROR`&&(t.startRow<i||t.startRow===i&&t.startCol<a)&&(n.push(t.text),r||=t);return n.length>0?{text:n.join(` `),errorNode:r}:void 0}function Jf(e,t,n){let r=t.startRow,i=t.startCol;for(let a of e.namedChildren)if(a.type===`ERROR`&&a.startRow===r&&a.startCol>i){let e=a.namedChildren.find(e=>e.type===`id`),r=e?e.text:a.text?.trim();if(!r)continue;let i=n instanceof G?n.name:t.text,o=e??a;return{errorPrefix:i,declType:I(new G(r),o),errorNode:a}}}function Yf(e){if(e.text?.trim())return new Cu(e.text,e.startCol)}function Xf(e,t,n,r,i,a,o){let s=t.childForFieldName(`block_value`);s||=t.namedChildren.find(e=>e.type===`mapping`)??null;let c=n.childForFieldName(`block_value`)??n.namedChildren.find(e=>e.type===`mapping`)??null,l=s??c;if(l){if(!uu(i))return;let t=i.parse(l,a);t.value&&typeof t.value==`object`&&(e.properties=t.value,e.__children.push(new hu(`properties`,t.value,i))),o.merge(t)}if(r&&e.properties){let t=n.childForFieldName(`colinear_value`)??n.childForFieldName(`expression`);if(t){let n=t.childForFieldName(`expression`)??t,o=a.parseExpression(n),s=e.properties,c=i.schema,l=c?c[r]:void 0,u=(Array.isArray(l)?l[0]:l)??Tf,d=s.__children;if(d){let e=new hu(r,o,u);d.unshift(e),Mu(s,[e])}}}}function Zf(e,t){let n=`Collection<${e.kind}>`;class r extends If{static __fieldKind=`Collection`;static kind=n;static isNamed=!1;static entryBlock=e;constructor(e){super(n,{entries:e})}static parse(t,n){let i=new r,a=new Y,o;for(let r of t.children){if(r.type===`comment`)continue;if(r.type===`ERROR`){let e=Yf(r);e&&o&&(o.__children??=[]).push(e);continue}if(r.type!==`mapping_element`)continue;let[t,s]=n.getKeyIds(r),c=t;if(!c)continue;if(s!==void 0){let e=r.childForFieldName(`key`);a.add(Md(e??r,`Composite key '${e?.text??`${t} ${s}`}' is not allowed; expected a single name`,N.Error,`composite-key`))}let{blockValue:l,colinearValue:u,procedure:d}=L(r),f=l??u??d??r,p=e.parse(f,c,n);if(i.has(c)){let e=r.childForFieldName(`key`),t=Md(e??r,`Duplicate key '${e?.text??c}'`,N.Warning,`duplicate-key`);a.add(t)}if(i.set(c,p.value),o=p.value,a.merge(p),r.children.some(e=>e.isError)){let e=i.__children[i.__children.length-1];e instanceof _u&&gu(e,r)}}return i.__diagnostics=a.own,tu(I(i,t),a.all)}static emit(e,t){return e.__emit(t)}static emitField(e,t,n){if(!t.__children||t.__children.length===0)return t.__cst?`${R(n)}${e}:`:``;let r=R(n),i={...n,indent:n.indent+1},a=ju(t.__children,i);return a?`${r}${e}:\n${a}`:``}}let i=pf(r,void 0,{factory:!0}),a=(e,t)=>Object.defineProperty(i,e,{value:t,writable:!0,configurable:!0,enumerable:!0}),o=e.__metadata,s={};return o?.example&&(s.example=o.example),o?.description&&(s.description=o.description),t?.description&&(s.description=t.description),Object.keys(s).length>0&&a(`__metadata`,s),a(`schema`,e.schema),a(`scopeAlias`,e.scopeAlias),a(`capabilities`,e.capabilities),a(`colinearType`,e.colinearType),a(`__isCollection`,!0),a(`__clone`,()=>Zf(e,t)),Vf(i),i}function Qf(e,t){let n=Zf(e,t),r=(e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0,enumerable:!0});return r(`__isNamedCollection`,!0),r(`__clone`,()=>Qf(e,t)),Vf(n),n}var $f=class{node;name;index;keyNode;keyChildren;leadingComments;inlineComments;constructor(e,t,n){this.node=e,this.index=n,this.leadingComments=t;let r=e.childForFieldName(`key`);this.keyNode=r,this.keyChildren=r?.namedChildren.filter(ql)??[],this.name=this.keyChildren[0]?Wl(this.keyChildren[0]):``,this.inlineComments=e.namedChildren.filter(e=>e.type===`comment`).map(e=>zl(e,`inline`))}get isQuotedKey(){return this.keyChildren[0]?.type===`string`}get isCompositeKey(){return this.keyChildren.length>1}get isEmptyKey(){return!this.name&&this.keyChildren.length>0}get diagnosticRange(){return this.keyNode??this.node}getColinearNode(){return this.node.childForFieldName(`colinear_value`)??this.node.childForFieldName(`expression`)}hasErrors(){return this.node.children.some(e=>e.type===`ERROR`)}getAttachedComments(){return[...this.leadingComments.map(e=>({...e,attachment:`leading`})),...this.inlineComments.map(e=>({...e,attachment:`inline`}))]}getRawValueText(){let e=this.node.text,t=e.indexOf(`:`);return t>=0?e.substring(t+1).trimStart():``}getBlockNode(){return this.node.childForFieldName(`block_value`)??this.node.namedChildren.find(e=>e.type===`mapping`)??null}},ep=class{dc=new Y;mergedElementIndices=new Set;elementNodes=[];declarations;blockLabel;hasModifier;modifiers;primitiveTypes;propertiesBlock;dialect;options;reservedNames;constructor(e,t,n,r,i,a,o,s){this.declarations=e,this.blockLabel=t,this.hasModifier=n,this.modifiers=r,this.primitiveTypes=i,this.propertiesBlock=a,this.dialect=o,this.options=s,this.reservedNames=[...ou(i),...ou(r),`list`]}run(e){let{elements:t,trailingComments:n}=this.collectElements(e);this.elementNodes=t.map(e=>e.node);let r;for(let e of t)r=this.processElement(e)??r;if(n.length>0&&r){let e=n.map(e=>({...e,attachment:`trailing`}));r.__comments=[...r.__comments??[],...e]}return this.declarations.__diagnostics=this.dc.own,tu(I(this.declarations,e),this.dc.all)}processElement(e){if(this.mergedElementIndices.has(e.index))return;this.validateKey(e);let t=e.getColinearNode();if(t)return this.processColinearElement(e,t);if(e.name&&e.hasErrors())return this.processErrorElement(e);if(e.name&&this.options.allowTypelessEntries){let t=e.getBlockNode();if(t)return this.processTypelessElement(e,t)}e.name&&this.processMissingTypeElement(e)}processColinearElement(e,t){let n=this.dialect.parseVariableDeclaration(t);this.validateReservedName(e);let r=this.resolveErrorRecovery(e,t,n.type);this.validateModifier(e,n,t),this.primitiveTypes.length>0&&this.validateType(e,r.declType,t);let i=I(this.hasModifier&&n.modifier?new Rf({type:r.declType,defaultValue:n.defaultValue,modifier:n.modifier}):new zf({type:r.declType,defaultValue:n.defaultValue}),e.node),a=e.getAttachedComments();if(a.length>0&&(i.__comments=a),r.mergedElement)Xf(i,e.node,r.mergedElement,r.mergedKeyRemainder,this.propertiesBlock,this.dialect,this.dc);else{let t=e.getBlockNode();if(t&&uu(this.propertiesBlock)){let e=this.propertiesBlock.parse(t,this.dialect);e.value&&typeof e.value==`object`&&(i.properties=e.value,i.__children.push(new hu(`properties`,e.value,this.propertiesBlock))),this.dc.merge(e)}}if(r.errorPrefix){let n=new Cu(r.errorPrefix,t.startCol);i.__children.unshift(n),this.hasModifier&&this.emitInvalidModifierDiagnostic(r.errorPrefix,e,r.errorPrefixNode??t)}return this.validateDuplicateName(e),this.declarations.set(e.name,i),i}processMissingTypeElement(e){let t=ou(this.primitiveTypes),n=t.length>0?`Expected a type after ':' (${t.slice(0,5).join(`, `)}, ...)`:`Expected a type after ':'`;this.dc.add(Md(e.node,`Missing type for ${this.blockLabel} '${e.name}'. ${n}`,N.Error,`missing-type`,{expected:t}))}processTypelessElement(e,t){this.validateReservedName(e);let n=I(new zf({type:I(new G(``),e.node)}),e.node),r=e.getAttachedComments();if(r.length>0&&(n.__comments=r),uu(this.propertiesBlock)){let e=this.propertiesBlock.parse(t,this.dialect),r=e.value;if(r&&typeof r==`object`){n.properties=r,n.__children.push(new hu(`properties`,r,this.propertiesBlock));let e=r.type;e?.typeName&&e.typeName.name&&(n.type=e.typeName)}this.dc.merge(e)}return n.typeInBlock=!0,this.validateDuplicateName(e),this.declarations.set(e.name,n),n}processErrorElement(e){let t=e.getRawValueText();if(!t)return;let n=I(new nd(t),e.node),r=I(this.hasModifier?new Rf({type:n}):new zf({type:n}),e.node),i=e.getAttachedComments();return i.length>0&&(r.__comments=i),this.validateDuplicateName(e),this.declarations.set(e.name,r),r}collectElements(e){let t=[],n=[];for(let r of e.namedChildren){if(r.type===`comment`){n.push(zl(r,`leading`));continue}if(r.type===`mapping_element`){t.push(new $f(r,n,t.length)),n=[];continue}n=[]}return{elements:t,trailingComments:n}}validateKey(e){if(e.isCompositeKey){let t=e.diagnosticRange;this.dc.add(Md(t,`Composite key '${t.text?.replace(/:$/,``)??e.name}' is not allowed; expected a single name`,N.Error,`composite-key`))}if(e.isEmptyKey&&this.dc.add(Md(e.diagnosticRange,`Empty field name is not allowed`,N.Error,`empty-field-name`)),e.name&&this.options.keyPattern)try{new RegExp(this.options.keyPattern).test(e.name)||this.dc.add(Md(e.keyChildren[0]??e.diagnosticRange,`'${e.name}' does not match required pattern /${this.options.keyPattern}/`,N.Error,`invalid-key-pattern`))}catch{}}validateReservedName(e){!e.name||e.isQuotedKey||this.reservedNames.includes(e.name)&&this.dc.add(Md(e.keyChildren[0],`'${e.name}' is a reserved keyword and cannot be used as a variable name. Reserved: ${this.reservedNames.join(`, `)}`,N.Error,`reserved-name`,{found:e.name,expected:this.reservedNames}))}validateModifier(e,t,n){!this.hasModifier||!t.modifier||this.emitInvalidModifierDiagnostic(t.modifier.name,e,n)}emitInvalidModifierDiagnostic(e,t,n){let r=ou(this.modifiers);if(r.includes(e))return;let i=Od(e,r),a=i?`Did you mean '${i}'?`:`Valid modifiers: ${r.join(`, `)}`;this.dc.add(Md(n,`Unknown modifier '${e}' for ${this.blockLabel} ${t.name}. ${a}`,N.Error,`invalid-modifier`,{found:e,expected:r}))}validateDuplicateName(e){!e.name||!this.declarations.has(e.name)||this.dc.add(Md(e.diagnosticRange,`'${e.name}' is already defined in ${this.blockLabel}`,N.Error,`duplicate-name`))}resolveErrorRecovery(e,t,n){let r=n,i,a,o,s,c=qf(e.node,t),l;if(t.type===`variable_declaration`){let e=[];for(let n of t.children)if(n.type===`ERROR`){let t=n.text?.trim();t&&e.push(t)}e.length>0&&(l=e.join(` `))}let u=Kf(this.elementNodes,e.index,t,n);if(u)i=c?`${c.text}${u.errorPrefix}`:u.errorPrefix,c&&(a=c.errorNode),r=u.declType,o=u.mergedElement,s=u.mergedKeyRemainder,this.mergedElementIndices.add(e.index+1);else{let o=Jf(e.node,t,n);o?(i=c?`${c.text}${o.errorPrefix}`:o.errorPrefix,a=o.errorNode,r=o.declType):c&&(i=c.text,a=c.errorNode)}return l&&(i=i?`${i} ${l}`:l),{declType:r,errorPrefix:i,errorPrefixNode:a,mergedElement:o,mergedKeyRemainder:s}}validateType(e,t,n){if(t instanceof G){let r=t.name,i=ou(this.primitiveTypes);if(i.includes(r))this.emitDeprecatedTypeDiagnostic(r,t.__cst?t.__cst.range:n);else{let a=Od(r,i),o=a?`Did you mean '${a}'?`:`Valid types: ${i.join(`, `)}`;this.dc.add(Md(t.__cst?t.__cst.range:n,`Unknown type '${r}' for ${this.blockLabel} ${e.name}. ${o}`,N.Error,`unknown-type`,{found:r,expected:i}))}}else t instanceof ad&&this.validateSubscriptType(e,t)}emitDeprecatedTypeDiagnostic(e,t){let n=this.primitiveTypes.find(t=>t.keyword===e)?.metadata?.deprecated;if(!n)return;let r;r=eu(t)?t.__cst.range:`startPosition`in t?M(t):t;let i=n.message?`'${e}' is deprecated: ${n.message}`:`'${e}' is deprecated`;this.dc.add(new Id(r,i,n.replacement))}validateSubscriptType(e,t){let n=t.object,r=t.index;if(!(n instanceof G)||n.name!==`list`){let e=n instanceof G?n.name:n.__emit({indent:0});this.dc.add(Md(n,`'${e}' does not support type parameters. Only 'list' supports type parameters (e.g., list[string]).`,N.Error,`invalid-type-parameter`,{found:e}))}else if(r instanceof ad)this.dc.add(Md(r,`Nested list types are not supported (e.g., list[list[string]]). Use a flat list type like list[string].`,N.Error,`nested-list-type`));else if(r instanceof G){let t=r.name,n=ou(this.primitiveTypes);if(n.includes(t))this.emitDeprecatedTypeDiagnostic(t,r);else{let i=Od(t,n),a=i?`Did you mean '${i}'?`:`Valid element types: ${n.join(`, `)}`;this.dc.add(Md(r,`Unknown list element type '${t}' for ${this.blockLabel} ${e.name}. ${a}`,N.Error,`unknown-type`,{found:t,expected:n}))}}}};function tp(e,t,n={}){let r=n.modifiers??[],i=n.primitiveTypes??[],a=r.length>0,o=e.replace(/Block$/,``).toLowerCase(),s=n.symbol??{kind:V.Namespace};class c extends If{static __fieldKind=`TypedMap`;static kind=e;static isNamed=!1;static __isTypedMap=!0;static propertiesSchema=t.schema;static __modifiers=r;static __primitiveTypes=i;static propertiesBlock=t;constructor(t){super(e,{symbol:s,entries:t})}static emit(e,t){return e.__emit(t)}static emitField(e,t,n){let r=R(n),i={...n,indent:n.indent+1},a=t.__emit(i);return a?`${r}${e}:\n${a}`:`${r}${e}:`}static withProperties(t){return tp(e,t,n)}static extendProperties(r){if(`extend`in t&&typeof t.extend==`function`)return tp(e,t.extend(r),n);throw Error(`Properties block for '${e}' does not support extend(). Use withProperties() instead.`)}static withKeyPattern(r){return tp(e,t,{...n,keyPattern:r})}static parse(e,s){return new ep(new c,o,a,r,i,t,s,n).run(e)}__emit(e){let t=R(e),n=[],o=new Set([...ou(i),...ou(r),`list`]);for(let[r,i]of this.entries()){if(!i)continue;let s=i.__comments??[],c=s.filter(e=>e.attachment===`leading`),l=s.filter(e=>e.attachment===`inline`),u=s.filter(e=>e.attachment===`trailing`),d=Ql(c,e);d&&n.push(d);let f=i.__cst?.node?.childForFieldName(`key`)?.namedChildren.find(ql),p=(f?f.type===`string`:o.has(r))?Kl(r):Gl(r),m=ed(i instanceof zf?i.typeInBlock:!1)===!0,h=`${t}${p}:`;if(!m){h+=` `,a&&`modifier`in i&&i.modifier instanceof G&&(h+=`${i.modifier.__emit(e)} `);for(let e of i.__children)if(e instanceof Cu){h+=`${e.rawText} `;break}h+=i.type.__emit(e),i.defaultValue?h+=` = ${i.defaultValue.__emit(e)}`:i.__cst?.node?.text?.trimEnd().endsWith(`=`)&&(h+=` =`)}if(l.length>0){let e=l.map(e=>e.value.trim().length===0?`#`:`${e.range?`#`:`# `}${e.value}`).join(` `);h+=` ${e}`}n.push(h);let g=Ql(u,{...e,indent:e.indent+1});if(g&&n.push(g),Au(i.properties)){let t=i.properties.__emit({...e,indent:e.indent+1});t&&n.push(t)}}return n.join(`
|
|
134
|
+
`)}}let l=pf(c,void 0,{factory:!0});return n.description&&Object.defineProperty(l,"__metadata",{value:{description:n.description},writable:!0,configurable:!0,enumerable:!0}),Object.defineProperty(l,"__clone",{value:()=>tp(e,t,n),writable:!0,configurable:!0,enumerable:!0}),Vf(l),l}var np=class extends Hl{__kind=`TypeDescriptor`;__symbol={kind:V.Object,noRecurse:!0};__children=[];typeName;properties;constructor(e){super(),this.typeName=e}__emit(e){let t=[];if(t.push(this.typeName.__emit(e)),this.__children.length>0){let n={...e,indent:e.indent+1},r=ju(this.__children,n);r&&t.push(`
|
|
135
|
+
`+r)}return t.join(``)}};function rp(e){let{primitiveTypes:t,typeParameterSchemas:n}=e,r=ou(t);return pf({__fieldKind:`Block`,parse(e,t){let i=new Y,a=null,o=null;if(e.type===`mapping`){o=e;let t=e.parent;t&&(a=t.childForFieldName(`colinear_value`)??t.childForFieldName(`expression`)??null)}else a=e;let s=``,c;if(a){let e=a.childForFieldName(`expression`)??a,t=e.type===`id`?e:e.namedChildren?.find(e=>e.type===`id`);if(t?(s=t.text,c=I(new G(s),t)):(s=a.text.trim(),c=I(new G(s),a)),s&&!r.includes(s)&&s!==`list`){let e=Od(s,[...r,`list`]),n=e?`Did you mean '${e}'?`:`Valid types: ${[...r,`list`].join(`, `)}`;i.add(Md(t??a,`Unknown type '${s}'. ${n}`,N.Error,`unknown-type`,{found:s,expected:[...r,`list`]}))}}else c=new G(``),i.add(Md(e,`Missing type keyword after 'type:'`,N.Error,`missing-type-keyword`));let l=I(new np(c),e);if(o&&s){let e=n[s];if(e&&Object.keys(e).length>0){let n=t.parseMapping(o,e);if(n.value&&typeof n.value==`object`){l.properties=n.value;for(let t of Object.keys(e)){let r=n.value[t];if(r!==void 0){let n=e[t];l.__children.push(new hu(t,r,n))}}}i.merge(n)}else o.namedChildren.length>0&&i.add(Md(o,`Type '${s}' does not accept type parameters.`,N.Error,`unexpected-type-parameters`))}return l.__diagnostics=i.all,tu(l,i.all)},emit(e,t){return e.__emit(t)},emitField(e,t,n){let r=R(n),i={...n,indent:n.indent+1},a=t.typeName.__emit(n),o=``;if(t.__children.length>0){let e=ju(t.__children,i);e&&(o=`
|
|
136
|
+
`+e)}return`${r}${e}: ${a}${o}`}},void 0)}function ip(e){return e instanceof Uu}function ap(e){return e instanceof id}function op(e){return e instanceof td}function sp(e){return e instanceof ad}function cp(e){return e instanceof rd}function lp(e){return H(e)&&e.__kind===`SetClause`}function up(e){return H(e)&&e.__kind===`WithClause`}function dp(e,t){for(let n of e){if(n.type!==`mapping_element`)continue;let e=n.childForFieldName(`key`);if(!e||Wl(e)!==t)continue;let{colinearValue:r}=L(n);if(!r)continue;let i=r.childForFieldName(`expression`)??r,a=i.text?.trim();if(a)return a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`)?{value:a.slice(1,-1),cstNode:i}:{value:a,cstNode:i}}}function fp(e){let t=M(e),n=e.previousSibling;if(n&&t.start.line===t.end.line&&t.start.character===t.end.character&&n.endPosition.row<e.startPosition.row){let e=n.endPosition;return{start:{line:e.row,character:e.column},end:{line:e.row,character:e.column}}}return t}function pp(e){let t=[];return mp(e,t),t}function mp(e,t){for(let n of e.children)if(n.isMissing)t.push(Pd(fp(n),`Missing ${n.type}`,`missing-token`));else if(n.isError){if(e.type!==`run_statement`){let e=n.text?.trim();t.push(Pd(n,e?`Syntax error: unexpected \`${e.length>40?e.slice(0,40)+`…`:e}\``:`Syntax error`,`syntax-error`))}mp(n,t)}else mp(n,t)}function hp(e,t,n){let r=t+1;for(;r<e.length&&!(e[r].startCol<=n);)r++;if(r>t+1)return{adopted:e.slice(t+1,r),newIndex:r-1}}function gp(e){let t=e.childForFieldName(`key`),n=t?.namedChildren.find(ql);if(n)return M(n);if(t)return M(t)}var _p=class{parse(e,t){let n=[],r=null;for(let t of e.namedChildren)if(t.type===`comment`){let e=r?`trailing`:`leading`;n.push(this.parseComment(t,e))}else(t.type===`mapping`||t.namedChildren.some(e=>e.type===`mapping_element`))&&(r=t);!r&&e.namedChildren.some(e=>e.type===`mapping_element`)&&(r=e);let i=r??e,a=i.namedChildren;if(r&&r!==e){let t=[];for(let n of e.namedChildren)n===r||n.type===`comment`||t.push(n);t.length>0&&(a=[...a,...t])}let o=this.parseMappingElements(a,t,i),s=o.value.__children,c=Array.isArray(s)?s:[],l=Object.keys(t).some(e=>o.value[e]!==void 0),u=c.length>0&&c.every(e=>e instanceof Cu);!l&&(e.isError||c.length===0||u)&&e.namedChildren.some(e=>e.type!==`comment`)&&e.text?.trim()&&(o.value.__children=[new Cu(e.text,e.startCol)]);let d=pp(e);if(d.length>0&&(o.value.__diagnostics.push(...d),o.diagnostics.push(...d)),n.length>0){let e=o.value.__children;Array.isArray(e)&&e.length>0&&e.every(e=>e instanceof Cu)||Bd(o.value,n)}return o}parseComment(e,t=`leading`){return zl(e,t)}buildContextPath(e){let t=[],n=e;for(;n&&n.type!==`document`;){if(n.type===`mapping_element`){let e=(n.childForFieldName(`key`)?.namedChildren.filter(ql))?.map(e=>Wl(e))??[];e.length>0&&t.unshift(...e)}n=n.parent}return t}formatStatementContext(e){let t=this.buildContextPath(e.parent??e);if(t.length===0)return``;if(t.length>=3){let e=t[t.length-1];return` in ${t[0]} '${t.slice(1,t.length-1).join(` `)}' ${e}`}return t.length===2?` in ${t[0]} '${t[1]}'`:` in ${t[0]}`}parseMapping(e,t,n,r){let i=n?[...e.namedChildren,...n]:e.namedChildren,a=this.parseMappingElements(i,t,e,r?.discriminant);if(r?.preserveOrphanedStatements!==!1){let e=a.value.__children;if(Array.isArray(e)){for(let t of i)if(t.type in cf){let n=Yf(t);n&&e.push(n)}}}return a}parseMappingElements(e,t,n,r){let i=t,a=[];if(r){let t=dp(e,r.field);if(t){let e=r.variants[t.value];if(e)i=e;else{let e=r.variantMatchers?.find(e=>e.test(t.value));e?i=e.schema:a.push(Md(t.cstNode,`Unknown variant '${t.value}' for discriminant '${r.field}'. Valid values: ${r.validValues.join(`, `)}`,N.Error,`unknown-variant`))}}}t=i;let o={},s={},c=new Y;for(let e of a)c.add(e);let l=[],u={},d=new zd;function f(e,t){if(e&&fu(e))return{entryBlock:e.entryBlock,parentFieldType:e,createContainer:()=>new e}}let p=n.type===`ERROR`;for(let n=0;n<e.length;n++){let r=e[n];if(r.type===`comment`){d.pushLeadingNode(r);continue}if(r.isMissing)continue;if(r.type===`ERROR`){let e=this.parseMapping(r,t);for(let n of Object.keys(t))n in e.value&&(o[n]=e.value[n]);let n=e.value,i=Array.isArray(n.__children)?n.__children:[],a=Object.keys(t).some(t=>t in e.value&&e.value[t]!==void 0);if(i.length>0&&a)l.push(...i);else{let e=Yf(r);e&&l.push(e)}if(!p&&!Object.keys(t).some(t=>t in e.value&&e.value[t]!==void 0)){let e=r.text?.trim();e&&c.add(Pd(r,`Unrecognized syntax: ${e.length>40?e.slice(0,40)+`…`:e}`,`syntax-error`))}c.merge(e);continue}if(r.type!==`mapping_element`){if(r.type in cf||r.type===`comment`||r.type===`key`||r.type===`expression_with_to`||r.type===`expression`||r.type===`variable_declaration`||r.type===`procedure`)continue;let e=Yf(r);e&&l.push(e);continue}let i=[],[a,m]=this.getKeyIds(r),h=t[a],g=Array.isArray(h)?h[0]:h,_=!1;if(!g){let e=au(t,a);e&&(g=e.fieldType,_=e.typedEntry===!0)}let v=Vd(r),y=Hd(r);if(!g){if(!p){let e=r.childForFieldName(`key`)?.namedChildren.filter(ql),n=e?.[0]?M(e[0]):M(r),i=this.buildContextPath(r.parent??r),o=i.length===0,s=Object.keys(t),l=Od(a,s),u=Dd(o?`Unknown block: ${a}`:`Unknown field \`${a}\` in ${i.join(` `)}`,l),d=o?`unknown-block`:`unknown-field`,f=Md(n,u,N.Error,d,{...l?{suggestion:l}:{},expected:s});c.add(f)}let{blockValue:e,colinearValue:n,procedure:i}=L(r),o=e?.type===`mapping`?e:null;if(n){let e=new hu(a,this.parseExpression(n),Tu(r.text,r.startCol));gu(e,r),d.hasPending&&d.drainAsErrorBlocks(l),l.push(e)}else{let e=new wu(a,m,r.text,r.startCol);if(e.__cst={node:r,range:M(r)},d.consumeOnto(e),o){let t=r.startPosition.row,n=[],i=[],a=!1;for(let e of r.namedChildren){if(e===o){a=!0;continue}e.type===`comment`&&e.startPosition.row!==t&&(a?i:n).push(new Cu(`# ${zl(e,`leading`).value}`,0))}let s=this.parseMappingElements(o.namedChildren,{},o),c=s.value,l=Array.isArray(c.__children)?c.__children:[];e.__children=[...n,...l,...i],e.__diagnostics.push(...s.diagnostics)}else if(i&&i.type===`procedure`){let t=this.parseProcedure(i);for(let n of t)e.__children.push(new Du(n))}Mu(e,e.__children),l.push(e)}continue}if(g.__metadata?.deprecated){let e=r.childForFieldName(`key`)?.namedChildren.filter(e=>e.type===`id`),t=e?.[0]?M(e[0]):M(r),n=g.__metadata.deprecated,i=new Id(t,n.message?`'${a}' is deprecated: ${n.message}`:`'${a}' is deprecated`,n.replacement);c.add(i)}let{blockValue:b,colinearValue:x,procedure:ee}=L(r),te=b??x??ee,S=f(g,a);if(m&&S){let t=!!(b||x||ee),i;if(!t){let t=hp(e,n,r.startCol);t&&(i=t.adopted,n=t.newIndex)}let{entryBlock:o,parentFieldType:u,createContainer:f}=S;s[a]??=f();let{value:p,extraComments:h,diagnostics:g}=this.parseNamedEntry(o,r,m,v,i);d.consumeOnto(p,h),s[a].set(m,p);let _=new hu(a,p,u,m,gp(r));l.push(_),c.mergeAll(g)}else if(m&&uu(g)){let e=r.childForFieldName(`key`)?.namedChildren.filter(ql)?.[1],t=e?M(e):gp(r);t&&c.add(Md(t,`Unexpected name \`${m}\` on \`${a}\` — this field does not take a name`,N.Error,`unexpected-block-name`));let n=g;if(te){let e=n.parse(te,this);d.consumeOnto(e.value,v),o[a]=e.value;let t=new hu(a,e.value,g,void 0,gp(r));l.push(t),c.merge(e)}}else if(S&&S.entryBlock.allowAnonymous){if(te){let e=r.childForFieldName(`key`)?.namedChildren.filter(ql),t=Md(e?.[0]?M(e[0]):M(r),`Anonymous ${a} name is not allowed`,N.Warning,`anonymous-named-block`);c.add(t);let n=`ILLEGAL_anonymous_${a}_${u[a]=(u[a]??0)+1}`,{entryBlock:i,parentFieldType:o,createContainer:f}=S;s[a]??=f();let{value:p,extraComments:m,diagnostics:h}=this.parseNamedEntry(i,r,n,v);d.consumeOnto(p,m),s[a].set(n,p);let g=new hu(a,p,o,n,gp(r));l.push(g),c.mergeAll(h)}}else if(uu(g)){if(!_&&te){let e=g.__fieldKind,t=e===`TypedMap`||e===`Collection`||e===`Block`&&typeof g.fromParsedFields==`function`,n=te===x||te===b&&b?.type===`atom`;t&&n&&c.add(Md(gp(r)??M(r),`\`${a}\` expects a nested block with fields, not a value`,N.Error,`invalid-block-value`))}let t;if(_){let e=r.childForFieldName(`colinear_value`)??r.childForFieldName(`expression`);t=e?this.parseVariableDeclaration(e):void 0}let s;if(g.__fieldKind===`Block`&&te){let t=hp(e,n,r.startCol);if(t){let e=te.startCol,r=t.adopted.filter(t=>t.startCol>=e);r.length>0&&(s=r,n=t.newIndex)}}let u=this.parseSingularField(g,a,r,te,v,y,d,s);if(u){let e=u.value;if(_){let n=I(new zf({type:t?.type??I(new G(`unknown`),r),defaultValue:t?.defaultValue}),r);e&&typeof e==`object`&&(n.properties=e,n.__children.push(new hu(`properties`,e,g))),e=n}o[a]=e;let n=new hu(a,e,g,void 0,gp(r));l.push(n),c.mergeAll(u.diagnostics),i.push(...u.dedentedComments);for(let e of r.children)if(e.isError){let t=Yf(e);t&&l.push(t)}}else{let e=Yf(r);e&&l.push(e),te||c.add(Md(r,`Missing value for '${a}'`,N.Error,`missing-value`))}}d.setPending(i)}d.flush();for(let e of Object.values(s))e.__cst||={node:n,range:M(n)};let m=I({...o,...s,__children:l},n);return m.__diagnostics=c.own,tu(m,c.all)}parseSingularField(e,t,n,r,i,a,o,s){let c=[];if(r){let t=e.parse(r,this,s),{beforeBody:l,afterBody:u}=Ud(a.filter(e=>e.range?.start.line!==n.startRow),r);if(e.__fieldKind===`TypedMap`||e.__fieldKind===`Collection`)Wd(t.value,l);else if(e.__fieldKind===`Primitive`)Gd(t.value,l);else if(e.__fieldKind===`Block`&&l.length>0){let e=t.value,n=Object.keys(e).find(t=>!t.startsWith(`__`)&&e[t]&&typeof e[t]==`object`);n&&Bd(e[n],l)}let d=u;if(e.__fieldKind===`Primitive`){let e=u.filter(e=>e.range.start.character>n.startCol),r=u.filter(e=>e.range.start.character<=n.startCol);d=Kd(t.value,e)?[]:e,r.length>0&&c.push(...r)}if(o.consumeOnto(t.value,[...i,...d]),e.__fieldKind===`Primitive`&&t.diagnostics.length>0){let e=t.value;e.__diagnostics&&e.__diagnostics.push(...t.diagnostics)}return{value:t.value,dedentedComments:c,diagnostics:t.diagnostics}}if(e.__fieldKind===`Block`){let t=e.fromParsedFields({},n,[]);return o.consumeOnto(t.value),{value:t.value,dedentedComments:c,diagnostics:[]}}if(e.__fieldKind===`TypedMap`){let e=If.forCollection(t);return e.__cst={node:n,range:M(n)},o.consumeOnto(e),{value:e,dedentedComments:c,diagnostics:[]}}if(e.__fieldKind===`Collection`){let t=e.parse(n,this);return o.consumeOnto(t.value),{value:t.value,dedentedComments:c,diagnostics:[]}}return null}parseNamedEntry(e,t,n,r,i){let{blockValue:a,colinearValue:o,procedure:s}=L(t),c=a??o??s,l=new Y,u=t.children.filter(e=>e.type===`comment`).filter(e=>e.startRow!==t.startRow).map(e=>this.parseComment(e,`trailing`)),d;if(c){let t=e.parse(c,n,this);d=t.value,l.merge(t)}else{let r=e.parse(t,n,this,i);d=r.value,l.merge(r)}return{value:d,extraComments:[...r,...u],diagnostics:l.all}}getKeyIds(e){let t=e.childForFieldName(`key`);if(!t)return[``,void 0];let n=t.namedChildren.filter(ql);return n.length===2?[Wl(n[0]),Wl(n[1])]:[n[0]?Wl(n[0]):``,void 0]}parseExpression(e){if(!e)return new G(``);if(e.isMissing){let t=I(new nd(``),e);return t.__diagnostics.push(Pd(fp(e),`Missing ${e.type}`,`missing-token`)),t}if(e.isError){let t=e.text?.trim(),n=I(new G(t||``),e);return n.__diagnostics.push(Pd(e,t?`Syntax error: unexpected \`${t.length>40?t.slice(0,40)+`…`:t}\``:`Syntax error`,`syntax-error`)),n}if(e.type===`atom`||e.type===`expression`)return this.unwrapExpression(e);if(e.type===`expression_with_to`){let t=e.childForFieldName(`expression`);if(t)return this.parseExpression(t)}if(e.type===`parenthesized_expression`&&e.namedChildren.length>0)return this.parseExpression(e.namedChildren[0]);let t=Td[e.type];return t?t(e,e=>this.parseExpression(e)):I(new G(e.text),e)}unwrapExpression(e){if(e.namedChildren.length>0)return this.parseExpression(e.namedChildren[0]);let t=e.text;return t===`True`||t===`False`?I(new $u(t===`True`),e):t===`None`?I(new td,e):t===`...`?I(new md,e):this.parseExpression(e.children[0])}parseProcedure(e){let t=e.type===`procedure`||e.type===`mapping`?e.namedChildren:[e];return this.parseStatementNodes(t,!0)}parseBlockContent(e,t,n){let r=this.parseMapping(e,t,void 0,{preserveOrphanedStatements:!1,discriminant:n?.discriminant}),i=this.parseStatementNodes(e.namedChildren);return{fields:r.value,statements:i,diagnostics:r.diagnostics}}parseStatementNodes(e,t=!1){let n=[],r=new zd;for(let i of e){if(i.type===`comment`){r.tryAttachInline(i,n[n.length-1])||r.pushLeadingNode(i);continue}if(i.isMissing){let e=I(new sf(``),i);e.__diagnostics.push(Pd(fp(i),`Missing ${i.type}`,`missing-token`)),n.push(e);continue}if(i.type===`ERROR`){let e=i.text.trim();if(e){let t=I(new sf(e),i);t.__diagnostics.push(Pd(i,`Unrecognized syntax${this.formatStatementContext(i)}: ${e.length>40?e.slice(0,40)+`…`:e}`,`syntax-error`)),n.push(t)}continue}let e=this.parseStatement(i,t);e&&(Array.isArray(e)?(r.consumeOntoFirst(e),n.push(...e)):(r.consumeOnto(e),n.push(e)))}return r.flush(),n}parseStatement(e,t=!1){let n=cf[e.type];if(!n){if(e.type===`comment`||!t&&e.type===`mapping_element`)return null;let n=e.text.trim();if(!n)return null;let r=I(new sf(n),e);return r.__diagnostics.push(Pd(e,`Unrecognized syntax${this.formatStatementContext(e)}: ${n}`,`syntax-error`)),r}let r=n(e,e=>this.parseExpression(e),e=>this.parseProcedure(e),e=>this.parseStatement(e)),i=e.namedChildren.filter(t=>t.type===`comment`&&t.startRow===e.startRow).map(e=>this.parseComment(e,`inline`));return i.length>0&&(Array.isArray(r)?r.length>0&&Bd(r[r.length-1],i):Bd(r,i)),r}parseVariableDeclaration(e){let t,n,r;if(e.type===`variable_declaration`){let i=e.children.find(e=>e.type===`mutable`||e.type===`linked`);i&&(t=I(new G(i.text),i));let a=e.childForFieldName(`type`),o=e.childForFieldName(`default`);n=a?this.parseExpression(a):I(new G(`unknown`),e),r=o?this.parseExpression(o):void 0}else if(e.type===`assignment_expression`){let t=e.childForFieldName(`left`),i=e.childForFieldName(`right`);n=t?this.parseExpression(t):I(new G(`unknown`),e),r=i?this.parseExpression(i):void 0}else n=this.parseExpression(e);return I(new Rf({type:n,defaultValue:r,modifier:t}),e)}},vp=Q(`VariablePropertiesBlock`,{description:X.describe(`Human-readable description.`),label:X.describe(`Display label shown in the UI.`),is_required:Z.describe(`Whether this variable is required.`)},{symbol:{kind:V.Object,noRecurse:!0}}).describe(`Properties for a variable declaration.`),yp=Q(`InputPropertiesBlock`,{label:X.describe(`Display label shown in the UI.`),description:X.describe(`Human-readable description.`),is_required:Z.describe(`Whether this input is required.`)},{symbol:{kind:V.Object,noRecurse:!0}}).describe(`Properties for an action input parameter.`),bp=Q(`OutputPropertiesBlock`,{label:X.describe(`Display label shown in the UI.`),description:X.describe(`Human-readable description.`)},{symbol:{kind:V.Object,noRecurse:!0}}).describe(`Properties for an action output parameter.`),xp=tp(`VariablesBlock`,vp,{modifiers:hf,primitiveTypes:mf}).describe(`Global variable declarations with modifiers, types, and defaults.`).example(`variables:
|
|
137
|
+
# Mutable types with defaults
|
|
138
|
+
user_name: mutable string = ""
|
|
139
|
+
description: "The customer's name"
|
|
140
|
+
request_count: mutable number = 0
|
|
141
|
+
description: "Number of requests in this session"
|
|
142
|
+
verified: mutable boolean = False
|
|
143
|
+
description: "Whether identity has been verified"
|
|
144
|
+
user_data: mutable object = {}
|
|
145
|
+
description: "Arbitrary user profile data"
|
|
146
|
+
order_items: mutable list[object] = []
|
|
147
|
+
description: "List of items in the current order"
|
|
148
|
+
join_date: mutable date
|
|
149
|
+
description: "When the customer joined"
|
|
150
|
+
|
|
151
|
+
# Mutable without default value
|
|
152
|
+
order_id: mutable string
|
|
153
|
+
description: "Current order ID"
|
|
154
|
+
|
|
155
|
+
# Variable with display label
|
|
156
|
+
loyalty_tier: mutable string = "basic"
|
|
157
|
+
label: "Loyalty Tier"
|
|
158
|
+
description: "The customer's loyalty program tier"
|
|
159
|
+
|
|
160
|
+
# Linked variables (sourced from external context, read-only)
|
|
161
|
+
EndUserId: linked string
|
|
162
|
+
source: @MessagingSession.MessagingEndUserId
|
|
163
|
+
description: "The messaging end user ID"
|
|
164
|
+
ContactId: linked string
|
|
165
|
+
source: @MessagingEndUser.ContactId
|
|
166
|
+
description: "The contact ID from messaging"`),Sp=tp(`InputsBlock`,yp,{modifiers:hf,primitiveTypes:mf}).describe(`Action input parameter declarations.`),Cp=tp(`OutputsBlock`,bp,{modifiers:hf,primitiveTypes:mf}).describe(`Action output parameter declarations.`).crossBlockReferenceable(),wp=Gf(`ActionBlock`,{description:X.describe(`Description of what the action does.`),label:X.describe(`Display label shown in the UI.`),inputs:Sp,outputs:Cp,target:X.required().describe(`External implementation target URI (e.g., "flow://Action_Name").`),source:X.describe(`Global namespace function name or legacy action identifier.`)},{symbol:{kind:V.Method},scopeAlias:`action`,capabilities:[`invocationTarget`]}).describe(`Action definition representing an external tool or flow.`).example(` actions:
|
|
167
|
+
Lookup_Order:
|
|
168
|
+
description: "Retrieve order details by order number"
|
|
169
|
+
inputs:
|
|
170
|
+
order_number: string
|
|
171
|
+
description: "The order number to look up"
|
|
172
|
+
is_required: True
|
|
173
|
+
outputs:
|
|
174
|
+
status: string
|
|
175
|
+
description: "Order status"
|
|
176
|
+
target: "flow://Lookup_Order"`),Tp=Zf(wp).describe(`Collection of action definitions.`),Ep=Gf(`ReasoningActionBlock`,{description:X.describe(`Description of the tool provided to the LLM. Overrides the action description.`),label:X.describe(`Human-readable label for the tool. Not provided to the LLM.`)},{colinear:Tf,body:wf,symbol:{kind:V.Method},scopeAlias:`action`}).describe(`Action made available to the agent to choose during reasoning.`).example(` actions:
|
|
177
|
+
lookup: @actions.Lookup_Order
|
|
178
|
+
with order_number=@variables.order_number
|
|
179
|
+
set @variables.status = @outputs.status`);Zf(Ep).describe(`Collection of reasoning action bindings.`);function Dp(e){let t=Wp(e),n=Qp(e),r=em(e,t),i=new Set(Object.keys(e.schema)),a=new Set([...i,...t.keys(),...Object.keys(e.aliases),...Object.values(e.aliases)]),o=new Map;if(e.globalScopes)for(let[t,n]of Object.entries(e.globalScopes)){if(a.has(t))throw Error(`Global scope namespace '${t}' collides with an existing namespace. Global scopes must use unique namespaces that don't overlap with schema keys, scoped namespaces, or aliases. This is a configuration error in the dialect's SchemaInfo.`);o.set(t,kp(n)),r.has(t)||r.set(t,{kind:V.Namespace})}let s=qp(e.schema),c=new Set([...t.keys()].filter(e=>s.has(e))),l=Yp(e),u=new Set(e.nodeMemberAccess?.members??[]),d=Mp(e,l.transitionTarget);return{info:e,scopedNamespaces:t,scopeNavigation:n,namespaceMetadata:r,schemaNamespaces:i,globalScopes:o,colinearResolvedScopes:c,invocationTargetNamespaces:l.invocationTarget,transitionTargetNamespaces:l.transitionTarget,nodeMemberNames:u,nodeOutputMemberName:e.nodeMemberAccess?.outputMember,nodeOutputFieldPaths:d}}function Op(e){return e instanceof Set}function kp(e){let t=new Map;if(Op(e)){for(let n of e)t.set(n,{});return t}for(let[n,r]of e)t.set(n,Ap(r));return t}function Ap(e){if(e==null)return{};if(typeof e==`string`)return{type:e};if(Op(e))return{subMembers:jp(e)};let t={};if(e.type!==void 0&&(t.type=e.type),e.capability!==void 0&&(t.capability=e.capability),e.subMembers!==void 0)if(Op(e.subMembers))t.subMembers=jp(e.subMembers);else{let n=new Map;for(let[t,r]of e.subMembers)n.set(t,Ap(r));t.subMembers=n}return e.list===!0&&(t.list=!0),e.elementFields!==void 0&&(t.elementFields=e.elementFields),t}function jp(e){let t=new Map;for(let n of e)t.set(n,{});return t}function Mp(e,t){let n=new Map;for(let r of t){let t=e.schema[r];if(!t)continue;let i=Np(cu(t));if(!i)continue;let a=Pp(i);a&&n.set(r,a)}return n}function Np(e){return du(e)?e.entryBlock.schema:e.schema}function Pp(e,t=new WeakSet){if(!Up(t,e))for(let[n,r]of Object.entries(e)){let e=cu(r);if(e.__metadata?.structuredOutputField===!0)return[n];if(e.schema){let r=Pp(e.schema,t);if(r)return[n,...r]}}}function Fp(e,t){let{aliases:n,extraNamespaceKeys:r}=t.info,i=e;for(;n[i];)i=n[i];let a=new Set([e,i]);for(let[e,t]of Object.entries(n))t===i&&a.add(e);if(r?.[e])for(let t of r[e])a.add(t);return[...a]}function Ip(e){return e.scopedNamespaces}function Lp(e,t){if(!(!e||!t)){for(let n of e)if(t[n])return n}}function Rp(e){return e.scopeNavigation}function zp(e){return e.schemaNamespaces}function Bp(e,t,n){if(n.length===0)return;let r=e.globalScopes.get(t),i;for(let e of n){if(!r||(i=r.get(e),!i))return;r=i.subMembers}return i?.type}function Vp(e){return e.__fieldKind===`TypedMap`}function Hp(e){return e.__isCollection===!0}function Up(e,t){return e.has(t)?!0:(e.add(t),!1)}function Wp(e){let t=new Map;for(let[,n]of Object.entries(e.schema)){let e=cu(n),r=e.scopeAlias,i=e.schema;(e.isNamed||Hp(e))&&r&&i&&Kp(i,r,t)}return t}function Gp(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function Kp(e,t,n,r=new WeakSet){if(!Up(r,e))for(let[i,a]of Object.entries(e)){let e=cu(a);e.isNamed||Hp(e)?(Gp(n,i,t),e.scopeAlias&&e.schema&&Kp(e.schema,e.scopeAlias,n,r)):Vp(e)?Gp(n,i,t):e.schema&&!e.isNamed&&Kp(e.schema,t,n,r)}}function qp(e){let t=new Set;return Jp(e,t),t}function Jp(e,t,n=new WeakSet){if(!Up(n,e))for(let[r,i]of Object.entries(e))i.__metadata?.crossBlockReferenceable&&t.add(r),i.schema&&Jp(i.schema,t,n)}function Yp(e){let t={invocationTarget:new Set,transitionTarget:new Set};for(let[n,r]of Object.entries(e.schema)){let e=cu(r);Xp(n,e,t),e.schema&&Zp(e.schema,t)}return t}function Xp(e,t,n){if(t.capabilities)for(let r of t.capabilities)r===`invocationTarget`?n.invocationTarget.add(e):r===`transitionTarget`&&n.transitionTarget.add(e)}function Zp(e,t,n=new WeakSet){if(!Up(n,e))for(let[r,i]of Object.entries(e)){let e=cu(i);Xp(r,e,t),e.schema&&Zp(e.schema,t,n)}}function Qp(e){let t=new Map;for(let[n,r]of Object.entries(e.schema)){let e=cu(r);if(!(e.isNamed||Hp(e))||!e.scopeAlias)continue;let i=t.get(e.scopeAlias);i?i.rootKeys.includes(n)||i.rootKeys.push(n):t.set(e.scopeAlias,{rootKeys:[n]}),e.schema&&$p(e.schema,e.scopeAlias,t)}return t}function $p(e,t,n,r=new WeakSet){if(!Up(r,e))for(let[,i]of Object.entries(e)){let e=cu(i);if((e.isNamed||Hp(e))&&e.scopeAlias){let i=n.get(e.scopeAlias);i?i.parentScope===void 0&&(i.parentScope=t):n.set(e.scopeAlias,{rootKeys:[],parentScope:t}),e.schema&&$p(e.schema,e.scopeAlias,n,r)}else e.schema&&!e.isNamed&&$p(e.schema,t,n,r)}}function em(e,t){let{schema:n,aliases:r}=e,i=new Map;for(let e of Object.keys(n))r[e]||i.set(e,{kind:V.Namespace});for(let[e,n]of t)i.set(e,{kind:V.Namespace,scopesRequired:n});return i}function tm(e,t){return e.__scope&&typeof e.__name==`string`?{...t,[e.__scope]:e.__name}:t}function nm(e,t,n,r){let i=Rp(r).get(t);if(!i)return null;let a=n[t];if(!a)return null;if(i.parentScope&&n[i.parentScope]){let t=nm(e,i.parentScope,n,r);if(t){let e=rm(t,a);if(e)return e}}for(let t of i.rootKeys)for(let n of Fp(t,r)){let t=e[n];if(U(t)){let e=t.get(a);if(H(e))return e}}return null}function rm(e,t){let n;for(let[r,i]of Object.entries(e))if(!(r.startsWith(`__`)||!i||typeof i!=`object`))if(U(i)){let e=i.get(t);if(H(e))return e}else H(i)&&i.__kind&&!i.__scope&&(n??=[]).push(i);if(n)for(let e of n){let n=rm(e,t);if(n)return n}return null}function im(e,t,n=[]){let r=e[t];U(r)&&n.push(r);for(let[r,i]of Object.entries(e))r.startsWith(`__`)||!i||typeof i!=`object`||U(i)||H(i)&&i.__kind&&!i.__scope&&im(i,t,n);return n}function am(e,t,n,r,i){if(!i)return null;let a=Ip(r),o=Fp(t,r);for(let t of o){let o=Lp(a.get(t),i);if(!o)continue;let s=nm(e,o,i,r);if(s)for(let e of im(s,t)){let t=e.get(n);if(H(t))return t}}return null}function om(e,t,n){return!(e<n.start.line||e>n.end.line||e===n.start.line&&t<n.start.character||e===n.end.line&&t>n.end.character)}function sm(e,t,n){if(t===`VariableDeclaration`||t===`ParameterDeclaration`){let t=[],n=e.modifier;if(H(n)&&n.__cst){let e=n.__cst.node.text?.trim();e&&t.push(e)}let r=e.type;if(H(r)&&r.__cst){let e=r.__cst.node.text?.trim();e&&t.push(e)}let i=e.defaultValue;if(H(i)&&i.__cst){let e=i.__cst.node.text?.trim();e&&t.push(`= `+e)}return t.length>0?t.join(` `):void 0}if(t===`StringLiteral`){let t=e.value;return typeof t==`string`?t.length>60?t.slice(0,60)+`...`:t:void 0}if(t===`TemplateExpression`)return cm(n);if(t===`BooleanValue`){let t=e.value;return t===!0?`True`:t===!1?`False`:void 0}if(t===`NumberValue`){let t=e.value;return t==null?void 0:String(t)}if(t===`ProcedureValue`)return`->`;let r=e.label;if(r instanceof W)return r.value}function cm(e){let t=e.node;if(t.type===`mapping_element`)return t.childForFieldName(`value`)?.text?.trim();let n=t.text?.trim();return n&&n.length>80?n.slice(0,80)+`...`:n||void 0}function lm(e){let t=e;for(;t;){if(t.type===`mapping_element`)return t;t=t.parent}return null}var um;(function(e){e[e.Deprecated=1]=`Deprecated`})(um||={});function dm(e){let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(`__`)||typeof r!=`object`||!r)continue;if(U(r)){let e=fm(n,r,!0);for(let n of e)t.push(n);continue}let e=pm(n,r);e&&t.push(e)}let n=e.__children;if(Array.isArray(n)){for(let e of n)if(Ou(e)&&e.__type===`untyped`){let n=hm(e);n&&t.push(n)}}return t}function fm(e,t,n){let r=t.__symbol,i=t.__cst;if(r&&i){let n=r.kind,{range:a,selectionRange:o}=_m(i),s=sm(t,t.__kind,i);if(r.noRecurse)return[{name:e,kind:n,range:a,selectionRange:o,...s?{detail:s}:{}}];let c=[];for(let[e,n]of t){let t=pm(e,n);t&&c.push(t)}return[{name:e,kind:n,range:a,selectionRange:o,...s?{detail:s}:{},...c.length>0?{children:c}:{}}]}if(n){let n=[];for(let[r,i]of t){let t=pm(`${e} ${r}`,i);t&&n.push(t)}return n}let a=gm(e,t);return a?[a]:[]}function pm(e,t){if(!H(t))return null;let n=t,r=n.__symbol,i=n.__cst;if(!i)return null;let a=r?.kind??V.Property,{range:o,selectionRange:s}=_m(i),c=sm(n,n.__kind,i);if(!r||r.noRecurse)return{name:e,kind:a,range:o,selectionRange:s,...c?{detail:c}:{}};let l=mm(n);return{name:e,kind:a,range:o,selectionRange:s,...c?{detail:c}:{},...l.length>0?{children:l}:{}}}function mm(e){let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(`__`)||typeof r!=`object`||!r)continue;if(U(r)){let e=fm(n,r,!1);for(let n of e)t.push(n);continue}let e=pm(n,r);e&&t.push(e)}let n=e.__children;if(Array.isArray(n)){for(let e of n)if(Ou(e)&&e.__type===`untyped`){let n=hm(e);n&&t.push(n)}}return t}function hm(e){let t=e.__cst;if(!t)return null;let{range:n,selectionRange:r}=_m(t),i=e.__blockName?`${e.key} ${e.__blockName}`:e.key,a=[];for(let t of e.__children)if(Ou(t)){if(t.__type===`untyped`){let e=hm(t);e&&a.push(e)}else if(t.__type===`field`){let e=t,n=e.value,r=n&&typeof n==`object`&&`__cst`in n?n.__cst:void 0;if(r){let{range:t,selectionRange:n}=_m(r);a.push({name:e.key,kind:V.Property,range:t,selectionRange:n})}}}return{name:i,kind:V.Property,range:n,selectionRange:r,...a.length>0?{children:a}:{}}}function gm(e,t){let n=t.__cst,r=[];for(let[e,n]of t){let t=pm(e,n);t&&r.push(t)}if(r.length===0)return null;let i,a;if(n){let e=_m(n);i=e.range,a=e.selectionRange}else i={start:r[0].range.start,end:r[r.length-1].range.end},a=i;return{name:e,kind:V.Namespace,range:i,selectionRange:a,children:r}}function _m(e){let t=e.node;if(t.type===`mapping_element`){let e=vm(t);return{range:M(t),selectionRange:e??M(t)}}let n=t.parent;if(n?.type===`mapping_element`){let e=vm(n);return{range:M(n),selectionRange:e??M(n)}}return{range:e.range,selectionRange:e.range}}function vm(e){let t=e.childForFieldName(`key`);return t?M(t):null}function ym(e,t){let n=e.find(e=>e.name===t);if(n)return n;for(let n of e){if(!n.children||n.kind!==V.Namespace)continue;let e=ym(n.children,t);if(e)return e}}function bm(e,t,n,r){if(r){let i=Sm(r,n);if(i.length>0){let a=e;for(let{level:e,info:o}of i){let i=r[e],s;if(o.parentScope)for(let e of a){if(!e.children)continue;let t=e.children.find(e=>e.name===i);if(t){s=t;break}}else{let e=o.rootKeys.flatMap(e=>Fp(e,n));s=a.find(t=>e.some(e=>t.name===`${e} ${i}`))}if(!s?.children)break;let c=ym(s.children,t);if(c)return(c.children??[]).map(e=>({name:e.name,symbol:e}));a=s.children}}}let i=e.find(e=>e.name===t);if(i)return(i.children??[]).map(e=>({name:e.name,symbol:e}));let a=Fp(t,n).map(e=>e+` `),o=[];for(let t of e)for(let e of a)t.name.startsWith(e)&&o.push({name:t.name.slice(e.length),symbol:t});return o.length>0?o:null}function xm(e,t,n,r,i){let a=i?Dm(e,t,i.line,i.character):bm(e,t,n,r);return a?a.map(e=>e.name):null}function Sm(e,t){let n=Rp(t),r=[];for(let[t,i]of n){if(!e[t])continue;let a=0,o=t;for(;o;){let e=n.get(o);if(!e?.parentScope)break;o=e.parentScope,a++}r.push({level:t,info:i,depth:a})}return r.sort((e,t)=>e.depth-t.depth),r}function Cm(e,t,n,r,i){return i?Dm(e,t,i.line,i.character):bm(e,t,n,r)}function wm(e,t,n,r,i,a){let o=Cm(e,t,r,i,a);return o?o.find(e=>e.name===n)?.symbol??null:null}function Tm(e,t,n){let r=[],i=e;for(;;){let e=i.find(e=>om(t,n,e.range));if(!e||(r.push({symbol:e,siblings:i}),!e.children))break;i=e.children}return r}function Em(e,t,n){let r=e.find(e=>e.name===t&&e!==n);if(r)return(r.children??[]).map(e=>({name:e.name,symbol:e}));let i=t+` `,a=[];for(let t of e)t!==n&&t.name.startsWith(i)&&a.push({name:t.name.slice(i.length),symbol:t});return a.length>0?a:null}function Dm(e,t,n,r){let i=Tm(e,n,r);for(let e=i.length-1;e>=0;e--){let n=Em(i[e].siblings,t,i[e].symbol);if(n)return n}return i.length===0?Em(e,t):null}function Om(e,t){if(U(e)){for(let[n,r]of e)t(n,r,e);return}if(Array.isArray(e)){for(let n of e)t(``,n,e);return}if(!H(e))return;Bf(e)&&e.defaultValue!==void 0&&t(`defaultValue`,e.defaultValue,e);let n=e.__children;if(Array.isArray(n)){let r=new Set;for(let i of n){if(!Ou(i))continue;let n=i;switch(n.__type){case`field`:if(n.entryName){if(!r.has(n.key)){r.add(n.key);let i=e[n.key];i!==void 0&&t(n.key,i,e)}}else t(n.key,n.value,e);break;case`map_entry`:t(n.name,n.value,e);break;case`sequence_item`:t(``,n.value,e);break;case`value`:t(`value`,n.value,e);break;case`statement`:t(``,n.value,e);break;case`untyped`:t(n.key,n,e);break;case`error`:break;default:}}return}for(let[n,r]of Object.entries(e))n.startsWith(`__`)||t(n,r,e)}function km(e,t){switch(e.__kind){case`MemberExpression`:t(e.object,`object`,e);break;case`SubscriptExpression`:t(e.object,`object`,e),t(e.index,`index`,e);break;case`SliceExpression`:e.start&&t(e.start,`start`,e),e.stop&&t(e.stop,`stop`,e),e.step&&t(e.step,`step`,e);break;case`BinaryExpression`:case`ComparisonExpression`:t(e.left,`left`,e),t(e.right,`right`,e);break;case`UnaryExpression`:t(e.operand,`operand`,e);break;case`SpreadExpression`:t(e.expression,`expression`,e);break;case`ListLiteral`:{let n=e.elements;if(Array.isArray(n))for(let r of n)t(r,``,e);break}case`DictLiteral`:{let n=e.entries;if(Array.isArray(n))for(let e of n)H(e)&&(t(e.key,`key`,e),t(e.value,`value`,e));break}case`TernaryExpression`:t(e.consequence,`consequence`,e),t(e.condition,`condition`,e),t(e.alternative,`alternative`,e);break;case`CallExpression`:if(t(e.func,`func`,e),Array.isArray(e.args))for(let n of e.args)t(n,``,e);break;case`TemplateExpression`:{let n=e.parts;if(Array.isArray(n))for(let e of n)H(e)&&e.__kind===`TemplateInterpolation`&&t(e.expression,`expression`,e);break}}}function Am(e,t,n,r){if(Array.isArray(e)){for(let n of e)r(n,t,``,e);return t}if(!H(e))return t;let i=tm(e,t);return e.__kind&&wd(e.__kind)?(n?.(e,i),km(e,(e,t,n)=>{r(e,i,t,n)})):Om(e,(e,t,n)=>{r(t,i,e,n)}),i}function jm(e,t,n={},r=new Set){!e||typeof e!=`object`||r.has(e)||(r.add(e),Am(e,n,t,(e,n)=>{jm(e,t,n,r)}))}function Mm(e){let t=[];return Nm(e,t,new Set),t}function Nm(e,t,n){if(!(!e||typeof e!=`object`)&&!n.has(e)){if(n.add(e),H(e)){let n=e.__diagnostics;if(Array.isArray(n))for(let e of n)t.push(e)}Om(e,(e,r)=>{Nm(r,t,n)})}}function $(e){return e}var Pm=class{data=new Map;set(e,t){if(this.data.has(e))throw Error(`PassStore key '${e}' already set — cannot overwrite`);this.data.set(e,t)}get(e){return this.data.get(e)}has(e){return this.data.has(e)}update(e,t){let n=this.get(e);if(n===void 0)throw Error(`PassStore key '${e}' not set — cannot update`);this.data.set(e,t(n))}};function Fm(e,t){return{__each:!0,key:e,...t?{selector:t}:{}}}function Im(e){return typeof e==`object`&&!!e&&`__each`in e}function Lm(e){let t=[],n,r,i;for(let[a,o]of Object.entries(e.deps))if(Im(o)){if(n!==void 0)throw Error(`defineRule('${e.id}'): only one each() dep allowed, found '${n}' and '${a}'`);n=a,r=o.key,i=o.selector,t.push(o.key)}else t.push(o);return{id:$(e.id),description:e.description,requires:t,run(t,a){let o={};for(let[n,r]of Object.entries(e.deps))Im(r)||(o[n]=t.get(r));if(n&&r){let a=t.get(r);if(a==null)return;let s=i?i(a):Array.isArray(a)?a:[];for(let t of s)e.run({...o,[n]:t})}else e.run(o)}}}var Rm=class extends Error{missingDependencies;cyclicDependencies;constructor(e,t,n){super(e),this.missingDependencies=t,this.cyclicDependencies=n,this.name=`DependencyResolutionError`}};function zm(e){return{visitVariables:e.filter(e=>e.visitVariables),visitExpression:e.filter(e=>e.visitExpression),enterNode:e.filter(e=>e.enterNode),exitNode:e.filter(e=>e.exitNode)}}var Bm=$(`schema-context`),Vm=class{passes=new Map;disabled=new Set;source;constructor(e){this.source=e?.source??`lint`;for(let t of e?.passes??[])this.addPass(t)}addPass(e){if(this.passes.has(e.id))throw Error(`Duplicate lint id: '${e.id}'`);return this.passes.set(e.id,e),this}disable(e){if(!this.passes.has(e))throw Error(`Cannot disable unknown lint id: '${e}'`);return this.disabled.add(e),this}enable(e){if(!this.passes.has(e))throw Error(`Cannot enable unknown lint id: '${e}'`);return this.disabled.delete(e),this}run(e,t){let n=new Pm;n.set(Bm,t);let r=[],i=new Set,a=[...this.passes.values()].filter(e=>!this.disabled.has(e.id));for(let e of a)if(e.init)try{e.init()}catch(t){i.add(e.id),r.push(this.systemDiagnostic(`Pass '${e.id}' init failed: ${t instanceof Error?t.message:String(t)}`,`lint-pass-error`))}let o=a.filter(e=>!i.has(e.id)),s=zm(o);this.dispatchTargetedHooks(e,s,i,r),this.walkNode(e,s,{},``,void 0,new Set,i,r);let c=o.filter(e=>e.finalize),l=this.sortFinalize(c,i);for(let t of l){if(i.has(t.id))continue;let a=t.finalizeAfter?.find(e=>!n.has(e));if(a){i.add(t.id),r.push(this.systemDiagnostic(`Pass '${t.id}' skipped: required data '${a}' not available`,`lint-pass-skipped`));continue}try{t.finalize(n,e)}catch(e){i.add(t.id),r.push(this.systemDiagnostic(`Pass '${t.id}' finalize failed: ${e instanceof Error?e.message:String(e)}`,`lint-pass-error`))}}let u=o.filter(e=>e.run);for(let t of u){if(i.has(t.id))continue;let a=t.requires?.find(e=>!n.has(e));if(a){r.push(this.systemDiagnostic(`Pass '${t.id}' skipped: required data '${a}' not available`,`lint-pass-skipped`));continue}try{t.run(n,e)}catch(e){r.push(this.systemDiagnostic(`Pass '${t.id}' run failed: ${e instanceof Error?e.message:String(e)}`,`lint-pass-error`))}}return{diagnostics:[...Mm(e),...r],store:n}}dispatchTargetedHooks(e,t,n,r){if(t.visitVariables.length>0){let i=e.variables;if(U(i)){for(let e of t.visitVariables)if(!n.has(e.id))try{e.visitVariables(i)}catch(t){n.add(e.id),r.push(this.systemDiagnostic(`Pass '${e.id}' visitVariables failed: ${t instanceof Error?t.message:String(t)}`,`lint-pass-error`))}}}}walkNode(e,t,n,r,i,a,o,s){if(!e||typeof e!=`object`||a.has(e))return;if(a.add(e),Array.isArray(e)){for(let r of e)this.walkNode(r,t,n,``,e,a,o,s);return}if(!H(e))return;let c=e.__diagnostics;Array.isArray(c)&&(e.__diagnostics=c.filter(e=>e.source!==this.source));for(let n of t.enterNode)if(!o.has(n.id))try{n.enterNode(r,e,i)}catch(e){o.add(n.id),s.push(this.systemDiagnostic(`Pass '${n.id}' enterNode failed: ${e instanceof Error?e.message:String(e)}`,`lint-pass-error`))}Am(e,n,(e,n)=>{for(let r of t.visitExpression)if(!o.has(r.id))try{r.visitExpression(e,n)}catch(e){o.add(r.id),s.push(this.systemDiagnostic(`Pass '${r.id}' visitExpression failed: ${e instanceof Error?e.message:String(e)}`,`lint-pass-error`))}},(e,n,r,i)=>{this.walkNode(e,t,n,r,i,a,o,s)});for(let n of t.exitNode)if(!o.has(n.id))try{n.exitNode(r,e,i)}catch(e){o.add(n.id),s.push(this.systemDiagnostic(`Pass '${n.id}' exitNode failed: ${e instanceof Error?e.message:String(e)}`,`lint-pass-error`))}}sortFinalize(e,t){let n=e.filter(e=>!t.has(e.id));if(n.length===0)return[];let r=new Map;for(let e of n)r.set(e.id,e);let i=new Map,a=new Map;for(let e of n)i.set(e.id,0),a.set(e.id,new Set);for(let e of n)for(let t of e.finalizeAfter??[])r.has(t)&&(a.get(t).add(e.id),i.set(e.id,(i.get(e.id)??0)+1));let o=[];for(let[e,t]of i)t===0&&o.push(e);let s=[],c=0;for(;c<o.length;){let e=o[c++];s.push(r.get(e));for(let t of a.get(e)??[]){let e=(i.get(t)??1)-1;i.set(t,e),e===0&&o.push(t)}}if(s.length!==n.length){let e=n.filter(e=>!s.some(t=>t.id===e.id)).map(e=>e.id);throw new Rm(`Cyclic finalize dependencies among: ${e.join(`, `)}`,void 0,e)}return s}systemDiagnostic(e,t){return{range:{start:{line:0,character:0},end:{line:0,character:0}},message:e,severity:N.Information,code:t,source:this.source}}},Hm=$(`position-index`);function Um(e,t,n,r,i,a){if(a){let e=wm(a,t,n,r,i);if(e)return{namespace:t,name:n,symbolKind:e.kind,definitionRange:e.selectionRange,fullRange:e.range}}return Lp(Ip(r).get(t),i)&&i?qm(e,t,n,i,r):Km(e,t,n,r)}function Wm(e,t){Gm(e,t,{},void 0,new Set)}function Gm(e,t,n,r,i){if(!e||typeof e!=`object`||i.has(e))return;if(i.add(e),U(e)){for(let[a,o]of e){if(!H(o))continue;let e=o.__cst;if(!e)continue;let s=tm(o,n),c=r??``;if(c){let{range:n,selectionRange:r}=_m(e);t(c,a,r,n,s)}Gm(o,t,s,void 0,i)}return}if(!H(e))return;let a=tm(e,n);for(let[n,o]of Object.entries(e))if(!n.startsWith(`__`)&&!(!o||typeof o!=`object`)){if(U(o))Gm(o,t,a,n,i);else if(H(o))if(!r&&o.__kind&&o.__symbol)Gm(o,t,a,n,i);else if(r){let e=o.__cst;if(e){let i=lm(e.node),{range:o,selectionRange:s}=_m(i?{...e,node:i}:e);t(r,n,s,o,a)}Gm(o,t,a,void 0,i)}else Gm(o,t,a,void 0,i)}}function Km(e,t,n,r){for(let i of Fp(t,r)){let r=Bl(e,i);if(r){if(U(r)){let e=Jm(r,n,t);if(e)return e}else if(typeof r==`object`){let e=Xm(r,n,t);if(e)return e}}}return null}function qm(e,t,n,r,i){let a=am(e,t,n,i,r);return a?Ym(a,t,n):null}function Jm(e,t,n){if(!U(e))return null;let r=e.get(t);return H(r)?Ym(r,n,t):null}function Ym(e,t,n){let r=e.__cst;if(!r)return null;let i=e.__symbol?.kind??V.Property,{range:a,selectionRange:o}=_m(r);return{namespace:t,name:n,symbolKind:i,definitionRange:o,fullRange:a}}function Xm(e,t,n){if(!H(e)||U(e)||t.startsWith(`__`))return null;let r=e[t];if(!H(r))return null;let i=r.__cst;if(!i)return null;let a=r.__symbol?.kind??V.Property,o=lm(i.node),{range:s,selectionRange:c}=_m(o?{...i,node:o}:i);return{namespace:n,name:t,symbolKind:a,definitionRange:c,fullRange:s}}var Zm=$(`symbol-table`),Qm=class{id=Zm;description=`Extracts LSP DocumentSymbol tree from the parsed AST`;finalize(e,t){e.set(Zm,dm(t))}};function $m(){return new Qm}var eh=class{id=Hm;description=`Builds a position index for fast cursor lookups`;expressions=[];init(){this.expressions=[]}visitExpression(e,t){let n=e.__cst;n&&this.expressions.push({expr:e,range:n.range,scope:t})}finalize(e,t){let n=[];Wm(t,(e,t,r,i,a)=>{n.push({namespace:e,name:t,keyRange:r,fullRange:i,scope:a})});let r=[];th(t,{},new Set,r),e.set(Hm,{expressions:this.expressions,definitions:n,scopes:r})}};function th(e,t,n,r){if(!(!e||typeof e!=`object`)&&!n.has(e)){if(n.add(e),U(e)){for(let[i,a]of e){if(!H(a))continue;let e=a.__cst;if(!e)continue;let o=a.__scope,s=t;o&&typeof a.__name==`string`&&(s={...t,[o]:i},r.push({range:e.range,scope:s})),Om(a,(e,t)=>{th(t,s,n,r)})}return}Om(e,(e,i)=>{th(i,t,n,r)})}}function nh(){return new eh}function rh(e){let t=Array.isArray(e)?e[0]:e;return{fieldType:t,innerSchema:t.schema}}function ih(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ah(e,t,n){for(let[r,i]of Object.entries(t)){let{fieldType:t,innerSchema:a}=rh(i),o=e[r];n.visitField?.(o,t,r,e),o!==void 0&&oh(o,t,a,n)}}function oh(e,t,n,r){if(t.__fieldKind===`TypedMap`&&U(e)){let n=`propertiesSchema`in t&&ih(t.propertiesSchema)?t.propertiesSchema:void 0;if(n){for(let[,t]of e)if(H(t)){let e=t.properties;H(e)&&ah(e,n,r)}}}if(du(t)){if(U(e)){let i=`colinearType`in t?t.colinearType:void 0;for(let[,a]of e)if(H(a)){let e=t.entryBlock,o=n;if(su(e)){let t=Vl(a,e.discriminantField);t&&(o=e.resolveSchemaForDiscriminant(t))}else{let t=typeof a.__name==`string`?a.__name:void 0;t&&(o=e.resolveSchemaForName(t))}o&&ah(a,o,r),i&&a.value!==void 0&&r.visitField?.(a.value,i,`value`,a)}}}else if(n&&H(e)&&!(e instanceof Of)){let i=n;if(su(t)){let n=Vl(e,t.discriminantField);n&&(i=t.resolveSchemaForDiscriminant(n))}ah(e,i,r)}if(e instanceof Of){let t=e.items;if(n)for(let e of t)H(e)&&`__symbol`in e&&ah(e,n,r)}}function sh(e,t,n){for(let[r,i]of Object.entries(t)){let{fieldType:t,innerSchema:a}=rh(i),o=Bl(e,r);n.visitField?.(o,t,r,e),o!==void 0&&oh(o,t,a,n)}}function ch(e){return e.__metadata?.constraints}function lh(e){if(!H(e))return;let t=e.__kind;if(t===`NumberValue`){let t=e.value;if(typeof t==`number`)return{kind:`number`,raw:t}}if(t===`BooleanValue`){let t=e.value;if(typeof t==`boolean`)return{kind:`boolean`,raw:t}}if(t===`StringLiteral`){let t=e.value;if(typeof t==`string`)return{kind:`string`,raw:t}}}var uh=new Map,dh;function fh(e){if(uh.has(e))return uh.get(e);try{let t=new RegExp(e);return uh.set(e,t),t}catch{return uh.set(e,null),null}}function ph(e,t){if(e===`invocationTarget`)return t.invocationTargetNamespaces;if(e===`transitionTarget`)return t.transitionTargetNamespaces}function mh(e){return e===`invocationTarget`?`invocation target`:e===`transitionTarget`?`transition target`:e}function hh(e,t){let n=ph(e,t),r=new Set(Object.keys(t.info.aliases)),i=new Set;if(n)for(let e of n)r.has(e)||i.add(e);return t.globalScopes.has(`utils`)&&i.add(`utils`),i.size===0?`@namespace.member`:[...i].sort().map(e=>`@${e}`).join(`, `)}function gh(e,t,n,r,i){if(!H(e))return;let a=e,o=a.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}};if(t.resolvedType&&a instanceof id&&i){let n=bd(e);if(n&&i.globalScopes.has(n.namespace)){let e=i.globalScopes.get(n.namespace);if(e&&n.path.length>0){let i=e,s;for(let e of n.path){if(!i||(s=i.get(e),!s))break;i=s.subMembers}if(s&&(s.capability!==void 0&&s.capability!==t.resolvedType||s.capability===void 0&&t.resolvedType===`invocationTarget`)){r?.add(a);let e=mh(t.resolvedType);J(a,q(o,`Cannot ${t.resolvedType===`invocationTarget`?`invoke`:`reference`} '${`@${n.namespace}.${n.path.join(`.`)}`}' — '${n.namespace}.${n.path.join(`.`)}' is not a valid ${e}.`,N.Error,`constraint-resolved-type`))}return}}let s=yd(e);if(s){let e=ph(t.resolvedType,i);if(e&&!e.has(s.namespace)){r?.add(a);let e=(H(a.object)?a.object:void 0)?.__cst?.range??o,n=mh(t.resolvedType);J(a,q(e,`Cannot ${t.resolvedType===`invocationTarget`?`invoke`:`reference`} '@${s.namespace}.${s.property}' \u2014 '${s.namespace}' is not a valid ${n}.`,N.Error,`constraint-resolved-type`));return}}}if(t.resolvedType&&!(a instanceof id)){r?.add(a);let e=a.__kind??`unknown`;J(a,q(o,`'${n}' must be a member of ${i?hh(t.resolvedType,i):`@namespace.member`}. Got ${e}.`,N.Error,`constraint-resolved-type`));return}if(t.allowedNamespaces&&a instanceof id){r?.add(a);let i=yd(e);if(i&&!t.allowedNamespaces.includes(i.namespace)){let e=(H(a.object)?a.object:void 0)?.__cst?.range??o,r=Od(i.namespace,[...t.allowedNamespaces]);J(a,q(e,Dd(`'${n}' must reference one of: ${t.allowedNamespaces.map(e=>`@${e}`).join(`, `)}. Got @${i.namespace}`,r,`@`),N.Error,`constraint-allowed-namespaces`))}return}if(a instanceof Of){let e=a.items.length;t.minItems!==void 0&&e<t.minItems&&J(a,q(o,`'${n}' must have at least ${t.minItems} item(s), got ${e}`,N.Error,`constraint-min-items`)),t.maxItems!==void 0&&e>t.maxItems&&J(a,q(o,`'${n}' must have at most ${t.maxItems} item(s), got ${e}`,N.Error,`constraint-max-items`));return}let s=lh(e);if(!s)return;let{kind:c,raw:l}=s;if(t.enum!==void 0&&!t.enum.includes(l)&&J(a,q(o,`'${n}' must be one of: ${t.enum.map(e=>JSON.stringify(e)).join(`, `)}. Got ${JSON.stringify(l)}`,N.Error,`constraint-enum`)),t.const!==void 0&&l!==t.const&&J(a,q(o,`'${n}' must be ${JSON.stringify(t.const)}. Got ${JSON.stringify(l)}`,N.Error,`constraint-const`)),c===`number`&&typeof l==`number`&&(t.minimum!==void 0&&l<t.minimum&&J(a,q(o,`'${n}' must be >= ${t.minimum}, got ${l}`,N.Error,`constraint-minimum`)),t.maximum!==void 0&&l>t.maximum&&J(a,q(o,`'${n}' must be <= ${t.maximum}, got ${l}`,N.Error,`constraint-maximum`)),t.exclusiveMinimum!==void 0&&l<=t.exclusiveMinimum&&J(a,q(o,`'${n}' must be > ${t.exclusiveMinimum}, got ${l}`,N.Error,`constraint-exclusive-minimum`)),t.exclusiveMaximum!==void 0&&l>=t.exclusiveMaximum&&J(a,q(o,`'${n}' must be < ${t.exclusiveMaximum}, got ${l}`,N.Error,`constraint-exclusive-maximum`)),t.multipleOf!==void 0)){let e=Math.abs(l%t.multipleOf),r=2**-52*Math.max(1,Math.abs(l),Math.abs(t.multipleOf));e>r&&Math.abs(e-t.multipleOf)>r&&J(a,q(o,`'${n}' must be a multiple of ${t.multipleOf}, got ${l}`,N.Error,`constraint-multiple-of`))}if(c===`string`&&typeof l==`string`&&(t.minLength!==void 0&&l.length<t.minLength&&J(a,q(o,`'${n}' must be at least ${t.minLength} character(s) long, got ${l.length}`,N.Error,`constraint-min-length`)),t.maxLength!==void 0&&l.length>t.maxLength&&J(a,q(o,`'${n}' must be at most ${t.maxLength} character(s) long, got ${l.length}`,N.Error,`constraint-max-length`)),t.pattern!==void 0)){let e=fh(t.pattern);e===null?J(a,q(o,`'${n}' has invalid constraint pattern: /${t.pattern}/`,N.Warning,`constraint-invalid-pattern`)):e.test(l)||J(a,q(o,`'${n}' must match pattern /${t.pattern}/`,N.Error,`constraint-pattern`))}}var _h=$(`constraint-validation`),vh=class{id=_h;description=`Validates field values against JSON Schema-style constraints (min, max, pattern, enum, etc.)`;requires=[Bm];run(e,t){let n=e.get(Bm);if(!n)return;dh!==n&&(uh.clear(),dh=n);let r=new Set;sh(t,n.info.schema,{visitField(e,t,i){if(e===void 0)return;let a=ch(t);a&&gh(e,a,i,r,n)}}),e.set(_h,r)}};function yh(){return new vh}function bh(e){if(!ap(e))return null;let t=e.property;if(!t)return null;let n=e.object;if(!sp(n))return null;let r=n.object;if(!ap(r))return null;let i=r.property;if(!i)return null;let a=r.object;return cp(a)?{namespace:a.name,listMember:i,attr:t}:null}function xh(e,t,n,r){let i=r.scopedNamespaces.get(t);for(let r=e.length-1;r>=0;r--){let a=e[r];if(!H(a)||U(a)||i&&r!==0&&(!a.__scope||!i.has(a.__scope)))continue;let o=a[t];if(U(o)&&o.has(n))return!0}return!1}function Sh(e,t,n,r){let i=r.scopedNamespaces.get(n.namespace);for(let r=t-1;r>=0;r--){let t=e[r];if(!H(t)||U(t)||i&&(!t.__scope||!i.has(t.__scope)))continue;let a=t[n.namespace];if(!U(a))continue;let o=a.get(n.property);if(H(o))return o}}function Ch(e,t){let n=e[t+1];return H(n)&&n.__kind===`WithClause`}function wh(e,t,n){let r=n.scopedNamespaces.get(t);if(r?.has(`action`))for(let i=e.length-1;i>=0;i--){let a=e[i];if(!H(a)||U(a))continue;if(a.__scope&&r.has(a.__scope))return;if(a.__kind!==`RunStatement`||Ch(e,i))continue;let o=a.target;if(!o||typeof o!=`object`)continue;let s=yd(o);if(!s)continue;let c=Sh(e,i,s,n);if(!c)return;let l=c[t];return U(l)?[...l.keys()]:[]}}function Th(e,t,n){let r=n.scopedNamespaces.get(t);if(!(!r||r.size===0))for(let i=e.length-1;i>=0;i--){let a=e[i];if(!H(a)||U(a))continue;let o=a;if(o.__kind===`RunStatement`&&r.has(`action`)&&!Ch(e,i)){let r=o.target;if(!r||typeof r!=`object`)continue;let a=yd(r);if(!a)continue;let s=Sh(e,i,a,n);if(!s)return;let c=s[t];return U(c)?[...c.keys()]:[]}if(!o.__scope||!r.has(o.__scope))continue;let s=o.value;if(!s||typeof s!=`object`)continue;let c=yd(s);if(!c)continue;let l=Sh(e,i,c,n);if(!l)return;let u=l[t];return U(u)?[...u.keys()]:[]}}function Eh(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r];if(!H(i)||U(i))continue;let a=i[t];if(U(a)&&a.has(n)&&r+2<e.length&&e[r+1]===a&&H(e[r+2])&&a.get(n)===e[r+2])return!0}return!1}function Dh(e,t){let{expr:n,namespace:r,property:i,ctx:a,ancestors:o}=e,{symbols:s,schemaCtx:c,validatedRefs:l,root:u}=t;if(l.has(n))return{kind:`skip-validated`};if(c.scopedNamespaces.has(r)&&c.colinearResolvedScopes.has(r)){let e=wh(o,r,c);if(e!==void 0)return e.includes(i)?{kind:`resolved`}:{kind:`colinear-miss`,members:e}}let d=xm(s,r,c,a),f=c.globalScopes.get(r),p=Eh(o,r,i);if(d!==null)return xh(o,r,i,c)||!p&&Um(u,r,i,c,a,s)||f&&(f.has(i)||f.has(`*`))?{kind:`resolved`}:p?{kind:`standard-miss`,candidates:d.filter(e=>e!==i)}:{kind:`standard-miss`,candidates:d};if(f)return f.has(i)||f.has(`*`)?{kind:`resolved`}:{kind:`global-miss`,members:[...f.keys()]};let m=zp(c).has(r);if(c.scopedNamespaces.has(r)){if(!c.colinearResolvedScopes.has(r))return{kind:`non-referenceable-scope`};let e=Th(o,r,c);return e===void 0?{kind:`skip-colinear-unresolvable`}:e.includes(i)?{kind:`resolved`}:{kind:`colinear-miss`,members:e}}return m?{kind:`skip-schema-key`}:{kind:`unknown-namespace`,knownNamespaces:[...zp(c),...c.globalScopes.keys()]}}function Oh(e,t,n,r){let i=`@${t}.${n}`;switch(e.kind){case`resolved`:case`skip-validated`:case`skip-schema-key`:case`skip-colinear-unresolvable`:return;case`global-miss`:{let a=Od(n,e.members);return Nd(r,`'${n}' is not defined in ${t}`,i,a,e.members)}case`unknown-namespace`:{let n=Od(t,e.knownNamespaces);return Nd(r,`'@${t}' is not a recognized namespace`,i,n,e.knownNamespaces)}case`non-referenceable-scope`:return Nd(r,`'@${t}' cannot be used as a reference. This namespace is scoped to its parent block and is not directly referenceable`,i);case`colinear-miss`:{let a=Od(n,e.members);return Nd(r,`'${n}' is not defined in ${t}`,i,a,e.members)}case`standard-miss`:{let a=Od(n,e.candidates);return Nd(r,`'${n}' is not defined in ${t}`,i,a,e.candidates)}}}var kh=class{id=$(`undefined-reference`);description=`Validates that @namespace.member references point to defined symbols`;requires=[Zm,_h];pendingChecks=[];nestedChecks=[];listElementChecks=[];ancestorStack=[];init(){this.pendingChecks=[],this.nestedChecks=[],this.listElementChecks=[],this.ancestorStack=[]}enterNode(e,t){this.ancestorStack.push(t)}exitNode(){this.ancestorStack.pop()}visitExpression(e,t){let n=yd(e);if(n){this.pendingChecks.push({expr:e,namespace:n.namespace,property:n.property,ctx:t,ancestors:[...this.ancestorStack]});return}let r=bd(e);r&&r.path.length===2&&this.nestedChecks.push({expr:e,namespace:r.namespace,parent:r.path[0],member:r.path[1]});let i=bh(e);i&&this.listElementChecks.push({expr:e,...i})}run(e,t){let n=e.get(Zm)??[],r=e.get(Bm);if(!r)return;let i=e.get(_h);if(!i)throw Error(`undefined-reference pass requires constraint-validation to run first. Ensure constraintValidationPass is included and listed before undefinedReferencePass.`);let a={symbols:n,schemaCtx:r,validatedRefs:i,root:t};for(let e of this.pendingChecks){let t=Dh(e,a),n=e.expr.__cst;if(!n)continue;let r=Oh(t,e.namespace,e.property,n.range);r&&J(e.expr,r)}for(let e of this.nestedChecks){let t=Ah(e,r);t&&J(e.expr,t)}for(let e of this.listElementChecks){let t=jh(e,r);t&&J(e.expr,t)}}};function Ah(e,t){let n=e.expr.__cst;if(!n)return;let r=t.globalScopes.get(e.namespace);if(!r)return;let i=r.get(e.parent);if(!i||mu(i))return;let a=i.subMembers;if(!a||a.has(e.member)||a.has(`*`))return;let o=`${e.namespace}.${e.parent}`,s=`@${o}.${e.member}`,c=[...a.keys()],l=Od(e.member,c);return Nd(n.range,`'${e.member}' is not defined in ${o}`,s,l,c)}function jh(e,t){let n=e.expr.__cst;if(!n)return;let r=t.globalScopes.get(e.namespace);if(!r)return;let i=r.get(e.listMember);if(!i||!mu(i)||i.elementFields.has(e.attr))return;let a=`${e.namespace}.${e.listMember}[]`,o=`@${e.namespace}.${e.listMember}[].${e.attr}`,s=[...i.elementFields],c=Od(e.attr,s);return Nd(n.range,`'${e.attr}' is not defined on ${a} elements`,o,c,s)}function Mh(){return new kh}function Nh(e){if(e.__keyRange)return e.__keyRange;let t=e.value;if(eu(t))return t.__cst.range}function Ph(e){if(up(e))return e.param?`with ${e.param}`:void 0;if(lp(e)){let t=e.target?.__cst?.node?.text?.trim();return t?`set ${t}`:void 0}}var Fh=class{id=$(`duplicate-key`);description="Detects duplicate keys within block fields and duplicate `with`/`set` clauses within procedure bodies";nodes=[];runStatements=[];init(){this.nodes=[],this.runStatements=[]}enterNode(e,t,n){H(t)&&(t.__children&&this.nodes.push(t),t.__kind===`RunStatement`&&this.runStatements.push(t))}finalize(e,t){for(let e of this.nodes)this.checkBlockChildren(e);for(let e of this.runStatements)this.checkRunBody(e)}checkBlockChildren(e){if(!e.__children)return;let t=new Map,n=new Map;for(let r of e.__children){if(r instanceof hu){let n=r.entryName?`${r.key} ${r.entryName}`:r.key;if(t.has(n)){let t=Nh(r);t&&J(e,q(t,`Duplicate key '${n}'`,N.Warning,`duplicate-key`))}else t.set(n,r);continue}r instanceof Du&&this.checkClauseDuplicate(r.value,n)}}checkRunBody(e){let t=e.body;if(!Array.isArray(t))return;let n=new Map;for(let e of t)H(e)&&this.checkClauseDuplicate(e,n)}checkClauseDuplicate(e,t){if(!H(e))return;let n=Ph(e);if(n)if(t.has(n)){let t=e.__cst?.range;t&&J(e,q(t,`Duplicate ${n}`,N.Warning,`duplicate-clause`))}else t.set(n,e)}};function Ih(){return new Fh}function Lh(e){return e.__metadata?.required===!0}function Rh(e){let t={start:{line:0,character:0},end:{line:0,character:0}},n=e.__cst;if(!n)return t;let r=n.node,i=r.type===`mapping_element`?r:r.parent?.type===`mapping_element`?r.parent:null;if(i){let e=i.childForFieldName(`key`);if(e)return M(e)}return{start:n.range.start,end:{line:n.range.start.line,character:n.range.start.character}}}var zh=class{id=$(`required-fields`);description=`Validates that blocks contain all required fields from their schema`;requires=[Bm];run(e,t){let n=e.get(Bm);n&&sh(t,n.info.schema,{visitField(e,t,n,r){Lh(t)&&e===void 0&&J(r,q(Rh(r),`Missing required field '${n}'`,N.Error,`missing-required-field`))}})}};function Bh(){return new zh}var Vh=class{id=$(`singular-collection`);description=`Enforces that collection fields marked singular contain at most one entry`;finalize(e,t){let n=e.get(Bm);if(!n)return;let r=n.info.schema,i=t;for(let[e,n]of Object.entries(r)){if(!Hh(n))continue;let r=i[e];if(!U(r)||r.size<=1)continue;let a=0;for(let[,n]of r){if(a===0){a++;continue}let r=Uh(n);r&&J(t,q(r,`Only one '${e}' is allowed, but found multiple entries`,N.Error,`singular-collection`)),a++}}}};function Hh(e){return e.__metadata?.singular===!0}function Uh(e){return eu(e)?e.__cst.range:void 0}function Wh(){return new Vh}function Gh(e){return e instanceof rf?!0:e instanceof nf?e.orelse.length===0?!1:Kh(e.body)&&Kh(e.orelse):!1}function Kh(e){return e.some(Gh)}function qh(e){return e instanceof rf?`Code will never execute after 'transition'. Move this code before the transition, or wrap the transition in a conditional block.`:`Code will never execute because all branches of the preceding 'if' block transition away. Add an else branch without a transition, or move this code into one of the branches.`}function Jh(e){return Au(e)&&`__kind`in e&&typeof e.__kind==`string`}function Yh(e){let t=null;for(let n of e){if(!Jh(n))continue;let e=n;if(t){let n=e.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}};if(!H(e))continue;J(e,q(n,qh(t),N.Warning,`unreachable-code`,{tags:[hs.Unnecessary]}));continue}Gh(e)&&(t=e),e instanceof nf?(Yh(e.body),Yh(e.orelse)):e instanceof tf&&Yh(e.body)}}var Xh=class{id=$(`unreachable-code`);description=`Detects unreachable code after terminal statements like transition`;procedures=[];init(){this.procedures=[]}enterNode(e,t,n){H(t)&&t.__kind===`ProcedureValue`&&this.procedures.push(t)}run(e,t){for(let e of this.procedures){let t=e.statements;Array.isArray(t)&&t.length>0&&Yh(t)}}};function Zh(){return new Xh}var Qh=`AgentScript does not support nested 'if' statements. Combine conditions with 'and'/'or', or restructure the logic.`;function $h(e){return H(e)&&`__kind`in e&&typeof e.__kind==`string`}function eg(e){return e.__cst?.node?.type===`else_if_clause`}function tg(e){let t=e.__cst?.range;t&&H(e)&&J(e,q(t,Qh,N.Error,`unsupported-nested-if`))}function ng(e){for(let t of e)t instanceof nf&&(eg(t)||tg(t),ng(t.body),ng(t.orelse))}function rg(e){for(let t of e)$h(t)&&(t instanceof nf?(ng(t.body),ng(t.orelse)):t instanceof tf&&rg(t.body))}var ig=class{id=$(`unsupported-conditionals`);description=`Flags nested 'if' statements as unsupported by the AgentScript language spec.`;procedures=[];init(){this.procedures=[]}enterNode(e,t,n){H(t)&&t.__kind===`ProcedureValue`&&this.procedures.push(t)}run(e,t){for(let e of this.procedures){let t=e.statements;Array.isArray(t)&&t.length>0&&rg(t)}}};function ag(){return new ig}var og=`'transition' requires a target. Use 'transition to <target>'.`,sg=`'transition' accepts a single 'to' target. Multiple 'to' clauses are not allowed.`,cg=class{id=$(`transition-target`);description=`Validates that 'transition' statements have exactly one 'to <target>' clause.`;transitions=[];init(){this.transitions=[]}enterNode(e,t,n){H(t)&&t.__kind===`TransitionStatement`&&t instanceof rf&&this.transitions.push(t)}run(e,t){for(let e of this.transitions){let t=e.clauses.filter(e=>e instanceof Xd),n=e.__cst?.range;if(n&&H(e)){if(t.length===0){let t=e.__cst?.node?.children?.[0];J(e,q(t?M(t):n,og,N.Error,`transition-missing-target`))}else if(t.length>1)for(let r=1;r<t.length;r++)J(e,q(t[r].__cst?.range??n,sg,N.Error,`transition-multiple-targets`))}}}};function lg(){return new cg}var ug=new Set([`inputs`,`outputs`]),dg=class{id=$(`empty-block`);description=`Flags empty inputs/outputs blocks that should contain at least one entry`;hits=[];init(){this.hits=[]}enterNode(e,t,n){if(!ug.has(e)||!n||typeof n!=`object`)return;let r=null;if(U(t)){if(t.size>0)return;r=t}else if(t==null)r=null;else return;this.hits.push({key:e,node:r,parent:n})}finalize(e,t){for(let{key:e,node:t,parent:n}of this.hits){let r=t?.__cst,i=n.__cst,a=r?.range??i?.range??{start:{line:0,character:0},end:{line:0,character:0}};J(t??n,q(a,`Empty '${e}' block — must contain at least one entry`,N.Error,`empty-block`))}}};function fg(){return new dg}var pg=class{id=$(`spread-context`);description=`Rejects spread expressions outside call arguments or list literals`;enterNode(e,t,n){if(!(t instanceof hd)||n instanceof fd&&e!==`func`||n instanceof ud)return;let r=t.__cst;r&&J(t,q(r.range,`Spread expression is only allowed as a call argument or list element`,N.Error,`invalid-spread-context`))}};function mg(){return new pg}var hg=class{id=$(`identifier-validation`);description="Rejects bare identifiers used as expression values (e.g. `none`, `abcd`)";ancestorStack=[];init(){this.ancestorStack=[]}enterNode(e,t){this.ancestorStack.push(t)}exitNode(){this.ancestorStack.pop()}visitExpression(e,t){if(!(e instanceof G))return;let n=this.ancestorStack[this.ancestorStack.length-2];if(n instanceof fd&&n.func===e)return;let r=e.__cst;if(!r)return;let{message:i,code:a}=gg(e.name),o=this.isInsideInterpolation()?N.Warning:N.Error;J(e,q(r.range,i,o,a))}isInsideInterpolation(){return this.ancestorStack.some(ip)}};function gg(e){switch(e.toLowerCase()){case`none`:return{message:`'${e}' is not a valid value in AgentScript. Did you mean 'None' (capitalized) for an empty value?`,code:`identifier-confusable-none`};case`true`:case`false`:return{message:`'${e}' is not a valid value in AgentScript. Did you mean '${e[0].toUpperCase()+e.slice(1).toLowerCase()}' (capitalized)?`,code:`identifier-confusable-boolean`};case`null`:return{message:`'null' is not a valid value in AgentScript. Use 'None' for an empty value or '""' for an empty string.`,code:`null-not-allowed`};default:return{message:`'${e}' is not a defined value. Bare identifiers are not allowed here; use a literal ("...", a number, True/False/None) or an @variables.X reference.`,code:`unknown-identifier`}}}function _g(){return new hg}var vg=class{options;id=$(`unused-variable`);description=`Flags variables that are declared but never referenced`;usedVariables=new Set;constructor(e={}){this.options=e}init(){this.usedVariables=new Set}visitExpression(e,t){let n=jd(e);n&&this.usedVariables.add(n)}run(e,t){let n=t.variables;if(!U(n))return;let r=this.options.collectExternallyUsedVariables?.(e,t);if(r)for(let e of r)this.usedVariables.add(e);for(let[e,t]of n){if(this.usedVariables.has(e))continue;let n=H(t)?t:null;if(!n?.__cst)continue;let r=n.__cst.range,i=this.options.overrideMessageForVariable?.(e,n);J(n,{range:r,message:i??`Variable '${e}' is declared but never used`,severity:N.Information,code:`unused-variable`,source:K,tags:[hs.Unnecessary],data:{removalRange:r}})}}};function yg(e){return new vg(e)}function bg(e){let t=e[1];return!(t instanceof W)||!t.__cst?.range||xg(t.value)?[]:[{range:t.__cst.range,message:`'${t.value}' is a structurally malformed JSONPath selector. Selectors must follow necessary structural rules such as a '$' root, balanced brackets and quotes, and non-empty bracket contents.`,severity:N.Error,code:`invalid-jsonpath`}]}function xg(e){if(e.length===0||e[0]!==`$`||e.length>1&&e[1]!==`.`&&e[1]!==`[`)return!1;let t=null,n=[];for(let r=1;r<e.length;r++){let i=e[r];if(t){if(i===t){let n=0;for(let t=r-1;t>=0&&e[t]===`\\`;t--)n++;n%2==0&&(t=null)}continue}if(i===`"`||i===`'`)t=i;else if(i===`[`)n.push(r);else if(i===`]`){let t=n.pop();if(t===void 0||e.slice(t+1,r).trim().length===0)return!1}}return!(t!==null||n.length>0||/\.\.?$/.test(e))}var Sg=new Map([[`len`,{name:`len`,minArgs:1,maxArgs:1}],[`max`,{name:`max`,minArgs:1,maxArgs:null}],[`min`,{name:`min`,minArgs:1,maxArgs:null}],[`json_path`,{name:`json_path`,minArgs:2,maxArgs:3,validators:[bg]}],[`lower`,{name:`lower`,minArgs:1,maxArgs:1}],[`upper`,{name:`upper`,minArgs:1,maxArgs:1}],[`to_json`,{name:`to_json`,minArgs:1,maxArgs:1}],[`from_json`,{name:`from_json`,minArgs:1,maxArgs:1}]]);(()=>{let e=new Set(Sg.keys()),t=new Set(gs),n=[...t].filter(t=>!e.has(t)),r=[...e].filter(e=>!t.has(e));if(n.length>0||r.length>0){let e=[];throw n.length>0&&e.push(`missing from BUILTIN_CATALOG: ${n.join(`, `)}`),r.length>0&&e.push(`missing from BUILTIN_FUNCTION_NAMES: ${r.join(`, `)}`),Error(`Built-in function catalog is out of sync with @sf-agentscript/types BUILTIN_FUNCTION_NAMES (${e.join(`; `)}). Add the function to both so highlighting and linting agree.`)}})();function Cg(e){let t=new Map;for(let n of e)t.set(n,{name:n,minArgs:0,maxArgs:null});return t}new Set(Sg.keys());var wg=new Set([`+`,`-`,`==`,`!=`,`<`,`>`,`<=`,`>=`,`and`,`or`,`not`,`in`,`not in`]),Tg=class{id=$(`expression-validation`);description=`Validates function calls and operators used in expressions`;catalog;namespacedFunctions;allowedFunctionsList;supportedOperators;ancestorStack=[];constructor(e={}){this.catalog=e.catalog??(e.functions?Cg(e.functions):Sg),this.namespacedFunctions=e.namespacedFunctions??{},this.supportedOperators=e.supportedOperators??wg,this.allowedFunctionsList=[...this.catalog.keys()]}init(){this.ancestorStack=[]}enterNode(e,t){this.ancestorStack.push(t)}exitNode(){this.ancestorStack.pop()}visitExpression(e,t){e instanceof fd?this.checkCallExpression(e):e instanceof sd?this.checkBinaryExpression(e):e instanceof ad?this.checkSubscriptExpression(e):e instanceof id&&this.checkMemberExpression(e)}checkBareUploadedFilesReference(e){let t=this.ancestorStack[this.ancestorStack.length-2];if(Eg(t,e))return;let n=e.__cst;n&&J(e,q(n.range,`@system_variables.uploaded_files is a list; index it with [N], slice it with [a:b], or wrap in len() — a bare reference renders as a raw list at runtime`,N.Error,`bare-uploaded-files-reference`))}checkMemberExpression(e){!(e.object instanceof rd)||e.object.name!==`system_variables`||e.property!==`uploaded_files`||this.checkBareUploadedFilesReference(e)}checkSubscriptExpression(e){if(!(e instanceof ad))return;if(e.object instanceof rd&&e.object.name===`system_variables`&&e.index instanceof W&&e.index.value===`uploaded_files`){this.checkBareUploadedFilesReference(e);return}if(!(e.index instanceof od)||!(e.object instanceof rd)||e.object.name!==`system_variables`)return;let t=e.__cst;t&&J(e,q(t.range,`Slices are not supported on @system_variables (use @system_variables.uploaded_files[…] for slicing uploaded files)`,N.Error,`unsupported-slice-target`))}checkCallExpression(e){let t=e.__cst;if(!t)return;let n=e.func;if(!(!n||typeof n!=`object`||!(`__kind`in n)))if(n instanceof id){let r=n.object;if(r instanceof G){let i=r.name,a=this.namespacedFunctions[i]??new Set;if(!(i in this.namespacedFunctions)){let n=Object.keys(this.namespacedFunctions),r=Od(i,n),a=Dd(`'${i}' is not a recognized function. Available functions: ${[...this.allowedFunctionsList,...n].join(`, `)}`,r);J(e,q(t.range,a,N.Error,`unknown-function`,{suggestion:r}))}else if(!a.has(n.property)){let r=[...a],o=Od(n.property,r),s=Dd(`'${n.property}' is not a recognized function in namespace '${i}'. Available functions: ${r.join(`, `)}`,o);J(e,q(t.range,s,N.Error,`unknown-function`,{suggestion:o}))}}else{let n=Object.entries(this.namespacedFunctions).flatMap(([e,t])=>[...t].map(t=>`${e}.${t}`));J(e,q(t.range,`Namespace function calls are not permitted. Only direct namespace function calls are allowed (${n.join(`, `)})`,N.Error,`namespace-function-call`))}}else n instanceof G?this.validateIdentifier(n,e):J(e,q(t.range,`Indirect function calls are not permitted. Only direct calls to built-in functions are allowed (${this.allowedFunctionsList.join(`, `)})`,N.Error,`indirect-function-call`))}validateIdentifier(e,t){let n=t.__cst;if(!n)return;let r=e.name;if(r.length===0){J(t,q(n.range,`Unexpected Identifier node: missing "name" property`,N.Warning,`malformed-ast`));return}let i=this.catalog.get(r);if(!i){let e=Od(r,this.allowedFunctionsList),i=Dd(`'${r}' is not a recognized function. Available functions: ${this.allowedFunctionsList.join(`, `)}`,e);J(t,q(n.range,i,N.Error,`unknown-function`,{suggestion:e}));return}let a=t.args??[],o=Dg(r,i,a.length);if(o){J(t,q(n.range,o,N.Error,`function-argument-count`));return}let s=i.validators?.flatMap(e=>e(a))??[];for(let e of s)J(t,q(e.range,e.message,e.severity,e.code,e.suggestion?{suggestion:e.suggestion}:void 0))}checkBinaryExpression(e){let t=e.operator;if(typeof t==`string`&&!this.supportedOperators.has(t)){let n=e.__cst;if(!n)return;J(e,q(n.range,`Operator '${t}' is not supported`,N.Error,`unsupported-operator`))}}};function Eg(e,t){if(e instanceof ad&&e.object===t)return!0;if(e instanceof fd){let t=e.func;if(t instanceof G&&t.name===`len`)return!0}return!1}function Dg(e,t,n){let{minArgs:r,maxArgs:i}=t,a=e=>e===1?`argument`:`arguments`;return i!==null&&r===i?n===r?null:`'${e}' expects exactly ${r} ${a(r)} but received ${n}`:n<r?i===null?`'${e}' expects at least ${r} ${a(r)} but received ${n}`:`'${e}' expects ${r} to ${i} arguments but received ${n}`:i!==null&&n>i?`'${e}' expects ${r} to ${i} arguments but received ${n}`:null}function Og(e){return new Tg(e)}function kg(e,t,n){if(!e||typeof e!=`object`)return null;let r=e;switch(r.__kind){case`BooleanLiteral`:case`ComparisonExpression`:return`boolean`;case`BinaryExpression`:{let e=r.operator;return e===`and`||e===`or`?`boolean`:`number`}case`UnaryExpression`:return r.operator===`not`?`boolean`:`number`;case`StringLiteral`:case`TemplateExpression`:return`string`;case`NumberLiteral`:return`number`;case`MemberExpression`:case`AtIdentifier`:if(t){let n=jd(e);if(n){let e=t(n);if(e)return e.toLowerCase()===`boolean`?`boolean`:e}}if(n){let t=bd(e);if(t){let e=n(t.namespace,t.path);if(e)return e.toLowerCase()===`boolean`?`boolean`:e}}return null;default:return null}}var Ag={string:`StringLiteral`,number:`NumberLiteral`};function jg(e){let t=Ag[e];return t?Sd.get(t)??`'${e}'`:e===`boolean`?`a boolean`:`'${e}'`}var Mg=[`keyword`,`type`,`function`,`variable`,`string`,`number`,`operator`,`comment`,`namespace`,`property`,`decorator`],Ng=[`defaultLibrary`,`modification`,`readonly`,`block`,`blockName`];function Pg(e){let t=Mg.indexOf(e);if(t===-1)throw Error(`Unknown token type: ${e}`);return t}function Fg(e){let t=Ng.indexOf(e);if(t===-1)throw Error(`Unknown token modifier: ${e}`);return 1<<t}Pg(`comment`),Pg(`keyword`),Pg(`number`),Pg(`string`),Pg(`operator`),Pg(`variable`),Pg(`property`),Pg(`type`),Pg(`function`),Pg(`namespace`),Pg(`keyword`),Fg(`modification`),Pg(`keyword`),Pg(`string`),Pg(`namespace`),Pg(`property`),Pg(`keyword`),Fg(`block`),Pg(`keyword`),Fg(`blockName`),Pg(`operator`),Pg(`operator`),Pg(`operator`),Pg(`operator`),Pg(`keyword`),Fg(`modification`),Pg(`decorator`);function Ig(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Lg(e){if(Ig(e)){if(`value`in e&&`diagnostics`in e){let t=e.value;return Ig(t)?t:void 0}return e}}var Rg=Q(`MessagesBlock`,{welcome:X.describe(`Welcome message shown to the user.`),error:X.describe(`Error message shown on failure.`).required()}).describe(`Pre-defined message templates.`).example(`messages:
|
|
180
|
+
welcome: "Hello! How can I help you today?"
|
|
181
|
+
error: "Sorry, something went wrong. Please try again."`),zg=Q(`SystemBlock`,{instructions:X.describe(`System-level instructions for the agent. Supports {!<expression>} interpolation with context variables.`),messages:Rg.describe(`Default messages for certain situations (e.g., welcome, error).`),strip_salesforce_instructions:Z.describe("When True, the default Salesforce system instructions are stripped. Set at the top-level `system` block to apply to every subagent, or at a subagent-level `system` block to override for that subagent.")},{symbol:{kind:V.Namespace}}).describe(`System-level instructions and messages that interact with the user.`).example(`system:
|
|
182
|
+
instructions: |
|
|
183
|
+
You are a helpful, professional assistant for customer support.
|
|
184
|
+
Always be polite, concise, and reassuring.
|
|
185
|
+
messages:
|
|
186
|
+
welcome: "Hello! How can I help you today?"
|
|
187
|
+
error: "Sorry, something went wrong. Please try again."`),Bg=Q(`ConfigBlock`,{description:X.describe(`Agent description. Defaults to label.`),agent_type:X.describe(`Agent type discriminator. Standard agents omit this or use their product type; goal-based agents (AgentIQ) use "GoalBasedAgent". Any valid backend agent type is accepted.`).accepts([`StringLiteral`]).suggest([`GoalBasedAgent`])}).describe(`High-level agent configuration.`).example(`config:
|
|
188
|
+
agent_name: "My_Agent"
|
|
189
|
+
description: "An AI assistant for customer support"`);function Vg(e,t){if(e instanceof W)return tu(I(e,t),[]);if(e instanceof G)return tu(I(new W(e.name),t),[]);let n=I(new W(``),t),r=Fd(M(t),`Expected a locale string (e.g. "en_GB" or en_GB), got ${e.__describe()}`,`StringLiteral`,e.__kind);return n.__diagnostics.push(r),tu(n,[r])}var Hg=Nf({__fieldKind:`Primitive`,__accepts:[`StringLiteral`,`Identifier`],parse(e,t){return Vg(t.parseExpression(e),e)},emit(e,t){return e.__emit(t)}}),Ug=Q(`LanguageBlock`,{adaptive:Z.describe(`When True, the agent infers the locale from the user and other language fields are ignored.`),default_locale:X.describe(`The primary locale for the agent (e.g., "en_US", "de", "fr").`),additional_locales:{__fieldKind:`Sequence`,__metadata:{description:`Additional supported locales.`,example:`additional_locales:
|
|
190
|
+
- "fr"
|
|
191
|
+
- "de"`},parse(e,t){if(e.namedChildren.some(e=>e.type===`sequence_element`))return Hg.parse(e,t);let n=t.parseExpression(e);if(n instanceof ud){let t=[],r=[];for(let i of n.elements){let n=Vg(i,i.__cst?.node??e);t.push(n.value),r.push(...n.diagnostics)}let i=I(new Of(t),e);return i.__diagnostics.push(...r),tu(i,r)}if(n instanceof W)return tu(I(new Of(n.value.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>new W(e))),e),[]);let r=I(new Of,e),i=Fd(M(e),`Expected a list of locale strings, got ${n.__describe()}`,`StringLiteral`,n.__kind);return r.__diagnostics.push(i),tu(r,[i])},emit(e,t){return Hg.emit(e,t)},emitField(e,t,n){let r=t.__cst?.node,i=r?.namedChildren.some(e=>e.type===`sequence_element`);return r&&!i?`${R(n)}${e}: ${r.text}`:Hg.emitField(e,t,n)}},all_additional_locales:Z.describe(`Whether to support all available locales.`)}).describe(`Locale and language configuration.`).example(`language:
|
|
192
|
+
default_locale: "en_US"
|
|
193
|
+
additional_locales:
|
|
194
|
+
- "fr"
|
|
195
|
+
- "de"
|
|
196
|
+
all_additional_locales: True`),Wg=Zf(Ep.extend({},{colinear:Tf.resolvedType(`invocationTarget`)})).describe(`Collection of reasoning action bindings.`),Gg=Q(`ReasoningBlock`,{instructions:wf.describe(`Procedural instructions for the reasoning loop. Supports templating and directives.`),actions:Wg.describe(`Actions available to the agent during the reasoning loop.`)},{symbol:{kind:V.Namespace}}).describe(`Instructions and actions for the agent's reasoning loop.`).example(` reasoning:
|
|
197
|
+
instructions: ->
|
|
198
|
+
# Conditional logic can be embedded in instructions
|
|
199
|
+
if @variables.checked_loyalty_tier == False:
|
|
200
|
+
run @actions.Get_Loyalty_Tier
|
|
201
|
+
with member_email = @variables.member_email
|
|
202
|
+
set @variables.loyalty_tier = @outputs.loyalty_tier
|
|
203
|
+
set @variables.checked_loyalty_tier = True
|
|
204
|
+
if @variables.loyalty_tier != "Premium":
|
|
205
|
+
| Basic members are not eligible for returns. Apologize and
|
|
206
|
+
explain alternatives like exchanges or store credit.
|
|
207
|
+
else:
|
|
208
|
+
| If the user wants a return, confirm which order and process
|
|
209
|
+
with {!@actions.create_return}.
|
|
210
|
+
|
|
211
|
+
# Main instructions use {!@variables.x} and {!@actions.Name} for interpolation
|
|
212
|
+
| Analyze the user's request. Use {!@actions.lookup_order} to retrieve
|
|
213
|
+
order details. Current status: {! @variables.request_status }
|
|
214
|
+
actions:
|
|
215
|
+
# Bind an action — LLM can invoke during reasoning
|
|
216
|
+
lookup_order: @actions.Lookup_Order
|
|
217
|
+
with order_number=@variables.order_number
|
|
218
|
+
set @variables.status = @outputs.status
|
|
219
|
+
set @variables.order_id = @outputs.order_id
|
|
220
|
+
|
|
221
|
+
# LLM slot-filled input (... = LLM provides the value from conversation)
|
|
222
|
+
search: @actions.Search_Products
|
|
223
|
+
with query=...
|
|
224
|
+
set @variables.results = @outputs.products
|
|
225
|
+
|
|
226
|
+
# Conditional availability guard
|
|
227
|
+
create_return: @actions.Create_Return
|
|
228
|
+
available when @variables.return_eligible == True
|
|
229
|
+
with order_id = @variables.order_id
|
|
230
|
+
set @variables.rma_number = @outputs.rma_number
|
|
231
|
+
|
|
232
|
+
# Chained run — execute a follow-up action after the first completes
|
|
233
|
+
lookup_by_email: @actions.Lookup_Order_By_Email
|
|
234
|
+
with email=@variables.member_email
|
|
235
|
+
set @variables.order_number = @outputs.order_number
|
|
236
|
+
run @actions.Lookup_Order
|
|
237
|
+
with order_number=@variables.order_number
|
|
238
|
+
set @variables.status = @outputs.status
|
|
239
|
+
|
|
240
|
+
# Transition to another subagent
|
|
241
|
+
go_to_returns: @utils.transition to @subagent.Return_Management
|
|
242
|
+
description: "Route to returns when user wants to return items"
|
|
243
|
+
available when @variables.verified is True
|
|
244
|
+
|
|
245
|
+
# Set variables from conversation (LLM fills values)
|
|
246
|
+
capture_info: @utils.setVariables
|
|
247
|
+
description: "Capture customer information from conversation"
|
|
248
|
+
with member_email=...
|
|
249
|
+
with member_number=...
|
|
250
|
+
|
|
251
|
+
# Escalate to a human agent
|
|
252
|
+
escalate: @utils.escalate
|
|
253
|
+
description: "Hand off to a live human agent"`),Kg={label:X.describe(`Display label shown in the UI.`).accepts([`StringLiteral`]).displayLabelField(),description:X.describe(`Block description. Influences transitions to this block.`).required(),system:zg.pick([`instructions`,`strip_salesforce_instructions`]),actions:Tp.describe(`Action definitions available to this block.`),bundles:Nf().describe(`Node-level bundle references, e.g. @bundles.targeting. Each entry must reference a top-level bundle declared in the bundles block.`),reasoning:Gg.describe(`Reasoning block containing instructions and actions for the agent reasoning loop.`),schema:X.describe(`URI identifying the subagent schema variant (e.g., "node://CustomSubagent"). When specified, enables custom field validation.`).pattern(/^node:\/\/\S+$/).accepts([`StringLiteral`])},qg={...Kg,before_reasoning:wf.describe(`Procedures that run before the reasoning loop starts, once per turn.`).omitArrow().disallowTemplates(`Templates are for LLM instructions and should only be used in reasoning.instructions.`),after_reasoning:wf.describe(`Procedures that run after the reasoning loop completes, once per turn.`).omitArrow().disallowTemplates(`Templates are for LLM instructions and should only be used in reasoning.instructions.`)},Jg={...Kg,parameters:Q(`ParametersBlock`,{}).describe(`Custom parameters for schema variants. Structure is defined by the schema variant.`),on_init:wf.describe(`Procedures that run when the subagent is initialized.`).omitArrow().disallowTemplates(`Templates are for LLM instructions and should only be used in reasoning.instructions.`),on_exit:wf.describe(`Procedures that run when the subagent is exited from.`).omitArrow().disallowTemplates(`Templates are for LLM instructions and should only be used in reasoning.instructions.`)},Yg={allowAnonymous:!0,capabilities:[`invocationTarget`,`transitionTarget`]},Xg=Gf(`SubagentBlock`,{...qg},{scopeAlias:`subagent`,...Yg}).describe(`A subagent defining agent logic with actions and reasoning.`),Zg=Gf(`StartAgentBlock`,{...qg},{scopeAlias:`subagent`,...Yg}).describe(`The entry-point agent block.`),Qg=Gf(`ConnectedSubagentBlock`,{target:X.accepts([`StringLiteral`]).describe(`URI identifying the connected agent (e.g., "agent://Agent_Name").`).required().pattern(/^[a-zA-Z][a-zA-Z0-9_]*:\/\/\S+$/),label:X.describe(`Human-readable label for the connected agent.`),description:X.describe(`Description of the connected agent's capabilities or when it should be called.`),loading_text:X.describe(`Message to display while the connected agent is executing.`),inputs:Sp,after_response:wf.describe(`Procedures that run after the connected agent returns a response. Supports run/set/if/transition for post-response state updates and handoffs.`).omitArrow().disallowTemplates(`Templates are for LLM instructions; connected agents have no reasoning loop.`),delegate_escalation:Z.describe(`When True (default), use the outbound flow of the connected subagent. When False, use the outbound flow of the orchestrator agent.`)},{capabilities:[`invocationTarget`,`transitionTarget`]}),$g=Gf(`WorkflowBlock`,{agent:Tf.describe(`Subagent (or connected subagent) this workflow routes to deterministically, e.g. @subagent.lead_generation.`).resolvedType(`invocationTarget`),prompt:X.describe(`Instruction for this workflow. Required when no agent is set; optional additional context when agent is set.`).accepts([`StringLiteral`])},{symbol:{kind:V.Method},scopeAlias:`workflows`,capabilities:[`invocationTarget`]}).describe(`A named, independently-executable workflow scoped to the agent.`).example(`workflows:
|
|
254
|
+
lead_generation:
|
|
255
|
+
agent: @subagent.lead_generation
|
|
256
|
+
follow_up:
|
|
257
|
+
agent: @subagent.outreach
|
|
258
|
+
prompt: "Follow up on emails from last week that haven't received a reply."
|
|
259
|
+
free_form:
|
|
260
|
+
prompt: "Summarise recent activity for this account."`),e_=Gf(`TriggerBlock`,{schedule:X.describe(`Cron schedule expression (e.g., "30 8 * * *").`).accepts([`StringLiteral`]).required(),target:Tf.describe(`Reference to the workflow to execute, e.g. @workflows.follow_up.`).required()},{symbol:{kind:V.Event},scopeAlias:`trigger`}).describe(`A scheduled trigger that executes a workflow on a cron schedule.`).example(`trigger:
|
|
261
|
+
daily_lead_gen:
|
|
262
|
+
schedule: "30 8 * * *"
|
|
263
|
+
target: @workflows.lead_generation`),t_=Gf(`BundleBlock`,{target:X.accepts([`StringLiteral`]).describe(`URI identifying the bundle, e.g. "bundle://prospecting". Matches the name of the bundle.`).required().pattern(/^bundle:\/\/\S+$/)},{symbol:{kind:V.Namespace},scopeAlias:`bundles`}).describe(`A bundle the agent can load and route to.`).example(`bundles:
|
|
264
|
+
prospecting:
|
|
265
|
+
target: "bundle://prospecting"
|
|
266
|
+
outreach:
|
|
267
|
+
target: "bundle://outreach"`),n_=Gf(`OrchestratorBlock`,{actions:Tp.describe(`Action definitions available to the orchestrator during reasoning.`),reasoning:Gg.describe(`LLM-facing reasoning configuration: instructions and available tools.`)},{scopeAlias:`orchestrator`,allowAnonymous:!0,capabilities:[`invocationTarget`,`transitionTarget`]}).describe(`The primary, LLM-driven entry point for a goal-based agent.`).example(`orchestrator agent:
|
|
268
|
+
actions:
|
|
269
|
+
lookup_account:
|
|
270
|
+
description: "Look up an account by name"
|
|
271
|
+
target: "flow://LookupAccount"
|
|
272
|
+
reasoning:
|
|
273
|
+
instructions: ->
|
|
274
|
+
| You are a goal-based agent. Determine the user's intent and act.
|
|
275
|
+
actions:
|
|
276
|
+
lookup_account:
|
|
277
|
+
description: "Look up an account"`),r_={system:zg,config:Bg,variables:xp,language:Ug,actions:Tp.describe(`Agent-level action definitions. Inherited by every subagent, which can reference them in reasoning actions.`),workflows:Qf($g),bundles:Qf(t_),trigger:Qf(e_),connected_subagent:Qf(Qg),start_agent:Qf(Zg.clone().example(`# Exactly one start_agent is required as the entry point
|
|
278
|
+
start_agent topic_selector:
|
|
279
|
+
label: "Topic Selector"
|
|
280
|
+
description: "Welcome user and route to the right subagent"
|
|
281
|
+
|
|
282
|
+
reasoning:
|
|
283
|
+
instructions: ->
|
|
284
|
+
| Welcome the user. Analyze their request and route accordingly:
|
|
285
|
+
{!@actions.go_to_orders}: For order lookups and updates
|
|
286
|
+
{!@actions.go_to_returns}: For return requests
|
|
287
|
+
{!@actions.go_to_escalation}: When user is upset or asks for a person
|
|
288
|
+
actions:
|
|
289
|
+
go_to_orders: @utils.transition to @subagent.Order_Management
|
|
290
|
+
description: "Handle order inquiries"
|
|
291
|
+
available when @variables.verified == True
|
|
292
|
+
go_to_returns: @utils.transition to @subagent.Return_Management
|
|
293
|
+
description: "Handle return requests"
|
|
294
|
+
available when @variables.verified == True
|
|
295
|
+
go_to_escalation: @utils.transition to @subagent.escalation
|
|
296
|
+
description: "Escalate to human agent"`)).singular(),orchestrator:Qf(n_).singular(),subagent:Qf(Xg.clone().example(`# Additional subagents handle specific conversation areas
|
|
297
|
+
subagent Order_Management:
|
|
298
|
+
description: "Handles order lookups, updates, and summaries"
|
|
299
|
+
|
|
300
|
+
# Optional subagent-level system instruction override
|
|
301
|
+
system:
|
|
302
|
+
instructions: "Focus on helping the user with their order. Never expose internal record IDs."
|
|
303
|
+
|
|
304
|
+
# before_reasoning runs BEFORE the LLM reasoning loop on every turn
|
|
305
|
+
before_reasoning:
|
|
306
|
+
if @variables.verified is not True:
|
|
307
|
+
transition to @subagent.Identity
|
|
308
|
+
# Run an action and store results in variables
|
|
309
|
+
run @actions.Check_Business_Hours
|
|
310
|
+
set @variables.is_business_hours = @outputs.is_business_hours
|
|
311
|
+
|
|
312
|
+
# Action definitions — external actions the agent can call
|
|
313
|
+
actions:
|
|
314
|
+
Lookup_Order:
|
|
315
|
+
description: "Retrieve order details"
|
|
316
|
+
inputs:
|
|
317
|
+
order_number: string
|
|
318
|
+
description: "The order number to look up"
|
|
319
|
+
is_required: True
|
|
320
|
+
is_user_input: True
|
|
321
|
+
outputs:
|
|
322
|
+
status: string
|
|
323
|
+
description: "Order status"
|
|
324
|
+
items: string
|
|
325
|
+
order_id: string
|
|
326
|
+
target: "flow://Lookup_Order"
|
|
327
|
+
|
|
328
|
+
Check_Business_Hours:
|
|
329
|
+
description: "Check if it is currently business hours"
|
|
330
|
+
inputs:
|
|
331
|
+
query: string
|
|
332
|
+
outputs:
|
|
333
|
+
is_business_hours: boolean
|
|
334
|
+
next_open_time: string
|
|
335
|
+
target: "flow://Check_Business_Hours"
|
|
336
|
+
|
|
337
|
+
reasoning:
|
|
338
|
+
instructions: ->
|
|
339
|
+
| Ask for the Order Number and call {!@actions.lookup_order}.
|
|
340
|
+
Summarize: status, items, delivery info.
|
|
341
|
+
Never show the Record ID: {!@variables.order_id}
|
|
342
|
+
actions:
|
|
343
|
+
lookup_order: @actions.Lookup_Order
|
|
344
|
+
with order_number=...
|
|
345
|
+
set @variables.status = @outputs.status
|
|
346
|
+
set @variables.order_id = @outputs.order_id
|
|
347
|
+
|
|
348
|
+
go_to_return: @utils.transition to @subagent.Return_Management
|
|
349
|
+
description: "If user wants to return items"
|
|
350
|
+
|
|
351
|
+
# after_reasoning runs AFTER the LLM reasoning loop on every turn
|
|
352
|
+
after_reasoning:
|
|
353
|
+
if @variables.severe_weather_alert:
|
|
354
|
+
transition to @subagent.severe_weather_alerts
|
|
355
|
+
set @variables.request_count = @variables.request_count + 1`))},i_={start_agent:`subagent`,agent:`orchestrator`},a_={schema:r_,aliases:i_,nodeMemberAccess:{members:[`input`,`output`],outputMember:`output`},globalScopes:{utils:new Map([[`transition`,{capability:`invocationTarget`}],[`setVariables`,{capability:`invocationTarget`}],[`escalate`,{capability:`invocationTarget`}],[`end_session`,{capability:`invocationTarget`}]]),system_variables:new Map([[`user_input`,{type:`string`}],[`current_modality`,{type:`string`}],[`current_connection`,{type:`string`}],[`last_reply`,{subMembers:new Map([[`interrupted`,{type:`boolean`}],[`interrupted_heard_text`,{type:`string`}]])}],[`uploaded_files`,{list:!0,elementFields:new Set([`id`,`file_url`,`name`,`mime_type`])}]])}};Dp(a_);function o_(e){let t=e.type;return t?t.__cst?.node?.text?.trim()??null:null}function s_(e){if(!e||typeof e!=`object`)return;let t=e;if(t.__kind!==`BooleanValue`||typeof t.value!=`boolean`)return;let n=t.__cst;if(!n)return;let r=n.node.parent,i=n.range;if(r?.type===`mapping_element`){let e=r.childForFieldName(`key`);e&&(i=M(e))}return{value:t.value,keyRange:i,node:t}}function c_(e){if(!e||typeof e!=`object`)return;let t=e;if(t.__kind!==`StringLiteral`||typeof t.value!=`string`)return;let n=t.__cst;if(!n)return;let r=n.node.parent,i=n.range;if(r?.type===`mapping_element`){let e=r.childForFieldName(`key`);e&&(i=M(e))}return{value:t.value,keyRange:i,node:t}}function l_(e){if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return;let t=e;if(typeof t.value==`string`)return t.value;if(typeof t.name==`string`)return t.name}function u_(e){let t=new Map;if(!e||!U(e))return t;for(let[n,r]of e){if(!r||typeof r!=`object`)continue;let e=r,i=o_(e);if(!i)continue;let a={type:i,hasDefault:e.defaultValue!=null},o=e.properties;if(o){let e=s_(o.is_required);e&&(a.isRequired=e.value)}t.set(n,a)}return t}function d_(e){let t=new Map;if(!e||!U(e))return t;for(let[n,r]of e){if(!r||typeof r!=`object`)continue;let e=r,i=o_(e);if(!i)continue;let a={type:i,hasDefault:e.defaultValue!=null},o=e.properties;if(o){let e=s_(o.is_displayable);e&&(a.isDisplayable=e);let t=s_(o.is_used_by_planner);t&&(a.isUsedByPlanner=t)}t.set(n,a)}return t}var f_=$(`type-map`),p_=class{id=f_;description=`Extracts structured type information for variables and action parameters`;variables=new Map;init(){this.variables=new Map}visitVariables(e){for(let[t,n]of e){if(!n||typeof n!=`object`)continue;let e=n,r=o_(e);if(!r)continue;let i=e.modifier,a=e.properties;this.variables.set(t,{type:r,modifier:i?.name,visibility:l_(a?.visibility)})}}finalize(e,t){let n=e.get(Bm),r=new Map,i=new Map,a=t;if(n){let e=new Set([...Fp(`subagent`,n),...Fp(`topic`,n)]);for(let t of e){let e=a[t];if(!(!e||!U(e)))for(let[t,n]of e){if(!n||typeof n!=`object`)continue;let e=n,a=e.actions;if(a&&U(a))for(let[e,n]of a){if(!n||typeof n!=`object`)continue;let i=n,a=u_(i.inputs),o=d_(i.outputs),s=s_(i.require_user_confirmation),c=i.source,l=c&&typeof c.value==`string`?c.value:void 0,u=c_(i.target);r.has(t)||r.set(t,new Map),r.get(t).set(e,{inputs:a,outputs:o,requireUserConfirmation:s,source:l,target:u})}m_(e.before_reasoning,i),m_(e.after_reasoning,i);let o=e.reasoning?.actions;if(o&&U(o))for(let[,e]of o)!e||typeof e!=`object`||m_(e,i)}}}let o=new Map,s=a.connected_subagent;if(s&&U(s))for(let[e,t]of s){if(!t||typeof t!=`object`)continue;let n=t,r=n.inputs,i=new Map;if(r&&U(r))for(let[e,t]of r){if(!t||typeof t!=`object`)continue;let n=t,r=o_(n);if(!r)continue;let a=n.defaultValue,o=a?.__cst;i.set(e,{type:r,hasDefault:a!=null,decl:n,defaultValueNode:a,defaultValueCst:o??void 0})}let a=n.target,s=a&&typeof a.value==`string`?a.value:void 0;o.set(e,{inputs:i,target:s,targetNode:a})}e.set(f_,{variables:this.variables,actions:r,connectedAgents:o,transitionTargets:i})}};function m_(e,t){if(!e||typeof e!=`object`)return;let n=e,r=n.statements;if(r)for(let e of r)h_(e,n,t)}function h_(e,t,n){if(e.__kind===`ToClause`)g_(e,t,n);else if(e.__kind===`TransitionStatement`){let r=e.clauses;if(r)for(let e of r)e.__kind===`ToClause`&&g_(e,t,n)}else if(e.__kind===`IfStatement`){let r=e.body;if(r)for(let e of r)h_(e,t,n);let i=e.orelse;if(i)for(let e of i)h_(e,t,n)}}function g_(e,t,n){let r=e.target;if(!r||typeof r!=`object`)return;let i=yd(r);if(!i)return;let a=r.__cst?.range??e.__cst?.range;if(!a)return;let o={namespace:i.namespace,property:i.property,range:a,diagnosticParent:t},s=n.get(i.namespace);s?s.push(o):n.set(i.namespace,[o])}function __(){return new p_}var v_=$(`reasoning-actions`),y_=$(`set-variables-entries`),b_=class{id=v_;description=`Pre-resolves reasoning action references and their action signatures`;finalizeAfter=[f_];finalize(e,t){let n=e.get(f_);if(!n)return;let r=e.get(Bm);if(!r)return;let i=[],a=[],o=t,s=new Set([...Fp(`subagent`,r),...Fp(`topic`,r)]);for(let e of s){let t=o[e];if(!(!t||!U(t)))for(let[e,n]of t){if(!n||typeof n!=`object`)continue;let t=n.reasoning;if(!t||typeof t!=`object`)continue;let r=t.actions;if(!(!r||!U(r)))for(let[,t]of r){if(!t||typeof t!=`object`)continue;let n=t;if(n.__kind!==`ReasoningActionBlock`)continue;if(!n.value){let e=n.__cst;e&&J(n,q(e.range,`Reasoning action is missing a target reference (e.g., @actions.Name, @utils.transition, @utils.setVariables)`,N.Error,`missing-action-reference`));continue}let r=n.statements,o=n.value?.__cst?.range??n.__cst?.range,s=kd(n);if(s){i.push({topicName:e,refActionName:s,namespace:`actions`,ra:n,statements:r,actionRefRange:o});continue}let c=yd(n.value);c&&c.namespace===`connected_subagent`?i.push({topicName:e,refActionName:c.property,namespace:`connected_subagent`,ra:n,statements:r,actionRefRange:o}):c&&c.namespace===`utils`&&c.property===`setVariables`&&a.push({topicName:e,ra:n,statements:r,actionRefRange:o})}}}let c=[];for(let e of i){let t;if(e.namespace===`actions`)t=n.actions.get(e.topicName)?.get(e.refActionName);else if(e.namespace===`connected_subagent`){let r=n.connectedAgents.get(e.refActionName);r&&(t=S_(r))}t&&c.push({topicName:e.topicName,refActionName:e.refActionName,namespace:e.namespace,sig:t,ra:e.ra,statements:e.statements,actionRefRange:e.actionRefRange})}e.set(v_,c),e.set(y_,a)}};function x_(){return new b_}function S_(e){let t=new Map;for(let[n,r]of e.inputs)t.set(n,{type:r.type,hasDefault:r.hasDefault});return{inputs:t,outputs:new Map}}function C_(){return Lm({id:`action-io`,description:`Validates with/set clauses match action input/output definitions`,deps:{entry:Fm(v_)},run({entry:e}){let{refActionName:t,namespace:n,sig:r,statements:i,actionRefRange:a,ra:o}=e,s=[...r.inputs.keys()],c=[...r.outputs.keys()],l=new Set,u=n===`connected_subagent`?N.Error:N.Information,d=e=>n===`connected_subagent`?`Missing required input '${e}' for action '${t}'`:`Input '${e}' on action '${t}' has no \`with\` clause and will be filled by the LLM at runtime`;if(!i){for(let[e,t]of r.inputs)!t.hasDefault&&t.isRequired!==!1&&a&&J(o,q(a,d(e),u,`action-missing-input`));return}for(let e of i){if(e.__kind===`WithClause`){let n=e.param;if(!n)continue;if(l.add(n),!r.inputs.has(n)){let r=e.__cst;if(r){let i=e.__paramCstNode,a=i?M(i):r.range,o=Od(n,s);J(e,q(a,`'${n}' is not a defined input of action '${t}'`,N.Error,`action-unknown-input`,{suggestion:o}))}}}if(e.__kind===`SetClause`){let n=Ad(e.value);if(n&&!r.outputs.has(n.name)){let r=n.cst;if(r){let i=Od(n.name,c),a=`'${n.name}' is not a defined output of action '${t}'`;J(e,q(r.range,a,N.Error,`action-unknown-output`,{suggestion:i}))}}}}for(let[e,t]of r.inputs)!t.hasDefault&&t.isRequired!==!1&&!l.has(e)&&a&&J(o,q(a,d(e),u,`action-missing-input`))}})}function w_(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n===`object`||r===`object`}function T_(){return Lm({id:`action-type-check`,description:`Validates type compatibility in with/set clauses against action parameter types`,deps:{typeMap:f_,schemaCtx:Bm,entry:Fm(v_)},run({typeMap:e,schemaCtx:t,entry:n}){let{sig:r,statements:i}=n;if(!i)return;let a=t=>e.variables.get(t)?.type??null,o=(e,n)=>Bp(t,e,n)??null;for(let t of i){if(t.__kind===`WithClause`){let e=t.param;if(!e)continue;let n=r.inputs.get(e);if(!n)continue;let i=kg(t.value,a,o);if(!i)continue;if(!w_(n.type,i)){let r=t.__cst;if(r){let a=Fd(r.range,`Type mismatch: input '${e}' expects '${n.type}' but got '${i}'`,n.type,i,K);a.severity=N.Warning,J(t,a)}}}if(t.__kind===`SetClause`){let n=Ad(t.value);if(!n)continue;let i=r.outputs.get(n.name);if(!i)continue;let a=jd(t.target);if(!a)continue;let o=e.variables.get(a)?.type;if(o&&!w_(o,i.type)){let e=t.__cst;if(e){let r=Fd(e.range,`Type mismatch: output '${n.name}' is '${i.type}' but target '@variables.${a}' expects '${o}'`,o,i.type,K);r.severity=N.Warning,J(t,r)}}}}}})}function E_(){return Lm({id:`available-when-type-check`,description:`Validates that available when conditions are boolean expressions or references`,deps:{typeMap:f_,schemaCtx:Bm,entry:Fm(v_)},run({typeMap:e,schemaCtx:t,entry:n}){let{statements:r}=n;if(!r)return;let i=t=>e.variables.get(t)?.type??null,a=(e,n)=>Bp(t,e,n)??null;for(let e of r){if(e.__kind!==`AvailableWhen`)continue;let t=e.condition;if(!t)continue;let n=kg(t,i,a);if(n===null||n===`boolean`)continue;let r=t.__cst;r&&J(e,q(r.range,`'available when' condition should be a boolean expression or reference, but found ${jg(n)}`,N.Warning,`available-when-non-boolean`))}}})}function D_(e){return e===`list`||e.startsWith(`list[`)}function O_(e){return e===`dict`||e===`object`||e===`string`||D_(e)}function k_(e){return e===`object`||e===`dict`||D_(e)}var A_={len:e=>e.filter(e=>e.type!==null&&!O_(e.type)).map(e=>({arg:e.expr,message:`'len' expects a list, dict, or string, but got ${jg(e.type)}`})),min:M_(`min`),max:M_(`max`),json_path:e=>{let t=e[0];return!t||t.type===null||k_(t.type)?[]:[{arg:t.expr,message:`'json_path' expects an object or list, but got ${jg(t.type)}`}]},lower:j_(`lower`),upper:j_(`upper`),from_json:j_(`from_json`)};function j_(e){return t=>{let n=t[0];return!n||n.type===null||n.type===`string`?[]:[{arg:n.expr,message:`'${e}' expects a string, but got ${jg(n.type)}`}]}}function M_(e){return t=>{if(t.length!==1)return[];let n=t[0];return n.type===null||O_(n.type)?[]:[{arg:n.expr,message:`'${e}' with a single argument expects a list, dict, or string, but got ${jg(n.type)}`}]}}var N_=$(`function-argument-type-check`);function P_(){return{id:N_,description:`Validates argument types of built-in function calls (json_path, len, max, min, lower, upper, to_json, from_json)`,requires:[f_,Bm],run(e,t){let n=e.get(f_),r=e.get(Bm);if(!n||!r)return;let i=e=>n.variables.get(e)?.type??null,a=(e,t)=>Bp(r,e,t)??null;jm(t,e=>{if(!(e instanceof fd))return;let t=e.func;if(!(t instanceof G))return;let n=A_[t.name];if(!n)return;let r=e.args.map(e=>({expr:e,type:kg(e,i,a)}));for(let e of n(r)){let t=e.arg.__cst;t&&J(e.arg,q(t.range,e.message,N.Warning,`function-argument-type`))}})}}}function F_(e){if(!e||typeof e!=`object`)return null;switch(e.__kind){case`StringLiteral`:case`TemplateExpression`:return`string`;case`NumberLiteral`:return`number`;case`BooleanLiteral`:return`boolean`;case`ListLiteral`:return`list`;case`DictLiteral`:return`object`;default:return null}}function I_(e){let t=e.toLowerCase().trim();return t===`list`||t.startsWith(`list[`)?`list`:t}function L_(e,t){let n=I_(e),r=I_(t);return n===r||n===`object`||r===`object`}var R_=class{id=$(`variable-default-type-check`);description=`Validates that variable default values match their declared types`;requires=[f_];run(e,t){let n=e.get(f_);if(!n)return;let r=t.variables;if(!(!r||!U(r)))for(let[e,t]of r){if(!t||typeof t!=`object`)continue;let r=t,i=r.defaultValue;if(!i)continue;let a=F_(i);if(!a)continue;let o=n.variables.get(e)?.type;if(!o||L_(o,a))continue;let s=i.__cst;if(!s)continue;let c=Fd(s.range,`Type mismatch: variable '${e}' is declared as '${o}' but default value is '${a}'`,o,a,K);c.severity=N.Warning,c.code=`variable-default-type-mismatch`,J(r,c)}}};function z_(){return new R_}function B_(e){let t=e.get(y_),n=new Set;if(!t)return n;for(let e of t)for(let t of e.statements??[]){if(t.__kind!==`WithClause`)continue;let e=t.param;e&&n.add(e)}return n}function V_(){return Lm({id:`set-variables-io`,description:`Validates with clause params in @utils.setVariables reference defined mutable variables`,deps:{entry:Fm(y_),typeMap:f_},run({entry:e,typeMap:t}){let{statements:n}=e;if(n)for(let e of n){if(e.__kind!==`WithClause`)continue;let n=e.param;if(!n)continue;let r=t.variables.get(n);if(!r){let r=e.__cst;if(!r)continue;let i=e.__paramCstNode,a=i?M(i):r.range,o=Od(n,[...t.variables.keys()]);J(e,q(a,`'${n}' is not a defined variable. @utils.setVariables can only assign to declared variables.`,N.Warning,`set-variables-unknown-variable`,{suggestion:o}));continue}if(r.modifier!==`mutable`){let t=e.__cst;if(!t)continue;let i=e.__paramCstNode;J(e,q(i?M(i):t.range,`'${n}' is a ${r.modifier??`non-mutable`} variable. @utils.setVariables can only assign to mutable variables.`,N.Error,`set-variables-immutable-target`))}}}})}var H_=$(`instruction-template-syntax`),U_=/(^|[^A-Za-z0-9_@.])(@?(variables|actions)\.([A-Za-z_][A-Za-z0-9_]*))(?![A-Za-z0-9_])/g,W_=new Map([[`@outputs`,{code:`instruction-output-reference`,message:`@outputs cannot be referenced in instructions or prompts. Assign the action result to @variables in the set clause immediately following the action's run statement, then reference that variable instead.`,pattern:/(?<![A-Za-z0-9_@-])@outputs(?![A-Za-z0-9_-])/g}],[`@inputs`,{code:`instruction-input-reference`,message:`@inputs can only be referenced in connection instructions. For other Agent Script instructions or prompts, declare the value under variables and reference it with @variables.<name> instead. In Prompt Builder, use $Input merge-field syntax.`,pattern:/(?<![A-Za-z0-9_@-])@inputs(?![A-Za-z0-9_-])/g,allowedInConnectionInstructions:!0}]]),G_=class{id=H_;description=`Validates template syntax patterns in instruction fields`;requires=[];run(e,t){this.scanProhibitedPromptReferences(t);let n=new Set,r=t;if(r.variables&&U(r.variables))for(let[e]of r.variables)n.add(e);let i=new Set;this.collectActionNames(t,i,new WeakSet);let a=new WeakSet;this.walkForBlocks(t,a,n,i)}scanProhibitedPromptReferences(e){let t=e.__cst?.node;if(!t)return;let n=[],r=new Set,i=(e,t)=>{let i=t.mappingPath[0]?.startsWith(`connection `)===!0,a;for(let t of W_.values())if(!(i&&t.allowedInConnectionInstructions===!0))for(let i of e.text.matchAll(t.pattern)){let o=this.computeCstRange(e,a??=this.computeLineStarts(e.text),i.index,i[0].length),s=`${t.code}:${o.start.line}:${o.start.character}`;r.has(s)||(r.add(s),n.push({code:t.code,message:t.message,range:o}))}},a=(e,t)=>{if(t.inInstructionProcedure&&e.type===`template`&&i(e,t),e.type===`mapping_element`){let n=e.childForFieldName(`key`),r=e.childForFieldName(`colinear_value`)??e.childForFieldName(`block_value`),o=n?.text.trim(),s=t.mappingPath.at(-1),c=o===`instructions`&&(s===`system`||s===`reasoning`),l=o===`prompt`&&t.mappingPath.includes(`workflows`);for(let n of e.namedChildren)if(n===r&&o){let e=n.type===`procedure`||n.type===`mapping`;(c&&!e||l)&&i(n,t),a(n,{mappingPath:[...t.mappingPath,o],inInstructionProcedure:t.inInstructionProcedure||c&&e})}else a(n,t);return}for(let n of e.namedChildren)a(n,t)};a(t,{mappingPath:[],inInstructionProcedure:!1}),n.sort((e,t)=>e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character||e.code.localeCompare(t.code));for(let t of n)J(e,{...t,severity:N.Warning,source:K})}computeCstRange(e,t,n,r){return{start:this.positionAt(t,n,e.startPosition.row,e.startPosition.column),end:this.positionAt(t,n+r,e.startPosition.row,e.startPosition.column)}}collectActionNames(e,t,n){if(!e||typeof e!=`object`||n.has(e))return;n.add(e);let r=e;if(r.reasoning&&typeof r.reasoning==`object`){let e=r.reasoning;if(e.actions&&U(e.actions))for(let[n]of e.actions)t.add(n)}for(let i in e){if(!Object.hasOwn(e,i)||i.startsWith(`__`))continue;let a=r[i];if(a&&typeof a==`object`)if(Array.isArray(a))for(let e of a)this.collectActionNames(e,t,n);else if(a instanceof Map||U(a))for(let[e,r]of a.entries())this.collectActionNames(r,t,n);else this.collectActionNames(a,t,n)}}walkForBlocks(e,t,n,r){if(!e||typeof e!=`object`||t.has(e))return;t.add(e);let i=e;i.instructions&&typeof i.instructions==`object`&&this.scanInstructionNode(i.instructions,n,r);for(let a in e){if(!Object.hasOwn(e,a)||a.startsWith(`__`)||a===`instructions`)continue;let o=i[a];if(o&&typeof o==`object`)if(Array.isArray(o))for(let e of o)this.walkForBlocks(e,t,n,r);else if(o instanceof Map||U(o))for(let[e,i]of o.entries())this.walkForBlocks(i,t,n,r);else this.walkForBlocks(o,t,n,r)}}scanInstructionNode(e,t,n){switch(e.__kind){case`StringLiteral`:this.scanStringLiteral(e,t,n);break;case`TemplateExpression`:this.scanTemplateExpression(e,t,n);break;case`ProcedureValue`:this.scanProcedureValue(e,t,n);break;default:break}}scanStringLiteral(e,t,n){let r=e.value;typeof r!=`string`||!r||this.scanTextAndAttach(r,e,t,n)}scanTemplateExpression(e,t,n){let r=e;if(typeof r.value==`string`){this.scanTextAndAttach(r.value,e,t,n);return}if(Array.isArray(r.parts)){for(let e of r.parts)if(e.__kind===`TemplateText`){let r=e;typeof r.value==`string`&&this.scanTextAndAttach(r.value,e,t,n)}}}scanProcedureValue(e,t,n){let r=e;if(Array.isArray(r.statements))for(let e of r.statements)e.__kind===`Template`&&this.scanTemplateExpression(e,t,n)}scanTextAndAttach(e,t,n,r){let i=t.__cst?.node.text??e,a=this.detectPatterns(i,n,r);if(a.length===0)return;let o=this.computeLineStarts(i);for(let e of a)J(t,{range:this.computeRange(t,o,e.offset,e.length),message:e.message,severity:N.Information,code:`instruction-template-syntax`,source:K})}computeRange(e,t,n,r){let i=e.__cst;return i?.range?{start:this.positionAt(t,n,i.range.start.line,i.range.start.character),end:this.positionAt(t,n+r,i.range.start.line,i.range.start.character)}:{start:{line:0,character:0},end:{line:0,character:0}}}computeLineStarts(e){let t=[0],n=e.indexOf(`
|
|
356
|
+
`);for(;n!==-1;)t.push(n+1),n=e.indexOf(`
|
|
357
|
+
`,n+1);return t}positionAt(e,t,n,r){let i=0,a=e.length;for(;i+1<a;){let n=Math.floor((i+a)/2);e[n]<=t?i=n:a=n}return{line:n+i,character:i===0?r+t:t-e[i]}}detectPatterns(e,t,n){let r=[];for(let t of[`variables`,`system_variables`,`actions`]){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`\\{\\s*@${n}\\.(\\w+)\\s*\\}`,`g`);for(let n of e.matchAll(i))r.push({pattern:n[0],message:`Reference syntax should be {!@${t}.${n[1]}} (note the exclamation mark). The '!' is required for template interpolation.`,offset:n.index,length:n[0].length})}let i={variables:t,actions:n},a=this.findBalancedBraceSpans(e),o=0;for(let t of e.matchAll(U_)){let e=t[1],n=t[2],s=t[3],c=t[4],l=t.index+e.length;if(!i[s].has(c))continue;for(;o<a.length&&a[o].end<=l;)o+=1;let u=a[o];if(u&&u.start<=l&&l<u.end)continue;let d=s===`variables`?`Variable`:`Action`;r.push({pattern:n,message:`'${n}' should be wrapped in template syntax — did you mean {!@${s}.${c}}? ${d} references require {! ... } for interpolation.`,offset:l,length:n.length})}return r}findBalancedBraceSpans(e){let t=[],n=[];for(let r=0;r<e.length;r+=1)if(e[r]===`{`)n.push(r);else if(e[r]===`}`&&n.length>0){let e=n.pop();for(;t.length>0&&t[t.length-1].start>e;)t.pop();t.push({start:e,end:r+1})}let r=n.find(t=>{let n=t+1;for(;/\s/.test(e[n]??``);)n+=1;return e[n]===`!`||e[n]===`@`});if(r!==void 0){for(;t.length>0&&t[t.length-1].start>=r;)t.pop();t.push({start:r,end:e.length})}return t}};function K_(){return new G_}var q_=new Set([`json`]),J_=$(`connection-formats-index`),Y_=class{id=J_;description=`Indexes each connection’s response_formats sub-map for render-rule ownership checks`;finalize(e,t){let n=e.get(Bm);if(!n)return;let r=new Map,i=t,a=Fp(`connection`,n);for(let e of a){let t=i[e];if(U(t))for(let[e,n]of t){if(!n||typeof n!=`object`)continue;let t=n.response_formats,i=[];if(U(t)){for(let[e,n]of t)if(i.push(e),q_.has(e)){let t=Q_(n);t&&J(n,q(t,`'${e}' is a reserved built-in response format name and cannot be declared as a user response format`,N.Error,`response-format-reserved-name`))}}r.set(e,i)}}e.set(J_,r)}};function X_(){return new Y_}function Z_(e,t){return typeof e==`object`&&!!e&&e.__kind===t}function Q_(e){return e?.__cst?.range}function $_(e){let t=bd(e);if(!t)return null;let{namespace:n,path:r}=t;return n===`response_formats`&&r.length===1?{connection:void 0,name:r[0]}:n===`connection`&&r.length===3&&r[1]===`response_formats`?{connection:r[0],name:r[2]}:null}function ev(){return Lm({id:`render-rules`,description:`Validates render: and show_and_return: clauses on reasoning actions`,deps:{entry:Fm(v_),connectionFormats:J_},run({entry:e,connectionFormats:t}){let{statements:n}=e;if(!n)return;let r=new Set;for(let e of n){if(Z_(e,`RenderStatement`)){let t=Q_(e);t&&J(e,q(t,`render can only be used within a 'when @connection.<surface>' block`,N.Error,`render-outside-when`));continue}if(Z_(e,`ShowAndReturnStatement`)){let t=Q_(e);t&&J(e,q(t,`'show_and_return:' must appear nested inside a 'render:' clause`,N.Error,`show-and-return-outside-render`));continue}if(!Z_(e,`WhenStatement`))continue;let n=e.subject,i=n?bd(n):null,a=i&&i.namespace===`connection`&&i.path.length===1?i.path[0]:void 0;if(!a){let t=Q_(n)??Q_(e);t&&J(e,q(t,`'when' block reference must be '@connection.<surface>' (e.g. '@connection.messaging')`,N.Error,`when-non-connection-ref`));continue}if(r.has(a)){let t=Q_(n)??Q_(e);t&&J(e,q(t,`Duplicate when context: '${a}'`,N.Error,`render-rule-duplicate-connection`))}r.add(a);let o=e.body??[],s=o.filter(e=>Z_(e,`RenderStatement`)),c=o.filter(e=>Z_(e,`ShowAndReturnStatement`));for(let e of c){let t=Q_(e);t&&J(e,q(t,`'show_and_return:' must appear nested inside a 'render:' clause`,N.Error,`show-and-return-outside-render`))}if(s.length===0){let t=Q_(e);t&&J(e,q(t,`'when @connection.${a}' block requires a 'render:' clause`,N.Error,`render-rule-empty-when`))}else if(s.length>1)for(let e of s.slice(1)){let t=Q_(e);t&&J(e,q(t,`Only one 'render:' clause is allowed per 'when @connection.<surface>' block`,N.Error,`render-rule-multiple-render`))}for(let e of s){let n=e.value,r=n?$_(n):null,i=Q_(n)??Q_(e);if(!r)i&&J(e,q(i,`'render:' value must be '@response_formats.<name>' or '@connection.<surface>.response_formats.<name>'`,N.Error,`render-rule-invalid-format-ref`));else if(r.connection!==void 0&&r.connection!==a)i&&J(e,q(i,`Response format '${r.name}' is not valid for connection '${a}'`,N.Error,`render-rule-format-connection-mismatch`));else if(!q_.has(r.name)){let n=t.get(a);n&&!n.includes(r.name)&&i&&J(e,q(i,`Response format '${r.name}' is not valid for connection '${a}'`,N.Error,`render-rule-format-not-in-connection`))}let o=(e.body??[]).filter(e=>Z_(e,`ShowAndReturnStatement`));if(o.length>1)for(let e of o.slice(1)){let t=Q_(e);t&&J(e,q(t,`Only one 'show_and_return:' clause is allowed per 'render:' body`,N.Error,`render-rule-multiple-show-and-return`))}for(let e of o){let t=e.value;if(!(typeof t==`object`&&t&&t.__kind===`BooleanLiteral`)){let n=Q_(t)??Q_(e);n&&J(e,q(n,`'show_and_return:' value must be a boolean literal ('True' or 'False')`,N.Error,`render-rule-show-and-return-not-bool`))}}}}}})}var tv=class{id=$(`render-rule-scope`);description=`Detects render/show_and_return/when-connection statements outside a reasoning action body`;stack=[];init(){this.stack=[]}enterNode(e,t,n){if(!H(t))return;let r=t.__kind;if((r===`RenderStatement`||r===`ShowAndReturnStatement`||r===`WhenStatement`)&&!this.isInsideReasoningAction()){let e=t.__cst?.range;if(e){let{message:n,code:i}=nv(r);J(t,q(e,n,N.Error,i))}}this.stack.push(typeof r==`string`?r:``)}exitNode(e,t,n){H(t)&&this.stack.pop()}run(e,t){}isInsideReasoningAction(){for(let e=this.stack.length-1;e>=0;e--){let t=this.stack[e];if(t===`ReasoningActionBlock`)return!0;if(t===`IfStatement`||t===`RunStatement`||t===`CollectClause`)return!1}return!1}};function nv(e){return e===`RenderStatement`?{message:`'render:' must appear inside a 'when @connection.<surface>' block within a reasoning action body`,code:`render-outside-when`}:e===`ShowAndReturnStatement`?{message:`'show_and_return:' must appear nested inside a 'render:' clause within a reasoning action body`,code:`show-and-return-outside-render`}:{message:`'when @connection.<surface>' must appear inside a reasoning action body`,code:`when-connection-outside-action`}}function rv(){return new tv}var iv=class{id=$(`render-target-exemption`);description=`Marks render: value expressions as pre-validated to avoid duplicate undefined-reference diagnostics`;requires=[_h];run(e,t){let n=e.get(_h);n&&av(t,n)}};function av(e,t,n=new Set){if(!(!e||typeof e!=`object`)&&!n.has(e)){if(n.add(e),H(e)&&e.__kind===`RenderStatement`){let n=e.value;H(n)&&ov(n,t);return}Om(e,(e,r)=>av(r,t,n))}}function ov(e,t){let n=e;for(;H(n)&&(t.add(n),n.__kind===`MemberExpression`);)n=n.object}function sv(){return new iv}var cv=new Set([`subagent`,`connected_subagent`]);function lv(e){return e.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}}}function uv(e,t,n){J(e,q(lv(e),t,N.Error,n))}var dv=new Set([`@yearly`,`@annually`,`@monthly`,`@weekly`,`@daily`,`@midnight`,`@hourly`]),fv={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},pv={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function mv(e,t,n,r){let i=e=>{let t=e.toLowerCase();return r&&t in r?r[t]:/^\d+$/.test(e)?Number(e):null},a=e=>{let r=i(e);return r!==null&&r>=t&&r<=n};for(let r of e.split(`,`)){let e=r.split(`/`);if(e.length>2)return`invalid step syntax in "${r}"`;let[o,s]=e;if(s!==void 0&&(!/^\d+$/.test(s)||Number(s)<1))return`step value in "${r}" must be a positive integer`;if(o===`*`)continue;let c=o.split(`-`);if(c.length===1){if(!a(o)){let e=i(o);return e===null?`"${o}" is not a valid value`:`${e} is out of range (${t}–${n})`}}else if(c.length===2){let[e,r]=c,a=i(e),o=i(r);if(a===null)return`"${e}" is not a valid value`;if(o===null)return`"${r}" is not a valid value`;if(a<t||a>n)return`${a} is out of range (${t}–${n})`;if(o<t||o>n)return`${o} is out of range (${t}–${n})`;if(a>o)return`range start ${a} must not exceed end ${o}`}else return`invalid range syntax in "${r}"`}return null}var hv=[`minute (0–59)`,`hour (0–23)`,`day-of-month (1–31)`,`month (1–12 or JAN–DEC)`,`day-of-week (0–7 or SUN–SAT)`],gv=[[0,59,void 0],[0,23,void 0],[1,31,void 0],[1,12,fv],[0,7,pv]];function _v(e){let t=e.trim();if(dv.has(t.toLowerCase()))return null;if(/^@\w+$/.test(t))return`"${t}" is not a recognised shorthand. Valid shorthands: ${[...dv].join(`, `)}`;let n=t.split(/\s+/);if(n.length!==5)return`expected 5 fields (minute hour day-of-month month day-of-week) or a shorthand (@yearly, @monthly, @weekly, @daily, @hourly), but got ${n.length} field${n.length===1?``:`s`}`;for(let e=0;e<5;e++){let[t,r,i]=gv[e],a=mv(n[e],t,r,i);if(a!==null)return`${hv[e]}: ${a}`}return null}var vv=class{id=$(`agentiq-validation`);description=`Validates AgentIQ workflow, trigger, and orchestrator semantics`;run(e,t){let n=t;this.validateWorkflows(n.workflows),this.validateTriggers(n.trigger),this.validateSubagentBundles(n.subagent),this.validateSubagentBundles(n.start_agent)}validateWorkflows(e){if(U(e))for(let[,t]of e){let e=t,n=e.agent!==void 0,r=e.prompt!==void 0;if(!n&&!r&&uv(e,`Workflow must define 'agent', 'prompt', or both`,`workflow-exactly-one-target`),n){let t=e.agent,n=yd(t);(!n||!cv.has(n.namespace))&&uv(t,`'agent' must reference @subagent or @connected_subagent`,`invalid-workflow-agent`)}}}validateTriggers(e){if(U(e))for(let[,t]of e){let e=t,n=e.schedule;if(n&&typeof n.value==`string`){let e=_v(n.value);e!==null&&uv(n,`Invalid cron schedule — ${e}`,`invalid-cron-schedule`)}if(e.target!==void 0){let t=e.target,n=bd(t),r=n?.namespace===`workflows`&&n.path.length===1,i=n?.namespace===`bundles`&&n.path.length===3&&n.path[1]===`workflows`;!r&&!i&&uv(t,`'target' must reference @workflows.<workflow> or @bundles.<bundle>.workflows.<workflow>`,`invalid-trigger-target`)}}}validateSubagentBundles(e){if(U(e))for(let[t,n]of e){let e=n.bundles;if(!(!e||e.__kind!==`Sequence`)&&Array.isArray(e.items))for(let n of e.items)yd(n)?.namespace!==`bundles`&&uv(n,`Subagent '${t}' bundles must use @bundles.<name> (e.g. @bundles.targeting)`,`invalid-node-bundle-reference`)}}};function yv(){return new vv}function bv(e){return e.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}}}function xv(e){if(!(!H(e)||!e.__kind||![`StringLiteral`,`TemplateExpression`].includes(e.__kind)||typeof e.value!=`string`||e.value.trim().length===0))return e.value}function Sv(e,t){J(e,q(bv(e),`'${t}' is only allowed for GoalBasedAgent. Set 'agent_type: "GoalBasedAgent"' in the config block.`,N.Error,`gba-only-${t}`))}var Cv=`GoalBasedAgent`,wv=[`subagent`,`start_agent`],Tv=class{id=$(`gba-only-blocks`);description=`Validates that GBA-exclusive blocks are only used when agent_type is GoalBasedAgent`;requires=[Bm];run(e,t){if(!e.get(Bm)?.schemaNamespaces.has(`config`))return;let n=t;if(xv((H(n.config)?n.config:void 0)?.agent_type)?.trim().toLowerCase()===Cv.toLowerCase()){for(let e of[`subagent`,`start_agent`]){let t=n[e];U(t)&&J(t,q(bv(t),`'${e}' is not allowed in a GoalBasedAgent script. Use 'orchestrator' as the entry point.`,N.Error,`gba-forbidden-${e}`))}return}for(let e of[`bundles`,`workflows`,`trigger`,`actions`,`orchestrator`]){let t=n[e];U(t)&&Sv(t,e)}for(let e of wv){let t=n[e];if(U(t))for(let[,e]of t){let t=e.bundles;H(t)&&t.__kind===`Sequence`&&Array.isArray(t.items)&&t.items.length>0&&Sv(t,`bundles`)}}let r=H(n.context)?n.context:void 0;if(r)for(let e of[`salesforce`,`data_cloud`]){let t=r[e];H(t)&&Sv(t,`context-${e}`)}}};function Ev(){return new Tv}function Dv(){return[$m(),Ih(),Bh(),Wh(),yh(),nh(),Zh(),ag(),lg(),fg(),yg({collectExternallyUsedVariables:e=>B_(e)}),Og(),mg(),_g(),yv(),Ev(),__(),x_(),X_(),sv(),Mh(),C_(),z_(),T_(),E_(),P_(),V_(),ev(),rv(),K_()]}var Ov=`node://commerce/shopper_agent/v1`,kv={parameters:Q(`ParametersBlock`,{template:Sp.describe(`Variable bindings: each key maps to a @variables.X expression, e.g., authToken: @variables.authToken.`)}).describe(`Variable binding configuration. Use parameters.template to pre-populate node inputs from agent-level variables.`)},Av=`node://tableau/analyze_data/v1`,jv={parameters:Q(`ParametersBlock`,{context:Sp.describe(`Variable bindings: each key maps to a @variables.X expression, e.g., authToken: @variables.authToken.`)}).describe(`Variable binding configuration. Use parameters.context to pre-populate node inputs from agent-level variables.`)},Mv=`node://byon/`,Nv={parameters:Q(`ParametersBlock`,{},{wildcardPrefixes:[{prefix:``,fieldType:Sp}]}).describe(`Parameter groups. Each key is a named group containing variable bindings (key: @variables.X).`)},Pv=Qf(Gf(`SkillBlock`,{instructions:X.describe(`When present, it implies that this skill is an inline skill. Required if 'target' is NOT present.
|
|
358
|
+
SKILL.md body. YAML frontmatter optional but recommended.`),target:X.describe(`When present, it implies that this skill is an external / AgentForce SkillStore skill that follows a URI pattern URI (e.g., 'skill://Developer_Name_v2').
|
|
359
|
+
Conditionally required if 'instructions' is NOT present`),description:X.describe(`Description. Conditionally required for inline skills (when 'target' is NOT present).`),label:X.describe(`Display label.`)},{symbol:{kind:V.Method},scopeAlias:`skill_definitions`,capabilities:[`invocationTarget`]}).describe(`A top-level skill definition — an external or inline capability a subagent can reference by name.`)).describe(`Top-level collection of skill definitions, referenced from a subagent via @skill_definitions.<name>.`),Fv=Q(`PronunciationDictEntryBlock`,{grapheme:X.required(),phoneme:X.required(),type:X.enum([`IPA`,`CMU`])}),Iv=Q(`InboundKeywordsBlock`,{keywords:Nf().describe(`List of keywords for inbound speech detection.`)}).describe(`Keyword detection configuration for inbound speech.`),Lv=Q(`SpeakUpConfigBlock`,{speak_up_first_wait_time_ms:Cf.describe(`Time in milliseconds before first speak-up prompt.`).min(1e4).max(3e5),speak_up_follow_up_wait_time_ms:Cf.describe(`Time in milliseconds before follow-up speak-up prompts.`).min(1e4).max(3e5),speak_up_message:X.describe(`Message to speak when prompting the user to speak up.`)}).describe(`Configuration for speak-up behavior.`),Rv=Q(`EndpointingConfigBlock`,{max_wait_time_ms:Cf.describe(`Maximum wait time in milliseconds for endpointing detection.`).min(500).max(6e4)}).describe(`Configuration for endpointing detection.`),zv=Q(`BeepBoopConfigBlock`,{max_wait_time_ms:Cf.describe(`Maximum wait time in milliseconds for beep-boop detection.`).min(500).max(6e4)}).describe(`Configuration for beep-boop detection.`),Bv=Q(`AdditionalConfigsBlock`,{speak_up_config:Lv.describe(`Configuration for speak-up prompts.`),endpointing_config:Rv.describe(`Configuration for endpointing detection.`),beepboop_config:zv.describe(`Configuration for beep-boop detection.`)}).describe(`Additional voice-related configurations.`),Vv=Q(`FillerSentenceBlock`,{waiting:Nf().describe(`List of waiting messages for this filler sentence entry.`)}).describe(`A filler sentence configuration entry.`),Hv={model:Q(`VoiceModelBlock`,{id:X.describe(`Use a specific model, e.g. if version X and X+1 are simultaneously supported (GA, Beta).`),parameters:Q(`VoiceModelParametersBlock`,{},{wildcardPrefixes:[{prefix:``,fieldType:Tf}]}).describe(`Model-specific parameters. Any name-value pairs; values must be strings, booleans, or numbers. Passed through to the model at runtime.`)}).describe(`The model settings for this direction`)},Uv=Q(`VoiceInboundDirectionBlock`,{...Hv,filler_words_detection:Z.describe(`Whether to enable detection of filler words in inbound speech.`),keywords:Nf().describe(`Keyword detection configuration for inbound speech with boost values.`)}),Wv=Q(`VoiceOutboundDirectionBlock`,{...Hv,persona_id:X.describe(`Unique identifier for the voice persona (e.g., "EQx6HGDYjkDpcli6vorJ").`),filler_sentences:Mf(Vv).describe(`List of filler sentence entries to use during outbound speech pauses.`),pronunciations:Mf(Fv).describe(`List of pronunciation dictionary entries for custom word pronunciations.`)}),Gv={inbound:Uv,outbound:Wv},Kv={inbound:Uv,outbound:Wv,session_language_switching:X.enum([`Monolingual`,`Multilingual`]).describe(`When multilingual, any language can be used on any turn. Defaults to monolingual (one language per session).`),language:Ug.describe(`The languages available for Voice. Voice languages can be the same or a subset of the text languages.`),language_settings:tp(`VoiceLanguageMap`,Q(`VoiceLanguageBlock`,Gv),{allowTypelessEntries:!0}).describe(`A list of language tags with all voice settings for each language. By default, every language will use the agent-level setting. Use this for a language-specific override.`),inbound_keywords:Iv.describe(`Keyword detection configuration for inbound speech with boost values.`),inbound_filler_words_detection:Z.describe(`Whether to enable detection of filler words in inbound speech.`),voice_id:X.describe(`Unique identifier for the voice (e.g., "EQx6HGDYjkDpcli6vorJ").`),outbound_speed:Cf.describe(`Speech speed for outbound voice (e.g., 1.0 for normal speed).`).min(.5).max(2),outbound_style_exaggeration:Cf.describe(`Style exaggeration level for outbound voice (0.0 to 1.0).`).min(0).max(1),outbound_stability:Cf.describe(`Deprecated. Voice stability for outbound speech.`),outbound_similarity:Cf.describe(`Deprecated. Voice similarity level for outbound speech.`),outbound_filler_sentences:Mf(Vv).describe(`List of filler sentence entries to use during outbound speech pauses.`),pronunciation_dict:Mf(Fv).describe(`List of pronunciation dictionary entries for custom word pronunciations.`),additional_configs:Bv.describe(`Additional voice-related configurations.`)},qv=[`AgentforceServiceAgent`,`EinsteinSDR`,`SalesEinsteinCoach`,`BankingServiceAgent`,`ServicePlanner`,`AppDevAgent`,`AgentforceEmployeeAgent`,`CustomAgent`,`LightningAppBuilder`,`SalesCanvasAgent`,`ScaleAgent`,`ThirdPartyA2AAgent`,`GoalBasedAgent`],Jv=new Set(qv.map(e=>e.toLowerCase()));function Yv(e){return Jv.has(e.trim().toLowerCase())}var Xv=xp.extendProperties({source:Ef.describe(`Where the variable gets its value. Required for linked variables, not allowed for mutable variables (e.g., @MessagingSession.Id).`).allowedNamespaces([`MessagingSession`,`MessagingEndUser`,`VoiceCall`]),visibility:X.describe(`Visibility level for the variable.`).enum([`Internal`,`External`,`internal`,`external`]),is_displayable:Z.describe(`Whether this variable is visible in the UI.`),is_used_by_planner:Z.describe(`Whether the planner can read this variable.`)}).withKeyPattern(`^(?!.*__)[a-zA-Z][a-zA-Z0-9_]*$`),Zv=Sp.extendProperties({complex_data_type_name:X.describe(`Complex data type name (e.g., "@apexClassType/c__RequestMetadata"). For object type, defaults to "lightning__objectType".`),schema:X.describe(`Schema URI for input validation (e.g., "schema://city_schema").`),is_user_input:Z.describe(`Whether this input comes from the user.`),filter_from_agent:Z.describe(`Whether to filter this input from the agent context.`),is_displayable:Z.describe(`Whether this input can be shown to users.`),is_used_by_planner:Z.describe(`Whether the planner can use this input.`)}),Qv=Sp.crossBlockReferenceable(),$v=Cp.extendProperties({developer_name:X.describe(`Developer name identifier for the output field.`),is_displayable:Z.describe(`Whether this output can be shown to users.`),is_used_by_planner:Z.describe(`Whether the planner can read this output.`),complex_data_type_name:X.describe(`Complex data type name. For object type, defaults to "lightning__objectType".`),filter_from_agent:Z.describe(`Whether to filter this output from the agent context.`)}),ey=Q(`ModelConfigParamsBlock`,{}).describe(`Model parameters as key-value pairs. Accepts arbitrary parameters that vary by model (e.g., temperature, max_tokens, top_p). Values can be strings, numbers, booleans, or arrays. Parameters are dynamically extracted at compile time.`),ty=Q(`ModelConfigBlock`,{model:X.describe(`Model identifier URI (e.g., "model://...")`),params:ey.describe(`Additional model parameters (e.g., temperature: 0.7, max_tokens: 2000)`)}).describe(`Model selection and parameter configuration.`),ny=Q(`ContextMemoryBlock`,{enabled:Z.describe(`Whether memory is enabled for the agent.`)}).describe(`Memory configuration for the agent.`),ry=Q(`ContextUserProfileBlock`,{enabled:Z.describe(`Specifies whether user profile is enabled for the agent. When user profile is enabled, the agent can use the end user's profile attributes as context.`)}).describe(`The configuration for user profile capabilities that allow the agent to use the end user's profile attributes as context.`),iy=Q(`ContextPastConversationsBlock`,{enabled:Z.describe(`Specifies whether conversation history is enabled for the agent. When conversation history is enabled, the agent can use past conversations with the end user as context.`)}).describe(`The configuration for conversation history capabilities that allow the agent to use past conversations with the end user as context.`),ay=Q(`ContextProviderBlock`,{auto_enabled:Z.describe(`When True, this context source is gathered automatically during execution.`),enabled:Z.describe(`When True, this context source is available to the agent.`)}).describe(`Configuration for a single external context provider.`),oy=Q(`ContextBlock`,{memory:ny.describe(`Memory configuration.`),user_profile:ry.describe(`The configuration for user profile capabilities that allow the agent to use the end user's profile attributes as context.`),past_conversations:iy.describe(`The configuration for conversation history capabilities that allow the agent to use past conversations with the end user as context.`),salesforce:ay.describe(`Salesforce org context (records, metadata) available to the agent.`),data_cloud:ay.describe(`Data Cloud context available to the agent.`)}).describe(`Context configuration for the agent.`),sy=Q(`RuntimeConfigBlock`,{streaming:Z.describe(`When True, stream incremental SSE chunks over /messages/stream; when False, collapse into a single terminal SSE chunk. Omit to defer to the caller's runtime policy.`),thought_chunks:Z.describe(`When True, the agent runtime buffers planner prose into ThoughtTextChunks (reasoning trace events) alongside response chunks when the client supports it. Omit to defer to the caller's runtime policy.`),citation:Z.describe(`When True, run the citation enrichment post-orchestration step; when False, skip it. Omit to defer to the caller's runtime policy.`),groundedness:Z.describe(`When True, run the groundedness post-orchestration step; when False, force it off (overrides the agent-type default). Omit to use the agent-type default (enabled for the Agentforce Service Agent, disabled otherwise).`),reset_to_initial_node:Z.describe(`When True, rewind current_node to the initial node after each terminal node is reached. Omit to defer to the caller's runtime policy.`),user_skills:Z.describe(`When True, the agent runtime adds skill CRUD tools and retrieves user skill frontmatter into all subagent nodes' system prompts; when False, they are disabled. Omit to defer to the caller's runtime policy.`)}).describe(`Runtime behavior settings for the agent.`),cy=Q(`RecommendedPromptsBlock`,{in_conversation:Z.describe(`Whether in-conversation recommendations are enabled for the agent.`),welcome_screen:Z.describe(`Whether welcome screen recommendations are enabled for the agent.`),starter_prompts:Nf().describe(`Up to 20 starter prompt strings, each between 1 and 50 characters. Only allowed when welcome_screen is True. Min 3 entries.`)}).describe(`Recommended prompts configuration. Only supported for AgentforceEmployeeAgent.`),ly=zg.extend({recommended_prompts:cy.describe(`Recommended prompts configuration for welcome and in-conversation suggestions.`)}),uy=Bg.extend({developer_name:X.describe(`Agent identifier. Must follow standard name field requirements. Set this or agent_name (not both).`),agent_label:X.describe(`Display label for the agent. Defaults to normalized developer_name.`).accepts([`StringLiteral`]),agent_description:X.describe(`Agent description used in prompts and routing. Distinct from description (internal documentation).`),agent_type:X.describe(`Agent type (e.g., "AgentforceServiceAgent", "AgentforceEmployeeAgent", "SalesEinsteinCoach"). Any valid backend agent type is accepted.`).suggest(qv),agent_id:X.describe(`Unique identifier for the agent.`),agent_name:X.describe(`Internal name for the agent.`),default_agent_user:Sf.describe("Default user identity. Required for AgentforceServiceAgent type. May be `None` only for AgentforceEmployeeAgent. Deprecated — move to the top-level `access` block.").deprecated(`Property default_agent_user has moved from config to access. Move field to access block.`,{replacement:`access.default_agent_user`}),agent_version:X.describe(`Version identifier for the agent (e.g., "v1").`),enable_enhanced_event_logs:Z.describe(`Whether to record enhanced event logs for debugging and analytics.`),company:X.describe(`Company information. Can be embedded in subagent prompts for context.`),role:X.describe(`Job description or role for the agent.`),planner_type:X.describe(`Planner type (e.g., "AiCopilot__ReAct", "Atlas__ConcurrentMultiAgentOrchestration").`),additional_parameter__reset_to_initial_node:Z.describe(`Whether to reset to the initial node between turns.`).hidden(),additional_parameter__DISABLE_GROUNDEDNESS:Z.describe(`Whether to disable groundedness checking.`).hidden(),debug:Z.describe(`Whether to enable debug mode.`),max_tokens:Cf.describe(`Maximum number of tokens for responses.`),temperature:Cf.describe(`Sampling temperature for model responses.`),agent_template:X.describe(`Template name identifier for the agent.`),outbound_flow:X.describe(`API name of the default outbound flow for escalation routing.`),user_locale:X.describe(`User locale override (e.g., "en_US").`).deprecated(`Use the language block instead.`),runtime:sy.describe(`Runtime behavior settings for the agent.`),file_upload:Q(`FileUploadConfig`,{mode:X.describe(`How the agent handles user-uploaded files. "auto" (default) surfaces every file to every subagent; "managed" surfaces a file only when an author references it (e.g. @system_variables.uploaded_files[0]); "disabled" drops uploads silently; "error" rejects uploads with an error message.`).enum([`auto`,`managed`,`disabled`,`error`]),message:Sf.describe(`Custom message to display when mode is "error" or "disabled". If not provided, a default message will be used.`)}).describe(`Configuration for how the agent handles user-uploaded files.`)},{wildcardPrefixes:[{prefix:`additional_parameter__`,fieldType:Tf}]}).example(`config:
|
|
360
|
+
developer_name: "customer_support_agent"
|
|
361
|
+
agent_label: "Customer Support Agent"
|
|
362
|
+
description: "Assists customers with orders, returns, and account management"
|
|
363
|
+
default_agent_user: "support@example.com"
|
|
364
|
+
agent_type: "AgentforceServiceAgent"
|
|
365
|
+
enable_enhanced_event_logs: True
|
|
366
|
+
file_upload:
|
|
367
|
+
mode: "auto"
|
|
368
|
+
additional_parameter__reset_to_initial_node: True`),dy=Zf(wp.extend({source:X.describe(`Source URI for the action (e.g., "custom://weather_api").`),require_user_confirmation:Z.describe(`Whether to require user confirmation before executing.`),include_in_progress_indicator:Z.describe(`Whether to show a progress indicator during execution.`),progress_indicator_message:X.describe(`Message shown during execution. Only used if include_in_progress_indicator is True.`),inputs:Zv,outputs:$v}).example(` actions:
|
|
369
|
+
Lookup_Order:
|
|
370
|
+
description: "Retrieve order details by order number"
|
|
371
|
+
label: "Lookup Order"
|
|
372
|
+
require_user_confirmation: False
|
|
373
|
+
include_in_progress_indicator: True
|
|
374
|
+
progress_indicator_message: "Looking up your order..."
|
|
375
|
+
inputs:
|
|
376
|
+
order_number: string
|
|
377
|
+
description: "The order number to look up"
|
|
378
|
+
is_required: True
|
|
379
|
+
is_user_input: True
|
|
380
|
+
email: string
|
|
381
|
+
description: "Customer email for verification"
|
|
382
|
+
is_required: False
|
|
383
|
+
is_user_input: False
|
|
384
|
+
outputs:
|
|
385
|
+
status: string
|
|
386
|
+
description: "Order status"
|
|
387
|
+
is_displayable: True
|
|
388
|
+
order_id: string
|
|
389
|
+
description: "Internal order record ID"
|
|
390
|
+
is_displayable: False
|
|
391
|
+
filter_from_agent: True
|
|
392
|
+
items: list[object]
|
|
393
|
+
description: "Items in the order"
|
|
394
|
+
is_displayable: True
|
|
395
|
+
target: "flow://Lookup_Order_By_Number"
|
|
396
|
+
|
|
397
|
+
# Target URI formats:
|
|
398
|
+
# flow://Flow_API_Name — Salesforce Flow
|
|
399
|
+
# apex://Apex_Class_Name — Apex invocable action
|
|
400
|
+
# externalService://endpoint_name — External service
|
|
401
|
+
# standardInvocableAction://Action_Name — Standard Salesforce invocable action`)),fy=Q(`AccessBlock`,{default_agent_user:Sf.describe("Default user identity. Required for AgentforceServiceAgent type. May be `None` only for AgentforceEmployeeAgent."),sharing_policy:Q(`SharingPolicyBlock`,{use_default_sharing_entities:Z.describe(`Sharing policy for the agent.`),custom_sharing_entities:Nf().describe(`Custom sharing entities for the agent.`)}).describe(`Sharing policy for the agent.`),verified_customer_record_access:Q(`VerifiedCustomerRecordAccessBlock`,{use_default_objects:Z.describe(`Whether to use the default set of objects for record access filtering.`),additional_objects:Nf().describe(`Additional objects for record access filtering.`)}).describe(`Verified customer record access configuration.`)}).describe(`Agent access configuration (user identity, sharing, record access).`),py=Zf(Gf(`ReasoningSkillBlock`,{},{colinear:Tf.resolvedType(`invocationTarget`),symbol:{kind:V.Method},scopeAlias:`skills`}).describe(`A node-level skill reference bound to a local handle.`).example(`skills:
|
|
402
|
+
my_stored_skill: @skill_definitions.myStoredSkill
|
|
403
|
+
my_inline_skill: @skill_definitions.myInlineSkill`)).describe(`Node-level skill references, keyed by a local handle: my_skill: @skill_definitions.myStoredSkill. Each value must reference a skill declared in the top-level skill_definitions block. The handle is presented to the reasoner/LLM (compiles to the wire name); the referenced definition name compiles to target.`),my=Gg.extend({skills:py}).describe(`Reasoning block containing instructions, actions, and skill references for the agent reasoning loop.`),hy={...qg,model_config:ty.describe(`Model configuration for this block.`)},gy={allowAnonymous:!0,capabilities:[`invocationTarget`,`transitionTarget`]},_y=Gf(`TopicBlock`,{...hy,actions:dy},{scopeAlias:`topic`,...gy}).describe(`A topic defining agent logic with actions and reasoning.`).discriminant(`schema`),vy={...Jg,actions:dy,model_config:ty.describe(`Model configuration for this block.`)},yy={...vy,...kv,reasoning:Gg.omit(`instructions`).describe("Reasoning block containing actions available to the agent. Note: `instructions` is not supported on the commerce shopper variant.")},by={...vy,...jv,reasoning:Gg.omit(`instructions`).describe("Reasoning block containing actions available to the agent. Note: `instructions` is not supported on the Tableau Analyze Data variant.")},xy={...vy,...Nv},Sy=Gf(`SubagentBlock`,{...hy,actions:dy,reasoning:my},{scopeAlias:`subagent`,...gy}).describe(`A subagent defining agent logic with actions and reasoning.`).discriminant(`schema`).variant(Ov,yy).variant(Av,by).variantMatch(`byon`,e=>e.startsWith(Mv),xy),Cy=Zg.extend({actions:dy,reasoning:my,model_config:ty.describe(`Configuration for the model used by this block.`)},{scopeAlias:`topic`}).discriminant(`schema`).variant(Ov,yy).variant(Av,by).variantMatch(`byon`,e=>e.startsWith(Mv),xy),wy=Q(`KnowledgeBlock`,{citations_url:X.describe(`URL prefix for citation links.`),rag_feature_config_id:X.describe(`RAG feature configuration identifier. Typically a UUID-based identifier.`),citations_enabled:Z.describe(`Whether to include citations in responses.`)}).describe(`Knowledge and citation configuration for RAG-based question answering.`).example(`knowledge:
|
|
404
|
+
citations_url: "https://help.example.com"
|
|
405
|
+
rag_feature_config_id: "my_knowledge_base"
|
|
406
|
+
citations_enabled: True`),Ty={},Ey={description:`Nested parameters of this object input. Each entry is itself an input declaration.`},Dy=new Proxy({},{get(e,t,n){let r=Ty.block;if(!r)throw Error(`ResponseFormatInputsBlock accessed before initialization`);return t===`__metadata`?Ey:Reflect.get(r,t,n)},has(e,t){if(t===`__metadata`)return!0;let n=Ty.block;return n?Reflect.has(n,t):!1}}),Oy={},ky=rp({primitiveTypes:mf,typeParameterSchemas:{list:{value:new Proxy({},{get(e,t,n){let r=Oy.field;if(!r)throw Error(`ResponseFormatTypeDescriptor accessed before initialization`);return Reflect.get(r,t,n)},has(e,t){let n=Oy.field;return n?Reflect.has(n,t):!1}}),min_items:Cf.describe(`Minimum number of array items.`),max_items:Cf.describe(`Maximum number of array items.`)},object:{description:X.describe(`Description of this object type.`),fields:Dy},string:{enum:Nf().describe(`Allowed values.`),min_length:Cf.describe(`Minimum string length.`),max_length:Cf.describe(`Maximum string length.`)},number:{enum:Nf().describe(`Allowed values.`),minimum:Cf.describe(`Minimum numeric value.`),maximum:Cf.describe(`Maximum numeric value.`)},integer:{enum:Nf().describe(`Allowed values.`),minimum:Cf.describe(`Minimum numeric value.`),maximum:Cf.describe(`Maximum numeric value.`)},boolean:{},date:{},datetime:{},id:{}}}).describe(`Type specification for this input. Use for complex types (list, object with fields).`);Oy.field=ky;var Ay=tp(`ResponseFormatInputsBlock`,yp.extend({schema:X.describe(`Schema URI for input validation (e.g., "messaging_components://FormName").`),type:ky},{symbol:{kind:V.Object,noRecurse:!0}}).describe(`Properties for a response format input field.`),{primitiveTypes:mf,allowTypelessEntries:!0}).describe(`Structured input schema for response format definitions.`);Ty.block=Ay;var jy=Zf(Gf(`ResponseFormatBlock`,{label:X.describe(`Human-readable label for the format. Not provided to the LLM.`),description:X.describe(`Tells the LLM when to pick this format over others. Write it as selection guidance: e.g., "Use this when presenting 2–6 choices for the user to pick from."`).required(),source:X.describe(`Source identifier for an existing format (e.g., "SurfaceAction__MessagingChoices").`),target:X.describe(`Target URI for custom format (e.g., "apex://SomeApex").`),inputs:Ay.clone().describe(`Structured input schema for this response format.`)},{symbol:{kind:V.Method},scopeAlias:`response_formats`,capabilities:[`invocationTarget`]}).describe(`Response format definition with schema and target.`).example(` response_formats:
|
|
407
|
+
# Custom format with structured input schema
|
|
408
|
+
custom_choices:
|
|
409
|
+
description: "A response action containing UI components. Use this to prompt the
|
|
410
|
+
user to select one of many simple available choices with images."
|
|
411
|
+
target: "apex://ChoicesHandler"
|
|
412
|
+
inputs:
|
|
413
|
+
message: string
|
|
414
|
+
description: "The message text"
|
|
415
|
+
is_required: True
|
|
416
|
+
choices: list[string]
|
|
417
|
+
is_required: True
|
|
418
|
+
title: string
|
|
419
|
+
description: "Heading for the options"
|
|
420
|
+
is_required: True`)).describe(`Collection of response format definitions.`),My=Zf(Gf(`AvailableFormatBlock`,{},{colinear:Tf.resolvedType(`invocationTarget`),symbol:{kind:V.Method},scopeAlias:`response_actions`}).describe(`Response format made available to the LLM for selection.`).example(`response_actions:
|
|
421
|
+
messaging_rich_link: @response_formats.messaging_rich_link
|
|
422
|
+
messaging_choices: @response_formats.messaging_choices`)).describe(`Formats available to the LLM for non-deterministic selection.`),Ny=Q(`ConnectionReasoningBlock`,{instructions:X.describe(`Connection-level instructions for the agent. Supports {!<expression>} template interpolation.`),response_actions:My.describe(`Response format tools available to the LLM for non-deterministic selection during reasoning.`)},{symbol:{kind:V.Namespace}}).describe(`Reasoning configuration for the connection.`),Py=Gf(`ConnectionBlock`,{label:X.describe(`Display label for the connection.`).accepts([`StringLiteral`]),description:X.describe(`Description of the connection purpose.`),source:X.describe(`Source identifier for the connection.`),inputs:Qv.describe(`Parameters defined by connection owners.`),additional_system_instructions:X.describe(`Additional system instructions that append to global system instructions. Supports {!<expression>} template interpolation.`),reasoning:Ny.describe(`Reasoning configuration with instructions and available formats.`),response_formats:jy.describe(`Response format definitions for this connection.`),adaptive_response_allowed:Z.describe(`Whether adaptive responses are allowed for this connection.`),escalation_message:X.describe(`Message sent when escalating to a human agent. Supports {!<expression>} template interpolation.`),outbound_route_type:X.describe(`Type of outbound route (e.g., "OmniChannelFlow").`),outbound_route_name:X.describe(`Name of outbound route (e.g., "flow://Route_to_Agent").`)},{symbol:{kind:V.Interface},scopeAlias:`connection`}).describe(`External connection configuration.`).example(`connection service_email:
|
|
423
|
+
label: "Email Connection"
|
|
424
|
+
description: "Connection for email channels"
|
|
425
|
+
|
|
426
|
+
outbound_route_type: "OmniChannelFlow"
|
|
427
|
+
outbound_route_name: "flow://Route"
|
|
428
|
+
|
|
429
|
+
inputs:
|
|
430
|
+
legal_disclosure: string = "this is a disclosure"
|
|
431
|
+
description: "Legal disclosure message"
|
|
432
|
+
|
|
433
|
+
additional_system_instructions: |
|
|
434
|
+
Use recipient name if provided
|
|
435
|
+
|
|
436
|
+
reasoning:
|
|
437
|
+
instructions: |
|
|
438
|
+
Always append {!@inputs.legal_disclosure}
|
|
439
|
+
Use {!@response_actions.choices} for multiple choice responses
|
|
440
|
+
|
|
441
|
+
response_actions:
|
|
442
|
+
choices: @response_formats.email_choices
|
|
443
|
+
rich_link: @response_formats.email_rich_link
|
|
444
|
+
|
|
445
|
+
response_formats:
|
|
446
|
+
email_choices:
|
|
447
|
+
description: "Multiple choice format"
|
|
448
|
+
source: "response_format://SurfaceAction__EmailTextChoices"
|
|
449
|
+
|
|
450
|
+
email_rich_link:
|
|
451
|
+
source: "response_format://SurfaceAction__EmailTextRichLink"`),Fy=Qf(Py),Iy=Qf(Gf(`ModalityBlock`).variant(`voice`,Kv)),Ly={...r_,system:ly,config:uy,variables:Xv,model_config:ty.describe(`Default model configuration for the agent. Can be overridden at topic level.`).example(`model_config:
|
|
452
|
+
model: "model://sfdc_ai__DefaultGPT4"
|
|
453
|
+
params:
|
|
454
|
+
temperature: 0.7
|
|
455
|
+
max_tokens: 2000`),knowledge:wy,connection:Fy,connected_subagent:Qf(Qg),modality:Iy,access:fy,context:oy,skill_definitions:Pv.example(`skill_definitions:
|
|
456
|
+
myStoredSkill:
|
|
457
|
+
target: "skill://Helper_v1"
|
|
458
|
+
myInlineSkill:
|
|
459
|
+
instructions: "# Helper\\nInline body."
|
|
460
|
+
description: "Helper skill"`),subagent:Qf(Sy.clone().example(`subagent Order_Management:
|
|
461
|
+
description: "Handles order lookups, updates, and summaries"
|
|
462
|
+
|
|
463
|
+
system:
|
|
464
|
+
instructions: "Focus on helping the user with their order. Never expose internal record IDs."
|
|
465
|
+
|
|
466
|
+
before_reasoning:
|
|
467
|
+
if @variables.verified is not True:
|
|
468
|
+
transition to @subagent.Identity
|
|
469
|
+
|
|
470
|
+
actions:
|
|
471
|
+
Lookup_Order:
|
|
472
|
+
description: "Retrieve order details"
|
|
473
|
+
require_user_confirmation: False
|
|
474
|
+
include_in_progress_indicator: True
|
|
475
|
+
progress_indicator_message: "Looking up your order..."
|
|
476
|
+
inputs:
|
|
477
|
+
order_number: string
|
|
478
|
+
description: "The order number to look up"
|
|
479
|
+
is_required: True
|
|
480
|
+
is_user_input: True
|
|
481
|
+
outputs:
|
|
482
|
+
status: string
|
|
483
|
+
description: "Order status"
|
|
484
|
+
is_displayable: True
|
|
485
|
+
order_id: string
|
|
486
|
+
description: "Internal order record ID"
|
|
487
|
+
is_displayable: False
|
|
488
|
+
filter_from_agent: True
|
|
489
|
+
target: "flow://Lookup_Order"
|
|
490
|
+
|
|
491
|
+
reasoning:
|
|
492
|
+
instructions: ->
|
|
493
|
+
| Ask for the Order Number and call {!@actions.lookup_order}.
|
|
494
|
+
Summarize: status, items, delivery info.
|
|
495
|
+
actions:
|
|
496
|
+
lookup_order: @actions.Lookup_Order
|
|
497
|
+
with order_number=...
|
|
498
|
+
set @variables.status = @outputs.status
|
|
499
|
+
set @variables.order_id = @outputs.order_id
|
|
500
|
+
|
|
501
|
+
go_to_return: @utils.transition to @subagent.Return_Management
|
|
502
|
+
description: "If user wants to return items"
|
|
503
|
+
|
|
504
|
+
after_reasoning:
|
|
505
|
+
set @variables.request_count = @variables.request_count + 1`)),start_agent:Qf(Cy.clone().example(`start_agent topic_selector:
|
|
506
|
+
label: "Topic Selector"
|
|
507
|
+
description: "Welcome user and route to the right topic"
|
|
508
|
+
reasoning:
|
|
509
|
+
instructions: ->
|
|
510
|
+
| Welcome the user. Analyze their request and route accordingly:
|
|
511
|
+
{!@actions.go_to_orders}: For order lookups and updates
|
|
512
|
+
{!@actions.go_to_returns}: For return requests
|
|
513
|
+
{!@actions.go_to_escalation}: When user is upset or asks for a person
|
|
514
|
+
actions:
|
|
515
|
+
go_to_orders: @utils.transition to @subagent.Order_Management
|
|
516
|
+
description: "Handle order inquiries"
|
|
517
|
+
available when @variables.verified == True
|
|
518
|
+
go_to_returns: @utils.transition to @subagent.Return_Management
|
|
519
|
+
description: "Handle return requests"
|
|
520
|
+
available when @variables.verified == True
|
|
521
|
+
go_to_escalation: @utils.transition to @subagent.escalation
|
|
522
|
+
description: "Escalate to human agent"`)).singular(),topic:Qf(_y.clone().example(`topic Order_Management:
|
|
523
|
+
description: "Handles order lookups, updates, and summaries"
|
|
524
|
+
|
|
525
|
+
actions:
|
|
526
|
+
Lookup_Order:
|
|
527
|
+
description: "Retrieve order details"
|
|
528
|
+
target: "flow://Lookup_Order"
|
|
529
|
+
|
|
530
|
+
reasoning:
|
|
531
|
+
instructions: ->
|
|
532
|
+
| Help the user with their order.
|
|
533
|
+
actions:
|
|
534
|
+
lookup_order: @actions.Lookup_Order
|
|
535
|
+
with order_number=...`)).deprecated(`Replace topic with subagent.`,{replacement:`subagent`})};pu(Ly);var Ry={schema:Ly,aliases:{...i_},globalScopes:{...a_.globalScopes,MessagingSession:new Set([`MessagingEndUserId`,`Id`,`EndUserLanguage`]),MessagingEndUser:new Set([`ContactId`]),VoiceCall:new Set([`Id`])},extraNamespaceKeys:{topic:[`start_agent`]}},zy=Dp(Ry),By=[`api`,`apex`,`apexRest`,`auraEnabled`,`cdpMlPrediction`,`createCatalogItemRequest`,`decisionTableAction`,`executeIntegrationProcedure`,`expressionSet`,`externalConnector`,`externalService`,`flow`,`generatePromptResponse`,`integrationProcedureAction`,`mcpTool`,`platformMcpTool`,`namedQuery`,`placeholder`,`prompt`,`quickAction`,`retriever`,`runExpressionSet`,`serviceCatalog`,`slack`,`standardInvocableAction`],Vy=new Set(By.map(e=>e.toLowerCase()));function Hy(e){let t=[];for(let[,n]of e.actions)for(let[e,r]of n)r.target&&t.push({actionName:e,sig:r});return t}function Uy(){return Lm({id:`invalid-action-target`,description:`Action target URIs must use a supported scheme (flow://, apex://, externalService://, standardInvocableAction://, prompt://, generatePromptResponse://, etc.).`,deps:{action:Fm(f_,Hy)},run({action:e}){let{actionName:t,sig:n}=e,r=n.target,i;try{i=new URL(r.value)}catch{J(r.node,q(r.keyRange,`Action '${t}' has an invalid target "${r.value}". Expected a URI with a supported scheme: ${By.join(`, `)}.`,N.Error,`invalid-action-target`));return}let a=i.protocol.slice(0,-1).toLowerCase();if(!a){J(r.node,q(r.keyRange,`Action '${t}' has an invalid target "${r.value}". Expected a URI with a supported scheme: ${By.join(`, `)}.`,N.Error,`invalid-action-target`));return}if(!Vy.has(a)){J(r.node,q(r.keyRange,`Action '${t}' uses unsupported target scheme "${a}://". Supported schemes: ${By.join(`, `)}.`,N.Error,`invalid-action-target`));return}a===`placeholder`&&J(r.node,q(r.keyRange,`Action '${t}' uses a placeholder target "${r.value}". Replace this with a real implementation before committing.`,N.Warning,`placeholder-action-target`))}})}var Wy={start:{line:0,character:0},end:{line:0,character:0}};function Gy(e){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return;let t=e;if(typeof t.value==`string`)return t.value}function Ky(e){if(typeof e!=`object`||!e)return[];let t=e.items;return Array.isArray(t)?t.map(e=>{let t=Gy(e);if(t!==void 0)return t;if(typeof e==`object`&&e&&typeof e.name==`string`)return e.name}).filter(e=>e!==void 0):[]}function qy(e){if(e&&typeof e==`object`){let t=e.__cst;if(t?.range)return t.range}return Wy}function Jy(e){if(e&&typeof e==`object`){let t=e.__cst;if(t?.node){let e=t.node;for(;e;){if(e.type===`mapping_element`)return M(e);e=e.parent}}if(t?.range)return t.range}return Wy}var Yy=`skill`,Xy=class{id=$(`invalid-skill-target`);description=`A skill must define exactly one of \`instructions\` (inline) or \`target\` (stored, ${Yy}:// scheme); inline skills require a description.`;run(e,t){let n=t.skill_definitions;if(U(n))for(let[e,t]of n)!t||typeof t!=`object`||Zy(e,t)}};function Zy(e,t){let n=t,r=n.instructions,i=n.target,a=r!=null,o=i!=null;if(!a&&!o){J(t,q(qy(t),`Skill '${e}' must define either 'instructions' (inline skill) or 'target' (stored skill).`,N.Error,`invalid-skill-shape`));return}if(a&&o){J(t,q(qy(i),`Skill '${e}' defines both 'instructions' and 'target'. A skill is either inline ('instructions') or stored ('target'), not both.`,N.Error,`invalid-skill-shape`));return}if(a&&n.description==null&&J(t,q(qy(t),`Inline skill '${e}' must declare a 'description'.`,N.Error,`invalid-skill-shape`)),o){let n=Gy(i);n!=null&&Qy(e,n,i,t)}}function Qy(e,t,n,r){let i;try{i=new URL(t)}catch{J(r,q(qy(n),`Skill '${e}' has an invalid target "${t}". Expected a URI with the ${Yy}:// scheme.`,N.Error,`invalid-skill-target`));return}let a=i.protocol.slice(0,-1).toLowerCase();a!==Yy&&J(r,q(qy(n),`Skill '${e}' uses unsupported target scheme "${a}://". Expected ${Yy}://.`,N.Error,`invalid-skill-target`))}function $y(){return new Xy}var eb=`model://sfdc_ai__DefaultEinsteinHyperClassifier`,tb=$(`hyperclassifier-topics`);function nb(e){let t=e.model_config;if(!t||typeof t!=`object`)return;let n=t.model;return Gy(n)}function rb(e){if(!e)return!1;if(Array.isArray(e))return e.length>0;if(typeof e==`object`&&`statements`in e){let t=e.statements;return Array.isArray(t)&&t.length>0}return!0}var ib=class{id=tb;description=`Identifies hyperclassifier/router topics`;finalize(e,t){let n=e.get(Bm);if(!n)return;let r=[],i=new Set([...Fp(`topic`,n),...Fp(`subagent`,n)]);for(let e of i){let n=t[e];if(U(n))for(let[e,t]of n){if(!H(t))continue;let n=nb(t);n===eb&&r.push({topicName:e,block:t,model:n})}}e.set(tb,r)}};function ab(){return new ib}function ob(){return Lm({id:`hyperclassifier-constraints`,description:`Validates constraints on hyperclassifier/router nodes`,deps:{topic:Fm(tb)},run({topic:e}){let{block:t,model:n}=e,r=t.reasoning;if(r&&typeof r==`object`){let e=r,t=e.tools??e.actions;if(t&&U(t))for(let[,e]of t){if(!e||typeof e!=`object`)continue;let t=e,r=yd(t.value);if(!(r?.namespace===`utils`&&r?.property===`transition`)){let e=t.__cst;e&&J(t,q(e.range,`Only @utils.transition reasoning actions are allowed when using model: ${n}`,N.Error,`hyperclassifier-non-transition`))}}}if(rb(t.before_reasoning)){let e=t.before_reasoning,r=e?.__cst??t.__cst;r&&J(e??t,q(r.range,`before_reasoning is not allowed when using model: ${n}. Use 'reasoning.instructions' to specify inline actions.`,N.Error,`hyperclassifier-before-reasoning`))}if(rb(t.after_reasoning)){let e=t.after_reasoning,r=e?.__cst??t.__cst;r&&J(e??t,q(r.range,`after_reasoning is not allowed when using model: ${n}. Use post-action logic attached to reasoning.actions instead.`,N.Error,`hyperclassifier-after-reasoning`))}}})}var sb=Object.keys(Py.schema).filter(e=>!e.startsWith(`__`)),cb=[`apex`,`flow`,`standardInvocableAction`,`prompt`,`generatePromptResponse`],lb=[`system`],ub=[...cb,...lb],db=[`MessagingRichLink`,`MessagingChoices`,`MessagingChoicesWithImages`,`MessagingTimePicker`,`ESTypeMessage`,`MessagingAudio`,`ClientAction`],fb=new Set([`ESTypeMessage`,`MessagingAudio`]),pb=[`string`,`number`,`boolean`],mb=[`description`];function hb(e,t){return e[t]!=null}function gb(e){return sb.some(t=>hb(e,t))}function _b(e,t,n){let r=e.__cst;r&&J(e,q(r.range,`${t} connections do not support ${n}`,N.Error,`connection-disallowed-field`))}function vb(e,t,n){let r=e[n];if(!H(r))return;let i=r.__cst;i&&J(e,q(i.range,`${t} connections do not use ${n}`,N.Warning,`connection-field-not-used`))}function yb(e,t){let n=e.__cst;n&&J(e,q(n.range,`${t} connections require at least one configuration field (e.g. description).`,N.Error,`connection-missing-required-fields`))}function bb(e){for(let t of sb)t!==`adaptive_response_allowed`&&hb(e,t)&&_b(e,`Slack`,t)}function xb(e){if(!gb(e)){yb(e,`service_email`);return}hb(e,`escalation_message`)&&_b(e,`Service email`,`escalation_message`);let t=hb(e,`outbound_route_name`);if(t!==hb(e,`outbound_route_type`)){let n=t?`outbound_route_type`:`outbound_route_name`,r=e.__cst;r&&J(e,q(r.range,`Service email connections require both outbound_route_name and outbound_route_type, but ${n} is missing`,N.Error,`connection-missing-paired-field`))}}function Sb(e){if(!gb(e)){yb(e,`messaging`);return}let t=hb(e,`outbound_route_name`);if(t!==hb(e,`outbound_route_type`)){let n=t?`outbound_route_type`:`outbound_route_name`,r=e.__cst;r&&J(e,q(r.range,`Messaging connections require both outbound_route_name and outbound_route_type, but ${n} is missing`,N.Error,`connection-missing-paired-field`))}hb(e,`inputs`)&&vb(e,`Messaging`,`inputs`)}function Cb(e){if(!gb(e)){yb(e,`customer_web_client`);return}hb(e,`inputs`)&&vb(e,`Customer Web Client`,`inputs`)}function wb(e,t){gb(e)||yb(e,t)}function Tb(e){let t=e.inputs;if(U(t))for(let[e,n]of t){if(!H(n))continue;let t=n,r=t.type;if(r){let n;if(r.__kind===`Identifier`)n=r.name;else if(r.__kind===`SubscriptExpression`){let e=t.__cst;if(e){let n=pb.join(`, `);J(t,q(e.range,`Connection inputs do not support list types. Supported types: ${n}.`,N.Error,`connection-input-invalid-type`))}continue}if(n&&!pb.includes(n)){let r=t.__cst;if(r){let i=pb.join(`, `);J(t,q(r.range,`Connection input '${e}' has invalid type '${n}'. Supported types: ${i}.`,N.Error,`connection-input-invalid-type`))}}}else{let e=t.__cst;if(e){let n=pb.join(`, `);J(t,q(e.range,`Connection inputs require type definition. Supported types: ${n}.`,N.Error,`connection-input-invalid-type`))}}let i=t.properties;if(i&&typeof i==`object`){for(let n of Object.keys(i))if(!mb.includes(n)){let r=i[n];if(!H(r))continue;let a=r.__cst;if(a){let r=mb.join(`, `);J(t,q(a.range,`Connection input '${e}' has unsupported property '${n}'. Supported properties: ${r}.`,N.Error,`connection-input-invalid-property`))}}}}}function Eb(e){let t=e.reasoning;if(!t)return;let n=t.response_actions;if(U(n))for(let[e,t]of n){if(!H(t))continue;let n=t.value;if(n&&!(n.__kind===`MemberExpression`&&n.object?.name===`response_formats`)){let n=t.__cst;n&&J(t,q(n.range,`Response action '${e}' must reference a response format using '@response_formats.format_name' syntax`,N.Error,`response-action-invalid-reference`))}}}function Db(e){let t=e.target;if(!H(t))return!1;let n=t.value;if(n===void 0)return!1;let r=n.split(`://`);return r[0]===`system`&&r[1]!==void 0&&fb.has(r[1])}function Ob(e,t){let n=e.response_formats;if(U(n))for(let[e,r]of n){if(!H(r))continue;let n=r,i=n.target!=null,a=Db(n);if(n.inputs==null&&!a){let e=n.__cst;e&&J(n,q(e.range,`Missing required field 'inputs'`,N.Error,`missing-required-field`))}else if(n.inputs!=null&&a){let e=n.inputs,t=H(e)?e.__cst:n.__cst,r=(H(n.target)?n.target.value:void 0)??``;t&&J(n,q(t.range,`Target '${r}' does not use input schema.`,N.Warning,`response-format-inputs-ignored-for-target`))}if(i&&H(n.target)){let t=n.target,r=t.value;if(r!==void 0){let i=t.__cst,a=r.split(`://`);a.length!==2||!a[0]||!a[1]?i&&J(n,q(i.range,`Response format '${e}' target must be in the format 'type://Name' (e.g., 'apex://MyApexClass')`,N.Error,`response-format-invalid-target`)):ub.includes(a[0])?a[0]===`system`&&!db.includes(a[1])&&i&&J(n,q(i.range,`Response format '${e}' uses an unrecognized system target '${a[1]}'. Known system targets: ${db.join(`, `)}.`,N.Warning,`response-format-unknown-system-target`)):i&&J(n,q(i.range,`Response format '${e}' target has unsupported invocation type '${a[0]}'. Supported types: ${ub.map(e=>`${e}`).join(`, `)}`,N.Error,`response-format-unsupported-target-scheme`))}}U(n.inputs)&&kb(n.inputs,n,t)}}function kb(e,t,n){let r=[];for(let[i,a]of e){if(!H(a))continue;let e=a;r.push([i,e]),Vb(e,i,t);let o=e.properties;Fb(i,e,o,t),Lb(i,e,o,t),o&&(Ub(o,i,t,!0,n),jb(o)&&Rb(o,t),Hb(o,t,n))}Ab(r,t)}function Ab(e,t){if(!(e.length<=1))for(let[n,r]of e){let e=r.properties;if(!e||e.schema==null)continue;let i=r.__cst;i&&J(t,q(i.range,`Input '${n}' declares a schema and must the only input in this response format.`,N.Error,`response-format-schema-input-not-exclusive`))}}function jb(e){if(!H(e.schema))return!1;let t=e.schema.value;if(typeof t!=`string`)return!1;let n=t.split(`://`);return n[0]===`messaging_component`&&!!n[1]}function Mb(e){let t=e.type;if(t?.properties){let e=t.properties.fields;if(U(e))return e;let n=t.properties.value;if(n?.properties){let e=n.properties.fields;if(U(e))return e}}}function*Nb(e){let t=Mb(e);if(t)for(let[e,n]of t)H(n)&&n.__kind===`ParameterDeclaration`&&(yield[e,n])}function Pb(e){let t=e.type;if(t){if(t.__kind===`Identifier`)return t.name;if(t.__kind===`SubscriptExpression`){let e=t.index;if(e?.__kind===`Identifier`)return e.name;let n=t.object;if(n?.__kind===`Identifier`)return n.name}}}function Fb(e,t,n,r){let i=Ib(t,n),a=t.__cst;if(!a)return;let o=n?Mb(n):void 0,s=U(o)&&o.size>0;if(i){if(n&&jb(n))return;s||J(r,q(a.range,`Input '${e}' is an object but declares no 'fields:' block, so it has no shape.`,N.Warning,`response-format-object-missing-fields`));return}s&&J(r,q(a.range,`Input '${e}' declares a 'fields:' block but is not an object or list[object].`,N.Error,`response-format-fields-on-non-object`))}function Ib(e,t){let n=Pb(e);if(n===`object`)return!0;if(n!==`list`)return!1;let r=(t?.type)?.properties?.value;if(!H(r))return!1;let i=r.typeName;return i?.__kind===`Identifier`?i.name===`object`:!1}function Lb(e,t,n,r){if(Pb(t)!==`list`)return;let i=n?.type;if(!i?.properties||i.properties.value!=null)return;let a=t.__cst;a&&J(r,q(a.range,`Input '${e}' is a list but does not declare a 'value:' parameter. Specify the element type (e.g., 'value: string' or 'value: object').`,N.Error,`response-format-list-missing-value`))}function Rb(e,t){for(let[n,r]of Nb(e)){if(r.defaultValue!=null)continue;let e=r.__cst;e&&J(t,q(e.range,`Messaging component parameter '${n}' must have a default value (e.g. '${n}: <type> = <value>').`,N.Error,`response-format-messaging-component-missing-default`))}}var zb=new Set([`StringLiteral`,`NumberLiteral`,`BooleanLiteral`,`NoneLiteral`]);function Bb(e){if(e.__kind&&zb.has(e.__kind))return!0;if(e.__kind===`UnaryExpression`){let t=e.operand;return!!t&&t.__kind===`NumberLiteral`}return!1}function Vb(e,t,n){let r=e.defaultValue;if(r?.__kind===`ListLiteral`&&(r.elements??[]).some(e=>!Bb(e))){let e=r.__cst;e&&J(n,q(e.range,`Input '${t}' has a list default value that contains non-literal elements. List defaults may only contain primitive literals (e.g. [1, 2, 3] or ["a", "b"]).`,N.Error,`response-format-list-default-non-primitive`))}let i=e.properties;if(i)for(let[e,t]of Nb(i))Vb(t,e,n)}function Hb(e,t,n){for(let[r,i]of Nb(e)){let e=i.properties;Fb(r,i,e,t),e&&(Ub(e,r,t,!1,n),Hb(e,t,n))}}function Ub(e,t,n,r,i){if(!H(e.schema))return;let a=e.schema.value;if(a===void 0)return;let o=e.schema.__cst;if(!o)return;let s=a.split(`://`);if(s.length!==2||!s[0]||!s[1]){J(n,q(o.range,`Input '${t}' has invalid schema URI '${a}'. Expected format: 'type://target' (e.g., 'messaging_component://MyComponent')`,N.Error,`response-format-invalid-schema-uri`));return}if(s[0]!==`messaging_component`){J(n,q(o.range,`Input '${t}' has unsupported schema type '${s[0]}'. Only 'messaging_component' is currently supported.`,N.Error,`response-format-unsupported-schema-type`));return}if(i!==`messaging`){J(n,q(o.range,`Messaging components can only be used in a messaging connection.`,N.Error,`response-format-messaging-component-wrong-surface`));return}r||J(n,q(o.range,`Input '${t}' cannot use '${s[0]}' schema on a nested field. '${s[0]}://' is only valid on top-level input fields.`,N.Error,`response-format-nested-schema`))}var Wb={slack:bb,service_email:xb,messaging:Sb,customer_web_client:Cb},Gb=class{id=$(`connection-validation`);description=`Validates per-connection-type field constraints`;requires=[];run(e,t){let n=t.connection;if(U(n))for(let[e,t]of n){if(!H(t))continue;let n=e.toLowerCase(),r=Wb[n];r?r(t):wb(t,e),Tb(t),Ob(t,n),Eb(t)}}};function Kb(){return new Gb}function qb(e){let t=[];if(!e||typeof e!=`object`)return t;let n=e;if(n.__kind!==`TemplateExpression`||!Array.isArray(n.parts))return t;for(let e of n.parts){if(!e||typeof e!=`object`)continue;let n=e;if(n.__kind!==`TemplateInterpolation`)continue;let r=yd(n.expression);r?.namespace===`variables`&&t.push({name:r.property,node:n.expression})}return t}function Jb(e){return e===`External`||e===`external`}function Yb(e,t,n){for(let{name:r,node:i}of qb(e)){let e=n.variables.get(r);if(!e||e.modifier===`linked`||Jb(e.visibility))continue;let a=i.__cst;a&&J(i,q(a.range,`Variable '${r}' is ${e.modifier??`unmodified`} and cannot be used in ${t} messages. Only linked variables and variables with visibility: External are available at runtime.`,N.Error,`system-message-mutable-variable`))}}var Xb=class{id=$(`system-message-variables`);description=`Validates that system message templates only reference linked variables`;requires=[f_];run(e,t){let n=e.get(f_);if(!n)return;let r=t.system;if(!r)return;let i=r.messages;i&&(Yb(i.welcome,`welcome`,n),Yb(i.error,`error`,n))}};function Zb(){return new Xb}function Qb(e){if(!H(e)||e.__kind!==`MemberExpression`)return;let t=yd(e);if(!(!t||t.namespace!==`variables`))return t.property}var $b=new Set([`StringLiteral`,`NumberLiteral`,`BooleanLiteral`,`NoneLiteral`]);function ex(e){return H(e)?typeof e.__kind==`string`&&$b.has(e.__kind):!1}function tx(e){if(!H(e)||e.__kind!==`ListLiteral`)return;let t=e.elements;return Array.isArray(t)?t:void 0}function nx(e){return H(e)?e.__cst?.range:void 0}function rx(){return Lm({id:`connected-agent/bound-inputs`,description:`Connected agent inputs must be bound to linked or mutable variables`,deps:{typeMap:f_},run({typeMap:e}){for(let[,t]of e.connectedAgents)for(let[n,r]of t.inputs){if(!r.defaultValueNode||!r.defaultValueCst){let e=r.decl.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}};J(r.decl,q(e,`Input '${n}' must be bound to a variable (e.g. ${n}: string = @variables.X).`,N.Error,`bound-input-required`));continue}let t=tx(r.defaultValueNode);if(t){for(let e of t)ex(e)||J(r.decl,q(nx(e)??r.defaultValueCst.range,`A list bound input may only contain literal values (e.g. "123", 42). To bind variables, reference a single list-typed variable instead (e.g. @variables.X).`,N.Error,`bound-input-not-variable`));continue}if(ex(r.defaultValueNode))continue;let i=Qb(r.defaultValueNode);if(!i){J(r.decl,q(r.defaultValueCst.range,`Bound input must be a simple variable reference (e.g. @variables.X) or a literal value.`,N.Error,`bound-input-not-variable`));continue}let a=e.variables.get(i);a&&a.modifier!==`linked`&&a.modifier!==`mutable`&&J(r.decl,q(r.defaultValueCst.range,`Bound input must reference a linked or mutable variable — '${i}' is ${a.modifier??`unmodified`}.`,N.Error,`bound-input-not-linked-or-mutable`))}}})}var ix=[`agent`,`agentforce`];function ax(e){return/^[a-zA-Z]/.test(e)?/^[a-zA-Z0-9_]+$/.test(e)?e.endsWith(`_`)?`Target name '${e}' cannot end with an underscore.`:e.includes(`__`)?`Target name '${e}' cannot contain consecutive underscores.`:null:`Target name '${e}' can only contain letters, numbers, and underscores.`:`Target name '${e}' must start with a letter (a-z, A-Z).`}function ox(e){let t=e.match(/^[a-zA-Z][a-zA-Z0-9_]*:\/\/(.+)$/);return t?t[1]:null}var sx=$(`connected-agent-target`),cx=class{id=sx;description=`Validates connected agent target URIs (scheme and name)`;requires=[f_];run(e){let t=e.get(f_);if(t)for(let[,e]of t.connectedAgents){let{target:t,targetNode:n}=e;if(!t||!n)continue;let r=n.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}},i=t.match(/^([a-zA-Z][a-zA-Z0-9_]*):\/\//);if(!i)continue;let a=i[1];if(!ix.includes(a)){J(n,q(r,`Unsupported connected agent target scheme '${a}://'. Only ${ix.map(e=>`${e}://`).join(`, `)} is currently supported.`,N.Error,`connected-agent-unsupported-scheme`));continue}let o=ox(t);if(!o)continue;let s=ax(o);s&&J(n,q(r,s,N.Error,`invalid-connected-subagent-target-name`))}}};function lx(){return new cx}var ux=$(`template-reference-validation`),dx=class{id=ux;description=`Validates that template interpolations in instructions use @actions.X for connected subagents`;requires=[];run(e,t){let n=new WeakSet;this.walkNode(t,null,n)}walkNode(e,t,n){if(!H(e)||n.has(e))return;n.add(e);let r=t;if((e.__kind===`SubagentBlock`||e.__kind===`StartAgentBlock`)&&(r=e),e.__kind===`TemplateInterpolation`&&this.validateTemplateInterpolation(e,r),`__children`in e&&Array.isArray(e.__children))for(let t of e.__children)this.walkNode(t,r,n);for(let t in e){if(!Object.hasOwn(e,t)||t.startsWith(`__`))continue;let i=e[t];if(i&&typeof i==`object`)if(Array.isArray(i))for(let e of i)this.walkNode(e,r,n);else this.walkNode(i,r,n)}}validateTemplateInterpolation(e,t){let n=e.expression;if(!n||typeof n!=`object`)return;let r=n,i=yd(r);if(i&&i.namespace===`connected_subagent`){let n=i.property,a=this.findActionAlias(t,n);J(e,q(r.__cst?.range??{start:{line:0,character:0},end:{line:0,character:0}},`Connected subagent '${n}' cannot be referenced as {!@connected_subagent.${n}} in template instructions. Use ${a?`{!@actions.${a}}`:`{!@actions.<action_alias>}`} instead.`,N.Error,`invalid-connected-subagent-reference`))}}findActionAlias(e,t){if(!e)return null;let n=e.reasoning;if(!n||typeof n!=`object`)return null;let r=n.actions;if(!U(r))return null;for(let[e,n]of r){if(!n||typeof n!=`object`)continue;let r=n;if(r.__kind!==`ReasoningActionBlock`)continue;let i=yd(r.value);if(i&&i.namespace===`connected_subagent`&&i.property===t)return e}return null}};function fx(){return new dx}function px(e){if(!(!H(e)||!e.__kind||![`StringLiteral`,`TemplateExpression`].includes(e.__kind)||typeof e.value!=`string`||e.value.trim().length===0))return e.value}var mx=class{id=$(`config-validation`);description=`Validates Agentforce config block constraints (agent name, default_agent_user)`;run(e,t){let n=t.config;if(!H(n))return;let r=px(n.developer_name),i=px(n.agent_name);!r&&!i?J(n,q(qy(n),`Config requires either 'developer_name' or 'agent_name'.`,N.Error,`config-missing-agent-name`)):r&&i&&J(n,q(qy(n),`Only one of 'developer_name' or 'agent_name' can be provided, not both.`,N.Error,`config-duplicate-agent-name`));let a=H(t.access)?t.access:void 0,o=n.default_agent_user,s=a?.default_agent_user,c=px(s),l=px(o),u=op(s),d=op(o),f=c||l;if((c||u)&&(l||d)){let e=o;J(e,q(qy(e),`'default_agent_user' is set in both 'config' and 'access' — 'access.default_agent_user' takes precedence and 'config.default_agent_user' will be ignored.`,N.Warning,`config-default-agent-user-conflict`))}let p=px(n.agent_type),m=p?.toLowerCase();if(p&&!Yv(p)){let e=n.agent_type;J(e,q(qy(e),`'${p}' is not a supported agent_type.`,N.Error,`agent-type-not-allowed`))}let h=m===`agentforceemployeeagent`||m===`agentforce employee agent`;if(!h){let e=p?`'default_agent_user' may only be 'None' for AgentforceEmployeeAgent (got ${p}).`:`'default_agent_user' may only be 'None' when 'agent_type' is 'AgentforceEmployeeAgent'.`;if(d){let t=o;J(t,q(qy(t),e,N.Error,`config-invalid-default-agent-user-none`))}if(u&&a){let t=s;J(t,q(qy(t),e,N.Error,`config-invalid-default-agent-user-none`))}}let g=(H(t.system)?t.system:void 0)?.recommended_prompts;if(H(g)&&!h&&J(g,q(qy(g),`'recommended_prompts' is only supported for AgentforceEmployeeAgent${p?` (got ${p})`:``}.`,N.Error,`recommended-prompts-agent-type`)),h&&a){let e=a.sharing_policy;H(e)&&J(e,q(qy(e),`'sharing_policy' is not allowed for AgentforceEmployeeAgent.`,N.Error,`access-sharing-policy-not-allowed`));let t=a.verified_customer_record_access;H(t)&&J(t,q(qy(t),`'verified_customer_record_access' is not allowed for AgentforceEmployeeAgent.`,N.Error,`access-verified-customer-record-access-not-allowed`))}p&&(m===`agentforceserviceagent`||m===`agentforce service agent`)&&(f||J(n,q(qy(n),`'default_agent_user' is required for ${p} type agents.`,N.Error,`config-missing-default-agent-user`)))}};function hx(){return new mx}var gx=class{id=$(`variable-validation`);description=`Validates variable names and linked variable constraints`;requires=[f_];run(e,t){let n=e.get(f_);if(!n)return;let r=t.variables;if(U(r))for(let[e,t]of r){if(!t||typeof t!=`object`)continue;let r=t,i=qy(r),a=r.properties;this.validateName(e,r,i);let o=n.variables.get(e);this.validateSourceProperty(e,r,i,o?.modifier,a),o?.modifier===`linked`&&this.validateLinkedVariable(e,r,i,o.type)}}validateName(e,t,n){e.startsWith(`_`)&&J(t,q(n,`Variable name '${e}' cannot start with an underscore.`,N.Error,`invalid-variable-name`));let r=e.endsWith(`__c`);e.endsWith(`_`)&&!r&&J(t,q(n,`Variable name '${e}' cannot end with an underscore (except __c suffix).`,N.Error,`invalid-variable-name`)),e.includes(`__`)&&(r?e.slice(0,-3).includes(`__`)&&J(t,q(n,`Variable name '${e}' cannot contain consecutive underscores (except __c suffix).`,N.Error,`invalid-variable-name`)):J(t,q(n,`Variable name '${e}' cannot contain consecutive underscores (except __c suffix).`,N.Error,`invalid-variable-name`)))}validateSourceProperty(e,t,n,r,i){let a=i?.source!=null;r===`mutable`&&a&&J(t,q(n,`Mutable variable '${e}' cannot have a source property. Only linked variables can have a source.`,N.Error,`mutable-variable-cannot-have-source`)),r===`linked`&&!a&&J(t,q(n,`Linked variable '${e}' must have a source property (e.g., source: @MessagingSession.Id).`,N.Error,`linked-variable-missing-source`))}validateLinkedVariable(e,t,n,r){(r.startsWith(`list[`)||r.startsWith(`list(`))&&J(t,q(n,`Context variable '${e}' cannot be a list.`,N.Error,`linked-variable-cannot-be-list`)),r===`object`&&J(t,q(n,`Context variable '${e}' cannot be an object.`,N.Error,`linked-variable-cannot-be-object`)),t.defaultValue!=null&&J(t,q(n,`Context variable '${e}' cannot have a default value.`,N.Error,`linked-variable-cannot-have-default`))}};function _x(){return new gx}function vx(e){let t=e.type;return H(t)?t.__cst?.node?.text?.trim()??null:null}var yx=new Set([`object`,`list[object]`]);function bx(e){return yx.has(e)}function xx(e,t){if(!e)return!1;let n=e[t];if(!n||typeof n!=`object`)return!1;let r=n;return typeof r.value==`string`&&r.value.trim().length>0}var Sx=class{id=$(`complex-data-type-warning`);description=`Warns when object-type action inputs/outputs lack complex_data_type_name or schema`;requires=[Bm];run(e,t){let n=e.get(Bm);if(!n)return;let r=new Set([...Fp(`topic`,n),...Fp(`subagent`,n)]);for(let e of r){let n=t[e];if(U(n))for(let[,e]of n){if(!H(e))continue;let t=e.actions;if(U(t))for(let[e,n]of t)H(n)&&(this.checkDecls(n.inputs,e,`input`),this.checkDecls(n.outputs,e,`output`))}}}checkDecls(e,t,n){if(!(!e||!U(e)))for(let[r,i]of e){if(!H(i))continue;let e=i,a=vx(e);if(!a)continue;let o=e.properties,s=xx(o,`complex_data_type_name`);if(!bx(a)){s&&J(e,q(qy(e),`Action ${n} '${r}' in '${t}' has primitive type '${a}' and does not require 'complex_data_type_name'. Only 'object' and 'list[object]' types require 'complex_data_type_name'.`,N.Warning,`complex-data-type-on-primitive`));continue}if(!(s||n===`input`&&xx(o,`schema`))){let i=n===`input`?`'complex_data_type_name' or 'schema'`:`'complex_data_type_name'`;J(e,q(qy(e),`Action ${n} '${r}' in '${t}' has type '${a}' but lacks ${i}. Consider specifying the object schema for better type validation.`,N.Warning,`object-type-missing-schema`))}}}};function Cx(){return new Sx}var wx=`node://`,Tx=`__`,Ex={[Ov]:new Set(Object.keys(yy)),[Av]:new Set(Object.keys(by))};function Dx(e,t,n){let r=Ex[n];if(r)for(let n of Object.keys(t)){if(n.startsWith(Tx)||r.has(n))continue;let i=t[n];i!=null&&J(t,q(qy(i)??qy(t),`'${n}' is not allowed on custom subagent '${e}'.`,N.Error,`custom-subagent-validation`))}}var Ox=class{id=$(`custom-subagent-validation`);description=`Validates custom subagent variants against their schema`;run(e,t){for(let e of[`subagent`,`start_agent`]){let n=t[e];if(U(n))for(let[e,t]of n){if(!t||typeof t!=`object`)continue;let n=t,r=Gy(n.schema);if(!(!r||!r.startsWith(wx))){if(r.startsWith(`node://byon/`)){kx(e,n);continue}Dx(e,n,r)}}}}};function kx(e,t){J(t,q(qy(t.schema)??qy(t),`Custom subagent '${e}' uses a node://byon/* schema. BYON nodes are for test and lower environments only — not for production use.`,N.Warning,`byon-not-for-production`))}function Ax(){return new Ox}function jx(e){if(typeof e==`boolean`)return e;if(typeof e!=`object`||!e)return;let t=e;if((t.__kind===`BooleanValue`||t.__kind===`BooleanLiteral`)&&typeof t.value==`boolean`)return t.value}var Mx=[`default_locale`,`additional_locales`,`all_additional_locales`],Nx=class{id=$(`adaptive-language-validation`);description=`Validates configurations that conflict with language.adaptive=True`;run(e,t){let n=t.language;if(!n||typeof n!=`object`||jx(n.adaptive)!==!0)return;for(let e of Mx){let t=n[e];t!=null&&J(n,q(qy(t),`Field '${e}' will be ignored because language.adaptive is True.`,N.Warning,`adaptive-language-overrides`))}let r=t.modality;U(r)&&r.has(`voice`)&&J(n,q(qy(n.adaptive),`Adaptive mode cannot be used over voice modality. The adaptive language setting will be ignored if this agent is attached to a voice channel.`,N.Warning,`voice-adaptive-conflict`))}};function Px(){return new Nx}var Fx=`additional_parameter__`,Ix=`disabled-additional-parameter`,Lx=`deprecated-additional-parameter`,Rx=new Map([[`reset_to_initial_node`,`reset_to_initial_node`],[`disable_groundedness`,`groundedness`],[`enable_groundedness`,`groundedness`],[`disable_streaming`,`streaming`],[`disable_citation`,`citation`],[`enable_thought_chunks`,`thought_chunks`]]),zx=new Map([[`disable_graph_runtime`,`Disabling the graph runtime is not permitted. Please reach out to support if you need that.`]]);function Bx(e,t){return`The ${Fx}${e} parameter is deprecated and will be removed in a future release. Use config.runtime.${t} instead.`}var Vx=class{id=$(`governed-additional-parameters`);description=`Governs additional_parameter__ config fields — forbids some, deprecates others`;run(e,t){let n=t.config;if(H(n))for(let e of Object.keys(n)){let t=e.toLowerCase();if(!t.startsWith(Fx))continue;let r=t.slice(22),i=zx.get(r),a=Rx.get(r),o,s,c,l;if(i!==void 0)o=i,s=N.Error,c=Ix;else if(a!==void 0)o=Bx(r,a),s=N.Warning,c=Lx,l=[hs.Deprecated];else continue;let u=n[e];J(H(u)?u:n,q(H(u)?Jy(u):qy(n),o,s,c,l?{tags:l}:void 0))}}};function Hx(){return new Vx}function Ux(e){if(typeof e==`boolean`)return e;if(typeof e!=`object`||!e)return;let t=e;if((t.__kind===`BooleanValue`||t.__kind===`BooleanLiteral`)&&typeof t.value==`boolean`)return t.value}function Wx(e){let t=new Set(Ky(e.additional_locales)),n=Gy(e.default_locale);return n&&t.add(n),t}var Gx=class{id=$(`voice-language-validation`);description=`Validates that voice language keys are declared in the language block`;run(e,t){let n=t.modality;if(!U(n)||!n.has(`voice`))return;let r=n.get(`voice`),i=r.language,a=r.language_settings,o=!!i&&typeof i==`object`,s=U(a)&&a.size>0;if(!(!o&&!s)){if(o){let e=t.language;if(!e||typeof e!=`object`)J(r,q(qy(i),`Voice languages are defined but no 'language' block exists. Define 'default_locale' and/or 'additional_locales'.`,N.Warning,`voice-language-missing-language-block`));else{let t=Wx(e),n=Gy(i.default_locale);n&&!t.has(n)&&J(i,q(qy(i.default_locale),`Voice language '${n}' is not declared in the language block. Add it to 'default_locale' or 'additional_locales'.`,N.Error,`voice-language-not-declared`));let r=Ky(i.additional_locales);for(let e of r)t.has(e)||J(i,q(qy(i.additional_locales),`Voice language '${e}' is not declared in the language block. Add it to 'default_locale' or 'additional_locales'.`,N.Error,`voice-language-not-declared`))}}if(s&&(o?Ux(i.all_additional_locales):void 0)!==!0){let e=o?Wx(i):new Set;for(let[t,n]of a)e.has(t)||J(n,q(qy(n),`Voice language setting '${t}' is not a declared voice language. Add it to the voice 'language' block's 'default_locale' or 'additional_locales'.`,N.Error,`voice-language-settings-not-declared`))}}}};function Kx(){return new Gx}var qx=[`inbound`,`outbound`,`session_language_switching`,`language`,`language_settings`],Jx=[`inbound_keywords`,`inbound_filler_words_detection`,`voice_id`,`outbound_speed`,`outbound_style_exaggeration`,`outbound_stability`,`outbound_similarity`,`outbound_filler_sentences`,`pronunciation_dict`,`additional_configs`],Yx=class{id=$(`voice-version-mixing`);description=`Ensures V1 and V2 voice properties are not mixed in the same modality voice block`;run(e,t){let n=t.modality;if(!U(n)||!n.has(`voice`))return;let r=n.get(`voice`),i=[],a=[];for(let e of Jx)r[e]!==void 0&&i.push(e);for(let e of qx)r[e]!==void 0&&a.push(e);if(!(i.length===0||a.length===0))for(let e of i){let t=r[e];J(r,q(Jy(t),`Cannot mix V1 and V2 voice properties. '${e}' is a V1 property but V2 properties are also present: ${a.join(`, `)}. Use exclusively V1 or V2 properties.`,N.Error,`voice-version-mixing`))}}};function Xx(){return new Yx}var Zx=[`system`,`variables`,`model_config`,`knowledge`,`connection`,`modality`,`access`,`context`],Qx=[`modality`];function $x(e){let t=e.size;return typeof t==`number`?t===0:!Object.keys(e).some(e=>!e.startsWith(`__`))}function eS(e,t){let n=e.__diagnostics;return Array.isArray(n)&&n.some(e=>e.code===t)}function tS(e,t){J(e,q(qy(e),`Empty '${t}' block: it has no content and will have no effect. Add configuration or remove the block.`,N.Error,`empty-block`))}var nS=class{id=$(`empty-block-agentforce`);description=`Flags blocks (connection, knowledge, modality, …) written with no content`;run(e,t){for(let e of Zx){let n=t[e];!n||typeof n!=`object`||$x(n)&&tS(n,e)}for(let e of Qx){let n=t[e];if(U(n))for(let[t,r]of n.entries())!r||typeof r!=`object`||eS(r,`unknown-variant`)||$x(r)&&tS(r,`${e} ${t}`)}}};function rS(){return new nS}var iS=new Map([[`EndUserId`,`@MessagingSession.MessagingEndUserId`],[`ChannelType`,`@MessagingSession.ChannelType`],[`RoutableId`,`@MessagingSession.Id`],[`EndUserLanguage`,`@MessagingSession.EndUserLanguage`],[`ContactId`,`@MessagingEndUser.ContactId`]]);function aS(e){let t=e.properties?.source;if(!t)return;let n=yd(t);if(n)return`@${n.namespace}.${n.property}`}function oS(){return[...Dv().map(e=>e.id===`unused-variable`?yg({overrideMessageForVariable:(e,t)=>{let n=iS.get(e);if(n&&aS(t)===n)return`Variable '${e}' is not used but is required by Agentforce. Removing this variable can cause issues when running the agent.`}}):e),Uy(),$y(),ab(),ob(),Kb(),Zb(),rx(),lx(),fx(),hx(),_x(),Cx(),Ax(),Px(),Hx(),Kx(),Xx(),rS()]}Dp({schema:{system:ly.pick([`instructions`]).describe(`System instructions contributed by the plugin and appended to the host agent instructions.`),actions:dy.describe(`Agentforce action definitions exposed by the plugin.`),workflows:Qf($g),subagent:Qf(Sy)},aliases:{},globalScopes:Ry.globalScopes,nodeMemberAccess:Ry.nodeMemberAccess});function sS(e){let t=[],n=null;try{let{rootNode:r}=Rl(e),i=new _p().parse(r,Ly);if(n=i,i&&typeof i==`object`&&`diagnostics`in i){let e=i.diagnostics;Array.isArray(e)&&t.push(...e)}try{let e=new Vm({passes:oS(),source:`agentscript`}).run(cS(i),zy);t.push(...e.diagnostics)}catch(e){t.push(pS(e))}}catch(e){t.push(fS(e))}return{source:e,parsed:n,diagnostics:lS(t)}}function cS(e){let t=Lg(e);if(t===void 0)throw Error(`dialect.parse() returned no readable root — its { value, diagnostics } wrapper held no object. Linting a non-root silently finds no keys to walk and reports nothing.`);if(!(`__cst`in t)||!Array.isArray(t.__diagnostics))throw Error(`dialect.parse() returned a root missing __cst / __diagnostics, which every lint pass reads. The upstream node shape has changed; adapt to it rather than casting past it.`);return t}function lS(e){let t=new Set,n=[];for(let r of e){let e=JSON.stringify([r.code??``,r.message,r.range??``]);t.has(e)||(t.add(e),n.push(r))}return n}function uS(e){let t=new dS(e);return{document:t,diagnostics:t.analysis.diagnostics}}var dS=class{#e=[];#t=[];#n;#r;constructor(e=``){this.#n=e,this.#r=sS(e)}get source(){return this.#n}get analysis(){return this.#r}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}edit(e){return e===this.#n?this:(this.#e.push(this.#n),this.#t.length=0,this.#n=e,this.#r=sS(e),this)}undo(){let e=this.#e.pop();return e===void 0?this:(this.#t.push(this.#n),this.#n=e,this.#r=sS(e),this)}redo(){let e=this.#t.pop();return e===void 0?this:(this.#e.push(this.#n),this.#n=e,this.#r=sS(e),this)}};function fS(e){return mS(`the document could not be parsed: ${hS(e)}`)}function pS(e){return mS(`the document was parsed but could not be linted: ${hS(e)}`)}function mS(e){return{message:e,severity:1,range:{start:{line:0,character:0},end:{line:0,character:0}}}}function hS(e){return e instanceof Error?e.message:String(e)}var gS=[{id:`config`,summary:`the config block naming the agent`,probe:`config:
|
|
536
|
+
agent_name: "spec-author"
|
|
537
|
+
`,kinds:[`ConfigBlock`]},{id:`system.instructions`,summary:`standing instructions, as a multiline block`,probe:`system:
|
|
538
|
+
instructions: |
|
|
539
|
+
You help the author.
|
|
540
|
+
`,kinds:[`SystemBlock`,`TemplateExpression`,`TemplateText`]},{id:`variables`,summary:`declared variables with a type and a literal default`,probe:`variables:
|
|
541
|
+
stage: mutable string = "proposal"
|
|
542
|
+
change_id: string = "OS-1"
|
|
543
|
+
approved: mutable boolean = False
|
|
544
|
+
`,kinds:[`VariablesBlock`,`VariableDeclaration`,`ParameterDeclaration`,`Identifier`,`StringLiteral`,`BooleanLiteral`]},{id:`variables.description`,summary:`a variable's description`,probe:`variables:
|
|
545
|
+
stage: mutable string = "proposal"
|
|
546
|
+
description: "which stage is live"
|
|
547
|
+
`,kinds:[`VariablePropertiesBlock`]},{id:`subagent`,summary:`a named subagent with a description`,probe:`subagent draft:
|
|
548
|
+
description: "Fill the proposal"
|
|
549
|
+
`,kinds:[`Collection<SubagentBlock>`,`SubagentBlock`]},{id:`subagent.reasoning`,summary:`a subagent's reasoning block`,probe:`subagent draft:
|
|
550
|
+
description: "d"
|
|
551
|
+
|
|
552
|
+
reasoning:
|
|
553
|
+
instructions: ->
|
|
554
|
+
| Do the thing.
|
|
555
|
+
`,kinds:[`ReasoningBlock`,`ProcedureValue`]},{id:`reasoning.prompt-line`,summary:`a prompt line, interpreted by the model`,probe:`subagent t:
|
|
556
|
+
reasoning:
|
|
557
|
+
instructions: ->
|
|
558
|
+
| Read the artifact.
|
|
559
|
+
`,kinds:[`Template`,`TemplateText`]},{id:`reasoning.interpolation`,summary:"a `{!@variables.x}` reference inside a prompt line",probe:`variables:
|
|
560
|
+
stage: mutable string = "proposal"
|
|
561
|
+
|
|
562
|
+
subagent t:
|
|
563
|
+
reasoning:
|
|
564
|
+
instructions: ->
|
|
565
|
+
| Draft the {!@variables.stage}.
|
|
566
|
+
`,kinds:[`TemplateInterpolation`]},{id:`reasoning.logic-line`,summary:`a logic line, run deterministically every turn`,probe:`variables:
|
|
567
|
+
stage: mutable string = "proposal"
|
|
568
|
+
count: mutable number = 0
|
|
569
|
+
approved: mutable boolean = False
|
|
570
|
+
|
|
571
|
+
subagent t:
|
|
572
|
+
reasoning:
|
|
573
|
+
instructions: ->
|
|
574
|
+
if not @variables.approved and @variables.count > 1:
|
|
575
|
+
| Draft it.
|
|
576
|
+
else:
|
|
577
|
+
set @variables.stage = "specs"
|
|
578
|
+
`,kinds:[`IfStatement`,`SetClause`,`MemberExpression`,`AtIdentifier`,`ComparisonExpression`,`BinaryExpression`,`UnaryExpression`,`StringLiteral`,`NumberLiteral`,`BooleanLiteral`]},{id:`reasoning.structured-output`,summary:`assigning a variable from a field of the step's structured result`,probe:`variables:
|
|
579
|
+
verdict: mutable string = ""
|
|
580
|
+
|
|
581
|
+
subagent t:
|
|
582
|
+
reasoning:
|
|
583
|
+
instructions: ->
|
|
584
|
+
| Judge it.
|
|
585
|
+
set @variables.verdict = @outputs.verdict
|
|
586
|
+
`,kinds:[`SetClause`,`MemberExpression`,`AtIdentifier`]}];gS.map(e=>e.id);var _S=[`Template`,`IfStatement`,`SetClause`],vS=[`MemberExpression`,`AtIdentifier`,`ComparisonExpression`,`BinaryExpression`,`UnaryExpression`,`StringLiteral`,`NumberLiteral`,`BooleanLiteral`];[...new Set([...gS.flatMap(e=>e.kinds),..._S,...vS])];function yS(e){return typeof e==`object`&&e?e:null}function bS(e){let t=yS(yS(yS(e)?.__cst)?.range),n=yS(t?.start),r=yS(t?.end);return n===null||r===null?null:{startLine:Number(n.line),startCharacter:Number(n.character),endLine:Number(r.line),endCharacter:Number(r.character)}}function xS(e){return String(yS(e)?.__kind??``)}function SS(e){let t=yS(e);return t===null||typeof t[Symbol.iterator]!=`function`?[]:[...t].filter(e=>Array.isArray(e)&&yS(e[1])!==null)}var CS=/@variables\.([A-Za-z_][A-Za-z0-9_]*)/;function wS(e,t){let n=e.split(`
|
|
587
|
+
`);if(t.startLine===t.endLine)return(n[t.startLine]??``).slice(t.startCharacter,t.endCharacter);let r=(n[t.startLine]??``).slice(t.startCharacter),i=n.slice(t.startLine+1,t.endLine),a=(n[t.endLine]??``).slice(0,t.endCharacter);return[r,...i,a].join(`
|
|
588
|
+
`)}function TS(e,t,n){let r=e.split(`
|
|
589
|
+
`),i=(r[t.startLine]??``).slice(0,t.startCharacter),a=(r[t.endLine]??``).slice(t.endCharacter),o=r.slice(0,t.startLine),s=r.slice(t.endLine+1);return[...o,`${i}${n}${a}`,...s].join(`
|
|
590
|
+
`)}function ES(e,t){let n=yS(t)?.parts;if(!Array.isArray(n))return[];let r=[];for(let t of n){if(xS(t)!==`TemplateInterpolation`)continue;let n=bS(t);if(n===null)continue;let i=CS.exec(wS(e,n))?.[1];i!==void 0&&r.push({name:i,range:n})}return r}function DS(e,t,n){let r=wS(e,t);return n===`prompt`?r.replace(/^\|[ \t]?/,``).trimEnd():r.trimEnd()}function OS(e,t,n,r,i){if(!Array.isArray(t))return[];let a=[];return t.forEach((t,o)=>{let s=bS(t);if(s===null)return;let c=`${n}:${i}${o}`,l=xS(t)===`Template`,u=yS(t)?.body,d=OS(e,u,n,r+1,`${i}${o}.`);a.push({key:c,kind:l?`prompt`:`logic`,marker:l?`|`:`->`,text:DS(e,d.length===0?s:{...s,endLine:s.startLine,endCharacter:(e.split(`
|
|
591
|
+
`)[s.startLine]??``).length},l?`prompt`:`logic`),depth:r,range:s,encloses:d.length>0,references:ES(e,t)}),a.push(...d)}),a}function kS(e){let{document:t,diagnostics:n}=uS(e),r=t.analysis,i=yS(yS(r.parsed)?.value)??yS(r.parsed),a=yS(yS(i?.config)?.agent_name),o=yS(yS(i?.system)?.instructions),s=SS(i?.variables).map(([t,n])=>{let r=bS(n)??{startLine:0,startCharacter:0,endLine:0,endCharacter:0},i=bS(n.defaultValue);return{name:t,type:String(yS(n.type)?.name??``),modifier:yS(n.modifier)?.name===void 0?null:String(yS(n.modifier)?.name),defaultText:i===null?``:wS(e,i),defaultRange:i,declRange:r}}),c=SS(i?.subagent).map(([t,n])=>{let r=yS(n.description)?.value,i=yS(yS(n.reasoning)?.instructions)?.statements;return{name:t,description:r===void 0?null:String(r),lines:OS(e,i,t,0,``)}}),l=c.flatMap(e=>e.lines.flatMap(e=>e.references));return{source:e,agentName:a?.value===void 0?null:String(a.value),systemInstructions:o===null?null:String(yS(o.parts?.[0])?.value??``),variables:s,subagents:c,references:l,diagnostics:n.map(e=>{let t=e,n=bS({__cst:{range:t.range}})??{startLine:0,startCharacter:0,endLine:0,endCharacter:0},r=yS(t.data)?.referenceName;return{message:String(t.message??``),severity:Number(t.severity??1),code:t.code===void 0?null:String(t.code),range:n,variable:typeof r==`string`?CS.exec(r)?.[1]??null:null}})}}function AS(e,t,n){if(!e.subagents.some(e=>e.name===t))return e.source;let r=e.source.split(`
|
|
592
|
+
`),i=RegExp(`^(\\s*subagent\\s+)${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}(\\s*:)`),a=r.findIndex(e=>i.test(e));return a===-1?e.source:(r[a]=r[a].replace(i,`$1${n}$2`),r.join(`
|
|
593
|
+
`))}function jS(e,t,n){let{document:r}=uS(e.source),i=SS(yS(yS(r.analysis.parsed)?.value)?.subagent).find(([e])=>e===t)?.[1],a=bS(i?.description);return a===null?e.source:TS(e.source,a,JSON.stringify(n))}function MS(e,t){let n=e.subagents.flatMap(e=>e.lines).find(e=>e.key===t);if(n===void 0||n.encloses)return e.source;let r=e.source.split(`
|
|
594
|
+
`),i=r[n.range.startLine];if(i===void 0)return e.source;let a=n.range.startCharacter;return r[n.range.startLine]=n.kind===`prompt`?i.slice(0,a)+i.slice(a).replace(/^\|[ \t]?/,``):`${i.slice(0,a)}| ${i.slice(a)}`,r.join(`
|
|
595
|
+
`)}function NS(e){return e?`True`:`False`}function PS(e,t,n){let r=e.variables.find(e=>e.name===t);return r===void 0||r.defaultRange===null?{outcome:`no-variable`,variable:t,message:`This approval had no variable to write: the Agent Script document declares no \`${t}\`. The approval itself is unchanged — it is recorded beside the change either way — but the agent's prompt will not reflect it until the document declares that variable.`}:{outcome:`written`,variable:t,source:TS(e.source,r.defaultRange,NS(n))}}function FS(e,t,n){let r=PS(kS(e),t,n);if(r.outcome===`no-variable`)return{source:e,report:r.message};let i=new dS(e);return i.edit(r.source),{source:i.source,report:null}}var IS=Object.freeze([Object.freeze({shape:`prose`,words:/\b(?:prose|paragraphs?)\b/i}),Object.freeze({shape:`bullets`,words:/\b(?:bullets?|bulleted|list of bullets)\b/i}),Object.freeze({shape:`numbered`,words:/\b(?:numbered|ordered|numbers)\b/i})]);function LS(e){let t=IS.filter(t=>t.words.test(e));return t.length===1?t[0].shape:null}var RS=/^##[ \t]+(.+?)[ \t]*$/,zS=/^<!--([\s\S]*?)-->/;function BS(e){let t=e.split(`
|
|
596
|
+
`),n=[],r=null,i=()=>{if(r===null)return;let e=r.body.join(`
|
|
597
|
+
`),t=zS.exec(e.trimStart())?.[1]?.trim()??null;n.push({title:r.title,hint:t,shape:t===null?null:LS(t),body:e})};for(let e of t){let t=RS.exec(e);if(t!==null){i(),r={title:t[1].trim(),body:[]};continue}r!==null&&r.body.push(e)}return i(),n}function VS(e){let t=BS(e);return t.length>0?{sections:t,namesNoSection:null}:{sections:t,namesNoSection:e.trim()===``?`This template has no content at all, so it names no section — every proposal drafted from it would be empty and the proposal hand-off would have nothing to draft.`:"This template names no `##` section — the proposal hand-off works against that set, so it would have nothing to draft."}}function HS(e){switch(e){case`prose`:return`paragraphs`;case`bullets`:return`bullets`;case`numbered`:return`numbered`;case null:return`no shape claimed`}}var US=/^###[ \t]+Requirement:[ \t]*(.+?)[ \t]*$/gm;function WS(e){return e.flatMap(e=>[...e.content.matchAll(US)].map(t=>({capability:e.capability,key:t[1]})))}var GS=Object.freeze({proposal:`stage_proposal`,specs:`stage_requirements`,design:`stage_design`,tasks:`stage_tasks`,implemented:`stage_implemented`}),KS=Object.freeze({proposal:`Reconcile the draft against the proposal template`,specs:`Draft a requirement and its scenarios into a delta spec`,design:`Scaffold design.md from the proposal and the drafted requirements`,tasks:`One task per scenario, grouped by capability, each group citing its requirements`,implemented:`Explain what archiving does, and write nothing`});function qS(e,t){return(e[t]??``).trim()!==``}function JS(e){return Object.entries(e).map(([e,t])=>({capability:/^specs\/([^/]+)\/spec\.md$/.exec(e)?.[1],content:t})).filter(e=>e.capability!==void 0)}function YS(e){return WS(JS(e)).map(e=>({capability:e.capability,name:e.key}))}function XS(e,t){let n=t.offers?.[GS[e]]??KS[e],r=ZS(e,t),i=r.filter(e=>!e.present),a=r.filter(e=>e.present);return{stage:e,offer:n,inputs:r,missing:i,writes:e!==`implemented`,reduced:i.length===0?null:`${i.map(e=>`\`${e.name}\``).join(`, `)} ${i.length===1?`is`:`are`} absent. The offer is what ${a.length===0?`nothing else supports — there is nothing left to draft from`:`${a.map(e=>`\`${e.name}\``).join(`, `)} supports, and nothing is fabricated for the rest`}.`}}function ZS(e,t){let n={name:`proposal.md`,kind:`change`,present:qS(t.buffers,`proposal.md`)};switch(e){case`proposal`:return[n,{name:`the proposal template`,kind:`setting`,present:BS(t.template).length>0}];case`specs`:return[n,...t.folded.map(e=>({name:`openspec/specs/${e}/spec.md`,kind:`folded`,present:!0}))];case`design`:return[n,{name:`the change's drafted requirements`,kind:`derived`,present:YS(t.buffers).length>0}];case`tasks`:return[{name:`the change's requirements and scenarios`,kind:`derived`,present:YS(t.buffers).length>0}];case`implemented`:return[]}}var QS=Object.freeze({"tl;dr":[`why`,`summary`,`overview`,`tldr`],scope:[`what changes`,`whats changing`,`what will change`],risks:[`impact`,`risks and impact`,`consequences`],"current state":[`background`,`context`,`today`,`current behaviour`,`current behavior`],phases:[`plan`,`rollout`,`milestones`,`stages`],assumptions:[`givens`,`preconditions`]});function $S(e){return e.toLowerCase().replace(/[^a-z0-9; ]+/g,``).replace(/\s+/g,` `).trim()}function eC(e,t){let n=$S(e),r=t.find(e=>$S(e)===n);if(r!==void 0)return r;for(let e of t){let t=QS[$S(e)];if(t!==void 0&&t.includes(n))return e}return null}var tC=/^##[ \t]+(.+?)[ \t]*$/,nC=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;function rC(e){let t=nC.exec(e)?.[0]??``,n=e.slice(t.length).split(`
|
|
598
|
+
`),r=[],i=[],a=null;for(let e of n){let t=tC.exec(e);if(t!==null){a!==null&&i.push({title:a.title,body:a.body.join(`
|
|
599
|
+
`)}),a={title:t[1].trim(),body:[]};continue}a===null?r.push(e):a.body.push(e)}return a!==null&&i.push({title:a.title,body:a.body.join(`
|
|
600
|
+
`)}),{preamble:t+r.join(`
|
|
601
|
+
`).replace(/\s+$/,``),sections:i}}function iC(e,t){let n=BS(t),r=n.map(e=>e.title),{preamble:i,sections:a}=rC(e),o=[],s=new Map,c=[];for(let e of a){let t=eC(e.title,r);if(t===null||s.has(t)){c.push(e.title);continue}s.set(t,e.body),o.push({from:e.title,to:t})}let l=r.filter(e=>!s.has(e)),u=n.map(e=>{let t=s.get(e.title);return`## ${e.title}\n${t===void 0?e.body:t}`.replace(/\s+$/,``)}),d=a.filter(e=>c.includes(e.title)).map(e=>`## ${e.title}\n${e.body}`.replace(/\s+$/,``));return{mapped:o,drafted:l,unmapped:c,text:`${[i,...u,...d].filter(e=>e!==``).join(`
|
|
602
|
+
|
|
603
|
+
`)}\n`}}function aC(e){let t=YS(e.buffers),n=[...new Set(t.map(e=>e.capability))],r=[`proposal.md`,...t.length===0?[]:[`the change's drafted requirements`]];return{text:[`## Context`,``,`## Decisions`,``,`| Decision | Alternative considered |`,`|---|---|`,`| | |`,``,...n.length===0?[`## Diagrams`,``]:[`## Diagrams`,``,...n.flatMap(e=>[`### ${e}`,``,"```mermaid","```",``])]].join(`
|
|
604
|
+
`).replace(/\n+$/,`
|
|
605
|
+
`),derivedFrom:r}}function oC(e){return`Archiving is \`openspec archive ${e}\`, and it does two things together: it folds this change's deltas into \`openspec/specs/\` and it moves the change directory to \`openspec/changes/archive/\`. There is no move-only archive — a directory in \`archive/\` whose deltas were never folded is the failure this rule exists to prevent. The workbench does not perform it, and nothing is written by this answer.`}var sC=`the demo fixture (no model ran)`,cC=[`## Context`,``,`## Decisions`,``,`| Decision | Alternative considered |`,`|---|---|`,`| | |`,``,`## Diagrams`,``,"```mermaid",`flowchart TD`,"```"].join(`
|
|
606
|
+
`),lC=[`### Requirement: A Queued Task Reports Which Change It Belongs To`,``,`The queue SHALL report the change a running task belongs to.`,``,`#### Scenario: A task is running`,`- **WHEN** a task is running`,`- **THEN** the change it belongs to is reported alongside it`].join(`
|
|
607
|
+
`);function uC(e,t,n,r){let i=e.toLowerCase();if(i.includes(`reconcile`)&&r!==void 0){let e=iC(r.buffers[`proposal.md`]??``,r.template);return{kind:`answered`,answer:`Mapped ${e.mapped.map(e=>`\`${e.from}\` onto \`${e.to}\``).join(`, `)}; drafted ${e.drafted.map(e=>`\`${e}\``).join(`, `)}`+(e.unmapped.length===0?`.`:`. Left ${e.unmapped.map(e=>`\`${e}\``).join(`, `)} in place — I could not map it, so it is yours to decide.`),served:sC,read:[`proposal.md`,`the proposal template`],proposals:[Ro(`edit_artifact`,{artifact:`proposal.md`,mode:`replace`,text:e.text},n)]}}if(i.includes(`plan the implementation`))return{kind:`answered`,answer:`Proposed one task group for the runner queue, as an edit to tasks.md. Nothing is written until you accept it.`,served:sC,read:[`proposal.md`,`tasks.md`],proposals:[Ro(`add_task_group`,{title:`The runner queue`,tasks:[`Run one task at a time`,`Report a failed run with its reason`]},n)]};if(i.includes(`scaffold this design`)){let e=r===void 0?null:aC(r);return{kind:`answered`,answer:`Proposed a scaffold for design.md — headings, an empty decisions table and empty diagram fences derived from this change. The decisions are yours to write.`,served:sC,read:e?.derivedFrom??[`proposal.md`],proposals:[Ro(`edit_artifact`,{artifact:`design.md`,mode:`append`,text:e?.text??cC},n)]}}return i.includes(`draft a requirement`)&&t.capability!==null?{kind:`answered`,answer:`Drafted a requirement into specs/${t.capability}/spec.md.`,served:sC,read:[`proposal.md`,...(r?.folded??[]).map(e=>`openspec/specs/${e}/spec.md`)],proposals:[Ro(`add_requirement`,{capability:t.capability,block:lC},n)]}:{kind:`answered`,answer:`The demo fixture has no scripted answer for “${e}”, so it proposed nothing.`,served:sC,read:[],assumed:`that this change follows the OpenSpec conventions, without checking it`,proposals:[]}}function dC(e,t){return e.diagnostics.filter(e=>e.range.startLine===t).slice().sort((e,t)=>e.range.startCharacter-t.range.startCharacter)}var fC=/(\{!@variables\.[A-Za-z_][A-Za-z0-9_]*\})/g;function pC(e){let t=dC(e.view,e.line),n=e.text.split(fC);return(0,C.jsxs)(`div`,{className:`as-script-line`,"data-testid":`as-script-line-${e.line}`,children:[(0,C.jsx)(`span`,{className:`as-script-gutter`,children:e.line+1}),(0,C.jsx)(`code`,{className:`as-script-text`,children:n.map((e,n)=>{let r=/^\{!@variables\.([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(e)?.[1];if(r===void 0)return(0,C.jsx)(`span`,{children:e},n);let i=t.filter(e=>e.variable===r);return(0,C.jsxs)(`span`,{className:`as-reference`,"data-testid":`as-reference-${r}`,"data-flagged":i.length>0?`true`:`false`,title:i.map(e=>e.message).join(`
|
|
608
|
+
`),children:[e,i.map((e,t)=>(0,C.jsx)(`span`,{className:`as-diagnostic`,"data-testid":`as-diagnostic-${r}`,role:`note`,children:e.message},t))]},n)})}),t.filter(e=>e.variable===null).map((t,n)=>(0,C.jsx)(`span`,{className:`as-diagnostic`,"data-testid":`as-diagnostic-line-${e.line}`,role:`note`,children:t.message},n))]})}function mC(e){let[t,n]=(0,_.useState)(!1),r=kS(e.value);return(0,C.jsxs)(`div`,{className:`settings-two-up`,"data-testid":`settings-panel-agent-script`,children:[(0,C.jsxs)(`div`,{className:`as-form`,"data-testid":`as-form`,children:[(0,C.jsx)(`span`,{className:`workbench-col-label`,children:`form`}),(0,C.jsx)(`p`,{className:`settings-field-label`,children:`The script is the stored artifact; this form is a second view of it. A construct the form has no control for is never touched by an edit made here.`}),(0,C.jsxs)(`section`,{className:`as-section`,children:[(0,C.jsx)(`span`,{className:`as-section-title`,children:`variables`}),(0,C.jsxs)(`table`,{className:`as-variables`,"data-testid":`as-variables`,children:[(0,C.jsx)(`thead`,{children:(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{scope:`col`,children:`name`}),(0,C.jsx)(`th`,{scope:`col`,children:`type`}),(0,C.jsx)(`th`,{scope:`col`,children:`default`})]})}),(0,C.jsx)(`tbody`,{children:r.variables.map(e=>(0,C.jsxs)(`tr`,{"data-testid":`as-variable-${e.name}`,children:[(0,C.jsx)(`td`,{children:e.name}),(0,C.jsx)(`td`,{children:e.modifier===null?e.type:`${e.modifier} ${e.type}`}),(0,C.jsx)(`td`,{"data-testid":`as-variable-default-${e.name}`,children:e.defaultText})]},e.name))})]})]}),r.subagents.map(t=>(0,C.jsxs)(`section`,{className:`as-section`,"data-testid":`as-subagent-${t.name}`,children:[(0,C.jsxs)(`label`,{className:`settings-field`,children:[(0,C.jsx)(`span`,{className:`as-section-title`,children:`subagent`}),(0,C.jsx)(`input`,{className:`as-input`,"data-testid":`as-subagent-name-${t.name}`,"aria-label":`Name of subagent ${t.name}`,value:t.name,onChange:n=>e.onChange(AS(r,t.name,n.target.value))})]}),(0,C.jsxs)(`label`,{className:`settings-field`,children:[(0,C.jsx)(`span`,{className:`settings-field-label`,children:`description`}),(0,C.jsx)(`input`,{className:`as-input`,"data-testid":`as-subagent-description-${t.name}`,"aria-label":`Description of subagent ${t.name}`,value:t.description??``,onChange:n=>e.onChange(jS(r,t.name,n.target.value))})]}),(0,C.jsx)(`ul`,{className:`as-lines`,children:t.lines.map(t=>(0,C.jsxs)(`li`,{className:`as-line`,"data-testid":`as-line-${t.key}`,"data-kind":t.kind,"data-depth":t.depth,style:{"--as-depth":t.depth},children:[(0,C.jsx)(`span`,{className:`as-marker`,"data-testid":`as-line-marker-${t.key}`,"data-kind":t.kind,children:t.marker}),(0,C.jsx)(`span`,{className:`as-line-kind`,children:t.kind}),(0,C.jsx)(`span`,{className:`as-line-text`,children:t.text}),(0,C.jsx)(`button`,{type:`button`,className:`as-line-toggle`,"data-testid":`as-line-toggle-${t.key}`,"aria-label":`Make this ${t.kind===`prompt`?`a logic line`:`a prompt line`}`,disabled:t.encloses,title:t.encloses?`This line has lines nested beneath it; changing its kind would reparent them.`:void 0,onClick:()=>e.onChange(MS(r,t.key)),children:t.kind===`prompt`?`make logic ->`:`make prompt |`})]},t.key))})]},t.name))]}),(0,C.jsxs)(`div`,{className:`as-script`,"data-testid":`as-script`,children:[(0,C.jsxs)(`div`,{className:`as-script-head`,children:[(0,C.jsx)(`span`,{className:`workbench-col-label`,children:`script`}),(0,C.jsx)(`button`,{type:`button`,className:`as-script-mode`,"data-testid":`as-script-edit`,"aria-pressed":t,onClick:()=>n(e=>!e),children:t?`done editing`:`edit the script`})]}),t?(0,C.jsx)(`textarea`,{className:`settings-editor`,"data-testid":`as-script-editor`,"aria-label":`Agent Script`,spellCheck:!1,value:e.value,onChange:t=>e.onChange(t.target.value)}):(0,C.jsx)(`div`,{className:`as-script-body`,children:e.value.split(`
|
|
609
|
+
`).map((e,t)=>(0,C.jsx)(pC,{line:t,text:e,view:r},t))})]})]})}var hC=`# <change-id>
|
|
610
|
+
|
|
611
|
+
## TL;DR
|
|
612
|
+
<!-- 1-2 paragraphs -->
|
|
613
|
+
|
|
614
|
+
## Assumptions
|
|
615
|
+
<!-- bullets -->
|
|
616
|
+
-
|
|
617
|
+
|
|
618
|
+
## Scope
|
|
619
|
+
<!-- 1-2 paragraphs -->
|
|
620
|
+
|
|
621
|
+
## Current state
|
|
622
|
+
<!-- 1-2 paragraphs -->
|
|
623
|
+
|
|
624
|
+
## Risks
|
|
625
|
+
<!-- bullets -->
|
|
626
|
+
-
|
|
627
|
+
|
|
628
|
+
## Phases
|
|
629
|
+
<!-- numbered -->
|
|
630
|
+
1.
|
|
631
|
+
`,gC=`config:
|
|
632
|
+
agent_name: "SpecSketch Workbench"
|
|
633
|
+
description: "Walks one author through one OpenSpec change, one stage at a time"
|
|
634
|
+
|
|
635
|
+
system:
|
|
636
|
+
instructions: |
|
|
637
|
+
You help one author write one OpenSpec change, in five stages: proposal,
|
|
638
|
+
requirements, design, tasks, implemented. Each stage offers exactly one
|
|
639
|
+
hand-off, names the artifacts it will read before the turn, and writes
|
|
640
|
+
nothing until the author accepts it.
|
|
641
|
+
|
|
642
|
+
variables:
|
|
643
|
+
change_id: string = "the change being authored"
|
|
644
|
+
stage: mutable string = "proposal"
|
|
645
|
+
proposal_approved: mutable boolean = False
|
|
646
|
+
specs_approved: mutable boolean = False
|
|
647
|
+
design_approved: mutable boolean = False
|
|
648
|
+
tasks_approved: mutable boolean = False
|
|
649
|
+
|
|
650
|
+
subagent stage_proposal:
|
|
651
|
+
description: "Reconcile the draft against the proposal template"
|
|
652
|
+
reasoning:
|
|
653
|
+
instructions: ->
|
|
654
|
+
if @variables.stage == "proposal":
|
|
655
|
+
| Read {!@variables.change_id}'s proposal.md and the configured proposal template.
|
|
656
|
+
| Map the draft's existing headings onto the template's sections.
|
|
657
|
+
| Draft the sections the template names and the draft lacks. Write nothing until accepted.
|
|
658
|
+
|
|
659
|
+
subagent stage_requirements:
|
|
660
|
+
description: "Draft a requirement and its scenarios into a delta spec"
|
|
661
|
+
reasoning:
|
|
662
|
+
instructions: ->
|
|
663
|
+
if not @variables.proposal_approved:
|
|
664
|
+
| Refuse: the proposal stage is not approved. Name that gate and stop.
|
|
665
|
+
| Read proposal.md and the folded capabilities in openspec/specs/. Do not read design.md.
|
|
666
|
+
| Draft one requirement and its scenarios into the delta spec, consuming a folded requirement by reference where one already covers the behaviour.
|
|
667
|
+
|
|
668
|
+
subagent stage_design:
|
|
669
|
+
description: "Scaffold design.md from the proposal and the drafted requirements"
|
|
670
|
+
reasoning:
|
|
671
|
+
instructions: ->
|
|
672
|
+
if not @variables.proposal_approved:
|
|
673
|
+
| Refuse: the proposal stage is not approved. Name that gate and stop.
|
|
674
|
+
| Read proposal.md and the change's drafted requirements.
|
|
675
|
+
| Offer headings, an empty decisions table and empty diagram fences derived from those inputs. Write no decision text.
|
|
676
|
+
|
|
677
|
+
subagent stage_tasks:
|
|
678
|
+
description: "One task per scenario, grouped by capability, each group citing its requirements"
|
|
679
|
+
reasoning:
|
|
680
|
+
instructions: ->
|
|
681
|
+
if not @variables.specs_approved:
|
|
682
|
+
| Refuse: the requirements stage is not approved. Name that gate and stop.
|
|
683
|
+
if not @variables.design_approved:
|
|
684
|
+
| Refuse: the design stage is not approved. Name that gate and stop.
|
|
685
|
+
| Read the change's requirements and scenarios.
|
|
686
|
+
| Offer one task per scenario, grouped by capability, each task carrying its testing row as a continuation line.
|
|
687
|
+
|
|
688
|
+
subagent stage_implemented:
|
|
689
|
+
description: "Explain what archiving does, and write nothing"
|
|
690
|
+
reasoning:
|
|
691
|
+
instructions: ->
|
|
692
|
+
if @variables.tasks_approved:
|
|
693
|
+
| Explain that archiving folds the deltas into openspec/specs/ and moves the change directory, together. Write nothing.
|
|
694
|
+
`,_C=Object.freeze([Object.freeze({id:`proposal-template`,label:`proposal template`,owner:`specsketch-settings-template`}),Object.freeze({id:`agent-script`,label:`agent script`,owner:`specsketch-settings-agentscript`}),Object.freeze({id:`credential`,label:`model credential`,owner:`specsketch-workbench-agent`})]),vC=Object.freeze({proposalTemplate:hC,agentScript:gC});function yC(e,t){switch(t){case`proposal-template`:return{...e,proposalTemplate:hC};case`agent-script`:return{...e,agentScript:gC};case`credential`:return e}}function bC(e){return`Reset ${_C.find(t=>t.id===e)?.label??e} to its default — this tab only`}var xC=`specsketch.workbench.settings`;function SC(e,t=xC){return{read:()=>{let n=e.getItem(t);if(n===null)return vC;try{let e=JSON.parse(n);return{proposalTemplate:typeof e.proposalTemplate==`string`?e.proposalTemplate:vC.proposalTemplate,agentScript:typeof e.agentScript==`string`?e.agentScript:vC.agentScript}}catch{return vC}},write:n=>{e.setItem(t,JSON.stringify(n))}}}function CC(e){let t=VS(e.value);return(0,C.jsxs)(`div`,{className:`settings-two-up`,"data-testid":`settings-panel-proposal-template`,children:[(0,C.jsxs)(`label`,{className:`settings-field`,children:[(0,C.jsxs)(`span`,{className:`settings-field-label`,children:[`Every new `,(0,C.jsx)(`code`,{children:`proposal.md`}),` starts from this. Editing it changes what the`,` `,(0,C.jsx)(`em`,{children:`next`}),` proposal starts from; nothing already written is rewritten.`]}),(0,C.jsx)(`textarea`,{className:`settings-editor`,"data-testid":`template-editor`,"aria-label":`Proposal template`,spellCheck:!1,value:e.value,onChange:t=>e.onChange(t.target.value)})]}),(0,C.jsxs)(`div`,{className:`settings-aside`,children:[(0,C.jsx)(`span`,{className:`workbench-col-label`,children:`sections`}),t.namesNoSection===null?null:(0,C.jsx)(`p`,{className:`settings-report`,"data-testid":`template-names-no-section`,role:`alert`,"data-severity":`warn`,children:t.namesNoSection}),(0,C.jsx)(`ul`,{className:`template-sections`,"data-testid":`template-sections`,children:t.sections.map((e,t)=>(0,C.jsxs)(`li`,{className:`template-section`,"data-testid":`template-section-${t}`,"data-shape":e.shape??`none`,children:[(0,C.jsx)(`span`,{className:`template-section-title`,children:e.title}),(0,C.jsx)(`span`,{className:`template-section-shape`,"data-testid":`template-section-shape-${t}`,children:HS(e.shape)}),e.hint===null?null:(0,C.jsxs)(`span`,{className:`template-section-hint`,"data-testid":`template-section-hint-${t}`,children:[`read from `,(0,C.jsx)(`code`,{children:`<!-- ${e.hint} -->`})]})]},`${e.title}-${t}`))})]})]})}var wC=`a[href], button:not([disabled]), input, textarea, select, [tabindex]:not([tabindex="-1"])`;function TC(e){let[t,n]=(0,_.useState)(`proposal-template`),[r,i]=(0,_.useState)(e.settings),a=(0,_.useRef)(null);(0,_.useEffect)(()=>{a.current?.focus()},[]);let o=r.proposalTemplate!==e.settings.proposalTemplate||r.agentScript!==e.settings.agentScript,s=(0,_.useCallback)(t=>{if(t.key===`Escape`){e.onDismiss();return}if(t.key!==`Tab`)return;let n=[...a.current?.querySelectorAll(wC)??[]];if(n.length===0)return;let r=n[0],i=n[n.length-1],o=document.activeElement;t.shiftKey&&(o===r||o===a.current)?(t.preventDefault(),i.focus()):!t.shiftKey&&o===i&&(t.preventDefault(),r.focus())},[e]);return(0,C.jsx)(`div`,{className:`settings-backdrop`,"data-testid":`settings-backdrop`,onMouseDown:e.onDismiss,children:(0,C.jsxs)(`div`,{className:`settings-dialog`,"data-testid":`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Workbench settings`,tabIndex:-1,ref:a,onKeyDown:s,onMouseDown:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`settings-head`,children:[(0,C.jsx)(`span`,{className:`settings-title`,children:`settings`}),(0,C.jsx)(`button`,{type:`button`,className:`settings-dismiss`,"data-testid":`settings-dismiss`,"aria-label":`Dismiss settings without saving`,onClick:e.onDismiss,children:`close`})]}),(0,C.jsx)(`div`,{className:`settings-tabs`,role:`tablist`,"aria-label":`Settings sections`,children:_C.map(e=>(0,C.jsx)(`button`,{type:`button`,role:`tab`,className:`settings-tab`,"data-testid":`settings-tab-${e.id}`,"aria-selected":t===e.id,"aria-controls":`settings-panel-${e.id}`,onClick:()=>n(e.id),children:e.label},e.id))}),(0,C.jsxs)(`div`,{className:`settings-body`,role:`tabpanel`,id:`settings-panel-${t}`,children:[t===`proposal-template`?(0,C.jsx)(CC,{value:r.proposalTemplate,onChange:e=>i(t=>({...t,proposalTemplate:e}))}):null,t===`agent-script`?(0,C.jsx)(mC,{value:r.agentScript,onChange:e=>i(t=>({...t,agentScript:e}))}):null,t===`credential`?(0,C.jsx)(`div`,{"data-testid":`settings-panel-credential`,children:(0,C.jsx)(de,{machine:e.machine,credential:e.credential,selection:e.selection,onSelect:e.onSelectSource,onClear:e.onClearSelection,onClose:e.onDismiss})}):null]}),(0,C.jsxs)(`div`,{className:`settings-foot`,children:[(0,C.jsx)(`button`,{type:`button`,className:`settings-reset`,"data-testid":`settings-reset`,onClick:()=>{t===`credential`?e.onClearSelection():i(e=>yC(e,t))},children:bC(t)}),(0,C.jsx)(`span`,{className:`settings-dirty`,"data-testid":`settings-unsaved`,"data-state":o?`dirty`:`clean`,children:o?`unsaved changes`:`no unsaved changes`}),(0,C.jsx)(`button`,{type:`button`,className:`settings-save`,"data-testid":`settings-save`,onClick:()=>e.onSave(r),children:`save`})]})]})})}var EC=Object.freeze({kind:`none`});function DC(e){return{kind:`issue`,issue:e}}function OC(e){return e.kind===`issue`?String(e.issue):`none`}var kC=/^---\r?\n([\s\S]*?)\r?\n---/;function AC(e){let t=kC.exec(e)?.[1];if(t===void 0)return{provenance:EC,recorded:!1};for(let e of t.split(`
|
|
695
|
+
`)){let t=/^issue:\s*(.+?)\s*$/.exec(e.trim());if(!t)continue;let n=t[1].replace(/^["']|["']$/g,``).trim();if(n===`none`)return{provenance:EC,recorded:!0};let r=Number.parseInt(n,10);return Number.isFinite(r)?{provenance:DC(r),recorded:!0}:{provenance:EC,recorded:!1}}return{provenance:EC,recorded:!1}}function jC(e,t){let n=`issue: ${OC(t)}`,r=kC.exec(e);if(r===null)return`---\n${n}\n---\n\n${e}`;let i=r[1].split(`
|
|
696
|
+
`),a=i.findIndex(e=>/^issue:/.test(e.trim())),o=a===-1?[...i,n]:i.map((e,t)=>t===a?n:e);return e.replace(kC,`---\n${o.join(`
|
|
697
|
+
`)}\n---`)}function MC(e){return e.recorded?e.provenance.kind===`issue`?`started from issue #${e.provenance.issue}`:"started from no issue — recorded explicitly as `issue: none`":`no provenance is recorded in proposal.md — this is not the same as "no issue"`}function NC(e,t){return jC(e,t)}var PC=class{options;buffers=new Map;outstanding=0;settleMs;schedule;cancel;idle=Promise.resolve();settleIdle=()=>{};constructor(e){this.options=e,this.settleMs=e.settleMs??400,this.schedule=e.schedule??((e,t)=>setTimeout(e,t)),this.cancel=e.cancel??(e=>clearTimeout(e))}edit(e,t){let n=this.buffer(e);n.pending=t,n.timer===null?this.beginWork():this.cancel(n.timer),n.timer=this.schedule(()=>{n.timer=null,this.flushNow(e)},this.settleMs),this.mark(n,e,n.pending===n.persisted?`persisted`:`unsaved`)}async save(e){let t=this.buffers.get(e);if(t){if(t.timer!==null){this.cancel(t.timer),t.timer=null,await this.flushNow(e);return}this.beginWork(),await this.flushNow(e)}}status(e){let t=this.buffers.get(e);return t?{artifact:e,state:t.state,...t.reason===void 0?{}:{reason:t.reason},content:t.pending}:{artifact:e,state:`persisted`,content:``}}statuses(){return[...this.buffers.keys()].map(e=>this.status(e))}async settled(){await this.idle}buffer(e){let t=this.buffers.get(e);if(t)return t;let n={pending:``,persisted:null,state:`persisted`,timer:null,inFlight:!1};return this.buffers.set(e,n),n}async flushNow(e){let t=this.buffer(e);if(t.inFlight){this.endWork();return}t.inFlight=!0;try{for(;;){let n=t.pending;if(n===t.persisted){this.mark(t,e,`persisted`);return}this.mark(t,e,`writing`);let r;try{r=await this.options.write(e,n)}catch(e){r={outcome:`failed`,reason:e instanceof Error?e.message:String(e)}}if(r.outcome===`failed`){t.reason=r.reason,this.mark(t,e,`failed`);return}if(t.persisted=n,t.reason=void 0,t.pending===n){this.mark(t,e,`persisted`);return}}}finally{t.inFlight=!1,this.endWork()}}mark(e,t,n){n!==`failed`&&(e.reason=void 0),e.state=n,this.options.onStatus?.(this.status(t))}beginWork(){this.outstanding===0&&(this.idle=new Promise(e=>{this.settleIdle=e})),this.outstanding+=1}endWork(){--this.outstanding,this.outstanding<=0&&(this.outstanding=0,this.settleIdle())}};function FC(e){switch(e.kind){case`proposal-section`:return`proposal section \`${e.title}\``;case`capability`:return`capability \`${e.capability}\``;case`requirement`:return`requirement \`${e.requirement}\` in \`${e.capability}\``;case`scenario`:return`scenario \`${e.scenario}\` of \`${e.requirement}\` in \`${e.capability}\``;case`task`:return`task ${e.number} (\`${e.title}\`)`;case`design-block`:return`design block ${e.index+1} (\`${e.blockKind}\`)`;case`task-group`:return`task group ${e.number} (\`${e.title}\`)`;case`change`:return`change \`${e.change}\``}}function IC(e){let t=e?.result;if(typeof t!=`object`||!t)return{outcome:`unavailable`,reason:`the host answered with no validity result`};let n=t;return n.outcome===`unavailable`?{outcome:`unavailable`,reason:typeof n.reason==`string`&&n.reason!==``?n.reason:`no reason given`}:n.outcome!==`validated`||typeof n.valid!=`boolean`||!Array.isArray(n.errors)||!Array.isArray(n.warnings)?{outcome:`unavailable`,reason:`the host answered with a validity payload this surface cannot read`}:{outcome:`validated`,valid:n.valid,errors:n.errors,warnings:n.warnings}}function LC(e){switch(e.kind){case`proposal-section`:return`proposal.md`;case`capability`:case`requirement`:case`scenario`:return`specs/${e.capability}/spec.md`;case`design-block`:return`design.md`;case`task`:case`task-group`:return`tasks.md`;case`change`:return null}}function RC(e,t){let n=new Set(e);return t.filter(e=>!n.has(e))}function zC(e){let t=e?.artifacts;return Array.isArray(t)?t.filter(e=>typeof e==`string`):null}function BC(e){let t=e?.result;return t?.outcome===`read`&&typeof t.content==`string`?{content:t.content}:{reason:t?.reason??`\`${t?.outcome??`no outcome`}\``}}async function VC(e,t=e=>fetch(e)){let n=await HC(t),r=null;try{let e=await t(`/api/workbench/artifacts`);r=e.ok?zC(await e.json()):null}catch{r=null}if(r===null)return{validity:n,appeared:[],unreadable:[]};let i=[],a=[];for(let n of RC(e,r))try{let e=BC(await(await t(`/api/workbench/artifact?artifact=${encodeURIComponent(n)}`)).json());`content`in e?i.push({artifact:n,content:e.content}):a.push({artifact:n,reason:e.reason})}catch(e){a.push({artifact:n,reason:e.message})}return{validity:n,appeared:i,unreadable:a}}async function HC(e){try{let t=await e(`/api/workbench/validity`);return t.ok?IC(await t.json()):{outcome:`unavailable`,reason:`the workbench host answered ${t.status} when asked for the change's validity`}}catch(e){return{outcome:`unavailable`,reason:e.message}}}function UC(e){if(e.ctrlKey||e.metaKey||e.altKey||e.typing||e.confirmOpen)return null;if(e.helpOpen)return e.key===`Escape`||e.key===`?`?`close-help`:null;switch(e.key){case`j`:return`next-delta`;case`k`:return`prev-delta`;case`n`:return`next-unviewed`;case`u`:return`prev-unviewed`;case`?`:return`toggle-help`;default:return null}}function WC(e){if(!e)return!1;if(e.isContentEditable)return!0;let t=e.tagName.toUpperCase();if(t===`TEXTAREA`||t===`SELECT`)return!0;if(t!==`INPUT`)return!1;let n=(e.type??`text`).toLowerCase();return n!==`checkbox`&&n!==`radio`&&n!==`button`&&n!==`submit`&&n!==`reset`&&n!==`range`&&n!==`color`&&n!==`file`}function GC(e,t,n){let r=e.length;if(r===0)return null;let i=t=>!n||e[t].unviewed,a=e.findIndex(e=>e.current);if(a===-1){for(let e=0;e<r;e+=1){let n=t===1?e:r-1-e;if(i(n))return n}return null}for(let e=1;e<=r;e+=1){let n=((a+t*e)%r+r)%r;if(i(n))return n}return null}function KC(e){let t=(e.matches(`button, a[href]`)?e:e.querySelector(`button, a[href]`))??e;(t.hasAttribute(`tabindex`)||t.tabIndex>=0)&&t.focus({preventScroll:!0}),e.scrollIntoView({block:`start`})}function qC(e,t,n){let r=Array.from(e.querySelectorAll(`[data-testid="validity-finding"]`)),i=typeof document>`u`?null:document.activeElement,a=GC(r.map(e=>({unviewed:e.dataset.severity===`error`,current:i instanceof Node&&e.contains(i)})),t,n);if(a===null)return null;let o=r[a];return KC(o),o}function JC(){let e=document.querySelector(`.structure-gate`);if(!e)return null;let t=e.querySelector(`.gate-finding, .gate-unsatisfied-link`)??e;return KC(t),t}function YC(e,t){return`${e} ${t}${e===1?``:`s`}`}function XC(e){return e===null||e.outcome===`unavailable`?`unknown`:e.valid?`true`:`false`}function ZC(e){let{finding:t}=e,n=t.severity,r=LC(t.subject),i=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`finding-severity`,children:n}),` `,(0,C.jsx)(`span`,{className:`finding-subject`,children:FC(t.subject)}),` —`,` `,(0,C.jsx)(`span`,{className:`finding-message`,children:t.message})]}),a=`gate-finding gate-${n}`;return r===null||!e.artifacts.includes(r)?(0,C.jsx)(`li`,{className:a,"data-testid":`validity-finding`,"data-severity":n,tabIndex:-1,children:i}):(0,C.jsx)(`li`,{"data-testid":`validity-finding`,"data-severity":n,"data-artifact":r,children:(0,C.jsx)(`button`,{type:`button`,className:a,title:`open ${r}`,onClick:()=>e.onOpenArtifact(r),children:i})})}function QC(e){let{validity:t}=e,n=t?.outcome===`validated`?t.errors:[],r=t?.outcome===`validated`?t.warnings:[];return(0,C.jsxs)(`section`,{className:`structure-gate validity-report`,"data-testid":`validity-report`,"data-valid":XC(t),"data-errors":n.length,"data-warnings":r.length,"aria-label":`validity of this change`,children:[(0,C.jsx)(`p`,{className:`gate-title`,children:`validity`}),t===null?(0,C.jsx)(`p`,{className:`gate-verdict`,"data-testid":`validity-verdict`,children:`reading the change from disk…`}):t.outcome===`unavailable`?(0,C.jsxs)(`p`,{className:`gate-verdict`,"data-testid":`validity-verdict`,role:`alert`,children:[`validity is unavailable — `,t.reason]}):(0,C.jsx)(`p`,{className:`gate-verdict ${t.valid?`gate-ok`:`gate-bad`}`,"data-testid":`validity-verdict`,children:t.valid?`openspec validate --strict: this change is valid`:`openspec validate --strict: ${YC(n.length,`error`)}, ${YC(r.length,`warning`)}`}),n.length>0?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{type:`button`,className:`gate-title gate-count`,"data-testid":`validity-errors-title`,onClick:()=>JC(),children:[`errors (`,n.length,`)`]}),(0,C.jsx)(`ul`,{className:`gate-findings`,"data-testid":`validity-errors`,children:n.map((t,n)=>(0,C.jsx)(ZC,{finding:t,artifacts:e.artifacts,onOpenArtifact:e.onOpenArtifact},`error-${n}`))})]}):null,r.length>0?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`p`,{className:`gate-title`,"data-testid":`validity-warnings-title`,children:[`warnings (`,r.length,`)`]}),(0,C.jsx)(`ul`,{className:`gate-findings`,"data-testid":`validity-warnings`,children:r.map((t,n)=>(0,C.jsx)(ZC,{finding:t,artifacts:e.artifacts,onOpenArtifact:e.onOpenArtifact},`warning-${n}`))}),(0,C.jsxs)(`p`,{className:`gate-note`,"data-testid":`validity-strict-note`,children:[`the repository gate runs `,(0,C.jsx)(`code`,{children:`--strict`}),`, under which a warning is fatal`]})]}):null]})}function $C(e){switch(e.outcome){case`read`:return e.approvals;case`absent`:return{};case`unreadable`:return null}}function ew(e){return Object.fromEntries(Object.keys(e).map(e=>[e,!0]))}function tw(e){return e.outcome===`unreadable`?`The approval store could not be read: ${e.reason}. This is not the same as no approvals having been given — the approvals recorded beside this change are unavailable, and no stage is being shown approved on the strength of a read that failed.`:null}function nw(e){return e.outcome===`failed`?`The approval could not be stored: ${e.reason}. The stage is not approved.`:null}function rw(e){return`${e.replace(/[^a-z0-9]+/gi,`_`)}_approved`}function iw(e,t){return{stage:e,approvedAt:t,variable:rw(e)}}function aw(e=fetch){return{read:async()=>{try{let t=await e(`/api/workbench/approvals`);return(await t.json()).result??{outcome:`unreadable`,reason:`host responded ${t.status}`}}catch(e){return{outcome:`unreadable`,reason:e instanceof Error?e.message:String(e)}}},write:async(t,n)=>{try{let r=await e(`/api/workbench/approvals`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({stage:t,approved:n})});return(await r.json()).result??{outcome:`failed`,reason:`host responded ${r.status}`}}catch(e){return{outcome:`failed`,reason:e instanceof Error?e.message:String(e)}}}}}var ow=[`flowchart`,`flowchart-v2`,`graph`,`sequenceDiagram`,`classDiagram`,`classDiagram-v2`,`stateDiagram`,`stateDiagram-v2`,`erDiagram`,`C4Context`,`C4Container`,`C4Component`,`C4Dynamic`,`C4Deployment`];function sw(e){return ow.includes(e)}function cw(e){let t=e.split(`
|
|
698
|
+
`),n=0;if((t[0]??``).trim()===`---`){let e=t.findIndex((e,t)=>t>0&&e.trim()===`---`);e>0&&(n=e+1)}for(;n<t.length;n+=1){let e=(t[n]??``).trim();if(e===``||e.startsWith(`%%`))continue;let r=(e.split(/[\s(;:]/)[0]??``).trim();return r===``?null:r}return null}function lw(e){let t=cw(e);return t===null?{kind:`undeclared`}:sw(t)?{kind:`drawable`,declared:t}:{kind:`undrawable`,declared:t}}var uw=`modulepreload`,dw=function(e){return`/`+e},fw={},pw=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=dw(t,n),t=s(t),t in fw)return;fw[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:uw,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},mw=null;function hw(e){if(typeof getComputedStyle!=`function`)return;let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return t===``?void 0:t}function gw(){let e={background:hw(`--surface`),primaryColor:hw(`--surface-raised`),primaryTextColor:hw(`--text`),primaryBorderColor:hw(`--border`),secondaryColor:hw(`--surface-2`),tertiaryColor:hw(`--surface-3`),lineColor:hw(`--muted`),textColor:hw(`--text-2`),mainBkg:hw(`--surface-raised`),nodeBorder:hw(`--accent`)},t={darkMode:!0};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}async function _w(){let e=(await pw(()=>import(`./mermaid.core-DQoThCaK.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))).default;return e.initialize({startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,theme:`base`,fontFamily:hw(`--ff-mono`),themeVariables:gw()}),e}function vw(){return mw??=_w(),mw}function yw(e){return e instanceof Error&&e.message!==``?e.message:typeof e==`string`&&e!==``?e:`no cause reported`}var bw=0;function xw({reason:e,dialect:t,label:n,source:r,testId:i}){return(0,C.jsxs)(`div`,{className:`fence-code`,"data-testid":i,"data-reason":e,"data-dialect":t,children:[(0,C.jsx)(`span`,{className:`fence-code-label`,children:n}),(0,C.jsx)(`pre`,{className:`fence-code-body`,children:r})]})}function Sw(e){return t=>{let n=t?.querySelector(`svg`);n&&(n.setAttribute(`role`,`img`),(n.getAttribute(`aria-label`)??``).trim()!==``||(n.getAttribute(`aria-labelledby`)??``).trim()!==``||(n.querySelector(`:scope > title`)?.textContent??``).trim()!==``||n.setAttribute(`aria-label`,`${e} diagram, drawn from the fence`))}}function Cw({code:e,testId:t}){let n=lw(e),r=n.kind===`drawable`?n.declared:null,[i,a]=(0,_.useState)({kind:`loading`});return(0,_.useEffect)(()=>{if(r===null)return;let t=!0;a({kind:`loading`}),bw+=1;let n=`mermaid-render-${bw}`;return vw().then(r=>{r.render(n,e).then(e=>{t&&a({kind:`drawn`,svg:e.svg})},e=>{t&&a({kind:`diagram-parse-error`,cause:yw(e)})})},e=>{t&&a({kind:`mermaid-unavailable`,cause:yw(e)})}),()=>{t=!1}},[e,r]),n.kind===`undrawable`?(0,C.jsx)(xw,{dialect:n.declared,label:`mermaid · ${n.declared} — this renderer does not draw that kind of diagram. Its source is shown unchanged rather than drawn as a different one.`,reason:`undrawable-dialect`,source:e,testId:`fence-code-${t}`}):n.kind===`undeclared`?(0,C.jsx)(xw,{dialect:`(none)`,label:`mermaid — this fence declares no diagram type, so there is nothing to draw yet. Its source is shown unchanged.`,reason:`no-dialect`,source:e,testId:`fence-code-${t}`}):i.kind===`mermaid-unavailable`?(0,C.jsx)(xw,{dialect:n.declared,label:`mermaid · ${n.declared} — mermaid could not be loaded (${i.cause}). The fence is shown as source; nothing was drawn.`,reason:`mermaid-unavailable`,source:e,testId:`fence-code-${t}`}):i.kind===`diagram-parse-error`?(0,C.jsx)(xw,{dialect:n.declared,label:`mermaid · ${n.declared} — this diagram did not parse: ${i.cause}`,reason:`diagram-parse-error`,source:e,testId:`fence-code-${t}`}):i.kind===`loading`?(0,C.jsx)(xw,{dialect:n.declared,label:`mermaid · ${n.declared} — loading the diagram renderer…`,reason:`mermaid-loading`,source:e,testId:`fence-code-${t}`}):(0,C.jsxs)(`figure`,{className:`mermaid-figure`,"data-testid":`mermaid-diagram-${t}`,"data-dialect":n.declared,"data-reason":`drawn`,children:[(0,C.jsx)(`div`,{className:`mermaid-figure-body`,ref:Sw(n.declared),dangerouslySetInnerHTML:{__html:i.svg}}),(0,C.jsxs)(`figcaption`,{className:`mermaid-caption`,children:[n.declared,` · drawn from the fence`]})]})}var ww=/(`[^`\n]+`|(?<!!)\[[^\]\n]*\]\([^()\s]*\)|\*\*[^*\n]+\*\*|\*[^*\n]+\*)/g,Tw=/^\[([^\]\n]*)\]\(([^()\s]*)\)$/;function Ew(e){let t=[];for(let n of e.split(ww)){if(n===``)continue;if(n.length>=3&&n.startsWith("`")&&n.endsWith("`")){t.push({kind:`code-span`,text:n.slice(1,-1)});continue}if(n.length>=5&&n.startsWith(`**`)&&n.endsWith(`**`)){t.push({kind:`strong`,text:n.slice(2,-2)});continue}let e=Tw.exec(n);if(e){t.push({kind:`link`,text:e[1]??``,href:e[2]??``});continue}if(n.length>=3&&n.startsWith(`*`)&&n.endsWith(`*`)){t.push({kind:`emphasis`,text:n.slice(1,-1)});continue}t.push({kind:`text`,text:n})}return t}var Dw=/^ {0,3}<(?:[A-Za-z][A-Za-z0-9-]*|\/[A-Za-z]|!|\?)/,Ow=/^ {0,3}=+[ \t]*$/,kw=/^ {0,3}\[\^[^\]]+\]:/,Aw=/^ {0,3}:[ \t]+\S/,jw=/^ {0,3}\$\$[ \t]*$/,Mw=/^(?: {4}|\t)\S/,Nw=/^[ \t]*$/;function Pw(e,t){let n=t+1;for(;n<e.length&&!Nw.test(e[n]??``);)n+=1;return n}var Fw=[{construct:`frontmatter`,label:`YAML frontmatter`,match:(e,t)=>{if(t!==0||(e[0]??``)!==`---`)return null;let n=e.indexOf(`---`,1);return n>0?n+1:null}},{construct:`html-block`,label:`inline HTML`,match:(e,t)=>Dw.test(e[t]??``)?Pw(e,t):null},{construct:`math-block`,label:`a $$…$$ math block`,match:(e,t)=>{if(!jw.test(e[t]??``))return null;let n=t+1;for(;n<e.length&&!jw.test(e[n]??``);)n+=1;return Math.min(n+1,e.length)}},{construct:`footnote-definition`,label:`a footnote definition`,match:(e,t)=>kw.test(e[t]??``)?Pw(e,t):null},{construct:`definition-list`,label:`a definition list`,match:(e,t)=>Aw.test(e[t]??``)?Pw(e,t):null},{construct:`indented-code-block`,label:`an indented code block`,match:(e,t)=>{if(!Mw.test(e[t]??``))return null;let n=t+1;for(;n<e.length&&(Mw.test(e[n]??``)||Nw.test(e[n]??``));)n+=1;for(;n>t+1&&Nw.test(e[n-1]??``);)--n;return n}},{construct:`setext-heading`,label:`a setext heading`,match:(e,t)=>{let n=e[t]??``;if(Nw.test(n)||Ow.test(n))return null;let r=t+1;for(;r<e.length&&!Nw.test(e[r]??``)&&!Ow.test(e[r]??``);)r+=1;return r<e.length&&Ow.test(e[r]??``)?r+1:null}}];function Iw(e,t){for(let n of Fw){let r=n.match(e,t);if(r!==null&&r>t)return{probe:n,end:r}}return null}var Lw=/^[ \t]*$/,Rw=/^ {0,3}(#{1,6})[ \t]+(.*?)[ \t]*#*[ \t]*$/,zw=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,Bw=/^ {0,3}```(.*)$/,Vw=/^ {0,3}```[ \t]*$/,Hw=/^ {0,3}[-*+][ \t]+(.*)$/,Uw=/^ {0,3}\d{1,9}[.)][ \t]+(.*)$/,Ww=/^\[([ xX])\][ \t]*(.*)$/,Gw=/^ {0,3}> ?(.*)$/,Kw=/^ {0,3}\|/,qw=/^ {0,3}\|(?:[ \t]*:?-+:?[ \t]*\|)+[ \t]*$/,Jw=/^(?: +|\t)\S/;function Yw(e){return e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim())}function Xw(e){let t=e.split(`
|
|
699
|
+
`),n=[],r=0,i=(e,r,i)=>{n.push({...i,span:{start:e,end:r},source:t.slice(e,r).join(`
|
|
700
|
+
`)})};for(;r<t.length;){let e=t[r]??``;if(Lw.test(e)){r+=1;continue}let n=Iw(t,r);if(n){i(r,n.end,{kind:`unsupported`,construct:n.probe.construct,label:n.probe.label}),r=n.end;continue}let a=Bw.exec(e);if(a){let e=r+1;for(;e<t.length&&!Vw.test(t[e]??``);)e+=1;let n=e<t.length;i(r,n?e+1:e,{kind:`code`,info:(a[1]??``).trim(),body:t.slice(r+1,e).join(`
|
|
701
|
+
`),closed:n}),r=n?e+1:e;continue}let o=Rw.exec(e);if(o){i(r,r+1,{kind:`heading`,level:(o[1]??`#`).length,content:Ew(o[2]??``)}),r+=1;continue}if(zw.test(e)){i(r,r+1,{kind:`thematic-break`}),r+=1;continue}if(Gw.test(e)){let e=r,n=[];for(;r<t.length;){let e=Gw.exec(t[r]??``);if(!e)break;n.push(Ew(e[1]??``)),r+=1}i(e,r,{kind:`blockquote`,lines:n});continue}if(Kw.test(e)&&qw.test(t[r+1]??``)){let n=r,a=Yw(e).map(Ew);r+=2;let o=[];for(;r<t.length&&Kw.test(t[r]??``);)o.push(Yw(t[r]??``).map(Ew)),r+=1;i(n,r,{kind:`table`,head:a,rows:o});continue}let s=Hw.exec(e),c=s?null:Uw.exec(e);if(s||c){let e=r,n=c!==null,a=[];for(;r<t.length;){let e=t[r]??``,i=n?Uw.exec(e):Hw.exec(e);if(!i||zw.test(e))break;let o=i[1]??``,s=Ww.exec(o);r+=1;let c=[];for(;r<t.length&&Jw.test(t[r]??``);)c.push(Ew((t[r]??``).trim())),r+=1;a.push({checked:s?(s[1]??` `)!==` `:null,content:Ew(s?s[2]??``:o),continuations:c})}i(e,r,{kind:`list`,ordered:n,items:a});continue}let l=r,u=[];for(;r<t.length;){let e=t[r]??``;if(Lw.test(e)||r>l&&(Rw.test(e)||Bw.test(e)||zw.test(e)||Gw.test(e)||Hw.test(e)||Uw.test(e)||Kw.test(e)&&qw.test(t[r+1]??``)||Iw(t,r)!==null))break;u.push(Ew(e)),r+=1}i(l,r,{kind:`paragraph`,lines:u})}return n}function Zw({spans:e,keyBase:t}){return(0,C.jsx)(C.Fragment,{children:e.map((e,n)=>{let r=`${t}-${n}`;switch(e.kind){case`code-span`:return(0,C.jsx)(`code`,{children:e.text},r);case`strong`:return(0,C.jsx)(`strong`,{children:e.text},r);case`emphasis`:return(0,C.jsx)(`em`,{children:e.text},r);case`link`:return(0,C.jsx)(`a`,{href:e.href,rel:`noreferrer`,target:`_blank`,children:e.text},r);case`text`:return(0,C.jsx)(`span`,{children:e.text},r)}})})}function Qw({item:e,keyBase:t}){let n=(0,C.jsxs)(C.Fragment,{children:[e.checked===null?null:(0,C.jsx)(`input`,{checked:e.checked,className:`md-task-box`,readOnly:!0,type:`checkbox`}),(0,C.jsx)(Zw,{keyBase:t,spans:e.content}),e.continuations.map((e,n)=>(0,C.jsx)(`span`,{className:`md-task-continuation`,"data-testid":`${t}-cont-${n}`,children:(0,C.jsx)(Zw,{keyBase:`${t}-c${n}`,spans:e})},n))]});return(0,C.jsx)(`li`,{className:e.checked===null?void 0:`md-task`,"data-testid":t,children:n})}function $w(e,t){switch(e.kind){case`heading`:return(0,C.jsx)(`h${Math.min(6,Math.max(1,e.level))}`,{children:(0,C.jsx)(Zw,{keyBase:`h${t}`,spans:e.content})},t);case`paragraph`:return(0,C.jsx)(`p`,{children:e.lines.map((e,n)=>(0,C.jsxs)(_.Fragment,{children:[n===0?null:` `,(0,C.jsx)(Zw,{keyBase:`p${t}-${n}`,spans:e})]},n))},t);case`thematic-break`:return(0,C.jsx)(`hr`,{},t);case`blockquote`:return(0,C.jsx)(`blockquote`,{children:e.lines.map((e,n)=>(0,C.jsx)(`div`,{className:`md-quote-line`,children:(0,C.jsx)(Zw,{keyBase:`q${t}-${n}`,spans:e})},n))},t);case`list`:return(0,C.jsx)(e.ordered?`ol`:`ul`,{children:e.items.map((e,n)=>(0,C.jsx)(Qw,{item:e,keyBase:`li${t}-${n}`},n))},t);case`code`:return e.info.split(/\s+/)[0]===`mermaid`&&e.closed?(0,C.jsx)(Cw,{code:e.body,testId:`b${t}`},t):(0,C.jsx)(`pre`,{className:`md-code`,"data-info":e.info===``?void 0:e.info,children:e.body},t);case`table`:return(0,C.jsx)(`div`,{className:`md-table-scroll`,children:(0,C.jsxs)(`table`,{children:[(0,C.jsx)(`thead`,{children:(0,C.jsx)(`tr`,{children:e.head.map((e,n)=>(0,C.jsx)(`th`,{children:(0,C.jsx)(Zw,{keyBase:`th${t}-${n}`,spans:e})},n))})}),(0,C.jsx)(`tbody`,{children:e.rows.map((e,n)=>(0,C.jsx)(`tr`,{children:e.map((e,r)=>(0,C.jsx)(`td`,{children:(0,C.jsx)(Zw,{keyBase:`td${t}-${n}-${r}`,spans:e})},r))},n))})]})},t);case`unsupported`:return(0,C.jsxs)(`div`,{className:`md-unsupported`,"data-construct":e.construct,children:[(0,C.jsxs)(`span`,{className:`md-unsupported-label`,children:[e.label,` — outside the set this renderer draws, shown as its own source`]}),(0,C.jsx)(`pre`,{className:`md-unsupported-body`,children:e.source})]},t)}}function eT({source:e}){return(0,C.jsx)(`div`,{className:`markdown`,children:Xw(e).map($w)})}function tT(e){return e.replace(/[/.]/g,`-`)}var nT={persisted:`saved to disk`,unsaved:`unsaved edits`,writing:`saving…`,failed:`unsaved — the last save failed`};function rT(e){let{artifact:t,content:n,readOnly:r,panes:i}=e;return(0,C.jsxs)(`section`,{className:`document`,"data-testid":`document`,"data-artifact":t,children:[(0,C.jsxs)(`header`,{className:`document-header`,children:[(0,C.jsx)(`h2`,{className:`document-title`,"data-testid":`open-artifact`,children:t}),r?(0,C.jsxs)(`span`,{className:`chip chip-readonly`,"data-testid":`readonly-chip`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`🔒 `}),`read only`]}):null,(0,C.jsxs)(`div`,{className:`pane-toggles`,role:`group`,"aria-label":`panes`,children:[(0,C.jsxs)(`label`,{className:`pane-toggle`,children:[(0,C.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-source`,checked:i.source,onChange:()=>e.onTogglePane(`source`)}),`markdown source`]}),(0,C.jsxs)(`label`,{className:`pane-toggle`,children:[(0,C.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-preview`,checked:i.preview,onChange:()=>e.onTogglePane(`preview`)}),`rendered preview`]})]})]}),e.paneRefusal===null?null:(0,C.jsx)(`p`,{className:`pane-refusal`,"data-testid":`pane-refusal`,role:`alert`,children:e.paneRefusal}),e.status!==null&&!r?(0,C.jsx)(`p`,{className:`buffer-state`,"data-testid":`buffer-state-${tT(t)}`,"data-state":e.status.state,children:nT[e.status.state]}):null,e.status?.state===`failed`&&e.status.reason!==void 0?(0,C.jsx)(`p`,{className:`buffer-report`,"data-testid":`buffer-report-${tT(t)}`,"data-outcome":`refused`,role:`alert`,children:e.status.reason}):null,e.conflict===null?null:(0,C.jsxs)(`div`,{className:`conflict`,"data-testid":`conflict-${tT(t)}`,role:`alertdialog`,"aria-label":`${t} changed underneath your edits`,children:[(0,C.jsx)(`p`,{className:`conflict-reason`,children:e.conflict}),(0,C.jsxs)(`div`,{className:`conflict-choices`,children:[(0,C.jsx)(`button`,{type:`button`,"data-testid":`conflict-overwrite-${tT(t)}`,onClick:()=>e.onResolveConflict(`overwrite`),children:`overwrite the file with my edits`}),(0,C.jsx)(`button`,{type:`button`,"data-testid":`conflict-discard-${tT(t)}`,onClick:()=>e.onResolveConflict(`discard`),children:`discard my edits and reload the file`})]})]}),(0,C.jsxs)(`div`,{className:`panes`,"data-testid":`panes`,children:[i.source?(0,C.jsx)(`div`,{className:`pane pane-source`,"data-testid":`pane-source`,children:(0,C.jsx)(`textarea`,{className:`source-editor`,"data-testid":`source-editor`,"aria-label":`markdown source of ${t}`,value:n,readOnly:r,onChange:t=>{r||e.onEdit(t.target.value)}})}):null,i.preview?(0,C.jsx)(`div`,{className:`pane pane-preview`,"data-testid":`pane-preview`,children:(0,C.jsx)(eT,{source:n})}):null]})]})}function iT(e,t){return e[t]&&!(t===`source`?e.preview:e.source)?{panes:e,refusal:`The ${t===`source`?`markdown source`:`rendered preview`} pane is the only one open. Closing it would leave the workbench showing neither the source nor the rendering of this file, so it stays open.`}:{panes:{...e,[t]:!e[t]},refusal:null}}var aT=Object.freeze({name:`spec-driven`,artifacts:Object.freeze([Object.freeze({id:`proposal`,generates:`proposal.md`,requires:Object.freeze([])}),Object.freeze({id:`specs`,generates:`specs/**/*.md`,requires:Object.freeze([`proposal`])}),Object.freeze({id:`design`,generates:`design.md`,requires:Object.freeze([`proposal`])}),Object.freeze({id:`tasks`,generates:`tasks.md`,requires:Object.freeze([`specs`,`design`])})])});function oT(e){for(let t of e.split(`
|
|
702
|
+
`)){let e=t.trim();if(e.startsWith(`#`))continue;let n=/^schema:\s*(?:"([^"]*)"|'([^']*)'|([^\s#]+))\s*(?:#.*)?$/.exec(e);if(!n)continue;let r=(n[1]??n[2]??n[3]??``).trim();return r===``?null:r}return null}function sT(e,t=[aT]){let n=oT(e);if(n===null)return{kind:`unknown-schema`,name:``};let r=t.find(e=>e.name===n);return r?{kind:`resolved`,schema:r}:{kind:`unknown-schema`,name:n}}var cT={proposal:`Proposal`,specs:`Requirements`,design:`Design`,tasks:`Tasks`};function lT(e){return cT[e]??e}function uT(e,t){let n=t[e];return n===void 0?`unknown`:n?`complete`:`incomplete`}function dT(e,t){let n=(e.kind===`resolved`?e.schema.artifacts:[]).map((e,n)=>{let r=e.requires.filter(e=>t.approvals[e]!==!0),i=t.approvals[e.id]===!0,a=uT(e.id,t.completion);return{id:e.id,label:lT(e.id),ordinal:n+1,requires:e.requires,approved:i,completion:a,artifactMissing:i&&a!==`complete`,locked:r.length>0,blockedBy:r}});return{schemaName:e.kind===`resolved`?e.schema.name:e.name,schemaKnown:e.kind===`resolved`,stages:n,implemented:t.facts.implemented,archived:t.facts.archived,everyStageExited:n.length>0&&n.every(e=>e.approved)&&t.facts.implemented}}function fT(e,t){let n=e.blockedBy.map(e=>`\`${lT(e)}\``),r=n.length===1?`${n[0]} is not approved`:`${n.slice(0,-1).join(`, `)} and ${n[n.length-1]} are not approved`,i=e.blockedBy.map(e=>`\`${e}\``).join(`, `);return`\`${e.label}\` is locked: ${r}. This change's own \`.openspec.yaml\` names the \`${t.schemaName}\` schema, and that schema declares \`${e.id}\` requires ${i}. Approve ${n.join(` and `)} to unlock it.`}function pT(e,t){if(e.everyStageExited)return{kind:`ready-to-archive`,label:`ready to archive`};let n=e.stages.find(e=>e.id===t)??e.stages[0];return n?n.approved&&n.ordinal===e.stages.length&&!e.implemented?{kind:`implement`,stage:n.id,label:`Mark implemented`}:{kind:`approve`,stage:n.id,label:`Approve ${n.label.toLowerCase()}`}:{kind:`ready-to-archive`,label:`ready to archive`}}function mT(e,t,n){let r=dT(e,t);return dT(e,{...t,approvals:{...t.approvals,[n]:!0}}).stages.filter(e=>!e.locked&&r.stages.find(t=>t.id===e.id)?.locked===!0)}var hT=`# specsketch-workbench-shell Specification
|
|
703
|
+
|
|
704
|
+
## Purpose
|
|
705
|
+
The shell the specsketch workbench presents: the change navigated as its own directory tree, with a second read-only root for the folded capabilities, because requirements are drafted against them. One artifact is open at a time, shown as markdown source and rendered preview through two independent pane toggles — turning off the last active pane is refused rather than leaving an empty workbench. Owns provenance recorded including its explicit absence, booting from the repository rather than a fixture, and the display of the change lifecycle as its schema defines it — stages derived from the change's own \`.openspec.yaml\` rather than hardcoded, with \`archived\` presented as following \`implemented\`.
|
|
706
|
+
|
|
707
|
+
**The one-scrolling-document model is retired**, along with the third "structured" view: markdown *is* the structured view, and a stage rail with gates is a completion gate of exactly the kind that model refused to have.
|
|
708
|
+
|
|
709
|
+
## Requirements
|
|
710
|
+
|
|
711
|
+
### Requirement: Provenance Is Recorded, Including Its Absence
|
|
712
|
+
|
|
713
|
+
The workbench SHALL record the issue a change originated from, or SHALL record explicitly
|
|
714
|
+
that it originated from none, and SHALL write that provenance into \`proposal.md\` frontmatter.
|
|
715
|
+
The absence of an issue SHALL be written as an explicit value; the key SHALL NOT be omitted,
|
|
716
|
+
because an omitted key and a deliberate "no issue" are different facts and a reader cannot
|
|
717
|
+
tell them apart.
|
|
718
|
+
|
|
719
|
+
#### Scenario: A change started from an issue
|
|
720
|
+
- **WHEN** the author attaches issue 212 as the starting context
|
|
721
|
+
- **THEN** the emitted frontmatter carries \`issue: 212\`
|
|
722
|
+
- **AND** the issue remains displayed above the document for the session
|
|
723
|
+
|
|
724
|
+
#### Scenario: A change started from nothing
|
|
725
|
+
- **WHEN** the author starts with no issue
|
|
726
|
+
- **THEN** the emitted frontmatter carries \`issue: none\`
|
|
727
|
+
- **AND** the provenance strip states that there is no issue rather than being hidden
|
|
728
|
+
|
|
729
|
+
### Requirement: The Change Lifecycle Is Displayed As Its Schema Defines It
|
|
730
|
+
|
|
731
|
+
The workbench SHALL display the change's lifecycle as the ordered stages its schema defines —
|
|
732
|
+
for the default \`spec-driven\` schema, the artifacts \`proposal\`, \`specs\`, \`design\`, \`tasks\`,
|
|
733
|
+
followed by \`implemented\` and \`archived\` — and SHALL show which stage the change currently
|
|
734
|
+
occupies.
|
|
735
|
+
|
|
736
|
+
The workbench SHALL derive artifact completion and its blocking dependencies from the change
|
|
737
|
+
itself rather than assuming a fixed set, so a change created under a different schema is
|
|
738
|
+
displayed as that schema defines it and not as the default one.
|
|
739
|
+
|
|
740
|
+
\`archived\` SHALL be presented as following \`implemented\`. The workbench SHALL NOT present a
|
|
741
|
+
stage in which a change's deltas are folded before its code exists — that was the superseded
|
|
742
|
+
apply-first lifecycle, and displaying it would tell the author a fold is due when it is not.
|
|
743
|
+
|
|
744
|
+
\`implemented\` and \`archived\` SHALL be carried as two independent facts, never derived from one
|
|
745
|
+
another and never merged into a single stage counter. A change may be implemented and not
|
|
746
|
+
archived, and the display SHALL be able to say so. Validity SHALL be computed from the change as
|
|
747
|
+
it currently stands rather than from a recorded validator run, so a change that is valid right
|
|
748
|
+
now counts as validated without the author having to re-run anything to be told so.
|
|
749
|
+
|
|
750
|
+
#### Scenario: A change part-way through its artifacts
|
|
751
|
+
- **WHEN** a change has a proposal and specs but no tasks
|
|
752
|
+
- **THEN** the completed artifacts are shown complete, \`tasks\` is shown incomplete, and the change is not shown as archivable
|
|
753
|
+
|
|
754
|
+
#### Scenario: An implemented change that is not yet archived
|
|
755
|
+
- **WHEN** a change's artifacts are complete and its code is built
|
|
756
|
+
- **THEN** \`implemented\` is shown reached and \`archived\` is shown not reached
|
|
757
|
+
|
|
758
|
+
#### Scenario: A change created under another schema
|
|
759
|
+
- **WHEN** a change's \`.openspec.yaml\` names a schema other than the default
|
|
760
|
+
- **THEN** the stages displayed are that schema's artifacts, not the default schema's
|
|
761
|
+
|
|
762
|
+
#### Scenario: Implemented and archived are two facts, not one counter
|
|
763
|
+
- **WHEN** a change's code is built but its deltas are not folded
|
|
764
|
+
- **THEN** \`implemented\` is shown reached and \`archived\` is shown not reached, from two independent facts
|
|
765
|
+
|
|
766
|
+
### Requirement: The Shell Boots From The Repository, Not A Fixture
|
|
767
|
+
|
|
768
|
+
The shell SHALL take its initial state from the host, so that what the author sees on open is
|
|
769
|
+
the repository they launched in. The demo fixture SHALL remain available for the browser
|
|
770
|
+
scenarios and SHALL be selected explicitly, never as a fallback when the host is unreachable.
|
|
771
|
+
|
|
772
|
+
A host that cannot be reached SHALL surface as an error. Falling back to the fixture would put
|
|
773
|
+
demo content in front of an author who asked for their repository, and it would look exactly
|
|
774
|
+
like a successful start.
|
|
775
|
+
|
|
776
|
+
What the shell takes from the host on open is both of its roots — the change directory being
|
|
777
|
+
authored and the read-only folded root under \`openspec/specs/\` — together with the change's
|
|
778
|
+
provenance. The folded root replaces the capability chooser this requirement previously named:
|
|
779
|
+
choosing a capability to open a working copy of was a control of the derivation model, and
|
|
780
|
+
under this change \`openspec/specs/\` is reference the author reads rather than a set of things
|
|
781
|
+
they pick from.
|
|
782
|
+
|
|
783
|
+
#### Scenario: The shell opens on repository state
|
|
784
|
+
- **WHEN** the shell starts with a reachable host
|
|
785
|
+
- **THEN** both roots of its tree and its provenance come from the repository, not the fixture
|
|
786
|
+
|
|
787
|
+
#### Scenario: An unreachable host is an error, not a silent fixture
|
|
788
|
+
- **WHEN** the shell starts and the host cannot be reached
|
|
789
|
+
- **THEN** the shell reports that it could not reach the host
|
|
790
|
+
- **AND** it does not fall back to fixture data
|
|
791
|
+
|
|
792
|
+
### Requirement: The Tree Presents Two Roots — The Change And The Folded Specs
|
|
793
|
+
|
|
794
|
+
The workbench SHALL present a navigation tree carrying exactly two roots: the change directory
|
|
795
|
+
being authored, which is writable, and \`openspec/specs/\`, which is read-only. Each root SHALL
|
|
796
|
+
have the shape OpenSpec actually keeps on disk — files, and capability directories each holding
|
|
797
|
+
a \`spec.md\` — and SHALL NOT carry children below file level. A file is the unit the workbench
|
|
798
|
+
opens, so a node beneath one would name something the author cannot open.
|
|
799
|
+
|
|
800
|
+
The folded root exists because requirements are drafted against the capabilities already
|
|
801
|
+
folded, and both the author and the agent read them while drafting. Opening a node beneath it
|
|
802
|
+
SHALL present that file read-only: marked read-only in the pane and refusing input, rather than
|
|
803
|
+
accepting edits it will not save. \`openspec/specs/\` SHALL NOT be presented as a working copy —
|
|
804
|
+
nothing under it is editable, and nothing the author does to the change writes into it.
|
|
805
|
+
|
|
806
|
+
Every node SHALL carry a status summary computed from the buffer's current content rather than
|
|
807
|
+
entered or cached: a spec file SHALL report how many \`### Requirement:\` blocks its buffer
|
|
808
|
+
holds, and \`tasks.md\` SHALL report its completed and total checkbox counts. Editing the
|
|
809
|
+
markdown SHALL move the summary in the same interaction, without a refresh, because a summary
|
|
810
|
+
computed from anything but the buffer can disagree with the text beside it.
|
|
811
|
+
|
|
812
|
+
Selecting a node SHALL open that file and SHALL mark the node current. A directory node SHALL
|
|
813
|
+
be collapsible, and collapsing SHALL change nothing on disk.
|
|
814
|
+
|
|
815
|
+
The workbench SHALL present exactly one file at a time and SHALL NOT present the change as one
|
|
816
|
+
concatenated document. A change is four separate files that OpenSpec reads separately; joining
|
|
817
|
+
them puts the author's cursor in a document that does not exist and obscures which file a given
|
|
818
|
+
edit lands in.
|
|
819
|
+
|
|
820
|
+
#### Scenario: Selecting a node opens its file
|
|
821
|
+
- **WHEN** the author selects the tree node for \`design.md\`
|
|
822
|
+
- **THEN** that file is opened in the workbench and the node is marked current
|
|
823
|
+
|
|
824
|
+
#### Scenario: A badge follows the buffer
|
|
825
|
+
- **WHEN** the author adds a \`### Requirement:\` block to an open delta spec
|
|
826
|
+
- **THEN** that file's node reports one more requirement, in the same interaction and without a refresh
|
|
827
|
+
|
|
828
|
+
#### Scenario: The folded root opens read-only
|
|
829
|
+
- **WHEN** the author opens a \`spec.md\` under \`openspec/specs/\`
|
|
830
|
+
- **THEN** it is presented as read-only and refuses input
|
|
831
|
+
- **AND** nothing the author does in the workbench writes into \`openspec/specs/\`
|
|
832
|
+
- **AND** it is not offered as one of the change's own artifacts
|
|
833
|
+
|
|
834
|
+
#### Scenario: The body holds one file, not a concatenation
|
|
835
|
+
- **WHEN** the author opens an artifact of the change
|
|
836
|
+
- **THEN** that file alone is presented, and the change's other artifacts are not joined into it
|
|
837
|
+
|
|
838
|
+
#### Scenario: A checkbox count ignores continuation lines
|
|
839
|
+
- **WHEN** \`tasks.md\` holds tasks whose testing rows are continuation lines
|
|
840
|
+
- **THEN** the node's completed and total counts count the tasks and not the continuations
|
|
841
|
+
|
|
842
|
+
#### Scenario: Collapsing changes nothing on disk
|
|
843
|
+
- **WHEN** the author collapses the change's \`specs/\` directory
|
|
844
|
+
- **THEN** the change directory on disk is unchanged
|
|
845
|
+
|
|
846
|
+
### Requirement: Every File Surface Offers Independent Source And Preview Panes
|
|
847
|
+
|
|
848
|
+
Each file the workbench opens SHALL offer two panes over one buffer: a **markdown source** pane
|
|
849
|
+
showing the exact bytes the file holds, and a **rendered preview** pane showing the file as a
|
|
850
|
+
reader reads it. The two SHALL toggle independently, so either alone and both together are
|
|
851
|
+
states the author can choose, and both SHALL be projections of the one buffer — turning a pane
|
|
852
|
+
on or off SHALL NOT change a byte.
|
|
853
|
+
|
|
854
|
+
Turning off the last active pane SHALL be refused rather than performed. A workbench showing
|
|
855
|
+
neither the source nor the rendering of the open file shows nothing at all, and an author who
|
|
856
|
+
reaches that state has no way to tell an empty file from a hidden one.
|
|
857
|
+
|
|
858
|
+
There SHALL NOT be a third, structured authoring view. The markdown *is* the structured view:
|
|
859
|
+
its headings are the structure OpenSpec reads, and a surface projecting them into fields is a
|
|
860
|
+
second model of the same file that must then be kept in step with it.
|
|
861
|
+
|
|
862
|
+
#### Scenario: The source pane is the bytes on disk
|
|
863
|
+
- **WHEN** the author opens the source pane of a saved \`proposal.md\`
|
|
864
|
+
- **THEN** the displayed text is byte-identical to the file's content on disk
|
|
865
|
+
|
|
866
|
+
#### Scenario: Toggling a pane preserves the buffer
|
|
867
|
+
- **WHEN** the author turns the preview off and on again
|
|
868
|
+
- **THEN** the buffer and the bytes it would save are unchanged
|
|
869
|
+
|
|
870
|
+
#### Scenario: The last pane cannot be closed
|
|
871
|
+
- **WHEN** only the source pane is active and the author turns it off
|
|
872
|
+
- **THEN** the action is refused and the pane stays open
|
|
873
|
+
`,gT=`# specsketch-workbench-agent Specification
|
|
874
|
+
|
|
875
|
+
## Purpose
|
|
876
|
+
The agent rail of the specsketch workbench: a docked container scoped to the file currently in focus, which drafts and never commits. Owns the rule that every agent output reaches the change only through an explicit apply and only through the same path a human edit takes — so no second path into the delta set exists — together with source reporting on every answer and a read-only repository profile proven by the absence of a write tool rather than by instruction.
|
|
877
|
+
|
|
878
|
+
## Requirements
|
|
879
|
+
|
|
880
|
+
### Requirement: The Agent Is A Docked Rail Scoped To The Focused File
|
|
881
|
+
|
|
882
|
+
The workbench SHALL offer an agent rail as one docked container **beneath** the change
|
|
883
|
+
document, spanning the full width of the frame, openable and closable at every viewport width
|
|
884
|
+
and resizable by a live handle between a minimum height that still shows a message and a
|
|
885
|
+
maximum that leaves the document usable. Docking it below rather than beside the document is
|
|
886
|
+
what lets the document keep its full width at every size. Below a narrow breakpoint it SHALL
|
|
887
|
+
overlay the document rather than taking height from it, so the document never loses its area to
|
|
888
|
+
the rail.
|
|
889
|
+
|
|
890
|
+
The rail SHALL report which file of the change it is currently scoped to, and its offered
|
|
891
|
+
prompts SHALL be those relevant to that file. Focusing a different file SHALL re-scope the
|
|
892
|
+
rail. The rail SHALL be reachable from every surface without leaving that surface.
|
|
893
|
+
|
|
894
|
+
Scope SHALL be total: every surface the author can focus SHALL resolve to exactly one reported
|
|
895
|
+
scope, so the rail is never scoped to nothing. Where a surface is a container rather than a
|
|
896
|
+
file — a directory node, which stands over the files beneath it rather than being one — the
|
|
897
|
+
rail SHALL resolve to the first file beneath it, because that is the file the directory
|
|
898
|
+
actually stands over. Where a directory holds no file, and for any surface the map does not
|
|
899
|
+
recognise, the rail SHALL resolve to \`proposal.md\`: the one file every change has.
|
|
900
|
+
|
|
901
|
+
#### Scenario: Scope follows focus
|
|
902
|
+
- **WHEN** the author moves from \`proposal.md\` to a delta spec of the change
|
|
903
|
+
- **THEN** the rail reports the new scope and offers prompts relevant to it
|
|
904
|
+
|
|
905
|
+
#### Scenario: The rail is a drawer on a narrow viewport
|
|
906
|
+
- **WHEN** the viewport is below the narrow breakpoint
|
|
907
|
+
- **THEN** the rail overlays the document rather than taking height from it, and the document keeps its full width
|
|
908
|
+
|
|
909
|
+
#### Scenario: A container surface resolves to a definite scope
|
|
910
|
+
- **WHEN** focus is on the change's \`specs/\` directory node rather than a file beneath it
|
|
911
|
+
- **THEN** the rail reports a definite scope rather than none
|
|
912
|
+
|
|
913
|
+
### Requirement: Every Agent Mutation Is Applied By The Author, Never Written Directly
|
|
914
|
+
|
|
915
|
+
The agent SHALL NOT write into the change. Anything it produces — proposal prose, a mermaid
|
|
916
|
+
fence, a requirement written into a delta spec, a task group — SHALL be presented as a proposed
|
|
917
|
+
change carrying an explicit accept action, and SHALL reach the file only when the author
|
|
918
|
+
invokes that action. Declining SHALL remove the proposal and write nothing. There SHALL be no
|
|
919
|
+
path by which agent output enters the change without that step.
|
|
920
|
+
|
|
921
|
+
Agent-authored content SHALL enter through the same buffer a human edit writes to. A
|
|
922
|
+
requirement the agent drafts SHALL be applied as an edit to the delta spec's own buffer, and
|
|
923
|
+
SHALL then be exactly as visible, editable and revertible as one the author typed. The agent
|
|
924
|
+
SHALL NOT hold a second representation of the change from which files are produced, because a
|
|
925
|
+
second path into the change is a second source of truth.
|
|
926
|
+
|
|
927
|
+
#### Scenario: Output requires an explicit apply
|
|
928
|
+
- **WHEN** the agent proposes a mermaid fence for \`design.md\`
|
|
929
|
+
- **THEN** \`design.md\` is unchanged until the author accepts it, and unchanged if they decline
|
|
930
|
+
|
|
931
|
+
#### Scenario: A drafted requirement derives like a human edit
|
|
932
|
+
- **WHEN** the agent's proposal to add a requirement is accepted
|
|
933
|
+
- **THEN** the requirement is written into the delta spec's buffer through the same path a human edit takes
|
|
934
|
+
- **AND** no content reaches the change by any other path
|
|
935
|
+
|
|
936
|
+
### Requirement: The Agent Reports What It Read And What It Assumed
|
|
937
|
+
|
|
938
|
+
Every agent answer SHALL report the repository files it read, in a form the author can open,
|
|
939
|
+
and SHALL state any assumption it made in place of reading. An answer that read nothing SHALL
|
|
940
|
+
say so rather than presenting an unsourced claim in the same shape as a sourced one.
|
|
941
|
+
|
|
942
|
+
The rail SHALL additionally show, **before** a turn is taken, exactly what it will read at the
|
|
943
|
+
change's current point — naming each file, and distinguishing the change's own artifacts from
|
|
944
|
+
the folded capabilities it reads only for reference. Reporting sources after the fact tells the
|
|
945
|
+
author what happened; naming them first is what lets them correct it before it does.
|
|
946
|
+
|
|
947
|
+
#### Scenario: An answer cites its sources
|
|
948
|
+
- **WHEN** the agent answers a question about the repository
|
|
949
|
+
- **THEN** the files it read are listed and openable alongside the answer
|
|
950
|
+
|
|
951
|
+
#### Scenario: An unsourced answer is marked
|
|
952
|
+
- **WHEN** the agent answers without reading any file
|
|
953
|
+
- **THEN** the answer states that it is unsourced, distinguishing it from a sourced answer
|
|
954
|
+
|
|
955
|
+
#### Scenario: The rail names its context before the turn
|
|
956
|
+
- **WHEN** the author is about to ask for a requirement to be drafted
|
|
957
|
+
- **THEN** the rail names each file it will read
|
|
958
|
+
- **AND** the folded capabilities it reads for reference are distinguished from the change's own artifacts
|
|
959
|
+
|
|
960
|
+
### Requirement: The Agent Has Read-Only Access To The Repository
|
|
961
|
+
|
|
962
|
+
The agent SHALL be given a read-only view of the repository. It SHALL NOT be offered a tool
|
|
963
|
+
capable of writing, and its inability to write SHALL be a property of the tools it holds
|
|
964
|
+
rather than an instruction it is asked to obey.
|
|
965
|
+
|
|
966
|
+
#### Scenario: No write tool exists on the profile
|
|
967
|
+
- **WHEN** the agent's tool set is inspected
|
|
968
|
+
- **THEN** it contains no tool that can create, modify or delete a file
|
|
969
|
+
|
|
970
|
+
### Requirement: A Settings Surface Lets The Member See And Choose The Credential Source
|
|
971
|
+
|
|
972
|
+
The rail SHALL offer a settings control that opens a settings surface listing **every**
|
|
973
|
+
credential source the workbench knows about, each showing whether it is available on this
|
|
974
|
+
machine, and which one is currently in use.
|
|
975
|
+
|
|
976
|
+
The surface SHALL state **why** the current source is in use — default precedence, or an
|
|
977
|
+
explicit selection. A member SHALL be able to select any available source explicitly, and to
|
|
978
|
+
clear that selection and return to the default precedence. An explicit selection SHALL persist
|
|
979
|
+
across sessions.
|
|
980
|
+
|
|
981
|
+
#### Scenario: The settings surface names the source in use and why
|
|
982
|
+
- **WHEN** the member opens the settings surface with no explicit selection recorded
|
|
983
|
+
- **THEN** the source in use is marked, and its reason is given as the default precedence
|
|
984
|
+
|
|
985
|
+
#### Scenario: An explicit selection overrides the default order
|
|
986
|
+
- **WHEN** the member explicitly selects a source other than the one precedence would choose
|
|
987
|
+
- **THEN** subsequent turns use the selected source, and the surface gives the reason as an explicit selection
|
|
988
|
+
|
|
989
|
+
#### Scenario: A selection can be cleared
|
|
990
|
+
- **WHEN** the member clears an explicit selection
|
|
991
|
+
- **THEN** resolution returns to the default precedence, and the surface says so
|
|
992
|
+
|
|
993
|
+
### Requirement: An Unavailable Source Is Shown As Unavailable, With Its Reason
|
|
994
|
+
|
|
995
|
+
A credential source that is not usable SHALL be listed and marked unavailable, with the reason
|
|
996
|
+
it is unavailable, rather than omitted from the list.
|
|
997
|
+
|
|
998
|
+
The reasons SHALL be distinguished, at minimum: **not installed**, **installed but not
|
|
999
|
+
authenticated**, and **present but rejected**. These lead to different actions — install, log
|
|
1000
|
+
in, or investigate — and collapsing them into one unavailable state, or into absence from the
|
|
1001
|
+
list, leaves the member unable to tell which applies.
|
|
1002
|
+
|
|
1003
|
+
#### Scenario: An installed but unauthenticated source
|
|
1004
|
+
- **WHEN** Claude Code is installed on the machine but not logged in
|
|
1005
|
+
- **THEN** it is listed, marked unavailable, and its reason distinguishes it from not being installed
|
|
1006
|
+
|
|
1007
|
+
#### Scenario: An absent source is listed, not hidden
|
|
1008
|
+
- **WHEN** a credential source is not present on the machine at all
|
|
1009
|
+
- **THEN** it still appears in the list, marked unavailable with that reason
|
|
1010
|
+
|
|
1011
|
+
### Requirement: The Rail Reports Which Credential Served Each Turn
|
|
1012
|
+
|
|
1013
|
+
The rail SHALL report, for each completed turn, which credential source served it.
|
|
1014
|
+
|
|
1015
|
+
A member holding both a subscription and an API key otherwise cannot tell which one was billed,
|
|
1016
|
+
and the two bill differently. The report SHALL name the source that actually served the turn as
|
|
1017
|
+
observed from the run, not the source that resolution selected before it — a run that fell back
|
|
1018
|
+
and a run that used what was chosen are different outcomes, and reporting the intent in place of
|
|
1019
|
+
the result would hide exactly the divergence worth knowing about.
|
|
1020
|
+
|
|
1021
|
+
#### Scenario: A turn reports the source that served it
|
|
1022
|
+
- **WHEN** a turn completes
|
|
1023
|
+
- **THEN** the credential source that served it is reported alongside the answer
|
|
1024
|
+
|
|
1025
|
+
#### Scenario: A run that did not use the selected source is reported as such
|
|
1026
|
+
- **WHEN** a turn is served by a source other than the one resolution selected
|
|
1027
|
+
- **THEN** the divergence is reported, naming both the selected and the serving source
|
|
1028
|
+
|
|
1029
|
+
### Requirement: A Turn Is A Real Model Turn Through One Boundary
|
|
1030
|
+
|
|
1031
|
+
Asking the rail SHALL dispatch a turn to a model through a single provider-agnostic boundary,
|
|
1032
|
+
and the answer the rail displays SHALL be that model's. The rail SHALL NOT display a scripted
|
|
1033
|
+
answer as though a model produced it; the demo transcript SHALL be reachable only under the
|
|
1034
|
+
explicit fixture flag, which already announces itself.
|
|
1035
|
+
|
|
1036
|
+
A turn SHALL run a tool loop rather than a single request: the boundary dispatches the context
|
|
1037
|
+
and the tool set, executes any tool the model calls, returns each result to the model, and
|
|
1038
|
+
repeats until the model stops calling tools. A turn that stops because it hit the loop's bound
|
|
1039
|
+
SHALL say so rather than presenting a partial answer as a finished one.
|
|
1040
|
+
|
|
1041
|
+
The boundary SHALL be one module. A second per-provider client would put the question "which
|
|
1042
|
+
model answered" in two places, and \`The Rail Reports Which Credential Served Each Turn\` requires
|
|
1043
|
+
one answer.
|
|
1044
|
+
|
|
1045
|
+
#### Scenario: The answer comes from the model
|
|
1046
|
+
- **WHEN** the author asks the rail something with a credential resolved
|
|
1047
|
+
- **THEN** the answer displayed is the model's, not the demo transcript's
|
|
1048
|
+
|
|
1049
|
+
#### Scenario: A tool call is executed and fed back
|
|
1050
|
+
- **WHEN** the model calls a tool during a turn
|
|
1051
|
+
- **THEN** the tool runs, its result is returned to the model, and the turn continues
|
|
1052
|
+
|
|
1053
|
+
#### Scenario: A turn that exhausts its loop says so
|
|
1054
|
+
- **WHEN** a turn reaches the maximum number of tool rounds
|
|
1055
|
+
- **THEN** the rail reports that the turn was cut short rather than presenting the partial answer as complete
|
|
1056
|
+
|
|
1057
|
+
### Requirement: A Proposed Task Group Carries The Requirement It Implements
|
|
1058
|
+
|
|
1059
|
+
A task-group proposal SHALL accept an optional citation naming the requirement the group
|
|
1060
|
+
implements, and a citation naming a requirement the change does not declare SHALL be refused at
|
|
1061
|
+
the tool boundary rather than proposed — the same treatment a proposal naming an artifact the
|
|
1062
|
+
change does not have receives.
|
|
1063
|
+
|
|
1064
|
+
#### Scenario: The agent cites a declared requirement
|
|
1065
|
+
- **WHEN** the agent proposes a task group citing a requirement the change's delta specs declare
|
|
1066
|
+
- **THEN** the proposal carries that citation
|
|
1067
|
+
- **AND** accepting it sets the group's citation through the same field a human choice writes
|
|
1068
|
+
|
|
1069
|
+
#### Scenario: The agent cites something the change does not declare
|
|
1070
|
+
- **WHEN** the agent proposes a task group citing a requirement no delta spec declares
|
|
1071
|
+
- **THEN** the proposal is refused, naming the requirement that is not declared
|
|
1072
|
+
- **AND** no group is proposed
|
|
1073
|
+
|
|
1074
|
+
#### Scenario: A group that implements no requirement
|
|
1075
|
+
- **WHEN** the agent proposes a task group with no citation
|
|
1076
|
+
- **THEN** the proposal is accepted and the group cites nothing
|
|
1077
|
+
|
|
1078
|
+
### Requirement: The Rail Runs Against A Credential Resolved On The Member's Own Machine
|
|
1079
|
+
|
|
1080
|
+
The agent rail SHALL run against a model credential resolved on the member's own machine, and
|
|
1081
|
+
SHALL NOT contact any inference service the member has not selected.
|
|
1082
|
+
|
|
1083
|
+
Resolution SHALL follow the precedence \`platform-cli-modelauth\` defines. That capability is
|
|
1084
|
+
**referenced, not restated**: it is the single definition of the precedence, of what each
|
|
1085
|
+
credential type is, of when each is computed, and of how each is presented to a provider, and a
|
|
1086
|
+
second copy here would be free to drift from it. This capability declares none of those things.
|
|
1087
|
+
Where a subscription serves a turn, the mechanism by which it does so is
|
|
1088
|
+
\`platform-cli-modelauth\`'s to define and this rail's only to consume.
|
|
1089
|
+
|
|
1090
|
+
The rail SHALL NOT itself read, parse, hold or forward a credential secret, and SHALL NOT set a
|
|
1091
|
+
provider credential environment variable for a turn. It selects a source and names it; the
|
|
1092
|
+
model boundary authenticates. This is a **narrowing of behaviour that exists**, not a
|
|
1093
|
+
restatement of it: the workbench today parses the subscription's stored OAuth access token out
|
|
1094
|
+
of its credential file and exports it into the environment of the turn, and satisfying this
|
|
1095
|
+
requirement means deleting that path and the tests that pin it. A surface that handles the
|
|
1096
|
+
secret is a second place it can leak, and it is the place least equipped to be careful with it.
|
|
1097
|
+
|
|
1098
|
+
Where an explicit selection has been recorded, that selection SHALL take precedence over the
|
|
1099
|
+
default order.
|
|
1100
|
+
|
|
1101
|
+
Where no credential resolves, the rail SHALL report that no model is available and SHALL remain
|
|
1102
|
+
usable for everything that does not need one. It SHALL NOT present an unavailable rail as an
|
|
1103
|
+
empty or idle one — "no model is configured" and "the model returned nothing" are different
|
|
1104
|
+
facts and lead to different actions. In particular the rail SHALL NOT answer from the canned
|
|
1105
|
+
demo transcript when no credential resolves, because a scripted answer and a model's answer are
|
|
1106
|
+
the two facts hardest to tell apart once they are on screen together.
|
|
1107
|
+
|
|
1108
|
+
#### Scenario: A subscription login is preferred over an exported API key
|
|
1109
|
+
- **WHEN** both a Claude Code subscription login and \`ANTHROPIC_API_KEY\` are present, with no explicit selection
|
|
1110
|
+
- **THEN** the rail resolves the subscription login
|
|
1111
|
+
- **AND** the source is settled before the turn is dispatched, rather than left to whatever the provider path would pick
|
|
1112
|
+
|
|
1113
|
+
#### Scenario: The rail handles no credential secret
|
|
1114
|
+
- **WHEN** the rail dispatches a turn on a resolved subscription source
|
|
1115
|
+
- **THEN** it passes the selected source rather than a token
|
|
1116
|
+
- **AND** no credential secret is parsed, held, or exported into the turn's environment by the rail
|
|
1117
|
+
|
|
1118
|
+
#### Scenario: No credential resolves
|
|
1119
|
+
- **WHEN** no credential source is available on the machine
|
|
1120
|
+
- **THEN** the rail reports that no model is available, naming that as the reason
|
|
1121
|
+
- **AND** it is not presented as idle, empty, or as having returned nothing
|
|
1122
|
+
|
|
1123
|
+
### Requirement: The Agent's Proposals Are Markdown Edits Against An Artifact Buffer
|
|
1124
|
+
|
|
1125
|
+
Every item the agent proposes SHALL be a markdown edit against one named artifact buffer of the
|
|
1126
|
+
change — \`proposal.md\`, \`design.md\`, a \`specs/<capability>/spec.md\`, or \`tasks.md\` — presented
|
|
1127
|
+
as a card carrying that edit as a diff against the buffer's current content, with an accept and
|
|
1128
|
+
a decline. The agent holds no tool capable of writing, as *The Agent Has Read-Only Access To The
|
|
1129
|
+
Repository* requires; a proposal is the only shape its output has.
|
|
1130
|
+
|
|
1131
|
+
The tool set SHALL cover every artifact the change has, so that an agent asked to plan
|
|
1132
|
+
implementation can return tasks and an agent asked to draft a requirement can return one. An
|
|
1133
|
+
agent that can only return prose cannot answer the requests most worth making of it. Covering
|
|
1134
|
+
every artifact is about the *subjects* a proposal may name, not about gaining a write: the
|
|
1135
|
+
tools that widen are the ones that compose a proposal.
|
|
1136
|
+
|
|
1137
|
+
What the agent offers SHALL be exactly the text that will sit in the file. Accepting a proposal
|
|
1138
|
+
SHALL produce that text and nothing generated around it, because the file is the document and a
|
|
1139
|
+
proposal the workbench re-renders on the way in is a second author the reviewer of the diff did
|
|
1140
|
+
not see.
|
|
1141
|
+
|
|
1142
|
+
A proposal naming something the change does not have — an artifact that does not exist, a
|
|
1143
|
+
capability with no delta spec — SHALL surface as a refused proposal naming what was missing. It
|
|
1144
|
+
SHALL NOT be silently dropped, because a proposal that vanishes and one that was never made
|
|
1145
|
+
look identical to the author waiting for it.
|
|
1146
|
+
|
|
1147
|
+
#### Scenario: The agent proposes a task group
|
|
1148
|
+
- **WHEN** the author asks the agent to plan the implementation of the change
|
|
1149
|
+
- **THEN** it offers an edit to \`tasks.md\` carrying the task groups, as a diff with accept and decline
|
|
1150
|
+
- **AND** \`tasks.md\` is unchanged until the author accepts
|
|
1151
|
+
|
|
1152
|
+
#### Scenario: The accepted text is the proposed text
|
|
1153
|
+
- **WHEN** the author accepts a proposal
|
|
1154
|
+
- **THEN** the buffer holds exactly the text the diff showed
|
|
1155
|
+
|
|
1156
|
+
#### Scenario: A proposal naming something absent is refused, not dropped
|
|
1157
|
+
- **WHEN** the agent proposes an edit to a delta spec for a capability the change has none for
|
|
1158
|
+
- **THEN** the proposal is shown as refused, naming what was missing
|
|
1159
|
+
- **AND** nothing is written into the change
|
|
1160
|
+
|
|
1161
|
+
#### Scenario: Declining writes nothing
|
|
1162
|
+
- **WHEN** the author declines a proposal
|
|
1163
|
+
- **THEN** the card is removed and no buffer changes
|
|
1164
|
+
`,_T=`# platform-ui-standard Specification
|
|
1165
|
+
|
|
1166
|
+
## Purpose
|
|
1167
|
+
The refinement rules every coopcli surface obeys — iconography, the hierarchy channels available on a two-face monospace stack, shape, scroll behaviour, and state differentiation — defined ONCE for all six surfaces and mechanically enforced. Owned by no product: it governs \`packages/web\`, the two Vite apps bundled into offline npm CLIs (\`specsketch\`, \`specplan\`), \`specdocs\`, and the unbundled public \`.html\` files that no bundler touches. \`website-design-system\` references this capability and pins its own web-only constraints; it does not restate these rules. Values are stated here; a surface may not redefine them under a different name.
|
|
1168
|
+
|
|
1169
|
+
## Requirements
|
|
1170
|
+
|
|
1171
|
+
### Requirement: One Canonical Token Vocabulary Across Every Surface
|
|
1172
|
+
|
|
1173
|
+
Each design role SHALL have exactly ONE token name, defined once, and no surface SHALL introduce a second name for a role that already has one. Every surface SHALL satisfy this as a contract; the three bundled surfaces SHALL satisfy it by consuming a shared stylesheet, and the unbundled surfaces by conformance.
|
|
1174
|
+
|
|
1175
|
+
Nine independent \`:root\` blocks declare overlapping vocabularies today, and the failure is not merely duplication: \`--danger\` is \`#ef4444\` canonically and \`#ff5f57\` in specplan, where \`#ff5f57\` is canonically \`--err\`. The same name means two different things, so a rule written against one surface is wrong on the other rather than absent.
|
|
1176
|
+
|
|
1177
|
+
#### Scenario: A role acquires a second name
|
|
1178
|
+
- **WHEN** a surface declares a token whose role already has a canonical name
|
|
1179
|
+
- **THEN** the conformance canary fails, naming both the offending token and the canonical name for that role
|
|
1180
|
+
|
|
1181
|
+
#### Scenario: A shared name carries a different value
|
|
1182
|
+
- **WHEN** two surfaces declare the same token name with different values
|
|
1183
|
+
- **THEN** the canary fails, naming both values
|
|
1184
|
+
|
|
1185
|
+
#### Scenario: An unbundled surface satisfies the contract without importing
|
|
1186
|
+
- **WHEN** a surface loads CSS via a raw \`<link>\` and cannot import a shared stylesheet
|
|
1187
|
+
- **THEN** it satisfies this requirement by declaring the canonical names and values
|
|
1188
|
+
- **AND** the canary checks it on the same terms as a bundled surface
|
|
1189
|
+
|
|
1190
|
+
### Requirement: Repetition Earns An Icon, Adjacency And Consequence Keep The Word
|
|
1191
|
+
|
|
1192
|
+
An icon-only control SHALL be permitted ONLY where the action repeats per row or per line, is non-destructive, and is not one of three or more semantically adjacent sibling actions in one family. An action that is infrequent, destructive, terminal, or one of three-or-more adjacent siblings SHALL carry a visible text label.
|
|
1193
|
+
|
|
1194
|
+
A destructive action that repeats per row MAY be icon-only when a confirmation names what is lost. The bound exists because a tooltip is hidden by default and unavailable on touch, so every icon-only control spends a finite budget: a screen of unlabelled glyphs is not dense, it is encrypted.
|
|
1195
|
+
|
|
1196
|
+
#### Scenario: An action that repeats down the viewport
|
|
1197
|
+
- **WHEN** a control appears once per row and is non-destructive
|
|
1198
|
+
- **THEN** it MAY be icon-only
|
|
1199
|
+
|
|
1200
|
+
#### Scenario: Three adjacent siblings in one family
|
|
1201
|
+
- **WHEN** three or more sibling actions of one family sit together, such as three view modes of a file
|
|
1202
|
+
- **THEN** each keeps a visible text label, however often the group repeats
|
|
1203
|
+
|
|
1204
|
+
#### Scenario: A destructive action that repeats
|
|
1205
|
+
- **WHEN** a destructive control appears once per row
|
|
1206
|
+
- **THEN** it MAY be icon-only only if activating it opens a confirmation that names what will be lost
|
|
1207
|
+
|
|
1208
|
+
#### Scenario: A once-per-screen action
|
|
1209
|
+
- **WHEN** a control appears once per screen
|
|
1210
|
+
- **THEN** it carries a visible text label regardless of its consequence
|
|
1211
|
+
|
|
1212
|
+
### Requirement: The Icon Set Is Hand-Authored On One Grid With One Stroke
|
|
1213
|
+
|
|
1214
|
+
Icons SHALL be hand-authored SVG exported from a single shared module, drawn on a 16px canvas with ONE uniform stroke width at every size, round caps and joins, a 1px corner radius unless recognisability requires otherwise, 1px gaps drawn between overlapping shapes, and outer edges aligned to pixel boundaries. Stroke width SHALL NOT scale with icon size. An icon SHALL NOT be rendered at a size it was not drawn for.
|
|
1215
|
+
|
|
1216
|
+
Icons SHALL take their colour from \`currentColor\` and their HEIGHT from the \`1em\` of their context, so an icon matches the text beside it. Each icon box SHALL occupy an integer multiple of \`1ch\` in WIDTH so icons align to the monospace column grid. Height tracks the text and width tracks the column; the two are independent, and \`1em\` is not required to equal a whole number of \`ch\`.
|
|
1217
|
+
|
|
1218
|
+
No unicode character SHALL stand in for an icon. A declared set of text STATE-MARKS is permitted and is not an icon: an icon names an action or a thing and is drawn to the 16px grid; a state-mark annotates text, is set in the text's own font, and carries no meaning on its own. Every state-mark SHALL be declared once as a token in the canonical stylesheet, and any character used as a state-mark that is not a declared token SHALL fail the canary. Declaring the set is what keeps this a rule rather than an exemption.
|
|
1219
|
+
|
|
1220
|
+
Filled and outline variants SHALL NOT be the sole encoding of any state. The reference icon system assigns them no semantics, so any meaning given to them is this project's invention and SHALL be documented as such where it is used.
|
|
1221
|
+
|
|
1222
|
+
#### Scenario: One stroke width across the set
|
|
1223
|
+
- **WHEN** any icon in the set is inspected at any rendered size
|
|
1224
|
+
- **THEN** its stroke width equals every other icon's in the set
|
|
1225
|
+
|
|
1226
|
+
#### Scenario: A glyph used as an icon
|
|
1227
|
+
- **WHEN** a unicode character stands in for an icon in a control
|
|
1228
|
+
- **THEN** the canary fails, naming the character and its location
|
|
1229
|
+
|
|
1230
|
+
#### Scenario: An undeclared state-mark
|
|
1231
|
+
- **WHEN** a state indicator uses a character that is not a declared state-mark token
|
|
1232
|
+
- **THEN** the canary fails, naming the character and its location
|
|
1233
|
+
|
|
1234
|
+
#### Scenario: One definition serves a bundled and an unbundled surface
|
|
1235
|
+
- **WHEN** an unbundled surface needs an icon
|
|
1236
|
+
- **THEN** it uses a sprite generated at build time from the same source the bundled surfaces import
|
|
1237
|
+
- **AND** no icon is defined twice
|
|
1238
|
+
|
|
1239
|
+
### Requirement: Every Icon-Only Control Names Itself
|
|
1240
|
+
|
|
1241
|
+
Every icon-only control SHALL expose a non-empty accessible name describing its action. Controls performing the same action SHALL share an identical name; controls performing different actions SHALL have distinct names. An icon carrying meaning not present in adjacent text SHALL expose that meaning to assistive technology; a decorative icon SHALL be hidden from it, and decorative SHALL be the default.
|
|
1242
|
+
|
|
1243
|
+
A tooltip SHALL NOT be the sole carrier of information required to complete a task, and SHALL NOT be attached to a non-interactive element.
|
|
1244
|
+
|
|
1245
|
+
#### Scenario: An icon-only button
|
|
1246
|
+
- **WHEN** a control renders an icon and no text
|
|
1247
|
+
- **THEN** it carries an accessible name naming its action
|
|
1248
|
+
- **AND** the accessibility assertion in the browser suite covers it
|
|
1249
|
+
|
|
1250
|
+
#### Scenario: Two controls, one action
|
|
1251
|
+
- **WHEN** the same action appears on several rows
|
|
1252
|
+
- **THEN** every instance carries the identical accessible name
|
|
1253
|
+
|
|
1254
|
+
#### Scenario: A decorative icon
|
|
1255
|
+
- **WHEN** an icon repeats meaning already present in adjacent text
|
|
1256
|
+
- **THEN** it is hidden from assistive technology
|
|
1257
|
+
|
|
1258
|
+
### Requirement: The Weight Ladder Is Only What The Font Provides
|
|
1259
|
+
|
|
1260
|
+
Declared font weights SHALL be limited to those the shipped font actually renders. Absent a self-hosted webfont, that ladder SHALL be exactly \`{400, 700}\`, and no other numeric weight SHALL appear in any source file.
|
|
1261
|
+
|
|
1262
|
+
Weight SHALL NOT be used inside prose runs, and SHALL mark at most one element per group. 184 declarations across five values render as two faces today, with \`500\` resolving to Regular and \`600\`, \`700\` and \`800\` all resolving to Bold — a ladder whose steps do not exist, with the boundary falling between 500 and 600 where nobody put it.
|
|
1263
|
+
|
|
1264
|
+
#### Scenario: A weight the font cannot render
|
|
1265
|
+
- **WHEN** a source file declares a font weight outside the ladder
|
|
1266
|
+
- **THEN** the canary fails, naming the file, the line and the value
|
|
1267
|
+
|
|
1268
|
+
#### Scenario: Bold inside prose
|
|
1269
|
+
- **WHEN** a multi-line prose run applies the bold weight to a whole paragraph
|
|
1270
|
+
- **THEN** it is a violation of this requirement
|
|
1271
|
+
|
|
1272
|
+
### Requirement: Hierarchy Is Carried By Dim, Size And Surface
|
|
1273
|
+
|
|
1274
|
+
Visual hierarchy SHALL be built from a foreground dim ladder, a short size scale, and background surface — not from weight. The dim ladder SHALL carry at most three text steps, because each must clear its contrast floor; a fourth, non-compliant step is permitted for disabled controls only. Muted and disabled treatments SHALL be produced by alpha-collapsing an existing colour, never by introducing a new hue. Elevation SHALL be conveyed by a lighter surface, not by shadow, which is near-invisible on this ground.
|
|
1275
|
+
|
|
1276
|
+
An element SHALL differ from its parent on at most TWO channels. Code SHALL be distinguished from surrounding prose by background, not by size and not by weight.
|
|
1277
|
+
|
|
1278
|
+
Letter-spacing SHALL NOT be applied to text participating in column alignment, because tracking makes each advance \`1ch + tracking\` and silently breaks a \`ch\` grid.
|
|
1279
|
+
|
|
1280
|
+
#### Scenario: A fourth text dim step
|
|
1281
|
+
- **WHEN** a fourth foreground step is introduced for text
|
|
1282
|
+
- **THEN** it fails its contrast floor and is a violation
|
|
1283
|
+
|
|
1284
|
+
#### Scenario: Three channels of difference
|
|
1285
|
+
- **WHEN** an element differs from its parent in dim, size and surface at once
|
|
1286
|
+
- **THEN** it is a violation of this requirement
|
|
1287
|
+
|
|
1288
|
+
#### Scenario: Tracking on grid-aligned text
|
|
1289
|
+
- **WHEN** letter-spacing is applied to text in a column-aligned run
|
|
1290
|
+
- **THEN** it is a violation, and the carve-out for isolated labels does not apply
|
|
1291
|
+
|
|
1292
|
+
### Requirement: The Shape Ladder Is Closed And Complete
|
|
1293
|
+
|
|
1294
|
+
Border radius SHALL come from a closed ladder, border width from \`{1px, 2px, 4px}\`, and neither SHALL take an arbitrary value. The ladder SHALL include a pill rung and a circle rung, because surfaces legitimately need them and none exists today. Rungs SHALL NOT be visually indistinguishable from one another, and SHALL be expressed in ONE unit system.
|
|
1295
|
+
|
|
1296
|
+
A 1px hairline SHALL be the default separator; 2px and 4px SHALL be reserved for emphasis such as focus, selection, or severity. A dashed border SHALL carry exactly one meaning across the product; it carries six today.
|
|
1297
|
+
|
|
1298
|
+
#### Scenario: An off-ladder radius
|
|
1299
|
+
- **WHEN** a source file declares a border radius outside the ladder
|
|
1300
|
+
- **THEN** the canary fails, naming the file, the line and the value
|
|
1301
|
+
|
|
1302
|
+
#### Scenario: A pill
|
|
1303
|
+
- **WHEN** a component needs a fully-rounded edge
|
|
1304
|
+
- **THEN** it uses the pill rung rather than a raw value
|
|
1305
|
+
|
|
1306
|
+
#### Scenario: Two rungs that look identical
|
|
1307
|
+
- **WHEN** two rungs resolve to values within one pixel of each other
|
|
1308
|
+
- **THEN** they are collapsed into one rung
|
|
1309
|
+
|
|
1310
|
+
### Requirement: One Scrollport Per Axis Per Region, With Headers That Stay
|
|
1311
|
+
|
|
1312
|
+
A region SHALL expose at most one scrollport per axis. A section header SHALL remain sticky to the top of its scroll container for the full extent of its section, and this SHALL be covered by an automated test.
|
|
1313
|
+
|
|
1314
|
+
Any action that collapses, resolves, or expands content above the viewport SHALL preserve the scroll offset of the element at the top of the viewport, and \`overflow-anchor\` SHALL NOT be the sole mechanism, because it is not uniformly implemented.
|
|
1315
|
+
|
|
1316
|
+
The worst case today is three nested scrollports with the middle one horizontal, so a two-axis gesture inside a draft scrolls the diff above it; and the one header carrying a filename and its view toggle is not sticky, so scrolling into a file loses both.
|
|
1317
|
+
|
|
1318
|
+
#### Scenario: Nested scrollports on one axis
|
|
1319
|
+
- **WHEN** a scrollport on some axis contains another scrollport on the same axis
|
|
1320
|
+
- **THEN** it is a violation of this requirement
|
|
1321
|
+
|
|
1322
|
+
#### Scenario: A header outlives its section
|
|
1323
|
+
- **WHEN** a reader scrolls to the end of a section
|
|
1324
|
+
- **THEN** that section's header is still visible, and its controls still reachable
|
|
1325
|
+
|
|
1326
|
+
#### Scenario: Resolving a thread above the viewport
|
|
1327
|
+
- **WHEN** content above the viewport is collapsed or resolved
|
|
1328
|
+
- **THEN** the element at the top of the viewport keeps its offset
|
|
1329
|
+
- **AND** a regression test asserts that offset is unchanged
|
|
1330
|
+
|
|
1331
|
+
### Requirement: Every Count Of Outstanding Items Can Be Reached
|
|
1332
|
+
|
|
1333
|
+
A surface reporting a count of outstanding items SHALL provide a way to navigate to them. Navigation SHALL be keyboard-reachable, and the surface SHALL provide a discoverable list of its shortcuts.
|
|
1334
|
+
|
|
1335
|
+
A count with no route to its members is a dead end: the review summary prints how many deltas are unviewed and offers no way to reach one, and the structure gate names unsatisfied sections from a different scrollport with no link to them.
|
|
1336
|
+
|
|
1337
|
+
#### Scenario: An unviewed count
|
|
1338
|
+
- **WHEN** a surface reports that N items are unviewed or unsatisfied
|
|
1339
|
+
- **THEN** a keyboard action moves focus to the next such item
|
|
1340
|
+
|
|
1341
|
+
#### Scenario: A named finding
|
|
1342
|
+
- **WHEN** a validation finding names a section or requirement
|
|
1343
|
+
- **THEN** activating that finding brings the named target into view
|
|
1344
|
+
|
|
1345
|
+
### Requirement: No State Is Distinguishable By Colour Alone
|
|
1346
|
+
|
|
1347
|
+
Every state-bearing component SHALL expose its state as a data attribute AND differentiate it by at least one non-colour channel — a glyph, a shape, or text. Colour SHALL NOT be the only difference between two states, and text SHALL NOT be the only difference where a glyph or shape would carry it.
|
|
1348
|
+
|
|
1349
|
+
This is acute rather than routine here: the accent is hue-adjacent to the warning amber, so emphasis and severity read as one signal on this ground and to anyone with a red-green deficiency. They SHALL differ by shape or glyph.
|
|
1350
|
+
|
|
1351
|
+
Perceptual distinguishability is not machine-checkable. This requirement is therefore satisfied by the stated implementation commitment, asserted per state in the browser suite — not by a check claiming to measure perception.
|
|
1352
|
+
|
|
1353
|
+
#### Scenario: Two states differing only in colour
|
|
1354
|
+
- **WHEN** two states share identical text, shape, and size and differ only in a colour property
|
|
1355
|
+
- **THEN** it is a violation of this requirement
|
|
1356
|
+
|
|
1357
|
+
#### Scenario: Emphasis beside severity
|
|
1358
|
+
- **WHEN** an emphasis indicator and a warning indicator appear on one screen
|
|
1359
|
+
- **THEN** they differ in shape or glyph, not only in hue
|
|
1360
|
+
|
|
1361
|
+
#### Scenario: Every state is asserted
|
|
1362
|
+
- **WHEN** a state-bearing component is tested
|
|
1363
|
+
- **THEN** each of its states is asserted to carry its data attribute and its non-colour differentiator
|
|
1364
|
+
|
|
1365
|
+
### Requirement: Every Interactive Control Has A Visible Focus Indicator
|
|
1366
|
+
|
|
1367
|
+
Every interactive control SHALL have a visible focus indicator that meets its contrast floor against the surface behind it, and SHALL NOT rely on the user agent default. Removing an outline without replacing it SHALL be a violation.
|
|
1368
|
+
|
|
1369
|
+
#### Scenario: A control receives keyboard focus
|
|
1370
|
+
- **WHEN** a control is focused by keyboard
|
|
1371
|
+
- **THEN** a visible indicator distinguishes it from every unfocused control
|
|
1372
|
+
|
|
1373
|
+
#### Scenario: An outline removed
|
|
1374
|
+
- **WHEN** a rule sets \`outline: none\` on an interactive control
|
|
1375
|
+
- **THEN** that control declares a replacement focus indicator
|
|
1376
|
+
|
|
1377
|
+
### Requirement: Conformance Is Enforced By Test, Not By Convention
|
|
1378
|
+
|
|
1379
|
+
Conformance SHALL be enforced mechanically. The statically decidable rules — raw colour values outside a token block, type sizes off the scale, radii off the ladder, weights off the ladder, and a second name for an existing role — SHALL be checked by a canary that reads source files and names every offender with its file and line. The canary SHALL enumerate the file set it scanned and pin the count, so a pattern that stops matching fails loudly rather than passing silently. Its exemptions SHALL be enumerated, each with a stated reason.
|
|
1380
|
+
|
|
1381
|
+
The canary SHALL scan every source form that can carry style, including files that emit CSS from TypeScript and style properties written inline in components. A colour-value exemption for vector artwork SHALL span the element, not the line.
|
|
1382
|
+
|
|
1383
|
+
The rules that are not statically decidable — accessible names, focus indicators, and state differentiation — SHALL be asserted in the browser suites that already run in CI.
|
|
1384
|
+
|
|
1385
|
+
An unenforced rule is the failure this requirement exists to prevent: the current design-system spec forbids a second token block in its own package, five exist, and nothing noticed for weeks.
|
|
1386
|
+
|
|
1387
|
+
#### Scenario: A violation reaches a pull request
|
|
1388
|
+
- **WHEN** source is changed to violate a statically decidable rule
|
|
1389
|
+
- **THEN** the canary fails and names the file, the line and the offending value
|
|
1390
|
+
|
|
1391
|
+
#### Scenario: The scanned set shrinks
|
|
1392
|
+
- **WHEN** a scanned path stops matching any file
|
|
1393
|
+
- **THEN** the canary fails rather than reporting no offenders
|
|
1394
|
+
|
|
1395
|
+
#### Scenario: A style declared outside a stylesheet
|
|
1396
|
+
- **WHEN** a style value is declared inline in a component or emitted from TypeScript
|
|
1397
|
+
- **THEN** the canary scans it on the same terms as a stylesheet
|
|
1398
|
+
|
|
1399
|
+
#### Scenario: An exemption without a reason
|
|
1400
|
+
- **WHEN** a path is added to the exemption set with no stated reason
|
|
1401
|
+
- **THEN** the canary fails
|
|
1402
|
+
|
|
1403
|
+
### Requirement: Every Interactive Control Is Styled By The Vocabulary, Not The User Agent
|
|
1404
|
+
|
|
1405
|
+
Every interactive control SHALL resolve its colour, background and border from the canonical token vocabulary. A control that matches no rule inherits the user agent stylesheet instead, and that SHALL be a conformance failure rather than the absence of one.
|
|
1406
|
+
|
|
1407
|
+
This is the INVERSE of the rules the source canary enforces, and it exists because those rules cannot see it. A source scanner reads what is written and judges whether the values sit on the ladders; an element with NO rule has nothing to scan and therefore passes every ladder trivially. The user agent values — a light button face, a black label, an \`outset\` border — are on no ladder and are invisible to the scanner precisely because nobody wrote them.
|
|
1408
|
+
|
|
1409
|
+
Because the question is what a control RESOLVES rather than what a stylesheet declares, this SHALL be asserted against computed style in a browser rather than by reading source.
|
|
1410
|
+
|
|
1411
|
+
#### Scenario: A control that matches no rule
|
|
1412
|
+
- **WHEN** an interactive control resolves a colour or background from the user agent rather than from the vocabulary
|
|
1413
|
+
- **THEN** the check fails, naming the control and the value it inherited
|
|
1414
|
+
|
|
1415
|
+
#### Scenario: A control whose container is styled but which is not
|
|
1416
|
+
- **WHEN** a control sits inside a correctly styled container but declares nothing itself
|
|
1417
|
+
- **THEN** the check still fails, because a control does not inherit its container colour
|
|
1418
|
+
|
|
1419
|
+
### Requirement: Every Mounted Route Has A Caller Or A Reason
|
|
1420
|
+
|
|
1421
|
+
Every route mounted by a server in this repository SHALL have at least one caller in the repository, or SHALL appear in an enumerated exemption set with a stated reason. The check SHALL read source and SHALL run in the same conformance canary as the other statically decidable rules, rather than in a second harness.
|
|
1422
|
+
|
|
1423
|
+
A route consumed only by a client outside this repository — the published CLIs calling the worker's REST API from another machine — is a legitimate exemption, and its entry SHALL say so. What the check exists to catch is the route no caller anywhere invokes.
|
|
1424
|
+
|
|
1425
|
+
This class of defect has occurred four times in this product: the capability chooser, the emit write controls, the agent turn, and roadmap reorder. Each was implemented, tested at the route layer, and unreachable from the surface; each was found by a person using the product rather than by a test, because a mounted route with no caller and a working feature are indistinguishable from inside a route test.
|
|
1426
|
+
|
|
1427
|
+
#### Scenario: A route with no caller
|
|
1428
|
+
- **WHEN** a route is mounted and no source file in the repository calls it
|
|
1429
|
+
- **THEN** the canary fails, naming the route and where it is mounted
|
|
1430
|
+
|
|
1431
|
+
#### Scenario: An externally-consumed route
|
|
1432
|
+
- **WHEN** a route is called only by a client outside this repository
|
|
1433
|
+
- **THEN** it is listed as an exemption with the reason stated
|
|
1434
|
+
- **AND** the canary passes
|
|
1435
|
+
|
|
1436
|
+
#### Scenario: An exemption with no reason
|
|
1437
|
+
- **WHEN** a route is exempted without a stated reason
|
|
1438
|
+
- **THEN** the canary fails
|
|
1439
|
+
|
|
1440
|
+
#### Scenario: A caller is deleted
|
|
1441
|
+
- **WHEN** the last caller of a mounted route is removed
|
|
1442
|
+
- **THEN** the canary fails on that change rather than at the next person to use the product
|
|
1443
|
+
|
|
1444
|
+
### Requirement: Every Path A Spec Names Exists
|
|
1445
|
+
|
|
1446
|
+
Every filesystem path named in a requirement or a scenario SHALL exist in the repository, and the conformance canary SHALL fail when one does not, naming the capability, the requirement and the missing path. Paths deliberately describing something not yet built SHALL appear in an enumerated exemption set with a stated reason.
|
|
1447
|
+
|
|
1448
|
+
This is the decidable half of "is this specification true". Whether a requirement describes behaviour correctly is a judgement no scanner can make; whether a path it names exists is not. And every drift now being repaired began as a path: a worker with no content, a stylesheet at a path that moved, a docs layout cited at a line number two directories away from where it now lives. A spec that cites a path which has gone fails on the commit that moves it, rather than ageing quietly into a confident falsehood.
|
|
1449
|
+
|
|
1450
|
+
The check SHALL run in the same canary as the other statically decidable rules rather than in a second harness, because a second scanner is a second place for exemptions to collect.
|
|
1451
|
+
|
|
1452
|
+
#### Scenario: A requirement names a path that has gone
|
|
1453
|
+
- **WHEN** a folded requirement or scenario names a path absent from the repository
|
|
1454
|
+
- **THEN** the canary fails, naming the capability, the requirement and the path
|
|
1455
|
+
|
|
1456
|
+
#### Scenario: A path is moved by a change
|
|
1457
|
+
- **WHEN** a change relocates a file that a folded specification names
|
|
1458
|
+
- **THEN** the canary fails on that change
|
|
1459
|
+
|
|
1460
|
+
#### Scenario: A path describing unbuilt work
|
|
1461
|
+
- **WHEN** a specification names a path for something deliberately not yet built
|
|
1462
|
+
- **THEN** it is exempted with a stated reason and the canary passes
|
|
1463
|
+
|
|
1464
|
+
#### Scenario: An exemption with no reason
|
|
1465
|
+
- **WHEN** a path exemption carries no reason
|
|
1466
|
+
- **THEN** the canary fails
|
|
1467
|
+
`,vT=`add-specexec-product`,yT=[{artifact:`proposal.md`,content:`# Proposal — add-specexec-product
|
|
1468
|
+
|
|
1469
|
+
## Why
|
|
1470
|
+
|
|
1471
|
+
Running a change's tasks is still a person copying task text into an agent by hand. The
|
|
1472
|
+
workbench can hand them over directly.
|
|
1473
|
+
|
|
1474
|
+
## What Changes
|
|
1475
|
+
|
|
1476
|
+
- A prompt contract every runner obeys.
|
|
1477
|
+
- A queue that runs one task at a time and reports what it did.
|
|
1478
|
+
|
|
1479
|
+
## Capabilities
|
|
1480
|
+
|
|
1481
|
+
- **New**: \`specexec-prompt-contract\`, \`specexec-runner-queue\`
|
|
1482
|
+
|
|
1483
|
+
## Impact
|
|
1484
|
+
|
|
1485
|
+
The workbench's tasks surface, and one new worker route.
|
|
1486
|
+
`},{artifact:`design.md`,content:`# Design — add-specexec-product
|
|
1487
|
+
|
|
1488
|
+
## Context
|
|
1489
|
+
|
|
1490
|
+
See proposal.md — Why.
|
|
1491
|
+
|
|
1492
|
+
## Decisions
|
|
1493
|
+
|
|
1494
|
+
| Decision | Alternative considered |
|
|
1495
|
+
|---|---|
|
|
1496
|
+
| One task in flight per change | A parallel pool |
|
|
1497
|
+
`},{artifact:`tasks.md`,content:`# Tasks — add-specexec-product
|
|
1498
|
+
|
|
1499
|
+
## 1. The prompt contract
|
|
1500
|
+
|
|
1501
|
+
- [x] 1.1 Write the contract's shape
|
|
1502
|
+
Testing: vitest \`contract.test.ts\`
|
|
1503
|
+
- [ ] 1.2 Refuse a prompt that names no task
|
|
1504
|
+
Testing: vitest \`contract.test.ts\`
|
|
1505
|
+
|
|
1506
|
+
## 2. The runner queue
|
|
1507
|
+
|
|
1508
|
+
- [ ] 2.1 Run one task at a time
|
|
1509
|
+
Testing: vitest \`queue.test.ts\`
|
|
1510
|
+
`},{artifact:`specs/specexec-prompt-contract/spec.md`,content:`# specexec-prompt-contract (delta) — add-specexec-product
|
|
1511
|
+
|
|
1512
|
+
## ADDED Requirements
|
|
1513
|
+
|
|
1514
|
+
### Requirement: A Runner Prompt Names Exactly One Task
|
|
1515
|
+
|
|
1516
|
+
The runner SHALL send exactly one task per prompt.
|
|
1517
|
+
|
|
1518
|
+
#### Scenario: Two tasks in one prompt
|
|
1519
|
+
- **WHEN** a prompt names two tasks
|
|
1520
|
+
- **THEN** it is refused
|
|
1521
|
+
|
|
1522
|
+
### Requirement: A Prompt Carries The Task's Testing Row
|
|
1523
|
+
|
|
1524
|
+
The runner SHALL include the task's testing row.
|
|
1525
|
+
|
|
1526
|
+
#### Scenario: A task with a testing row
|
|
1527
|
+
- **WHEN** the task carries one
|
|
1528
|
+
- **THEN** the prompt carries it
|
|
1529
|
+
`},{artifact:`specs/specexec-runner-queue/spec.md`,content:`# specexec-runner-queue (delta) — add-specexec-product
|
|
1530
|
+
|
|
1531
|
+
## ADDED Requirements
|
|
1532
|
+
|
|
1533
|
+
### Requirement: One Task Runs At A Time
|
|
1534
|
+
|
|
1535
|
+
The queue SHALL run one task per change at a time.
|
|
1536
|
+
|
|
1537
|
+
#### Scenario: A second task while one runs
|
|
1538
|
+
- **WHEN** a second task is enqueued
|
|
1539
|
+
- **THEN** it waits
|
|
1540
|
+
|
|
1541
|
+
### Requirement: A Failed Run Is Reported, Not Retried
|
|
1542
|
+
|
|
1543
|
+
The queue SHALL report a failed run.
|
|
1544
|
+
|
|
1545
|
+
#### Scenario: A run fails
|
|
1546
|
+
- **WHEN** a run fails
|
|
1547
|
+
- **THEN** the failure is reported with its reason
|
|
1548
|
+
`}],bT=[{capability:`platform-ui-standard`,content:_T},{capability:`specsketch-workbench-agent`,content:gT},{capability:`specsketch-workbench-shell`,content:hT}];function xT(e){let t=new URLSearchParams(e).get(`lifecycle`);return{implemented:t===`implemented`||t===`archived`,archived:t===`archived`}}function ST(e){let t=new URLSearchParams(e);if(t.get(`approvals`)===`unreadable`)return{outcome:`unreadable`,reason:`the sidecar is not valid JSON`};let n=(t.get(`approved`)??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``);return n.length===0?{outcome:`absent`}:{outcome:`read`,approvals:Object.fromEntries(n.map(e=>[e,{approvedAt:`2026-08-26T00:00:00.000Z`}]))}}function CT(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``).map(e=>{let[t,n]=e.split(`:`);return{id:(t??``).trim(),generates:`${(t??``).trim()}.md`,requires:(n??``).split(`|`).map(e=>e.trim()).filter(e=>e!==``)}})}function wT(e){let t=new URLSearchParams(e),n=t.get(`schema`);if(n===null||n===``)return{openspecYaml:`schema: spec-driven
|
|
1549
|
+
`,known:[aT]};let r=CT(t.get(`artifacts`)??``);return{openspecYaml:`schema: ${n}\n`,known:r.length>0?[aT,{name:n,artifacts:r}]:[aT]}}function TT(e){let t=new URLSearchParams(e).get(`issue`),n=t===null?NaN:Number.parseInt(t,10);return Number.isFinite(n)?DC(n):EC}function ET(e){let t=wT(e);return{changeId:vT,provenance:TT(e),artifacts:yT,folded:bT,openspecYaml:t.openspecYaml,knownSchemas:t.known,facts:xT(e),approvals:ST(e),fixture:!0}}function DT(e){let t=`openspec archive ${e.changeId}`;return(0,C.jsxs)(`section`,{className:`archive-note`,"data-testid":`archive-note`,children:[(0,C.jsx)(`span`,{className:`gate-title`,children:`archiving`}),(0,C.jsxs)(`p`,{"data-testid":`archive-note-together`,children:[`Archiving folds this change's deltas into `,(0,C.jsx)(`code`,{children:`openspec/specs/`}),` and moves its directory to `,(0,C.jsx)(`code`,{children:`openspec/changes/archive/`}),`. The two happen together or not at all — there is no move-only archive, here or anywhere.`]}),(0,C.jsxs)(`p`,{"data-testid":`archive-note-tool`,children:[`The workbench does not perform the fold. `,(0,C.jsx)(`code`,{children:`openspec archive`}),` is the one implementation of it; run it yourself when the change is done:`]}),(0,C.jsx)(`pre`,{className:`archive-command`,"data-testid":`archive-command`,children:(0,C.jsx)(`code`,{children:t})}),(0,C.jsx)(`p`,{className:`surface-note`,"data-testid":`archive-note-order`,"data-state":e.implemented?`due`:`not-due`,children:e.implemented?`This is the last step. The code is built, so the fold records behaviour that exists.`:`Not yet — archiving is the last step, following implementation. What is folded is behaviour that exists, so build the code first.`})]})}function OT(e,t){return e.approved?`done`:e.locked?`locked`:t?`active`:`open`}function kT(e,t){return e.approved?`✓`:e.locked?`🔒`:t?`●`:`○`}function AT(e){let{view:t,exitAction:n}=e;return t.schemaKnown?(0,C.jsxs)(`div`,{className:`stage-rail`,"data-testid":`stage-rail`,children:[(0,C.jsx)(`ol`,{className:`stages`,children:t.stages.map(t=>{let n=e.focusedStage===t.id;return(0,C.jsx)(`li`,{className:`stage-item`,children:(0,C.jsxs)(`button`,{type:`button`,className:`stage`,"data-testid":`stage-${t.id}`,"data-state":OT(t,n),"data-locked":t.locked?`true`:`false`,"aria-current":n?`step`:void 0,onClick:()=>t.locked?e.onRefused(t):e.onSelectStage(t),children:[(0,C.jsx)(`span`,{className:`stage-ordinal`,"aria-hidden":`true`,children:[`①`,`②`,`③`,`④`,`⑤`,`⑥`,`⑦`,`⑧`][t.ordinal-1]??t.ordinal}),(0,C.jsx)(`span`,{className:`stage-label`,children:t.label}),(0,C.jsxs)(`span`,{className:`stage-state`,"data-testid":`stage-state-${t.id}`,children:[(0,C.jsxs)(`span`,{"aria-hidden":`true`,children:[kT(t,n),` `]}),OT(t,n)]}),t.artifactMissing?(0,C.jsx)(`span`,{className:`stage-missing`,"data-testid":`stage-missing-${t.id}`,children:`artifact missing`}):null]})},t.id)})}),(0,C.jsx)(`button`,{type:`button`,className:`stage-exit`,"data-testid":`stage-exit`,"data-kind":n.kind,disabled:n.kind===`ready-to-archive`,onClick:()=>e.onExit(n),children:n.label}),t.stages.length>0&&t.stages.every(e=>e.approved)?(0,C.jsx)(DT,{changeId:e.changeId,implemented:e.implemented}):null]}):(0,C.jsx)(`div`,{className:`stage-rail`,"data-testid":`stage-rail`,role:`alert`,children:(0,C.jsxs)(`p`,{"data-testid":`stage-rail-unknown-schema`,children:["This change's `.openspec.yaml` names",` `,t.schemaName===``?`no schema`:`the \`${t.schemaName}\` schema`,`, whose artifacts are not known here. The stages cannot be derived, so none are shown.`]})})}var jT=[[`j`,`next validity finding`],[`k`,`previous validity finding`],[`n`,`next error`],[`u`,`previous error`],[`?`,`open or close this list`],[`Esc`,`close this list`]];function MT({onClose:e}){let t=(0,_.useRef)(null);return(0,_.useEffect)(()=>{t.current?.focus()},[]),(0,C.jsxs)(`div`,{className:`shortcut-help`,role:`dialog`,"aria-label":`Keyboard shortcuts`,"data-testid":`shortcut-help`,tabIndex:-1,ref:t,children:[(0,C.jsxs)(`header`,{className:`shortcut-help-head`,children:[(0,C.jsx)(`span`,{className:`shortcut-help-title`,children:`keyboard shortcuts`}),(0,C.jsx)(`button`,{type:`button`,"data-testid":`shortcut-help-close`,onClick:e,children:`close`})]}),(0,C.jsx)(`dl`,{className:`shortcut-list`,children:jT.map(([e,t])=>(0,C.jsxs)(`div`,{className:`shortcut-row`,children:[(0,C.jsx)(`dt`,{children:(0,C.jsx)(`kbd`,{children:e})}),(0,C.jsx)(`dd`,{children:t})]},e))})]})}function NT({node:e,depth:t,props:n}){let r=e.children.length>0,i=n.collapsed.has(e.id);return(0,C.jsxs)(`div`,{className:`tree-branch`,children:[(0,C.jsxs)(`div`,{className:`tree-node`,"data-testid":`tree-node`,"data-node-id":e.id,"data-read-only":e.readOnly?`true`:void 0,"data-current":n.currentId===e.id?`true`:void 0,"aria-current":n.currentId===e.id?`location`:void 0,style:{paddingLeft:`${t*.75}rem`},children:[(0,C.jsx)(`button`,{type:`button`,className:`tree-caret`,"data-testid":`tree-toggle-${e.id}`,"aria-label":`${i?`expand`:`collapse`} ${e.label}`,disabled:!r,onClick:()=>n.onToggleCollapse(e.id),children:r?i?`▸`:`▾`:`·`}),(0,C.jsxs)(`button`,{type:`button`,className:`tree-select`,"data-testid":`tree-select-${e.id}`,onClick:()=>n.onSelect(e),children:[(0,C.jsx)(`span`,{className:`tree-label`,children:e.label}),e.readOnly?(0,C.jsxs)(`span`,{className:`tree-lock`,"data-testid":`tree-lock-${e.id}`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`🔒 `}),`read only`]}):null,(0,C.jsx)(`span`,{className:`tree-status`,children:e.status})]})]}),r&&!i?(0,C.jsx)(`div`,{className:`tree-children`,children:e.children.map(e=>(0,C.jsx)(NT,{node:e,depth:t+1,props:n},e.id))}):null]})}function PT(e){return(0,C.jsx)(`div`,{className:`tree`,"data-testid":`tree`,children:e.nodes.map(t=>(0,C.jsx)(NT,{node:t,depth:0,props:e},t.id))})}function FT(e,t){if(e===`specs`)return t.find(e=>e.endsWith(`/spec.md`))??null;let n=`${e}.md`;return t.includes(n)?n:null}var IT=[`proposal`,`specs`,`design`,`tasks`,`implemented`];function LT(e){return IT.find(t=>t===e)??`proposal`}function RT(e){if(e.endsWith(`/spec.md`))return`specs`;let t=/^([a-z]+)\.md$/.exec(e);return t?t[1]:null}function zT({boot:e,approvalPort:t}={}){let n=(0,_.useMemo)(()=>e??ET(window.location.search),[e]),[r,i]=(0,_.useState)(()=>{let e=Object.fromEntries(n.artifacts.map(e=>[e.artifact,e.content]));return`proposal.md`in e?e:{...e,"proposal.md":NC(SC(window.localStorage).read().proposalTemplate,n.provenance)}}),[a]=(0,_.useState)(()=>Object.fromEntries(n.folded.map(e=>[`${Uo}:${e.capability}/spec.md`,e.content]))),[o,s]=(0,_.useState)(`proposal.md`),[c,l]=(0,_.useState)(`${Ho}:proposal.md`),[u,d]=(0,_.useState)(new Set),[f,p]=(0,_.useState)({source:!0,preview:!0}),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(n.approvals),[y,b]=(0,_.useState)(null),[x,ee]=(0,_.useState)(`proposal`),[te,S]=(0,_.useState)([]),[re,ie]=(0,_.useState)(!0),[ae,ue]=(0,_.useState)(!1),de=(0,_.useRef)(null),[w,T]=(0,_.useState)(n.facts.implemented),[fe,pe]=(0,_.useState)(null),[me,he]=(0,_.useState)(!1),ge=(0,_.useMemo)(()=>SC(window.localStorage),[]),[E,_e]=(0,_.useState)(()=>ge.read()),[ve,ye]=(0,_.useState)(null),[be,xe]=(0,_.useState)(null),[Se,Ce]=(0,_.useState)([]),we=(0,_.useMemo)(()=>le(window.location.search),[]),[Te,Ee]=(0,_.useState)(()=>oe(window.localStorage)),De=(0,_.useMemo)(()=>ne(we,Te),[we,Te]),Oe=(0,_.useMemo)(()=>t??(n.fixture?VT(n.changeId):aw()),[t,n.fixture,n.changeId]);(0,_.useEffect)(()=>{let e=!1;return Oe.read().then(t=>{e||v(t)}),()=>{e=!0}},[Oe]);let ke=(0,_.useMemo)(()=>Object.keys(r),[r]),Ae=(0,_.useMemo)(()=>Qo({changeId:n.changeId,artifacts:ke.map(e=>({artifact:e,content:r[e]})),folded:n.folded}),[n.changeId,n.folded,ke,r]),je=(0,_.useMemo)(()=>sT(n.openspecYaml,n.knownSchemas),[n.openspecYaml,n.knownSchemas]),Me=$C(g),Ne=(0,_.useMemo)(()=>({completion:Object.fromEntries((je.kind===`resolved`?je.schema.artifacts:[]).map(e=>{let t=FT(e.id,ke);return[e.id,t!==null&&(r[t]??``).trim()!==``]})),approvals:Me===null?{}:ew(Me),facts:{implemented:w,archived:n.facts.archived}}),[je,ke,r,Me,w,n.facts.archived]),D=(0,_.useMemo)(()=>dT(je,Ne),[je,Ne]),Pe=(0,_.useMemo)(()=>pT(D,x),[D,x]),Fe=c===null?null:es(Ae,c),Ie=Fe?.readOnly===!0,Le=Ie?a[o]??``:r[o]??``,Re=(0,_.useMemo)(()=>is(Ae,c),[Ae,c]),ze=(0,_.useMemo)(()=>({artifacts:ke,buffers:r,openCapabilities:ke.map(e=>/^specs\/([^/]+)\/spec\.md$/.exec(e)?.[1]).filter(e=>e!==void 0),citable:YS(r).map(e=>({capability:e.capability,key:e.name}))}),[ke,r]),Be=(0,_.useMemo)(()=>({buffers:r,folded:n.folded.map(e=>e.capability),template:E.proposalTemplate,offers:Object.fromEntries(kS(E.agentScript).subagents.map(e=>[e.name,e.description??``]))}),[r,n.folded,E]),Ve=(0,_.useMemo)(()=>XS(w?`implemented`:LT(x),Be),[w,x,Be]);(0,_.useEffect)(()=>{window.__workbench={buffers:()=>r}},[r]),(0,_.useEffect)(()=>{let e=e=>{e.key===`,`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),he(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,_.useEffect)(()=>{let e=e=>{let t=e.target,n=UC({key:e.key,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,typing:WC(t instanceof HTMLElement?{tagName:t.tagName,isContentEditable:t.isContentEditable,type:t instanceof HTMLInputElement?t.type:void 0}:null),confirmOpen:document.querySelector(`[role="alertdialog"]`)!==null,helpOpen:ae});if(n!==null)switch(e.preventDefault(),n){case`next-delta`:qC(document,1,!1);return;case`prev-delta`:qC(document,-1,!1);return;case`next-unviewed`:qC(document,1,!0);return;case`prev-unviewed`:qC(document,-1,!0);return;case`toggle-help`:ae?Ue.current():(de.current=document.activeElement instanceof HTMLElement?document.activeElement:null,ue(!0));return;case`close-help`:Ue.current();return}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ae]);let He=(0,_.useCallback)(()=>{ue(!1),de.current?.focus()},[]),Ue=(0,_.useRef)(He);Ue.current=He;let[We,Ge]=(0,_.useState)({}),[Ke,qe]=(0,_.useState)({}),Je=(0,_.useCallback)(async(e,t,r)=>{if(n.fixture)return{outcome:`written`};try{let n=await(await fetch(`/api/workbench/artifact`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r?{artifact:e,content:t,overwrite:r}:{artifact:e,content:t})})).json();if(n.result?.outcome===`written`)return{outcome:`written`};let i=n.result?.reason??`\`${e}\`: the write was refused`;return n.result?.outcome===`changed-underneath`&&qe(t=>({...t,[e]:i})),{outcome:`failed`,reason:i}}catch(e){return{outcome:`failed`,reason:e.message}}},[n.fixture]),Ye=(0,_.useMemo)(()=>new PC({write:(e,t)=>Je(e,t,!1),onStatus:e=>Ge(t=>({...t,[e.artifact]:e}))}),[Je]),Xe=(0,_.useCallback)(async(e,t)=>{let n=We[e];if(qe(t=>{let n={...t};return delete n[e],n}),t===`overwrite`){await Je(e,n?.content??``,!0);return}let r=(await(await fetch(`/api/workbench/artifact?artifact=${encodeURIComponent(e)}`)).json()).result?.content??``;i(t=>e in t?{...t,[e]:r}:t)},[We,Je]),Ze=(0,_.useCallback)((e,t)=>{i(n=>e in n?{...n,[e]:t}:n),Ye.edit(e,t)},[Ye]);(0,_.useEffect)(()=>{if(n.fixture)return;let e=!1;return(async()=>{if(await Ye.settled(),e)return;let t=await VC(Object.keys(r));e||(xe(t.validity),Ce(t.unreadable),t.appeared.length>0&&i(e=>{let n=t.appeared.filter(t=>!(t.artifact in e));return n.length===0?e:{...e,...Object.fromEntries(n.map(e=>[e.artifact,e.content]))}}))})(),()=>{e=!0}},[n.fixture,Ye,r]);let Qe=(0,_.useCallback)(e=>{if(l(e.id),h(null),e.artifact!==null&&(s(e.artifact),!e.readOnly)){let t=RT(e.artifact);t!==null&&ee(t)}},[]),$e=(0,_.useCallback)(e=>{let t=es(Ae,`${Ho}:${e}`);t!==null&&Qe(t)},[Ae,Qe]),et=(0,_.useCallback)(e=>{let t=/^openspec\/specs\/(.+)$/.exec(e)?.[1],n=es(Ae,t===void 0?`${Ho}:${e}`:`${Uo}:${t}`);n!==null&&Qe(n)},[Ae,Qe]),tt=e=>{ie(!0),S(t=>[...t,{kind:`refusal`,text:fT(e,D)}])},nt=e=>{ee(e.id);let t=FT(e.id,ke);t!==null&&$e(t)},rt=async e=>{if(e.kind===`ready-to-archive`)return;if(e.kind===`implement`){T(!0),ie(!0),S(e=>[...e,{kind:`note`,text:oC(n.changeId)}]);return}let t=await Oe.write(e.stage,!0);if(t.outcome===`failed`){b(nw(t));return}b(null);let r=mT(je,Ne,e.stage);v({outcome:`read`,approvals:t.approvals});let i=iw(e.stage,new Date().toISOString());pe(i);let a=FS(E.agentScript,i.variable,!0);if(ye(a.report),a.report===null){let e={...E,agentScript:a.source};_e(e),ge.write(e)}let o=r[0];if(o!==void 0){ee(o.id);let e=FT(o.id,ke);e!==null&&$e(e)}},it=async e=>{if(n.fixture)return uC(e,Re,ze,Be);await Ye.settled();let t=await(await fetch(`/api/workbench/agent/turn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({prompt:e,scope:Re.file,buffers:r,openCapabilities:ze.openCapabilities})})).json(),i=t.outcome??{};return{kind:i.kind??`failed`,answer:i.answer??``,served:i.served??``,proposals:t.proposals??[],read:t.read??[],...i.reason===void 0?{}:{reason:i.reason}}},at=e=>{if(e.kind===`refused`)return;let t=r[e.artifact]??``;Ze(e.artifact,zo(t,e)),$e(e.artifact)},ot=AC(r[`proposal.md`]??``),st=tw(g);return(0,C.jsxs)(`div`,{className:`workbench`,"data-testid":`workbench`,"data-rail-open":re?`true`:`false`,children:[me?(0,C.jsx)(TC,{settings:E,machine:we,credential:De,selection:Te,onSelectSource:e=>{se(window.localStorage,e),Ee(e)},onClearSelection:()=>{ce(window.localStorage),Ee(null)},onSave:e=>{_e(e),ge.write(e),he(!1)},onDismiss:()=>he(!1)}):null,(0,C.jsxs)(`nav`,{className:`workbench-nav`,"data-testid":`nav`,"aria-label":`Change`,children:[(0,C.jsx)(PT,{nodes:Ae,currentId:c,collapsed:u,onSelect:Qe,onToggleCollapse:e=>d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}),(0,C.jsx)(QC,{validity:be,artifacts:ke,onOpenArtifact:$e}),(0,C.jsx)(`button`,{type:`button`,className:`shortcut-help-toggle`,"data-testid":`shortcut-help-toggle`,onClick:()=>{de.current=document.activeElement instanceof HTMLElement?document.activeElement:null,ue(!0)},children:`? shortcuts`})]}),ae?(0,C.jsx)(MT,{onClose:He}):null,(0,C.jsxs)(`main`,{className:`workbench-main`,"data-testid":`main`,children:[(0,C.jsx)(`p`,{className:`provenance-strip`,"data-testid":`provenance-strip`,children:MC(ot)}),st===null?null:(0,C.jsx)(`p`,{className:`approval-store-failure`,"data-testid":`approval-store-failure`,role:`alert`,children:st}),Se.length>0?(0,C.jsx)(`p`,{className:`refresh-unreadable`,"data-testid":`refresh-unreadable`,role:`alert`,children:Se.map(e=>`${e.artifact} is on disk and could not be read (${e.reason})`).join(`; `)}):null,y===null?null:(0,C.jsx)(`p`,{className:`approval-write-failure`,"data-testid":`approval-write-failure`,role:`alert`,children:y}),(0,C.jsx)(AT,{view:D,changeId:n.changeId,implemented:w,focusedStage:x,exitAction:Pe,onSelectStage:nt,onRefused:tt,onExit:e=>void rt(e)}),fe===null?null:(0,C.jsxs)(`p`,{className:`approval-published`,"data-testid":`approval-published`,children:[`approved `,(0,C.jsx)(`code`,{children:fe.stage}),` at `,fe.approvedAt,` — published as`,` `,(0,C.jsx)(`code`,{children:fe.variable})]}),ve===null?null:(0,C.jsx)(`p`,{className:`approval-write-back`,"data-testid":`approval-write-back`,role:`note`,children:ve}),(0,C.jsx)(rT,{artifact:Ie?Fe?.label??o:o,content:Le,readOnly:Ie,panes:f,paneRefusal:m,onTogglePane:e=>{let t=iT(f,e);p(t.panes),h(t.refusal)},onEdit:e=>Ze(o,e),status:We[o]??null,conflict:Ke[o]??null,onResolveConflict:e=>void Xe(o,e)})]}),re?(0,C.jsx)(us,{scope:Re,buffers:r,machine:we,selection:Te,entries:te,onSelectSource:e=>{se(window.localStorage,e),Ee(e)},onClearSelection:()=>{ce(window.localStorage),Ee(null)},onClose:()=>ie(!1),onRunTurn:it,onAccept:at,handoff:Ve,onOpenFile:et,onOpenSettings:()=>he(!0)}):(0,C.jsxs)(`button`,{type:`button`,className:`rail-open`,"data-testid":`rail-open`,onClick:()=>ie(!0),children:[`open the agent rail — `,ss(Re).length,` prompts for `,Re.file]})]})}var BT=`2026-08-26T00:00:00.000Z`;function VT(e){let t=`specsketch.fixture.approvals.${e}`,n=()=>{let e=window.localStorage.getItem(t);return e===null?{}:JSON.parse(e)};return{read:async()=>{let e=new URLSearchParams(window.location.search);if(e.get(`approvals`)===`unreadable`)return{outcome:`unreadable`,reason:`the sidecar is not valid JSON`};let t=(e.get(`approved`)??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``),r=n(),i={...Object.fromEntries(t.map(e=>[e,{approvedAt:BT}])),...r};return Object.keys(i).length===0?{outcome:`absent`}:{outcome:`read`,approvals:i}},write:async(e,r)=>{let i={...n()};r?i[e]={approvedAt:new Date().toISOString()}:delete i[e],window.localStorage.setItem(t,JSON.stringify(i));let a=(new URLSearchParams(window.location.search).get(`approved`)??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``);return{outcome:`written`,approvals:{...Object.fromEntries(a.map(e=>[e,{approvedAt:BT}])),...i}}}}}function HT(e){return Array.isArray(e.artifacts)?e.artifacts.filter(e=>e.outcome===`unreadable`||e.outcome===`refused`):[]}function UT(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.changeId==`string`&&Array.isArray(t.artifacts)}function WT(e){return e.artifacts.flatMap(e=>e.outcome===`read`?[{artifact:e.artifact,content:e.content}]:[])}function GT(e,t){let n=e.schema.schema?.name??e.schema.name??``;return{changeId:e.changeId,provenance:{kind:`none`},artifacts:WT(e),folded:t,openspecYaml:e.openspecYaml??(n===``?``:`schema: ${n}\n`),knownSchemas:e.schema.schema?[e.schema.schema,aT]:[aT],facts:{implemented:e.implemented===!0,archived:e.archived===!0},approvals:e.approvals??{outcome:`absent`},fixture:!1}}async function KT(){let e=await fetch(`/api/workbench/capabilities`);if(!e.ok)throw Error(`host responded ${e.status} listing capabilities`);let t=((await e.json()).capabilities??[]).map(e=>e.name);return(await Promise.all(t.map(async e=>{let t=await fetch(`/api/workbench/capabilities/${e}`);if(!t.ok)return null;let n=await t.json();return n.result?.outcome===`opened`&&n.result.folded!==void 0?{capability:e,content:n.result.folded}:null}))).filter(e=>e!==null)}function qT(){let[e,t]=(0,_.useState)(()=>new URLSearchParams(window.location.search).get(`fixture`)===`1`?{kind:`fixture`}:{kind:`loading`});return(0,_.useEffect)(()=>{if(e.kind!==`loading`)return;let n=!1;return(async()=>{try{let e=await fetch(`/api/workbench/context`);if(!e.ok)throw Error(`host responded ${e.status}`);let r=await e.json();if(!UT(r))throw Error(`the host answered with a payload this shell cannot read`);let i=r,a=i.folded??await KT();n||t({kind:`ready`,context:i,folded:a})}catch(e){n||t({kind:`unreachable`,detail:e instanceof Error?e.message:String(e)})}})(),()=>{n=!0}},[e.kind]),e.kind===`loading`?(0,C.jsx)(`p`,{"data-testid":`boot-loading`,children:`reading the repository…`}):e.kind===`unreachable`?(0,C.jsxs)(`div`,{"data-testid":`boot-unreachable`,role:`alert`,children:[(0,C.jsx)(`h1`,{children:`could not reach the workbench host`}),(0,C.jsx)(`p`,{children:e.detail}),(0,C.jsx)(`p`,{children:`The workbench reads the repository through its host. It has not fallen back to demo data, because that would look exactly like a successful start.`})]}):e.kind===`fixture`?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{"data-testid":`boot-fixture-banner`,children:`showing the demo fixture — not this repository`}),(0,C.jsx)(zT,{boot:ET(window.location.search)})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`p`,{"data-testid":`boot-context`,children:[e.context.changeId,` — `,e.context.resuming?`resuming`:`new draft`,` in`,` `,e.context.repoRoot]}),HT(e.context).length>0?(0,C.jsxs)(`p`,{"data-testid":`boot-unreadable-artifacts`,role:`alert`,children:[`some artifacts of this change could not be read:`,` `,HT(e.context).map(e=>`${e.artifact} (${`reason`in e?e.reason:`no reason given`})`).join(`; `)]}):null,(0,C.jsx)(zT,{boot:GT(e.context,e.folded)})]})}var JT=document.getElementById(`root`);if(!JT)throw Error(`Missing #root element`);(0,v.createRoot)(JT).render((0,C.jsx)(_.StrictMode,{children:(0,C.jsx)(qT,{})}));export{o as n,c as r,pw as t};
|