"use strict";(self.webpackChunksage_agent_internal=self.webpackChunksage_agent_internal||[]).push([[439],{7820:(n,t)=>{function r(n){if(void 0!==n){if(null===n)return null;if(""===n)return"";n=n.replace(/\\+$/,n=>n.length%2==0?n:n.slice(0,-1));try{return JSON.parse(n)}catch(t){const[s,i]=":"===n.trimLeft()[0]?e(n,t):e(n,t,h);if(r.lastParseReminding=i,r.onExtraToken&&i.length>0){const t=i.trimRight();r.lastParseReminding=t,t.length>0&&r.onExtraToken(n,s,t)}return s}}}function e(n,t,r){const e=i[n[0]]||r;if(!e)throw console.error(`no parser registered for ${JSON.stringify(n[0])}:`,{s:n}),t;return e(n,t)}function s(n,t,r){return'"'===n[0]?l(n):"'"===n[0]?g(n):h(n,0,r)}Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0,t.parse=r,function(n){n.onExtraToken=(n,t,r)=>{console.error("parsed json with extra tokens:",{text:n,data:t,reminding:r})}}(r=t.parse||(t.parse={}));const i={};function o(n){return n.trimLeft()}function u(n,t){return e(n=o(n),t)}i[" "]=u,i["\r"]=u,i["\n"]=u,i["\t"]=u,i["["]=function(n,t){const r=[];for(n=o(n=n.substr(1));n.length>0;){if("]"===n[0]){n=n.substr(1);break}const s=e(n,t,(n,t)=>h(n,0,[",","]"]));r.push(s[0]),","===(n=o(n=s[1]))[0]&&(n=o(n=n.substring(1)))}return[r,n]};for(const n of"0123456789.-".slice())i[n]=c;function c(n){for(let t=0;t<n.length;t++){const r=n[t];if(i[r]===c)continue;const e=n.substring(0,t);return n=n.substring(t),[f(e),n]}return[f(n),""]}function f(n){if("-"===n)return-0;const t=+n;return Number.isNaN(t)?n:t}function l(n){for(let t=1;t<n.length;t++){const r=n[t];if("\\"!==r){if('"'===r){const r=a(n.substring(0,t+1));return n=n.substring(t+1),[JSON.parse(r),n]}}else t++}return[JSON.parse(a(n)+'"'),""]}function a(n){return n.replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}function g(n){for(let t=1;t<n.length;t++){const r=n[t];if("\\"!==r){if("'"===r){const r=a(n.substring(0,t+1));return n=n.substring(t+1),[JSON.parse('"'+r.slice(1,-1)+'"'),n]}}else t++}return[JSON.parse('"'+a(n.slice(1))+'"'),""]}function h(n,t,r=[" "]){const e=Math.min(...r.map(t=>{const r=n.indexOf(t);return-1===r?n.length:r}));return[n.substring(0,e).trim(),n.substring(e)]}function b(n,t,r,e){for(let e=t.length;e>=1;e--)if(n.startsWith(t.slice(0,e)))return[r,n.slice(e)];{const r=JSON.stringify(n.slice(0,t.length));throw console.error(`unknown token starting with ${r}:`,{s:n}),e}}i['"']=l,i["'"]=g,i["{"]=function(n,t){const r={};for(n=o(n=n.substr(1));n.length>0;){if("}"===n[0]){n=n.substr(1);break}const i=s(n,0,[":","}"]),u=i[0];if(":"!==(n=o(n=i[1]))[0]){r[u]=void 0;break}if(0===(n=o(n=n.substr(1))).length){r[u]=void 0;break}const c=e(n,t);r[u]=c[0],","===(n=o(n=c[1]))[0]&&(n=o(n=n.substr(1)))}return[r,n]},i.t=function(n,t){return b(n,"true",!0,t)},i.f=function(n,t){return b(n,"false",!1,t)},i.n=function(n,t){return b(n,"null",null,t)}}}]);