granclaw 0.0.1-beta.97 → 0.0.1-beta.98

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.
@@ -1,9 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.registerBrowserProvider = registerBrowserProvider;
40
+ exports.registerBrowserKiller = registerBrowserKiller;
41
+ exports.killBrowser = killBrowser;
7
42
  exports._resetBrowserProvidersForTests = _resetBrowserProvidersForTests;
8
43
  exports.buildArgv = buildArgv;
9
44
  exports.cdpNavigate = cdpNavigate;
@@ -16,8 +51,31 @@ const providers = [];
16
51
  function registerBrowserProvider(provider) {
17
52
  providers.push(provider);
18
53
  }
54
+ const killers = [];
55
+ function registerBrowserKiller(killer) {
56
+ killers.push(killer);
57
+ }
58
+ async function killBrowser(agentId) {
59
+ for (const killer of killers) {
60
+ try {
61
+ await killer(agentId);
62
+ }
63
+ catch { }
64
+ }
65
+ try {
66
+ fs_1.default.unlinkSync(`/tmp/granclaw-cdp-${agentId}.url`);
67
+ }
68
+ catch { }
69
+ try {
70
+ const { execFileSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
71
+ const bin = process.env.AGENT_BROWSER_BIN ?? 'agent-browser';
72
+ execFileSync(bin, ['--session', agentId, 'close'], { timeout: 5000, stdio: 'pipe' });
73
+ }
74
+ catch { }
75
+ }
19
76
  function _resetBrowserProvidersForTests() {
20
77
  providers.length = 0;
78
+ killers.length = 0;
21
79
  }
22
80
  function buildArgv(res, command, args) {
23
81
  return [...res.preCommandArgs, command, ...args, ...res.postCommandArgs];
@@ -838,6 +838,41 @@ async function runAgent(agent, message, onChunk, options) {
838
838
  },
839
839
  });
840
840
  });
841
+ extensionFactories.push((pi) => {
842
+ pi.registerTool({
843
+ name: 'browser_restart',
844
+ label: 'Restart Browser',
845
+ description: 'Kill the browser process and force a fresh start on the next browser command. ' +
846
+ 'Cookies, logins, and profile data are preserved — only the process is restarted. ' +
847
+ 'Use when the browser is hung, unresponsive, showing stale state, or after a proxy change.',
848
+ promptSnippet: 'Kill and respawn the browser daemon (cookies survive)',
849
+ promptGuidelines: [
850
+ 'Use when browser commands timeout repeatedly or the browser appears hung.',
851
+ 'Use after you receive BROWSER_BLOCKED if you want a clean process before retrying.',
852
+ 'Cookies and saved logins persist — only the process is restarted.',
853
+ 'The next browser command after this will spawn a fresh browser automatically.',
854
+ ],
855
+ parameters: { type: 'object', properties: {} },
856
+ async execute() {
857
+ try {
858
+ if (browserState.handle) {
859
+ try {
860
+ await (0, session_manager_js_1.finalizeSession)(browserState.handle, 'closed');
861
+ }
862
+ catch { }
863
+ browserState.handle = null;
864
+ }
865
+ await (0, browser_bin_js_1.killBrowser)(agent.id);
866
+ return { content: [{ type: 'text', text: 'Browser killed. Cookies and logins are preserved. The next browser command will spawn a fresh instance.' }] };
867
+ }
868
+ catch (err) {
869
+ browserState.handle = null;
870
+ const msg = err instanceof Error ? err.message : String(err);
871
+ return { content: [{ type: 'text', text: `browser_restart partial: ${msg} — next browser call will still spawn fresh.` }] };
872
+ }
873
+ },
874
+ });
875
+ });
841
876
  extensionFactories.push((pi) => {
842
877
  pi.registerTool({
843
878
  name: 'request_human_browser_takeover',
@@ -1530,6 +1530,7 @@ function createServer() {
1530
1530
  (0, loader_js_1.loadExtensions)({
1531
1531
  app,
1532
1532
  registerBrowserProvider: browser_bin_js_1.registerBrowserProvider,
1533
+ registerBrowserKiller: browser_bin_js_1.registerBrowserKiller,
1533
1534
  registerCdpSession: browser_live_js_1.registerExternalCdpSession,
1534
1535
  removeCdpSession: browser_live_js_1.removeExternalCdpSession,
1535
1536
  registerTakeoverResolvedListener: takeover_listeners_js_1.registerTakeoverResolvedListener,
@@ -87,7 +87,7 @@ Esto eliminará permanentemente:
87
87
  • Memoria de sesión de Claude
88
88
  • Archivos del espacio de trabajo
89
89
 
90
- Esta acción no se puede deshacer.`,guardian:"Guardián",comingSoon:"Próximamente",guardianBlurb1:"Configura un agente guardián para controlar lo que puede hacer tu agente principal.",guardianBlurb2:"Define restricciones, bloquea acciones y exige aprobación antes de operaciones sensibles.",guardianChatBlurb:"Chat del guardián.<br />Configura restricciones aquí.",guardianDisconnected:"○ desconectado",errorCreditLimit:"La clave API ha alcanzado su límite de gasto. Recarga créditos o aumenta el límite de la clave en el panel de tu proveedor.",errorRateLimit:"Límite de solicitudes excedido. El proveedor está limitando las peticiones — intenta de nuevo en unos segundos.",errorAuth:"Autenticación fallida. La clave API puede ser inválida o estar expirada — revisa Configuración.",errorNoProvider:"Sin proveedor configurado. Ve a Configuración para agregar uno.",errorNoKey:"Falta la clave API del proveedor. Ve a Configuración para reconfigurar.",errorTimeout:"El agente tardó demasiado en responder. Intenta de nuevo o simplifica tu solicitud.",errorGeneric:"Algo salió mal: {message}"},jM={sessionExpiredLabel:"toma de control",sessionExpired:"Sesión expirada",sessionExpiredBlurb:"Este enlace de toma de control ya fue usado o expiró.",completeLabel:"completo",controlReturned:"Control devuelto al agente",closeTab:"Puedes cerrar esta pestaña.",connecting:"conectando…",agentNeedsHelp:"El agente necesita tu ayuda",liveLabel:"en vivo",waitingStream:"esperando transmisión del navegador…",browserStarting:"iniciando el navegador — la transmisión comenzará cuando cargue una página",browserNotReady:"el navegador está entre páginas — esperando la próxima navegación",whatDidYouDo:"¿Qué hiciste?",optional:"(opcional)",describeActionPlaceholder:"Describe tu acción para el agente…",returning:"Devolviendo…",completed:"Completado",urlBarPlaceholder:"Escribe una URL y pulsa Intro para navegar…"},PM={title:"Habilidades",subtitle:"Habilidades que tu agente puede invocar. Las habilidades invocables por el usuario se pueden activar desde el chat con /barra-comando.",empty:"No hay habilidades instaladas todavía. Viven en .pi/skills/ dentro del workspace del agente.",loading:"Cargando habilidades…",selectSkill:"Selecciona una habilidad a la izquierda para ver su definición completa.",userInvocable:"invocable por usuario",allowedTools:"Herramientas permitidas",loadError:"No se pudo cargar la habilidad: {error}"},TM={columns:{backlog:"PENDIENTE",inProgress:"EN PROGRESO",scheduled:"PROGRAMADO",toReview:"EN REVISIÓN",done:"COMPLETADO",cancelled:"CANCELADO"},statusLabels:{backlog:"Pendiente",inProgress:"En progreso",scheduled:"Programado",toReview:"En revisión",done:"Completado",cancelled:"Cancelado"},editedBy:"editado por {name}",relativeNow:"ahora",relativeMinutes:"hace {n}m",relativeHours:"hace {n}h",relativeDays:"hace {n}d",titlePlaceholder:"Título de tarea…",descPlaceholder:"Descripción (markdown)…",add:"Agregar",cancel:"Cancelar"},MM={saving:"guardando…",close:"Cerrar",status:"Estado",sourceLabel:"fuente",editedByLabel:"editado por",created:"creado",updated:"actualizado",description:"Descripción",descPlaceholder:"Agregar una descripción…",save:"Guardar",cancel:"Cancelar",descEmpty:"Sin descripción — clic para agregar",commentsLabel:"Comentarios ({count})",noComments:"Sin comentarios aún",addComment:"Agregar comentario",commentPlaceholder:"Escribe un comentario… (markdown soportado)",publishComment:"Publicar comentario",publishing:"Publicando…",dangerZone:"Zona peligrosa",deleteTask:"[PELIGROSO] Eliminar tarea",deleting:"eliminando…",deleteConfirm:'¿Eliminar tarea "{title}"? Esta acción no se puede deshacer.'},RM={backToRuns:"← Volver a ejecuciones",loading:"Cargando…",waitingResponse:"Esperando respuesta…",triggering:"Iniciando…",runNow:"Ejecutar ahora",runHistory:"Historial de ejecuciones",noRuns:"Sin ejecuciones aún.",loadingList:"Cargando programados…",emptyIcon:"⏰",emptyText:"Sin programados aún. Pídele al agente que configure tareas recurrentes.",title:"Programados",activeCountOne:"{count} activo",activeCountOther:"{count} activos",next:"Próximo: {time}",last:"Último: {time}",pause:"Pausar",resume:"Reanudar",delete:"Eliminar",deleteConfirm:'¿Eliminar programado "{name}"?'},DM={title:"Flujos de trabajo",emptyText:"Sin flujos de trabajo aún. Pídele al agente que cree uno via chat.",running:"Ejecutando…",run:"Ejecutar",createdOn:"{id} · Creado {date}",back:"← Volver a flujos",run_button:"Ejecutar",stepsTitle:"Pasos ({count})",conditionsOne:"{count} condición",conditionsOther:"{count} condiciones",stepType:"Tipo: {type}",stepTimeout:"Límite de tiempo: {seconds}s",stepId:"ID: {id}",runHistoryTitle:"Historial de ejecuciones ({count})",noRuns:"Sin ejecuciones aún.",runStatus:{running:"en ejecución",completed:"completado",failed:"fallido",cancelled:"cancelado"},newWorkflow:"Nuevo flujo",editWorkflow:"Editar flujo",edit:"Editar",delete:"Eliminar",cancel:"Cancelar",save:"Guardar",saving:"Guardando…",addStep:"Añadir paso",addStepTitle:"Añadir paso",editStepTitle:"Editar paso",moveUp:"Subir",moveDown:"Bajar",noSteps:'Aún no hay pasos. Haz clic en "Añadir paso" para empezar.',confirmDelete:'¿Eliminar el flujo "{name}"? Esto no se puede deshacer.',confirmDeleteStep:'¿Eliminar el paso "{name}"?',formName:"Nombre",formNamePlaceholder:"Resumen diario de LinkedIn",formDescription:"Descripción",formDescriptionPlaceholder:"¿Qué hace este flujo?",formStatus:"Estado",stepNameLabel:"Nombre del paso",stepNamePlaceholder:"Recoger últimas publicaciones",stepTypeLabel:"Tipo",stepScriptLabel:"Script",stepScriptPlaceholder:'echo "hola"',stepShellLabel:"Shell",stepTimeoutLabel:"Tiempo límite (segundos)",stepPromptLabel:"Prompt",stepPromptPlaceholder:"Resume la salida del paso anterior…",stepModelLabel:"Modelo (opcional)",stepModelPlaceholder:"claude-sonnet-4-6"},AM={loading:"Cargando ejecución…",back:"← Volver al flujo",runLabel:"Ejecución —",errorPrefix:"Error:",input:"Entrada",output:"Salida",activity:"Actividad",cancel:"Cancelar ejecución",cancelling:"Cancelando…"},LM={loading:"Cargando monitor…",title:"Monitor",idle:"inactivo",claudeSessionsOne:"{count} sesión claude",claudeSessionsOther:"{count} sesiones claude",processes:"Procesos",agentProcess:"Proceso del Agente",guardianProcess:"Guardián (Big Brother)",browserDaemon:"Demonio de Navegador",activeClaudeSessions:"Sesiones Claude Activas — {count}",jobQueue:"Cola de trabajos — {processing} en proceso, {pending} en espera",noActiveJobs:"Sin trabajos activos",processing:"procesando",queued:"en cola",terminate:"Terminar",cancel:"Cancelar",runningWorkflows:"Flujos de trabajo en ejecución",cpu:"CPU",mem:"MEM",rss:"RSS",uptime:"Tiempo activo"},IM={title:"Integraciones",blurb:"Conecta servicios externos. Cada integración almacena un token como secreto y se activa automáticamente.",moreSoon:"Más integraciones próximamente. Para otras claves API y credenciales, usa la sección de Secretos en la barra lateral.",connected:"Conectado",disconnect:"Desconectar",connect:"Conectar",saveAndConnect:"Guardar y conectar",saving:"Guardando…",cancel:"Cancelar",newPrefix:"Nuevo {label}",pasteNewToken:"Pega el nuevo token",updateToken:"Actualizar token",rotateToken:"Rotar token",errorSave:"Error al guardar — revisa la consola",disconnectConfirm:"¿Desconectar {name}? El agente dejará de usarlo inmediatamente.",telegramDescription:"Recibe y responde mensajes a través de un bot de Telegram.",telegramHelp:"Crea un bot mediante @BotFather en Telegram, luego pega el token aquí.",telegramTokenLabel:"Token del bot"},OM={loading:"Escaneando sesiones…",title:"Uso",totalTokens:"Tokens totales",cachedSuffix:"{amount} en caché",sessions:"Sesiones",modelsCount:"{count} modelos",estCost:"Costo est.",periodDays:"Período de {days} días",avgDay:"Prom/Día",sessionsPerDay:"{count} sesiones/día",dailyTokenUsage:"Uso diario de tokens",noUsageData:"Sin datos de uso",dailyCost:"Costo estimado diario",noCostData:"Sin datos de costo",byModel:"Por modelo",modelSessionsBlurb:"{sessions} sesiones · {input} entrada · {output} salida",tokenBreakdown:"Desglose de tokens",inputTokens:"Tokens de entrada",outputTokens:"Tokens de salida",cacheRead:"Lectura de caché",cacheWrite:"Escritura de caché",toolInvocations:"Invocaciones de herramientas",dailyBreakdown:"Desglose diario",date:"Fecha",tableSessions:"Sesiones",tableInput:"Entrada",tableOutput:"Salida",tableCache:"Caché",tableCost:"Costo"},FM={searchPlaceholder:"Buscar registros…",apply:"Aplicar",live:"En vivo",loading:"cargando…",noResults:'sin resultados para "{query}"',noEntries:"sin entradas de registro",loadOlder:"Cargar {count} entradas anteriores…"},$M={views:{chat:"Chat",tasks:"Tareas",skills:"Habilidades",browser:"Navegador",files:"Archivos",workflows:"Flujos de trabajo",schedules:"Programados",monitor:"Monitor",usage:"Uso",logs:"Registros",integrations:"Integraciones",guardian:"Guardián"},comingSoon:"Pronto",secrets:"Secretos",noSecrets:"Sin secretos configurados",updating:"Actualizando {name}",newValue:"nuevo valor",save:"Guardar",secretNamePlaceholder:"NOMBRE",secretValuePlaceholder:"valor",guardrails:"Restricciones",guardrailsBlurb:"Configurado via chat guardián",exportAgent:"📦 Exportar agente",exportTitle:"Descargar una copia de seguridad completa del espacio de trabajo del agente como zip",wipeAgent:"🗑 Borrar agente",wiping:"borrando…"},zM={workspace:"espacio-de-trabajo",savingLabel:"guardando…",saveButton:"Guardar",emptyDir:"Directorio vacío"},BM={common:kM,shell:SM,dashboard:CM,settings:EM,chat:NM,takeover:jM,skillsView:PM,tasks:TM,taskDetail:MM,schedules:RM,workflows:DM,runDetail:AM,monitor:LM,integrations:IM,usage:OM,logs:FM,agentSettings:$M,files:zM},Fy={en:wM,es:BM},nS="granclaw:lang";function WM(){if(typeof window>"u")return"en";try{const t=window.localStorage.getItem(nS);if(t==="en"||t==="es")return t}catch{}return(typeof navigator<"u"?navigator.language:"").toLowerCase().startsWith("es")?"es":"en"}function $y(e,t){const n=t.split(".");let r=e;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return typeof r=="string"?r:void 0}function HM(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const i=t[r];return i==null?`{${r}}`:String(i)}):e}const rS=E.createContext(null);function VM({children:e}){const[t,n]=E.useState(()=>WM()),r=E.useCallback(o=>{n(o);try{window.localStorage.setItem(nS,o)}catch{}},[]);E.useEffect(()=>{try{document.documentElement.lang=t}catch{}},[t]);const i=E.useCallback((o,a)=>{const l=Fy[t],c=$y(l,o)??$y(Fy.en,o)??o;return HM(c,a)},[t]),s=E.useMemo(()=>({lang:t,setLang:r,t:i}),[t,r,i]);return h.jsx(rS.Provider,{value:s,children:e})}function we(){const e=E.useContext(rS);if(!e)throw new Error("useT must be used inside <LanguageProvider>");return e}function UM({className:e}){const{lang:t,setLang:n}=we();return h.jsx("div",{className:`flex items-center gap-0.5 rounded-full bg-surface-container/40 p-[2px] ${e??""}`,children:["en","es"].map(r=>h.jsx("button",{onClick:()=>n(r),className:`px-2 py-[2px] rounded-full text-[10px] font-mono uppercase tracking-wider transition-colors ${t===r?"bg-primary/30 text-primary":"text-on-surface-variant/70 hover:text-on-surface"}`,"aria-pressed":t===r,children:r},r))})}function qM(){const e=ss(),t=os(),n=e.pathname.includes("/chat"),{t:r}=we();return h.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-surface",children:[h.jsxs("header",{className:"flex h-11 flex-shrink-0 items-center justify-between border-b border-outline-variant/20 bg-surface-low px-3 sm:px-5",children:[h.jsxs("button",{onClick:()=>t("/dashboard"),className:"flex items-center gap-2 hover:opacity-80 transition-opacity min-w-0",children:[h.jsx("img",{src:"/granclaw-logo.png",alt:"GranClaw",className:"h-6 w-6 rounded flex-shrink-0"}),h.jsx("span",{className:"font-display font-semibold text-on-surface tracking-tight truncate",children:"GranClaw"}),h.jsxs("span",{className:"text-xs font-mono text-on-surface/60 flex-shrink-0",children:["v","0.0.1-beta.97"]})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsx(UM,{}),h.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-secondary-container/20 px-2 sm:px-3 py-1 text-xs font-mono text-secondary flex-shrink-0",children:[h.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-secondary animate-pulse flex-shrink-0"}),h.jsx("span",{className:"hidden sm:inline",children:r("shell.systemPrefix")}),r("shell.onlineSuffix")]})]})]}),h.jsx("main",{className:`flex-1 overflow-auto min-w-0 ${n?"":"p-3 sm:p-5"}`,children:h.jsx(WP,{})})]})}const se="";async function zy(){const e=await fetch(`${se}/agents`);if(!e.ok)throw new Error(`fetchAgents: ${e.status}`);return e.json()}async function GM(e,t,n,r,i){const s=await fetch(`${se}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,name:t,model:n,provider:r,...i?{workspaceDir:i}:{}})});if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Error(o.error)}}async function KM(e){const t=await fetch(`${se}/agents/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(`deleteAgent: ${t.status}`)}async function By(e){const t=await fetch(`${se}/agents/${e}`);if(!t.ok)throw new Error(`fetchAgent: ${t.status}`);return t.json()}async function Wy(e,t="ui"){const n=await fetch(`${se}/agents/${e}/messages?channelId=${t}&sortBy=desc&limit=200`,{cache:"no-store"});if(!n.ok)throw new Error(`fetchMessages: ${n.status}`);return(await n.json()).reverse()}async function YM(e){const t=await fetch(`${se}/agents/${e}/reset`,{method:"DELETE"});if(!t.ok)throw new Error(`resetAgent: ${t.status}`)}async function XM(e,t=""){const n=await fetch(`${se}/agents/${e}/files?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`fetchFiles: ${n.status}`);return(await n.json()).entries}async function JM(e,t){const n=await fetch(`${se}/agents/${e}/files/read?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`readFile: ${n.status}`);return(await n.json()).content}async function QM(e,t,n){const r=await fetch(`${se}/agents/${e}/files/write?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});if(!r.ok)throw new Error(`writeFile: ${r.status}`)}async function ZM(e){const t=await fetch(`${se}/agents/${e}/secrets`);if(!t.ok)throw new Error(`fetchSecrets: ${t.status}`);return t.json()}async function Dp(e,t,n){const r=await fetch(`${se}/agents/${e}/secrets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,value:n})});if(!r.ok)throw new Error(`addSecret: ${r.status}`)}async function iS(e,t){const n=await fetch(`${se}/agents/${e}/secrets/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteSecret: ${n.status}`)}async function eR(e){const t=await fetch(`${se}/agents/${e}/skills`);if(!t.ok)throw new Error(`fetchSkills: ${t.status}`);return(await t.json()).skills}async function tR(e,t){const n=t.split("/").map(encodeURIComponent).join("/"),r=await fetch(`${se}/agents/${e}/skills/${n}`);if(!r.ok)throw new Error(`fetchSkillDetail: ${r.status}`);return r.json()}async function nR(e,t){const r=await fetch(`${se}/agents/${e}/tasks`);if(!r.ok)throw new Error(`fetchTasks: ${r.status}`);return r.json()}async function rR(e,t){const n=await fetch(`${se}/agents/${e}/tasks/${t}`);if(!n.ok)throw new Error(`fetchTask: ${n.status}`);return n.json()}async function iR(e,t){const n=await fetch(`${se}/agents/${e}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`createTask: ${n.status}`);return n.json()}async function Hy(e,t,n){const r=await fetch(`${se}/agents/${e}/tasks/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`updateTask: ${r.status}`);return r.json()}async function sR(e,t){const n=await fetch(`${se}/agents/${e}/tasks/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteTask: ${n.status}`)}async function oR(e,t,n){const r=await fetch(`${se}/agents/${e}/tasks/${t}/comments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:n})});if(!r.ok)throw new Error(`addTaskComment: ${r.status}`);return r.json()}async function aR(e){const t=await fetch(`${se}/agents/${e}/browser-sessions`);if(!t.ok)throw new Error(`fetchBrowserSessions: ${t.status}`);return t.json()}async function sS(e,t){const n=await fetch(`${se}/agents/${e}/browser-sessions/${t}`);if(!n.ok)throw new Error(`fetchBrowserSession: ${n.status}`);return n.json()}function lR(e,t){return`${se}/agents/${e}/browser-sessions/${t}/video`}function oS(e,t){const n=window.location;return`${n.protocol==="https:"?"wss:":"ws:"}//${n.host}/browser-live/${e}/${t}`}function cR(e){return`${se}/agents/${e}/export`}async function Vy(e,t){const n=new URL(`${se}/agents/import`,window.location.origin);t!=null&&t.id&&n.searchParams.set("id",t.id);const r=await fetch(n.toString().replace(window.location.origin,""),{method:"POST",headers:{"Content-Type":"application/zip"},body:e});if(!r.ok){const i=await r.json().catch(()=>({error:r.statusText}));throw new Error(i.error)}return r.json()}async function Uy(e,t){const n=await fetch(`${se}/agents/${e}/monitor/jobs/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`killJob: ${n.status}`)}async function uR(e){const t=await fetch(`${se}/agents/${e}/monitor`);if(!t.ok)throw new Error(`fetchMonitor: ${t.status}`);return t.json()}async function dR(e,t=30){const n=await fetch(`${se}/agents/${e}/usage?days=${t}`);if(!n.ok)throw new Error(`fetchUsage: ${n.status}`);return n.json()}async function hR(e){const t=await fetch(`${se}/agents/${e}/schedules`);if(!t.ok)throw new Error(`fetchSchedules: ${t.status}`);return t.json()}async function fR(e,t,n){const r=await fetch(`${se}/agents/${e}/schedules/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`updateSchedule: ${r.status}`);return r.json()}async function pR(e,t){const n=await fetch(`${se}/agents/${e}/schedules/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteSchedule: ${n.status}`)}async function gR(e,t){const n=await fetch(`${se}/agents/${e}/schedules/${t}/trigger`,{method:"POST"});if(!n.ok)throw new Error(`triggerSchedule: ${n.status}`);return n.json()}async function mR(e,t){const n=await fetch(`${se}/agents/${e}/schedules/${t}/runs`);if(!n.ok)throw new Error(`fetchScheduleRuns: ${n.status}`);return n.json()}async function xR(e,t){const n=await fetch(`${se}/agents/${e}/messages?channelId=${encodeURIComponent(t)}&sortBy=asc&limit=200`);if(!n.ok)throw new Error(`fetchScheduleRunMessages: ${n.status}`);return n.json()}async function vR(e){const t=await fetch(`${se}/agents/${e}/workflows`);if(!t.ok)throw new Error(`fetchWorkflows: ${t.status}`);return t.json()}async function qy(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}`);if(!n.ok)throw new Error(`fetchWorkflow: ${n.status}`);return n.json()}async function Sh(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}/runs`);if(!n.ok)throw new Error(`fetchWorkflowRuns: ${n.status}`);return n.json()}async function yR(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/runs/${n}`);if(!r.ok)throw new Error(`fetchWorkflowRun: ${r.status}`);return r.json()}async function bR(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}/run`,{method:"POST"});if(!n.ok)throw new Error(`triggerWorkflowRun: ${n.status}`);return n.json()}async function _R(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/runs/${n}/cancel`,{method:"POST"});if(!r.ok)throw new Error(`cancelWorkflowRun: ${r.status}`)}async function wR(e,t){const n=await fetch(`${se}/agents/${e}/workflows`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`createWorkflow: ${n.status}`);return n.json()}async function kR(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`updateWorkflow: ${r.status}`);return r.json()}async function SR(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteWorkflow: ${n.status}`)}async function CR(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/steps`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`createStep: ${r.status}`);return r.json()}async function Ch(e,t,n,r){const i=await fetch(`${se}/agents/${e}/workflows/${t}/steps/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw new Error(`updateStep: ${i.status}`);return i.json()}async function ER(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/steps/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`deleteStep: ${r.status}`)}async function NR(e){const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.type&&t.set("type",e.type),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!=null&&t.set("offset",String(e.offset));const n=await fetch(`${se}/logs?${t}`);if(!n.ok)throw new Error(`fetchLogs: ${n.status}`);return n.json()}async function aS(){const e=await fetch(`${se}/settings/provider`);if(!e.ok)throw new Error("Failed to fetch provider settings");return e.json()}const Eh={showWorkspaceDirConfig:!0,showBraveSearchConfig:!0,enableIntegrations:!1};async function lS(){try{const e=await fetch(`${se}/settings/app`);if(!e.ok)return{...Eh};const t=await e.json();return{...Eh,...t}}catch{return{...Eh}}}async function Gy(e,t,n){if(!(await fetch(`${se}/settings/provider`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,model:t,apiKey:n})})).ok)throw new Error("Failed to save provider settings")}async function jR(e){if(!(await fetch(`${se}/settings/providers/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to remove provider")}async function PR(){const e=await fetch(`${se}/settings/search`);return e.ok?e.json():{provider:"brave",configured:!1}}async function TR(e,t){const n=await fetch(`${se}/settings/search`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!n.ok)throw new Error(`Failed to save search settings: ${n.status}`)}async function MR(){const e=await fetch(`${se}/settings/search`,{method:"DELETE"});if(!e.ok&&e.status!==204&&e.status!==404)throw new Error(`Failed to clear search settings: ${e.status}`)}const RR={google:[{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash — fast + smart (recommended)"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro — most capable"},{value:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite — cheapest"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash — preview"},{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro — preview"}],openai:[{value:"gpt-4.1",label:"GPT-4.1 — recommended, 1M ctx"},{value:"gpt-4.1-mini",label:"GPT-4.1 Mini — fast, efficient"},{value:"gpt-4.1-nano",label:"GPT-4.1 Nano — cheapest"}],anthropic:[{value:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 — recommended"},{value:"claude-opus-4-6",label:"Claude Opus 4.6 — most capable"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5 — fastest"}],groq:[{value:"openai/gpt-oss-120b",label:"GPT-OSS 120B — flagship, ~500 tok/s"},{value:"openai/gpt-oss-20b",label:"GPT-OSS 20B — fast, efficient"},{value:"llama-3.3-70b-versatile",label:"Llama 3.3 70B — versatile"},{value:"llama-3.1-8b-instant",label:"Llama 3.1 8B — fastest/cheapest"}],openrouter:[{value:"google/gemini-2.5-flash",label:"Gemini 2.5 Flash — best price/perf ($0.30/$2.50 /M)"},{value:"google/gemini-3-flash-preview",label:"Gemini 3 Flash — fast, 1M ctx ($0.50/$3 /M)"},{value:"google/gemini-3.1-pro-preview",label:"Gemini 3.1 Pro — frontier ($2/$12 /M)"},{value:"deepseek/deepseek-v3.2",label:"DeepSeek V3.2 — cheap output ($0.26/$0.38 /M)"},{value:"xiaomi/mimo-v2-pro",label:"MiMo V2 Pro — agentic, 1T params ($1/$3 /M)"},{value:"qwen/qwen3.6-plus",label:"Qwen 3.6 Plus — throughput leader ($0.33/$1.95 /M)"},{value:"minimax/minimax-m2.7",label:"MiniMax M2.7 — agentic ($0.30/$1.20 /M)"},{value:"x-ai/grok-4",label:"Grok 4 — reasoning, 256k ctx ($3/$15 /M)"}],freetier:[{value:"z-ai/glm-5-turbo",label:"GLM 5 Turbo — enterprise default"}]},cS=[{value:"google",label:"Google Gemini"},{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"openrouter",label:"OpenRouter"}];function fd(e){return RR[e]??[]}function Ap(e){var t;return((t=fd(e)[0])==null?void 0:t.value)??""}const Ui="inline-flex items-center justify-center gap-2 bg-primary text-on-primary px-5 py-2.5 text-sm font-label font-semibold uppercase tracking-widest rounded shadow-sm transition-all hover:bg-surface-tint hover:shadow-md active:scale-[0.98] disabled:opacity-40 disabled:pointer-events-none",Cm="inline-flex items-center justify-center gap-2 border border-outline-variant text-on-surface px-5 py-2.5 text-sm font-label font-semibold uppercase tracking-widest rounded transition-all hover:bg-surface-container hover:border-outline active:scale-[0.98] disabled:opacity-40 disabled:pointer-events-none",qr="inline-flex items-center justify-center gap-1.5 text-on-surface-variant px-2.5 py-1.5 text-xs font-label font-medium uppercase tracking-wider rounded transition-colors hover:bg-surface-container hover:text-on-surface disabled:opacity-40 disabled:pointer-events-none",Ru="inline-flex items-center justify-center gap-1.5 text-error px-2.5 py-1.5 text-xs font-label font-medium uppercase tracking-wider rounded transition-colors hover:bg-error/10 disabled:opacity-40 disabled:pointer-events-none",an="w-full bg-surface-container-lowest text-on-surface placeholder:text-on-surface-variant border border-outline-variant rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",Lp=an.replace("text-sm","text-sm font-mono"),nl="bg-surface-container-lowest border border-outline-variant/40 rounded-xl shadow-callout",Gs="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-label font-medium uppercase tracking-wider",Pc=`${Gs} bg-surface-container border border-outline-variant/40 text-on-surface-variant`,Ip=`${Gs} bg-success/10 border border-success/20 text-success`,Ky=`${Gs} bg-warning/10 border border-warning/20 text-warning`;function DR({agent:e,onDelete:t}){const n=os(),{t:r}=we(),i=e.status==="active",s=e.busy===!0;return h.jsxs("div",{onClick:()=>n(`/agents/${e.id}/chat`),className:"group flex items-center gap-4 rounded-xl bg-surface-container-lowest border border-outline-variant/40 p-4 cursor-pointer transition-all hover:border-primary/40 hover:shadow-callout",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"font-headline text-lg font-bold text-on-surface",children:e.name}),s?h.jsxs("span",{"data-testid":"busy-badge",className:"inline-flex items-center gap-1 rounded-full bg-secondary/15 border border-secondary/30 px-2 py-0.5 text-[10px] font-label font-semibold uppercase tracking-wider text-secondary",children:[h.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-secondary animate-pulse"}),"busy"]}):h.jsx("span",{className:i?Ip:Pc,children:e.status})]}),h.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[h.jsx("span",{className:"font-mono text-[10px] text-primary/70",children:e.model}),h.jsxs("span",{className:"font-mono text-[10px] text-on-surface-variant/60 hidden sm:inline",children:["id: ",e.id]})]})]}),h.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:h.jsx("button",{onClick:o=>{o.stopPropagation(),t()},className:`${Ru} sm:opacity-0 sm:group-hover:opacity-100`,children:r("dashboard.delete")})})]})}function AR(){const{t:e}=we(),[t,n]=E.useState([]),[r,i]=E.useState(!0),[s,o]=E.useState(null),[a,l]=E.useState({showWorkspaceDirConfig:!0,showBraveSearchConfig:!0,enableIntegrations:!1}),[c,u]=E.useState(!1),[d,f]=E.useState(""),[p,g]=E.useState(""),[m,y]=E.useState(""),[x,v]=E.useState(""),[b,S]=E.useState(""),[k,_]=E.useState(!1),[C,j]=E.useState(!1),[P,w]=E.useState(null),M=E.useRef(null);async function D(N){var te,T;const Q=(te=N.target.files)==null?void 0:te[0];if(Q){j(!0),w(null);try{let re;try{re=await Vy(Q)}catch(le){const ae=le instanceof Error?le.message:String(le);if(ae.includes("already exists")){const R=(T=prompt(`${ae}
90
+ Esta acción no se puede deshacer.`,guardian:"Guardián",comingSoon:"Próximamente",guardianBlurb1:"Configura un agente guardián para controlar lo que puede hacer tu agente principal.",guardianBlurb2:"Define restricciones, bloquea acciones y exige aprobación antes de operaciones sensibles.",guardianChatBlurb:"Chat del guardián.<br />Configura restricciones aquí.",guardianDisconnected:"○ desconectado",errorCreditLimit:"La clave API ha alcanzado su límite de gasto. Recarga créditos o aumenta el límite de la clave en el panel de tu proveedor.",errorRateLimit:"Límite de solicitudes excedido. El proveedor está limitando las peticiones — intenta de nuevo en unos segundos.",errorAuth:"Autenticación fallida. La clave API puede ser inválida o estar expirada — revisa Configuración.",errorNoProvider:"Sin proveedor configurado. Ve a Configuración para agregar uno.",errorNoKey:"Falta la clave API del proveedor. Ve a Configuración para reconfigurar.",errorTimeout:"El agente tardó demasiado en responder. Intenta de nuevo o simplifica tu solicitud.",errorGeneric:"Algo salió mal: {message}"},jM={sessionExpiredLabel:"toma de control",sessionExpired:"Sesión expirada",sessionExpiredBlurb:"Este enlace de toma de control ya fue usado o expiró.",completeLabel:"completo",controlReturned:"Control devuelto al agente",closeTab:"Puedes cerrar esta pestaña.",connecting:"conectando…",agentNeedsHelp:"El agente necesita tu ayuda",liveLabel:"en vivo",waitingStream:"esperando transmisión del navegador…",browserStarting:"iniciando el navegador — la transmisión comenzará cuando cargue una página",browserNotReady:"el navegador está entre páginas — esperando la próxima navegación",whatDidYouDo:"¿Qué hiciste?",optional:"(opcional)",describeActionPlaceholder:"Describe tu acción para el agente…",returning:"Devolviendo…",completed:"Completado",urlBarPlaceholder:"Escribe una URL y pulsa Intro para navegar…"},PM={title:"Habilidades",subtitle:"Habilidades que tu agente puede invocar. Las habilidades invocables por el usuario se pueden activar desde el chat con /barra-comando.",empty:"No hay habilidades instaladas todavía. Viven en .pi/skills/ dentro del workspace del agente.",loading:"Cargando habilidades…",selectSkill:"Selecciona una habilidad a la izquierda para ver su definición completa.",userInvocable:"invocable por usuario",allowedTools:"Herramientas permitidas",loadError:"No se pudo cargar la habilidad: {error}"},TM={columns:{backlog:"PENDIENTE",inProgress:"EN PROGRESO",scheduled:"PROGRAMADO",toReview:"EN REVISIÓN",done:"COMPLETADO",cancelled:"CANCELADO"},statusLabels:{backlog:"Pendiente",inProgress:"En progreso",scheduled:"Programado",toReview:"En revisión",done:"Completado",cancelled:"Cancelado"},editedBy:"editado por {name}",relativeNow:"ahora",relativeMinutes:"hace {n}m",relativeHours:"hace {n}h",relativeDays:"hace {n}d",titlePlaceholder:"Título de tarea…",descPlaceholder:"Descripción (markdown)…",add:"Agregar",cancel:"Cancelar"},MM={saving:"guardando…",close:"Cerrar",status:"Estado",sourceLabel:"fuente",editedByLabel:"editado por",created:"creado",updated:"actualizado",description:"Descripción",descPlaceholder:"Agregar una descripción…",save:"Guardar",cancel:"Cancelar",descEmpty:"Sin descripción — clic para agregar",commentsLabel:"Comentarios ({count})",noComments:"Sin comentarios aún",addComment:"Agregar comentario",commentPlaceholder:"Escribe un comentario… (markdown soportado)",publishComment:"Publicar comentario",publishing:"Publicando…",dangerZone:"Zona peligrosa",deleteTask:"[PELIGROSO] Eliminar tarea",deleting:"eliminando…",deleteConfirm:'¿Eliminar tarea "{title}"? Esta acción no se puede deshacer.'},RM={backToRuns:"← Volver a ejecuciones",loading:"Cargando…",waitingResponse:"Esperando respuesta…",triggering:"Iniciando…",runNow:"Ejecutar ahora",runHistory:"Historial de ejecuciones",noRuns:"Sin ejecuciones aún.",loadingList:"Cargando programados…",emptyIcon:"⏰",emptyText:"Sin programados aún. Pídele al agente que configure tareas recurrentes.",title:"Programados",activeCountOne:"{count} activo",activeCountOther:"{count} activos",next:"Próximo: {time}",last:"Último: {time}",pause:"Pausar",resume:"Reanudar",delete:"Eliminar",deleteConfirm:'¿Eliminar programado "{name}"?'},DM={title:"Flujos de trabajo",emptyText:"Sin flujos de trabajo aún. Pídele al agente que cree uno via chat.",running:"Ejecutando…",run:"Ejecutar",createdOn:"{id} · Creado {date}",back:"← Volver a flujos",run_button:"Ejecutar",stepsTitle:"Pasos ({count})",conditionsOne:"{count} condición",conditionsOther:"{count} condiciones",stepType:"Tipo: {type}",stepTimeout:"Límite de tiempo: {seconds}s",stepId:"ID: {id}",runHistoryTitle:"Historial de ejecuciones ({count})",noRuns:"Sin ejecuciones aún.",runStatus:{running:"en ejecución",completed:"completado",failed:"fallido",cancelled:"cancelado"},newWorkflow:"Nuevo flujo",editWorkflow:"Editar flujo",edit:"Editar",delete:"Eliminar",cancel:"Cancelar",save:"Guardar",saving:"Guardando…",addStep:"Añadir paso",addStepTitle:"Añadir paso",editStepTitle:"Editar paso",moveUp:"Subir",moveDown:"Bajar",noSteps:'Aún no hay pasos. Haz clic en "Añadir paso" para empezar.',confirmDelete:'¿Eliminar el flujo "{name}"? Esto no se puede deshacer.',confirmDeleteStep:'¿Eliminar el paso "{name}"?',formName:"Nombre",formNamePlaceholder:"Resumen diario de LinkedIn",formDescription:"Descripción",formDescriptionPlaceholder:"¿Qué hace este flujo?",formStatus:"Estado",stepNameLabel:"Nombre del paso",stepNamePlaceholder:"Recoger últimas publicaciones",stepTypeLabel:"Tipo",stepScriptLabel:"Script",stepScriptPlaceholder:'echo "hola"',stepShellLabel:"Shell",stepTimeoutLabel:"Tiempo límite (segundos)",stepPromptLabel:"Prompt",stepPromptPlaceholder:"Resume la salida del paso anterior…",stepModelLabel:"Modelo (opcional)",stepModelPlaceholder:"claude-sonnet-4-6"},AM={loading:"Cargando ejecución…",back:"← Volver al flujo",runLabel:"Ejecución —",errorPrefix:"Error:",input:"Entrada",output:"Salida",activity:"Actividad",cancel:"Cancelar ejecución",cancelling:"Cancelando…"},LM={loading:"Cargando monitor…",title:"Monitor",idle:"inactivo",claudeSessionsOne:"{count} sesión claude",claudeSessionsOther:"{count} sesiones claude",processes:"Procesos",agentProcess:"Proceso del Agente",guardianProcess:"Guardián (Big Brother)",browserDaemon:"Demonio de Navegador",activeClaudeSessions:"Sesiones Claude Activas — {count}",jobQueue:"Cola de trabajos — {processing} en proceso, {pending} en espera",noActiveJobs:"Sin trabajos activos",processing:"procesando",queued:"en cola",terminate:"Terminar",cancel:"Cancelar",runningWorkflows:"Flujos de trabajo en ejecución",cpu:"CPU",mem:"MEM",rss:"RSS",uptime:"Tiempo activo"},IM={title:"Integraciones",blurb:"Conecta servicios externos. Cada integración almacena un token como secreto y se activa automáticamente.",moreSoon:"Más integraciones próximamente. Para otras claves API y credenciales, usa la sección de Secretos en la barra lateral.",connected:"Conectado",disconnect:"Desconectar",connect:"Conectar",saveAndConnect:"Guardar y conectar",saving:"Guardando…",cancel:"Cancelar",newPrefix:"Nuevo {label}",pasteNewToken:"Pega el nuevo token",updateToken:"Actualizar token",rotateToken:"Rotar token",errorSave:"Error al guardar — revisa la consola",disconnectConfirm:"¿Desconectar {name}? El agente dejará de usarlo inmediatamente.",telegramDescription:"Recibe y responde mensajes a través de un bot de Telegram.",telegramHelp:"Crea un bot mediante @BotFather en Telegram, luego pega el token aquí.",telegramTokenLabel:"Token del bot"},OM={loading:"Escaneando sesiones…",title:"Uso",totalTokens:"Tokens totales",cachedSuffix:"{amount} en caché",sessions:"Sesiones",modelsCount:"{count} modelos",estCost:"Costo est.",periodDays:"Período de {days} días",avgDay:"Prom/Día",sessionsPerDay:"{count} sesiones/día",dailyTokenUsage:"Uso diario de tokens",noUsageData:"Sin datos de uso",dailyCost:"Costo estimado diario",noCostData:"Sin datos de costo",byModel:"Por modelo",modelSessionsBlurb:"{sessions} sesiones · {input} entrada · {output} salida",tokenBreakdown:"Desglose de tokens",inputTokens:"Tokens de entrada",outputTokens:"Tokens de salida",cacheRead:"Lectura de caché",cacheWrite:"Escritura de caché",toolInvocations:"Invocaciones de herramientas",dailyBreakdown:"Desglose diario",date:"Fecha",tableSessions:"Sesiones",tableInput:"Entrada",tableOutput:"Salida",tableCache:"Caché",tableCost:"Costo"},FM={searchPlaceholder:"Buscar registros…",apply:"Aplicar",live:"En vivo",loading:"cargando…",noResults:'sin resultados para "{query}"',noEntries:"sin entradas de registro",loadOlder:"Cargar {count} entradas anteriores…"},$M={views:{chat:"Chat",tasks:"Tareas",skills:"Habilidades",browser:"Navegador",files:"Archivos",workflows:"Flujos de trabajo",schedules:"Programados",monitor:"Monitor",usage:"Uso",logs:"Registros",integrations:"Integraciones",guardian:"Guardián"},comingSoon:"Pronto",secrets:"Secretos",noSecrets:"Sin secretos configurados",updating:"Actualizando {name}",newValue:"nuevo valor",save:"Guardar",secretNamePlaceholder:"NOMBRE",secretValuePlaceholder:"valor",guardrails:"Restricciones",guardrailsBlurb:"Configurado via chat guardián",exportAgent:"📦 Exportar agente",exportTitle:"Descargar una copia de seguridad completa del espacio de trabajo del agente como zip",wipeAgent:"🗑 Borrar agente",wiping:"borrando…"},zM={workspace:"espacio-de-trabajo",savingLabel:"guardando…",saveButton:"Guardar",emptyDir:"Directorio vacío"},BM={common:kM,shell:SM,dashboard:CM,settings:EM,chat:NM,takeover:jM,skillsView:PM,tasks:TM,taskDetail:MM,schedules:RM,workflows:DM,runDetail:AM,monitor:LM,integrations:IM,usage:OM,logs:FM,agentSettings:$M,files:zM},Fy={en:wM,es:BM},nS="granclaw:lang";function WM(){if(typeof window>"u")return"en";try{const t=window.localStorage.getItem(nS);if(t==="en"||t==="es")return t}catch{}return(typeof navigator<"u"?navigator.language:"").toLowerCase().startsWith("es")?"es":"en"}function $y(e,t){const n=t.split(".");let r=e;for(const i of n)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return typeof r=="string"?r:void 0}function HM(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const i=t[r];return i==null?`{${r}}`:String(i)}):e}const rS=E.createContext(null);function VM({children:e}){const[t,n]=E.useState(()=>WM()),r=E.useCallback(o=>{n(o);try{window.localStorage.setItem(nS,o)}catch{}},[]);E.useEffect(()=>{try{document.documentElement.lang=t}catch{}},[t]);const i=E.useCallback((o,a)=>{const l=Fy[t],c=$y(l,o)??$y(Fy.en,o)??o;return HM(c,a)},[t]),s=E.useMemo(()=>({lang:t,setLang:r,t:i}),[t,r,i]);return h.jsx(rS.Provider,{value:s,children:e})}function we(){const e=E.useContext(rS);if(!e)throw new Error("useT must be used inside <LanguageProvider>");return e}function UM({className:e}){const{lang:t,setLang:n}=we();return h.jsx("div",{className:`flex items-center gap-0.5 rounded-full bg-surface-container/40 p-[2px] ${e??""}`,children:["en","es"].map(r=>h.jsx("button",{onClick:()=>n(r),className:`px-2 py-[2px] rounded-full text-[10px] font-mono uppercase tracking-wider transition-colors ${t===r?"bg-primary/30 text-primary":"text-on-surface-variant/70 hover:text-on-surface"}`,"aria-pressed":t===r,children:r},r))})}function qM(){const e=ss(),t=os(),n=e.pathname.includes("/chat"),{t:r}=we();return h.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-surface",children:[h.jsxs("header",{className:"flex h-11 flex-shrink-0 items-center justify-between border-b border-outline-variant/20 bg-surface-low px-3 sm:px-5",children:[h.jsxs("button",{onClick:()=>t("/dashboard"),className:"flex items-center gap-2 hover:opacity-80 transition-opacity min-w-0",children:[h.jsx("img",{src:"/granclaw-logo.png",alt:"GranClaw",className:"h-6 w-6 rounded flex-shrink-0"}),h.jsx("span",{className:"font-display font-semibold text-on-surface tracking-tight truncate",children:"GranClaw"}),h.jsxs("span",{className:"text-xs font-mono text-on-surface/60 flex-shrink-0",children:["v","0.0.1-beta.98"]})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsx(UM,{}),h.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-secondary-container/20 px-2 sm:px-3 py-1 text-xs font-mono text-secondary flex-shrink-0",children:[h.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-secondary animate-pulse flex-shrink-0"}),h.jsx("span",{className:"hidden sm:inline",children:r("shell.systemPrefix")}),r("shell.onlineSuffix")]})]})]}),h.jsx("main",{className:`flex-1 overflow-auto min-w-0 ${n?"":"p-3 sm:p-5"}`,children:h.jsx(WP,{})})]})}const se="";async function zy(){const e=await fetch(`${se}/agents`);if(!e.ok)throw new Error(`fetchAgents: ${e.status}`);return e.json()}async function GM(e,t,n,r,i){const s=await fetch(`${se}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,name:t,model:n,provider:r,...i?{workspaceDir:i}:{}})});if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Error(o.error)}}async function KM(e){const t=await fetch(`${se}/agents/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(`deleteAgent: ${t.status}`)}async function By(e){const t=await fetch(`${se}/agents/${e}`);if(!t.ok)throw new Error(`fetchAgent: ${t.status}`);return t.json()}async function Wy(e,t="ui"){const n=await fetch(`${se}/agents/${e}/messages?channelId=${t}&sortBy=desc&limit=200`,{cache:"no-store"});if(!n.ok)throw new Error(`fetchMessages: ${n.status}`);return(await n.json()).reverse()}async function YM(e){const t=await fetch(`${se}/agents/${e}/reset`,{method:"DELETE"});if(!t.ok)throw new Error(`resetAgent: ${t.status}`)}async function XM(e,t=""){const n=await fetch(`${se}/agents/${e}/files?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`fetchFiles: ${n.status}`);return(await n.json()).entries}async function JM(e,t){const n=await fetch(`${se}/agents/${e}/files/read?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`readFile: ${n.status}`);return(await n.json()).content}async function QM(e,t,n){const r=await fetch(`${se}/agents/${e}/files/write?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});if(!r.ok)throw new Error(`writeFile: ${r.status}`)}async function ZM(e){const t=await fetch(`${se}/agents/${e}/secrets`);if(!t.ok)throw new Error(`fetchSecrets: ${t.status}`);return t.json()}async function Dp(e,t,n){const r=await fetch(`${se}/agents/${e}/secrets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,value:n})});if(!r.ok)throw new Error(`addSecret: ${r.status}`)}async function iS(e,t){const n=await fetch(`${se}/agents/${e}/secrets/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteSecret: ${n.status}`)}async function eR(e){const t=await fetch(`${se}/agents/${e}/skills`);if(!t.ok)throw new Error(`fetchSkills: ${t.status}`);return(await t.json()).skills}async function tR(e,t){const n=t.split("/").map(encodeURIComponent).join("/"),r=await fetch(`${se}/agents/${e}/skills/${n}`);if(!r.ok)throw new Error(`fetchSkillDetail: ${r.status}`);return r.json()}async function nR(e,t){const r=await fetch(`${se}/agents/${e}/tasks`);if(!r.ok)throw new Error(`fetchTasks: ${r.status}`);return r.json()}async function rR(e,t){const n=await fetch(`${se}/agents/${e}/tasks/${t}`);if(!n.ok)throw new Error(`fetchTask: ${n.status}`);return n.json()}async function iR(e,t){const n=await fetch(`${se}/agents/${e}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`createTask: ${n.status}`);return n.json()}async function Hy(e,t,n){const r=await fetch(`${se}/agents/${e}/tasks/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`updateTask: ${r.status}`);return r.json()}async function sR(e,t){const n=await fetch(`${se}/agents/${e}/tasks/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteTask: ${n.status}`)}async function oR(e,t,n){const r=await fetch(`${se}/agents/${e}/tasks/${t}/comments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:n})});if(!r.ok)throw new Error(`addTaskComment: ${r.status}`);return r.json()}async function aR(e){const t=await fetch(`${se}/agents/${e}/browser-sessions`);if(!t.ok)throw new Error(`fetchBrowserSessions: ${t.status}`);return t.json()}async function sS(e,t){const n=await fetch(`${se}/agents/${e}/browser-sessions/${t}`);if(!n.ok)throw new Error(`fetchBrowserSession: ${n.status}`);return n.json()}function lR(e,t){return`${se}/agents/${e}/browser-sessions/${t}/video`}function oS(e,t){const n=window.location;return`${n.protocol==="https:"?"wss:":"ws:"}//${n.host}/browser-live/${e}/${t}`}function cR(e){return`${se}/agents/${e}/export`}async function Vy(e,t){const n=new URL(`${se}/agents/import`,window.location.origin);t!=null&&t.id&&n.searchParams.set("id",t.id);const r=await fetch(n.toString().replace(window.location.origin,""),{method:"POST",headers:{"Content-Type":"application/zip"},body:e});if(!r.ok){const i=await r.json().catch(()=>({error:r.statusText}));throw new Error(i.error)}return r.json()}async function Uy(e,t){const n=await fetch(`${se}/agents/${e}/monitor/jobs/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`killJob: ${n.status}`)}async function uR(e){const t=await fetch(`${se}/agents/${e}/monitor`);if(!t.ok)throw new Error(`fetchMonitor: ${t.status}`);return t.json()}async function dR(e,t=30){const n=await fetch(`${se}/agents/${e}/usage?days=${t}`);if(!n.ok)throw new Error(`fetchUsage: ${n.status}`);return n.json()}async function hR(e){const t=await fetch(`${se}/agents/${e}/schedules`);if(!t.ok)throw new Error(`fetchSchedules: ${t.status}`);return t.json()}async function fR(e,t,n){const r=await fetch(`${se}/agents/${e}/schedules/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`updateSchedule: ${r.status}`);return r.json()}async function pR(e,t){const n=await fetch(`${se}/agents/${e}/schedules/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteSchedule: ${n.status}`)}async function gR(e,t){const n=await fetch(`${se}/agents/${e}/schedules/${t}/trigger`,{method:"POST"});if(!n.ok)throw new Error(`triggerSchedule: ${n.status}`);return n.json()}async function mR(e,t){const n=await fetch(`${se}/agents/${e}/schedules/${t}/runs`);if(!n.ok)throw new Error(`fetchScheduleRuns: ${n.status}`);return n.json()}async function xR(e,t){const n=await fetch(`${se}/agents/${e}/messages?channelId=${encodeURIComponent(t)}&sortBy=asc&limit=200`);if(!n.ok)throw new Error(`fetchScheduleRunMessages: ${n.status}`);return n.json()}async function vR(e){const t=await fetch(`${se}/agents/${e}/workflows`);if(!t.ok)throw new Error(`fetchWorkflows: ${t.status}`);return t.json()}async function qy(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}`);if(!n.ok)throw new Error(`fetchWorkflow: ${n.status}`);return n.json()}async function Sh(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}/runs`);if(!n.ok)throw new Error(`fetchWorkflowRuns: ${n.status}`);return n.json()}async function yR(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/runs/${n}`);if(!r.ok)throw new Error(`fetchWorkflowRun: ${r.status}`);return r.json()}async function bR(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}/run`,{method:"POST"});if(!n.ok)throw new Error(`triggerWorkflowRun: ${n.status}`);return n.json()}async function _R(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/runs/${n}/cancel`,{method:"POST"});if(!r.ok)throw new Error(`cancelWorkflowRun: ${r.status}`)}async function wR(e,t){const n=await fetch(`${se}/agents/${e}/workflows`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`createWorkflow: ${n.status}`);return n.json()}async function kR(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`updateWorkflow: ${r.status}`);return r.json()}async function SR(e,t){const n=await fetch(`${se}/agents/${e}/workflows/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`deleteWorkflow: ${n.status}`)}async function CR(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/steps`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`createStep: ${r.status}`);return r.json()}async function Ch(e,t,n,r){const i=await fetch(`${se}/agents/${e}/workflows/${t}/steps/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw new Error(`updateStep: ${i.status}`);return i.json()}async function ER(e,t,n){const r=await fetch(`${se}/agents/${e}/workflows/${t}/steps/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`deleteStep: ${r.status}`)}async function NR(e){const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.type&&t.set("type",e.type),e!=null&&e.search&&t.set("search",e.search),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),(e==null?void 0:e.offset)!=null&&t.set("offset",String(e.offset));const n=await fetch(`${se}/logs?${t}`);if(!n.ok)throw new Error(`fetchLogs: ${n.status}`);return n.json()}async function aS(){const e=await fetch(`${se}/settings/provider`);if(!e.ok)throw new Error("Failed to fetch provider settings");return e.json()}const Eh={showWorkspaceDirConfig:!0,showBraveSearchConfig:!0,enableIntegrations:!1};async function lS(){try{const e=await fetch(`${se}/settings/app`);if(!e.ok)return{...Eh};const t=await e.json();return{...Eh,...t}}catch{return{...Eh}}}async function Gy(e,t,n){if(!(await fetch(`${se}/settings/provider`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,model:t,apiKey:n})})).ok)throw new Error("Failed to save provider settings")}async function jR(e){if(!(await fetch(`${se}/settings/providers/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to remove provider")}async function PR(){const e=await fetch(`${se}/settings/search`);return e.ok?e.json():{provider:"brave",configured:!1}}async function TR(e,t){const n=await fetch(`${se}/settings/search`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!n.ok)throw new Error(`Failed to save search settings: ${n.status}`)}async function MR(){const e=await fetch(`${se}/settings/search`,{method:"DELETE"});if(!e.ok&&e.status!==204&&e.status!==404)throw new Error(`Failed to clear search settings: ${e.status}`)}const RR={google:[{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash — fast + smart (recommended)"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro — most capable"},{value:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite — cheapest"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash — preview"},{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro — preview"}],openai:[{value:"gpt-4.1",label:"GPT-4.1 — recommended, 1M ctx"},{value:"gpt-4.1-mini",label:"GPT-4.1 Mini — fast, efficient"},{value:"gpt-4.1-nano",label:"GPT-4.1 Nano — cheapest"}],anthropic:[{value:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 — recommended"},{value:"claude-opus-4-6",label:"Claude Opus 4.6 — most capable"},{value:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5 — fastest"}],groq:[{value:"openai/gpt-oss-120b",label:"GPT-OSS 120B — flagship, ~500 tok/s"},{value:"openai/gpt-oss-20b",label:"GPT-OSS 20B — fast, efficient"},{value:"llama-3.3-70b-versatile",label:"Llama 3.3 70B — versatile"},{value:"llama-3.1-8b-instant",label:"Llama 3.1 8B — fastest/cheapest"}],openrouter:[{value:"google/gemini-2.5-flash",label:"Gemini 2.5 Flash — best price/perf ($0.30/$2.50 /M)"},{value:"google/gemini-3-flash-preview",label:"Gemini 3 Flash — fast, 1M ctx ($0.50/$3 /M)"},{value:"google/gemini-3.1-pro-preview",label:"Gemini 3.1 Pro — frontier ($2/$12 /M)"},{value:"deepseek/deepseek-v3.2",label:"DeepSeek V3.2 — cheap output ($0.26/$0.38 /M)"},{value:"xiaomi/mimo-v2-pro",label:"MiMo V2 Pro — agentic, 1T params ($1/$3 /M)"},{value:"qwen/qwen3.6-plus",label:"Qwen 3.6 Plus — throughput leader ($0.33/$1.95 /M)"},{value:"minimax/minimax-m2.7",label:"MiniMax M2.7 — agentic ($0.30/$1.20 /M)"},{value:"x-ai/grok-4",label:"Grok 4 — reasoning, 256k ctx ($3/$15 /M)"}],freetier:[{value:"z-ai/glm-5-turbo",label:"GLM 5 Turbo — enterprise default"}]},cS=[{value:"google",label:"Google Gemini"},{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"openrouter",label:"OpenRouter"}];function fd(e){return RR[e]??[]}function Ap(e){var t;return((t=fd(e)[0])==null?void 0:t.value)??""}const Ui="inline-flex items-center justify-center gap-2 bg-primary text-on-primary px-5 py-2.5 text-sm font-label font-semibold uppercase tracking-widest rounded shadow-sm transition-all hover:bg-surface-tint hover:shadow-md active:scale-[0.98] disabled:opacity-40 disabled:pointer-events-none",Cm="inline-flex items-center justify-center gap-2 border border-outline-variant text-on-surface px-5 py-2.5 text-sm font-label font-semibold uppercase tracking-widest rounded transition-all hover:bg-surface-container hover:border-outline active:scale-[0.98] disabled:opacity-40 disabled:pointer-events-none",qr="inline-flex items-center justify-center gap-1.5 text-on-surface-variant px-2.5 py-1.5 text-xs font-label font-medium uppercase tracking-wider rounded transition-colors hover:bg-surface-container hover:text-on-surface disabled:opacity-40 disabled:pointer-events-none",Ru="inline-flex items-center justify-center gap-1.5 text-error px-2.5 py-1.5 text-xs font-label font-medium uppercase tracking-wider rounded transition-colors hover:bg-error/10 disabled:opacity-40 disabled:pointer-events-none",an="w-full bg-surface-container-lowest text-on-surface placeholder:text-on-surface-variant border border-outline-variant rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",Lp=an.replace("text-sm","text-sm font-mono"),nl="bg-surface-container-lowest border border-outline-variant/40 rounded-xl shadow-callout",Gs="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-label font-medium uppercase tracking-wider",Pc=`${Gs} bg-surface-container border border-outline-variant/40 text-on-surface-variant`,Ip=`${Gs} bg-success/10 border border-success/20 text-success`,Ky=`${Gs} bg-warning/10 border border-warning/20 text-warning`;function DR({agent:e,onDelete:t}){const n=os(),{t:r}=we(),i=e.status==="active",s=e.busy===!0;return h.jsxs("div",{onClick:()=>n(`/agents/${e.id}/chat`),className:"group flex items-center gap-4 rounded-xl bg-surface-container-lowest border border-outline-variant/40 p-4 cursor-pointer transition-all hover:border-primary/40 hover:shadow-callout",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"font-headline text-lg font-bold text-on-surface",children:e.name}),s?h.jsxs("span",{"data-testid":"busy-badge",className:"inline-flex items-center gap-1 rounded-full bg-secondary/15 border border-secondary/30 px-2 py-0.5 text-[10px] font-label font-semibold uppercase tracking-wider text-secondary",children:[h.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-secondary animate-pulse"}),"busy"]}):h.jsx("span",{className:i?Ip:Pc,children:e.status})]}),h.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[h.jsx("span",{className:"font-mono text-[10px] text-primary/70",children:e.model}),h.jsxs("span",{className:"font-mono text-[10px] text-on-surface-variant/60 hidden sm:inline",children:["id: ",e.id]})]})]}),h.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:h.jsx("button",{onClick:o=>{o.stopPropagation(),t()},className:`${Ru} sm:opacity-0 sm:group-hover:opacity-100`,children:r("dashboard.delete")})})]})}function AR(){const{t:e}=we(),[t,n]=E.useState([]),[r,i]=E.useState(!0),[s,o]=E.useState(null),[a,l]=E.useState({showWorkspaceDirConfig:!0,showBraveSearchConfig:!0,enableIntegrations:!1}),[c,u]=E.useState(!1),[d,f]=E.useState(""),[p,g]=E.useState(""),[m,y]=E.useState(""),[x,v]=E.useState(""),[b,S]=E.useState(""),[k,_]=E.useState(!1),[C,j]=E.useState(!1),[P,w]=E.useState(null),M=E.useRef(null);async function D(N){var te,T;const Q=(te=N.target.files)==null?void 0:te[0];if(Q){j(!0),w(null);try{let re;try{re=await Vy(Q)}catch(le){const ae=le instanceof Error?le.message:String(le);if(ae.includes("already exists")){const R=(T=prompt(`${ae}
91
91
 
92
92
  Enter a new id for the imported agent:`,""))==null?void 0:T.trim();if(!R){j(!1);return}re=await Vy(Q,{id:R})}else throw le}await F(),$(`/agents/${re.id}/chat`)}catch(re){w(re instanceof Error?re.message:e("dashboard.importFailed"))}finally{j(!1),M.current&&(M.current.value="")}}}const F=()=>{Promise.all([zy(),aS(),lS()]).then(([N,Q,te])=>{var T;if(n(N),o(Q),l(te),!m){const re=(T=Q.providers)==null?void 0:T[0];re&&(y(re.provider),v(re.model))}}).catch(console.error).finally(()=>i(!1))};E.useEffect(()=>{F();const N=setInterval(()=>{zy().then(n).catch(()=>{})},2e3);return()=>clearInterval(N)},[]);const $=os(),L=(s==null?void 0:s.providers)??[],H=m?fd(m):[];function X(N){y(N),v(Ap(N))}async function I(){if(!(!d.trim()||!p.trim())){_(!0),w(null);try{const N=d.trim();await GM(N,p.trim(),x,m||void 0,b.trim()||void 0),$(`/agents/${N}/chat`)}catch(N){w(N instanceof Error?N.message:e("common.errorCreate")),_(!1)}}}async function B(N,Q){confirm(e("dashboard.deleteConfirm",{name:Q,id:N}))&&(await KM(N),F())}return r?h.jsx("div",{className:"font-mono text-xs text-on-surface-variant p-8",children:e("dashboard.loadingAgents")}):s&&!s.configured&&t.length===0?h.jsx("div",{className:"max-w-3xl mx-auto py-16 px-4",children:h.jsxs("div",{className:"text-center",children:[h.jsxs("h1",{className:"font-headline text-4xl font-bold text-on-surface mb-4",children:[e("dashboard.getStartedWith")," ",h.jsx("span",{className:"highlight-marker",children:"GranClaw"})]}),h.jsx("p",{className:"font-mono text-xs text-on-surface-variant mb-8",children:e("dashboard.configureProviderBlurb")}),h.jsx(Sv,{to:"/settings",className:Ui,children:e("dashboard.configureProvider")})]})}):h.jsxs("div",{className:"max-w-4xl mx-auto py-6 sm:py-8 px-4",children:[s&&!s.configured&&h.jsxs("div",{className:"rounded-xl bg-warning/10 border border-warning/30 px-4 py-3 mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[h.jsx("p",{className:"font-mono text-[11px] text-warning",children:e("dashboard.noProviderWarning")}),h.jsx(Sv,{to:"/settings",className:"font-label text-[11px] font-semibold uppercase tracking-widest text-primary hover:text-surface-tint flex-shrink-0",children:e("dashboard.configureArrow")})]}),h.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 mb-6 sm:mb-8",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"font-headline text-3xl sm:text-4xl font-bold text-on-surface",children:e("dashboard.title")}),h.jsx("p",{className:"font-mono text-[11px] text-on-surface-variant mt-1",children:e(t.length===1?"dashboard.agentsCountOne":"dashboard.agentsCountOther",{count:t.length})})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsx("input",{ref:M,type:"file",accept:".zip,application/zip",onChange:D,className:"hidden"}),h.jsx("button",{onClick:()=>{var N;return(N=M.current)==null?void 0:N.click()},disabled:C||!(s!=null&&s.configured),className:Cm,title:e("dashboard.importTitle"),children:e(C?"dashboard.importing":"dashboard.import")}),h.jsx("button",{onClick:()=>u(N=>!N),disabled:!(s!=null&&s.configured),className:Ui,children:e(c?"dashboard.cancel":"dashboard.newAgent")})]})]}),c&&h.jsxs("div",{className:`${nl} p-5 mb-6 space-y-3`,children:[h.jsx("p",{className:"font-label text-[10px] font-semibold uppercase tracking-widest text-on-surface-variant",children:e("dashboard.createNewAgent")}),h.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[h.jsx("input",{className:Lp,placeholder:e("dashboard.agentIdPlaceholder"),value:d,onChange:N=>f(N.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))}),h.jsx("input",{className:an,placeholder:e("dashboard.displayNamePlaceholder"),value:p,onChange:N=>g(N.target.value)})]}),h.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[h.jsx("select",{className:`${an} appearance-none`,value:m,onChange:N=>X(N.target.value),children:L.map(N=>h.jsx("option",{value:N.provider,children:N.label??N.provider},N.provider))}),h.jsx("select",{className:`${an} appearance-none`,value:x,onChange:N=>v(N.target.value),children:H.map(N=>h.jsx("option",{value:N.value,children:N.label},N.value))})]}),a.showWorkspaceDirConfig&&h.jsx("input",{className:Lp,placeholder:e("dashboard.workspacePlaceholder",{id:d||e("dashboard.workspacePlaceholderDefault")}),value:b,onChange:N=>S(N.target.value)}),h.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h.jsx("button",{onClick:I,disabled:k||!d.trim()||!p.trim()||!x,className:Ui,children:e(k?"dashboard.creating":"dashboard.create")}),P&&h.jsx("span",{className:"font-mono text-[10px] text-error",children:P})]})]}),h.jsx("div",{className:"space-y-3",children:t.length===0?h.jsxs("div",{className:"text-center py-16",children:[h.jsx("span",{className:"text-3xl opacity-30",children:"🤖"}),h.jsx("p",{className:"font-mono text-[11px] text-on-surface-variant mt-3",children:e("dashboard.noAgents")})]}):t.map(N=>h.jsx(DR,{agent:N,onDelete:()=>B(N.id,N.name)},N.id))})]})}function LR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const IR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FR={};function Yy(e,t){return(FR.jsx?OR:IR).test(e)}const $R=/[ \t\n\f\r]/g;function zR(e){return typeof e=="object"?e.type==="text"?Xy(e.value):!1:Xy(e)}function Xy(e){return e.replace($R,"")===""}class vl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}vl.prototype.normal={};vl.prototype.property={};vl.prototype.space=void 0;function uS(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new vl(n,r,t)}function Op(e){return e.toLowerCase()}class Zt{constructor(t,n){this.attribute=n,this.property=t}}Zt.prototype.attribute="";Zt.prototype.booleanish=!1;Zt.prototype.boolean=!1;Zt.prototype.commaOrSpaceSeparated=!1;Zt.prototype.commaSeparated=!1;Zt.prototype.defined=!1;Zt.prototype.mustUseProperty=!1;Zt.prototype.number=!1;Zt.prototype.overloadedBoolean=!1;Zt.prototype.property="";Zt.prototype.spaceSeparated=!1;Zt.prototype.space=void 0;let BR=0;const he=as(),st=as(),Fp=as(),W=as(),Le=as(),Ks=as(),nn=as();function as(){return 2**++BR}const $p=Object.freeze(Object.defineProperty({__proto__:null,boolean:he,booleanish:st,commaOrSpaceSeparated:nn,commaSeparated:Ks,number:W,overloadedBoolean:Fp,spaceSeparated:Le},Symbol.toStringTag,{value:"Module"})),Nh=Object.keys($p);class Em extends Zt{constructor(t,n,r,i){let s=-1;if(super(t,n),Jy(this,"space",i),typeof r=="number")for(;++s<Nh.length;){const o=Nh[s];Jy(this,Nh[s],(r&$p[o])===$p[o])}}}Em.prototype.defined=!0;function Jy(e,t,n){n&&(e[t]=n)}function vo(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Em(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Op(r)]=r,n[Op(s.attribute)]=r}return new vl(t,n,e.space)}const dS=vo({properties:{ariaActiveDescendant:null,ariaAtomic:st,ariaAutoComplete:null,ariaBusy:st,ariaChecked:st,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:Le,ariaCurrent:null,ariaDescribedBy:Le,ariaDetails:null,ariaDisabled:st,ariaDropEffect:Le,ariaErrorMessage:null,ariaExpanded:st,ariaFlowTo:Le,ariaGrabbed:st,ariaHasPopup:null,ariaHidden:st,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Le,ariaLevel:W,ariaLive:null,ariaModal:st,ariaMultiLine:st,ariaMultiSelectable:st,ariaOrientation:null,ariaOwns:Le,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:st,ariaReadOnly:st,ariaRelevant:null,ariaRequired:st,ariaRoleDescription:Le,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:st,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function hS(e,t){return t in e?e[t]:t}function fS(e,t){return hS(e,t.toLowerCase())}const WR=vo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ks,acceptCharset:Le,accessKey:Le,action:null,allow:null,allowFullScreen:he,allowPaymentRequest:he,allowUserMedia:he,alt:null,as:null,async:he,autoCapitalize:null,autoComplete:Le,autoFocus:he,autoPlay:he,blocking:Le,capture:null,charSet:null,checked:he,cite:null,className:Le,cols:W,colSpan:null,content:null,contentEditable:st,controls:he,controlsList:Le,coords:W|Ks,crossOrigin:null,data:null,dateTime:null,decoding:null,default:he,defer:he,dir:null,dirName:null,disabled:he,download:Fp,draggable:st,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:he,formTarget:null,headers:Le,height:W,hidden:Fp,high:W,href:null,hrefLang:null,htmlFor:Le,httpEquiv:Le,id:null,imageSizes:null,imageSrcSet:null,inert:he,inputMode:null,integrity:null,is:null,isMap:he,itemId:null,itemProp:Le,itemRef:Le,itemScope:he,itemType:Le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:he,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:he,muted:he,name:null,nonce:null,noModule:he,noValidate:he,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:he,optimum:W,pattern:null,ping:Le,placeholder:null,playsInline:he,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:he,referrerPolicy:null,rel:Le,required:he,reversed:he,rows:W,rowSpan:W,sandbox:Le,scope:null,scoped:he,seamless:he,selected:he,shadowRootClonable:he,shadowRootDelegatesFocus:he,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:st,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:he,useMap:null,value:st,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Le,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:he,declare:he,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:he,noHref:he,noShade:he,noWrap:he,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:st,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:he,disableRemotePlayback:he,prefix:null,property:null,results:W,security:null,unselectable:null},space:"html",transform:fS}),HR=vo({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"},properties:{about:nn,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:Le,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:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:he,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,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:Ks,g2:Ks,glyphName:Ks,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,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:W,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:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nn,rev:nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nn,requiredFeatures:nn,requiredFonts:nn,requiredFormats:nn,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:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nn,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hS}),pS=vo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),gS=vo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fS}),mS=vo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),VR={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"},UR=/[A-Z]/g,Qy=/-[a-z]/g,qR=/^data[-\w.:]+$/i;function GR(e,t){const n=Op(t);let r=t,i=Zt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&qR.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Qy,YR);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Qy.test(s)){let o=s.replace(UR,KR);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Em}return new i(r,t)}function KR(e){return"-"+e.toLowerCase()}function YR(e){return e.charAt(1).toUpperCase()}const XR=uS([dS,WR,pS,gS,mS],"html"),Nm=uS([dS,HR,pS,gS,mS],"svg");function JR(e){return e.join(" ").trim()}var jm={},Zy=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,QR=/\n/g,ZR=/^\s*/,eD=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,tD=/^:\s*/,nD=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,rD=/^[;\s]*/,iD=/^\s+|\s+$/g,sD=`
93
93
  `,e0="/",t0="*",Ii="",oD="comment",aD="declaration";function lD(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var m=g.match(QR);m&&(n+=m.length);var y=g.lastIndexOf(sD);r=~y?g.length-y:r+g.length}function s(){var g={line:n,column:r};return function(m){return m.position=new o(g),c(),m}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var m=new Error(t.source+":"+n+":"+r+": "+g);if(m.reason=g,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(g){var m=g.exec(e);if(m){var y=m[0];return i(y),e=e.slice(y.length),m}}function c(){l(ZR)}function u(g){var m;for(g=g||[];m=d();)m!==!1&&g.push(m);return g}function d(){var g=s();if(!(e0!=e.charAt(0)||t0!=e.charAt(1))){for(var m=2;Ii!=e.charAt(m)&&(t0!=e.charAt(m)||e0!=e.charAt(m+1));)++m;if(m+=2,Ii===e.charAt(m-1))return a("End of comment missing");var y=e.slice(2,m-2);return r+=2,i(y),e=e.slice(m),r+=2,g({type:oD,comment:y})}}function f(){var g=s(),m=l(eD);if(m){if(d(),!l(tD))return a("property missing ':'");var y=l(nD),x=g({type:aD,property:n0(m[0].replace(Zy,Ii)),value:y?n0(y[0].replace(Zy,Ii)):Ii});return l(rD),x}}function p(){var g=[];u(g);for(var m;m=f();)m!==!1&&(g.push(m),u(g));return g}return c(),p()}function n0(e){return e?e.replace(iD,Ii):Ii}var cD=lD,uD=Hc&&Hc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(jm,"__esModule",{value:!0});jm.default=hD;const dD=uD(cD);function hD(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,dD.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var pd={};Object.defineProperty(pd,"__esModule",{value:!0});pd.camelCase=void 0;var fD=/^--[a-zA-Z0-9_-]+$/,pD=/-([a-z])/g,gD=/^[^-]+$/,mD=/^-(webkit|moz|ms|o|khtml)-/,xD=/^-(ms)-/,vD=function(e){return!e||gD.test(e)||fD.test(e)},yD=function(e,t){return t.toUpperCase()},r0=function(e,t){return"".concat(t,"-")},bD=function(e,t){return t===void 0&&(t={}),vD(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(xD,r0):e=e.replace(mD,r0),e.replace(pD,yD))};pd.camelCase=bD;var _D=Hc&&Hc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},wD=_D(jm),kD=pd;function zp(e,t){var n={};return!e||typeof e!="string"||(0,wD.default)(e,function(r,i){r&&i&&(n[(0,kD.camelCase)(r,t)]=i)}),n}zp.default=zp;var SD=zp;const CD=hg(SD),xS=vS("end"),Pm=vS("start");function vS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ED(e){const t=Pm(e),n=xS(e);if(t&&n)return{start:t,end:n}}function ka(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?i0(e.position):"start"in e||"end"in e?i0(e):"line"in e||"column"in e?Bp(e):""}function Bp(e){return s0(e&&e.line)+":"+s0(e&&e.column)}function i0(e){return Bp(e&&e.start)+"-"+Bp(e&&e.end)}function s0(e){return e&&typeof e=="number"?e:1}class Dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=ka(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;const Tm={}.hasOwnProperty,ND=new Map,jD=/[A-Z]/g,PD=new Set(["table","tbody","thead","tfoot","tr"]),TD=new Set(["td","th"]),yS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function MD(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=$D(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=FD(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Nm:XR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=bS(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function bS(e,t,n){if(t.type==="element")return RD(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return DD(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return LD(e,t,n);if(t.type==="mdxjsEsm")return AD(e,t);if(t.type==="root")return ID(e,t,n);if(t.type==="text")return OD(e,t)}function RD(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Nm,e.schema=i),e.ancestors.push(t);const s=wS(e,t.tagName,!1),o=zD(e,t);let a=Rm(e,t);return PD.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!zR(l):!0})),_S(e,o,s,t),Mm(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function DD(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}rl(e,t.position)}function AD(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rl(e,t.position)}function LD(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Nm,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:wS(e,t.name,!0),o=BD(e,t),a=Rm(e,t);return _S(e,o,s,t),Mm(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function ID(e,t,n){const r={};return Mm(r,Rm(e,t)),e.create(t,e.Fragment,r,n)}function OD(e,t){return t.value}function _S(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Mm(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function FD(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function $D(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Pm(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function zD(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Tm.call(t.properties,i)){const s=WD(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&TD.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function BD(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else rl(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else rl(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Rm(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:ND;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=bS(e,s,o);a!==void 0&&n.push(a)}return n}function WD(e,t,n){const r=GR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?LR(n):JR(n)),r.property==="style"){let i=typeof n=="object"?n:HD(e,String(n));return e.stylePropertyNameCase==="css"&&(i=VD(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?VR[r.property]||r.property:r.attribute,n]}}function HD(e,t){try{return CD(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Dt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=yS+"#cannot-parse-style-attribute",i}}function wS(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=Yy(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=Yy(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Tm.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);rl(e)}function rl(e,t){const n=new Dt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=yS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function VD(e){const t={};let n;for(n in e)Tm.call(e,n)&&(t[UD(n)]=e[n]);return t}function UD(e){let t=e.replace(jD,qD);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function qD(e){return"-"+e.toLowerCase()}const jh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},GD={};function Dm(e,t){const n=GD,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return kS(e,r,i)}function kS(e,t,n){if(KD(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return o0(e.children,t,n)}return Array.isArray(e)?o0(e,t,n):""}function o0(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=kS(e[i],t,n);return r.join("")}function KD(e){return!!(e&&typeof e=="object")}const a0=document.createElement("i");function Am(e){const t="&"+e+";";a0.innerHTML=t;const n=a0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function hn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function kn(e,t){return e.length>0?(hn(e,e.length,0,t),e):t}const l0={}.hasOwnProperty;function SS(e){const t={};let n=-1;for(;++n<e.length;)YD(t,e[n]);return t}function YD(e,t){let n;for(n in t){const i=(l0.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){l0.call(i,o)||(i[o]=[]);const a=s[o];XD(i[o],Array.isArray(a)?a:a?[a]:[])}}}function XD(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);hn(e,0,0,r)}function CS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function zn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=bi(/[A-Za-z]/),Pt=bi(/[\dA-Za-z]/),JD=bi(/[#-'*+\--9=?A-Z^-~]/);function Du(e){return e!==null&&(e<32||e===127)}const Wp=bi(/\d/),QD=bi(/[\dA-Fa-f]/),ZD=bi(/[!-/:-@[-`{-~]/);function oe(e){return e!==null&&e<-2}function Ae(e){return e!==null&&(e<0||e===32)}function pe(e){return e===-2||e===-1||e===32}const gd=bi(new RegExp("\\p{P}|\\p{S}","u")),es=bi(/\s/);function bi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function yo(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&Pt(e.charCodeAt(n+1))&&Pt(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function _e(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return pe(l)?(e.enter(n),a(l)):t(l)}function a(l){return pe(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const eA={tokenize:tA};function tA(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),_e(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return oe(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const nA={tokenize:rA},c0={tokenize:iA};function rA(e){const t=this,n=[];let r=0,i,s,o;return a;function a(b){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const S=t.events.length;let k=S,_;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){_=t.events[k][1].end;break}x(r);let C=S;for(;C<t.events.length;)t.events[C][1].end={..._},C++;return hn(t.events,k+1,0,t.events.slice(S)),t.events.length=C,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return g(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(c0,u,d)(b)}function u(b){return i&&v(),x(r),f(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(b)}function f(b){return t.containerState={},e.attempt(c0,p,g)(b)}function p(b){return r++,n.push([t.currentConstruct,t.containerState]),f(b)}function g(b){if(b===null){i&&v(),x(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(b)}function m(b){if(b===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(b);return}return oe(b)?(e.consume(b),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),m)}function y(b,S){const k=t.sliceStream(b);if(S&&k.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(k),t.parser.lazy[b.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<o&&(!i.events[_][1].end||i.events[_][1].end.offset>o))return;const C=t.events.length;let j=C,P,w;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){if(P){w=t.events[j][1].end;break}P=!0}for(x(r),_=C;_<t.events.length;)t.events[_][1].end={...w},_++;hn(t.events,j+1,0,t.events.slice(C)),t.events.length=_}}function x(b){let S=n.length;for(;S-- >b;){const k=n[S];t.containerState=k[1],k[0].exit.call(t,e)}n.length=b}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function iA(e,t,n){return _e(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function lo(e){if(e===null||Ae(e)||es(e))return 1;if(gd(e))return 2}function md(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Hp={name:"attention",resolveAll:sA,tokenize:oA};function sA(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};u0(d,-l),u0(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=kn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=kn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=kn(c,md(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=kn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=kn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,hn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function oA(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=lo(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),u=lo(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!f)),c._close=!!(s===42?f:f&&(u||!d)),t(l)}}function u0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const aA={name:"autolink",tokenize:lA};function lA(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return $t(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||Pt(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Pt(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Du(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):JD(p)?(e.consume(p),c):n(p)}function u(p){return Pt(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Pt(p))&&r++<63){const g=p===45?f:d;return e.consume(p),g}return n(p)}}const yl={partial:!0,tokenize:cA};function cA(e,t,n){return r;function r(s){return pe(s)?_e(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||oe(s)?t(s):n(s)}}const ES={continuation:{tokenize:dA},exit:hA,name:"blockQuote",tokenize:uA};function uA(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return pe(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function dA(e,t,n){const r=this;return i;function i(o){return pe(o)?_e(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(ES,t,n)(o)}}function hA(e){e.exit("blockQuote")}const NS={name:"characterEscape",tokenize:fA};function fA(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return ZD(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const jS={name:"characterReference",tokenize:pA};function pA(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Pt,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=QD,u):(e.enter("characterReferenceValue"),s=7,o=Wp,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===Pt&&!Am(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),u):n(d)}}const d0={partial:!0,tokenize:mA},h0={concrete:!0,name:"codeFenced",tokenize:gA};function gA(e,t,n){const r=this,i={partial:!0,tokenize:k};let s=0,o=0,a;return l;function l(_){return c(_)}function c(_){const C=r.events[r.events.length-1];return s=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,a=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(_)}function u(_){return _===a?(o++,e.consume(_),u):o<3?n(_):(e.exit("codeFencedFenceSequence"),pe(_)?_e(e,d,"whitespace")(_):d(_))}function d(_){return _===null||oe(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(d0,m,S)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===null||oe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(_)):pe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_e(e,p,"whitespace")(_)):_===96&&_===a?n(_):(e.consume(_),f)}function p(_){return _===null||oe(_)?d(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||oe(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(_)):_===96&&_===a?n(_):(e.consume(_),g)}function m(_){return e.attempt(i,S,y)(_)}function y(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),x}function x(_){return s>0&&pe(_)?_e(e,v,"linePrefix",s+1)(_):v(_)}function v(_){return _===null||oe(_)?e.check(d0,m,S)(_):(e.enter("codeFlowValue"),b(_))}function b(_){return _===null||oe(_)?(e.exit("codeFlowValue"),v(_)):(e.consume(_),b)}function S(_){return e.exit("codeFenced"),t(_)}function k(_,C,j){let P=0;return w;function w(L){return _.enter("lineEnding"),_.consume(L),_.exit("lineEnding"),M}function M(L){return _.enter("codeFencedFence"),pe(L)?_e(_,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):D(L)}function D(L){return L===a?(_.enter("codeFencedFenceSequence"),F(L)):j(L)}function F(L){return L===a?(P++,_.consume(L),F):P>=o?(_.exit("codeFencedFenceSequence"),pe(L)?_e(_,$,"whitespace")(L):$(L)):j(L)}function $(L){return L===null||oe(L)?(_.exit("codeFencedFence"),C(L)):j(L)}}}function mA(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Ph={name:"codeIndented",tokenize:vA},xA={partial:!0,tokenize:yA};function vA(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),_e(e,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):oe(c)?e.attempt(xA,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||oe(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function yA(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):_e(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):oe(o)?i(o):n(o)}}const bA={name:"codeText",previous:wA,resolve:_A,tokenize:kA};function _A(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function wA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kA(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(s=e.enter("codeTextSequence"),i=0,u(d)):oe(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||oe(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class SA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&zo(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),zo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),zo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);zo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);zo(this.left,n.reverse())}}}function zo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function PS(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new SA(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,CA(u,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return hn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function CA(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,g=0,m=0;const y=[m];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(m=f+1,y.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),f=y.length;f--;){const x=a.slice(y[f],y[f+1]),v=s.pop();l.push([v,v+x.length-1]),e.splice(v,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[g+l[f][0]]=g+l[f][1],g+=l[f][1]-l[f][0]-1;return c}const EA={resolve:jA,tokenize:PA},NA={partial:!0,tokenize:TA};function jA(e){return PS(e),e}function PA(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):oe(a)?e.check(NA,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function TA(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),_e(e,s,"linePrefix")}function s(o){if(o===null||oe(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function TS(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(x),e.exit(s),f):x===null||x===32||x===41||Du(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(x))}function f(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),f(x)):x===null||x===60||oe(x)?n(x):(e.consume(x),x===92?g:p)}function g(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function m(x){return!u&&(x===null||x===41||Ae(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,m):x===41?(e.consume(x),u--,m):x===null||x===32||x===40||Du(x)?n(x):(e.consume(x),x===92?y:m)}function y(x){return x===40||x===41||x===92?(e.consume(x),m):m(x)}}function MS(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):oe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||oe(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!pe(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function RS(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),l(o)):f===null?n(f):oe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),_e(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||oe(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Sa(e,t){let n;return r;function r(i){return oe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):pe(i)?_e(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const MA={name:"definition",tokenize:DA},RA={partial:!0,tokenize:AA};function DA(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return MS.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Ae(p)?Sa(e,c)(p):c(p)}function c(p){return TS(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(RA,d,d)(p)}function d(p){return pe(p)?_e(e,f,"whitespace")(p):f(p)}function f(p){return p===null||oe(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function AA(e,t,n){return r;function r(a){return Ae(a)?Sa(e,i)(a):n(a)}function i(a){return RS(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return pe(a)?_e(e,o,"whitespace")(a):o(a)}function o(a){return a===null||oe(a)?t(a):n(a)}}const LA={name:"hardBreakEscape",tokenize:IA};function IA(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return oe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const OA={name:"headingAtx",resolve:FA,tokenize:$A};function FA(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},hn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function $A(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||Ae(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||oe(u)?(e.exit("atxHeading"),t(u)):pe(u)?_e(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Ae(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const zA=["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"],f0=["pre","script","style","textarea"],BA={concrete:!0,name:"htmlFlow",resolveTo:VA,tokenize:UA},WA={partial:!0,tokenize:GA},HA={partial:!0,tokenize:qA};function VA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function UA(e,t,n){const r=this;let i,s,o,a,l;return c;function c(T){return u(T)}function u(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),s=!0,m):T===63?(e.consume(T),i=3,r.interrupt?t:N):$t(T)?(e.consume(T),o=String.fromCharCode(T),y):n(T)}function f(T){return T===45?(e.consume(T),i=2,p):T===91?(e.consume(T),i=5,a=0,g):$t(T)?(e.consume(T),i=4,r.interrupt?t:N):n(T)}function p(T){return T===45?(e.consume(T),r.interrupt?t:N):n(T)}function g(T){const re="CDATA[";return T===re.charCodeAt(a++)?(e.consume(T),a===re.length?r.interrupt?t:D:g):n(T)}function m(T){return $t(T)?(e.consume(T),o=String.fromCharCode(T),y):n(T)}function y(T){if(T===null||T===47||T===62||Ae(T)){const re=T===47,le=o.toLowerCase();return!re&&!s&&f0.includes(le)?(i=1,r.interrupt?t(T):D(T)):zA.includes(o.toLowerCase())?(i=6,re?(e.consume(T),x):r.interrupt?t(T):D(T)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):s?v(T):b(T))}return T===45||Pt(T)?(e.consume(T),o+=String.fromCharCode(T),y):n(T)}function x(T){return T===62?(e.consume(T),r.interrupt?t:D):n(T)}function v(T){return pe(T)?(e.consume(T),v):w(T)}function b(T){return T===47?(e.consume(T),w):T===58||T===95||$t(T)?(e.consume(T),S):pe(T)?(e.consume(T),b):w(T)}function S(T){return T===45||T===46||T===58||T===95||Pt(T)?(e.consume(T),S):k(T)}function k(T){return T===61?(e.consume(T),_):pe(T)?(e.consume(T),k):b(T)}function _(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),l=T,C):pe(T)?(e.consume(T),_):j(T)}function C(T){return T===l?(e.consume(T),l=null,P):T===null||oe(T)?n(T):(e.consume(T),C)}function j(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Ae(T)?k(T):(e.consume(T),j)}function P(T){return T===47||T===62||pe(T)?b(T):n(T)}function w(T){return T===62?(e.consume(T),M):n(T)}function M(T){return T===null||oe(T)?D(T):pe(T)?(e.consume(T),M):n(T)}function D(T){return T===45&&i===2?(e.consume(T),H):T===60&&i===1?(e.consume(T),X):T===62&&i===4?(e.consume(T),Q):T===63&&i===3?(e.consume(T),N):T===93&&i===5?(e.consume(T),B):oe(T)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(WA,te,F)(T)):T===null||oe(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),D)}function F(T){return e.check(HA,$,te)(T)}function $(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),L}function L(T){return T===null||oe(T)?F(T):(e.enter("htmlFlowData"),D(T))}function H(T){return T===45?(e.consume(T),N):D(T)}function X(T){return T===47?(e.consume(T),o="",I):D(T)}function I(T){if(T===62){const re=o.toLowerCase();return f0.includes(re)?(e.consume(T),Q):D(T)}return $t(T)&&o.length<8?(e.consume(T),o+=String.fromCharCode(T),I):D(T)}function B(T){return T===93?(e.consume(T),N):D(T)}function N(T){return T===62?(e.consume(T),Q):T===45&&i===2?(e.consume(T),N):D(T)}function Q(T){return T===null||oe(T)?(e.exit("htmlFlowData"),te(T)):(e.consume(T),Q)}function te(T){return e.exit("htmlFlow"),t(T)}}function qA(e,t,n){const r=this;return i;function i(o){return oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function GA(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(yl,t,n)}}const KA={name:"htmlText",tokenize:YA};function YA(e,t,n){const r=this;let i,s,o;return a;function a(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),c):N===47?(e.consume(N),k):N===63?(e.consume(N),b):$t(N)?(e.consume(N),j):n(N)}function c(N){return N===45?(e.consume(N),u):N===91?(e.consume(N),s=0,g):$t(N)?(e.consume(N),v):n(N)}function u(N){return N===45?(e.consume(N),p):n(N)}function d(N){return N===null?n(N):N===45?(e.consume(N),f):oe(N)?(o=d,X(N)):(e.consume(N),d)}function f(N){return N===45?(e.consume(N),p):d(N)}function p(N){return N===62?H(N):N===45?f(N):d(N)}function g(N){const Q="CDATA[";return N===Q.charCodeAt(s++)?(e.consume(N),s===Q.length?m:g):n(N)}function m(N){return N===null?n(N):N===93?(e.consume(N),y):oe(N)?(o=m,X(N)):(e.consume(N),m)}function y(N){return N===93?(e.consume(N),x):m(N)}function x(N){return N===62?H(N):N===93?(e.consume(N),x):m(N)}function v(N){return N===null||N===62?H(N):oe(N)?(o=v,X(N)):(e.consume(N),v)}function b(N){return N===null?n(N):N===63?(e.consume(N),S):oe(N)?(o=b,X(N)):(e.consume(N),b)}function S(N){return N===62?H(N):b(N)}function k(N){return $t(N)?(e.consume(N),_):n(N)}function _(N){return N===45||Pt(N)?(e.consume(N),_):C(N)}function C(N){return oe(N)?(o=C,X(N)):pe(N)?(e.consume(N),C):H(N)}function j(N){return N===45||Pt(N)?(e.consume(N),j):N===47||N===62||Ae(N)?P(N):n(N)}function P(N){return N===47?(e.consume(N),H):N===58||N===95||$t(N)?(e.consume(N),w):oe(N)?(o=P,X(N)):pe(N)?(e.consume(N),P):H(N)}function w(N){return N===45||N===46||N===58||N===95||Pt(N)?(e.consume(N),w):M(N)}function M(N){return N===61?(e.consume(N),D):oe(N)?(o=M,X(N)):pe(N)?(e.consume(N),M):P(N)}function D(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),i=N,F):oe(N)?(o=D,X(N)):pe(N)?(e.consume(N),D):(e.consume(N),$)}function F(N){return N===i?(e.consume(N),i=void 0,L):N===null?n(N):oe(N)?(o=F,X(N)):(e.consume(N),F)}function $(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||Ae(N)?P(N):(e.consume(N),$)}function L(N){return N===47||N===62||Ae(N)?P(N):n(N)}function H(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function X(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),I}function I(N){return pe(N)?_e(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):B(N)}function B(N){return e.enter("htmlTextData"),o(N)}}const Lm={name:"labelEnd",resolveAll:ZA,resolveTo:eL,tokenize:tL},XA={tokenize:nL},JA={tokenize:rL},QA={tokenize:iL};function ZA(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&hn(e,0,e.length,n),e}function eL(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=kn(a,e.slice(s+1,s+r+3)),a=kn(a,[["enter",u,t]]),a=kn(a,md(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=kn(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=kn(a,e.slice(o+1)),a=kn(a,[["exit",l,t]]),hn(e,s,e.length,a),e}function tL(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(zn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(XA,u,o?u:d)(f):f===91?e.attempt(JA,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(QA,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function nL(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Ae(d)?Sa(e,s)(d):s(d)}function s(d){return d===41?u(d):TS(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Ae(d)?Sa(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?RS(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Ae(d)?Sa(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function rL(e,t,n){const r=this;return i;function i(a){return MS.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function iL(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const sL={name:"labelStartImage",resolveAll:Lm.resolveAll,tokenize:oL};function oL(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const aL={name:"labelStartLink",resolveAll:Lm.resolveAll,tokenize:lL};function lL(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Th={name:"lineEnding",tokenize:cL};function cL(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),_e(e,t,"linePrefix")}}const Tc={name:"thematicBreak",tokenize:uL};function uL(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||oe(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),pe(c)?_e(e,a,"whitespace")(c):a(c))}}const Vt={continuation:{tokenize:pL},exit:mL,name:"list",tokenize:fL},dL={partial:!0,tokenize:xL},hL={partial:!0,tokenize:gL};function fL(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Wp(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Tc,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Wp(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(yl,r.interrupt?n:u,e.attempt(dL,f,d))}function u(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return pe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function pL(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(yl,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_e(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!pe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hL,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,_e(e,e.attempt(Vt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function gL(e,t,n){const r=this;return _e(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function mL(e){e.exit(this.containerState.type)}function xL(e,t,n){const r=this;return _e(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!pe(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const p0={name:"setextUnderline",resolveTo:vL,tokenize:yL};function vL(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function yL(e,t,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),pe(c)?_e(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||oe(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const bL={tokenize:_L};function _L(e){const t=this,n=e.attempt(yl,r,e.attempt(this.parser.constructs.flowInitial,i,_e(e,e.attempt(this.parser.constructs.flow,i,e.attempt(EA,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const wL={resolveAll:AS()},kL=DS("string"),SL=DS("text");function DS(e){return{resolveAll:AS(e==="text"?CL:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function AS(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function CL(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const EL={42:Vt,43:Vt,45:Vt,48:Vt,49:Vt,50:Vt,51:Vt,52:Vt,53:Vt,54:Vt,55:Vt,56:Vt,57:Vt,62:ES},NL={91:MA},jL={[-2]:Ph,[-1]:Ph,32:Ph},PL={35:OA,42:Tc,45:[p0,Tc],60:BA,61:p0,95:Tc,96:h0,126:h0},TL={38:jS,92:NS},ML={[-5]:Th,[-4]:Th,[-3]:Th,33:sL,38:jS,42:Hp,60:[aA,KA],91:aL,92:[LA,NS],93:Lm,95:Hp,96:bA},RL={null:[Hp,wL]},DL={null:[42,95]},AL={null:[]},LL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:DL,contentInitial:NL,disable:AL,document:EL,flow:PL,flowInitial:jL,insideSpan:RL,string:TL,text:ML},Symbol.toStringTag,{value:"Module"}));function IL(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:C(k),check:C(_),consume:v,enter:b,exit:S,interrupt:C(_,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(M){return o=kn(o,M),y(),o[o.length-1]!==null?[]:(j(t,0),c.events=md(s,c.events,c),c.events)}function f(M,D){return FL(p(M),D)}function p(M){return OL(o,M)}function g(){const{_bufferIndex:M,_index:D,line:F,column:$,offset:L}=r;return{_bufferIndex:M,_index:D,line:F,column:$,offset:L}}function m(M){i[M.line]=M.column,w()}function y(){let M;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<D.length;)x(D.charCodeAt(r._bufferIndex));else x(D)}}function x(M){u=u(M)}function v(M){oe(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,w()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=M}function b(M,D){const F=D||{};return F.type=M,F.start=g(),c.events.push(["enter",F,c]),a.push(F),F}function S(M){const D=a.pop();return D.end=g(),c.events.push(["exit",D,c]),D}function k(M,D){j(M,D.from)}function _(M,D){D.restore()}function C(M,D){return F;function F($,L,H){let X,I,B,N;return Array.isArray($)?te($):"tokenize"in $?te([$]):Q($);function Q(ae){return R;function R(ie){const ee=ie!==null&&ae[ie],je=ie!==null&&ae.null,Ze=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(je)?je:je?[je]:[]];return te(Ze)(ie)}}function te(ae){return X=ae,I=0,ae.length===0?H:T(ae[I])}function T(ae){return R;function R(ie){return N=P(),B=ae,ae.partial||(c.currentConstruct=ae),ae.name&&c.parser.constructs.disable.null.includes(ae.name)?le():ae.tokenize.call(D?Object.assign(Object.create(c),D):c,l,re,le)(ie)}}function re(ae){return M(B,N),L}function le(ae){return N.restore(),++I<X.length?T(X[I]):H}}}function j(M,D){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&hn(c.events,D,c.events.length-D,M.resolve(c.events.slice(D),c)),M.resolveTo&&(c.events=M.resolveTo(c.events,c))}function P(){const M=g(),D=c.previous,F=c.currentConstruct,$=c.events.length,L=Array.from(a);return{from:$,restore:H};function H(){r=M,c.previous=D,c.currentConstruct=F,c.events.length=$,a=L,w()}}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function OL(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function FL(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
@@ -27,7 +27,7 @@
27
27
  } catch (_) { /* SSR / blocked storage — ignore */ }
28
28
  })();
29
29
  </script>
30
- <script type="module" crossorigin src="/assets/index-6s2NVOlC.js"></script>
30
+ <script type="module" crossorigin src="/assets/index-ITF3o546.js"></script>
31
31
  <link rel="stylesheet" crossorigin href="/assets/index-DExQ2dsz.css">
32
32
  </head>
33
33
  <body class="bg-background text-on-surface">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "granclaw",
3
- "version": "0.0.1-beta.97",
3
+ "version": "0.0.1-beta.98",
4
4
  "description": "A personal AI assistant you run on your own machine.",
5
5
  "license": "MIT",
6
6
  "repository": {