@copilotkit/react-core 1.51.3-next.7 → 1.51.3
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/CHANGELOG.md +26 -0
- package/dist/{chunk-BUSWSDYO.mjs → chunk-7JTI6ZL4.mjs} +2 -2
- package/dist/{chunk-GPEJNVE5.mjs → chunk-RBGVEVWY.mjs} +2 -2
- package/dist/{chunk-E7SE25ZU.mjs → chunk-SRJT5VVY.mjs} +2 -2
- package/dist/{chunk-CDUIA2WM.mjs → chunk-VGL3DGUW.mjs} +16 -13
- package/dist/chunk-VGL3DGUW.mjs.map +1 -0
- package/dist/hooks/index.js +14 -11
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -4
- package/dist/hooks/use-copilot-action.js +14 -11
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +14 -11
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-default-tool.js +14 -11
- package/dist/hooks/use-default-tool.js.map +1 -1
- package/dist/hooks/use-default-tool.mjs +3 -3
- package/dist/hooks/use-frontend-tool.js +14 -11
- package/dist/hooks/use-frontend-tool.js.map +1 -1
- package/dist/hooks/use-frontend-tool.mjs +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.umd.js +39 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/setupTests.js +2 -0
- package/dist/setupTests.js.map +1 -1
- package/dist/setupTests.mjs +2 -0
- package/dist/setupTests.mjs.map +1 -1
- package/dist/v2/index.umd.js +2 -0
- package/dist/v2/index.umd.js.map +1 -0
- package/package.json +10 -8
- package/rollup.config.mjs +92 -0
- package/src/hooks/__tests__/use-frontend-tool-remount.e2e.test.tsx +92 -0
- package/src/hooks/use-frontend-tool.ts +20 -14
- package/src/setupTests.ts +3 -0
- package/dist/chunk-CDUIA2WM.mjs.map +0 -1
- /package/dist/{chunk-BUSWSDYO.mjs.map → chunk-7JTI6ZL4.mjs.map} +0 -0
- /package/dist/{chunk-GPEJNVE5.mjs.map → chunk-RBGVEVWY.mjs.map} +0 -0
- /package/dist/{chunk-E7SE25ZU.mjs.map → chunk-SRJT5VVY.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-6ESSSQ7Q.mjs";
|
|
23
23
|
import {
|
|
24
24
|
useDefaultTool
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-7JTI6ZL4.mjs";
|
|
26
26
|
import {
|
|
27
27
|
useCoAgent
|
|
28
28
|
} from "./chunk-ZYTXB6HH.mjs";
|
|
@@ -31,16 +31,16 @@ import {
|
|
|
31
31
|
} from "./chunk-ABWT4DRT.mjs";
|
|
32
32
|
import {
|
|
33
33
|
useCopilotAuthenticatedAction_c
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-SRJT5VVY.mjs";
|
|
35
35
|
import {
|
|
36
36
|
useCopilotAction
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RBGVEVWY.mjs";
|
|
38
38
|
import {
|
|
39
39
|
useRenderToolCall
|
|
40
40
|
} from "./chunk-NBK4KBLX.mjs";
|
|
41
41
|
import {
|
|
42
42
|
useFrontendTool
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-VGL3DGUW.mjs";
|
|
44
44
|
import {
|
|
45
45
|
useHumanInTheLoop
|
|
46
46
|
} from "./chunk-7DTB7S5V.mjs";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("@copilotkitnext/react"),require("@copilotkit/shared"),require("react-dom"),require("@copilotkit/runtime-client-gql"),require("@ag-ui/client"),require("@copilotkitnext/core")):"function"==typeof define&&define.amd?define(["exports","react","@copilotkitnext/react","@copilotkit/shared","react-dom","@copilotkit/runtime-client-gql","@ag-ui/client","@copilotkitnext/core"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).CopilotKitReactCore={},e.React,e.CopilotKitNextReact,e.CopilotKitShared,e.ReactDOM,e.CopilotKitRuntimeClientGQL,e.AgUIClient,e.CopilotKitNextCore)}(this,function(e,n,t,r,o,i,l,s){"use strict";function a(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var c,d={exports:{}},f={};var p,h,g={};
|
|
2
|
+
/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.development.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/function m(){return p||(p=1,"production"!==process.env.NODE_ENV&&function(){function e(n){if(null==n)return null;if("function"==typeof n)return n.$$typeof===E?null:n.displayName||n.name||null;if("string"==typeof n)return n;switch(n){case p:return"Fragment";case m:return"Profiler";case h:return"StrictMode";case x:return"Suspense";case k:return"SuspenseList";case w:return"Activity"}if("object"==typeof n)switch("number"==typeof n.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case f:return"Portal";case v:return(n.displayName||"Context")+".Provider";case y:return(n._context.displayName||"Context")+".Consumer";case b:var t=n.render;return(n=n.displayName)||(n=""!==(n=t.displayName||t.name||"")?"ForwardRef("+n+")":"ForwardRef"),n;case C:return null!==(t=n.displayName||null)?t:e(n.type)||"Memo";case S:t=n._payload,n=n._init;try{return e(n(t))}catch(e){}}return null}function t(e){return""+e}function r(e){try{t(e);var n=!1}catch(e){n=!0}if(n){var r=(n=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),t(e)}}function o(n){if(n===p)return"<>";if("object"==typeof n&&null!==n&&n.$$typeof===S)return"<...>";try{var t=e(n);return t?"<"+t+">":"<...>"}catch(e){return"<...>"}}function i(){return Error("react-stack-top-frame")}function l(){var n=e(this.type);return T[n]||(T[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(n=this.props.ref)?n:null}function s(n,t,o,i,s,c,f,p){var h,g=t.children;if(void 0!==g)if(i)if(O(g)){for(i=0;i<g.length;i++)a(g[i]);Object.freeze&&Object.freeze(g)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else a(g);if(A.call(t,"key")){g=e(n);var m=Object.keys(t).filter(function(e){return"key"!==e});i=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",M[g+i]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',i,g,m,g),M[g+i]=!0)}if(g=null,void 0!==o&&(r(o),g=""+o),function(e){if(A.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return void 0!==e.key}(t)&&(r(t.key),g=""+t.key),"key"in t)for(var y in o={},t)"key"!==y&&(o[y]=t[y]);else o=t;return g&&function(e,n){function t(){u||(u=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(o,"function"==typeof n?n.displayName||n.name||"Unknown":n),function(e,n,t,r,o,i,s,a){return t=i.ref,e={$$typeof:d,type:e,key:n,props:i,_owner:o},null!==(void 0!==t?t:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:l}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:s}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(n,g,c,0,null===(h=I.A)?null:h.getOwner(),o,f,p)}function a(e){"object"==typeof e&&null!==e&&e.$$typeof===d&&e._store&&(e._store.validated=1)}var u,c=n,d=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),v=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),I=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,O=Array.isArray,R=console.createTask?console.createTask:function(){return null},T={},j=(c={"react-stack-bottom-frame":function(e){return e()}})["react-stack-bottom-frame"].bind(c,i)(),P=R(o(i)),M={};g.Fragment=p,g.jsx=function(e,n,t,r,i){var l=1e4>I.recentlyCreatedOwnerStacks++;return s(e,n,t,!1,0,i,l?Error("react-stack-top-frame"):j,l?R(o(e)):P)},g.jsxs=function(e,n,t,r,i){var l=1e4>I.recentlyCreatedOwnerStacks++;return s(e,n,t,!0,0,i,l?Error("react-stack-top-frame"):j,l?R(o(e)):P)}}()),g}var y=(h||(h=1,"production"===process.env.NODE_ENV?d.exports=function(){if(c)return f;c=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(n,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return t=r.ref,{$$typeof:e,type:n,key:o,ref:void 0!==t?t:null,props:r}}return f.Fragment=n,f.jsx=t,f.jsxs=t,f}():d.exports=m()),d.exports);const v={actions:{},setAction:()=>{},removeAction:()=>{},setRegisteredActions:()=>"",removeRegisteredAction:()=>{},chatComponentsCache:{current:{actions:{},coAgentStateRenders:{}}},getContextString:(e,n)=>k(),addContext:()=>"",removeContext:()=>{},getAllContext:()=>[],getFunctionCallHandler:()=>k(),isLoading:!1,setIsLoading:()=>k(),chatInstructions:"",setChatInstructions:()=>k(),additionalInstructions:[],setAdditionalInstructions:()=>k(),getDocumentsContext:e=>k(),addDocumentContext:()=>k(),removeDocumentContext:()=>{},copilotApiConfig:new class{get chatApiEndpoint(){throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!")}get headers(){return{}}get body(){return{}}},chatSuggestionConfiguration:{},addChatSuggestionConfiguration:()=>{},removeChatSuggestionConfiguration:()=>{},showDevConsole:!1,coagentStates:{},setCoagentStates:()=>{},coagentStatesRef:{current:{}},setCoagentStatesWithRef:()=>{},agentSession:null,setAgentSession:()=>{},forwardedParameters:{},agentLock:null,threadId:"",setThreadId:()=>{},runId:null,setRunId:()=>{},chatAbortControllerRef:{current:null},availableAgents:[],extensions:{},setExtensions:()=>{},interruptActions:{},setInterruptAction:()=>{},removeInterruptAction:()=>{},interruptEventQueue:{},addInterruptEvent:()=>{},resolveInterruptEvent:()=>{},onError:()=>{},bannerError:null,setBannerError:()=>{},internalErrorHandlers:{},setInternalErrorHandler:()=>{},removeInternalErrorHandler:()=>{}},b=n.createContext(v);function x(){const e=n.useContext(b);if(e===v)throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!");return e}function k(e){throw new Error("Remember to wrap your app in a `<CopilotKit> {...} </CopilotKit>` !!!")}const C=(e,n)=>e.reduce((e,t)=>{if(t.id!==n){const r=Object.assign(Object.assign({},t),{children:C(t.children,n)});e.push(r)}return e},[]),S=(e,n,t)=>t?e.map(e=>e.id===t?Object.assign(Object.assign({},e),{children:[...e.children,n]}):e.children.length?Object.assign(Object.assign({},e),{children:S(e.children,n,t)}):e):[...e,n],w=(e,n)=>0===n?(e+1).toString():1===n?String.fromCharCode(65+e):2===n?String.fromCharCode(97+e):"-",E=(e,n="",t=0)=>{const r=" ".repeat(3).repeat(t),o=n.length+r.length,i=" ".repeat(o),l=e.value.split("\n"),s=`${r}${n}${l[0]}`,a=l.slice(1).map(e=>`${i}${e}`).join("\n");let u=`${s}\n`;a&&(u+=`${a}\n`);const c=" ".repeat(n.length);return e.children.forEach((e,n)=>u+=E(e,`${c}${w(n,t+1)}. `,t+1)),u};function I(e,n){switch(n.type){case"ADD_NODE":{const{value:t,parentId:r,id:o}=n,i={id:o,value:t,children:[],categories:new Set(n.categories)};try{return S(e,i,r)}catch(n){return console.error(`Error while adding node with id ${o}: ${n}`),e}}case"REMOVE_NODE":return C(e,n.id);default:return e}}function A(e,n){switch(n.type){case"ADD_ELEMENT":{const{value:t,id:r,categories:o}=n,i={id:r,value:t,categories:new Set(o)},l=new Map(e);return l.set(r,i),l}case"REMOVE_ELEMENT":{const t=new Map(e);return t.delete(n.id),t}default:return e}}const O={messages:[],setMessages:()=>[],suggestions:[],setSuggestions:()=>[]},R=n.createContext(O);const T=n.createContext(void 0);function j(){const e=n.useContext(T);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function P({enabled:e,children:t}){const[o,i]=n.useState([]),[l,s]=n.useState(null),a=n.useCallback(e=>{i(n=>n.filter(n=>n.id!==e))},[]),u=n.useCallback(n=>{var t;if(!e)return;const r=null!==(t=n.id)&&void 0!==t?t:Math.random().toString(36).substring(2,9);i(e=>e.find(e=>e.id===r)?e:[...e,Object.assign(Object.assign({},n),{id:r})]),n.duration&&setTimeout(()=>{a(r)},n.duration)},[e,a]),c=n.useCallback(n=>{(e||null===n)&&s(n)},[e]),d={toasts:o,addToast:u,addGraphQLErrorsToast:n.useCallback(e=>{console.warn("addGraphQLErrorsToast is deprecated. All errors now show as banners.")},[]),removeToast:a,enabled:e,bannerError:l,setBannerError:c};return y.jsxs(T.Provider,{value:d,children:[l&&(()=>{const e=function(e){switch(e){case"critical":return{background:"#fee2e2",border:"#dc2626",text:"#7f1d1d",icon:"#dc2626"};case"warning":return{background:"#fef3c7",border:"#d97706",text:"#78350f",icon:"#d97706"};case"info":return{background:"#dbeafe",border:"#2563eb",text:"#1e3a8a",icon:"#2563eb"}}}(function(e){if(e.severity)switch(e.severity){case r.Severity.CRITICAL:return"critical";case r.Severity.WARNING:return"warning";case r.Severity.INFO:default:return"info"}const n=e.message.toLowerCase();return n.includes("api key")||n.includes("401")||n.includes("unauthorized")||n.includes("authentication")||n.includes("incorrect api key")?"critical":"info"}(l));return y.jsx("div",{style:{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:9999,backgroundColor:e.background,border:`1px solid ${e.border}`,borderLeft:`4px solid ${e.border}`,borderRadius:"8px",padding:"12px 16px",fontSize:"13px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",backdropFilter:"blur(8px)",maxWidth:"min(90vw, 700px)",width:"100%",boxSizing:"border-box",overflow:"hidden"},children:y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"10px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flex:1,minWidth:0},children:[y.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",backgroundColor:e.border,flexShrink:0}}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[y.jsx("div",{style:{color:e.text,lineHeight:"1.4",fontWeight:"400",fontSize:"13px",flex:1,wordBreak:"break-all",overflowWrap:"break-word",maxWidth:"550px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:10,WebkitBoxOrient:"vertical"},children:(()=>{let e=l.message;const n=e.match(/'message':\s*'([^']+)'/);return n?n[1]:(e=e.split(" - ")[0],e=e.split(": Error code")[0],e=e.replace(/:\s*\d{3}$/,""),e=e.replace(/See more:.*$/g,""),e=e.trim(),e||"Configuration error occurred.")})()}),(()=>{const n=l.message,t=/(https?:\/\/[^\s)]+)/g;let r=null,o="See More";const i=/\[([^\]]+)\]\(([^)]+)\)/g.exec(n);if(i)r=i[2],o="See More";else{const e=t.exec(n);e&&(r=e[0].replace(/[.,;:'"]*$/,""),o="See More")}return r?y.jsx("button",{onClick:()=>window.open(r,"_blank","noopener,noreferrer"),style:{background:e.border,color:"white",border:"none",borderRadius:"5px",padding:"4px 10px",fontSize:"11px",fontWeight:"500",cursor:"pointer",transition:"all 0.2s ease",flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9",e.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:e=>{e.currentTarget.style.opacity="1",e.currentTarget.style.transform="translateY(0)"},children:o}):null})()]})]}),y.jsx("button",{onClick:()=>c(null),style:{background:"transparent",border:"none",color:e.text,cursor:"pointer",padding:"2px",borderRadius:"3px",fontSize:"14px",lineHeight:"1",opacity:.6,transition:"all 0.2s ease",flexShrink:0},title:"Dismiss",onMouseEnter:e=>{e.currentTarget.style.opacity="1",e.currentTarget.style.background="rgba(0, 0, 0, 0.05)"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.6",e.currentTarget.style.background="transparent"},children:"×"})]})})})(),t]})}function M(e){return void 0!==e?e:"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname||"0.0.0.0"===window.location.hostname)}const D=n.createContext(null);function F({children:e}){const t=n.useRef([]),r=n.useRef({getMessagesFromTap:()=>t.current,updateTapMessages:e=>{t.current=e}});return y.jsx(D.Provider,{value:r.current,children:e})}function N({children:e}){const[t,o]=n.useState([]);n.useRef(void 0),n.useRef(void 0),n.useRef(void 0);const{updateTapMessages:i}=function(){const e=n.useContext(D);if(!e)throw new Error("useMessagesTap must be used inside <MessagesTapProvider>");return e}(),{threadId:l,agentSession:s,showDevConsole:a,onError:u,copilotApiConfig:c}=x(),{setBannerError:d}=j(),f=n.useCallback(async(e,n)=>{if(u&&c.publicApiKey)try{const t={type:"error",timestamp:Date.now(),context:{source:"ui",request:{operation:"loadAgentState",url:c.chatApiEndpoint,startTime:Date.now()},technical:{environment:"browser",userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0,stackTrace:n instanceof Error?n.stack:void 0}},error:e};await u(t)}catch(e){console.error("Error in CopilotMessages onError handler:",e)}},[u,c.publicApiKey,c.chatApiEndpoint]);n.useCallback(e=>{var n;if(null===(n=e.graphQLErrors)||void 0===n?void 0:n.length){const n=e=>{const n=e.extensions,t=null==n?void 0:n.visibility;if(!M(a))return void console.error("CopilotKit Error (hidden in production):",e.message);if(t===r.ErrorVisibility.SILENT)return void console.error("CopilotKit Silent Error:",e.message);const o=(e=>{const n=e.extensions,t=null==n?void 0:n.originalError;if(null==t?void 0:t.stack){if(t.stack.includes("CopilotApiDiscoveryError"))return new r.CopilotKitApiDiscoveryError({message:t.message});if(t.stack.includes("CopilotKitRemoteEndpointDiscoveryError"))return new r.CopilotKitRemoteEndpointDiscoveryError({message:t.message});if(t.stack.includes("CopilotKitAgentDiscoveryError"))return new r.CopilotKitAgentDiscoveryError({agentName:"",availableAgents:[]})}const o=(null==t?void 0:t.message)||e.message,i=null==n?void 0:n.code;return i?new r.CopilotKitError({message:o,code:i}):null})(e);if(o)d(o),f(o,e);else{const n=new r.CopilotKitError({message:e.message,code:r.CopilotKitErrorCode.UNKNOWN});d(n),f(n,e)}};e.graphQLErrors.forEach(n)}else{if(M(a)){const n=new r.CopilotKitError({message:(null==e?void 0:e.message)||String(e),code:r.CopilotKitErrorCode.UNKNOWN});d(n),f(n,e)}else console.error("CopilotKit Error (hidden in production):",e)}},[d,a,f]),n.useEffect(()=>{i(t)},[t,i]);const p=n.useMemo(()=>e,[e]),[h,g]=n.useState([]);return y.jsx(R.Provider,{value:{messages:t,setMessages:o,suggestions:h,setSuggestions:g},children:p})}function L({severity:e=r.Severity.CRITICAL,message:n="",onClose:t,actions:o}){if(!n||!e)return null;const i={[r.Severity.INFO]:{bg:"#f8fafc",border:"#e2e8f0",text:"#475569",accent:"#3b82f6"},[r.Severity.WARNING]:{bg:"#fffbeb",border:"#fbbf24",text:"#92400e",accent:"#f59e0b"},[r.Severity.CRITICAL]:{bg:"#fef2f2",border:"#fecaca",text:"#dc2626",accent:"#ef4444"}}[e];return y.jsxs(y.Fragment,{children:[y.jsx("style",{children:`\n @keyframes slideUp {\n from { opacity: 0; transform: translateX(-50%) translateY(8px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n \n .usage-banner {\n position: fixed;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n width: min(600px, calc(100vw - 32px));\n z-index: 10000;\n animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);\n }\n \n .banner-content {\n background: linear-gradient(135deg, ${i.bg} 0%, ${i.bg}f5 100%);\n border: 1px solid ${i.border};\n border-radius: 12px;\n padding: 18px 20px;\n box-shadow: \n 0 4px 24px rgba(0, 0, 0, 0.08),\n 0 2px 8px rgba(0, 0, 0, 0.04),\n inset 0 1px 0 rgba(255, 255, 255, 0.7);\n display: flex;\n align-items: center;\n gap: 16px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n backdrop-filter: blur(12px);\n position: relative;\n overflow: hidden;\n }\n \n .banner-content::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 1px;\n background: linear-gradient(90deg, transparent, ${i.accent}40, transparent);\n }\n \n .banner-message {\n color: ${i.text};\n font-size: 14px;\n line-height: 1.5;\n font-weight: 500;\n flex: 1;\n letter-spacing: -0.01em;\n }\n \n .close-btn {\n background: rgba(0, 0, 0, 0.05);\n border: none;\n color: ${i.text};\n cursor: pointer;\n padding: 0;\n border-radius: 6px;\n opacity: 0.6;\n transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);\n font-size: 14px;\n line-height: 1;\n flex-shrink: 0;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .close-btn:hover {\n opacity: 1;\n background: rgba(0, 0, 0, 0.08);\n transform: scale(1.05);\n }\n \n .btn-primary {\n background: linear-gradient(135deg, ${i.accent} 0%, ${i.accent}e6 100%);\n color: white;\n border: none;\n border-radius: 8px;\n padding: 10px 18px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);\n font-family: inherit;\n flex-shrink: 0;\n box-shadow: \n 0 2px 8px ${i.accent}30,\n inset 0 1px 0 rgba(255, 255, 255, 0.2);\n letter-spacing: -0.01em;\n }\n \n .btn-primary:hover {\n transform: translateY(-1px) scale(1.02);\n box-shadow: \n 0 4px 12px ${i.accent}40,\n inset 0 1px 0 rgba(255, 255, 255, 0.25);\n }\n \n .btn-primary:active {\n transform: translateY(0) scale(0.98);\n transition: all 0.08s cubic-bezier(0.16, 1, 0.3, 1);\n }\n \n @media (max-width: 640px) {\n .usage-banner {\n width: calc(100vw - 24px);\n }\n \n .banner-content {\n padding: 16px;\n gap: 12px;\n }\n \n .banner-message {\n font-size: 13px;\n line-height: 1.45;\n }\n \n .btn-primary {\n padding: 8px 14px;\n font-size: 12px;\n }\n \n .close-btn {\n width: 22px;\n height: 22px;\n font-size: 12px;\n }\n }\n `}),y.jsx("div",{className:"usage-banner",children:y.jsxs("div",{className:"banner-content",children:[y.jsx("div",{className:"banner-message",children:n}),(null==o?void 0:o.primary)&&y.jsx("button",{className:"btn-primary",onClick:o.primary.onClick,children:o.primary.label}),t&&y.jsx("button",{className:"close-btn",onClick:t,title:"Close",children:"×"})]})})]})}const _=e=>{switch(e.code){case r.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR:return{primary:{label:"Show me how",onClick:()=>window.open("https://docs.copilotkit.ai/premium#how-do-i-get-access-to-premium-features","_blank","noopener,noreferrer")}};case r.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR:return{primary:{label:"Upgrade",onClick:()=>window.open("https://cloud.copilotkit.ai","_blank","noopener,noreferrer")}};default:return}};const z=({className:e,style:n})=>y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`lucide lucide-circle-alert ${e||""}`,style:n,children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),y.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),$=["http","https","mailto","tel"];function B(e){const n=(e||"").trim(),t=n.charAt(0);if("#"===t||"/"===t)return n;const r=n.indexOf(":");if(-1===r)return n;let o=-1;for(;++o<$.length;){const e=$[o];if(r===e.length&&n.slice(0,e.length).toLowerCase()===e)return n}return o=n.indexOf("?"),-1!==o&&r>o?n:(o=n.indexOf("#"),-1!==o&&r>o?n:"javascript:void(0)")}
|
|
11
|
+
/*!
|
|
12
|
+
* Determine if an object is a Buffer
|
|
13
|
+
*
|
|
14
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/var U,K;var H=u(K?U:(K=1,U=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}));function V(e){return e&&"object"==typeof e?"position"in e||"type"in e?W(e.position):"start"in e||"end"in e?W(e):"line"in e||"column"in e?q(e):"":""}function q(e){return J(e&&e.line)+":"+J(e&&e.column)}function W(e){return q(e&&e.start)+"-"+q(e&&e.end)}function J(e){return e&&"number"==typeof e?e:1}class G extends Error{constructor(e,n,t){const r=[null,null];let o={start:{line:null,column:null},end:{line:null,column:null}};if(super(),"string"==typeof n&&(t=n,n=void 0),"string"==typeof t){const e=t.indexOf(":");-1===e?r[1]=t:(r[0]=t.slice(0,e),r[1]=t.slice(e+1))}n&&("type"in n||"position"in n?n.position&&(o=n.position):"start"in n||"end"in n?o=n:("line"in n||"column"in n)&&(o.start=n)),this.name=V(n)||"1:1",this.message="object"==typeof e?e.message:e,this.stack="","object"==typeof e&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=o.start.line,this.column=o.start.column,this.position=o,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}}G.prototype.file="",G.prototype.name="",G.prototype.reason="",G.prototype.message="",G.prototype.stack="",G.prototype.fatal=null,G.prototype.column=null,G.prototype.line=null,G.prototype.source=null,G.prototype.ruleId=null,G.prototype.position=null;const Y={basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');Q(e);let t,r=0,o=-1,i=e.length;if(void 0===n||0===n.length||n.length>e.length){for(;i--;)if(47===e.charCodeAt(i)){if(t){r=i+1;break}}else o<0&&(t=!0,o=i+1);return o<0?"":e.slice(r,o)}if(n===e)return"";let l=-1,s=n.length-1;for(;i--;)if(47===e.charCodeAt(i)){if(t){r=i+1;break}}else l<0&&(t=!0,l=i+1),s>-1&&(e.charCodeAt(i)===n.charCodeAt(s--)?s<0&&(o=i):(s=-1,o=l));r===o?o=l:o<0&&(o=e.length);return e.slice(r,o)},dirname:function(e){if(Q(e),0===e.length)return".";let n,t=-1,r=e.length;for(;--r;)if(47===e.charCodeAt(r)){if(n){t=r;break}}else n||(n=!0);return t<0?47===e.charCodeAt(0)?"/":".":1===t&&47===e.charCodeAt(0)?"//":e.slice(0,t)},extname:function(e){Q(e);let n,t=e.length,r=-1,o=0,i=-1,l=0;for(;t--;){const s=e.charCodeAt(t);if(47!==s)r<0&&(n=!0,r=t+1),46===s?i<0?i=t:1!==l&&(l=1):i>-1&&(l=-1);else if(n){o=t+1;break}}if(i<0||r<0||0===l||1===l&&i===r-1&&i===o+1)return"";return e.slice(i,r)},join:function(...e){let n,t=-1;for(;++t<e.length;)Q(e[t]),e[t]&&(n=void 0===n?e[t]:n+"/"+e[t]);return void 0===n?".":function(e){Q(e);const n=47===e.charCodeAt(0);let t=function(e,n){let t,r,o="",i=0,l=-1,s=0,a=-1;for(;++a<=e.length;){if(a<e.length)t=e.charCodeAt(a);else{if(47===t)break;t=47}if(47===t){if(l===a-1||1===s);else if(l!==a-1&&2===s){if(o.length<2||2!==i||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){if(r=o.lastIndexOf("/"),r!==o.length-1){r<0?(o="",i=0):(o=o.slice(0,r),i=o.length-1-o.lastIndexOf("/")),l=a,s=0;continue}}else if(o.length>0){o="",i=0,l=a,s=0;continue}n&&(o=o.length>0?o+"/..":"..",i=2)}else o.length>0?o+="/"+e.slice(l+1,a):o=e.slice(l+1,a),i=a-l-1;l=a,s=0}else 46===t&&s>-1?s++:s=-1}return o}(e,!n);0!==t.length||n||(t=".");t.length>0&&47===e.charCodeAt(e.length-1)&&(t+="/");return n?"/"+t:t}(n)},sep:"/"};function Q(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const X={cwd:function(){return"/"}};function Z(e){return null!==e&&"object"==typeof e&&e.href&&e.origin}function ee(e){if("string"==typeof e)e=new URL(e);else if(!Z(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const n=e.pathname;let t=-1;for(;++t<n.length;)if(37===n.charCodeAt(t)&&50===n.charCodeAt(t+1)){const e=n.charCodeAt(t+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(n)}(e)}const ne=["history","path","basename","stem","extname","dirname"];class te{constructor(e){let n;n=e?"string"==typeof e||function(e){return H(e)}(e)?{value:e}:Z(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd=X.cwd(),this.value,this.stored,this.result,this.map;let t,r=-1;for(;++r<ne.length;){const e=ne[r];e in n&&void 0!==n[e]&&null!==n[e]&&(this[e]="history"===e?[...n[e]]:n[e])}for(t in n)ne.includes(t)||(this[t]=n[t])}get path(){return this.history[this.history.length-1]}set path(e){Z(e)&&(e=ee(e)),oe(e,"path"),this.path!==e&&this.history.push(e)}get dirname(){return"string"==typeof this.path?Y.dirname(this.path):void 0}set dirname(e){ie(this.basename,"dirname"),this.path=Y.join(e||"",this.basename)}get basename(){return"string"==typeof this.path?Y.basename(this.path):void 0}set basename(e){oe(e,"basename"),re(e,"basename"),this.path=Y.join(this.dirname||"",e)}get extname(){return"string"==typeof this.path?Y.extname(this.path):void 0}set extname(e){if(re(e,"extname"),ie(this.dirname,"extname"),e){if(46!==e.charCodeAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Y.join(this.dirname,this.stem+(e||""))}get stem(){return"string"==typeof this.path?Y.basename(this.path,this.extname):void 0}set stem(e){oe(e,"stem"),re(e,"stem"),this.path=Y.join(this.dirname||"",e+(this.extname||""))}toString(e){return(this.value||"").toString(e||void 0)}message(e,n,t){const r=new G(e,n,t);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}info(e,n,t){const r=this.message(e,n,t);return r.fatal=null,r}fail(e,n,t){const r=this.message(e,n,t);throw r.fatal=!0,r}}function re(e,n){if(e&&e.includes(Y.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Y.sep+"`")}function oe(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function ie(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function le(e){if(e)throw e}var se,ae;var ue=function(){if(ae)return se;ae=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},i=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var r,o=e.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&e.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!o&&!i)return!1;for(r in t);return void 0===r||e.call(t,r)},l=function(e,n){t&&"__proto__"===n.name?t(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},s=function(n,t){if("__proto__"===t){if(!e.call(n,t))return;if(r)return r(n,t).value}return n[t]};return se=function e(){var n,t,r,a,u,c,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(null!=(n=arguments[f]))for(t in n)r=s(d,t),d!==(a=s(n,t))&&(h&&a&&(i(a)||(u=o(a)))?(u?(u=!1,c=r&&o(r)?r:[]):c=r&&i(r)?r:{},l(d,{name:t,newValue:e(h,c,a)})):void 0!==a&&l(d,{name:t,newValue:a}));return d},se}(),ce=u(ue);function de(e){if("object"!=typeof e||null===e)return!1;const n=Object.getPrototypeOf(e);return!(null!==n&&n!==Object.prototype&&null!==Object.getPrototypeOf(n)||Symbol.toStringTag in e||Symbol.iterator in e)}function fe(){const e=[],n={run:function(...n){let t=-1;const r=n.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function o(i,...l){const s=e[++t];let a=-1;if(i)r(i);else{for(;++a<n.length;)null!==l[a]&&void 0!==l[a]||(l[a]=n[a]);n=l,s?function(e,n){let t;return r;function r(...n){const r=e.length>n.length;let l;r&&n.push(o);try{l=e.apply(this,n)}catch(e){if(r&&t)throw e;return o(e)}r||(l&&l.then&&"function"==typeof l.then?l.then(i,o):l instanceof Error?o(l):i(l))}function o(e,...r){t||(t=!0,n(e,...r))}function i(e){o(null,e)}}(s,o)(...l):r(null,...l)}}(null,...n)},use:function(t){if("function"!=typeof t)throw new TypeError("Expected `middelware` to be a function, not "+t);return e.push(t),n}};return n}const pe=function e(){const n=fe(),t=[];let r,o={},i=-1;return l.data=function(e,n){if("string"==typeof e)return 2===arguments.length?(ve("data",r),o[e]=n,l):he.call(o,e)&&o[e]||null;if(e)return ve("data",r),o=e,l;return o},l.Parser=void 0,l.Compiler=void 0,l.freeze=function(){if(r)return l;for(;++i<t.length;){const[e,...r]=t[i];if(!1===r[0])continue;!0===r[0]&&(r[0]=void 0);const o=e.call(l,...r);"function"==typeof o&&n.use(o)}return r=!0,i=Number.POSITIVE_INFINITY,l},l.attachers=t,l.use=function(e,...n){let i;if(ve("use",r),null==e);else if("function"==typeof e)c(e,...n);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?u(e):a(e)}i&&(o.settings=Object.assign(o.settings||{},i));return l;function s(e){if("function"==typeof e)c(e);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[n,...t]=e;c(n,...t)}else a(e)}}function a(e){u(e.plugins),e.settings&&(i=Object.assign(i||{},e.settings))}function u(e){let n=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++n<e.length;){s(e[n])}}}function c(e,n){let r,o=-1;for(;++o<t.length;)if(t[o][0]===e){r=t[o];break}r?(de(r[1])&&de(n)&&(n=ce(!0,r[1],n)),r[1]=n):t.push([...arguments])}},l.parse=function(e){l.freeze();const n=ke(e),t=l.Parser;if(me("parse",t),ge(t,"parse"))return new t(String(n),n).parse();return t(String(n),n)},l.stringify=function(e,n){l.freeze();const t=ke(n),r=l.Compiler;if(ye("stringify",r),be(e),ge(r,"compile"))return new r(e,t).compile();return r(e,t)},l.run=function(e,t,r){be(e),l.freeze(),r||"function"!=typeof t||(r=t,t=void 0);if(!r)return new Promise(o);function o(o,i){function l(n,t,l){t=t||e,n?i(n):o?o(t):r(null,t,l)}n.run(e,ke(t),l)}o(null,r)},l.runSync=function(e,n){let t,r;return l.run(e,n,o),xe("runSync","run",r),t;function o(e,n){le(e),t=n,r=!0}},l.process=function(e,n){if(l.freeze(),me("process",l.Parser),ye("process",l.Compiler),!n)return new Promise(t);function t(t,r){const o=ke(e);function i(e,o){e||!o?r(e):t?t(o):n(null,o)}l.run(l.parse(o),o,(e,n,t)=>{if(!e&&n&&t){const o=l.stringify(n,t);null==o||("string"==typeof(r=o)||H(r)?t.value=o:t.result=o),i(e,t)}else i(e);var r})}t(null,n)},l.processSync=function(e){let n;l.freeze(),me("processSync",l.Parser),ye("processSync",l.Compiler);const t=ke(e);return l.process(t,r),xe("processSync","process",n),t;function r(e){n=!0,le(e)}},l;function l(){const n=e();let r=-1;for(;++r<t.length;)n.use(...t[r]);return n.data(ce(!0,{},o)),n}}().freeze(),he={}.hasOwnProperty;function ge(e,n){return"function"==typeof e&&e.prototype&&(function(e){let n;for(n in e)if(he.call(e,n))return!0;return!1}(e.prototype)||n in e.prototype)}function me(e,n){if("function"!=typeof n)throw new TypeError("Cannot `"+e+"` without `Parser`")}function ye(e,n){if("function"!=typeof n)throw new TypeError("Cannot `"+e+"` without `Compiler`")}function ve(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function be(e){if(!de(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function xe(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function ke(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new te(e)}const Ce={};function Se(e,n,t){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||t?e.value:"";if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return we(e.children,n,t)}return Array.isArray(e)?we(e,n,t):""}function we(e,n,t){const r=[];let o=-1;for(;++o<e.length;)r[o]=Se(e[o],n,t);return r.join("")}function Ee(e,n,t,r){const o=e.length;let i,l=0;if(n=n<0?-n>o?0:o+n:n>o?o:n,t=t>0?t:0,r.length<1e4)i=Array.from(r),i.unshift(n,t),e.splice(...i);else for(t&&e.splice(n,t);l<r.length;)i=r.slice(l,l+1e4),i.unshift(n,0),e.splice(...i),l+=1e4,n+=1e4}function Ie(e,n){return e.length>0?(Ee(e,e.length,0,n),e):n}const Ae={}.hasOwnProperty;function Oe(e,n){let t;for(t in n){const r=(Ae.call(e,t)?e[t]:void 0)||(e[t]={}),o=n[t];let i;if(o)for(i in o){Ae.call(r,i)||(r[i]=[]);const e=o[i];Re(r[i],Array.isArray(e)?e:e?[e]:[])}}}function Re(e,n){let t=-1;const r=[];for(;++t<n.length;)("after"===n[t].add?e:r).push(n[t]);Ee(e,0,0,r)}const Te=Ue(/[A-Za-z]/),je=Ue(/[\dA-Za-z]/),Pe=Ue(/[#-'*+\--9=?A-Z^-~]/);function Me(e){return null!==e&&(e<32||127===e)}const De=Ue(/\d/),Fe=Ue(/[\dA-Fa-f]/),Ne=Ue(/[!-/:-@[-`{-~]/);function Le(e){return null!==e&&e<-2}function _e(e){return null!==e&&(e<0||32===e)}function ze(e){return-2===e||-1===e||32===e}const $e=Ue(/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/),Be=Ue(/\s/);function Ue(e){return function(n){return null!==n&&e.test(String.fromCharCode(n))}}function Ke(e,n,t,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return function(r){if(ze(r))return e.enter(t),l(r);return n(r)};function l(r){return ze(r)&&i++<o?(e.consume(r),l):(e.exit(t),n(r))}}const He={tokenize:function(e){const n=e.attempt(this.parser.constructs.contentInitial,function(t){if(null===t)return void e.consume(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Ke(e,n,"linePrefix")},function(n){return e.enter("paragraph"),r(n)});let t;return n;function r(n){const r=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=r),t=r,o(n)}function o(n){return null===n?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(n)):Le(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),o)}}};const Ve={tokenize:function(e){const n=this,t=[];let r,o,i,l=0;return s;function s(r){if(l<t.length){const o=t[l];return n.containerState=o[1],e.attempt(o[0].continuation,a,u)(r)}return u(r)}function a(e){if(l++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,r&&v();const t=n.events.length;let o,i=t;for(;i--;)if("exit"===n.events[i][0]&&"chunkFlow"===n.events[i][1].type){o=n.events[i][1].end;break}y(l);let s=t;for(;s<n.events.length;)n.events[s][1].end=Object.assign({},o),s++;return Ee(n.events,i+1,0,n.events.slice(t)),n.events.length=s,u(e)}return s(e)}function u(o){if(l===t.length){if(!r)return f(o);if(r.currentConstruct&&r.currentConstruct.concrete)return h(o);n.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(qe,c,d)(o)}function c(e){return r&&v(),y(l),f(e)}function d(e){return n.parser.lazy[n.now().line]=l!==t.length,i=n.now().offset,h(e)}function f(t){return n.containerState={},e.attempt(qe,p,h)(t)}function p(e){return l++,t.push([n.currentConstruct,n.containerState]),f(e)}function h(t){return null===t?(r&&v(),y(0),void e.consume(t)):(r=r||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:r}),g(t))}function g(t){return null===t?(m(e.exit("chunkFlow"),!0),y(0),void e.consume(t)):Le(t)?(e.consume(t),m(e.exit("chunkFlow")),l=0,n.interrupt=void 0,s):(e.consume(t),g)}function m(e,t){const s=n.sliceStream(e);if(t&&s.push(null),e.previous=o,o&&(o.next=e),o=e,r.defineSkip(e.start),r.write(s),n.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<i&&(!r.events[e][1].end||r.events[e][1].end.offset>i))return;const t=n.events.length;let o,s,a=t;for(;a--;)if("exit"===n.events[a][0]&&"chunkFlow"===n.events[a][1].type){if(o){s=n.events[a][1].end;break}o=!0}for(y(l),e=t;e<n.events.length;)n.events[e][1].end=Object.assign({},s),e++;Ee(n.events,a+1,0,n.events.slice(t)),n.events.length=e}}function y(r){let o=t.length;for(;o-- >r;){const r=t[o];n.containerState=r[1],r[0].exit.call(n,e)}t.length=r}function v(){r.write([null]),o=void 0,r=void 0,n.containerState._closeFlow=void 0}}},qe={tokenize:function(e,n,t){return Ke(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function We(e){return null===e||_e(e)||Be(e)?1:$e(e)?2:void 0}function Je(e,n,t){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(n=i(n,t),r.push(i))}return n}const Ge={name:"attention",tokenize:function(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,o=We(r);let i;return function(n){return i=n,e.enter("attentionSequence"),l(n)};function l(s){if(s===i)return e.consume(s),l;const a=e.exit("attentionSequence"),u=We(s),c=!u||2===u&&o||t.includes(s),d=!o||2===o&&u||t.includes(r);return a._open=Boolean(42===i?c:c&&(o||!d)),a._close=Boolean(42===i?d:d&&(u||!c)),n(s)}},resolveAll:function(e,n){let t,r,o,i,l,s,a,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close)for(t=c;t--;)if("exit"===e[t][0]&&"attentionSequence"===e[t][1].type&&e[t][1]._open&&n.sliceSerialize(e[t][1]).charCodeAt(0)===n.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[t][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[t][1].end.offset-e[t][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;s=e[t][1].end.offset-e[t][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;const d=Object.assign({},e[t][1].end),f=Object.assign({},e[c][1].start);Ye(d,-s),Ye(f,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[t][1].end)},l={type:s>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[c][1].start),end:f},o={type:s>1?"strongText":"emphasisText",start:Object.assign({},e[t][1].end),end:Object.assign({},e[c][1].start)},r={type:s>1?"strong":"emphasis",start:Object.assign({},i.start),end:Object.assign({},l.end)},e[t][1].end=Object.assign({},i.start),e[c][1].start=Object.assign({},l.end),a=[],e[t][1].end.offset-e[t][1].start.offset&&(a=Ie(a,[["enter",e[t][1],n],["exit",e[t][1],n]])),a=Ie(a,[["enter",r,n],["enter",i,n],["exit",i,n],["enter",o,n]]),a=Ie(a,Je(n.parser.constructs.insideSpan.null,e.slice(t+1,c),n)),a=Ie(a,[["exit",o,n],["enter",l,n],["exit",l,n],["exit",r,n]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,a=Ie(a,[["enter",e[c][1],n],["exit",e[c][1],n]])):u=0,Ee(e,t-1,c-t+3,a),c=t+a.length-u-2;break}c=-1;for(;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e}};function Ye(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const Qe={name:"autolink",tokenize:function(e,n,t){let r=0;return function(n){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(n){return Te(n)?(e.consume(n),i):a(n)}function i(e){return 43===e||45===e||46===e||je(e)?(r=1,l(e)):a(e)}function l(n){return 58===n?(e.consume(n),r=0,s):(43===n||45===n||46===n||je(n))&&r++<32?(e.consume(n),l):(r=0,a(n))}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),n):null===r||32===r||60===r||Me(r)?t(r):(e.consume(r),s)}function a(n){return 64===n?(e.consume(n),u):Pe(n)?(e.consume(n),a):t(n)}function u(e){return je(e)?c(e):t(e)}function c(t){return 46===t?(e.consume(t),r=0,u):62===t?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.exit("autolink"),n):d(t)}function d(n){if((45===n||je(n))&&r++<63){const t=45===n?d:c;return e.consume(n),t}return t(n)}}};const Xe={tokenize:function(e,n,t){return function(n){return ze(n)?Ke(e,r,"linePrefix")(n):r(n)};function r(e){return null===e||Le(e)?n(e):t(e)}},partial:!0};const Ze={name:"blockQuote",tokenize:function(e,n,t){const r=this;return function(n){if(62===n){const t=r.containerState;return t.open||(e.enter("blockQuote",{_container:!0}),t.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(n),e.exit("blockQuoteMarker"),o}return t(n)};function o(t){return ze(t)?(e.enter("blockQuotePrefixWhitespace"),e.consume(t),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(t))}},continuation:{tokenize:function(e,n,t){const r=this;return function(n){if(ze(n))return Ke(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(n);return o(n)};function o(r){return e.attempt(Ze,n,t)(r)}}},exit:function(e){e.exit("blockQuote")}};const en={name:"characterEscape",tokenize:function(e,n,t){return function(n){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(n),e.exit("escapeMarker"),r};function r(r){return Ne(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(r)}}};const nn=document.createElement("i");function tn(e){const n="&"+e+";";nn.innerHTML=n;const t=nn.textContent;return(59!==t.charCodeAt(t.length-1)||"semi"===e)&&(t!==n&&t)}const rn={name:"characterReference",tokenize:function(e,n,t){const r=this;let o,i,l=0;return function(n){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(n),e.exit("characterReferenceMarker"),s};function s(n){return 35===n?(e.enter("characterReferenceMarkerNumeric"),e.consume(n),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),o=31,i=je,u(n))}function a(n){return 88===n||120===n?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(n),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,i=Fe,u):(e.enter("characterReferenceValue"),o=7,i=De,u(n))}function u(s){if(59===s&&l){const o=e.exit("characterReferenceValue");return i!==je||tn(r.sliceSerialize(o))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),n):t(s)}return i(s)&&l++<o?(e.consume(s),u):t(s)}}};const on={tokenize:function(e,n,t){const r=this;return function(n){if(null===n)return t(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),o};function o(e){return r.parser.lazy[r.now().line]?t(e):n(e)}},partial:!0},ln={name:"codeFenced",tokenize:function(e,n,t){const r=this,o={tokenize:function(e,n,t){let o=0;return l;function l(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),a}function a(n){return e.enter("codeFencedFence"),ze(n)?Ke(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(n):u(n)}function u(n){return n===i?(e.enter("codeFencedFenceSequence"),c(n)):t(n)}function c(n){return n===i?(o++,e.consume(n),c):o>=s?(e.exit("codeFencedFenceSequence"),ze(n)?Ke(e,d,"whitespace")(n):d(n)):t(n)}function d(r){return null===r||Le(r)?(e.exit("codeFencedFence"),n(r)):t(r)}},partial:!0};let i,l=0,s=0;return function(n){return function(n){const t=r.events[r.events.length-1];return l=t&&"linePrefix"===t[1].type?t[2].sliceSerialize(t[1],!0).length:0,i=n,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),a(n)}(n)};function a(n){return n===i?(s++,e.consume(n),a):s<3?t(n):(e.exit("codeFencedFenceSequence"),ze(n)?Ke(e,u,"whitespace")(n):u(n))}function u(t){return null===t||Le(t)?(e.exit("codeFencedFence"),r.interrupt?n(t):e.check(on,p,v)(t)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),c(t))}function c(n){return null===n||Le(n)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(n)):ze(n)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,d,"whitespace")(n)):96===n&&n===i?t(n):(e.consume(n),c)}function d(n){return null===n||Le(n)?u(n):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(n))}function f(n){return null===n||Le(n)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(n)):96===n&&n===i?t(n):(e.consume(n),f)}function p(n){return e.attempt(o,v,h)(n)}function h(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),g}function g(n){return l>0&&ze(n)?Ke(e,m,"linePrefix",l+1)(n):m(n)}function m(n){return null===n||Le(n)?e.check(on,p,v)(n):(e.enter("codeFlowValue"),y(n))}function y(n){return null===n||Le(n)?(e.exit("codeFlowValue"),m(n)):(e.consume(n),y)}function v(t){return e.exit("codeFenced"),n(t)}},concrete:!0};const sn={name:"codeIndented",tokenize:function(e,n,t){const r=this;return function(n){return e.enter("codeIndented"),Ke(e,o,"linePrefix",5)(n)};function o(e){const n=r.events[r.events.length-1];return n&&"linePrefix"===n[1].type&&n[2].sliceSerialize(n[1],!0).length>=4?i(e):t(e)}function i(n){return null===n?s(n):Le(n)?e.attempt(an,i,s)(n):(e.enter("codeFlowValue"),l(n))}function l(n){return null===n||Le(n)?(e.exit("codeFlowValue"),i(n)):(e.consume(n),l)}function s(t){return e.exit("codeIndented"),n(t)}}},an={tokenize:function(e,n,t){const r=this;return o;function o(n){return r.parser.lazy[r.now().line]?t(n):Le(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),o):Ke(e,i,"linePrefix",5)(n)}function i(e){const i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?n(e):Le(e)?o(e):t(e)}},partial:!0};const un={name:"codeText",tokenize:function(e,n,t){let r,o,i=0;return function(n){return e.enter("codeText"),e.enter("codeTextSequence"),l(n)};function l(n){return 96===n?(e.consume(n),i++,l):(e.exit("codeTextSequence"),s(n))}function s(n){return null===n?t(n):32===n?(e.enter("space"),e.consume(n),e.exit("space"),s):96===n?(o=e.enter("codeTextSequence"),r=0,u(n)):Le(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),s):(e.enter("codeTextData"),a(n))}function a(n){return null===n||32===n||96===n||Le(n)?(e.exit("codeTextData"),s(n)):(e.consume(n),a)}function u(t){return 96===t?(e.consume(t),r++,u):r===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(t)):(o.type="codeTextData",a(t))}},resolve:function(e){let n,t,r=e.length-4,o=3;if(!("lineEnding"!==e[o][1].type&&"space"!==e[o][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(n=o;++n<r;)if("codeTextData"===e[n][1].type){e[o][1].type="codeTextPadding",e[r][1].type="codeTextPadding",o+=2,r-=2;break}n=o-1,r++;for(;++n<=r;)void 0===t?n!==r&&"lineEnding"!==e[n][1].type&&(t=n):n!==r&&"lineEnding"!==e[n][1].type||(e[t][1].type="codeTextData",n!==t+2&&(e[t][1].end=e[n-1][1].end,e.splice(t+2,n-t-2),r-=n-t-2,n=t+2),t=void 0);return e},previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type}};function cn(e){const n={};let t,r,o,i,l,s,a,u=-1;for(;++u<e.length;){for(;u in n;)u=n[u];if(t=e[u],u&&"chunkFlow"===t[1].type&&"listItemPrefix"===e[u-1][1].type&&(s=t[1]._tokenizer.events,o=0,o<s.length&&"lineEndingBlank"===s[o][1].type&&(o+=2),o<s.length&&"content"===s[o][1].type))for(;++o<s.length&&"content"!==s[o][1].type;)"chunkText"===s[o][1].type&&(s[o][1]._isInFirstContentOfListItem=!0,o++);if("enter"===t[0])t[1].contentType&&(Object.assign(n,dn(e,u)),u=n[u],a=!0);else if(t[1]._container){for(o=u,r=void 0;o--&&(i=e[o],"lineEnding"===i[1].type||"lineEndingBlank"===i[1].type);)"enter"===i[0]&&(r&&(e[r][1].type="lineEndingBlank"),i[1].type="lineEnding",r=o);r&&(t[1].end=Object.assign({},e[r][1].start),l=e.slice(r,u),l.unshift(t),Ee(e,r,u-r+1,l))}}return!a}function dn(e,n){const t=e[n][1],r=e[n][2];let o=n-1;const i=[],l=t._tokenizer||r.parser[t.contentType](t.start),s=l.events,a=[],u={};let c,d,f=-1,p=t,h=0,g=0;const m=[g];for(;p;){for(;e[++o][1]!==p;);i.push(o),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),d&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(c),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=t;++f<s.length;)"exit"===s[f][0]&&"enter"===s[f-1][0]&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(g=f+1,m.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):m.pop(),f=m.length;f--;){const n=s.slice(m[f],m[f+1]),t=i.pop();a.unshift([t,t+n.length-1]),Ee(e,t,2,n)}for(f=-1;++f<a.length;)u[h+a[f][0]]=h+a[f][1],h+=a[f][1]-a[f][0]-1;return u}const fn={tokenize:function(e,n){let t;return function(n){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),r(n)};function r(n){return null===n?o(n):Le(n)?e.check(pn,i,o)(n):(e.consume(n),r)}function o(t){return e.exit("chunkContent"),e.exit("content"),n(t)}function i(n){return e.consume(n),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,r}},resolve:function(e){return cn(e),e}},pn={tokenize:function(e,n,t){const r=this;return function(n){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ke(e,o,"linePrefix")};function o(o){if(null===o||Le(o))return t(o);const i=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}},partial:!0};function hn(e,n,t,r,o,i,l,s,a){const u=a||Number.POSITIVE_INFINITY;let c=0;return function(n){if(60===n)return e.enter(r),e.enter(o),e.enter(i),e.consume(n),e.exit(i),d;if(null===n||32===n||41===n||Me(n))return t(n);return e.enter(r),e.enter(l),e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n)};function d(t){return 62===t?(e.enter(i),e.consume(t),e.exit(i),e.exit(o),e.exit(r),n):(e.enter(s),e.enter("chunkString",{contentType:"string"}),f(t))}function f(n){return 62===n?(e.exit("chunkString"),e.exit(s),d(n)):null===n||60===n||Le(n)?t(n):(e.consume(n),92===n?p:f)}function p(n){return 60===n||62===n||92===n?(e.consume(n),f):f(n)}function h(o){return c||null!==o&&41!==o&&!_e(o)?c<u&&40===o?(e.consume(o),c++,h):41===o?(e.consume(o),c--,h):null===o||32===o||40===o||Me(o)?t(o):(e.consume(o),92===o?g:h):(e.exit("chunkString"),e.exit(s),e.exit(l),e.exit(r),n(o))}function g(n){return 40===n||41===n||92===n?(e.consume(n),h):h(n)}}function gn(e,n,t,r,o,i){const l=this;let s,a=0;return function(n){return e.enter(r),e.enter(o),e.consume(n),e.exit(o),e.enter(i),u};function u(d){return a>999||null===d||91===d||93===d&&!s||94===d&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?t(d):93===d?(e.exit(i),e.enter(o),e.consume(d),e.exit(o),e.exit(r),n):Le(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(n){return null===n||91===n||93===n||Le(n)||a++>999?(e.exit("chunkString"),u(n)):(e.consume(n),s||(s=!ze(n)),92===n?d:c)}function d(n){return 91===n||92===n||93===n?(e.consume(n),a++,c):c(n)}}function mn(e,n,t,r,o,i){let l;return function(n){if(34===n||39===n||40===n)return e.enter(r),e.enter(o),e.consume(n),e.exit(o),l=40===n?41:n,s;return t(n)};function s(t){return t===l?(e.enter(o),e.consume(t),e.exit(o),e.exit(r),n):(e.enter(i),a(t))}function a(n){return n===l?(e.exit(i),s(l)):null===n?t(n):Le(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ke(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(n))}function u(n){return n===l||null===n||Le(n)?(e.exit("chunkString"),a(n)):(e.consume(n),92===n?c:u)}function c(n){return n===l||92===n?(e.consume(n),u):u(n)}}function yn(e,n){let t;return function r(o){if(Le(o))return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t=!0,r;if(ze(o))return Ke(e,r,t?"linePrefix":"lineSuffix")(o);return n(o)}}function vn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn={name:"definition",tokenize:function(e,n,t){const r=this;let o;return function(n){return e.enter("definition"),function(n){return gn.call(r,e,i,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)}(n)};function i(n){return o=vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===n?(e.enter("definitionMarker"),e.consume(n),e.exit("definitionMarker"),l):t(n)}function l(n){return _e(n)?yn(e,s)(n):s(n)}function s(n){return hn(e,a,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(n)}function a(n){return e.attempt(xn,u,u)(n)}function u(n){return ze(n)?Ke(e,c,"whitespace")(n):c(n)}function c(i){return null===i||Le(i)?(e.exit("definition"),r.parser.defined.push(o),n(i)):t(i)}}},xn={tokenize:function(e,n,t){return function(n){return _e(n)?yn(e,r)(n):t(n)};function r(n){return mn(e,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(n)}function o(n){return ze(n)?Ke(e,i,"whitespace")(n):i(n)}function i(e){return null===e||Le(e)?n(e):t(e)}},partial:!0};const kn={name:"hardBreakEscape",tokenize:function(e,n,t){return function(n){return e.enter("hardBreakEscape"),e.consume(n),r};function r(r){return Le(r)?(e.exit("hardBreakEscape"),n(r)):t(r)}}};const Cn={name:"headingAtx",tokenize:function(e,n,t){let r=0;return function(n){return e.enter("atxHeading"),function(n){return e.enter("atxHeadingSequence"),o(n)}(n)};function o(n){return 35===n&&r++<6?(e.consume(n),o):null===n||_e(n)?(e.exit("atxHeadingSequence"),i(n)):t(n)}function i(t){return 35===t?(e.enter("atxHeadingSequence"),l(t)):null===t||Le(t)?(e.exit("atxHeading"),n(t)):ze(t)?Ke(e,i,"whitespace")(t):(e.enter("atxHeadingText"),s(t))}function l(n){return 35===n?(e.consume(n),l):(e.exit("atxHeadingSequence"),i(n))}function s(n){return null===n||35===n||_e(n)?(e.exit("atxHeadingText"),i(n)):(e.consume(n),s)}},resolve:function(e,n){let t,r,o=e.length-2,i=3;"whitespace"===e[i][1].type&&(i+=2);o-2>i&&"whitespace"===e[o][1].type&&(o-=2);"atxHeadingSequence"===e[o][1].type&&(i===o-1||o-4>i&&"whitespace"===e[o-2][1].type)&&(o-=i+1===o?2:4);o>i&&(t={type:"atxHeadingText",start:e[i][1].start,end:e[o][1].end},r={type:"chunkText",start:e[i][1].start,end:e[o][1].end,contentType:"text"},Ee(e,i,o-i+1,[["enter",t,n],["enter",r,n],["exit",r,n],["exit",t,n]]));return e}};const Sn=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wn=["pre","script","style","textarea"],En={name:"htmlFlow",tokenize:function(e,n,t){const r=this;let o,i,l,s,a;return function(n){return function(n){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),u}(n)};function u(s){return 33===s?(e.consume(s),c):47===s?(e.consume(s),i=!0,p):63===s?(e.consume(s),o=3,r.interrupt?n:D):Te(s)?(e.consume(s),l=String.fromCharCode(s),h):t(s)}function c(i){return 45===i?(e.consume(i),o=2,d):91===i?(e.consume(i),o=5,s=0,f):Te(i)?(e.consume(i),o=4,r.interrupt?n:D):t(i)}function d(o){return 45===o?(e.consume(o),r.interrupt?n:D):t(o)}function f(o){const i="CDATA[";return o===i.charCodeAt(s++)?(e.consume(o),6===s?r.interrupt?n:I:f):t(o)}function p(n){return Te(n)?(e.consume(n),l=String.fromCharCode(n),h):t(n)}function h(s){if(null===s||47===s||62===s||_e(s)){const a=47===s,u=l.toLowerCase();return a||i||!wn.includes(u)?Sn.includes(l.toLowerCase())?(o=6,a?(e.consume(s),g):r.interrupt?n(s):I(s)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(s):i?m(s):y(s)):(o=1,r.interrupt?n(s):I(s))}return 45===s||je(s)?(e.consume(s),l+=String.fromCharCode(s),h):t(s)}function g(o){return 62===o?(e.consume(o),r.interrupt?n:I):t(o)}function m(n){return ze(n)?(e.consume(n),m):w(n)}function y(n){return 47===n?(e.consume(n),w):58===n||95===n||Te(n)?(e.consume(n),v):ze(n)?(e.consume(n),y):w(n)}function v(n){return 45===n||46===n||58===n||95===n||je(n)?(e.consume(n),v):b(n)}function b(n){return 61===n?(e.consume(n),x):ze(n)?(e.consume(n),b):y(n)}function x(n){return null===n||60===n||61===n||62===n||96===n?t(n):34===n||39===n?(e.consume(n),a=n,k):ze(n)?(e.consume(n),x):C(n)}function k(n){return n===a?(e.consume(n),a=null,S):null===n||Le(n)?t(n):(e.consume(n),k)}function C(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||_e(n)?b(n):(e.consume(n),C)}function S(e){return 47===e||62===e||ze(e)?y(e):t(e)}function w(n){return 62===n?(e.consume(n),E):t(n)}function E(n){return null===n||Le(n)?I(n):ze(n)?(e.consume(n),E):t(n)}function I(n){return 45===n&&2===o?(e.consume(n),T):60===n&&1===o?(e.consume(n),j):62===n&&4===o?(e.consume(n),F):63===n&&3===o?(e.consume(n),D):93===n&&5===o?(e.consume(n),M):!Le(n)||6!==o&&7!==o?null===n||Le(n)?(e.exit("htmlFlowData"),A(n)):(e.consume(n),I):(e.exit("htmlFlowData"),e.check(In,N,A)(n))}function A(n){return e.check(An,O,N)(n)}function O(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),R}function R(n){return null===n||Le(n)?A(n):(e.enter("htmlFlowData"),I(n))}function T(n){return 45===n?(e.consume(n),D):I(n)}function j(n){return 47===n?(e.consume(n),l="",P):I(n)}function P(n){if(62===n){const t=l.toLowerCase();return wn.includes(t)?(e.consume(n),F):I(n)}return Te(n)&&l.length<8?(e.consume(n),l+=String.fromCharCode(n),P):I(n)}function M(n){return 93===n?(e.consume(n),D):I(n)}function D(n){return 62===n?(e.consume(n),F):45===n&&2===o?(e.consume(n),D):I(n)}function F(n){return null===n||Le(n)?(e.exit("htmlFlowData"),N(n)):(e.consume(n),F)}function N(t){return e.exit("htmlFlow"),n(t)}},resolveTo:function(e){let n=e.length;for(;n--&&("enter"!==e[n][0]||"htmlFlow"!==e[n][1].type););n>1&&"linePrefix"===e[n-2][1].type&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2));return e},concrete:!0},In={tokenize:function(e,n,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Xe,n,t)}},partial:!0},An={tokenize:function(e,n,t){const r=this;return function(n){if(Le(n))return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),o;return t(n)};function o(e){return r.parser.lazy[r.now().line]?t(e):n(e)}},partial:!0};const On={name:"htmlText",tokenize:function(e,n,t){const r=this;let o,i,l;return function(n){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(n),s};function s(n){return 33===n?(e.consume(n),a):47===n?(e.consume(n),x):63===n?(e.consume(n),v):Te(n)?(e.consume(n),S):t(n)}function a(n){return 45===n?(e.consume(n),u):91===n?(e.consume(n),i=0,p):Te(n)?(e.consume(n),y):t(n)}function u(n){return 45===n?(e.consume(n),f):t(n)}function c(n){return null===n?t(n):45===n?(e.consume(n),d):Le(n)?(l=c,P(n)):(e.consume(n),c)}function d(n){return 45===n?(e.consume(n),f):c(n)}function f(e){return 62===e?j(e):45===e?d(e):c(e)}function p(n){const r="CDATA[";return n===r.charCodeAt(i++)?(e.consume(n),6===i?h:p):t(n)}function h(n){return null===n?t(n):93===n?(e.consume(n),g):Le(n)?(l=h,P(n)):(e.consume(n),h)}function g(n){return 93===n?(e.consume(n),m):h(n)}function m(n){return 62===n?j(n):93===n?(e.consume(n),m):h(n)}function y(n){return null===n||62===n?j(n):Le(n)?(l=y,P(n)):(e.consume(n),y)}function v(n){return null===n?t(n):63===n?(e.consume(n),b):Le(n)?(l=v,P(n)):(e.consume(n),v)}function b(e){return 62===e?j(e):v(e)}function x(n){return Te(n)?(e.consume(n),k):t(n)}function k(n){return 45===n||je(n)?(e.consume(n),k):C(n)}function C(n){return Le(n)?(l=C,P(n)):ze(n)?(e.consume(n),C):j(n)}function S(n){return 45===n||je(n)?(e.consume(n),S):47===n||62===n||_e(n)?w(n):t(n)}function w(n){return 47===n?(e.consume(n),j):58===n||95===n||Te(n)?(e.consume(n),E):Le(n)?(l=w,P(n)):ze(n)?(e.consume(n),w):j(n)}function E(n){return 45===n||46===n||58===n||95===n||je(n)?(e.consume(n),E):I(n)}function I(n){return 61===n?(e.consume(n),A):Le(n)?(l=I,P(n)):ze(n)?(e.consume(n),I):w(n)}function A(n){return null===n||60===n||61===n||62===n||96===n?t(n):34===n||39===n?(e.consume(n),o=n,O):Le(n)?(l=A,P(n)):ze(n)?(e.consume(n),A):(e.consume(n),R)}function O(n){return n===o?(e.consume(n),o=void 0,T):null===n?t(n):Le(n)?(l=O,P(n)):(e.consume(n),O)}function R(n){return null===n||34===n||39===n||60===n||61===n||96===n?t(n):47===n||62===n||_e(n)?w(n):(e.consume(n),R)}function T(e){return 47===e||62===e||_e(e)?w(e):t(e)}function j(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),n):t(r)}function P(n){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),M}function M(n){return ze(n)?Ke(e,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(n):D(n)}function D(n){return e.enter("htmlTextData"),l(n)}}};const Rn={name:"labelEnd",tokenize:function(e,n,t){const r=this;let o,i,l=r.events.length;for(;l--;)if(("labelImage"===r.events[l][1].type||"labelLink"===r.events[l][1].type)&&!r.events[l][1]._balanced){o=r.events[l][1];break}return function(n){if(!o)return t(n);if(o._inactive)return c(n);return i=r.parser.defined.includes(vn(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(n),e.exit("labelMarker"),e.exit("labelEnd"),s};function s(n){return 40===n?e.attempt(Tn,u,i?u:c)(n):91===n?e.attempt(jn,u,i?a:c)(n):i?u(n):c(n)}function a(n){return e.attempt(Pn,u,c)(n)}function u(e){return n(e)}function c(e){return o._balanced=!0,t(e)}},resolveTo:function(e,n){let t,r,o,i,l=e.length,s=0;for(;l--;)if(t=e[l][1],r){if("link"===t.type||"labelLink"===t.type&&t._inactive)break;"enter"===e[l][0]&&"labelLink"===t.type&&(t._inactive=!0)}else if(o){if("enter"===e[l][0]&&("labelImage"===t.type||"labelLink"===t.type)&&!t._balanced&&(r=l,"labelLink"!==t.type)){s=2;break}}else"labelEnd"===t.type&&(o=l);const a={type:"labelLink"===e[r][1].type?"link":"image",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[r][1].start),end:Object.assign({},e[o][1].end)},c={type:"labelText",start:Object.assign({},e[r+s+2][1].end),end:Object.assign({},e[o-2][1].start)};return i=[["enter",a,n],["enter",u,n]],i=Ie(i,e.slice(r+1,r+s+3)),i=Ie(i,[["enter",c,n]]),i=Ie(i,Je(n.parser.constructs.insideSpan.null,e.slice(r+s+4,o-3),n)),i=Ie(i,[["exit",c,n],e[o-2],e[o-1],["exit",u,n]]),i=Ie(i,e.slice(o+1)),i=Ie(i,[["exit",a,n]]),Ee(e,r,e.length,i),e},resolveAll:function(e){let n=-1;for(;++n<e.length;){const t=e[n][1];"labelImage"!==t.type&&"labelLink"!==t.type&&"labelEnd"!==t.type||(e.splice(n+1,"labelImage"===t.type?4:2),t.type="data",n++)}return e}},Tn={tokenize:function(e,n,t){return function(n){return e.enter("resource"),e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),r};function r(n){return _e(n)?yn(e,o)(n):o(n)}function o(n){return 41===n?u(n):hn(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(n)}function i(n){return _e(n)?yn(e,s)(n):u(n)}function l(e){return t(e)}function s(n){return 34===n||39===n||40===n?mn(e,a,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(n):u(n)}function a(n){return _e(n)?yn(e,u)(n):u(n)}function u(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),n):t(r)}}},jn={tokenize:function(e,n,t){const r=this;return function(n){return gn.call(r,e,o,i,"reference","referenceMarker","referenceString")(n)};function o(e){return r.parser.defined.includes(vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(e):t(e)}function i(e){return t(e)}}},Pn={tokenize:function(e,n,t){return function(n){return e.enter("reference"),e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),n):t(r)}}};const Mn={name:"labelStartImage",tokenize:function(e,n,t){const r=this;return function(n){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(n),e.exit("labelImageMarker"),o};function o(n){return 91===n?(e.enter("labelMarker"),e.consume(n),e.exit("labelMarker"),e.exit("labelImage"),i):t(n)}function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?t(e):n(e)}},resolveAll:Rn.resolveAll};const Dn={name:"labelStartLink",tokenize:function(e,n,t){const r=this;return function(n){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(n),e.exit("labelMarker"),e.exit("labelLink"),o};function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?t(e):n(e)}},resolveAll:Rn.resolveAll};const Fn={name:"lineEnding",tokenize:function(e,n){return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Ke(e,n,"linePrefix")}}};const Nn={name:"thematicBreak",tokenize:function(e,n,t){let r,o=0;return function(n){return e.enter("thematicBreak"),function(e){return r=e,i(e)}(n)};function i(i){return i===r?(e.enter("thematicBreakSequence"),l(i)):o>=3&&(null===i||Le(i))?(e.exit("thematicBreak"),n(i)):t(i)}function l(n){return n===r?(e.consume(n),o++,l):(e.exit("thematicBreakSequence"),ze(n)?Ke(e,i,"whitespace")(n):i(n))}}};const Ln={name:"list",tokenize:function(e,n,t){const r=this,o=r.events[r.events.length-1];let i=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,l=0;return function(n){const o=r.containerState.type||(42===n||43===n||45===n?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||n===r.containerState.marker:De(n)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===n||45===n?e.check(Nn,t,a)(n):a(n);if(!r.interrupt||49===n)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(n)}return t(n)};function s(n){return De(n)&&++l<10?(e.consume(n),s):(!r.interrupt||l<2)&&(r.containerState.marker?n===r.containerState.marker:41===n||46===n)?(e.exit("listItemValue"),a(n)):t(n)}function a(n){return e.enter("listItemMarker"),e.consume(n),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||n,e.check(Xe,r.interrupt?t:u,e.attempt(_n,d,c))}function u(e){return r.containerState.initialBlankLine=!0,i++,d(e)}function c(n){return ze(n)?(e.enter("listItemPrefixWhitespace"),e.consume(n),e.exit("listItemPrefixWhitespace"),d):t(n)}function d(t){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(t)}},continuation:{tokenize:function(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(Xe,o,i);function o(t){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ke(e,n,"listItemIndent",r.containerState.size+1)(t)}function i(t){return r.containerState.furtherBlankLines||!ze(t)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(t)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(zn,n,l)(t))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ke(e,e.attempt(Ln,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)}},_n={tokenize:function(e,n,t){const r=this;return Ke(e,function(e){const o=r.events[r.events.length-1];return!ze(e)&&o&&"listItemPrefixWhitespace"===o[1].type?n(e):t(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},zn={tokenize:function(e,n,t){const r=this;return Ke(e,function(e){const o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(e):t(e)},"listItemIndent",r.containerState.size+1)},partial:!0};const $n={name:"setextUnderline",tokenize:function(e,n,t){const r=this;let o;return function(n){let l,s=r.events.length;for(;s--;)if("lineEnding"!==r.events[s][1].type&&"linePrefix"!==r.events[s][1].type&&"content"!==r.events[s][1].type){l="paragraph"===r.events[s][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||l))return e.enter("setextHeadingLine"),o=n,function(n){return e.enter("setextHeadingLineSequence"),i(n)}(n);return t(n)};function i(n){return n===o?(e.consume(n),i):(e.exit("setextHeadingLineSequence"),ze(n)?Ke(e,l,"lineSuffix")(n):l(n))}function l(r){return null===r||Le(r)?(e.exit("setextHeadingLine"),n(r)):t(r)}},resolveTo:function(e,n){let t,r,o,i=e.length;for(;i--;)if("enter"===e[i][0]){if("content"===e[i][1].type){t=i;break}"paragraph"===e[i][1].type&&(r=i)}else"content"===e[i][1].type&&e.splice(i,1),o||"definition"!==e[i][1].type||(o=i);const l={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",l,n]),e.splice(o+1,0,["exit",e[t][1],n]),e[t][1].end=Object.assign({},e[o][1].end)):e[t][1]=l;return e.push(["exit",l,n]),e}};const Bn={tokenize:function(e){const n=this,t=e.attempt(Xe,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t},e.attempt(this.parser.constructs.flowInitial,r,Ke(e,e.attempt(this.parser.constructs.flow,r,e.attempt(fn,r)),"linePrefix")));return t;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n.currentConstruct=void 0,t;e.consume(r)}}};const Un={resolveAll:qn()},Kn=Vn("string"),Hn=Vn("text");function Vn(e){return{tokenize:function(n){const t=this,r=this.parser.constructs[e],o=n.attempt(r,i,l);return i;function i(e){return a(e)?o(e):l(e)}function l(e){if(null!==e)return n.enter("data"),n.consume(e),s;n.consume(e)}function s(e){return a(e)?(n.exit("data"),o(e)):(n.consume(e),s)}function a(e){if(null===e)return!0;const n=r[e];let o=-1;if(n)for(;++o<n.length;){const e=n[o];if(!e.previous||e.previous.call(t,t.previous))return!0}return!1}},resolveAll:qn("text"===e?Wn:void 0)}}function qn(e){return function(n,t){let r,o=-1;for(;++o<=n.length;)void 0===r?n[o]&&"data"===n[o][1].type&&(r=o,o++):n[o]&&"data"===n[o][1].type||(o!==r+2&&(n[r][1].end=n[o-1][1].end,n.splice(r+2,o-r-2),o=r+2),r=void 0);return e?e(n,t):n}}function Wn(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||"lineEnding"===e[t][1].type)&&"data"===e[t-1][1].type){const r=e[t-1][1],o=n.sliceStream(r);let i,l=o.length,s=-1,a=0;for(;l--;){const e=o[l];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)a++,s--;if(s)break;s=-1}else if(-2===e)i=!0,a++;else if(-1!==e){l++;break}}if(a){const o={type:t===e.length||i||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+l,_bufferIndex:l?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},o.start),r.start.offset===r.end.offset?Object.assign(r,o):(e.splice(t,0,["enter",o,n],["exit",o,n]),t+=2)}t++}return e}function Jn(e,n,t){let r=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},i=[];let l=[],s=[];const a={consume:function(e){Le(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++));u.previous=e},enter:function(e,n){const t=n||{};return t.type=e,t.start=f(),u.events.push(["enter",t,u]),s.push(t),t},exit:function(e){const n=s.pop();return n.end=f(),u.events.push(["exit",n,u]),n},attempt:m(function(e,n){y(e,n.from)}),check:m(g),interrupt:m(g,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:d,sliceSerialize:function(e,n){return function(e,n){let t=-1;const r=[];let o;for(;++t<e.length;){const i=e[t];let l;if("string"==typeof i)l=i;else switch(i){case-5:l="\r";break;case-4:l="\n";break;case-3:l="\r\n";break;case-2:l=n?" ":"\t";break;case-1:if(!n&&o)continue;l=" ";break;default:l=String.fromCharCode(i)}o=-2===i,r.push(l)}return r.join("")}(d(e),n)},now:f,defineSkip:function(e){o[e.line]=e.column,v()},write:function(e){if(l=Ie(l,e),p(),null!==l[l.length-1])return[];return y(n,0),u.events=Je(i,u.events,u),u.events}};let c=n.tokenize.call(u,a);return n.resolveAll&&i.push(n),u;function d(e){return function(e,n){const t=n.start._index,r=n.start._bufferIndex,o=n.end._index,i=n.end._bufferIndex;let l;if(t===o)l=[e[t].slice(r,i)];else{if(l=e.slice(t,o),r>-1){const e=l[0];"string"==typeof e?l[0]=e.slice(r):l.shift()}i>0&&l.push(e[o].slice(0,i))}return l}(l,e)}function f(){const{line:e,column:n,offset:t,_index:o,_bufferIndex:i}=r;return{line:e,column:n,offset:t,_index:o,_bufferIndex:i}}function p(){let e;for(;r._index<l.length;){const n=l[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;)h(n.charCodeAt(r._bufferIndex));else h(n)}}function h(e){c=c(e)}function g(e,n){n.restore()}function m(e,n){return function(t,o,i){let l,c,d,p;return Array.isArray(t)?h(t):"tokenize"in t?h([t]):function(e){return n;function n(n){const t=null!==n&&e[n],r=null!==n&&e.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(n)}}(t);function h(e){return l=e,c=0,0===e.length?i:g(e[c])}function g(e){return function(t){p=function(){const e=f(),n=u.previous,t=u.currentConstruct,o=u.events.length,i=Array.from(s);return{restore:l,from:o};function l(){r=e,u.previous=n,u.currentConstruct=t,u.events.length=o,s=i,v()}}(),d=e,e.partial||(u.currentConstruct=e);if(e.name&&u.parser.constructs.disable.null.includes(e.name))return y();return e.tokenize.call(n?Object.assign(Object.create(u),n):u,a,m,y)(t)}}function m(n){return e(d,p),o}function y(e){return p.restore(),++c<l.length?g(l[c]):i}}}function y(e,n){e.resolveAll&&!i.includes(e)&&i.push(e),e.resolve&&Ee(u.events,n,u.events.length-n,e.resolve(u.events.slice(n),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function v(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}const Gn={42:Ln,43:Ln,45:Ln,48:Ln,49:Ln,50:Ln,51:Ln,52:Ln,53:Ln,54:Ln,55:Ln,56:Ln,57:Ln,62:Ze},Yn={91:bn},Qn={[-2]:sn,[-1]:sn,32:sn},Xn={35:Cn,42:Nn,45:[$n,Nn],60:En,61:$n,95:Nn,96:ln,126:ln},Zn={38:rn,92:en},et={[-5]:Fn,[-4]:Fn,[-3]:Fn,33:Mn,38:rn,42:Ge,60:[Qe,On],91:Dn,92:[kn,en],93:Rn,95:Ge,96:un},nt={null:[Ge,Un]};var tt=Object.freeze({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Yn,disable:{null:[]},document:Gn,flow:Xn,flowInitial:Qn,insideSpan:nt,string:Zn,text:et});function rt(e){const n=function(e){const n={};let t=-1;for(;++t<e.length;)Oe(n,e[t]);return n}([tt,...(e||{}).extensions||[]]),t={defined:[],lazy:{},constructs:n,content:r(He),document:r(Ve),flow:r(Bn),string:r(Kn),text:r(Hn)};return t;function r(e){return function(n){return Jn(t,e,n)}}}const ot=/[\0\t\n\r]/g;function it(e,n){const t=Number.parseInt(e,n);return t<9||11===t||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||!(65535&~t)||65534==(65535&t)||t>1114111?"�":String.fromCharCode(t)}const lt=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function st(e,n,t){if(n)return n;if(35===t.charCodeAt(0)){const e=t.charCodeAt(1),n=120===e||88===e;return it(t.slice(n?2:1),n?16:10)}return tn(t)||e}const at={}.hasOwnProperty,ut=function(e,n,t){return"string"!=typeof n&&(t=n,n=void 0),function(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(re),autolinkProtocol:A,autolinkEmail:A,atxHeading:s(Z),blockQuote:s(J),characterEscape:A,characterReference:A,codeFenced:s(G),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(G,a),codeText:s(Y,a),codeTextData:A,data:A,codeFlowValue:A,definition:s(Q),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(X),hardBreakEscape:s(ee),hardBreakTrailing:s(ee),htmlFlow:s(ne,a),htmlFlowData:A,htmlText:s(ne,a),htmlTextData:A,image:s(te),label:a,link:s(re),listItem:s(ie),listItemValue:h,listOrdered:s(oe,p),listUnordered:s(oe),paragraph:s(le),reference:B,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Z),strong:s(se),thematicBreak:s(ue)},exit:{atxHeading:c(),atxHeadingSequence:S,autolink:c(),autolinkEmail:W,autolinkProtocol:q,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:H,codeFenced:c(v),codeFencedFence:y,codeFencedFenceInfo:g,codeFencedFenceMeta:m,codeFlowValue:O,codeIndented:c(b),codeText:c(M),codeTextData:O,data:O,definition:c(),definitionDestinationString:C,definitionLabelString:x,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(T),hardBreakTrailing:c(T),htmlFlow:c(j),htmlFlowData:O,htmlText:c(P),htmlTextData:O,image:c(F),label:L,labelText:N,lineEnding:R,link:c(D),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:U,resourceDestinationString:_,resourceTitleString:z,resource:$,setextHeading:c(I),setextHeadingLineSequence:E,setextHeadingText:w,strong:c(),thematicBreak:c()}};dt(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(e){let t={type:"root",children:[]};const r={stack:[t],tokenStack:[],config:n,enter:u,exit:d,buffer:a,resume:f,setData:i,getData:l},s=[];let c=-1;for(;++c<e.length;)if("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)if("enter"===e[c][0])s.push(c);else{c=o(e,s.pop(),c)}for(c=-1;++c<e.length;){const t=n[e[c][0]];at.call(t,e[c][1].type)&&t[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},r),e[c][1])}if(r.tokenStack.length>0){const e=r.tokenStack[r.tokenStack.length-1];(e[1]||pt).call(r,void 0,e[0])}for(t.position={start:ct(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ct(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<n.transforms.length;)t=n.transforms[c](t)||t;return t}function o(e,n,t){let r,o,i,l,s=n-1,a=-1,u=!1;for(;++s<=t;){const n=e[s];if("listUnordered"===n[1].type||"listOrdered"===n[1].type||"blockQuote"===n[1].type?("enter"===n[0]?a++:a--,l=void 0):"lineEndingBlank"===n[1].type?"enter"===n[0]&&(!r||l||a||i||(i=s),l=void 0):"linePrefix"===n[1].type||"listItemValue"===n[1].type||"listItemMarker"===n[1].type||"listItemPrefix"===n[1].type||"listItemPrefixWhitespace"===n[1].type||(l=void 0),!a&&"enter"===n[0]&&"listItemPrefix"===n[1].type||-1===a&&"exit"===n[0]&&("listUnordered"===n[1].type||"listOrdered"===n[1].type)){if(r){let l=s;for(o=void 0;l--;){const n=e[l];if("lineEnding"===n[1].type||"lineEndingBlank"===n[1].type){if("exit"===n[0])continue;o&&(e[o][1].type="lineEndingBlank",u=!0),n[1].type="lineEnding",o=l}else if("linePrefix"!==n[1].type&&"blockQuotePrefix"!==n[1].type&&"blockQuotePrefixWhitespace"!==n[1].type&&"blockQuoteMarker"!==n[1].type&&"listItemIndent"!==n[1].type)break}i&&(!o||i<o)&&(r._spread=!0),r.end=Object.assign({},o?e[o][1].start:n[1].end),e.splice(o||s,0,["exit",r,n[2]]),s++,t++}"listItemPrefix"===n[1].type&&(r={type:"listItem",_spread:!1,start:Object.assign({},n[1].start),end:void 0},e.splice(s,0,["enter",r,n[2]]),s++,t++,i=void 0,l=!0)}}return e[n][1]._spread=u,t}function i(e,n){t[e]=n}function l(e){return t[e]}function s(e,n){return t;function t(t){u.call(this,e(t),t),n&&n.call(this,t)}}function a(){this.stack.push({type:"fragment",children:[]})}function u(e,n,t){return this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([n,t]),e.position={start:ct(n.start)},e}function c(e){return n;function n(n){e&&e.call(this,n),d.call(this,n)}}function d(e,n){const t=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+V({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(n)n.call(this,e,r[0]);else{(r[1]||pt).call(this,e,r[0])}return t.position.end=ct(e.end),t}function f(){return function(e){return Se(e,"boolean"!=typeof Ce.includeImageAlt||Ce.includeImageAlt,"boolean"!=typeof Ce.includeHtml||Ce.includeHtml)}(this.stack.pop())}function p(){i("expectingFirstListItemValue",!0)}function h(e){if(l("expectingFirstListItemValue")){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),i("expectingFirstListItemValue")}}function g(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function m(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function y(){l("flowCodeInside")||(this.buffer(),i("flowCodeInside",!0))}function v(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),i("flowCodeInside")}function b(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function x(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.label=n,t.identifier=vn(this.sliceSerialize(e)).toLowerCase()}function k(){const e=this.resume();this.stack[this.stack.length-1].title=e}function C(){const e=this.resume();this.stack[this.stack.length-1].url=e}function S(e){const n=this.stack[this.stack.length-1];if(!n.depth){const t=this.sliceSerialize(e).length;n.depth=t}}function w(){i("setextHeadingSlurpLineEnding",!0)}function E(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).charCodeAt(0)?1:2}function I(){i("setextHeadingSlurpLineEnding")}function A(e){const n=this.stack[this.stack.length-1];let t=n.children[n.children.length-1];t&&"text"===t.type||(t=ae(),t.position={start:ct(e.start)},n.children.push(t)),this.stack.push(t)}function O(e){const n=this.stack.pop();n.value+=this.sliceSerialize(e),n.position.end=ct(e.end)}function R(e){const t=this.stack[this.stack.length-1];if(l("atHardBreak")){return t.children[t.children.length-1].position.end=ct(e.end),void i("atHardBreak")}!l("setextHeadingSlurpLineEnding")&&n.canContainEols.includes(t.type)&&(A.call(this,e),O.call(this,e))}function T(){i("atHardBreak",!0)}function j(){const e=this.resume();this.stack[this.stack.length-1].value=e}function P(){const e=this.resume();this.stack[this.stack.length-1].value=e}function M(){const e=this.resume();this.stack[this.stack.length-1].value=e}function D(){const e=this.stack[this.stack.length-1];if(l("inReference")){const n=l("referenceType")||"shortcut";e.type+="Reference",e.referenceType=n,delete e.url,delete e.title}else delete e.identifier,delete e.label;i("referenceType")}function F(){const e=this.stack[this.stack.length-1];if(l("inReference")){const n=l("referenceType")||"shortcut";e.type+="Reference",e.referenceType=n,delete e.url,delete e.title}else delete e.identifier,delete e.label;i("referenceType")}function N(e){const n=this.sliceSerialize(e),t=this.stack[this.stack.length-2];t.label=function(e){return e.replace(lt,st)}(n),t.identifier=vn(n).toLowerCase()}function L(){const e=this.stack[this.stack.length-1],n=this.resume(),t=this.stack[this.stack.length-1];if(i("inReference",!0),"link"===t.type){const n=e.children;t.children=n}else t.alt=n}function _(){const e=this.resume();this.stack[this.stack.length-1].url=e}function z(){const e=this.resume();this.stack[this.stack.length-1].title=e}function $(){i("inReference")}function B(){i("referenceType","collapsed")}function U(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.label=n,t.identifier=vn(this.sliceSerialize(e)).toLowerCase(),i("referenceType","full")}function K(e){i("characterReferenceType",e.type)}function H(e){const n=this.sliceSerialize(e),t=l("characterReferenceType");let r;if(t)r=it(n,"characterReferenceMarkerNumeric"===t?10:16),i("characterReferenceType");else{r=tn(n)}const o=this.stack.pop();o.value+=r,o.position.end=ct(e.end)}function q(e){O.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function W(e){O.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function J(){return{type:"blockquote",children:[]}}function G(){return{type:"code",lang:null,meta:null,value:""}}function Y(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function X(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:void 0,children:[]}}function ee(){return{type:"break"}}function ne(){return{type:"html",value:""}}function te(){return{type:"image",title:null,url:"",alt:null}}function re(){return{type:"link",title:null,url:"",children:[]}}function oe(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function ie(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function le(){return{type:"paragraph",children:[]}}function se(){return{type:"strong",children:[]}}function ae(){return{type:"text",value:""}}function ue(){return{type:"thematicBreak"}}}(t)(function(e){for(;!cn(e););return e}(rt(t).document().write(function(){let e,n=1,t="",r=!0;return function(o,i,l){const s=[];let a,u,c,d,f;for(o=t+o.toString(i),c=0,t="",r&&(65279===o.charCodeAt(0)&&c++,r=void 0);c<o.length;){if(ot.lastIndex=c,a=ot.exec(o),d=a&&void 0!==a.index?a.index:o.length,f=o.charCodeAt(d),!a){t=o.slice(c);break}if(10===f&&c===d&&e)s.push(-3),e=void 0;else switch(e&&(s.push(-5),e=void 0),c<d&&(s.push(o.slice(c,d)),n+=d-c),f){case 0:s.push(65533),n++;break;case 9:for(u=4*Math.ceil(n/4),s.push(-2);n++<u;)s.push(-1);break;case 10:s.push(-4),n=1;break;default:e=!0,n=1}c=d+1}return l&&(e&&s.push(-5),t&&s.push(t),s.push(null)),s}}()(e,n,!0))))};function ct(e){return{line:e.line,column:e.column,offset:e.offset}}function dt(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?dt(e,r):ft(e,r)}}function ft(e,n){let t;for(t in n)if(at.call(n,t))if("canContainEols"===t){const r=n[t];r&&e[t].push(...r)}else if("transforms"===t){const r=n[t];r&&e[t].push(...r)}else if("enter"===t||"exit"===t){const r=n[t];r&&Object.assign(e[t],r)}}function pt(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+V({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+V({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+V({start:n.start,end:n.end})+") is still open")}function ht(e){Object.assign(this,{Parser:n=>{const t=this.data("settings");return ut(n,Object.assign({},t,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function gt(e){const n=[];let t=-1,r=0,o=0;for(;++t<e.length;){const i=e.charCodeAt(t);let l="";if(37===i&&je(e.charCodeAt(t+1))&&je(e.charCodeAt(t+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(l=String.fromCharCode(i));else if(i>55295&&i<57344){const n=e.charCodeAt(t+1);i<56320&&n>56319&&n<57344?(l=String.fromCharCode(i,n),o=1):l="�"}else l=String.fromCharCode(i);l&&(n.push(e.slice(r,t),encodeURIComponent(l)),r=t+o+1,l=""),o&&(t+=o,o=0)}return n.join("")+e.slice(r)}function mt(e,n){const t=String(n.identifier).toUpperCase(),r=gt(t.toLowerCase()),o=e.footnoteOrder.indexOf(t);let i;-1===o?(e.footnoteOrder.push(t),e.footnoteCounts[t]=1,i=e.footnoteOrder.length):(e.footnoteCounts[t]++,i=o+1);const l=e.footnoteCounts[t],s={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fn-"+r,id:e.clobberPrefix+"fnref-"+r+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(n,s);const a={type:"element",tagName:"sup",properties:{},children:[s]};return e.patch(n,a),e.applyData(n,a)}function yt(e,n){const t=n.referenceType;let r="]";if("collapsed"===t?r+="[]":"full"===t&&(r+="["+(n.label||n.identifier)+"]"),"imageReference"===n.type)return{type:"text",value:"!["+n.alt+r};const o=e.all(n),i=o[0];i&&"text"===i.type?i.value="["+i.value:o.unshift({type:"text",value:"["});const l=o[o.length-1];return l&&"text"===l.type?l.value+=r:o.push({type:"text",value:r}),o}function vt(e){const n=e.spread;return null==n?e.children.length>1:n}const bt=kt("start"),xt=kt("end");function kt(e){return function(n){const t=n&&n.position&&n.position[e]||{};return{line:t.line||null,column:t.column||null,offset:t.offset>-1?t.offset:null}}}function Ct(e){const n=String(e),t=/\r?\n|\r/g;let r=t.exec(n),o=0;const i=[];for(;r;)i.push(St(n.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=t.exec(n);return i.push(St(n.slice(o),o>0,!1)),i.join("")}function St(e,n,t){let r=0,o=e.length;if(n){let n=e.codePointAt(r);for(;9===n||32===n;)r++,n=e.codePointAt(r)}if(t){let n=e.codePointAt(o-1);for(;9===n||32===n;)o--,n=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}const wt={blockquote:function(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)},break:function(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:"\n"}]},code:function(e,n){const t=n.value?n.value+"\n":"",r=n.lang?n.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,o={};r&&(o.className=["language-"+r]);let i={type:"element",tagName:"code",properties:o,children:[{type:"text",value:t}]};return n.meta&&(i.data={meta:n.meta}),e.patch(n,i),i=e.applyData(n,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(n,i),i},delete:function(e,n){const t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)},emphasis:function(e,n){const t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)},footnoteReference:mt,footnote:function(e,n){const t=e.footnoteById;let r=1;for(;r in t;)r++;const o=String(r);return t[o]={type:"footnoteDefinition",identifier:o,children:[{type:"paragraph",children:n.children}],position:n.position},mt(e,{type:"footnoteReference",identifier:o,position:n.position})},heading:function(e,n){const t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)},html:function(e,n){if(e.dangerous){const t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}return null},imageReference:function(e,n){const t=e.definition(n.identifier);if(!t)return yt(e,n);const r={src:gt(t.url||""),alt:n.alt};null!==t.title&&void 0!==t.title&&(r.title=t.title);const o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,o),e.applyData(n,o)},image:function(e,n){const t={src:gt(n.url)};null!==n.alt&&void 0!==n.alt&&(t.alt=n.alt),null!==n.title&&void 0!==n.title&&(t.title=n.title);const r={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,r),e.applyData(n,r)},inlineCode:function(e,n){const t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);const r={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,r),e.applyData(n,r)},linkReference:function(e,n){const t=e.definition(n.identifier);if(!t)return yt(e,n);const r={href:gt(t.url||"")};null!==t.title&&void 0!==t.title&&(r.title=t.title);const o={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,o),e.applyData(n,o)},link:function(e,n){const t={href:gt(n.url)};null!==n.title&&void 0!==n.title&&(t.title=n.title);const r={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)},listItem:function(e,n,t){const r=e.all(n),o=t?function(e){let n=!1;if("list"===e.type){n=e.spread||!1;const t=e.children;let r=-1;for(;!n&&++r<t.length;)n=vt(t[r])}return n}(t):vt(n),i={},l=[];if("boolean"==typeof n.checked){const e=r[0];let t;e&&"element"===e.type&&"p"===e.tagName?t=e:(t={type:"element",tagName:"p",properties:{},children:[]},r.unshift(t)),t.children.length>0&&t.children.unshift({type:"text",value:" "}),t.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const e=r[s];(o||0!==s||"element"!==e.type||"p"!==e.tagName)&&l.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||o?l.push(e):l.push(...e.children)}const a=r[r.length-1];a&&(o||"element"!==a.type||"p"!==a.tagName)&&l.push({type:"text",value:"\n"});const u={type:"element",tagName:"li",properties:i,children:l};return e.patch(n,u),e.applyData(n,u)},list:function(e,n){const t={},r=e.all(n);let o=-1;for("number"==typeof n.start&&1!==n.start&&(t.start=n.start);++o<r.length;){const e=r[o];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}const i={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(r,!0)};return e.patch(n,i),e.applyData(n,i)},paragraph:function(e,n){const t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)},root:function(e,n){const t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)},strong:function(e,n){const t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)},table:function(e,n){const t=e.all(n),r=t.shift(),o=[];if(r){const t={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],t),o.push(t)}if(t.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},i=bt(n.children[1]),l=xt(n.children[n.children.length-1]);i.line&&l.line&&(r.position={start:i,end:l}),o.push(r)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,i),e.applyData(n,i)},tableCell:function(e,n){const t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)},tableRow:function(e,n,t){const r=t?t.children:void 0,o=0===(r?r.indexOf(n):1)?"th":"td",i=t&&"table"===t.type?t.align:void 0,l=i?i.length:n.children.length;let s=-1;const a=[];for(;++s<l;){const t=n.children[s],r={},l=i?i[s]:void 0;l&&(r.align=l);let u={type:"element",tagName:o,properties:r,children:[]};t&&(u.children=e.all(t),e.patch(t,u),u=e.applyData(n,u)),a.push(u)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(n,u),e.applyData(n,u)},text:function(e,n){const t={type:"text",value:Ct(String(n.value))};return e.patch(n,t),e.applyData(n,t)},thematicBreak:function(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)},toml:Et,yaml:Et,definition:Et,footnoteDefinition:Et};function Et(){return null}const It=function(e){if(null==e)return Ot;if("string"==typeof e)return function(e){return At(n);function n(n){return n&&n.type===e}}(e);if("object"==typeof e)return Array.isArray(e)?function(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=It(e[t]);return At(r);function r(...e){let t=-1;for(;++t<n.length;)if(n[t].call(this,...e))return!0;return!1}}(e):function(e){return At(n);function n(n){let t;for(t in e)if(n[t]!==e[t])return!1;return!0}}(e);if("function"==typeof e)return At(e);throw new Error("Expected function, string, or object as test")};function At(e){return function(n,...t){return Boolean(n&&"object"==typeof n&&"type"in n&&Boolean(e.call(this,n,...t)))}}function Ot(){return!0}const Rt=!0,Tt=!1,jt=function(e,n,t,r){"function"==typeof n&&"function"!=typeof t&&(r=t,t=n,n=null);const o=It(n),i=r?-1:1;!function e(l,s,a){const u=l&&"object"==typeof l?l:{};if("string"==typeof u.type){const e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+l.type+(e?"<"+e+">":"")+")"})}return c;function c(){let u,c,d,f=[];if((!n||o(l,s,a[a.length-1]||null))&&(f=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[Rt,e];return[e]}(t(l,a)),f[0]===Tt))return f;if(l.children&&"skip"!==f[0])for(c=(r?l.children.length:-1)+i,d=a.concat(l);c>-1&&c<l.children.length;){if(u=e(l.children[c],c,d)(),u[0]===Tt)return u;c="number"==typeof u[1]?u[1]:c+i}return f}}(e,void 0,[])()};const Pt=function(e,n,t,r){"function"==typeof n&&"function"!=typeof t&&(r=t,t=n,n=null),jt(e,n,function(e,n){const r=n[n.length-1];return t(e,r?r.children.indexOf(e):null,r)},r)};const Mt={}.hasOwnProperty;function Dt(e){return String(e||"").toUpperCase()}const Ft={}.hasOwnProperty;function Nt(e,n){const t=n||{},r=t.allowDangerousHtml||!1,o={};return l.dangerous=r,l.clobberPrefix=void 0===t.clobberPrefix||null===t.clobberPrefix?"user-content-":t.clobberPrefix,l.footnoteLabel=t.footnoteLabel||"Footnotes",l.footnoteLabelTagName=t.footnoteLabelTagName||"h2",l.footnoteLabelProperties=t.footnoteLabelProperties||{className:["sr-only"]},l.footnoteBackLabel=t.footnoteBackLabel||"Back to content",l.unknownHandler=t.unknownHandler,l.passThrough=t.passThrough,l.handlers={...wt,...t.handlers},l.definition=function(e){const n=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Pt(e,"definition",e=>{const t=Dt(e.identifier);t&&!Mt.call(n,t)&&(n[t]=e)}),function(e){const t=Dt(e);return t&&Mt.call(n,t)?n[t]:null}}(e),l.footnoteById=o,l.footnoteOrder=[],l.footnoteCounts={},l.patch=Lt,l.applyData=_t,l.one=function(e,n){return zt(l,e,n)},l.all=function(e){return $t(l,e)},l.wrap=Bt,l.augment=i,Pt(e,"footnoteDefinition",e=>{const n=String(e.identifier).toUpperCase();Ft.call(o,n)||(o[n]=e)}),l;function i(e,n){if(e&&"data"in e&&e.data){const t=e.data;t.hName&&("element"!==n.type&&(n={type:"element",tagName:"",properties:{},children:[]}),n.tagName=t.hName),"element"===n.type&&t.hProperties&&(n.properties={...n.properties,...t.hProperties}),"children"in n&&n.children&&t.hChildren&&(n.children=t.hChildren)}if(e){const t="type"in e?e:{position:e};(function(e){return!(e&&e.position&&e.position.start&&e.position.start.line&&e.position.start.column&&e.position.end&&e.position.end.line&&e.position.end.column)})(t)||(n.position={start:bt(t),end:xt(t)})}return n}function l(e,n,t,r){return Array.isArray(t)&&(r=t,t={}),i(e,{type:"element",tagName:n,properties:t||{},children:r||[]})}}function Lt(e,n){e.position&&(n.position=function(e){return{start:bt(e),end:xt(e)}}(e))}function _t(e,n){let t=n;if(e&&e.data){const n=e.data.hName,r=e.data.hChildren,o=e.data.hProperties;"string"==typeof n&&("element"===t.type?t.tagName=n:t={type:"element",tagName:n,properties:{},children:[]}),"element"===t.type&&o&&(t.properties={...t.properties,...o}),"children"in t&&t.children&&null!=r&&(t.children=r)}return t}function zt(e,n,t){const r=n&&n.type;if(!r)throw new Error("Expected node, got `"+n+"`");return Ft.call(e.handlers,r)?e.handlers[r](e,n,t):e.passThrough&&e.passThrough.includes(r)?"children"in n?{...n,children:$t(e,n)}:n:e.unknownHandler?e.unknownHandler(e,n,t):function(e,n){const t=n.data||{},r=!("value"in n)||Ft.call(t,"hProperties")||Ft.call(t,"hChildren")?{type:"element",tagName:"div",properties:{},children:$t(e,n)}:{type:"text",value:n.value};return e.patch(n,r),e.applyData(n,r)}(e,n)}function $t(e,n){const t=[];if("children"in n){const r=n.children;let o=-1;for(;++o<r.length;){const i=zt(e,r[o],n);if(i){if(o&&"break"===r[o-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=i.value.replace(/^\s+/,"")),!Array.isArray(i)&&"element"===i.type)){const e=i.children[0];e&&"text"===e.type&&(e.value=e.value.replace(/^\s+/,""))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}function Bt(e,n){const t=[];let r=-1;for(n&&t.push({type:"text",value:"\n"});++r<e.length;)r&&t.push({type:"text",value:"\n"}),t.push(e[r]);return n&&e.length>0&&t.push({type:"text",value:"\n"}),t}function Ut(e,n){const t=Nt(e,n),r=t.one(e,null),o=function(e){const n=[];let t=-1;for(;++t<e.footnoteOrder.length;){const r=e.footnoteById[e.footnoteOrder[t]];if(!r)continue;const o=e.all(r),i=String(r.identifier).toUpperCase(),l=gt(i.toLowerCase());let s=0;const a=[];for(;++s<=e.footnoteCounts[i];){const n={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fnref-"+l+(s>1?"-"+s:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"↩"}]};s>1&&n.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(s)}]}),a.length>0&&a.push({type:"text",value:" "}),a.push(n)}const u=o[o.length-1];if(u&&"element"===u.type&&"p"===u.tagName){const e=u.children[u.children.length-1];e&&"text"===e.type?e.value+=" ":u.children.push({type:"text",value:" "}),u.children.push(...a)}else o.push(...a);const c={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+l},children:e.wrap(o,!0)};e.patch(r,c),n.push(c)}if(0!==n.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(e.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:e.footnoteLabel}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(n,!0)},{type:"text",value:"\n"}]}}(t);return o&&r.children.push({type:"text",value:"\n"},o),Array.isArray(r)?{type:"root",children:r}:r}const Kt=function(e,n){return e&&"run"in e?function(e,n){return(t,r,o)=>{e.run(Ut(t,n),r,e=>{o(e)})}}(e,n):function(e){return n=>Ut(n,e)}(e||n)};var Ht,Vt={exports:{}},qt={exports:{}},Wt={};var Jt,Gt,Yt,Qt,Xt,Zt,er,nr,tr,rr,or,ir,lr,sr,ar,ur={};
|
|
17
|
+
/** @license React v16.13.1
|
|
18
|
+
* react-is.development.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/function cr(){return Gt||(Gt=1,"production"===process.env.NODE_ENV?qt.exports=function(){if(Ht)return Wt;Ht=1;var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,t=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,a=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case n:switch(e=e.type){case a:case u:case r:case i:case o:case d:return e;default:switch(e=e&&e.$$typeof){case s:case c:case h:case p:case l:return e;default:return f}}case t:return f}}}function x(e){return b(e)===u}return Wt.AsyncMode=a,Wt.ConcurrentMode=u,Wt.ContextConsumer=s,Wt.ContextProvider=l,Wt.Element=n,Wt.ForwardRef=c,Wt.Fragment=r,Wt.Lazy=h,Wt.Memo=p,Wt.Portal=t,Wt.Profiler=i,Wt.StrictMode=o,Wt.Suspense=d,Wt.isAsyncMode=function(e){return x(e)||b(e)===a},Wt.isConcurrentMode=x,Wt.isContextConsumer=function(e){return b(e)===s},Wt.isContextProvider=function(e){return b(e)===l},Wt.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},Wt.isForwardRef=function(e){return b(e)===c},Wt.isFragment=function(e){return b(e)===r},Wt.isLazy=function(e){return b(e)===h},Wt.isMemo=function(e){return b(e)===p},Wt.isPortal=function(e){return b(e)===t},Wt.isProfiler=function(e){return b(e)===i},Wt.isStrictMode=function(e){return b(e)===o},Wt.isSuspense=function(e){return b(e)===d},Wt.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===p||e.$$typeof===l||e.$$typeof===s||e.$$typeof===c||e.$$typeof===m||e.$$typeof===y||e.$$typeof===v||e.$$typeof===g)},Wt.typeOf=b,Wt}():qt.exports=(Jt||(Jt=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,t=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,a=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case n:var g=e.type;switch(g){case a:case u:case r:case i:case o:case d:return g;default:var m=g&&g.$$typeof;switch(m){case s:case c:case h:case p:case l:return m;default:return f}}case t:return f}}}var x=a,k=u,C=s,S=l,w=n,E=c,I=r,A=h,O=p,R=t,T=i,j=o,P=d,M=!1;function D(e){return b(e)===u}ur.AsyncMode=x,ur.ConcurrentMode=k,ur.ContextConsumer=C,ur.ContextProvider=S,ur.Element=w,ur.ForwardRef=E,ur.Fragment=I,ur.Lazy=A,ur.Memo=O,ur.Portal=R,ur.Profiler=T,ur.StrictMode=j,ur.Suspense=P,ur.isAsyncMode=function(e){return M||(M=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(e)||b(e)===a},ur.isConcurrentMode=D,ur.isContextConsumer=function(e){return b(e)===s},ur.isContextProvider=function(e){return b(e)===l},ur.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},ur.isForwardRef=function(e){return b(e)===c},ur.isFragment=function(e){return b(e)===r},ur.isLazy=function(e){return b(e)===h},ur.isMemo=function(e){return b(e)===p},ur.isPortal=function(e){return b(e)===t},ur.isProfiler=function(e){return b(e)===i},ur.isStrictMode=function(e){return b(e)===o},ur.isSuspense=function(e){return b(e)===d},ur.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===i||e===o||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===p||e.$$typeof===l||e.$$typeof===s||e.$$typeof===c||e.$$typeof===m||e.$$typeof===y||e.$$typeof===v||e.$$typeof===g)},ur.typeOf=b}()),ur)),qt.exports}
|
|
25
|
+
/*
|
|
26
|
+
object-assign
|
|
27
|
+
(c) Sindre Sorhus
|
|
28
|
+
@license MIT
|
|
29
|
+
*/function dr(){if(Qt)return Yt;Qt=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;return Yt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,l,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),a=1;a<arguments.length;a++){for(var u in i=Object(arguments[a]))n.call(i,u)&&(s[u]=i[u]);if(e){l=e(i);for(var c=0;c<l.length;c++)t.call(i,l[c])&&(s[l[c]]=i[l[c]])}}return s},Yt}function fr(){if(Zt)return Xt;Zt=1;return Xt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function pr(){return nr?er:(nr=1,er=Function.call.bind(Object.prototype.hasOwnProperty))}function hr(){if(rr)return tr;rr=1;var e=function(){};if("production"!==process.env.NODE_ENV){var n=fr(),t={},r=pr();e=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}}function o(o,i,l,s,a){if("production"!==process.env.NODE_ENV)for(var u in o)if(r(o,u)){var c;try{if("function"!=typeof o[u]){var d=Error((s||"React class")+": "+l+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}c=o[u](i,u,s,l,null,n)}catch(e){c=e}if(!c||c instanceof Error||e((s||"React class")+": type specification of "+l+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in t)){t[c.message]=!0;var f=a?a():"";e("Failed "+l+" type: "+c.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(t={})},tr=o}function gr(){if(ir)return or;ir=1;var e=cr(),n=dr(),t=fr(),r=pr(),o=hr(),i=function(){};function l(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}),or=function(s,a){var u="function"==typeof Symbol&&Symbol.iterator;var c="<<anonymous>>",d={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:h(l),arrayOf:function(e){return h(function(n,r,o,i,l){if("function"!=typeof e)return new p("Property `"+l+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=n[r];if(!Array.isArray(s))return new p("Invalid "+i+" `"+l+"` of type `"+v(s)+"` supplied to `"+o+"`, expected an array.");for(var a=0;a<s.length;a++){var u=e(s,a,o,i,l+"["+a+"]",t);if(u instanceof Error)return u}return null})},element:h(function(e,n,t,r,o){var i=e[n];return s(i)?null:new p("Invalid "+r+" `"+o+"` of type `"+v(i)+"` supplied to `"+t+"`, expected a single ReactElement.")}),elementType:h(function(n,t,r,o,i){var l=n[t];return e.isValidElementType(l)?null:new p("Invalid "+o+" `"+i+"` of type `"+v(l)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return h(function(n,t,r,o,i){if(!(n[t]instanceof e)){var l=e.name||c;return new p("Invalid "+o+" `"+i+"` of type `"+(((s=n[t]).constructor&&s.constructor.name?s.constructor.name:c)+"` supplied to `")+r+"`, expected instance of `"+l+"`.")}var s;return null})},node:h(function(e,n,t,r,o){return y(e[n])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}),objectOf:function(e){return h(function(n,o,i,l,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var a=n[o],u=v(a);if("object"!==u)return new p("Invalid "+l+" `"+s+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var c in a)if(r(a,c)){var d=e(a,c,i,l,s+"."+c,t);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),l;return h(function(n,t,r,o,i){for(var l=n[t],s=0;s<e.length;s++)if(f(l,e[s]))return null;var a=JSON.stringify(e,function(e,n){return"symbol"===b(n)?String(n):n});return new p("Invalid "+o+" `"+i+"` of value `"+String(l)+"` supplied to `"+r+"`, expected one of "+a+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+x(o)+" at index "+n+"."),l}return h(function(n,o,i,l,s){for(var a=[],u=0;u<e.length;u++){var c=(0,e[u])(n,o,i,l,s,t);if(null==c)return null;c.data&&r(c.data,"expectedType")&&a.push(c.data.expectedType)}return new p("Invalid "+l+" `"+s+"` supplied to `"+i+"`"+(a.length>0?", expected one of type ["+a.join(", ")+"]":"")+".")})},shape:function(e){return h(function(n,r,o,i,l){var s=n[r],a=v(s);if("object"!==a)return new p("Invalid "+i+" `"+l+"` of type `"+a+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var c=e[u];if("function"!=typeof c)return m(o,i,l,u,b(c));var d=c(s,u,o,i,l+"."+u,t);if(d)return d}return null})},exact:function(e){return h(function(o,i,l,s,a){var u=o[i],c=v(u);if("object"!==c)return new p("Invalid "+s+" `"+a+"` of type `"+c+"` supplied to `"+l+"`, expected `object`.");var d=n({},o[i],e);for(var f in d){var h=e[f];if(r(e,f)&&"function"!=typeof h)return m(l,s,a,f,b(h));if(!h)return new p("Invalid "+s+" `"+a+"` key `"+f+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var g=h(u,f,l,s,a+"."+f,t);if(g)return g}return null})}};function f(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}function p(e,n){this.message=e,this.data=n&&"object"==typeof n?n:{},this.stack=""}function h(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function o(o,l,s,u,d,f,h){if(u=u||c,f=f||s,h!==t){if(a){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=u+":"+s;!n[m]&&r<3&&(i("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[m]=!0,r++)}}return null==l[s]?o?null===l[s]?new p("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `null`."):new p("The "+d+" `"+f+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(l,s,u,d,f)}var l=o.bind(null,!1);return l.isRequired=o.bind(null,!0),l}function g(e){return h(function(n,t,r,o,i,l){var s=n[t];return v(s)!==e?new p("Invalid "+o+" `"+i+"` of type `"+b(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null})}function m(e,n,t,r,o){return new p((e||"React class")+": "+n+" type `"+t+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function y(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(y);if(null===e||s(e))return!0;var n=function(e){var n=e&&(u&&e[u]||e["@@iterator"]);if("function"==typeof n)return n}(e);if(!n)return!1;var t,r=n.call(e);if(n!==e.entries){for(;!(t=r.next()).done;)if(!y(t.value))return!1}else for(;!(t=r.next()).done;){var o=t.value;if(o&&!y(o[1]))return!1}return!0;default:return!1}}function v(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,n){return"symbol"===e||!!n&&("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}(n,e)?"symbol":n}function b(e){if(null==e)return""+e;var n=v(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function x(e){var n=b(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}return p.prototype=Error.prototype,d.checkPropTypes=o,d.resetWarningCache=o.resetWarningCache,d.PropTypes=d,d},or}function mr(){if(sr)return lr;sr=1;var e=fr();function n(){}function t(){}return t.resetWarningCache=n,lr=function(){function r(n,t,r,o,i,l){if(l!==e){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function o(){return r}r.isRequired=r;var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:t,resetWarningCache:n};return i.PropTypes=i,i}}function yr(){if(ar)return Vt.exports;if(ar=1,"production"!==process.env.NODE_ENV){var e=cr();Vt.exports=gr()(e.isElement,true)}else Vt.exports=mr()();return Vt.exports}var vr=u(yr());class br{constructor(e,n,t){this.property=e,this.normal=n,t&&(this.space=t)}}function xr(e,n){const t={},r={};let o=-1;for(;++o<e.length;)Object.assign(t,e[o].property),Object.assign(r,e[o].normal);return new br(t,r,n)}function kr(e){return e.toLowerCase()}br.prototype.property={},br.prototype.normal={},br.prototype.space=null;class Cr{constructor(e,n){this.property=e,this.attribute=n}}Cr.prototype.space=null,Cr.prototype.boolean=!1,Cr.prototype.booleanish=!1,Cr.prototype.overloadedBoolean=!1,Cr.prototype.number=!1,Cr.prototype.commaSeparated=!1,Cr.prototype.spaceSeparated=!1,Cr.prototype.commaOrSpaceSeparated=!1,Cr.prototype.mustUseProperty=!1,Cr.prototype.defined=!1;let Sr=0;const wr=jr(),Er=jr(),Ir=jr(),Ar=jr(),Or=jr(),Rr=jr(),Tr=jr();function jr(){return 2**++Sr}var Pr=Object.freeze({__proto__:null,boolean:wr,booleanish:Er,commaOrSpaceSeparated:Tr,commaSeparated:Rr,number:Ar,overloadedBoolean:Ir,spaceSeparated:Or});const Mr=Object.keys(Pr);class Dr extends Cr{constructor(e,n,t,r){let o=-1;if(super(e,n),Fr(this,"space",r),"number"==typeof t)for(;++o<Mr.length;){const e=Mr[o];Fr(this,Mr[o],(t&Pr[e])===Pr[e])}}}function Fr(e,n,t){t&&(e[n]=t)}Dr.prototype.defined=!0;const Nr={}.hasOwnProperty;function Lr(e){const n={},t={};let r;for(r in e.properties)if(Nr.call(e.properties,r)){const o=e.properties[r],i=new Dr(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),n[r]=i,t[kr(r)]=r,t[kr(i.attribute)]=r}return new br(n,t,e.space)}const _r=Lr({space:"xlink",transform:(e,n)=>"xlink:"+n.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),zr=Lr({space:"xml",transform:(e,n)=>"xml:"+n.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function $r(e,n){return n in e?e[n]:n}function Br(e,n){return $r(e,n.toLowerCase())}const Ur=Lr({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Br,properties:{xmlns:null,xmlnsXLink:null}}),Kr=Lr({transform:(e,n)=>"role"===n?n:"aria-"+n.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Er,ariaAutoComplete:null,ariaBusy:Er,ariaChecked:Er,ariaColCount:Ar,ariaColIndex:Ar,ariaColSpan:Ar,ariaControls:Or,ariaCurrent:null,ariaDescribedBy:Or,ariaDetails:null,ariaDisabled:Er,ariaDropEffect:Or,ariaErrorMessage:null,ariaExpanded:Er,ariaFlowTo:Or,ariaGrabbed:Er,ariaHasPopup:null,ariaHidden:Er,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Or,ariaLevel:Ar,ariaLive:null,ariaModal:Er,ariaMultiLine:Er,ariaMultiSelectable:Er,ariaOrientation:null,ariaOwns:Or,ariaPlaceholder:null,ariaPosInSet:Ar,ariaPressed:Er,ariaReadOnly:Er,ariaRelevant:null,ariaRequired:Er,ariaRoleDescription:Or,ariaRowCount:Ar,ariaRowIndex:Ar,ariaRowSpan:Ar,ariaSelected:Er,ariaSetSize:Ar,ariaSort:null,ariaValueMax:Ar,ariaValueMin:Ar,ariaValueNow:Ar,ariaValueText:null,role:null}}),Hr=Lr({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Br,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rr,acceptCharset:Or,accessKey:Or,action:null,allow:null,allowFullScreen:wr,allowPaymentRequest:wr,allowUserMedia:wr,alt:null,as:null,async:wr,autoCapitalize:null,autoComplete:Or,autoFocus:wr,autoPlay:wr,blocking:Or,capture:null,charSet:null,checked:wr,cite:null,className:Or,cols:Ar,colSpan:null,content:null,contentEditable:Er,controls:wr,controlsList:Or,coords:Ar|Rr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wr,defer:wr,dir:null,dirName:null,disabled:wr,download:Ir,draggable:Er,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wr,formTarget:null,headers:Or,height:Ar,hidden:wr,high:Ar,href:null,hrefLang:null,htmlFor:Or,httpEquiv:Or,id:null,imageSizes:null,imageSrcSet:null,inert:wr,inputMode:null,integrity:null,is:null,isMap:wr,itemId:null,itemProp:Or,itemRef:Or,itemScope:wr,itemType:Or,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wr,low:Ar,manifest:null,max:null,maxLength:Ar,media:null,method:null,min:null,minLength:Ar,multiple:wr,muted:wr,name:null,nonce:null,noModule:wr,noValidate:wr,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:wr,optimum:Ar,pattern:null,ping:Or,placeholder:null,playsInline:wr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wr,referrerPolicy:null,rel:Or,required:wr,reversed:wr,rows:Ar,rowSpan:Ar,sandbox:Or,scope:null,scoped:wr,seamless:wr,selected:wr,shadowRootClonable:wr,shadowRootDelegatesFocus:wr,shadowRootMode:null,shape:null,size:Ar,sizes:null,slot:null,span:Ar,spellCheck:Er,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ar,step:null,style:null,tabIndex:Ar,target:null,title:null,translate:null,type:null,typeMustMatch:wr,useMap:null,value:Er,width:Ar,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Or,axis:null,background:null,bgColor:null,border:Ar,borderColor:null,bottomMargin:Ar,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wr,declare:wr,event:null,face:null,frame:null,frameBorder:null,hSpace:Ar,leftMargin:Ar,link:null,longDesc:null,lowSrc:null,marginHeight:Ar,marginWidth:Ar,noResize:wr,noHref:wr,noShade:wr,noWrap:wr,object:null,profile:null,prompt:null,rev:null,rightMargin:Ar,rules:null,scheme:null,scrolling:Er,standby:null,summary:null,text:null,topMargin:Ar,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ar,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wr,disableRemotePlayback:wr,prefix:null,property:null,results:Ar,security:null,unselectable:null}}),Vr=Lr({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:$r,properties:{about:Tr,accentHeight:Ar,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ar,amplitude:Ar,arabicForm:null,ascent:Ar,attributeName:null,attributeType:null,azimuth:Ar,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ar,by:null,calcMode:null,capHeight:Ar,className:Or,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ar,diffuseConstant:Ar,direction:null,display:null,dur:null,divisor:Ar,dominantBaseline:null,download:wr,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ar,enableBackground:null,end:null,event:null,exponent:Ar,externalResourcesRequired:null,fill:null,fillOpacity:Ar,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rr,g2:Rr,glyphName:Rr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ar,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ar,horizOriginX:Ar,horizOriginY:Ar,id:null,ideographic:Ar,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ar,k:Ar,k1:Ar,k2:Ar,k3:Ar,k4:Ar,kernelMatrix:Tr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ar,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ar,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ar,overlineThickness:Ar,paintOrder:null,panose1:null,path:null,pathLength:Ar,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Or,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ar,pointsAtY:Ar,pointsAtZ:Ar,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tr,rev:Tr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tr,requiredFeatures:Tr,requiredFonts:Tr,requiredFormats:Tr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ar,specularExponent:Ar,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ar,strikethroughThickness:Ar,string:null,stroke:null,strokeDashArray:Tr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ar,strokeOpacity:Ar,strokeWidth:null,style:null,surfaceScale:Ar,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tr,tabIndex:Ar,tableValues:null,target:null,targetX:Ar,targetY:Ar,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ar,underlineThickness:Ar,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ar,values:null,vAlphabetic:Ar,vMathematical:Ar,vectorEffect:null,vHanging:Ar,vIdeographic:Ar,version:null,vertAdvY:Ar,vertOriginX:Ar,vertOriginY:Ar,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ar,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),qr=/^data[-\w.:]+$/i,Wr=/-[a-z]/g,Jr=/[A-Z]/g;function Gr(e){return"-"+e.toLowerCase()}function Yr(e){return e.charAt(1).toUpperCase()}const Qr={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Xr=xr([zr,_r,Ur,Kr,Hr],"html"),Zr=xr([zr,_r,Ur,Kr,Vr],"svg");function eo(e){if(e.allowedElements&&e.disallowedElements)throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(e.allowedElements||e.disallowedElements||e.allowElement)return n=>{Pt(n,"element",(n,t,r)=>{const o=r;let i;if(e.allowedElements?i=!e.allowedElements.includes(n.tagName):e.disallowedElements&&(i=e.disallowedElements.includes(n.tagName)),!i&&e.allowElement&&"number"==typeof t&&(i=!e.allowElement(n,t,o)),i&&"number"==typeof t)return e.unwrapDisallowed&&n.children?o.children.splice(t,1,...n.children):o.children.splice(t,1),t})}}var no,to={exports:{}},ro={};var oo,io,lo={};
|
|
30
|
+
/**
|
|
31
|
+
* @license React
|
|
32
|
+
* react-is.development.js
|
|
33
|
+
*
|
|
34
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/var so=u((io||(io=1,"production"===process.env.NODE_ENV?to.exports=function(){if(no)return ro;no=1;var e,n=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen");function g(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case n:switch(e=e.type){case r:case i:case o:case c:case d:return e;default:switch(e=e&&e.$$typeof){case a:case s:case u:case p:case f:case l:return e;default:return h}}case t:return h}}}return e=Symbol.for("react.module.reference"),ro.ContextConsumer=s,ro.ContextProvider=l,ro.Element=n,ro.ForwardRef=u,ro.Fragment=r,ro.Lazy=p,ro.Memo=f,ro.Portal=t,ro.Profiler=i,ro.StrictMode=o,ro.Suspense=c,ro.SuspenseList=d,ro.isAsyncMode=function(){return!1},ro.isConcurrentMode=function(){return!1},ro.isContextConsumer=function(e){return g(e)===s},ro.isContextProvider=function(e){return g(e)===l},ro.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},ro.isForwardRef=function(e){return g(e)===u},ro.isFragment=function(e){return g(e)===r},ro.isLazy=function(e){return g(e)===p},ro.isMemo=function(e){return g(e)===f},ro.isPortal=function(e){return g(e)===t},ro.isProfiler=function(e){return g(e)===i},ro.isStrictMode=function(e){return g(e)===o},ro.isSuspense=function(e){return g(e)===c},ro.isSuspenseList=function(e){return g(e)===d},ro.isValidElementType=function(n){return"string"==typeof n||"function"==typeof n||n===r||n===i||n===o||n===c||n===d||n===h||"object"==typeof n&&null!==n&&(n.$$typeof===p||n.$$typeof===f||n.$$typeof===l||n.$$typeof===s||n.$$typeof===u||n.$$typeof===e||void 0!==n.getModuleId)},ro.typeOf=g,ro}():to.exports=(oo||(oo=1,"production"!==process.env.NODE_ENV&&function(){var e,n=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen");function g(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case n:var g=e.type;switch(g){case r:case i:case o:case c:case d:return g;default:var m=g&&g.$$typeof;switch(m){case a:case s:case u:case p:case f:case l:return m;default:return h}}case t:return h}}}e=Symbol.for("react.module.reference");var m=s,y=l,v=n,b=u,x=r,k=p,C=f,S=t,w=i,E=o,I=c,A=d,O=!1,R=!1;lo.ContextConsumer=m,lo.ContextProvider=y,lo.Element=v,lo.ForwardRef=b,lo.Fragment=x,lo.Lazy=k,lo.Memo=C,lo.Portal=S,lo.Profiler=w,lo.StrictMode=E,lo.Suspense=I,lo.SuspenseList=A,lo.isAsyncMode=function(e){return O||(O=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},lo.isConcurrentMode=function(e){return R||(R=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},lo.isContextConsumer=function(e){return g(e)===s},lo.isContextProvider=function(e){return g(e)===l},lo.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},lo.isForwardRef=function(e){return g(e)===u},lo.isFragment=function(e){return g(e)===r},lo.isLazy=function(e){return g(e)===p},lo.isMemo=function(e){return g(e)===f},lo.isPortal=function(e){return g(e)===t},lo.isProfiler=function(e){return g(e)===i},lo.isStrictMode=function(e){return g(e)===o},lo.isSuspense=function(e){return g(e)===c},lo.isSuspenseList=function(e){return g(e)===d},lo.isValidElementType=function(n){return"string"==typeof n||"function"==typeof n||n===r||n===i||n===o||n===c||n===d||n===h||"object"==typeof n&&null!==n&&(n.$$typeof===p||n.$$typeof===f||n.$$typeof===l||n.$$typeof===s||n.$$typeof===u||n.$$typeof===e||void 0!==n.getModuleId)},lo.typeOf=g}()),lo)),to.exports));function ao(e){const n=e&&"object"==typeof e&&"text"===e.type?e.value||"":e;return"string"==typeof n&&""===n.replace(/[ \t\n\f\r]/g,"")}var uo,co,fo,po={exports:{}};var ho=function(){if(fo)return po.exports;fo=1;var e=function(){if(co)return uo;co=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,a="";function u(e){return e?e.replace(s,a):a}return uo=function(s,c){if("string"!=typeof s)throw new TypeError("First argument must be a string");if(!s)return[];c=c||{};var d=1,f=1;function p(e){var t=e.match(n);t&&(d+=t.length);var r=e.lastIndexOf("\n");f=~r?e.length-r:f+e.length}function h(){var e={line:d,column:f};return function(n){return n.position=new g(e),v(),n}}function g(e){this.start=e,this.end={line:d,column:f},this.source=c.source}function m(e){var n=new Error(c.source+":"+d+":"+f+": "+e);if(n.reason=e,n.filename=c.source,n.line=d,n.column=f,n.source=s,!c.silent)throw n}function y(e){var n=e.exec(s);if(n){var t=n[0];return p(t),s=s.slice(t.length),n}}function v(){y(t)}function b(e){var n;for(e=e||[];n=x();)!1!==n&&e.push(n);return e}function x(){var e=h();if("/"==s.charAt(0)&&"*"==s.charAt(1)){for(var n=2;a!=s.charAt(n)&&("*"!=s.charAt(n)||"/"!=s.charAt(n+1));)++n;if(n+=2,a===s.charAt(n-1))return m("End of comment missing");var t=s.slice(2,n-2);return f+=2,p(t),s=s.slice(n),f+=2,e({type:"comment",comment:t})}}function k(){var n=h(),t=y(r);if(t){if(x(),!y(o))return m("property missing ':'");var s=y(i),c=n({type:"declaration",property:u(t[0].replace(e,a)),value:s?u(s[0].replace(e,a)):a});return y(l),c}}return g.prototype.content=s,v(),function(){var e,n=[];for(b(n);e=k();)!1!==e&&(n.push(e),b(n));return n}()},uo}();function n(n,t){var r,o=null;if(!n||"string"!=typeof n)return o;for(var i,l,s=e(n),a="function"==typeof t,u=0,c=s.length;u<c;u++)i=(r=s[u]).property,l=r.value,a?t(i,l,r):l&&(o||(o={}),o[i]=l);return o}return po.exports=n,po.exports.default=n,po.exports}(),go=u(ho);const mo={}.hasOwnProperty,yo=new Set(["table","thead","tbody","tfoot","tr"]);function vo(e,n){const t=[];let r,o=-1;for(;++o<n.children.length;)r=n.children[o],"element"===r.type?t.push(bo(e,r,o,n)):"text"===r.type?"element"===n.type&&yo.has(n.tagName)&&ao(r)||t.push(r.value):"raw"!==r.type||e.options.skipHtml||t.push(r.value);return t}function bo(e,t,r,o){const i=e.options,l=void 0===i.transformLinkUri?B:i.transformLinkUri,s=e.schema,a=t.tagName,u={};let c,d=s;if("html"===s.space&&"svg"===a&&(d=Zr,e.schema=d),t.properties)for(c in t.properties)mo.call(t.properties,c)&&ko(u,c,t.properties[c],e);"ol"!==a&&"ul"!==a||e.listDepth++;const f=vo(e,t);"ol"!==a&&"ul"!==a||e.listDepth--,e.schema=s;const p=t.position||{start:{line:null,column:null,offset:null},end:{line:null,column:null,offset:null}},h=i.components&&mo.call(i.components,a)?i.components[a]:a,g="string"==typeof h||h===n.Fragment;if(!so.isValidElementType(h))throw new TypeError(`Component for name \`${a}\` not defined or is not renderable`);if(u.key=r,"a"===a&&i.linkTarget&&(u.target="function"==typeof i.linkTarget?i.linkTarget(String(u.href||""),t.children,"string"==typeof u.title?u.title:null):i.linkTarget),"a"===a&&l&&(u.href=l(String(u.href||""),t.children,"string"==typeof u.title?u.title:null)),g||"code"!==a||"element"!==o.type||"pre"===o.tagName||(u.inline=!0),g||"h1"!==a&&"h2"!==a&&"h3"!==a&&"h4"!==a&&"h5"!==a&&"h6"!==a||(u.level=Number.parseInt(a.charAt(1),10)),"img"===a&&i.transformImageUri&&(u.src=i.transformImageUri(String(u.src||""),String(u.alt||""),"string"==typeof u.title?u.title:null)),!g&&"li"===a&&"element"===o.type){const e=function(e){let n=-1;for(;++n<e.children.length;){const t=e.children[n];if("element"===t.type&&"input"===t.tagName)return t}return null}(t);u.checked=e&&e.properties?Boolean(e.properties.checked):null,u.index=xo(o,t),u.ordered="ol"===o.tagName}var m;return g||"ol"!==a&&"ul"!==a||(u.ordered="ol"===a,u.depth=e.listDepth),"td"!==a&&"th"!==a||(u.align&&(u.style||(u.style={}),u.style.textAlign=u.align,delete u.align),g||(u.isHeader="th"===a)),g||"tr"!==a||"element"!==o.type||(u.isHeader=Boolean("thead"===o.tagName)),i.sourcePos&&(u["data-sourcepos"]=[(m=p).start.line,":",m.start.column,"-",m.end.line,":",m.end.column].map(String).join("")),!g&&i.rawSourcePos&&(u.sourcePosition=t.position),!g&&i.includeElementIndex&&(u.index=xo(o,t),u.siblingCount=xo(o)),g||(u.node=t),f.length>0?n.createElement(h,u,f):n.createElement(h,u)}function xo(e,n){let t=-1,r=0;for(;++t<e.children.length&&e.children[t]!==n;)"element"===e.children[t].type&&r++;return r}function ko(e,n,t,r){const o=function(e,n){const t=kr(n);let r=n,o=Cr;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&"data"===t.slice(0,4)&&qr.test(n)){if("-"===n.charAt(4)){const e=n.slice(5).replace(Wr,Yr);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=n.slice(4);if(!Wr.test(e)){let t=e.replace(Jr,Gr);"-"!==t.charAt(0)&&(t="-"+t),n="data"+t}}o=Dr}return new o(r,n)}(r.schema,n);let i=t;null!=i&&i==i&&(Array.isArray(i)&&(i=o.commaSeparated?function(e){const n={};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(i):i.join(" ").trim()),"style"===o.property&&"string"==typeof i&&(i=function(e){const n={};try{go(e,t)}catch{}return n;function t(e,t){const r="-ms-"===e.slice(0,4)?`ms-${e.slice(4)}`:e;n[r.replace(/-([a-z])/g,Co)]=t}}(i)),o.space&&o.property?e[mo.call(Qr,o.property)?Qr[o.property]:o.property]=i:o.attribute&&(e[o.attribute]=i))}function Co(e,n){return n.toUpperCase()}const So={}.hasOwnProperty,wo={plugins:{to:"remarkPlugins",id:"change-plugins-to-remarkplugins"},renderers:{to:"components",id:"change-renderers-to-components"},astPlugins:{id:"remove-buggy-html-in-markdown-parser"},allowDangerousHtml:{id:"remove-buggy-html-in-markdown-parser"},escapeHtml:{id:"remove-buggy-html-in-markdown-parser"},source:{to:"children",id:"change-source-to-children"},allowNode:{to:"allowElement",id:"replace-allownode-allowedtypes-and-disallowedtypes"},allowedTypes:{to:"allowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},disallowedTypes:{to:"disallowedElements",id:"replace-allownode-allowedtypes-and-disallowedtypes"},includeNodeIndex:{to:"includeElementIndex",id:"change-includenodeindex-to-includeelementindex"}};function Eo(e){for(const n in wo)if(So.call(wo,n)&&So.call(e,n)){const e=wo[n];console.warn(`[react-markdown] Warning: please ${e.to?`use \`${e.to}\` instead of`:"remove"} \`${n}\` (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#${e.id}> for more info)`),delete wo[n]}const t=pe().use(ht).use(e.remarkPlugins||[]).use(Kt,{...e.remarkRehypeOptions,allowDangerousHtml:!0}).use(e.rehypePlugins||[]).use(eo,e),r=new te;"string"==typeof e.children?r.value=e.children:void 0!==e.children&&null!==e.children&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${e.children}\`)`);const o=t.runSync(t.parse(r),r);if("root"!==o.type)throw new TypeError("Expected a `root` node");let i=n.createElement(n.Fragment,{},vo({options:e,schema:Xr,listDepth:0},o));return e.className&&(i=n.createElement("div",{className:e.className},i)),i}function Io({errors:e}){const n=e.map((e,n)=>{var t,r,o;const i="extensions"in e?null===(t=e.extensions)||void 0===t?void 0:t.originalError:{},l=null!==(r=null==i?void 0:i.message)&&void 0!==r?r:e.message,s="extensions"in e?null===(o=e.extensions)||void 0===o?void 0:o.code:null;return y.jsxs("div",{style:{marginTop:0===n?0:10,marginBottom:14},children:[y.jsx(z,{style:{marginBottom:4}}),s&&y.jsxs("div",{style:{fontWeight:"600",marginBottom:4},children:["Copilot Runtime Error:"," ",y.jsx("span",{style:{fontFamily:"monospace",fontWeight:"normal"},children:s})]}),y.jsx(Eo,{children:l})]},n)});return y.jsxs("div",{style:{fontSize:"13px",maxWidth:"600px"},children:[n,y.jsx("div",{style:{fontSize:"11px",opacity:.75},children:"NOTE: This error only displays during local development."})]})}function Ao(e,t){const r=function(){const{addToast:e}=j();return n.useCallback(n=>{const t=n.map(e=>{var n,t;const r="extensions"in e&&(null===(t=null===(n=e.extensions)||void 0===n?void 0:n.originalError)||void 0===t?void 0:t.message)||e.message,o=e.stack||"";return btoa(r+o).slice(0,32)}).join("|");e({type:"error",id:t,message:y.jsx(Io,{errors:n})})},[e])}();return n.useCallback(async(...n)=>{try{return await e(...n)}catch(e){throw console.error("Error in async callback:",e),r([e]),e}},t)}Eo.propTypes={children:vr.string,className:vr.string,allowElement:vr.func,allowedElements:vr.arrayOf(vr.string),disallowedElements:vr.arrayOf(vr.string),unwrapDisallowed:vr.bool,remarkPlugins:vr.arrayOf(vr.oneOfType([vr.object,vr.func,vr.arrayOf(vr.oneOfType([vr.bool,vr.string,vr.object,vr.func,vr.arrayOf(vr.any)]))])),rehypePlugins:vr.arrayOf(vr.oneOfType([vr.object,vr.func,vr.arrayOf(vr.oneOfType([vr.bool,vr.string,vr.object,vr.func,vr.arrayOf(vr.any)]))])),sourcePos:vr.bool,rawSourcePos:vr.bool,skipHtml:vr.bool,includeElementIndex:vr.bool,transformLinkUri:vr.oneOfType([vr.func,vr.bool]),linkTarget:vr.oneOfType([vr.func,vr.string]),transformImageUri:vr.func,components:vr.object};const Oo=new class{constructor(){this.activeKey=null,this.intervalId=null,this.instanceCount=0,this.lastResponse=null}async start(e,n){if(this.instanceCount++,this.activeKey===e)return;this.intervalId&&clearInterval(this.intervalId);const t=async()=>{try{const t=await fetch(`${r.COPILOT_CLOUD_API_URL}/ciu`,{method:"GET",headers:{[r.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]:e}}).then(e=>e.json());return this.lastResponse=t,null==n||n(t),t}catch(e){return null}},o=await t();return this.intervalId=setInterval(t,3e5),this.activeKey=e,o}getLastResponse(){return this.lastResponse}stop(){this.instanceCount--,0===this.instanceCount&&this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null,this.activeKey=null,this.lastResponse=null)}};class Ro extends n.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidMount(){this.props.publicApiKey&&Oo.start(this.props.publicApiKey,e=>{this.setState(n=>{var t;return(null==e?void 0:e.severity)!==(null===(t=n.status)||void 0===t?void 0:t.severity)?{status:null!=e?e:void 0}:null})})}componentWillUnmount(){Oo.stop()}componentDidCatch(e,n){console.error("CopilotKit Error:",e,n)}render(){var e,n,t,o;if(this.state.hasError){if(this.state.error instanceof r.CopilotKitError)return y.jsxs(y.Fragment,{children:[this.props.children,this.props.showUsageBanner&&y.jsx(L,{severity:null!==(n=null===(e=this.state.status)||void 0===e?void 0:e.severity)&&void 0!==n?n:this.state.error.severity,message:null!==(o=null===(t=this.state.status)||void 0===t?void 0:t.message)&&void 0!==o?o:this.state.error.message,actions:_(this.state.error)})]});throw this.state.error}return this.props.children}}const To=n.createContext(void 0);function jo({children:e}){const[t,r]=n.useState({}),o=n.useCallback((e,n)=>{r(t=>Object.assign(Object.assign({},t),{[e]:n}))},[]),i=n.useCallback(e=>{r(n=>{const t=Object.assign({},n);return delete t[e],t})},[]),l=n.useRef({});return y.jsx(To.Provider,{value:{coAgentStateRenders:t,setCoAgentStateRender:o,removeCoAgentStateRender:i,claimsRef:l},children:e})}function Po(){const e=n.useContext(To);if(!e)throw new Error("useCoAgentStateRenders must be used within CoAgentStateRendersProvider");return e}const Mo=n.createContext(void 0);function Do({children:e,threadId:t}){const[o,i]=n.useState(()=>r.randomUUID()),l=null!=t?t:o;return y.jsx(Mo.Provider,{value:{threadId:l,setThreadId:i},children:e})}function Fo(){const e=n.useContext(Mo);if(!e)throw new Error("useThreads must be used within ThreadsProvider");return e}var No,Lo;function _o(e){if(!e)return{};const{messages:n,tools:t,copilotkit:r}=e;return a(e,["messages","tools","copilotkit"])}function zo(e,n){if(e&&!n||!e&&n)return!1;const{messages:t,tools:r,copilotkit:o}=e,i=a(e,["messages","tools","copilotkit"]),{messages:l,tools:s,copilotkit:u}=n,c=a(n,["messages","tools","copilotkit"]);return JSON.stringify(i)===JSON.stringify(c)}function $o(e){return!!e&&e.startsWith("coagent-state-render-")}function Bo(e){return"coagent-state-render"===e}function Uo(e){if(!e||"object"!=typeof e)return{snapshot:e,runId:void 0};return{snapshot:"snapshot"in e?e.snapshot:e,runId:"runId"in e?e.runId:void 0}}!function(e){e.InProgress="inProgress",e.Complete="complete"}(No||(No={})),function(e){e.Create="create",e.Override="override",e.Existing="existing",e.Block="block"}(Lo||(Lo={}));const Ko="__lastSnapshotsByStateRenderIdAndRun",Ho="__lastSnapshotsByMessageId";function Vo(e){return e.current}function qo({agentId:e,stateRenderId:t,message:o,messageIndex:i,stateSnapshot:l,agentState:s,agentMessages:a,claimsRef:u}){var c,d,f,p,h,g;const m=Vo(u),y=o.runId,v=null===(c=m[Ho])||void 0===c?void 0:c[o.id],{runId:b}=Uo(v),x=function({existingClaimRunId:e,cachedMessageRunId:n,runId:t}){return e||n||t||"pending"}({existingClaimRunId:null===(d=u.current[o.id])||void 0===d?void 0:d.runId,cachedMessageRunId:b,runId:y});if(n.useEffect(()=>()=>{var e,n,t,r;const i=u.current[o.id];if((null==i?void 0:i.stateSnapshot)&&Object.keys(i.stateSnapshot).length>0){const l=Object.assign({},null!==(e=m[Ko])&&void 0!==e?e:{});l[`${i.stateRenderId}::${null!==(n=i.runId)&&void 0!==n?n:"pending"}`]=i.stateSnapshot,l[`${i.stateRenderId}::latest`]=i.stateSnapshot,m[Ko]=l;const s=Object.assign({},null!==(t=m[Ho])&&void 0!==t?t:{});s[o.id]={snapshot:i.stateSnapshot,runId:null!==(r=i.runId)&&void 0!==r?r:x},m[Ho]=s}delete u.current[o.id]},[u,x,o.id]),!t)return{canRender:!1};const k=function(e){var n,t;const r=Vo(e);return{byStateRenderAndRun:null!==(n=r[Ko])&&void 0!==n?n:{},byMessageId:null!==(t=r[Ho])&&void 0!==t?t:{}}}(u),C=u.current[o.id],{snapshot:S,hasSnapshotKeys:w,allowEmptySnapshot:E,snapshotForClaim:I}=function({messageId:e,messageName:n,allowLiveState:t,skipLatestCache:o,stateRenderId:i,effectiveRunId:l,stateSnapshotProp:s,agentState:a,agentMessages:u,existingClaim:c,caches:d}){var f,p,h,g,m,y;const v=u?null===(f=[...u].reverse().find(e=>"assistant"===e.role))||void 0===f?void 0:f.id:void 0,b=void 0!==i?d.byStateRenderAndRun[`${i}::latest`]:void 0,x=u?u.findIndex(n=>n.id===e):-1,k=x>=0&&u?null===(p=u[x])||void 0===p?void 0:p.role:void 0;let C;if(x>0&&u)for(let e=x-1;e>=0;e-=1)if("user"===(null===(h=u[e])||void 0===h?void 0:h.role)){C=null===(g=u[e])||void 0===g?void 0:g.id;break}const S=void 0===s&&void 0!==b&&void 0!==a&&zo(b,a),w=(Boolean(t)||!v||e===v)&&!S,E=s?r.parseJson(s,s):w?a:void 0,I=!!(E&&Object.keys(E).length>0),A=void 0!==E&&!I&&(void 0!==s||w),O=Uo(d.byMessageId[e]).snapshot,R=void 0!==i?`${i}::${l}`:void 0;let T=null!=O?O:d.byMessageId[e];return void 0===T&&R&&void 0!==d.byStateRenderAndRun[R]&&(T=d.byStateRenderAndRun[R]),void 0===T&&i&&C&&void 0!==d.byStateRenderAndRun[`${i}::pending:${C}`]&&(T=d.byStateRenderAndRun[`${i}::pending:${C}`]),void 0===T&&!o&&i&&"assistant"!==k&&(void 0!==s||a&&Object.keys(a).length>0)&&(T=d.byStateRenderAndRun[`${i}::latest`]),{snapshot:E,hasSnapshotKeys:I,cachedSnapshot:T,allowEmptySnapshot:A,snapshotForClaim:(null==c?void 0:c.locked)?null!==(m=c.stateSnapshot)&&void 0!==m?m:T:I?E:null!==(y=null==c?void 0:c.stateSnapshot)&&void 0!==y?y:T}}({messageId:o.id,messageName:o.name,allowLiveState:Bo(o.name)||$o(o.id),skipLatestCache:Bo(o.name)||$o(o.id),stateRenderId:t,effectiveRunId:x,stateSnapshotProp:l,agentState:s,agentMessages:a,existingClaim:C,caches:k}),A=function({claims:e,context:n,stateSnapshot:t}){const{messageId:o,stateRenderId:i,runId:l,messageIndex:s}=n,a=e[o];if(a){const e=a.stateRenderId===i,n=e&&l&&(!a.runId||"pending"===a.runId);return{canRender:e,action:e?Lo.Existing:Lo.Block,updateRunId:n?l:void 0}}const u=null!=l?l:"pending",c=Object.entries(e).find(([,e])=>{var n;return e.stateRenderId===i&&(null!==(n=e.runId)&&void 0!==n?n:"pending")===u&&r.dataToUUID(_o(e.stateSnapshot))===r.dataToUUID(_o(t))}),d=null==c?void 0:c[1],f=null==c?void 0:c[0];return d?void 0!==s&&void 0!==d.messageIndex&&s>d.messageIndex?{canRender:!0,action:Lo.Override,nextClaim:{stateRenderId:i,runId:l,messageIndex:s},lockOthers:l===d.runId||$o(f)}:l&&d.runId&&l!==d.runId?{canRender:!0,action:Lo.Override,nextClaim:{stateRenderId:i,runId:l,messageIndex:s},lockOthers:$o(f)}:$o(f)?{canRender:!0,action:Lo.Override,nextClaim:{stateRenderId:i,runId:l,messageIndex:s},lockOthers:!0}:t&&d.stateSnapshot&&!zo(d.stateSnapshot,t)?{canRender:!0,action:Lo.Override,nextClaim:{stateRenderId:i,runId:l}}:{canRender:!1,action:Lo.Block}:l?{canRender:!0,action:Lo.Create,nextClaim:{stateRenderId:i,runId:l,messageIndex:s}}:{canRender:!1,action:Lo.Block}}({claims:u.current,context:{messageId:o.id,stateRenderId:t,runId:x,messageIndex:i},stateSnapshot:I});if(A.action===Lo.Block)return{canRender:!1};if(A.updateRunId&&u.current[o.id]&&(u.current[o.id].runId=A.updateRunId),A.nextClaim&&(u.current[o.id]=A.nextClaim),A.lockOthers&&Object.entries(u.current).forEach(([e,n])=>{e!==o.id&&n.stateRenderId===t&&(n.locked=!0)}),C&&!C.locked&&(null==a?void 0:a.length)){const e=a.findIndex(e=>e.id===o.id);e>=0&&e<a.length-1&&(C.locked=!0)}const O=u.current[o.id].stateSnapshot,R=l&&void 0!==O&&!zo(O,S);if(S&&(l||w||E)&&(!u.current[o.id].locked||R)){if(!u.current[o.id].locked||R){u.current[o.id].stateSnapshot=S;const e=Object.assign({},null!==(f=m[Ko])&&void 0!==f?f:{});e[`${t}::${x}`]=S,e[`${t}::latest`]=S,m[Ko]=e;const n=Object.assign({},null!==(p=m[Ho])&&void 0!==p?p:{});n[o.id]={snapshot:S,runId:x},m[Ho]=n,l&&(u.current[o.id].locked=!0)}}else if(I){if(!u.current[o.id].stateSnapshot){u.current[o.id].stateSnapshot=I;const e=Object.assign({},null!==(h=m[Ko])&&void 0!==h?h:{});e[`${t}::${x}`]=I,e[`${t}::latest`]=I,m[Ko]=e;const n=Object.assign({},null!==(g=m[Ho])&&void 0!==g?g:{});n[o.id]={snapshot:I,runId:x},m[Ho]=n}}return{canRender:!0}}function Wo(e){return function(e,o){var i;const{stateSnapshot:l,message:s}=o,{coAgentStateRenders:a,claimsRef:u}=Po(),{agent:c}=t.useAgent({agentId:e}),[d,f]=n.useState(void 0),[,p]=n.useState(0);n.useEffect(()=>{if(!c)return;const e={onStateChanged:()=>{p(e=>e+1)},onStepStartedEvent:({event:e})=>{e.stepName!==d&&f(e.stepName)},onStepFinishedEvent:({event:e})=>{e.stepName===d&&f(void 0)}},{unsubscribe:n}=c.subscribe(e);return()=>{n()}},[e,d]);const h=n.useCallback(n=>Object.entries(a).find(([t,r])=>{if(u.current[n])return t===u.current[n].stateRenderId;const o=r.name===e,i=!r.nodeName||r.nodeName===d;return o&&i}),[a,d,e]),g=n.useMemo(()=>h(s.id),[h,s.id]),m=null==g?void 0:g[0],y=null==g?void 0:g[1],v=Object.assign(Object.assign({},s),{runId:null!==(i=o.runId)&&void 0!==i?i:s.runId}),{canRender:b}=qo({agentId:e,stateRenderId:m,message:v,messageIndex:o.messageIndex,stateSnapshot:l,agentState:null==c?void 0:c.state,agentMessages:null==c?void 0:c.messages,claimsRef:u});return n.useMemo(()=>{var e,n;if(!y||!m)return null;if(!b)return null;if(y.handler&&y.handler({state:l?r.parseJson(l,l):null!==(e=null==c?void 0:c.state)&&void 0!==e?e:{},nodeName:null!=d?d:""}),y.render){const e=(null==c?void 0:c.isRunning)?No.InProgress:No.Complete;return"string"==typeof y.render?y.render:y.render({status:e,state:null!==(n=u.current[s.id].stateSnapshot)&&void 0!==n?n:{},nodeName:null!=d?d:""})}},[y,m,null==c?void 0:c.state,null==c?void 0:c.isRunning,d,s.id,l,b])}(e.agentId,e)}function Jo(){const{copilotkit:e}=t.useCopilotKit(),o=t.useCopilotChatConfiguration(),i=null==o?void 0:o.agentId,{setBannerError:l}=j(),{agent:s}=t.useAgent({agentId:i});return(e=>{const t=n.useRef([]),o=n.useCallback(e=>({onCustomEvent:({event:e})=>{"PredictState"===e.name&&(t.current=e.value)},onToolCallArgsEvent:({partialToolCallArgs:n,toolCallName:o})=>{t.current.forEach(t=>{if((null==t?void 0:t.tool)!==o)return;const i="string"==typeof n?r.parseJson(n,n):n;e.setState({[t.state_key]:i[t.state_key]})})}}),[]);n.useEffect(()=>{if(!e)return;const n=o(e),{unsubscribe:t}=e.subscribe(n);return()=>{t()}},[e,o])})(s),n.useEffect(()=>{const n={onError:({error:e})=>{l(new r.CopilotKitLowLevelError({error:e,message:e.message}))}},t=e.subscribe(n);return()=>{t.unsubscribe()}},[null==e?void 0:e.subscribe]),null}function Go(){const{copilotkit:e}=t.useCopilotKit(),{onError:r,copilotApiConfig:o}=x();return n.useEffect(()=>{if(!e)return;const n=e.subscribe({onError:async e=>{const n={type:"error",timestamp:Date.now(),context:Object.assign({source:"agent",request:{operation:e.code||"unknown",url:null==o?void 0:o.chatApiEndpoint,startTime:Date.now()},technical:{environment:"browser",userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0,stackTrace:e.error.stack}},e.context),error:e.error};try{await r(n)}catch(e){console.error("Error in onError handler:",e)}}});return()=>{n.unsubscribe()}},[e,r,o]),null}function Yo(e){var i;const{children:l}=e,s=a(e,["children"]);!function(e){const n=Object.keys(e).filter(e=>e.endsWith("_c")),t=e.publicApiKey||e.publicLicenseKey;if(!e.runtimeUrl&&!t)throw new r.ConfigurationError("Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'");if(n.length>0&&!t)throw new r.MissingPublicApiKeyError(`Missing required prop: 'publicApiKey' or 'publicLicenseKey' to use cloud features: ${n.map(Xo).join(", ")}`)}(e);const u=s.publicLicenseKey||s.publicApiKey,c=s.runtimeUrl||r.COPILOT_CLOUD_CHAT_URL,[d,f]=n.useState({}),[p,h]=n.useState(new Map),g=n.useRef({actions:{},coAgentStateRenders:{}}),{addElement:m,removeElement:v,printTree:x,getAllElements:k}=(()=>{const[e,t]=n.useReducer(I,[]),o=n.useCallback((e,n,o)=>{const i=r.randomId();return t({type:"ADD_NODE",value:e,parentId:o,id:i,categories:n}),i},[]),i=n.useCallback(e=>{t({type:"REMOVE_NODE",id:e})},[]),l=n.useCallback(()=>e,[e]),s=n.useCallback(n=>{const t=new Set(n);let r="";return e.forEach((e,n)=>{(function(e,n){const[t,r]=e.size<=n.size?[e,n]:[n,e];for(let e of t)if(r.has(e))return!0;return!1})(t,e.categories)&&(0!==n&&(r+="\n"),r+=E(e,`${w(n,0)}. `))}),r},[e]);return{tree:e,addElement:o,printTree:s,removeElement:i,getAllElements:l}})(),[C,S]=n.useState(!1),[O,R]=n.useState(""),[T,j]=n.useState({}),[P,D]=n.useState({}),[z,$]=n.useState([]),{addElement:B,removeElement:U,allElements:K}=(()=>{const[e,t]=n.useReducer(A,new Map),o=n.useCallback((e,n)=>{const o=r.randomId();return t({type:"ADD_ELEMENT",value:e,id:o,categories:n}),o},[]),i=n.useCallback(e=>{t({type:"REMOVE_ELEMENT",id:e})},[]),l=n.useCallback(n=>{const t=new Set(n),r=[];return e.forEach(e=>{(function(e,n){const[t,r]=e.size<=n.size?[e,n]:[n,e];for(let e of t)if(r.has(e))return!0;return!1})(t,e.categories)&&r.push(e.value)}),r},[e]);return{addElement:o,removeElement:i,allElements:l}})(),H=n.useCallback((e,n)=>{f(t=>Object.assign(Object.assign({},t),{[e]:n}))},[]),V=n.useCallback(e=>{f(n=>{const t=Object.assign({},n);return delete t[e],t})},[]),q=n.useCallback((e,n)=>`${e.map(e=>`${e.name} (${e.sourceApplication}):\n${e.getContents()}`).join("\n\n")}\n\n${x(n)}`,[x]),W=n.useCallback((e,n,t=Qo)=>m(e,t,n),[m]),J=n.useCallback(e=>{v(e)},[v]),G=n.useCallback(()=>k(),[k]),Y=n.useCallback(e=>function(e){return async({name:n,args:t})=>{let r={};for(let n of e)r[n.name]=n;const i=r[n];let l;return i&&(await new Promise((e,n)=>{o.flushSync(async()=>{var r;try{l=await(null===(r=i.handler)||void 0===r?void 0:r.call(i,t)),e()}catch(e){n(e)}})}),await new Promise(e=>setTimeout(e,20))),l}}(Object.values(e||d)),[d]),Q=n.useCallback(e=>K(e),[K]),X=n.useCallback((e,n=Qo)=>B(e,n),[B]),Z=n.useCallback(e=>{U(e)},[U]),ee=n.useMemo(()=>{var e,n;let t;return u&&(t={guardrails:{input:{restrictToTopic:{enabled:Boolean(s.guardrails_c),validTopics:(null===(e=s.guardrails_c)||void 0===e?void 0:e.validTopics)||[],invalidTopics:(null===(n=s.guardrails_c)||void 0===n?void 0:n.invalidTopics)||[]}}}}),Object.assign(Object.assign({publicApiKey:u},t?{cloud:t}:{}),{chatApiEndpoint:c,headers:s.headers||{},properties:s.properties||{},transcribeAudioUrl:s.transcribeAudioUrl,textToSpeechUrl:s.textToSpeechUrl,credentials:s.credentials})},[u,s.headers,s.properties,s.transcribeAudioUrl,s.textToSpeechUrl,s.credentials,s.cloudRestrictToTopic,s.guardrails_c]);n.useMemo(()=>{const e=Object.values(T||{}).reduce((e,n)=>"authenticated"===n.status&&n.authHeaders?Object.assign(Object.assign({},e),Object.entries(n.authHeaders).reduce((e,[n,t])=>Object.assign(Object.assign({},e),{[n.startsWith("X-Custom-")?n:`X-Custom-${n}`]:t}),{})):e,{});return Object.assign(Object.assign(Object.assign({},ee.headers||{}),ee.publicApiKey?{[r.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]:ee.publicApiKey}:{}),e)},[ee.headers,ee.publicApiKey,T]);const[ne,te]=n.useState({}),re=n.useCallback(e=>{te(n=>Object.assign(Object.assign({},n),e))},[]),oe=n.useCallback(e=>{te(n=>{const t=n,r=e;t[r];return a(t,["symbol"==typeof r?r:r+""])})},[]),ie=n.useRef(s.onError);n.useEffect(()=>{ie.current=s.onError},[s.onError]);const le=n.useRef({});n.useEffect(()=>{le.current=ne},[ne]);const se=n.useCallback(async e=>{if(ee.publicApiKey&&ie.current)try{await ie.current(e)}catch(e){console.error("Error in public onError handler:",e)}const n=Object.values(le.current);await Promise.all(n.map(n=>Promise.resolve(n(e)).catch(e=>console.error("Error in internal error handler:",e))))},[ee.publicApiKey]),[ae,ue]=n.useState({}),ce=n.useCallback((e,n)=>{ue(t=>Object.assign(Object.assign({},t),{[e]:n}))},[ue]),de=n.useCallback(e=>{ue(n=>{const t=n,r=e;t[r];return a(t,["symbol"==typeof r?r:r+""])})},[ue]),[fe,pe]=n.useState([]),[he,ge]=n.useState({}),me=n.useRef({}),ye=n.useCallback(e=>{const n="function"==typeof e?e(me.current):e;me.current=n,ge(e=>n)},[]);let ve=null;s.agent&&(ve={agentName:s.agent});const[be,xe]=n.useState(ve);n.useEffect(()=>{s.agent?xe({agentName:s.agent}):xe(null)},[s.agent]);const{threadId:ke,setThreadId:Ce}=Fo(),Se=n.useCallback(e=>{if(s.threadId)throw new Error("Cannot call setThreadId() when threadId is provided via props.");Ce(e)},[s.threadId]),[we,Ee]=n.useState(null),Ie=n.useRef(null),Ae=M(s.showDevConsole),[Oe,Re]=n.useState({}),Te=n.useCallback(e=>{Re(n=>{var t;return null!=e&&e.id?Object.assign(Object.assign({},n),{[e.id]:Object.assign(Object.assign({},null!==(t=n[e.id])&&void 0!==t?t:{}),e)}):n})},[]),je=n.useCallback(e=>{Re(n=>{const t=n,r=e;t[r];return a(t,["symbol"==typeof r?r:r+""])})},[]),[Pe,Me]=n.useState({}),De=n.useCallback(e=>{Me(n=>{const t=n[e.threadId]||[];return Object.assign(Object.assign({},n),{[e.threadId]:[...t,e]})})},[]),Fe=n.useCallback((e,n,t)=>{Me(r=>{const o=r[e]||[];return Object.assign(Object.assign({},r),{[e]:o.map(e=>e.eventId===n?Object.assign(Object.assign({},e),{event:Object.assign(Object.assign({},e.event),{response:t})}):e)})})},[]),Ne=n.useMemo(()=>l,[l]),[Le,_e]=n.useState(null),ze=n.useMemo(()=>{var e;return null!==(e=s.agent)&&void 0!==e?e:null},[s.agent]),$e=n.useMemo(()=>{var e;return null!==(e=s.forwardedParameters)&&void 0!==e?e:{}},[s.forwardedParameters]),Be=n.useCallback(e=>{D(n=>{const t="function"==typeof e?e(n):e;return Object.keys(t).length===Object.keys(n).length&&Object.entries(t).every(([e,t])=>n[e]===t)?n:t})},[D]),Ue=n.useCallback(e=>{j(n=>{const t="function"==typeof e?e(n):e;return Object.keys(t).length===Object.keys(n).length&&Object.entries(t).every(([e,t])=>n[e]===t)?n:t})},[j]),Ke=n.useCallback(e=>{const n=e.action.name||r.randomUUID();return h(t=>{const r=new Map(t);return r.set(n,e),r}),n},[]),He=n.useCallback(e=>{h(n=>{const t=new Map(n);return t.delete(e),t})},[]),Ve=n.useMemo(()=>()=>y.jsx(y.Fragment,{children:Array.from(p.entries()).map(([e,n])=>{const t=n.component;return y.jsx(t,{action:n.action},e)})}),[p]);return y.jsx(t.CopilotChatConfigurationProvider,{agentId:null!==(i=s.agent)&&void 0!==i?i:"default",threadId:ke,children:y.jsxs(b.Provider,{value:{actions:d,chatComponentsCache:g,getFunctionCallHandler:Y,setAction:H,removeAction:V,setRegisteredActions:Ke,removeRegisteredAction:He,getContextString:q,addContext:W,removeContext:J,getAllContext:G,getDocumentsContext:Q,addDocumentContext:X,removeDocumentContext:Z,copilotApiConfig:ee,isLoading:C,setIsLoading:S,chatSuggestionConfiguration:ae,addChatSuggestionConfiguration:ce,removeChatSuggestionConfiguration:de,chatInstructions:O,setChatInstructions:R,additionalInstructions:z,setAdditionalInstructions:$,showDevConsole:Ae,coagentStates:he,setCoagentStates:ge,coagentStatesRef:me,setCoagentStatesWithRef:ye,agentSession:be,setAgentSession:xe,forwardedParameters:$e,agentLock:ze,threadId:ke,setThreadId:Se,runId:we,setRunId:Ee,chatAbortControllerRef:Ie,availableAgents:fe,authConfig_c:s.authConfig_c,authStates_c:T,setAuthStates_c:Ue,extensions:P,setExtensions:Be,interruptActions:Oe,setInterruptAction:Te,removeInterruptAction:je,interruptEventQueue:Pe,addInterruptEvent:De,resolveInterruptEvent:Fe,bannerError:Le,setBannerError:_e,onError:se,internalErrorHandlers:ne,setInternalErrorHandler:re,removeInternalErrorHandler:oe},children:[y.jsx(Jo,{}),y.jsx(Go,{}),y.jsxs(jo,{children:[y.jsx(F,{children:y.jsxs(N,{children:[Ne,y.jsx(Ve,{})]})}),Le&&Ae&&y.jsx(L,{severity:Le.severity,message:Le.message,onClose:()=>_e(null),actions:_(Le)})]})]})})}const Qo=["global"];function Xo(e){return e.replace(/_c$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}function Zo(e){const{agent:r}=t.useAgent({agentId:e}),o=n.useRef("start");return n.useEffect(()=>{if(!r)return;const e={onStepStartedEvent:({event:e})=>{o.current=e.stepName},onRunStartedEvent:()=>{o.current="start"},onRunFinishedEvent:()=>{o.current="end"}},n=r.subscribe(e);return()=>{n.unsubscribe()}},[r]),o.current}const ei=({event:e,result:n,render:t,resolve:r})=>t({event:e,result:n,resolve:r});function ni(e){var o;const{interruptActions:l,agentSession:s,threadId:a,interruptEventQueue:u,addInterruptEvent:c,resolveInterruptEvent:d}=x(),f=t.useCopilotChatConfiguration(),p=Zo(null!==(o=null==f?void 0:f.agentId)&&void 0!==o?o:"default");n.useEffect(()=>{if(!e)return;let n=null;const t={onCustomEvent:({event:e})=>{if("on_interrupt"===e.name){const t={name:i.MetaEventName.LangGraphInterruptEvent,type:e.type,value:r.parseJson(e.value,e.value)},o=r.dataToUUID(t,"interruptEvents");n={eventId:o,threadId:a,event:t}}},onRunStartedEvent:()=>{n=null},onRunFinalized:()=>{n&&(c(n),n=null)}},{unsubscribe:o}=e.subscribe(t);return()=>{o()}},[e,a]);const h=n.useCallback((n,t)=>{null==e||e.runAgent({forwardedProps:{command:{resume:t}}}),d(a,n,null!=t?t:"")},[e,a]);return n.useMemo(()=>{const e=(u[a]||[]).find(e=>!e.event.response);if(!e||!s)return null;const t=Object.values(l).find(n=>!n.enabled||n.enabled({eventValue:e.event.value,agentMetadata:Object.assign(Object.assign({},s),{nodeName:p})}));if(!t)return null;const{render:r,handler:o}=t,i=n=>{h(e.eventId,n)};let c=null;return o&&(c=o({event:e.event,resolve:i})),r?n.createElement(ei,{event:e.event,result:c,render:r,resolve:i}):null},[l,u,a,s,h])}function ti(){const e=t.useRenderToolCall();return n.useCallback((n,t)=>{var r;if(!(null===(r=null==n?void 0:n.toolCalls)||void 0===r?void 0:r.length))return null;const o=n.toolCalls[0];if(!o)return null;const i=null==t?void 0:t.find(e=>"tool"===e.role&&e.toolCallId===o.id);return()=>e({toolCall:o,toolMessage:i})},[e])}function ri({suggestions:e,onInProgress:r,onSubmitMessage:o,onStopGeneration:s,onReloadMessages:a}={}){var u,c,d;const{copilotkit:f}=t.useCopilotKit(),{threadId:p,agentSession:h}=x(),g=t.useCopilotChatConfiguration(),[m,y]=n.useState(!1),v=null!==(u=null==g?void 0:g.agentId)&&void 0!==u?u:"default",{agent:b}=t.useAgent({agentId:v});n.useEffect(()=>(b&&(null==g?void 0:g.threadId)&&b.threadId!==g.threadId&&(b.threadId=g.threadId,(async e=>{y(!1);try{await f.connectAgent({agent:e}),y(!0)}catch(e){e instanceof l.AGUIConnectNotImplementedError||console.error("CopilotChat: connectAgent failed",e)}})(b)),()=>{}),[null==g?void 0:g.threadId,b,f,v]),n.useEffect(()=>{null==r||r(Boolean(null==b?void 0:b.isRunning))},[null==b?void 0:b.isRunning,r]);const k=ni(b),C=n.useCallback(e=>{var n;const t=(null!==(n=null==b?void 0:b.messages)&&void 0!==n?n:[]).filter(n=>n.id!==e);null==b||b.setMessages(t)},[null==b?void 0:b.setMessages,null==b?void 0:b.messages]),S=oi(C),w=n.useCallback(e=>S.current(e),[S]),E=t.useSuggestions({agentId:v}),I=Ao(async e=>{var n;const t=null!==(n=null==b?void 0:b.messages)&&void 0!==n?n:[];if(0===t.length)return;const r=t.findIndex(n=>n.id===e);if(-1===r)return void console.warn(`Message with id ${e} not found`);const o=t[r].role;if("assistant"!==o)return void console.warn(`Regenerate cannot be performed on ${o} role`);let i=[t[0]];if(t.length>2&&0!==r){const e=t.slice(0,r).reverse().find(e=>"user"===e.role);if(e){const n=t.findIndex(n=>n.id===e.id);i=t.slice(0,n+1)}else i=[t[0]]}else t.length>2&&0===r&&(i=[t[0],t[1]]);if(null==b||b.setMessages(i),b)try{await f.runAgent({agent:b})}catch(e){console.error("CopilotChat: runAgent failed during reload",e)}},[null==b?void 0:b.setMessages,null==f?void 0:f.runAgent]),A=Ao(async(e,n)=>{var t;if(!b)return;const r=null===(t=null==n?void 0:n.followUp)||void 0===t||t;if((null==n?void 0:n.clearSuggestions)&&f.clearSuggestions(v),o){const n="string"==typeof e.content?e.content:e.content&&"text"in e.content?e.content.text:e.content&&"filename"in e.content?e.content.filename:"";try{await o(n)}catch(e){console.error("Error in onSubmitMessage:",e)}}if(null==b||b.addMessage(e),r)try{await f.runAgent({agent:b})}catch(e){console.error("CopilotChat: runAgent failed",e)}},[b,f,v,o]),O=Ao(async(e,n)=>A(i.gqlToAGUI([e])[0],n),[A]),R=n.useCallback(e=>{var n,t;return e.every(e=>e instanceof i.Message)?null===(n=null==b?void 0:b.setMessages)||void 0===n?void 0:n.call(b,i.gqlToAGUI(e)):null===(t=null==b?void 0:b.setMessages)||void 0===t?void 0:t.call(b,e)},[null==b?void 0:b.setMessages,b]),T=oi(I),j=Ao(async e=>{var n;return null==a||a({messageId:e,currentAgentName:null==b?void 0:b.agentId,messages:null!==(n=null==b?void 0:b.messages)&&void 0!==n?n:[]}),await T.current(e)},[T,b,a]),P=n.useCallback(()=>{var e,n;return null==s||s({currentAgentName:null==b?void 0:b.agentId,messages:null!==(e=null==b?void 0:b.messages)&&void 0!==e?e:[]}),null===(n=null==b?void 0:b.abortRun)||void 0===n?void 0:n.call(b)},[s,b]),M=oi(()=>{null==b||b.setMessages([]),null==b||b.setState(null)}),D=n.useCallback(()=>M.current(),[M]),F=ti(),N=t.useRenderCustomMessages(),L=function({copilotkit:e,agent:t,agentId:r,threadId:o}){return n.useMemo(()=>e&&t?({message:i,position:l})=>{var s;const a=null!==(s=null!=o?o:t.threadId)&&void 0!==s?s:"default",u=i.runId,c=u||e.getRunIdForMessage(r,a,i.id)||`pending:${i.id}`,d=Math.max(t.messages.findIndex(e=>e.id===i.id),0),f={message:i,position:l,runId:c,messageIndex:d,messageIndexInRun:0,numberOfMessagesInRun:1,agentId:r,stateSnapshot:i.state};return n.createElement(Wo,f)}:null,[t,r,e,o])}({copilotkit:f,agent:b,agentId:v,threadId:null!==(c=null==g?void 0:g.threadId)&&void 0!==c?c:p}),_=null!==(d=null==b?void 0:b.messages)&&void 0!==d?d:[],z=n.useMemo(()=>{var e,n;let t=_.map(e=>{if("assistant"!==e.role)return e;const n=F(e,_);if(n){const t=n();if(t)return Object.assign(Object.assign({},e),{generativeUI:()=>t})}const t=L||N?()=>{var n;if(L)return L({message:e,position:"before"});try{return null!==(n=null==N?void 0:N({message:e,position:"before"}))&&void 0!==n?n:null}catch(e){return console.warn("[CopilotKit] renderCustomMessages failed, falling back to legacy renderer",e),null}}:null;return t?Object.assign(Object.assign({},e),{generativeUI:t,generativeUIPosition:"before"}):e});const r=t.some(e=>"assistant"===e.role),o=Boolean(N&&(null===(e=null==f?void 0:f.getAgent)||void 0===e?void 0:e.call(f,v))),i=L||(o?N:null),l=Boolean(null==b?void 0:b.isRunning)||Boolean((null==b?void 0:b.state)&&Object.keys(b.state).length),s=null!==(n=null!=p?p:null==b?void 0:b.threadId)&&void 0!==n?n:"default";let a=-1;for(let e=t.length-1;e>=0;e-=1)if("user"===t[e].role){a=e;break}const u=a>=0?t[a].id:void 0,c=u?f.getRunIdForMessage(v,s,u)||`pending:${u}`:void 0,d=a>=0?t.slice(a+1).some(e=>"assistant"===e.role):r;if(i&&l&&!d){const e={id:c?`coagent-state-render-${v}-${c}`:`coagent-state-render-${v}`,role:"assistant",content:"",name:"coagent-state-render",runId:c};t=[...t,Object.assign(Object.assign({},e),{generativeUIPosition:"before",generativeUI:()=>i({message:e,position:"before"})})]}return t},[null==b?void 0:b.messages,F,_,N,L,v,f,null==b?void 0:b.isRunning,null==b?void 0:b.state]),$=n.useMemo(()=>Array.isArray(e)?{suggestions:e.map(e=>Object.assign(Object.assign({},e),{isLoading:!1})),isLoading:!1}:E,[e,E]);return{messages:z,sendMessage:A,appendMessage:O,setMessages:R,reloadMessages:j,stopGeneration:P,reset:D,deleteMessage:w,isAvailable:m,isLoading:Boolean(null==b?void 0:b.isRunning),suggestions:$.suggestions,setSuggestions:e=>f.addSuggestionsConfig({suggestions:e}),generateSuggestions:async()=>f.reloadSuggestions(v),resetSuggestions:()=>f.clearSuggestions(v),isLoadingSuggestions:$.isLoading,interrupt:k,agent:b,threadId:p}}function oi(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e},[e]),t}function ii(e,o){const{name:i,description:l,parameters:s,render:a,followUp:u}=e,c=r.getZodParameters(s),d=n.useRef(a);n.useEffect(()=>{d.current=a},[a,...null!=o?o:[]]);const f=n.useMemo(()=>{if(void 0!==a)return e=>{const t=d.current;if(void 0===t)return null;if("string"==typeof t)return n.createElement(n.Fragment,null,t);const o=t(Object.assign(Object.assign({},e),{result:"string"==typeof e.result?r.parseJson(e.result,e.result):e.result}));return"string"==typeof o?n.createElement(n.Fragment,null,o):null!=o?o:null}},[]),p=n.useRef(e.handler);n.useEffect(()=>{p.current=e.handler},[e.handler,...null!=o?o:[]]);const h=e.handler?e=>{var n;return null===(n=p.current)||void 0===n?void 0:n.call(p,e)}:void 0;t.useFrontendTool({name:i,description:l,parameters:c,handler:h,followUp:u,render:f})}function li(e,o){const{copilotkit:i}=t.useCopilotKit(),l=n.useRef(!1);n.useEffect(()=>{const{name:n,parameters:o,render:s}=e,a=r.getZodParameters(o),u="*"===n?t.defineToolCallRenderer({name:"*",render:e=>s(Object.assign(Object.assign({},e),{result:e.result?r.parseJson(e.result,e.result):e.result}))}):t.defineToolCallRenderer({name:n,args:a,render:e=>s(Object.assign(Object.assign({},e),{result:e.result?r.parseJson(e.result,e.result):e.result}))}),c=i.renderToolCalls.findIndex(e=>e.name===n);return-1!==c&&i.renderToolCalls.splice(c,1),i.renderToolCalls.push(u),l.current=!0,()=>{if(l.current){const e=i.renderToolCalls.findIndex(e=>e.name===n);-1!==e&&i.renderToolCalls.splice(e,1),l.current=!1}}},[e,...null!=o?o:[]])}function si(e,o){const{render:i}=e,l=a(e,["render"]),{name:u,description:c,parameters:d,followUp:f}=l,p=r.getZodParameters(d),h=n.useRef(null);n.useEffect(()=>{h.current=e=>{if("string"==typeof i)return n.createElement(n.Fragment,null,i);if(!i)return null;const t=(()=>{const n=e.args;switch(e.status){case s.ToolCallStatus.InProgress:return{args:n,respond:e.respond,status:e.status,handler:void 0};case s.ToolCallStatus.Executing:return{args:n,respond:e.respond,status:e.status,handler:()=>{}};case s.ToolCallStatus.Complete:return{args:n,respond:e.respond,status:e.status,result:e.result?r.parseJson(e.result,e.result):e.result,handler:void 0};default:throw new r.CopilotKitError({code:r.CopilotKitErrorCode.UNKNOWN,message:`Invalid tool call status: ${e.status}`})}})(),o=i(t);return"string"==typeof o?n.createElement(n.Fragment,null,o):null!=o?o:null}},[i,...null!=o?o:[]]),t.useHumanInTheLoop({name:u,description:c,followUp:f,parameters:p,render:e=>{var n,t;return null!==(t=null===(n=h.current)||void 0===n?void 0:n.call(h,e))&&void 0!==t?t:null}})}function ai(e){if("*"===e.name)return{type:"render",action:e};if("renderAndWaitForResponse"in e||"renderAndWait"in e){let n=e.render;return!n&&"renderAndWaitForResponse"in e&&(n=e.renderAndWaitForResponse),!n&&"renderAndWait"in e&&(n=e.renderAndWait),{type:"hitl",action:Object.assign(Object.assign({},e),{render:n})}}if("available"in e){if("enabled"===e.available||"remote"===e.available)return{type:"frontend",action:e};if("frontend"===e.available||"disabled"===e.available)return{type:"render",action:e}}if("handler"in e)return{type:"frontend",action:e};throw new Error("Invalid action configuration")}function ui(e,t){const[r]=n.useState(ai(e)),o=ai(e);if(r.type!==o.type)throw new Error("Action configuration changed between renders");switch(o.type){case"render":return li(o.action,t);case"hitl":return si(o.action,t);case"frontend":return ii(o.action,t);default:throw new Error("Invalid action configuration")}}const ci=e=>"state"in e&&"setState"in e;function di(e){return e.filter(e=>e.available!==i.ActionInputAvailability.Disabled&&!0!==e.disabled&&"*"!==e.name&&"frontend"!=e.available&&!e.pairedAction).map(e=>{let n=i.ActionInputAvailability.Enabled;return e.disabled||"disabled"===e.available?n=i.ActionInputAvailability.Disabled:"remote"===e.available&&(n=i.ActionInputAvailability.Remote),{name:e.name,description:e.description||"",jsonSchema:JSON.stringify(r.actionParametersToJsonSchema(e.parameters||[])),available:n}})}function fi(e,n){return`\nPlease act as an efficient, competent, conscientious, and industrious professional assistant.\n\nHelp the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.\nAlways be polite and respectful, and prefer brevity over verbosity.\n\nThe user has provided you with the following context:\n\`\`\`\n${e}\n\`\`\`\n\nThey have also provided you with functions you can call to initiate actions on their behalf.\n\nPlease assist them as best you can.\n\nThis is not a conversation, so please do not ask questions. Just call a function without saying anything else.\n\nThe user has given you the following task to complete:\n\n\`\`\`\n${n}\n\`\`\`\n`}e.CoAgentStateRendersContext=To,e.CoAgentStateRendersProvider=jo,e.CopilotContext=b,e.CopilotKit=function(e){var{children:r}=e,o=a(e,["children"]);const i=M(o.showDevConsole),l=M(o.enableInspector),s=o.publicApiKey||o.publicLicenseKey,u=n.useMemo(()=>[{render:Wo}],[]);return y.jsx(P,{enabled:i,children:y.jsx(Ro,{publicApiKey:s,showUsageBanner:i,children:y.jsx(Do,{threadId:o.threadId,children:y.jsx(t.CopilotKitProvider,Object.assign({},o,{showDevConsole:l,renderCustomMessages:u,useSingleEndpoint:!0,children:y.jsx(Yo,Object.assign({},o,{children:r}))}))})})})},e.CopilotMessagesContext=R,e.CopilotTask=class{constructor(e){this.instructions=e.instructions,this.actions=e.actions||[],this.includeCopilotReadable=!1!==e.includeCopilotReadable,this.includeCopilotActions=!1!==e.includeCopilotActions,this.forwardedParameters=e.forwardedParameters}async run(e,n){var t,r,o;const l=this.includeCopilotActions?Object.assign({},e.actions):{};for(const e of this.actions)l[e.name]=e;let s="";n&&(s=("string"==typeof n?n:JSON.stringify(n))+"\n\n"),this.includeCopilotReadable&&(s+=e.getContextString([],Qo));const a=[new i.TextMessage({content:fi(s,this.instructions),role:i.Role.System})],u=new i.CopilotRuntimeClient({url:e.copilotApiConfig.chatApiEndpoint,publicApiKey:e.copilotApiConfig.publicApiKey,headers:e.copilotApiConfig.headers,credentials:e.copilotApiConfig.credentials}),c=await u.generateCopilotResponse({data:{frontend:{actions:di(Object.values(l)),url:window.location.href},messages:i.convertMessagesToGqlInput(i.filterAgentStateMessages(a)),metadata:{requestType:i.CopilotRequestType.Task},forwardedParameters:Object.assign({toolChoice:"required"},null!==(t=this.forwardedParameters)&&void 0!==t?t:{})},properties:e.copilotApiConfig.properties}).toPromise(),d=e.getFunctionCallHandler(l),f=i.convertGqlOutputToMessages((null===(o=null===(r=c.data)||void 0===r?void 0:r.generateCopilotResponse)||void 0===o?void 0:o.messages)||[]).filter(e=>e.isActionExecutionMessage());for(const e of f)await d({messages:a,name:e.name,args:e.arguments})}},e.SUGGESTION_RETRY_CONFIG={MAX_RETRIES:3,COOLDOWN_MS:5e3},e.ThreadsContext=Mo,e.ThreadsProvider=Do,e.defaultCopilotContextCategories=Qo,e.shouldShowDevConsole=M,e.useCoAgent=function(e){const{agent:r}=t.useAgent({agentId:e.name}),{copilotkit:o}=t.useCopilotKit(),i=Zo(e.name),l=n.useCallback(e=>{if(r)if("function"==typeof e){const n=e;r.setState(n(r.state))}else r.setState(Object.assign(Object.assign({},r.state),e))},[null==r?void 0:r.state,null==r?void 0:r.setState]);n.useEffect(()=>{var n;if(!e.config&&!e.configurable)return;let t=null!==(n=e.config)&&void 0!==n?n:{};e.configurable&&(t=Object.assign(Object.assign({},t),{configurable:Object.assign(Object.assign({},e.configurable),t.configurable)})),o.setProperties(t)},[e.config,e.configurable]);const s=n.useMemo(()=>ci(e)?JSON.stringify(e.state):void 0,[ci(e)?JSON.stringify(e.state):void 0]);n.useEffect(()=>{(null==r?void 0:r.state)&&ci(e)&&JSON.stringify(e.state)!==JSON.stringify(r.state)&&l(e.state)},[r,s,l]);const a=n.useCallback(e=>Boolean(e&&Object.keys(e).length),[]),u=n.useRef(ci(e)?e.state:"initialState"in e?e.initialState:void 0);return n.useEffect(()=>{ci(e)?u.current=e.state:"initialState"in e&&(u.current=e.initialState)},[ci(e)?JSON.stringify(e.state):"initialState"in e?JSON.stringify(e.initialState):void 0]),n.useEffect(()=>{if(!r)return;const n={onStateChanged:n=>{ci(e)&&e.setState(n.state)},onRunInitialized:e=>{a(e.state)?l(e.state):a(r.state)||void 0!==u.current&&l(u.current)}},t=r.subscribe(n);return()=>{t.unsubscribe()}},[r,l,a]),n.useMemo(()=>{var n,t,o;if(!r){const r=()=>{},o=async()=>{},l=null!==(t=null!==(n="state"in e&&e.state)&&void 0!==n?n:"initialState"in e&&e.initialState)&&void 0!==t?t:{};return{name:e.name,nodeName:i,threadId:void 0,running:!1,state:l,setState:r,start:r,stop:r,run:o}}return{name:null!==(o=null==r?void 0:r.agentId)&&void 0!==o?o:e.name,nodeName:i,threadId:r.threadId,running:r.isRunning,state:r.state,setState:l,start:r.runAgent,stop:r.abortRun,run:r.runAgent}},[null==r?void 0:r.state,null==r?void 0:r.runAgent,null==r?void 0:r.abortRun,null==r?void 0:r.runAgent,null==r?void 0:r.threadId,null==r?void 0:r.isRunning,null==r?void 0:r.agentId,l,e.name])},e.useCoAgentStateRender=function(e,t){const{chatComponentsCache:o,availableAgents:i}=n.useContext(b),{setCoAgentStateRender:l,removeCoAgentStateRender:s,coAgentStateRenders:a}=Po(),u=n.useRef(r.randomId()),{setBannerError:c,addToast:d}=j();n.useEffect(()=>{if((null==i?void 0:i.length)&&!i.some(n=>n.name===e.name)){e.name;const n=new r.CopilotKitAgentDiscoveryError({agentName:e.name,availableAgents:i.map(e=>({name:e.name,id:e.id}))});c(n)}},[i]);const f=`${e.name}-${e.nodeName||"global"}`;void 0===t&&a[u.current]&&(a[u.current].handler=e.handler,"function"==typeof e.render&&null!==o.current&&(o.current.coAgentStateRenders[f]=e.render)),n.useEffect(()=>{const n=u.current;if(Object.entries(a).some(([t,r])=>{if(t===n)return!1;if(r.name!==e.name)return!1;const o=!!e.nodeName,i=!!r.nodeName;return!o&&!i||o===i&&e.nodeName===r.nodeName})){const n=e.nodeName?`Found multiple state renders for agent ${e.name} and node ${e.nodeName}. State renders might get overridden`:`Found multiple state renders for agent ${e.name}. State renders might get overridden`;d({type:"warning",message:n,id:`dup-action-${e.name}`})}},[a]),n.useEffect(()=>(l(u.current,e),null!==o.current&&void 0!==e.render&&(o.current.coAgentStateRenders[f]=e.render),()=>{s(u.current)}),[l,s,e.name,"string"==typeof e.render?e.render:void 0,...t||[]])},e.useCoAgentStateRenders=Po,e.useCopilotAction=ui,e.useCopilotAdditionalInstructions=function({instructions:e,available:t="enabled"},r){const{setAdditionalInstructions:o}=x();n.useEffect(()=>{if("disabled"!==t)return o(n=>[...n||[],e]),()=>{o(n=>(null==n?void 0:n.filter(n=>n!==e))||[])}},[t,e,o,...r||[]])},e.useCopilotAuthenticatedAction_c=function(e,t){const{authConfig_c:r,authStates_c:o,setAuthStates_c:i}=x(),l=n.useRef(null),s=n.useCallback(t=>"function"==typeof e.render?e.render(t):e.render||n.createElement(n.Fragment),[e]),a=n.useCallback(t=>Object.values(o||{}).some(e=>"authenticated"===e.status)?s(t):(l.current=t,(null==r?void 0:r.SignInComponent)?n.createElement(r.SignInComponent,{onSignInComplete:n=>{null==i||i(t=>Object.assign(Object.assign({},t),{[e.name]:n})),l.current&&(s(l.current),l.current=null)}}):n.createElement(n.Fragment)),[e,o,i]);ui(Object.assign(Object.assign({},e),{render:a}),t)},e.useCopilotChat=function(e={}){const{visibleMessages:n,appendMessage:t,reloadMessages:r,stopGeneration:o,reset:i,isLoading:l,isAvailable:s,runChatCompletion:a,mcpServers:u,setMcpServers:c}=ri(e);return{visibleMessages:n,appendMessage:t,reloadMessages:r,stopGeneration:o,reset:i,isLoading:l,isAvailable:s,runChatCompletion:a,mcpServers:u,setMcpServers:c}},e.useCopilotChatHeadless_c=function(e={}){const{copilotApiConfig:t,setBannerError:o}=x(),i=Boolean(t.publicApiKey),l=ri(e);return n.useEffect(()=>{i?o(null):(o(new r.CopilotKitError({message:"You're using useCopilotChatHeadless_c, a premium-only feature, which offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.",code:r.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,severity:r.Severity.WARNING,visibility:r.ErrorVisibility.BANNER})),r.styledConsole.logCopilotKitPlatformMessage())},[i]),i?l:{visibleMessages:[],messages:[],sendMessage:async()=>{},appendMessage:async()=>{},setMessages:()=>{},deleteMessage:()=>{},reloadMessages:async()=>{},stopGeneration:()=>{},reset:()=>{},isLoading:!1,isAvailable:!1,runChatCompletion:async()=>[],mcpServers:[],setMcpServers:()=>{},suggestions:[],setSuggestions:()=>{},generateSuggestions:async()=>{},resetSuggestions:()=>{},isLoadingSuggestions:!1,interrupt:null}},e.useCopilotChatInternal=ri,e.useCopilotChatSuggestions=function(e,n=[]){var r,o;const i=t.useCopilotChatConfiguration(),l=null!==(r=null==i?void 0:i.agentId)&&void 0!==r?r:"default",s=null!==(o="enabled"===e.available?"always":e.available)&&void 0!==o?o:"before-first-message",a=Object.assign(Object.assign({},e),{available:s,consumerAgentId:l});t.useConfigureSuggestions(a,n)},e.useCopilotContext=x,e.useCopilotMessagesContext=function(){const e=n.useContext(R);if(e===O)throw new Error("A messages consuming component was not wrapped with `<CopilotMessages> {...} </CopilotMessages>`");return e},e.useCopilotReadable=function({description:e,value:r,convert:o,available:i},l){const{copilotkit:s}=t.useCopilotKit(),a=n.useRef(void 0);return n.useEffect(()=>{if(!s)return;const n=Object.entries(s.context).find(([n,t])=>JSON.stringify({description:e,value:r})==JSON.stringify(t));return n?(a.current=n[0],void("disabled"===i&&s.removeContext(a.current))):n||"disabled"!==i?(a.current=s.addContext({description:e,value:(null!=o?o:JSON.stringify)(r)}),()=>{a.current&&s.removeContext(a.current)}):void 0},[e,r,o]),a.current},e.useCopilotRuntimeClient=e=>{const{setBannerError:t}=j(),{showDevConsole:o,onError:l}=e,s=a(e,["showDevConsole","onError"]),u=n.useRef(null),c=async(e,n)=>{try{const t={type:"error",timestamp:Date.now(),context:{source:"ui",request:{operation:"runtimeClient",url:s.url,startTime:Date.now()},technical:{environment:"browser",userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0,stackTrace:n instanceof Error?n.stack:void 0}},error:e};await l(t)}catch(e){console.error("Error in onError handler:",e)}},d=n.useMemo(()=>new i.CopilotRuntimeClient(Object.assign(Object.assign({},s),{handleGQLErrors:e=>{var n;if(null===(n=e.graphQLErrors)||void 0===n?void 0:n.length){const n=e=>{const n=e.extensions;if((null==n?void 0:n.visibility)===r.ErrorVisibility.SILENT)return void console.error("CopilotKit Silent Error:",e.message);const o=Date.now(),i=e.message;if(u.current&&u.current.message===i&&o-u.current.timestamp<150)return;u.current={message:i,timestamp:o};const l=function(e){var n,t,o;const i=e.extensions,l=null==i?void 0:i.originalError,s=(null==l?void 0:l.message)||e.message,a=null==i?void 0:i.code;if(a)return new r.CopilotKitError({message:s,code:a});if(null===(n=null==l?void 0:l.stack)||void 0===n?void 0:n.includes("CopilotApiDiscoveryError"))return new r.CopilotKitApiDiscoveryError({message:s});if(null===(t=null==l?void 0:l.stack)||void 0===t?void 0:t.includes("CopilotKitRemoteEndpointDiscoveryError"))return new r.CopilotKitRemoteEndpointDiscoveryError({message:s});if(null===(o=null==l?void 0:l.stack)||void 0===o?void 0:o.includes("CopilotKitAgentDiscoveryError"))return new r.CopilotKitAgentDiscoveryError({agentName:"",availableAgents:[]});return null}(e);if(l)t(l),c(l,e);else{const n=new r.CopilotKitError({message:e.message,code:r.CopilotKitErrorCode.UNKNOWN});t(n),c(n,e)}};e.graphQLErrors.forEach(n)}else{const n=new r.CopilotKitError({message:(null==e?void 0:e.message)||String(e),code:r.CopilotKitErrorCode.UNKNOWN});t(n),c(n,e)}},handleGQLWarning:e=>{console.warn(e);const n=new r.CopilotKitError({message:e,code:r.CopilotKitErrorCode.UNKNOWN});t(n)}})),[s,t,l]);return d},e.useDefaultTool=function(e,n){ui(Object.assign(Object.assign({},e),{name:"*"}),n)},e.useFrontendTool=ii,e.useHumanInTheLoop=si,e.useLangGraphInterrupt=function(e,t){const{setInterruptAction:o,removeInterruptAction:i,interruptActions:l,threadId:s}=n.useContext(b),{addToast:a}=j(),u=r.dataToUUID(e,"lgAction");n.useEffect(()=>{if(e)return o(Object.assign(Object.assign({},e),{id:u})),()=>{i(u)}},[o,i,s,u,...t||[]])},e.useLangGraphInterruptRender=ni,e.useLazyToolRenderer=ti,e.useMakeCopilotDocumentReadable=function(e,t,r=[]){const{addDocumentContext:o,removeDocumentContext:i}=x(),l=n.useRef(void 0);return n.useEffect(()=>{const n=o(e,t);return l.current=n,()=>{i(n)}},[o,i,...r]),l.current},e.useRenderToolCall=li,e.useThreads=Fo});
|
|
39
|
+
//# sourceMappingURL=index.umd.js.map
|