@economic/agents-playground 0.0.1-beta.5 → 0.0.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/README.md +9 -9
- package/dist/assets/{_basePickBy-L9tJjs4k.js → _basePickBy-BJ_rm3-n.js} +1 -1
- package/dist/assets/{_baseUniq-CJGmJ2Kn.js → _baseUniq-BGPNLZq7.js} +1 -1
- package/dist/assets/architecture-PBZL5I3N-BqR3gJ-S.js +1 -0
- package/dist/assets/architectureDiagram-2XIMDMQ5-Ci6lZRdi.js +36 -0
- package/dist/assets/{blockDiagram-WCTKOSBZ-ByDlnt_h.js → blockDiagram-WCTKOSBZ-Bs2dO4Lh.js} +1 -1
- package/dist/assets/{chunk-7E7YKBS2-DC6Ssfw1.js → chunk-7E7YKBS2-CjPkysZ4.js} +1 -1
- package/dist/assets/{chunk-C72U2L5F-DyqCQIE3.js → chunk-C72U2L5F-B11-t4Kx.js} +1 -1
- package/dist/assets/{chunk-EGIJ26TM-B7Ugi6e1.js → chunk-EGIJ26TM-Dn67x_wP.js} +1 -1
- package/dist/assets/{chunk-L3YUKLVL-qKwCol5r.js → chunk-L3YUKLVL-B6prTSRj.js} +1 -1
- package/dist/assets/{chunk-NQ4KR5QH-DWw53kPv.js → chunk-NQ4KR5QH-CgXz_uQQ.js} +1 -1
- package/dist/assets/{chunk-OZEHJAEY-BmfGg85m.js → chunk-OZEHJAEY-DFGloWwN.js} +1 -1
- package/dist/assets/{chunk-R5LLSJPH-DYLrvrgX.js → chunk-R5LLSJPH-iHaJebab.js} +1 -1
- package/dist/assets/{chunk-WL4C6EOR-DzVRiTF5.js → chunk-WL4C6EOR-BTGOslpF.js} +1 -1
- package/dist/assets/{chunk-XIRO2GV7-DDoKknvy.js → chunk-XIRO2GV7-BbBu2-ax.js} +1 -1
- package/dist/assets/{chunk-XZSTWKYB-CvLuTGQr.js → chunk-XZSTWKYB-CR7HLNO4.js} +1 -1
- package/dist/assets/classDiagram-VBA2DB6C-DET8D2F6.js +1 -0
- package/dist/assets/classDiagram-v2-RAHNMMFH-C_pvaxDg.js +1 -0
- package/dist/assets/clone-DCUYwHc1.js +1 -0
- package/dist/assets/{dagre-BJ0Et-5X.js → dagre-DHSLkSfU.js} +1 -1
- package/dist/assets/dagre-KLK3FWXG-CsIRyGd-.js +4 -0
- package/dist/assets/diagram-E7M64L7V-eMkzKdKv.js +24 -0
- package/dist/assets/diagram-IFDJBPK2-BDQnMPef.js +43 -0
- package/dist/assets/diagram-P4PSJMXO-C1pGlueJ.js +24 -0
- package/dist/assets/{erDiagram-INFDFZHY-C0BMPOrX.js → erDiagram-INFDFZHY-oSJOQVMl.js} +1 -1
- package/dist/assets/{flowDiagram-PKNHOUZH-B2fIxLUm.js → flowDiagram-PKNHOUZH-DCjCL66H.js} +1 -1
- package/dist/assets/ganttDiagram-A5KZAMGK-BEoHssiP.js +292 -0
- package/dist/assets/gitGraph-HDMCJU4V-Cldfavhj.js +1 -0
- package/dist/assets/gitGraphDiagram-K3NZZRJ6-BaVomO0E.js +65 -0
- package/dist/assets/{graphlib-CmaOUyjl.js → graphlib-sSK0q0jO.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BKuJC0rZ.js → highlighted-body-OFNGDK62-BWa9Mb0y.js} +1 -1
- package/dist/assets/{index-rODTN5ZH.js → index-D8W5OEji.js} +8 -8
- package/dist/assets/info-3K5VOQVL-Bp03asUc.js +1 -0
- package/dist/assets/infoDiagram-LFFYTUFH-BpLjxnPR.js +2 -0
- package/dist/assets/{ishikawaDiagram-PHBUUO56-COt-f3vI.js → ishikawaDiagram-PHBUUO56-KwEjkSbo.js} +1 -1
- package/dist/assets/{journeyDiagram-4ABVD52K-C-U1F_87.js → journeyDiagram-4ABVD52K-BbJAX67K.js} +1 -1
- package/dist/assets/{kanban-definition-K7BYSVSG-CBurs7Od.js → kanban-definition-K7BYSVSG-qoQ-gouW.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BonhTQ8Y.js +1 -0
- package/dist/assets/mermaid-parser.core-zSGpBtrZ.js +4 -0
- package/dist/assets/{mindmap-definition-YRQLILUH-BgwlrWWN.js → mindmap-definition-YRQLILUH-a6cg75mj.js} +1 -1
- package/dist/assets/packet-RMMSAZCW-DZw3Th1z.js +1 -0
- package/dist/assets/pie-UPGHQEXC-Boxmvw0_.js +1 -0
- package/dist/assets/{pieDiagram-SKSYHLDU-DQ65vLhm.js → pieDiagram-SKSYHLDU-Ba8_qWtW.js} +1 -1
- package/dist/assets/{quadrantDiagram-337W2JSQ-C3xMuDjL.js → quadrantDiagram-337W2JSQ-BYRgqy3l.js} +1 -1
- package/dist/assets/radar-KQ55EAFF-CMpoCV22.js +1 -0
- package/dist/assets/{requirementDiagram-Z7DCOOCP-BT86nLzI.js → requirementDiagram-Z7DCOOCP-bWlpEI8M.js} +1 -1
- package/dist/assets/{sequenceDiagram-2WXFIKYE-C_zZdkM7.js → sequenceDiagram-2WXFIKYE-DXTnjjaR.js} +1 -1
- package/dist/assets/stateDiagram-RAJIS63D-BEPLG8-b.js +1 -0
- package/dist/assets/stateDiagram-v2-FVOUBMTO-Cn3GtrPV.js +1 -0
- package/dist/assets/treemap-KZPCXAKY-C2Yo6dTQ.js +1 -0
- package/dist/assets/{vennDiagram-LZ73GAT5-CwTLFBJg.js → vennDiagram-LZ73GAT5-Bl0Pzjn6.js} +1 -1
- package/dist/assets/{xychartDiagram-JWTSCODW-BvFKMIoI.js → xychartDiagram-JWTSCODW-BCXHFEAl.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/dist/assets/architecture-PBZL5I3N-D2-4uytP.js +0 -1
- package/dist/assets/architectureDiagram-2XIMDMQ5-CzwfKASt.js +0 -36
- package/dist/assets/classDiagram-VBA2DB6C-BFf1_hDn.js +0 -1
- package/dist/assets/classDiagram-v2-RAHNMMFH-Cc_Q9nD6.js +0 -1
- package/dist/assets/clone-CjD8itTD.js +0 -1
- package/dist/assets/dagre-KLK3FWXG-Cj4lt3rZ.js +0 -4
- package/dist/assets/diagram-E7M64L7V-Con9XOMz.js +0 -24
- package/dist/assets/diagram-IFDJBPK2-DLBrjdhF.js +0 -43
- package/dist/assets/diagram-P4PSJMXO-D5R-VbFF.js +0 -24
- package/dist/assets/ganttDiagram-A5KZAMGK-CS4Q9uqC.js +0 -292
- package/dist/assets/gitGraph-HDMCJU4V-C5SnLwfc.js +0 -1
- package/dist/assets/gitGraphDiagram-K3NZZRJ6-Cv0H9yt2.js +0 -65
- package/dist/assets/info-3K5VOQVL-DdjJmzis.js +0 -1
- package/dist/assets/infoDiagram-LFFYTUFH-BX45-9cE.js +0 -2
- package/dist/assets/mermaid-GHXKKRXX-Dar-R5At.js +0 -1
- package/dist/assets/mermaid-parser.core-Bzr6VxwG.js +0 -4
- package/dist/assets/packet-RMMSAZCW-kdWIWETB.js +0 -1
- package/dist/assets/pie-UPGHQEXC-BNgd9bxQ.js +0 -1
- package/dist/assets/radar-KQ55EAFF-B8qgTldE.js +0 -1
- package/dist/assets/stateDiagram-RAJIS63D-LjyoGrQS.js +0 -1
- package/dist/assets/stateDiagram-v2-FVOUBMTO-bXfl44aF.js +0 -1
- package/dist/assets/treemap-KZPCXAKY-DoXzvv-b.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CLN8hUkL.js","assets/chunk-CFjPhJqf.js","assets/html-BssphMwH.js","assets/css-Dpwu4hnV.js","assets/javascript-Disn4kvK.js","assets/angular-ts-BTf_6UJD.js","assets/scss-CIxECQd8.js","assets/apl-Dmey0I11.js","assets/json-2ARyELAv.js","assets/xml-ChOqEror.js","assets/java-Ca11plGa.js","assets/astro-rxUfhFen.js","assets/postcss-BaPK48jz.js","assets/tsx-BAkfWjS_.js","assets/typescript-Cwv1ZgFx.js","assets/blade-kNr4IyDc.js","assets/html-derivative-DS9un8R5.js","assets/sql-kL5DzYk5.js","assets/bsl-D3T-XG_R.js","assets/sdbl-DWnO-pW9.js","assets/c-D7c2HeJv.js","assets/cairo-Q_T2FuvI.js","assets/python-BGHBflPa.js","assets/cobol-DUGsMi7x.js","assets/coffee-D6yCj3Fh.js","assets/cpp-C9vOIeRa.js","assets/glsl-DfZK2zwb.js","assets/regexp-DFBvo9yN.js","assets/crystal-vlsZ77US.js","assets/shellscript-TQe97AAy.js","assets/edge-BQDMv7EU.js","assets/elixir-BGa8FZWt.js","assets/elm-BZBzk4O6.js","assets/erb-CXANWvrV.js","assets/ruby-BNSv-oU-.js","assets/graphql-BvlJIw0p.js","assets/jsx-ERM13yPu.js","assets/haml-zahW1gi7.js","assets/lua-Ds5agjrK.js","assets/yaml-DyGG0X6u.js","assets/erlang-R9i3kMP5.js","assets/markdown-pW8niWsW.js","assets/fortran-fixed-form-CHZzH8CX.js","assets/fortran-free-form-DQ6cnx5P.js","assets/fsharp-Bh8uGiJv.js","assets/gdresource-BMHd1vI1.js","assets/gdscript-0eY0tghO.js","assets/gdshader-qIQewyec.js","assets/git-commit-CAgaRK7M.js","assets/diff-9DLIDTu5.js","assets/git-rebase-Bk7h7XWM.js","assets/glimmer-js-DMPZB9YH.js","assets/glimmer-ts-8NAYBR_3.js","assets/hack-Cn3_qbkK.js","assets/handlebars-1cVzqGiW.js","assets/http-DEUbK2Ow.js","assets/hurl-DGuWDZ_u.js","assets/csv-CCnBNHSl.js","assets/hxml-QnJ9WbXI.js","assets/haxe-BClgBASn.js","assets/jinja-rLVReIms.js","assets/jison-BzgF2_KT.js","assets/julia-B1jrbcOg.js","assets/r-Chj4EctZ.js","assets/just-snq5kZBw.js","assets/perl-rw6dCmyC.js","assets/latex-BvDjRVc0.js","assets/tex-DOsiCa_c.js","assets/liquid-B7K9LsH3.js","assets/marko-tunMYIMX.js","assets/less-CmMf7Yt5.js","assets/mdc-BKL4gNEO.js","assets/nextflow-iKg2KdJ3.js","assets/nextflow-groovy-DfRCsnXR.js","assets/nginx-CH3xVIaf.js","assets/nim-CtUjtqDv.js","assets/php-CylCtQAb.js","assets/pug-C1MHqzjK.js","assets/qml-DNAE9-n1.js","assets/razor-B0hS086G.js","assets/csharp-BVUqvcsv.js","assets/rst-Cyi2ugj1.js","assets/cmake-8InvLTn8.js","assets/sas-B2GB4sFz.js","assets/shaderlab-B3KmLsfH.js","assets/hlsl-D0j01cr3.js","assets/shellsession-h56xzAJT.js","assets/soy-Bg3kp6Vd.js","assets/sparql-B7pQSNyT.js","assets/turtle-DMmncelR.js","assets/stata-FbZLeckc.js","assets/surrealql-40vNa1_u.js","assets/svelte-DxuRq8JZ.js","assets/templ-BPbj7dwT.js","assets/go-CH_yyiUM.js","assets/ts-tags-2EuNMnfN.js","assets/twig-CY4Ir08O.js","assets/vue-B9qMus9W.js","assets/vue-html-CdUGrliw.js","assets/vue-vine-81O3RRX2.js","assets/stylus-B5_eVOG1.js","assets/xsl-C89zcMFS.js","assets/dagre-KLK3FWXG-
|
|
2
|
-
import{a as e,n as t,o as n,r,t as i}from"./chunk-CFjPhJqf.js";import{t as a}from"./preload-helper-DSXbuxSR.js";import{t as o}from"./katex--tSeZgTA.js";import{_ as s,g as c,h as l,p as u}from"./src-B0URjIBy.js";import{F as d,G as f,H as p,J as m,M as h,N as g,S as _,T as v,X as y,Y as b,Z as x,b as S,c as C,f as w,g as T,h as E,l as D,n as O,p as k,r as ee,s as A,t as j,w as M,x as N,y as P,z as F}from"./chunk-7R4GIKGN-B0Nk6xl6.js";import{a as te,d as ne,h as re,i as I,m as ie,r as ae,u as oe}from"./chunk-GEFDOKGD-D5eIWnuf.js";import"./chunk-MX3YWQON-FdgNOTEP.js";import"./dist-CpWSQIlk.js";import{B as se,E as ce,G as le,L as ue,U as de,b as fe,g as pe,p as me,v as he,w as ge,x as _e,z as ve}from"./_createAssigner-BmxrMTIs.js";import"./chunk-YBOYWFTD-i-hva81G.js";import"./chunk-PQ6SQG4A-DB1drAIU.js";import{i as ye,o as be}from"./chunk-PU5JKC2W-KA2MZku5.js";import{a as xe,i as Se,s as Ce}from"./chunk-KYZI473N-CXcIXlKo.js";import{a as we,i as Te,n as Ee,r as De}from"./chunk-O4XLMI2P-n-oWchCV.js";(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 Oe=i((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 S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 M(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,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(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+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(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 N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(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 F=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)},te={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=te,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=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.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)!T.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 E(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)T.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 E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),ke=i(((e,t)=>{t.exports=Oe()})),Ae=i((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,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){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&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(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`):w=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(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),je=i(((e,t)=>{t.exports=Ae()})),Me=i((e=>{var t=ke();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.4`})),Ne=i(((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=Me()})),Pe=i((e=>{var t=je(),n=ke(),r=Ne();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 u(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 d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function A(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?A(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return A(e(t))}catch{}}return null}var j=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},F=[],te=-1;function ne(e){return{current:e}}function re(e){0>te||(e.current=F[te],F[te]=null,te--)}function I(e,t){te++,F[te]=e.current,e.current=t}var ie=ne(null),ae=ne(null),oe=ne(null),se=ne(null);function ce(e,t){switch(I(oe,t),I(ae,e),I(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ef(t),e=tf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(ie),I(ie,e)}function le(){re(ie),re(ae),re(oe)}function ue(e){e.memoizedState!==null&&I(se,e);var t=ie.current,n=tf(t,e.type);t!==n&&(I(ae,e),I(ie,n))}function de(e){ae.current===e&&(re(ie),re(ae)),se.current===e&&(re(se),dp._currentValue=P)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CLN8hUkL.js","assets/chunk-CFjPhJqf.js","assets/html-BssphMwH.js","assets/css-Dpwu4hnV.js","assets/javascript-Disn4kvK.js","assets/angular-ts-BTf_6UJD.js","assets/scss-CIxECQd8.js","assets/apl-Dmey0I11.js","assets/json-2ARyELAv.js","assets/xml-ChOqEror.js","assets/java-Ca11plGa.js","assets/astro-rxUfhFen.js","assets/postcss-BaPK48jz.js","assets/tsx-BAkfWjS_.js","assets/typescript-Cwv1ZgFx.js","assets/blade-kNr4IyDc.js","assets/html-derivative-DS9un8R5.js","assets/sql-kL5DzYk5.js","assets/bsl-D3T-XG_R.js","assets/sdbl-DWnO-pW9.js","assets/c-D7c2HeJv.js","assets/cairo-Q_T2FuvI.js","assets/python-BGHBflPa.js","assets/cobol-DUGsMi7x.js","assets/coffee-D6yCj3Fh.js","assets/cpp-C9vOIeRa.js","assets/glsl-DfZK2zwb.js","assets/regexp-DFBvo9yN.js","assets/crystal-vlsZ77US.js","assets/shellscript-TQe97AAy.js","assets/edge-BQDMv7EU.js","assets/elixir-BGa8FZWt.js","assets/elm-BZBzk4O6.js","assets/erb-CXANWvrV.js","assets/ruby-BNSv-oU-.js","assets/graphql-BvlJIw0p.js","assets/jsx-ERM13yPu.js","assets/haml-zahW1gi7.js","assets/lua-Ds5agjrK.js","assets/yaml-DyGG0X6u.js","assets/erlang-R9i3kMP5.js","assets/markdown-pW8niWsW.js","assets/fortran-fixed-form-CHZzH8CX.js","assets/fortran-free-form-DQ6cnx5P.js","assets/fsharp-Bh8uGiJv.js","assets/gdresource-BMHd1vI1.js","assets/gdscript-0eY0tghO.js","assets/gdshader-qIQewyec.js","assets/git-commit-CAgaRK7M.js","assets/diff-9DLIDTu5.js","assets/git-rebase-Bk7h7XWM.js","assets/glimmer-js-DMPZB9YH.js","assets/glimmer-ts-8NAYBR_3.js","assets/hack-Cn3_qbkK.js","assets/handlebars-1cVzqGiW.js","assets/http-DEUbK2Ow.js","assets/hurl-DGuWDZ_u.js","assets/csv-CCnBNHSl.js","assets/hxml-QnJ9WbXI.js","assets/haxe-BClgBASn.js","assets/jinja-rLVReIms.js","assets/jison-BzgF2_KT.js","assets/julia-B1jrbcOg.js","assets/r-Chj4EctZ.js","assets/just-snq5kZBw.js","assets/perl-rw6dCmyC.js","assets/latex-BvDjRVc0.js","assets/tex-DOsiCa_c.js","assets/liquid-B7K9LsH3.js","assets/marko-tunMYIMX.js","assets/less-CmMf7Yt5.js","assets/mdc-BKL4gNEO.js","assets/nextflow-iKg2KdJ3.js","assets/nextflow-groovy-DfRCsnXR.js","assets/nginx-CH3xVIaf.js","assets/nim-CtUjtqDv.js","assets/php-CylCtQAb.js","assets/pug-C1MHqzjK.js","assets/qml-DNAE9-n1.js","assets/razor-B0hS086G.js","assets/csharp-BVUqvcsv.js","assets/rst-Cyi2ugj1.js","assets/cmake-8InvLTn8.js","assets/sas-B2GB4sFz.js","assets/shaderlab-B3KmLsfH.js","assets/hlsl-D0j01cr3.js","assets/shellsession-h56xzAJT.js","assets/soy-Bg3kp6Vd.js","assets/sparql-B7pQSNyT.js","assets/turtle-DMmncelR.js","assets/stata-FbZLeckc.js","assets/surrealql-40vNa1_u.js","assets/svelte-DxuRq8JZ.js","assets/templ-BPbj7dwT.js","assets/go-CH_yyiUM.js","assets/ts-tags-2EuNMnfN.js","assets/twig-CY4Ir08O.js","assets/vue-B9qMus9W.js","assets/vue-html-CdUGrliw.js","assets/vue-vine-81O3RRX2.js","assets/stylus-B5_eVOG1.js","assets/xsl-C89zcMFS.js","assets/dagre-KLK3FWXG-CsIRyGd-.js","assets/chunk-PU5JKC2W-KA2MZku5.js","assets/src-B0URjIBy.js","assets/chunk-GEFDOKGD-D5eIWnuf.js","assets/dist-CpWSQIlk.js","assets/math-wh5kcxAa.js","assets/chunk-7R4GIKGN-B0Nk6xl6.js","assets/preload-helper-DSXbuxSR.js","assets/_createAssigner-BmxrMTIs.js","assets/dagre-DHSLkSfU.js","assets/graphlib-sSK0q0jO.js","assets/_baseUniq-BGPNLZq7.js","assets/_basePickBy-BJ_rm3-n.js","assets/clone-DCUYwHc1.js","assets/chunk-KYZI473N-CXcIXlKo.js","assets/chunk-PQ6SQG4A-DB1drAIU.js","assets/chunk-YBOYWFTD-i-hva81G.js","assets/rough.esm-C7RslGBg.js","assets/chunk-MX3YWQON-FdgNOTEP.js","assets/chunk-O4XLMI2P-n-oWchCV.js","assets/line-Dte_HEDa.js","assets/path-BoFZ_ZCz.js","assets/array-CYHT4lxU.js","assets/cose-bilkent-S5V4N54A-CKgjVWnH.js","assets/cytoscape.esm-gMSa0A8n.js","assets/c4Diagram-IC4MRINW-DQEOk4gF.js","assets/chunk-JSJVCQXG-BthkA1o-.js","assets/flowDiagram-PKNHOUZH-DCjCL66H.js","assets/channel-B_vP0iKX.js","assets/chunk-55IACEB6-CLHg9Ulb.js","assets/chunk-FMBD7UC4-Cca8p-Ag.js","assets/chunk-KX2RTZJC-yDo9-99g.js","assets/erDiagram-INFDFZHY-oSJOQVMl.js","assets/gitGraphDiagram-K3NZZRJ6-BaVomO0E.js","assets/mermaid-parser.core-zSGpBtrZ.js","assets/chunk-XZSTWKYB-CR7HLNO4.js","assets/chunk-7E7YKBS2-CjPkysZ4.js","assets/chunk-C72U2L5F-B11-t4Kx.js","assets/chunk-EGIJ26TM-Dn67x_wP.js","assets/chunk-L3YUKLVL-B6prTSRj.js","assets/chunk-OZEHJAEY-DFGloWwN.js","assets/chunk-R5LLSJPH-iHaJebab.js","assets/chunk-XIRO2GV7-BbBu2-ax.js","assets/chunk-4BX2VUAB-BMQY333L.js","assets/chunk-QZHKN3VN-C-zFVA0L.js","assets/ganttDiagram-A5KZAMGK-BEoHssiP.js","assets/linear-CIQZW2al.js","assets/defaultLocale-DL4ssfbz.js","assets/init-D0iKTvvc.js","assets/infoDiagram-LFFYTUFH-BpLjxnPR.js","assets/pieDiagram-SKSYHLDU-Ba8_qWtW.js","assets/ordinal-t_ha_BUo.js","assets/arc-Ddz4TeZN.js","assets/quadrantDiagram-337W2JSQ-BYRgqy3l.js","assets/xychartDiagram-JWTSCODW-BCXHFEAl.js","assets/requirementDiagram-Z7DCOOCP-bWlpEI8M.js","assets/sequenceDiagram-2WXFIKYE-DXTnjjaR.js","assets/classDiagram-VBA2DB6C-DET8D2F6.js","assets/chunk-WL4C6EOR-BTGOslpF.js","assets/classDiagram-v2-RAHNMMFH-C_pvaxDg.js","assets/stateDiagram-RAJIS63D-BEPLG8-b.js","assets/chunk-NQ4KR5QH-CgXz_uQQ.js","assets/stateDiagram-v2-FVOUBMTO-Cn3GtrPV.js","assets/journeyDiagram-4ABVD52K-BbJAX67K.js","assets/timeline-definition-YZTLITO2-BHlpJEA0.js","assets/mindmap-definition-YRQLILUH-a6cg75mj.js","assets/kanban-definition-K7BYSVSG-qoQ-gouW.js","assets/sankeyDiagram-WA2Y5GQK-Bemb6KrC.js","assets/diagram-P4PSJMXO-C1pGlueJ.js","assets/diagram-IFDJBPK2-BDQnMPef.js","assets/blockDiagram-WCTKOSBZ-Bs2dO4Lh.js","assets/architectureDiagram-2XIMDMQ5-Ci6lZRdi.js","assets/ishikawaDiagram-PHBUUO56-KwEjkSbo.js","assets/vennDiagram-LZ73GAT5-Bl0Pzjn6.js","assets/diagram-E7M64L7V-eMkzKdKv.js","assets/highlighted-body-OFNGDK62-BWa9Mb0y.js","assets/angular-html-CBF8nfHB.js","assets/html-D7mRpFvM.js","assets/css-DBhU8AwW.js","assets/javascript-Dg7EP1YE.js","assets/angular-ts-CdkmjzQ5.js","assets/scss-iDA7palb.js","assets/apl-D9I1J98W.js","assets/json-fnBI0gj2.js","assets/xml-Cb1wEfHX.js","assets/java-DX6TKDCS.js","assets/astro-DC-LgFtO.js","assets/postcss-_4KnAWK8.js","assets/tsx-DUUZbgtM.js","assets/typescript-KVqcuDhh.js","assets/blade-CBVc-fmH.js","assets/html-derivative-B_ONBGtR.js","assets/sql-D0PeXViA.js","assets/bsl-B54i21_P.js","assets/sdbl-f-RzDkID.js","assets/c-D_62jz9M.js","assets/cairo-JaUDbVYo.js","assets/python-CiZjse7V.js","assets/cobol-DN-bwds2.js","assets/coffee-CMKPRhQn.js","assets/cpp-CTiQpY4Q.js","assets/glsl-Cj6gxCEm.js","assets/regexp-CT-F6Hxp.js","assets/crystal-BAASLKeI.js","assets/shellscript-BFnGMkoH.js","assets/edge-Bu05vss1.js","assets/elixir-C5D6SI--.js","assets/elm-r-peYKRu.js","assets/erb-CR0PyxQX.js","assets/ruby-BeLnD7ib.js","assets/graphql-BPIhqTYr.js","assets/jsx-BQK4-39B.js","assets/haml-Book8V-o.js","assets/lua-rjS96mNp.js","assets/yaml-ByqB90Zo.js","assets/erlang-9bZkvgha.js","assets/markdown-dkut3LZ0.js","assets/fortran-fixed-form-BVlcY82S.js","assets/fortran-free-form-T246OFmF.js","assets/fsharp-D4PGOmrZ.js","assets/gdresource-zogYIbMs.js","assets/gdscript-DilHUO6X.js","assets/gdshader-CVkSEAIh.js","assets/git-commit-BOtit0B7.js","assets/diff-BfcdpccF.js","assets/git-rebase-BmpwmPNs.js","assets/glimmer-js-B25x-Ii3.js","assets/glimmer-ts-Db9yyIKq.js","assets/hack-U0nxHTSJ.js","assets/handlebars-nJPafxzB.js","assets/http-9S_fJGIM.js","assets/hurl-Bxb4BvdJ.js","assets/csv-BxO9mTca.js","assets/hxml-CBLoPFJn.js","assets/haxe-Ds6BbIFI.js","assets/jinja-C2CwCT3C.js","assets/jison-6bgqXqzl.js","assets/julia-C4-Pvt58.js","assets/r-CI6sc9V-.js","assets/just-BQvD4Ka4.js","assets/perl-DyDhIwHk.js","assets/latex-B7-Eoqey.js","assets/tex-BPvzdsh9.js","assets/liquid-BvNEju9J.js","assets/marko-DL361qFU.js","assets/less-Cmnr-ah1.js","assets/mdc-DScSTqTV.js","assets/nextflow-DaMHJyv-.js","assets/nextflow-groovy-BCzh_nVB.js","assets/nginx-P1NWeu-J.js","assets/nim-BPSdfc7K.js","assets/php-tzeJfrd4.js","assets/pug-Bl2N86rV.js","assets/qml-5nJQQUuI.js","assets/razor-D-K6GP8P.js","assets/csharp-CiH7oTou.js","assets/rst-DeEonWJm.js","assets/cmake-t9HbbaOy.js","assets/sas-t25Xsrxd.js","assets/shaderlab-B__viSd1.js","assets/hlsl-Cn4xOp4H.js","assets/shellsession-B4tEcxRF.js","assets/soy-rXXEZbaM.js","assets/sparql-P3fQ_Jok.js","assets/turtle-C4YJmC8S.js","assets/stata-2iW5ygo5.js","assets/surrealql-CS15q6Al.js","assets/svelte-CwADlTIx.js","assets/templ-DSA20zaC.js","assets/go-BT4oYldF.js","assets/ts-tags-D_9pNjC0.js","assets/twig-C0ffcDgu.js","assets/vue-BK1C3UoX.js","assets/vue-html-B060Qjjr.js","assets/vue-vine-CwTBzwo-.js","assets/stylus-BRjIdNaI.js","assets/xsl-B2L5oOrY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,n as t,o as n,r,t as i}from"./chunk-CFjPhJqf.js";import{t as a}from"./preload-helper-DSXbuxSR.js";import{t as o}from"./katex--tSeZgTA.js";import{_ as s,g as c,h as l,p as u}from"./src-B0URjIBy.js";import{F as d,G as f,H as p,J as m,M as h,N as g,S as _,T as v,X as y,Y as b,Z as x,b as S,c as C,f as w,g as T,h as E,l as D,n as O,p as k,r as ee,s as A,t as j,w as M,x as N,y as P,z as F}from"./chunk-7R4GIKGN-B0Nk6xl6.js";import{a as te,d as ne,h as re,i as I,m as ie,r as ae,u as oe}from"./chunk-GEFDOKGD-D5eIWnuf.js";import"./chunk-MX3YWQON-FdgNOTEP.js";import{B as se,E as ce,G as le,L as ue,U as de,b as fe,g as pe,p as me,v as he,w as ge,x as _e,z as ve}from"./_createAssigner-BmxrMTIs.js";import"./chunk-YBOYWFTD-i-hva81G.js";import"./chunk-PQ6SQG4A-DB1drAIU.js";import{i as ye,o as be}from"./chunk-PU5JKC2W-KA2MZku5.js";import{a as xe,i as Se,s as Ce}from"./chunk-KYZI473N-CXcIXlKo.js";import{a as we,i as Te,n as Ee,r as De}from"./chunk-O4XLMI2P-n-oWchCV.js";(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 Oe=i((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 S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 M(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,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(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+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(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 N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(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 F=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)},te={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=te,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=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.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)!T.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 E(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)T.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 E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),ke=i(((e,t)=>{t.exports=Oe()})),Ae=i((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,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){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&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(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`):w=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(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),je=i(((e,t)=>{t.exports=Ae()})),Me=i((e=>{var t=ke();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.4`})),Ne=i(((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=Me()})),Pe=i((e=>{var t=je(),n=ke(),r=Ne();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 u(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 d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function A(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?A(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return A(e(t))}catch{}}return null}var j=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},F=[],te=-1;function ne(e){return{current:e}}function re(e){0>te||(e.current=F[te],F[te]=null,te--)}function I(e,t){te++,F[te]=e.current,e.current=t}var ie=ne(null),ae=ne(null),oe=ne(null),se=ne(null);function ce(e,t){switch(I(oe,t),I(ae,e),I(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ef(t),e=tf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(ie),I(ie,e)}function le(){re(ie),re(ae),re(oe)}function ue(e){e.memoizedState!==null&&I(se,e);var t=ie.current,n=tf(t,e.type);t!==n&&(I(ae,e),I(ie,n))}function de(e){ae.current===e&&(re(ie),re(ae)),se.current===e&&(re(se),dp._currentValue=P)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!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
5
|
`),l=s.split(`
|
|
@@ -195,8 +195,8 @@ XID_Start XIDS`.split(/\s/).map(e=>[Rb(e),e])),Mx=new Map([[`s`,gx(383)],[gx(383
|
|
|
195
195
|
`+e.slice(i,a),i=a+1),o=s;return c+=`
|
|
196
196
|
`,e.length-i>t&&o>i?c+=e.slice(i,o)+`
|
|
197
197
|
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}l(XE,`foldLine`);function ZE(e){for(var t=``,n=0,r,i=0;i<e.length;n>=65536?i+=2:i++)n=RE(e,i),r=xE[n],!r&&NE(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||TE(n);return t}l(ZE,`escapeString`);function QE(e,t,n){var r=``,i=e.tag,a,o,s;for(a=0,o=n.length;a<o;a+=1)s=n[a],e.replacer&&(s=e.replacer.call(n,String(a),s)),(rD(e,t,s,!1,!1)||s===void 0&&rD(e,t,null,!1,!1))&&(r!==``&&(r+=`,`+(e.condenseFlow?``:` `)),r+=e.dump);e.tag=i,e.dump=`[`+r+`]`}l(QE,`writeFlowSequence`);function $E(e,t,n,r){var i=``,a=e.tag,o,s,c;for(o=0,s=n.length;o<s;o+=1)c=n[o],e.replacer&&(c=e.replacer.call(n,String(o),c)),(rD(e,t+1,c,!0,!0,!1,!0)||c===void 0&&rD(e,t+1,null,!0,!0,!1,!0))&&((!r||i!==``)&&(i+=AE(e,t)),e.dump&&fE===e.dump.charCodeAt(0)?i+=`-`:i+=`- `,i+=e.dump);e.tag=a,e.dump=i||`[]`}l($E,`writeBlockSequence`);function eD(e,t,n){var r=``,i=e.tag,a=Object.keys(n),o,s,c,l,u;for(o=0,s=a.length;o<s;o+=1)u=``,r!==``&&(u+=`, `),e.condenseFlow&&(u+=`"`),c=a[o],l=n[c],e.replacer&&(l=e.replacer.call(n,c,l)),rD(e,t,c,!1,!1)&&(e.dump.length>1024&&(u+=`? `),u+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),rD(e,t,l,!1,!1)&&(u+=e.dump,r+=u));e.tag=i,e.dump=`{`+r+`}`}l(eD,`writeFlowMapping`);function tD(e,t,n,r){var i=``,a=e.tag,o=Object.keys(n),s,c,l,u,d,f;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys==`function`)o.sort(e.sortKeys);else if(e.sortKeys)throw new xw(`sortKeys must be a boolean or a function`);for(s=0,c=o.length;s<c;s+=1)f=``,(!r||i!==``)&&(f+=AE(e,t)),l=o[s],u=n[l],e.replacer&&(u=e.replacer.call(n,l,u)),rD(e,t+1,l,!0,!0,!0)&&(d=e.tag!==null&&e.tag!==`?`||e.dump&&e.dump.length>1024,d&&(e.dump&&fE===e.dump.charCodeAt(0)?f+=`?`:f+=`? `),f+=e.dump,d&&(f+=AE(e,t)),rD(e,t+1,u,!0,d)&&(e.dump&&fE===e.dump.charCodeAt(0)?f+=`:`:f+=`: `,f+=e.dump,i+=f));e.tag=a,e.dump=i||`{}`}l(tD,`writeBlockMapping`);function nD(e,t,n){var r,i=n?e.explicitTypes:e.implicitTypes,a,o,s,c;for(a=0,o=i.length;a<o;a+=1)if(s=i[a],(s.instanceOf||s.predicate)&&(!s.instanceOf||typeof t==`object`&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(n?s.multi&&s.representName?e.tag=s.representName(t):e.tag=s.tag:e.tag=`?`,s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,lE.call(s.represent)===`[object Function]`)r=s.represent(t,c);else if(uE.call(s.represent,c))r=s.represent[c](t,c);else throw new xw(`!<`+s.tag+`> tag resolver accepts not "`+c+`" style`);e.dump=r}return!0}return!1}l(nD,`detectType`);function rD(e,t,n,r,i,a,o){e.tag=null,e.dump=n,nD(e,n,!1)||nD(e,n,!0);var s=lE.call(e.dump),c=r,l;r&&=e.flowLevel<0||e.flowLevel>t;var u=s===`[object Object]`||s===`[object Array]`,d,f;if(u&&(d=e.duplicates.indexOf(n),f=d!==-1),(e.tag!==null&&e.tag!==`?`||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[d])e.dump=`*ref_`+d;else{if(u&&f&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),s===`[object Object]`)r&&Object.keys(e.dump).length!==0?(tD(e,t,e.dump,i),f&&(e.dump=`&ref_`+d+e.dump)):(eD(e,t,e.dump),f&&(e.dump=`&ref_`+d+` `+e.dump));else if(s===`[object Array]`)r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?$E(e,t-1,e.dump,i):$E(e,t,e.dump,i),f&&(e.dump=`&ref_`+d+e.dump)):(QE(e,t,e.dump),f&&(e.dump=`&ref_`+d+` `+e.dump));else if(s===`[object String]`)e.tag!==`?`&&KE(e,e.dump,t,a,c);else if(s===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new xw(`unacceptable kind of an object to dump `+s)}e.tag!==null&&e.tag!==`?`&&(l=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`),l=e.tag[0]===`!`?`!`+l:l.slice(0,18)===`tag:yaml.org,2002:`?`!!`+l.slice(18):`!<`+l+`>`,e.dump=l+` `+e.dump)}return!0}l(rD,`writeNode`);function iD(e,t){var n=[],r=[],i,a;for(aD(e,n,r),i=0,a=r.length;i<a;i+=1)t.duplicates.push(n[r[i]]);t.usedDuplicates=Array(a)}l(iD,`getDuplicateReferences`);function aD(e,t,n){var r,i,a;if(typeof e==`object`&&e)if(i=t.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,a=e.length;i<a;i+=1)aD(e[i],t,n);else for(r=Object.keys(e),i=0,a=r.length;i<a;i+=1)aD(e[r[i]],t,n)}l(aD,`inspectNode`);function oD(e,t){t||={};var n=new OE(t);n.noRefs||iD(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},``,r)),rD(n,0,r,!0,!0)?n.dump+`
|
|
198
|
-
`:``}l(oD,`dump$1`);var sD={dump:oD};function cD(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}l(cD,`renamed`);var lD=qw,uD=cE.load;cE.loadAll,sD.dump;var dD={common:A,getConfig:P,insertCluster:Se,insertEdge:Ee,insertEdgeLabel:De,insertMarkers:Te,insertNode:xe,interpolateToCurve:oe,labelHelper:Ce,log:c,positionEdgeLabel:we},fD={},pD=l(e=>{for(let t of e)fD[t.name]=t},`registerLayoutLoaders`);l(()=>{pD([{name:`dagre`,loader:l(async()=>await a(()=>import(`./dagre-KLK3FWXG-Cj4lt3rZ.js`),__vite__mapDeps([102,103,1,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124])),`loader`)},...[{name:`cose-bilkent`,loader:l(async()=>await a(()=>import(`./cose-bilkent-S5V4N54A-CKgjVWnH.js`),__vite__mapDeps([125,1,126,105])),`loader`)}]])},`registerDefaultLayoutLoaders`)();var mD=l(async(e,t)=>{if(!(e.layoutAlgorithm in fD))throw Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);let n=fD[e.layoutAlgorithm];return(await n.loader()).render(e,t,dD,{algorithm:n.algorithm})},`render`),hD=l((e=``,{fallback:t=`dagre`}={})=>{if(e in fD)return e;if(t in fD)return c.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw Error(`Both layout algorithms ${e} and ${t} are not registered.`)},`getRegisteredLayoutAlgorithm`),gD=`comm`,_D=`rule`,vD=`decl`,yD=`@import`,bD=`@namespace`,xD=`@keyframes`,SD=`@layer`,CD=Math.abs,wD=String.fromCharCode;function TD(e){return e.trim()}function ED(e,t,n){return e.replace(t,n)}function DD(e,t,n){return e.indexOf(t,n)}function OD(e,t){return e.charCodeAt(t)|0}function kD(e,t,n){return e.slice(t,n)}function AD(e){return e.length}function jD(e){return e.length}function MD(e,t){return t.push(e),e}var ND=1,PD=1,FD=0,ID=0,LD=0,RD=``;function zD(e,t,n,r,i,a,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:ND,column:PD,length:o,return:``,siblings:s}}function BD(){return LD}function VD(){return LD=ID>0?OD(RD,--ID):0,PD--,LD===10&&(PD=1,ND--),LD}function HD(){return LD=ID<FD?OD(RD,ID++):0,PD++,LD===10&&(PD=1,ND++),LD}function UD(){return OD(RD,ID)}function WD(){return ID}function GD(e,t){return kD(RD,e,t)}function KD(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function qD(e){return ND=PD=1,FD=AD(RD=e),ID=0,[]}function JD(e){return RD=``,e}function YD(e){return TD(GD(ID-1,QD(e===91?e+2:e===40?e+1:e)))}function XD(e){for(;(LD=UD())&&LD<33;)HD();return KD(e)>2||KD(LD)>3?``:` `}function ZD(e,t){for(;--t&&HD()&&!(LD<48||LD>102||LD>57&&LD<65||LD>70&&LD<97););return GD(e,WD()+(t<6&&UD()==32&&HD()==32))}function QD(e){for(;HD();)switch(LD){case e:return ID;case 34:case 39:e!==34&&e!==39&&QD(LD);break;case 40:e===41&&QD(e);break;case 92:HD();break}return ID}function $D(e,t){for(;HD()&&e+LD!==57&&!(e+LD===84&&UD()===47););return`/*`+GD(t,ID-1)+`*`+wD(e===47?e:HD())}function eO(e){for(;!KD(UD());)HD();return GD(e,ID)}function tO(e){return JD(nO(``,null,null,null,[``],e=qD(e),0,[0],e))}function nO(e,t,n,r,i,a,o,s,c){for(var l=0,u=0,d=o,f=0,p=0,m=0,h=1,g=1,_=1,v=0,y=``,b=i,x=a,S=r,C=y;g;)switch(m=v,v=HD()){case 40:if(m!=108&&OD(C,d-1)==58){DD(C+=ED(YD(v),`&`,`&\f`),`&\f`,CD(l?s[l-1]:0))!=-1&&(_=-1);break}case 34:case 39:case 91:C+=YD(v);break;case 9:case 10:case 13:case 32:C+=XD(m);break;case 92:C+=ZD(WD()-1,7);continue;case 47:switch(UD()){case 42:case 47:MD(iO($D(HD(),WD()),t,n,c),c),(KD(m||1)==5||KD(UD()||1)==5)&&AD(C)&&kD(C,-1,void 0)!==` `&&(C+=` `);break;default:C+=`/`}break;case 123*h:s[l++]=AD(C)*_;case 125*h:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+u:_==-1&&(C=ED(C,/\f/g,``)),p>0&&(AD(C)-d||h===0&&m===47)&&MD(p>32?aO(C+`;`,r,n,d-1,c):aO(ED(C,` `,``)+`;`,r,n,d-2,c),c);break;case 59:C+=`;`;default:if(MD(S=rO(C,t,n,l,u,i,s,y,b=[],x=[],d,a),a),v===123)if(u===0)nO(C,t,S,S,b,a,d,s,x);else{switch(f){case 99:if(OD(C,3)===110)break;case 108:if(OD(C,2)===97)break;default:u=0;case 100:case 109:case 115:}u?nO(e,S,S,r&&MD(rO(e,S,S,0,0,i,s,y,i,b=[],d,x),x),i,x,d,s,r?b:x):nO(C,S,S,S,[``],x,0,s,x)}}l=u=p=0,h=_=1,y=C=``,d=o;break;case 58:d=1+AD(C),p=m;default:if(h<1){if(v==123)--h;else if(v==125&&h++==0&&VD()==125)continue}switch(C+=wD(v),v*h){case 38:_=u>0?1:(C+=`\f`,-1);break;case 44:s[l++]=(AD(C)-1)*_,_=1;break;case 64:UD()===45&&(C+=YD(HD())),f=UD(),u=d=AD(y=C+=eO(WD())),v++;break;case 45:m===45&&AD(C)==2&&(h=0)}}return a}function rO(e,t,n,r,i,a,o,s,c,l,u,d){for(var f=i-1,p=i===0?a:[``],m=jD(p),h=0,g=0,_=0;h<r;++h)for(var v=0,y=kD(e,f+1,f=CD(g=o[h])),b=e;v<m;++v)(b=TD(g>0?p[v]+` `+y:ED(y,/&\f/g,p[v])))&&(c[_++]=b);return zD(e,t,n,i===0?_D:s,c,l,u,d)}function iO(e,t,n,r){return zD(e,t,n,gD,wD(BD()),kD(e,2,-2),0,r)}function aO(e,t,n,r,i){return zD(e,t,n,vD,kD(e,0,r),kD(e,r+1,-1),r,i)}function oO(e,t){for(var n=``,r=0;r<e.length;r++)n+=t(e[r],r,e,t)||``;return n}function sO(e,t,n,r){switch(e.type){case SD:if(e.children.length)break;case yD:case bD:case vD:return e.return=e.return||e.value;case gD:return``;case xD:return e.return=e.value+`{`+oO(e.children,r)+`}`;case _D:if(!AD(e.value=e.props.join(`,`)))return``}return AD(n=oO(e.children,r))?e.return=e.value+`{`+n+`}`:``}var cO=ce(Object.keys,Object),lO=Object.prototype.hasOwnProperty;function uO(e){if(!ge(e))return cO(e);var t=[];for(var n in Object(e))lO.call(e,n)&&n!=`constructor`&&t.push(n);return t}var dO=ve(le,`DataView`),fO=ve(le,`Promise`),pO=ve(le,`Set`),mO=ve(le,`WeakMap`),hO=`[object Map]`,gO=`[object Object]`,_O=`[object Promise]`,vO=`[object Set]`,yO=`[object WeakMap]`,bO=`[object DataView]`,xO=se(dO),SO=se(ue),CO=se(fO),wO=se(pO),TO=se(mO),EO=de;(dO&&EO(new dO(new ArrayBuffer(1)))!=bO||ue&&EO(new ue)!=hO||fO&&EO(fO.resolve())!=_O||pO&&EO(new pO)!=vO||mO&&EO(new mO)!=yO)&&(EO=function(e){var t=de(e),n=t==gO?e.constructor:void 0,r=n?se(n):``;if(r)switch(r){case xO:return bO;case SO:return hO;case CO:return _O;case wO:return vO;case TO:return yO}return t});var DO=EO,OO=`[object Map]`,kO=`[object Set]`,AO=Object.prototype.hasOwnProperty;function jO(e){if(e==null)return!0;if(he(e)&&(fe(e)||typeof e==`string`||typeof e.splice==`function`||pe(e)||me(e)||_e(e)))return!e.length;var t=DO(e);if(t==OO||t==kO)return!e.size;if(ge(e))return!uO(e).length;for(var n in e)if(AO.call(e,n))return!1;return!0}var MO=`c4`,NO={id:MO,detector:l(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./c4Diagram-IC4MRINW-DQEOk4gF.js`);return{diagram:e}},__vite__mapDeps([127,103,1,105,106,107,108,109,110,128]));return{id:MO,diagram:e}},`loader`)},PO=`flowchart`,FO={id:PO,detector:l((e,t)=>t?.flowchart?.defaultRenderer===`dagre-wrapper`||t?.flowchart?.defaultRenderer===`elk`?!1:/^\s*graph/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./flowDiagram-PKNHOUZH-B2fIxLUm.js`);return{diagram:e}},__vite__mapDeps([129,103,1,104,105,106,107,108,109,110,130,131,132,128,133,116,117,118,119,120,121,122,123,124]));return{id:PO,diagram:e}},`loader`)},IO=`flowchart-v2`,LO={id:IO,detector:l((e,t)=>t?.flowchart?.defaultRenderer===`dagre-d3`?!1:(t?.flowchart?.defaultRenderer===`elk`&&(t.layout=`elk`),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer===`dagre-wrapper`?!0:/^\s*flowchart/.test(e)),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./flowDiagram-PKNHOUZH-B2fIxLUm.js`);return{diagram:e}},__vite__mapDeps([129,103,1,104,105,106,107,108,109,110,130,131,132,128,133,116,117,118,119,120,121,122,123,124]));return{id:IO,diagram:e}},`loader`)},RO=`er`,zO={id:RO,detector:l(e=>/^\s*erDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./erDiagram-INFDFZHY-C0BMPOrX.js`);return{diagram:e}},__vite__mapDeps([134,103,1,104,105,106,107,108,109,110,130,131,133,116,117,118,119,120,121,122,123,124]));return{id:RO,diagram:e}},`loader`)},BO=`gitGraph`,VO={id:BO,detector:l(e=>/^\s*gitGraph/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./gitGraphDiagram-K3NZZRJ6-Cv0H9yt2.js`);return{diagram:e}},__vite__mapDeps([135,103,1,136,110,113,114,115,137,138,139,140,141,142,143,144,109,105,106,107,108,145,146]));return{id:BO,diagram:e}},`loader`)},HO=`gantt`,UO={id:HO,detector:l(e=>/^\s*gantt/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./ganttDiagram-A5KZAMGK-CS4Q9uqC.js`);return{diagram:e}},__vite__mapDeps([147,1,103,148,105,149,150,106,107,108,109,110]));return{id:HO,diagram:e}},`loader`)},WO=`info`,GO={id:WO,detector:l(e=>/^\s*info/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./infoDiagram-LFFYTUFH-BX45-9cE.js`);return{diagram:e}},__vite__mapDeps([151,136,1,110,113,114,115,137,138,139,140,141,142,143,144,109,105,108]));return{id:WO,diagram:e}},`loader`)},KO=`pie`,qO={id:KO,detector:l(e=>/^\s*pie/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./pieDiagram-SKSYHLDU-DQ65vLhm.js`);return{diagram:e}},__vite__mapDeps([152,103,1,136,110,113,114,115,137,138,139,140,141,142,143,144,109,105,123,153,150,154,107,124,106,108,145]));return{id:KO,diagram:e}},`loader`)},JO=`quadrantChart`,YO={id:JO,detector:l(e=>/^\s*quadrantChart/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./quadrantDiagram-337W2JSQ-C3xMuDjL.js`);return{diagram:e}},__vite__mapDeps([155,148,105,1,149,150,108,109]));return{id:JO,diagram:e}},`loader`)},XO=`xychart`,ZO={id:XO,detector:l(e=>/^\s*xychart(-beta)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./xychartDiagram-JWTSCODW-BvFKMIoI.js`);return{diagram:e}},__vite__mapDeps([156,103,1,104,105,106,107,108,109,110,148,149,150,153,122,123,124]));return{id:XO,diagram:e}},`loader`)},QO=`requirement`,$O={id:QO,detector:l(e=>/^\s*requirement(Diagram)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./requirementDiagram-Z7DCOOCP-BT86nLzI.js`);return{diagram:e}},__vite__mapDeps([157,103,1,104,105,106,107,108,109,110,131,133,116,117,118,119,120,121,122,123,124]));return{id:QO,diagram:e}},`loader`)},ek=`sequence`,tk={id:ek,detector:l(e=>/^\s*sequenceDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./sequenceDiagram-2WXFIKYE-C_zZdkM7.js`);return{diagram:e}},__vite__mapDeps([158,103,1,105,106,107,108,109,110,128,146]));return{id:ek,diagram:e}},`loader`)},nk=`class`,rk={id:nk,detector:l((e,t)=>t?.class?.defaultRenderer===`dagre-wrapper`?!1:/^\s*classDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./classDiagram-VBA2DB6C-BFf1_hDn.js`);return{diagram:e}},__vite__mapDeps([159,103,1,104,105,106,107,108,109,110,131,132,128,133,116,117,118,119,120,121,122,123,124,160]));return{id:nk,diagram:e}},`loader`)},ik=`classDiagram`,ak={id:ik,detector:l((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer===`dagre-wrapper`?!0:/^\s*classDiagram-v2/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./classDiagram-v2-RAHNMMFH-Cc_Q9nD6.js`);return{diagram:e}},__vite__mapDeps([161,103,1,104,105,106,107,108,109,110,131,132,128,133,116,117,118,119,120,121,122,123,124,160]));return{id:ik,diagram:e}},`loader`)},ok=`state`,sk={id:ok,detector:l((e,t)=>t?.state?.defaultRenderer===`dagre-wrapper`?!1:/^\s*stateDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./stateDiagram-RAJIS63D-LjyoGrQS.js`);return{diagram:e}},__vite__mapDeps([162,103,1,104,105,106,107,108,109,110,122,123,124,111,112,113,114,131,133,116,117,118,119,120,163,121]));return{id:ok,diagram:e}},`loader`)},ck=`stateDiagram`,lk={id:ck,detector:l((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer===`dagre-wrapper`),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./stateDiagram-v2-FVOUBMTO-bXfl44aF.js`);return{diagram:e}},__vite__mapDeps([164,103,1,104,105,106,107,108,109,110,131,133,116,117,118,119,120,163,121,122,123,124]));return{id:ck,diagram:e}},`loader`)},uk=`journey`,dk={id:uk,detector:l(e=>/^\s*journey/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./journeyDiagram-4ABVD52K-C-U1F_87.js`);return{diagram:e}},__vite__mapDeps([165,103,1,105,154,123,107,108,109,132,128]));return{id:uk,diagram:e}},`loader`)},fk={draw:l((e,t,n)=>{c.debug(`rendering svg for syntax error
|
|
199
|
-
`);let r=dw(t),i=r.append(`g`);r.attr(`viewBox`,`0 0 2412 512`),C(r,100,512,!0),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1440).attr(`y`,250).attr(`font-size`,`150px`).style(`text-anchor`,`middle`).text(`Syntax error in text`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1250).attr(`y`,400).attr(`font-size`,`100px`).style(`text-anchor`,`middle`).text(`mermaid version ${n}`)},`draw`)},pk=fk,mk={db:{},renderer:fk,parser:{parse:l(()=>{},`parse`)}},hk=`flowchart-elk`,gk={id:hk,detector:l((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer===`elk`?(t.layout=`elk`,!0):!1,`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./flowDiagram-PKNHOUZH-
|
|
198
|
+
`:``}l(oD,`dump$1`);var sD={dump:oD};function cD(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}l(cD,`renamed`);var lD=qw,uD=cE.load;cE.loadAll,sD.dump;var dD={common:A,getConfig:P,insertCluster:Se,insertEdge:Ee,insertEdgeLabel:De,insertMarkers:Te,insertNode:xe,interpolateToCurve:oe,labelHelper:Ce,log:c,positionEdgeLabel:we},fD={},pD=l(e=>{for(let t of e)fD[t.name]=t},`registerLayoutLoaders`);l(()=>{pD([{name:`dagre`,loader:l(async()=>await a(()=>import(`./dagre-KLK3FWXG-CsIRyGd-.js`),__vite__mapDeps([102,103,104,1,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124])),`loader`)},...[{name:`cose-bilkent`,loader:l(async()=>await a(()=>import(`./cose-bilkent-S5V4N54A-CKgjVWnH.js`),__vite__mapDeps([125,1,126,104])),`loader`)}]])},`registerDefaultLayoutLoaders`)();var mD=l(async(e,t)=>{if(!(e.layoutAlgorithm in fD))throw Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);let n=fD[e.layoutAlgorithm];return(await n.loader()).render(e,t,dD,{algorithm:n.algorithm})},`render`),hD=l((e=``,{fallback:t=`dagre`}={})=>{if(e in fD)return e;if(t in fD)return c.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw Error(`Both layout algorithms ${e} and ${t} are not registered.`)},`getRegisteredLayoutAlgorithm`),gD=`comm`,_D=`rule`,vD=`decl`,yD=`@import`,bD=`@namespace`,xD=`@keyframes`,SD=`@layer`,CD=Math.abs,wD=String.fromCharCode;function TD(e){return e.trim()}function ED(e,t,n){return e.replace(t,n)}function DD(e,t,n){return e.indexOf(t,n)}function OD(e,t){return e.charCodeAt(t)|0}function kD(e,t,n){return e.slice(t,n)}function AD(e){return e.length}function jD(e){return e.length}function MD(e,t){return t.push(e),e}var ND=1,PD=1,FD=0,ID=0,LD=0,RD=``;function zD(e,t,n,r,i,a,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:ND,column:PD,length:o,return:``,siblings:s}}function BD(){return LD}function VD(){return LD=ID>0?OD(RD,--ID):0,PD--,LD===10&&(PD=1,ND--),LD}function HD(){return LD=ID<FD?OD(RD,ID++):0,PD++,LD===10&&(PD=1,ND++),LD}function UD(){return OD(RD,ID)}function WD(){return ID}function GD(e,t){return kD(RD,e,t)}function KD(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function qD(e){return ND=PD=1,FD=AD(RD=e),ID=0,[]}function JD(e){return RD=``,e}function YD(e){return TD(GD(ID-1,QD(e===91?e+2:e===40?e+1:e)))}function XD(e){for(;(LD=UD())&&LD<33;)HD();return KD(e)>2||KD(LD)>3?``:` `}function ZD(e,t){for(;--t&&HD()&&!(LD<48||LD>102||LD>57&&LD<65||LD>70&&LD<97););return GD(e,WD()+(t<6&&UD()==32&&HD()==32))}function QD(e){for(;HD();)switch(LD){case e:return ID;case 34:case 39:e!==34&&e!==39&&QD(LD);break;case 40:e===41&&QD(e);break;case 92:HD();break}return ID}function $D(e,t){for(;HD()&&e+LD!==57&&!(e+LD===84&&UD()===47););return`/*`+GD(t,ID-1)+`*`+wD(e===47?e:HD())}function eO(e){for(;!KD(UD());)HD();return GD(e,ID)}function tO(e){return JD(nO(``,null,null,null,[``],e=qD(e),0,[0],e))}function nO(e,t,n,r,i,a,o,s,c){for(var l=0,u=0,d=o,f=0,p=0,m=0,h=1,g=1,_=1,v=0,y=``,b=i,x=a,S=r,C=y;g;)switch(m=v,v=HD()){case 40:if(m!=108&&OD(C,d-1)==58){DD(C+=ED(YD(v),`&`,`&\f`),`&\f`,CD(l?s[l-1]:0))!=-1&&(_=-1);break}case 34:case 39:case 91:C+=YD(v);break;case 9:case 10:case 13:case 32:C+=XD(m);break;case 92:C+=ZD(WD()-1,7);continue;case 47:switch(UD()){case 42:case 47:MD(iO($D(HD(),WD()),t,n,c),c),(KD(m||1)==5||KD(UD()||1)==5)&&AD(C)&&kD(C,-1,void 0)!==` `&&(C+=` `);break;default:C+=`/`}break;case 123*h:s[l++]=AD(C)*_;case 125*h:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+u:_==-1&&(C=ED(C,/\f/g,``)),p>0&&(AD(C)-d||h===0&&m===47)&&MD(p>32?aO(C+`;`,r,n,d-1,c):aO(ED(C,` `,``)+`;`,r,n,d-2,c),c);break;case 59:C+=`;`;default:if(MD(S=rO(C,t,n,l,u,i,s,y,b=[],x=[],d,a),a),v===123)if(u===0)nO(C,t,S,S,b,a,d,s,x);else{switch(f){case 99:if(OD(C,3)===110)break;case 108:if(OD(C,2)===97)break;default:u=0;case 100:case 109:case 115:}u?nO(e,S,S,r&&MD(rO(e,S,S,0,0,i,s,y,i,b=[],d,x),x),i,x,d,s,r?b:x):nO(C,S,S,S,[``],x,0,s,x)}}l=u=p=0,h=_=1,y=C=``,d=o;break;case 58:d=1+AD(C),p=m;default:if(h<1){if(v==123)--h;else if(v==125&&h++==0&&VD()==125)continue}switch(C+=wD(v),v*h){case 38:_=u>0?1:(C+=`\f`,-1);break;case 44:s[l++]=(AD(C)-1)*_,_=1;break;case 64:UD()===45&&(C+=YD(HD())),f=UD(),u=d=AD(y=C+=eO(WD())),v++;break;case 45:m===45&&AD(C)==2&&(h=0)}}return a}function rO(e,t,n,r,i,a,o,s,c,l,u,d){for(var f=i-1,p=i===0?a:[``],m=jD(p),h=0,g=0,_=0;h<r;++h)for(var v=0,y=kD(e,f+1,f=CD(g=o[h])),b=e;v<m;++v)(b=TD(g>0?p[v]+` `+y:ED(y,/&\f/g,p[v])))&&(c[_++]=b);return zD(e,t,n,i===0?_D:s,c,l,u,d)}function iO(e,t,n,r){return zD(e,t,n,gD,wD(BD()),kD(e,2,-2),0,r)}function aO(e,t,n,r,i){return zD(e,t,n,vD,kD(e,0,r),kD(e,r+1,-1),r,i)}function oO(e,t){for(var n=``,r=0;r<e.length;r++)n+=t(e[r],r,e,t)||``;return n}function sO(e,t,n,r){switch(e.type){case SD:if(e.children.length)break;case yD:case bD:case vD:return e.return=e.return||e.value;case gD:return``;case xD:return e.return=e.value+`{`+oO(e.children,r)+`}`;case _D:if(!AD(e.value=e.props.join(`,`)))return``}return AD(n=oO(e.children,r))?e.return=e.value+`{`+n+`}`:``}var cO=ce(Object.keys,Object),lO=Object.prototype.hasOwnProperty;function uO(e){if(!ge(e))return cO(e);var t=[];for(var n in Object(e))lO.call(e,n)&&n!=`constructor`&&t.push(n);return t}var dO=ve(le,`DataView`),fO=ve(le,`Promise`),pO=ve(le,`Set`),mO=ve(le,`WeakMap`),hO=`[object Map]`,gO=`[object Object]`,_O=`[object Promise]`,vO=`[object Set]`,yO=`[object WeakMap]`,bO=`[object DataView]`,xO=se(dO),SO=se(ue),CO=se(fO),wO=se(pO),TO=se(mO),EO=de;(dO&&EO(new dO(new ArrayBuffer(1)))!=bO||ue&&EO(new ue)!=hO||fO&&EO(fO.resolve())!=_O||pO&&EO(new pO)!=vO||mO&&EO(new mO)!=yO)&&(EO=function(e){var t=de(e),n=t==gO?e.constructor:void 0,r=n?se(n):``;if(r)switch(r){case xO:return bO;case SO:return hO;case CO:return _O;case wO:return vO;case TO:return yO}return t});var DO=EO,OO=`[object Map]`,kO=`[object Set]`,AO=Object.prototype.hasOwnProperty;function jO(e){if(e==null)return!0;if(he(e)&&(fe(e)||typeof e==`string`||typeof e.splice==`function`||pe(e)||me(e)||_e(e)))return!e.length;var t=DO(e);if(t==OO||t==kO)return!e.size;if(ge(e))return!uO(e).length;for(var n in e)if(AO.call(e,n))return!1;return!0}var MO=`c4`,NO={id:MO,detector:l(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./c4Diagram-IC4MRINW-DQEOk4gF.js`);return{diagram:e}},__vite__mapDeps([127,106,1,104,105,107,108,109,110,128]));return{id:MO,diagram:e}},`loader`)},PO=`flowchart`,FO={id:PO,detector:l((e,t)=>t?.flowchart?.defaultRenderer===`dagre-wrapper`||t?.flowchart?.defaultRenderer===`elk`?!1:/^\s*graph/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./flowDiagram-PKNHOUZH-DCjCL66H.js`);return{diagram:e}},__vite__mapDeps([129,103,104,1,105,106,107,108,109,110,130,131,132,128,133,116,117,118,119,120,121,122,123,124]));return{id:PO,diagram:e}},`loader`)},IO=`flowchart-v2`,LO={id:IO,detector:l((e,t)=>t?.flowchart?.defaultRenderer===`dagre-d3`?!1:(t?.flowchart?.defaultRenderer===`elk`&&(t.layout=`elk`),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer===`dagre-wrapper`?!0:/^\s*flowchart/.test(e)),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./flowDiagram-PKNHOUZH-DCjCL66H.js`);return{diagram:e}},__vite__mapDeps([129,103,104,1,105,106,107,108,109,110,130,131,132,128,133,116,117,118,119,120,121,122,123,124]));return{id:IO,diagram:e}},`loader`)},RO=`er`,zO={id:RO,detector:l(e=>/^\s*erDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./erDiagram-INFDFZHY-oSJOQVMl.js`);return{diagram:e}},__vite__mapDeps([134,103,104,1,105,106,107,108,109,110,130,131,133,116,117,118,119,120,121,122,123,124]));return{id:RO,diagram:e}},`loader`)},BO=`gitGraph`,VO={id:BO,detector:l(e=>/^\s*gitGraph/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./gitGraphDiagram-K3NZZRJ6-BaVomO0E.js`);return{diagram:e}},__vite__mapDeps([135,136,109,137,1,110,113,114,115,138,139,140,141,142,143,144,104,105,106,107,108,145,146]));return{id:BO,diagram:e}},`loader`)},HO=`gantt`,UO={id:HO,detector:l(e=>/^\s*gantt/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./ganttDiagram-A5KZAMGK-BEoHssiP.js`);return{diagram:e}},__vite__mapDeps([147,1,106,148,104,149,150,105,107,108,109,110]));return{id:HO,diagram:e}},`loader`)},WO=`info`,GO={id:WO,detector:l(e=>/^\s*info/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./infoDiagram-LFFYTUFH-BpLjxnPR.js`);return{diagram:e}},__vite__mapDeps([151,136,109,137,1,110,113,114,115,138,139,140,141,142,143,144,104,108]));return{id:WO,diagram:e}},`loader`)},KO=`pie`,qO={id:KO,detector:l(e=>/^\s*pie/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./pieDiagram-SKSYHLDU-Ba8_qWtW.js`);return{diagram:e}},__vite__mapDeps([152,136,109,137,1,110,113,114,115,138,139,140,141,142,143,144,104,123,153,150,154,107,124,105,106,108,145]));return{id:KO,diagram:e}},`loader`)},JO=`quadrantChart`,YO={id:JO,detector:l(e=>/^\s*quadrantChart/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./quadrantDiagram-337W2JSQ-BYRgqy3l.js`);return{diagram:e}},__vite__mapDeps([155,148,104,1,149,150,108,109]));return{id:JO,diagram:e}},`loader`)},XO=`xychart`,ZO={id:XO,detector:l(e=>/^\s*xychart(-beta)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./xychartDiagram-JWTSCODW-BCXHFEAl.js`);return{diagram:e}},__vite__mapDeps([156,103,104,1,105,106,107,108,109,110,148,149,150,153,122,123,124]));return{id:XO,diagram:e}},`loader`)},QO=`requirement`,$O={id:QO,detector:l(e=>/^\s*requirement(Diagram)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./requirementDiagram-Z7DCOOCP-bWlpEI8M.js`);return{diagram:e}},__vite__mapDeps([157,103,104,1,105,106,107,108,109,110,131,133,116,117,118,119,120,121,122,123,124]));return{id:QO,diagram:e}},`loader`)},ek=`sequence`,tk={id:ek,detector:l(e=>/^\s*sequenceDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./sequenceDiagram-2WXFIKYE-DXTnjjaR.js`);return{diagram:e}},__vite__mapDeps([158,106,1,104,105,107,108,109,110,128,146]));return{id:ek,diagram:e}},`loader`)},nk=`class`,rk={id:nk,detector:l((e,t)=>t?.class?.defaultRenderer===`dagre-wrapper`?!1:/^\s*classDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./classDiagram-VBA2DB6C-DET8D2F6.js`);return{diagram:e}},__vite__mapDeps([159,103,104,1,105,106,107,108,109,110,131,132,128,133,116,117,118,119,120,121,122,123,124,160]));return{id:nk,diagram:e}},`loader`)},ik=`classDiagram`,ak={id:ik,detector:l((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer===`dagre-wrapper`?!0:/^\s*classDiagram-v2/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./classDiagram-v2-RAHNMMFH-C_pvaxDg.js`);return{diagram:e}},__vite__mapDeps([161,103,104,1,105,106,107,108,109,110,131,132,128,133,116,117,118,119,120,121,122,123,124,160]));return{id:ik,diagram:e}},`loader`)},ok=`state`,sk={id:ok,detector:l((e,t)=>t?.state?.defaultRenderer===`dagre-wrapper`?!1:/^\s*stateDiagram/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./stateDiagram-RAJIS63D-BEPLG8-b.js`);return{diagram:e}},__vite__mapDeps([162,103,104,1,105,106,107,108,109,110,122,123,124,111,112,113,114,131,133,116,117,118,119,120,163,121]));return{id:ok,diagram:e}},`loader`)},ck=`stateDiagram`,lk={id:ck,detector:l((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer===`dagre-wrapper`),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./stateDiagram-v2-FVOUBMTO-Cn3GtrPV.js`);return{diagram:e}},__vite__mapDeps([164,103,104,1,105,106,107,108,109,110,131,133,116,117,118,119,120,163,121,122,123,124]));return{id:ck,diagram:e}},`loader`)},uk=`journey`,dk={id:uk,detector:l(e=>/^\s*journey/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./journeyDiagram-4ABVD52K-BbJAX67K.js`);return{diagram:e}},__vite__mapDeps([165,104,1,154,123,107,108,109,132,128,106]));return{id:uk,diagram:e}},`loader`)},fk={draw:l((e,t,n)=>{c.debug(`rendering svg for syntax error
|
|
199
|
+
`);let r=dw(t),i=r.append(`g`);r.attr(`viewBox`,`0 0 2412 512`),C(r,100,512,!0),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1440).attr(`y`,250).attr(`font-size`,`150px`).style(`text-anchor`,`middle`).text(`Syntax error in text`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1250).attr(`y`,400).attr(`font-size`,`100px`).style(`text-anchor`,`middle`).text(`mermaid version ${n}`)},`draw`)},pk=fk,mk={db:{},renderer:fk,parser:{parse:l(()=>{},`parse`)}},hk=`flowchart-elk`,gk={id:hk,detector:l((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer===`elk`?(t.layout=`elk`,!0):!1,`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./flowDiagram-PKNHOUZH-DCjCL66H.js`);return{diagram:e}},__vite__mapDeps([129,103,104,1,105,106,107,108,109,110,130,131,132,128,133,116,117,118,119,120,121,122,123,124]));return{id:hk,diagram:e}},`loader`)},_k=`timeline`,vk={id:_k,detector:l(e=>/^\s*timeline/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./timeline-definition-YZTLITO2-BHlpJEA0.js`);return{diagram:e}},__vite__mapDeps([166,104,1,154,123,107,108,109]));return{id:_k,diagram:e}},`loader`)},yk=`mindmap`,bk={id:yk,detector:l(e=>/^\s*mindmap/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./mindmap-definition-YRQLILUH-a6cg75mj.js`);return{diagram:e}},__vite__mapDeps([167,103,104,1,105,106,107,108,109,110,131,133,116,117,118,119,120,121,122,123,124]));return{id:yk,diagram:e}},`loader`)},xk=`kanban`,Sk={id:xk,detector:l(e=>/^\s*kanban/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./kanban-definition-K7BYSVSG-qoQ-gouW.js`);return{diagram:e}},__vite__mapDeps([168,103,104,1,105,106,107,108,109,110,132,116,117,118,119]));return{id:xk,diagram:e}},`loader`)},Ck=`sankey`,wk={id:Ck,detector:l(e=>/^\s*sankey(-beta)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./sankeyDiagram-WA2Y5GQK-Bemb6KrC.js`);return{diagram:e}},__vite__mapDeps([169,104,1,153,150,108,109]));return{id:Ck,diagram:e}},`loader`)},Tk=`packet`,Ek={id:Tk,detector:l(e=>/^\s*packet(-beta)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./diagram-P4PSJMXO-C1pGlueJ.js`);return{diagram:e}},__vite__mapDeps([170,136,109,137,1,110,113,114,115,138,139,140,141,142,143,144,104,105,106,107,108,145]));return{id:Tk,diagram:e}},`loader`)},Dk=`radar`,Ok={id:Dk,detector:l(e=>/^\s*radar-beta/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./diagram-IFDJBPK2-BDQnMPef.js`);return{diagram:e}},__vite__mapDeps([171,136,109,137,1,110,113,114,115,138,139,140,141,142,143,144,104,105,106,107,108,145]));return{id:Dk,diagram:e}},`loader`)},kk=`block`,Ak={id:kk,detector:l(e=>/^\s*block(-beta)?/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./blockDiagram-WCTKOSBZ-Bs2dO4Lh.js`);return{diagram:e}},__vite__mapDeps([172,103,104,1,105,106,107,108,109,110,122,123,124,112,113,130,115,132,120,118]));return{id:kk,diagram:e}},`loader`)},jk=`architecture`,Mk={id:jk,detector:l(e=>/^\s*architecture/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./architectureDiagram-2XIMDMQ5-Ci6lZRdi.js`);return{diagram:e}},__vite__mapDeps([173,1,103,104,105,106,107,108,109,110,136,137,113,114,115,138,139,140,141,142,143,144,126,145]));return{id:jk,diagram:e}},`loader`)},Nk=`ishikawa`,Pk={id:Nk,detector:l(e=>/^\s*ishikawa(-beta)?\b/i.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./ishikawaDiagram-PHBUUO56-KwEjkSbo.js`);return{diagram:e}},__vite__mapDeps([174,104,1,105,106,107,108,109,110,119]));return{id:Nk,diagram:e}},`loader`)},Fk=`venn`,Ik={id:Fk,detector:l(e=>/^\s*venn-beta/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./vennDiagram-LZ73GAT5-Bl0Pzjn6.js`);return{diagram:e}},__vite__mapDeps([175,104,1,105,106,107,108,109,110,119]));return{id:Fk,diagram:e}},`loader`)},Lk=`treemap`,Rk={id:Lk,detector:l(e=>/^\s*treemap/.test(e),`detector`),loader:l(async()=>{let{diagram:e}=await a(async()=>{let{diagram:e}=await import(`./diagram-E7M64L7V-eMkzKdKv.js`);return{diagram:e}},__vite__mapDeps([176,136,109,137,1,110,113,114,115,138,139,140,141,142,143,144,104,149,153,150,105,106,107,108,145,133,117]));return{id:Lk,diagram:e}},`loader`)},zk=!1,Bk=l(()=>{zk||(zk=!0,h(`error`,mk,e=>e.toLowerCase().trim()===`error`),h(`---`,{db:{clear:l(()=>{},`clear`)},styles:{},renderer:{draw:l(()=>{},`draw`)},parser:{parse:l(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},`parse`)},init:l(()=>null,`init`)},e=>e.toLowerCase().trimStart().startsWith(`---`)),g(gk,bk,Mk),g(NO,Sk,ak,rk,zO,UO,GO,qO,$O,tk,LO,FO,vk,VO,lk,sk,dk,YO,wk,Ek,ZO,Ak,Ok,Pk,Rk,Ik))},`addDiagrams`),Vk=l(async()=>{c.debug(`Loading registered diagrams`);let e=(await Promise.allSettled(Object.entries(k).map(async([e,{detector:t,loader:n}])=>{if(n)try{N(e)}catch{try{let{diagram:e,id:r}=await n();h(r,e,t)}catch(t){throw c.error(`Failed to load external diagram with key ${e}. Removing from detectors.`),delete k[e],t}}}))).filter(e=>e.status===`rejected`);if(e.length>0){c.error(`Failed to load ${e.length} external diagrams`);for(let t of e)c.error(t);throw Error(`Failed to load ${e.length} external diagrams`)}},`loadRegisteredDiagrams`),Hk=`graphics-document document`;function Uk(e,t){e.attr(`role`,Hk),t!==``&&e.attr(`aria-roledescription`,t)}l(Uk,`setA11yDiagramInfo`);function Wk(e,t,n,r){if(e.insert!==void 0){if(n){let t=`chart-desc-${r}`;e.attr(`aria-describedby`,t),e.insert(`desc`,`:first-child`).attr(`id`,t).text(n)}if(t){let n=`chart-title-${r}`;e.attr(`aria-labelledby`,n),e.insert(`title`,`:first-child`).attr(`id`,n).text(t)}}}l(Wk,`addSVGa11yTitleDescription`);var Gk=class e{constructor(e,t,n,r,i){this.type=e,this.text=t,this.db=n,this.parser=r,this.renderer=i}static{l(this,`Diagram`)}static async fromText(t,n={}){let r=P(),i=w(t,r);t=te(t)+`
|
|
200
200
|
`;try{N(i)}catch{let e=_(i);if(!e)throw new j(`Diagram ${i} not found.`);let{id:t,diagram:n}=await e();h(t,n)}let{db:a,parser:o,renderer:s,init:c}=N(i);return o.parser&&(o.parser.yy=a),a.clear?.(),c?.(r),n.title&&a.setDiagramTitle?.(n.title),await o.parse(t),new e(i,t,a,o,s)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},Kk=[],qk=l(()=>{Kk.forEach(e=>{e()}),Kk=[]},`attachFunctions`),Jk=l(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,``).trimStart(),`cleanupComments`);function Yk(e){let t=e.match(T);if(!t)return{text:e,metadata:{}};let n=uD(t[1],{schema:lD})??{};n=typeof n==`object`&&!Array.isArray(n)?n:{};let r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}l(Yk,`extractFrontMatter`);var Xk=l(e=>e.replace(/\r\n?/g,`
|
|
201
201
|
`).replace(/<(\w+)([^>]*)>/g,(e,t,n)=>`<`+t+n.replace(/="([^"]*)"/g,`='$1'`)+`>`),`cleanupText`),Zk=l(e=>{let{text:t,metadata:n}=Yk(e),{displayMode:r,title:i,config:a={}}=n;return r&&(a.gantt||={},a.gantt.displayMode=r),{title:i,config:a,text:t}},`processFrontmatter`),Qk=l(e=>{let t=re.detectInit(e)??{},n=re.detectDirective(e,`wrap`);return Array.isArray(n)?t.wrap=n.some(({type:e})=>e===`wrap`):n?.type===`wrap`&&(t.wrap=!0),{text:ie(e),directive:t}},`processDirectives`);function $k(e){let t=Zk(Xk(e)),n=Qk(t.text),r=ae(t.config,n.directive);return e=Jk(n.text),{code:e,title:t.title,config:r}}l($k,`preprocessDiagram`);function eA(e){let t=new TextEncoder().encode(e),n=Array.from(t,e=>String.fromCodePoint(e)).join(``);return btoa(n)}l(eA,`toBase64`);var tA=5e4,nA=`graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa`,rA=`sandbox`,iA=`loose`,aA=`http://www.w3.org/2000/svg`,oA=`http://www.w3.org/1999/xlink`,sA=`http://www.w3.org/1999/xhtml`,cA=`100%`,lA=`100%`,uA=`border:0;margin:0;`,dA=`margin:0`,fA=`allow-top-navigation-by-user-activation allow-popups`,pA=`The "iframe" tag is not supported by your browser.`,mA=[`foreignobject`],hA=[`dominant-baseline`];function gA(e){let t=$k(e);return d(),O(t.config??{}),t}l(gA,`processAndSetConfigs`);async function _A(e,t){Bk();try{let{code:t,config:n}=gA(e);return{diagramType:(await OA(t)).type,config:n}}catch(e){if(t?.suppressErrors)return!1;throw e}}l(_A,`parse`);var vA=l((e,t,n=[])=>`
|
|
202
202
|
.${e} ${t} { ${n.join(` !important; `)} !important; }`,`cssImportantStyles`),yA=l((e,t=new Map)=>{let n=``;if(e.themeCSS!==void 0&&(n+=`
|
|
@@ -314,14 +314,14 @@ ${e}</tr>
|
|
|
314
314
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${TV(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=EV(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+TV(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=EV(e);if(i===null)return TV(n);e=i;let a=`<img src="${e}" alt="${TV(n)}"`;return t&&(a+=` title="${TV(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:TV(e.text)}},IV=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},LV=class e{options;renderer;textRenderer;constructor(e){this.options=e||fB,this.options.renderer=this.options.renderer||new FV,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new IV}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},RV=class{options;block;constructor(e){this.options=e||fB}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?PV.lex:PV.lexInline}provideParser(){return this.block?LV.parse:LV.parseInline}},zV=new class{defaults=dB();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=LV;Renderer=FV;TextRenderer=IV;Lexer=PV;Tokenizer=NV;Hooks=RV;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new FV(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new NV(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new RV;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];RV.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&RV.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return PV.lex(e,t??this.defaults)}parser(e,t){return LV.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?PV.lex:PV.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?LV.parse:LV.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?PV.lex:PV.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?LV.parse:LV.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
315
315
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+TV(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function BV(e,t){return zV.parse(e,t)}BV.options=BV.setOptions=function(e){return zV.setOptions(e),BV.defaults=zV.defaults,pB(BV.defaults),BV},BV.getDefaults=dB,BV.defaults=fB,BV.use=function(...e){return zV.use(...e),BV.defaults=zV.defaults,pB(BV.defaults),BV},BV.walkTokens=function(e,t){return zV.walkTokens(e,t)},BV.parseInline=zV.parseInline,BV.Parser=LV,BV.parser=LV.parse,BV.Renderer=FV,BV.TextRenderer=IV,BV.Lexer=PV,BV.lexer=PV.lex,BV.Tokenizer=NV,BV.Hooks=RV,BV.parse=BV,BV.options,BV.setOptions,BV.use,BV.walkTokens,BV.parseInline,LV.parse,PV.lex;var VV=300,HV=`300px`,UV=500;function WV(e={}){let{immediate:t=!1,debounceDelay:n=VV,rootMargin:r=HV,idleTimeout:i=UV}=e,[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null),c=(0,L.useRef)(null),l=(0,L.useRef)(null),u=(0,L.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,L.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,L.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,L.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var GV=/\s/,KV=/^\s+$/,qV=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),JV=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,YV=e=>e.some(e=>JV(e)&&qV.has(e.tagName)),XV=e=>{let t=[],n=``,r=!1;for(let i of e){let e=GV.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},ZV=e=>{let t=[],n=``;for(let r of e)GV.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},QV=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${a}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},$V=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(YV(t))return qm;let o=a,s=o.children.indexOf(e);if(s===-1)return;let c=e.value;if(!c.trim()){i.count+=c.length;return}let l=n.sep===`char`?ZV(c):XV(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,KV.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return QV(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},eH=0;function tH(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40},n={prevContentLength:0,lastRenderCharCount:0},r=eH++,i=()=>e=>{let r={count:0,newIndex:0};Jm(e,`text`,(e,i)=>$V(e,i,t,n,r)),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,`name`,{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.prevContentLength=e},getLastRenderCharCount(){let e=n.lastRenderCharCount;return n.lastRenderCharCount=0,e}}}tH();var nH=(0,L.createContext)(!1),rH=()=>(0,L.useContext)(nH),iH=(...e)=>gi(Vn(e)),aH=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},oH=e=>e?(...t)=>aH(e,gi(Vn(t))):iH,sH=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},cH=(0,L.createContext)(iH),lH=()=>(0,L.useContext)(cH),uH=iH(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),dH=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},fH=(0,L.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=lH(),c=(0,L.useMemo)(()=>s(uH),[s]),l=(0,L.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,dH(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,z.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,z.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,z.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,z.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
316
316
|
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,z.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),pH=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,z.jsx)(`div`,{className:lH()(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i}),mH=(0,L.createContext)({code:``}),hH=()=>(0,L.useContext)(mH),gH=({language:e})=>{let t=lH();return(0,z.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,z.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},_H=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
317
|
-
`;)t--;return e.slice(0,t)},vH=(0,L.lazy)(()=>a(()=>import(`./highlighted-body-OFNGDK62-
|
|
317
|
+
`;)t--;return e.slice(0,t)},vH=(0,L.lazy)(()=>a(()=>import(`./highlighted-body-OFNGDK62-BWa9Mb0y.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([177,1]))),yH=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=lH(),l=(0,L.useMemo)(()=>_H(e),[e]),u=(0,L.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
|
|
318
318
|
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,z.jsx)(mH.Provider,{value:{code:e},children:(0,z.jsxs)(pH,{isIncomplete:i,language:t,children:[(0,z.jsx)(gH,{language:t}),r?(0,z.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,z.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,z.jsx)(L.Suspense,{fallback:(0,z.jsx)(fH,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,z.jsx)(vH,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},bH={CheckIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,z.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,z.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,z.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},xH=(0,L.createContext)(bH),SH=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1},CH=({icons:e,children:t})=>{let n=(0,L.useRef)(e),r=(0,L.useRef)(e?{...bH,...e}:bH);SH(n.current,e)||(n.current=e,r.current=e?{...bH,...e}:bH);let i=r.current;return(0,z.jsx)(xH.Provider,{value:i,children:t})},wH=()=>(0,L.useContext)(xH),TH={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},EH=(0,L.createContext)(TH),DH=()=>(0,L.useContext)(EH),OH=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=lH(),[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(0),{code:d}=hH(),{isAnimating:f}=(0,L.useContext)(PW),p=DH(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,L.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=wH(),_=c?g.CheckIcon:g.CopyIcon;return(0,z.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,z.jsx)(_,{size:14})})},kH={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},AH=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=lH(),{code:c}=hH(),{isAnimating:l}=(0,L.useContext)(PW),u=DH(),d=wH(),f=a??c,p=`file.${n&&n in kH?kH[n]:`txt`}`,m=()=>{try{sH(p,f,`text/plain`),e?.()}catch(e){t?.(e)}};return(0,z.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:m,title:u.downloadFile,type:`button`,...o,children:r??(0,z.jsx)(d.DownloadIcon,{size:14})})},jH=()=>{let{Loader2Icon:e}=wH(),t=lH();return(0,z.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,z.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,z.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,z.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},MH=/\.[^/.]+$/,NH=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=wH(),c=lH(),l=(0,L.useRef)(null),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=DH(),h=o.width!=null||o.height!=null,g=(u||h)&&!f,_=f&&!h;(0,L.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;d(t),p(!t)}},[]);let v=(0,L.useCallback)(e=>{d(!0),p(!1),i?.(e)},[i]),y=(0,L.useCallback)(e=>{d(!1),p(!0),a?.(e)},[a]),b=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(MH,``)}.${i}`}sH(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,z.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,z.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,_&&`hidden`,t),"data-streamdown":`image`,onError:y,onLoad:v,ref:l,src:n,...o}),_&&(0,z.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:m.imageNotAvailable}),(0,z.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),g&&(0,z.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:b,title:m.downloadImage,type:`button`,children:(0,z.jsx)(s,{size:14})})]}):null},PH=0,FH=()=>{PH+=1,PH===1&&(document.body.style.overflow=`hidden`)},IH=()=>{PH=Math.max(0,PH-1),PH===0&&(document.body.style.overflow=``)},LH=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=wH(),c=lH(),[l,u]=(0,L.useState)(!1),d=DH(),f=(0,L.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,L.useCallback)(()=>{r(),n()},[r,n]);return(0,L.useEffect)(()=>{if(t){FH();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),IH()}}},[t,n]),t?(0,z.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,z.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,z.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,z.jsx)(s,{size:16})}),(0,z.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,z.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,z.jsx)(o,{size:20}),(0,z.jsx)(`span`,{children:d.openExternalLink})]}),(0,z.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,z.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,z.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,z.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(i,{size:14}),(0,z.jsx)(`span`,{children:d.copied})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{size:14}),(0,z.jsx)(`span`,{children:d.copyLink})]})}),(0,z.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,z.jsx)(o,{size:14}),(0,z.jsx)(`span`,{children:d.openLink})]})]})]})}):null},RH=(0,L.createContext)(null),zH=()=>(0,L.useContext)(RH),BH=()=>zH()?.code??null,VH=()=>zH()?.mermaid??null,HH=e=>{var t;let n=zH();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},UH=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),WH=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=lH(),[s,c]=(0,L.useState)(!1),l=(0,L.useRef)(null),{isAnimating:u}=(0,L.useContext)(PW),d=wH(),f=VH(),p=DH(),m=async t=>{try{if(t===`mmd`){sH(`diagram.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!f){a?.(Error(`Mermaid plugin not available`));return}let n=f.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}if(t===`svg`){sH(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){sH(`diagram.png`,await UH(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,L.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,z.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,z.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:p.downloadDiagram,type:`button`,children:t??(0,z.jsx)(d.DownloadIcon,{size:14})}),s?(0,z.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`svg`),title:p.downloadDiagramAsSvg,type:`button`,children:p.mermaidFormatSvg}),(0,z.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`png`),title:p.downloadDiagramAsPng,type:`button`,children:p.mermaidFormatPng}),(0,z.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`mmd`),title:p.downloadDiagramAsMmd,type:`button`,children:p.mermaidFormatMmd})]}):null]})},GH=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=wH(),c=lH(),[l,u]=(0,L.useState)(!1),{isAnimating:d,controls:f}=(0,L.useContext)(PW),p=DH(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),h=()=>{u(!l)};return(0,L.useEffect)(()=>{if(l){FH();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),IH()}}},[l]),(0,L.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:h,title:p.viewFullscreen,type:`button`,...a,children:(0,z.jsx)(o,{size:14})}),l?(0,Ie.createPortal)((0,z.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:h,onKeyDown:e=>{e.key===`Escape`&&h()},role:`button`,tabIndex:0,children:[(0,z.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:h,title:p.exitFullscreen,type:`button`,children:(0,z.jsx)(s,{size:20})}),(0,z.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,z.jsx)(RW,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})},KH=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}},qH=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
|
|
319
319
|
`)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
|
|
320
320
|
`)},JH=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
321
321
|
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
322
322
|
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
323
323
|
`)},YH=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):n.push(t);return n.join(``)},XH=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0;r[i]=`| ${t.map(e=>YH(e)).join(` | `)} |`,i+=1;let a=Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=`---`;r[i]=`| ${a.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?YH(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>YH(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
324
|
-
`)},ZH=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=lH(),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null),d=(0,L.useRef)(0),{isAnimating:f}=(0,L.useContext)(PW),p=DH(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=KH(t),o=({csv:qH,tsv:JH,md:XH}[e]||XH)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,L.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=wH(),g=c?h.CheckIcon:h.CopyIcon;return(0,z.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,z.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,z.jsx)(g,{height:14,width:14})}),o?(0,z.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},QH=({children:e,className:t,onDownload:n,onError:r})=>{let i=lH(),[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null),{isAnimating:c}=(0,L.useContext)(PW),l=DH(),u=wH(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=KH(t),a=e===`csv`?qH(i):XH(i);sH(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,L.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,z.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,z.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,z.jsx)(u.DownloadIcon,{size:14})}),a?(0,z.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,z.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},$H=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=wH(),o=lH(),[s,c]=(0,L.useState)(!1),{isAnimating:l}=(0,L.useContext)(PW),u=DH(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,L.useEffect)(()=>{if(s){FH();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),IH()}}},[s]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,z.jsx)(i,{size:14})}),s?(0,Ie.createPortal)((0,z.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,z.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,z.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,z.jsx)(ZH,{}):null,r?(0,z.jsx)(QH,{}):null,(0,z.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,z.jsx)(a,{size:20})})]}),(0,z.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,z.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},eU=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=lH(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,z.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,z.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,z.jsx)(ZH,{}):null,l?(0,z.jsx)(QH,{}):null,u?(0,z.jsx)($H,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,z.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,z.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},tU=/startLine=(\d+)/,nU=/\bnoLineNumbers\b/,rU=(0,L.lazy)(()=>a(()=>import(`./mermaid-GHXKKRXX-Dar-R5At.js`).then(e=>({default:e.Mermaid})),[])),iU=/language-([^\s]+)/;function aU(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function oU(e,t){return e.className===t.className&&aU(e.node,t.node)}var sU=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,cU=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},lU=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},uU=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},dU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`ol`,{className:lH()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>oU(e,t));dU.displayName=`MarkdownOl`;var fU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`li`,{className:lH()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&aU(e.node,t.node));fU.displayName=`MarkdownLi`;var pU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`ul`,{className:lH()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>oU(e,t));pU.displayName=`MarkdownUl`;var mU=(0,L.memo)(({className:e,node:t,...n})=>(0,z.jsx)(`hr`,{className:lH()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>oU(e,t));mU.displayName=`MarkdownHr`;var hU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`span`,{className:lH()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>oU(e,t));hU.displayName=`MarkdownStrong`;var gU=(0,L.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=lH(),{linkSafety:o}=(0,L.useContext)(PW),[s,c]=(0,L.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,L.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,L.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,L.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,z.jsx)(LH,{...p})]}):(0,z.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>oU(e,t)&&e.href===t.href);gU.displayName=`MarkdownA`;var _U=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h1`,{className:lH()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>oU(e,t));_U.displayName=`MarkdownH1`;var vU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h2`,{className:lH()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>oU(e,t));vU.displayName=`MarkdownH2`;var yU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h3`,{className:lH()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>oU(e,t));yU.displayName=`MarkdownH3`;var bU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h4`,{className:lH()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>oU(e,t));bU.displayName=`MarkdownH4`;var xU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h5`,{className:lH()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>oU(e,t));xU.displayName=`MarkdownH5`;var SU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h6`,{className:lH()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>oU(e,t));SU.displayName=`MarkdownH6`;var CU=(0,L.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,L.useContext)(PW);return(0,z.jsx)(eU,{className:t,showControls:sU(i,`table`),showCopy:cU(i,`copy`),showDownload:cU(i,`download`),showFullscreen:cU(i,`fullscreen`),...r,children:e})},(e,t)=>oU(e,t));CU.displayName=`MarkdownTable`;var wU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`thead`,{className:lH()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>oU(e,t));wU.displayName=`MarkdownThead`;var TU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`tbody`,{className:lH()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>oU(e,t));TU.displayName=`MarkdownTbody`;var EU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`tr`,{className:lH()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>oU(e,t));EU.displayName=`MarkdownTr`;var DU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`th`,{className:lH()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>oU(e,t));DU.displayName=`MarkdownTh`;var OU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`td`,{className:lH()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>oU(e,t));OU.displayName=`MarkdownTd`;var kU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`blockquote`,{className:lH()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>oU(e,t));kU.displayName=`MarkdownBlockquote`;var AU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`sup`,{className:lH()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>oU(e,t));AU.displayName=`MarkdownSup`;var jU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`sub`,{className:lH()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>oU(e,t));jU.displayName=`MarkdownSub`;var MU=(0,L.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,L.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,L.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,L.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,L.isValidElement)(e))return e;if(e.type===dU){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,z.jsx)(`section`,{className:t,...r,children:i}):null}return(0,z.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>oU(e,t));MU.displayName=`MarkdownSection`;var NU=(0,L.memo)(({node:e,className:t,children:n,...r})=>{let i=lH(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,L.useContext)(PW),l=VH(),u=rH(),d=(t?.match(iU))?.at(1)??``,f=HH(d);if(a)return(0,z.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(tU),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&nU.test(p))&&c!==!1,v=``;if((0,L.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,z.jsx)(L.Suspense,{fallback:(0,z.jsx)(jH,{}),children:(0,z.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=sU(s,`mermaid`),n=uU(s,`download`),r=uU(s,`copy`),a=uU(s,`fullscreen`),c=uU(s,`panZoom`),l=e&&(n||r||a);return(0,z.jsx)(L.Suspense,{fallback:(0,z.jsx)(jH,{}),children:(0,z.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,z.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,z.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,z.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,z.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,z.jsx)(WH,{chart:v,config:o?.config}):null,r?(0,z.jsx)(OH,{code:v}):null,a?(0,z.jsx)(GH,{chart:v,config:o?.config}):null]})}):null,(0,z.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,z.jsx)(rU,{chart:v,config:o?.config,showControls:c})})]})})}let y=sU(s,`code`),b=lU(s,`download`),x=lU(s,`copy`);return(0,z.jsx)(yH,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,z.jsxs)(z.Fragment,{children:[b?(0,z.jsx)(AH,{code:v,language:d}):null,x?(0,z.jsx)(OH,{}):null]}):null})},(e,t)=>e.className===t.className&&aU(e.node,t.node));NU.displayName=`MarkdownCode`;var PU=(0,L.memo)(NH,(e,t)=>e.className===t.className&&aU(e.node,t.node));PU.displayName=`MarkdownImg`;var FU=(0,L.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,L.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,z.jsx)(z.Fragment,{children:e})}return(0,z.jsx)(`p`,{...n,children:e})},(e,t)=>oU(e,t));FU.displayName=`MarkdownParagraph`;var IU={ol:dU,li:fU,ul:pU,hr:mU,strong:hU,a:gU,h1:_U,h2:vU,h3:yU,h4:bU,h5:xU,h6:SU,table:CU,thead:wU,tbody:TU,tr:EU,th:DU,td:OU,blockquote:kU,code:NU,img:PU,pre:({children:e})=>(0,L.isValidElement)(e)?(0,L.cloneElement)(e,{"data-block":`true`}):e,sup:AU,sub:jU,p:FU,section:MU},LU=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,RU=/\p{L}/u;function zU(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(LU.test(e))return`rtl`;if(RU.test(e))return`ltr`}return`ltr`}var BU=/^[ \t]{0,3}(`{3,}|~{3,})/,VU=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,HU=e=>{let t=e.split(`
|
|
324
|
+
`)},ZH=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=lH(),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),u=(0,L.useRef)(null),d=(0,L.useRef)(0),{isAnimating:f}=(0,L.useContext)(PW),p=DH(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=KH(t),o=({csv:qH,tsv:JH,md:XH}[e]||XH)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,L.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=wH(),g=c?h.CheckIcon:h.CopyIcon;return(0,z.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,z.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,z.jsx)(g,{height:14,width:14})}),o?(0,z.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},QH=({children:e,className:t,onDownload:n,onError:r})=>{let i=lH(),[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null),{isAnimating:c}=(0,L.useContext)(PW),l=DH(),u=wH(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=KH(t),a=e===`csv`?qH(i):XH(i);sH(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,L.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,z.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,z.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,z.jsx)(u.DownloadIcon,{size:14})}),a?(0,z.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,z.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},$H=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=wH(),o=lH(),[s,c]=(0,L.useState)(!1),{isAnimating:l}=(0,L.useContext)(PW),u=DH(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,L.useEffect)(()=>{if(s){FH();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),IH()}}},[s]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,z.jsx)(i,{size:14})}),s?(0,Ie.createPortal)((0,z.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,z.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,z.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,z.jsx)(ZH,{}):null,r?(0,z.jsx)(QH,{}):null,(0,z.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,z.jsx)(a,{size:20})})]}),(0,z.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,z.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},eU=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=lH(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,z.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,z.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,z.jsx)(ZH,{}):null,l?(0,z.jsx)(QH,{}):null,u?(0,z.jsx)($H,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,z.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,z.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},tU=/startLine=(\d+)/,nU=/\bnoLineNumbers\b/,rU=(0,L.lazy)(()=>a(()=>import(`./mermaid-GHXKKRXX-BonhTQ8Y.js`).then(e=>({default:e.Mermaid})),[])),iU=/language-([^\s]+)/;function aU(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function oU(e,t){return e.className===t.className&&aU(e.node,t.node)}var sU=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,cU=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},lU=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},uU=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},dU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`ol`,{className:lH()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>oU(e,t));dU.displayName=`MarkdownOl`;var fU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`li`,{className:lH()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&aU(e.node,t.node));fU.displayName=`MarkdownLi`;var pU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`ul`,{className:lH()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>oU(e,t));pU.displayName=`MarkdownUl`;var mU=(0,L.memo)(({className:e,node:t,...n})=>(0,z.jsx)(`hr`,{className:lH()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>oU(e,t));mU.displayName=`MarkdownHr`;var hU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`span`,{className:lH()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>oU(e,t));hU.displayName=`MarkdownStrong`;var gU=(0,L.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=lH(),{linkSafety:o}=(0,L.useContext)(PW),[s,c]=(0,L.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,L.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,L.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,L.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,z.jsx)(LH,{...p})]}):(0,z.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>oU(e,t)&&e.href===t.href);gU.displayName=`MarkdownA`;var _U=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h1`,{className:lH()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>oU(e,t));_U.displayName=`MarkdownH1`;var vU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h2`,{className:lH()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>oU(e,t));vU.displayName=`MarkdownH2`;var yU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h3`,{className:lH()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>oU(e,t));yU.displayName=`MarkdownH3`;var bU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h4`,{className:lH()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>oU(e,t));bU.displayName=`MarkdownH4`;var xU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h5`,{className:lH()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>oU(e,t));xU.displayName=`MarkdownH5`;var SU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h6`,{className:lH()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>oU(e,t));SU.displayName=`MarkdownH6`;var CU=(0,L.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,L.useContext)(PW);return(0,z.jsx)(eU,{className:t,showControls:sU(i,`table`),showCopy:cU(i,`copy`),showDownload:cU(i,`download`),showFullscreen:cU(i,`fullscreen`),...r,children:e})},(e,t)=>oU(e,t));CU.displayName=`MarkdownTable`;var wU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`thead`,{className:lH()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>oU(e,t));wU.displayName=`MarkdownThead`;var TU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`tbody`,{className:lH()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>oU(e,t));TU.displayName=`MarkdownTbody`;var EU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`tr`,{className:lH()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>oU(e,t));EU.displayName=`MarkdownTr`;var DU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`th`,{className:lH()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>oU(e,t));DU.displayName=`MarkdownTh`;var OU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`td`,{className:lH()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>oU(e,t));OU.displayName=`MarkdownTd`;var kU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`blockquote`,{className:lH()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>oU(e,t));kU.displayName=`MarkdownBlockquote`;var AU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`sup`,{className:lH()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>oU(e,t));AU.displayName=`MarkdownSup`;var jU=(0,L.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`sub`,{className:lH()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>oU(e,t));jU.displayName=`MarkdownSub`;var MU=(0,L.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,L.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,L.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,L.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,L.isValidElement)(e))return e;if(e.type===dU){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,z.jsx)(`section`,{className:t,...r,children:i}):null}return(0,z.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>oU(e,t));MU.displayName=`MarkdownSection`;var NU=(0,L.memo)(({node:e,className:t,children:n,...r})=>{let i=lH(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,L.useContext)(PW),l=VH(),u=rH(),d=(t?.match(iU))?.at(1)??``,f=HH(d);if(a)return(0,z.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(tU),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&nU.test(p))&&c!==!1,v=``;if((0,L.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,z.jsx)(L.Suspense,{fallback:(0,z.jsx)(jH,{}),children:(0,z.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=sU(s,`mermaid`),n=uU(s,`download`),r=uU(s,`copy`),a=uU(s,`fullscreen`),c=uU(s,`panZoom`),l=e&&(n||r||a);return(0,z.jsx)(L.Suspense,{fallback:(0,z.jsx)(jH,{}),children:(0,z.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,z.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,z.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,z.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,z.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,z.jsx)(WH,{chart:v,config:o?.config}):null,r?(0,z.jsx)(OH,{code:v}):null,a?(0,z.jsx)(GH,{chart:v,config:o?.config}):null]})}):null,(0,z.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,z.jsx)(rU,{chart:v,config:o?.config,showControls:c})})]})})}let y=sU(s,`code`),b=lU(s,`download`),x=lU(s,`copy`);return(0,z.jsx)(yH,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,z.jsxs)(z.Fragment,{children:[b?(0,z.jsx)(AH,{code:v,language:d}):null,x?(0,z.jsx)(OH,{}):null]}):null})},(e,t)=>e.className===t.className&&aU(e.node,t.node));NU.displayName=`MarkdownCode`;var PU=(0,L.memo)(NH,(e,t)=>e.className===t.className&&aU(e.node,t.node));PU.displayName=`MarkdownImg`;var FU=(0,L.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,L.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,z.jsx)(z.Fragment,{children:e})}return(0,z.jsx)(`p`,{...n,children:e})},(e,t)=>oU(e,t));FU.displayName=`MarkdownParagraph`;var IU={ol:dU,li:fU,ul:pU,hr:mU,strong:hU,a:gU,h1:_U,h2:vU,h3:yU,h4:bU,h5:xU,h6:SU,table:CU,thead:wU,tbody:TU,tr:EU,th:DU,td:OU,blockquote:kU,code:NU,img:PU,pre:({children:e})=>(0,L.isValidElement)(e)?(0,L.cloneElement)(e,{"data-block":`true`}):e,sup:AU,sub:jU,p:FU,section:MU},LU=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,RU=/\p{L}/u;function zU(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(LU.test(e))return`rtl`;if(RU.test(e))return`ltr`}return`ltr`}var BU=/^[ \t]{0,3}(`{3,}|~{3,})/,VU=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,HU=e=>{let t=e.split(`
|
|
325
325
|
`),n=null,r=0;for(let e of t){let t=BU.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},UU=e=>{let t=e.split(`
|
|
326
326
|
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&VU.test(t))return!0}return!1},WU=()=>e=>{Ym(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},GU=[],KU={allowDangerousHtml:!0},qU=new WeakMap,JU=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=qU.get(e);n||(n=e.name,qU.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=qU.get(r);e||(e=r.name,qU.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},YU=e=>{let t=XU(e),n=e.children||``;return rW(t.runSync(t.parse(n),n),e)},XU=e=>{let t=JU.get(e);if(t)return t;let n=QU(e);return JU.set(e,n),n},ZU=e=>e.some(e=>Array.isArray(e)?e[0]===yF:e===yF),QU=e=>{let t=e.rehypePlugins||GU,n=e.remarkPlugins||GU,r=ZU(t)?n:[...n,WU],i=e.remarkRehypeOptions?{...KU,...e.remarkRehypeOptions}:KU;return tB().use(IR).use(r).use(Dz,i).use(t)},$U=e=>e,eW=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},tW=(e,t)=>{for(let n in ZL)if(Object.hasOwn(ZL,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=ZL[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},nW=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},rW=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||$U;Ym(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return eW(c,s,a,e.value),s;if(e.type===`element`&&(tW(e,t),nW(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return kL(e,{Fragment:z.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0})},iW=/\[\^[\w-]{1,200}\](?!:)/,aW=/\[\^[\w-]{1,200}\]:/,oW=/<(\w+)[\s>]/,sW=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),cW=new Map,lW=new Map,uW=e=>{let t=e.toLowerCase(),n=cW.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return cW.set(t,r),r},dW=e=>{let t=e.toLowerCase(),n=lW.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return lW.set(t,r),r},fW=(e,t)=>{if(sW.has(t.toLowerCase()))return 0;let n=e.match(uW(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},pW=(e,t)=>{let n=e.match(dW(t));return n?n.length:0},mW=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},hW=e=>{let t=iW.test(e),n=aW.test(e);if(t||n)return[e];let r=PV.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=fW(t,e),o=pW(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(oW);if(e){let n=e[1];fW(t,n)>pW(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(mW(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},gW=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
|
|
327
327
|
|
|
@@ -395,7 +395,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
395
395
|
]))`;continue}else if(r[e]===`$`){i+=`($|(?=[\r
|
|
396
396
|
]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r
|
|
397
397
|
`:`[${r[e]}\r
|
|
398
|
-
]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function E7(e,t){let n={type:`object`,additionalProperties:O7(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===$.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=x7(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===$.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===$.ZodBranded&&e.keyType._def.type._def.typeName===$.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=_7(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Lve(e,t){return t.mapStrategy===`record`?E7(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[O7(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||g7(),O7(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||g7()],minItems:2,maxItems:2}}}function Rve(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function zve(){return{not:g7()}}function Bve(){return{type:`null`}}var D7={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function Vve(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in D7&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=D7[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Hve(e,t)}var Hve=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>O7(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function Uve(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[D7[e.innerType._def.typeName],`null`]};let n=O7(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Wve(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function Gve(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=qve(a),s=O7(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=Kve(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Kve(e,t){if(e.catchall._def.typeName!==`ZodNever`)return O7(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function qve(e){try{return e.isOptional()}catch{return!0}}var Jve=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return O7(e.innerType._def,t);let n=O7(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:g7()},n]}:g7()},Yve=(e,t)=>{if(t.pipeStrategy===`input`)return O7(e.in._def,t);if(t.pipeStrategy===`output`)return O7(e.out._def,t);let n=O7(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,O7(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Xve(e,t){return O7(e.type._def,t)}function Zve(e,t){let n={type:`array`,uniqueItems:!0,items:O7(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Qve(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>O7(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:O7(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>O7(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function $ve(){return{not:g7()}}function eye(){return g7()}var tye=(e,t)=>O7(e.innerType._def,t),nye=(e,t,n)=>{switch(t){case $.ZodString:return x7(e,n);case $.ZodNumber:return Wve(e);case $.ZodObject:return Gve(e,n);case $.ZodBigInt:return Tve(e);case $.ZodBoolean:return Eve();case $.ZodDate:return v7(e,n);case $.ZodUndefined:return $ve();case $.ZodNull:return Bve();case $.ZodArray:return wve(e,n);case $.ZodUnion:case $.ZodDiscriminatedUnion:return Vve(e,n);case $.ZodIntersection:return Nve(e,n);case $.ZodTuple:return Qve(e,n);case $.ZodRecord:return E7(e,n);case $.ZodLiteral:return Pve(e);case $.ZodEnum:return jve(e);case $.ZodNativeEnum:return Rve(e);case $.ZodNullable:return Uve(e,n);case $.ZodOptional:return Jve(e,n);case $.ZodMap:return Lve(e,n);case $.ZodSet:return Zve(e,n);case $.ZodLazy:return()=>e.getter()._def;case $.ZodPromise:return Xve(e,n);case $.ZodNaN:case $.ZodNever:return zve();case $.ZodEffects:return Ave(e,n);case $.ZodAny:return g7();case $.ZodUnknown:return eye();case $.ZodDefault:return kve(e,n);case $.ZodBranded:return _7(e,n);case $.ZodReadonly:return tye(e,n);case $.ZodCatch:return Dve(e,n);case $.ZodPipeline:return Yve(e,n);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(e=>void 0)(t)}},rye=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function O7(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.call(t,e,t,r,n);if(i!==m7)return i}if(r&&!n){let e=iye(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=nye(e,e.typeName,t),o=typeof a==`function`?O7(a(),t):a;if(o&&aye(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var iye=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:rye(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),g7()):t.$refStrategy===`seen`?g7():void 0}},aye=(e,t,n)=>(e.description&&(n.description=e.description),n),oye=e=>{let t=Cve(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},sye=(e,t)=>{let n=oye(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:O7(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??g7()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=O7(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??g7(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},k7=Symbol.for(`vercel.ai.schema`);function cye(e){let t;return()=>(t??=e(),t)}function A7(e,{validate:t}={}){return{[k7]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function lye(e){return typeof e==`object`&&!!e&&k7 in e&&e[k7]===!0&&`jsonSchema`in e&&`validate`in e}function j7(e){return e==null?A7({properties:{},additionalProperties:!1}):lye(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?M7(e):uye(e):e()}function uye(e){return A7(()=>f7(e[`~standard`].jsonSchema.input({target:`draft-07`})),{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new w3({value:t,cause:n.issues})}}})}function dye(e,t){let n=t?.useReferences??!1;return A7(()=>sye(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function fye(e,t){let n=t?.useReferences??!1;return A7(()=>f7(Cge(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await T8(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function pye(e){return`_zod`in e}function M7(e,t){return pye(e)?fye(e,t):dye(e,t)}async function N7({value:e,schema:t,context:n}){let r=await P7({value:e,schema:t,context:n});if(!r.success)throw w3.wrap({value:e,cause:r.error,context:n});return r.value}async function P7({value:e,schema:t,context:n}){let r=j7(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:w3.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:w3.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function F7({text:e,schema:t}){try{let n=Sve(e);return t==null?{success:!0,value:n,rawValue:n}:await P7({value:n,schema:t})}catch(t){return{success:!1,error:y3.isInstance(t)?t:new y3({text:e,cause:t}),rawValue:void 0}}}function mye({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new hve).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await F7({text:e,schema:t}))}}))}async function I7(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}var hye=Object.defineProperty,gye=(e,t)=>{for(var n in t)hye(e,n,{get:t[n],enumerable:!0})},L7=`AI_NoObjectGeneratedError`,R7=`vercel.ai.error.${L7}`,_ye=Symbol.for(R7),z7,B7=class extends l3{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:L7,message:e,cause:t}),this[z7]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return l3.hasMarker(e,R7)}};z7=_ye;var V7=`AI_UIMessageStreamError`,H7=`vercel.ai.error.${V7}`,vye=Symbol.for(H7),U7,W7=class extends l3{constructor({chunkType:e,chunkId:t,message:n}){super({name:V7,message:n}),this[U7]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return l3.hasMarker(e,H7)}};U7=vye;var G7=V8([Z(),$8(Uint8Array),$8(ArrayBuffer),Q8(e=>globalThis.Buffer?.isBuffer(e)??!1,{message:`Must be a Buffer`})]),K7=L_e(()=>V8([d_e(),Z(),s_e(),N8(),H8(Z(),K7.optional()),I8(K7)])),q7=H8(Z(),H8(Z(),K7.optional())),J7=R8({type:G8(`text`),text:Z(),providerOptions:q7.optional()}),yye=R8({type:G8(`image`),image:V8([G7,$8(URL)]),mediaType:Z().optional(),providerOptions:q7.optional()}),Y7=R8({type:G8(`file`),data:V8([G7,$8(URL)]),filename:Z().optional(),mediaType:Z(),providerOptions:q7.optional()}),bye=R8({type:G8(`reasoning`),text:Z(),providerOptions:q7.optional()}),xye=R8({type:G8(`tool-call`),toolCallId:Z(),toolName:Z(),input:P8(),providerOptions:q7.optional(),providerExecuted:N8().optional()}),Sye=g_e(`type`,[R8({type:G8(`text`),value:Z(),providerOptions:q7.optional()}),R8({type:G8(`json`),value:K7,providerOptions:q7.optional()}),R8({type:G8(`execution-denied`),reason:Z().optional(),providerOptions:q7.optional()}),R8({type:G8(`error-text`),value:Z(),providerOptions:q7.optional()}),R8({type:G8(`error-json`),value:K7,providerOptions:q7.optional()}),R8({type:G8(`content`),value:I8(V8([R8({type:G8(`text`),text:Z(),providerOptions:q7.optional()}),R8({type:G8(`media`),data:Z(),mediaType:Z()}),R8({type:G8(`file-data`),data:Z(),mediaType:Z(),filename:Z().optional(),providerOptions:q7.optional()}),R8({type:G8(`file-url`),url:Z(),providerOptions:q7.optional()}),R8({type:G8(`file-id`),fileId:V8([Z(),H8(Z(),Z())]),providerOptions:q7.optional()}),R8({type:G8(`image-data`),data:Z(),mediaType:Z(),providerOptions:q7.optional()}),R8({type:G8(`image-url`),url:Z(),providerOptions:q7.optional()}),R8({type:G8(`image-file-id`),fileId:V8([Z(),H8(Z(),Z())]),providerOptions:q7.optional()}),R8({type:G8(`custom`),providerOptions:q7.optional()})]))})]),X7=R8({type:G8(`tool-result`),toolCallId:Z(),toolName:Z(),output:Sye,providerOptions:q7.optional()}),Cye=R8({type:G8(`tool-approval-request`),approvalId:Z(),toolCallId:Z()}),wye=R8({type:G8(`tool-approval-response`),approvalId:Z(),approved:N8(),reason:Z().optional()});V8([R8({role:G8(`system`),content:Z(),providerOptions:q7.optional()}),R8({role:G8(`user`),content:V8([Z(),I8(V8([J7,yye,Y7]))]),providerOptions:q7.optional()}),R8({role:G8(`assistant`),content:V8([Z(),I8(V8([J7,Y7,bye,xye,X7,Cye]))]),providerOptions:q7.optional()}),R8({role:G8(`tool`),content:I8(V8([X7,wye])),providerOptions:q7.optional()})]);function Z7(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=Z7(a,i):n[r]=i}return n}gye({},{array:()=>Oye,choice:()=>kye,json:()=>Aye,object:()=>Dye,text:()=>Eye});function Tye(e){let t=[`ROOT`],n=-1,r=null;function i(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s<e.length;s++){let c=e[s];switch(t[t.length-1]){case`ROOT`:i(c,s,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=s,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(c){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:i(c,s,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:a(c,s);break;case`INSIDE_STRING`:switch(c){case`"`:t.pop(),n=s;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=s}break;case`INSIDE_ARRAY_START`:switch(c){case`]`:n=s,t.pop();break;default:n=s,i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(c){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=s,t.pop();break;default:n=s;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),n=s;break;case`INSIDE_NUMBER`:switch(c){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=s;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,s+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?a(c,s):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s)):n=s;break}}}let s=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:s+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}return s}async function Q7(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await F7({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await F7({text:Tye(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}var Eye=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),Dye=({schema:e,name:t,description:n})=>{let r=j7(e);return{name:`object`,responseFormat:I7(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await F7({text:e});if(!n.success)throw new B7({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await P7({value:n.value,schema:r});if(!i.success)throw new B7({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Q7(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},Oye=({element:e,name:t,description:n})=>{let r=j7(e);return{name:`array`,responseFormat:I7(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await F7({text:e});if(!n.success)throw new B7({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new B7({message:`No object generated: response did not match schema.`,cause:new w3({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let n of i.elements){let i=await P7({value:n,schema:r});if(!i.success)throw new B7({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await Q7(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await P7({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},kye=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await F7({text:t});if(!r.success)throw new B7({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new B7({message:`No object generated: response did not match schema.`,cause:new w3({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Q7(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),Aye=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await F7({text:e});if(!n.success)throw new B7({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Q7(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}});l7({prefix:`aitxt`,size:24});var jye=cye(()=>M7(V8([z8({type:G8(`text-start`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`text-delta`),id:Z(),delta:Z(),providerMetadata:q7.optional()}),z8({type:G8(`text-end`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`error`),errorText:Z()}),z8({type:G8(`tool-input-start`),toolCallId:Z(),toolName:Z(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),title:Z().optional()}),z8({type:G8(`tool-input-delta`),toolCallId:Z(),inputTextDelta:Z()}),z8({type:G8(`tool-input-available`),toolCallId:Z(),toolName:Z(),input:P8(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),title:Z().optional()}),z8({type:G8(`tool-input-error`),toolCallId:Z(),toolName:Z(),input:P8(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),errorText:Z(),title:Z().optional()}),z8({type:G8(`tool-approval-request`),approvalId:Z(),toolCallId:Z()}),z8({type:G8(`tool-output-available`),toolCallId:Z(),output:P8(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),preliminary:N8().optional()}),z8({type:G8(`tool-output-error`),toolCallId:Z(),errorText:Z(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional()}),z8({type:G8(`tool-output-denied`),toolCallId:Z()}),z8({type:G8(`reasoning-start`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`reasoning-delta`),id:Z(),delta:Z(),providerMetadata:q7.optional()}),z8({type:G8(`reasoning-end`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`source-url`),sourceId:Z(),url:Z(),title:Z().optional(),providerMetadata:q7.optional()}),z8({type:G8(`source-document`),sourceId:Z(),mediaType:Z(),title:Z(),filename:Z().optional(),providerMetadata:q7.optional()}),z8({type:G8(`file`),url:Z(),mediaType:Z(),providerMetadata:q7.optional()}),z8({type:Q8(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:Z().optional(),data:P8(),transient:N8().optional()}),z8({type:G8(`start-step`)}),z8({type:G8(`finish-step`)}),z8({type:G8(`start`),messageId:Z().optional(),messageMetadata:P8().optional()}),z8({type:G8(`finish`),finishReason:W8([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`]).optional(),messageMetadata:P8().optional()}),z8({type:G8(`abort`),reason:Z().optional()}),z8({type:G8(`message-metadata`),messageMetadata:P8()})])));function Mye(e){return e.type.startsWith(`data-`)}function $7(e){return e.type===`text`}function e9(e){return e.type===`reasoning`}function t9(e){return e.type.startsWith(`tool-`)}function n9(e){return e.type===`dynamic-tool`}function r9(e){return t9(e)||n9(e)}function i9(e){return e.type.split(`-`).slice(1).join(`-`)}function a9(e){return n9(e)?e.toolName:i9(e)}function Nye({lastMessage:e,messageId:t}){return{message:e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Pye({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{function l(e){let t=r.message.parts.filter(r9).find(t=>t.toolCallId===e);if(t==null)throw new W7({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function u(e){let t=r.message.parts.find(t=>t9(t)&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:n.input,output:n.output,rawInput:n.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,preliminary:n.preliminary,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}function d(e){let t=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.toolName=e.toolName,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput??i.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:n.input,output:n.output,errorText:n.errorText,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:e.title,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}async function f(e){if(e!=null){let n=r.message.metadata==null?e:Z7(r.message.metadata,e);t!=null&&await N7({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new W7({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new W7({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new W7({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new W7({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(t9);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new W7({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:n}=await Q7(t.text);t.dynamic?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}):u({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}),c();break}case`tool-input-available`:e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=r.message.parts.filter(r9).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break}case`tool-approval-request`:{let t=l(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId},c();break}case`tool-output-denied`:{let t=l(e.toolCallId);t.state=`output-denied`,c();break}case`tool-output-available`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:i9(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`tool-output-error`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:i9(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts={},r.activeReasoningParts={};break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await f(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i?.(Error(e.errorText));break;default:if(Mye(e)){if(n?.[e.type]!=null){let t=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:r.message.parts.length;await N7({value:e.data,schema:n[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),c()}}s.enqueue(e)})}}))}async function Fye({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t?.(e)}finally{n.releaseLock()}}l7({prefix:`aitxt`,size:24}),l7({prefix:`aiobj`,size:24});var Iye=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}};l7({prefix:`aiobj`,size:24});async function Lye(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}var Rye=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await I7(this.body),r=await I7(this.headers),i=await I7(this.credentials),a={...u7(r),...u7(t.headers)},o=await this.prepareSendMessagesRequest?.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:u7(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"Content-Type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw Error(await d.text()??`Failed to fetch the chat response.`);if(!d.body)throw Error(`The response body is empty.`);return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await I7(this.body),n=await I7(this.headers),r=await I7(this.credentials),i={...u7(n),...u7(e.headers)},a=await this.prepareReconnectToStreamRequest?.call(this,{api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api??`${this.api}/${e.chatId}/stream`,s=a?.headers===void 0?i:u7(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c});if(l.status===204)return null;if(!l.ok)throw Error(await l.text()??`Failed to fetch the chat response.`);if(!l.body)throw Error(`The response body is empty.`);return this.processResponseStream(l.body)}},zye=class extends Rye{constructor(e={}){super(e)}processResponseStream(e){return mye({stream:e,schema:jye}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Bye=class{constructor({generateId:e=vve,id:t=e(),transport:n=new zye,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new Iye,this.sendMessage=async(e,t)=>{if(e==null){await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...t});return}let n;if(n=`text`in e||`files`in e?{parts:[...Array.isArray(e.files)?e.files:await Lye(e.files),...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}:e,e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(this.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...n,id:e.messageId,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=r=>r9(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{id:e,approved:t,reason:n}}:r;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...r})})}),this.addToolOutput=async({state:e=`output-available`,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>r9(i)&&i.toolCallId===t?{...i,state:e,output:n,errorText:r}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...i})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.status!==`streaming`&&this.status!==`submitted`||this.activeResponse?.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e==`object`&&`then`in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a;let o;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(e==null)return;o=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e});return}this.setStatus({status:`submitted`,error:void 0});let s=this.lastMessage,c=!1,l=!1,u=!1;try{let a={state:Nye({lastMessage:this.state.snapshot(s),messageId:this.generateId()}),abortController:new AbortController};a.abortController.signal.addEventListener(`abort`,()=>{c=!0}),this.activeResponse=a;let l;l=e===`resume-stream`?o:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:a.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await Fye({stream:Pye({stream:l,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>e({state:a.state,write:()=>{this.setStatus({status:`streaming`}),a.state.message.id===this.lastMessage?.id?this.state.replaceMessage(this.state.messages.length-1,a.state.message):this.state.pushMessage(a.state.message)}})),onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:`ready`})}catch(e){if(c||e.name===`AbortError`)return c=!0,this.setStatus({status:`ready`}),null;u=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(l=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{(a=this.onFinish)==null||a.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:l,isError:u,finishReason:this.activeResponse?.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!u&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r})}},Vye=n(i(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}))(),1),o9=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},s9=(e,t,n)=>(o9(e,t,`read from private field`),n?n.call(e):t.get(e)),c9=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},l9=(e,t,n,r)=>(o9(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function Hye(e,t){return t==null?e:(0,Vye.default)(e,t)}var u9,d9,f9,p9,m9,h9,g9,_9,v9,Uye=class{constructor(e=[]){c9(this,u9,void 0),c9(this,d9,`ready`),c9(this,f9,void 0),c9(this,p9,new Set),c9(this,m9,new Set),c9(this,h9,new Set),this.pushMessage=e=>{l9(this,u9,s9(this,u9).concat(e)),s9(this,g9).call(this)},this.popMessage=()=>{l9(this,u9,s9(this,u9).slice(0,-1)),s9(this,g9).call(this)},this.replaceMessage=(e,t)=>{l9(this,u9,[...s9(this,u9).slice(0,e),this.snapshot(t),...s9(this,u9).slice(e+1)]),s9(this,g9).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Hye(e,t):e;return s9(this,p9).add(n),()=>{s9(this,p9).delete(n)}},this[`~registerStatusCallback`]=e=>(s9(this,m9).add(e),()=>{s9(this,m9).delete(e)}),this[`~registerErrorCallback`]=e=>(s9(this,h9).add(e),()=>{s9(this,h9).delete(e)}),c9(this,g9,()=>{s9(this,p9).forEach(e=>e())}),c9(this,_9,()=>{s9(this,m9).forEach(e=>e())}),c9(this,v9,()=>{s9(this,h9).forEach(e=>e())}),l9(this,u9,e)}get status(){return s9(this,d9)}set status(e){l9(this,d9,e),s9(this,_9).call(this)}get error(){return s9(this,f9)}set error(e){l9(this,f9,e),s9(this,v9).call(this)}get messages(){return s9(this,u9)}set messages(e){l9(this,u9,[...e]),s9(this,g9).call(this)}};u9=new WeakMap,d9=new WeakMap,f9=new WeakMap,p9=new WeakMap,m9=new WeakMap,h9=new WeakMap,g9=new WeakMap,_9=new WeakMap,v9=new WeakMap;var y9,b9=class extends Bye{constructor({messages:e,...t}){let n=new Uye(e);super({...t,state:n}),c9(this,y9,void 0),this[`~registerMessagesCallback`]=(e,t)=>s9(this,y9)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>s9(this,y9)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>s9(this,y9)[`~registerErrorCallback`](e),l9(this,y9,n)}};y9=new WeakMap;function Wye({experimental_throttle:e,resume:t=!1,...n}={}){let r=(0,L.useRef)(`chat`in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});`chat`in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});let i={...n,onToolCall:e=>{var t;return(t=r.current).onToolCall?.call(t,e)},onData:e=>{var t;return(t=r.current).onData?.call(t,e)},onFinish:e=>{var t;return(t=r.current).onFinish?.call(t,e)},onError:e=>{var t;return(t=r.current).onError?.call(t,e)},sendAutomaticallyWhen:e=>{var t;return(t=r.current).sendAutomaticallyWhen?.call(t,e)??!1}},a=(0,L.useRef)(`chat`in n?n.chat:new b9(i));(`chat`in n&&n.chat!==a.current||`id`in n&&a.current.id!==n.id)&&(a.current=`chat`in n?n.chat:new b9(i));let o=(0,L.useSyncExternalStore)((0,L.useCallback)(t=>a.current[`~registerMessagesCallback`](t,e),[e,a.current.id]),()=>a.current.messages,()=>a.current.messages),s=(0,L.useSyncExternalStore)(a.current[`~registerStatusCallback`],()=>a.current.status,()=>a.current.status),c=(0,L.useSyncExternalStore)(a.current[`~registerErrorCallback`],()=>a.current.error,()=>a.current.error),l=(0,L.useCallback)(e=>{typeof e==`function`&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,L.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:o,setMessages:l,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:c,resumeStream:a.current.resumeStream,status:s,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}var Gye=class{constructor(e){this._resumeResolver=null,this._resumeNoneResolver=null,this.agent=e.agent,this.prepareBody=e.prepareBody,this.activeRequestIds=e.activeRequestIds}handleStreamResuming(e){return this._resumeResolver?(this._resumeResolver(e),!0):!1}handleStreamResumeNone(){return this._resumeNoneResolver?(this._resumeNoneResolver(),!0):!1}async sendMessages(e){let t=vq(8),n=new AbortController,r=!1,i={};this.prepareBody&&(i=await this.prepareBody({messages:e.messages,trigger:e.trigger,messageId:e.messageId})),e.body&&(i={...i,...e.body});let a=JSON.stringify({messages:e.messages,trigger:e.trigger,...i});this.activeRequestIds?.add(t);let o=this.agent,s=this.activeRequestIds,c=e=>{if(!r){r=!0;try{e()}catch{}s?.delete(t),n.abort()}},l=Error(`Aborted`);l.name=`AbortError`;let u=()=>{if(!r){try{o.send(JSON.stringify({id:t,type:r3.CF_AGENT_CHAT_REQUEST_CANCEL}))}catch{}c(()=>d.error(l))}},d,f=new ReadableStream({start(e){d=e,o.addEventListener(`message`,n=>{try{let r=JSON.parse(n.data);if(r.type!==r3.CF_AGENT_USE_CHAT_RESPONSE||r.id!==t)return;if(r.error){c(()=>e.error(Error(r.body||`Stream error`)));return}if(r.body?.trim())try{let t=JSON.parse(r.body);e.enqueue(t)}catch{}r.done&&c(()=>e.close())}catch{}},{signal:n.signal})},cancel(){u()}});return e.abortSignal&&(e.abortSignal.addEventListener(`abort`,u,{once:!0}),e.abortSignal.aborted&&u()),o.send(JSON.stringify({id:t,init:{method:`POST`,body:a},type:r3.CF_AGENT_USE_CHAT_REQUEST})),f}async reconnectToStream(e){let t=this.activeRequestIds;return new Promise(e=>{let n=!1,r,i=t=>{n||(n=!0,this._resumeResolver=null,this._resumeNoneResolver=null,r&&clearTimeout(r),e(t))};this._resumeNoneResolver=()=>i(null),this._resumeResolver=e=>{let n=e.id;t?.add(n),this.agent.send(JSON.stringify({type:r3.CF_AGENT_STREAM_RESUME_ACK,id:n})),i(this._createResumeStream(n))};try{this.agent.send(JSON.stringify({type:r3.CF_AGENT_STREAM_RESUME_REQUEST}))}catch{}r=setTimeout(()=>i(null),5e3)})}_createResumeStream(e){let t=this.agent,n=this.activeRequestIds,r=new AbortController,i=!1,a=t=>{if(!i){i=!0;try{t()}catch{}n?.delete(e),r.abort()}};return new ReadableStream({start(n){t.addEventListener(`message`,t=>{try{let r=JSON.parse(t.data);if(r.type!==r3.CF_AGENT_USE_CHAT_RESPONSE||r.id!==e)return;if(r.error){a(()=>n.error(Error(r.body||`Stream error`)));return}if(r.body?.trim())try{let e=JSON.parse(r.body);n.enqueue(e)}catch{}r.done&&a(()=>n.close())}catch{}},{signal:r.signal})},cancel(){a(()=>{})}})}},x9=new Set;function S9(e,t){x9.has(e)||(x9.add(e),console.warn(`[@cloudflare/ai-chat] Deprecated: ${t}`))}function C9(e){if(!e)return;let t=Object.entries(e).filter(([e,t])=>t.execute).map(([e,t])=>(t.inputSchema&&!t.parameters&&console.warn(`[useAgentChat] Tool "${e}" uses deprecated 'inputSchema'. Please migrate to 'parameters'.`),{name:e,description:t.description,parameters:t.parameters??t.inputSchema}));return t.length>0?t:void 0}var w9=new Map;function Kye(e){let{agent:t,getInitialMessages:n,messages:r,onToolCall:i,onData:a,experimental_automaticToolResolution:o,tools:s,toolsRequiringConfirmation:c,autoContinueAfterToolResult:l=!0,autoSendAfterAllConfirmationsResolved:u=!0,resume:d=!0,body:f,prepareSendMessagesRequest:p,...m}=e;c&&S9(`useAgentChat.toolsRequiringConfirmation`,`The 'toolsRequiringConfirmation' option is deprecated. Use needsApproval on server-side tools instead. Will be removed in the next major version.`),o&&S9(`useAgentChat.experimental_automaticToolResolution`,`The 'experimental_automaticToolResolution' option is deprecated. Use the onToolCall callback instead. Will be removed in the next major version.`),e.autoSendAfterAllConfirmationsResolved!==void 0&&S9(`useAgentChat.autoSendAfterAllConfirmationsResolved`,`The 'autoSendAfterAllConfirmationsResolved' option is deprecated. Use sendAutomaticallyWhen from AI SDK instead. Will be removed in the next major version.`);let h=(0,L.useMemo)(()=>c||(s?Object.entries(s).filter(([e,t])=>!t.execute).map(([e])=>e):[]),[c,s]),g=(0,L.useRef)(i);g.current=i;let _=(0,L.useRef)(a);_.current=a;let v=new URL(`${(t._url||t._pkurl)?.replace(`ws://`,`http://`).replace(`wss://`,`https://`)}`);v.searchParams.delete(`_pk`);let y=v.toString(),b=`${y}|${t.agent??``}|${t.name??``}`,x=(0,L.useRef)(t);x.current=t;async function S({url:t}){let n=new URL(t);n.pathname+=`/get-messages`;let r=await fetch(n.toString(),{credentials:e.credentials,headers:e.headers});if(!r.ok)return console.warn(`Failed to fetch initial messages: ${r.status} ${r.statusText}`),[];let i=await r.text();if(!i.trim())return[];try{return JSON.parse(i)}catch(e){return console.warn(`Failed to parse initial messages JSON:`,e),[]}}let C=n||S;function w(e,t){if(w9.has(t))return w9.get(t);let n=C(e);return w9.set(t,n),n}let T=n===null?null:w({agent:t.agent,name:t.name,url:y},b),E=T?(0,L.use)(T):r??[];(0,L.useEffect)(()=>{if(T)return w9.set(b,T),()=>{w9.get(b)===T&&w9.delete(b)}},[b,T]);let D=(0,L.useRef)(s);D.current=s;let O=(0,L.useRef)(p);O.current=p;let k=(0,L.useRef)(f);k.current=f;let ee=(0,L.useRef)(new Set),A=(0,L.useRef)(null);A.current===null&&(A.current=new Gye({agent:x.current,activeRequestIds:ee.current,prepareBody:async({messages:e,trigger:t,messageId:n})=>{let r={},i=k.current;if(i&&(r={...typeof i==`function`?await i():i}),D.current){let e=C9(D.current);e&&(r.clientTools=e)}if(O.current){let i=await O.current({id:x.current._pk,messages:e,trigger:t,messageId:n});i.body&&Object.assign(r,i.body)}return r}})),A.current.agent=x.current;let j=A.current,M=Wye({...m,onData:a,messages:E,transport:j,id:b,resume:d}),{messages:N,setMessages:P,addToolResult:F,addToolApprovalResponse:te,sendMessage:ne}=M,re=(0,L.useRef)(new Set),I=(0,L.useRef)(!1),[ie,ae]=(0,L.useState)(0),[oe,se]=(0,L.useState)(new Map),ce=(0,L.useRef)(N);ce.current=N;let le=N[N.length-1],ue=(()=>{if(!le||le.role!==`assistant`)return{messageId:void 0,toolCallIds:new Set};let e=new Set;for(let t of le.parts??[])r9(t)&&t.state===`input-available`&&h.includes(a9(t))&&e.add(t.toolCallId);return{messageId:le.id,toolCallIds:e}})(),de=(0,L.useRef)(ue);de.current=ue,(0,L.useEffect)(()=>{if(!o||I.current)return;let e=N[N.length-1];if(!e||e.role!==`assistant`)return;let t=e.parts.filter(e=>r9(e)&&e.state===`input-available`&&!re.current.has(e.toolCallId));if(t.length>0){let e=D.current,n=t.filter(t=>r9(t)&&!h.includes(a9(t))&&e?.[a9(t)]?.execute);n.length>0&&(I.current=!0,(async()=>{try{let t=[];for(let r of n)if(r9(r)){let n=null,i=a9(r),a=e?.[i];if(a?.execute&&r.input!==void 0)try{n=await a.execute(r.input)}catch(e){n=`Error executing tool: ${e instanceof Error?e.message:String(e)}`}re.current.add(r.toolCallId),t.push({toolCallId:r.toolCallId,toolName:i,output:n})}if(t.length>0){let n=C9(e);for(let e of t)x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_RESULT,toolCallId:e.toolCallId,toolName:e.toolName,output:e.output,autoContinue:l,clientTools:n}));await Promise.all(t.map(e=>F({tool:e.toolName,toolCallId:e.toolCallId,output:e.output}))),se(e=>{let n=new Map(e);for(let e of t)n.set(e.toolCallId,e.output);return n})}}finally{I.current=!1,ae(e=>e+1)}})())}},[N,o,F,h,l,ie]);let fe=(0,L.useCallback)((e,t,n,r,i)=>{x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_RESULT,toolCallId:e,toolName:t,output:n,...r?{state:r}:{},...i===void 0?{}:{errorText:i},autoContinue:r===`output-error`?!1:l,clientTools:D.current?C9(D.current):void 0})),r!==`output-error`&&se(t=>new Map(t).set(e,n))},[l]),pe=(0,L.useCallback)((e,t)=>{x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_APPROVAL,toolCallId:e,approved:t,autoContinue:l}))},[l]);(0,L.useEffect)(()=>{let e=g.current;if(!e)return;let t=N[N.length-1];if(!t||t.role!==`assistant`)return;let n=t.parts.filter(e=>r9(e)&&e.state===`input-available`&&!re.current.has(e.toolCallId));for(let t of n)if(r9(t)){let n=t.toolCallId,r=a9(t);re.current.add(n),e({toolCall:{toolCallId:n,toolName:r,input:t.input},addToolOutput:e=>{fe(e.toolCallId,r,e.output,e.state,e.errorText),F({tool:r,toolCallId:e.toolCallId,output:e.state===`output-error`?e.errorText??`Tool execution denied by user`:e.output})}})}},[N,fe,F]);let me=(0,L.useRef)(null),he=(0,L.useCallback)(e=>{P(t=>{let n=t.findIndex(t=>t.id===e.messageId);if(n<0&&e.continuation){for(let e=t.length-1;e>=0;e--)if(t[e].role===`assistant`){n=e;break}}let r={id:n>=0?t[n].id:e.messageId,role:`assistant`,parts:[...e.parts],...e.metadata!=null&&{metadata:e.metadata}};if(n>=0){let e=[...t];return e[n]=r,e}return[...t,r]})},[P]);(0,L.useEffect)(()=>{function e(e){if(typeof e.data!=`string`)return;let t;try{t=JSON.parse(e.data)}catch{return}switch(t.type){case r3.CF_AGENT_CHAT_CLEAR:P([]);break;case r3.CF_AGENT_CHAT_MESSAGES:P(t.messages);break;case r3.CF_AGENT_MESSAGE_UPDATED:P(e=>{let n=t.message,r=e.findIndex(e=>e.id===n.id);if(r<0){let t=new Set(n.parts.filter(e=>`toolCallId`in e&&e.toolCallId).map(e=>e.toolCallId));t.size>0&&(r=e.findIndex(e=>e.parts.some(e=>`toolCallId`in e&&t.has(e.toolCallId))))}if(r>=0){let t=[...e];return t[r]={...n,id:e[r].id},t}return[...e,n]});break;case r3.CF_AGENT_STREAM_RESUME_NONE:j.handleStreamResumeNone();break;case r3.CF_AGENT_STREAM_RESUMING:if(!d||j.handleStreamResuming(t)||ee.current.has(t.id))return;me.current=null,me.current={id:t.id,messageId:vq(),continuation:!1,parts:[]},x.current.send(JSON.stringify({type:r3.CF_AGENT_STREAM_RESUME_ACK,id:t.id}));break;case r3.CF_AGENT_USE_CHAT_RESPONSE:{if(ee.current.has(t.id))return;let e=t.continuation===!0;if(!me.current||me.current.id!==t.id){let n=vq(),r=[],i;if(e){let e=ce.current;for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`){n=e[t].id,r=[...e[t].parts],e[t].metadata!=null&&(i={...e[t].metadata});break}}me.current={id:t.id,messageId:n,continuation:e,parts:r,metadata:i}}let n=me.current,r=t.replay===!0;if(t.body?.trim())try{let i=JSON.parse(t.body),a=Xfe(n.parts,i);typeof i.type==`string`&&i.type.startsWith(`data-`)&&_.current&&_.current(i),!a&&(i.type===`start`||i.type===`finish`||i.type===`message-metadata`)&&(i.messageId!=null&&i.type===`start`&&!e&&(n.messageId=i.messageId),i.messageMetadata!=null&&(n.metadata=n.metadata?{...n.metadata,...i.messageMetadata}:{...i.messageMetadata})),r||he(n)}catch(e){console.warn(`[useAgentChat] Failed to parse stream chunk:`,e instanceof Error?e.message:e,`body:`,t.body?.slice(0,100))}t.done||t.error?(r&&n&&he(n),me.current=null):t.replayComplete&&n&&he(n);break}}}return t.addEventListener(`message`,e),()=>{t.removeEventListener(`message`,e),me.current=null}},[t,P,d,he,j]);let ge=async e=>{let{toolCallId:t}=e,n=`tool`in e?e.tool:``,r=`output`in e?e.output:void 0;if(x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_RESULT,toolCallId:t,toolName:n,output:r,autoContinue:l,clientTools:D.current?C9(D.current):void 0})),se(e=>new Map(e).set(t,r)),F(e),!l){if(!u){ne();return}let e=de.current?.toolCallIds;if(!e){ne();return}let n=e.size===1&&e.has(t);e.has(t)&&e.delete(t),(n||e.size===0)&&ne()}},_e=e=>{let{id:t,approved:n}=e,r;for(let e of ce.current){for(let n of e.parts)if(`toolCallId`in n&&`approval`in n&&n.approval?.id===t){r=n.toolCallId;break}if(r)break}r?pe(r,n):console.warn(`[useAgentChat] addToolApprovalResponse: Could not find toolCallId for approval ID "${t}". Server will not be notified, which may cause duplicate messages.`),te(e)},ve=(0,L.useMemo)(()=>oe.size===0?N:N.map(e=>({...e,parts:e.parts.map(e=>!(`toolCallId`in e)||!(`state`in e)||e.state!==`input-available`||!oe.has(e.toolCallId)?e:{...e,state:`output-available`,output:oe.get(e.toolCallId)})})),[N,oe]);(0,L.useEffect)(()=>{let e=new Set;for(let t of N)for(let n of t.parts)`toolCallId`in n&&n.toolCallId&&e.add(n.toolCallId);se(t=>{if(t.size===0)return t;let n=!1;for(let r of t.keys())if(!e.has(r)){n=!0;break}if(!n)return t;let r=new Map;for(let[n,i]of t)e.has(n)&&r.set(n,i);return r});for(let t of re.current)e.has(t)||re.current.delete(t)},[N]);let ye=(0,L.useCallback)(e=>{let t=e.toolName??``;fe(e.toolCallId,t,e.output,e.state,e.errorText),F({tool:t,toolCallId:e.toolCallId,output:e.state===`output-error`?e.errorText??`Tool execution denied by user`:e.output})},[fe,F]);return{...M,messages:ve,addToolOutput:ye,addToolResult:ge,addToolApprovalResponse:_e,clearHistory:()=>{P([]),se(new Map),re.current.clear(),t.send(JSON.stringify({type:r3.CF_AGENT_CHAT_CLEAR}))},setMessages:e=>{let n;n=typeof e==`function`?e(ce.current):e,P(n),t.send(JSON.stringify({messages:n,type:r3.CF_AGENT_CHAT_MESSAGES}))}}}var T9=function(e){return e.CF_AGENT_MCP_SERVERS=`cf_agent_mcp_servers`,e.CF_MCP_AGENT_EVENT=`cf_mcp_agent_event`,e.CF_AGENT_STATE=`cf_agent_state`,e.CF_AGENT_STATE_ERROR=`cf_agent_state_error`,e.CF_AGENT_IDENTITY=`cf_agent_identity`,e.RPC=`rpc`,e}({});function qye(e){if(e===e.toUpperCase()&&e!==e.toLowerCase())return e.toLowerCase().replace(/_/g,`-`);let t=e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return t=t.startsWith(`-`)?t.slice(1):t,t.replace(/_/g,`-`).replace(/-$/,``)}(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
|
|
398
|
+
]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function E7(e,t){let n={type:`object`,additionalProperties:O7(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===$.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=x7(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===$.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===$.ZodBranded&&e.keyType._def.type._def.typeName===$.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=_7(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Lve(e,t){return t.mapStrategy===`record`?E7(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[O7(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||g7(),O7(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||g7()],minItems:2,maxItems:2}}}function Rve(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function zve(){return{not:g7()}}function Bve(){return{type:`null`}}var D7={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function Vve(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in D7&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=D7[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Hve(e,t)}var Hve=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>O7(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function Uve(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[D7[e.innerType._def.typeName],`null`]};let n=O7(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Wve(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function Gve(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=qve(a),s=O7(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=Kve(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Kve(e,t){if(e.catchall._def.typeName!==`ZodNever`)return O7(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function qve(e){try{return e.isOptional()}catch{return!0}}var Jve=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return O7(e.innerType._def,t);let n=O7(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:g7()},n]}:g7()},Yve=(e,t)=>{if(t.pipeStrategy===`input`)return O7(e.in._def,t);if(t.pipeStrategy===`output`)return O7(e.out._def,t);let n=O7(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,O7(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Xve(e,t){return O7(e.type._def,t)}function Zve(e,t){let n={type:`array`,uniqueItems:!0,items:O7(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Qve(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>O7(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:O7(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>O7(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function $ve(){return{not:g7()}}function eye(){return g7()}var tye=(e,t)=>O7(e.innerType._def,t),nye=(e,t,n)=>{switch(t){case $.ZodString:return x7(e,n);case $.ZodNumber:return Wve(e);case $.ZodObject:return Gve(e,n);case $.ZodBigInt:return Tve(e);case $.ZodBoolean:return Eve();case $.ZodDate:return v7(e,n);case $.ZodUndefined:return $ve();case $.ZodNull:return Bve();case $.ZodArray:return wve(e,n);case $.ZodUnion:case $.ZodDiscriminatedUnion:return Vve(e,n);case $.ZodIntersection:return Nve(e,n);case $.ZodTuple:return Qve(e,n);case $.ZodRecord:return E7(e,n);case $.ZodLiteral:return Pve(e);case $.ZodEnum:return jve(e);case $.ZodNativeEnum:return Rve(e);case $.ZodNullable:return Uve(e,n);case $.ZodOptional:return Jve(e,n);case $.ZodMap:return Lve(e,n);case $.ZodSet:return Zve(e,n);case $.ZodLazy:return()=>e.getter()._def;case $.ZodPromise:return Xve(e,n);case $.ZodNaN:case $.ZodNever:return zve();case $.ZodEffects:return Ave(e,n);case $.ZodAny:return g7();case $.ZodUnknown:return eye();case $.ZodDefault:return kve(e,n);case $.ZodBranded:return _7(e,n);case $.ZodReadonly:return tye(e,n);case $.ZodCatch:return Dve(e,n);case $.ZodPipeline:return Yve(e,n);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(e=>void 0)(t)}},rye=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function O7(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.call(t,e,t,r,n);if(i!==m7)return i}if(r&&!n){let e=iye(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=nye(e,e.typeName,t),o=typeof a==`function`?O7(a(),t):a;if(o&&aye(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var iye=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:rye(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),g7()):t.$refStrategy===`seen`?g7():void 0}},aye=(e,t,n)=>(e.description&&(n.description=e.description),n),oye=e=>{let t=Cve(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},sye=(e,t)=>{let n=oye(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:O7(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??g7()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=O7(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??g7(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},k7=Symbol.for(`vercel.ai.schema`);function cye(e){let t;return()=>(t??=e(),t)}function A7(e,{validate:t}={}){return{[k7]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function lye(e){return typeof e==`object`&&!!e&&k7 in e&&e[k7]===!0&&`jsonSchema`in e&&`validate`in e}function j7(e){return e==null?A7({properties:{},additionalProperties:!1}):lye(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?M7(e):uye(e):e()}function uye(e){return A7(()=>f7(e[`~standard`].jsonSchema.input({target:`draft-07`})),{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new w3({value:t,cause:n.issues})}}})}function dye(e,t){let n=t?.useReferences??!1;return A7(()=>sye(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function fye(e,t){let n=t?.useReferences??!1;return A7(()=>f7(Cge(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await T8(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function pye(e){return`_zod`in e}function M7(e,t){return pye(e)?fye(e,t):dye(e,t)}async function N7({value:e,schema:t,context:n}){let r=await P7({value:e,schema:t,context:n});if(!r.success)throw w3.wrap({value:e,cause:r.error,context:n});return r.value}async function P7({value:e,schema:t,context:n}){let r=j7(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:w3.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:w3.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function F7({text:e,schema:t}){try{let n=Sve(e);return t==null?{success:!0,value:n,rawValue:n}:await P7({value:n,schema:t})}catch(t){return{success:!1,error:y3.isInstance(t)?t:new y3({text:e,cause:t}),rawValue:void 0}}}function mye({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new hve).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await F7({text:e,schema:t}))}}))}async function I7(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}var hye=Object.defineProperty,gye=(e,t)=>{for(var n in t)hye(e,n,{get:t[n],enumerable:!0})},L7=`AI_NoObjectGeneratedError`,R7=`vercel.ai.error.${L7}`,_ye=Symbol.for(R7),z7,B7=class extends l3{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:L7,message:e,cause:t}),this[z7]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return l3.hasMarker(e,R7)}};z7=_ye;var V7=`AI_UIMessageStreamError`,H7=`vercel.ai.error.${V7}`,vye=Symbol.for(H7),U7,W7=class extends l3{constructor({chunkType:e,chunkId:t,message:n}){super({name:V7,message:n}),this[U7]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return l3.hasMarker(e,H7)}};U7=vye;var G7=V8([Z(),$8(Uint8Array),$8(ArrayBuffer),Q8(e=>globalThis.Buffer?.isBuffer(e)??!1,{message:`Must be a Buffer`})]),K7=L_e(()=>V8([d_e(),Z(),s_e(),N8(),H8(Z(),K7.optional()),I8(K7)])),q7=H8(Z(),H8(Z(),K7.optional())),J7=R8({type:G8(`text`),text:Z(),providerOptions:q7.optional()}),yye=R8({type:G8(`image`),image:V8([G7,$8(URL)]),mediaType:Z().optional(),providerOptions:q7.optional()}),Y7=R8({type:G8(`file`),data:V8([G7,$8(URL)]),filename:Z().optional(),mediaType:Z(),providerOptions:q7.optional()}),bye=R8({type:G8(`reasoning`),text:Z(),providerOptions:q7.optional()}),xye=R8({type:G8(`tool-call`),toolCallId:Z(),toolName:Z(),input:P8(),providerOptions:q7.optional(),providerExecuted:N8().optional()}),Sye=g_e(`type`,[R8({type:G8(`text`),value:Z(),providerOptions:q7.optional()}),R8({type:G8(`json`),value:K7,providerOptions:q7.optional()}),R8({type:G8(`execution-denied`),reason:Z().optional(),providerOptions:q7.optional()}),R8({type:G8(`error-text`),value:Z(),providerOptions:q7.optional()}),R8({type:G8(`error-json`),value:K7,providerOptions:q7.optional()}),R8({type:G8(`content`),value:I8(V8([R8({type:G8(`text`),text:Z(),providerOptions:q7.optional()}),R8({type:G8(`media`),data:Z(),mediaType:Z()}),R8({type:G8(`file-data`),data:Z(),mediaType:Z(),filename:Z().optional(),providerOptions:q7.optional()}),R8({type:G8(`file-url`),url:Z(),providerOptions:q7.optional()}),R8({type:G8(`file-id`),fileId:V8([Z(),H8(Z(),Z())]),providerOptions:q7.optional()}),R8({type:G8(`image-data`),data:Z(),mediaType:Z(),providerOptions:q7.optional()}),R8({type:G8(`image-url`),url:Z(),providerOptions:q7.optional()}),R8({type:G8(`image-file-id`),fileId:V8([Z(),H8(Z(),Z())]),providerOptions:q7.optional()}),R8({type:G8(`custom`),providerOptions:q7.optional()})]))})]),X7=R8({type:G8(`tool-result`),toolCallId:Z(),toolName:Z(),output:Sye,providerOptions:q7.optional()}),Cye=R8({type:G8(`tool-approval-request`),approvalId:Z(),toolCallId:Z()}),wye=R8({type:G8(`tool-approval-response`),approvalId:Z(),approved:N8(),reason:Z().optional()});V8([R8({role:G8(`system`),content:Z(),providerOptions:q7.optional()}),R8({role:G8(`user`),content:V8([Z(),I8(V8([J7,yye,Y7]))]),providerOptions:q7.optional()}),R8({role:G8(`assistant`),content:V8([Z(),I8(V8([J7,Y7,bye,xye,X7,Cye]))]),providerOptions:q7.optional()}),R8({role:G8(`tool`),content:I8(V8([X7,wye])),providerOptions:q7.optional()})]);function Z7(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=Z7(a,i):n[r]=i}return n}gye({},{array:()=>Oye,choice:()=>kye,json:()=>Aye,object:()=>Dye,text:()=>Eye});function Tye(e){let t=[`ROOT`],n=-1,r=null;function i(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s<e.length;s++){let c=e[s];switch(t[t.length-1]){case`ROOT`:i(c,s,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=s,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(c){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:i(c,s,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:a(c,s);break;case`INSIDE_STRING`:switch(c){case`"`:t.pop(),n=s;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=s}break;case`INSIDE_ARRAY_START`:switch(c){case`]`:n=s,t.pop();break;default:n=s,i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(c){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=s,t.pop();break;default:n=s;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),n=s;break;case`INSIDE_NUMBER`:switch(c){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=s;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,s+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?a(c,s):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s)):n=s;break}}}let s=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:s+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}return s}async function Q7(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await F7({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await F7({text:Tye(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}var Eye=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),Dye=({schema:e,name:t,description:n})=>{let r=j7(e);return{name:`object`,responseFormat:I7(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await F7({text:e});if(!n.success)throw new B7({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await P7({value:n.value,schema:r});if(!i.success)throw new B7({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Q7(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},Oye=({element:e,name:t,description:n})=>{let r=j7(e);return{name:`array`,responseFormat:I7(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await F7({text:e});if(!n.success)throw new B7({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new B7({message:`No object generated: response did not match schema.`,cause:new w3({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(let n of i.elements){let i=await P7({value:n,schema:r});if(!i.success)throw new B7({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return i.elements},async parsePartialOutput({text:e}){let t=await Q7(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await P7({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},kye=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await F7({text:t});if(!r.success)throw new B7({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new B7({message:`No object generated: response did not match schema.`,cause:new w3({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Q7(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),Aye=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await F7({text:e});if(!n.success)throw new B7({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Q7(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}});l7({prefix:`aitxt`,size:24}),TransformStream;var jye=cye(()=>M7(V8([z8({type:G8(`text-start`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`text-delta`),id:Z(),delta:Z(),providerMetadata:q7.optional()}),z8({type:G8(`text-end`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`error`),errorText:Z()}),z8({type:G8(`tool-input-start`),toolCallId:Z(),toolName:Z(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),title:Z().optional()}),z8({type:G8(`tool-input-delta`),toolCallId:Z(),inputTextDelta:Z()}),z8({type:G8(`tool-input-available`),toolCallId:Z(),toolName:Z(),input:P8(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),title:Z().optional()}),z8({type:G8(`tool-input-error`),toolCallId:Z(),toolName:Z(),input:P8(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),errorText:Z(),title:Z().optional()}),z8({type:G8(`tool-approval-request`),approvalId:Z(),toolCallId:Z()}),z8({type:G8(`tool-output-available`),toolCallId:Z(),output:P8(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional(),preliminary:N8().optional()}),z8({type:G8(`tool-output-error`),toolCallId:Z(),errorText:Z(),providerExecuted:N8().optional(),providerMetadata:q7.optional(),dynamic:N8().optional()}),z8({type:G8(`tool-output-denied`),toolCallId:Z()}),z8({type:G8(`reasoning-start`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`reasoning-delta`),id:Z(),delta:Z(),providerMetadata:q7.optional()}),z8({type:G8(`reasoning-end`),id:Z(),providerMetadata:q7.optional()}),z8({type:G8(`source-url`),sourceId:Z(),url:Z(),title:Z().optional(),providerMetadata:q7.optional()}),z8({type:G8(`source-document`),sourceId:Z(),mediaType:Z(),title:Z(),filename:Z().optional(),providerMetadata:q7.optional()}),z8({type:G8(`file`),url:Z(),mediaType:Z(),providerMetadata:q7.optional()}),z8({type:Q8(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:Z().optional(),data:P8(),transient:N8().optional()}),z8({type:G8(`start-step`)}),z8({type:G8(`finish-step`)}),z8({type:G8(`start`),messageId:Z().optional(),messageMetadata:P8().optional()}),z8({type:G8(`finish`),finishReason:W8([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`]).optional(),messageMetadata:P8().optional()}),z8({type:G8(`abort`),reason:Z().optional()}),z8({type:G8(`message-metadata`),messageMetadata:P8()})])));function Mye(e){return e.type.startsWith(`data-`)}function $7(e){return e.type===`text`}function e9(e){return e.type===`reasoning`}function t9(e){return e.type.startsWith(`tool-`)}function n9(e){return e.type===`dynamic-tool`}function r9(e){return t9(e)||n9(e)}function i9(e){return e.type.split(`-`).slice(1).join(`-`)}function a9(e){return n9(e)?e.toolName:i9(e)}function Nye({lastMessage:e,messageId:t}){return{message:e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Pye({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{function l(e){let t=r.message.parts.filter(r9).find(t=>t.toolCallId===e);if(t==null)throw new W7({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function u(e){let t=r.message.parts.find(t=>t9(t)&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:n.input,output:n.output,rawInput:n.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,preliminary:n.preliminary,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}function d(e){let t=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),n=e,i=t;if(t!=null){t.state=e.state,i.toolName=e.toolName,i.input=n.input,i.output=n.output,i.errorText=n.errorText,i.rawInput=n.rawInput??i.rawInput,i.preliminary=n.preliminary,e.title!==void 0&&(i.title=e.title),i.providerExecuted=n.providerExecuted??t.providerExecuted;let r=n.providerMetadata;if(r!=null)if(e.state===`output-available`||e.state===`output-error`){let e=t;e.resultProviderMetadata=r}else t.callProviderMetadata=r}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:n.input,output:n.output,errorText:n.errorText,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:e.title,...n.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:n.providerMetadata}:{},...n.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:n.providerMetadata}:{}})}async function f(e){if(e!=null){let n=r.message.metadata==null?e:Z7(r.message.metadata,e);t!=null&&await N7({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new W7({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new W7({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new W7({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new W7({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(t9);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new W7({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let{value:n}=await Q7(t.text);t.dynamic?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}):u({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n,title:t.title}),c();break}case`tool-input-available`:e.dynamic?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=r.message.parts.filter(r9).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?d({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):u({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break}case`tool-approval-request`:{let t=l(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId},c();break}case`tool-output-denied`:{let t=l(e.toolCallId);t.state=`output-denied`,c();break}case`tool-output-available`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:i9(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`tool-output-error`:{let t=l(e.toolCallId);t.type===`dynamic-tool`?d({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}):u({toolCallId:e.toolCallId,toolName:i9(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title}),c();break}case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts={},r.activeReasoningParts={};break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await f(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await f(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i?.(Error(e.errorText));break;default:if(Mye(e)){if(n?.[e.type]!=null){let t=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:r.message.parts.length;await N7({value:e.data,schema:n[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),c()}}s.enqueue(e)})}}))}async function Fye({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t?.(e)}finally{n.releaseLock()}}l7({prefix:`aitxt`,size:24}),l7({prefix:`aiobj`,size:24});var Iye=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}};l7({prefix:`aiobj`,size:24});async function Lye(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}var Rye=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await I7(this.body),r=await I7(this.headers),i=await I7(this.credentials),a={...u7(r),...u7(t.headers)},o=await this.prepareSendMessagesRequest?.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:u7(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"Content-Type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw Error(await d.text()??`Failed to fetch the chat response.`);if(!d.body)throw Error(`The response body is empty.`);return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await I7(this.body),n=await I7(this.headers),r=await I7(this.credentials),i={...u7(n),...u7(e.headers)},a=await this.prepareReconnectToStreamRequest?.call(this,{api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api??`${this.api}/${e.chatId}/stream`,s=a?.headers===void 0?i:u7(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c});if(l.status===204)return null;if(!l.ok)throw Error(await l.text()??`Failed to fetch the chat response.`);if(!l.body)throw Error(`The response body is empty.`);return this.processResponseStream(l.body)}},zye=class extends Rye{constructor(e={}){super(e)}processResponseStream(e){return mye({stream:e,schema:jye}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Bye=class{constructor({generateId:e=vve,id:t=e(),transport:n=new zye,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new Iye,this.sendMessage=async(e,t)=>{if(e==null){await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...t});return}let n;if(n=`text`in e||`files`in e?{parts:[...Array.isArray(e.files)?e.files:await Lye(e.files),...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}:e,e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(this.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...n,id:e.messageId,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=i[i.length-1],o=r=>r9(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{id:e,approved:t,reason:n}}:r;this.state.replaceMessage(i.length-1,{...a,parts:a.parts.map(o)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...r})})}),this.addToolOutput=async({state:e=`output-available`,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=a[a.length-1],s=i=>r9(i)&&i.toolCallId===t?{...i,state:e,output:n,errorText:r}:i;this.state.replaceMessage(a.length-1,{...o,parts:o.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(e=>{e&&this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,...i})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.status!==`streaming`&&this.status!==`submitted`||this.activeResponse?.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e==`object`&&`then`in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a;let o;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(e==null)return;o=e}catch(e){this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e});return}this.setStatus({status:`submitted`,error:void 0});let s=this.lastMessage,c=!1,l=!1,u=!1;try{let a={state:Nye({lastMessage:this.state.snapshot(s),messageId:this.generateId()}),abortController:new AbortController};a.abortController.signal.addEventListener(`abort`,()=>{c=!0}),this.activeResponse=a;let l;l=e===`resume-stream`?o:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:a.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await Fye({stream:Pye({stream:l,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>e({state:a.state,write:()=>{this.setStatus({status:`streaming`}),a.state.message.id===this.lastMessage?.id?this.state.replaceMessage(this.state.messages.length-1,a.state.message):this.state.pushMessage(a.state.message)}})),onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:`ready`})}catch(e){if(c||e.name===`AbortError`)return c=!0,this.setStatus({status:`ready`}),null;u=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(l=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{(a=this.onFinish)==null||a.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:l,isError:u,finishReason:this.activeResponse?.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!u&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r})}},Vye=n(i(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}))(),1),o9=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},s9=(e,t,n)=>(o9(e,t,`read from private field`),n?n.call(e):t.get(e)),c9=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},l9=(e,t,n,r)=>(o9(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function Hye(e,t){return t==null?e:(0,Vye.default)(e,t)}var u9,d9,f9,p9,m9,h9,g9,_9,v9,Uye=class{constructor(e=[]){c9(this,u9,void 0),c9(this,d9,`ready`),c9(this,f9,void 0),c9(this,p9,new Set),c9(this,m9,new Set),c9(this,h9,new Set),this.pushMessage=e=>{l9(this,u9,s9(this,u9).concat(e)),s9(this,g9).call(this)},this.popMessage=()=>{l9(this,u9,s9(this,u9).slice(0,-1)),s9(this,g9).call(this)},this.replaceMessage=(e,t)=>{l9(this,u9,[...s9(this,u9).slice(0,e),this.snapshot(t),...s9(this,u9).slice(e+1)]),s9(this,g9).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Hye(e,t):e;return s9(this,p9).add(n),()=>{s9(this,p9).delete(n)}},this[`~registerStatusCallback`]=e=>(s9(this,m9).add(e),()=>{s9(this,m9).delete(e)}),this[`~registerErrorCallback`]=e=>(s9(this,h9).add(e),()=>{s9(this,h9).delete(e)}),c9(this,g9,()=>{s9(this,p9).forEach(e=>e())}),c9(this,_9,()=>{s9(this,m9).forEach(e=>e())}),c9(this,v9,()=>{s9(this,h9).forEach(e=>e())}),l9(this,u9,e)}get status(){return s9(this,d9)}set status(e){l9(this,d9,e),s9(this,_9).call(this)}get error(){return s9(this,f9)}set error(e){l9(this,f9,e),s9(this,v9).call(this)}get messages(){return s9(this,u9)}set messages(e){l9(this,u9,[...e]),s9(this,g9).call(this)}};u9=new WeakMap,d9=new WeakMap,f9=new WeakMap,p9=new WeakMap,m9=new WeakMap,h9=new WeakMap,g9=new WeakMap,_9=new WeakMap,v9=new WeakMap;var y9,b9=class extends Bye{constructor({messages:e,...t}){let n=new Uye(e);super({...t,state:n}),c9(this,y9,void 0),this[`~registerMessagesCallback`]=(e,t)=>s9(this,y9)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>s9(this,y9)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>s9(this,y9)[`~registerErrorCallback`](e),l9(this,y9,n)}};y9=new WeakMap;function Wye({experimental_throttle:e,resume:t=!1,...n}={}){let r=(0,L.useRef)(`chat`in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});`chat`in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});let i={...n,onToolCall:e=>{var t;return(t=r.current).onToolCall?.call(t,e)},onData:e=>{var t;return(t=r.current).onData?.call(t,e)},onFinish:e=>{var t;return(t=r.current).onFinish?.call(t,e)},onError:e=>{var t;return(t=r.current).onError?.call(t,e)},sendAutomaticallyWhen:e=>{var t;return(t=r.current).sendAutomaticallyWhen?.call(t,e)??!1}},a=(0,L.useRef)(`chat`in n?n.chat:new b9(i));(`chat`in n&&n.chat!==a.current||`id`in n&&a.current.id!==n.id)&&(a.current=`chat`in n?n.chat:new b9(i));let o=(0,L.useSyncExternalStore)((0,L.useCallback)(t=>a.current[`~registerMessagesCallback`](t,e),[e,a.current.id]),()=>a.current.messages,()=>a.current.messages),s=(0,L.useSyncExternalStore)(a.current[`~registerStatusCallback`],()=>a.current.status,()=>a.current.status),c=(0,L.useSyncExternalStore)(a.current[`~registerErrorCallback`],()=>a.current.error,()=>a.current.error),l=(0,L.useCallback)(e=>{typeof e==`function`&&(e=e(a.current.messages)),a.current.messages=e},[a]);return(0,L.useEffect)(()=>{t&&a.current.resumeStream()},[t,a]),{id:a.current.id,messages:o,setMessages:l,sendMessage:a.current.sendMessage,regenerate:a.current.regenerate,clearError:a.current.clearError,stop:a.current.stop,error:c,resumeStream:a.current.resumeStream,status:s,addToolResult:a.current.addToolOutput,addToolOutput:a.current.addToolOutput,addToolApprovalResponse:a.current.addToolApprovalResponse}}var Gye=class{constructor(e){this._resumeResolver=null,this._resumeNoneResolver=null,this.agent=e.agent,this.prepareBody=e.prepareBody,this.activeRequestIds=e.activeRequestIds}handleStreamResuming(e){return this._resumeResolver?(this._resumeResolver(e),!0):!1}handleStreamResumeNone(){return this._resumeNoneResolver?(this._resumeNoneResolver(),!0):!1}async sendMessages(e){let t=vq(8),n=new AbortController,r=!1,i={};this.prepareBody&&(i=await this.prepareBody({messages:e.messages,trigger:e.trigger,messageId:e.messageId})),e.body&&(i={...i,...e.body});let a=JSON.stringify({messages:e.messages,trigger:e.trigger,...i});this.activeRequestIds?.add(t);let o=this.agent,s=this.activeRequestIds,c=e=>{if(!r){r=!0;try{e()}catch{}s?.delete(t),n.abort()}},l=Error(`Aborted`);l.name=`AbortError`;let u=()=>{if(!r){try{o.send(JSON.stringify({id:t,type:r3.CF_AGENT_CHAT_REQUEST_CANCEL}))}catch{}c(()=>d.error(l))}},d,f=new ReadableStream({start(e){d=e,o.addEventListener(`message`,n=>{try{let r=JSON.parse(n.data);if(r.type!==r3.CF_AGENT_USE_CHAT_RESPONSE||r.id!==t)return;if(r.error){c(()=>e.error(Error(r.body||`Stream error`)));return}if(r.body?.trim())try{let t=JSON.parse(r.body);e.enqueue(t)}catch{}r.done&&c(()=>e.close())}catch{}},{signal:n.signal})},cancel(){u()}});return e.abortSignal&&(e.abortSignal.addEventListener(`abort`,u,{once:!0}),e.abortSignal.aborted&&u()),o.send(JSON.stringify({id:t,init:{method:`POST`,body:a},type:r3.CF_AGENT_USE_CHAT_REQUEST})),f}async reconnectToStream(e){let t=this.activeRequestIds;return new Promise(e=>{let n=!1,r,i=t=>{n||(n=!0,this._resumeResolver=null,this._resumeNoneResolver=null,r&&clearTimeout(r),e(t))};this._resumeNoneResolver=()=>i(null),this._resumeResolver=e=>{let n=e.id;t?.add(n),this.agent.send(JSON.stringify({type:r3.CF_AGENT_STREAM_RESUME_ACK,id:n})),i(this._createResumeStream(n))};try{this.agent.send(JSON.stringify({type:r3.CF_AGENT_STREAM_RESUME_REQUEST}))}catch{}r=setTimeout(()=>i(null),5e3)})}_createResumeStream(e){let t=this.agent,n=this.activeRequestIds,r=new AbortController,i=!1,a=t=>{if(!i){i=!0;try{t()}catch{}n?.delete(e),r.abort()}};return new ReadableStream({start(n){t.addEventListener(`message`,t=>{try{let r=JSON.parse(t.data);if(r.type!==r3.CF_AGENT_USE_CHAT_RESPONSE||r.id!==e)return;if(r.error){a(()=>n.error(Error(r.body||`Stream error`)));return}if(r.body?.trim())try{let e=JSON.parse(r.body);n.enqueue(e)}catch{}r.done&&a(()=>n.close())}catch{}},{signal:r.signal})},cancel(){a(()=>{})}})}},x9=new Set;function S9(e,t){x9.has(e)||(x9.add(e),console.warn(`[@cloudflare/ai-chat] Deprecated: ${t}`))}function C9(e){if(!e)return;let t=Object.entries(e).filter(([e,t])=>t.execute).map(([e,t])=>(t.inputSchema&&!t.parameters&&console.warn(`[useAgentChat] Tool "${e}" uses deprecated 'inputSchema'. Please migrate to 'parameters'.`),{name:e,description:t.description,parameters:t.parameters??t.inputSchema}));return t.length>0?t:void 0}var w9=new Map;function Kye(e){let{agent:t,getInitialMessages:n,messages:r,onToolCall:i,onData:a,experimental_automaticToolResolution:o,tools:s,toolsRequiringConfirmation:c,autoContinueAfterToolResult:l=!0,autoSendAfterAllConfirmationsResolved:u=!0,resume:d=!0,body:f,prepareSendMessagesRequest:p,...m}=e;c&&S9(`useAgentChat.toolsRequiringConfirmation`,`The 'toolsRequiringConfirmation' option is deprecated. Use needsApproval on server-side tools instead. Will be removed in the next major version.`),o&&S9(`useAgentChat.experimental_automaticToolResolution`,`The 'experimental_automaticToolResolution' option is deprecated. Use the onToolCall callback instead. Will be removed in the next major version.`),e.autoSendAfterAllConfirmationsResolved!==void 0&&S9(`useAgentChat.autoSendAfterAllConfirmationsResolved`,`The 'autoSendAfterAllConfirmationsResolved' option is deprecated. Use sendAutomaticallyWhen from AI SDK instead. Will be removed in the next major version.`);let h=(0,L.useMemo)(()=>c||(s?Object.entries(s).filter(([e,t])=>!t.execute).map(([e])=>e):[]),[c,s]),g=(0,L.useRef)(i);g.current=i;let _=(0,L.useRef)(a);_.current=a;let v=new URL(`${(t._url||t._pkurl)?.replace(`ws://`,`http://`).replace(`wss://`,`https://`)}`);v.searchParams.delete(`_pk`);let y=v.toString(),b=`${y}|${t.agent??``}|${t.name??``}`,x=(0,L.useRef)(t);x.current=t;async function S({url:t}){let n=new URL(t);n.pathname+=`/get-messages`;let r=await fetch(n.toString(),{credentials:e.credentials,headers:e.headers});if(!r.ok)return console.warn(`Failed to fetch initial messages: ${r.status} ${r.statusText}`),[];let i=await r.text();if(!i.trim())return[];try{return JSON.parse(i)}catch(e){return console.warn(`Failed to parse initial messages JSON:`,e),[]}}let C=n||S;function w(e,t){if(w9.has(t))return w9.get(t);let n=C(e);return w9.set(t,n),n}let T=n===null?null:w({agent:t.agent,name:t.name,url:y},b),E=T?(0,L.use)(T):r??[];(0,L.useEffect)(()=>{if(T)return w9.set(b,T),()=>{w9.get(b)===T&&w9.delete(b)}},[b,T]);let D=(0,L.useRef)(s);D.current=s;let O=(0,L.useRef)(p);O.current=p;let k=(0,L.useRef)(f);k.current=f;let ee=(0,L.useRef)(new Set),A=(0,L.useRef)(null);A.current===null&&(A.current=new Gye({agent:x.current,activeRequestIds:ee.current,prepareBody:async({messages:e,trigger:t,messageId:n})=>{let r={},i=k.current;if(i&&(r={...typeof i==`function`?await i():i}),D.current){let e=C9(D.current);e&&(r.clientTools=e)}if(O.current){let i=await O.current({id:x.current._pk,messages:e,trigger:t,messageId:n});i.body&&Object.assign(r,i.body)}return r}})),A.current.agent=x.current;let j=A.current,M=Wye({...m,onData:a,messages:E,transport:j,id:b,resume:d}),{messages:N,setMessages:P,addToolResult:F,addToolApprovalResponse:te,sendMessage:ne}=M,re=(0,L.useRef)(new Set),I=(0,L.useRef)(!1),[ie,ae]=(0,L.useState)(0),[oe,se]=(0,L.useState)(new Map),ce=(0,L.useRef)(N);ce.current=N;let le=N[N.length-1],ue=(()=>{if(!le||le.role!==`assistant`)return{messageId:void 0,toolCallIds:new Set};let e=new Set;for(let t of le.parts??[])r9(t)&&t.state===`input-available`&&h.includes(a9(t))&&e.add(t.toolCallId);return{messageId:le.id,toolCallIds:e}})(),de=(0,L.useRef)(ue);de.current=ue,(0,L.useEffect)(()=>{if(!o||I.current)return;let e=N[N.length-1];if(!e||e.role!==`assistant`)return;let t=e.parts.filter(e=>r9(e)&&e.state===`input-available`&&!re.current.has(e.toolCallId));if(t.length>0){let e=D.current,n=t.filter(t=>r9(t)&&!h.includes(a9(t))&&e?.[a9(t)]?.execute);n.length>0&&(I.current=!0,(async()=>{try{let t=[];for(let r of n)if(r9(r)){let n=null,i=a9(r),a=e?.[i];if(a?.execute&&r.input!==void 0)try{n=await a.execute(r.input)}catch(e){n=`Error executing tool: ${e instanceof Error?e.message:String(e)}`}re.current.add(r.toolCallId),t.push({toolCallId:r.toolCallId,toolName:i,output:n})}if(t.length>0){let n=C9(e);for(let e of t)x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_RESULT,toolCallId:e.toolCallId,toolName:e.toolName,output:e.output,autoContinue:l,clientTools:n}));await Promise.all(t.map(e=>F({tool:e.toolName,toolCallId:e.toolCallId,output:e.output}))),se(e=>{let n=new Map(e);for(let e of t)n.set(e.toolCallId,e.output);return n})}}finally{I.current=!1,ae(e=>e+1)}})())}},[N,o,F,h,l,ie]);let fe=(0,L.useCallback)((e,t,n,r,i)=>{x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_RESULT,toolCallId:e,toolName:t,output:n,...r?{state:r}:{},...i===void 0?{}:{errorText:i},autoContinue:r===`output-error`?!1:l,clientTools:D.current?C9(D.current):void 0})),r!==`output-error`&&se(t=>new Map(t).set(e,n))},[l]),pe=(0,L.useCallback)((e,t)=>{x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_APPROVAL,toolCallId:e,approved:t,autoContinue:l}))},[l]);(0,L.useEffect)(()=>{let e=g.current;if(!e)return;let t=N[N.length-1];if(!t||t.role!==`assistant`)return;let n=t.parts.filter(e=>r9(e)&&e.state===`input-available`&&!re.current.has(e.toolCallId));for(let t of n)if(r9(t)){let n=t.toolCallId,r=a9(t);re.current.add(n),e({toolCall:{toolCallId:n,toolName:r,input:t.input},addToolOutput:e=>{fe(e.toolCallId,r,e.output,e.state,e.errorText),F({tool:r,toolCallId:e.toolCallId,output:e.state===`output-error`?e.errorText??`Tool execution denied by user`:e.output})}})}},[N,fe,F]);let me=(0,L.useRef)(null),he=(0,L.useCallback)(e=>{P(t=>{let n=t.findIndex(t=>t.id===e.messageId);if(n<0&&e.continuation){for(let e=t.length-1;e>=0;e--)if(t[e].role===`assistant`){n=e;break}}let r={id:n>=0?t[n].id:e.messageId,role:`assistant`,parts:[...e.parts],...e.metadata!=null&&{metadata:e.metadata}};if(n>=0){let e=[...t];return e[n]=r,e}return[...t,r]})},[P]);(0,L.useEffect)(()=>{function e(e){if(typeof e.data!=`string`)return;let t;try{t=JSON.parse(e.data)}catch{return}switch(t.type){case r3.CF_AGENT_CHAT_CLEAR:P([]);break;case r3.CF_AGENT_CHAT_MESSAGES:P(t.messages);break;case r3.CF_AGENT_MESSAGE_UPDATED:P(e=>{let n=t.message,r=e.findIndex(e=>e.id===n.id);if(r<0){let t=new Set(n.parts.filter(e=>`toolCallId`in e&&e.toolCallId).map(e=>e.toolCallId));t.size>0&&(r=e.findIndex(e=>e.parts.some(e=>`toolCallId`in e&&t.has(e.toolCallId))))}if(r>=0){let t=[...e];return t[r]={...n,id:e[r].id},t}return[...e,n]});break;case r3.CF_AGENT_STREAM_RESUME_NONE:j.handleStreamResumeNone();break;case r3.CF_AGENT_STREAM_RESUMING:if(!d||j.handleStreamResuming(t)||ee.current.has(t.id))return;me.current=null,me.current={id:t.id,messageId:vq(),continuation:!1,parts:[]},x.current.send(JSON.stringify({type:r3.CF_AGENT_STREAM_RESUME_ACK,id:t.id}));break;case r3.CF_AGENT_USE_CHAT_RESPONSE:{if(ee.current.has(t.id))return;let e=t.continuation===!0;if(!me.current||me.current.id!==t.id){let n=vq(),r=[],i;if(e){let e=ce.current;for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`){n=e[t].id,r=[...e[t].parts],e[t].metadata!=null&&(i={...e[t].metadata});break}}me.current={id:t.id,messageId:n,continuation:e,parts:r,metadata:i}}let n=me.current,r=t.replay===!0;if(t.body?.trim())try{let i=JSON.parse(t.body),a=Xfe(n.parts,i);typeof i.type==`string`&&i.type.startsWith(`data-`)&&_.current&&_.current(i),!a&&(i.type===`start`||i.type===`finish`||i.type===`message-metadata`)&&(i.messageId!=null&&i.type===`start`&&!e&&(n.messageId=i.messageId),i.messageMetadata!=null&&(n.metadata=n.metadata?{...n.metadata,...i.messageMetadata}:{...i.messageMetadata})),r||he(n)}catch(e){console.warn(`[useAgentChat] Failed to parse stream chunk:`,e instanceof Error?e.message:e,`body:`,t.body?.slice(0,100))}t.done||t.error?(r&&n&&he(n),me.current=null):t.replayComplete&&n&&he(n);break}}}return t.addEventListener(`message`,e),()=>{t.removeEventListener(`message`,e),me.current=null}},[t,P,d,he,j]);let ge=async e=>{let{toolCallId:t}=e,n=`tool`in e?e.tool:``,r=`output`in e?e.output:void 0;if(x.current.send(JSON.stringify({type:r3.CF_AGENT_TOOL_RESULT,toolCallId:t,toolName:n,output:r,autoContinue:l,clientTools:D.current?C9(D.current):void 0})),se(e=>new Map(e).set(t,r)),F(e),!l){if(!u){ne();return}let e=de.current?.toolCallIds;if(!e){ne();return}let n=e.size===1&&e.has(t);e.has(t)&&e.delete(t),(n||e.size===0)&&ne()}},_e=e=>{let{id:t,approved:n}=e,r;for(let e of ce.current){for(let n of e.parts)if(`toolCallId`in n&&`approval`in n&&n.approval?.id===t){r=n.toolCallId;break}if(r)break}r?pe(r,n):console.warn(`[useAgentChat] addToolApprovalResponse: Could not find toolCallId for approval ID "${t}". Server will not be notified, which may cause duplicate messages.`),te(e)},ve=(0,L.useMemo)(()=>oe.size===0?N:N.map(e=>({...e,parts:e.parts.map(e=>!(`toolCallId`in e)||!(`state`in e)||e.state!==`input-available`||!oe.has(e.toolCallId)?e:{...e,state:`output-available`,output:oe.get(e.toolCallId)})})),[N,oe]);(0,L.useEffect)(()=>{let e=new Set;for(let t of N)for(let n of t.parts)`toolCallId`in n&&n.toolCallId&&e.add(n.toolCallId);se(t=>{if(t.size===0)return t;let n=!1;for(let r of t.keys())if(!e.has(r)){n=!0;break}if(!n)return t;let r=new Map;for(let[n,i]of t)e.has(n)&&r.set(n,i);return r});for(let t of re.current)e.has(t)||re.current.delete(t)},[N]);let ye=(0,L.useCallback)(e=>{let t=e.toolName??``;fe(e.toolCallId,t,e.output,e.state,e.errorText),F({tool:t,toolCallId:e.toolCallId,output:e.state===`output-error`?e.errorText??`Tool execution denied by user`:e.output})},[fe,F]);return{...M,messages:ve,addToolOutput:ye,addToolResult:ge,addToolApprovalResponse:_e,clearHistory:()=>{P([]),se(new Map),re.current.clear(),t.send(JSON.stringify({type:r3.CF_AGENT_CHAT_CLEAR}))},setMessages:e=>{let n;n=typeof e==`function`?e(ce.current):e,P(n),t.send(JSON.stringify({messages:n,type:r3.CF_AGENT_CHAT_MESSAGES}))}}}var T9=function(e){return e.CF_AGENT_MCP_SERVERS=`cf_agent_mcp_servers`,e.CF_MCP_AGENT_EVENT=`cf_mcp_agent_event`,e.CF_AGENT_STATE=`cf_agent_state`,e.CF_AGENT_STATE_ERROR=`cf_agent_state_error`,e.CF_AGENT_IDENTITY=`cf_agent_identity`,e.RPC=`rpc`,e}({});function qye(e){if(e===e.toUpperCase()&&e!==e.toLowerCase())return e.toLowerCase().replace(/_/g,`-`);let t=e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return t=t.startsWith(`-`)?t.slice(1):t,t.replace(/_/g,`-`).replace(/-$/,``)}(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
|
|
399
399
|
PartySocket requires a global 'EventTarget' class to be available!
|
|
400
400
|
You can polyfill this global by adding this to your code before any partysocket imports:
|
|
401
401
|
|
|
@@ -422,4 +422,4 @@ const partysocket = new PartySocket({
|
|
|
422
422
|
|
|
423
423
|
`),c=o.some($7),l=!t&&!c&&a.length>0;return(0,z.jsx)(zW,{from:e.role,children:(0,z.jsxs)(`div`,{children:[r.length>0&&(0,z.jsxs)(ede,{children:[(0,z.jsx)(tde,{count:r.length}),(0,z.jsx)(nde,{children:r.map((e,t)=>e.type===`source-url`?(0,z.jsx)(X2,{href:e.url,title:e.title??e.url},t):(0,z.jsx)(X2,{href:`#${e.sourceId}`,title:e.title},t))})]}),(0,z.jsx)(BW,{children:l?(0,z.jsx)(KW,{children:s}):(0,z.jsxs)(z.Fragment,{children:[s&&!n&&(0,z.jsxs)(q2,{defaultOpen:!1,isStreaming:t,children:[(0,z.jsx)(J2,{}),(0,z.jsx)(Y2,{children:s})]}),o.map((e,r)=>(0,z.jsx)(fbe,{isStreaming:t,part:e,partIndex:r,userMode:n},r))]})})]})})}var mbe=({attachment:e,onRemove:t})=>(0,z.jsxs)(Ef,{data:e,onRemove:(0,L.useCallback)(()=>{t(e.id)},[t,e.id]),children:[(0,z.jsx)(Df,{}),(0,z.jsx)(Of,{})]}),hbe=()=>{let e=Tq(),t=(0,L.useCallback)(t=>{e.remove(t)},[e]);return e.files.length===0?null:(0,z.jsx)(Tf,{variant:`inline`,children:e.files.map(e=>(0,z.jsx)(mbe,{attachment:e,onRemove:t},e.id))})},gbe=({chatId:e,host:t,agent:n,agentUrl:r,body:i,query:a,onAgentChange:o,onConnectionStatusChange:s,onRetry:c,onUnauthorized:l,userMode:u})=>{let[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(`connecting`);(0,L.useEffect)(()=>{g(`connecting`)},[e,t,n]);let{agent:_,chat:v}=dbe({agent:n,host:t,chatId:e,toolContext:i??{},connectionParams:a??{},onConnectionStatusChange:e=>{g(e),s?.(e)},onClose:e=>{e.code>=3e3&&l?.(e.reason??``)}});(0,L.useEffect)(()=>(o?.(_),()=>{o?.(null)}),[_,o]);let{messages:y,sendMessage:b,status:x,stop:S}=v,C=(0,L.useMemo)(()=>y.filter(e=>e.role!==`system`),[y]),w=(0,L.useCallback)(e=>{let t=!!e.text?.trim(),n=!!e.files?.length;if(!(t||n))return;let r=[];if(e.text?.trim()&&r.push({type:`text`,text:e.text.trim()}),e.files?.length)for(let t of e.files)r.push({type:`text`,text:`[Attachment: ${t.filename??`file`}]`});b({role:`user`,parts:r}),f(``),e.files?.length&&Ze.success(`Files attached`,{description:`${e.files.length} file(s) attached to message`})},[b]),T=(0,L.useCallback)(e=>{f(t=>t?`${t} ${e}`:e)},[]),E=(0,L.useCallback)(e=>{f(e.target.value)},[]),D=(0,L.useCallback)(()=>{m(e=>!e)},[]),O=(0,L.useMemo)(()=>String(x)===`idle`||String(x)===`ready`?`ready`:x===`submitted`||x===`streaming`||x===`error`?x:`ready`,[x]),k=(0,L.useMemo)(()=>{if(O!==`submitted`&&O!==`streaming`)return!1;let e=C.at(-1);if(!e||e.role===`user`)return!0;if(e.role===`assistant`){let t=e.parts?.some(e=>e.type===`text`),n=e.parts?.some(e=>e.type===`reasoning`);return!t&&!n}return!1},[O,C]),ee=(0,L.useMemo)(()=>!d.trim()||O===`streaming`||O===`submitted`,[d,O]);return h===`connecting`?(0,z.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-3 text-muted-foreground`,children:[(0,z.jsx)(`div`,{className:`h-6 w-6 rounded-full border-2 border-zinc-300 border-t-zinc-600 animate-spin`}),(0,z.jsx)(`p`,{className:`text-sm`,children:`Connecting to agent...`})]}):h===`disconnected`?(0,z.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,z.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-red-50 flex items-center justify-center`,children:(0,z.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-red-400`})}),(0,z.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Unable to connect`}),r&&(0,z.jsxs)(`p`,{className:`text-xs text-muted-foreground max-w-xs`,children:[`Could not reach `,(0,z.jsx)(`span`,{className:`font-mono`,children:r}),`. Check the URL and make sure the agent is running.`]})]}),c&&(0,z.jsx)(`button`,{className:`text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground transition-colors`,onClick:c,children:`Try again`})]}):(0,z.jsxs)(`div`,{className:`relative flex size-full flex-col divide-y overflow-hidden`,children:[(0,z.jsxs)(Hf,{children:[(0,z.jsxs)(Uf,{children:[C.map((e,t)=>(0,z.jsx)(UW,{defaultBranch:0,children:(0,z.jsx)(WW,{children:(0,z.jsx)(pbe,{isStreaming:O===`streaming`&&t===C.length-1,message:e,userMode:u})})},e.id)),k&&(0,z.jsx)(zW,{from:`assistant`,children:(0,z.jsx)(BW,{children:(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground text-sm`,children:[(0,z.jsx)(_q,{className:`size-3.5 shrink-0`}),(0,z.jsx)(`span`,{children:`Thinking...`})]})})})]}),(0,z.jsx)(Wf,{})]}),(0,z.jsx)(`div`,{className:`grid shrink-0 gap-4 pt-4`,children:(0,z.jsx)(`div`,{className:`w-full px-4 pb-4`,children:(0,z.jsxs)(Oq,{globalDrop:!0,multiple:!0,onSubmit:w,children:[(0,z.jsx)(jq,{children:(0,z.jsx)(hbe,{})}),(0,z.jsx)(kq,{children:(0,z.jsx)(Aq,{onChange:E,value:d})}),(0,z.jsxs)(Mq,{children:[(0,z.jsxs)(Nq,{children:[(0,z.jsxs)(Fq,{children:[(0,z.jsx)(Iq,{}),(0,z.jsx)(Lq,{children:(0,z.jsx)(Dq,{})})]}),(0,z.jsx)(ide,{className:`shrink-0`,onTranscriptionChange:T,size:`icon-sm`,variant:`ghost`}),(0,z.jsxs)(Pq,{onClick:D,variant:p?`default`:`ghost`,children:[(0,z.jsx)(ef,{size:16}),(0,z.jsx)(`span`,{children:`Search`})]})]}),(0,z.jsx)(Rq,{disabled:ee,onStop:S,status:O})]})]})})})]})};function _be({className:e,size:t=`default`,...n}){return(0,z.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:_i(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function vbe({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`card-header`,className:_i(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function ybe({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`card-title`,className:_i(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function bbe({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`card-description`,className:_i(`text-sm text-muted-foreground`,e),...t})}function xbe({...e}){return(0,z.jsx)(LG,{"data-slot":`sheet`,...e})}function Sbe({...e}){return(0,z.jsx)(zG,{"data-slot":`sheet-trigger`,...e})}function Cbe({...e}){return(0,z.jsx)(bG,{"data-slot":`sheet-portal`,...e})}function wbe({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,z.jsx)(Cbe,{children:(0,z.jsxs)(vG,{"data-slot":`sheet-content`,"data-side":n,className:_i(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,z.jsx)(nG,{"data-slot":`sheet-close`,render:(0,z.jsxs)(xi,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,z.jsx)(_f,{}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})})}function Tbe({className:e,...t}){return(0,z.jsx)(`div`,{"data-slot":`sheet-header`,className:_i(`flex flex-col gap-0.5 p-4`,e),...t})}function Ebe({className:e,...t}){return(0,z.jsx)(RG,{"data-slot":`sheet-title`,className:_i(`cn-font-heading text-base font-medium text-foreground`,e),...t})}function Dbe({className:e,...t}){return(0,z.jsx)(rG,{"data-slot":`sheet-description`,className:_i(`text-sm text-muted-foreground`,e),...t})}function Obe(e){return!e||typeof e!=`object`?!1:`durable_object_name`in e||`title`in e||`summary`in e||`created_at`in e||`updated_at`in e}function kbe(e){return Array.isArray(e)?{rows:e.filter(Obe),supported:!0}:{rows:[],supported:!1}}function Abe(e){if(e==null||e===``)return`Unknown time`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown time`:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function jbe(e){let t=e?.trim();return t?t.length>180?`${t.slice(0,177)}...`:t:`No summary available yet.`}function Mbe(e){return e.title?.trim()||`Untitled conversation`}function Nbe(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)}function Pbe({agent:e,connectionStatus:t,currentChatId:n,onConversationClick:r}){let[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)([]),[c,l]=(0,L.useState)(`disconnected`),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),m=(0,L.useMemo)(()=>t===`unauthorized`?{title:`Unauthorized`,description:`Reconnect with valid credentials to load conversations.`}:{title:`Disconnected`,description:`Connect to the agent to load conversations for the active identity.`},[t]),h=(0,L.useCallback)(async()=>{if(!e){l(t===`unauthorized`?`unauthorized`:`disconnected`),d(null);return}if(t!==`connected`){l(t===`unauthorized`?`unauthorized`:`disconnected`),d(null);return}l(`loading`),d(null);try{let{rows:t,supported:n}=kbe(await e.call(`getConversations`));s(t),p(new Date().toISOString()),l(n?t.length>0?`ready`:`empty`:`unsupported`)}catch(e){d(e instanceof Error?e.message:String(e)),l(`error`)}},[e,t]);return(0,L.useEffect)(()=>{if(t===`connected`&&e&&!i){h();return}if(i){if(t===`connected`&&e){h();return}l(t===`unauthorized`?`unauthorized`:`disconnected`),d(null)}},[i,t,h]),(0,z.jsxs)(xbe,{open:i,onOpenChange:a,children:[(0,z.jsx)(Sbe,{children:(0,z.jsxs)(mp,{children:[(0,z.jsx)(hp,{children:(0,z.jsx)(xi,{"aria-label":`Conversation history`,title:`Conversation history`,size:`icon-sm`,variant:`outline`,className:`relative`,children:(0,z.jsx)(of,{className:`size-4`})})}),(0,z.jsx)(gp,{children:(0,z.jsx)(`p`,{children:`Conversation history`})})]})}),(0,z.jsxs)(wbe,{className:`gap-0`,children:[(0,z.jsxs)(Tbe,{children:[(0,z.jsxs)(Ebe,{children:[`Conversation history`,(0,z.jsx)(xi,{"aria-label":`Refresh conversations`,className:`absolute top-3 right-10`,onClick:()=>void h(),size:`icon-sm`,variant:`ghost`,children:(0,z.jsx)(df,{className:`size-4`})})]}),(0,z.jsx)(Dbe,{children:`Recent conversations for the connected identity.`})]}),(0,z.jsx)(`div`,{className:`border-b px-4 pb-3 text-xs text-muted-foreground`,children:f?(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,z.jsx)(Jd,{className:`size-3.5`}),`Last refreshed`,` `,new Intl.DateTimeFormat(void 0,{timeStyle:`short`}).format(new Date(f))]}):(0,z.jsx)(`span`,{children:`Open the panel to load conversations from the current session.`})}),(0,z.jsxs)(`div`,{className:`overflow-y-auto`,children:[c===`loading`&&(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center px-4`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,z.jsx)(_q,{className:`size-4`}),`Loading conversations...`]})}),c===`unauthorized`||c===`disconnected`?(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center px-4`,children:(0,z.jsx)(_be,{size:`sm`,className:`w-full border-dashed`,children:(0,z.jsxs)(vbe,{children:[(0,z.jsx)(ybe,{className:`text-sm`,children:m.title}),(0,z.jsx)(bbe,{children:m.description})]})})}):null,c===`error`?(0,z.jsxs)(`div`,{className:` items-center justify-center p-4`,children:[(0,z.jsx)(`p`,{className:`text-red-600`,children:`Could not load conversations`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u??`An unexpected error occurred while loading the conversation list.`}),(0,z.jsx)(xi,{onClick:()=>void h(),size:`sm`,variant:`outline`,children:`Retry`})]}):null,c===`empty`?(0,z.jsxs)(`div`,{className:` items-center justify-center p-4`,children:[(0,z.jsx)(`p`,{children:`No conversations yet`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This identity has not created any saved conversations.`})]}):null,c===`unsupported`?(0,z.jsxs)(`div`,{className:` items-center justify-center p-4`,children:[(0,z.jsx)(`p`,{children:`Conversations unavailable`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This agent does not expose saved conversations for the current identity.`})]}):null,c===`ready`?(0,z.jsx)(`div`,{className:`flex flex-col gap-3 p-4`,children:o.map((e,t)=>{let i=Nbe(e.durable_object_name??``);return(0,z.jsx)(`article`,{className:[`rounded-lg border bg-card p-3 shadow-sm transition-shadow hover:shadow-md cursor-pointer`,n&&i===n?`ring-2 ring-primary border-primary`:``].filter(Boolean).join(` `),onClick:()=>{a(!1),r(i)},children:(0,z.jsxs)(`div`,{className:`flex flex-col justify-between gap-2`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex gap-x-2 items-center`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-medium`,children:Mbe(e)}),(0,z.jsx)(`time`,{className:`shrink-0 text-[11px] text-muted-foreground ml-auto`,children:Abe(e.updated_at)})]}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-3 text-xs leading-relaxed text-muted-foreground`,children:jbe(e.summary)})]})},e.durable_object_name??`${e.updated_at??t}`)})}):null]})]})]})}var Fbe=class extends L.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,z.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center gap-4 text-muted-foreground`,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,z.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-red-50 flex items-center justify-center`,children:(0,z.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-red-400`})}),(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Something went wrong`}),(0,z.jsx)(`p`,{className:`text-xs max-w-xs`,children:`Could not connect to the agent. Check the URL above and try again.`})]})}):this.props.children}};function L9(e){try{let t=JSON.parse(e);return typeof t==`object`&&!!t&&Object.keys(t).length>0}catch{return!1}}function Ibe({body:e,onChange:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(e),o=(0,L.useCallback)(t=>{t&&a(e),r(t)},[e]),s=(0,L.useCallback)(()=>{let e=i.trim();if(e&&e!==`{}`)try{JSON.parse(e)}catch{Ze.error(`Invalid JSON — check the syntax and try again.`);return}t(e),r(!1)},[i,t]),c=L9(e);return(0,z.jsxs)(BG,{open:n,onOpenChange:o,children:[(0,z.jsx)(VG,{children:(0,z.jsxs)(mp,{children:[(0,z.jsx)(hp,{children:(0,z.jsxs)(xi,{"aria-label":`Request body`,title:`Request body — JSON merged into each chat request (tool execution context)`,size:`icon-sm`,variant:`outline`,className:`relative`,children:[(0,z.jsx)(ff,{className:`size-4`}),c&&(0,z.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-blue-500`})]})}),(0,z.jsx)(gp,{children:(0,z.jsx)(`p`,{children:`Request body params`})})]})}),(0,z.jsxs)(WG,{className:`!w-2xl !max-w-2xl`,children:[(0,z.jsx)(GG,{children:(0,z.jsx)(qG,{children:`Request body`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`JSON object merged into the body of every chat request. Available in tool`,` `,(0,z.jsx)(`code`,{className:`font-mono`,children:`execute`}),` functions via`,` `,(0,z.jsx)(`code`,{className:`font-mono`,children:`experimental_context`}),`.`]}),(0,z.jsx)(fK,{className:`font-mono text-xs min-h-32 max-h-72 break-all w-full`,placeholder:`{
|
|
424
424
|
"authorization": "Bearer my-token"
|
|
425
|
-
}`,value:i,onChange:e=>a(e.target.value),spellCheck:!1})]}),(0,z.jsx)(KG,{showCloseButton:!0,children:(0,z.jsx)(xi,{size:`sm`,onClick:s,children:`Save`})})]})]})}function R9(e){if(!e||e===`{}`)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t;for(let e of Object.values(n))if(typeof e!=`string`)return null;return n}function z9(e,t){if(!t?.length)return;let n=e??{};for(let e of t)n[e]?.trim()||Ze.warning(`Query param "${e}" is required for this playground session.`)}function B9(e,t,n){let r=n?.declaredQueryKeys;if(!e||e===`{}`)return z9(null,r),t(e),!0;let i=R9(e);return i===null?(Ze.error(`Invalid query params — use only flat string key/value pairs.`),!1):(z9(i,r),t(e),!0)}function V9(e){let t=R9(e.trim());return!t||Object.keys(t).length===0?[{id:vq(),key:``,value:``}]:Object.entries(t).map(([e,t])=>({id:vq(),key:e,value:t}))}function Lbe(e){let t={},n=new Set;for(let r of e){let e=r.key.trim();if(e){if(n.has(e))return`duplicate`;n.add(e),t[e]=r.value}}return t}function Rbe({query:e,onChange:t,declaredQueryKeys:n,userId:r,onUserIdChange:i}){let[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(r),[l,u]=(0,L.useState)(()=>V9(e)),d=(0,L.useCallback)(t=>{t&&(c(r),u(V9(e))),o(t)},[e,r]),f=(0,L.useCallback)(()=>{u(e=>[...e,{id:vq(),key:``,value:``}])},[]),p=(0,L.useCallback)(e=>{u(t=>{let n=t.filter(t=>t.id!==e);return n.length>0?n:[{id:vq(),key:``,value:``}]})},[]),m=(0,L.useCallback)((e,t,n)=>{u(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),h=(0,L.useCallback)(()=>{let e=s.trim();if(!e){Ze.error(`User ID is required.`);return}let r=Lbe(l);if(r===`duplicate`){Ze.error(`Duplicate parameter keys are not allowed.`);return}B9(JSON.stringify(r),e=>t(e),{declaredQueryKeys:n})&&(i(e),o(!1))},[l,t,n,s,i]),g=L9(e)||!!r;return(0,z.jsxs)(BG,{open:a,onOpenChange:d,children:[(0,z.jsx)(VG,{children:(0,z.jsxs)(mp,{children:[(0,z.jsx)(hp,{children:(0,z.jsxs)(xi,{"aria-label":`Connection query params`,title:`Connection query params — appended to the WebSocket URL`,size:`icon-sm`,variant:`outline`,className:`relative`,children:[(0,z.jsx)(nf,{className:`size-4`}),g&&(0,z.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-blue-500`})]})}),(0,z.jsx)(gp,{children:(0,z.jsx)(`p`,{children:`Connection query params`})})]})}),(0,z.jsxs)(WG,{className:`!w-2xl !max-w-2xl`,children:[(0,z.jsx)(GG,{children:(0,z.jsx)(qG,{children:`Connection query params`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Flat string key/value pairs appended to the WebSocket URL (no nested JSON). Changes take effect on the next connection after saving, such as starting a new chat or refreshing the page.`}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:`params-user-id`,children:[`User ID `,(0,z.jsx)(`span`,{className:`text-destructive font-normal`,children:`(required)`})]}),(0,z.jsx)(dK,{autoComplete:`off`,className:`font-mono text-xs`,id:`params-user-id`,onChange:e=>c(e.target.value),placeholder:`e.g. user_123`,spellCheck:!1,value:s})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`Additional params`}),(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)_auto] gap-2 text-xs font-medium text-muted-foreground px-0.5`,children:[(0,z.jsx)(`span`,{children:`Name`}),(0,z.jsx)(`span`,{children:`Value`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Remove`})]}),l.map(e=>(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)_auto] gap-2 items-center`,children:[(0,z.jsx)(dK,{"aria-label":`Parameter name`,className:`font-mono text-xs h-9`,onChange:t=>m(e.id,`key`,t.target.value),placeholder:`e.g. token`,spellCheck:!1,value:e.key}),(0,z.jsx)(dK,{"aria-label":`Value for ${e.key||`parameter`}`,className:`font-mono text-xs h-9`,onChange:t=>m(e.id,`value`,t.target.value),placeholder:`value`,spellCheck:!1,value:e.value}),(0,z.jsx)(xi,{"aria-label":`Remove row`,className:`shrink-0 justify-self-end sm:justify-self-center`,onClick:()=>p(e.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,z.jsx)(mf,{className:`size-4 text-muted-foreground`})})]},e.id)),(0,z.jsxs)(xi,{className:`self-start gap-1.5`,onClick:f,size:`sm`,type:`button`,variant:`outline`,children:[(0,z.jsx)(uf,{className:`size-4`}),`Add param`]})]})]}),(0,z.jsx)(KG,{showCloseButton:!0,children:(0,z.jsx)(xi,{size:`sm`,onClick:h,children:`Save`})})]})]})}var H9=`playground:url`,U9=`playground:body`,W9=`playground:query`,G9=`playground:userId`,K9=`playground:userMode`,q9=`{{agent_name}}`,zbe=`http://localhost:8787/agents/${q9}`;function J9(e){if(!e?.trim())return[];let t=new Set,n=[];for(let r of e.split(`,`)){let e=r.trim();e&&(t.has(e)||(t.add(e),n.push(e)))}return n}function Bbe(e){return e?.length?J9(e.join(`,`)):[]}function Y9(){let e=window.__PLAYGROUND_CONFIG__,t=Bbe(e?.queryParamKeys),n=J9(void 0),r=t.length>0?t:n;return{agentName:e?.agentName,port:e?.port,queryParamKeys:r}}function Vbe(e,t){if(t.length===0)return!0;let n=R9(e.trim());return n?t.every(e=>!!n[e]?.trim()):!1}function X9(e,t){return R9(e.trim())?.[t]?.trim()??``}function Z9(e){return`setup-query-${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}`}function Hbe(){return localStorage.getItem(U9)??``}function Ube(){return localStorage.getItem(W9)??``}function Wbe(){return new URLSearchParams(window.location.search).get(`user`)??``}function Gbe(){return Wbe()||(localStorage.getItem(G9)??``)}function Q9(e){try{let t=new URL(e.includes(`://`)?e:`http://${e}`),n=t.pathname.split(`/`).filter(Boolean);return n[0]===`agents`&&n[1]?{host:t.host,agent:n[1]}:null}catch{return null}}function Kbe(e){return e?Q9(e)||(Ze.error(`Invalid agent URL — expected http://<host>/agents/<name>`),null):null}function qbe({open:e,urlDraft:t,setUrlDraft:n,onCommitUrl:r,query:i,onPersistQuery:a,requiredParamKeys:o,userId:s,onUserIdChange:c}){let[l,u]=(0,L.useState)(s),[d,f]=(0,L.useState)(()=>Object.fromEntries(o.map(e=>[e,X9(i,e)])));(0,L.useEffect)(()=>{u(s)},[s]),(0,L.useEffect)(()=>{f(Object.fromEntries(o.map(e=>[e,X9(i,e)])))},[i,o]);let p=(0,L.useCallback)(()=>{let e=l.trim();if(!e){Ze.error(`User ID is required.`);return}if(r()){if(o.length>0){for(let e of o)if(!d[e]?.trim()){Ze.error(`"${e}" is required for this playground session (WebSocket query param).`);return}let e={...R9(i.trim())??{},...Object.fromEntries(o.map(e=>[e,d[e].trim()]))};a(JSON.stringify(e))}c(e)}},[l,r,o,d,i,a,c]);return(0,z.jsx)(BG,{open:e,onOpenChange:e=>{},children:(0,z.jsxs)(WG,{className:`!w-2xl !max-w-2xl`,showCloseButton:!1,children:[(0,z.jsx)(GG,{children:(0,z.jsx)(qG,{children:`Initial setup`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Set your User ID, a valid agent URL, and any required connection fields for the WebSocket.`,` `,o.length>0?(0,z.jsxs)(z.Fragment,{children:[`This CLI session also requires:`,` `,(0,z.jsx)(`code`,{className:`font-mono`,children:o.join(`, `)}),`.`]}):(0,z.jsx)(z.Fragment,{children:`Optional query params can be added later via the key icon in the header.`}),` `,`Fields are pre-filled from saved settings when possible.`]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:`setup-user-id`,children:[`User ID `,(0,z.jsx)(`span`,{className:`text-destructive font-normal`,children:`(required)`})]}),(0,z.jsx)(dK,{autoComplete:`off`,className:`font-mono text-xs`,id:`setup-user-id`,onChange:e=>u(e.target.value),placeholder:`e.g. user_123`,spellCheck:!1,value:l})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:`setup-agent-url`,children:`Agent URL`}),(0,z.jsx)(dK,{className:`font-mono text-xs`,id:`setup-agent-url`,onChange:e=>n(e.target.value),placeholder:`http://localhost:8787/agents/my-agent`,spellCheck:!1,value:t})]}),o.length>0?(0,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`Required query params`}),o.map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:Z9(e),children:[(0,z.jsx)(`code`,{className:`font-mono`,children:e}),` `,(0,z.jsx)(`span`,{className:`text-destructive font-normal`,children:`(required)`})]}),(0,z.jsx)(dK,{autoComplete:`off`,className:`font-mono text-xs`,id:Z9(e),onChange:t=>f(n=>({...n,[e]:t.target.value})),placeholder:e,spellCheck:!1,value:d[e]??``})]},e)),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Use the key icon in the header to add more key/value pairs if you need keys beyond this list.`})]}):null]}),(0,z.jsx)(KG,{children:(0,z.jsx)(xi,{size:`sm`,onClick:p,children:`Continue`})})]})})}function Jbe(){let e=Y9();return e.agentName?`http://localhost:${e.port??8787}/agents/${e.agentName}`:zbe}function Ybe(){return localStorage.getItem(H9)??Jbe()}function Xbe(){return new URLSearchParams(window.location.search).get(`chat`)??void 0}function $9(){return vq()}function Zbe(){let[e,t]=(0,L.useState)(()=>Xbe()??$9()),[n,r]=(0,L.useState)(Gbe),[i,a]=(0,L.useState)(Ybe),[o,s]=(0,L.useState)(i),[c,l]=(0,L.useState)(`connecting`),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(Hbe),[m,h]=(0,L.useState)(Ube),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(()=>localStorage.getItem(K9)===`true`),b=(0,L.useRef)(!1),x=(0,L.useMemo)(()=>Y9().queryParamKeys??[],[]);(0,L.useEffect)(()=>{l(`connecting`),d(null)},[e]);let S=i.includes(q9),C=S?null:Q9(i),w=!S&&C!==null,T=Vbe(m,x),E=!w||!T||!n;(0,L.useEffect)(()=>{let t=new URLSearchParams(window.location.search);e&&t.get(`chat`)!==e&&(t.set(`chat`,e),history.replaceState(null,``,`?${t}`))},[e]),(0,L.useEffect)(()=>{let e=new URLSearchParams(window.location.search);n&&e.get(`user`)!==n&&(e.set(`user`,n),history.replaceState(null,``,`?${e}`))},[n]);let D=(0,L.useCallback)(()=>{let e=$9(),n=new URLSearchParams(window.location.search);n.set(`chat`,e),history.pushState(null,``,`?${n}`),t(e),Ze.success(`New chat started`)},[]),O=(0,L.useCallback)(()=>{let e=o.trim();return Kbe(e)?(localStorage.setItem(H9,e),a(e),s(e),b.current=!0,t($9()),!0):!1},[o]),k=(0,L.useCallback)(e=>{localStorage.setItem(G9,e),r(e)},[]);return(0,z.jsxs)(`div`,{className:`relative flex h-screen overflow-hidden`,children:[(0,z.jsx)(qbe,{open:E,query:m,requiredParamKeys:x,setUrlDraft:s,urlDraft:o,onCommitUrl:O,onPersistQuery:(0,L.useCallback)(e=>B9(e,e=>{localStorage.setItem(W9,e),h(e)},{declaredQueryKeys:x}),[x]),userId:n,onUserIdChange:k}),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col`,children:[(0,z.jsx)(`div`,{className:`border-b-2 border-zinc-200 flex items-center justify-between bg-zinc-50`,children:(0,z.jsxs)(`div`,{className:`h-20 flex items-center w-6xl mx-auto border-x-2 border-zinc-200/40 py-6 px-6 justify-between`,children:[(0,z.jsx)(`div`,{className:`flex items-center`,children:i?(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{className:`text-sm font-semibold mb-0 flex items-center`,children:[(0,z.jsx)(`div`,{className:[`h-2 w-2 rounded-full mr-2`,c===`connected`&&`bg-green-500`,c===`connecting`&&`bg-amber-400 animate-pulse`,(c===`disconnected`||c===`unauthorized`)&&`bg-red-500 animate-pulse`].filter(Boolean).join(` `)}),c===`connected`&&`Connected to agent`,c===`connecting`&&`Connecting...`,c===`disconnected`&&`Unable to connect to agent`,c===`unauthorized`&&`Unauthorized to connect to agent`]}),(0,z.jsx)(`input`,{className:`-ml-1.5 text-xs text-muted-foreground mb-0 py-1 pl-2 pr-10 field-sizing-content rounded-md hover:text-foreground focus:text-foreground hover:bg-white focus:bg-white hover:outline hover:outline-zinc-200 focus:outline focus:outline-zinc-300`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?(O(),e.currentTarget.blur()):e.key===`Escape`&&(s(i),e.currentTarget.blur())},onBlur:()=>{if(b.current){b.current=!1;return}s(i)}})]})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`h-2 w-2 bg-muted-foreground/50 rounded-full mr-3`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground mb-0`,children:`Not Connected`}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground mb-0`,children:`Enter an agent URL and click Connect`})]})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(xi,{onClick:D,size:`icon-sm`,variant:`outline`,children:(0,z.jsx)(af,{className:`size-4`})}),(0,z.jsx)(Pbe,{agent:g,connectionStatus:c,currentChatId:e,onConversationClick:t}),(0,z.jsx)(Rbe,{declaredQueryKeys:x,query:m,onChange:e=>{localStorage.setItem(W9,e),h(e)},userId:n,onUserIdChange:k}),(0,z.jsx)(Ibe,{body:f,onChange:e=>{localStorage.setItem(U9,e),p(e)}}),(0,z.jsxs)(mp,{children:[(0,z.jsx)(hp,{children:(0,z.jsx)(xi,{"aria-label":`View chat as a user would`,title:`View chat as a user would`,onClick:()=>y(e=>{let t=!e;return localStorage.setItem(K9,String(t)),t}),size:`icon-sm`,variant:v?`default`:`outline`,children:v?(0,z.jsx)(Qd,{className:`size-4`}):(0,z.jsx)(Zd,{className:`size-4`})})}),(0,z.jsx)(gp,{children:(0,z.jsx)(`p`,{children:`Conversation history`})})]})]})]})}),(0,z.jsx)(`div`,{className:`flex-1 overflow-hidden min-h-0 grow`,children:(0,z.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto border-x-2 border-zinc-100 h-full`,children:[c===`unauthorized`&&w&&T&&(0,z.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center gap-4 text-muted-foreground`,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,z.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-red-50 flex items-center justify-center`,children:(0,z.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-red-400`})}),(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Unauthorized`}),u?(0,z.jsx)(`p`,{className:`text-xs max-w-xs`,children:u}):(0,z.jsx)(`p`,{className:`text-xs max-w-xs`,children:`You are not authorized to connect to this agent.`})]})}),w&&T&&C?(0,z.jsx)(Fbe,{children:(0,z.jsx)(gbe,{agent:C.agent,host:C.host,chatId:n?`${n}:${e}`:e,agentUrl:i,body:f?JSON.parse(f):void 0,query:m?R9(m.trim())??void 0:void 0,onAgentChange:_,onConnectionStatusChange:l,onUnauthorized:d,userMode:v},`${n}:${e}:${m}`)},`${n}:${e}:${m}`):(0,z.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center gap-3 text-muted-foreground px-4`,children:w?(0,z.jsxs)(`p`,{className:`text-sm text-center max-w-md`,children:[`Set required WebSocket query params in the setup dialog`,x.length>0?(0,z.jsxs)(z.Fragment,{children:[`: `,(0,z.jsx)(`code`,{className:`font-mono text-xs`,children:x.join(`, `)})]}):null,`.`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`text-sm text-center`,children:`Enter an agent URL in the bar above or in the setup dialog.`}),(0,z.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground/60`,children:`e.g. http://localhost:8787/agents/my-agent`})]})})]})})]})]})}(0,Fe.createRoot)(document.getElementById(`app`)).render((0,z.jsx)(L.StrictMode,{children:(0,z.jsxs)(pp,{children:[(0,z.jsx)(ft,{}),(0,z.jsx)(Zbe,{})]})}));export{jO as a,uO as c,lD as d,uD as f,ke as h,RW as i,hD as l,yi as m,BH as n,DO as o,dw as p,PW as r,pO as s,fH as t,mD as u};
|
|
425
|
+
}`,value:i,onChange:e=>a(e.target.value),spellCheck:!1})]}),(0,z.jsx)(KG,{showCloseButton:!0,children:(0,z.jsx)(xi,{size:`sm`,onClick:s,children:`Save`})})]})]})}function R9(e){if(!e||e===`{}`)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t;for(let e of Object.values(n))if(typeof e!=`string`)return null;return n}function z9(e,t){if(!t?.length)return;let n=e??{};for(let e of t)n[e]?.trim()||Ze.warning(`Query param "${e}" is required for this playground session.`)}function B9(e,t,n){let r=n?.declaredQueryKeys;if(!e||e===`{}`)return z9(null,r),t(e),!0;let i=R9(e);return i===null?(Ze.error(`Invalid query params — use only flat string key/value pairs.`),!1):(z9(i,r),t(e),!0)}function V9(e){let t=R9(e.trim());return!t||Object.keys(t).length===0?[{id:vq(),key:``,value:``}]:Object.entries(t).map(([e,t])=>({id:vq(),key:e,value:t}))}function Lbe(e){let t={},n=new Set;for(let r of e){let e=r.key.trim();if(e){if(n.has(e))return`duplicate`;n.add(e),t[e]=r.value}}return t}function Rbe({query:e,onChange:t,declaredQueryKeys:n,userId:r,onUserIdChange:i}){let[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(r),[l,u]=(0,L.useState)(()=>V9(e)),d=(0,L.useCallback)(t=>{t&&(c(r),u(V9(e))),o(t)},[e,r]),f=(0,L.useCallback)(()=>{u(e=>[...e,{id:vq(),key:``,value:``}])},[]),p=(0,L.useCallback)(e=>{u(t=>{let n=t.filter(t=>t.id!==e);return n.length>0?n:[{id:vq(),key:``,value:``}]})},[]),m=(0,L.useCallback)((e,t,n)=>{u(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),h=(0,L.useCallback)(()=>{let e=s.trim();if(!e){Ze.error(`User ID is required.`);return}let r=Lbe(l);if(r===`duplicate`){Ze.error(`Duplicate parameter keys are not allowed.`);return}B9(JSON.stringify(r),e=>t(e),{declaredQueryKeys:n})&&(i(e),o(!1))},[l,t,n,s,i]),g=L9(e)||!!r;return(0,z.jsxs)(BG,{open:a,onOpenChange:d,children:[(0,z.jsx)(VG,{children:(0,z.jsxs)(mp,{children:[(0,z.jsx)(hp,{children:(0,z.jsxs)(xi,{"aria-label":`Connection query params`,title:`Connection query params — appended to the WebSocket URL`,size:`icon-sm`,variant:`outline`,className:`relative`,children:[(0,z.jsx)(nf,{className:`size-4`}),g&&(0,z.jsx)(`span`,{className:`absolute -top-1 -right-1 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-blue-500`})]})}),(0,z.jsx)(gp,{children:(0,z.jsx)(`p`,{children:`Connection query params`})})]})}),(0,z.jsxs)(WG,{className:`!w-2xl !max-w-2xl`,children:[(0,z.jsx)(GG,{children:(0,z.jsx)(qG,{children:`Connection query params`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Flat string key/value pairs appended to the WebSocket URL (no nested JSON). Changes take effect on the next connection after saving, such as starting a new chat or refreshing the page.`}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:`params-user-id`,children:[`User ID `,(0,z.jsx)(`span`,{className:`text-destructive font-normal`,children:`(required)`})]}),(0,z.jsx)(dK,{autoComplete:`off`,className:`font-mono text-xs`,id:`params-user-id`,onChange:e=>c(e.target.value),placeholder:`e.g. user_123`,spellCheck:!1,value:s})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`Additional params`}),(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)_auto] gap-2 text-xs font-medium text-muted-foreground px-0.5`,children:[(0,z.jsx)(`span`,{children:`Name`}),(0,z.jsx)(`span`,{children:`Value`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Remove`})]}),l.map(e=>(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)_auto] gap-2 items-center`,children:[(0,z.jsx)(dK,{"aria-label":`Parameter name`,className:`font-mono text-xs h-9`,onChange:t=>m(e.id,`key`,t.target.value),placeholder:`e.g. token`,spellCheck:!1,value:e.key}),(0,z.jsx)(dK,{"aria-label":`Value for ${e.key||`parameter`}`,className:`font-mono text-xs h-9`,onChange:t=>m(e.id,`value`,t.target.value),placeholder:`value`,spellCheck:!1,value:e.value}),(0,z.jsx)(xi,{"aria-label":`Remove row`,className:`shrink-0 justify-self-end sm:justify-self-center`,onClick:()=>p(e.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,z.jsx)(mf,{className:`size-4 text-muted-foreground`})})]},e.id)),(0,z.jsxs)(xi,{className:`self-start gap-1.5`,onClick:f,size:`sm`,type:`button`,variant:`outline`,children:[(0,z.jsx)(uf,{className:`size-4`}),`Add param`]})]})]}),(0,z.jsx)(KG,{showCloseButton:!0,children:(0,z.jsx)(xi,{size:`sm`,onClick:h,children:`Save`})})]})]})}var H9=`playground:url`,U9=`playground:body`,W9=`playground:query`,G9=`playground:userId`,K9=`playground:userMode`,q9=`{{agent_name}}`,zbe=`http://localhost:8787/agents/${q9}`;function J9(e){if(!e?.trim())return[];let t=new Set,n=[];for(let r of e.split(`,`)){let e=r.trim();e&&(t.has(e)||(t.add(e),n.push(e)))}return n}function Bbe(e){return e?.length?J9(e.join(`,`)):[]}function Y9(){let e=window.__PLAYGROUND_CONFIG__,t=Bbe(e?.queryParamKeys),n=J9(void 0),r=t.length>0?t:n;return{agentName:e?.agentName,port:e?.port,queryParamKeys:r}}function Vbe(e,t){if(t.length===0)return!0;let n=R9(e.trim());return n?t.every(e=>!!n[e]?.trim()):!1}function X9(e,t){return R9(e.trim())?.[t]?.trim()??``}function Z9(e){return`setup-query-${e.replace(/[^a-zA-Z0-9_-]/g,`_`)}`}function Hbe(){return localStorage.getItem(U9)??``}function Ube(){return localStorage.getItem(W9)??``}function Wbe(){return new URLSearchParams(window.location.search).get(`user`)??``}function Gbe(){return Wbe()||(localStorage.getItem(G9)??``)}function Q9(e){try{let t=new URL(e.includes(`://`)?e:`http://${e}`),n=t.pathname.split(`/`).filter(Boolean);return n[0]===`agents`&&n[1]?{host:t.host,agent:n[1]}:null}catch{return null}}function Kbe(e){return e?Q9(e)||(Ze.error(`Invalid agent URL — expected http://<host>/agents/<name>`),null):null}function qbe({open:e,urlDraft:t,setUrlDraft:n,onCommitUrl:r,query:i,onPersistQuery:a,requiredParamKeys:o,userId:s,onUserIdChange:c}){let[l,u]=(0,L.useState)(s),[d,f]=(0,L.useState)(()=>Object.fromEntries(o.map(e=>[e,X9(i,e)])));(0,L.useEffect)(()=>{u(s)},[s]),(0,L.useEffect)(()=>{f(Object.fromEntries(o.map(e=>[e,X9(i,e)])))},[i,o]);let p=(0,L.useCallback)(()=>{let e=l.trim();if(!e){Ze.error(`User ID is required.`);return}if(r()){if(o.length>0){for(let e of o)if(!d[e]?.trim()){Ze.error(`"${e}" is required for this playground session (WebSocket query param).`);return}let e={...R9(i.trim())??{},...Object.fromEntries(o.map(e=>[e,d[e].trim()]))};a(JSON.stringify(e))}c(e)}},[l,r,o,d,i,a,c]);return(0,z.jsx)(BG,{open:e,onOpenChange:e=>{},children:(0,z.jsxs)(WG,{className:`!w-2xl !max-w-2xl`,showCloseButton:!1,children:[(0,z.jsx)(GG,{children:(0,z.jsx)(qG,{children:`Initial setup`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Set your User ID, a valid agent URL, and any required connection fields for the WebSocket.`,` `,o.length>0?(0,z.jsxs)(z.Fragment,{children:[`This CLI session also requires:`,` `,(0,z.jsx)(`code`,{className:`font-mono`,children:o.join(`, `)}),`.`]}):(0,z.jsx)(z.Fragment,{children:`Optional query params can be added later via the key icon in the header.`}),` `,`Fields are pre-filled from saved settings when possible.`]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:`setup-user-id`,children:[`User ID `,(0,z.jsx)(`span`,{className:`text-destructive font-normal`,children:`(required)`})]}),(0,z.jsx)(dK,{autoComplete:`off`,className:`font-mono text-xs`,id:`setup-user-id`,onChange:e=>u(e.target.value),placeholder:`e.g. user_123`,spellCheck:!1,value:l})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:`setup-agent-url`,children:`Agent URL`}),(0,z.jsx)(dK,{className:`font-mono text-xs`,id:`setup-agent-url`,onChange:e=>n(e.target.value),placeholder:`http://localhost:8787/agents/my-agent`,spellCheck:!1,value:t})]}),o.length>0?(0,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`Required query params`}),o.map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`label`,{className:`text-xs font-medium text-foreground`,htmlFor:Z9(e),children:[(0,z.jsx)(`code`,{className:`font-mono`,children:e}),` `,(0,z.jsx)(`span`,{className:`text-destructive font-normal`,children:`(required)`})]}),(0,z.jsx)(dK,{autoComplete:`off`,className:`font-mono text-xs`,id:Z9(e),onChange:t=>f(n=>({...n,[e]:t.target.value})),placeholder:e,spellCheck:!1,value:d[e]??``})]},e)),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Use the key icon in the header to add more key/value pairs if you need keys beyond this list.`})]}):null]}),(0,z.jsx)(KG,{children:(0,z.jsx)(xi,{size:`sm`,onClick:p,children:`Continue`})})]})})}function Jbe(){let e=Y9();return e.agentName?`http://localhost:${e.port??8787}/agents/${e.agentName}`:zbe}function Ybe(){return localStorage.getItem(H9)??Jbe()}function Xbe(){return new URLSearchParams(window.location.search).get(`chat`)??void 0}function $9(){return vq()}function Zbe(){let[e,t]=(0,L.useState)(()=>Xbe()??$9()),[n,r]=(0,L.useState)(Gbe),[i,a]=(0,L.useState)(Ybe),[o,s]=(0,L.useState)(i),[c,l]=(0,L.useState)(`connecting`),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(Hbe),[m,h]=(0,L.useState)(Ube),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(()=>localStorage.getItem(K9)===`true`),b=(0,L.useRef)(!1),x=(0,L.useMemo)(()=>Y9().queryParamKeys??[],[]);(0,L.useEffect)(()=>{l(`connecting`),d(null)},[e]);let S=i.includes(q9),C=S?null:Q9(i),w=!S&&C!==null,T=Vbe(m,x),E=!w||!T||!n;(0,L.useEffect)(()=>{let t=new URLSearchParams(window.location.search);e&&t.get(`chat`)!==e&&(t.set(`chat`,e),history.replaceState(null,``,`?${t}`))},[e]),(0,L.useEffect)(()=>{let e=new URLSearchParams(window.location.search);n&&e.get(`user`)!==n&&(e.set(`user`,n),history.replaceState(null,``,`?${e}`))},[n]);let D=(0,L.useCallback)(()=>{let e=$9(),n=new URLSearchParams(window.location.search);n.set(`chat`,e),history.pushState(null,``,`?${n}`),t(e),Ze.success(`New chat started`)},[]),O=(0,L.useCallback)(()=>{let e=o.trim();return Kbe(e)?(localStorage.setItem(H9,e),a(e),s(e),b.current=!0,t($9()),!0):!1},[o]),k=(0,L.useCallback)(e=>{localStorage.setItem(G9,e),r(e)},[]);return(0,z.jsxs)(`div`,{className:`relative flex h-screen overflow-hidden`,children:[(0,z.jsx)(qbe,{open:E,query:m,requiredParamKeys:x,setUrlDraft:s,urlDraft:o,onCommitUrl:O,onPersistQuery:(0,L.useCallback)(e=>B9(e,e=>{localStorage.setItem(W9,e),h(e)},{declaredQueryKeys:x}),[x]),userId:n,onUserIdChange:k}),(0,z.jsxs)(`div`,{className:`flex-1 flex flex-col`,children:[(0,z.jsx)(`div`,{className:`border-b-2 border-zinc-200 flex items-center justify-between bg-zinc-50`,children:(0,z.jsxs)(`div`,{className:`h-20 flex items-center w-6xl mx-auto border-x-2 border-zinc-200/40 py-6 px-6 justify-between`,children:[(0,z.jsx)(`div`,{className:`flex items-center`,children:i?(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{className:`text-sm font-semibold mb-0 flex items-center`,children:[(0,z.jsx)(`div`,{className:[`h-2 w-2 rounded-full mr-2`,c===`connected`&&`bg-green-500`,c===`connecting`&&`bg-amber-400 animate-pulse`,(c===`disconnected`||c===`unauthorized`)&&`bg-red-500 animate-pulse`].filter(Boolean).join(` `)}),c===`connected`&&`Connected to agent`,c===`connecting`&&`Connecting...`,c===`disconnected`&&`Unable to connect to agent`,c===`unauthorized`&&`Unauthorized to connect to agent`]}),(0,z.jsx)(`input`,{className:`-ml-1.5 text-xs text-muted-foreground mb-0 py-1 pl-2 pr-10 field-sizing-content rounded-md hover:text-foreground focus:text-foreground hover:bg-white focus:bg-white hover:outline hover:outline-zinc-200 focus:outline focus:outline-zinc-300`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?(O(),e.currentTarget.blur()):e.key===`Escape`&&(s(i),e.currentTarget.blur())},onBlur:()=>{if(b.current){b.current=!1;return}s(i)}})]})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`h-2 w-2 bg-muted-foreground/50 rounded-full mr-3`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground mb-0`,children:`Not Connected`}),(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground mb-0`,children:`Enter an agent URL and click Connect`})]})]})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(xi,{onClick:D,size:`icon-sm`,variant:`outline`,children:(0,z.jsx)(af,{className:`size-4`})}),(0,z.jsx)(Pbe,{agent:g,connectionStatus:c,currentChatId:e,onConversationClick:t}),(0,z.jsx)(Rbe,{declaredQueryKeys:x,query:m,onChange:e=>{localStorage.setItem(W9,e),h(e)},userId:n,onUserIdChange:k}),(0,z.jsx)(Ibe,{body:f,onChange:e=>{localStorage.setItem(U9,e),p(e)}}),(0,z.jsxs)(mp,{children:[(0,z.jsx)(hp,{children:(0,z.jsx)(xi,{"aria-label":`View chat as a user would`,title:`View chat as a user would`,onClick:()=>y(e=>{let t=!e;return localStorage.setItem(K9,String(t)),t}),size:`icon-sm`,variant:v?`default`:`outline`,children:v?(0,z.jsx)(Qd,{className:`size-4`}):(0,z.jsx)(Zd,{className:`size-4`})})}),(0,z.jsx)(gp,{children:(0,z.jsx)(`p`,{children:`View chat as a user would`})})]})]})]})}),(0,z.jsx)(`div`,{className:`flex-1 overflow-hidden min-h-0 grow`,children:(0,z.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto border-x-2 border-zinc-100 h-full`,children:[c===`unauthorized`&&w&&T&&(0,z.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center gap-4 text-muted-foreground`,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,z.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-red-50 flex items-center justify-center`,children:(0,z.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-red-400`})}),(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Unauthorized`}),u?(0,z.jsx)(`p`,{className:`text-xs max-w-xs`,children:u}):(0,z.jsx)(`p`,{className:`text-xs max-w-xs`,children:`You are not authorized to connect to this agent.`})]})}),w&&T&&C?(0,z.jsx)(Fbe,{children:(0,z.jsx)(gbe,{agent:C.agent,host:C.host,chatId:n?`${n}:${e}`:e,agentUrl:i,body:f?JSON.parse(f):void 0,query:m?R9(m.trim())??void 0:void 0,onAgentChange:_,onConnectionStatusChange:l,onUnauthorized:d,userMode:v},`${n}:${e}:${m}`)},`${n}:${e}:${m}`):(0,z.jsx)(`div`,{className:`flex size-full flex-col items-center justify-center gap-3 text-muted-foreground px-4`,children:w?(0,z.jsxs)(`p`,{className:`text-sm text-center max-w-md`,children:[`Set required WebSocket query params in the setup dialog`,x.length>0?(0,z.jsxs)(z.Fragment,{children:[`: `,(0,z.jsx)(`code`,{className:`font-mono text-xs`,children:x.join(`, `)})]}):null,`.`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`text-sm text-center`,children:`Enter an agent URL in the bar above or in the setup dialog.`}),(0,z.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground/60`,children:`e.g. http://localhost:8787/agents/my-agent`})]})})]})})]})]})}(0,Fe.createRoot)(document.getElementById(`app`)).render((0,z.jsx)(L.StrictMode,{children:(0,z.jsxs)(pp,{children:[(0,z.jsx)(ft,{}),(0,z.jsx)(Zbe,{})]})}));export{jO as a,uO as c,lD as d,uD as f,ke as h,RW as i,hD as l,yi as m,BH as n,DO as o,dw as p,PW as r,pO as s,fH as t,mD as u};
|