@contraagent/ui 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +179 -3
- package/dist/adapters/filters.d.ts.map +1 -1
- package/dist/adapters/filters.js +3 -1
- package/dist/adapters/filters.js.map +1 -1
- package/dist/adapters/graph/compound.d.ts +2 -0
- package/dist/adapters/graph/compound.d.ts.map +1 -1
- package/dist/adapters/graph/compound.js +12 -1
- package/dist/adapters/graph/compound.js.map +1 -1
- package/dist/adapters/graph/layer.d.ts.map +1 -1
- package/dist/adapters/graph/layer.js +6 -1
- package/dist/adapters/graph/layer.js.map +1 -1
- package/dist/adapters/graph/matrix.d.ts.map +1 -1
- package/dist/adapters/graph/matrix.js +43 -9
- package/dist/adapters/graph/matrix.js.map +1 -1
- package/dist/adapters/lanes.d.ts.map +1 -1
- package/dist/adapters/lanes.js +26 -9
- package/dist/adapters/lanes.js.map +1 -1
- package/dist/adapters/panel-body.d.ts.map +1 -1
- package/dist/adapters/panel-body.js +15 -3
- package/dist/adapters/panel-body.js.map +1 -1
- package/dist/contraagent-ui.js +683 -683
- package/dist/elements/lists/ca-contracts.d.ts +4 -0
- package/dist/elements/lists/ca-contracts.d.ts.map +1 -1
- package/dist/elements/lists/ca-contracts.js +33 -13
- package/dist/elements/lists/ca-contracts.js.map +1 -1
- package/dist/elements/lists/ca-journal-table.d.ts +3 -0
- package/dist/elements/lists/ca-journal-table.d.ts.map +1 -1
- package/dist/elements/lists/ca-journal-table.js +18 -5
- package/dist/elements/lists/ca-journal-table.js.map +1 -1
- package/dist/elements/lists/ca-panel-body.d.ts +3 -0
- package/dist/elements/lists/ca-panel-body.d.ts.map +1 -1
- package/dist/elements/lists/ca-panel-body.js +11 -1
- package/dist/elements/lists/ca-panel-body.js.map +1 -1
- package/dist/elements/lists/ca-task-table.d.ts +2 -0
- package/dist/elements/lists/ca-task-table.d.ts.map +1 -1
- package/dist/elements/lists/ca-task-table.js +5 -1
- package/dist/elements/lists/ca-task-table.js.map +1 -1
- package/dist/elements/overview/ca-overview.d.ts.map +1 -1
- package/dist/elements/overview/ca-overview.js +3 -1
- package/dist/elements/overview/ca-overview.js.map +1 -1
- package/dist/elements/overview/ca-pipeline-graph.d.ts +10 -1
- package/dist/elements/overview/ca-pipeline-graph.d.ts.map +1 -1
- package/dist/elements/overview/ca-pipeline-graph.js +57 -17
- package/dist/elements/overview/ca-pipeline-graph.js.map +1 -1
- package/dist/elements/overview/pipeline-graph/inspector.js +2 -1
- package/dist/elements/overview/pipeline-graph/inspector.js.map +1 -1
- package/dist/elements/overview/pipeline-graph/strings.d.ts.map +1 -1
- package/dist/elements/overview/pipeline-graph/strings.js +15 -1
- package/dist/elements/overview/pipeline-graph/strings.js.map +1 -1
- package/dist/words/clock-format.d.ts +3 -0
- package/dist/words/clock-format.d.ts.map +1 -0
- package/dist/words/clock-format.js +19 -0
- package/dist/words/clock-format.js.map +1 -0
- package/dist/words/format.d.ts.map +1 -1
- package/dist/words/format.js +2 -17
- package/dist/words/format.js.map +1 -1
- package/package.json +3 -3
- package/src/adapters/filters.ts +4 -1
- package/src/adapters/graph/compound.ts +9 -1
- package/src/adapters/graph/layer.ts +4 -1
- package/src/adapters/graph/matrix.ts +38 -7
- package/src/adapters/lanes.ts +29 -11
- package/src/adapters/panel-body.ts +13 -3
- package/src/elements/lists/ca-contracts.ts +29 -11
- package/src/elements/lists/ca-journal-table.ts +19 -5
- package/src/elements/lists/ca-panel-body.ts +11 -1
- package/src/elements/lists/ca-task-table.ts +6 -1
- package/src/elements/overview/ca-overview.ts +3 -1
- package/src/elements/overview/ca-pipeline-graph.ts +54 -15
- package/src/elements/overview/pipeline-graph/inspector.ts +2 -1
- package/src/elements/overview/pipeline-graph/strings.ts +15 -1
- package/src/words/clock-format.ts +20 -0
- package/src/words/format.ts +2 -18
package/dist/contraagent-ui.js
CHANGED
|
@@ -1,247 +1,247 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=new Set([`launch`,`message_update`,`tool_execution_start`,`tool_execution_update`,`tool_execution_end`,`acall`,`aresult`,`message_start`,`message_end`,`turn_end`,`notice`,`auto_retry_start`]);function r(e){return n.has(e.type)?e:null}var i=class extends Error{constructor(e,t,n=0,r=``){super(`No JSON answer from ${e}: ${t} ${n} ${r}`.trim()),this.url=e,this.failure=t,this.status=n,this.type=r,this.name=`ApiError`}};function a(e={}){let t=(e.baseUrl??``).replace(/\/$/,``),n=(t||globalThis.location?.origin||``).replace(/\/$/,``),r=e.fetch??globalThis.fetch;async function a(e,t){let{path:a={},query:o={}}=t??{},s=n+e.replace(/\{(\w+)\}/g,(e,t)=>t in a?encodeURIComponent(a[t]):e),c=Object.entries(o).filter(([,e])=>e!=null).map(([e,t])=>`${e}=${encodeURIComponent(t)}`).join(`&`),l=c?`${s}?${c}`:s,u;try{u=await r(new Request(l))}catch{throw new i(l,`network`)}let{status:d,ok:f}=u,p=(u.headers.get(`Content-Type`)??``).split(`;`)[0].trim().toLowerCase();try{if(f)return await u.json()}catch{}throw new i(l,f?`not-json`:`status`,d,p)}return{baseUrl:t,info:()=>a(`/api/info`),runs:()=>a(`/api/runs`),hosts:()=>a(`/api/hosts`),journal:(e,t=0)=>a(`/api/runs/{run}/journal`,{path:{run:e},query:{since:t}}),definitions:e=>a(`/api/runs/{run}/definitions`,{path:{run:e}}),task:(e,t)=>a(`/api/runs/{run}/task/{key}`,{path:{run:e,key:t}}),stream:(e,t,n=0)=>a(`/api/runs/{run}/stream/{key}`,{path:{run:e,key:t},query:{since:n}}),panel:(e,t)=>a(`/api/runs/{run}/panels/{name}`,{path:{run:e,name:t}}),trends:(e={})=>a(`/api/trends`,{query:{...e}}),trendsPanel:(e,t={})=>a(`/api/trends/panels/{name}`,{path:{name:e},query:{...t}})}}var o=[`journal`,`procs`,`plan`,`outputs`,`forecast`,`cursor`,`ready`];function s(e,t,n,r){let i=new(r.EventSource??globalThis.EventSource)(e);i.onopen=()=>n.open?.(),i.onerror=()=>n.error?.();for(let e of t)i.addEventListener(e,t=>{n.message({event:e,data:JSON.parse(t.data)})});return()=>i.close()}var c=encodeURIComponent,l=e=>(e.baseUrl??``).replace(/\/$/,``)
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=new Set([`launch`,`message_update`,`tool_execution_start`,`tool_execution_update`,`tool_execution_end`,`acall`,`aresult`,`message_start`,`message_end`,`turn_end`,`notice`,`auto_retry_start`]);function r(e){return n.has(e.type)?e:null}var i=class extends Error{constructor(e,t,n=0,r=``){super(`No JSON answer from ${e}: ${t} ${n} ${r}`.trim()),this.url=e,this.failure=t,this.status=n,this.type=r,this.name=`ApiError`}};function a(e={}){let t=(e.baseUrl??``).replace(/\/$/,``),n=(t||globalThis.location?.origin||``).replace(/\/$/,``),r=e.fetch??globalThis.fetch;async function a(e,t){let{path:a={},query:o={}}=t??{},s=n+e.replace(/\{(\w+)\}/g,(e,t)=>t in a?encodeURIComponent(a[t]):e),c=Object.entries(o).filter(([,e])=>e!=null).map(([e,t])=>`${e}=${encodeURIComponent(t)}`).join(`&`),l=c?`${s}?${c}`:s,u;try{u=await r(new Request(l))}catch{throw new i(l,`network`)}let{status:d,ok:f}=u,p=(u.headers.get(`Content-Type`)??``).split(`;`)[0].trim().toLowerCase();try{if(f)return await u.json()}catch{}throw new i(l,f?`not-json`:`status`,d,p)}return{baseUrl:t,info:()=>a(`/api/info`),runs:()=>a(`/api/runs`),hosts:()=>a(`/api/hosts`),journal:(e,t=0)=>a(`/api/runs/{run}/journal`,{path:{run:e},query:{since:t}}),definitions:e=>a(`/api/runs/{run}/definitions`,{path:{run:e}}),task:(e,t)=>a(`/api/runs/{run}/task/{key}`,{path:{run:e,key:t}}),stream:(e,t,n=0)=>a(`/api/runs/{run}/stream/{key}`,{path:{run:e,key:t},query:{since:n}}),panel:(e,t)=>a(`/api/runs/{run}/panels/{name}`,{path:{run:e,name:t}}),trends:(e={})=>a(`/api/trends`,{query:{...e}}),trendsPanel:(e,t={})=>a(`/api/trends/panels/{name}`,{path:{name:e},query:{...t}})}}var o=[`journal`,`procs`,`plan`,`outputs`,`forecast`,`cursor`,`ready`];function s(e,t,n,r){let i=new(r.EventSource??globalThis.EventSource)(e);i.onopen=()=>n.open?.(),i.onerror=()=>n.error?.();for(let e of t)i.addEventListener(e,t=>{n.message({event:e,data:JSON.parse(t.data)})});return()=>i.close()}var c=encodeURIComponent,l=e=>(e.baseUrl??``).replace(/\/$/,``),u=e=>e.ok,d=e=>e.stop!==`invalid_input`&&e.stop!==`skipped`;function f(e,t){if(e?.state===`running`)return`running`;let n=t[t.length-1];return n?n.stop===`skipped`?`skipped`:n.stop===`invalid_input`?`not_started`:n.stop===`partial`?`partial`:n.stop===`cancelled`?`cancelled`:u(n)?t.some(e=>d(e)&&!u(e))?`recovered`:`done`:`failed`:e?.state===`blocked`?`not_started`:`waiting`}function p(e){let t=new Set,n=[];for(let r of e)d(r)&&(t.has(r.key)&&n.push(r),u(r)||t.add(r.key));return n}function m(e){switch(e){case`blocked`:return`not_started`;case`pending`:return`waiting`;default:return e}}var h=e=>e===`done`||e===`recovered`||e===`partial`||e===`skipped`||e===`cancelled`;function g(e,t,n){let r=new Set,i=n=>{for(let a of e.get(n)?.after??[]){if(r.has(a))continue;r.add(a);let e=t.get(a);if(e?.outcome===`failed`)return a;if(e?.outcome===`not_started`){let e=i(a);if(e)return e}}return null};return i(n)}function _(e){let t=new Map;for(let n of e.values())n.outcome===`failed`&&t.set(n.key,{task:n,stopped:[]});let n=[];for(let r of e.values()){if(r.outcome!==`not_started`)continue;let e=r.cause?t.get(r.cause):void 0;e?e.stopped.push(r):n.push(r)}let r=e=>e.attempts[e.attempts.length-1]?.ts??``;return{failed:[...t.values()].sort((e,t)=>r(t.task).localeCompare(r(e.task))),notStarted:n,partial:[...e.values()].filter(e=>e.outcome===`partial`),recovered:[...e.values()].filter(e=>e.outcome===`recovered`)}}function v(e){let t=Array.isArray(e?.flow)?e.flow:[];for(let e=t.length-1;e>=0;e--){let n=t[e]?.loops??[],r=n[n.length-1];if(r)return typeof r.pass==`number`&&r.pass>=1?r.pass:1}return null}function y(e,t){let n=new Map(t.nodes.map(e=>[e.key,e]));return[...e.values()].map(t=>{let r=t.attempts[t.attempts.length-1],i=n.get(t.key);return{...t,pass:v(i),wall_s:t.tries.reduce((e,t)=>e+(t.wall_s||0),0),last_ts:r?.ts??``,last_stop:r?.stop??``,waits_for:t.outcome===`waiting`?(i?.after??[]).filter(t=>!h(e.get(t)?.outcome??`waiting`)):[],claims:i?.claims??[],priority:i?.priority??0}})}var b={nodes:[],groups:[]},x=new WeakMap;function S(e,t=b){let n=t??b,r=x.get(e);r||x.set(e,r=new WeakMap);let i=r.get(n);return i||r.set(n,i=function(e,t){let n=function(e,t){let n=new Map;for(let t of e){let e=n.get(t.key);e||n.set(t.key,e=[]),e.push(t)}let r=new Map(t.nodes.map(e=>[e.key,e])),i=[...new Set([...t.nodes.map(e=>e.key),...n.keys()])],a=new Map;for(let e of t.flow_calls??[])a.has(e.id)||a.set(e.id,e.function);let o=e=>{let t=e?.flow_call;return t?a.get(t)??``:``},s=new Map;for(let e of i){let t=r.get(e),i=n.get(e)??[],a=i[0];s.set(e,{key:e,kind:t?.kind??a?.kind??``,unit:t?.unit??a?.unit??``,executor:t?.executor??a?.executor??`agent`,outcome:f(t,i),attempts:i,tries:i.filter(d),cause:null,deferred:t?.deferred??``,deferredCause:t?.deferred_cause??null,deferredIn:o(t?.deferred_cause)})}for(let[e,t]of function(e,t){let n=new Map,r=new Set,i=!1,a=o=>{let s=n.get(o);if(s!==void 0)return s;r.add(o);let c=null;for(let n of e.get(o)?.after??[]){let e=t.get(n);if(e?.outcome===`failed`){c=n;break}if(e?.outcome===`not_started`){if(r.has(n)){i=!0;continue}let e=a(n);if(e){c=e;break}}}return r.delete(o),n.set(o,c),c},o=new Map;for(let[e,n]of t)n.outcome===`not_started`&&o.set(e,a(e));if(!i)return o;for(let n of o.keys())o.set(n,g(e,t,n));return o}(r,s))s.get(e).cause=t;return s}(e,t),r=function(e){let t={done:0,recovered:0,partial:0,failed:0,not_started:0,running:0,waiting:0,skipped:0,cancelled:0,total:0};for(let n of e.values())t[n.outcome]++,t.total++;return t}(n);return{outcomes:n,rows:y(n,t),counts:{...r,doneTotal:r.done+r.recovered,finished:r.done+r.recovered+r.partial+r.skipped+r.cancelled},problems:_(n),kinds:[...new Set([...n.values()].map(e=>e.kind))].sort(),tries:ee(e)}}(e,n)),i}function ee(e){let t=e.filter(d).length;return{tries:t,notStarted:e.length-t}}function C(e){let t=Date.parse(e?.started_at??``),n=Date.parse(e?.last_ts??``);return Number.isNaN(t)||Number.isNaN(n)?null:Math.max(0,(n-t)/1e3)}function w(e,t=!1){return t||e?.running?`running`:e?.unresponsive?`unresponsive`:`stopped`}var te=(e,t)=>t?.host_id?e?.find(e=>e.host_id===t.host_id):void 0;function ne(e){let t=e.run.length-(e.host_id?.length??0)-1;return e.host_id&&t>0&&e.run.endsWith(`@${e.host_id}`)?e.run.slice(0,t):e.run}var re=[`running`,`unresponsive`,`stopped`];function ie(e,t=[]){let n=new Map;for(let t of e){let e=t.host_id??``,r=n.get(e);r?r.push(t):n.set(e,[t])}let r=[...n.keys()],i=t.map(e=>e.host_id),a=new Set(i),o=new Map;for(let e of t)o.has(e.host_id)||o.set(e.host_id,e);let s=e=>re.indexOf(w(e));return[...i.filter(e=>n.has(e)),...r.filter(e=>!a.has(e)).sort()].map(e=>({hostId:e,host:o.get(e),runs:[...n.get(e)??[]].sort((e,t)=>s(e)-s(t))}))}var ae=e=>!!e.stop&&e.stop!==`completed`&&e.stop!==`partial`&&e.stop!==`skipped`&&e.stop!==`cancelled`,T=e=>e.executor===`python`;function oe(e){let t=0;return e.map((n,r)=>{let i=e[r-1];return i&&(n.attempt??0)<=(i.attempt??0)&&t++,t})}var se=e=>`${e.ts}|${e.key}`,ce=(e,t)=>e.find(e=>e.run===t),le=(e,t)=>w(t,!!e.procs?.alive)===`running`;function ue(e){return e?[...e.launches.map(e=>({cls:`llm`,id:`c:${e.key}`,kind:e.kind||`task`,unit:e.unit||``,detail:[e.unit,e.model||e.role].filter(Boolean).join(` | `),ageS:e.age_s,key:e.key})),...e.python_tasks.map(e=>({cls:`py`,id:`p:${e.key}`,kind:e.kind||`task`,unit:e.unit||``,detail:e.unit||`Python`,ageS:e.age_s,key:``}))]:[]}var de=[`tiles`,`table`,`columns`,`lines`,`heatmap`,`hbars`,`status_grid`,`note`,`code`,`tree`,`embed`,`blocks`];function fe(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.type;return typeof t==`string`&&de.includes(t)?e:null}var pe=e=>(e.scope??`run`)===`run`,me={title:`contraagent`,panels:[],api_version:``},he=(e,t)=>e instanceof i?e:new i(t,`network`),ge=class{constructor(e={}){this.snap={info:me,runs:[],hosts:null,run:``,state:{journal:[],procs:null,plan:{nodes:[],groups:[],flow_calls:[]},outputs:{contracts:[],tally:{valid:0,invalid:0,refused:0,pending:0,failed:0,running:0}},forecast:null,cursor:null,panels:{},ready:!1},connected:!1,fresh:new Set,runsLoaded:!1,error:null,trends:null},this.trendsQuery=null,this.trendsAsked=0,this.trendsOver=null,this.refreshing=!1,this.trendsBusy=!1,this.infoError=null,this.runsError=null,this.hostsError=null,this.infoLoaded=!1,this.stopped=!1,this.listeners=new Set,this.rowListeners=new Set,this.closeFeed=null,this.queue=[],this.flushTimer=null,this.flushAt=0,this.replaying=!0,this.replayDrawn=!1,this.expiries=[],this.freshTimer=null,this.pollTimer=null,this.opts={runsEveryMs:5e3,batchMs:50,freshMs:4e3,...e},this.client=e.client??a(e.baseUrl===void 0?{}:{baseUrl:e.baseUrl})}get snapshot(){return this.snap}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}onNewRow(e){return this.rowListeners.add(e),()=>this.rowListeners.delete(e)}async start(){this.stopped=!1,await this.refresh(),this.schedule()}schedule(){this.stopped||this.opts.runsEveryMs<=0||this.pollTimer||(this.pollTimer=setTimeout(()=>{this.pollTimer=null,this.refresh().finally(()=>this.schedule())},this.opts.runsEveryMs))}async refresh(){if(this.refreshing)return;this.refreshing=!0;try{this.infoLoaded||await this.loadInfo(),await this.refreshRuns()}finally{this.refreshing=!1}let e=this.trendsQuery;!e||this.trendsBusy||this.stopped||this.trendsKey()===this.trendsOver||(this.trendsBusy=!0,this.fetchTrends(e).finally(()=>this.trendsBusy=!1))}trendsKey(){return`${this.snap.runs.map(e=>`${e.run}\t${e.last_ts}\t${e.attempts}`).join(`
|
|
2
2
|
`)}\n\n${this.trendPanelNames().join(`
|
|
3
|
-
`)}`}trendPanelNames(){return this.snap.info.panels.filter(e=>e.scope===`trends`).map(e=>e.name)}async loadTrends(e){let t=this.snap.trends&&JSON.stringify(this.snap.trends.query)===JSON.stringify(e);this.trendsQuery=e,this.set({trends:{query:e,data:t?this.snap.trends.data:this.snap.trends?.data??null,panels:t?this.snap.trends.panels:{},loading:!0,error:null}}),await this.fetchTrends(e)}closeTrends(){this.trendsQuery=null}async fetchTrends(e){let t=++this.trendsAsked;this.trendsOver=this.trendsKey();let n=()=>t!==this.trendsAsked||this.stopped?null:this.snap.trends,r=this.trendPanelNames(),i=this.client.trends(e).then(t=>{let r=n();r&&this.set({trends:{...r,query:e,data:t,loading:!1,error:null}})},t=>{let r=n();r&&this.set({trends:{...r,query:e,loading:!1,error:
|
|
4
|
-
`)}reopen(){let e=this.snap.run;this.closeFeed?.(),this.closeFeed=null,this.selectRun(e)}selectRun(e){if(e===this.snap.run&&(this.closeFeed||!e)||(this.closeFeed?.(),this.closeFeed=null,this.queue=[],this.set({run:e,state:{journal:[],procs:null,plan:{nodes:[],groups:[],flow_calls:[]},outputs:{contracts:[],tally:{valid:0,invalid:0,refused:0,pending:0,failed:0,running:0}},forecast:null,cursor:null,panels:{},ready:!1},connected:!1,fresh:new Set}),!e))return;let t=this.snap.info.panels.filter(he).map(e=>e.name),n={open:()=>{this.push({event:`connected`}),this.set({connected:!0})},error:()=>this.set({connected:!1}),message:e=>this.push(e)};this.closeFeed=this.opts.openRunFeed?this.opts.openRunFeed(e,t,n):function(e,t,n,r={}){let i=[...o,...t.map(e=>`panel:${e}`)];return s(`${l(r)}/events?run=${c(e)}`,i,n,r)}(e,t,n,{...this.opts.baseUrl===void 0?{}:{baseUrl:this.opts.baseUrl},...this.opts.feed})}stop(){this.stopped=!0,this.closeFeed?.(),this.closeFeed=null,this.pollTimer&&clearTimeout(this.pollTimer),this.pollTimer=null,this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=null}push(e){this.queue.push(e),this.flushTimer??=setTimeout(()=>this.flush(),this.opts.batchMs)}flush(){this.flushTimer=null;let e=this.queue;this.queue=[];let t=this.snap.state.ready,n=[];for(let r of e)r.event===`connected`?t=!1:r.event===`ready`?t=!0:r.event===`journal`&&t&&n.push(r.data);let r=function(e,t){let n=e,r=null,i=()=>{if(!r)return;let e=n.journal.concat(r);n={...n,journal:e.length>4e3?e.slice(e.length-4e3):e},r=null};for(let e of t)if(e.event!==`journal`)switch(i(),e.event){case`connected`:n={...n,journal:[],ready:!1};break;case`ready`:n={...n,ready:!0};break;case`procs`:n={...n,procs:e.data};break;case`plan`:n={...n,plan:e.data};break;case`outputs`:n={...n,outputs:e.data};break;case`forecast`:n={...n,forecast:e.data};break;case`cursor`:n={...n,cursor:e.data};break;default:n={...n,panels:{...n.panels,[e.event.slice(6)]:e.data}}}else(r??=[]).push(e.data);return i(),n}(this.snap.state,e);if(!n.length)return void this.set({state:r});let i=new Set(this.snap.fresh);for(let e of n)i.add(le(e));this.set({state:r,fresh:i});for(let e of n)for(let t of this.rowListeners)t(e);setTimeout(()=>{let e=new Set(this.snap.fresh);for(let t of n)e.delete(le(t));this.set({fresh:e})},this.opts.freshMs)}set(e){this.snap={...this.snap,...e};for(let e of this.listeners)e(this.snap)}},ye=encodeURIComponent;function be(e){let t=Array.from(e,e=>/^[\p{L}\p{N}._-]$/u.test(e)?e:`_`).join(``).replace(/\.\.+/g,e=>`_`.repeat(e.length));return t.startsWith(`.`)?`_${t.slice(1)}`:t||`_`}var xe=e=>Object.keys(e).length>0;function Se(e){return(t,n,r)=>{let i=!1;return(async()=>{try{let[a,o,s,c,l,u]=await Promise.all([e.journal(t),e.file(`runs/${ye(t)}/plan.json`),e.file(`runs/${ye(t)}/outputs.json`),e.file(`runs/${ye(t)}/forecast.json`).catch(()=>null),e.file(`runs/${ye(t)}/cursor.json`),Promise.all(n.map(n=>e.panel(t,n).catch(e=>({error:String(e)}))))]);if(i)return;r.open?.();let d=e=>!i&&r.message(e);for(let e of a.entries)d({event:`journal`,data:e});d({event:`plan`,data:o}),d({event:`outputs`,data:s}),c&&d({event:`forecast`,data:c}),d({event:`cursor`,data:xe(l)?l:null}),n.forEach((e,t)=>d({event:`panel:${e}`,data:u[t]??{}})),d({event:`ready`,data:{journal:a.total}})}catch{i||r.error?.()}})(),()=>{i=!0}}}var Ce=()=>({input:0,output:0,cache_read:0,cache_creation:0,calls:0,cost:null,reported:0}),we=e=>e.input+e.output+e.cache_read+e.cache_creation;function Te(e,t){let n=t.usage;return n||t.cost_usd!==null&&t.cost_usd!==void 0?(n&&(e.input+=n.input??0,e.output+=n.output??0,e.cache_read+=n.cache_read??0,e.cache_creation+=n.cache_creation??0,e.calls+=n.calls??0),t.cost_usd!==null&&t.cost_usd!==void 0&&(e.cost=(e.cost??0)+t.cost_usd),e.reported++,e):e}function Ee(e){let t={input:0,output:0,cache_read:0,cache_creation:0,calls:0,cost:null,reported:0};for(let n of e)Te(t,n);return t.reported?t:null}function De(e,t){let n=new Map,r={input:0,output:0,cache_read:0,cache_creation:0,calls:0,cost:null,reported:0};for(let i of e){Te(r,i);let e=t(i),a=n.get(e);a||n.set(e,a={id:e,kind:i.kind,unit:i.unit??``,spend:Ce(),share:null}),Te(a.spend,i)}let i=[...n.values()].filter(e=>e.spend.reported);for(let e of i)e.share=r.cost?(e.spend.cost??0)/r.cost:null;return i.sort((e,t)=>(t.spend.cost??0)-(e.spend.cost??0)||we(t.spend)-we(e.spend))}var Oe=e=>De(e,e=>e.kind).map(e=>({...e,unit:``})),ke=e=>(e.input??0)+(e.output??0)+(e.cache_read??0)+(e.cache_creation??0);function Ae(e,t){switch(t){case`cost`:return e.cost_usd??null;case`tokens`:return ke(e);case`time`:return e.wall_s??0;case`sessions`:return e.sessions}}var je=e=>[`cost`,`tokens`,`time`,`sessions`].filter(t=>e.some(e=>(Ae(e,t)??0)>0)),Me=e=>Date.parse(e.observed_at??``),Ne=e=>!Number.isNaN(Me(e))&&(e.five_hour_pct!=null||e.seven_day_pct!=null);function Pe(e){let t=[];for(let n of e)for(let e of n.quota??[])Ne(e)&&t.push({reading:e,key:n.key,attempt:n.attempt??0});return t.sort((e,t)=>Me(e.reading)-Me(t.reading))}var Fe=e=>`${e.credential??``}\0${e.account??``}`;function Ie(e){let t=new Map;for(let{reading:n}of Pe(e)){let e=Fe(n),r=t.get(e);r||t.set(e,r=[]),r.push(n)}let n=[];for(let e of t.values()){let t=e[0],r=e[e.length-1];t&&r&&n.push({credential:r.credential??``,account:r.account??``,first:t,last:r})}return n.sort((e,t)=>(t.last.seven_day_pct??0)-(e.last.seven_day_pct??0))}function Le(e,t){let n=(e.quota??[]).filter(Ne).sort((e,t)=>Me(e)-Me(t)),r=Date.parse(e.ts),i=n[0]??null,a=i===null?``:Fe(i);return{start:i,next:(i===null||Number.isNaN(r)?void 0:t.find(e=>Me(e.reading)>r&&Fe(e.reading)===a))?.reading??null}}function Re(e){let t=/^invalid input:\s*(.*)$/s.exec(e||``);if(!t)return[];let n=[];for(let e of(t[1]??``).split(`; `)){let t=/^input from (\S+) is missing: (\S+)/.exec(e);t?n.push({path:t[2]??``,producer:t[1]??``,problem:`missing`}):(t=/^input from (\S+) ended \S+: (\S+)/.exec(e),t?n.push({path:t[2]??``,producer:t[1]??``,problem:`failed`}):(t=/^(\S+?): required input is missing/.exec(e),t?n.push({path:t[1]??``,producer:``,problem:`missing`}):(t=/^(\S+?): /.exec(e),t&&!n.some(e=>e.path===t?.[1])&&n.push({path:t[1]??``,producer:``,problem:`checks`}))))}return n}function w(e,t){if(!e||!t)return e??``;let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`(?:/[^\\s:'"]*)?/${n}/`,`g`),``)}var ze=`lit-localize-status`,T=(e,...t)=>({strTag:!0,strings:e,values:t}),Be=(e,t,n)=>{let r=e[0];for(let i=1;i<e.length;i++)r+=t[n?n[i-1]:i-1],r+=e[i];return r},Ve=e=>{return typeof(t=e)!=`string`&&`strTag`in t?Be(e.strings,e.values):e;var t},E=Ve,He=!1,Ue=class{constructor(e){this.__litLocalizeEventHandler=e=>{e.detail.status===`ready`&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(ze,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(ze,this.__litLocalizeEventHandler)}},We=e=>e.addController(new Ue(e)),D=()=>(e,t)=>(e.addInitializer(We),e),Ge=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}},Ke=[];for(let e=0;e<256;e++)Ke[e]=(e>>4&15).toString(16)+(15&e).toString(16);var qe=new WeakMap,Je=new Map;function Ye(e){window.dispatchEvent(new CustomEvent(ze,{detail:e}))}var Xe,Ze,Qe,$e,et,tt=``,nt=new Ge;nt.resolve();var rt=0,it=e=>(function(){if(He)throw Error(`lit-localize can only be configured once`);E=(e,t)=>function(e,t,n){if(e){let r=e[n?.id??function(e){let t=typeof e==`string`?e:e.strings,n=Je.get(t);return n===void 0&&(n=function(e,t){return(t?`h`:`s`)+function(e){let t=0,n=8997,r=0,i=33826,a=0,o=40164,s=0,c=52210;for(let l=0;l<e.length;l++)n^=e.charCodeAt(l),t=435*n,r=435*i,a=435*o,s=435*c,a+=n<<8,s+=i<<8,r+=t>>>16,n=65535&t,a+=r>>>16,i=65535&r,c=s+(a>>>16)&65535,o=65535&a;return Ke[c>>8]+Ke[255&c]+Ke[o>>8]+Ke[255&o]+Ke[i>>8]+Ke[255&i]+Ke[n>>8]+Ke[255&n]}(typeof e==`string`?e:e.join(``))}(t,typeof e!=`string`&&!(`strTag`in e)),Je.set(t,n)),n}(t)];if(r){if(typeof r==`string`)return r;if(`strTag`in r)return Be(r.strings,t.values,r.values);{let e=qe.get(r);return e===void 0&&(e=r.values,qe.set(r,e)),{...r,values:e.map(e=>t.values[e])}}}}return Ve(t)}(et,e,t),He=!0}(),tt=Ze=e.sourceLocale,(Qe=new Set(e.targetLocales)).add(e.sourceLocale),$e=e.loadLocale,{getLocale:at,setLocale:ot}),at=()=>tt,ot=e=>{if(e===(Xe??tt))return nt.promise;if(!Qe||!$e)throw Error(`Internal error`);if(!Qe.has(e))throw Error(`Invalid locale code`);let t=++rt;return Xe=e,nt.settled&&(nt=new Ge),Ye({status:`loading`,loadingLocale:e}),(e===Ze?Promise.resolve({templates:void 0}):$e(e)).then(n=>{rt===t&&(tt=e,Xe=void 0,et=n.templates,Ye({status:`ready`,readyLocale:e}),nt.resolve())},n=>{rt===t&&(Ye({status:`error`,errorLocale:e,errorMessage:n.toString()}),nt.reject(n))}),nt.promise},st=globalThis,ct=st.ShadowRoot&&(st.ShadyCSS===void 0||st.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,lt=Symbol(),ut=new WeakMap,dt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==lt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ct&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ut.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ut.set(t,e))}return e}toString(){return this.cssText}},ft=e=>new dt(typeof e==`string`?e:e+``,void 0,lt),O=(e,...t)=>new dt(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,lt),pt=(e,t)=>{if(ct)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=st.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},mt=ct?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ft(t)})(e):e,{is:ht,defineProperty:gt,getOwnPropertyDescriptor:_t,getOwnPropertyNames:vt,getOwnPropertySymbols:yt,getPrototypeOf:bt}=Object,xt=globalThis,St=xt.trustedTypes,Ct=St?St.emptyScript:``,wt=xt.reactiveElementPolyfillSupport,Tt=(e,t)=>e,Et={toAttribute(e,t){switch(t){case Boolean:e=e?Ct:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Dt=(e,t)=>!ht(e,t),Ot={attribute:!0,type:String,converter:Et,reflect:!1,useDefault:!1,hasChanged:Dt};Symbol.metadata??=Symbol(`metadata`),xt.litPropertyMetadata??=new WeakMap;var kt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ot){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&>(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=_t(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ot}static _$Ei(){if(this.hasOwnProperty(Tt(`elementProperties`)))return;let e=bt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Tt(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Tt(`properties`))){let e=this.properties,t=[...vt(e),...yt(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(mt(e))}else e!==void 0&&t.push(mt(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return pt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?Et:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?Et:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??Dt)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};kt.elementStyles=[],kt.shadowRootOptions={mode:`open`},kt[Tt(`elementProperties`)]=new Map,kt[Tt(`finalized`)]=new Map,wt?.({ReactiveElement:kt}),(xt.reactiveElementVersions??=[]).push(`2.1.2`);var At=globalThis,jt=e=>e,Mt=At.trustedTypes,Nt=Mt?Mt.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,Pt=`$lit$`,Ft=`lit$${Math.random().toFixed(9).slice(2)}$`,It=`?`+Ft,Lt=`<${It}>`,Rt=document,zt=()=>Rt.createComment(``),Bt=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Vt=Array.isArray,Ht=e=>Vt(e)||typeof e?.[Symbol.iterator]==`function`,Ut=`[
|
|
5
|
-
\f\r]`,Wt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gt=/-->/g,Kt=/>/g,qt=RegExp(`>|${Ut}(?:([^\\s"'>=/]+)(${Ut}*=${Ut}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),Jt=/'/g,Yt=/"/g,Xt=/^(?:script|style|textarea|title)$/i,Zt=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),k=Zt(1),A=Zt(2),Qt=Symbol.for(`lit-noChange`),j=Symbol.for(`lit-nothing`),$t=new WeakMap,en=Rt.createTreeWalker(Rt,129);function tn(e,t){if(!Vt(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Nt===void 0?t:Nt.createHTML(t)}var nn=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=Wt;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===Wt?c[1]===`!--`?o=Gt:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=qt):(Xt.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=qt):o=Kt:o===qt?c[0]===`>`?(o=i??Wt,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?qt:c[3]===`"`?Yt:Jt):o===Yt||o===Jt?o=qt:o===Gt||o===Kt?o=Wt:(o=qt,i=void 0);let d=o===qt&&e[t+1].startsWith(`/>`)?` `:``;a+=o===Wt?n+Lt:l>=0?(r.push(s),n.slice(0,l)+Pt+n.slice(l)+Ft+d):n+Ft+(l===-2?t:d)}return[tn(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},rn=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=nn(t,n);if(this.el=e.createElement(l,r),en.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=en.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Pt)){let t=u[o++],n=i.getAttribute(e).split(Ft),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ln:r[1]===`?`?un:r[1]===`@`?dn:cn}),i.removeAttribute(e)}else e.startsWith(Ft)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Xt.test(i.tagName)){let e=i.textContent.split(Ft),t=e.length-1;if(t>0){i.textContent=Mt?Mt.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],zt()),en.nextNode(),c.push({type:2,index:++a});i.append(e[t],zt())}}}else if(i.nodeType===8){if(i.data===It)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(Ft,e+1))!==-1;)c.push({type:7,index:a}),e+=Ft.length-1}}a++}}static createElement(e,t){let n=Rt.createElement(`template`);return n.innerHTML=e,n}};function an(e,t,n=e,r){if(t===Qt)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=Bt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=an(e,i._$AS(e,t.values),i,r)),t}var on=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??Rt).importNode(t,!0);en.currentNode=r;let i=en.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new sn(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new fn(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=en.nextNode(),a++)}return en.currentNode=Rt,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},sn=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=an(this,e,t),Bt(e)?e===j||e==null||e===``?(this._$AH!==j&&this._$AR(),this._$AH=j):e!==this._$AH&&e!==Qt&&this._(e):e._$litType$===void 0?e.nodeType===void 0?Ht(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==j&&Bt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Rt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=rn.createElement(tn(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new on(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=$t.get(e.strings);return t===void 0&&$t.set(e.strings,t=new rn(e)),t}k(t){Vt(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(zt()),this.O(zt()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=jt(e).nextSibling;jt(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},cn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=j,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=j}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=an(this,e,t,0),a=!Bt(e)||e!==this._$AH&&e!==Qt,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=an(this,r[n+o],t,o),s===Qt&&(s=this._$AH[o]),a||=!Bt(s)||s!==this._$AH[o],s===j?e=j:e!==j&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ln=class extends cn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===j?void 0:e}},un=class extends cn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==j)}},dn=class extends cn{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=an(this,e,t,0)??j)===Qt)return;let n=this._$AH,r=e===j&&n!==j||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==j&&(n===j||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},fn=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){an(this,e)}},pn={M:Pt,P:Ft,A:It,C:1,L:nn,R:on,D:Ht,V:an,I:sn,H:cn,N:un,U:dn,B:ln,F:fn},mn=At.litHtmlPolyfillSupport;mn?.(rn,sn),(At.litHtmlVersions??=[]).push(`3.3.3`);var hn=globalThis,M=class extends kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new sn(t.insertBefore(zt(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Qt}};M._$litElement$=!0,M.finalized=!0,hn.litElementHydrateSupport?.({LitElement:M});var gn=hn.litElementPolyfillSupport;gn?.({LitElement:M}),(hn.litElementVersions??=[]).push(`4.2.2`);var N=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},_n={attribute:!0,type:String,converter:Et,reflect:!1,hasChanged:Dt},vn=(e=_n,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function P(e){return(t,n)=>typeof n==`object`?vn(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function F(e){return P({...e,state:!0,attribute:!1})}var yn=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function bn(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return yn(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return yn(n,r,{get(){return a(this)}})}}var xn,Sn=t({templates:()=>Cn}),Cn=function(e){let t=new Map;return new Proxy(e,{get(e,n){if(typeof n==`string`){if(!t.has(n)){let r;for(let t=1;t<=n.length&&r===void 0;t++){let i=n.slice(0,t);Object.hasOwn(e,i)&&(r=e[i])}t.set(n,r)}return t.get(n)}}})}({c:`実行`,d:`出力`,"edge-a":`完了を待つ`,"edge-c":`結果を受けて作成`,"edge-g":`出力を受け取る`,f:`停止`,h0:k`JSON Lines(1 行ごとに JSON オブジェクト、スキーマ ${0})`,h5:k`${0} の出力`,h6:k`JSON オブジェクト(スキーマ ${0})`,h87:k`依存先タスク ${0}`,h8e:k`この実行には階層 <code>${0}</code> がありません`,ha:k`ファイルなし | Python コードで定義(<code>TaskAdapter</code>)`,hc:k`実行中 ${0}${1}`,hf:k`${0} の出力から`,i:`未確認`,"no-":`実行はまだありません`,non:`なし`,"outcome-c":`取り消し`,"outcome-d":`完了`,"outcome-p":`一部のみ完了`,"part-d":`定義`,"part-i":`入力ファイル`,"part-p":`パラメータ`,s000:`実行履歴の未実行のタスク`,s009:`修正ラウンド 1 回後`,s00c:T`HTTP ステータス ${0}`,s02f7:`実行されず`,s02f9:T`アカウント: ${0}`,s030:T`カスタムビュー ${0} はありません`,s037:`完了`,s0382:T`${0}: ${1}`,s038b:`ページ`,s03b:`タブ`,s03e:`タスク`,s03f:T`古い試行 ${0} 件は非表示`,s041:T`ほか ${0} 件`,s042:`タスクが宣言したパターンの下で、試行が作成・変更・削除したファイル(changes)`,s044:T`一部のみ完了 ${0} 件`,s048:`再開後に再実行`,s04f:`停止した部分`,s051:`実行中のエージェントのセッション`,s055:`選択中の項目`,s05f:`認証エラー`,s062:`トランスクリプト`,s0668:`ユニットごとのステージとステップ(CursorStore)`,s066d:`出力`,s06a:`Esc: 1 つ上の階層`,s06b0:`実行中ではありません`,s06bf:`中を表示`,s077:`テキストフィルター(/)`,s079:T`キャッシュ ${0}`,s07d:`関数`,s07e:T`+${0}`,s087:T`${0}%`,s08b1:T`${0}(認証情報が休止中)`,s08b3:`いいえ`,s08c:`稼働中`,s0932:`出力の検証: OK`,s0935:`終了日`,s094:`最初のエージェントのセッションの前に終了`,s09b:`プロンプトなし`,s0a:T`入力元: ${0}`,s0b0:T`作成元: ${0}`,s0b2:`エージェントのセッション開始時のサブスクリプション利用率(アカウント全体)`,s0b3:`OK`,s0b7:`実行前からあるファイル`,s0bf:T`${0} 周目`,s0c:T`モデル切り替えのあったタスク ${0} 件`,s0d7:T`キャッシュ書き込み ${0}`,s0df:`依存先タスクが登録されなかった`,s0e6:`問題`,s0ea:`プラグインディレクトリ`,s0ef:`すべてのホスト`,s0f0:`一部省略`,s0f1:`リセット済み`,s0f2:T`最初の API 呼び出しの入力: ${0}`,s0f8:T`出力ファイル ${0} 件`,s103:`再開カーソル`,s104:`昇順に並べ替え`,s107:`種別の最初のタスクの開始時に記録(definitions/<kind>.json)`,s108:T`${0} の実装`,s114:T`${0} 型の JSON 値`,s115:`過去 24 時間`,s123:`待機中`,s125:T`要素 ${0} 個`,s12c:`型の不一致`,s13:T`最終報告 ${0}`,s14b:`コーディングエージェントが報告した値`,s14c:T`この失敗で ${0} が ${1} で停止`,s150:`出力`,s156:`なし(任意)`,s158:T`週の利用率 ${0}`,s159:`このタスクが代わりに出力ファイルを書く種別(output_of)`,s163:`検証対象のファイルなし`,s165:T`${0} 回目で完了 | 失敗 1 回`,s168:`検証のタイミング`,s170:T`実行されず ${0} 件`,s172:T`同じフローの実行 ${0} から見込んだ、この実行がまだ作成していないタスク(forecast)`,s17d:`利用率のルール`,s17e:`書き込み待ち(タスクが待機中)`,s18:T`ループ内の ${0}`,s197:`利用できるモデルなし`,s19e:`上限: max_concurrent`,s1a20:T`スキップ ${0} 件`,s1a2c:T`5 時間枠 ${0} → ${1}`,s1a3:`種別 · ユニット`,s1a4:`モデルごとの、エージェントのセッションの使用量。モデル切り替えの前後は別々に集計(Plan.models)`,s1ac:`エディタのテーマ`,s1b2:T`種別 ${0}`,s1bf:`実行中のプロセスなし`,s1c0:`パラメータ`,s1c2:`タスクが選択されていません`,s1c4:T`セッション開始時の利用率(アカウント全体): ${0}`,s1c7:`実行に登録されたすべてのタスク(種別ごと、plan.jsonl)`,s1cc:`実行中の Python タスク`,s1d4:`どのフローも結果を待たず、after= にも渡さず、戻り値にも含めなかったタスク(unawaited)。出力ファイルと変更のために実行された`,s1db:`API エラー`,s1dc:T`試行 ${0} 回`,s1dd:`実行中のタスクなし`,s1e9:T`プロンプト(${0} 文字、ほか ${1} 文字は未保存)`,s1eb:`入力`,s1f:`削除`,s204:`安全分類器による停止`,s20e:T`リセットまで ${0}`,s20f9:`依存先タスクが実行されなかった`,s20fd:`ホストなし`,s217:`あり`,s21a:`発生したらリトライする例外(retry_on)`,s221:`JSON ではありません`,s224:`ツール実行中に中止`,s230:`スキーマにないフィールド`,s234:`終了した試行はまだありません`,s236:`拡大`,s23b:T`${0} 回の試行がすべて失敗: ${1}`,s23f:`定義はまだありません`,s24:T`完了 ${0}`,s25:T`まだ登録されていない種別: ${0}`,s260:`API 呼び出し 1 回`,s26ba:`ユニットなし`,s26bb:`実行した試行の回数(リトライを含む、journal.jsonl)`,s26e:T`API 呼び出し ${0} 回`,s27a:`最後のメッセージから`,s27b:T`ユニット: ${0}`,s27d:`フローの構成`,s28a2:`リプレイ`,s28ad:`曜日と時刻ごと(期間のタイムゾーン)`,s29b5:T`${1} タスク中 ${0} 件`,s29b6:T`最大コンテキスト: ${0}`,s2a:`現在`,s2c0:T`パラメータ ${0}`,s2c8:`リトライ`,s2cd:`モデルの利用可否`,s2dd:`試行の結果(stop)`,s2df0:`割合`,s2df6:`開始時も同じ内容`,s2e3:T`ほかの出力 ${0} 件`,s2e4:`周`,s2f34:T`${0} 周`,s2f3c:`問題なし`,s2f5:`定義なし`,s2fa:T`5 時間枠の利用率 ${0}(リセット ${1})`,s2fe:`ツール`,s313:`終了(未実行のタスク 1 件)`,s31a:T`待たれなかったタスク ${0} 件`,s321:`余分なフィールド`,s326:T`キャッシュ読み込み ${0}`,s32d:`最大コンテキスト`,s33b:`パイプラインの階層`,s33f:T`${0} で停止`,s343:`新しいイベント 1 件を表示`,s34b:`終了`,s34e:`降順に並べ替え`,s351:`終了した試行なし`,s352:`ファイル全体`,s355:`入力ファイルに検証エラー`,s366:`週`,s367:`料金`,s368:`コピー`,s36d:T`この書き出しに含まれないもの: ${0}`,s36e:T`所要時間 ${0}`,s3700:`Web 検索 1 回`,s370b:T`報告時刻 ${0}`,s378:`検証エラーの後に、同じエージェントのセッションで続けるラウンド(rounds)`,s37d:`スキーマ以外の検証(validators)`,s384:T`${0} を展開`,s38500:`各タスクが読み込むファイル(InputContract)`,s38501:T`修正ラウンド ${0}`,s387:T`検索結果 ${0} 件`,s38e65:`修正依頼のプロンプトに含めて送信`,s38e6a:`日ごとの料金`,s390:`JSON オブジェクトではありません`,s39e:`パイプライン`,s3a7:T`上限: ${0}`,s3aa:`出力ファイルなし`,s3b3:`プロセスツリー`,s3b8:`アカウント全体の値 | アカウントごとの最初と最後の値 | エージェントのセッション開始時に取得`,s3b9:T`${0} にモニター API がありません: ${1}`,s3bd:T`task_detail コールバックが失敗: ${0}`,s3c6:`実行した試行の回数`,s3cd:`実行中のエージェントのセッション 1 件`,s3d0:`エージェントのセッション`,s3d1:`概要`,s3d31:`利用できるモデルがなく、設定どおりのモデルで実行する種別(kept)`,s3d38:T`認証情報 ${0}`,s3d99:`検証エラー後の、同じエージェントのセッション`,s3d9b:`テキストファイル`,s3dd:`ネットワークエラーで応答なし`,s3f7:`修正依頼`,s3fd6:`開始`,s3fda:`このタスクの出力が後続タスクのパラメータに含まれる(given_from)`,s3ff:T`認証情報: ${0}`,s407:T`${0}: 入力`,s408:`週の利用率`,s41:`Tab: 次のノード`,s42a:`フィールド`,s42c:`検証`,s438:`ハイライトを解除`,s43a:`入力ファイル`,s43e:`利用不可`,s451:`料金の高いタスク`,s454:T`${0} のループの各周`,s45d:T`${0}(カスタムビュー)`,s46:T`1 周: ${0}`,s473:`キャッシュ読み込み`,s478:`検証対象のファイル(OutputContract、InputContract)`,s479:`締め切り`,s47a:T`このタスクの入力 ${0} 件`,s47b:`Python タスク`,s47c:`未対応のイベント`,s482:T`終了 ${0}`,s484:`テキストなし`,s48e:`所要時間`,s490:`モニターのサーバーに接続済み`,s491:T`${0} のループ`,s49c:T`修正ラウンド ${0} 回`,s4a:T`${0} 日前`,s4c:`あと 1 件の見込み(forecast)`,s4d6:`検索結果 1 件`,s4d8:`モデル切り替え`,s4e7:T`修正依頼 ${0} 回で完了 | 最初の検証エラー: ${1}`,s4ef:`ループ`,s4f0:`スキーマにない`,s4f9:T`ホスト ${0}`,s4fc:`検証エラーを示し、同じエージェントのセッションで出力の修正を求める依頼。ラウンドの途中、または修正ラウンドで(hook_errors, rounds)`,s4fe:`エージェントタスク`,s5013:T`取り消し ${0} 件`,s5018:T`${0}: ${1} → ${2}`,s504:`日付指定`,s5131:`そのモデルで始めたエージェントのセッションの数`,s5138:`入力・出力・キャッシュ読み込み・キャッシュ書き込みの合計`,s514:`実行が終了した`,s521:`1 ユニット`,s522:`安全分類器がエージェントのセッションの一部を止め、セッションはそのまま続いた(safety_stops)`,s525b:`失敗の後の、次のモデルでの新しいエージェントのセッション(Router のホップ)`,s525c:`記録から再生した試行(replayed)`,s529:T`上限 ${0}`,s52cc:T`${0} の締め切りと仕上げの猶予を過ぎた`,s52cf:`カスタムビュー`,s535:`種別`,s53c5:T`${0}: 未実行`,s53c8:`不可`,s53e:`次の周`,s541:`開始できず`,s543:`プロンプト`,s5522:T`フロー呼び出し ${0}`,s552a:T`${0} の失敗により停止`,s555:`プラグインディレクトリ`,s558:`認証情報の不一致`,s5590:`項目`,s559f:`その他のモデル`,s55f:T`${0}(${1})`,s565:`修正ラウンド 1 回`,s566:T`(ほか ${0} 文字は未保存)`,s567:`未実行(依存先タスクが失敗)`,s568:T`後続タスク: ${0}`,s571:T`入力 ${0} がありません(${1} が未実行)`,s574:T`キャッシュ書き込み ${0}`,s585:T`入力 ${0} がありません(${1} が失敗)`,s587:T`${0} 以降報告なし`,s58b:`モデルの置き換え`,s58c:`実行履歴`,s591:`5 時間枠`,s594:T`修正依頼 ${0} 回`,s59e:`上限に接近`,s5a3:`休止中`,s5a7:`ツール`,s5ab:`並び順`,s5b9:`種別ごとのトークンと料金`,s5bd:`フロー呼び出しごとの締め切り(time_box)`,s5c7:`サービスなし`,s5cb:`分岐`,s5cd:T`エージェントのセッション ${0} 回`,s5cf:`値なし`,s5d0:`実行中にこのタスクが占有する名前(claims)`,s5d4:T`${0} 回目で完了 | 失敗 ${1} 回`,s5d5:T`利用率: ${0}`,s5da:`モデル`,s5de:`依存先タスク`,s5e3:`書き込みなし(タスクが未実行)`,s5e6:`テキスト(JSON 文字列)`,s5f2:`ロールなし`,s5f31:`エージェント・モデル・認証情報`,s5f34:`エラー`,s5f40:`行なし`,s5f43:`ソース`,s5f7:`なし(必須)`,s5f8:T`認証情報 ${0} は休止中`,s5ff:`エージェントタスク`,s601:`実行中`,s605:T`未実行の後続タスク ${0} 件`,s6203:`キャッシュ書き込み`,s6204:T`このバージョンの contraagent が読めなかったイベント(unread_events): ${0}`,s629:`任意`,s647:`応答が JSON ではなく HTML`,s649:`後続タスク`,s64a:`前のタスクの出力は同じなのに、フローが別のパラメータを渡した(divergence)。時刻、乱数、外部の状態、フローのコードの変更による`,s64f:`変更禁止の箇所`,s652:T`ロック ${0} 件`,s653:`締め切りを過ぎた`,s65c:`中断`,s6645:`拡大(Ctrl + スクロール)`,s6647:`ファイルなし`,s664b:`ツール呼び出しが戻る前に実行が終了`,s670:T`${0} ユニット`,s673:`停止でエラー`,s680:`タイムライン`,s688:`その他の検証`,s68d:T`仕上げの猶予 ${0}`,s695:`修正依頼 1 回`,s699:T`スキーマ ${0}`,s6a0:`1 ステップ完了`,s6a8:T`入力 ${0} がありません(${1} が未完了)`,s6aa:`未実行(入力ファイルなし)`,s6b0:`ホスト`,s6b8:T`同時実行 ${0}/${1}`,s6b9:`タスクなし`,s6c3:`依存先タスクなし`,s6c7:`実行の開始時刻`,s6c8:T`依存先タスク ${0} が失敗`,s6d7:T`${1} タスク中 ${0} 件完了`,s6db:T`${0} 文字`,s6e4:`未選択`,s6eb:`読み込み中…`,s6f1:`API 呼び出し`,s6f2:`出力ファイル 1 件`,s6f5:T`見込み: あと ${0} タスク`,s6fa:`フロー呼び出しがエラーで終了`,s700:`書き出しに含まれない`,s703:T`${0} まで休止`,s706:`実行グループ`,s70a7:T`タスク終了後の利用率: ${0}`,s70af:`種別`,s71:T`モデル切り替え: ${0}`,s721:`ホストからの報告なし`,s7233:`古い試行 1 件は非表示`,s7239:T`修正依頼のあったタスク ${0} 件`,s72dc:`ユニットごとの周回数`,s72dd:`キャッシュ読み込み`,s734:`スタブエージェント`,s737:`ループの周回数`,s73d:`未実行の後続タスク 1 件`,s755:T`プラグイン ${0}`,s758:`エージェントのセッションなし`,s75e:`実行を検索`,s767:T`${0} モニター`,s76d:`カスタム列(row_extras)`,s76f:`原因`,s771:T`入力 ${0} は失敗したタスク ${1} の出力`,s77e:T`未実行 ${0} 件`,s782:`書き足す対象のファイル`,s786:`トランスクリプト`,s78f:`トークン`,s797:`すべての中を隠す`,s79a:T`未対応のイベント: ${0}`,s79f:T`5 時間枠の利用率 ${0}`,s7a1:`エラーで終了したフロー呼び出し 1 件`,s7a4:`権限エラー`,s7b16:`入力ファイルなし`,s7b1c:`修正依頼のあった試行`,s7b3:`検索に一致する実行なし`,s7bf:T`最初のエージェントのセッションの前に各モデルへ送る 1 回のリクエスト(preflight, policy ${0})`,s7c0:T`ホストからの報告なし ${0} 件`,s7c9:`フィルター`,s7cd8:`このタスクの入力 1 件`,s7cd9:`利用できるモデルがなく、最初に応答したモデルで実行する種別(substitute)`,s7cf:`応答が JSON ではない`,s7da:`最終報告`,s7df:T`終了(未実行のタスク ${0} 件)`,s7e:T`ロール ${0}`,s7f:`表示形式`,s803:`ファイル`,s807:`実行 1 件`,s80c:`1 行`,s817:`変更したファイル 1 件`,s81a:`各タスクが書き込むファイル(OutputContract)`,s822:T`以前の試行のモデル: ${0}`,s826:`エージェントのセッションが使ったモデル`,s827:`認証情報が休止中`,s83:T`書き込み ${0}`,s841:`たった今`,s84f:`リトライ`,s8512:T`テーマ: ${0}`,s851d:`ファイルの値`,s859:`実行中`,s85e:T`${0}: モデル切り替え`,s863:T`入力 ${0} がありません`,s864:`全体を表示`,s868:T`${2} 年 ${0}〜${1} | ${3}`,s86c:T`ホスト ${0} 台`,s874:T`${0} ステップ完了`,s877:T`${0} 回目の失敗後の、新しいエージェントのセッション`,s87a:`実行されず`,s87b:T`モデル切り替え後に完了: ${0}`,s880:`全試行の合計`,s888:`入力`,s88b:`表で表示`,s892:T`入力 ${0}(${1} の出力)がありません`,s89e:`パラメータなし`,s8a56:`なし`,s8a59:T`PID ${0}`,s8ab:`コーディングエージェント`,s8ad:`周回数`,s8ae:T`${0} の記録から再生したエージェントのセッションと、そこに記録した新しいセッション(replay, record_missing)`,s8b1:`リトライしたタスク`,s8b4:`同じロックを持つタスクが共有する常駐の補助プロセス(services.jsonl)`,s8bb:`終了したすべての試行から集計(journal.jsonl)`,s8c1:T`${0} 分前`,s8c5:`このタスクの結果を受け取った直後に、フロー呼び出しが後続タスクを作成した(created_from)`,s8d3:`コーディングエージェントが使ったアカウントまたは API キー(credential)`,s8d4:`PID`,s8dd:T`キャッシュ読み込み ${0}`,s8de:`再開後の実行での、新しいエージェントのセッション`,s8df:`オブジェクト`,s8e3:`アシスタント`,s8e6:`Python コードで定義`,s8e9:T`ほか ${0} アカウント`,s8ea:`Tab: 次の行`,s8f1:`選択を解除`,s8f2:`ユニット`,s8f4:`入力と出力(全試行の合計)`,s8f5:`未実行`,s8fa:`未実行(入力ファイルなし、入力ファイルに検証エラー)`,s8fc:T`修正依頼 1 回で完了 | 最初の検証エラー: ${0}`,s900:`ビュー`,s901:`完了したタスク`,s906:`Python タスク`,s90c:T`コンテキストの上限 ${1} の ${0}%`,s90e:`ほかの種別が実装する種別(base_kind)`,s90f:`認証エラー`,s914:T`最大 ${0} 周`,s919:T`${0}d ${1}h`,s91d:`順序のみの依存先`,s924:T`モデル ${0}`,s92a:T`依存先タスク ${0} 件の出力待ち`,s92b:T`5 時間枠 ${0}`,s934:`試行 1 回`,s936:`キュー内で同順位のタスクの順序を決める値(priority)`,s93e:`リプレイ`,s941:T`1 日あたり ${0}`,s949:`書き出しの期間`,s94d:`認証情報`,s94e:T`最終更新 ${0}`,s94f0:`実行中のタスク`,s94fd:T`${0} を折りたたむ`,s967:T`失敗 ${0} 件`,s96a:`コンテキストの上限`,s96c:T`出力 ${0}`,s97:T`修正依頼 ${0} 回で完了`,s980:`テキストフィルター`,s9893d9:T`利用率のルール: ${0}`,s9893de:`ホスト 1 台`,s98b:`グループ`,s98f:`入力ファイルなし`,s99:T`${0} 日間`,s9a4:T`失敗: ${0}`,s9a6:T`Web 検索 ${0} 回`,s9aa:`API 呼び出し 1 回あたりの入力の最大値。キャッシュ読み込みとキャッシュ書き込みを含む(peak_context)`,s9b1a6:`実行中ではありません`,s9b1a9:T`仕上げの種別: ${0}`,s9b3:`報告間隔`,s9b7:`書き込みなし(タスクが失敗)`,s9bd:T`${0} 回目で完了 | 失敗 ${1} 回 | 最初の失敗: ${2}`,s9c3:T`上限を超えた利用: ${0}`,s9c5:T`${0} の出力`,s9c6:`修正ラウンド`,s9c7:`すべての中を表示`,s9cb:`実装する種別`,s9d3:T`${0} 時点の書き出し`,s9d6:`最終応答なしで終了`,s9da:T`修正ラウンド ${0} 回後`,s9de:`モデル`,s9e0:T`状態: ${0}`,s9e8:`未実行(入力ファイルに検証エラー)`,s9f0:T`入力 ${0}`,s9f2:`一部のみ完了`,s9f7:`エラー`,s9f92:T`${0} の内部`,s9f97:`料金の上限`,s9fb:`実行`,s9fd:`タスクの開始前からあるファイルも有効`,s9ff:`モデル切り替え`,sa1:`リプレイした試行`,sa23:`ターン数の上限`,sa24:T`${0} の締め切りまでに終わらない`,sa31:`行を折り返す`,sa33:`後続タスクなし`,sa358:`ロール`,sa35c:`試行`,sa36:`モデル別の内訳`,sa39:T`実行中のエージェントのセッションの新しいイベント ${0} 件を表示`,sa3c:`形式`,sa3d3:T`週の利用率 ${0}(リセット ${1})`,sa3db:`エージェント・モデル`,sa3de:`停止`,sa43:`作成元`,sa48:`コマンドライン`,sa4f:T`最大 ${0} 回`,sa508:`安全分類器による停止 1 件`,sa50a:`折りたたむ`,sa54:`API 呼び出しごとのトークンは不明`,sa57:`権限エラーになったツール呼び出し`,sa62:T`${0}: トランスクリプト`,sa66:T`前の ${0} 行を表示`,sa6a:`開始日`,sa70:`項目なし`,sa71:`期待する型`,sa74:`縮小(Ctrl + スクロール)`,sa81:`システム設定に合わせる`,sa84:T`新しいイベント ${0} 件を表示`,sa86:T`${0} 時間前`,sa87:`ソースを表示`,sa88:T`${0} の入れ子のループ`,sa8b:`Shift + 矢印キー: 依存先タスク・後続タスク`,sa9b:`タスク詳細`,sa9d:`報告なし`,saa0:`書き込み待ち(タスクが実行中)`,saa2:`理由`,saa9:`OutputContract・InputContract を宣言したタスクなし`,saaa:`5 時間枠の利用率`,saab:`テーマ`,sab5:T`${0} 行目`,sabd:`思考`,sac1:`モニターのサーバーに未接続`,sac7:T`${0} に利用できるモデルなし`,saca:`期間内の実行の合計`,sacb:`分かっているのはコーディングエージェントが出力したトークンの合計だけ。API 呼び出しごとのトークンは不明(usage_unknown)`,sacc:`可`,sad1:T`ほかに休止中の認証情報 ${0} 件`,sad3:`状態`,sad9:`API リクエストを再送`,sadb:`トークンは不明`,sae5:`必須`,sae6:`実行履歴のリトライしたタスク`,saee:`プロセス`,saf2:`すべてのモデルが利用可能`,saf8:`変更したファイルなし`,safd:T`${0} 回目が失敗: ${1}`,sb05:`エラー`,sb06:`実行履歴の修正依頼のあった試行`,sb0c5:`サブスクリプションの利用率`,sb0cc:T`週 ${0} → ${1}`,sb0f:`Python タスク 1 回`,sb105:T`未実行: ${0}`,sb106:`検索語`,sb108:`作成、試行の失敗後に削除`,sb14:T`報告なし ${0} 台`,sb16:T`${0} 行`,sb1f:`前の 1 行を表示`,sb24:T`この失敗で ${0} が停止`,sb26a:`登録順`,sb26f:`表示中の階層の外`,sb27:`Enter: 開く`,sb28:`キャッシュ書き込み`,sb31:T`プロンプト(${0} 文字)`,sb34:T`変更したファイル ${0} 件`,sb38:`ツール呼び出し`,sb4:`トランスクリプトなし`,sb51:`パイプラインのプロセス内`,sb53:`はい`,sb55:`コーディングエージェントが報告した値`,sb59:T`コンテキストの上限に接近(${0}%)`,sb5a:`未実行`,sb6:`タスク実行中の書き込みが必須`,sb74:`下の階層あり`,sb76:T`${0} に停止`,sb81:`実行したエージェントのセッションのトークンは不明(usage_unknown)`,sb88:`このバージョンの contraagent が読めなかったイベント(unread_events)`,sb89:`エージェントのセッション 1 回`,sb94:T`5 時間枠(${0})`,sb97:`コンテキストの上限に接近`,sb98:T`${0}: 完了`,sb99:`トークンと料金`,sb9c:T`Python タスク: ${0}`,sba3:`1 周`,sba7:`ほかの出力 1 件`,sba8:`検証を通るファイルを書き込む前に、タスクが失敗`,sbaf:`要素 1 個`,sbb2:`開始時の利用率`,sbb9:`終了`,sbbe:`入力元`,sbc6:T`${0} 周: ${1}`,sbc9:T`以前の試行のモデル: ${0}`,sbca:`タスクの開始時`,sbcc:`依存先タスクが失敗`,sbd4:`実行を切り替え(r)`,sbd5:`停止の記録なし`,sbd9:`再開後`,sbdc:T`履歴にほか ${0} 件`,sbe2:`実行履歴の失敗した試行`,sbe4:T`${0} の記録から再生したエージェントのセッション(replay)`,sbe9:T`週(${0})`,sbea:`保存対象外(keep_transcripts = false)`,sbf18:`種別のロール`,sbf1d:T`ロック ${0}`,sbf2:`アクティビティなし`,sbf9:`スタブエージェントが台本どおりの応答で処理したタスク(stub)`,sc03:`それ以前`,sc07:`リトライ対象の例外`,sc15:`スキップ`,sc1a:T`待機中 ${0} 件`,sc1b:T`リトライしたタスク ${0} 件`,sc2:`ツール`,sc3:`この期間の実行はありません`,sc4:`タイムアウト`,sc53:`休止した認証情報`,sc54:T`${0} の締め切りを過ぎた`,sc57:T`入力 ${0} に検証エラー`,sc59:T`${2} 年 ${0}〜${1}`,sc5b:`次のモデルでの新しいエージェントのセッション`,sc61:T`週 ${0}`,sc65:`縮小`,sc68:`日時`,sc6e:`締め切りまでに終わらない`,sc6f:T`エラーで終了したフロー呼び出し ${0} 件`,sc73:`開始`,sc75:T`全 ${1} 行のうち先頭 ${0} 行`,sc79:`タスク`,sc7d:`同時実行(上限)`,sc87a:T`警告のしきい値: ${0}`,sc87d:T`終了 ${0}`,sc92:`空き`,sc94:`全体`,sc97:`タイムゾーン`,sc9e:`その他`,sca1:`開始前に変更された`,sca4:`プロセスなし`,sca6:`プレビューを表示`,sca7:`ロール`,scb8:`終了(未完了のタスク 1 件)`,scb9:`最終試行の終了時刻`,scbd:`全文`,scbf:T`試行 ${1} 回中 ${0} 回`,scca:T`最も高い種別: ${0}`,sccc:`モデルが応答を拒否`,scd1:`モデルの応答`,scd2:T`${0}: ${1} → 次のモデル`,scd94:`エージェントの所要時間`,scd9c:T`優先度 ${0}`,scdb:`Esc: 選択を解除`,scde:`ループ`,scf41:T`完了 ${0} 件`,scf43:T`入力 ${0} は失敗したタスクの出力`,scf70:`レート制限`,scf71:`失敗した試行の後の試行(retries)`,sd05:T`締め切り ${0}`,sd0e:`出来事`,sd17:`入力 / 出力 | キャッシュ読み込み / キャッシュ書き込み`,sd1f:`ファイルの検証に使うスキーマ`,sd20:T`順序のみの依存先: ${0}`,sd26:T`${0} 件を同時実行`,sd34:T`${0} に開始(${1})`,sd38:`変更`,sd3c:`登録済みのタスクなし`,sd3e:T`終了(未完了のタスク ${0} 件)`,sd40:`読み込むファイル(検証あり)`,sd47:`ローカルの認証情報(ambient)`,sd58:`終了(失敗したタスク 1 件)`,sd5a:`実行がシグナルで停止された`,sd5c:T`変更: ${0}`,sd5d:T`トークン: 入力 ${0}、出力 ${1}、キャッシュ読み込み ${2}、キャッシュ書き込み ${3}`,sd5e:`所要時間の合計`,sd6:`タスク呼び出しが実行全体の代わりに指定した、このタスクの作業ディレクトリ(cwd)`,sd73:`失敗`,sd744:`検証対象のファイル`,sd747:`なし(任意)`,sd75:`検証エラー`,sd776:T`全体の ${0}%`,sd77d:`実行中のエージェントのセッションの新しいイベント 1 件を表示`,sd7d:T`入力 ${0}(${1} の出力)に検証エラー`,sd82:`タスクの開始前からあるファイルは無効`,sd8a:T`${0} まで`,sd93:T`依存先タスク ${0} の出力待ち`,sd95:T`一部のみ完了: ${0}`,sd96:`中を隠す`,sda2:T`セッション開始時の利用率: ${0}`,sda80:T`すべて表示(${0} 文字)`,sda8d:`最大コンテキストが警告のしきい値を超えた(context_warned)`,sdb1:`入力`,sdb4:`イベントが途絶えた`,sdb8:`出力に検証エラー`,sdc:T`実行グループ ${0}`,sdd1:`モニターから応答がありません`,sddf:`ビューを表示`,sde3:T`作業ディレクトリ ${0}`,sde7:`履歴にほか 1 件`,sde8:T`アカウント ${0}`,sdf1:T`${0} 回目で完了 | 失敗 1 回 | 最初の失敗: ${1}`,sdf9:`リトライ後に完了`,se0e6:T`${0} から休止中`,se0ed:T`実行されず: ${0}`,se17:T`必要な時間 ${0}`,se1a:`作成`,se21:`指標`,se27:`タスクを実行した CLI(claude、omp)`,se2b:T`キー ${0} 個: ${1}`,se2c:T`期待する型: ${0}`,se3:`キーボードショートカット`,se4:`作成、試行の失敗後も保持`,se55:`エージェントのセッションの所要時間の合計`,se5ad:`モデル切り替え`,se5af:T`修正ラウンド ${0}`,se5b:`推移`,se5d:`monitor.Panel`,se60:`ハイコントラスト`,se61:`パイプラインのプロセス内の関数`,se66:`1 タスク`,se69:`後続タスクはこのタスクの完了を待つが、出力は受け取らない(after)`,se71:T`${0} 回目`,se75:`リプレイと新しいセッション`,se7b:T`タスクの所要時間 ${0}`,se8:T`安全分類器による停止 ${0} 件`,se90:`認証情報`,se99d:`ロック`,se99f:T`終了(失敗したタスク ${0} 件)`,sea2:`期間`,sea4:`定義`,sea6:`矢印キー: マーク`,sea74:T`${0} タスク`,sea7b:`実行の一覧`,seac:`待機中`,seb0:`グラフで表示`,seb2:`締め切りと仕上げの猶予を過ぎた`,seba:`既定`,sec2:`すべての種別`,sec7:`コーディングエージェントが使ったエージェント定義(agents/<role>.md)`,secc:`上限に到達`,secf:T`${0}の利用率 ${1}`,sed05:`コーディングエージェントが報告した料金(試行が終わった日に計上)`,sed0a:`タスクごとに 1 つ(Backend.run)`,sed7:`種別または関数`,sed8:`合計`,sede:`ステージなし`,seea0:`結果`,seea1:`ホスト ID なし`,seed:T`入力ルート ${1} の ${0}`,seee1:`スキップ`,seee3:`完了しなかった試行`,sef0:T`実行中 ${0} 件`,sefc:`言語`,ser:`稼働中`,sf03:`所要時間の中央値`,sf06:T`タスクは ${0} 回目で完了`,sf08:`すべてのエージェントのセッションの合計(同時に実行した分も含む)`,sf11:`終了時刻`,sf14:`最初のエージェントのセッション`,sf26:T`実行 ${0} 件`,sf2b:`トークンの報告なし`,sf2d:T`関数 ${0}`,sf2e:`定義`,sf39:`周回数`,sf3c:`ほか 1 アカウント`,sf3e:`カスタムビュー`,sf46:T`${0} 周目`,sf48:`終了後の利用率`,sf4d:`コピー済み`,sf55:`サービス`,sf56:`試行の終了後に、同じアカウントで最初に報告された値`,sf5d:`ユニットごとではなく、実行ごとに 1 回実行されるタスク`,sf6:`フロー呼び出し`,sf7b:T`不明(${0})`,sf7d:T`残り ${0}`,sf7e:`すべての実行グループ`,sf82:T`休止 ${0} → ${1}`,sf86:`内容不明`,sf93:`合計`,sf9b:`エージェントのセッションが始まらなかった`,sfa04:`テキスト`,sfa06:`待たれなかったタスク 1 件`,sfa25:T`${0} 〜 ${1}`,sfa29:T`あと ${0} 件の見込み(forecast)`,sfa6:`フィルターに一致するタスクなし`,sfa8:`ツールのリクエスト`,sfad:`修正依頼 1 回で完了`,sfae:`ホスト一覧`,sfb3:`実行を切り替え`,sfb6:T`実行中のエージェントのセッション ${0} 件`,sfbb1:`失敗した試行`,sfbb8:T`${1} の失敗により ${0} で停止`,sfc4:`外部の状態`,sfc7:`再開カーソルなし`,sfd3:T`リトライ後に完了 ${0} 件`,sfd5:T`要素 ${0} 個: ${1}`,sfd7:`出力`,sfd85:`タスクの前から変わらない出力ファイルの箇所(preserve)`,sfd8b:`各日の最大値`,sfdd:`プロセス`,sfde:`ファイルにない必須フィールド`,sfe7:T`${0}: 入力と出力`,sfe9:T`プロセス ${0}`,sfef:`見込み: あと 1 タスク`,sff6:`登録済みのタスクはまだありません`,sff8:T`${0} のタスク`,sffa:`定義なし`,sfff:T`Python タスク ${0} 回`,stag:`完了`,stat:`状態`,"stop-ca":`取り消し`,"stop-co":`完了`,"stop-i":`未実行`,"stop-p":`一部のみ完了`,tab:`タスク`,tas:`タスク`,tok:`出力`,too:`完了`,"trends-p":`一部のみ完了`,"trends-r":`実行`,"view-g":`グラフ`,"view-o":`出力`,"view-t":`表`}),wn=`en`,Tn=[`ja`],En=[`en`,`ja`],Dn={en:`English`,ja:`日本語`},On={ja:()=>Promise.resolve(Sn)};function kn(){if(xn===void 0)try{xn=it({sourceLocale:wn,targetLocales:Tn,loadLocale:e=>On[e]()})}catch{xn=null}return xn!==null}var I=()=>xn?.getLocale()??wn;async function An(e){kn()&&await xn.setLocale(e)}var jn=`contraagent:locale`,Mn=e=>En.includes(e);function Nn(){try{let e=globalThis.localStorage?.getItem(jn);if(Mn(e))return e}catch{}for(let e of globalThis.navigator?.languages??[]){let t=e.toLowerCase().split(`-`)[0];if(Mn(t))return t}return wn}async function Pn(e){try{globalThis.localStorage?.setItem(jn,e)}catch{}await An(e)}var Fn=`contraagent`,In=null,Ln=``,Rn=null,zn=!1;function Bn(){let e=globalThis.history?.state;return e&&typeof e==`object`?e:{}}function Vn(){let e=Bn()[Fn];return e&&typeof e==`object`?e:{}}function Hn(){Rn&&clearTimeout(Rn),Rn=null;let e=In;In=null,e&&globalThis.history&&Vn().entry===Ln&&history.replaceState({...Bn(),[Fn]:{...Vn(),...e}},``)}function Un(){Hn()}var Wn={recall:function(e){if(globalThis.history)return In&&Ln===Vn().entry&&e in In?In[e]:Vn()[e]},remember:function(e,t){if(!globalThis.history)return;let n=function(){let e=Vn().entry;if(e)return e;let t=Math.random().toString(36).slice(2);return history.replaceState({...Bn(),[Fn]:{...Vn(),entry:t}},``),t}();In&&Ln!==n&&(In=null),Ln=n,(In??={})[e]=t,Rn??=setTimeout(Hn,200),zn||(zn=!0,globalThis.addEventListener?.(`pagehide`,Un))}},Gn=class{constructor(){this.values=new Map}recall(e){return this.values.get(e)}remember(e,t){this.values.set(e,t)}},Kn=new WeakMap;function qn(e,t){t?Kn.set(e,t):Kn.delete(e)}function Jn(e){for(let t=e;t;t=t.parentNode??t.host){let e=Kn.get(t);if(e)return e}return Wn}var Yn=class{constructor(e,t){this.id=e,this.from=t,this.items=null}get memory(){return Jn(this.from)}get loaded(){return this.items??=new Set(this.memory.recall(this.id)??[])}has(e){return this.loaded.has(e)}set(e,t){let n=this.loaded;t!==n.has(e)&&(t?n.add(e):n.delete(e),this.memory.remember(this.id,[...n]))}values(){return[...this.loaded]}clear(){this.loaded.size&&(this.loaded.clear(),this.memory.remember(this.id,[]))}},Xn=class{constructor(e){this.id=e;let t=null;try{t=JSON.parse(globalThis.sessionStorage?.getItem(`${Fn}:${e}`)??`null`)}catch{}this.items=new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}has(e){return this.items.has(e)}set(e,t){if(t!==this.items.has(e)){t?this.items.add(e):this.items.delete(e);try{globalThis.sessionStorage?.setItem(`${Fn}:${this.id}`,JSON.stringify([...this.items]))}catch{}}}},Zn=[`wheel`,`touchstart`,`pointerdown`,`keydown`],Qn=class{constructor(e,t=()=>Wn){this.id=e,this.memory=t,this.el=null,this.frame=0,this.restoring=!1,this.target=0,this.until=null,this.step=()=>{if(this.frame=0,this.restoring&&this.el)return this.place()?this.cancel():void(this.until!==null&&(this.frame=requestAnimationFrame(this.step)))},this.cancel=()=>{if(cancelAnimationFrame(this.frame),this.frame=0,this.restoring){this.restoring=!1,this.el&&(this.el.style.overflowAnchor=``);for(let e of Zn)this.el?.removeEventListener(e,this.cancel)}},this.onScroll=()=>{!this.restoring&&this.el&&this.memory().remember(this.id,Math.round(this.el.scrollTop))}}attach(e){this.el!==e&&(this.detach(),this.el=e,e.addEventListener(`scroll`,this.onScroll,{passive:!0}))}detach(){this.cancel(),this.el?.removeEventListener(`scroll`,this.onScroll),this.el=null}restore(){let e=this.el;if(!e)return;this.cancel();let t=this.memory().recall(this.id)??0;if(t<=0)e.scrollTop=0;else{this.target=t,this.until=null,this.restoring=!0,e.style.overflowAnchor=`none`;for(let t of Zn)e.addEventListener(t,this.cancel,{passive:!0,once:!0});this.place()}}update(e){this.restoring&&(e&&(this.until??=performance.now()+6e3),this.frame||=requestAnimationFrame(this.step))}reset(){this.cancel(),this.el&&(this.el.scrollTop=0)}place(){let e=this.el,t=e.scrollHeight-e.clientHeight;return e.scrollTop=Math.min(this.target,t),this.until!==null&&(t>=this.target||performance.now()>this.until)}},$n=[`overview`,`tasks`,`journal`,`outputs`,`definitions`,`procs`,`stream`],er=[`transcript`,`input`,`output`,`definition`],tr=[7,14,30],nr={page:``,run:``,tab:`overview`,key:null,view:`transcript`,round:null,def:null,kind:``,stop:``,q:``,layer:``,unit:``,sel:``,days:14,from:``,to:``,tz:``,group:``,trendsTab:``},rr=e=>$n.includes(e)||/^panel:.+/.test(e),ir=e=>er.includes(e);function ar(e){let t=new URLSearchParams(e),n=t.get(`tab`)??``,r=t.get(`view`)??``,i=Number(t.get(`round`)),a=t.get(`page`)===`hosts`?`hosts`:t.get(`page`)===`trends`?`trends`:``,o=t.get(`from`)??``,s=t.get(`to`)??``,c=/^\d{4}-\d{2}-\d{2}$/.test(o)&&/^\d{4}-\d{2}-\d{2}$/.test(s),l=Number(t.get(`days`));return{page:a,run:a?``:t.get(`run`)??``,tab:a!==`trends`&&rr(n)?n:`overview`,key:t.get(`key`)||null,view:ir(r)?r:`transcript`,round:Number.isInteger(i)&&i>0?i:null,def:t.get(`def`)||null,kind:t.get(`kind`)??``,stop:t.get(`stop`)??``,q:t.get(`q`)??``,layer:t.get(`layer`)??``,unit:t.get(`unit`)??``,sel:t.get(`sel`)??``,days:c?0:tr.includes(l)?l:nr.days,from:c?o:``,to:c?s:``,tz:t.get(`tz`)??``,group:t.get(`group`)??``,trendsTab:a===`trends`?t.get(`tab`)??``:``}}function or(e){if(e.page===`hosts`)return`?page=hosts`;if(e.page===`trends`){let t=new URLSearchParams({page:`trends`});return e.days===0&&e.from&&e.to?(t.set(`from`,e.from),t.set(`to`,e.to)):e.days!==nr.days&&t.set(`days`,String(e.days)),e.tz&&t.set(`tz`,e.tz),e.group&&t.set(`group`,e.group),e.trendsTab&&t.set(`tab`,e.trendsTab),`?${t.toString()}`}let t=new URLSearchParams;e.run&&t.set(`run`,e.run),e.tab!==`overview`&&t.set(`tab`,e.tab),e.tab===`stream`&&(e.key&&t.set(`key`,e.key),e.view!==`transcript`&&t.set(`view`,e.view),e.round!=null&&t.set(`round`,String(e.round))),e.tab===`definitions`&&e.def&&t.set(`def`,e.def),e.tab===`overview`&&e.layer&&t.set(`layer`,e.layer),e.tab===`overview`&&e.unit&&t.set(`unit`,e.unit),e.tab===`overview`&&e.sel&&t.set(`sel`,e.sel);let n=e.tab===`tasks`||e.tab===`journal`;n&&e.kind&&t.set(`kind`,e.kind),e.tab===`journal`&&e.stop&&t.set(`stop`,e.stop),n&&e.q&&t.set(`q`,e.q);let r=t.toString();return r?`?${r}`:``}function sr(e,t){let n={...e,...t};return t.run!==void 0&&t.run!==e.run&&Object.assign(n,{key:null,def:null,round:null,layer:``,unit:``,sel:``,...t}),t.layer!==void 0&&t.layer!==e.layer&&t.sel===void 0&&(n.sel=``),t.key!==void 0&&t.key!==e.key&&(t.view===void 0&&(n.view=`transcript`),t.round===void 0&&(n.round=null)),n}function cr(e,t){let n=e=>or({...e,kind:``,stop:``,q:``,unit:``,sel:``});return n(e)!==n(t)}var lr=class{constructor(e,t,n,r=()=>{}){this.mode=e,this.onChange=t,this.onLeave=r,this.onPop=()=>{this.current=ar(location.search),this.onChange(this.current,`pop`)};let i=ar(e===`url`?location.search:``);this.current=sr(i,n??{})}get viewRoute(){return this.current}start(){this.mode===`url`&&(history.scrollRestoration=`manual`,addEventListener(`popstate`,this.onPop)),this.onChange(this.current,`init`)}stop(){this.mode===`url`&&removeEventListener(`popstate`,this.onPop)}navigate(e,t={}){let n=sr(this.current,e);if(or(n)===or(this.current))return;let r=!t.replace&&cr(this.current,n);if(this.current=n,this.mode===`url`){let e=`${location.pathname}${or(n)}${location.hash}`;r?(this.onLeave(),history.pushState({},``,e)):history.replaceState(history.state,``,e)}this.onChange(n,r?`push`:`replace`)}},ur=class{constructor(e,t){this.host=e,this.opts=t,this.ready=Promise.resolve(),e.addController(this)}hostConnected(){let e=this.opts.locale();this.ready=An(Mn(e)?e:Nn()).catch(()=>{})}hostUpdated(){let e=this.opts.locale();e!==this.seen&&(this.seen=e,Mn(e)&&e!==I()&&An(e)),this.opts.pageWide()&&(document.documentElement.lang=I()),this.host.lang=I()}},dr=class{constructor(e,t,n){this.host=e,this.onKey=t,this.scope=n,this.bound=null,this.boundScope=`off`,this.listener=e=>{let t=e;t.defaultPrevented||function(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&(t.isContentEditable||t.matches(`input, select, textarea, [contenteditable]:not([contenteditable="false"])`))}(t)||t.metaKey||t.ctrlKey||t.altKey||this.onKey(t)},e.addController(this)}hostConnected(){this.bind()}hostUpdated(){this.scope()!==this.boundScope&&this.bind()}hostDisconnected(){this.unbind()}bind(){this.unbind();let e=this.scope();this.boundScope=e,this.bound=e===`page`?document:e===`element`?this.host:null,this.bound?.addEventListener(`keydown`,this.listener)}unbind(){this.bound?.removeEventListener(`keydown`,this.listener),this.bound=null,this.boundScope=`off`}},fr=[{name:`backdrop`,prop:`--ca-backdrop`},{name:`bg`,prop:`--ca-bg`},{name:`card`,prop:`--ca-card`},{name:`panel`,prop:`--ca-panel`},{name:`panel2`,prop:`--ca-panel2`},{name:`raise`,prop:`--ca-raise`},{name:`well`,prop:`--ca-well`},{name:`track`,prop:`--ca-track`},{name:`line`,prop:`--ca-line`},{name:`line2`,prop:`--ca-line2`},{name:`shadow`,prop:`--ca-shadow`},{name:`text`,prop:`--ca-text`},{name:`text-2`,prop:`--ca-text-secondary`},{name:`text-muted`,prop:`--ca-text-muted`},{name:`accent`,prop:`--ca-accent`},{name:`accent-bg`,prop:`--ca-accent-bg`,derive:`color-mix(in srgb, var(--accent) calc(var(--tint) + 1%), transparent)`},{name:`focus`,prop:`--ca-focus`},{name:`focus-width`,prop:`--ca-focus-width`},{name:`selection`,prop:`--ca-selection`},{name:`status-failed`,prop:`--ca-status-failed`},{name:`status-failed-bg`,prop:`--ca-status-failed-bg`,derive:`color-mix(in srgb, var(--status-failed) var(--tint), transparent)`},{name:`status-attention`,prop:`--ca-status-attention`},{name:`status-attention-bg`,prop:`--ca-status-attention-bg`,derive:`color-mix(in srgb, var(--status-attention) var(--tint), transparent)`},{name:`status-done`,prop:`--ca-status-done`},{name:`status-done-bg`,prop:`--ca-status-done-bg`,derive:`color-mix(in srgb, var(--status-done) var(--tint), transparent)`},{name:`status-running`,prop:`--ca-status-running`},{name:`status-running-bg`,prop:`--ca-status-running-bg`,derive:`color-mix(in srgb, var(--status-running) var(--tint), transparent)`},{name:`status-muted`,prop:`--ca-status-muted`},{name:`status-muted-bg`,prop:`--ca-status-muted-bg`,derive:`color-mix(in srgb, var(--status-muted) calc(var(--tint) - 1%), transparent)`},{name:`tint`,prop:`--ca-tint`},{name:`agent`,prop:`--ca-agent`},{name:`agent-bg`,prop:`--ca-agent-bg`,derive:`color-mix(in srgb, var(--agent) calc(var(--tint) + 2%), transparent)`},{name:`meter`,prop:`--ca-meter`},{name:`tok-input`,prop:`--ca-tok-input`},{name:`tok-cache-read`,prop:`--ca-tok-cache-read`},{name:`tok-cache-write`,prop:`--ca-tok-cache-write`},{name:`tok-output`,prop:`--ca-tok-output`},{name:`series-1`,prop:`--ca-series-1`},{name:`series-2`,prop:`--ca-series-2`},{name:`series-3`,prop:`--ca-series-3`},{name:`series-4`,prop:`--ca-series-4`},{name:`series-5`,prop:`--ca-series-5`},{name:`series-6`,prop:`--ca-series-6`},{name:`code-keyword`,prop:`--ca-code-keyword`},{name:`code-string`,prop:`--ca-code-string`},{name:`code-number`,prop:`--ca-code-number`},{name:`code-constant`,prop:`--ca-code-constant`},{name:`code-comment`,prop:`--ca-code-comment`},{name:`code-function`,prop:`--ca-code-function`},{name:`code-type`,prop:`--ca-code-type`},{name:`code-name`,prop:`--ca-code-name`},{name:`font-size-xs`,prop:`--ca-font-size-xs`,derive:`10px`},{name:`font-size-sm`,prop:`--ca-font-size-sm`,derive:`11px`},{name:`font-size-md`,prop:`--ca-font-size-md`,derive:`12px`},{name:`font-size-lg`,prop:`--ca-font-size-lg`,derive:`13px`},{name:`font-size-xl`,prop:`--ca-font-size-xl`,derive:`15px`},{name:`font-size-2xl`,prop:`--ca-font-size-2xl`,derive:`28px`},{name:`radius-sm`,prop:`--ca-radius-sm`,derive:`4px`},{name:`radius-md`,prop:`--ca-radius-md`,derive:`8px`},{name:`radius-lg`,prop:`--ca-radius-lg`,derive:`12px`},{name:`radius-pill`,prop:`--ca-radius-pill`,derive:`999px`}],pr=[`contraagent-dark`,`contraagent-light`,`github-dark`,`github-light`,`one-dark`,`nord`,`high-contrast`],mr=[`contraagent-dark`,`contraagent-light`,`system`,`github-dark`,`github-light`,`one-dark`,`nord`,`high-contrast`],hr=[`github-dark`,`github-light`,`one-dark`,`nord`,`high-contrast`],gr=`contraagent-dark`,_r={"contraagent-dark":{label:`contraagent Dark`,scheme:`dark`,tokens:{backdrop:`radial-gradient(1100px 520px at 8% -12%, #10203a 0%, transparent 62%), radial-gradient(900px 480px at 108% 4%, #1b1238 0%, transparent 58%), #060a11`,bg:`#060a11`,card:`#0f1724`,panel:`#0f1724`,panel2:`#142034`,raise:`#1a2740`,well:`#0a111c`,track:`#1b273b`,line:`#1d2940`,line2:`#2b3c58`,shadow:`#060a11`,text:`#e7edf5`,"text-2":`#bcc7d6`,"text-muted":`#909db2`,accent:`#7aa2ff`,focus:`#7aa2ff`,"focus-width":`2px`,selection:`#7aa2ff4d`,"status-failed":`#f87171`,"status-attention":`#fbbf24`,"status-done":`#34d399`,"status-running":`#22d3ee`,"status-muted":`#94a3b8`,tint:`13%`,agent:`#b597fb`,meter:`#7d8ba3`,"tok-input":`#7c86f5`,"tok-cache-read":`#3f4d63`,"tok-cache-write":`#8796ad`,"tok-output":`#d6b8ff`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#c4a5ff`,"code-string":`#7ee2a8`,"code-number":`#f5c26b`,"code-constant":`#ff9e64`,"code-comment":`#74839a`,"code-function":`#7dd3fc`,"code-type":`#ffd479`,"code-name":`#79b8ff`}},"contraagent-light":{label:`contraagent Light`,scheme:`light`,tokens:{backdrop:`radial-gradient(1100px 520px at 8% -12%, #dde7fb 0%, transparent 62%), radial-gradient(900px 480px at 108% 4%, #ebe3fa 0%, transparent 58%), #eef2f8`,bg:`#eef2f8`,card:`#ffffff`,panel:`#ffffff`,panel2:`#f7f9fc`,raise:`#e6ecf5`,well:`#f3f6fa`,track:`#e1e7f0`,line:`#d6dde8`,line2:`#b6c2d3`,shadow:`#0f172438`,text:`#0f1724`,"text-2":`#34415a`,"text-muted":`#556279`,accent:`#2f58d4`,focus:`#2f58d4`,"focus-width":`2px`,selection:`#2f58d42e`,"status-failed":`#b8132d`,"status-attention":`#6c4801`,"status-done":`#026b49`,"status-running":`#01525f`,"status-muted":`#56637a`,tint:`11%`,agent:`#6f45c0`,meter:`#8a97ab`,"tok-input":`#4d4cc8`,"tok-cache-read":`#cdd6e3`,"tok-cache-write":`#7d8aa0`,"tok-output":`#a07ad9`,"series-1":`#2a78d6`,"series-2":`#eb6834`,"series-3":`#1baf7a`,"series-4":`#eda100`,"series-5":`#e87ba4`,"series-6":`#008300`,"code-keyword":`#6f49a8`,"code-string":`#076b40`,"code-number":`#7b5605`,"code-constant":`#964605`,"code-comment":`#5d6b80`,"code-function":`#086586`,"code-type":`#785902`,"code-name":`#095ea8`}},"github-dark":{label:`GitHub Dark`,scheme:`dark`,tokens:{backdrop:`#010409`,bg:`#010409`,card:`#0d1117`,panel:`#0d1117`,panel2:`#151b23`,raise:`#212830`,well:`#010409`,track:`#262c36`,line:`#262c36`,line2:`#3d444d`,shadow:`#010409`,text:`#f0f6fc`,"text-2":`#d1d7e0`,"text-muted":`#9299a2`,accent:`#4796fb`,focus:`#1f6feb`,"focus-width":`2px`,selection:`#388bfd4d`,"status-failed":`#fc554d`,"status-attention":`#d29922`,"status-done":`#3fb950`,"status-running":`#39c5cf`,"status-muted":`#9198a1`,tint:`15%`,agent:`#ab7df8`,meter:`#656c76`,"tok-input":`#58a6ff`,"tok-cache-read":`#2f3742`,"tok-cache-write":`#656c76`,"tok-output":`#d2a8ff`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#ff7b72`,"code-string":`#a5d6ff`,"code-number":`#79c0ff`,"code-constant":`#79c0ff`,"code-comment":`#9198a1`,"code-function":`#d2a8ff`,"code-type":`#ffa657`,"code-name":`#7ee787`}},"github-light":{label:`GitHub Light`,scheme:`light`,tokens:{backdrop:`#f6f8fa`,bg:`#f6f8fa`,card:`#ffffff`,panel:`#ffffff`,panel2:`#ffffff`,raise:`#eff2f5`,well:`#f6f8fa`,track:`#e6eaef`,line:`#d1d9e0`,line2:`#b7c0ca`,shadow:`#1f232833`,text:`#1f2328`,"text-2":`#393f46`,"text-muted":`#59636e`,accent:`#0165d6`,focus:`#0165d6`,"focus-width":`2px`,selection:`#0969da33`,"status-failed":`#cd1e2b`,"status-attention":`#916103`,"status-done":`#147b33`,"status-running":`#10767d`,"status-muted":`#59636e`,tint:`8%`,agent:`#804ddc`,meter:`#818b98`,"tok-input":`#54aeff`,"tok-cache-read":`#d1d9e0`,"tok-cache-write":`#818b98`,"tok-output":`#a475f9`,"series-1":`#2a78d6`,"series-2":`#eb6834`,"series-3":`#1baf7a`,"series-4":`#eda100`,"series-5":`#e87ba4`,"series-6":`#008300`,"code-keyword":`#cf222e`,"code-string":`#0a3069`,"code-number":`#0550ae`,"code-constant":`#0550ae`,"code-comment":`#59636e`,"code-function":`#6639ba`,"code-type":`#953800`,"code-name":`#116329`}},"one-dark":{label:`One Dark`,scheme:`dark`,tokens:{backdrop:`#21252b`,bg:`#21252b`,card:`#282c34`,panel:`#282c34`,panel2:`#2c313a`,raise:`#2c313a`,well:`#21252b`,track:`#3a3f4b`,line:`#181a1f`,line2:`#4b5263`,shadow:`#0e1013`,text:`#d7dae0`,"text-2":`#abb2bf`,"text-muted":`#a7afbe`,accent:`#64b2f2`,focus:`#528bff`,"focus-width":`2px`,selection:`#3e4451`,"status-failed":`#fc858d`,"status-attention":`#e5c07b`,"status-done":`#98c379`,"status-running":`#57b7c3`,"status-muted":`#a7afbe`,tint:`12%`,agent:`#d788ee`,meter:`#5c6370`,"tok-input":`#61afef`,"tok-cache-read":`#3e4451`,"tok-cache-write":`#5c6370`,"tok-output":`#c678dd`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#c678dd`,"code-string":`#98c379`,"code-number":`#d19a66`,"code-constant":`#d19a66`,"code-comment":`#8f949e`,"code-function":`#61afef`,"code-type":`#e5c07b`,"code-name":`#e36e77`}},nord:{label:`Nord`,scheme:`dark`,tokens:{backdrop:`#2e3440`,bg:`#242933`,card:`#2e3440`,panel:`#2e3440`,panel2:`#323946`,raise:`#3b4252`,well:`#272c36`,track:`#3b4252`,line:`#3b4252`,line2:`#4c566a`,shadow:`#1d2129`,text:`#eceff4`,"text-2":`#d8dee9`,"text-muted":`#adbcd9`,accent:`#9dbedf`,focus:`#88c0d0`,"focus-width":`2px`,selection:`#4c566a`,"status-failed":`#fe9aa1`,"status-attention":`#ebcb8b`,"status-done":`#a5c18e`,"status-running":`#89c1d1`,"status-muted":`#adbcd9`,tint:`13%`,agent:`#d0a9c9`,meter:`#7b88a1`,"tok-input":`#5e81ac`,"tok-cache-read":`#4c566a`,"tok-cache-write":`#7b88a1`,"tok-output":`#b48ead`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#81a1c1`,"code-string":`#a3be8c`,"code-number":`#b790b0`,"code-constant":`#d38972`,"code-comment":`#8f9db8`,"code-function":`#88c0d0`,"code-type":`#8fbcbb`,"code-name":`#8fbcbb`}},"high-contrast":{label:`High contrast`,scheme:`dark`,tokens:{backdrop:`#010409`,bg:`#010409`,card:`#0a0c10`,panel:`#0a0c10`,panel2:`#0a0c10`,raise:`#1c2128`,well:`#010409`,track:`#272b33`,line:`#7a828e`,line2:`#9ea7b3`,shadow:`#000000`,text:`#ffffff`,"text-2":`#f0f3f6`,"text-muted":`#bdc4cc`,accent:`#7abbfe`,focus:`#7abbfe`,"focus-width":`3px`,selection:`#409eff66`,"status-failed":`#ffacb8`,"status-attention":`#fad209`,"status-done":`#0ef38e`,"status-running":`#62ceff`,"status-muted":`#bdc4cc`,tint:`12%`,agent:`#c299fe`,meter:`#9ea7b3`,"tok-input":`#409eff`,"tok-cache-read":`#525964`,"tok-cache-write":`#9ea7b3`,"tok-output":`#dbb7ff`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#ff9492`,"code-string":`#addcff`,"code-number":`#91cbff`,"code-constant":`#91cbff`,"code-comment":`#bdc4cc`,"code-function":`#dbb7ff`,"code-type":`#ffb757`,"code-name":`#72f088`}}},vr=Object.fromEntries(fr.map(e=>[e.name,e.prop])),yr=e=>`:where([data-ca-theme="${e}"])`;function br(e=yr){return pr.map(t=>{let n=_r[t],r=Object.entries(n.tokens).map(([e,t])=>`${vr[e]}: ${t};`);return`${e(t)} { color-scheme: ${n.scheme}; --ca-color-scheme: ${n.scheme}; ${r.join(` `)} }`}).join(`
|
|
6
|
-
`)}var
|
|
7
|
-
`))} --sans:var(--ca-sans,system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif);--mono:var(--ca-mono,ui-monospace,SFMono-Regular,Menlo,Consolas,'Liberation Mono',monospace);--ease:cubic-bezier(0.2,0.8,0.2,1);color-scheme:var(--ca-color-scheme,${
|
|
8
|
-
${e.map(e=>
|
|
9
|
-
</div>`}var ai=
|
|
10
|
-
${
|
|
11
|
-
</div>`}};
|
|
3
|
+
`)}`}trendPanelNames(){return this.snap.info.panels.filter(e=>e.scope===`trends`).map(e=>e.name)}async loadTrends(e){let t=this.snap.trends&&JSON.stringify(this.snap.trends.query)===JSON.stringify(e);this.trendsQuery=e,this.set({trends:{query:e,data:t?this.snap.trends.data:this.snap.trends?.data??null,panels:t?this.snap.trends.panels:{},loading:!0,error:null}}),await this.fetchTrends(e)}closeTrends(){this.trendsQuery=null}async fetchTrends(e){let t=++this.trendsAsked;this.trendsOver=this.trendsKey();let n=()=>t!==this.trendsAsked||this.stopped?null:this.snap.trends,r=this.trendPanelNames(),i=this.client.trends(e).then(t=>{let r=n();r&&this.set({trends:{...r,query:e,data:t,loading:!1,error:null}})},t=>{let r=n();r&&this.set({trends:{...r,query:e,loading:!1,error:he(t,`${this.client.baseUrl}/api/trends`)}})}),a=(e,t)=>{let r=n();r&&this.set({trends:{...r,panels:{...r.panels,[e]:t}}})},o=r.map(t=>this.client.trendsPanel(t,e).then(e=>a(t,e),e=>a(t,{error:String(e)})));await Promise.allSettled([i,...o])}async loadInfo(){try{let e=this.panelNames(),t=await this.client.info();if(this.stopped)return;this.infoLoaded=!0,this.infoError=null,this.set({info:t}),this.snap.run&&this.panelNames()!==e&&this.reopen()}catch(e){this.infoError=he(e,`${this.client.baseUrl}/api/info`)}}async refreshRuns(){let[e,t]=await Promise.allSettled([this.client.runs(),this.snap.info.hosts?this.client.hosts():Promise.resolve(null)]);if(this.stopped)return;let n={};e.status===`fulfilled`?(n.runs=e.value,n.runsLoaded=!0,this.runsError=null):this.runsError=he(e.reason,`${this.client.baseUrl}/api/runs`),t.status===`fulfilled`?(n.hosts=t.value,this.hostsError=null):this.hostsError=he(t.reason,`${this.client.baseUrl}/api/hosts`);let r=this.infoError??this.runsError??this.hostsError;r?.message!==this.snap.error?.message&&(n.error=r),Object.keys(n).length&&this.set(n)}panelNames(){return this.snap.info.panels.filter(pe).map(e=>e.name).join(`
|
|
4
|
+
`)}reopen(){let e=this.snap.run;this.closeFeed?.(),this.closeFeed=null,this.selectRun(e)}selectRun(e){if(e===this.snap.run&&(this.closeFeed||!e)||(this.closeFeed?.(),this.closeFeed=null,this.queue=[],this.replayDrawn=!1,this.set({run:e,state:{journal:[],procs:null,plan:{nodes:[],groups:[],flow_calls:[]},outputs:{contracts:[],tally:{valid:0,invalid:0,refused:0,pending:0,failed:0,running:0}},forecast:null,cursor:null,panels:{},ready:!1},connected:!1,fresh:new Set}),!e))return;let t=this.snap.info.panels.filter(pe).map(e=>e.name),n={open:()=>{this.push({event:`connected`}),this.set({connected:!0})},error:()=>this.set({connected:!1}),message:e=>this.push(e)};this.closeFeed=this.opts.openRunFeed?this.opts.openRunFeed(e,t,n):function(e,t,n,r={}){let i=[...o,...t.map(e=>`panel:${e}`)];return s(`${l(r)}/events?run=${c(e)}`,i,n,r)}(e,t,n,{...this.opts.baseUrl===void 0?{}:{baseUrl:this.opts.baseUrl},...this.opts.feed})}stop(){this.stopped=!0,this.closeFeed?.(),this.closeFeed=null,this.pollTimer&&clearTimeout(this.pollTimer),this.pollTimer=null,this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=null}push(e){this.queue.length||(this.replaying=!this.snap.state.ready),this.queue.push(e),e.event===`connected`?(this.replaying=!0,this.replayDrawn=!1):e.event===`ready`&&(this.replaying=!1);let t=this.replaying&&this.replayDrawn?5*this.opts.batchMs:this.opts.batchMs,n=Date.now()+t;this.flushTimer&&n>=this.flushAt||(this.flushTimer&&clearTimeout(this.flushTimer),this.flushAt=n,this.flushTimer=setTimeout(()=>this.flush(),t))}flush(){this.flushTimer=null;let e=this.queue;this.queue=[],this.replaying&&(this.replayDrawn=!0);let t=this.snap.state.ready,n=[];for(let r of e)r.event===`connected`?t=!1:r.event===`ready`?t=!0:r.event===`journal`&&t&&n.push(r.data);let r=function(e,t){let n=e,r=null,i=()=>{if(!r)return;let e=n.journal.concat(r);n={...n,journal:e.length>4e3?e.slice(e.length-4e3):e},r=null};for(let e of t)if(e.event!==`journal`)switch(i(),e.event){case`connected`:n={...n,journal:[],ready:!1};break;case`ready`:n={...n,ready:!0};break;case`procs`:n={...n,procs:e.data};break;case`plan`:n={...n,plan:e.data};break;case`outputs`:n={...n,outputs:e.data};break;case`forecast`:n={...n,forecast:e.data};break;case`cursor`:n={...n,cursor:e.data};break;default:n={...n,panels:{...n.panels,[e.event.slice(6)]:e.data}}}else(r??=[]).push(e.data);return i(),n}(this.snap.state,e);if(!n.length)return void this.set({state:r});let i=new Set(this.snap.fresh);for(let e of n)i.add(se(e));this.set({state:r,fresh:i});for(let e of n)for(let t of this.rowListeners)t(e);this.expiries.push({at:Date.now()+this.opts.freshMs,rows:n}),this.freshTimer||this.expireLater()}expireLater(){let e=this.expiries[0];e&&(this.freshTimer=setTimeout(()=>{this.freshTimer=null;let e=this.expiries.shift();if(e){let t=new Set(this.snap.fresh);for(let n of e.rows)t.delete(se(n));this.set({fresh:t})}this.expireLater()},Math.max(0,e.at-Date.now())))}set(e){this.snap={...this.snap,...e};for(let e of this.listeners)e(this.snap)}},_e=encodeURIComponent;function ve(e){let t=Array.from(e,e=>/^[\p{L}\p{N}._-]$/u.test(e)?e:`_`).join(``).replace(/\.\.+/g,e=>`_`.repeat(e.length));return t.startsWith(`.`)?`_${t.slice(1)}`:t||`_`}var ye=e=>Object.keys(e).length>0;function be(e){return(t,n,r)=>{let i=!1;return(async()=>{try{let[a,o,s,c,l,u]=await Promise.all([e.journal(t),e.file(`runs/${_e(t)}/plan.json`),e.file(`runs/${_e(t)}/outputs.json`),e.file(`runs/${_e(t)}/forecast.json`).catch(()=>null),e.file(`runs/${_e(t)}/cursor.json`),Promise.all(n.map(n=>e.panel(t,n).catch(e=>({error:String(e)}))))]);if(i)return;r.open?.();let d=e=>!i&&r.message(e);for(let e of a.entries)d({event:`journal`,data:e});d({event:`plan`,data:o}),d({event:`outputs`,data:s}),c&&d({event:`forecast`,data:c}),d({event:`cursor`,data:ye(l)?l:null}),n.forEach((e,t)=>d({event:`panel:${e}`,data:u[t]??{}})),d({event:`ready`,data:{journal:a.total}})}catch{i||r.error?.()}})(),()=>{i=!0}}}var xe=()=>({input:0,output:0,cache_read:0,cache_creation:0,calls:0,cost:null,reported:0}),Se=e=>e.input+e.output+e.cache_read+e.cache_creation;function Ce(e,t){let n=t.usage;return n||t.cost_usd!==null&&t.cost_usd!==void 0?(n&&(e.input+=n.input??0,e.output+=n.output??0,e.cache_read+=n.cache_read??0,e.cache_creation+=n.cache_creation??0,e.calls+=n.calls??0),t.cost_usd!==null&&t.cost_usd!==void 0&&(e.cost=(e.cost??0)+t.cost_usd),e.reported++,e):e}function we(e){let t={input:0,output:0,cache_read:0,cache_creation:0,calls:0,cost:null,reported:0};for(let n of e)Ce(t,n);return t.reported?t:null}function Te(e,t){let n=new Map,r={input:0,output:0,cache_read:0,cache_creation:0,calls:0,cost:null,reported:0};for(let i of e){Ce(r,i);let e=t(i),a=n.get(e);a||n.set(e,a={id:e,kind:i.kind,unit:i.unit??``,spend:xe(),share:null}),Ce(a.spend,i)}let i=[...n.values()].filter(e=>e.spend.reported);for(let e of i)e.share=r.cost?(e.spend.cost??0)/r.cost:null;return i.sort((e,t)=>(t.spend.cost??0)-(e.spend.cost??0)||Se(t.spend)-Se(e.spend))}var Ee=e=>Te(e,e=>e.kind).map(e=>({...e,unit:``})),De=e=>(e.input??0)+(e.output??0)+(e.cache_read??0)+(e.cache_creation??0);function Oe(e,t){switch(t){case`cost`:return e.cost_usd??null;case`tokens`:return De(e);case`time`:return e.wall_s??0;case`sessions`:return e.sessions}}var ke=e=>[`cost`,`tokens`,`time`,`sessions`].filter(t=>e.some(e=>(Oe(e,t)??0)>0)),Ae=e=>Date.parse(e.observed_at??``),je=e=>!Number.isNaN(Ae(e))&&(e.five_hour_pct!=null||e.seven_day_pct!=null);function Me(e){let t=[];for(let n of e)for(let e of n.quota??[])je(e)&&t.push({reading:e,key:n.key,attempt:n.attempt??0});return t.sort((e,t)=>Ae(e.reading)-Ae(t.reading))}var Ne=e=>`${e.credential??``}\0${e.account??``}`;function Pe(e){let t=new Map;for(let{reading:n}of Me(e)){let e=Ne(n),r=t.get(e);r||t.set(e,r=[]),r.push(n)}let n=[];for(let e of t.values()){let t=e[0],r=e[e.length-1];t&&r&&n.push({credential:r.credential??``,account:r.account??``,first:t,last:r})}return n.sort((e,t)=>(t.last.seven_day_pct??0)-(e.last.seven_day_pct??0))}function Fe(e,t){let n=(e.quota??[]).filter(je).sort((e,t)=>Ae(e)-Ae(t)),r=Date.parse(e.ts),i=n[0]??null,a=i===null?``:Ne(i);return{start:i,next:(i===null||Number.isNaN(r)?void 0:t.find(e=>Ae(e.reading)>r&&Ne(e.reading)===a))?.reading??null}}function Ie(e){let t=/^invalid input:\s*(.*)$/s.exec(e||``);if(!t)return[];let n=[];for(let e of(t[1]??``).split(`; `)){let t=/^input from (\S+) is missing: (\S+)/.exec(e);t?n.push({path:t[2]??``,producer:t[1]??``,problem:`missing`}):(t=/^input from (\S+) ended \S+: (\S+)/.exec(e),t?n.push({path:t[2]??``,producer:t[1]??``,problem:`failed`}):(t=/^(\S+?): required input is missing/.exec(e),t?n.push({path:t[1]??``,producer:``,problem:`missing`}):(t=/^(\S+?): /.exec(e),t&&!n.some(e=>e.path===t?.[1])&&n.push({path:t[1]??``,producer:``,problem:`checks`}))))}return n}function E(e,t){if(!e||!t)return e??``;let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`(?:/[^\\s:'"]*)?/${n}/`,`g`),``)}var Le=`lit-localize-status`,D=(e,...t)=>({strTag:!0,strings:e,values:t}),Re=(e,t,n)=>{let r=e[0];for(let i=1;i<e.length;i++)r+=t[n?n[i-1]:i-1],r+=e[i];return r},ze=e=>{return typeof(t=e)!=`string`&&`strTag`in t?Re(e.strings,e.values):e;var t},O=ze,Be=!1,Ve=class{constructor(e){this.__litLocalizeEventHandler=e=>{e.detail.status===`ready`&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(Le,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Le,this.__litLocalizeEventHandler)}},He=e=>e.addController(new Ve(e)),k=()=>(e,t)=>(e.addInitializer(He),e),Ue=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}},We=[];for(let e=0;e<256;e++)We[e]=(e>>4&15).toString(16)+(15&e).toString(16);var Ge=new WeakMap,Ke=new Map;function qe(e){window.dispatchEvent(new CustomEvent(Le,{detail:e}))}var Je,Ye,Xe,Ze,Qe,$e=``,et=new Ue;et.resolve();var tt=0,nt=e=>(function(){if(Be)throw Error(`lit-localize can only be configured once`);O=(e,t)=>function(e,t,n){if(e){let r=e[n?.id??function(e){let t=typeof e==`string`?e:e.strings,n=Ke.get(t);return n===void 0&&(n=function(e,t){return(t?`h`:`s`)+function(e){let t=0,n=8997,r=0,i=33826,a=0,o=40164,s=0,c=52210;for(let l=0;l<e.length;l++)n^=e.charCodeAt(l),t=435*n,r=435*i,a=435*o,s=435*c,a+=n<<8,s+=i<<8,r+=t>>>16,n=65535&t,a+=r>>>16,i=65535&r,c=s+(a>>>16)&65535,o=65535&a;return We[c>>8]+We[255&c]+We[o>>8]+We[255&o]+We[i>>8]+We[255&i]+We[n>>8]+We[255&n]}(typeof e==`string`?e:e.join(``))}(t,typeof e!=`string`&&!(`strTag`in e)),Ke.set(t,n)),n}(t)];if(r){if(typeof r==`string`)return r;if(`strTag`in r)return Re(r.strings,t.values,r.values);{let e=Ge.get(r);return e===void 0&&(e=r.values,Ge.set(r,e)),{...r,values:e.map(e=>t.values[e])}}}}return ze(t)}(Qe,e,t),Be=!0}(),$e=Ye=e.sourceLocale,(Xe=new Set(e.targetLocales)).add(e.sourceLocale),Ze=e.loadLocale,{getLocale:rt,setLocale:it}),rt=()=>$e,it=e=>{if(e===(Je??$e))return et.promise;if(!Xe||!Ze)throw Error(`Internal error`);if(!Xe.has(e))throw Error(`Invalid locale code`);let t=++tt;return Je=e,et.settled&&(et=new Ue),qe({status:`loading`,loadingLocale:e}),(e===Ye?Promise.resolve({templates:void 0}):Ze(e)).then(n=>{tt===t&&($e=e,Je=void 0,Qe=n.templates,qe({status:`ready`,readyLocale:e}),et.resolve())},n=>{tt===t&&(qe({status:`error`,errorLocale:e,errorMessage:n.toString()}),et.reject(n))}),et.promise},at=globalThis,ot=at.ShadowRoot&&(at.ShadyCSS===void 0||at.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,st=Symbol(),ct=new WeakMap,lt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==st)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ot&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ct.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ct.set(t,e))}return e}toString(){return this.cssText}},ut=e=>new lt(typeof e==`string`?e:e+``,void 0,st),A=(e,...t)=>new lt(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,st),dt=(e,t)=>{if(ot)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=at.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},ft=ot?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ut(t)})(e):e,{is:pt,defineProperty:mt,getOwnPropertyDescriptor:ht,getOwnPropertyNames:gt,getOwnPropertySymbols:_t,getPrototypeOf:vt}=Object,yt=globalThis,bt=yt.trustedTypes,xt=bt?bt.emptyScript:``,St=yt.reactiveElementPolyfillSupport,Ct=(e,t)=>e,wt={toAttribute(e,t){switch(t){case Boolean:e=e?xt:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Tt=(e,t)=>!pt(e,t),Et={attribute:!0,type:String,converter:wt,reflect:!1,useDefault:!1,hasChanged:Tt};Symbol.metadata??=Symbol(`metadata`),yt.litPropertyMetadata??=new WeakMap;var Dt=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Et){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&mt(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=ht(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Et}static _$Ei(){if(this.hasOwnProperty(Ct(`elementProperties`)))return;let e=vt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ct(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ct(`properties`))){let e=this.properties,t=[...gt(e),..._t(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(ft(e))}else e!==void 0&&t.push(ft(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return dt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?wt:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?wt:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??Tt)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};Dt.elementStyles=[],Dt.shadowRootOptions={mode:`open`},Dt[Ct(`elementProperties`)]=new Map,Dt[Ct(`finalized`)]=new Map,St?.({ReactiveElement:Dt}),(yt.reactiveElementVersions??=[]).push(`2.1.2`);var Ot=globalThis,kt=e=>e,At=Ot.trustedTypes,jt=At?At.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,Mt=`$lit$`,Nt=`lit$${Math.random().toFixed(9).slice(2)}$`,Pt=`?`+Nt,Ft=`<${Pt}>`,It=document,Lt=()=>It.createComment(``),Rt=e=>e===null||typeof e!=`object`&&typeof e!=`function`,zt=Array.isArray,Bt=e=>zt(e)||typeof e?.[Symbol.iterator]==`function`,Vt=`[
|
|
5
|
+
\f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ut=/-->/g,Wt=/>/g,Gt=RegExp(`>|${Vt}(?:([^\\s"'>=/]+)(${Vt}*=${Vt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),Kt=/'/g,qt=/"/g,Jt=/^(?:script|style|textarea|title)$/i,Yt=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),j=Yt(1),M=Yt(2),Xt=Symbol.for(`lit-noChange`),N=Symbol.for(`lit-nothing`),Zt=new WeakMap,Qt=It.createTreeWalker(It,129);function $t(e,t){if(!zt(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return jt===void 0?t:jt.createHTML(t)}var en=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=Ht;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===Ht?c[1]===`!--`?o=Ut:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=Gt):(Jt.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=Gt):o=Wt:o===Gt?c[0]===`>`?(o=i??Ht,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?Gt:c[3]===`"`?qt:Kt):o===qt||o===Kt?o=Gt:o===Ut||o===Wt?o=Ht:(o=Gt,i=void 0);let d=o===Gt&&e[t+1].startsWith(`/>`)?` `:``;a+=o===Ht?n+Ft:l>=0?(r.push(s),n.slice(0,l)+Mt+n.slice(l)+Nt+d):n+Nt+(l===-2?t:d)}return[$t(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},tn=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=en(t,n);if(this.el=e.createElement(l,r),Qt.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=Qt.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Mt)){let t=u[o++],n=i.getAttribute(e).split(Nt),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?sn:r[1]===`?`?cn:r[1]===`@`?ln:on}),i.removeAttribute(e)}else e.startsWith(Nt)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Jt.test(i.tagName)){let e=i.textContent.split(Nt),t=e.length-1;if(t>0){i.textContent=At?At.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],Lt()),Qt.nextNode(),c.push({type:2,index:++a});i.append(e[t],Lt())}}}else if(i.nodeType===8){if(i.data===Pt)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(Nt,e+1))!==-1;)c.push({type:7,index:a}),e+=Nt.length-1}}a++}}static createElement(e,t){let n=It.createElement(`template`);return n.innerHTML=e,n}};function nn(e,t,n=e,r){if(t===Xt)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=Rt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=nn(e,i._$AS(e,t.values),i,r)),t}var rn=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??It).importNode(t,!0);Qt.currentNode=r;let i=Qt.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new an(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new un(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=Qt.nextNode(),a++)}return Qt.currentNode=It,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},an=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=nn(this,e,t),Rt(e)?e===N||e==null||e===``?(this._$AH!==N&&this._$AR(),this._$AH=N):e!==this._$AH&&e!==Xt&&this._(e):e._$litType$===void 0?e.nodeType===void 0?Bt(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==N&&Rt(this._$AH)?this._$AA.nextSibling.data=e:this.T(It.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=tn.createElement($t(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new rn(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Zt.get(e.strings);return t===void 0&&Zt.set(e.strings,t=new tn(e)),t}k(t){zt(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(Lt()),this.O(Lt()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=kt(e).nextSibling;kt(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},on=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=N,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=N}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=nn(this,e,t,0),a=!Rt(e)||e!==this._$AH&&e!==Xt,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=nn(this,r[n+o],t,o),s===Xt&&(s=this._$AH[o]),a||=!Rt(s)||s!==this._$AH[o],s===N?e=N:e!==N&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},sn=class extends on{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===N?void 0:e}},cn=class extends on{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==N)}},ln=class extends on{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=nn(this,e,t,0)??N)===Xt)return;let n=this._$AH,r=e===N&&n!==N||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==N&&(n===N||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},un=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){nn(this,e)}},dn={M:Mt,P:Nt,A:Pt,C:1,L:en,R:rn,D:Bt,V:nn,I:an,H:on,N:cn,U:ln,B:sn,F:un},fn=Ot.litHtmlPolyfillSupport;fn?.(tn,an),(Ot.litHtmlVersions??=[]).push(`3.3.3`);var pn=globalThis,P=class extends Dt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new an(t.insertBefore(Lt(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Xt}};P._$litElement$=!0,P.finalized=!0,pn.litElementHydrateSupport?.({LitElement:P});var mn=pn.litElementPolyfillSupport;mn?.({LitElement:P}),(pn.litElementVersions??=[]).push(`4.2.2`);var F=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},hn={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:Tt},gn=(e=hn,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function I(e){return(t,n)=>typeof n==`object`?gn(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function L(e){return I({...e,state:!0,attribute:!1})}var _n=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function vn(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return _n(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return _n(n,r,{get(){return a(this)}})}}var yn,bn=t({templates:()=>xn}),xn=function(e){let t=new Map;return new Proxy(e,{get(e,n){if(typeof n==`string`){if(!t.has(n)){let r;for(let t=1;t<=n.length&&r===void 0;t++){let i=n.slice(0,t);Object.hasOwn(e,i)&&(r=e[i])}t.set(n,r)}return t.get(n)}}})}({c:`実行`,d:`出力`,"edge-a":`完了を待つ`,"edge-c":`結果を受けて作成`,"edge-g":`出力を受け取る`,f:`停止`,h0:j`JSON Lines(1 行ごとに JSON オブジェクト、スキーマ ${0})`,h5:j`${0} の出力`,h6:j`JSON オブジェクト(スキーマ ${0})`,h87:j`依存先タスク ${0}`,h8e:j`この実行には階層 <code>${0}</code> がありません`,ha:j`ファイルなし | Python コードで定義(<code>TaskAdapter</code>)`,hc:j`実行中 ${0}${1}`,hf:j`${0} の出力から`,i:`未確認`,"no-":`実行はまだありません`,non:`なし`,"outcome-c":`取り消し`,"outcome-d":`完了`,"outcome-p":`一部のみ完了`,"part-d":`定義`,"part-i":`入力ファイル`,"part-p":`パラメータ`,s000:`実行履歴の未実行のタスク`,s009:`修正ラウンド 1 回後`,s00c:D`HTTP ステータス ${0}`,s02f7:`実行されず`,s02f9:D`アカウント: ${0}`,s030:D`カスタムビュー ${0} はありません`,s037:`完了`,s0382:D`${0}: ${1}`,s038b:`ページ`,s03b:`タブ`,s03e:`タスク`,s03f:D`古い試行 ${0} 件は非表示`,s041:D`ほか ${0} 件`,s042:`タスクが宣言したパターンの下で、試行が作成・変更・削除したファイル(changes)`,s044:D`一部のみ完了 ${0} 件`,s048:`再開後に再実行`,s04f:`停止した部分`,s051:`実行中のエージェントのセッション`,s055:`選択中の項目`,s05f:`認証エラー`,s062:`トランスクリプト`,s0668:`ユニットごとのステージとステップ(CursorStore)`,s066d:`出力`,s06a:`Esc: 1 つ上の階層`,s06b0:`実行中ではありません`,s06bf:`中を表示`,s077:`テキストフィルター(/)`,s079:D`キャッシュ ${0}`,s07d:`関数`,s07e:D`+${0}`,s087:D`${0}%`,s08b1:D`${0}(認証情報が休止中)`,s08b3:`いいえ`,s08c:`稼働中`,s0932:`出力の検証: OK`,s0935:`終了日`,s094:`最初のエージェントのセッションの前に終了`,s09b:`プロンプトなし`,s0a:D`入力元: ${0}`,s0b0:D`作成元: ${0}`,s0b2:`エージェントのセッション開始時のサブスクリプション利用率(アカウント全体)`,s0b3:`OK`,s0b7:`実行前からあるファイル`,s0bf:D`${0} 周目`,s0c:D`モデル切り替えのあったタスク ${0} 件`,s0d7:D`キャッシュ書き込み ${0}`,s0df:`依存先タスクが登録されなかった`,s0e6:`問題`,s0ea:`プラグインディレクトリ`,s0ef:`すべてのホスト`,s0f0:`一部省略`,s0f1:`リセット済み`,s0f2:D`最初の API 呼び出しの入力: ${0}`,s0f8:D`出力ファイル ${0} 件`,s103:`再開カーソル`,s104:`昇順に並べ替え`,s107:`種別の最初のタスクの開始時に記録(definitions/<kind>.json)`,s108:D`${0} の実装`,s114:D`${0} 型の JSON 値`,s115:`過去 24 時間`,s123:`待機中`,s125:D`要素 ${0} 個`,s12c:`型の不一致`,s13:D`最終報告 ${0}`,s14b:`コーディングエージェントが報告した値`,s14c:D`この失敗で ${0} が ${1} で停止`,s150:`出力`,s156:`なし(任意)`,s158:D`週の利用率 ${0}`,s159:`このタスクが代わりに出力ファイルを書く種別(output_of)`,s163:`検証対象のファイルなし`,s165:D`${0} 回目で完了 | 失敗 1 回`,s168:`検証のタイミング`,s170:D`実行されず ${0} 件`,s172:D`同じフローの実行 ${0} から見込んだ、この実行がまだ作成していないタスク(forecast)`,s17d:`利用率のルール`,s17e:`書き込み待ち(タスクが待機中)`,s18:D`ループ内の ${0}`,s197:`利用できるモデルなし`,s19e:`上限: max_concurrent`,s1a20:D`スキップ ${0} 件`,s1a2c:D`5 時間枠 ${0} → ${1}`,s1a3:`種別 · ユニット`,s1a4:`モデルごとの、エージェントのセッションの使用量。モデル切り替えの前後は別々に集計(Plan.models)`,s1ac:`エディタのテーマ`,s1b2:D`種別 ${0}`,s1bf:`実行中のプロセスなし`,s1c0:`パラメータ`,s1c2:`タスクが選択されていません`,s1c4:D`セッション開始時の利用率(アカウント全体): ${0}`,s1c7:`実行に登録されたすべてのタスク(種別ごと、plan.jsonl)`,s1cc:`実行中の Python タスク`,s1d4:`どのフローも結果を待たず、after= にも渡さず、戻り値にも含めなかったタスク(unawaited)。出力ファイルと変更のために実行された`,s1db:`API エラー`,s1dc:D`試行 ${0} 回`,s1dd:`実行中のタスクなし`,s1e9:D`プロンプト(${0} 文字、ほか ${1} 文字は未保存)`,s1eb:`入力`,s1f:`削除`,s204:`安全分類器による停止`,s20e:D`リセットまで ${0}`,s20f9:`依存先タスクが実行されなかった`,s20fd:`ホストなし`,s217:`あり`,s21a:`発生したらリトライする例外(retry_on)`,s221:`JSON ではありません`,s224:`ツール実行中に中止`,s230:`スキーマにないフィールド`,s234:`終了した試行はまだありません`,s236:`拡大`,s23b:D`${0} 回の試行がすべて失敗: ${1}`,s23f:`定義はまだありません`,s24:D`完了 ${0}`,s25:D`まだ登録されていない種別: ${0}`,s260:`API 呼び出し 1 回`,s26ba:`ユニットなし`,s26bb:`実行した試行の回数(リトライを含む、journal.jsonl)`,s26e:D`API 呼び出し ${0} 回`,s27a:`最後のメッセージから`,s27b:D`ユニット: ${0}`,s27d:`フローの構成`,s28a2:`リプレイ`,s28ad:`曜日と時刻ごと(期間のタイムゾーン)`,s29b5:D`${1} タスク中 ${0} 件`,s29b6:D`最大コンテキスト: ${0}`,s2a:`現在`,s2c0:D`パラメータ ${0}`,s2c8:`リトライ`,s2cd:`モデルの利用可否`,s2dd:`試行の結果(stop)`,s2df0:`割合`,s2df6:`開始時も同じ内容`,s2e3:D`ほかの出力 ${0} 件`,s2e4:`周`,s2f34:D`${0} 周`,s2f3c:`問題なし`,s2f5:`定義なし`,s2fa:D`5 時間枠の利用率 ${0}(リセット ${1})`,s2fe:`ツール`,s313:`終了(未実行のタスク 1 件)`,s31a:D`待たれなかったタスク ${0} 件`,s321:`余分なフィールド`,s326:D`キャッシュ読み込み ${0}`,s32d:`最大コンテキスト`,s33b:`パイプラインの階層`,s33f:D`${0} で停止`,s343:`新しいイベント 1 件を表示`,s34b:`終了`,s34e:`降順に並べ替え`,s351:`終了した試行なし`,s352:`ファイル全体`,s355:`入力ファイルに検証エラー`,s366:`週`,s367:`料金`,s368:`コピー`,s36d:D`この書き出しに含まれないもの: ${0}`,s36e:D`所要時間 ${0}`,s3700:`Web 検索 1 回`,s370b:D`報告時刻 ${0}`,s378:`検証エラーの後に、同じエージェントのセッションで続けるラウンド(rounds)`,s37d:`スキーマ以外の検証(validators)`,s384:D`${0} を展開`,s38500:`各タスクが読み込むファイル(InputContract)`,s38501:D`修正ラウンド ${0}`,s387:D`検索結果 ${0} 件`,s38e65:`修正依頼のプロンプトに含めて送信`,s38e6a:`日ごとの料金`,s390:`JSON オブジェクトではありません`,s39e:`パイプライン`,s3a7:D`上限: ${0}`,s3aa:`出力ファイルなし`,s3b3:`プロセスツリー`,s3b8:`アカウント全体の値 | アカウントごとの最初と最後の値 | エージェントのセッション開始時に取得`,s3b9:D`${0} にモニター API がありません: ${1}`,s3bd:D`task_detail コールバックが失敗: ${0}`,s3c6:`実行した試行の回数`,s3cd:`実行中のエージェントのセッション 1 件`,s3d0:`エージェントのセッション`,s3d1:`概要`,s3d31:`利用できるモデルがなく、設定どおりのモデルで実行する種別(kept)`,s3d38:D`認証情報 ${0}`,s3d99:`検証エラー後の、同じエージェントのセッション`,s3d9b:`テキストファイル`,s3dd:`ネットワークエラーで応答なし`,s3f7:`修正依頼`,s3fd6:`開始`,s3fda:`このタスクの出力が後続タスクのパラメータに含まれる(given_from)`,s3ff:D`認証情報: ${0}`,s407:D`${0}: 入力`,s408:`週の利用率`,s41:`Tab: 次のノード`,s42a:`フィールド`,s42c:`検証`,s438:`ハイライトを解除`,s43a:`入力ファイル`,s43e:`利用不可`,s451:`料金の高いタスク`,s454:D`${0} のループの各周`,s45d:D`${0}(カスタムビュー)`,s46:D`1 周: ${0}`,s473:`キャッシュ読み込み`,s478:`検証対象のファイル(OutputContract、InputContract)`,s479:`締め切り`,s47a:D`このタスクの入力 ${0} 件`,s47b:`Python タスク`,s47c:`未対応のイベント`,s482:D`終了 ${0}`,s484:`テキストなし`,s48e:`所要時間`,s490:`モニターのサーバーに接続済み`,s491:D`${0} のループ`,s49c:D`修正ラウンド ${0} 回`,s4a:D`${0} 日前`,s4c:`あと 1 件の見込み(forecast)`,s4d6:`検索結果 1 件`,s4d8:`モデル切り替え`,s4e7:D`修正依頼 ${0} 回で完了 | 最初の検証エラー: ${1}`,s4ef:`ループ`,s4f0:`スキーマにない`,s4f9:D`ホスト ${0}`,s4fc:`検証エラーを示し、同じエージェントのセッションで出力の修正を求める依頼。ラウンドの途中、または修正ラウンドで(hook_errors, rounds)`,s4fe:`エージェントタスク`,s5013:D`取り消し ${0} 件`,s5018:D`${0}: ${1} → ${2}`,s504:`日付指定`,s5131:`そのモデルで始めたエージェントのセッションの数`,s5138:`入力・出力・キャッシュ読み込み・キャッシュ書き込みの合計`,s514:`実行が終了した`,s521:`1 ユニット`,s522:`安全分類器がエージェントのセッションの一部を止め、セッションはそのまま続いた(safety_stops)`,s525b:`失敗の後の、次のモデルでの新しいエージェントのセッション(Router のホップ)`,s525c:`記録から再生した試行(replayed)`,s529:D`上限 ${0}`,s52cc:D`${0} の締め切りと仕上げの猶予を過ぎた`,s52cf:`カスタムビュー`,s535:`種別`,s53c5:D`${0}: 未実行`,s53c8:`不可`,s53e:`次の周`,s541:`開始できず`,s543:`プロンプト`,s5522:D`フロー呼び出し ${0}`,s552a:D`${0} の失敗により停止`,s555:`プラグインディレクトリ`,s558:`認証情報の不一致`,s5590:`項目`,s559f:`その他のモデル`,s55f:D`${0}(${1})`,s565:`修正ラウンド 1 回`,s566:D`(ほか ${0} 文字は未保存)`,s567:`未実行(依存先タスクが失敗)`,s568:D`後続タスク: ${0}`,s571:D`入力 ${0} がありません(${1} が未実行)`,s574:D`キャッシュ書き込み ${0}`,s585:D`入力 ${0} がありません(${1} が失敗)`,s587:D`${0} 以降報告なし`,s58b:`モデルの置き換え`,s58c:`実行履歴`,s591:`5 時間枠`,s594:D`修正依頼 ${0} 回`,s59e:`上限に接近`,s5a3:`休止中`,s5a7:`ツール`,s5ab:`並び順`,s5b9:`種別ごとのトークンと料金`,s5bd:`フロー呼び出しごとの締め切り(time_box)`,s5c7:`サービスなし`,s5cb:`分岐`,s5cd:D`エージェントのセッション ${0} 回`,s5cf:`値なし`,s5d0:`実行中にこのタスクが占有する名前(claims)`,s5d4:D`${0} 回目で完了 | 失敗 ${1} 回`,s5d5:D`利用率: ${0}`,s5da:`モデル`,s5de:`依存先タスク`,s5e3:`書き込みなし(タスクが未実行)`,s5e6:`テキスト(JSON 文字列)`,s5f2:`ロールなし`,s5f31:`エージェント・モデル・認証情報`,s5f34:`エラー`,s5f40:`行なし`,s5f43:`ソース`,s5f7:`なし(必須)`,s5f8:D`認証情報 ${0} は休止中`,s5ff:`エージェントタスク`,s601:`実行中`,s605:D`未実行の後続タスク ${0} 件`,s6203:`キャッシュ書き込み`,s6204:D`このバージョンの contraagent が読めなかったイベント(unread_events): ${0}`,s629:`任意`,s647:`応答が JSON ではなく HTML`,s649:`後続タスク`,s64a:`前のタスクの出力は同じなのに、フローが別のパラメータを渡した(divergence)。時刻、乱数、外部の状態、フローのコードの変更による`,s64f:`変更禁止の箇所`,s652:D`ロック ${0} 件`,s653:`締め切りを過ぎた`,s65c:`中断`,s6645:`拡大(Ctrl + スクロール)`,s6647:`ファイルなし`,s664b:`ツール呼び出しが戻る前に実行が終了`,s670:D`${0} ユニット`,s673:`停止でエラー`,s680:`タイムライン`,s688:`その他の検証`,s68d:D`仕上げの猶予 ${0}`,s695:`修正依頼 1 回`,s699:D`スキーマ ${0}`,s6a0:`1 ステップ完了`,s6a8:D`入力 ${0} がありません(${1} が未完了)`,s6aa:`未実行(入力ファイルなし)`,s6b0:`ホスト`,s6b8:D`同時実行 ${0}/${1}`,s6b9:`タスクなし`,s6c3:`依存先タスクなし`,s6c7:`実行の開始時刻`,s6c8:D`依存先タスク ${0} が失敗`,s6d7:D`${1} タスク中 ${0} 件完了`,s6db:D`${0} 文字`,s6e4:`未選択`,s6eb:`読み込み中…`,s6f1:`API 呼び出し`,s6f2:`出力ファイル 1 件`,s6f5:D`見込み: あと ${0} タスク`,s6fa:`フロー呼び出しがエラーで終了`,s700:`書き出しに含まれない`,s703:D`${0} まで休止`,s706:`実行グループ`,s70a7:D`タスク終了後の利用率: ${0}`,s70af:`種別`,s71:D`モデル切り替え: ${0}`,s721:`ホストからの報告なし`,s7233:`古い試行 1 件は非表示`,s7239:D`修正依頼のあったタスク ${0} 件`,s72dc:`ユニットごとの周回数`,s72dd:`キャッシュ読み込み`,s734:`スタブエージェント`,s737:`ループの周回数`,s73d:`未実行の後続タスク 1 件`,s755:D`プラグイン ${0}`,s758:`エージェントのセッションなし`,s75e:`実行を検索`,s767:D`${0} モニター`,s76d:`カスタム列(row_extras)`,s76f:`原因`,s771:D`入力 ${0} は失敗したタスク ${1} の出力`,s77e:D`未実行 ${0} 件`,s782:`書き足す対象のファイル`,s786:`トランスクリプト`,s78f:`トークン`,s797:`すべての中を隠す`,s79a:D`未対応のイベント: ${0}`,s79f:D`5 時間枠の利用率 ${0}`,s7a1:`エラーで終了したフロー呼び出し 1 件`,s7a4:`権限エラー`,s7b16:`入力ファイルなし`,s7b1c:`修正依頼のあった試行`,s7b3:`検索に一致する実行なし`,s7bf:D`最初のエージェントのセッションの前に各モデルへ送る 1 回のリクエスト(preflight, policy ${0})`,s7c0:D`ホストからの報告なし ${0} 件`,s7c9:`フィルター`,s7cd8:`このタスクの入力 1 件`,s7cd9:`利用できるモデルがなく、最初に応答したモデルで実行する種別(substitute)`,s7cf:`応答が JSON ではない`,s7da:`最終報告`,s7df:D`終了(未実行のタスク ${0} 件)`,s7e:D`ロール ${0}`,s7f:`表示形式`,s803:`ファイル`,s807:`実行 1 件`,s80c:`1 行`,s817:`変更したファイル 1 件`,s81a:`各タスクが書き込むファイル(OutputContract)`,s822:D`以前の試行のモデル: ${0}`,s826:`エージェントのセッションが使ったモデル`,s827:`認証情報が休止中`,s83:D`書き込み ${0}`,s841:`たった今`,s84f:`リトライ`,s8512:D`テーマ: ${0}`,s851d:`ファイルの値`,s859:`実行中`,s85e:D`${0}: モデル切り替え`,s863:D`入力 ${0} がありません`,s864:`全体を表示`,s868:D`${2} 年 ${0}〜${1} | ${3}`,s86c:D`ホスト ${0} 台`,s874:D`${0} ステップ完了`,s877:D`${0} 回目の失敗後の、新しいエージェントのセッション`,s87a:`実行されず`,s87b:D`モデル切り替え後に完了: ${0}`,s880:`全試行の合計`,s888:`入力`,s88b:`表で表示`,s892:D`入力 ${0}(${1} の出力)がありません`,s89e:`パラメータなし`,s8a56:`なし`,s8a59:D`PID ${0}`,s8ab:`コーディングエージェント`,s8ad:`周回数`,s8ae:D`${0} の記録から再生したエージェントのセッションと、そこに記録した新しいセッション(replay, record_missing)`,s8b1:`リトライしたタスク`,s8b4:`同じロックを持つタスクが共有する常駐の補助プロセス(services.jsonl)`,s8bb:`終了したすべての試行から集計(journal.jsonl)`,s8c1:D`${0} 分前`,s8c5:`このタスクの結果を受け取った直後に、フロー呼び出しが後続タスクを作成した(created_from)`,s8d3:`コーディングエージェントが使ったアカウントまたは API キー(credential)`,s8d4:`PID`,s8dd:D`キャッシュ読み込み ${0}`,s8de:`再開後の実行での、新しいエージェントのセッション`,s8df:`オブジェクト`,s8e3:`アシスタント`,s8e6:`Python コードで定義`,s8e9:D`ほか ${0} アカウント`,s8ea:`Tab: 次の行`,s8f1:`選択を解除`,s8f2:`ユニット`,s8f4:`入力と出力(全試行の合計)`,s8f5:`未実行`,s8fa:`未実行(入力ファイルなし、入力ファイルに検証エラー)`,s8fc:D`修正依頼 1 回で完了 | 最初の検証エラー: ${0}`,s900:`ビュー`,s901:`完了したタスク`,s906:`Python タスク`,s90c:D`コンテキストの上限 ${1} の ${0}%`,s90e:`ほかの種別が実装する種別(base_kind)`,s90f:`認証エラー`,s914:D`最大 ${0} 周`,s919:D`${0}d ${1}h`,s91d:`順序のみの依存先`,s924:D`モデル ${0}`,s92a:D`依存先タスク ${0} 件の出力待ち`,s92b:D`5 時間枠 ${0}`,s934:`試行 1 回`,s936:`キュー内で同順位のタスクの順序を決める値(priority)`,s93e:`リプレイ`,s941:D`1 日あたり ${0}`,s949:`書き出しの期間`,s94d:`認証情報`,s94e:D`最終更新 ${0}`,s94f0:`実行中のタスク`,s94fd:D`${0} を折りたたむ`,s967:D`失敗 ${0} 件`,s96a:`コンテキストの上限`,s96c:D`出力 ${0}`,s97:D`修正依頼 ${0} 回で完了`,s980:`テキストフィルター`,s9893d9:D`利用率のルール: ${0}`,s9893de:`ホスト 1 台`,s98b:`グループ`,s98f:`入力ファイルなし`,s99:D`${0} 日間`,s9a4:D`失敗: ${0}`,s9a6:D`Web 検索 ${0} 回`,s9aa:`API 呼び出し 1 回あたりの入力の最大値。キャッシュ読み込みとキャッシュ書き込みを含む(peak_context)`,s9b1a6:`実行中ではありません`,s9b1a9:D`仕上げの種別: ${0}`,s9b3:`報告間隔`,s9b7:`書き込みなし(タスクが失敗)`,s9bd:D`${0} 回目で完了 | 失敗 ${1} 回 | 最初の失敗: ${2}`,s9c3:D`上限を超えた利用: ${0}`,s9c5:D`${0} の出力`,s9c6:`修正ラウンド`,s9c7:`すべての中を表示`,s9cb:`実装する種別`,s9d3:D`${0} 時点の書き出し`,s9d6:`最終応答なしで終了`,s9da:D`修正ラウンド ${0} 回後`,s9de:`モデル`,s9e0:D`状態: ${0}`,s9e8:`未実行(入力ファイルに検証エラー)`,s9f0:D`入力 ${0}`,s9f2:`一部のみ完了`,s9f7:`エラー`,s9f92:D`${0} の内部`,s9f97:`料金の上限`,s9fb:`実行`,s9fd:`タスクの開始前からあるファイルも有効`,s9ff:`モデル切り替え`,sa1:`リプレイした試行`,sa23:`ターン数の上限`,sa24:D`${0} の締め切りまでに終わらない`,sa31:`行を折り返す`,sa33:`後続タスクなし`,sa358:`ロール`,sa35c:`試行`,sa36:`モデル別の内訳`,sa39:D`実行中のエージェントのセッションの新しいイベント ${0} 件を表示`,sa3c:`形式`,sa3d3:D`週の利用率 ${0}(リセット ${1})`,sa3db:`エージェント・モデル`,sa3de:`停止`,sa43:`作成元`,sa48:`コマンドライン`,sa4f:D`最大 ${0} 回`,sa508:`安全分類器による停止 1 件`,sa50a:`折りたたむ`,sa54:`API 呼び出しごとのトークンは不明`,sa57:`権限エラーになったツール呼び出し`,sa62:D`${0}: トランスクリプト`,sa66:D`前の ${0} 行を表示`,sa6a:`開始日`,sa70:`項目なし`,sa71:`期待する型`,sa74:`縮小(Ctrl + スクロール)`,sa81:`システム設定に合わせる`,sa84:D`新しいイベント ${0} 件を表示`,sa86:D`${0} 時間前`,sa87:`ソースを表示`,sa88:D`${0} の入れ子のループ`,sa8b:`Shift + 矢印キー: 依存先タスク・後続タスク`,sa9b:`タスク詳細`,sa9d:`報告なし`,saa0:`書き込み待ち(タスクが実行中)`,saa2:`理由`,saa9:`OutputContract・InputContract を宣言したタスクなし`,saaa:`5 時間枠の利用率`,saab:`テーマ`,sab5:D`${0} 行目`,sabd:`思考`,sac1:`モニターのサーバーに未接続`,sac7:D`${0} に利用できるモデルなし`,saca:`期間内の実行の合計`,sacb:`分かっているのはコーディングエージェントが出力したトークンの合計だけ。API 呼び出しごとのトークンは不明(usage_unknown)`,sacc:`可`,sad1:D`ほかに休止中の認証情報 ${0} 件`,sad3:`状態`,sad9:`API リクエストを再送`,sadb:`トークンは不明`,sae5:`必須`,sae6:`実行履歴のリトライしたタスク`,saee:`プロセス`,saf2:`すべてのモデルが利用可能`,saf8:`変更したファイルなし`,safd:D`${0} 回目が失敗: ${1}`,sb05:`エラー`,sb06:`実行履歴の修正依頼のあった試行`,sb0c5:`サブスクリプションの利用率`,sb0cc:D`週 ${0} → ${1}`,sb0f:`Python タスク 1 回`,sb105:D`未実行: ${0}`,sb106:`検索語`,sb108:`作成、試行の失敗後に削除`,sb14:D`報告なし ${0} 台`,sb16:D`${0} 行`,sb1f:`前の 1 行を表示`,sb24:D`この失敗で ${0} が停止`,sb26a:`登録順`,sb26f:`表示中の階層の外`,sb27:`Enter: 開く`,sb28:`キャッシュ書き込み`,sb31:D`プロンプト(${0} 文字)`,sb34:D`変更したファイル ${0} 件`,sb38:`ツール呼び出し`,sb4:`トランスクリプトなし`,sb51:`パイプラインのプロセス内`,sb53:`はい`,sb55:`コーディングエージェントが報告した値`,sb59:D`コンテキストの上限に接近(${0}%)`,sb5a:`未実行`,sb6:`タスク実行中の書き込みが必須`,sb74:`下の階層あり`,sb76:D`${0} に停止`,sb81:`実行したエージェントのセッションのトークンは不明(usage_unknown)`,sb88:`このバージョンの contraagent が読めなかったイベント(unread_events)`,sb89:`エージェントのセッション 1 回`,sb94:D`5 時間枠(${0})`,sb97:`コンテキストの上限に接近`,sb98:D`${0}: 完了`,sb99:`トークンと料金`,sb9c:D`Python タスク: ${0}`,sba3:`1 周`,sba7:`ほかの出力 1 件`,sba8:`検証を通るファイルを書き込む前に、タスクが失敗`,sbaf:`要素 1 個`,sbb2:`開始時の利用率`,sbb9:`終了`,sbbe:`入力元`,sbc6:D`${0} 周: ${1}`,sbc9:D`以前の試行のモデル: ${0}`,sbca:`タスクの開始時`,sbcc:`依存先タスクが失敗`,sbd4:`実行を切り替え(r)`,sbd5:`停止の記録なし`,sbd9:`再開後`,sbdc:D`履歴にほか ${0} 件`,sbe2:`実行履歴の失敗した試行`,sbe4:D`${0} の記録から再生したエージェントのセッション(replay)`,sbe9:D`週(${0})`,sbea:`保存対象外(keep_transcripts = false)`,sbf18:`種別のロール`,sbf1d:D`ロック ${0}`,sbf2:`アクティビティなし`,sbf9:`スタブエージェントが台本どおりの応答で処理したタスク(stub)`,sc03:`それ以前`,sc07:`リトライ対象の例外`,sc15:`スキップ`,sc1a:D`待機中 ${0} 件`,sc1b:D`リトライしたタスク ${0} 件`,sc2:`ツール`,sc3:`この期間の実行はありません`,sc4:`タイムアウト`,sc53:`休止した認証情報`,sc54:D`${0} の締め切りを過ぎた`,sc57:D`入力 ${0} に検証エラー`,sc59:D`${2} 年 ${0}〜${1}`,sc5b:`次のモデルでの新しいエージェントのセッション`,sc61:D`週 ${0}`,sc65:`縮小`,sc68:`日時`,sc6e:`締め切りまでに終わらない`,sc6f:D`エラーで終了したフロー呼び出し ${0} 件`,sc73:`開始`,sc75:D`全 ${1} 行のうち先頭 ${0} 行`,sc79:`タスク`,sc7d:`同時実行(上限)`,sc87a:D`警告のしきい値: ${0}`,sc87d:D`終了 ${0}`,sc92:`空き`,sc94:`全体`,sc97:`タイムゾーン`,sc9e:`その他`,sca1:`開始前に変更された`,sca4:`プロセスなし`,sca6:`プレビューを表示`,sca7:`ロール`,scb8:`終了(未完了のタスク 1 件)`,scb9:`最終試行の終了時刻`,scbd:`全文`,scbf:D`試行 ${1} 回中 ${0} 回`,scca:D`最も高い種別: ${0}`,sccc:`モデルが応答を拒否`,scd1:`モデルの応答`,scd2:D`${0}: ${1} → 次のモデル`,scd94:`エージェントの所要時間`,scd9c:D`優先度 ${0}`,scdb:`Esc: 選択を解除`,scde:`ループ`,scf41:D`完了 ${0} 件`,scf43:D`入力 ${0} は失敗したタスクの出力`,scf70:`レート制限`,scf71:`失敗した試行の後の試行(retries)`,sd05:D`締め切り ${0}`,sd0e:`出来事`,sd17:`入力 / 出力 | キャッシュ読み込み / キャッシュ書き込み`,sd1f:`ファイルの検証に使うスキーマ`,sd20:D`順序のみの依存先: ${0}`,sd26:D`${0} 件を同時実行`,sd34:D`${0} に開始(${1})`,sd38:`変更`,sd3c:`登録済みのタスクなし`,sd3e:D`終了(未完了のタスク ${0} 件)`,sd40:`読み込むファイル(検証あり)`,sd47:`ローカルの認証情報(ambient)`,sd58:`終了(失敗したタスク 1 件)`,sd5a:`実行がシグナルで停止された`,sd5c:D`変更: ${0}`,sd5d:D`トークン: 入力 ${0}、出力 ${1}、キャッシュ読み込み ${2}、キャッシュ書き込み ${3}`,sd5e:`所要時間の合計`,sd6:`タスク呼び出しが実行全体の代わりに指定した、このタスクの作業ディレクトリ(cwd)`,sd73:`失敗`,sd744:`検証対象のファイル`,sd747:`なし(任意)`,sd75:`検証エラー`,sd776:D`全体の ${0}%`,sd77d:`実行中のエージェントのセッションの新しいイベント 1 件を表示`,sd7d:D`入力 ${0}(${1} の出力)に検証エラー`,sd82:`タスクの開始前からあるファイルは無効`,sd8a:D`${0} まで`,sd93:D`依存先タスク ${0} の出力待ち`,sd95:D`一部のみ完了: ${0}`,sd96:`中を隠す`,sda2:D`セッション開始時の利用率: ${0}`,sda80:D`すべて表示(${0} 文字)`,sda8d:`最大コンテキストが警告のしきい値を超えた(context_warned)`,sdb1:`入力`,sdb4:`イベントが途絶えた`,sdb8:`出力に検証エラー`,sdc:D`実行グループ ${0}`,sdd1:`モニターから応答がありません`,sddf:`ビューを表示`,sde3:D`作業ディレクトリ ${0}`,sde7:`履歴にほか 1 件`,sde8:D`アカウント ${0}`,sdf1:D`${0} 回目で完了 | 失敗 1 回 | 最初の失敗: ${1}`,sdf9:`リトライ後に完了`,se0e6:D`${0} から休止中`,se0ed:D`実行されず: ${0}`,se17:D`必要な時間 ${0}`,se1a:`作成`,se21:`指標`,se27:`タスクを実行した CLI(claude、omp)`,se2b:D`キー ${0} 個: ${1}`,se2c:D`期待する型: ${0}`,se3:`キーボードショートカット`,se4:`作成、試行の失敗後も保持`,se55:`エージェントのセッションの所要時間の合計`,se5ad:`モデル切り替え`,se5af:D`修正ラウンド ${0}`,se5b:`推移`,se5d:`monitor.Panel`,se60:`ハイコントラスト`,se61:`パイプラインのプロセス内の関数`,se66:`1 タスク`,se69:`後続タスクはこのタスクの完了を待つが、出力は受け取らない(after)`,se71:D`${0} 回目`,se75:`リプレイと新しいセッション`,se7b:D`タスクの所要時間 ${0}`,se8:D`安全分類器による停止 ${0} 件`,se90:`認証情報`,se99d:`ロック`,se99f:D`終了(失敗したタスク ${0} 件)`,sea2:`期間`,sea4:`定義`,sea6:`矢印キー: マーク`,sea74:D`${0} タスク`,sea7b:`実行の一覧`,seac:`待機中`,seb0:`グラフで表示`,seb2:`締め切りと仕上げの猶予を過ぎた`,seba:`既定`,sec2:`すべての種別`,sec7:`コーディングエージェントが使ったエージェント定義(agents/<role>.md)`,secc:`上限に到達`,secf:D`${0}の利用率 ${1}`,sed05:`コーディングエージェントが報告した料金(試行が終わった日に計上)`,sed0a:`タスクごとに 1 つ(Backend.run)`,sed7:`種別または関数`,sed8:`合計`,sede:`ステージなし`,seea0:`結果`,seea1:`ホスト ID なし`,seed:D`入力ルート ${1} の ${0}`,seee1:`スキップ`,seee3:`完了しなかった試行`,sef0:D`実行中 ${0} 件`,sefc:`言語`,ser:`稼働中`,sf03:`所要時間の中央値`,sf06:D`タスクは ${0} 回目で完了`,sf08:`すべてのエージェントのセッションの合計(同時に実行した分も含む)`,sf11:`終了時刻`,sf14:`最初のエージェントのセッション`,sf26:D`実行 ${0} 件`,sf2b:`トークンの報告なし`,sf2d:D`関数 ${0}`,sf2e:`定義`,sf39:`周回数`,sf3c:`ほか 1 アカウント`,sf3e:`カスタムビュー`,sf46:D`${0} 周目`,sf48:`終了後の利用率`,sf4d:`コピー済み`,sf55:`サービス`,sf56:`試行の終了後に、同じアカウントで最初に報告された値`,sf5d:`ユニットごとではなく、実行ごとに 1 回実行されるタスク`,sf6:`フロー呼び出し`,sf7b:D`不明(${0})`,sf7d:D`残り ${0}`,sf7e:`すべての実行グループ`,sf82:D`休止 ${0} → ${1}`,sf86:`内容不明`,sf93:`合計`,sf9b:`エージェントのセッションが始まらなかった`,sfa04:`テキスト`,sfa06:`待たれなかったタスク 1 件`,sfa25:D`${0} 〜 ${1}`,sfa29:D`あと ${0} 件の見込み(forecast)`,sfa6:`フィルターに一致するタスクなし`,sfa8:`ツールのリクエスト`,sfad:`修正依頼 1 回で完了`,sfae:`ホスト一覧`,sfb3:`実行を切り替え`,sfb6:D`実行中のエージェントのセッション ${0} 件`,sfbb1:`失敗した試行`,sfbb8:D`${1} の失敗により ${0} で停止`,sfc4:`外部の状態`,sfc7:`再開カーソルなし`,sfd3:D`リトライ後に完了 ${0} 件`,sfd5:D`要素 ${0} 個: ${1}`,sfd7:`出力`,sfd85:`タスクの前から変わらない出力ファイルの箇所(preserve)`,sfd8b:`各日の最大値`,sfdd:`プロセス`,sfde:`ファイルにない必須フィールド`,sfe7:D`${0}: 入力と出力`,sfe9:D`プロセス ${0}`,sfef:`見込み: あと 1 タスク`,sff6:`登録済みのタスクはまだありません`,sff8:D`${0} のタスク`,sffa:`定義なし`,sfff:D`Python タスク ${0} 回`,stag:`完了`,stat:`状態`,"stop-ca":`取り消し`,"stop-co":`完了`,"stop-i":`未実行`,"stop-p":`一部のみ完了`,tab:`タスク`,tas:`タスク`,tok:`出力`,too:`完了`,"trends-p":`一部のみ完了`,"trends-r":`実行`,"view-g":`グラフ`,"view-o":`出力`,"view-t":`表`}),Sn=`en`,Cn=[`ja`],wn=[`en`,`ja`],Tn={en:`English`,ja:`日本語`},En={ja:()=>Promise.resolve(bn)};function Dn(){if(yn===void 0)try{yn=nt({sourceLocale:Sn,targetLocales:Cn,loadLocale:e=>En[e]()})}catch{yn=null}return yn!==null}var R=()=>yn?.getLocale()??Sn;async function On(e){Dn()&&await yn.setLocale(e)}var kn=`contraagent:locale`,An=e=>wn.includes(e);function jn(){try{let e=globalThis.localStorage?.getItem(kn);if(An(e))return e}catch{}for(let e of globalThis.navigator?.languages??[]){let t=e.toLowerCase().split(`-`)[0];if(An(t))return t}return Sn}async function Mn(e){try{globalThis.localStorage?.setItem(kn,e)}catch{}await On(e)}var Nn=`contraagent`,Pn=null,Fn=``,In=null,Ln=!1;function Rn(){let e=globalThis.history?.state;return e&&typeof e==`object`?e:{}}function zn(){let e=Rn()[Nn];return e&&typeof e==`object`?e:{}}function Bn(){In&&clearTimeout(In),In=null;let e=Pn;Pn=null,e&&globalThis.history&&zn().entry===Fn&&history.replaceState({...Rn(),[Nn]:{...zn(),...e}},``)}function Vn(){Bn()}var Hn={recall:function(e){if(globalThis.history)return Pn&&Fn===zn().entry&&e in Pn?Pn[e]:zn()[e]},remember:function(e,t){if(!globalThis.history)return;let n=function(){let e=zn().entry;if(e)return e;let t=Math.random().toString(36).slice(2);return history.replaceState({...Rn(),[Nn]:{...zn(),entry:t}},``),t}();Pn&&Fn!==n&&(Pn=null),Fn=n,(Pn??={})[e]=t,In??=setTimeout(Bn,200),Ln||(Ln=!0,globalThis.addEventListener?.(`pagehide`,Vn))}},Un=class{constructor(){this.values=new Map}recall(e){return this.values.get(e)}remember(e,t){this.values.set(e,t)}},Wn=new WeakMap;function Gn(e,t){t?Wn.set(e,t):Wn.delete(e)}function Kn(e){for(let t=e;t;t=t.parentNode??t.host){let e=Wn.get(t);if(e)return e}return Hn}var qn=class{constructor(e,t){this.id=e,this.from=t,this.items=null}get memory(){return Kn(this.from)}get loaded(){return this.items??=new Set(this.memory.recall(this.id)??[])}has(e){return this.loaded.has(e)}set(e,t){let n=this.loaded;t!==n.has(e)&&(t?n.add(e):n.delete(e),this.memory.remember(this.id,[...n]))}values(){return[...this.loaded]}clear(){this.loaded.size&&(this.loaded.clear(),this.memory.remember(this.id,[]))}},Jn=class{constructor(e){this.id=e;let t=null;try{t=JSON.parse(globalThis.sessionStorage?.getItem(`${Nn}:${e}`)??`null`)}catch{}this.items=new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}has(e){return this.items.has(e)}set(e,t){if(t!==this.items.has(e)){t?this.items.add(e):this.items.delete(e);try{globalThis.sessionStorage?.setItem(`${Nn}:${this.id}`,JSON.stringify([...this.items]))}catch{}}}},Yn=[`wheel`,`touchstart`,`pointerdown`,`keydown`],Xn=class{constructor(e,t=()=>Hn){this.id=e,this.memory=t,this.el=null,this.frame=0,this.restoring=!1,this.target=0,this.until=null,this.step=()=>{if(this.frame=0,this.restoring&&this.el)return this.place()?this.cancel():void(this.until!==null&&(this.frame=requestAnimationFrame(this.step)))},this.cancel=()=>{if(cancelAnimationFrame(this.frame),this.frame=0,this.restoring){this.restoring=!1,this.el&&(this.el.style.overflowAnchor=``);for(let e of Yn)this.el?.removeEventListener(e,this.cancel)}},this.onScroll=()=>{!this.restoring&&this.el&&this.memory().remember(this.id,Math.round(this.el.scrollTop))}}attach(e){this.el!==e&&(this.detach(),this.el=e,e.addEventListener(`scroll`,this.onScroll,{passive:!0}))}detach(){this.cancel(),this.el?.removeEventListener(`scroll`,this.onScroll),this.el=null}restore(){let e=this.el;if(!e)return;this.cancel();let t=this.memory().recall(this.id)??0;if(t<=0)e.scrollTop=0;else{this.target=t,this.until=null,this.restoring=!0,e.style.overflowAnchor=`none`;for(let t of Yn)e.addEventListener(t,this.cancel,{passive:!0,once:!0});this.place()}}update(e){this.restoring&&(e&&(this.until??=performance.now()+6e3),this.frame||=requestAnimationFrame(this.step))}reset(){this.cancel(),this.el&&(this.el.scrollTop=0)}place(){let e=this.el,t=e.scrollHeight-e.clientHeight;return e.scrollTop=Math.min(this.target,t),this.until!==null&&(t>=this.target||performance.now()>this.until)}},Zn=[`overview`,`tasks`,`journal`,`outputs`,`definitions`,`procs`,`stream`],Qn=[`transcript`,`input`,`output`,`definition`],$n=[7,14,30],er={page:``,run:``,tab:`overview`,key:null,view:`transcript`,round:null,def:null,kind:``,stop:``,q:``,layer:``,unit:``,sel:``,days:14,from:``,to:``,tz:``,group:``,trendsTab:``},tr=e=>Zn.includes(e)||/^panel:.+/.test(e),nr=e=>Qn.includes(e);function rr(e){let t=new URLSearchParams(e),n=t.get(`tab`)??``,r=t.get(`view`)??``,i=Number(t.get(`round`)),a=t.get(`page`)===`hosts`?`hosts`:t.get(`page`)===`trends`?`trends`:``,o=t.get(`from`)??``,s=t.get(`to`)??``,c=/^\d{4}-\d{2}-\d{2}$/.test(o)&&/^\d{4}-\d{2}-\d{2}$/.test(s),l=Number(t.get(`days`));return{page:a,run:a?``:t.get(`run`)??``,tab:a!==`trends`&&tr(n)?n:`overview`,key:t.get(`key`)||null,view:nr(r)?r:`transcript`,round:Number.isInteger(i)&&i>0?i:null,def:t.get(`def`)||null,kind:t.get(`kind`)??``,stop:t.get(`stop`)??``,q:t.get(`q`)??``,layer:t.get(`layer`)??``,unit:t.get(`unit`)??``,sel:t.get(`sel`)??``,days:c?0:$n.includes(l)?l:er.days,from:c?o:``,to:c?s:``,tz:t.get(`tz`)??``,group:t.get(`group`)??``,trendsTab:a===`trends`?t.get(`tab`)??``:``}}function ir(e){if(e.page===`hosts`)return`?page=hosts`;if(e.page===`trends`){let t=new URLSearchParams({page:`trends`});return e.days===0&&e.from&&e.to?(t.set(`from`,e.from),t.set(`to`,e.to)):e.days!==er.days&&t.set(`days`,String(e.days)),e.tz&&t.set(`tz`,e.tz),e.group&&t.set(`group`,e.group),e.trendsTab&&t.set(`tab`,e.trendsTab),`?${t.toString()}`}let t=new URLSearchParams;e.run&&t.set(`run`,e.run),e.tab!==`overview`&&t.set(`tab`,e.tab),e.tab===`stream`&&(e.key&&t.set(`key`,e.key),e.view!==`transcript`&&t.set(`view`,e.view),e.round!=null&&t.set(`round`,String(e.round))),e.tab===`definitions`&&e.def&&t.set(`def`,e.def),e.tab===`overview`&&e.layer&&t.set(`layer`,e.layer),e.tab===`overview`&&e.unit&&t.set(`unit`,e.unit),e.tab===`overview`&&e.sel&&t.set(`sel`,e.sel);let n=e.tab===`tasks`||e.tab===`journal`;n&&e.kind&&t.set(`kind`,e.kind),e.tab===`journal`&&e.stop&&t.set(`stop`,e.stop),n&&e.q&&t.set(`q`,e.q);let r=t.toString();return r?`?${r}`:``}function ar(e,t){let n={...e,...t};return t.run!==void 0&&t.run!==e.run&&Object.assign(n,{key:null,def:null,round:null,layer:``,unit:``,sel:``,...t}),t.layer!==void 0&&t.layer!==e.layer&&t.sel===void 0&&(n.sel=``),t.key!==void 0&&t.key!==e.key&&(t.view===void 0&&(n.view=`transcript`),t.round===void 0&&(n.round=null)),n}function or(e,t){let n=e=>ir({...e,kind:``,stop:``,q:``,unit:``,sel:``});return n(e)!==n(t)}var sr=class{constructor(e,t,n,r=()=>{}){this.mode=e,this.onChange=t,this.onLeave=r,this.onPop=()=>{this.current=rr(location.search),this.onChange(this.current,`pop`)};let i=rr(e===`url`?location.search:``);this.current=ar(i,n??{})}get viewRoute(){return this.current}start(){this.mode===`url`&&(history.scrollRestoration=`manual`,addEventListener(`popstate`,this.onPop)),this.onChange(this.current,`init`)}stop(){this.mode===`url`&&removeEventListener(`popstate`,this.onPop)}navigate(e,t={}){let n=ar(this.current,e);if(ir(n)===ir(this.current))return;let r=!t.replace&&or(this.current,n);if(this.current=n,this.mode===`url`){let e=`${location.pathname}${ir(n)}${location.hash}`;r?(this.onLeave(),history.pushState({},``,e)):history.replaceState(history.state,``,e)}this.onChange(n,r?`push`:`replace`)}},cr=class{constructor(e,t){this.host=e,this.opts=t,this.ready=Promise.resolve(),e.addController(this)}hostConnected(){let e=this.opts.locale();this.ready=On(An(e)?e:jn()).catch(()=>{})}hostUpdated(){let e=this.opts.locale();e!==this.seen&&(this.seen=e,An(e)&&e!==R()&&On(e)),this.opts.pageWide()&&(document.documentElement.lang=R()),this.host.lang=R()}},lr=class{constructor(e,t,n){this.host=e,this.onKey=t,this.scope=n,this.bound=null,this.boundScope=`off`,this.listener=e=>{let t=e;t.defaultPrevented||function(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&(t.isContentEditable||t.matches(`input, select, textarea, [contenteditable]:not([contenteditable="false"])`))}(t)||t.metaKey||t.ctrlKey||t.altKey||this.onKey(t)},e.addController(this)}hostConnected(){this.bind()}hostUpdated(){this.scope()!==this.boundScope&&this.bind()}hostDisconnected(){this.unbind()}bind(){this.unbind();let e=this.scope();this.boundScope=e,this.bound=e===`page`?document:e===`element`?this.host:null,this.bound?.addEventListener(`keydown`,this.listener)}unbind(){this.bound?.removeEventListener(`keydown`,this.listener),this.bound=null,this.boundScope=`off`}},ur=[{name:`backdrop`,prop:`--ca-backdrop`},{name:`bg`,prop:`--ca-bg`},{name:`card`,prop:`--ca-card`},{name:`panel`,prop:`--ca-panel`},{name:`panel2`,prop:`--ca-panel2`},{name:`raise`,prop:`--ca-raise`},{name:`well`,prop:`--ca-well`},{name:`track`,prop:`--ca-track`},{name:`line`,prop:`--ca-line`},{name:`line2`,prop:`--ca-line2`},{name:`shadow`,prop:`--ca-shadow`},{name:`text`,prop:`--ca-text`},{name:`text-2`,prop:`--ca-text-secondary`},{name:`text-muted`,prop:`--ca-text-muted`},{name:`accent`,prop:`--ca-accent`},{name:`accent-bg`,prop:`--ca-accent-bg`,derive:`color-mix(in srgb, var(--accent) calc(var(--tint) + 1%), transparent)`},{name:`focus`,prop:`--ca-focus`},{name:`focus-width`,prop:`--ca-focus-width`},{name:`selection`,prop:`--ca-selection`},{name:`status-failed`,prop:`--ca-status-failed`},{name:`status-failed-bg`,prop:`--ca-status-failed-bg`,derive:`color-mix(in srgb, var(--status-failed) var(--tint), transparent)`},{name:`status-attention`,prop:`--ca-status-attention`},{name:`status-attention-bg`,prop:`--ca-status-attention-bg`,derive:`color-mix(in srgb, var(--status-attention) var(--tint), transparent)`},{name:`status-done`,prop:`--ca-status-done`},{name:`status-done-bg`,prop:`--ca-status-done-bg`,derive:`color-mix(in srgb, var(--status-done) var(--tint), transparent)`},{name:`status-running`,prop:`--ca-status-running`},{name:`status-running-bg`,prop:`--ca-status-running-bg`,derive:`color-mix(in srgb, var(--status-running) var(--tint), transparent)`},{name:`status-muted`,prop:`--ca-status-muted`},{name:`status-muted-bg`,prop:`--ca-status-muted-bg`,derive:`color-mix(in srgb, var(--status-muted) calc(var(--tint) - 1%), transparent)`},{name:`tint`,prop:`--ca-tint`},{name:`agent`,prop:`--ca-agent`},{name:`agent-bg`,prop:`--ca-agent-bg`,derive:`color-mix(in srgb, var(--agent) calc(var(--tint) + 2%), transparent)`},{name:`meter`,prop:`--ca-meter`},{name:`tok-input`,prop:`--ca-tok-input`},{name:`tok-cache-read`,prop:`--ca-tok-cache-read`},{name:`tok-cache-write`,prop:`--ca-tok-cache-write`},{name:`tok-output`,prop:`--ca-tok-output`},{name:`series-1`,prop:`--ca-series-1`},{name:`series-2`,prop:`--ca-series-2`},{name:`series-3`,prop:`--ca-series-3`},{name:`series-4`,prop:`--ca-series-4`},{name:`series-5`,prop:`--ca-series-5`},{name:`series-6`,prop:`--ca-series-6`},{name:`code-keyword`,prop:`--ca-code-keyword`},{name:`code-string`,prop:`--ca-code-string`},{name:`code-number`,prop:`--ca-code-number`},{name:`code-constant`,prop:`--ca-code-constant`},{name:`code-comment`,prop:`--ca-code-comment`},{name:`code-function`,prop:`--ca-code-function`},{name:`code-type`,prop:`--ca-code-type`},{name:`code-name`,prop:`--ca-code-name`},{name:`font-size-xs`,prop:`--ca-font-size-xs`,derive:`10px`},{name:`font-size-sm`,prop:`--ca-font-size-sm`,derive:`11px`},{name:`font-size-md`,prop:`--ca-font-size-md`,derive:`12px`},{name:`font-size-lg`,prop:`--ca-font-size-lg`,derive:`13px`},{name:`font-size-xl`,prop:`--ca-font-size-xl`,derive:`15px`},{name:`font-size-2xl`,prop:`--ca-font-size-2xl`,derive:`28px`},{name:`radius-sm`,prop:`--ca-radius-sm`,derive:`4px`},{name:`radius-md`,prop:`--ca-radius-md`,derive:`8px`},{name:`radius-lg`,prop:`--ca-radius-lg`,derive:`12px`},{name:`radius-pill`,prop:`--ca-radius-pill`,derive:`999px`}],dr=[`contraagent-dark`,`contraagent-light`,`github-dark`,`github-light`,`one-dark`,`nord`,`high-contrast`],fr=[`contraagent-dark`,`contraagent-light`,`system`,`github-dark`,`github-light`,`one-dark`,`nord`,`high-contrast`],pr=[`github-dark`,`github-light`,`one-dark`,`nord`,`high-contrast`],mr=`contraagent-dark`,hr={"contraagent-dark":{label:`contraagent Dark`,scheme:`dark`,tokens:{backdrop:`radial-gradient(1100px 520px at 8% -12%, #10203a 0%, transparent 62%), radial-gradient(900px 480px at 108% 4%, #1b1238 0%, transparent 58%), #060a11`,bg:`#060a11`,card:`#0f1724`,panel:`#0f1724`,panel2:`#142034`,raise:`#1a2740`,well:`#0a111c`,track:`#1b273b`,line:`#1d2940`,line2:`#2b3c58`,shadow:`#060a11`,text:`#e7edf5`,"text-2":`#bcc7d6`,"text-muted":`#909db2`,accent:`#7aa2ff`,focus:`#7aa2ff`,"focus-width":`2px`,selection:`#7aa2ff4d`,"status-failed":`#f87171`,"status-attention":`#fbbf24`,"status-done":`#34d399`,"status-running":`#22d3ee`,"status-muted":`#94a3b8`,tint:`13%`,agent:`#b597fb`,meter:`#7d8ba3`,"tok-input":`#7c86f5`,"tok-cache-read":`#3f4d63`,"tok-cache-write":`#8796ad`,"tok-output":`#d6b8ff`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#c4a5ff`,"code-string":`#7ee2a8`,"code-number":`#f5c26b`,"code-constant":`#ff9e64`,"code-comment":`#74839a`,"code-function":`#7dd3fc`,"code-type":`#ffd479`,"code-name":`#79b8ff`}},"contraagent-light":{label:`contraagent Light`,scheme:`light`,tokens:{backdrop:`radial-gradient(1100px 520px at 8% -12%, #dde7fb 0%, transparent 62%), radial-gradient(900px 480px at 108% 4%, #ebe3fa 0%, transparent 58%), #eef2f8`,bg:`#eef2f8`,card:`#ffffff`,panel:`#ffffff`,panel2:`#f7f9fc`,raise:`#e6ecf5`,well:`#f3f6fa`,track:`#e1e7f0`,line:`#d6dde8`,line2:`#b6c2d3`,shadow:`#0f172438`,text:`#0f1724`,"text-2":`#34415a`,"text-muted":`#556279`,accent:`#2f58d4`,focus:`#2f58d4`,"focus-width":`2px`,selection:`#2f58d42e`,"status-failed":`#b8132d`,"status-attention":`#6c4801`,"status-done":`#026b49`,"status-running":`#01525f`,"status-muted":`#56637a`,tint:`11%`,agent:`#6f45c0`,meter:`#8a97ab`,"tok-input":`#4d4cc8`,"tok-cache-read":`#cdd6e3`,"tok-cache-write":`#7d8aa0`,"tok-output":`#a07ad9`,"series-1":`#2a78d6`,"series-2":`#eb6834`,"series-3":`#1baf7a`,"series-4":`#eda100`,"series-5":`#e87ba4`,"series-6":`#008300`,"code-keyword":`#6f49a8`,"code-string":`#076b40`,"code-number":`#7b5605`,"code-constant":`#964605`,"code-comment":`#5d6b80`,"code-function":`#086586`,"code-type":`#785902`,"code-name":`#095ea8`}},"github-dark":{label:`GitHub Dark`,scheme:`dark`,tokens:{backdrop:`#010409`,bg:`#010409`,card:`#0d1117`,panel:`#0d1117`,panel2:`#151b23`,raise:`#212830`,well:`#010409`,track:`#262c36`,line:`#262c36`,line2:`#3d444d`,shadow:`#010409`,text:`#f0f6fc`,"text-2":`#d1d7e0`,"text-muted":`#9299a2`,accent:`#4796fb`,focus:`#1f6feb`,"focus-width":`2px`,selection:`#388bfd4d`,"status-failed":`#fc554d`,"status-attention":`#d29922`,"status-done":`#3fb950`,"status-running":`#39c5cf`,"status-muted":`#9198a1`,tint:`15%`,agent:`#ab7df8`,meter:`#656c76`,"tok-input":`#58a6ff`,"tok-cache-read":`#2f3742`,"tok-cache-write":`#656c76`,"tok-output":`#d2a8ff`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#ff7b72`,"code-string":`#a5d6ff`,"code-number":`#79c0ff`,"code-constant":`#79c0ff`,"code-comment":`#9198a1`,"code-function":`#d2a8ff`,"code-type":`#ffa657`,"code-name":`#7ee787`}},"github-light":{label:`GitHub Light`,scheme:`light`,tokens:{backdrop:`#f6f8fa`,bg:`#f6f8fa`,card:`#ffffff`,panel:`#ffffff`,panel2:`#ffffff`,raise:`#eff2f5`,well:`#f6f8fa`,track:`#e6eaef`,line:`#d1d9e0`,line2:`#b7c0ca`,shadow:`#1f232833`,text:`#1f2328`,"text-2":`#393f46`,"text-muted":`#59636e`,accent:`#0165d6`,focus:`#0165d6`,"focus-width":`2px`,selection:`#0969da33`,"status-failed":`#cd1e2b`,"status-attention":`#916103`,"status-done":`#147b33`,"status-running":`#10767d`,"status-muted":`#59636e`,tint:`8%`,agent:`#804ddc`,meter:`#818b98`,"tok-input":`#54aeff`,"tok-cache-read":`#d1d9e0`,"tok-cache-write":`#818b98`,"tok-output":`#a475f9`,"series-1":`#2a78d6`,"series-2":`#eb6834`,"series-3":`#1baf7a`,"series-4":`#eda100`,"series-5":`#e87ba4`,"series-6":`#008300`,"code-keyword":`#cf222e`,"code-string":`#0a3069`,"code-number":`#0550ae`,"code-constant":`#0550ae`,"code-comment":`#59636e`,"code-function":`#6639ba`,"code-type":`#953800`,"code-name":`#116329`}},"one-dark":{label:`One Dark`,scheme:`dark`,tokens:{backdrop:`#21252b`,bg:`#21252b`,card:`#282c34`,panel:`#282c34`,panel2:`#2c313a`,raise:`#2c313a`,well:`#21252b`,track:`#3a3f4b`,line:`#181a1f`,line2:`#4b5263`,shadow:`#0e1013`,text:`#d7dae0`,"text-2":`#abb2bf`,"text-muted":`#a7afbe`,accent:`#64b2f2`,focus:`#528bff`,"focus-width":`2px`,selection:`#3e4451`,"status-failed":`#fc858d`,"status-attention":`#e5c07b`,"status-done":`#98c379`,"status-running":`#57b7c3`,"status-muted":`#a7afbe`,tint:`12%`,agent:`#d788ee`,meter:`#5c6370`,"tok-input":`#61afef`,"tok-cache-read":`#3e4451`,"tok-cache-write":`#5c6370`,"tok-output":`#c678dd`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#c678dd`,"code-string":`#98c379`,"code-number":`#d19a66`,"code-constant":`#d19a66`,"code-comment":`#8f949e`,"code-function":`#61afef`,"code-type":`#e5c07b`,"code-name":`#e36e77`}},nord:{label:`Nord`,scheme:`dark`,tokens:{backdrop:`#2e3440`,bg:`#242933`,card:`#2e3440`,panel:`#2e3440`,panel2:`#323946`,raise:`#3b4252`,well:`#272c36`,track:`#3b4252`,line:`#3b4252`,line2:`#4c566a`,shadow:`#1d2129`,text:`#eceff4`,"text-2":`#d8dee9`,"text-muted":`#adbcd9`,accent:`#9dbedf`,focus:`#88c0d0`,"focus-width":`2px`,selection:`#4c566a`,"status-failed":`#fe9aa1`,"status-attention":`#ebcb8b`,"status-done":`#a5c18e`,"status-running":`#89c1d1`,"status-muted":`#adbcd9`,tint:`13%`,agent:`#d0a9c9`,meter:`#7b88a1`,"tok-input":`#5e81ac`,"tok-cache-read":`#4c566a`,"tok-cache-write":`#7b88a1`,"tok-output":`#b48ead`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#81a1c1`,"code-string":`#a3be8c`,"code-number":`#b790b0`,"code-constant":`#d38972`,"code-comment":`#8f9db8`,"code-function":`#88c0d0`,"code-type":`#8fbcbb`,"code-name":`#8fbcbb`}},"high-contrast":{label:`High contrast`,scheme:`dark`,tokens:{backdrop:`#010409`,bg:`#010409`,card:`#0a0c10`,panel:`#0a0c10`,panel2:`#0a0c10`,raise:`#1c2128`,well:`#010409`,track:`#272b33`,line:`#7a828e`,line2:`#9ea7b3`,shadow:`#000000`,text:`#ffffff`,"text-2":`#f0f3f6`,"text-muted":`#bdc4cc`,accent:`#7abbfe`,focus:`#7abbfe`,"focus-width":`3px`,selection:`#409eff66`,"status-failed":`#ffacb8`,"status-attention":`#fad209`,"status-done":`#0ef38e`,"status-running":`#62ceff`,"status-muted":`#bdc4cc`,tint:`12%`,agent:`#c299fe`,meter:`#9ea7b3`,"tok-input":`#409eff`,"tok-cache-read":`#525964`,"tok-cache-write":`#9ea7b3`,"tok-output":`#dbb7ff`,"series-1":`#3987e5`,"series-2":`#d95926`,"series-3":`#199e70`,"series-4":`#c98500`,"series-5":`#d55181`,"series-6":`#008300`,"code-keyword":`#ff9492`,"code-string":`#addcff`,"code-number":`#91cbff`,"code-constant":`#91cbff`,"code-comment":`#bdc4cc`,"code-function":`#dbb7ff`,"code-type":`#ffb757`,"code-name":`#72f088`}}},gr=Object.fromEntries(ur.map(e=>[e.name,e.prop])),_r=e=>`:where([data-ca-theme="${e}"])`;function vr(e=_r){return dr.map(t=>{let n=hr[t],r=Object.entries(n.tokens).map(([e,t])=>`${gr[e]}: ${t};`);return`${e(t)} { color-scheme: ${n.scheme}; --ca-color-scheme: ${n.scheme}; ${r.join(` `)} }`}).join(`
|
|
6
|
+
`)}var yr=e=>fr.includes(e);function br(e,t){return e===`system`?t?`contraagent-light`:`contraagent-dark`:(e=>dr.includes(e))(e)?e:mr}var xr=`contraagent:theme`,Sr=()=>{try{return globalThis.localStorage}catch{return}},Cr=ut(vr()),wr=ut(vr(e=>`:host([data-ca-theme="${e}"])`)),Tr=new WeakSet,Er=class{constructor(e,t){this.host=e,this.opts=t,this.light=globalThis.matchMedia?.(`(prefers-color-scheme: light)`).matches??!1,this.stop=null,e.addController(this)}get choice(){let e=this.opts.theme();return yr(e)?e:function(e=Sr()){try{let t=e?.getItem(xr);if(yr(t))return t}catch{}return mr}()}get shown(){return br(this.choice,this.light)}get system(){return br(`system`,this.light)}hostConnected(){this.apply();let e=globalThis.matchMedia?.(`(prefers-color-scheme: light)`);if(!e)return;let t=e=>{this.light=e.matches,this.host.requestUpdate()};e.addEventListener(`change`,t),this.stop=()=>e.removeEventListener(`change`,t)}hostDisconnected(){this.stop?.(),this.stop=null}hostUpdated(){this.apply()}apply(){let e=this.shown;this.host.getAttribute(`data-ca-theme`)!==e&&this.host.setAttribute(`data-ca-theme`,e),this.opts.pageWide()&&document.documentElement.getAttribute(`data-ca-theme`)!==e&&document.documentElement.setAttribute(`data-ca-theme`,e)}},Dr=new Map;function Or(e,t){let n=`${e}|${t}`,r=Dr.get(n);return r||(r=new Intl.DateTimeFormat(e,{...t?{month:`short`,day:`numeric`}:{},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Dr.set(n,r)),r}var z=e=>e&&e!==`neutral`?e:N;function B(e,t,n){return e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}function kr(e,t){let n={...e};if(t)for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function V(e,t){customElements.get(e)||customElements.define(e,t)}function H(e){if(e==null||Number.isNaN(e))return`—`;let t=Math.max(0,e);if(t<.05)return`<0.1s`;if(t<9.95)return`${t.toFixed(1)}s`;let n=Math.round(t);return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m ${String(n%60).padStart(2,`0`)}s`:`${Math.floor(n/3600)}h ${String(Math.floor(n%3600/60)).padStart(2,`0`)}m`}var Ar=e=>String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),jr=new Set,Mr=null;function Nr(){for(let e of jr)e.requestUpdate()}var Pr=class{constructor(e){this.host=e,e.addController(this)}hostConnected(){jr.add(this.host),Mr??=setInterval(Nr,1e3)}hostDisconnected(){jr.delete(this.host),!jr.size&&Mr&&(clearInterval(Mr),Mr=null)}},Fr=new class{constructor(){this.seen=new Map}at(e,t,n=Date.now()){let r=Math.round(n-1e3*t),i=this.seen.get(e);return i!==void 0&&Math.abs(i-r)<5e3?i:(this.seen.set(e,r),r)}},Ir=A` .tag{font-size:var(--font-size-xs);padding:0 7px;border-radius:var(--radius-pill);border:1px solid var(--line2);color:var(--text-muted);white-space:nowrap;}.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;}.chip{font-size:var(--font-size-sm);padding:1px 8px;border-radius:var(--radius-pill);border:1px solid var(--line);color:var(--text-muted);white-space:nowrap;}.chip[data-tone='done']{color:var(--text-2);}.chip[data-tone='done']>[aria-hidden]{color:var(--tone);font-weight:700;}.chip[data-tone='running']{background:var(--tone);color:var(--bg);border-color:var(--tone);font-weight:600;animation:ping 1.6s var(--ease) infinite;}.chip.todo{opacity:0.65;}.taskchip{display:inline-block;font:inherit;font-family:var(--mono);font-size:var(--font-size-sm);line-height:1.5;padding:0 8px;border-radius:var(--radius-pill);border:1px solid var(--line);background:var(--raise);color:var(--text-2);white-space:nowrap;}button.taskchip{cursor:pointer;}button.taskchip:hover{border-color:var(--accent);color:var(--text);}.kbd{font-family:var(--mono);font-size:var(--font-size-xs);border:1px solid var(--line2);border-bottom-width:2px;border-radius:var(--radius-sm);padding:0 4px;color:var(--text-muted);}`,Lr=A` .g12{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:14px;container-type:inline-size;}.c12{grid-column:span 12;}.c7{grid-column:span 7;}.c5{grid-column:span 5;}@container (max-width:1100px){.c7,.c5{grid-column:span 12;}}.panel{background:linear-gradient(180deg,var(--panel2),var(--panel));border:1px solid var(--line);border-radius:var(--radius-lg);padding:14px 16px;min-width:0;box-shadow:0 10px 28px color-mix(in srgb,var(--shadow) 40%,transparent);}.panel>h3{margin:0 0 12px;display:flex;align-items:center;gap:8px;font-size:12.5px;font-weight:600;color:var(--text-2);}.panel>h3 .r{margin-left:auto;font-weight:400;font-size:11.5px;color:var(--text-muted);}.sect-h{margin:14px 0 8px;font-size:var(--font-size-md);color:var(--text-2);font-weight:600;}.sect-h .meta{margin-left:8px;font-weight:400;}.blank{display:flex;flex-direction:column;align-items:center;gap:8px;padding:60px 16px;color:var(--text-muted);text-align:center;}.blank .ic{font-size:30px;opacity:0.55;}.blank b{color:var(--text-2);font-weight:600;}.blank a.lnk{text-decoration:underline;}.blank.small{padding:24px;}.fl{padding:7px 10px;border-radius:var(--radius-md);cursor:pointer;display:grid;grid-template-columns:auto 1fr auto;gap:2px 10px;align-items:baseline;}button.fl{width:100%;background:none;border:0;color:inherit;text-align:start;}.fl-name{background:none;border:0;padding:0;color:inherit;font-weight:700;text-align:start;cursor:pointer;min-width:0;}.fl>.meta:last-child{grid-column:1 / 4;overflow:hidden;text-overflow:ellipsis;}.fl:hover{background:var(--raise);}`,Rr=A` .enter{animation:enter 0.5s var(--ease) both;}@keyframes turn{to{transform:rotate(360deg);}}@keyframes breathe{0%,100%{opacity:0.45;box-shadow:0 0 0 0 transparent;transform:scale(0.85);}50%{opacity:1;box-shadow:0 0 0 4px var(--status-running-bg);transform:scale(1);}}@keyframes ping{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--status-running) 55%,transparent);}80%,100%{box-shadow:0 0 0 9px transparent;}}@keyframes enter{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}@keyframes bump{0%{transform:scale(1);}35%{transform:scale(1.04);box-shadow:0 0 0 1px var(--line2);}100%{transform:scale(1);}}@keyframes scan{to{left:100%;}}@keyframes growx{from{transform:scaleX(0);}to{transform:scaleX(1);}}@keyframes stripes{to{background-position:17px 0;}}@keyframes toast-in{from{opacity:0;transform:translateY(12px) scale(0.97);}to{opacity:1;transform:none;}}@keyframes toast-out{to{opacity:0;transform:translateX(24px);}}@keyframes rowin{from{background:color-mix(in srgb,var(--text) 10%,transparent);}to{background:transparent;}}@keyframes bounce{0%,80%,100%{transform:translateY(0);opacity:0.45;}40%{transform:translateY(-5px);opacity:1;}}@keyframes core-beat{0%,100%{transform:scale(1);}50%{transform:scale(0.72);}}@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none !important;transition:none !important;}}`,zr=A` *,*::before,*::after{box-sizing:border-box;}*{scrollbar-width:thin;scrollbar-color:var(--line2) transparent;}*:hover{scrollbar-color:var(--text-muted) transparent;}::selection{background:var(--selection);}:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;}button{font:inherit;color:inherit;}[hidden]{display:none !important;}`,Br=A` [data-tone='failed']{--tone:var(--status-failed);--tone-bg:var(--status-failed-bg);}[data-tone='attention']{--tone:var(--status-attention);--tone-bg:var(--status-attention-bg);}[data-tone='done']{--tone:var(--status-done);--tone-bg:var(--status-done-bg);}[data-tone='running']{--tone:var(--status-running);--tone-bg:var(--status-running-bg);}[data-tone='muted']{--tone:var(--status-muted);--tone-bg:var(--status-muted-bg);}[data-mark]::before{margin-right:0.35em;font-weight:700;}[data-mark='done']::before{content:'✓';content:'✓' / '';color:var(--status-done);}[data-mark='failed']::before{content:'✕';content:'✕' / '';}[data-mark='pending']::before{content:'◌';content:'◌' / '';}.tone-text[data-tone]{color:var(--tone);}.pill{border-radius:var(--radius-pill);padding:1px 10px;font-size:var(--font-size-sm);font-weight:500;background:var(--raise);color:var(--text-2);white-space:nowrap;}.pill[data-tone]{background:var(--tone-bg);color:var(--tone);}.pill[data-tone='done']{background:none;padding-left:2px;color:var(--text-2);}.jstop{font-weight:600;}.jstop[data-tone='failed'],.jstop[data-tone='attention']{color:var(--tone);}.jstop[data-tone='done']{color:var(--text-2);font-weight:500;}.dot{width:8px;height:8px;border-radius:50%;background:var(--line2);flex:none;display:inline-block;}.dot[data-tone]{background:var(--tone);}.dot[data-tone='running']{animation:breathe 1.8s ease-in-out infinite;}.dot[data-tone='attention']{border-radius:1px;transform:rotate(45deg) scale(0.86);}.dot[data-tone='failed']{border-radius:1.5px;}.spin{width:14px;height:14px;border-radius:50%;border:2px solid var(--status-running-bg);border-top-color:var(--status-running);animation:turn 0.9s linear infinite;flex:none;display:inline-block;}`,Vr=A` .jmono,code,.mono{font-family:var(--mono);}.sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}.jmono{font-size:11.5px;}.meta{color:var(--text-muted);font-size:var(--font-size-sm);}.words{word-break:keep-all;overflow-wrap:break-word;line-break:strict;}.words .f{display:inline-block;max-width:100%;}@supports (word-break:auto-phrase){.words:lang(ja){word-break:auto-phrase;}}.mut,.jdim{color:var(--text-muted);}a.lnk{color:var(--accent);cursor:pointer;text-decoration:none;}a.lnk:hover{text-decoration:underline;}`,Hr=hr[mr].tokens,Ur=A` :host{${ut(ur.map(e=>e.derive?`--${e.name}: var(${e.prop}, ${e.derive});`:`--${e.name}: var(${e.prop}, ${Hr[e.name]});`).join(`
|
|
7
|
+
`))} --sans:var(--ca-sans,system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif);--mono:var(--ca-mono,ui-monospace,SFMono-Regular,Menlo,Consolas,'Liberation Mono',monospace);--ease:cubic-bezier(0.2,0.8,0.2,1);color-scheme:var(--ca-color-scheme,${ut(hr[mr].scheme)});color:var(--text);}:host([hidden]){display:none !important;}`,Wr=A` .jtree{font-family:var(--mono);font-size:var(--font-size-md);overflow:auto;}.jt{margin-left:16px;}details.jt>summary{cursor:pointer;list-style:revert;}.jk{color:var(--code-name);}.js{color:var(--code-string);}.jn{color:var(--code-number);}.md-p{margin:0.15em 0;}.md-gap{height:0.5em;}.md-h{font-weight:600;margin:0.7em 0 0.25em;}.md-h1{font-size:1.25em;}.md-h2{font-size:1.12em;}.md-h3{font-size:1.03em;color:var(--text-2);}.md-h4{color:var(--text-2);}.md-li{padding-left:16px;text-indent:-12px;margin:0.1em 0;}.md-li::before{content:'• ';color:var(--text-muted);}.md-ol::before{content:'';}.md-n{color:var(--text-muted);margin-right:6px;}.md-q{border-left:3px solid var(--line2);padding-left:10px;color:var(--text-2);margin:0.2em 0;}.md-hr{border:0;border-top:1px solid var(--line);margin:0.7em 0;}.md-t{border-collapse:collapse;margin:0.4em 0;}.md-t th,.md-t td{border:1px solid var(--line);padding:3px 9px;text-align:left;font-size:12.5px;}.md-t th{background:var(--raise);}.md-doc{padding:10px 14px;background:var(--well);border:1px solid var(--line);border-radius:var(--radius-md);max-height:460px;overflow:auto;line-height:1.55;}.md-doc code,.tx code{background:var(--raise);border-radius:var(--radius-sm);padding:0 4px;font-size:0.92em;}.md-doc pre{background:var(--well);border:1px solid var(--line);border-radius:6px;padding:8px 10px;white-space:pre-wrap;}.md-doc pre code,.tx pre code{background:none;padding:0;border-radius:0;font-size:inherit;}.md-front{margin-bottom:10px;border-collapse:collapse;}.md-front td{padding:2px 14px 2px 0;font-size:12.5px;border:0;vertical-align:top;}.md-front td:first-child{color:var(--text-muted);}.md-tele{color:var(--text-muted);font-size:11.5px;margin-bottom:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.df-text{background:var(--well);border:1px solid var(--line);border-radius:var(--radius-md);padding:10px 12px;font-size:var(--font-size-md);white-space:pre-wrap;max-height:420px;overflow:auto;margin:0;}.df-tog{margin-left:auto;font-size:var(--font-size-sm);color:var(--accent);border:1px solid var(--line2);border-radius:var(--radius-pill);padding:0 9px;cursor:pointer;background:none;}.df-tog:hover{background:var(--accent-bg);}.pv{color:var(--code-constant);background:color-mix(in srgb,var(--code-constant) 12%,transparent);border-radius:var(--radius-sm);padding:0 3px;}.pv.pc{color:var(--code-keyword);background:color-mix(in srgb,var(--code-keyword) 12%,transparent);}.hl{font-family:var(--mono);}.hl-k{color:var(--code-keyword);}.hl-const{color:var(--code-constant);font-style:italic;}.hl-s{color:var(--code-string);}.hl-doc{color:var(--code-string);font-style:italic;opacity:0.85;}.hl-c{color:var(--code-comment);font-style:italic;}.hl-n{color:var(--code-number);}.hl-d{color:var(--code-function);}.hl-f{color:var(--code-function);font-weight:600;}.hl-cls{color:var(--code-type);font-weight:700;}.hl-t{color:var(--code-type);}.hl-b{color:var(--code-name);}.hl-key{color:var(--code-name);}.hl-tag{color:var(--code-keyword);}.hl-attr{color:var(--code-name);}.hl-meta{color:var(--code-comment);font-weight:600;}.hl-ins{color:var(--status-done);}.hl-del{color:var(--status-failed);}`,Gr=A` .jdur{position:relative;display:block;height:6px;border-radius:3px;background:var(--track);overflow:hidden;margin-top:2px;}.jdur i{position:absolute;left:0;top:0;bottom:0;border-radius:3px;background:var(--meter);}.jdur i.bad{background:var(--status-failed);}`,Kr=A` .drv-facts{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:8px;font-size:var(--font-size-md);}.drv-facts i{font-style:normal;color:var(--text-muted);margin-right:5px;font-size:var(--font-size-sm);}`,qr=A` .mark{width:var(--m);height:var(--m);padding:0;margin:0;border:0;border-radius:50%;background:var(--tone,var(--status-done));opacity:0.9;cursor:pointer;position:relative;transition:opacity 0.2s,transform 0.15s,background 0.3s;}.mark:not([data-tone]){--tone:initial;}.mark[data-tone='muted']{opacity:0.55;}.mark[data-tone='running']{opacity:1;animation:breathe 1.4s ease-in-out infinite;}.mark[data-shape='ring']{background:transparent;box-shadow:inset 0 0 0 1.5px var(--tone,var(--line2));}.mark[data-shape='hatched']{border-radius:2px;background:repeating-linear-gradient(135deg,transparent 0 2px,color-mix(in srgb,var(--tone) 55%,transparent) 2px 3px);box-shadow:inset 0 0 0 1.5px var(--tone);opacity:1;}.mark[data-shape='half']{background:linear-gradient(0deg,var(--tone) 50%,transparent 50%);box-shadow:inset 0 0 0 1.5px var(--tone);opacity:1;}.mark[data-shape='square']{border-radius:2px;opacity:1;}.big .mark[data-tone='failed']::after{content:'✕';position:absolute;inset:0;display:grid;place-items:center;color:var(--bg);font-size:calc(var(--m) - 3px);line-height:1;font-weight:700;}.mark[data-n]::after{content:'';position:absolute;inset:32%;border-radius:50%;background:var(--card);}.big .mark[data-n]::after{content:attr(data-n);inset:0;display:grid;place-items:center;border-radius:0;background:none;font:700 max(7px,calc(var(--m) - 4px)) / 1 var(--sans);color:var(--bg);letter-spacing:-0.5px;}.big .mark:is(:not([data-tone]),[data-tone='attention'],[data-tone='muted'])[data-n]::after{color:var(--text);}.mark:hover,.mark:focus-visible{transform:scale(1.4);outline:var(--focus-width) solid var(--text);outline-offset:1px;z-index:2;}.mark.sel{outline:var(--focus-width) solid var(--accent);outline-offset:2px;z-index:2;}@media (prefers-reduced-motion:reduce){.mark{transition:none;}.mark[data-tone='running']{animation:none;background:linear-gradient(90deg,var(--status-running) 50%,transparent 50%);box-shadow:inset 0 0 0 1.5px var(--status-running);}}`,U=[Ur,zr,Vr,Br,Ir,Lr,Rr];function Jr(e){switch(e){case`done`:return`done`;case`failed`:return`failed`;case`attention`:return`pending`;default:return null}}var Yr=e=>(e.mark===void 0||!0===e.mark?Jr(e.tone??`neutral`):e.mark||null)??N;function Xr(e){let t=e.tone??`neutral`;return j`<span class="pill ${e.cls??``}" part="pill tone-${t}" data-tone=${z(t)} data-mark=${Yr(e)} title=${e.title||N}>${e.text}</span>`}function Zr(e){let t=e.tone??`neutral`;return j`<span class="jstop ${e.cls??``}" part="status tone-${t}" data-tone=${z(t)} data-mark=${Yr(e)} title=${e.title||N}>${e.text}</span>`}function Qr(e,t){let n=t.tone??`neutral`;return j`<span class="${e} ${t.cls??``}" data-tone=${z(n)} data-mark=${Yr(t)} title=${t.title||N}>${t.text}</span>`}var $r=e=>(...t)=>({_$litDirective$:e,values:t}),ei=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},ti=`important`,ni=` !`+ti,ri=$r(class extends ei{constructor(e){if(super(e),e.type!==1||e.name!==`style`||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(e,[t]){let{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let e of this.ft)t[e]??(this.ft.delete(e),e.includes(`-`)?n.removeProperty(e):n[e]=null);for(let e in t){let r=t[e];if(r!=null){this.ft.add(e);let t=typeof r==`string`&&r.endsWith(ni);e.includes(`-`)||t?n.setProperty(e,t?r.slice(0,-11):r,t?ti:``):n[e]=r}}return Xt}});function ii(e,t={}){return j`<div class="legend ${t.cls??``}" part="legend" role="list" aria-label=${t.label||N}>
|
|
8
|
+
${e.map(e=>j`<span role="listitem" aria-hidden=${e.decorative?`true`:N}>${(e=>e.icon??(e.swatch||e.tone||e.shape||e.cls?j`<i class=${e.cls||N} data-tone=${z(e.tone)} data-shape=${e.shape??N} style=${e.swatch?ri({background:e.swatch}):N}></i>`:N))(e)}${e.label}</span>`)}
|
|
9
|
+
</div>`}var ai=A` .legend{display:flex;gap:14px;flex-wrap:wrap;font-size:var(--font-size-sm);color:var(--text-muted);}.legend>span{white-space:nowrap;}.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:-1px;}.legend i[data-tone]{background:var(--tone);}.legend i[data-shape='round']{border-radius:50%;}.legend i[data-shape='square']{border-radius:2px;}.legend i[data-shape='ring']{background:none;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--tone,var(--line2));}.legend i[data-shape='half']{border-radius:50%;background:linear-gradient(0deg,var(--tone,var(--line2)) 50%,transparent 50%);box-shadow:inset 0 0 0 1.5px var(--tone,var(--line2));}.legend i[data-shape='hatched']{border-radius:2px;background:repeating-linear-gradient(135deg,transparent 0 2px,var(--tone,var(--line2)) 2px 3px);}`;function oi(e){let t=e.reduce((e,t)=>e+Math.max(t,0),0);if(!t)return e.map(()=>0);let n=e.map(e=>100*Math.max(e,0)/t),r=n.map(Math.floor),i=n.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]||e[1]-t[1]);for(let e=0,t=100-r.reduce((e,t)=>e+t,0);e<t;e++)r[i[e][1]]+=1;return r}var si=(e,t)=>e===0&&t>0?`<1%`:`${e}%`,ci=A` .share{display:grid;gap:6px;}.share-bar,.share-names{display:flex;gap:2px;min-width:0;}.share-bar{height:14px;}.share-seg{position:relative;flex:0 1 0;min-width:3px;height:100%;border-radius:1px;cursor:default;outline-offset:2px;}.share-seg[data-edge='start']{border-radius:4px 1px 1px 4px;}.share-seg[data-edge='end']{border-radius:1px 4px 4px 1px;}.share-seg:only-child{border-radius:4px;}.share-seg::before{content:'';position:absolute;inset:-6px 0;}.share-seg:hover,.share-seg:focus-visible{box-shadow:0 0 0 2px var(--card);}.share-tip{display:none;position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);z-index:2;padding:4px 8px;border-radius:var(--radius-sm);background:var(--raise);border:1px solid var(--line2);box-shadow:0 4px 14px var(--shadow);color:var(--text);font-size:var(--font-size-sm);white-space:nowrap;pointer-events:none;}.share-seg[data-edge='start'] .share-tip,.share-seg:only-child .share-tip{left:0;transform:none;}.share-seg[data-edge='end'] .share-tip{left:auto;right:0;transform:none;}.share-seg:hover .share-tip,.share-seg:focus-visible .share-tip{display:block;}.share-names span{flex:0 1 0;min-width:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--font-size-sm);color:var(--text-muted);font-variant-numeric:tabular-nums;}.share-names b{font-weight:600;color:var(--text-2);}`,li=(e,t,n)=>e[t]?.count?.(n)??`${n} ${e[t]?.label??t}`;function ui(e,t=` | `){let n=e.filter(e=>typeof e==`string`?e:e.text);return n.length?j`${n.map((e,n)=>typeof e==`string`?j`${n?t:``}<span class="f">${e}</span>`:j`${n?t:``}<span class="f tone-text" data-tone=${z(e.tone)}>${e.text}</span>`)}`:N}var di=new Map;function fi(e,t,n={}){let r=di.get(e)??e;return t?j`<span class=${n.cls||N} part="icon" title=${t}><span aria-hidden="true">${r}</span><span class="sr">${t}</span></span>`:j`<span class=${n.cls||N} part="icon" aria-hidden="true">${r}</span>`}var pi=class{constructor(e,t){this.host=e,this.o=t,this.current=0,this.onFocus=e=>{let t=this.indexOf(e);t>=0&&t!==this.current&&this.set(t)},this.onKey=e=>{let t=this.o.items(),n=this.indexOf(e);if(n<0)return;let r=function(e,t,n,r){if(e<=0)return null;let i=n=>n===t||n<0||n>=e?null:n;if(r.layout===`grid`){let a=Math.max(1,r.cols??1),o=Math.floor(t/a)*a;switch(n){case`ArrowRight`:return(t+1)%a&&t+1<e?i(t+1):null;case`ArrowLeft`:return t%a?i(t-1):null;case`ArrowDown`:return i(t+a);case`ArrowUp`:return i(t-a);case`Home`:return i(r.ctrl?0:o);case`End`:return i(r.ctrl?e-1:Math.min(o+a,e)-1);default:return null}}let[a,o]=r.layout===`horizontal`?[`ArrowLeft`,`ArrowRight`]:[`ArrowUp`,`ArrowDown`],s=n=>i(r.wrap?(t+n+e)%e:t+n);switch(n){case o:return s(1);case a:return s(-1);case`Home`:return i(0);case`End`:return i(e-1);default:return null}}(t.length,n,e.key,{layout:this.o.layout,cols:this.o.columns?.(),wrap:this.o.wrap,ctrl:e.ctrlKey||e.metaKey}),i=r===null?void 0:t[r];r!==null&&i&&(e.preventDefault(),this.set(r),i.focus(),this.o.onMove?.(i,r))},e.addController(this)}hostConnected(){this.host.addEventListener(`keydown`,this.onKey),this.host.addEventListener(`focusin`,this.onFocus)}hostDisconnected(){this.host.removeEventListener(`keydown`,this.onKey),this.host.removeEventListener(`focusin`,this.onFocus)}hostUpdated(){this.sync()}set(e){this.current=e,this.sync()}sync(){let e=this.o.items();e.length&&(this.current=Math.min(Math.max(0,this.current),e.length-1),e.forEach((e,t)=>e.tabIndex=t===this.current?0:-1))}indexOf(e){return this.o.items().findIndex(t=>e.composedPath().includes(t))}};function mi(e,t,n,r=8){let i=Math.max(0,e.length-1),a=e[i]??0;if(!i||a<=0)return{from:0,to:i,padTop:0,padBottom:0};let o=Math.max(0,t),s=hi(e,o),c=hi(e,o+Math.max(0,n)),l=Math.max(0,s-r),u=Math.min(i,Math.max(l,c+1+r));return{from:l,to:u,padTop:e[l],padBottom:a-e[u]}}function hi(e,t){let n=0,r=e.length-1-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n}var{I:gi}=dn,_i=e=>e,vi=()=>document.createComment(``),yi=(e,t,n)=>{let r=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0)n=new gi(r.insertBefore(vi(),i),r.insertBefore(vi(),i),e,e.options);else{let t=n._$AB.nextSibling,a=n._$AM,o=a!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(t=e._$AU)!==a._$AU&&n._$AP(t)}if(t!==i||o){let e=n._$AA;for(;e!==t;){let t=_i(e).nextSibling;_i(r).insertBefore(e,i),e=t}}}return n},bi=(e,t,n=e)=>(e._$AI(t,n),e),xi={},Si=(e,t=xi)=>e._$AH=t,Ci=e=>{e._$AR(),e._$AA.remove()},wi=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},W=$r(class extends ei{constructor(e){if(super(e),e.type!==2)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){let i=(e=>e._$AH)(e),{values:a,keys:o}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=o,a;let s=this.ut??=[],c=[],l,u,d=0,f=i.length-1,p=0,m=a.length-1;for(;d<=f&&p<=m;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(s[d]===o[p])c[p]=bi(i[d],a[p]),d++,p++;else if(s[f]===o[m])c[m]=bi(i[f],a[m]),f--,m--;else if(s[d]===o[m])c[m]=bi(i[d],a[m]),yi(e,c[m+1],i[d]),d++,m--;else if(s[f]===o[p])c[p]=bi(i[f],a[p]),yi(e,i[d],i[f]),f--,p++;else if(l===void 0&&(l=wi(o,p,m),u=wi(s,d,f)),l.has(s[d])){if(l.has(s[f])){let t=u.get(o[p]),n=t===void 0?null:i[t];if(n===null){let t=yi(e,i[d]);bi(t,a[p]),c[p]=t}else c[p]=bi(n,a[p]),yi(e,i[d],n),i[t]=null;p++}else Ci(i[f]),f--}else Ci(i[d]),d++;for(;p<=m;){let t=yi(e,c[m+1]);bi(t,a[p]),c[p++]=t}for(;d<=f;){let e=i[d++];e!==null&&Ci(e)}return this.ut=o,Si(e,c),Xt}});function G(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}var Ti=class extends P{constructor(...e){super(...e),this.options=[],this.value=``,this.label=``,this.roving=new pi(this,{items:()=>[...this.renderRoot.querySelectorAll(`button:not(:disabled)`)??[]],layout:`horizontal`,wrap:!0,onMove:e=>this.choose(e.dataset.value??``)})}static{this.styles=[U,A` :host{display:inline-flex;vertical-align:middle;}.group{display:inline-flex;border:1px solid var(--line);border-radius:var(--cae-segmented-radius,6px);overflow:hidden;}button{min-width:22px;height:var(--cae-segmented-height,20px);line-height:var(--cae-segmented-height,20px);padding:var(--cae-segmented-padding,0 10px);margin:0;border:0;border-radius:0;background:none;font-size:var(--cae-segmented-font-size,11.5px);text-align:center;color:var(--text-muted);cursor:pointer;}button + button{border-left:var(--cae-segmented-divider,1px solid var(--line));}button:hover{color:var(--cae-segmented-hover,var(--text));}button[aria-checked='true']{background:var(--raise);color:var(--text);cursor:default;}button:disabled{opacity:0.5;cursor:default;}button:focus-visible{outline-offset:-2px;}`]}willUpdate(){let e=this.options.filter(e=>!e.disabled).findIndex(e=>e.value===this.value);e>=0&&(this.roving.current=e)}choose(e){e!==this.value&&(this.value=e,B(this,`cae-change`,{value:e}))}render(){return j`<div class="group" part="group" role="radiogroup" aria-label=${this.label||N}>
|
|
10
|
+
${W(this.options,e=>e.value,e=>{let t=e.value===this.value;return j`<button type="button" role="radio" part=${t?`option option-selected`:`option`} aria-checked=${t?`true`:`false`} data-value=${e.value} lang=${e.lang||N} title=${e.title||N} ?disabled=${!!e.disabled} @click=${()=>this.choose(e.value)}>${e.label}</button>`})}
|
|
11
|
+
</div>`}};G([I({attribute:!1})],Ti.prototype,`options`,void 0),G([I()],Ti.prototype,`value`,void 0),G([I()],Ti.prototype,`label`,void 0);var Ei=class extends P{constructor(...e){super(...e),this.open=1}static{this.styles=[U,Wr]}render(){return j`<div class="jtree" part="tree" data-scroll="x">${this.node(this.value,0)}</div>`}node(e,t){if(typeof e!=`object`||!e)return j`<span class=${typeof e==`string`?`js`:`jn`}>${JSON.stringify(e)??`undefined`}</span>`;let n=Array.isArray(e)?e.map((e,t)=>[t,e]):Object.entries(e);return n.length?j`${n.map(([e,n])=>(e=>typeof e!=`object`||!e||(Array.isArray(e)?!e.length:!Object.keys(e).length))(n)?j`<div class="jt"><span class="jk">${e}</span>: ${this.node(n,t+1)}</div>`:j`<details class="jt" ?open=${t<this.open}>
|
|
12
12
|
<summary>
|
|
13
13
|
<span class="jk">${e}</span>
|
|
14
14
|
<span class="meta">${Array.isArray(n)?`[${n.length}]`:`{${Object.keys(n).length}}`}</span>
|
|
15
15
|
</summary>
|
|
16
16
|
${this.node(n,t+1)}
|
|
17
|
-
</details>`)}`:Array.isArray(e)?`[]`:`{}`}};U([P({attribute:!1})],Ei.prototype,`value`,void 0),U([P({type:Number})],Ei.prototype,`open`,void 0);var Di=[`python`,`json`,`javascript`,`typescript`,`c`,`cpp`,`java`,`go`,`rust`,`shell`,`toml`,`yaml`,`sql`,`xml`,`diff`],W=e=>new Set(e.split(` `)),Oi=[`comment`,`//[^\\n]*|/\\*[\\s\\S]*?\\*/`],ki=`"(?:[^"\\\\\\n]|\\\\.)*"`,Ai=`'(?:[^'\\\\\\n]|\\\\.)*'`,ji=`'(?:[^'\\\\\\n]|\\\\.)'`,Mi=[`number`,`\\b(?:0[xX][\\da-fA-F_']+|0[bB][01_]+|\\d[\\d_']*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)[uUlLfFn]*\\b`],Ni=`break case catch class const continue debugger default delete do else export extends finally for from function if import in instanceof let new of return static super switch throw try typeof var void while with yield async await as`,Pi=`auto break case char const continue default do double else enum extern float for goto if inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while bool`,Fi={struct:`class`,class:`class`,enum:`class`,union:`class`},Ii={python:{rules:[[`comment`,`#[^\\n]*`],[`doc`,`(?:[rRbBfFuU]{0,2})(?:"""[\\s\\S]*?"""|'''[\\s\\S]*?''')`],[`string`,`(?:[rRbBfFuU]{0,2})(?:${ki}|${Ai})`],[`decorator`,`@[A-Za-z_][\\w.]*`],[`number`,`\\b\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],keywords:W(`and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case`),constants:W(`None True False self cls`),builtins:W(`str int float bool list dict set tuple bytes object type len range print isinstance super Optional Literal Any Union Path`),defines:{def:`function`,class:`class`},types:!0,name:`[A-Za-z_]\\w*`},json:{rules:[[`key`,`${ki}(?=\\s*:)`],[`string`,ki],[`comment`,`//[^\\n]*|/\\*[\\s\\S]*?\\*/`],[`number`,`-?\\b\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],constants:W(`true false null`),name:`[A-Za-z_]\\w*`},javascript:{rules:[Oi,[`string`,`${ki}|${Ai}|\`(?:[^\`\\\\]|\\\\.)*\``],[`decorator`,`@[A-Za-z_$][\\w$.]*`],Mi],keywords:W(Ni),constants:W(`true false null undefined this NaN Infinity`),builtins:W(`console Math JSON Promise Array Object String Number Boolean Map Set WeakMap Symbol Error Date RegExp BigInt globalThis window document`),defines:{function:`function`,class:`class`},types:!0},typescript:{rules:[Oi,[`string`,`${ki}|${Ai}|\`(?:[^\`\\\\]|\\\\.)*\``],[`decorator`,`@[A-Za-z_$][\\w$.]*`],Mi],keywords:W(`${Ni} interface type enum implements namespace declare abstract private protected public readonly keyof infer is satisfies module override`),constants:W(`true false null undefined this NaN Infinity`),builtins:W(`console Math JSON Promise Array Object String Number Boolean Map Set WeakMap Symbol Error Date RegExp BigInt globalThis string number boolean unknown never any void Record Partial Readonly`),defines:{function:`function`,class:`class`,interface:`class`,type:`class`,enum:`class`},types:!0},c:{rules:[[`meta`,`^[ \\t]*#[ \\t]*\\w+`],Oi,[`string`,`${ki}|${ji}`],Mi],keywords:W(Pi),constants:W(`NULL true false`),builtins:W(`printf fprintf malloc calloc realloc free size_t memcpy memset strlen strcmp FILE`),defines:Fi,types:!0},cpp:{rules:[[`meta`,`^[ \\t]*#[ \\t]*\\w+`],Oi,[`string`,`${ki}|${ji}`],Mi],keywords:W(`${Pi} alignas alignof catch class constexpr consteval const_cast decltype delete dynamic_cast explicit export friend mutable namespace new noexcept operator private protected public reinterpret_cast static_assert static_cast template this thread_local throw try typeid typename using virtual co_await co_return co_yield concept requires override final`),constants:W(`nullptr NULL true false`),builtins:W(`std string vector map set unordered_map array optional cout cerr endl unique_ptr shared_ptr make_unique make_shared size_t`),defines:Fi,types:!0},java:{rules:[Oi,[`string`,`"""[\\s\\S]*?"""|${ki}|${ji}`],[`decorator`,`@[A-Za-z_][\\w.]*`],Mi],keywords:W(`abstract assert boolean break byte case catch char class continue default do double else enum extends final finally float for if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while var record yield sealed permits`),constants:W(`true false null`),builtins:W(`String System Object Integer Long Double Boolean List Map Set Optional Exception RuntimeException`),defines:{class:`class`,interface:`class`,enum:`class`,record:`class`},types:!0},go:{rules:[Oi,[`string`,`${ki}|\`[^\`]*\`|${ji}`],Mi],keywords:W(`break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var`),constants:W(`true false nil iota`),builtins:W(`append cap close complex copy delete imag len make new panic print println real recover string int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 byte rune error bool float32 float64 any`),defines:{func:`function`,type:`class`},types:!0},rust:{rules:[Oi,[`string`,`b?r#*"[\\s\\S]*?"#*|b?"(?:[^"\\\\]|\\\\.)*"`],[`string`,`b?${ji}`],[`type`,`'[A-Za-z_]\\w*\\b(?!')`],[`decorator`,`#!?\\[[^\\]\\n]*\\]`],[`builtin`,`\\b[A-Za-z_]\\w*!(?=\\s*[\\[({])`],Mi],keywords:W(`as async await break const continue crate dyn else enum extern fn for if impl in let loop match mod move mut pub ref return self Self static struct super trait type unsafe use where while`),constants:W(`true false None Some Ok Err`),builtins:W(`Vec String Option Result Box Rc Arc HashMap str usize isize u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 bool char`),defines:{fn:`function`,struct:`class`,enum:`class`,trait:`class`,type:`class`},types:!0},shell:{rules:[[`comment`,`(?:^|(?<=\\s))#[^\\n]*`],[`string`,`"(?:[^"\\\\]|\\\\.)*"|'[^']*'`],[`builtin`,`\\$(?:\\{[^}\\n]*\\}|\\w+|[@*#?$!0-9-])`],[`number`,`\\b\\d+\\b`]],keywords:W(`if then else elif fi for while until do done case esac in function select return local export readonly declare set unset shift break continue exit source alias`),builtins:W(`echo cd printf read test eval exec trap pwd`),name:`[A-Za-z_][\\w-]*`},toml:{rules:[[`comment`,`#[^\\n]*`],[`class`,`^[ \\t]*\\[\\[?[^\\]\\n]*\\]\\]?`],[`key`,`^[ \\t]*[A-Za-z0-9_.\\-"']+(?=[ \\t]*=)`],[`string`,`"""[\\s\\S]*?"""|'''[\\s\\S]*?'''|${ki}|'[^'\\n]*'`],[`number`,`\\d{4}-\\d{2}-\\d{2}(?:[T ]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2})?)?`],[`number`,`[+-]?\\b\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],constants:W(`true false inf nan`),name:`[A-Za-z_]\\w*`},yaml:{rules:[[`comment`,`(?:^|(?<=\\s))#[^\\n]*`],[`meta`,`^(?:---|\\.\\.\\.)(?=\\s|$)`],[`key`,`[A-Za-z0-9_.\\-/]+(?=:(?:[ \\t]|$))`],[`string`,`${ki}|'(?:[^'\\n]|'')*'`],[`decorator`,`[&*][\\w-]+`],[`number`,`[+-]?\\b\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],constants:W(`true false null yes no on off True False Null`),name:`[A-Za-z_]\\w*`},sql:{rules:[[`comment`,`--[^\\n]*|/\\*[\\s\\S]*?\\*/`],[`string`,`'(?:[^']|'')*'`],[`key`,`"(?:[^"]|"")*"`],[`number`,`\\b\\d+(?:\\.\\d+)?\\b`]],keywords:W(`select from where and or not insert into values update set delete create table drop alter add column index primary key foreign references join left right inner outer full cross on as group by order having limit offset union all distinct case when then else end is in exists between like returning with view default unique constraint if begin commit rollback transaction asc desc`),constants:W(`true false null`),builtins:W(`count sum avg min max coalesce cast lower upper now integer int text varchar char boolean date timestamp real numeric bigint serial float double`),caseless:!0,name:`[A-Za-z_]\\w*`},xml:{rules:[[`comment`,`<!--[\\s\\S]*?-->`],[`meta`,`<\\?[\\s\\S]*?\\?>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|<![A-Za-z][^>]*>`],[`tag`,`</?[A-Za-z_][\\w:.-]*|/?>`],[`attribute`,`[A-Za-z_:][\\w:.-]*(?=\\s*=\\s*["'])`],[`string`,`(?<==\\s*)(?:"[^"]*"|'[^']*')`],[`constant`,`&#?\\w+;`]],name:null},diff:{rules:[[`meta`,`^(?:diff |index |--- |\\+\\+\\+ |@@)[^\\n]*`],[`inserted`,`^\\+[^\\n]*`],[`deleted`,`^-[^\\n]*`]],name:null}},Li={py:`python`,python3:`python`,pyi:`python`,pyw:`python`,jsonc:`json`,jsonl:`json`,json5:`json`,geojson:`json`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,node:`javascript`,ts:`typescript`,tsx:`typescript`,mts:`typescript`,cts:`typescript`,h:`c`,"c++":`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,hxx:`cpp`,golang:`go`,rs:`rust`,sh:`shell`,bash:`shell`,zsh:`shell`,ksh:`shell`,shellscript:`shell`,ini:`toml`,cfg:`toml`,yml:`yaml`,html:`xml`,htm:`xml`,xhtml:`xml`,svg:`xml`,plist:`xml`,xsd:`xml`,xsl:`xml`,patch:`diff`};function Ri(e){let t=String(e||``).trim().toLowerCase().replace(/^.*\//,``),n=e=>Di.includes(e)?e:Li[e]??``;return n(t)||(t.includes(`.`)?n(t.replace(/^.*\./,``)):``)}var zi=new Map;function Bi(e,t,n){let r=e.caseless?t.toLowerCase():t;return e.keywords?.has(r)?`keyword`:e.constants?.has(r)?`constant`:e.defines?.[n]||(e.builtins?.has(r)?`builtin`:e.types&&/^[A-Z]\w*$/.test(t)&&t.length>1&&/[a-z]/.test(t)?`type`:``)}function Vi(e,t){let n=Ri(t);if(!n||!e)return e?[{text:e,type:``}]:[];let r=Ii[n],i=function(e){let t=zi.get(e);if(!t){let n=Ii[e],r=n.rules.map(([,e])=>`(${e})`),i=n.name===void 0?`[A-Za-z_$][\\w$]*`:n.name;i&&r.push(`(${i})`),t=new RegExp(r.join(`|`),`gm`),zi.set(e,t)}return t}(n),a=[],o=(e,t)=>{if(!e)return;let n=a[a.length-1];n&&n.type===t?n.text+=e:a.push({text:e,type:t})},s=0,c=``;i.lastIndex=0;for(let t=i.exec(e);t;t=i.exec(e)){if(!t[0]){i.lastIndex++;continue}let n=e.slice(s,t.index);/\S/.test(n)&&(c=``),o(n,``),s=i.lastIndex;let a=t.findIndex((e,t)=>t>0&&e!==void 0)-1;a<r.rules.length?(o(t[0],r.rules[a][0]),c=``):(o(t[0],Bi(r,t[0],c)),c=t[0])}return o(e.slice(s),``),a}var Hi={comment:`hl-c`,doc:`hl-s hl-doc`,string:`hl-s`,number:`hl-n`,keyword:`hl-k`,constant:`hl-k hl-const`,builtin:`hl-b`,type:`hl-t`,function:`hl-f`,class:`hl-cls`,decorator:`hl-d`,key:`hl-key`,tag:`hl-tag`,attribute:`hl-attr`,inserted:`hl-ins`,deleted:`hl-del`,meta:`hl-meta`};function Ui(e){return e.map(e=>e.type?`<span class="${Hi[e.type]}">${Ar(e.text)}</span>`:Ar(e.text)).join(``)}function Wi(e,t){return Ui(Vi(e,t))}var Gi=class extends ei{constructor(e){if(super(e),this.it=j,e.type!==2)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===j||e==null)return this._t=void 0,this.it=e;if(e===Qt)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Gi.directiveName=`unsafeHTML`,Gi.resultType=1;var Ki=$r(Gi),qi={copy:`Copy`,copied:`Copied`,wrap:`Wrap lines`,empty:`No text`,cut:(e,t)=>`First ${e.toLocaleString(`en`)} of ${t.toLocaleString(`en`)} lines`},Ji=class extends M{constructor(...e){super(...e),this.code=``,this.language=``,this.start=1,this.highlight=[],this.path=``,this.label=``,this.wrap=!1,this.maxLines=5e3,this.maxCharacters=5e5,this.strings={},this.wrapped=!1,this.copied=!1}static{this.styles=[V,Wr,O` :host{display:block;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--well);overflow:hidden;}.head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;padding:4px 6px 4px 10px;border-bottom:1px solid var(--line);font-size:var(--font-size-sm);color:var(--text-2);}.path{font-family:var(--mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}.lang{color:var(--text-muted);}.tools{margin-left:auto;display:flex;gap:4px;flex:none;}.tools button{font-size:var(--font-size-sm);color:var(--text-2);border:1px solid var(--line2);border-radius:var(--radius-pill);padding:0 9px;cursor:pointer;background:none;}.tools button[aria-pressed='true']{background:var(--raise);color:var(--text);}.scroll{overflow:auto;max-height:var(--cae-code-max-height,70vh);font-family:var(--mono);font-size:var(--font-size-md);line-height:1.5;}.lines{display:block;min-width:max-content;padding:4px 0;}.wrap .lines{min-width:0;}.ln{display:flex;}.ln::before{content:attr(data-n);position:sticky;left:0;flex:none;box-sizing:border-box;width:calc(var(--digits) * 1ch + 22px);padding:0 10px 0 8px;text-align:right;color:var(--text-muted);background:var(--well);border-left:3px solid transparent;}.t{flex:1;white-space:pre;padding-right:12px;}.t:empty::after{content:' ';}.wrap .t{white-space:pre-wrap;overflow-wrap:anywhere;}.ln[data-mark]{background:color-mix(in srgb,var(--accent) 6%,transparent);}.hl-doc{opacity:1;}.ln[data-mark]::before{border-left-color:var(--accent);color:var(--text);background:color-mix(in srgb,var(--accent) 14%,var(--well));}.cut,.empty{padding:4px 10px;font-size:var(--font-size-sm);color:var(--text-muted);border-top:1px solid var(--line);}.empty{border-top:0;}`]}willUpdate(e){e.has(`wrap`)&&(this.wrapped=this.wrap),e.has(`code`)&&(this.copied=!1)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.copiedTimer)}async copy(){try{await navigator.clipboard.writeText(this.code)}catch{return}this.copied=!0,clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout(()=>this.copied=!1,1500)}render(){let e=kr(qi,this.strings),t=Ri(this.language),{shown:n,lines:r,total:i,cut:a}=function(e,t,n){let r=e.endsWith(`
|
|
17
|
+
</details>`)}`:Array.isArray(e)?`[]`:`{}`}};G([I({attribute:!1})],Ei.prototype,`value`,void 0),G([I({type:Number})],Ei.prototype,`open`,void 0);var Di=[`python`,`json`,`javascript`,`typescript`,`c`,`cpp`,`java`,`go`,`rust`,`shell`,`toml`,`yaml`,`sql`,`xml`,`diff`],K=e=>new Set(e.split(` `)),Oi=[`comment`,`//[^\\n]*|/\\*[\\s\\S]*?\\*/`],ki=`"(?:[^"\\\\\\n]|\\\\.)*"`,Ai=`'(?:[^'\\\\\\n]|\\\\.)*'`,ji=`'(?:[^'\\\\\\n]|\\\\.)'`,Mi=[`number`,`\\b(?:0[xX][\\da-fA-F_']+|0[bB][01_]+|\\d[\\d_']*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)[uUlLfFn]*\\b`],Ni=`break case catch class const continue debugger default delete do else export extends finally for from function if import in instanceof let new of return static super switch throw try typeof var void while with yield async await as`,Pi=`auto break case char const continue default do double else enum extern float for goto if inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while bool`,Fi={struct:`class`,class:`class`,enum:`class`,union:`class`},Ii={python:{rules:[[`comment`,`#[^\\n]*`],[`doc`,`(?:[rRbBfFuU]{0,2})(?:"""[\\s\\S]*?"""|'''[\\s\\S]*?''')`],[`string`,`(?:[rRbBfFuU]{0,2})(?:${ki}|${Ai})`],[`decorator`,`@[A-Za-z_][\\w.]*`],[`number`,`\\b\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],keywords:K(`and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case`),constants:K(`None True False self cls`),builtins:K(`str int float bool list dict set tuple bytes object type len range print isinstance super Optional Literal Any Union Path`),defines:{def:`function`,class:`class`},types:!0,name:`[A-Za-z_]\\w*`},json:{rules:[[`key`,`${ki}(?=\\s*:)`],[`string`,ki],[`comment`,`//[^\\n]*|/\\*[\\s\\S]*?\\*/`],[`number`,`-?\\b\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],constants:K(`true false null`),name:`[A-Za-z_]\\w*`},javascript:{rules:[Oi,[`string`,`${ki}|${Ai}|\`(?:[^\`\\\\]|\\\\.)*\``],[`decorator`,`@[A-Za-z_$][\\w$.]*`],Mi],keywords:K(Ni),constants:K(`true false null undefined this NaN Infinity`),builtins:K(`console Math JSON Promise Array Object String Number Boolean Map Set WeakMap Symbol Error Date RegExp BigInt globalThis window document`),defines:{function:`function`,class:`class`},types:!0},typescript:{rules:[Oi,[`string`,`${ki}|${Ai}|\`(?:[^\`\\\\]|\\\\.)*\``],[`decorator`,`@[A-Za-z_$][\\w$.]*`],Mi],keywords:K(`${Ni} interface type enum implements namespace declare abstract private protected public readonly keyof infer is satisfies module override`),constants:K(`true false null undefined this NaN Infinity`),builtins:K(`console Math JSON Promise Array Object String Number Boolean Map Set WeakMap Symbol Error Date RegExp BigInt globalThis string number boolean unknown never any void Record Partial Readonly`),defines:{function:`function`,class:`class`,interface:`class`,type:`class`,enum:`class`},types:!0},c:{rules:[[`meta`,`^[ \\t]*#[ \\t]*\\w+`],Oi,[`string`,`${ki}|${ji}`],Mi],keywords:K(Pi),constants:K(`NULL true false`),builtins:K(`printf fprintf malloc calloc realloc free size_t memcpy memset strlen strcmp FILE`),defines:Fi,types:!0},cpp:{rules:[[`meta`,`^[ \\t]*#[ \\t]*\\w+`],Oi,[`string`,`${ki}|${ji}`],Mi],keywords:K(`${Pi} alignas alignof catch class constexpr consteval const_cast decltype delete dynamic_cast explicit export friend mutable namespace new noexcept operator private protected public reinterpret_cast static_assert static_cast template this thread_local throw try typeid typename using virtual co_await co_return co_yield concept requires override final`),constants:K(`nullptr NULL true false`),builtins:K(`std string vector map set unordered_map array optional cout cerr endl unique_ptr shared_ptr make_unique make_shared size_t`),defines:Fi,types:!0},java:{rules:[Oi,[`string`,`"""[\\s\\S]*?"""|${ki}|${ji}`],[`decorator`,`@[A-Za-z_][\\w.]*`],Mi],keywords:K(`abstract assert boolean break byte case catch char class continue default do double else enum extends final finally float for if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while var record yield sealed permits`),constants:K(`true false null`),builtins:K(`String System Object Integer Long Double Boolean List Map Set Optional Exception RuntimeException`),defines:{class:`class`,interface:`class`,enum:`class`,record:`class`},types:!0},go:{rules:[Oi,[`string`,`${ki}|\`[^\`]*\`|${ji}`],Mi],keywords:K(`break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var`),constants:K(`true false nil iota`),builtins:K(`append cap close complex copy delete imag len make new panic print println real recover string int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 byte rune error bool float32 float64 any`),defines:{func:`function`,type:`class`},types:!0},rust:{rules:[Oi,[`string`,`b?r#*"[\\s\\S]*?"#*|b?"(?:[^"\\\\]|\\\\.)*"`],[`string`,`b?${ji}`],[`type`,`'[A-Za-z_]\\w*\\b(?!')`],[`decorator`,`#!?\\[[^\\]\\n]*\\]`],[`builtin`,`\\b[A-Za-z_]\\w*!(?=\\s*[\\[({])`],Mi],keywords:K(`as async await break const continue crate dyn else enum extern fn for if impl in let loop match mod move mut pub ref return self Self static struct super trait type unsafe use where while`),constants:K(`true false None Some Ok Err`),builtins:K(`Vec String Option Result Box Rc Arc HashMap str usize isize u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 bool char`),defines:{fn:`function`,struct:`class`,enum:`class`,trait:`class`,type:`class`},types:!0},shell:{rules:[[`comment`,`(?:^|(?<=\\s))#[^\\n]*`],[`string`,`"(?:[^"\\\\]|\\\\.)*"|'[^']*'`],[`builtin`,`\\$(?:\\{[^}\\n]*\\}|\\w+|[@*#?$!0-9-])`],[`number`,`\\b\\d+\\b`]],keywords:K(`if then else elif fi for while until do done case esac in function select return local export readonly declare set unset shift break continue exit source alias`),builtins:K(`echo cd printf read test eval exec trap pwd`),name:`[A-Za-z_][\\w-]*`},toml:{rules:[[`comment`,`#[^\\n]*`],[`class`,`^[ \\t]*\\[\\[?[^\\]\\n]*\\]\\]?`],[`key`,`^[ \\t]*[A-Za-z0-9_.\\-"']+(?=[ \\t]*=)`],[`string`,`"""[\\s\\S]*?"""|'''[\\s\\S]*?'''|${ki}|'[^'\\n]*'`],[`number`,`\\d{4}-\\d{2}-\\d{2}(?:[T ]\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2})?)?`],[`number`,`[+-]?\\b\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],constants:K(`true false inf nan`),name:`[A-Za-z_]\\w*`},yaml:{rules:[[`comment`,`(?:^|(?<=\\s))#[^\\n]*`],[`meta`,`^(?:---|\\.\\.\\.)(?=\\s|$)`],[`key`,`[A-Za-z0-9_.\\-/]+(?=:(?:[ \\t]|$))`],[`string`,`${ki}|'(?:[^'\\n]|'')*'`],[`decorator`,`[&*][\\w-]+`],[`number`,`[+-]?\\b\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b`]],constants:K(`true false null yes no on off True False Null`),name:`[A-Za-z_]\\w*`},sql:{rules:[[`comment`,`--[^\\n]*|/\\*[\\s\\S]*?\\*/`],[`string`,`'(?:[^']|'')*'`],[`key`,`"(?:[^"]|"")*"`],[`number`,`\\b\\d+(?:\\.\\d+)?\\b`]],keywords:K(`select from where and or not insert into values update set delete create table drop alter add column index primary key foreign references join left right inner outer full cross on as group by order having limit offset union all distinct case when then else end is in exists between like returning with view default unique constraint if begin commit rollback transaction asc desc`),constants:K(`true false null`),builtins:K(`count sum avg min max coalesce cast lower upper now integer int text varchar char boolean date timestamp real numeric bigint serial float double`),caseless:!0,name:`[A-Za-z_]\\w*`},xml:{rules:[[`comment`,`<!--[\\s\\S]*?-->`],[`meta`,`<\\?[\\s\\S]*?\\?>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|<![A-Za-z][^>]*>`],[`tag`,`</?[A-Za-z_][\\w:.-]*|/?>`],[`attribute`,`[A-Za-z_:][\\w:.-]*(?=\\s*=\\s*["'])`],[`string`,`(?<==\\s*)(?:"[^"]*"|'[^']*')`],[`constant`,`&#?\\w+;`]],name:null},diff:{rules:[[`meta`,`^(?:diff |index |--- |\\+\\+\\+ |@@)[^\\n]*`],[`inserted`,`^\\+[^\\n]*`],[`deleted`,`^-[^\\n]*`]],name:null}},Li={py:`python`,python3:`python`,pyi:`python`,pyw:`python`,jsonc:`json`,jsonl:`json`,json5:`json`,geojson:`json`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,node:`javascript`,ts:`typescript`,tsx:`typescript`,mts:`typescript`,cts:`typescript`,h:`c`,"c++":`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,hxx:`cpp`,golang:`go`,rs:`rust`,sh:`shell`,bash:`shell`,zsh:`shell`,ksh:`shell`,shellscript:`shell`,ini:`toml`,cfg:`toml`,yml:`yaml`,html:`xml`,htm:`xml`,xhtml:`xml`,svg:`xml`,plist:`xml`,xsd:`xml`,xsl:`xml`,patch:`diff`};function Ri(e){let t=String(e||``).trim().toLowerCase().replace(/^.*\//,``),n=e=>Di.includes(e)?e:Li[e]??``;return n(t)||(t.includes(`.`)?n(t.replace(/^.*\./,``)):``)}var zi=new Map;function Bi(e,t,n){let r=e.caseless?t.toLowerCase():t;return e.keywords?.has(r)?`keyword`:e.constants?.has(r)?`constant`:e.defines?.[n]||(e.builtins?.has(r)?`builtin`:e.types&&/^[A-Z]\w*$/.test(t)&&t.length>1&&/[a-z]/.test(t)?`type`:``)}function Vi(e,t){let n=Ri(t);if(!n||!e)return e?[{text:e,type:``}]:[];let r=Ii[n],i=function(e){let t=zi.get(e);if(!t){let n=Ii[e],r=n.rules.map(([,e])=>`(${e})`),i=n.name===void 0?`[A-Za-z_$][\\w$]*`:n.name;i&&r.push(`(${i})`),t=new RegExp(r.join(`|`),`gm`),zi.set(e,t)}return t}(n),a=[],o=(e,t)=>{if(!e)return;let n=a[a.length-1];n&&n.type===t?n.text+=e:a.push({text:e,type:t})},s=0,c=``;i.lastIndex=0;for(let t=i.exec(e);t;t=i.exec(e)){if(!t[0]){i.lastIndex++;continue}let n=e.slice(s,t.index);/\S/.test(n)&&(c=``),o(n,``),s=i.lastIndex;let a=t.findIndex((e,t)=>t>0&&e!==void 0)-1;a<r.rules.length?(o(t[0],r.rules[a][0]),c=``):(o(t[0],Bi(r,t[0],c)),c=t[0])}return o(e.slice(s),``),a}var Hi={comment:`hl-c`,doc:`hl-s hl-doc`,string:`hl-s`,number:`hl-n`,keyword:`hl-k`,constant:`hl-k hl-const`,builtin:`hl-b`,type:`hl-t`,function:`hl-f`,class:`hl-cls`,decorator:`hl-d`,key:`hl-key`,tag:`hl-tag`,attribute:`hl-attr`,inserted:`hl-ins`,deleted:`hl-del`,meta:`hl-meta`};function Ui(e){return e.map(e=>e.type?`<span class="${Hi[e.type]}">${Ar(e.text)}</span>`:Ar(e.text)).join(``)}function Wi(e,t){return Ui(Vi(e,t))}var Gi=class extends ei{constructor(e){if(super(e),this.it=N,e.type!==2)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===N||e==null)return this._t=void 0,this.it=e;if(e===Xt)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Gi.directiveName=`unsafeHTML`,Gi.resultType=1;var Ki=$r(Gi),qi={copy:`Copy`,copied:`Copied`,wrap:`Wrap lines`,empty:`No text`,cut:(e,t)=>`First ${e.toLocaleString(`en`)} of ${t.toLocaleString(`en`)} lines`},Ji=class extends P{constructor(...e){super(...e),this.code=``,this.language=``,this.start=1,this.highlight=[],this.path=``,this.label=``,this.wrap=!1,this.maxLines=5e3,this.maxCharacters=5e5,this.strings={},this.wrapped=!1,this.copied=!1}static{this.styles=[U,Wr,A` :host{display:block;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--well);overflow:hidden;}.head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;padding:4px 6px 4px 10px;border-bottom:1px solid var(--line);font-size:var(--font-size-sm);color:var(--text-2);}.path{font-family:var(--mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}.lang{color:var(--text-muted);}.tools{margin-left:auto;display:flex;gap:4px;flex:none;}.tools button{font-size:var(--font-size-sm);color:var(--text-2);border:1px solid var(--line2);border-radius:var(--radius-pill);padding:0 9px;cursor:pointer;background:none;}.tools button[aria-pressed='true']{background:var(--raise);color:var(--text);}.scroll{overflow:auto;max-height:var(--cae-code-max-height,70vh);font-family:var(--mono);font-size:var(--font-size-md);line-height:1.5;}.lines{display:block;min-width:max-content;padding:4px 0;}.wrap .lines{min-width:0;}.ln{display:flex;}.ln::before{content:attr(data-n);position:sticky;left:0;flex:none;box-sizing:border-box;width:calc(var(--digits) * 1ch + 22px);padding:0 10px 0 8px;text-align:right;color:var(--text-muted);background:var(--well);border-left:3px solid transparent;}.t{flex:1;white-space:pre;padding-right:12px;}.t:empty::after{content:' ';}.wrap .t{white-space:pre-wrap;overflow-wrap:anywhere;}.ln[data-mark]{background:color-mix(in srgb,var(--accent) 6%,transparent);}.hl-doc{opacity:1;}.ln[data-mark]::before{border-left-color:var(--accent);color:var(--text);background:color-mix(in srgb,var(--accent) 14%,var(--well));}.cut,.empty{padding:4px 10px;font-size:var(--font-size-sm);color:var(--text-muted);border-top:1px solid var(--line);}.empty{border-top:0;}`]}willUpdate(e){e.has(`wrap`)&&(this.wrapped=this.wrap),e.has(`code`)&&(this.copied=!1)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.copiedTimer)}async copy(){try{await navigator.clipboard.writeText(this.code)}catch{return}this.copied=!0,clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout(()=>this.copied=!1,1500)}render(){let e=kr(qi,this.strings),t=Ri(this.language),{shown:n,lines:r,total:i,cut:a}=function(e,t,n){let r=e.endsWith(`
|
|
18
18
|
`)?e.slice(0,-1):e,i=r||e?1:0;for(let e=r.indexOf(`
|
|
19
19
|
`);e>=0;e=r.indexOf(`
|
|
20
20
|
`,e+1))i++;let a=0,o=0;for(;o<Math.max(1,t);){let e=r.indexOf(`
|
|
21
21
|
`,a),t=e<0?r.length:e;if(o>0&&t>n)break;if(o++,e<0){a=r.length;break}a=e+1}let s=o>=i?r:r.slice(0,a-1);return s.length>n&&(s=s.slice(0,n)),{shown:s,lines:i?o:0,total:i,cut:s.length<r.length}}(this.code,this.maxLines,this.maxCharacters),o=this.start+Math.max(r,1)-1,s=function(e){let t=[[]];for(let n of e)n.text.split(`
|
|
22
|
-
`).forEach((e,r)=>{r>0&&t.push([]),e&&t[t.length-1].push({text:e,type:n.type})});return t}(Vi(n,t)).map((e,t)=>{let n=this.start+t;return`<div class="ln" data-n="${n}"${function(e,t){return e.some(e=>typeof e==`number`?e===t:t>=e[0]&&t<=e[1])}(this.highlight,n)?` data-mark=""`:``}><span class="t">${Ui(e)}</span></div>`}).join(``);return
|
|
23
|
-
${this.path?
|
|
24
|
-
${t?
|
|
22
|
+
`).forEach((e,r)=>{r>0&&t.push([]),e&&t[t.length-1].push({text:e,type:n.type})});return t}(Vi(n,t)).map((e,t)=>{let n=this.start+t;return`<div class="ln" data-n="${n}"${function(e,t){return e.some(e=>typeof e==`number`?e===t:t>=e[0]&&t<=e[1])}(this.highlight,n)?` data-mark=""`:``}><span class="t">${Ui(e)}</span></div>`}).join(``);return j`<div class="head" part="header">
|
|
23
|
+
${this.path?j`<span class="path" title=${this.path}>${this.path}</span>`:N}
|
|
24
|
+
${t?j`<span class="lang">${t}</span>`:N}
|
|
25
25
|
<span class="tools">
|
|
26
26
|
<button type="button" aria-pressed=${this.wrapped?`true`:`false`} @click=${()=>this.wrapped=!this.wrapped}>${e.wrap}</button>
|
|
27
27
|
<button type="button" ?disabled=${!this.code} @click=${()=>{this.copy()}}>${this.copied?e.copied:e.copy}</button>
|
|
28
28
|
</span>
|
|
29
29
|
<span class="sr" role="status">${this.copied?e.copied:``}</span>
|
|
30
30
|
</div>
|
|
31
|
-
${this.code?
|
|
31
|
+
${this.code?j`<div class="scroll ${this.wrapped?`wrap`:``}" part="code" data-scroll=${this.wrapped?`y`:`x`} tabindex="0" role=${this.label||this.path?`region`:N} aria-label=${this.label||this.path||N} style="--digits: ${String(o).length}">
|
|
32
32
|
<code class="lines hl">${Ki(s)}</code>
|
|
33
33
|
</div>
|
|
34
|
-
${a?
|
|
34
|
+
${a?j`<div class="cut" part="cut">${e.cut(r,i)}</div>`:N}`:j`<div class="empty">${e.empty}</div>`}`}};function Yi(e){return e.replace(/`([^`\n]+)`/g,`<code>$1</code>`).replace(/\*\*([^*\n]+)\*\*/g,`<b>$1</b>`).replace(/(^|[^*\w])\*([^*\n]+)\*(?!\w)/g,`$1<i>$2</i>`).replace(/\[([^\]\n]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a class="lnk" href="$2" target="_blank" rel="noopener">$1</a>`)}G([I()],Ji.prototype,`code`,void 0),G([I()],Ji.prototype,`language`,void 0),G([I({type:Number})],Ji.prototype,`start`,void 0),G([I({attribute:!1})],Ji.prototype,`highlight`,void 0),G([I()],Ji.prototype,`path`,void 0),G([I()],Ji.prototype,`label`,void 0),G([I({type:Boolean})],Ji.prototype,`wrap`,void 0),G([I({type:Number})],Ji.prototype,`maxLines`,void 0),G([I({type:Number})],Ji.prototype,`maxCharacters`,void 0),G([I({attribute:!1})],Ji.prototype,`strings`,void 0),G([L()],Ji.prototype,`wrapped`,void 0),G([L()],Ji.prototype,`copied`,void 0);var Xi=/^\s*\|.*\|\s*$/;function Zi(e){return function(e){let t=[],n=0;for(;;){let r=e.indexOf("```",n);if(r<0)return t.push({t:`text`,s:e.slice(n)}),t;t.push({t:`text`,s:e.slice(n,r)});let i=e.indexOf(`
|
|
35
35
|
`,r+3),a=e.slice(r+3,i<0?e.length:i).trim(),o=i<0?e.length:i+1,s=e.indexOf("```",o);if(s<0)return t.push({t:`code`,s:e.slice(o),lang:a}),t;t.push({t:`code`,s:e.slice(o,s),lang:a}),n=s+3}}(String(e||``)).map(e=>{if(e.t===`code`)return`<pre><code class="hl">${Wi(e.s,e.lang)}</code></pre>`;let t=Ar(e.s).split(`
|
|
36
36
|
`),n=[];for(let e=0;e<t.length;e++){let r=t[e]??``,i;if(i=r.match(/^(#{1,6})\s+(.*)$/))n.push(`<div class="md-h md-h${Math.min(i[1].length,4)}">${Yi(i[2])}</div>`);else if(/^\s*(-{3,}|\*{3,})\s*$/.test(r))n.push(`<hr class="md-hr">`);else if(i=r.match(/^\s*>\s?(.*)$/))n.push(`<div class="md-q">${Yi(i[1])}</div>`);else if(i=r.match(/^\s*[-*]\s+(.*)$/))n.push(`<div class="md-li">${Yi(i[1])}</div>`);else if(i=r.match(/^\s*(\d+)[.)]\s+(.*)$/))n.push(`<div class="md-li md-ol"><span class="md-n">${i[1]}.</span>${Yi(i[2])}</div>`);else if(Xi.test(r)&&/^\s*\|[\s:|-]+\|\s*$/.test(t[e+1]??``)){let i=e=>e.trim().replace(/^\||\|$/g,``).split(`|`).map(e=>Yi(e.trim())),a=i(r);e+=2;let o=[];for(;e<t.length&&Xi.test(t[e]??``);)o.push(i(t[e++]??``));e--,n.push(`<table class="md-t"><tr>${a.map(e=>`<th>${e}</th>`).join(``)}</tr>`+o.map(e=>`<tr>${e.map(e=>`<td>${e}</td>`).join(``)}</tr>`).join(``)+`</table>`)}else n.push(r.trim()===``?`<div class="md-gap"></div>`:`<div class="md-p">${Yi(r)}</div>`)}return n.join(``)}).join(``)}function Qi(e,t){let n=String(e||``),r=n.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/),i=``,a=n;if(r){a=r[2]??``;let e=(r[1]??``).split(`
|
|
37
|
-
`).map(e=>e.match(/^([\w-]+):\s*(.*)$/)).filter(e=>!!e).map(([,e,t])=>`<tr><td class="jmono">${Ar(e)}</td><td>${Ar(t)}</td></tr>`).join(``);i=e?`<table class="md-front">${e}</table>`:``}let o=Zi(a);return`<div class="md-doc">${i}${t?t(o):o}</div>`}var $i={showRendered:`Show rendered`,showSource:`Show source`},ea=class extends
|
|
37
|
+
`).map(e=>e.match(/^([\w-]+):\s*(.*)$/)).filter(e=>!!e).map(([,e,t])=>`<tr><td class="jmono">${Ar(e)}</td><td>${Ar(t)}</td></tr>`).join(``);i=e?`<table class="md-front">${e}</table>`:``}let o=Zi(a);return`<div class="md-doc">${i}${t?t(o):o}</div>`}var $i={showRendered:`Show rendered`,showSource:`Show source`},ea=class extends P{constructor(...e){super(...e),this.text=``,this.strings={},this.source=!1}static{this.styles=[U,Wr,A` :host{display:block;}.md-p,.md-h,.md-li,.md-q{overflow-wrap:anywhere;}.bar{display:flex;justify-content:flex-end;margin-bottom:4px;}`]}render(){let e=kr($i,this.strings),{head:t,body:n}=this.split?.(this.text)??{head:``,body:this.text},r=Qi(n,this.transform);return j`<div class="bar">
|
|
38
38
|
<button type="button" class="df-tog" part="toggle" @click=${()=>this.source=!this.source}>
|
|
39
39
|
${this.source?e.showRendered:e.showSource}</button>
|
|
40
40
|
</div>
|
|
41
|
-
${this.source?
|
|
41
|
+
${this.source?j`<pre class="df-text">${this.text}</pre>`:j`${t?j`<div class="md-tele jmono">${t}</div>`:N}${Ki(r)}`}`}};G([I()],ea.prototype,`text`,void 0),G([I({attribute:!1})],ea.prototype,`split`,void 0),G([I({attribute:!1})],ea.prototype,`transform`,void 0),G([I({attribute:!1})],ea.prototype,`strings`,void 0),G([L()],ea.prototype,`source`,void 0);var ta={empty:`No items`},na=e=>!!e.children?.length,ra=e=>e.selectable??!na(e);function ia(e,t){for(let n of e){if(n.id===t)return[];let e=n.children?ia(n.children,t):null;if(e)return[n.id,...e]}return null}var aa=M`<path d="M1.5 3.5h4l1.5 1.5h7.5v8h-13z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"></path>`,oa=M`<path d="M3.5 1.5h6l3 3v10h-9z M9.5 1.5v3h3" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"></path>`,sa=class extends P{constructor(...e){super(...e),this.items=[],this.selected=null,this.label=``,this.strings={},this.opened=new Map,this.focusId=null,this.isOpen=e=>this.opened.get(e.id)??e.open??!0}static{this.styles=[U,A` :host{display:block;font-size:var(--font-size-md);}.tree{margin:0;padding:2px 0;}.row{display:flex;align-items:center;gap:4px;min-height:24px;padding:0 8px 0 calc((var(--level) - 1) * 14px + 4px);border-radius:var(--radius-sm);cursor:pointer;white-space:nowrap;color:var(--text-2);}.row:hover{background:var(--raise);}.row[aria-selected='true']{background:color-mix(in srgb,var(--accent) 16%,transparent);color:var(--text);box-shadow:inset 2px 0 0 var(--accent);}.row:focus-visible{outline-offset:-2px;}.twist{flex:none;display:inline-grid;place-items:center;width:16px;height:16px;color:var(--text-muted);border-radius:var(--radius-sm);}.twist svg{transition:transform 0.12s ease;}[aria-expanded='true']>.twist svg{transform:rotate(90deg);}.twist:hover{color:var(--text);}.icon{flex:none;width:16px;height:16px;color:var(--text-muted);}.name{overflow:hidden;text-overflow:ellipsis;min-width:0;}.badge{flex:none;margin-left:6px;font-size:11px;padding:0 6px;border-radius:var(--radius-pill);background:var(--raise);color:var(--text-2);}.badge[data-tone]{background:var(--tone-bg);color:var(--tone);}.badge[data-tone='done']{background:none;color:var(--text-2);}.empty{color:var(--text-muted);font-size:var(--font-size-sm);padding:4px 8px;}@media (prefers-reduced-motion:reduce){.twist svg{transition:none;}}`]}willUpdate(e){if(e.has(`selected`)&&this.selected){let e=ia(this.items,this.selected);if(e?.some(e=>!0!==this.opened.get(e))){let t=new Map(this.opened);for(let n of e)t.set(n,!0);this.opened=t}}}updated(e){e.has(`selected`)&&this.selected&&!this.matches(`:focus-within`)&&this.rowOf(this.selected)?.scrollIntoView?.({block:`nearest`})}rowOf(e){return this.renderRoot.querySelector(`[data-id="${CSS.escape(e)}"]`)}setOpen(e,t){na(e)&&this.isOpen(e)!==t&&(this.opened=new Map(this.opened).set(e.id,t),B(this,`cae-toggle`,{id:e.id,open:t}))}choose(e){this.focusId=e.id,ra(e)?B(this,`cae-select`,{id:e.id}):this.setOpen(e,!this.isOpen(e))}async moveTo(e){this.focusId=e,await this.updateComplete,this.rowOf(e)?.focus()}onKey(e,t,n){let r=t[n],i=r.item,a;switch(e.key){case`ArrowDown`:a=t[n+1];break;case`ArrowUp`:a=t[n-1];break;case`Home`:a=t[0];break;case`End`:a=t[t.length-1];break;case`ArrowRight`:na(i)&&!this.isOpen(i)?this.setOpen(i,!0):na(i)&&(a=t[n+1]);break;case`ArrowLeft`:na(i)&&this.isOpen(i)?this.setOpen(i,!1):r.parent&&(a=t.find(e=>e.item.id===r.parent));break;case`Enter`:case` `:this.choose(i);break;default:{if(e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey||!/\S/.test(e.key))return;let r=e.key.toLowerCase();if(a=[...t.slice(n+1),...t.slice(0,n)].find(e=>e.item.name.toLowerCase().startsWith(r)),!a)return}}e.preventDefault(),a&&this.moveTo(a.item.id)}render(){if(!this.items.length)return j`<div class="empty" part="empty">${kr(ta,this.strings).empty}</div>`;let e=function(e,t){let n=[],r=(e,i,a)=>e.forEach((o,s)=>{n.push({item:o,level:i,parent:a,index:s,siblings:e.length}),na(o)&&t(o)&&r(o.children,i+1,o.id)});return r(e,1,null),n}(this.items,this.isOpen),t=e.find(e=>e.item.id===this.focusId)??e.find(e=>e.item.id===this.selected)??e[0];return j`<div class="tree" role="tree" part="tree" aria-label=${this.label||N}>
|
|
42
42
|
${e.map((n,r)=>this.row(n,r,e,n===t))}
|
|
43
|
-
</div>`}row(e,t,n,r){let i=e.item,a=na(i),o=a&&this.isOpen(i),s=(i.icon??(a?`directory`:`file`))===`directory`;return
|
|
44
|
-
<span class="twist" aria-hidden="true" @click=${e=>{a&&(e.stopPropagation(),this.focusId=i.id,this.setOpen(i,!o))}}>${a?
|
|
43
|
+
</div>`}row(e,t,n,r){let i=e.item,a=na(i),o=a&&this.isOpen(i),s=(i.icon??(a?`directory`:`file`))===`directory`;return j`<div class="row" part="item" role="treeitem" data-id=${i.id} tabindex=${r?0:-1} style="--level: ${e.level}" aria-level=${e.level} aria-setsize=${e.siblings} aria-posinset=${e.index+1} aria-expanded=${a?String(o):N} aria-selected=${ra(i)?String(i.id===this.selected):N} @click=${()=>this.choose(i)} @focus=${()=>this.focusId=i.id} @keydown=${e=>this.onKey(e,n,t)} >
|
|
44
|
+
<span class="twist" aria-hidden="true" @click=${e=>{a&&(e.stopPropagation(),this.focusId=i.id,this.setOpen(i,!o))}}>${a?j`<svg width="10" height="10" viewBox="0 0 10 10"><path d="M3 1.5 7 5 3 8.5" fill="none" stroke="currentColor" stroke-width="1.5"></path></svg>`:N}</span>
|
|
45
45
|
<svg class="icon" viewBox="0 0 16 16" aria-hidden="true">${s?aa:oa}</svg>
|
|
46
46
|
<span class="name">${i.name}</span>
|
|
47
|
-
${i.badge?Qr(`badge`,{text:i.badge,tone:i.tone??`neutral`}):
|
|
48
|
-
</div>`}};
|
|
49
|
-
${this.columns.map(r=>r.id===n?
|
|
50
|
-
</tr>`}render(){let e=kr(ua,this.strings),t=this.rows.length,n=this.columns.map(e=>e.width??`minmax(0, 1fr)`).join(` `),r=this.columns.find(e=>e.rowHeader)?.id,i=this.windowed?this.range.from:0,a=this.shown(),o=this.windowed?this.rowStarts():null,s=o?o[i]:0,c=o?o[t]-o[i+a.length]:0;return
|
|
47
|
+
${i.badge?Qr(`badge`,{text:i.badge,tone:i.tone??`neutral`}):N}
|
|
48
|
+
</div>`}};G([I({attribute:!1})],sa.prototype,`items`,void 0),G([I({attribute:!1})],sa.prototype,`selected`,void 0),G([I()],sa.prototype,`label`,void 0),G([I({attribute:!1})],sa.prototype,`strings`,void 0),G([L()],sa.prototype,`opened`,void 0),G([L()],sa.prototype,`focusId`,void 0);var ca=class extends P{constructor(...e){super(...e),this.value=0,this.shown=0,this.frame=0}createRenderRoot(){return this}willUpdate(e){if(!e.has(`value`))return;let t=this.shown,n=this.value;if(cancelAnimationFrame(this.frame),globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||t===n||!Number.isFinite(n)||!this.isConnected)return void(this.shown=n);let r=performance.now(),i=e=>{let a=Math.min(1,(e-r)/700);this.shown=Math.round(t+(n-t)*(1-(1-a)**3)),a<1&&(this.frame=requestAnimationFrame(i))};this.frame=requestAnimationFrame(i)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.frame),this.shown=this.value}render(){return String(this.shown)}};G([I({type:Number})],ca.prototype,`value`,void 0),G([L()],ca.prototype,`shown`,void 0);var la=class extends P{constructor(){super(),this.since=0,new Pr(this)}createRenderRoot(){return this}render(){return this.since?H((Date.now()-this.since)/1e3):``}};G([I({type:Number})],la.prototype,`since`,void 0);var ua={empty:`No rows`,sortAscending:`Sort ascending`,sortDescending:`Sort descending`},da=new Intl.Collator(void 0,{numeric:!0}),fa=A` :host{display:block;container-type:inline-size;}table{display:block;width:100%;border-collapse:collapse;overflow-x:auto;}caption{display:block;text-align:start;}thead,tbody{display:block;}tr{display:grid;grid-template-columns:var(--cae-data-table-columns);column-gap:var(--cae-data-table-gap,12px);align-items:center;padding:var(--cae-data-table-row-padding,6px 12px);}th,td{display:block;min-width:0;padding:0;text-align:start;font-weight:inherit;}[data-align='end']{text-align:end;font-variant-numeric:tabular-nums;}thead tr{color:var(--text-muted);font-size:var(--font-size-sm);border-bottom:1px solid var(--line);}tbody tr{border-bottom:1px solid var(--line);}tbody tr[data-key]{cursor:pointer;}table.passive tbody tr[data-key]{cursor:default;}tbody tr[data-key]:hover{background:var(--raise);}tbody tr[data-key]:focus-visible{outline-offset:-2px;}tbody tr[aria-current='true']{background:var(--accent-bg);}tbody tr[data-tone='running']{background:var(--status-running-bg);}tbody tr[data-tone='failed']{background:color-mix(in srgb,var(--status-failed) 6%,transparent);box-shadow:inset 3px 0 0 var(--status-failed);}tr.spacer{display:block;padding:0;border:0;}tr.empty{display:block;border:0;padding:0;}tr.empty td{color:var(--text-muted);padding:8px;}.sort{display:inline-flex;align-items:center;gap:4px;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer;}.sort:hover{color:var(--text);}.arrow{font-size:0.85em;}`,pa=$r(class extends ei{constructor(e){if(super(e),this.names=[],e.type!==6)throw Error(`attrs() goes on an element`)}render(e){return N}update(e,[t]){let n=e.element,r=Object.keys(t??{});for(let e of this.names)r.includes(e)||n.removeAttribute(e);for(let e of r)n.getAttribute(e)!==t[e]&&n.setAttribute(e,t[e]);return this.names=r,N}}),ma=new Set([`A`,`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`SUMMARY`,`LABEL`]),ha=class extends P{constructor(...e){super(...e),this.columns=[],this.rows=[],this.rowKey=e=>{let t=e.id;return typeof t==`string`||typeof t==`number`?String(t):``},this.activatable=!0,this.selected=null,this.sort=null,this.windowAt=200,this.rowHeight=32,this.caption=``,this.strings={},this.cellStyles=[],this.range={from:0,to:60},this.heights=new Map,this.offsets=null,this.focusKey=null,this.scroller=null,this.resized=null,this.frame=0,this.held=!1,this.roving=new pi(this,{items:()=>[...this.renderRoot.querySelectorAll(`tbody tr[data-key]`)],layout:`vertical`,onMove:e=>this.focusKey=e.dataset.key??null}),this.onScroll=()=>{this.frame||=requestAnimationFrame(()=>{this.frame=0,this.reframe()})},this.onClick=e=>{let t=this.rowOf(e);t&&this.act(t.id)},this.onFocusIn=e=>{let t=this.rowOf(e);t&&(this.focusKey=t.id)},this.onKey=e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.tagName===`TR`&&t.dataset.key!==void 0){if(e.key===`Enter`)return e.preventDefault(),void this.act(t.dataset.key);if(this.windowed&&(e.key===`Home`||e.key===`End`)){e.preventDefault(),e.stopPropagation();let t=e.key===`End`,n=this.rows[t?this.rows.length-1:0];if(n===void 0)return;this.focusKey=this.rowKey(n);let r=this.rows.length,i=Math.max(1,this.range.to-this.range.from);this.scrollToEnd(t),this.range=t?{from:Math.max(0,r-i),to:r}:{from:0,to:i},this.held=!0,this.updateComplete.then(()=>this.renderRoot.querySelector(`tbody tr[data-key="${CSS.escape(this.focusKey??``)}"]`)?.focus())}}}}static{this.styles=[U,fa]}get windowed(){return this.rows.length>this.windowAt}disconnectedCallback(){super.disconnectedCallback(),this.unwatch()}rowStarts(){if(this.offsets)return this.offsets;let e=0;for(let t of this.heights.values())e+=t;let t=this.heights.size?e/this.heights.size:this.rowHeight;return this.offsets=function(e,t){let n=Array(Math.max(0,e)+1);n[0]=0;for(let r=0;r<e;r++)n[r+1]=n[r]+Math.max(0,t(r));return n}(this.rows.length,e=>this.heights.get(this.rowKey(this.rows[e]))??t)}visible(){let e=this.rowStarts(),t=this.renderRoot.querySelector(`tbody`);if(!t||!this.scroller)return mi(e,0,e.at(-1)/Math.max(1,this.rows.length)*60,0);let n=this.scroller instanceof HTMLElement?{top:this.scroller.getBoundingClientRect().top,height:this.scroller.clientHeight}:{top:0,height:this.scroller.innerHeight};return mi(e,n.top-t.getBoundingClientRect().top,n.height)}scrollToEnd(e){let t=this.renderRoot.querySelector(`tbody`),n=this.scroller;if(!t||!n)return;let r=t.getBoundingClientRect(),i=n instanceof HTMLElement?n.getBoundingClientRect():{top:0,bottom:n.innerHeight},a=e?r.bottom-i.bottom:r.top-i.top;n instanceof HTMLElement?n.scrollTop+=a:n.scrollBy(0,a)}reframe(){let e=this.visible();e.from===this.range.from&&e.to===this.range.to||(this.range={from:e.from,to:e.to})}findScroller(){let e=this.parentNode;for(;e;){if(e instanceof HTMLElement){let t=getComputedStyle(e).overflowY;if((t===`auto`||t===`scroll`||t===`overlay`)&&e.scrollHeight>e.clientHeight+1)return e}e=e instanceof ShadowRoot?e.host:e.parentNode}return window}watch(){this.scroller||(this.scroller=this.findScroller(),this.scroller.addEventListener(`scroll`,this.onScroll,{passive:!0}),this.scroller instanceof HTMLElement?typeof ResizeObserver<`u`&&(this.resized??=new ResizeObserver(this.onScroll)).observe(this.scroller):window.addEventListener(`resize`,this.onScroll,{passive:!0}))}unwatch(){cancelAnimationFrame(this.frame),this.frame=0,this.scroller?.removeEventListener(`scroll`,this.onScroll),window.removeEventListener(`resize`,this.onScroll),this.resized?.disconnect(),this.scroller=null}willUpdate(e){if((e.has(`rows`)||e.has(`rowHeight`))&&(this.offsets=null),e.has(`rows`)||e.has(`windowAt`)){if(this.windowed&&this.hasUpdated){let e=this.visible();this.range={from:e.from,to:e.to}}else this.windowed||this.unwatch()}let t=this.shown().map(this.rowKey),n=this.focusKey===null?-1:t.indexOf(this.focusKey);this.roving.current=Math.max(0,n)}updated(e){if(e.has(`cellStyles`)&&this.renderRoot instanceof ShadowRoot&&dt(this.renderRoot,[...this.constructor.elementStyles,...this.cellStyles]),!this.windowed)return;this.watch();let t=!1;for(let e of this.renderRoot.querySelectorAll(`tbody tr[data-key]`)){let n=e.getBoundingClientRect().height,r=e.dataset.key;n>0&&Math.abs(n-(this.heights.get(r)??-1))>.5&&(this.heights.set(r,n),t=!0)}t&&(this.offsets=null),this.held?this.held=!1:this.onScroll()}shown(){return this.windowed?this.rows.slice(this.range.from,Math.min(this.rows.length,this.range.to)):this.rows}rowOf(e){for(let t of e.composedPath())if(t instanceof HTMLElement){if(ma.has(t.tagName))return null;if(t.tagName===`TR`&&t.dataset.key!==void 0)return{tr:t,id:t.dataset.key};if(t===this)break}return null}act(e){this.activatable?B(this,`cae-activate`,{id:e}):(this.selected=e,B(this,`cae-select`,{id:e}))}header(e,t){let n=this.sort?.id===e.id?this.sort.direction:null,r=n===`asc`?`ascending`:n===`desc`?`descending`:N,i=(e=>e.sortable??!!e.compare)(e)?j`<button type="button" class="sort" title=${n===`asc`?t.sortDescending:t.sortAscending} @click=${()=>B(this,`cae-sort`,{id:e.id,direction:n===`asc`?`desc`:`asc`})}>${e.header}${n?j`<span class="arrow" aria-hidden="true">${n===`asc`?`▲`:`▼`}</span>`:N}</button>`:e.header;return j`<th scope="col" role="columnheader" part="header-cell" data-col=${e.id} data-align=${e.align??N} aria-sort=${r} title=${e.tip||N}>${i}</th>`}row(e,t,n){let r=this.rowKey(e),i=this.selected!==null&&this.selected===r;return j`<tr role="row" part=${i?`row row-selected`:`row`} data-key=${r} data-tone=${z(this.rowTone?.(e))} aria-current=${i?`true`:N} aria-rowindex=${this.windowed?t+2:N} ${pa(this.rowAttrs?.(e))}>
|
|
49
|
+
${this.columns.map(r=>r.id===n?j`<th scope="row" role="rowheader" part="cell" data-col=${r.id} data-align=${r.align??N}>${r.cell(e,t)}</th>`:j`<td role="cell" part="cell" data-col=${r.id} data-align=${r.align??N}>${r.cell(e,t)}</td>`)}
|
|
50
|
+
</tr>`}render(){let e=kr(ua,this.strings),t=this.rows.length,n=this.columns.map(e=>e.width??`minmax(0, 1fr)`).join(` `),r=this.columns.find(e=>e.rowHeader)?.id,i=this.windowed?this.range.from:0,a=this.shown(),o=this.windowed?this.rowStarts():null,s=o?o[i]:0,c=o?o[t]-o[i+a.length]:0;return j`<table part="table" data-scroll="x" role="table" class=${this.activatable?``:`passive`} style="--cae-data-table-columns: ${n}" aria-rowcount=${this.windowed?t+1:N}>
|
|
51
51
|
<caption part="caption"><slot name="caption">${this.caption}</slot></caption>
|
|
52
52
|
<thead part="head" role="rowgroup"><tr role="row">${this.columns.map(t=>this.header(t,e))}</tr></thead>
|
|
53
53
|
<tbody role="rowgroup" @click=${this.onClick} @keydown=${this.onKey} @focusin=${this.onFocusIn}>
|
|
54
|
-
${s>0?
|
|
55
|
-
${
|
|
56
|
-
${c>0?
|
|
57
|
-
${t?j
|
|
54
|
+
${s>0?j`<tr class="spacer" aria-hidden="true" style="height: ${s}px"></tr>`:N}
|
|
55
|
+
${W(a,this.rowKey,(e,t)=>this.row(e,i+t,r))}
|
|
56
|
+
${c>0?j`<tr class="spacer" aria-hidden="true" style="height: ${c}px"></tr>`:N}
|
|
57
|
+
${t?N:j`<tr class="empty" role="row"><td part="empty" role="cell" colspan=${this.columns.length||1}><slot name="empty">${e.empty}</slot></td></tr>`}
|
|
58
58
|
</tbody>
|
|
59
|
-
</table>`}};
|
|
60
|
-
${
|
|
61
|
-
</div>`}tile(e){let t=e.tone??`neutral`;return
|
|
62
|
-
<div class="label words" part="label" data-mark=${Jr(t)??
|
|
63
|
-
<div class="value" part="value">${typeof e.value==`number`?
|
|
64
|
-
${(e.sub??[]).map(e=>
|
|
65
|
-
${e.action?
|
|
66
|
-
</div>`}updated(){let e=this.changed;if(this.changed=[],this.bump&&!globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)for(let t of this.renderRoot.querySelectorAll(`.tile`))e.includes(t.dataset.id??``)&&t.animate?.([{transform:`scale(1)`},{transform:`scale(1.04)`,boxShadow:`0 0 0 1px var(--line2)`,offset:.35},{transform:`scale(1)`}],{duration:700,easing:`cubic-bezier(.2,.8,.2,1)`})}};
|
|
67
|
-
<div class="axis" part="axis">${[0,.25,.5,.75,1].map(e=>
|
|
68
|
-
${
|
|
69
|
-
${a?
|
|
59
|
+
</table>`}};G([I({attribute:!1})],ha.prototype,`columns`,void 0),G([I({attribute:!1})],ha.prototype,`rows`,void 0),G([I({attribute:!1})],ha.prototype,`rowKey`,void 0),G([I({attribute:!1})],ha.prototype,`rowTone`,void 0),G([I({attribute:!1})],ha.prototype,`rowAttrs`,void 0),G([I({type:Boolean})],ha.prototype,`activatable`,void 0),G([I()],ha.prototype,`selected`,void 0),G([I({attribute:!1})],ha.prototype,`sort`,void 0),G([I({type:Number})],ha.prototype,`windowAt`,void 0),G([I({type:Number})],ha.prototype,`rowHeight`,void 0),G([I()],ha.prototype,`caption`,void 0),G([I({attribute:!1})],ha.prototype,`strings`,void 0),G([I({attribute:!1})],ha.prototype,`cellStyles`,void 0),G([L()],ha.prototype,`range`,void 0);var ga=A` :host{display:block;container-type:inline-size;}.tiles{display:grid;grid-template-columns:repeat(var(--cae-stat-tiles-columns,5),minmax(0,1fr));gap:var(--cae-stat-tiles-gap,12px);}@container (max-width:1100px){.tiles{grid-template-columns:repeat(4,minmax(0,1fr));}}@container (max-width:660px){.tiles{grid-template-columns:repeat(2,minmax(0,1fr));}}@container (max-width:420px){.tile{padding:10px 12px;}.value{font-size:22px;}}@container (max-width:240px){.tiles{grid-template-columns:minmax(0,1fr);}}.tile{position:relative;background:color-mix(in srgb,var(--text) 2.5%,transparent);border:1px solid var(--line);border-radius:11px;padding:12px 14px;overflow:hidden;}.tile::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--edge,transparent);}.label{font-size:12px;font-weight:600;color:var(--text-muted);}.value{overflow-wrap:anywhere;font-size:28px;font-weight:700;line-height:1.15;margin-top:6px;font-variant-numeric:tabular-nums;letter-spacing:-0.01em;color:var(--text);}.sub{font-size:11.5px;color:var(--text-muted);margin-top:2px;}.action{position:absolute;inset:0;border-radius:inherit;}.action:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;}.tile:has(.action):hover{border-color:var(--accent);}.tile[data-tone]{--edge:var(--tone);}.tile[data-tone] .value,.tile[data-tone] .label::before{color:var(--tone);}.label[data-mark]::before{display:inline-block;}`,_a=class extends P{constructor(...e){super(...e),this.tiles=[],this.columns=5,this.bump=!0,this.prev=new Map,this.changed=[]}static{this.styles=[U,ga]}willUpdate(e){if(e.has(`tiles`))for(let e of this.tiles)typeof e.value==`number`&&((this.prev.get(e.id)??0)!==e.value&&this.changed.push(e.id),this.prev.set(e.id,e.value))}render(){return j`<div class="tiles" part="tiles" style=${this.columns===5?N:`--cae-stat-tiles-columns:${this.columns}`}>
|
|
60
|
+
${W(this.tiles,e=>e.id,e=>this.tile(e))}
|
|
61
|
+
</div>`}tile(e){let t=e.tone??`neutral`;return j`<div class="tile" part="tile" data-tone=${z(t)} data-id=${e.id} title=${e.tip??N}>
|
|
62
|
+
<div class="label words" part="label" data-mark=${Jr(t)??N}>${e.label}</div>
|
|
63
|
+
<div class="value" part="value">${typeof e.value==`number`?j`<cae-count .value=${e.value}></cae-count>`:e.value}</div>
|
|
64
|
+
${(e.sub??[]).map(e=>j`<div class="sub words" part="sub">${ui(e)}</div>`)}
|
|
65
|
+
${e.action?j`<a class="action" part="action" href="#" @click=${t=>{t.preventDefault(),e.action&&B(this,`cae-action`,{id:e.id,action:e.action.id})}}><span class="sr">${e.action.label}</span></a>`:N}
|
|
66
|
+
</div>`}updated(){let e=this.changed;if(this.changed=[],this.bump&&!globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)for(let t of this.renderRoot.querySelectorAll(`.tile`))e.includes(t.dataset.id??``)&&t.animate?.([{transform:`scale(1)`},{transform:`scale(1.04)`,boxShadow:`0 0 0 1px var(--line2)`,offset:.35},{transform:`scale(1)`}],{duration:700,easing:`cubic-bezier(.2,.8,.2,1)`})}};G([I({attribute:!1})],_a.prototype,`tiles`,void 0),G([I({type:Number})],_a.prototype,`columns`,void 0),G([I({type:Boolean})],_a.prototype,`bump`,void 0);var va={omitted:e=>e===1?`1 bar not shown`:`${e} bars not shown`,empty:`No bars`},ya=A` :host{display:block;container-type:inline-size;--label:var(--cae-lanes-label-width,112px);}@container (max-width:760px){.lanes{--label:var(--cae-lanes-label-width,78px);}}@container (max-width:480px){.axis span:nth-child(even){display:none;}}.lanes{position:relative;}.axis{display:flex;justify-content:space-between;font-family:var(--mono);font-size:10px;color:var(--text-muted);margin:0 0 6px calc(var(--label) + 8px);}.lane{display:grid;grid-template-columns:var(--label) minmax(0,1fr);gap:8px;align-items:center;min-height:24px;padding:4px 0;}.name{font-size:11.5px;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.track{position:relative;height:calc(var(--rows,1) * 14px + 2px);border-radius:4px;background:repeating-linear-gradient(90deg,color-mix(in srgb,var(--text) 5%,transparent) 0 1px,transparent 1px 10%);}.bar{position:absolute;top:calc(var(--row,0) * 14px + 2px);height:12px;border-radius:4px;min-width:3px;cursor:default;transform-origin:left center;transition:width 1s linear;}.anim .bar:not(.running){animation:growx 0.6s var(--ease) both;}:is(.bar,.legend i)[data-pattern]{background:var(--bar);}:is(.bar,.legend i)[data-pattern='hatched']{background:repeating-linear-gradient(135deg,var(--bar) 0 3px,color-mix(in srgb,var(--bar) 55%,var(--bg)) 3px 5px);}:is(.bar,.legend i)[data-pattern='outline']{background:none;box-shadow:inset 0 0 0 1.5px var(--bar);}:is(.bar,.legend i)[data-pattern='striped']{background:repeating-linear-gradient(45deg,var(--bar) 0 6px,color-mix(in srgb,var(--bar) 60%,var(--bg)) 6px 12px);background-size:17px 17px;}.bar[data-pattern='striped']{animation:stripes 0.8s linear infinite;box-shadow:0 0 12px color-mix(in srgb,var(--bar) 45%,transparent);}.bar:hover{filter:brightness(1.2);}.now{position:absolute;top:-4px;bottom:-4px;width:2px;background:var(--status-running);border-radius:2px;box-shadow:0 0 10px var(--status-running);}.legend{margin-top:10px;}.legend + .legend{margin-top:4px;}`,ba=class extends P{constructor(...e){super(...e),this.lanes=[],this.barStyles={},this.range=null,this.live=!1,this.omitted=0,this.locale=``,this.strings={},this.timer=null,this.drawn=!1}static{this.styles=[U,ai,ya]}connectedCallback(){super.connectedCallback(),this.tick(this.live)}disconnectedCallback(){super.disconnectedCallback(),this.tick(!1)}updated(e){e.has(`live`)&&this.tick(this.live)}tick(e){e&&!this.timer&&(this.timer=setInterval(()=>this.requestUpdate(),1e3)),!e&&this.timer&&(clearInterval(this.timer),this.timer=null)}time(e,t){let n=this.locale||document.documentElement.lang||void 0;return new Date(e).toLocaleTimeString(n,{hour:`2-digit`,minute:`2-digit`,...t?{second:`2-digit`}:{},hourCycle:`h23`})}render(){let e=kr(va,this.strings),t=Date.now(),n=this.range??function(e,t){let n=e.flatMap(e=>e.bars);if(!n.length)return null;let r=1/0,i=-1/0;for(let e of n)r=Math.min(r,e.start),i=Math.max(i,e.end??t);let a=n.some(e=>e.end===null)?r+6e4*Math.ceil((t-r+2e4)/6e4):i;return{start:r,end:a}}(this.lanes,t);if(!n)return j`<div part="empty"><slot name="empty">${e.empty}</slot></div>`;let r=!this.drawn;this.drawn=!0;let i=Math.max(1,n.end-n.start),a=this.lanes.some(e=>e.bars.some(e=>e.end===null)),o=i<6e5,s=Math.min(1,(t-n.start)/i);return j`<div class="lanes ${r?`anim`:``}">
|
|
67
|
+
<div class="axis" part="axis">${[0,.25,.5,.75,1].map(e=>j`<span>${this.time(n.start+i*e,o)}</span>`)}</div>
|
|
68
|
+
${W(this.lanes,e=>e.id,e=>this.lane(e,n,t))}
|
|
69
|
+
${a?j`<span class="now" part="now" style="left:calc(var(--label) + 8px + (100% - var(--label) - 8px) * ${s.toFixed(4)})"></span>`:N}
|
|
70
70
|
</div>
|
|
71
|
-
${this.legends(e)}`}lane(e,t,n){let r=function(e){let t=[];return[...e].sort((e,t)=>e.start-t.start).map(e=>{let n=e.end??1/0,r=t.findIndex(t=>t<=e.start);return r<0?r=t.push(n)-1:t[r]=n,{bar:e,row:r}})}(e.bars),i=Math.max(1,...r.map(e=>e.row+1));return
|
|
71
|
+
${this.legends(e)}`}lane(e,t,n){let r=function(e){let t=[];return[...e].sort((e,t)=>e.start-t.start).map(e=>{let n=e.end??1/0,r=t.findIndex(t=>t<=e.start);return r<0?r=t.push(n)-1:t[r]=n,{bar:e,row:r}})}(e.bars),i=Math.max(1,...r.map(e=>e.row+1));return j`<div class="lane" part="lane">
|
|
72
72
|
<span class="name" part="lane-label" title=${e.label}>${e.label}</span>
|
|
73
73
|
<div class="track" part="track" style="--rows:${i}">
|
|
74
|
-
${r.map(({bar:e,row:r})=>{let i=function(e,t,n){let r=Math.max(1,t.end-t.start),i=(e.start-t.start)/r*100,a=((e.end??n)-e.start)/r*100;return{left:i,width:Math.max(.4,e.end===null?Math.min(100-i,a):a)}}(e,t,n),a=this.barStyles[e.style];return
|
|
74
|
+
${r.map(({bar:e,row:r})=>{let i=function(e,t,n){let r=Math.max(1,t.end-t.start),i=(e.start-t.start)/r*100,a=((e.end??n)-e.start)/r*100;return{left:i,width:Math.max(.4,e.end===null?Math.min(100-i,a):a)}}(e,t,n),a=this.barStyles[e.style];return j`<span class="bar ${e.end===null?`running`:``}" part="bar" data-style=${e.style} data-pattern=${a?.pattern??`solid`} title=${e.label} style="--bar:${a?.color??`var(--line2)`};--row:${r};left:min(${i.left.toFixed(3)}%, 100% - max(3px, ${i.width.toFixed(3)}%));width:${i.width.toFixed(3)}%"></span>`})}
|
|
75
75
|
</div>
|
|
76
|
-
</div>`}legends(e){let t=[],n=new Set(this.lanes.flatMap(e=>e.bars.map(e=>e.style)));for(let[e,r]of Object.entries(this.barStyles)){if(!n.has(e))continue;let i=r.group??0;(t[i]??=[]).push({label:r.label,icon:
|
|
77
|
-
${t.length?ii(t,{label:this.label}):
|
|
76
|
+
</div>`}legends(e){let t=[],n=new Set(this.lanes.flatMap(e=>e.bars.map(e=>e.style)));for(let[e,r]of Object.entries(this.barStyles)){if(!n.has(e))continue;let i=r.group??0;(t[i]??=[]).push({label:r.label,icon:j`<i data-pattern=${r.pattern??`solid`} style="--bar:${r.color}"></i>`})}let r=t.filter(Boolean);return this.omitted&&(r.length||r.push([]),r[r.length-1].push({label:e.omitted(this.omitted)})),r.map(e=>ii(e))}};G([I({attribute:!1})],ba.prototype,`lanes`,void 0),G([I({attribute:!1})],ba.prototype,`barStyles`,void 0),G([I({attribute:!1})],ba.prototype,`range`,void 0),G([I({type:Boolean})],ba.prototype,`live`,void 0),G([I({type:Number})],ba.prototype,`omitted`,void 0),G([I()],ba.prototype,`locale`,void 0),G([I({attribute:!1})],ba.prototype,`strings`,void 0);var xa={empty:`No values`,showTable:`Show table`,showChart:`Show chart`,label:`Label`,other:`Other`,total:`Total`,none:`—`,scale:(e,t)=>`${e} to ${t}`},Sa=`var(--meter)`,Ca=e=>e<6?`var(--series-${e+1})`:Sa;function wa(e,t,n=4){let r=Math.min(0,e),i=Math.max(0,t);if(!(i>r))return{min:0,max:1,ticks:[0,1]};let a=(i-r)/n,o=10**Math.floor(Math.log10(a)),s=[1,2,2.5,5,10].map(e=>e*o).find(e=>e>=a)??10*o,c=Math.floor(r/s)*s,l=Math.ceil(i/s)*s,u=[];for(let e=c;e<=l+s/2;e+=s)u.push(Math.round(e/s)*s);return{min:c,max:l,ticks:u}}function Ta(e,t,n){return e<=0||t<=0?1:Math.max(1,Math.ceil(e*n/t))}var Ea,Da=e=>String(Math.round(100*e)/100),Oa=new Map,ka=class extends P{constructor(...e){super(...e),this.label=``,this.format=Da,this.strings={},this.height=200,this.width=0,this.asTable=!1,this.active=null,this.resized=null,this.fontsLoaded=()=>{Oa.clear(),this.requestUpdate()},this.onKey=e=>{let t=this.itemCount();if(!t)return;let n=this.active,r=n,i=this.rowLength(),a=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:e.key===`ArrowDown`?i:e.key===`ArrowUp`?-i:0;if(a)r=n===null?a>0?0:t-1:Math.min(t-1,Math.max(0,n+a));else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t-1;else{if(e.key!==`Escape`)return;r=null}e.preventDefault(),this.active=r}}static{this.styles=[U,ai,A` :host{display:block;min-width:0;}.head{display:flex;align-items:flex-start;gap:12px;margin-bottom:8px;min-height:22px;}.head .legend{flex:1;min-width:0;}.head .legend span{color:var(--text-2);}.switch{margin-left:auto;flex:none;background:none;border:1px solid var(--line);border-radius:999px;padding:2px 10px;font:inherit;font-size:var(--font-size-sm);color:var(--text-muted);cursor:pointer;}.switch:hover,.switch:focus-visible{color:var(--text);border-color:var(--line2);}.plot{position:relative;outline-offset:2px;}.plot:focus-visible{outline:2px solid var(--accent);border-radius:var(--radius-sm);}svg{display:block;overflow:visible;}.axis{font-size:${10.5}px;fill:var(--text-muted);font-variant-numeric:tabular-nums;}.grid{stroke:var(--line);stroke-width:1;shape-rendering:crispEdges;}.base{stroke:var(--line2);stroke-width:1;shape-rendering:crispEdges;}.hit{fill:transparent;}.band{fill:var(--text);opacity:0.05;}.tip{position:absolute;z-index:2;pointer-events:none;padding:6px 9px;border-radius:var(--radius-sm);background:var(--raise);border:1px solid var(--line2);box-shadow:0 4px 14px var(--shadow);color:var(--text);font-size:var(--font-size-sm);white-space:nowrap;line-height:1.45;}.tip b{font-weight:600;}.tip .row{display:flex;align-items:center;gap:6px;}.tip .row i{width:9px;height:9px;border-radius:2px;flex:none;}.tip .row .v{margin-left:auto;padding-left:12px;font-variant-numeric:tabular-nums;}.scale{display:inline-flex;gap:1px;margin-right:6px;vertical-align:-1px;}.legend .scale i{width:12px;height:10px;margin:0;border-radius:2px;}.empty{padding:18px 0;color:var(--text-muted);font-size:var(--font-size-sm);}table{border-collapse:collapse;font-size:var(--font-size-sm);font-variant-numeric:tabular-nums;}.tbl{overflow-x:auto;max-width:100%;}th,td{padding:4px 12px 4px 0;text-align:right;white-space:nowrap;border-bottom:1px solid var(--line);}th{color:var(--text-muted);font-weight:500;}th:first-child,td:first-child{text-align:left;}td{color:var(--text-2);}`]}get words(){return kr(xa,this.strings)}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<`u`&&(this.resized??=new ResizeObserver(e=>{let t=Math.floor(e[0]?.contentRect.width??0);t&&Math.abs(t-this.width)>=1&&(this.width=t)}),this.resized.observe(this),document.fonts?.addEventListener(`loadingdone`,this.fontsLoaded))}disconnectedCallback(){super.disconnectedCallback(),this.resized?.disconnect(),document.fonts?.removeEventListener(`loadingdone`,this.fontsLoaded)}labelWidth(e){let t=getComputedStyle(this);return Math.ceil(function(e,t){if(Ea??=typeof document>`u`?null:document.createElement(`canvas`).getContext(`2d`),!Ea)return 10.5*e.length*.62;let n=`${t}\n${e}`,r=Oa.get(n);return r===void 0&&(Ea.font=t,r=Ea.measureText(e).width,Oa.set(n,r)),r}(e,`${t.fontStyle} ${t.fontWeight} 10.5px ${t.fontFamily}`))+6}firstUpdated(){this.width||=Math.floor(this.getBoundingClientRect().width)||600}get plotWidth(){return Math.max(240,this.width||600)}rowLength(){return 1}render(){let e=this.words;if(!this.hasValues())return j`<div class="empty" part="empty">${e.empty}</div>`;let t=this.legendItems();return j`<div class="head">
|
|
77
|
+
${t.length?ii(t,{label:this.label}):j`<span class="legend"></span>`}
|
|
78
78
|
<button type="button" class="switch" part="switch" aria-pressed=${this.asTable} @click=${()=>(this.asTable=!this.asTable,this.active=null)}>${this.asTable?e.showChart:e.showTable}</button>
|
|
79
79
|
</div>
|
|
80
|
-
${this.asTable?
|
|
81
|
-
${i.ticks.map(e=>
|
|
80
|
+
${this.asTable?j`<div class="tbl" part="table">${this.table()}</div>`:j`<div class="plot" part="plot" tabindex=${this.itemCount()?0:N} role="group" aria-label=${this.label||N} @keydown=${this.onKey} @blur=${()=>this.active=null} @mouseleave=${()=>this.active=null}>${this.plot()}</div>`}`}tip(e,t,n){let r=this.plotWidth,i=e>.6*r?`right`:`left`;return j`<div class="tip" role="status" style="${i}: ${i===`left`?Math.max(0,e+12):Math.max(0,r-e+12)}px; top: ${Math.max(0,t)}px">${n}</div>`}tipRow(e,t,n){return j`<div class="row">${e?j`<i style="background: ${e}"></i>`:N}<span>${t}</span><span class="v">${n}</span></div>`}};function Aa(e,t,n,r,i){if(r<=0||n<=0)return``;let a=i?Math.min(4,n/2,r):0;return`M${e},${t+r}V${t+a}${a?`Q${e},${t} ${e+a},${t}`:``}H${e+n-a}${a?`Q${e+n},${t} ${e+n},${t+a}`:``}V${t+r}Z`}G([I()],ka.prototype,`label`,void 0),G([I({attribute:!1})],ka.prototype,`format`,void 0),G([I({attribute:!1})],ka.prototype,`strings`,void 0),G([I({type:Number})],ka.prototype,`height`,void 0),G([L()],ka.prototype,`width`,void 0),G([L()],ka.prototype,`asTable`,void 0),G([L()],ka.prototype,`active`,void 0);var ja=class extends ka{constructor(...e){super(...e),this.x=[],this.series=[],this.stacked=!1}get drawn(){return function(e,t){if(e.length<=6)return e.map((e,t)=>({...e,colour:Ca(t)}));let n=e.slice(0,5).map((e,t)=>({...e,colour:Ca(t)})),r=e.slice(5),i=Math.max(...r.map(e=>e.values.length)),a=Array.from({length:i},(e,t)=>{let n=r.map(e=>e.values[t]).filter(e=>e!=null);return n.length?n.reduce((e,t)=>e+t,0):null});return[...n,{name:t,values:a,colour:Sa,folded:r.map(e=>e.name)}]}(this.series,this.words.other)}hasValues(){return this.x.length>0&&this.series.some(e=>e.values.some(e=>e!=null))}legendItems(){let e=this.drawn;return e.length>1?e.map(e=>({label:e.name,swatch:e.colour})):[]}itemCount(){return this.x.length}total(e){return this.drawn.reduce((t,n)=>t+Math.max(0,n.values[e]??0),0)}plot(){let e=this.drawn,t=this.x.length,n=e.flatMap(e=>e.values.filter(e=>e!=null)),r=this.stacked?Math.max(0,...this.x.map((e,t)=>this.total(t))):Math.max(0,...n),i=wa(Math.min(0,...n),r),a=Math.max(...i.ticks.map(e=>this.labelWidth(this.format(e))))+4,o=this.plotWidth,s=this.height,c=o-a-4,l=s-8-22,u=e=>8+l-(e-i.min)/(i.max-i.min)*l,d=c/t,f=Math.max(2,Math.min(40,d*(this.stacked||e.length===1?.62:.8))),p=Ta(t,c,Math.max(...this.x.map(e=>this.labelWidth(e)))+12),m=[];for(let n=0;n<t;n++){let t=a+n*d+(d-f)/2;if(this.stacked){let r=0,i=e.map(e=>({s:e,v:Math.max(0,e.values[n]??0)})).filter(e=>e.v>0);i.forEach((e,n)=>{let a=u(r+e.v),o=u(r)-a-(n>0?2:0);m.push(M`<path d=${Aa(t,a,f,Math.max(0,o),n===i.length-1)} fill=${e.s.colour}></path>`),r+=e.v})}else{let r=(f-2*(e.length-1))/e.length;e.forEach((e,i)=>{let a=e.values[n];if(a==null||a===0)return;let o=u(Math.max(0,a)),s=u(Math.min(0,a));m.push(M`<path d=${Aa(t+i*(r+2),o,Math.max(1,r),s-o,a>0)} fill=${e.colour}></path>`)})}}let h=this.active;return j`<svg width=${o} height=${s} role="img" aria-label=${this.label||N}>
|
|
81
|
+
${i.ticks.map(e=>M`<line class=${e===0?`base`:`grid`} x1=${a} x2=${o-4} y1=${u(e)} y2=${u(e)}></line>
|
|
82
82
|
<text class="axis" x=${a-6} y=${u(e)} dy="0.32em" text-anchor="end">${this.format(e)}</text>`)}
|
|
83
|
-
${h===null?
|
|
83
|
+
${h===null?N:M`<rect class="band" x=${a+h*d} y=${8} width=${d} height=${l}></rect>`}
|
|
84
84
|
${m}
|
|
85
|
-
${this.x.map((e,t)=>t%p===0?
|
|
86
|
-
${this.x.map((e,t)=>
|
|
85
|
+
${this.x.map((e,t)=>t%p===0?M`<text class="axis" x=${a+t*d+d/2} y=${s-6} text-anchor="middle">${e}</text>`:N)}
|
|
86
|
+
${this.x.map((e,t)=>M`<rect class="hit" x=${a+t*d} y=${8} width=${d} height=${l+22} @mouseenter=${()=>this.active=t}></rect>`)}
|
|
87
87
|
</svg>
|
|
88
|
-
${h!==null&&h<t?this.tip(a+h*d+d/2,8,this.tipBody(h)):
|
|
88
|
+
${h!==null&&h<t?this.tip(a+h*d+d/2,8,this.tipBody(h)):N}`}tipBody(e){let t=this.drawn,n=this.words.none;return j`<b>${this.x[e]}</b>
|
|
89
89
|
${[...t].reverse().map(t=>this.tipRow(t.colour,t.name,t.values[e]===null||t.values[e]===void 0?n:this.format(t.values[e])))}
|
|
90
|
-
${this.stacked&&t.length>1?this.tipRow(null,this.words.total,this.format(this.total(e))):
|
|
91
|
-
<thead><tr><th scope="col">${this.words.label}</th>${e.map(e=>
|
|
92
|
-
<tbody>${this.x.map((r,i)=>
|
|
93
|
-
</table>`}};
|
|
94
|
-
${n.ticks.map(e=>
|
|
90
|
+
${this.stacked&&t.length>1?this.tipRow(null,this.words.total,this.format(this.total(e))):N}`}table(){let e=this.drawn,t=this.words.none,n=this.stacked&&e.length>1;return j`<table aria-label=${this.label||N}>
|
|
91
|
+
<thead><tr><th scope="col">${this.words.label}</th>${e.map(e=>j`<th scope="col">${e.name}</th>`)}${n?j`<th scope="col">${this.words.total}</th>`:N}</tr></thead>
|
|
92
|
+
<tbody>${this.x.map((r,i)=>j`<tr><th scope="row">${r}</th>${e.map(e=>j`<td>${e.values[i]===null||e.values[i]===void 0?t:this.format(e.values[i])}</td>`)}${n?j`<td>${this.format(this.total(i))}</td>`:N}</tr>`)}</tbody>
|
|
93
|
+
</table>`}};G([I({attribute:!1})],ja.prototype,`x`,void 0),G([I({attribute:!1})],ja.prototype,`series`,void 0),G([I({type:Boolean})],ja.prototype,`stacked`,void 0);var Ma=class extends ka{constructor(...e){super(...e),this.x=[],this.series=[]}hasValues(){return this.x.length>0&&this.series.some(e=>e.values.some(e=>e!=null))}legendItems(){return this.series.length>1?this.series.map((e,t)=>({label:e.name,swatch:Ca(t)})):[]}itemCount(){return this.x.length}plot(){let e=this.x.length,t=this.series.flatMap(e=>e.values.filter(e=>e!=null)),n=wa(Math.min(0,...t),Math.max(0,...t)),r=Math.max(...n.ticks.map(e=>this.labelWidth(this.format(e))))+4,i=this.plotWidth,a=this.height,o=i-r-10,s=a-8-22,c=e>1?o/(e-1):0,l=t=>e>1?r+t*c:r+o/2,u=e=>8+s-(e-n.min)/(n.max-n.min)*s,d=Ta(e,o,Math.max(...this.x.map(e=>this.labelWidth(e)))+12),f=this.active,p=e>1?c:o;return j`<svg width=${i} height=${a} role="img" aria-label=${this.label||N}>
|
|
94
|
+
${n.ticks.map(e=>M`<line class=${e===0?`base`:`grid`} x1=${r} x2=${i-10} y1=${u(e)} y2=${u(e)}></line>
|
|
95
95
|
<text class="axis" x=${r-6} y=${u(e)} dy="0.32em" text-anchor="end">${this.format(e)}</text>`)}
|
|
96
|
-
${f===null?
|
|
97
|
-
${this.series.map((e,t)=>{let n=this.x.map((t,n)=>{let r=e.values[n];return r==null?null:[l(n),u(r)]}),r=n.filter((e,t)=>e&&!n[t-1]&&!n[t+1]);return
|
|
98
|
-
${r.map(e=>
|
|
99
|
-
${f===null?
|
|
100
|
-
${this.x.map((t,n)=>n%d===0?
|
|
101
|
-
${this.x.map((e,t)=>
|
|
96
|
+
${f===null?N:M`<line class="base" x1=${l(f)} x2=${l(f)} y1=${8} y2=${8+s}></line>`}
|
|
97
|
+
${this.series.map((e,t)=>{let n=this.x.map((t,n)=>{let r=e.values[n];return r==null?null:[l(n),u(r)]}),r=n.filter((e,t)=>e&&!n[t-1]&&!n[t+1]);return M`<path d=${function(e){let t=``,n=!1;for(let r of e)r?(t+=`${n?`L`:`M`}${r[0].toFixed(1)},${r[1].toFixed(1)}`,n=!0):n=!1;return t}(n)} fill="none" stroke=${Ca(t)} stroke-width="2" stroke-linejoin="round" stroke-linecap="round"></path>
|
|
98
|
+
${r.map(e=>M`<circle cx=${e[0]} cy=${e[1]} r="2.5" fill=${Ca(t)}></circle>`)}`})}
|
|
99
|
+
${f===null?N:this.series.map((e,t)=>{let n=e.values[f];return n==null?N:M`<circle cx=${l(f)} cy=${u(n)} r="4.5" fill=${Ca(t)} stroke="var(--card)" stroke-width="2"></circle>`})}
|
|
100
|
+
${this.x.map((t,n)=>n%d===0?M`<text class="axis" x=${l(n)} y=${a-6} text-anchor=${e>1&&n===0?`start`:e>1&&n===e-1?`end`:`middle`}>${t}</text>`:N)}
|
|
101
|
+
${this.x.map((e,t)=>M`<rect class="hit" x=${l(t)-p/2} y=${8} width=${p} height=${s+22} @mouseenter=${()=>this.active=t}></rect>`)}
|
|
102
102
|
</svg>
|
|
103
|
-
${f!==null&&f<e?this.tip(l(f),8,this.tipBody(f)):
|
|
104
|
-
${this.series.map((n,r)=>this.tipRow(
|
|
105
|
-
<thead><tr><th scope="col">${this.words.label}</th>${this.series.map(e=>
|
|
106
|
-
<tbody>${this.x.map((t,n)=>
|
|
107
|
-
</table>`}};
|
|
108
|
-
${this.y.map((e,t)=>
|
|
103
|
+
${f!==null&&f<e?this.tip(l(f),8,this.tipBody(f)):N}`}tipBody(e){let t=this.words.none;return j`<b>${this.x[e]}</b>
|
|
104
|
+
${this.series.map((n,r)=>this.tipRow(Ca(r),n.name,n.values[e]===null||n.values[e]===void 0?t:this.format(n.values[e])))}`}table(){let e=this.words.none;return j`<table aria-label=${this.label||N}>
|
|
105
|
+
<thead><tr><th scope="col">${this.words.label}</th>${this.series.map(e=>j`<th scope="col">${e.name}</th>`)}</tr></thead>
|
|
106
|
+
<tbody>${this.x.map((t,n)=>j`<tr><th scope="row">${t}</th>${this.series.map(t=>j`<td>${t.values[n]===null||t.values[n]===void 0?e:this.format(t.values[n])}</td>`)}</tr>`)}</tbody>
|
|
107
|
+
</table>`}};G([I({attribute:!1})],Ma.prototype,`x`,void 0),G([I({attribute:!1})],Ma.prototype,`series`,void 0);var Na=[16,34,52,72,92],Pa=e=>`color-mix(in srgb, var(--series-1) ${e}%, var(--card))`;function Fa(e,t,n){if(!(n>t))return Na.length-1;let r=(e-t)/(n-t);return Math.min(Na.length-1,Math.max(0,Math.floor(r*Na.length)))}var Ia=class extends ka{constructor(...e){super(...e),this.x=[],this.y=[],this.values=[]}get range(){let e=this.values.flat().filter(e=>e!=null);return e.length?[Math.min(0,...e),Math.max(...e)]:[0,0]}hasValues(){return this.x.length>0&&this.y.length>0&&this.values.some(e=>e.some(e=>e!=null))}legendItems(){let[e,t]=this.range,n=j`<span class="scale" aria-hidden="true">${Na.map(e=>j`<i style="background: ${Pa(e)}"></i>`)}</span>`;return[{label:this.words.scale(this.format(e),this.format(t)),icon:n}]}itemCount(){return this.x.length*this.y.length}rowLength(){return this.x.length}plot(){let e=this.x.length,t=this.y.length,[n,r]=this.range,i=Math.max(...this.y.map(e=>this.labelWidth(e)))+2,a=this.plotWidth,o=a-i-2,s=o/e,c=2+22*t+22,l=Ta(e,o,Math.max(...this.x.map(e=>this.labelWidth(e)))+12),u=this.active,d=[];for(let a=0;a<t;a++)for(let t=0;t<e;t++){let o=this.values[a]?.[t],c=i+t*s,l=2+22*a,f=a*e+t;d.push(o==null?M`<rect x=${c+1} y=${l+1} width=${Math.max(1,s-2)} height=${20} rx="2" fill="none" stroke="var(--line)" @mouseenter=${()=>this.active=f}></rect>`:M`<rect x=${c+1} y=${l+1} width=${Math.max(1,s-2)} height=${20} rx="2" fill=${Pa(Na[Fa(o,n,r)]??92)} stroke=${u===f?`var(--text)`:`none`} stroke-width="1.5" @mouseenter=${()=>this.active=f}></rect>`)}let f=u!==null&&u<e*t?{r:Math.floor(u/e),c:u%e}:null;return j`<svg width=${a} height=${c} role="img" aria-label=${this.label||N}>
|
|
108
|
+
${this.y.map((e,t)=>M`<text class="axis" x=${i-6} y=${2+22*t+11} dy="0.32em" text-anchor="end">${e}</text>`)}
|
|
109
109
|
${d}
|
|
110
|
-
${this.x.map((e,t)=>t%l===0?
|
|
110
|
+
${this.x.map((e,t)=>t%l===0?M`<text class="axis" x=${i+t*s+s/2} y=${c-6} text-anchor="middle">${e}</text>`:N)}
|
|
111
111
|
</svg>
|
|
112
|
-
${f?this.tip(i+f.c*s+s/2,2+22*(f.r+1),this.tipBody(f.r,f.c)):
|
|
113
|
-
<div class="row"><span>${n==null?this.words.none:this.format(n)}</span></div>`}table(){let e=this.words.none;return
|
|
114
|
-
<thead><tr><th scope="col">${this.words.label}</th>${this.x.map(e=>
|
|
115
|
-
<tbody>${this.y.map((t,n)=>
|
|
116
|
-
</table>`}};function
|
|
117
|
-
<rect x=${s.x} y=${s.y} width=${s.w} height=${s.h} rx="2" fill=${
|
|
118
|
-
${p?
|
|
119
|
-
${f?
|
|
120
|
-
</g>`)}let f=c!==null&&c<e*t?{r:Math.floor(c/e),c:c%e}:null;return
|
|
112
|
+
${f?this.tip(i+f.c*s+s/2,2+22*(f.r+1),this.tipBody(f.r,f.c)):N}`}tipBody(e,t){let n=this.values[e]?.[t];return j`<b>${this.y[e]} | ${this.x[t]}</b>
|
|
113
|
+
<div class="row"><span>${n==null?this.words.none:this.format(n)}</span></div>`}table(){let e=this.words.none;return j`<table aria-label=${this.label||N}>
|
|
114
|
+
<thead><tr><th scope="col">${this.words.label}</th>${this.x.map(e=>j`<th scope="col">${e}</th>`)}</tr></thead>
|
|
115
|
+
<tbody>${this.y.map((t,n)=>j`<tr><th scope="row">${t}</th>${this.x.map((t,r)=>{let i=this.values[n]?.[r];return j`<td>${i==null?e:this.format(i)}</td>`})}</tr>`)}</tbody>
|
|
116
|
+
</table>`}};function La(e){switch(e){case`failed`:return`color-mix(in srgb, var(--status-failed) 72%, var(--card))`;case`attention`:return`color-mix(in srgb, var(--status-attention) 68%, var(--card))`;case`running`:return`color-mix(in srgb, var(--status-running) 60%, var(--card))`;case`done`:return`color-mix(in srgb, var(--status-done) 30%, var(--card))`;case`muted`:return`color-mix(in srgb, var(--text-muted) 26%, var(--card))`;default:return`color-mix(in srgb, var(--text) 12%, var(--card))`}}function Ra(e){return e===`done`?`✓`:e===`failed`?`✕`:e===`attention`?`◌`:``}G([I({attribute:!1})],Ia.prototype,`x`,void 0),G([I({attribute:!1})],Ia.prototype,`y`,void 0),G([I({attribute:!1})],Ia.prototype,`values`,void 0);var za=[`failed`,`attention`,`running`,`done`,`muted`,`neutral`],Ba=[``,`stripes`,`dots`,`cross`,`lines`];function Va(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.tone)??0;t.set(r.tone,e+1),n.set(Ha(r),Ba[e%Ba.length])}return n}var Ha=e=>`${e.tone}\0${e.label}`;function Ua(e){let t=new Map;for(let n of e)for(let e of n)e&&!t.has(Ha(e))&&t.set(Ha(e),e);return[...t.values()].sort((e,t)=>za.indexOf(e.tone)-za.indexOf(t.tone))}var Wa=class extends ka{constructor(...e){super(...e),this.x=[],this.y=[],this.cells=[],this.uid=`sg${Math.random().toString(36).slice(2,8)}`}static{this.styles=[...ka.styles,A` .mark{font-size:11px;font-weight:700;fill:var(--text);pointer-events:none;}.mark.quiet{font-weight:400;fill:var(--text-muted);}.legend .key{display:inline-grid;place-items:center;width:14px;height:14px;margin-right:6px;border-radius:3px;font-size:9.5px;font-weight:700;color:var(--text);vertical-align:-2px;}`]}hasValues(){return this.x.length>0&&this.y.length>0&&this.cells.some(e=>e.some(e=>!!e))}legendItems(){let e=Ua(this.cells),t=Va(e);return e.map(e=>{let n=function(e){let t=`color-mix(in srgb, var(--text) 45%, transparent)`;switch(e){case`stripes`:return`repeating-linear-gradient(45deg, ${t} 0 1.5px, transparent 1.5px 4px)`;case`dots`:return`radial-gradient(${t} 1px, transparent 1.3px) 0 0 / 4px 4px`;case`cross`:return`repeating-linear-gradient(45deg, ${t} 0 1px, transparent 1px 4px), repeating-linear-gradient(-45deg, ${t} 0 1px, transparent 1px 4px)`;case`lines`:return`repeating-linear-gradient(0deg, ${t} 0 1.5px, transparent 1.5px 4px)`;default:return``}}(t.get(Ha(e))??``);return{label:e.label,icon:j`<span class="key" aria-hidden="true" data-texture=${t.get(Ha(e))||N} style="background: ${n?`${n}, `:``}${La(e.tone)}">${Ra(e.tone)}</span>`}})}itemCount(){return this.x.length*this.y.length}rowLength(){return this.x.length}plot(){let e=this.x.length,t=this.y.length,n=Math.max(...this.y.map(e=>this.labelWidth(e)))+2,r=this.plotWidth,i=r-n-2,a=i/e,o=2+22*t+22,s=Ta(e,i,Math.max(...this.x.map(e=>this.labelWidth(e)))+12),c=this.active,l=a-2>=14,u=Va(Ua(this.cells)),d=[];for(let r=0;r<t;r++)for(let t=0;t<e;t++){let i=this.cells[r]?.[t],o=r*e+t,s={x:n+t*a+1,y:2+22*r+1,w:Math.max(1,a-2),h:20};if(!i){d.push(M`<rect x=${s.x} y=${s.y} width=${s.w} height=${s.h} rx="2" fill="none" stroke="var(--line)" @mouseenter=${()=>this.active=o}></rect>`);continue}let f=l?Ra(i.tone):``,p=u.get(Ha(i))??``;d.push(M`<g @mouseenter=${()=>this.active=o}>
|
|
117
|
+
<rect x=${s.x} y=${s.y} width=${s.w} height=${s.h} rx="2" fill=${La(i.tone)} stroke=${c===o?`var(--text)`:`none`} stroke-width="1.5"></rect>
|
|
118
|
+
${p?M`<rect class="texture" data-texture=${p} x=${s.x} y=${s.y} width=${s.w} height=${s.h} rx="2" fill=${`url(#${this.patternId(p)})`} pointer-events="none"></rect>`:N}
|
|
119
|
+
${f?M`<text class=${i.tone===`done`?`mark quiet`:`mark`} x=${s.x+s.w/2} y=${s.y+s.h/2} dy="0.35em" text-anchor="middle" aria-hidden="true">${f}</text>`:N}
|
|
120
|
+
</g>`)}let f=c!==null&&c<e*t?{r:Math.floor(c/e),c:c%e}:null;return j`<svg width=${r} height=${o} role="img" aria-label=${this.label||N}>
|
|
121
121
|
${this.patterns(new Set(u.values()))}
|
|
122
|
-
${this.y.map((e,t)=>
|
|
122
|
+
${this.y.map((e,t)=>M`<text class="axis" x=${n-6} y=${2+22*t+11} dy="0.32em" text-anchor="end">${e}</text>`)}
|
|
123
123
|
${d}
|
|
124
|
-
${this.x.map((e,t)=>t%s===0?
|
|
124
|
+
${this.x.map((e,t)=>t%s===0?M`<text class="axis" x=${n+t*a+a/2} y=${o-6} text-anchor="middle">${e}</text>`:N)}
|
|
125
125
|
</svg>
|
|
126
|
-
${f?this.tip(n+f.c*a+a/2,2+22*(f.r+1),this.tipBody(f.r,f.c)):
|
|
127
|
-
<div class="row">${n?
|
|
128
|
-
${n?.tip?
|
|
129
|
-
<thead><tr><th scope="col">${this.words.label}</th>${this.x.map(e=>
|
|
130
|
-
<tbody>${this.y.map((t,n)=>
|
|
131
|
-
</table>`}};
|
|
132
|
-
${this.bars.map(t=>
|
|
126
|
+
${f?this.tip(n+f.c*a+a/2,2+22*(f.r+1),this.tipBody(f.r,f.c)):N}`}patternId(e){return`${this.uid}-${e}`}patterns(e){let t=e=>M`<path d=${e} stroke="var(--text)" stroke-opacity="0.45" stroke-width="1.2"></path>`;return M`<defs>${[...e].filter(e=>e).map(e=>M`<pattern id=${this.patternId(e)} width="5" height="5" patternUnits="userSpaceOnUse">${(e=>e===`stripes`?t(`M-1 1 L1 -1 M0 5 L5 0 M4 6 L6 4`):e===`dots`?M`<circle cx="2.5" cy="2.5" r="0.9" fill="var(--text)" fill-opacity="0.5"></circle>`:t(e===`cross`?`M0 0 L5 5 M5 0 L0 5`:`M0 2.5 L5 2.5`))(e)}</pattern>`)}</defs>`}tipBody(e,t){let n=this.cells[e]?.[t];return j`<b>${this.y[e]} | ${this.x[t]}</b>
|
|
127
|
+
<div class="row">${n?j`<i style="background: ${La(n.tone)}"></i><span>${n.label}</span>`:j`<span>${this.words.none}</span>`}</div>
|
|
128
|
+
${n?.tip?j`<div class="row"><span>${n.tip}</span></div>`:N}`}table(){let e=this.words.none;return j`<table aria-label=${this.label||N}>
|
|
129
|
+
<thead><tr><th scope="col">${this.words.label}</th>${this.x.map(e=>j`<th scope="col">${e}</th>`)}</tr></thead>
|
|
130
|
+
<tbody>${this.y.map((t,n)=>j`<tr><th scope="row">${t}</th>${this.x.map((t,r)=>{let i=this.cells[n]?.[r];return j`<td title=${i?.tip||N}>${i?i.label:e}</td>`})}</tr>`)}</tbody>
|
|
131
|
+
</table>`}};G([I({attribute:!1})],Wa.prototype,`x`,void 0),G([I({attribute:!1})],Wa.prototype,`y`,void 0),G([I({attribute:!1})],Wa.prototype,`cells`,void 0);var Ga=class extends ka{constructor(...e){super(...e),this.bars=[]}static{this.styles=[...ka.styles,A` .bars{display:grid;grid-template-columns:minmax(80px,max-content) minmax(0,1fr) max-content;gap:6px 12px;align-items:center;font-size:var(--font-size-sm);}.bars .r{display:contents;}.bars .l{color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:34ch;}.bars .track{display:block;height:12px;}.bars .bar{display:block;height:100%;min-width:2px;border-radius:1px 4px 4px 1px;background:var(--series-1);}.bars .bar[data-tone]{background:var(--tone);}.bars .v{color:var(--text-2);font-variant-numeric:tabular-nums;text-align:right;}`]}hasValues(){return this.bars.length>0}legendItems(){return[]}itemCount(){return 0}plot(){let e=Math.max(0,...this.bars.map(e=>e.value));return j`<div class="bars" role="list" aria-label=${this.label||N}>
|
|
132
|
+
${this.bars.map(t=>j`<div class="r" role="listitem" aria-label="${t.label} | ${this.format(t.value)}">
|
|
133
133
|
<span class="l" aria-hidden="true" title=${t.label}>${t.label}</span>
|
|
134
|
-
<span class="track" aria-hidden="true"><span class="bar" data-tone=${
|
|
134
|
+
<span class="track" aria-hidden="true"><span class="bar" data-tone=${z(t.tone)} style="width: ${e>0?100*Math.max(0,t.value)/e:0}%"></span></span>
|
|
135
135
|
<span class="v" aria-hidden="true">${this.format(t.value)}</span></div>`)}
|
|
136
|
-
</div>`}table(){return
|
|
137
|
-
<tbody>${this.bars.map(e=>
|
|
138
|
-
</table>`}};
|
|
136
|
+
</div>`}table(){return j`<table aria-label=${this.label||N}>
|
|
137
|
+
<tbody>${this.bars.map(e=>j`<tr><th scope="row">${e.label}</th><td>${this.format(e.value)}</td></tr>`)}</tbody>
|
|
138
|
+
</table>`}};G([I({attribute:!1})],Ga.prototype,`bars`,void 0);var Ka={name:`Name`,expected:`Expected`,actual:`Value`,verdict:`Check`,optional:`optional`,items:e=>e===1?`1 item`:`${e} items`,object:`object`},qa=A` .verdict{font-size:12px;}.verdict[data-verdict='pass']{color:var(--text-2);}.verdict[data-verdict='pass']>[aria-hidden]{color:var(--status-done);font-weight:700;}.verdict[data-verdict='fail']{color:var(--status-failed);font-weight:600;}.verdict[data-verdict='warn']{color:var(--status-attention);}.verdict[data-verdict='none']{color:var(--text-muted);}`,Ja=A` :host{display:block;max-width:100%;}table{width:auto;max-width:100%;border-collapse:collapse;}th{text-align:left;font-size:11.5px;color:var(--text-muted);font-weight:600;padding:4px 20px 4px 0;border-bottom:1px solid var(--line);}td{padding:5px 20px 5px 0;border:0;border-bottom:1px solid var(--line);vertical-align:baseline;font-size:12.5px;}th:last-child,td:last-child{padding-right:0;}td.value{overflow-wrap:anywhere;}tbody tr:last-child td{border-bottom:0;}td:first-child{font-weight:600;overflow-wrap:anywhere;}td:last-child{white-space:nowrap;}i{font-style:normal;color:var(--text-muted);font-size:11px;margin-left:4px;}.js{color:var(--code-string);}.jn{color:var(--code-number);}`;function Ya(e,t,n=``){if(e===`none`&&!t)return N;let r=e===`pass`?`✓`:e===`fail`?`✕`:``;return j`<span class="verdict" part="verdict" data-verdict=${e} title=${n||N}>${r?j`<span aria-hidden="true">${r}</span> `:N}${t}</span>`}var Xa=(e,t)=>e.length>t?`${e.slice(0,t)}…`:e,Za=class extends P{constructor(...e){super(...e),this.rows=[],this.showValues=!0,this.strings={}}static{this.styles=[U,qa,Ja]}render(){let e=kr(Ka,this.strings),t=this.showValues;return j`<table part="table">
|
|
139
139
|
<thead><tr>
|
|
140
140
|
<th scope="col">${e.name}</th><th scope="col">${e.expected}</th>
|
|
141
|
-
${t?
|
|
141
|
+
${t?j`<th scope="col">${e.actual}</th><th scope="col">${e.verdict}</th>`:N}
|
|
142
142
|
</tr></thead>
|
|
143
143
|
<tbody>
|
|
144
|
-
${this.rows.map(n=>
|
|
144
|
+
${this.rows.map(n=>j`<tr part="row">
|
|
145
145
|
<td class="jmono">${n.name}</td>
|
|
146
|
-
<td class=${n.extra?`jdim`:`jmono jdim`}>${n.expected}${n.optional?
|
|
147
|
-
${t?
|
|
148
|
-
<span class="jdim">${n}${e.length>3?`, …`:``}</span>`}return typeof e==`object`&&e?
|
|
149
|
-
<td>${
|
|
146
|
+
<td class=${n.extra?`jdim`:`jmono jdim`}>${n.expected}${n.optional?j` <i>${e.optional}</i>`:N}</td>
|
|
147
|
+
${t?j`<td class="value">${function(e,t){if(e===void 0)return j`<span class="jdim">—</span>`;if(typeof e==`string`)return j`<span class="js" title=${e}>"${Xa(e,90)}"</span>`;if(Array.isArray(e)){let n=e.slice(0,3).map(e=>typeof e==`string`?`"${Xa(e,28)}"`:JSON.stringify(e)).join(`, `);return j`<span class="jn">${t.items(e.length)}</span>
|
|
148
|
+
<span class="jdim">${n}${e.length>3?`, …`:``}</span>`}return typeof e==`object`&&e?j`<span class="jn">${t.object}</span> <span class="jdim">${Object.keys(e).slice(0,4).join(`, `)}</span>`:j`<span class="jn">${JSON.stringify(e)}</span>`}(n.hasValue?n.value:void 0,e)}</td>
|
|
149
|
+
<td>${Ya(n.verdict,n.verdictLabel,n.tip)}</td>`:N}
|
|
150
150
|
</tr>`)}
|
|
151
151
|
</tbody>
|
|
152
|
-
</table>`}};
|
|
152
|
+
</table>`}};G([I({attribute:!1})],Za.prototype,`rows`,void 0),G([I({type:Boolean})],Za.prototype,`showValues`,void 0),G([I({attribute:!1})],Za.prototype,`strings`,void 0);var Qa={sortBy:`Sort`,rowsHeader:`Row`},$a=A` :host{display:contents;}.mxblock{display:flex;flex-direction:column;width:fit-content;max-width:100%;min-width:min(100%,27rem);animation:view-in 0.1s var(--ease) both;}@keyframes view-in{from{opacity:0;}}@media (prefers-reduced-motion:reduce){.mxblock{animation:none;}}.mxbar{display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;margin-bottom:8px;font-size:12px;color:var(--text-2);width:0;min-width:100%;box-sizing:border-box;}.mxbar .cap{color:var(--text);font-weight:600;}.mxbar .sum{flex:1 0 100%;min-width:0;}.mxbar .f{white-space:nowrap;}.sep{color:var(--text-muted);}.mxbar label{display:inline-flex;align-items:center;gap:6px;margin-left:auto;color:var(--text-muted);font-size:11.5px;white-space:nowrap;}.mxbar select{font:inherit;font-size:11.5px;color:var(--text);background:var(--card);border:1px solid var(--line);border-radius:6px;padding:2px 6px;}.mxbar select:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.mx{overflow:auto;max-width:100%;max-height:max(${360}px,${ut(70)}vh);border-radius:6px;border:1px solid var(--line);}table.matrix{border-collapse:separate;border-spacing:0;font-size:11px;width:100%;min-width:max-content;}.matrix th,.matrix td{padding:0 6px;height:${24}px;border-bottom:1px solid var(--line);white-space:nowrap;}.matrix thead th{position:sticky;z-index:2;background:var(--panel2);color:var(--text-muted);font-weight:500;text-align:center;height:22px;}.matrix thead th.nh{font-family:var(--mono);color:var(--text-2);font-weight:600;max-width:110px;overflow:hidden;text-overflow:ellipsis;}.matrix thead th.group{color:var(--text-2);}.matrix thead th.group.code{font-family:var(--mono);color:var(--text-muted);}.matrix .uh,.matrix tbody th{position:sticky;left:0;z-index:1;background:var(--panel);text-align:left;}.matrix thead .uh{z-index:3;}.matrix thead .uh,.matrix thead .pn{background:var(--panel2);}.matrix tbody th{font-family:var(--mono);font-weight:600;color:var(--text);max-width:220px;overflow:hidden;text-overflow:ellipsis;}.matrix tbody th.none{font-family:var(--sans);font-weight:500;color:var(--text-muted);}.matrix .pn{text-align:right;color:var(--text-muted);font-variant-numeric:tabular-nums;}.matrix .pn.many{color:var(--text);font-weight:600;}.matrix td.c{text-align:center;--m:12px;}.matrix td.c .mark{vertical-align:middle;}.matrix .g0{border-left:1px solid var(--line2);}.matrix .g1{border-left:1px dashed var(--line);}.matrix tbody tr:hover td,.matrix tbody tr:hover th{background-color:color-mix(in srgb,var(--text-muted) 8%,transparent);}.matrix tbody tr.on td,.matrix tbody tr.on th{background-color:var(--accent-bg);}.matrix .gap td{padding:0;border:0;}.mx.hl .mark:not(.on){opacity:0.4;}.mx.hl .mark.on{transform:scale(1.2);}`,eo={caption:``,label:``,head:[],columns:[],rows:[]},to=class extends P{constructor(...e){super(...e),this.matrix=eo,this.states={},this.selected=null,this.highlight=null,this.key=``,this.windowAt=150,this.strings={},this.renderIcon=e=>fi(e),this.iconStyles=[],this.hover=null,this.scrollRow=0,this.cell=null,this.onScroll=e=>{let t=Math.floor(e.currentTarget.scrollTop/24);Math.abs(t-this.scrollRow)>=15&&(this.scrollRow=t)}}static{this.styles=[U,qr,$a]}static{this.properties={matrix:{attribute:!1},states:{attribute:!1},selected:{attribute:!1},highlight:{attribute:!1},key:{},windowAt:{type:Number},strings:{attribute:!1},renderIcon:{attribute:!1},iconStyles:{attribute:!1},hover:{state:!0},scrollRow:{state:!0}}}willUpdate(e){e.has(`key`)&&e.get(`key`)!==void 0&&(this.scrollRow=0,this.cell=null)}updated(e){e.has(`iconStyles`)&&this.renderRoot instanceof ShadowRoot&&dt(this.renderRoot,[...this.constructor.elementStyles,...this.iconStyles])}lit(){if(this.hover!==null)return this.hover;let e=this.selected?this.matrix.rows.find(e=>e.cells.some(e=>e?.id===this.selected)):void 0;return e?e.id||this.selected:this.highlight}select(e){e!==this.selected&&B(this,`cae-select`,{id:e})}act(e){e.drill?B(this,`cae-drill`,{id:e.id}):B(this,`cae-activate`,{id:e.id})}render(){let e=this.matrix,t=kr(Qa,this.strings),n=e.rows,r=e.columns,i=this.lit(),a=r.map((e,t)=>{let n=r[t-1]?.groups;if(!n)return-1;let i=e.groups.findIndex((e,t)=>e!==n[t]);return i<0?e.groups.length===n.length?-1:Math.min(e.groups.length,n.length):i}),o=e.head.length,s=!!e.value,c=s?2:1,l=n.length>this.windowAt,u=l?Math.max(0,this.scrollRow-30):0,d=l?Math.min(n.length,this.scrollRow+60+20):n.length,f=this.cell&&this.cell[0]<n.length?this.cell:function(e){for(let t=0;t<e.length;t++){let n=e[t]?.cells.findIndex(e=>e!==null)??-1;if(n>=0)return[t,n]}return null}(n),p=e=>e===0||a[e]===0?`g0`:(a[e]??-1)>0?`g1`:``,m=(e,t,n)=>{let r=`top:${22*n}px`;return e.type===`group`?j`<th scope="colgroup" part="head-cell" colspan=${e.span} class="group ${e.code?`code`:``} ${p(t)}" style=${r} title=${e.tip??N} aria-label=${e.summary??N}>${e.label}</th>`:j`<th scope="col" part="head-cell" rowspan=${e.rows} class="nh ${p(t)}" style=${r} title=${e.tip??N} aria-label=${e.summary??N}>${(e.icons??[]).map(e=>this.renderIcon(e))}${e.label}</th>`},h=(e.facts??[]).filter(e=>typeof e==`string`?e:e.text);return j`<div class="mxblock view">
|
|
153
153
|
<div class="mxbar">
|
|
154
|
-
<span class="cap" title=${e.captionTip??
|
|
155
|
-
${e.sorts?.length?
|
|
156
|
-
<select part="sort" @change=${e=>
|
|
157
|
-
${e.sorts.map(t=>
|
|
154
|
+
<span class="cap" title=${e.captionTip??N}>${e.caption}</span>
|
|
155
|
+
${e.sorts?.length?j`<label>${t.sortBy}
|
|
156
|
+
<select part="sort" @change=${e=>B(this,`cae-sort`,{id:e.target.value,direction:`asc`})}>
|
|
157
|
+
${e.sorts.map(t=>j`<option value=${t.id} ?selected=${e.sort===t.id}>${t.label}</option>`)}
|
|
158
158
|
</select>
|
|
159
|
-
</label>`:
|
|
160
|
-
<span class="sum">${h.map((e,t)=>
|
|
159
|
+
</label>`:N}
|
|
160
|
+
<span class="sum">${h.map((e,t)=>j`${t?j`<span class="sep"> | </span>`:N}${typeof e==`string`?j`<span class="f">${e}</span>`:j`<span class="f tone-text" data-tone=${z(e.tone)}>${e.text}</span>`}`)}</span>
|
|
161
161
|
</div>
|
|
162
162
|
<div class="mx ${i?`hl`:``}" @scroll=${this.onScroll} @mouseleave=${()=>this.hover=null}>
|
|
163
163
|
<table class="matrix big" part="matrix" role="grid" aria-rowcount=${n.length+o} aria-colcount=${r.length+c} aria-label=${e.label}>
|
|
164
164
|
<thead>
|
|
165
|
-
${e.head.map((n,r)=>{let i=(t=>{let n=[],r=0;for(let i of e.head[t]??[]){for(;
|
|
166
|
-
${r===0?
|
|
167
|
-
${s?
|
|
165
|
+
${e.head.map((n,r)=>{let i=(t=>{let n=[],r=0;for(let i of e.head[t]??[]){for(;no(e.head,t,r);)r++;n.push(r),r+=i.span}return n})(r);return j`<tr>
|
|
166
|
+
${r===0?j`<th scope="col" rowspan=${o} class="uh" style="top:0">${t.rowsHeader}</th>
|
|
167
|
+
${s?j`<th scope="col" rowspan=${o} class="pn" style="top:0" title=${e.value?.tip??N}>${e.value?.label}</th>`:N}`:N}
|
|
168
168
|
${n.map((e,t)=>m(e,i[t]??0,r))}
|
|
169
169
|
</tr>`})}
|
|
170
170
|
</thead>
|
|
171
171
|
<tbody @keydown=${e=>this.onKey(e,n)}>
|
|
172
|
-
${u>0?
|
|
173
|
-
${
|
|
174
|
-
<th scope="row" part="row-header" class=${e.muted?`none`:
|
|
175
|
-
${s?
|
|
176
|
-
${e.cells.map((t,r)=>{let o=!!t&&f!==null&&f[0]===n&&f[1]===r;return
|
|
172
|
+
${u>0?j`<tr class="gap" aria-hidden="true"><td colspan=${r.length+c} style="height:${24*u}px"></td></tr>`:N}
|
|
173
|
+
${W(n.slice(u,d),e=>e.id,(e,t)=>{let n=u+t;return j`<tr class=${e.id&&e.id===i?`on`:``} aria-rowindex=${n+o+1}>
|
|
174
|
+
<th scope="row" part="row-header" class=${e.muted?`none`:N} title=${e.tip??e.label}>${e.label}</th>
|
|
175
|
+
${s?j`<td class="pn ${e.strong?`many`:``}">${e.value}</td>`:N}
|
|
176
|
+
${e.cells.map((t,r)=>{let o=!!t&&f!==null&&f[0]===n&&f[1]===r;return j`<td class="c ${(e=>a[e]===0?`g0`:(a[e]??-1)>0?`g1`:``)(r)}" role="gridcell">${t?this.mark(e,t,n,r,o,i):N}</td>`})}
|
|
177
177
|
</tr>`})}
|
|
178
|
-
${d<n.length?
|
|
178
|
+
${d<n.length?j`<tr class="gap" aria-hidden="true"><td colspan=${r.length+c} style="height:${24*(n.length-d)}px"></td></tr>`:N}
|
|
179
179
|
</tbody>
|
|
180
180
|
</table>
|
|
181
181
|
</div>
|
|
182
|
-
</div>`}mark(e,t,n,r,i,a){let o=this.states[t.state],s=e.id||t.id,c=this.selected===t.id;return k`<button type="button" part="mark" class="mark ${e.id&&e.id===a?`on`:``} ${c?`sel`:``}" data-tone=${L(o?.tone)} data-shape=${o?.shape??j} data-r=${n} data-c=${r} tabindex=${i?0:-1} title=${t.tip??j} aria-label=${t.label} aria-pressed=${c} @mouseenter=${()=>this.hover=s} @focus=${()=>{this.hover=s,this.cell=[n,r],this.select(t.id)}} @blur=${()=>this.hover=null} @click=${()=>this.select(t.id)} @dblclick=${()=>this.act(t)}></button>`}onKey(e,t){let n=e.target;if(!n.classList.contains(`mark`))return;let r=Number(n.dataset.r),i=Number(n.dataset.c);if(e.key===`Enter`){let n=t[r]?.cells[i];e.preventDefault(),n&&this.act(n);return}let a=function(e,t,n,r,i=!1,a=10){let o=(t,n)=>!0===e[t]?.[n],s=t=>(e[t]??[]).findIndex(Boolean),c=t=>(e[t]??[]).lastIndexOf(!0),l=t=>{let r=e[t]??[],i=-1;return r.forEach((e,t)=>e&&(i<0||Math.abs(t-n)<Math.abs(i-n))&&(i=t)),i<0?null:[t,i]};switch(r){case`ArrowRight`:case`ArrowLeft`:{let i=r===`ArrowRight`?1:-1;for(let r=n+i;r>=0&&r<(e[t]?.length??0);r+=i)if(o(t,r))return[t,r];return null}case`ArrowDown`:case`ArrowUp`:{let i=r===`ArrowDown`?1:-1,a=((t,n,r)=>{for(let i=t;i>=0&&i<e.length;i+=n)if(o(i,r))return i;return-1})(t+i,i,n);if(a>=0)return[a,n];for(let n=t+i;n>=0&&n<e.length;n+=i)if(s(n)>=0)return l(n);return null}case`Home`:{let n=i?e.findIndex(e=>e.some(Boolean)):t;return n<0||s(n)<0?null:[n,s(n)]}case`End`:{let n=t;if(i)for(n=e.length-1;n>=0&&c(n)<0;n--);return n<0||c(n)<0?null:[n,c(n)]}case`PageDown`:case`PageUp`:{let n=r===`PageDown`?1:-1;for(let r=Math.max(0,Math.min(e.length-1,t+n*a));r!==t;r-=n)if(s(r)>=0)return l(r);return null}default:return null}}(t.map(e=>e.cells.map(e=>e!==null)),r,i,e.key,e.ctrlKey||e.metaKey);if(!a)return;e.preventDefault(),this.cell=a;let o=this.renderRoot.querySelector(`.mx`);if(o&&t.length>this.windowAt){let e=24*a[0];(e<o.scrollTop+48||e>o.scrollTop+o.clientHeight-72)&&(o.scrollTop=Math.max(0,e-o.clientHeight/2)),this.scrollRow=Math.floor(o.scrollTop/24)}this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`.matrix .mark[data-r="${a[0]}"][data-c="${a[1]}"]`)?.focus())}};function to(e,t,n){for(let r=0;r<t;r++){let i=0;for(let a of e[r]??[]){if(n>=i&&n<i+a.span&&r+a.rows>t)return!0;i+=a.span}}return!1}var no=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])},ro=(e,t)=>`${e}\0${t}`;function io(e,t,n){let r=new Set(e),i=new Map(e.map(e=>[e,[]]));for(let[e,n]of t)e!==n&&r.has(e)&&r.has(n)&&!i.get(e)?.includes(n)&&i.get(e)?.push(n);let a=new Set,o=new Map;for(let t of e){if(o.has(t))continue;o.set(t,1);let e=[[t,0]];for(;e.length;){let t=e[e.length-1],n=i.get(t[0])??[];if(t[1]<n.length){let r=n[t[1]++],i=o.get(r);i===1?a.add(ro(t[0],r)):i||(o.set(r,1),e.push([r,0]))}else o.set(t[0],2),e.pop()}}let s=new Map(e.map(e=>[e,[]])),c=new Map(e.map(e=>[e,[]]));for(let[e,t]of i)for(let n of t)a.has(ro(e,n))||(s.get(e)?.push(n),c.get(n)?.push(e));let l=new Map(e.map(e=>[e,c.get(e)?.length??0])),u=e.filter(e=>!l.get(e)),d=new Map;for(let e=u.shift();e!==void 0;e=u.shift()){d.set(e,n.get(e)??Math.max(0,...(c.get(e)??[]).map(e=>(d.get(e)??0)+1)));for(let t of s.get(e)??[])l.set(t,(l.get(t)??0)-1),l.get(t)||u.push(t)}return d}var ao=e=>e.startsWith(`~`);function oo(e,t,n){let r=new Map;e.forEach((e,t)=>e.forEach(e=>r.set(e,t)));let i=new Map,a=new Map;for(let[e,n]of t)no(a,e,n),no(i,n,e);let o=new Map,s=e=>e.forEach((e,t)=>o.set(e,t)),c=e.map(e=>[...e]);c.forEach(s);let l=()=>function(e,t,n,r){let i=0,a=new Map;for(let[e,i]of t){let t=r.get(e);t!==void 0&&no(a,t,[n.get(e)??0,n.get(i)??0])}for(let e of a.values())for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let[r,a]=e[t],[o,s]=e[n];(r-o)*(a-s)<0&&i++}return e.length?i:0}(c,t,o,r),u=c.map(e=>[...e]),d=l(),f=(e,t)=>{let r=new Map;for(let n of e){let e=(t.get(n)??[]).map(e=>o.get(e)).filter(e=>e!==void 0);r.set(n,e.length?e.reduce((e,t)=>e+t,0)/e.length:o.get(n)??0)}let i=e=>r.get(e)??0;if(!n)return[...e].sort((e,t)=>i(e)-i(t)||(o.get(e)??0)-(o.get(t)??0));let a=e.filter(e=>!ao(e)),s=e.filter(ao).sort((e,t)=>i(e)-i(t)||(o.get(e)??0)-(o.get(t)??0)),c=[],l=0;for(let e of a){for(;l<s.length&&i(s[l])<i(e);)c.push(s[l++]);c.push(e)}return[...c,...s.slice(l)]};for(let e=0;e<4;e++){let t=e%2==0,n=t?c.map((e,t)=>t).slice(1):c.map((e,t)=>t).reverse().slice(1);for(let e of n){let n=f(c[e],t?i:a);c[e]=n,s(n)}let r=l();r<d&&(d=r,u=c.map(e=>[...e]))}return l()<=d?c:u}var so=new WeakMap;function co(e,t,n=!1){let r=so.get(e)??[],i=r.find(e=>e.prev===t&&e.down===n);if(i)return i.out;let a=function(e,t,n){let r=new Set(e.clusters.map(e=>e.id)),i=new Map(e.clusters.map(e=>[e.id,e.parent])),a=new Map;for(let t of e.nodes)t.cluster&&a.set(t.id,t.cluster);let o=[...new Set(e.stubs.map(e=>e.id))],s=new Set(o),c=e=>{let t=[],n=r.has(e)?e:a.get(e)??null;for(;n;)t.push(n),n=i.get(n)??null;return t},l=(e,t)=>{let n=c(e);if(t===``)return n[n.length-1]??e;let r=n.indexOf(t);return r<0?void 0:r===0?e:n[r-1]},u=(e,t)=>c(e).find(e=>c(t).includes(e))??``,d=[``,...e.clusters.map(e=>e.id)],f=new Map(d.map(e=>[e,[]]));for(let{id:t}of e.nodes)for(let e of d){let n=l(t,e);n===void 0||f.get(e)?.includes(n)||f.get(e)?.push(n)}let p=new Map;for(let n of d){let r=f.get(n)??[],i=n===``?t?.layers:t?.clusters[n],a=new Map;i?.forEach((e,t)=>e.forEach(e=>r.includes(e)&&a.set(e,t)));let o=e.edges.filter(e=>e.ranks&&u(e.from,e.to)===n).map(e=>[l(e.from,n),l(e.to,n)]);p.set(n,io(r,o,a))}let m=p.get(``),h=new Map;t?.layers.forEach((e,t)=>e.forEach(e=>h.set(e,t)));let g=new Map(o.map(t=>[t,h.get(t)??Math.min(...e.stubs.filter(e=>e.id===t).map(e=>m.get(l(e.to,``))??0))-1]));if([...g.values()].some(e=>e<0)){for(let[e,t]of m)m.set(e,t+1);for(let[e,t]of g)g.set(e,t+1)}for(let[e,t]of g)m.set(e,t);let _=(e,t)=>p.get(e)?.get(t)??0,v=e=>Math.max(0,...p.get(e)?.values()??[]),y=e.edges.map(e=>((e,t)=>{let n=u(e,t);return _(n,l(e,n))>=_(n,l(t,n))})(e.from,e.to)),b=new Map;for(let e of d){let n=((e===``?t?.layers:t?.clusters[e])??[]).flat(),r=[...e===``?[...o]:[],...f.get(e)??[]];r.sort((e,t)=>{let r=n.indexOf(e),i=n.indexOf(t);return(r<0?1/0:r)-(i<0?1/0:i)});let i=Array.from({length:v(e)+1},()=>[]);for(let t of r)i[_(e,t)]?.push(t);b.set(e,i)}let x=[],S=new Set,ee=(e,t,n,r)=>{let i=`~${e}|${t}|${n}|${r}`;return S.has(i)||(S.add(i),b.get(e)?.[r]?.push(i)),{id:i,in:e}},te=(e,t,n,r)=>{let i=_(e,t),a=`~${e}|by:${t}|${n}|${r}|${i}`;return S.has(a)||(S.add(a),b.get(e)?.[i]?.push(a)),{id:a,in:e}},ne=(e,t,r)=>{let o=s.has(e)?``:u(e,t),d=(p=e,s.has(p)?``:a.get(p)??``),f=e;var p;let m=[{id:e,in:d}];for(;d!==o;){let e=i.get(d)??``;m.push({id:d,in:e}),_(d,f)<v(d)&&m.push(te(e,d,f,r)),f=d,d=e}let h=l(t,o);for(let e=_(o,f)+1;e<_(o,h);e++)m.push(ee(o,f,r,e));let g=c(t),y=g.slice(0,o===``?g.length:g.indexOf(o)).reverse(),b=`>${o}:${f}`,x=o;for(let e of y){let i=l(t,e);(_(e,i)>0||n)&&m.push(te(x,e,b,r)),m.push({id:e,in:x}),x=e}return m.push({id:t,in:x}),m};e.edges.forEach((e,t)=>{y[t]||x.push({from:e.from,to:e.to,style:e.style,steps:ne(e.from,e.to,e.style)})});for(let t of e.stubs)x.push({from:t.id,to:t.to,style:t.style,steps:ne(t.id,t.to,t.style)});let re={};for(let e of d){let n=[],r=new Map((b.get(e)??[]).flatMap((e,t)=>e.map(e=>[e,t])));for(let t of x)for(let i=1;i<t.steps.length;i++){let a=t.steps[i-1],o=t.steps[i];a.in===e&&o.in===e&&r.get(a.id)!==r.get(o.id)&&n.push([a.id,o.id])}let i=e===``?!!t:!!t?.clusters[e];re[e]=oo(b.get(e)??[],n,i).map(e=>{let t=e.filter(e=>e.includes(`|by:`));return e.filter(e=>!e.includes(`|by:`)).flatMap(e=>[e,...t.filter(t=>t.includes(`|by:${e}|`))])})}let ie=e=>e.map(e=>e.filter(e=>!ao(e))),ae=e.clusters.map(e=>({id:e.id,parent:e.parent,cycle:!!e.cycle,layers:ie(re[e.id]??[]).filter(e=>e.length)})),oe=ie(re[``]??[]).map(e=>e.filter(e=>!s.has(e))),se=new Map(ae.map(e=>[e.id,e])),C=e=>e.flatMap(e=>r.has(e)?C((se.get(e)?.layers??[]).flat()):[e]);return{drawn:C(oe.flat()),layers:oe.filter(e=>e.length),clusters:ae,back:y,slots:re,edgePaths:x,order:{layers:ie(re[``]??[]),clusters:Object.fromEntries(ae.map(e=>[e.id,ie(re[e.id]??[])]))}}}(e,t,n);return so.set(e,[...r.slice(-3),{prev:t,down:n,out:a}]),a}function lo(e){let t=new Map(e.clusters.map(e=>[e.id,e])),n=new Map,r=e=>{let i=0,a=0;for(let o of e){let e=0,s=0;for(let i of o){let a=t.get(i),o=a?n.get(i)??n.set(i,r(a.layers)).get(i)??{span:1,stack:1}:{span:1,stack:1};e=Math.max(e,o.span),s+=o.stack}i+=e,a=Math.max(a,s)}return{span:i,stack:a}};return r(e.layers)}var uo={across:{gap:56,boxGap:40,sep:16,pointSep:12,pad:12,padEnd:24,margin:16},down:{gap:40,boxGap:32,sep:16,pointSep:12,pad:10,padEnd:24,margin:16}};function fo(e,t,n){let r=[0];for(let n=1;n<e.length;n++)r.push(r[n-1]+t[n-1]);let i=[];e.forEach((e,t)=>{let a=n[t]??1;for(i.push({sum:a*(e-r[t]),w:a,n:1});i.length>1;){let e=i[i.length-1],t=i[i.length-2];if(t.sum/t.w<=e.sum/e.w)break;i.splice(-2,2,{sum:t.sum+e.sum,w:t.w+e.w,n:t.n+e.n})}});let a=[];for(let e of i)for(let t=0;t<e.n;t++)a.push(e.sum/e.w+r[a.length]);return a}function po(e,t,n,r,i=0){if(e<=0||t<=0||n<=0)return{k:1,x:0,y:0,h:Math.max(0,t)};let a=Math.min(1,n/e),o=Math.max(i,Math.min(t*a,r)),s=Math.min(a,o/t);return{k:s,x:(n-e*s)/2,y:(o-t*s)/2,h:o}}var mo=(e,t=200)=>e.marks.filter(e=>e!==null).length+e.loose.length>t,ho=(e,t,n)=>n<t?t:Math.min(n,Math.max(t,e));function go(e,t,n,r=e){let i=function(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return i>n&&a>r?{left:n,top:r,width:i-n,height:a-r}:null}(r,t);if(!i)return{shown:!1,x:0,y:0,side:`right`,arrow:0,fits:!1};let{width:a,height:o}=n,s=t.left+8,c=t.top+8,l=t.left+t.width-8,u=t.top+t.height-8,d=e.left+e.width,f=e.top+e.height,p=i.top+i.height/2,m=i.left+i.width/2,h=ho(p-o/2,c,u-o),g=ho(m-a/2,s,l-a),_={right:l-(d+12)-a,left:e.left-12-a-s,below:u-(f+12)-o,above:e.top-12-o-c},v=[`right`,`left`,`below`,`above`],y=v.find(e=>_[e]>=0)??v.reduce((e,t)=>_[t]>_[e]?t:e),b,x;switch(y){case`right`:[b,x]=[ho(d+12,s,l-a),h];break;case`left`:[b,x]=[ho(e.left-12-a,s,l-a),h];break;case`below`:[b,x]=[g,ho(f+12,c,u-o)];break;case`above`:[b,x]=[g,ho(e.top-12-o,c,u-o)]}return{shown:!0,x:b,y:x,side:y,arrow:y===`right`||y===`left`?ho(p-x,14,o-14):ho(m-b,14,a-14),fits:_[y]>=0}}var _o=class{constructor(e,t){this.host=e,this.o=t,this.view={k:1,x:0,y:0},this.frameH=0,this.fitK=1,this.moved=!1,this.pressed=!1,this.pan=null,this.swallowClick=!1,this.onPointerDown=e=>{this.pressed=!0,globalThis.addEventListener(`pointerup`,()=>this.pressed=!1,{once:!0}),e.button!==0||e.target.closest(`.tools`)||this.o.down()&&e.pointerType!==`mouse`||(this.pan={id:e.pointerId,px:e.clientX,py:e.clientY,x:this.view.x,y:this.view.y,far:!1})},this.onPointerMove=e=>{let t=this.pan;if(!t||t.id!==e.pointerId)return;let n=e.clientX-t.px,r=e.clientY-t.py;!t.far&&Math.hypot(n,r)<4||(t.far||(t.far=!0,e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.classList.add(`drag`)),this.setMoved(),this.setView({...this.view,x:t.x+n,y:t.y+r}))},this.onPointerUp=e=>{let t=this.pan;t&&t.id===e.pointerId&&(this.pan=null,e.currentTarget.classList.remove(`drag`),t.far&&(this.swallowClick=!0))},this.onWheel=e=>{if(!this.o.wheel()||!e.ctrlKey&&!e.metaKey)return;let t=this.o.frame();if(!t)return;e.preventDefault();let n=t.getBoundingClientRect();this.zoomBy(Math.exp(.0015*-e.deltaY),e.clientX-n.left,e.clientY-n.top)},this.onClickCapture=e=>{this.swallowClick&&(this.swallowClick=!1,e.stopPropagation(),e.preventDefault())},e.addController(this)}hostConnected(){this.host.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.host.addEventListener(`click`,this.onClickCapture,{capture:!0})}hostDisconnected(){this.host.removeEventListener(`wheel`,this.onWheel),this.host.removeEventListener(`click`,this.onClickCapture,{capture:!0}),this.resize?.disconnect(),this.resize=void 0}hostUpdated(){this.resize||(this.resize=new ResizeObserver(()=>this.o.onResize()),this.resize.observe(this.host))}get transform(){return(e=>`translate(${e.x}px,${e.y}px) scale(${e.k})`)(this.view)}reset(){this.moved=!1}fit(){let e=this.o.drawing();if(!e)return;let t=this.o.frame(),n=t?.clientWidth||this.host.clientWidth,r=po(e.w,e.h,n,e.down?1/0:Math.max(360,.7*globalThis.innerHeight)),i=t?.clientHeight??0,a=`${i}px`===(t?.style.height??`0px`)?r:po(e.w,e.h,n,i,i);a.k!==this.fitK&&(this.fitK=a.k,this.host.requestUpdate());let o=e.down?r.h:Math.max(r.h,e.room);this.moved?o>this.frameH&&this.setHeight(o):(this.setHeight(o),a.k===this.view.k&&a.x===this.view.x&&a.y===this.view.y||this.setView({k:a.k,x:a.x,y:a.y}))}showAll(){this.moved=!1,this.fit(),this.host.requestUpdate()}zoomBy(e,t=(this.o.frame()?.clientWidth??this.host.clientWidth)/2,n=(this.o.frame()?.clientHeight??this.frameH)/2){this.setMoved(),this.setView(function(e,t,n,r,i){let a=Math.min(2.5,Math.max(i,e.k*t)),o=a/e.k;return{k:a,x:n-(n-e.x)*o,y:r-(r-e.y)*o}}(this.view,e,t,n,Math.min(1,this.fitK)/2))}reveal(e){let t=this.o.frame();if(!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=0,a=0;r.left<n.left+24?i=n.left+24-r.left:r.right>n.right-24&&(i=n.right-24-r.right),r.top<n.top+24?a=n.top+24-r.top:r.bottom>n.bottom-24&&(a=n.bottom-24-r.bottom),(i||a)&&(this.setMoved(),this.setView({...this.view,x:this.view.x+i,y:this.view.y+a}))}setMoved(){this.moved||(this.moved=!0,this.host.requestUpdate())}setHeight(e){e!==this.frameH&&(this.frameH=e,this.host.requestUpdate())}setView(e){this.view=e;let t=this.o.stage();t&&(t.style.transform=this.transform),this.o.onMove()}},vo=class{constructor(e,t){this.host=e,this.o=t,this.room=0,this.quiet=!1,this.onCardKey=e=>{if(e.key===`Tab`&&e.shiftKey&&e.target===this.actions()[0]){let t=this.itemFocus();if(!t)return;e.preventDefault(),this.focusQuietly(t)}else e.key===`Escape`&&this.focusQuietly(this.itemFocus())},this.onTabToCard=e=>{if(e.key!==`Tab`||e.shiftKey||e.defaultPrevented)return;let t=this.itemFocus();if(!t||this.focused!==t)return;let n=this.actions()[0];n&&(e.preventDefault(),n.focus())},e.addController(this)}hostConnected(){this.host.addEventListener(`keydown`,this.onTabToCard)}hostDisconnected(){this.host.removeEventListener(`keydown`,this.onTabToCard)}get root(){return this.host.shadowRoot??this.host}get focused(){return function(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}(this.host.shadowRoot)}card(){return this.root.querySelector(`.insp`)}content(){return this.card()?.querySelector(`slot`)?.assignedElements({flatten:!0})??[]}actions(){return this.content().flatMap(e=>[...e.matches(`button, a[href]`)?[e]:[],...e.querySelectorAll(`button, a[href]`)])}anchor(){let e=this.root.querySelector(`.main > .frame`),t=e?.querySelector(`tr.sel > th`);if(e&&t)return{item:t,clear:t,frame:e};let n=e?.querySelector(`.mark.sel, .taskchip.sel, .node.sel, .cluster.sel`)??this.o.inner()?.querySelector(`.mark.sel`);if(!e||!n)return null;let r=n.classList.contains(`cluster`)?n.querySelector(`:scope > .hd`)??n:n;return{item:r,clear:r.closest(`.node`)??n,frame:e}}place(){let e=this.card(),t=this.o.docked(),n=e&&!t?e.querySelector(`.scroll`).scrollHeight+24+16:0;if(n!==this.room&&(n>this.o.frameH()||this.room>0)&&(this.room=n,this.o.grow()),!e||t)return;let r=this.anchor(),i=this.root.querySelector(`.main`);if(!r||!i)return void e.classList.remove(`placed`);let a=i.getBoundingClientRect(),o=e=>({left:e.left-a.left,top:e.top-a.top,width:e.width,height:e.height}),s=o(r.item.getBoundingClientRect()),c=o(r.clear.getBoundingClientRect()),l=o(r.frame.getBoundingClientRect()),u=r.frame.querySelector(`.mx`)??this.o.inner()?.querySelector(`.mx`),d=go(s,u?o(u.getBoundingClientRect()):l,{width:0,height:0}).shown,f=e.querySelector(`.scroll`);f&&(f.style.maxHeight=`${Math.max(120,l.height-16-24)}px`);let p={width:e.offsetWidth,height:e.offsetHeight},m=go(c,l,p,s);m.fits||r.clear===r.item||r.clear.classList.contains(`node`)||(m=go(s,l,p)),e.classList.toggle(`placed`,m.shown&&d),e.dataset.side=m.side,e.style.left=`${m.x}px`,e.style.top=`${m.y}px`,e.style.setProperty(`--arrow`,`${m.arrow}px`)}itemFocus(){let e=this.anchor();return e?e.item.matches(`button`)?e.item:e.item.querySelector(`.name`):null}describe(){let e=[this.root,this.o.inner()].filter(e=>!!e);for(let t of e)for(let e of t.querySelectorAll(`[aria-describedby="insp"]`))e.removeAttribute(`aria-describedby`);let t=this.itemFocus(),n=this.card();t&&n&&(t.getRootNode()===n.getRootNode()?t.setAttribute(`aria-describedby`,`insp`):`ariaDescribedByElements`in t&&(t.ariaDescribedByElements=[n]));let r=this.content(),i=e=>r.map(t=>t.matches(e)?t:t.querySelector(e)).find(Boolean)??null;return[i(`h1, h2, h3, h4, h5, h6`)?.textContent?.trim()??``,i(`[data-status]`)?.textContent?.trim()??``]}focusQuietly(e){this.quiet=!0,e?.focus(),this.quiet=!1}whenReleased(e){if(!this.o.pressed())return e();globalThis.addEventListener(`pointerup`,()=>setTimeout(e),{once:!0})}revealOverSheet(){let e=this.anchor()?.item;if(!e)return;let t=e.getBoundingClientRect(),n=this.card()?.getBoundingClientRect(),r=Math.min(globalThis.innerHeight,n?.top??1/0);(t.top<0||t.bottom>r)&&e.scrollIntoView({block:`center`})}},yo=(e=14)=>k`<svg class="ic loop-ic" width=${e} height=${e} viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
182
|
+
</div>`}mark(e,t,n,r,i,a){let o=this.states[t.state],s=e.id||t.id,c=this.selected===t.id;return j`<button type="button" part="mark" class="mark ${e.id&&e.id===a?`on`:``} ${c?`sel`:``}" data-tone=${z(o?.tone)} data-shape=${o?.shape??N} data-r=${n} data-c=${r} tabindex=${i?0:-1} title=${t.tip??N} aria-label=${t.label} aria-pressed=${c} @mouseenter=${()=>this.hover=s} @focus=${()=>{this.hover=s,this.cell=[n,r],this.select(t.id)}} @blur=${()=>this.hover=null} @click=${()=>this.select(t.id)} @dblclick=${()=>this.act(t)}></button>`}onKey(e,t){let n=e.target;if(!n.classList.contains(`mark`))return;let r=Number(n.dataset.r),i=Number(n.dataset.c);if(e.key===`Enter`){let n=t[r]?.cells[i];e.preventDefault(),n&&this.act(n);return}let a=function(e,t,n,r,i=!1,a=10){let o=(t,n)=>!0===e[t]?.[n],s=t=>(e[t]??[]).findIndex(Boolean),c=t=>(e[t]??[]).lastIndexOf(!0),l=t=>{let r=e[t]??[],i=-1;return r.forEach((e,t)=>e&&(i<0||Math.abs(t-n)<Math.abs(i-n))&&(i=t)),i<0?null:[t,i]};switch(r){case`ArrowRight`:case`ArrowLeft`:{let i=r===`ArrowRight`?1:-1;for(let r=n+i;r>=0&&r<(e[t]?.length??0);r+=i)if(o(t,r))return[t,r];return null}case`ArrowDown`:case`ArrowUp`:{let i=r===`ArrowDown`?1:-1,a=((t,n,r)=>{for(let i=t;i>=0&&i<e.length;i+=n)if(o(i,r))return i;return-1})(t+i,i,n);if(a>=0)return[a,n];for(let n=t+i;n>=0&&n<e.length;n+=i)if(s(n)>=0)return l(n);return null}case`Home`:{let n=i?e.findIndex(e=>e.some(Boolean)):t;return n<0||s(n)<0?null:[n,s(n)]}case`End`:{let n=t;if(i)for(n=e.length-1;n>=0&&c(n)<0;n--);return n<0||c(n)<0?null:[n,c(n)]}case`PageDown`:case`PageUp`:{let n=r===`PageDown`?1:-1;for(let r=Math.max(0,Math.min(e.length-1,t+n*a));r!==t;r-=n)if(s(r)>=0)return l(r);return null}default:return null}}(t.map(e=>e.cells.map(e=>e!==null)),r,i,e.key,e.ctrlKey||e.metaKey);if(!a)return;e.preventDefault(),this.cell=a;let o=this.renderRoot.querySelector(`.mx`);if(o&&t.length>this.windowAt){let e=24*a[0];(e<o.scrollTop+48||e>o.scrollTop+o.clientHeight-72)&&(o.scrollTop=Math.max(0,e-o.clientHeight/2)),this.scrollRow=Math.floor(o.scrollTop/24)}this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`.matrix .mark[data-r="${a[0]}"][data-c="${a[1]}"]`)?.focus())}};function no(e,t,n){for(let r=0;r<t;r++){let i=0;for(let a of e[r]??[]){if(n>=i&&n<i+a.span&&r+a.rows>t)return!0;i+=a.span}}return!1}var ro=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])},io=(e,t)=>`${e}\0${t}`;function ao(e,t,n){let r=new Set(e),i=new Map(e.map(e=>[e,[]])),a=new Set;for(let[e,n]of t){if(e===n||!r.has(e)||!r.has(n))continue;let t=io(e,n);a.has(t)||(a.add(t),i.get(e)?.push(n))}let o=new Set,s=new Map;for(let t of e){if(s.has(t))continue;s.set(t,1);let e=[[t,0]];for(;e.length;){let t=e[e.length-1],n=i.get(t[0])??[];if(t[1]<n.length){let r=n[t[1]++],i=s.get(r);i===1?o.add(io(t[0],r)):i||(s.set(r,1),e.push([r,0]))}else s.set(t[0],2),e.pop()}}let c=new Map(e.map(e=>[e,[]])),l=new Map(e.map(e=>[e,[]]));for(let[e,t]of i)for(let n of t)o.has(io(e,n))||(c.get(e)?.push(n),l.get(n)?.push(e));let u=new Map(e.map(e=>[e,l.get(e)?.length??0])),d=e.filter(e=>!u.get(e)),f=new Map;for(let e=0;e<d.length;e++){let t=d[e],r=0;for(let e of l.get(t)??[])r=Math.max(r,(f.get(e)??0)+1);f.set(t,n.get(t)??r);for(let e of c.get(t)??[])u.set(e,(u.get(e)??0)-1),u.get(e)||d.push(e)}return f}function oo(e){if(e.length<2)return 0;let t=0;for(let[n,r]of e){if(!Number.isInteger(n)||!Number.isInteger(r)||r<0||r>1e7)return so(e);r>t&&(t=r)}let n=[...e].sort((e,t)=>e[0]-t[0]||e[1]-t[1]),r=Array(t+2).fill(0),i=0;return n.forEach(([,e],t)=>{let n=0;for(let t=e+1;t>0;t-=t&-t)n+=r[t];i+=t-n;for(let t=e+1;t<r.length;t+=t&-t)r[t]=r[t]+1}),i}function so(e){let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let[i,a]=e[n],[o,s]=e[r];(i-o)*(a-s)<0&&t++}return t}var co=e=>e.startsWith(`~`);function lo(e,t,n){let r=new Map;e.forEach((e,t)=>e.forEach(e=>r.set(e,t)));let i=new Map,a=new Map;for(let[e,n]of t)ro(a,e,n),ro(i,n,e);let o=new Map,s=e=>e.forEach((e,t)=>o.set(e,t)),c=e.map(e=>[...e]);c.forEach(s);let l=()=>function(e,t,n,r){if(!e.length)return 0;let i=0,a=new Map;for(let[e,i]of t){let t=r.get(e);t!==void 0&&ro(a,t,[n.get(e)??0,n.get(i)??0])}for(let e of a.values())i+=oo(e);return i}(c,t,o,r),u=c.map(e=>[...e]),d=l(),f=(e,t)=>{let r=new Map;for(let n of e){let e=(t.get(n)??[]).map(e=>o.get(e)).filter(e=>e!==void 0);r.set(n,e.length?e.reduce((e,t)=>e+t,0)/e.length:o.get(n)??0)}let i=e=>r.get(e)??0;if(!n)return[...e].sort((e,t)=>i(e)-i(t)||(o.get(e)??0)-(o.get(t)??0));let a=e.filter(e=>!co(e)),s=e.filter(co).sort((e,t)=>i(e)-i(t)||(o.get(e)??0)-(o.get(t)??0)),c=[],l=0;for(let e of a){for(;l<s.length&&i(s[l])<i(e);)c.push(s[l++]);c.push(e)}return[...c,...s.slice(l)]};for(let e=0;e<4;e++){let t=e%2==0,n=t?c.map((e,t)=>t).slice(1):c.map((e,t)=>t).reverse().slice(1);for(let e of n){let n=f(c[e],t?i:a);c[e]=n,s(n)}let r=l();r<d&&(d=r,u=c.map(e=>[...e]))}return l()<=d?c:u}var uo=new WeakMap,fo=new Map,po=e=>e===void 0?`u`:e===null?`n`:`s${e}`;function mo(e,t,n=!1){let r=function(e){let t=uo.get(e);return t===void 0&&(t=JSON.stringify([e.nodes.map(e=>[po(e.id),po(e.cluster)]),e.clusters.map(e=>[po(e.id),po(e.parent),!!e.cycle]),e.edges.map(e=>[po(e.from),po(e.to),po(e.style),!!e.ranks]),e.stubs.map(e=>[po(e.id),po(e.to),po(e.style)])]),uo.set(e,t)),t}(e),i=fo.get(r)??[];fo.delete(r);let a=i.find(e=>e.prev===t&&e.down===n),o=a?.out??function(e,t,n){let r=new Set(e.clusters.map(e=>e.id)),i=new Map(e.clusters.map(e=>[e.id,e.parent])),a=new Map;for(let t of e.nodes)t.cluster&&a.set(t.id,t.cluster);let o=[...new Set(e.stubs.map(e=>e.id))],s=new Set(o),c=new Map,l=e=>{let t=c.get(e);if(!t){let n=[],o=r.has(e)?e:a.get(e)??null;for(;o;)n.push(o),o=i.get(o)??null;t={list:n,set:new Set(n)},c.set(e,t)}return t},u=e=>l(e).list,d=(e,t)=>{let n=u(e);if(t===``)return n[n.length-1]??e;let r=n.indexOf(t);return r<0?void 0:r===0?e:n[r-1]},f=(e,t)=>{let n=u(e),r=l(t).set;return n.find(e=>r.has(e))??``},p=[``,...e.clusters.map(e=>e.id)],m=new Map(p.map(e=>[e,[]])),h=new Map(p.map(e=>[e,new Set])),g=(e,t)=>{let n=h.get(e);n&&!n.has(t)&&(n.add(t),m.get(e)?.push(t))};for(let{id:t}of e.nodes){let e=u(t);g(``,e[e.length-1]??t),e.forEach((n,r)=>g(n,r===0?t:e[r-1]))}let _=e.edges.map(e=>f(e.from,e.to)),v=new Map;_.forEach((e,t)=>ro(v,e,t));let y=new Map;for(let n of p){let r=m.get(n)??[],i=h.get(n)??new Set,a=n===``?t?.layers:t?.clusters[n],o=new Map;a?.forEach((e,t)=>e.forEach(e=>i.has(e)&&o.set(e,t)));let s=(v.get(n)??[]).map(t=>e.edges[t]).filter(e=>e.ranks).map(e=>[d(e.from,n),d(e.to,n)]);y.set(n,ao(r,s,o))}let b=y.get(``),x=new Map;t?.layers.forEach((e,t)=>e.forEach(e=>x.set(e,t)));let S=new Map;for(let t of e.stubs)S.set(t.id,Math.min(S.get(t.id)??1/0,b.get(d(t.to,``))??0));let ee=new Map(o.map(e=>[e,x.get(e)??S.get(e)-1]));if([...ee.values()].some(e=>e<0)){for(let[e,t]of b)b.set(e,t+1);for(let[e,t]of ee)ee.set(e,t+1)}for(let[e,t]of ee)b.set(e,t);let C=(e,t)=>y.get(e)?.get(t)??0,w=new Map,te=e=>{let t=w.get(e);if(t===void 0){t=0;for(let n of y.get(e)?.values()??[])t=Math.max(t,n);w.set(e,t)}return t},ne=e.edges.map((e,t)=>{let n=_[t];return C(n,d(e.from,n))>=C(n,d(e.to,n))}),re=new Map;for(let e of p){let n=e===``?t?.layers:t?.clusters[e],r=new Map;(n??[]).flat().forEach((e,t)=>r.has(e)||r.set(e,t));let i=[...e===``?[...o]:[],...m.get(e)??[]];i.sort((e,t)=>(r.get(e)??1/0)-(r.get(t)??1/0));let a=Array.from({length:te(e)+1},()=>[]);for(let t of i)a[C(e,t)]?.push(t);re.set(e,a)}let ie=[],ae=new Set,T=(e,t,n,r)=>{let i=`~${e}|${t}|${n}|${r}`;return ae.has(i)||(ae.add(i),re.get(e)?.[r]?.push(i)),{id:i,in:e}},oe=(e,t,n,r)=>{let i=C(e,t),a=`~${e}|by:${t}|${n}|${r}|${i}`;return ae.has(a)||(ae.add(a),re.get(e)?.[i]?.push(a)),{id:a,in:e}},se=(e,t,r)=>{let o=s.has(e)?``:f(e,t),c=(p=e,s.has(p)?``:a.get(p)??``),l=e;var p;let m=[{id:e,in:c}];for(;c!==o;){let e=i.get(c)??``;m.push({id:c,in:e}),C(c,l)<te(c)&&m.push(oe(e,c,l,r)),l=c,c=e}let h=d(t,o);for(let e=C(o,l)+1;e<C(o,h);e++)m.push(T(o,l,r,e));let g=u(t),_=g.slice(0,o===``?g.length:g.indexOf(o)).reverse(),v=`>${o}:${l}`,y=o;for(let e of _){let i=d(t,e);(C(e,i)>0||n)&&m.push(oe(y,e,v,r)),m.push({id:e,in:y}),y=e}return m.push({id:t,in:y}),m};e.edges.forEach((e,t)=>{ne[t]||ie.push({from:e.from,to:e.to,style:e.style,steps:se(e.from,e.to,e.style)})});for(let t of e.stubs)ie.push({from:t.id,to:t.to,style:t.style,steps:se(t.id,t.to,t.style)});let ce=new Map;for(let e of p)ce.set(e,new Map((re.get(e)??[]).flatMap((e,t)=>e.map(e=>[e,t]))));let le=new Map(p.map(e=>[e,[]]));for(let e of ie)for(let t=1;t<e.steps.length;t++){let n=e.steps[t-1],r=e.steps[t];if(n.in!==r.in)continue;let i=ce.get(n.in);i&&i.get(n.id)!==i.get(r.id)&&le.get(n.in)?.push([n.id,r.id])}let ue={};for(let e of p){let n=e===``?!!t:!!t?.clusters[e];ue[e]=lo(re.get(e)??[],le.get(e)??[],n).map(ho)}let de=e=>e.map(e=>e.filter(e=>!co(e))),fe=e.clusters.map(e=>({id:e.id,parent:e.parent,cycle:!!e.cycle,layers:de(ue[e.id]??[]).filter(e=>e.length)})),pe=de(ue[``]??[]).map(e=>e.filter(e=>!s.has(e))),me=new Map(fe.map(e=>[e.id,e])),he=e=>e.flatMap(e=>r.has(e)?he((me.get(e)?.layers??[]).flat()):[e]);return{drawn:he(pe.flat()),layers:pe.filter(e=>e.length),clusters:fe,back:ne,slots:ue,edgePaths:ie,order:{layers:de(ue[``]??[]),clusters:Object.fromEntries(fe.map(e=>[e.id,de(ue[e.id]??[])]))}}}(e,t,n);return fo.set(r,a?i:[...i.slice(-3),{prev:t,down:n,out:o}]),fo.size>16&&fo.delete(fo.keys().next().value),o}function ho(e){let t=e.filter(e=>e.includes(`|by:`)),n=e.filter(e=>!e.includes(`|by:`));if(!t.length)return n;let r=new Map;for(let e of t){let t=new Set;for(let n=e.indexOf(`|by:`);n>=0;n=e.indexOf(`|by:`,n+1)){let i=e.indexOf(`|`,n+4);if(i<0)break;let a=e.slice(n+4,i);t.has(a)||(t.add(a),ro(r,a,e))}}return n.flatMap(e=>[e,...e.includes(`|`)?t.filter(t=>t.includes(`|by:${e}|`)):r.get(e)??[]])}function go(e){let t=new Map(e.clusters.map(e=>[e.id,e])),n=new Map,r=e=>{let i=0,a=0;for(let o of e){let e=0,s=0;for(let i of o){let a=t.get(i),o=a?n.get(i)??n.set(i,r(a.layers)).get(i)??{span:1,stack:1}:{span:1,stack:1};e=Math.max(e,o.span),s+=o.stack}i+=e,a=Math.max(a,s)}return{span:i,stack:a}};return r(e.layers)}var _o={across:{gap:56,boxGap:40,sep:16,pointSep:12,pad:12,padEnd:24,margin:16},down:{gap:40,boxGap:32,sep:16,pointSep:12,pad:10,padEnd:24,margin:16}};function vo(e,t,n){let r=[0];for(let n=1;n<e.length;n++)r.push(r[n-1]+t[n-1]);let i=[];e.forEach((e,t)=>{let a=n[t]??1;for(i.push({sum:a*(e-r[t]),w:a,n:1});i.length>1;){let e=i[i.length-1],t=i[i.length-2];if(t.sum/t.w<=e.sum/e.w)break;i.splice(-2,2,{sum:t.sum+e.sum,w:t.w+e.w,n:t.n+e.n})}});let a=[];for(let e of i)for(let t=0;t<e.n;t++)a.push(e.sum/e.w+r[a.length]);return a}function yo(e,t,n,r,i=0){if(e<=0||t<=0||n<=0)return{k:1,x:0,y:0,h:Math.max(0,t)};let a=Math.min(1,n/e),o=Math.max(i,Math.min(t*a,r)),s=Math.min(a,o/t);return{k:s,x:(n-e*s)/2,y:(o-t*s)/2,h:o}}var bo=(e,t=200)=>e.marks.filter(e=>e!==null).length+e.loose.length>t,xo=(e,t,n)=>n<t?t:Math.min(n,Math.max(t,e));function So(e,t,n,r=e){let i=function(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return i>n&&a>r?{left:n,top:r,width:i-n,height:a-r}:null}(r,t);if(!i)return{shown:!1,x:0,y:0,side:`right`,arrow:0,fits:!1};let{width:a,height:o}=n,s=t.left+8,c=t.top+8,l=t.left+t.width-8,u=t.top+t.height-8,d=e.left+e.width,f=e.top+e.height,p=i.top+i.height/2,m=i.left+i.width/2,h=xo(p-o/2,c,u-o),g=xo(m-a/2,s,l-a),_={right:l-(d+12)-a,left:e.left-12-a-s,below:u-(f+12)-o,above:e.top-12-o-c},v=[`right`,`left`,`below`,`above`],y=v.find(e=>_[e]>=0)??v.reduce((e,t)=>_[t]>_[e]?t:e),b,x;switch(y){case`right`:[b,x]=[xo(d+12,s,l-a),h];break;case`left`:[b,x]=[xo(e.left-12-a,s,l-a),h];break;case`below`:[b,x]=[g,xo(f+12,c,u-o)];break;case`above`:[b,x]=[g,xo(e.top-12-o,c,u-o)]}return{shown:!0,x:b,y:x,side:y,arrow:y===`right`||y===`left`?xo(p-x,14,o-14):xo(m-b,14,a-14),fits:_[y]>=0}}var Co=class{constructor(e,t){this.host=e,this.o=t,this.view={k:1,x:0,y:0},this.frameH=0,this.fitK=1,this.moved=!1,this.pressed=!1,this.pan=null,this.swallowClick=!1,this.onPointerDown=e=>{this.pressed=!0,globalThis.addEventListener(`pointerup`,()=>this.pressed=!1,{once:!0}),e.button!==0||e.target.closest(`.tools`)||this.o.down()&&e.pointerType!==`mouse`||(this.pan={id:e.pointerId,px:e.clientX,py:e.clientY,x:this.view.x,y:this.view.y,far:!1})},this.onPointerMove=e=>{let t=this.pan;if(!t||t.id!==e.pointerId)return;let n=e.clientX-t.px,r=e.clientY-t.py;!t.far&&Math.hypot(n,r)<4||(t.far||(t.far=!0,e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.classList.add(`drag`)),this.setMoved(),this.setView({...this.view,x:t.x+n,y:t.y+r}))},this.onPointerUp=e=>{let t=this.pan;t&&t.id===e.pointerId&&(this.pan=null,e.currentTarget.classList.remove(`drag`),t.far&&(this.swallowClick=!0))},this.onWheel=e=>{if(!this.o.wheel()||!e.ctrlKey&&!e.metaKey)return;let t=this.o.frame();if(!t)return;e.preventDefault();let n=t.getBoundingClientRect();this.zoomBy(Math.exp(.0015*-e.deltaY),e.clientX-n.left,e.clientY-n.top)},this.onClickCapture=e=>{this.swallowClick&&(this.swallowClick=!1,e.stopPropagation(),e.preventDefault())},e.addController(this)}hostConnected(){this.host.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.host.addEventListener(`click`,this.onClickCapture,{capture:!0})}hostDisconnected(){this.host.removeEventListener(`wheel`,this.onWheel),this.host.removeEventListener(`click`,this.onClickCapture,{capture:!0}),this.resize?.disconnect(),this.resize=void 0}hostUpdated(){this.resize||(this.resize=new ResizeObserver(()=>this.o.onResize()),this.resize.observe(this.host))}get transform(){return(e=>`translate(${e.x}px,${e.y}px) scale(${e.k})`)(this.view)}reset(){this.moved=!1}fit(){let e=this.o.drawing();if(!e)return;let t=this.o.frame(),n=t?.clientWidth||this.host.clientWidth,r=yo(e.w,e.h,n,e.down?1/0:Math.max(360,.7*globalThis.innerHeight)),i=t?.clientHeight??0,a=`${i}px`===(t?.style.height??`0px`)?r:yo(e.w,e.h,n,i,i);a.k!==this.fitK&&(this.fitK=a.k,this.host.requestUpdate());let o=e.down?r.h:Math.max(r.h,e.room);this.moved?o>this.frameH&&this.setHeight(o):(this.setHeight(o),a.k===this.view.k&&a.x===this.view.x&&a.y===this.view.y||this.setView({k:a.k,x:a.x,y:a.y}))}showAll(){this.moved=!1,this.fit(),this.host.requestUpdate()}zoomBy(e,t=(this.o.frame()?.clientWidth??this.host.clientWidth)/2,n=(this.o.frame()?.clientHeight??this.frameH)/2){this.setMoved(),this.setView(function(e,t,n,r,i){let a=Math.min(2.5,Math.max(i,e.k*t)),o=a/e.k;return{k:a,x:n-(n-e.x)*o,y:r-(r-e.y)*o}}(this.view,e,t,n,Math.min(1,this.fitK)/2))}reveal(e){let t=this.o.frame();if(!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=0,a=0;r.left<n.left+24?i=n.left+24-r.left:r.right>n.right-24&&(i=n.right-24-r.right),r.top<n.top+24?a=n.top+24-r.top:r.bottom>n.bottom-24&&(a=n.bottom-24-r.bottom),(i||a)&&(this.setMoved(),this.setView({...this.view,x:this.view.x+i,y:this.view.y+a}))}setMoved(){this.moved||(this.moved=!0,this.host.requestUpdate())}setHeight(e){e!==this.frameH&&(this.frameH=e,this.host.requestUpdate())}setView(e){this.view=e;let t=this.o.stage();t&&(t.style.transform=this.transform),this.o.onMove()}},wo=class{constructor(e,t){this.host=e,this.o=t,this.room=0,this.quiet=!1,this.onCardKey=e=>{if(e.key===`Tab`&&e.shiftKey&&e.target===this.actions()[0]){let t=this.itemFocus();if(!t)return;e.preventDefault(),this.focusQuietly(t)}else e.key===`Escape`&&this.focusQuietly(this.itemFocus())},this.onTabToCard=e=>{if(e.key!==`Tab`||e.shiftKey||e.defaultPrevented)return;let t=this.itemFocus();if(!t||this.focused!==t)return;let n=this.actions()[0];n&&(e.preventDefault(),n.focus())},e.addController(this)}hostConnected(){this.host.addEventListener(`keydown`,this.onTabToCard)}hostDisconnected(){this.host.removeEventListener(`keydown`,this.onTabToCard)}get root(){return this.host.shadowRoot??this.host}get focused(){return function(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}(this.host.shadowRoot)}card(){return this.root.querySelector(`.insp`)}content(){return this.card()?.querySelector(`slot`)?.assignedElements({flatten:!0})??[]}actions(){return this.content().flatMap(e=>[...e.matches(`button, a[href]`)?[e]:[],...e.querySelectorAll(`button, a[href]`)])}anchor(){let e=this.root.querySelector(`.main > .frame`),t=e?.querySelector(`tr.sel > th`);if(e&&t)return{item:t,clear:t,frame:e};let n=e?.querySelector(`.mark.sel, .taskchip.sel, .node.sel, .cluster.sel`)??this.o.inner()?.querySelector(`.mark.sel`);if(!e||!n)return null;let r=n.classList.contains(`cluster`)?n.querySelector(`:scope > .hd`)??n:n;return{item:r,clear:r.closest(`.node`)??n,frame:e}}place(){let e=this.card(),t=this.o.docked(),n=e&&!t?e.querySelector(`.scroll`).scrollHeight+24+16:0;if(n!==this.room&&(n>this.o.frameH()||this.room>0)&&(this.room=n,this.o.grow()),!e||t)return;let r=this.anchor(),i=this.root.querySelector(`.main`);if(!r||!i)return void e.classList.remove(`placed`);let a=i.getBoundingClientRect(),o=e=>({left:e.left-a.left,top:e.top-a.top,width:e.width,height:e.height}),s=o(r.item.getBoundingClientRect()),c=o(r.clear.getBoundingClientRect()),l=o(r.frame.getBoundingClientRect()),u=r.frame.querySelector(`.mx`)??this.o.inner()?.querySelector(`.mx`),d=So(s,u?o(u.getBoundingClientRect()):l,{width:0,height:0}).shown,f=e.querySelector(`.scroll`);f&&(f.style.maxHeight=`${Math.max(120,l.height-16-24)}px`);let p={width:e.offsetWidth,height:e.offsetHeight},m=So(c,l,p,s);m.fits||r.clear===r.item||r.clear.classList.contains(`node`)||(m=So(s,l,p)),e.classList.toggle(`placed`,m.shown&&d),e.dataset.side=m.side,e.style.left=`${m.x}px`,e.style.top=`${m.y}px`,e.style.setProperty(`--arrow`,`${m.arrow}px`)}itemFocus(){let e=this.anchor();return e?e.item.matches(`button`)?e.item:e.item.querySelector(`.name`):null}describe(){let e=[this.root,this.o.inner()].filter(e=>!!e);for(let t of e)for(let e of t.querySelectorAll(`[aria-describedby="insp"]`))e.removeAttribute(`aria-describedby`);let t=this.itemFocus(),n=this.card();t&&n&&(t.getRootNode()===n.getRootNode()?t.setAttribute(`aria-describedby`,`insp`):`ariaDescribedByElements`in t&&(t.ariaDescribedByElements=[n]));let r=this.content(),i=e=>r.map(t=>t.matches(e)?t:t.querySelector(e)).find(Boolean)??null;return[i(`h1, h2, h3, h4, h5, h6`)?.textContent?.trim()??``,i(`[data-status]`)?.textContent?.trim()??``]}focusQuietly(e){this.quiet=!0,e?.focus(),this.quiet=!1}whenReleased(e){if(!this.o.pressed())return e();globalThis.addEventListener(`pointerup`,()=>setTimeout(e),{once:!0})}revealOverSheet(){let e=this.anchor()?.item;if(!e)return;let t=e.getBoundingClientRect(),n=this.card()?.getBoundingClientRect(),r=Math.min(globalThis.innerHeight,n?.top??1/0);(t.top<0||t.bottom>r)&&e.scrollIntoView({block:`center`})}},To=(e=14)=>j`<svg class="ic loop-ic" width=${e} height=${e} viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
183
183
|
<path d="M12.7,9.71 A5,5 0 1 1 11.21,4.17" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"></path>
|
|
184
184
|
<path d="M12.44,5.2 L9.15,5.06 L11.73,2 z" fill="currentColor"></path>
|
|
185
|
-
</svg>`,
|
|
185
|
+
</svg>`,Eo=()=>j`<svg class="ic in-ic" width="12" height="12" viewBox="0 0 12 12" aria-hidden="true" focusable="false">
|
|
186
186
|
<rect x="3.4" y="0.7" width="7.9" height="7.9" rx="1.6" fill="none" stroke="currentColor" stroke-width="1.2"></rect>
|
|
187
187
|
<path d="M0.7,3.6 V9.7 Q0.7,11.3 2.3,11.3 H8.4" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"></path>
|
|
188
|
-
</svg>`,xo={graph:`Graph`,table:`Table`,view:`View`,zoomIn:`Zoom in`,zoomInTip:`Zoom in (Ctrl + scroll)`,zoomOut:`Zoom out`,zoomOutTip:`Zoom out (Ctrl + scroll)`,showAll:`Show all`,graphKeys:[`Tab: next node`,`Arrow keys: marks`,`Shift + arrow keys: earlier and later nodes`,`Enter: open`],tableKeys:[`Tab: next row`,`Enter: open`],matrixKeys:[`Arrow keys: marks`,`Enter: open`],clearKey:`Esc: clear selection`,upKey:``,inspector:`Selected item`,stubTip:`Outside this graph`,more:e=>`+${e}`,progress:(e,t)=>`${e} of ${t} done`,badge:`count`,solidEdge:`link`,dottedEdge:`second link`,dashedEdge:`other link`,cycle:`next round`,drill:`has an inner view`,open:`Show inside`,close:`Hide inside`,iconNames:{},nameHeader:`Name`,statusHeader:`Status`,solidHeader:`Earlier`,dottedHeader:`Dotted link from`,dashedHeader:`Dashed link from`,laterHeader:`Later`,none:`none`,inCluster:e=>`${e} in the cluster`,list:e=>new Intl.ListFormat(`en`,{type:`conjunction`}).format(e)},So=O` :host{display:block;container-type:inline-size;}.col,.main{display:flex;flex-direction:column;}.col{height:100%;}.main{flex:auto;min-height:0;}.frame{flex:auto;position:relative;overflow:hidden;border-radius:8px;background:var(--well);box-sizing:border-box;}.gframe{cursor:grab;touch-action:none;}.gframe.drag{cursor:grabbing;}.stage{position:absolute;left:0;top:0;transform-origin:0 0;}.gframe.down{touch-action:pan-y pinch-zoom;}.view{animation:view-in 0.1s var(--ease) both;}@keyframes view-in{from{opacity:0;}}@media (prefers-reduced-motion:reduce){.view{animation:none;}}.tools{display:flex;align-items:center;gap:4px;justify-self:end;}.tools button{all:unset;cursor:pointer;min-width:22px;height:22px;padding:0 7px;box-sizing:border-box;text-align:center;font-size:11.5px;line-height:22px;color:var(--text-2);border-radius:6px;border:1px solid var(--line);}.tools button:hover:not(:disabled){color:var(--text);border-color:var(--line2);}.tools button:focus-visible,.loopchip:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.tools button:disabled{cursor:default;opacity:0.4;}.views{margin-left:6px;}.dag{position:relative;}.dag.unplaced{visibility:hidden;}.dag>*,.cluster>.in>*{position:absolute;}.edges{left:0;top:0;pointer-events:none;overflow:visible;z-index:0;}.edges path{fill:none;stroke:var(--line2);stroke-width:1.5;}.edges path.dashed{stroke-dasharray:5 4;}.edges path.dotted,.legend svg path.dotted{stroke-dasharray:0.1 4;stroke-linecap:round;stroke-width:2;}.edges path.ret,.legend svg path.ret{stroke:var(--text-2);stroke-width:2;stroke-dasharray:0.1 4;stroke-linecap:round;opacity:0.8;}.edges path.ret-tip,.legend svg path.ret-head{fill:var(--text-2);stroke:none;opacity:0.8;}.ic{display:block;flex:none;}.loop-ic{color:var(--text-2);}.tip-ic{display:inline-flex;line-height:0;}.in-ic{color:var(--text-muted);}.stub{z-index:1;font-family:var(--mono);font-size:11.5px;color:var(--text-muted);padding:3px 9px;border-radius:999px;border:1px solid var(--line);background:var(--card);white-space:nowrap;}.cluster{z-index:1;box-sizing:border-box;border-radius:14px;border:1px solid var(--line2);background:color-mix(in srgb,var(--text-muted) 5%,transparent);}.cluster .cluster{background:color-mix(in srgb,var(--text-muted) 6%,transparent);}.cluster>.in{position:absolute;inset:0;pointer-events:none;}.cluster>.in>*{pointer-events:auto;}.cluster>.hd{position:absolute;left:11px;top:6px;display:flex;flex-direction:column;align-items:flex-start;gap:1px;white-space:nowrap;padding-right:22px;cursor:pointer;}.cluster>.hd .line{display:flex;align-items:center;gap:8px;}.cluster>.hd .name{display:inline-flex;align-items:center;gap:5px;}.cluster.sel{outline:var(--focus-width) solid var(--accent);outline-offset:2px;}.cluster>.hd .spread{font-size:11px;color:var(--text-2);font-variant-numeric:tabular-nums;}.node{z-index:1;width:max-content;min-width:120px;box-sizing:border-box;display:flex;flex-direction:column;gap:7px;padding:8px 10px 9px;border-radius:10px;border:1px solid var(--line);background:var(--card);transition:border-color 0.3s,box-shadow 0.3s;cursor:pointer;box-shadow:var(--ex,0 0 0 0 transparent);}.node.accent{--ex:inset 3px 0 0 -1px color-mix(in srgb,var(--agent) 60%,transparent);}.node .nm{display:flex;align-items:center;min-width:0;gap:0;}.node .right{display:flex;align-items:center;gap:8px;}.node .right>.tog{margin-inline-end:0;}.cue{display:block;line-height:0;}.cluster>.cue{position:absolute;top:9px;right:10px;padding:2px;margin:-2px;}.tog{all:unset;cursor:pointer;display:inline-flex;line-height:0;padding:2px;margin:-2px;border-radius:4px;color:var(--text-2);}.tog:hover{color:var(--text);background:var(--raise);}.tog:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.cluster>.hd .psep{color:var(--text-muted);font-size:11px;}.cluster>.hd .part{all:unset;cursor:pointer;font-family:var(--mono);font-weight:600;font-size:12.5px;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px;}.cluster>.hd .part:hover{color:var(--text);text-decoration:underline;}.cluster>.hd .part:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.node.sel{outline:var(--focus-width) solid var(--accent);outline-offset:2px;}.node.drill{box-shadow:4px 4px 0 -1px var(--card),4px 4px 0 0 var(--line2);}.node[data-look='running']{border-color:var(--status-running);}.node.drill[data-look='running']{box-shadow:4px 4px 0 -1px var(--card),4px 4px 0 0 var(--status-running),0 0 14px var(--status-running-bg);}.node:not(.drill)[data-look='running']{box-shadow:var(--ex,0 0 0 0 transparent),0 0 14px var(--status-running-bg);}.node[data-look='failed']{border-color:color-mix(in srgb,var(--status-failed) 55%,transparent);}.node:focus-within{border-color:var(--text-2);}.hd{display:flex;align-items:center;justify-content:space-between;gap:12px;}.name{all:unset;cursor:pointer;font-family:var(--mono);font-weight:600;font-size:12.5px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px;}.name:hover{text-decoration:underline;}.name:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.count{font-size:11px;color:var(--text-muted);font-variant-numeric:tabular-nums;white-space:nowrap;}.ex{display:flex;flex-wrap:wrap;gap:0 10px;font-size:11px;line-height:1.5;contain:inline-size;}:is(.ex,.st) .err{color:var(--status-failed);}:is(.ex,.st) .warn{color:var(--status-attention);}:is(.ex,.st) .live{color:var(--status-running);}:is(.ex,.st) .mut{color:var(--text-muted);}.marks{display:grid;grid-template-columns:repeat(var(--cols),var(--m));gap:var(--g);}.slot{width:var(--m);height:var(--m);}.expected{display:inline-block;align-self:flex-start;width:max-content;margin-top:6px;padding:0 7px;border:1.5px dotted var(--line2);border-radius:999px;font-size:11px;line-height:18px;color:var(--text-muted);}.taskchip.sel{outline:var(--focus-width) solid var(--accent);outline-offset:1px;}.hl .mark:not(.on){opacity:0.16;}.hl .mark.on{transform:scale(1.2);}.hl .mark.on[data-link]{outline:1.5px solid var(--text-2);outline-offset:2px;}.hl .mark.on[data-link='dotted']{outline-style:dotted;}.hl .mark.on[data-link='dashed']{outline-style:dashed;}@media (prefers-reduced-motion:reduce){.node{transition:none;}}.sbar{display:flex;width:220px;height:10px;border-radius:3px;overflow:hidden;background:var(--track);gap:1px;}.sbar i{display:block;min-width:2px;height:100%;background:var(--tone,var(--line2));}.sbar i:not([data-tone]){--tone:initial;}.sbar i[data-tone='done']{opacity:0.85;}.sbar i[data-tone='muted']{opacity:0.5;}.sbar i[data-shape='hatched']{background:repeating-linear-gradient(135deg,var(--tone-bg) 0 2px,color-mix(in srgb,var(--tone) 60%,transparent) 2px 3px);}.sbar i[data-shape='half']{background:linear-gradient(0deg,var(--tone) 50%,var(--tone-bg) 50%);}.fails{display:flex;flex-wrap:wrap;align-items:center;gap:4px;max-width:220px;font-size:11px;color:var(--text-muted);}.fails .taskchip{color:var(--status-failed);border-color:color-mix(in srgb,var(--status-failed) 45%,transparent);}.fails .taskchip:focus-visible{outline:var(--focus-width) solid var(--text);outline-offset:1px;}.hl .fails .taskchip:not(.on){opacity:0.4;}.mxframe{display:grid;grid-template-columns:minmax(0,1fr);place-items:center;padding:14px 16px;}.foot{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:6px 14px;margin-top:6px;}.legend{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:11px;color:var(--text-muted);}.legend span{display:inline-flex;align-items:center;gap:6px;}.legend .mark{--m:12px;cursor:default;animation:none;}.legend .mark:hover{transform:none;outline:none;}.legend i.mark{border-radius:3px;}.legend i.mark:is([data-shape='square'],[data-shape='hatched']){border-radius:2px;}.legend i.mark[data-shape='hatched']{background:repeating-linear-gradient(135deg,transparent 0 2px,color-mix(in srgb,var(--tone) 55%,transparent) 2px 3px);}.legend i.mark[data-shape='half']{border-radius:50%;}.legend svg path{stroke:var(--line2);stroke-width:1.5;fill:none;}.main{position:relative;min-width:0;}.sep{color:var(--text-muted);}.insp{position:absolute;left:0;top:0;z-index:6;width:272px;max-width:calc(100% - 16px);box-sizing:border-box;display:flex;flex-direction:column;gap:9px;padding:10px 12px 12px;border-radius:10px;border:1px solid var(--accent);background:var(--card);font-size:12px;overflow:visible;box-shadow:0 12px 32px color-mix(in srgb,var(--shadow) 55%,transparent);visibility:hidden;animation:insp-in 0.12s var(--ease) both;}.insp.placed{visibility:visible;}.insp .scroll{display:flex;flex-direction:column;gap:9px;min-height:0;overflow:auto;}.insp .ptr{position:absolute;width:10px;height:10px;background:var(--card);border:1px solid var(--accent);transform:rotate(45deg);}.insp[data-side='right'] .ptr{left:-6px;top:calc(var(--arrow) - 5px);border-top:0;border-right:0;}.insp[data-side='left'] .ptr{right:-6px;top:calc(var(--arrow) - 5px);border-bottom:0;border-left:0;}.insp[data-side='below'] .ptr{top:-6px;left:calc(var(--arrow) - 5px);border-bottom:0;border-right:0;}.insp[data-side='above'] .ptr{bottom:-6px;left:calc(var(--arrow) - 5px);border-top:0;border-left:0;}.insp.sheet{position:sticky;bottom:8px;width:auto;max-width:none;margin-top:8px;visibility:visible;}.insp.sheet .ptr{display:none;}@keyframes insp-in{from{opacity:0;transform:scale(0.96);}to{opacity:1;transform:none;}}.keys{grid-column:1 / -1;font-size:11px;color:var(--text-muted);visibility:hidden;}.keys span{white-space:nowrap;}:host(:focus-within) .keys{visibility:visible;}@container (max-width:560px){.foot{grid-template-columns:minmax(0,1fr);}.tools{grid-row:1;justify-self:start;flex-wrap:wrap;}.keys span{white-space:normal;}}@media not (any-pointer:fine){.keys{display:none;}}.tframe{overflow:auto;padding:0 12px 10px;background:linear-gradient(transparent,var(--well) 70%) center bottom / 100% 28px no-repeat local,radial-gradient(farthest-side at 50% 100%,color-mix(in srgb,var(--text-muted) 30%,transparent),transparent) center bottom / 100% 12px no-repeat scroll,var(--well);}table.list{width:100%;border-collapse:separate;border-spacing:0;font-size:12px;font-variant-numeric:tabular-nums;}.list th,.list td{text-align:left;vertical-align:middle;padding:6px 10px;border-bottom:1px solid var(--line);}.list .fit{width:1%;white-space:nowrap;}.list thead th{position:sticky;top:0;z-index:2;background:var(--well);color:var(--text-muted);font-weight:500;font-size:11px;white-space:nowrap;padding-top:10px;}.list tbody th{font-weight:600;}.list td{color:var(--text-2);}.list .rel>span{display:block;min-width:14ch;}.list tbody tr{cursor:pointer;}.list tbody tr:hover>*{background-color:color-mix(in srgb,var(--text-muted) 8%,transparent);}.list tbody tr.sel>*{background-color:var(--accent-bg);}.list tbody tr.sel>th{box-shadow:inset 2px 0 0 var(--accent);}.list .nm{display:inline-flex;align-items:center;gap:8px;vertical-align:middle;}.list .nm .in-ic{margin-right:-2px;}.list .name{max-width:32ch;}.loopchip{display:inline-flex;align-items:center;gap:4px;font-family:var(--sans);font-weight:400;}.loopchip .ic{color:var(--text-muted);}.list .st .n{color:var(--text);}`,Co=$r(class extends ei{constructor(){super(...arguments),this.key=j}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(Si(e),this.key=t),n}}),wo=(e,t)=>[...e.marks.map((e,n)=>e?{m:e,series:t[n]??``}:null),...e.loose.map(e=>({m:e,series:``}))];function To(e,t){let n=e.marks.length+e.loose.length,r=function(e){return e<=12?{cols:Math.max(1,e),size:12}:e<=100?{cols:10,size:10}:{cols:20,size:6}}(e.marks.length?t:n);return{cols:Math.min(r.cols,Math.max(1,n)),size:r.size,gap:r.size>=10?4:2}}function Eo(e){return Math.max(0,e.findIndex(e=>e!==null))}var Do={failed:`err`,attention:`warn`,running:`live`,muted:`mut`};function Oo(e,t,n){let r=e.lay?.at[t];if(!r)return`left:0;top:0`;let i=n?n.x+1:0,a=n?n.y+1:0;return`left:${r.x-i}px;top:${r.y-a}px`}function ko(e,t,n){t.target.closest(`.mark, .taskchip, .node, .cluster`)===t.currentTarget&&(t.stopPropagation(),t.detail>=2||e.select(n))}function Ao(e,t,n){t.target.closest(`.mark, .taskchip, .node, .cluster`)===t.currentTarget&&(t.stopPropagation(),e.act(n))}function jo(e,t,n){t.key===`Enter`&&(t.preventDefault(),e.act(n))}function Mo(e,t,n,r){let i=r?e.words.close:e.words.open;return k`<button type="button" class="tog" part="toggle" aria-expanded=${r} aria-label=${`${i}: ${n}`} title=${i} @click=${n=>{n.stopPropagation(),e.toggle(t,!r)}} @dblclick=${e=>e.stopPropagation()}>${(e=>k`<svg class="ic tog-ic" width="12" height="12" viewBox="0 0 12 12" aria-hidden="true" focusable="false">
|
|
188
|
+
</svg>`,Do={graph:`Graph`,table:`Table`,view:`View`,zoomIn:`Zoom in`,zoomInTip:`Zoom in (Ctrl + scroll)`,zoomOut:`Zoom out`,zoomOutTip:`Zoom out (Ctrl + scroll)`,showAll:`Show all`,graphKeys:[`Tab: next node`,`Arrow keys: marks`,`Shift + arrow keys: earlier and later nodes`,`Enter: open`],tableKeys:[`Tab: next row`,`Enter: open`],matrixKeys:[`Arrow keys: marks`,`Enter: open`],clearKey:`Esc: clear selection`,upKey:``,inspector:`Selected item`,stubTip:`Outside this graph`,more:e=>`+${e}`,progress:(e,t)=>`${e} of ${t} done`,badge:`count`,solidEdge:`link`,dottedEdge:`second link`,dashedEdge:`other link`,cycle:`next round`,drill:`has an inner view`,open:`Show inside`,close:`Hide inside`,iconNames:{},nameHeader:`Name`,statusHeader:`Status`,solidHeader:`Earlier`,dottedHeader:`Dotted link from`,dashedHeader:`Dashed link from`,laterHeader:`Later`,none:`none`,inCluster:e=>`${e} in the cluster`,list:e=>new Intl.ListFormat(`en`,{type:`conjunction`}).format(e)},Oo=A` :host{display:block;container-type:inline-size;}.col,.main{display:flex;flex-direction:column;}.col{height:100%;}.main{flex:auto;min-height:0;}.frame{flex:auto;position:relative;overflow:hidden;border-radius:8px;background:var(--well);box-sizing:border-box;}.gframe{cursor:grab;touch-action:none;}.gframe.drag{cursor:grabbing;}.stage{position:absolute;left:0;top:0;transform-origin:0 0;}.gframe.down{touch-action:pan-y pinch-zoom;}.view{animation:view-in 0.1s var(--ease) both;}@keyframes view-in{from{opacity:0;}}@media (prefers-reduced-motion:reduce){.view{animation:none;}}.tools{display:flex;align-items:center;gap:4px;justify-self:end;}.tools button{all:unset;cursor:pointer;min-width:22px;height:22px;padding:0 7px;box-sizing:border-box;text-align:center;font-size:11.5px;line-height:22px;color:var(--text-2);border-radius:6px;border:1px solid var(--line);}.tools button:hover:not(:disabled){color:var(--text);border-color:var(--line2);}.tools button:focus-visible,.loopchip:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.tools button:disabled{cursor:default;opacity:0.4;}.views{margin-left:6px;}.dag{position:relative;}.dag.unplaced{visibility:hidden;}.dag>*,.cluster>.in>*{position:absolute;}.edges{left:0;top:0;pointer-events:none;overflow:visible;z-index:0;}.edges path{fill:none;stroke:var(--line2);stroke-width:1.5;}.edges path.dashed{stroke-dasharray:5 4;}.edges path.dotted,.legend svg path.dotted{stroke-dasharray:0.1 4;stroke-linecap:round;stroke-width:2;}.edges path.ret,.legend svg path.ret{stroke:var(--text-2);stroke-width:2;stroke-dasharray:0.1 4;stroke-linecap:round;opacity:0.8;}.edges path.ret-tip,.legend svg path.ret-head{fill:var(--text-2);stroke:none;opacity:0.8;}.ic{display:block;flex:none;}.loop-ic{color:var(--text-2);}.tip-ic{display:inline-flex;line-height:0;}.in-ic{color:var(--text-muted);}.stub{z-index:1;font-family:var(--mono);font-size:11.5px;color:var(--text-muted);padding:3px 9px;border-radius:999px;border:1px solid var(--line);background:var(--card);white-space:nowrap;}.cluster{z-index:1;box-sizing:border-box;border-radius:14px;border:1px solid var(--line2);background:color-mix(in srgb,var(--text-muted) 5%,transparent);}.cluster .cluster{background:color-mix(in srgb,var(--text-muted) 6%,transparent);}.cluster>.in{position:absolute;inset:0;pointer-events:none;}.cluster>.in>*{pointer-events:auto;}.cluster>.hd{position:absolute;left:11px;top:6px;display:flex;flex-direction:column;align-items:flex-start;gap:1px;white-space:nowrap;padding-right:22px;cursor:pointer;}.cluster>.hd .line{display:flex;align-items:center;gap:8px;}.cluster>.hd .name{display:inline-flex;align-items:center;gap:5px;}.cluster.sel{outline:var(--focus-width) solid var(--accent);outline-offset:2px;}.cluster>.hd .spread{font-size:11px;color:var(--text-2);font-variant-numeric:tabular-nums;}.node{z-index:1;width:max-content;min-width:120px;box-sizing:border-box;display:flex;flex-direction:column;gap:7px;padding:8px 10px 9px;border-radius:10px;border:1px solid var(--line);background:var(--card);transition:border-color 0.3s,box-shadow 0.3s;cursor:pointer;box-shadow:var(--ex,0 0 0 0 transparent);}.node.accent{--ex:inset 3px 0 0 -1px color-mix(in srgb,var(--agent) 60%,transparent);}.node .nm{display:flex;align-items:center;min-width:0;gap:0;}.node .right{display:flex;align-items:center;gap:8px;}.node .right>.tog{margin-inline-end:0;}.cue{display:block;line-height:0;}.cluster>.cue{position:absolute;top:9px;right:10px;padding:2px;margin:-2px;}.tog{all:unset;cursor:pointer;display:inline-flex;line-height:0;padding:2px;margin:-2px;border-radius:4px;color:var(--text-2);}.tog:hover{color:var(--text);background:var(--raise);}.tog:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.cluster>.hd .psep{color:var(--text-muted);font-size:11px;}.cluster>.hd .part{all:unset;cursor:pointer;font-family:var(--mono);font-weight:600;font-size:12.5px;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px;}.cluster>.hd .part:hover{color:var(--text);text-decoration:underline;}.cluster>.hd .part:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.node.sel{outline:var(--focus-width) solid var(--accent);outline-offset:2px;}.node.drill{box-shadow:4px 4px 0 -1px var(--card),4px 4px 0 0 var(--line2);}.node[data-look='running']{border-color:var(--status-running);}.node.drill[data-look='running']{box-shadow:4px 4px 0 -1px var(--card),4px 4px 0 0 var(--status-running),0 0 14px var(--status-running-bg);}.node:not(.drill)[data-look='running']{box-shadow:var(--ex,0 0 0 0 transparent),0 0 14px var(--status-running-bg);}.node[data-look='failed']{border-color:color-mix(in srgb,var(--status-failed) 55%,transparent);}.node:focus-within{border-color:var(--text-2);}.hd{display:flex;align-items:center;justify-content:space-between;gap:12px;}.name{all:unset;cursor:pointer;font-family:var(--mono);font-weight:600;font-size:12.5px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px;}.name:hover{text-decoration:underline;}.name:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.count{font-size:11px;color:var(--text-muted);font-variant-numeric:tabular-nums;white-space:nowrap;}.ex{display:flex;flex-wrap:wrap;gap:0 10px;font-size:11px;line-height:1.5;contain:inline-size;}:is(.ex,.st) .err{color:var(--status-failed);}:is(.ex,.st) .warn{color:var(--status-attention);}:is(.ex,.st) .live{color:var(--status-running);}:is(.ex,.st) .mut{color:var(--text-muted);}.marks{display:grid;grid-template-columns:repeat(var(--cols),var(--m));gap:var(--g);}.slot{width:var(--m);height:var(--m);}.expected{display:inline-block;align-self:flex-start;width:max-content;margin-top:6px;padding:0 7px;border:1.5px dotted var(--line2);border-radius:999px;font-size:11px;line-height:18px;color:var(--text-muted);}.taskchip.sel{outline:var(--focus-width) solid var(--accent);outline-offset:1px;}.hl .mark:not(.on){opacity:0.16;}.hl .mark.on{transform:scale(1.2);}.hl .mark.on[data-link]{outline:1.5px solid var(--text-2);outline-offset:2px;}.hl .mark.on[data-link='dotted']{outline-style:dotted;}.hl .mark.on[data-link='dashed']{outline-style:dashed;}@media (prefers-reduced-motion:reduce){.node{transition:none;}}.sbar{display:flex;width:220px;height:10px;border-radius:3px;overflow:hidden;background:var(--track);gap:1px;}.sbar i{display:block;min-width:2px;height:100%;background:var(--tone,var(--line2));}.sbar i:not([data-tone]){--tone:initial;}.sbar i[data-tone='done']{opacity:0.85;}.sbar i[data-tone='muted']{opacity:0.5;}.sbar i[data-shape='hatched']{background:repeating-linear-gradient(135deg,var(--tone-bg) 0 2px,color-mix(in srgb,var(--tone) 60%,transparent) 2px 3px);}.sbar i[data-shape='half']{background:linear-gradient(0deg,var(--tone) 50%,var(--tone-bg) 50%);}.fails{display:flex;flex-wrap:wrap;align-items:center;gap:4px;max-width:220px;font-size:11px;color:var(--text-muted);}.fails .taskchip{color:var(--status-failed);border-color:color-mix(in srgb,var(--status-failed) 45%,transparent);}.fails .taskchip:focus-visible{outline:var(--focus-width) solid var(--text);outline-offset:1px;}.hl .fails .taskchip:not(.on){opacity:0.4;}.mxframe{display:grid;grid-template-columns:minmax(0,1fr);place-items:center;padding:14px 16px;}.foot{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:6px 14px;margin-top:6px;}.legend{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:11px;color:var(--text-muted);}.legend span{display:inline-flex;align-items:center;gap:6px;}.legend .mark{--m:12px;cursor:default;animation:none;}.legend .mark:hover{transform:none;outline:none;}.legend i.mark{border-radius:3px;}.legend i.mark:is([data-shape='square'],[data-shape='hatched']){border-radius:2px;}.legend i.mark[data-shape='hatched']{background:repeating-linear-gradient(135deg,transparent 0 2px,color-mix(in srgb,var(--tone) 55%,transparent) 2px 3px);}.legend i.mark[data-shape='half']{border-radius:50%;}.legend svg path{stroke:var(--line2);stroke-width:1.5;fill:none;}.main{position:relative;min-width:0;}.sep{color:var(--text-muted);}.insp{position:absolute;left:0;top:0;z-index:6;width:272px;max-width:calc(100% - 16px);box-sizing:border-box;display:flex;flex-direction:column;gap:9px;padding:10px 12px 12px;border-radius:10px;border:1px solid var(--accent);background:var(--card);font-size:12px;overflow:visible;box-shadow:0 12px 32px color-mix(in srgb,var(--shadow) 55%,transparent);visibility:hidden;animation:insp-in 0.12s var(--ease) both;}.insp.placed{visibility:visible;}.insp .scroll{display:flex;flex-direction:column;gap:9px;min-height:0;overflow:auto;}.insp .ptr{position:absolute;width:10px;height:10px;background:var(--card);border:1px solid var(--accent);transform:rotate(45deg);}.insp[data-side='right'] .ptr{left:-6px;top:calc(var(--arrow) - 5px);border-top:0;border-right:0;}.insp[data-side='left'] .ptr{right:-6px;top:calc(var(--arrow) - 5px);border-bottom:0;border-left:0;}.insp[data-side='below'] .ptr{top:-6px;left:calc(var(--arrow) - 5px);border-bottom:0;border-right:0;}.insp[data-side='above'] .ptr{bottom:-6px;left:calc(var(--arrow) - 5px);border-top:0;border-left:0;}.insp.sheet{position:sticky;bottom:8px;width:auto;max-width:none;margin-top:8px;visibility:visible;}.insp.sheet .ptr{display:none;}@keyframes insp-in{from{opacity:0;transform:scale(0.96);}to{opacity:1;transform:none;}}.keys{grid-column:1 / -1;font-size:11px;color:var(--text-muted);visibility:hidden;}.keys span{white-space:nowrap;}:host(:focus-within) .keys{visibility:visible;}@container (max-width:560px){.foot{grid-template-columns:minmax(0,1fr);}.tools{grid-row:1;justify-self:start;flex-wrap:wrap;}.keys span{white-space:normal;}}@media not (any-pointer:fine){.keys{display:none;}}.tframe{overflow:auto;padding:0 12px 10px;background:linear-gradient(transparent,var(--well) 70%) center bottom / 100% 28px no-repeat local,radial-gradient(farthest-side at 50% 100%,color-mix(in srgb,var(--text-muted) 30%,transparent),transparent) center bottom / 100% 12px no-repeat scroll,var(--well);}table.list{width:100%;border-collapse:separate;border-spacing:0;font-size:12px;font-variant-numeric:tabular-nums;}.list th,.list td{text-align:left;vertical-align:middle;padding:6px 10px;border-bottom:1px solid var(--line);}.list .fit{width:1%;white-space:nowrap;}.list thead th{position:sticky;top:0;z-index:2;background:var(--well);color:var(--text-muted);font-weight:500;font-size:11px;white-space:nowrap;padding-top:10px;}.list tbody th{font-weight:600;}.list td{color:var(--text-2);}.list .rel>span{display:block;min-width:14ch;}.list tbody tr{cursor:pointer;}.list tbody tr:hover>*{background-color:color-mix(in srgb,var(--text-muted) 8%,transparent);}.list tbody tr.sel>*{background-color:var(--accent-bg);}.list tbody tr.sel>th{box-shadow:inset 2px 0 0 var(--accent);}.list .nm{display:inline-flex;align-items:center;gap:8px;vertical-align:middle;}.list .nm .in-ic{margin-right:-2px;}.list .name{max-width:32ch;}.loopchip{display:inline-flex;align-items:center;gap:4px;font-family:var(--sans);font-weight:400;}.loopchip .ic{color:var(--text-muted);}.list .st .n{color:var(--text);}`,ko=$r(class extends ei{constructor(){super(...arguments),this.key=N}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(Si(e),this.key=t),n}}),Ao=(e,t)=>[...e.marks.map((e,n)=>e?{m:e,series:t[n]??``}:null),...e.loose.map(e=>({m:e,series:``}))];function jo(e,t){let n=e.marks.length+e.loose.length,r=function(e){return e<=12?{cols:Math.max(1,e),size:12}:e<=100?{cols:10,size:10}:{cols:20,size:6}}(e.marks.length?t:n);return{cols:Math.min(r.cols,Math.max(1,n)),size:r.size,gap:r.size>=10?4:2}}function Mo(e){return Math.max(0,e.findIndex(e=>e!==null))}var No={failed:`err`,attention:`warn`,running:`live`,muted:`mut`};function Po(e,t,n){let r=e.lay?.at[t];if(!r)return`left:0;top:0`;let i=n?n.x+1:0,a=n?n.y+1:0;return`left:${r.x-i}px;top:${r.y-a}px`}function Fo(e,t,n){t.target.closest(`.mark, .taskchip, .node, .cluster`)===t.currentTarget&&(t.stopPropagation(),t.detail>=2||e.select(n))}function Io(e,t,n){t.target.closest(`.mark, .taskchip, .node, .cluster`)===t.currentTarget&&(t.stopPropagation(),e.act(n))}function Lo(e,t,n){t.key===`Enter`&&(t.preventDefault(),e.act(n))}function Ro(e,t,n,r){let i=r?e.words.close:e.words.open;return j`<button type="button" class="tog" part="toggle" aria-expanded=${r} aria-label=${`${i}: ${n}`} title=${i} @click=${n=>{n.stopPropagation(),e.toggle(t,!r)}} @dblclick=${e=>e.stopPropagation()}>${(e=>j`<svg class="ic tog-ic" width="12" height="12" viewBox="0 0 12 12" aria-hidden="true" focusable="false">
|
|
189
189
|
<rect x="0.7" y="0.7" width="10.6" height="10.6" rx="2.2" fill="none" stroke="currentColor" stroke-width="1.2"></rect>
|
|
190
190
|
<path d=${e?`M3.5,6 H8.5`:`M3.5,6 H8.5 M6,3.5 V8.5`} fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"></path>
|
|
191
|
-
</svg>`)(r)}</button>`}var
|
|
192
|
-
`)||j} aria-label=${o.label} aria-pressed=${!!f} @mouseenter=${()=>e.hover=l} @focus=${p} @blur=${()=>e.hover=null} @click=${()=>e.select(o.id)} @dblclick=${()=>e.act(o.id)}></button>`}function Fo(e,t,n){let r=t.target;if(!r.classList.contains(`mark`)&&!r.classList.contains(`taskchip`))return;if(t.shiftKey&&t.key.startsWith(`Arrow`))return function(e,t,n){let r=t.key===`ArrowRight`||t.key===`ArrowDown`?`later`:`earlier`,i=e.lay,a=function(e,t,n,r){let i=new Map(e.drawn.map((e,t)=>[e,t])),a=[...new Set(e.edges.filter((r,i)=>!e.back[i]&&(n===`later`?r.from===t:r.to===t)).map(e=>n===`later`?e.to:e.from))],o=r(t);return a.sort((e,t)=>Math.abs(r(e)-o)-Math.abs(r(t)-o)||(i.get(e)??0)-(i.get(t)??0)),a[0]??null}({drawn:e.arr.drawn,edges:e.drawn.edges,back:e.arr.back},n.id,r,e=>{let t=i?.at[e];return t?i?.down?t.x+t.w/2:t.y+t.h/2:0});if(t.preventDefault(),!a)return;let o=e.nodes.get(a);if(!o)return;let s=n.slots[e.active.get(n.id)??Eo(n.slots)]?.series??``,c=wo(o,e.drawn.series),l=mo(o,e.barAt)?c.filter(t=>!!t&&e.states[t.m.state]?.tone===`failed`):c,u=s?l.findIndex(e=>e?.series===s):-1,d=u>=0?u:e.active.get(o.id)??Eo(l);e.active.set(o.id,d),e.requestUpdate(),e.updateComplete.then(()=>{let t=e.renderRoot.querySelector(`.node[data-id="${CSS.escape(a)}"]`);(t?.querySelector(`[data-i="${d}"]`)??t?.querySelector(`.name`))?.focus()})}(e,t,n);let{slots:i}=n;if(t.key===`Enter`){let n=i[Number(r.dataset.i)];t.preventDefault(),n&&e.act(n.m.id);return}let a=e.active.get(n.id)??Eo(i),o={ArrowRight:1,ArrowLeft:-1,ArrowDown:n.grid.cols,ArrowUp:-n.grid.cols},s;if(t.key===`Home`)s=Eo(i);else if(t.key===`End`)s=i.length-1-[...i].reverse().findIndex(e=>e!==null);else{if(o[t.key]===void 0)return;{let e=o[t.key];for(s=a+e;s>=0&&s<i.length&&!i[s];)s+=Math.sign(e);if(s<0||s>=i.length)return}}t.preventDefault(),e.active.set(n.id,s),e.requestUpdate();let c=t.currentTarget;e.updateComplete.then(()=>c.querySelector(`[data-i="${s}"]`)?.focus())}var Io=(e,t,n)=>{let r=e.states[t];return k`<i class="mark" data-tone=${L(r?.tone)} data-shape=${r?.shape??j} data-n=${n??j}></i>`},Lo={series:[],nodes:[],clusters:[],edges:[],stubs:[]},Ro=class extends M{constructor(...e){super(...e),this.graph=Lo,this.states={},this.selected=null,this.highlight=null,this.order=void 0,this.key=``,this.direction=`auto`,this.view=`graph`,this.controls=!0,this.matrix=null,this.barAt=200,this.related=void 0,this.strings={},this.matrixStrings={},this.renderIcon=e=>fi(e),this.iconStyles=[],this.hover=null,this.down=!1,this.lay=null,this.announced=``,this.arr=co(Lo),this.words=xo,this.drawn={...Lo,nodes:[]},this.nodes=new Map,this.clusters=new Map,this.markSeries=new Map,this.active=new Map,this.measured=null,this.layKey=``,this.layFor=null,this.litCache=null,this.scrolled=null,this.pz=new _o(this,{frame:()=>this.renderRoot.querySelector(`.frame`),stage:()=>this.renderRoot.querySelector(`.stage`),drawing:()=>this.lay&&!this.matrix?{w:this.lay.w,h:this.lay.h,down:this.down,room:this.card.room}:null,wheel:()=>this.view!==`table`&&!this.matrix,down:()=>this.down,onMove:()=>this.card.place(),onResize:()=>{this.fit(),this.card.place()}}),this.card=new vo(this,{docked:()=>this.down,frameH:()=>this.pz.frameH,grow:()=>this.matrix?this.requestUpdate():this.fit(),pressed:()=>this.pz.pressed,inner:()=>this.matrixEl()?.renderRoot??null}),this.h=this,this.onEscape=e=>{e.key===`Escape`&&!e.defaultPrevented&&this.selected&&(e.preventDefault(),this.select(null))}}static{this.styles=[V,qr,ai,So]}static{this.properties={graph:{attribute:!1},states:{attribute:!1},selected:{attribute:!1},highlight:{attribute:!1},order:{attribute:!1},key:{},direction:{},view:{},matrix:{attribute:!1},barAt:{type:Number},controls:{type:Boolean},related:{attribute:!1},strings:{attribute:!1},matrixStrings:{attribute:!1},renderIcon:{attribute:!1},iconStyles:{attribute:!1},hover:{state:!0},down:{state:!0},lay:{state:!0},announced:{state:!0}}}matrixEl(){return this.renderRoot.querySelector(`cae-mark-matrix`)}willUpdate(e){if(e.has(`key`)&&e.get(`key`)!==void 0&&(this.pz.reset(),this.active.clear()),e.has(`strings`)&&(this.words=kr(xo,this.strings)),e.has(`direction`)&&this.direction!==`auto`&&(this.down=this.direction===`down`),(e.has(`graph`)||e.has(`order`)||e.has(`down`)||e.has(`direction`))&&(this.arr=co(this.graph,this.order,this.down),this.clusters=new Map(this.graph.clusters.map(e=>[e.id,e]))),e.has(`graph`)||e.has(`states`)||e.has(`strings`)){let e=this.graph;this.drawn={...e,nodes:e.nodes.map(e=>function(e,t,n){let{marks:r=[],loose:i=[]}=e,a={},o=0,s=0;for(let e of[...r,...i])e&&(a[e.state]=(a[e.state]??0)+1,s++,t[e.state]?.tone===`done`&&o++);return{...e,marks:r,loose:i,counts:e.counts??a,progress:e.progress??{done:o,total:s,label:n(o,s)}}}(e,this.states,this.words.progress))},this.nodes=new Map(this.drawn.nodes.map(e=>[e.id,e])),this.markSeries=new Map(this.drawn.nodes.flatMap(t=>wo(t,e.series).flatMap(e=>e?[[e.m.id,e.series]]:[])))}}connectedCallback(){super.connectedCallback(),this.addEventListener(`keydown`,this.onEscape)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.onEscape)}updated(e){e.has(`iconStyles`)&&this.renderRoot instanceof ShadowRoot&&pt(this.renderRoot,[...this.constructor.elementStyles,...this.iconStyles]);let t=this.matrixEl();t&&t!==this.scrolled&&(this.scrolled=t,t.renderRoot.addEventListener(`scroll`,()=>this.card.place(),{capture:!0})),this.place(),this.card.place(),e.has(`selected`)&&this.selectionChanged()}focusToggle(e,t=4){let n=this.renderRoot;if(n.querySelector(`.dag.unplaced`)&&t>0)return void this.updateComplete.then(()=>requestAnimationFrame(()=>this.focusToggle(e,t-1)));let r=this.clusters.has(e)?`.cluster[data-cluster="${CSS.escape(e)}"] > .cue .tog`:`.node[data-id="${CSS.escape(e)}"] .tog`,i=n.querySelector(r);i?this.card.focusQuietly(i):this.focusItem(e)}focusItem(e){let t=this.renderRoot,n=null;e&&this.clusters.has(e)?n=t.querySelector(`.cluster[data-cluster="${CSS.escape(e)}"] > .hd .name`):e&&(n=t.querySelector(`.node[data-id="${CSS.escape(e)}"] [tabindex="0"]`));let r=t.querySelector(`slot[name="crumbs"]`)?.assignedElements({flatten:!0})??[];this.card.focusQuietly(n??r.map(e=>e.matches(`button`)?e:e.querySelector(`button`)).find(Boolean)??t.querySelector(`.mark[tabindex="0"], .node .name`)??this.matrixEl()?.renderRoot.querySelector(`.mark[tabindex="0"]`)??null)}selectionChanged(){let[e,t]=this.card.describe(),n=e?[e,t].filter(Boolean).join(` | `):``;n!==this.announced&&(this.announced=n),this.down&&this.card.whenReleased(()=>this.card.revealOverSheet())}place(){let e=this.renderRoot.querySelector(`.dag`);if(!e)return;let t=this.graph,n=`${this.down}|${this.clientWidth}`;if(this.measured?.graph===t&&this.measured.key===n)return this.fit();this.measured={graph:t,key:n};let r=new Map;for(let t of e.querySelectorAll(`[data-id]`))r.set(t.dataset.id??``,{w:t.offsetWidth,h:t.offsetHeight});let i=this.arr,a=JSON.stringify([this.key,i.slots,i.edgePaths.map(e=>e.steps.map(e=>e.id)),this.down,[...r]]);if(a===this.layKey)return this.fit();this.layKey=a,this.layFor=this.key,this.lay=function(e,t,n=!1){let r=uo[n?`down`:`across`],i=e=>n?e.h:e.w,a=e=>n?e.w:e.h,o=new Set(e.clusters.map(e=>e.id)),s=new Map(e.clusters.map(e=>[e.id,e.parent])),c=e=>t.get(`lbl:${e}`)??{w:0,h:0},l=e=>n?{u0:c(e).h+r.pad+r.gap/2,u1:r.pad,v0:r.pad,v1:r.padEnd,minU:0,minV:c(e).w+2*r.pad}:{u0:r.pad,u1:r.pad,v0:c(e).h+r.pad,v1:r.padEnd,minU:c(e).w+2*r.pad,minV:0},u=new Map,d=e=>{if(o.has(e))return u.get(e)??{u:0,v:0};if(ao(e))return{u:0,v:0};let n=t.get(e)??{w:0,h:0};return{u:i(n),v:a(n)}},f=new Map,p=new Map,m=e=>e===``?0:1+m(s.get(e)??``),h=[``,...e.clusters.map(e=>e.id)].sort((e,t)=>m(t)-m(e)),g=(t,n)=>{let r=e.edgePaths[t]?.steps??[],i=r[n];if(ao(i.id))return 0;if(!o.has(i.id))return d(i.id).v/2;let a=r[n-1]?.in===i.id?n-1:n+1,s=r[a];return l(i.id).v0+(f.get(i.id)?.top.get(s.id)??0)+g(t,a)};for(let t of h){let n=(e.slots[t]??[]).map(e=>[...e]);p.set(t,new Map(n.flatMap((e,t)=>e.map(e=>[e,t]))));let i=n.map(e=>Math.max(0,...e.map(e=>d(e).u))),a=t===``?r.gap:r.boxGap,s=[];i.forEach((e,t)=>s.push(t?s[t-1]+i[t-1]+a:0));let c=[];e.edgePaths.forEach((e,n)=>e.steps.forEach((r,i)=>{let a=e.steps[i-1];i&&a&&a.in===t&&r.in===t&&p.get(t)?.get(a.id)!==p.get(t)?.get(r.id)&&c.push({a:a.id,b:r.id,oa:g(n,i-1),ob:g(n,i)})}));let m=(e,t)=>t===void 0?0:o.has(e)||o.has(t)||!ao(e)&&!ao(t)?r.sep:r.pointSep,h=new Map;for(let e of n){let t=0;e.forEach((n,r)=>{h.set(n,t),t+=d(n).v+m(n,e[r+1])})}let _=(e,t)=>{let n=e.map(e=>{let n=t(e);return n.length?n.reduce((e,t)=>e+t,0)/n.length:h.get(e)??0}),r=e.map((t,n)=>d(t).v+m(t,e[n+1])),i=e.map((e,t)=>ao(e)?-1:t).filter(e=>e>=0),a=fo(i.map(e=>n[e]),i.map((e,t)=>t+1<i.length?((e,t)=>r.slice(e,t).reduce((e,t)=>e+t,0))(e,i[t+1]):0),i.map(()=>1));i.forEach((e,t)=>n[e]=a[t]),fo(n,r,e.map(e=>ao(e)?1:1e6)).forEach((t,n)=>h.set(e[n],Math.round(100*t)/100))},v=(e,t)=>{let n=ao(e)?t:t.filter(e=>!ao(e.other));return(n.length?n:t).map(e=>e.at)},y=e=>v(e,c.filter(t=>t.b===e).map(e=>({other:e.a,at:(h.get(e.a)??0)+e.oa-e.ob}))),b=e=>v(e,c.filter(t=>t.a===e).map(e=>({other:e.b,at:(h.get(e.b)??0)+e.ob-e.oa})));for(let e=0;e<8;e++){let t=n.map((e,t)=>t);e%2&&t.reverse();for(let r of t)_(n[r],e%2?b:y)}for(let e of n)_(e,e=>[...y(e),...b(e)]);let x=h.size?Math.min(...h.values()):0;for(let[e,t]of h)h.set(e,t-x);let S=(s[s.length-1]??0)+(i[i.length-1]??0),ee=Math.max(0,...n.flat().map(e=>(h.get(e)??0)+d(e).v));if(f.set(t,{rows:n,start:s,width:i,top:h,u:S,v:ee}),t!==``){let e=l(t);u.set(t,{u:Math.max(e.u0+S+e.u1,e.minU),v:Math.max(e.v0+ee+e.v1,e.minV)})}}let _={},v=new Map,y=(e,t,r)=>{v.set(e,{u:t,v:r});let i=f.get(e);i.rows.forEach((e,a)=>e.forEach(e=>{if(ao(e))return;let s=t+i.start[a],c=r+(i.top.get(e)??0);if(_[e]=((e,t,r)=>n?{x:t,y:e,w:r.v,h:r.u}:{x:e,y:t,w:r.u,h:r.v})(s,c,d(e)),o.has(e)){let t=l(e);y(e,s+t.u0,c+t.v0)}}))};y(``,r.margin,r.margin);let b=f.get(``),x=b.u+2*r.margin,S=b.v+2*r.margin,ee=(e,t)=>{let n=f.get(e),r=(v.get(e)??{u:0,v:0}).u+(n.start[t]??0);return[r,r+(n.width[t]??0)]},te=(e,t)=>p.get(e)?.get(t)??0,ne=e=>e&&ao(e.id)?/\|by:([^|]*)\|/.exec(e.id)?.[1]??``:``,re=e.edgePaths.map((e,t)=>{let i=n=>{let r=e.steps[n];return(v.get(r.in)??{u:0,v:0}).v+(f.get(r.in)?.top.get(r.id)??0)+g(t,n)},a=e.steps.map((t,a)=>{let o=e.steps[a-1],s=e.steps[a+1],[u,p]=ee(t.in,te(t.in,t.id)),m=i(a);if(a===0)return{a:u+d(t.id).u,b:p,at:m};if(a===e.steps.length-1)return{a:u,b:u,at:m};if(ao(t.id)){let i=ne(t);if(i&&o?.id===i)return{a:ee(i,te(i,e.steps[a-2]?.id??``)+1)[0],b:p,at:m};if(i&&s?.id===i){let t=te(i,e.steps[a+2]?.id??``);return{a:u,b:t>0?ee(i,t-1)[1]:(_[i]?n?_[i].y:_[i].x:u)+c(i).h+r.pad,at:m}}return{a:u,b:p,at:m}}let h=l(t.id),g=f.get(t.id);if(o?.in===t.id){if(ne(s)===t.id){let e=ee(t.id,te(t.id,o.id)+1)[0];return{a:e,b:e,at:i(a+1)}}return{a:u+h.u0+g.u,b:p,at:m}}if(ne(o)===t.id){let e=ee(t.id,te(t.id,s?.id??``))[0];return{a:e,b:e,at:i(a+1)}}return{a:u,b:u+h.u0,at:m}});return{from:e.from,to:e.to,style:e.style,runs:a}}),ie=e.clusters.flatMap(e=>{if(!e.cycle)return[];let t=f.get(e.id),n=v.get(e.id);if(!t||!n)return[];let r=e=>{let n=(e??[]).filter(e=>!ao(e)),r=null;for(let e of n){let n=d(e),i=(t.top.get(e)??0)+n.v;(!r||i>r.v)&&(r={u:n.u,v:i})}return r},i=t.rows.map((e,t)=>e.some(e=>!ao(e))?t:-1).filter(e=>e>=0),a=i[0]??0,o=i[i.length-1]??0,s=r(t.rows[o]),c=r(t.rows[a]);if(!s||!c)return[];let l=n.u+(t.start[o]??0)+(t.width[o]??0)/2,u=n.u+(t.start[a]??0)+(t.width[a]??0)/2;if(l-u<24){let e=Math.max(12,Math.min(28,Math.min(s.u,c.u)/4));l=(l+u)/2+e,u=l-2*e}return[{box:e.id,from:l,v0:n.v+s.v,to:u,v1:n.v+c.v,band:n.v+t.v+12}]});return{w:n?S:x,h:n?x:S,at:_,edges:re,returns:ie,down:n}}(i,r,this.down),this.updateComplete.then(()=>this.fit())}fit(){if(this.direction===`auto`){let e=this.clientWidth,t=e>0&&e<640;t!==this.down&&(this.down=t)}this.pz.fit()}select(e){e!==this.selected&&R(this,`cae-select`,{id:e})}act(e){let t=this.nodes.get(e)??this.clusters.get(e)??this.findMark(e);t?.drill?this.drill(e):t&&R(this,`cae-activate`,{id:e})}findMark(e){for(let t of this.drawn.nodes)for(let n of[...t.marks,...t.loose])if(n?.id===e)return n;for(let t of this.matrix?.rows??[])for(let n of t.cells)if(n?.id===e)return n;return null}lit(){let e=this.selected,t=this.hover===null&&e!==null&&this.markSeries.has(e)?this.markSeries.get(e)||e:null,n=this.hover??t??this.highlight??null,r=this.litCache;if(r&&r.key===n&&r.graph===this.graph&&r.related===this.related)return r;let i=n===null?null:(this.related??(e=>new Set([e])))(n);return this.litCache={key:n,graph:this.graph,related:this.related,on:i},this.litCache}known(e){return this.nodes.has(e)||this.clusters.has(e)||!!this.findMark(e)}render(){let e=this.h,t=this.matrix,n=t?this.matrixView(t):this.view===`table`?function(e){let t=e.drawn,n=e.words,r=[...t.edges,...t.stubs].some(e=>e.style===`dotted`),i=[...t.edges,...t.stubs].some(e=>e.style===`dashed`),a=e=>n.list(e)||n.none,o=!e.down&&e.laidOut&&e.pz.frameH>0?`height:${Math.round(e.pz.frameH)}px`:`max-height:max(360px, 70vh)`,s=e.arr.drawn.map(t=>e.nodes.get(t)).filter(e=>!!e);return k`<div class="frame tframe" part="frame" data-scroll="x" style=${o} @scroll=${()=>e.card.place()} @click=${t=>!t.target.closest(`tbody tr`)&&e.select(null)}>
|
|
191
|
+
</svg>`)(r)}</button>`}var zo=(e,t=`span`)=>(e.notes??[]).map(e=>t===`span`?j`<span class=${No[e.tone??`neutral`]??``}>${e.text}</span>`:j`<div class=${No[e.tone??`neutral`]??``}>${e.text}</div>`);function Bo(e,t,n,r,i,a=!1){let{m:o}=n,{key:s,on:c}=e.lit(),l=(e=>e.series||e.m.id)(n),u=c!==null&&(n.series!==``&&n.series===s||c.has(o.id)),d=u&&c!==null&&`get`in c?c.get(o.id)??null:null,f=e.selected===o.id?`sel`:``,p=n=>{e.hover=l,e.active.set(t.id,r),e.pz.reveal(n.currentTarget),e.focusSelect(o.id)};if(a)return j`<button type="button" class="taskchip ${u?`on`:``} ${f}" part="mark" data-i=${r} tabindex=${i?0:-1} title=${o.tip??N} aria-label=${o.label} aria-pressed=${!!f} @mouseenter=${()=>e.hover=l} @focus=${p} @blur=${()=>e.hover=null} @click=${()=>e.select(o.id)} @dblclick=${()=>e.act(o.id)}>${o.name??(n.series||o.id)}</button>`;let m=e.states[o.state];return j`<button type="button" class="mark ${u?`on`:``} ${f}" part="mark" data-tone=${z(m?.tone)} data-shape=${m?.shape??N} data-link=${d??N} data-i=${r} data-n=${o.badge??N} tabindex=${i?0:-1} title=${[o.tip,o.badge?`${e.words.badge}: ${o.badge}`:``].filter(Boolean).join(`
|
|
192
|
+
`)||N} aria-label=${o.label} aria-pressed=${!!f} @mouseenter=${()=>e.hover=l} @focus=${p} @blur=${()=>e.hover=null} @click=${()=>e.select(o.id)} @dblclick=${()=>e.act(o.id)}></button>`}function Vo(e,t,n){let r=t.target;if(!r.classList.contains(`mark`)&&!r.classList.contains(`taskchip`))return;if(t.shiftKey&&t.key.startsWith(`Arrow`))return function(e,t,n){let r=t.key===`ArrowRight`||t.key===`ArrowDown`?`later`:`earlier`,i=e.lay,a=function(e,t,n,r){let i=new Map(e.drawn.map((e,t)=>[e,t])),a=[...new Set(e.edges.filter((r,i)=>!e.back[i]&&(n===`later`?r.from===t:r.to===t)).map(e=>n===`later`?e.to:e.from))],o=r(t);return a.sort((e,t)=>Math.abs(r(e)-o)-Math.abs(r(t)-o)||(i.get(e)??0)-(i.get(t)??0)),a[0]??null}({drawn:e.arr.drawn,edges:e.drawn.edges,back:e.arr.back},n.id,r,e=>{let t=i?.at[e];return t?i?.down?t.x+t.w/2:t.y+t.h/2:0});if(t.preventDefault(),!a)return;let o=e.nodes.get(a);if(!o)return;let s=n.slots[e.active.get(n.id)??Mo(n.slots)]?.series??``,c=Ao(o,e.drawn.series),l=bo(o,e.barAt)?c.filter(t=>!!t&&e.states[t.m.state]?.tone===`failed`):c,u=s?l.findIndex(e=>e?.series===s):-1,d=u>=0?u:e.active.get(o.id)??Mo(l);e.active.set(o.id,d),e.requestUpdate(),e.updateComplete.then(()=>{let t=e.renderRoot.querySelector(`.node[data-id="${CSS.escape(a)}"]`);(t?.querySelector(`[data-i="${d}"]`)??t?.querySelector(`.name`))?.focus()})}(e,t,n);let{slots:i}=n;if(t.key===`Enter`){let n=i[Number(r.dataset.i)];t.preventDefault(),n&&e.act(n.m.id);return}let a=e.active.get(n.id)??Mo(i),o={ArrowRight:1,ArrowLeft:-1,ArrowDown:n.grid.cols,ArrowUp:-n.grid.cols},s;if(t.key===`Home`)s=Mo(i);else if(t.key===`End`)s=i.length-1-[...i].reverse().findIndex(e=>e!==null);else{if(o[t.key]===void 0)return;{let e=o[t.key];for(s=a+e;s>=0&&s<i.length&&!i[s];)s+=Math.sign(e);if(s<0||s>=i.length)return}}t.preventDefault(),e.active.set(n.id,s),e.requestUpdate();let c=t.currentTarget;e.updateComplete.then(()=>c.querySelector(`[data-i="${s}"]`)?.focus())}var Ho=(e,t,n)=>{let r=e.states[t];return j`<i class="mark" data-tone=${z(r?.tone)} data-shape=${r?.shape??N} data-n=${n??N}></i>`},Uo=new WeakMap,Wo={series:[],nodes:[],clusters:[],edges:[],stubs:[]},Go=new WeakMap;function Ko(e){let t=Go.get(e);return t===void 0&&(t=JSON.stringify([e.slots,e.edgePaths.map(e=>e.steps.map(e=>e.id))]),Go.set(e,t)),t}var qo=class extends P{constructor(...e){super(...e),this.graph=Wo,this.states={},this.selected=null,this.highlight=null,this.order=void 0,this.key=``,this.direction=`auto`,this.view=`graph`,this.controls=!0,this.matrix=null,this.barAt=200,this.related=void 0,this.strings={},this.matrixStrings={},this.renderIcon=e=>fi(e),this.iconStyles=[],this.hover=null,this.down=!1,this.lay=null,this.announced=``,this.arr=mo(Wo),this.words=Do,this.drawn={...Wo,nodes:[]},this.nodes=new Map,this.clusters=new Map,this.markSeries=new Map,this.active=new Map,this.measured=null,this.layKey=null,this.layFor=null,this.litCache=null,this.scrolled=null,this.markIx=null,this.pz=new Co(this,{frame:()=>this.renderRoot.querySelector(`.frame`),stage:()=>this.renderRoot.querySelector(`.stage`),drawing:()=>this.lay&&!this.matrix?{w:this.lay.w,h:this.lay.h,down:this.down,room:this.card.room}:null,wheel:()=>this.view!==`table`&&!this.matrix,down:()=>this.down,onMove:()=>this.card.place(),onResize:()=>{this.fit(),this.card.place()}}),this.card=new wo(this,{docked:()=>this.down,frameH:()=>this.pz.frameH,grow:()=>this.matrix?this.requestUpdate():this.fit(),pressed:()=>this.pz.pressed,inner:()=>this.matrixEl()?.renderRoot??null}),this.h=this,this.onEscape=e=>{e.key===`Escape`&&!e.defaultPrevented&&this.selected&&(e.preventDefault(),this.select(null))}}static{this.styles=[U,qr,ai,Oo]}static{this.properties={graph:{attribute:!1},states:{attribute:!1},selected:{attribute:!1},highlight:{attribute:!1},order:{attribute:!1},key:{},direction:{},view:{},matrix:{attribute:!1},barAt:{type:Number},controls:{type:Boolean},related:{attribute:!1},strings:{attribute:!1},matrixStrings:{attribute:!1},renderIcon:{attribute:!1},iconStyles:{attribute:!1},hover:{state:!0},down:{state:!0},lay:{state:!0},announced:{state:!0}}}matrixEl(){return this.renderRoot.querySelector(`cae-mark-matrix`)}willUpdate(e){if(e.has(`key`)&&e.get(`key`)!==void 0&&(this.pz.reset(),this.active.clear()),e.has(`strings`)&&(this.words=kr(Do,this.strings)),e.has(`direction`)&&this.direction!==`auto`&&(this.down=this.direction===`down`),(e.has(`graph`)||e.has(`order`)||e.has(`down`)||e.has(`direction`))&&(this.arr=mo(this.graph,this.order,this.down),this.clusters=new Map(this.graph.clusters.map(e=>[e.id,e]))),e.has(`graph`)||e.has(`states`)||e.has(`strings`)){let e=this.graph;this.drawn={...e,nodes:e.nodes.map(e=>function(e,t,n){let{marks:r=[],loose:i=[]}=e,a={},o=0,s=0;for(let e of[...r,...i])e&&(a[e.state]=(a[e.state]??0)+1,s++,t[e.state]?.tone===`done`&&o++);return{...e,marks:r,loose:i,counts:e.counts??a,progress:e.progress??{done:o,total:s,label:n(o,s)}}}(e,this.states,this.words.progress))},this.nodes=new Map(this.drawn.nodes.map(e=>[e.id,e])),this.markSeries=new Map(this.drawn.nodes.flatMap(t=>Ao(t,e.series).flatMap(e=>e?[[e.m.id,e.series]]:[])))}}connectedCallback(){super.connectedCallback(),this.addEventListener(`keydown`,this.onEscape)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.onEscape)}updated(e){e.has(`iconStyles`)&&this.renderRoot instanceof ShadowRoot&&dt(this.renderRoot,[...this.constructor.elementStyles,...this.iconStyles]);let t=this.matrixEl();t&&t!==this.scrolled&&(this.scrolled=t,t.renderRoot.addEventListener(`scroll`,()=>this.card.place(),{capture:!0})),this.place(),this.card.place(),e.has(`selected`)&&this.selectionChanged()}focusToggle(e,t=4){let n=this.renderRoot;if(n.querySelector(`.dag.unplaced`)&&t>0)return void this.updateComplete.then(()=>requestAnimationFrame(()=>this.focusToggle(e,t-1)));let r=this.clusters.has(e)?`.cluster[data-cluster="${CSS.escape(e)}"] > .cue .tog`:`.node[data-id="${CSS.escape(e)}"] .tog`,i=n.querySelector(r);i?this.card.focusQuietly(i):this.focusItem(e)}focusItem(e){let t=this.renderRoot,n=null;e&&this.clusters.has(e)?n=t.querySelector(`.cluster[data-cluster="${CSS.escape(e)}"] > .hd .name`):e&&(n=t.querySelector(`.node[data-id="${CSS.escape(e)}"] [tabindex="0"]`));let r=t.querySelector(`slot[name="crumbs"]`)?.assignedElements({flatten:!0})??[];this.card.focusQuietly(n??r.map(e=>e.matches(`button`)?e:e.querySelector(`button`)).find(Boolean)??t.querySelector(`.mark[tabindex="0"], .node .name`)??this.matrixEl()?.renderRoot.querySelector(`.mark[tabindex="0"]`)??null)}selectionChanged(){let[e,t]=this.card.describe(),n=e?[e,t].filter(Boolean).join(` | `):``;n!==this.announced&&(this.announced=n),this.down&&this.card.whenReleased(()=>this.card.revealOverSheet())}place(){let e=this.renderRoot.querySelector(`.dag`);if(!e)return;let t=this.graph,n=`${this.down}|${this.clientWidth}`;if(this.measured?.graph===t&&this.measured.key===n)return this.fit();this.measured={graph:t,key:n};let r=new Map;for(let t of e.querySelectorAll(`[data-id]`))r.set(t.dataset.id??``,{w:t.offsetWidth,h:t.offsetHeight});let i=this.arr,a={key:this.key,structure:Ko(i),down:this.down,sizes:[...r].map(([e,t])=>[e,t.w,t.h])};if(function(e,t){return!(!t||e.key!==t.key||e.down!==t.down||e.structure!==t.structure||e.sizes.length!==t.sizes.length)&&e.sizes.every((e,n)=>{let r=t.sizes[n];return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]})}(a,this.layKey))return this.fit();this.layKey=a,this.layFor=this.key,this.lay=function(e,t,n=!1){let r=_o[n?`down`:`across`],i=e=>n?e.h:e.w,a=e=>n?e.w:e.h,o=new Set(e.clusters.map(e=>e.id)),s=new Map(e.clusters.map(e=>[e.id,e.parent])),c=e=>t.get(`lbl:${e}`)??{w:0,h:0},l=e=>n?{u0:c(e).h+r.pad+r.gap/2,u1:r.pad,v0:r.pad,v1:r.padEnd,minU:0,minV:c(e).w+2*r.pad}:{u0:r.pad,u1:r.pad,v0:c(e).h+r.pad,v1:r.padEnd,minU:c(e).w+2*r.pad,minV:0},u=new Map,d=e=>{if(o.has(e))return u.get(e)??{u:0,v:0};if(co(e))return{u:0,v:0};let n=t.get(e)??{w:0,h:0};return{u:i(n),v:a(n)}},f=new Map,p=new Map,m=e=>e===``?0:1+m(s.get(e)??``),h=[``,...e.clusters.map(e=>e.id)].sort((e,t)=>m(t)-m(e)),g=(t,n)=>{let r=e.edgePaths[t]?.steps??[],i=r[n];if(co(i.id))return 0;if(!o.has(i.id))return d(i.id).v/2;let a=r[n-1]?.in===i.id?n-1:n+1,s=r[a];return l(i.id).v0+(f.get(i.id)?.top.get(s.id)??0)+g(t,a)};for(let t of h)p.set(t,new Map((e.slots[t]??[]).flatMap((e,t)=>e.map(e=>[e,t]))));let _=new Map;e.edgePaths.forEach((e,t)=>e.steps.forEach((n,r)=>{let i=e.steps[r-1];if(!r||!i||i.in!==n.in)return;let a=p.get(n.in);if(!a||a.get(i.id)===a.get(n.id))return;let o=_.get(n.in);o?o.push([t,r]):_.set(n.in,[[t,r]])}));for(let t of h){let n=(e.slots[t]??[]).map(e=>[...e]),i=n.map(e=>{let t=0;for(let n of e)t=Math.max(t,d(n).u);return t}),a=t===``?r.gap:r.boxGap,s=[];i.forEach((e,t)=>s.push(t?s[t-1]+i[t-1]+a:0));let c=(_.get(t)??[]).map(([t,n])=>{let r=e.edgePaths[t].steps;return{a:r[n-1].id,b:r[n].id,oa:g(t,n-1),ob:g(t,n)}}),p=new Map,m=new Map;for(let e of c)(p.get(e.b)??p.set(e.b,[]).get(e.b))?.push(e),(m.get(e.a)??m.set(e.a,[]).get(e.a))?.push(e);let h=(e,t)=>t===void 0?0:o.has(e)||o.has(t)||!co(e)&&!co(t)?r.sep:r.pointSep,v=new Map;for(let e of n){let t=0;e.forEach((n,r)=>{v.set(n,t),t+=d(n).v+h(n,e[r+1])})}let y=(e,t)=>{let n=e.map(e=>{let n=t(e);return n.length?n.reduce((e,t)=>e+t,0)/n.length:v.get(e)??0}),r=e.map((t,n)=>d(t).v+h(t,e[n+1])),i=e.map((e,t)=>co(e)?-1:t).filter(e=>e>=0),a=vo(i.map(e=>n[e]),i.map((e,t)=>t+1<i.length?((e,t)=>r.slice(e,t).reduce((e,t)=>e+t,0))(e,i[t+1]):0),i.map(()=>1));i.forEach((e,t)=>n[e]=a[t]),vo(n,r,e.map(e=>co(e)?1:1e6)).forEach((t,n)=>v.set(e[n],Math.round(100*t)/100))},b=(e,t)=>{let n=co(e)?t:t.filter(e=>!co(e.other));return(n.length?n:t).map(e=>e.at)},x=e=>b(e,(p.get(e)??[]).map(e=>({other:e.a,at:(v.get(e.a)??0)+e.oa-e.ob}))),S=e=>b(e,(m.get(e)??[]).map(e=>({other:e.b,at:(v.get(e.b)??0)+e.ob-e.oa})));for(let e=0;e<8;e++){let t=n.map((e,t)=>t);e%2&&t.reverse();for(let r of t)y(n[r],e%2?S:x)}for(let e of n)y(e,e=>[...x(e),...S(e)]);let ee=v.size?1/0:0;for(let e of v.values())ee=Math.min(ee,e);for(let[e,t]of v)v.set(e,t-ee);let C=(s[s.length-1]??0)+(i[i.length-1]??0),w=0;for(let e of n)for(let t of e)w=Math.max(w,(v.get(t)??0)+d(t).v);if(f.set(t,{rows:n,start:s,width:i,top:v,u:C,v:w}),t!==``){let e=l(t);u.set(t,{u:Math.max(e.u0+C+e.u1,e.minU),v:Math.max(e.v0+w+e.v1,e.minV)})}}let v={},y=new Map,b=(e,t,r)=>{y.set(e,{u:t,v:r});let i=f.get(e);i.rows.forEach((e,a)=>e.forEach(e=>{if(co(e))return;let s=t+i.start[a],c=r+(i.top.get(e)??0);if(v[e]=((e,t,r)=>n?{x:t,y:e,w:r.v,h:r.u}:{x:e,y:t,w:r.u,h:r.v})(s,c,d(e)),o.has(e)){let t=l(e);b(e,s+t.u0,c+t.v0)}}))};b(``,r.margin,r.margin);let x=f.get(``),S=x.u+2*r.margin,ee=x.v+2*r.margin,C=(e,t)=>{let n=f.get(e),r=(y.get(e)??{u:0,v:0}).u+(n.start[t]??0);return[r,r+(n.width[t]??0)]},w=(e,t)=>p.get(e)?.get(t)??0,te=e=>e&&co(e.id)?/\|by:([^|]*)\|/.exec(e.id)?.[1]??``:``,ne=e.edgePaths.map((e,t)=>{let i=n=>{let r=e.steps[n];return(y.get(r.in)??{u:0,v:0}).v+(f.get(r.in)?.top.get(r.id)??0)+g(t,n)},a=e.steps.map((t,a)=>{let o=e.steps[a-1],s=e.steps[a+1],[u,p]=C(t.in,w(t.in,t.id)),m=i(a);if(a===0)return{a:u+d(t.id).u,b:p,at:m};if(a===e.steps.length-1)return{a:u,b:u,at:m};if(co(t.id)){let i=te(t);if(i&&o?.id===i)return{a:C(i,w(i,e.steps[a-2]?.id??``)+1)[0],b:p,at:m};if(i&&s?.id===i){let t=w(i,e.steps[a+2]?.id??``);return{a:u,b:t>0?C(i,t-1)[1]:(v[i]?n?v[i].y:v[i].x:u)+c(i).h+r.pad,at:m}}return{a:u,b:p,at:m}}let h=l(t.id),g=f.get(t.id);if(o?.in===t.id){if(te(s)===t.id){let e=C(t.id,w(t.id,o.id)+1)[0];return{a:e,b:e,at:i(a+1)}}return{a:u+h.u0+g.u,b:p,at:m}}if(te(o)===t.id){let e=C(t.id,w(t.id,s?.id??``))[0];return{a:e,b:e,at:i(a+1)}}return{a:u,b:u+h.u0,at:m}});return{from:e.from,to:e.to,style:e.style,runs:a}}),re=e.clusters.flatMap(e=>{if(!e.cycle)return[];let t=f.get(e.id),n=y.get(e.id);if(!t||!n)return[];let r=e=>{let n=(e??[]).filter(e=>!co(e)),r=null;for(let e of n){let n=d(e),i=(t.top.get(e)??0)+n.v;(!r||i>r.v)&&(r={u:n.u,v:i})}return r},i=t.rows.map((e,t)=>e.some(e=>!co(e))?t:-1).filter(e=>e>=0),a=i[0]??0,o=i[i.length-1]??0,s=r(t.rows[o]),c=r(t.rows[a]);if(!s||!c)return[];let l=n.u+(t.start[o]??0)+(t.width[o]??0)/2,u=n.u+(t.start[a]??0)+(t.width[a]??0)/2;if(l-u<24){let e=Math.max(12,Math.min(28,Math.min(s.u,c.u)/4));l=(l+u)/2+e,u=l-2*e}return[{box:e.id,from:l,v0:n.v+s.v,to:u,v1:n.v+c.v,band:n.v+t.v+12}]});return{w:n?ee:S,h:n?S:ee,at:v,edges:ne,returns:re,down:n}}(i,r,this.down),this.updateComplete.then(()=>this.fit())}fit(){if(this.direction===`auto`){let e=this.clientWidth,t=e>0&&e<640;t!==this.down&&(this.down=t)}this.pz.fit()}select(e){e!==this.selected&&B(this,`cae-select`,{id:e})}act(e){let t=this.nodes.get(e)??this.clusters.get(e)??this.findMark(e);t?.drill?this.drill(e):t&&B(this,`cae-activate`,{id:e})}findMark(e){let t=this.markIx;if(!t||t.drawn!==this.drawn||t.matrix!==this.matrix){let e=new Map;for(let t of this.drawn.nodes){for(let n of t.marks)n&&!e.has(n.id)&&e.set(n.id,n);for(let n of t.loose)n&&!e.has(n.id)&&e.set(n.id,n)}for(let t of this.matrix?.rows??[])for(let n of t.cells)n&&!e.has(n.id)&&e.set(n.id,n);t=this.markIx={drawn:this.drawn,matrix:this.matrix,marks:e}}return t.marks.get(e)??null}lit(){let e=this.selected,t=this.hover===null&&e!==null&&this.markSeries.has(e)?this.markSeries.get(e)||e:null,n=this.hover??t??this.highlight??null,r=this.litCache;if(r&&r.key===n&&r.graph===this.graph&&r.related===this.related)return r;let i=n===null?null:(this.related??(e=>new Set([e])))(n);return this.litCache={key:n,graph:this.graph,related:this.related,on:i},this.litCache}known(e){return this.nodes.has(e)||this.clusters.has(e)||!!this.findMark(e)}render(){let e=this.h,t=this.matrix,n=t?this.matrixView(t):this.view===`table`?function(e){let t=e.drawn,n=e.words,r=[...t.edges,...t.stubs].some(e=>e.style===`dotted`),i=[...t.edges,...t.stubs].some(e=>e.style===`dashed`),a=e=>n.list(e)||n.none,o=!e.down&&e.laidOut&&e.pz.frameH>0?`height:${Math.round(e.pz.frameH)}px`:`max-height:max(360px, 70vh)`,s=e.arr.drawn.map(t=>e.nodes.get(t)).filter(e=>!!e);return j`<div class="frame tframe" part="frame" data-scroll="x" style=${o} @scroll=${()=>e.card.place()} @click=${t=>!t.target.closest(`tbody tr`)&&e.select(null)}>
|
|
193
193
|
<table class="list view" part="table">
|
|
194
194
|
<thead>
|
|
195
195
|
<tr>
|
|
196
196
|
<th scope="col" class="fit">${n.nameHeader}</th>
|
|
197
197
|
<th scope="col" class="fit">${n.statusHeader}</th>
|
|
198
198
|
<th scope="col">${n.solidHeader}</th>
|
|
199
|
-
${r?
|
|
200
|
-
${i?
|
|
199
|
+
${r?j`<th scope="col">${n.dottedHeader}</th>`:N}
|
|
200
|
+
${i?j`<th scope="col">${n.dashedHeader}</th>`:N}
|
|
201
201
|
<th scope="col">${n.laterHeader}</th>
|
|
202
202
|
</tr>
|
|
203
203
|
</thead>
|
|
204
204
|
<tbody>
|
|
205
|
-
${
|
|
205
|
+
${W(s,e=>e.id,o=>{let s=function(e,t,n,r){let i=e=>{let t=n.get(e);return t?t.cluster?r(t.label):t.label:e},a=function(e){let t=Uo.get(e);if(!t){let n=(e,t,n)=>(e.get(t)??e.set(t,[]).get(t))?.push(n);t={stubsTo:new Map,edgesTo:new Map,edgesFrom:new Map};for(let r of e.stubs)n(t.stubsTo,r.to,r);for(let r of e.edges)n(t.edgesTo,r.to,r),n(t.edgesFrom,r.from,r);Uo.set(e,t)}return t}(t),o=a.stubsTo.get(e.id)??[],s=a.edgesTo.get(e.id)??[],c=e=>[...o.filter(t=>t.style===e).map(e=>e.label),...s.filter(t=>t.style===e).map(e=>i(e.from))];return{solid:c(`solid`),dotted:c(`dotted`),dashed:c(`dashed`),later:[...new Set((a.edgesFrom.get(e.id)??[]).map(e=>i(e.to)))]}}(o,t,e.nodes,n.inCluster),c=o.cluster?e.clusters.get(o.cluster):void 0,l=e.selected===o.id,u=j`${(o.icons??[]).map(t=>e.renderIcon(t))}${o.drill?j`<span class="tip-ic" title=${n.drill}>${Eo()}</span>`:N}`;return j`<tr class=${l?`sel`:``} part="row" data-id=${o.id} @click=${t=>!t.target.closest(`.loopchip`)&&t.detail<2&&e.select(o.id)} @dblclick=${t=>!t.target.closest(`.loopchip`)&&e.act(o.id)}>
|
|
206
206
|
<th scope="row" class="fit">
|
|
207
|
-
<span class="nm">${u}<button type="button" class="name" title=${o.tip??
|
|
207
|
+
<span class="nm">${u}<button type="button" class="name" title=${o.tip??N} aria-pressed=${l} @focus=${()=>e.focusSelect(o.id)} @keydown=${t=>{t.key===`Enter`&&(t.preventDefault(),e.act(o.id))}}>${o.label}</button>${c?.drill?j`<button type="button" class="taskchip loopchip" title=${c.chipTip??N} aria-label=${c.chipLabel??N} @click=${()=>e.drill(c.id)}>${c.cycle?j`<span class="tip-ic" title=${n.cycle}>${To(12)}</span>`:N}${c.note??c.label}</button>`:N}</span>
|
|
208
208
|
</th>
|
|
209
|
-
<td class="fit st">${function(e){let t=
|
|
209
|
+
<td class="fit st">${function(e){let t=j`<span class="sep" aria-hidden="true"> | </span>`;return j`<span class="n" aria-hidden="true" title=${e.progress.label}>${e.progress.done}/${e.progress.total}</span><span class="sr">${e.progress.label}</span>${zo(e).map(e=>j`${t}${e}`)}`}(o)}</td>
|
|
210
210
|
<td class="rel"><span>${a(s.solid)}</span></td>
|
|
211
|
-
${r?
|
|
212
|
-
${i?
|
|
211
|
+
${r?j`<td class="rel"><span>${a(s.dotted)}</span></td>`:N}
|
|
212
|
+
${i?j`<td class="rel"><span>${a(s.dashed)}</span></td>`:N}
|
|
213
213
|
<td class="rel"><span>${a(s.later)}</span></td>
|
|
214
214
|
</tr>`})}
|
|
215
215
|
</tbody>
|
|
216
216
|
</table>
|
|
217
|
-
</div>`}(e):function(e){let t=e.pz;return
|
|
218
|
-
<div class="stage view" part="stage" style="transform:${t.transform}">${function(e){let{on:t}=e.lit(),n=e.drawn,r=e.lay,i=new Map(n.stubs.map(e=>[e.id,e])),a=(t,n)=>{let r=e.clusters.get(t);if(r)return function(e,t,n,r){let i=e.lay?.at[t.id]??null,a=(e.arr.slots[t.id]??[]).flat().filter(e=>!
|
|
217
|
+
</div>`}(e):function(e){let t=e.pz;return j`<div class="frame gframe ${e.down?`down`:``}" part="frame" style="height:${Math.round(t.frameH)}px" @pointerdown=${t.onPointerDown} @pointermove=${t.onPointerMove} @pointerup=${t.onPointerUp} @pointercancel=${t.onPointerUp} @click=${t=>!t.target.closest(`.node, .cluster, .stub, .tools`)&&e.select(null)}>
|
|
218
|
+
<div class="stage view" part="stage" style="transform:${t.transform}">${function(e){let{on:t}=e.lit(),n=e.drawn,r=e.lay,i=new Map(n.stubs.map(e=>[e.id,e])),a=(t,n)=>{let r=e.clusters.get(t);if(r)return function(e,t,n,r){let i=e.lay?.at[t.id]??null,a=(e.arr.slots[t.id]??[]).flat().filter(e=>!co(e)),o=i?`;width:${i.w}px;height:${i.h}px`:``,s=e.selected===t.id;return j`<section class="cluster ${s?`sel`:``}" part="cluster" role="group" data-cluster=${t.id} style=${Po(e,t.id,n)+o} aria-label=${t.summary??t.label} @click=${n=>Fo(e,n,t.id)} @dblclick=${n=>Io(e,n,t.id)}>
|
|
219
219
|
<div class="hd" part="cluster-label" data-id=${`lbl:${t.id}`}>
|
|
220
220
|
<span class="line">
|
|
221
|
-
${function(e,t,n){let r=t.path?.[0],i=
|
|
222
|
-
${t.note?
|
|
221
|
+
${function(e,t,n){let r=t.path?.[0],i=j`<button type="button" class="name" title=${(r?.tip??t.tip)||N} aria-pressed=${n} @focus=${()=>e.focusSelect(t.id)} @keydown=${n=>Lo(e,n,t.id)}>${t.cycle?j`<span class="tip-ic" title=${e.words.cycle}>${To()}</span>`:N}${r?.label??t.label}</button>`;return!t.path||t.path.length<2?i:j`${i}${t.path.slice(1).map(t=>j`<span class="psep" aria-hidden="true">›</span><button type="button" class="part" title=${t.tip||N} @click=${n=>{n.stopPropagation(),e.drill(t.id)}} @dblclick=${e=>e.stopPropagation()}>${t.label}</button>`)}`}(e,t,s)}
|
|
222
|
+
${t.note?j`<span class="count">${t.note}</span>`:N}
|
|
223
223
|
</span>
|
|
224
|
-
${t.detail?
|
|
224
|
+
${t.detail?j`<span class="spread" title=${t.detailTip??N}>${t.detail}</span>`:N}
|
|
225
225
|
</div>
|
|
226
|
-
${t.toggle?
|
|
227
|
-
<div class="in">${
|
|
228
|
-
</section>`}(e,r,n,(e,t)=>a(e,t));let o=i.get(t);if(o)return
|
|
226
|
+
${t.toggle?j`<span class="cue">${Ro(e,t.id,t.path?.map(e=>e.label).join(` › `)??t.label,!0)}</span>`:t.drill?j`<span class="cue" aria-hidden="true" title=${e.words.drill}>${Eo()}</span>`:N}
|
|
227
|
+
<div class="in">${W(a,e=>e,e=>r(e,i))}</div>
|
|
228
|
+
</section>`}(e,r,n,(e,t)=>a(e,t));let o=i.get(t);if(o)return j`<span class="stub" part="stub" data-id=${o.id} style=${Po(e,o.id,n)} title=${e.words.stubTip}>${o.label}</span>`;let s=e.nodes.get(t);return s?function(e,t,n){let r=e.drawn.series,i=bo(t,e.barAt),a=Ao(t,r),o=i?{id:t.id,slots:a.filter(t=>!!t&&e.states[t.m.state]?.tone===`failed`),grid:{cols:8,size:12,gap:4}}:{id:t.id,slots:a,grid:jo(t,r.length)},s=e.selected===t.id,c=(t.icons??[]).map(t=>e.renderIcon(t));return j`<section class="node ${t.drill?`drill`:``} ${t.accent?`accent`:``} ${s?`sel`:``}" part="node" role="group" data-id=${t.id} data-look=${t.look&&t.look!==`neutral`?t.look:N} aria-label=${t.summary??t.label} style="${Po(e,t.id,n)};--cols:${o.grid.cols};--m:${o.grid.size}px;--g:${o.grid.gap}px" @click=${n=>Fo(e,n,t.id)} @dblclick=${n=>Io(e,n,t.id)}>
|
|
229
229
|
<div class="hd" part="node-header">
|
|
230
|
-
<span class="nm">${c}<button type="button" class="name" part="node-name" title=${t.tip??
|
|
231
|
-
<span class="right"><span class="count" aria-hidden="true" title=${t.progress.label}>${t.progress.done}/${t.progress.total}</span>${t.toggle?
|
|
230
|
+
<span class="nm">${c}<button type="button" class="name" part="node-name" title=${t.tip??N} aria-pressed=${s} @focus=${()=>e.focusSelect(t.id)} @keydown=${n=>Lo(e,n,t.id)}>${t.label}</button></span>
|
|
231
|
+
<span class="right"><span class="count" aria-hidden="true" title=${t.progress.label}>${t.progress.done}/${t.progress.total}</span>${t.toggle?Ro(e,t.id,t.label,!1):t.drill?j`<span class="cue" aria-hidden="true" title=${e.words.drill}>${Eo()}</span>`:N}</span>
|
|
232
232
|
</div>
|
|
233
|
-
${i?function(e,t,n){let r=Object.keys(e.states),i=function(e,t){let n=t.reduce((t,n)=>t+(e[n]??0),0);return t.filter(t=>(e[t]??0)>0).map(t=>({state:t,n:e[t]??0,pct:100*(e[t]??0)/Math.max(1,n)}))}(t.counts,r),a=n.slots.slice(0,8),o=n.slots.length-a.length,s=Math.min(e.active.get(n.id)??0,Math.max(0,a.length-1));return
|
|
234
|
-
${i.map(t=>{let n=e.states[t.state];return
|
|
233
|
+
${i?function(e,t,n){let r=Object.keys(e.states),i=function(e,t){let n=t.reduce((t,n)=>t+(e[n]??0),0);return t.filter(t=>(e[t]??0)>0).map(t=>({state:t,n:e[t]??0,pct:100*(e[t]??0)/Math.max(1,n)}))}(t.counts,r),a=n.slots.slice(0,8),o=n.slots.length-a.length,s=Math.min(e.active.get(n.id)??0,Math.max(0,a.length-1));return j`<div class="sbar" role="img" aria-label=${r.filter(e=>t.counts[e]).map(n=>li(e.states,n,t.counts[n]??0)).join(` | `)}>
|
|
234
|
+
${i.map(t=>{let n=e.states[t.state];return j`<i data-tone=${z(n?.tone)} data-shape=${n?.shape??N} style="width:${t.pct}%" title=${li(e.states,t.state,t.n)}></i>`})}
|
|
235
235
|
</div>
|
|
236
|
-
${a.length?
|
|
237
|
-
${a.map((t,r)=>t?
|
|
238
|
-
${o>0?
|
|
239
|
-
</div>`:
|
|
240
|
-
${t.slots.map((r,i)=>r?
|
|
236
|
+
${a.length?j`<div class="fails" @keydown=${t=>Vo(e,t,{...n,slots:a,grid:{...n.grid,cols:a.length}})}>
|
|
237
|
+
${a.map((t,r)=>t?Bo(e,n,t,r,r===s,!0):N)}
|
|
238
|
+
${o>0?j`<span>${e.words.more(o)}</span>`:N}
|
|
239
|
+
</div>`:N}`}(e,t,o):function(e,t){let n=Math.min(e.active.get(t.id)??Mo(t.slots),t.slots.length-1);return j`<div class="marks ${t.grid.size>=10?`big`:``}" @keydown=${n=>Vo(e,n,t)}>
|
|
240
|
+
${t.slots.map((r,i)=>r?Bo(e,t,r,i,i===n):j`<span class="slot"></span>`)}
|
|
241
241
|
</div>`}(e,o)}
|
|
242
|
-
${t.expected?
|
|
243
|
-
${t.notes?.length?
|
|
244
|
-
</section>`}(e,s,n):
|
|
242
|
+
${t.expected?j`<span class="expected" part="expected" aria-hidden="true" title=${t.expected.label}>${t.expected.text}</span>`:N}
|
|
243
|
+
${t.notes?.length?j`<div class="ex" aria-hidden="true">${zo(t)}</div>`:N}
|
|
244
|
+
</section>`}(e,s,n):N},o=!!r&&n.nodes.every(e=>r.at[e.id]),s=r?.w??0,c=r?.h??0;return j`<div class="dag ${e.down?`down`:``} ${t?`hl`:``} ${o?``:`unplaced`}" style="width:${s}px;height:${c}px" @mouseleave=${()=>e.hover=null}>
|
|
245
245
|
<svg class="edges" aria-hidden="true" width=${s} height=${c}>
|
|
246
246
|
<defs>
|
|
247
247
|
<marker id="arr" viewBox="0 0 8 8" refX="8" refY="4" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto">
|
|
@@ -251,741 +251,741 @@ ${t.notes?.length?k`<div class="ex" aria-hidden="true">${No(t)}</div>`:j}
|
|
|
251
251
|
<path class="ret-tip" d="M0,0.5 L8,4 L0,7.5 z"></path>
|
|
252
252
|
</marker>
|
|
253
253
|
</defs>
|
|
254
|
-
${(r?.edges??[]).map(e=>
|
|
255
|
-
${(r?.returns??[]).map(e=>
|
|
254
|
+
${(r?.edges??[]).map(e=>M`<path class=${e.style} part="edge" d=${function(e,t=!1){let n=e=>Math.round(2*e)/2,r=(e,r)=>t?`${n(r)},${n(e)}`:`${n(e)},${n(r)}`,i=e[0];if(!i)return``;let a=`M${r(i.a,i.at)}`;return e.forEach((t,n)=>{t.b!==t.a&&(a+=` L${r(t.b,t.at)}`);let i=e[n+1];if(!i)return;if(Math.abs(i.at-t.at)<.5)return void(i.a!==t.b&&(a+=` L${r(i.a,i.at)}`));let o=(t.b+i.a)/2;a+=` C${r(o,t.at)} ${r(o,i.at)} ${r(i.a,i.at)}`}),a}(e.runs,r?.down)} marker-end="url(#arr)"></path>`)}
|
|
255
|
+
${(r?.returns??[]).map(e=>M`<path class="ret" data-cluster=${e.box} d=${function(e,t=!1,n=3){let r=e=>Math.round(2*e)/2,i=(e,n)=>t?`${r(n)},${r(e)}`:`${r(e)},${r(n)}`,a=Math.max(0,Math.min(6,(e.from-e.to)/2,e.band-e.v0-n,e.band-e.v1-n));return[`M${i(e.from,e.v0+n)}`,`L${i(e.from,e.band-a)}`,`Q${i(e.from,e.band)} ${i(e.from-a,e.band)}`,`L${i(e.to+a,e.band)}`,`Q${i(e.to,e.band)} ${i(e.to,e.band-a)}`,`L${i(e.to,e.v1+n)}`].join(` `)}(e,r?.down)} marker-end="url(#arr-ret)"></path>`)}
|
|
256
256
|
</svg>
|
|
257
|
-
${
|
|
257
|
+
${W((e.arr.slots[``]??[]).flat().filter(e=>!co(e)),e=>e,e=>a(e,null))}
|
|
258
258
|
</div>`}(e)}</div>
|
|
259
|
-
</div>`}(e),r=this.selected;return
|
|
259
|
+
</div>`}(e),r=this.selected;return j`<div class="col">
|
|
260
260
|
<slot name="crumbs"></slot>
|
|
261
|
-
<div class="main">${n}${r&&this.querySelector(`[slot=inspector]`)&&this.known(r)?
|
|
261
|
+
<div class="main">${n}${r&&this.querySelector(`[slot=inspector]`)&&this.known(r)?ko(r,j`<section id="insp" class="insp ${this.down?`sheet`:``}" part="inspector" aria-label=${this.words.inspector} @keydown=${this.card.onCardKey}>
|
|
262
262
|
<span class="ptr" aria-hidden="true"></span>
|
|
263
263
|
<div class="scroll"><slot name="inspector"></slot></div>
|
|
264
|
-
</section>`):
|
|
265
|
-
${function(e,t,n){let r=!!t||e.asTable;return
|
|
266
|
-
${function(e,t){let n=e.drawn,r=e.asTable&&!t,i=(r?[]:t?t.rows.flatMap(e=>e.cells).map(e=>e&&{state:e.state,badge:void 0}):n.nodes.flatMap(t=>
|
|
267
|
-
${n?
|
|
264
|
+
</section>`):N}<div class="sr" role="status">${this.announced}</div></div>
|
|
265
|
+
${function(e,t,n){let r=!!t||e.asTable;return j`<div class="foot">
|
|
266
|
+
${function(e,t){let n=e.drawn,r=e.asTable&&!t,i=(r?[]:t?t.rows.flatMap(e=>e.cells).map(e=>e&&{state:e.state,badge:void 0}):n.nodes.flatMap(t=>Ao(t,n.series).map(n=>n&&{state:n.m.state,badge:bo(t,e.barAt)?void 0:n.m.badge}))).filter(e=>e!==null),a=new Set(i.map(e=>e.state)),o=new Set(t||r?[]:[...n.edges,...n.stubs].map(e=>e.style)),s=o.size>1||o.size===1&&!o.has(`solid`)?[`solid`,`dotted`,`dashed`].filter(e=>o.has(e)):[],c=new Set(t?t.head.flat().flatMap(e=>e.icons??[]):n.nodes.flatMap(e=>e.icons??[])),l={solid:e.words.solidEdge,dotted:e.words.dottedEdge,dashed:e.words.dashedEdge};return ii([...Object.entries(e.states).filter(([e])=>a.has(e)).map(([t,n])=>({label:n.label,icon:Ho(e,t),decorative:!0})),...Object.entries(e.words.iconNames).filter(([e])=>c.has(e)).map(([t,n])=>({label:n,icon:e.renderIcon(t)})),...s.map(e=>{return{label:l[e],icon:(t=e,M`<svg width="22" height="8" aria-hidden="true"><path class=${t} d="M1,4 H21" stroke-dasharray=${t===`dashed`?`5 4`:t===`dotted`?`0.1 4`:`none`}></path></svg>`)};var t})],{cls:`big`})}(e,t)}
|
|
267
|
+
${n?j`<div class="tools">${r?N:function(e){let t=e.pz,n=e.words,r=!t.moved&&t.fitK>=1;return j`<button type="button" aria-label=${n.zoomOut} title=${n.zoomOutTip} @click=${()=>t.zoomBy(.8)}>−</button>
|
|
268
268
|
<button type="button" aria-label=${n.zoomIn} title=${n.zoomInTip} @click=${()=>t.zoomBy(1.25)}>+</button>
|
|
269
|
-
<button type="button" ?disabled=${r} @click=${()=>t.showAll()}>${n.showAll}</button>`}(e)}${function(e,t){return
|
|
270
|
-
<div class="keys" part="keys">${function(e,t){let n=e.words,r=e.selected?n.clearKey:n.upKey;return[...t?n.matrixKeys:e.asTable?n.tableKeys:n.graphKeys,r].filter(Boolean)}(e,t).map((e,t)=>
|
|
269
|
+
<button type="button" ?disabled=${r} @click=${()=>t.showAll()}>${n.showAll}</button>`}(e)}${function(e,t){return j`<cae-segmented class="views" .options=${[{value:`graph`,label:e.words.graph},{value:`table`,label:e.words.table}]} .value=${t?`table`:`graph`} label=${e.words.view} @cae-change=${t=>{t.stopPropagation(),e.showView(t.detail.value===`table`?`table`:`graph`)}}></cae-segmented>`}(e,r)}</div>`:N}
|
|
270
|
+
<div class="keys" part="keys">${function(e,t){let n=e.words,r=e.selected?n.clearKey:n.upKey;return[...t?n.matrixKeys:e.asTable?n.tableKeys:n.graphKeys,r].filter(Boolean)}(e,t).map((e,t)=>j`${t?` | `:``}<span>${e}</span>`)}</div>
|
|
271
271
|
</div>`}(e,t,this.controls)}
|
|
272
|
-
</div>`}matrixView(e){let t=this.down?0:Math.round(Math.max(this.pz.frameH,this.card.room));return
|
|
272
|
+
</div>`}matrixView(e){let t=this.down?0:Math.round(Math.max(this.pz.frameH,this.card.room));return j`<div class="frame mxframe" part="frame" style=${t?`min-height:${t}px`:``}>
|
|
273
273
|
<cae-mark-matrix .matrix=${e} .states=${this.states} .selected=${this.selected} .highlight=${this.highlight} .key=${this.key} .strings=${this.matrixStrings} .renderIcon=${this.renderIcon} .iconStyles=${this.iconStyles}></cae-mark-matrix>
|
|
274
|
-
</div>`}get laidOut(){return this.layFor===this.key}get asTable(){return this.view===`table`}focusSelect(e){this.card.quiet||this.select(e)}drill(e){R(this,`cae-drill`,{id:e})}toggle(e,t){R(this,`cae-toggle`,{id:e,open:t})}showView(e){this.matrix&&e===`table`||(this.matrix||(this.view=e),R(this,`cae-view-change`,{view:e}))}},zo=(e,t,n)=>e===1?`1 ${t}`:`${e} ${n}`,Bo={sections:`Sessions`,sectionsTip:``,loadEarlier:e=>`Show ${zo(e,`earlier line`,`earlier lines`)}`,newBelow:e=>`Show ${zo(e,`new event`,`new events`)}`,newInLatest:e=>`Show ${zo(e,`new event`,`new events`)} in the latest session`,prompt:`Prompt`,assistant:`Assistant`,reasoning:`Reasoning`,characters:e=>`${e} characters`,tool:`tool`,results:e=>zo(e,`result`,`results`),done:`done`,failed:`failed`,running:`running`,interrupted:`interrupted`,interruptedTip:`Ended with no result`,query:`query`,page:`page`,fullText:`Full text`,showAll:e=>`Show all (${e} characters)`,showLess:`Show less`},Vo=O` :host{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;position:relative;}:host([mode='none']){display:none;}:host([mode='tabs']){flex:none;}:host([mode='tabs']) .scroller,:host([mode='tabs']) .newpill{display:none;}.rounds{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 10px;padding-left:2px;}.stab{padding:3px 11px;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--text-muted);cursor:pointer;font-size:12px;display:inline-flex;align-items:center;}.stab:hover{border-color:var(--accent);}.stab.sel{background:var(--accent-bg);border-color:var(--accent);color:var(--text);}.stab-m{font-family:var(--mono);font-size:10.5px;color:var(--text-muted);margin-left:4px;}.stab.sel .stab-m{color:var(--text-2);}.stab .dot{width:6px;height:6px;margin-left:4px;}.stab .mk{margin-right:4px;}.stab .mk.ok{color:var(--status-done);}.stab .mk.bad{color:var(--status-failed);}.verdict{margin:6px 10px 4px 41px;padding:7px 11px;border-radius:10px;border:1px solid;font-size:12px;}.verdict[data-tone]{background:var(--tone-bg);color:var(--text);}.verdict[data-tone='attention']{border-color:color-mix(in srgb,var(--tone) 40%,transparent);}.verdict[data-tone='failed']{border-color:color-mix(in srgb,var(--tone) 45%,transparent);}.verdict b{display:block;margin-bottom:2px;}.verdict ul{margin:2px 0 0;padding-left:18px;font-family:var(--mono);font-size:11.5px;}.scroller{flex:1 1 auto;min-height:0;overflow:auto;border:1px solid var(--line);border-radius:14px;background:linear-gradient(180deg,var(--panel),var(--well));padding:4px 2px 8px;font-size:12.5px;}.back{margin:6px 10px;background:var(--raise);border:1px solid var(--line2);border-radius:8px;padding:3px 10px;cursor:pointer;color:var(--text-2);}.back:hover{border-color:var(--accent);}.inv-body{display:flex;flex-direction:column;gap:10px;}.inv-head{border:1px solid var(--line2);border-radius:12px;background:var(--raise);padding:8px 10px;margin:4px 8px 6px;}.inv-who{display:flex;flex-wrap:wrap;gap:6px;}.inv-cmdbox{margin-top:6px;}.inv-cmdbox summary,.inv-prompt summary{cursor:pointer;font-size:11px;color:var(--text-muted);}.inv-prompt summary{font-size:11.5px;}.inv-prompt summary:hover{color:var(--accent);}.inv-cmd{font-family:var(--mono);font-size:11.5px;white-space:pre-wrap;word-break:break-all;margin:4px 0 6px;max-height:160px;overflow:auto;color:var(--text);}.inv-ptext{margin-top:6px;max-height:360px;overflow:auto;}.msg{display:flex;gap:9px;padding:3px 10px;}.av{width:22px;height:22px;flex:0 0 22px;border-radius:7px;line-height:22px;font-size:11px;text-align:center;font-weight:700;}.av-a{background:var(--agent-bg);color:var(--agent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--agent) 35%,transparent);}.av-l{background:var(--raise);color:var(--text-2);}.av-t{background:var(--raise);color:var(--text-muted);}.bd{flex:1;min-width:0;background:color-mix(in srgb,var(--text) 2.5%,transparent);border:1px solid var(--line);border-radius:3px 10px 10px 10px;padding:5px 10px;}.hd{font-size:11px;font-weight:600;color:var(--text-muted);margin-bottom:1px;}.tx{color:var(--text);line-height:1.5;word-break:break-word;}.tx pre,.tx code{white-space:pre-wrap;}.tx pre{margin:0 0 4px;}.toolcard,.typing{margin-left:41px;margin-right:10px;}.toolcard{border:1px solid var(--line);border-left:3px solid var(--line2);border-radius:10px;margin-top:3px;margin-bottom:3px;overflow:hidden;background:var(--well);transition:border-color 0.3s;}.toolcard.run{border-left-color:var(--status-running);}.toolcard.err{border-left-color:var(--status-failed);}.th{display:flex;gap:9px;align-items:baseline;padding:4px 9px;cursor:pointer;}.th:hover{background:color-mix(in srgb,var(--text) 4%,transparent);}.tn{font-family:var(--mono);font-weight:600;flex:none;display:inline-flex;align-items:center;}.tn::before{content:'⚒';display:inline-grid;place-items:center;width:20px;height:20px;margin-right:7px;border-radius:6px;background:var(--raise);color:var(--text-2);font-size:11px;}.toolcard[data-tool='bash'] .tn::before{content:'❯';}.toolcard[data-tool='read'] .tn::before{content:'▤';}.toolcard[data-tool='grep'] .tn::before,.toolcard[data-tool='glob'] .tn::before{content:'⌕';}.toolcard[data-tool='edit'] .tn::before,.toolcard[data-tool='write'] .tn::before{content:'✎';}.toolcard[data-tool='task'] .tn::before,.toolcard[data-tool='agent'] .tn::before{content:'✦';color:var(--agent);}.toolcard[data-tool='web-search'] .tn::before{content:'◍';}.toolcard[data-tool='web-fetch'] .tn::before{content:'⇣';}.toolcard.revealed{box-shadow:0 0 0 1px var(--accent);}.tp{font-family:var(--mono);font-size:11.5px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.ti{color:var(--text-muted);font-size:11px;flex:none;max-width:35%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.st-run,.st-ok,.st-err,.st-int{flex:none;white-space:nowrap;}.st-run{color:var(--status-running);display:inline-flex;align-items:center;gap:6px;}.st-ok{color:var(--text-muted);}.st-ok>[aria-hidden]{color:var(--status-done);font-weight:700;}.st-err{color:var(--status-failed);}.st-int{color:var(--status-attention);}.pdot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--status-running);animation:breathe 1.8s ease-in-out infinite;}.tb{padding:6px 9px;border-top:1px solid var(--line);background:var(--bg);}.tb pre{white-space:pre-wrap;word-break:break-word;margin:4px 0;font-family:var(--mono);font-size:12px;}.fold{max-height:220px;overflow:hidden;position:relative;}.fold.open{max-height:none;}.foldbtn{cursor:pointer;color:var(--accent);font-size:11px;background:none;border:0;padding:0;font-family:inherit;}.wq{font-size:12px;margin:2px 0 6px;}.wq b{font-family:var(--mono);font-weight:600;}.wl{color:var(--text-muted);font-size:11px;margin-right:6px;}.links{margin:0 0 6px;padding-left:30px;font-size:12px;}.links li{margin:2px 0;overflow-wrap:anywhere;}.links a{color:var(--accent);text-decoration:none;}.links a:hover{text-decoration:underline;}.rawfold>summary{cursor:pointer;color:var(--text-muted);font-size:11px;}.plink{color:var(--accent);text-decoration:none;font-family:var(--mono);overflow-wrap:anywhere;}.plink:hover{text-decoration:underline;}.host{color:var(--text-muted);font-family:var(--mono);font-size:11px;margin-left:6px;}.sysline{display:flex;gap:8px;align-items:baseline;padding:2px 10px 2px 41px;font-size:11px;color:var(--text-muted);font-family:var(--mono);}.sysline .tx{color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.typing{display:flex;align-items:center;gap:10px;padding:10px 0;}.typing .av{width:26px;height:26px;flex:0 0 26px;border-radius:9px;display:grid;place-items:center;font-size:12px;}.dots{display:inline-flex;gap:4px;padding:8px 12px;border-radius:12px;background:var(--agent-bg);}.dots i{width:6px;height:6px;border-radius:50%;background:var(--agent);animation:bounce 1.2s infinite ease-in-out;}.dots i:nth-child(2){animation-delay:0.15s;}.dots i:nth-child(3){animation-delay:0.3s;}.scroller:not(.bulk) .msg,.scroller:not(.bulk) .toolcard{animation:enter 0.35s var(--ease) both;}.newpill{position:absolute;left:50%;bottom:26px;transform:translateX(-50%);z-index:5;cursor:pointer;padding:6px 14px;border-radius:999px;border:1px solid var(--accent);background:color-mix(in srgb,var(--panel) 92%,transparent);color:var(--accent);font-size:12px;font-weight:600;box-shadow:0 10px 28px color-mix(in srgb,var(--shadow) 50%,transparent);backdrop-filter:blur(6px);animation:toast-in 0.3s var(--ease) both;}.newpill:hover{background:var(--accent-bg);}`,Ho=e=>k`${e.map(e=>k`<span class="tag ${e.look??``}" part="tag" title=${e.tip??j}><span class="tag-l">${e.label}</span>${e.value}</span>`)}`,Uo=O` .tag{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;padding:2px 9px;border-radius:7px;border:1px solid var(--line2);white-space:nowrap;color:var(--text);background:var(--raise);}.tag-l{font-size:10px;font-weight:400;color:var(--text-muted);font-family:var(--sans);}.tag.mono,.tag.quiet{font-family:var(--mono);}.tag.quiet{color:var(--text-2);font-weight:500;background:none;}`,Wo=class{constructor(e){this.scroller=e,this.stick=!0,this.restored=!1,this.lastTop=0,this.gliding=!1}toBottom(e=!1){let t=this.scroller();t&&(this.gliding=e,e?t.scrollTo({top:t.scrollHeight,behavior:`smooth`}):t.scrollTop=t.scrollHeight)}read(){let e=this.scroller();if(!e||!e.clientHeight)return null;let t=e.scrollHeight-e.scrollTop-e.clientHeight<60;return this.gliding&&(e.scrollTop<this.lastTop-1||t)&&(this.gliding=!1),this.stick=t||this.gliding,this.lastTop=e.scrollTop,{stick:this.stick,top:Math.round(e.scrollTop)}}async restore(e,t){let n=this.scroller();if(e&&!e.stick&&n){this.stick=!1;let r=performance.now()+4e3;await new Promise(i=>{let a=()=>{let o=n.scrollHeight-n.clientHeight;n.scrollTop=Math.min(e.top,o),o>=e.top||performance.now()>r||t()?i():requestAnimationFrame(a)};a()}),this.lastTop=n.scrollTop}else this.stick=!0,this.toBottom();this.restored=!0}reshow(){let e=this.scroller();e&&(this.stick?this.toBottom():e.scrollTop=this.lastTop)}};function Go(e,t,n){let r=k`<pre><code>${t.slice(0,4e3)}</code></pre>`;if(t.length<=1200)return r;let i=e.folds.has(n);return k`<div>
|
|
274
|
+
</div>`}get laidOut(){return this.layFor===this.key}get asTable(){return this.view===`table`}focusSelect(e){this.card.quiet||this.select(e)}drill(e){B(this,`cae-drill`,{id:e})}toggle(e,t){B(this,`cae-toggle`,{id:e,open:t})}showView(e){this.matrix&&e===`table`||(this.matrix||(this.view=e),B(this,`cae-view-change`,{view:e}))}},Jo=(e,t,n)=>e===1?`1 ${t}`:`${e} ${n}`,Yo={sections:`Sessions`,sectionsTip:``,loadEarlier:e=>`Show ${Jo(e,`earlier line`,`earlier lines`)}`,newBelow:e=>`Show ${Jo(e,`new event`,`new events`)}`,newInLatest:e=>`Show ${Jo(e,`new event`,`new events`)} in the latest session`,prompt:`Prompt`,assistant:`Assistant`,reasoning:`Reasoning`,characters:e=>`${e} characters`,tool:`tool`,results:e=>Jo(e,`result`,`results`),done:`done`,failed:`failed`,running:`running`,interrupted:`interrupted`,interruptedTip:`Ended with no result`,query:`query`,page:`page`,fullText:`Full text`,showAll:e=>`Show all (${e} characters)`,showLess:`Show less`},Xo=A` :host{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;position:relative;}:host([mode='none']){display:none;}:host([mode='tabs']){flex:none;}:host([mode='tabs']) .scroller,:host([mode='tabs']) .newpill{display:none;}.rounds{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 10px;padding-left:2px;}.stab{padding:3px 11px;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--text-muted);cursor:pointer;font-size:12px;display:inline-flex;align-items:center;}.stab:hover{border-color:var(--accent);}.stab.sel{background:var(--accent-bg);border-color:var(--accent);color:var(--text);}.stab-m{font-family:var(--mono);font-size:10.5px;color:var(--text-muted);margin-left:4px;}.stab.sel .stab-m{color:var(--text-2);}.stab .dot{width:6px;height:6px;margin-left:4px;}.stab .mk{margin-right:4px;}.stab .mk.ok{color:var(--status-done);}.stab .mk.bad{color:var(--status-failed);}.verdict{margin:6px 10px 4px 41px;padding:7px 11px;border-radius:10px;border:1px solid;font-size:12px;}.verdict[data-tone]{background:var(--tone-bg);color:var(--text);}.verdict[data-tone='attention']{border-color:color-mix(in srgb,var(--tone) 40%,transparent);}.verdict[data-tone='failed']{border-color:color-mix(in srgb,var(--tone) 45%,transparent);}.verdict b{display:block;margin-bottom:2px;}.verdict ul{margin:2px 0 0;padding-left:18px;font-family:var(--mono);font-size:11.5px;}.scroller{flex:1 1 auto;min-height:0;overflow:auto;border:1px solid var(--line);border-radius:14px;background:linear-gradient(180deg,var(--panel),var(--well));padding:4px 2px 8px;font-size:12.5px;}.back{margin:6px 10px;background:var(--raise);border:1px solid var(--line2);border-radius:8px;padding:3px 10px;cursor:pointer;color:var(--text-2);}.back:hover{border-color:var(--accent);}.inv-body{display:flex;flex-direction:column;gap:10px;}.inv-head{border:1px solid var(--line2);border-radius:12px;background:var(--raise);padding:8px 10px;margin:4px 8px 6px;}.inv-who{display:flex;flex-wrap:wrap;gap:6px;}.inv-cmdbox{margin-top:6px;}.inv-cmdbox summary,.inv-prompt summary{cursor:pointer;font-size:11px;color:var(--text-muted);}.inv-prompt summary{font-size:11.5px;}.inv-prompt summary:hover{color:var(--accent);}.inv-cmd{font-family:var(--mono);font-size:11.5px;white-space:pre-wrap;word-break:break-all;margin:4px 0 6px;max-height:160px;overflow:auto;color:var(--text);}.inv-ptext{margin-top:6px;max-height:360px;overflow:auto;}.msg{display:flex;gap:9px;padding:3px 10px;}.av{width:22px;height:22px;flex:0 0 22px;border-radius:7px;line-height:22px;font-size:11px;text-align:center;font-weight:700;}.av-a{background:var(--agent-bg);color:var(--agent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--agent) 35%,transparent);}.av-l{background:var(--raise);color:var(--text-2);}.av-t{background:var(--raise);color:var(--text-muted);}.bd{flex:1;min-width:0;background:color-mix(in srgb,var(--text) 2.5%,transparent);border:1px solid var(--line);border-radius:3px 10px 10px 10px;padding:5px 10px;}.hd{font-size:11px;font-weight:600;color:var(--text-muted);margin-bottom:1px;}.tx{color:var(--text);line-height:1.5;word-break:break-word;}.tx pre,.tx code{white-space:pre-wrap;}.tx pre{margin:0 0 4px;}.toolcard,.typing{margin-left:41px;margin-right:10px;}.toolcard{border:1px solid var(--line);border-left:3px solid var(--line2);border-radius:10px;margin-top:3px;margin-bottom:3px;overflow:hidden;background:var(--well);transition:border-color 0.3s;}.toolcard.run{border-left-color:var(--status-running);}.toolcard.err{border-left-color:var(--status-failed);}.th{display:flex;gap:9px;align-items:baseline;padding:4px 9px;cursor:pointer;}.th:hover{background:color-mix(in srgb,var(--text) 4%,transparent);}.tn{font-family:var(--mono);font-weight:600;flex:none;display:inline-flex;align-items:center;}.tn::before{content:'⚒';display:inline-grid;place-items:center;width:20px;height:20px;margin-right:7px;border-radius:6px;background:var(--raise);color:var(--text-2);font-size:11px;}.toolcard[data-tool='bash'] .tn::before{content:'❯';}.toolcard[data-tool='read'] .tn::before{content:'▤';}.toolcard[data-tool='grep'] .tn::before,.toolcard[data-tool='glob'] .tn::before{content:'⌕';}.toolcard[data-tool='edit'] .tn::before,.toolcard[data-tool='write'] .tn::before{content:'✎';}.toolcard[data-tool='task'] .tn::before,.toolcard[data-tool='agent'] .tn::before{content:'✦';color:var(--agent);}.toolcard[data-tool='web-search'] .tn::before{content:'◍';}.toolcard[data-tool='web-fetch'] .tn::before{content:'⇣';}.toolcard.revealed{box-shadow:0 0 0 1px var(--accent);}.tp{font-family:var(--mono);font-size:11.5px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.ti{color:var(--text-muted);font-size:11px;flex:none;max-width:35%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.st-run,.st-ok,.st-err,.st-int{flex:none;white-space:nowrap;}.st-run{color:var(--status-running);display:inline-flex;align-items:center;gap:6px;}.st-ok{color:var(--text-muted);}.st-ok>[aria-hidden]{color:var(--status-done);font-weight:700;}.st-err{color:var(--status-failed);}.st-int{color:var(--status-attention);}.pdot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--status-running);animation:breathe 1.8s ease-in-out infinite;}.tb{padding:6px 9px;border-top:1px solid var(--line);background:var(--bg);}.tb pre{white-space:pre-wrap;word-break:break-word;margin:4px 0;font-family:var(--mono);font-size:12px;}.fold{max-height:220px;overflow:hidden;position:relative;}.fold.open{max-height:none;}.foldbtn{cursor:pointer;color:var(--accent);font-size:11px;background:none;border:0;padding:0;font-family:inherit;}.wq{font-size:12px;margin:2px 0 6px;}.wq b{font-family:var(--mono);font-weight:600;}.wl{color:var(--text-muted);font-size:11px;margin-right:6px;}.links{margin:0 0 6px;padding-left:30px;font-size:12px;}.links li{margin:2px 0;overflow-wrap:anywhere;}.links a{color:var(--accent);text-decoration:none;}.links a:hover{text-decoration:underline;}.rawfold>summary{cursor:pointer;color:var(--text-muted);font-size:11px;}.plink{color:var(--accent);text-decoration:none;font-family:var(--mono);overflow-wrap:anywhere;}.plink:hover{text-decoration:underline;}.host{color:var(--text-muted);font-family:var(--mono);font-size:11px;margin-left:6px;}.sysline{display:flex;gap:8px;align-items:baseline;padding:2px 10px 2px 41px;font-size:11px;color:var(--text-muted);font-family:var(--mono);}.sysline .tx{color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.typing{display:flex;align-items:center;gap:10px;padding:10px 0;}.typing .av{width:26px;height:26px;flex:0 0 26px;border-radius:9px;display:grid;place-items:center;font-size:12px;}.dots{display:inline-flex;gap:4px;padding:8px 12px;border-radius:12px;background:var(--agent-bg);}.dots i{width:6px;height:6px;border-radius:50%;background:var(--agent);animation:bounce 1.2s infinite ease-in-out;}.dots i:nth-child(2){animation-delay:0.15s;}.dots i:nth-child(3){animation-delay:0.3s;}.scroller:not(.bulk) .msg,.scroller:not(.bulk) .toolcard{animation:enter 0.35s var(--ease) both;}.newpill{position:absolute;left:50%;bottom:26px;transform:translateX(-50%);z-index:5;cursor:pointer;padding:6px 14px;border-radius:999px;border:1px solid var(--accent);background:color-mix(in srgb,var(--panel) 92%,transparent);color:var(--accent);font-size:12px;font-weight:600;box-shadow:0 10px 28px color-mix(in srgb,var(--shadow) 50%,transparent);backdrop-filter:blur(6px);animation:toast-in 0.3s var(--ease) both;}.newpill:hover{background:var(--accent-bg);}`,Zo=e=>j`${e.map(e=>j`<span class="tag ${e.look??``}" part="tag" title=${e.tip??N}><span class="tag-l">${e.label}</span>${e.value}</span>`)}`,Qo=A` .tag{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;padding:2px 9px;border-radius:7px;border:1px solid var(--line2);white-space:nowrap;color:var(--text);background:var(--raise);}.tag-l{font-size:10px;font-weight:400;color:var(--text-muted);font-family:var(--sans);}.tag.mono,.tag.quiet{font-family:var(--mono);}.tag.quiet{color:var(--text-2);font-weight:500;background:none;}`,$o=class{constructor(e){this.scroller=e,this.stick=!0,this.restored=!1,this.lastTop=0,this.gliding=!1}toBottom(e=!1){let t=this.scroller();t&&(this.gliding=e,e?t.scrollTo({top:t.scrollHeight,behavior:`smooth`}):t.scrollTop=t.scrollHeight)}read(){let e=this.scroller();if(!e||!e.clientHeight)return null;let t=e.scrollHeight-e.scrollTop-e.clientHeight<60;return this.gliding&&(e.scrollTop<this.lastTop-1||t)&&(this.gliding=!1),this.stick=t||this.gliding,this.lastTop=e.scrollTop,{stick:this.stick,top:Math.round(e.scrollTop)}}async restore(e,t){let n=this.scroller();if(e&&!e.stick&&n){this.stick=!1;let r=performance.now()+4e3;await new Promise(i=>{let a=()=>{let o=n.scrollHeight-n.clientHeight;n.scrollTop=Math.min(e.top,o),o>=e.top||performance.now()>r||t()?i():requestAnimationFrame(a)};a()}),this.lastTop=n.scrollTop}else this.stick=!0,this.toBottom();this.restored=!0}reshow(){let e=this.scroller();e&&(this.stick?this.toBottom():e.scrollTop=this.lastTop)}};function es(e,t,n){let r=j`<pre><code>${t.slice(0,4e3)}</code></pre>`;if(t.length<=1200)return r;let i=e.folds.has(n);return j`<div>
|
|
275
275
|
<div class="fold ${i?`open`:``}">${r}</div>
|
|
276
276
|
<button type="button" class="foldbtn" @click=${()=>{i?e.folds.delete(n):e.folds.add(n),e.requestUpdate()}}>${i?e.s.showLess:e.s.showAll(t.length)}</button>
|
|
277
|
-
</div>`}var
|
|
277
|
+
</div>`}var ts=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,ns=class extends P{constructor(...e){super(...e),this.sections=[],this.shown=null,this.live=!1,this.earlier=0,this.loading=!1,this.count=null,this.mode=`full`,this.memory=null,this.markdown=null,this.renderDetail=null,this.strings={},this.bulk=!0,this.unseen=0,this.pinned=null,this.revealed=``,this.revealPending=!1,this.follow=new $o(()=>this.scroller),this.started=!1,this.total=0,this.reloading=!1,this.lastShown=-1,this.opened=new Set,this.folds=new Set,this.openDetails=new Set,this.mdCache=new Map}static{this.styles=[U,Wr,Qo,Xo]}get shownIndex(){let e=this.sections.length;if(!e)return-1;let t=this.shown??this.pinned??e-1;return Math.max(0,Math.min(e-1,t))}reveal(e){let t=this.sections.findIndex(t=>t.items.some(t=>t.id===e));return t<0?-1:(this.setOpen(e,!0),this.pinned=null,this.revealed=e,this.revealPending=!0,this.requestUpdate(),t)}onLatest(){let e=this.sections.length;return e<2||this.shownIndex===e-1}isOpen(e){return this.memory?this.memory.isOpen(e):this.opened.has(e)}setOpen(e,t){this.memory?this.memory.setOpen(e,t):t?this.opened.add(e):this.opened.delete(e)}willUpdate(e){let t=this.count??this.sections.reduce((e,t)=>e+1+t.items.length,0);if(e.has(`sections`)){let n=e.get(`sections`)?.length??0;n&&this.sections.length>n&&this.shown===null&&this.pinned===null&&!this.follow.stick&&!this.bulk&&(this.pinned=n-1),this.reloading&&(this.reloading=!1,this.lastShown=-1,this.total=t)}if(!this.loading){if(this.started){if(t!==this.total){let e=t-this.total;this.total=t,e>0&&this.updateComplete.then(()=>{this.follow.stick&&this.onLatest()?this.follow.toBottom(!ts()):this.unseen+=e})}}else this.started=!0,this.total=t,this.afterFirst()}}async afterFirst(){await this.updateComplete,await this.follow.restore(this.memory?.scroll(),()=>!this.isConnected),requestAnimationFrame(()=>this.bulk=!1)}onScroll(){let e=this.follow.read();e&&(this.follow.stick&&this.onLatest()&&(this.unseen=0),this.follow.restored&&this.memory?.setScroll(e))}updated(e){let t=this.shownIndex;if(t!==this.lastShown){let e=this.lastShown;this.lastShown=t,e!==-1&&this.follow.restored&&(this.follow.toBottom(),ts()||this.scroller?.animate?.([{opacity:.25},{opacity:1}],{duration:240,easing:`ease-out`})),B(this,`cae-section-shown`,{index:t})}let n=e.get(`mode`);if(n&&n!==`full`&&this.mode===`full`&&this.follow.reshow(),this.revealPending){let e=this.renderRoot.querySelector(`[data-card="${CSS.escape(this.revealed)}"]`);e&&this.mode===`full`&&(this.revealPending=!1,this.follow.stick=!1,e.scrollIntoView({block:`center`}))}}pick(e){this.pinned=null,B(this,`cae-section-change`,{index:e===this.sections.length-1?null:e})}toLatest(){let e=this.sections.length;e>1&&this.shownIndex!==e-1&&(this.pinned=null,this.shown!==null&&B(this,`cae-section-change`,{index:null})),this.follow.stick=!0,this.unseen=0,this.updateComplete.then(()=>this.follow.toBottom(!0))}loadEarlier(){this.reloading=!0,B(this,`cae-load-earlier`,{})}render(){let e=kr(Yo,this.strings),t=this.sections,n=this.shownIndex,r=t[n],i={s:e,live:this.live,revealed:this.revealed,folds:this.folds,isOpen:e=>this.isOpen(e),toggle:e=>{this.setOpen(e,!this.isOpen(e)),this.requestUpdate()},requestUpdate:()=>this.requestUpdate()};return j`${this.renderPicker(t,n,e)}
|
|
278
278
|
<div class="scroller ${this.bulk?`bulk`:``}" @scroll=${()=>this.onScroll()}>
|
|
279
|
-
${this.earlier?
|
|
280
|
-
${e.loadEarlier(this.earlier)}</button></div>`:
|
|
281
|
-
${r?
|
|
282
|
-
${!r&&this.live?this.typing(e):
|
|
279
|
+
${this.earlier?j`<div class="meta"><button type="button" class="back" @click=${()=>this.loadEarlier()}>
|
|
280
|
+
${e.loadEarlier(this.earlier)}</button></div>`:N}
|
|
281
|
+
${r?ko(r.id,this.renderSection(r,n===t.length-1,e,i)):N}
|
|
282
|
+
${!r&&this.live?this.typing(e):N}
|
|
283
283
|
</div>
|
|
284
|
-
${this.unseen?
|
|
285
|
-
${this.onLatest()?e.newBelow(this.unseen):e.newInLatest(this.unseen)}</button>`:
|
|
286
|
-
${e.map((e,n)=>{let r=e.verdict;return
|
|
287
|
-
${r?
|
|
288
|
-
${e.facts?.length?
|
|
289
|
-
${e.active?
|
|
284
|
+
${this.unseen?j`<button type="button" class="newpill" @click=${()=>this.toLatest()}>
|
|
285
|
+
${this.onLatest()?e.newBelow(this.unseen):e.newInLatest(this.unseen)}</button>`:N}`}renderPicker(e,t,n){return e.length<2?N:j`<div class="rounds" role="group" aria-label=${n.sections} title=${n.sectionsTip||N} part="picker">
|
|
286
|
+
${e.map((e,n)=>{let r=e.verdict;return j`<button type="button" class="stab ${n===t?`sel`:``}" title=${r?.tip||N} aria-pressed=${n===t} @click=${()=>this.pick(n)}>
|
|
287
|
+
${r?j`<span class="mk ${r.tone===`done`?`ok`:`bad`}" aria-hidden="true">${r.tone===`done`?`✓`:`✕`}</span><span class="sr">${r.text}</span>`:N}${e.title}
|
|
288
|
+
${e.facts?.length?j` <span class="stab-m">${e.facts.join(` | `)}</span>`:N}
|
|
289
|
+
${e.active?j`<span class="dot" data-tone="running"></span>`:N}
|
|
290
290
|
</button>`})}
|
|
291
|
-
</div>`}renderSection(e,t,n,r){let i=e.footer;return
|
|
292
|
-
${e.tags?.length||e.details?.length?this.renderHead(e):
|
|
293
|
-
${
|
|
294
|
-
${t&&this.live?this.typing(n):
|
|
295
|
-
${i?
|
|
291
|
+
</div>`}renderSection(e,t,n,r){let i=e.footer;return j`<div class="inv-body" part="section">
|
|
292
|
+
${e.tags?.length||e.details?.length?this.renderHead(e):N}
|
|
293
|
+
${W(e.items,e=>e.id,e=>this.renderItem(e,n,r))}
|
|
294
|
+
${t&&this.live?this.typing(n):N}
|
|
295
|
+
${i?j`<div class="verdict" part="verdict" data-tone=${z(i.tone)}>
|
|
296
296
|
<b>${i.title}</b>
|
|
297
|
-
${i.list?.length?
|
|
298
|
-
</div>`:
|
|
299
|
-
</div>`}renderHead(e){return
|
|
300
|
-
<div class="inv-who">${
|
|
301
|
-
${(e.details??[]).map(t=>t.code?
|
|
302
|
-
</div>`}renderProse(e,t){let n=`${e.id}:${t.id}`,r=this.openDetails.has(n);return
|
|
297
|
+
${i.list?.length?j`<ul>${i.list.map(e=>j`<li>${e}</li>`)}</ul>`:i.note?j`<span class="meta">${i.note}</span>`:N}
|
|
298
|
+
</div>`:N}
|
|
299
|
+
</div>`}renderHead(e){return j`<div class="inv-head">
|
|
300
|
+
<div class="inv-who">${Zo(e.tags??[])}</div>
|
|
301
|
+
${(e.details??[]).map(t=>t.code?j`<details class="inv-cmdbox"><summary>${t.summary}</summary><pre class="inv-cmd"><code>${t.text}</code></pre></details>`:this.renderProse(e,t))}
|
|
302
|
+
</div>`}renderProse(e,t){let n=`${e.id}:${t.id}`,r=this.openDetails.has(n);return j`<details class="inv-prompt" ?open=${r} @toggle=${e=>{let t=e.target.open;t!==this.openDetails.has(n)&&(t?this.openDetails.add(n):this.openDetails.delete(n),this.requestUpdate())}}>
|
|
303
303
|
<summary>${t.summary}</summary>
|
|
304
|
-
${r?
|
|
305
|
-
</details>`}md(e,t){if(!this.markdown)return t;let n=this.mdCache.get(e);if(n?.raw===t)return Ki(n.html);let r=this.markdown(t);return this.mdCache.set(e,{raw:t,html:r}),Ki(r)}bubble(e,t,n,r,i,a=!1){return
|
|
306
|
-
${a?
|
|
307
|
-
<div class="bd">${a?j
|
|
308
|
-
</div>`}renderItem(e,t,n){switch(e.type){case`prompt`:return this.bubble(`▸`,`av-l`,t.prompt,
|
|
304
|
+
${r?j`<div class="inv-ptext">${this.renderDetail?this.renderDetail(t):j`<div class="tx">${this.md(n,t.text)}</div>`}</div>`:N}
|
|
305
|
+
</details>`}md(e,t){if(!this.markdown)return t;let n=this.mdCache.get(e);if(n?.raw===t)return Ki(n.html);let r=this.markdown(t);return this.mdCache.set(e,{raw:t,html:r}),Ki(r)}bubble(e,t,n,r,i,a=!1){return j`<div class="msg" part="bubble" title=${i??N}>
|
|
306
|
+
${a?j`<div class="av ${t}" role="img" aria-label=${n} title=${n}>${e}</div>`:j`<div class="av ${t}" aria-hidden="true">${e}</div>`}
|
|
307
|
+
<div class="bd">${a?N:j`<div class="hd">${n}</div>`}${r}</div>
|
|
308
|
+
</div>`}renderItem(e,t,n){switch(e.type){case`prompt`:return this.bubble(`▸`,`av-l`,t.prompt,j`<div class="tx meta">${t.characters(e.text.length)}</div>`,e.text.slice(0,600));case`message`:return this.bubble(`A`,`av-a`,t.assistant,j`<div class="tx">${this.md(e.id,e.text)}</div>`,void 0,!0);case`reasoning`:return this.bubble(`✦`,`av-t`,t.reasoning,j`<div class="tx">${this.md(e.id,e.text)}</div>`);case`event`:return j`<div class="msg" part="bubble"><div class="av av-t" aria-hidden="true">${e.icon}</div><div class="bd"><div class="hd">${e.title}</div>${e.text?j`<div class="tx meta">${e.text}</div>`:N}</div></div>`;case`notice`:return j`<div class="sysline" part="notice"><span aria-hidden="true">⚙</span><span class="tx">${e.text}</span></div>`;case`tool`:return function(e,t){let{s:n}=e,r=e.isOpen(t.id),i=t.links?.length??0,a=t.status===`ok`?j`<span class="st-ok"><span aria-hidden="true">✓</span> ${n.done}</span>`:t.status===`error`?j`<span class="st-err"><span aria-hidden="true">✕</span> ${n.failed}</span>`:e.live?j`<span class="st-run"><i class="pdot"></i>${n.running}</span>`:j`<span class="st-int" title=${n.interruptedTip}><span aria-hidden="true">◌</span> ${n.interrupted}</span>`;return j`<div class="toolcard ${t.status===`running`?`run`:t.status===`error`?`err`:`ok`} ${e.revealed===t.id?`revealed`:``}" part="tool" data-tool=${t.query?`web-search`:t.page?`web-fetch`:t.icon} data-card=${t.id}>
|
|
309
309
|
<div class="th" role="button" tabindex="0" aria-expanded=${r?`true`:`false`} @click=${()=>e.toggle(t.id)} @keydown=${e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.currentTarget.click())}}>
|
|
310
310
|
<span class="tn">${t.name||n.tool}</span><span class="tp">${t.summary}</span><span class="ti" >${i?n.results(i):t.intent}</span >${a}
|
|
311
311
|
</div>
|
|
312
|
-
${r?
|
|
313
|
-
<span class="wl">${t.query?e.s.query:e.s.page}</span>${a?
|
|
312
|
+
${r?j`<div class="tb" part="tool-body">${function(e,t){let n=t.output,r=t.links??[],i=t.query||t.page;if(!i)return n===null?es(e,t.body??``,`${t.id}:cmd`):j`${t.body?es(e,t.body,`${t.id}:cmd`):N}${es(e,n,`${t.id}:out`)}`;let a=!t.query&&/^https?:\/\//.test(i);return j`<div class="wq">
|
|
313
|
+
<span class="wl">${t.query?e.s.query:e.s.page}</span>${a?j`<a class="plink" href=${i} target="_blank" rel="noopener noreferrer">${i}</a>`:j`<b>${i}</b>`}
|
|
314
314
|
</div>
|
|
315
|
-
${r.length?
|
|
316
|
-
${r.map(e=>
|
|
317
|
-
</ol>`:
|
|
318
|
-
${n===null?
|
|
319
|
-
</div>`}(n,e)}}typing(e){return
|
|
320
|
-
`)[0]||``).trim();return n.length>100?`${n.slice(0,100)}…`:n}function
|
|
321
|
-
`)}var
|
|
315
|
+
${r.length?j`<ol class="links">
|
|
316
|
+
${r.map(e=>j`<li><a href=${e.url} target="_blank" rel="noopener noreferrer">${e.title}</a><span class="host">${function(e){try{return new URL(e).host}catch{return``}}(e.url)}</span></li>`)}
|
|
317
|
+
</ol>`:N}
|
|
318
|
+
${n===null?N:r.length?j`<details class="rawfold"><summary>${e.s.fullText}</summary>${es(e,n,`${t.id}:out`)}</details>`:es(e,n,`${t.id}:out`)}`}(e,t)}</div>`:N}
|
|
319
|
+
</div>`}(n,e)}}typing(e){return j`<div class="typing"><span class="av av-a" aria-hidden="true">A</span><span class="dots"><i></i><i></i><i></i></span><span class="meta">${e.running}</span></div>`}};function q(e,t=!1,n=R()){if(!e)return``;let r=new Date(e);return Number.isNaN(r.getTime())?e:Or(n,t).format(r)}function rs(e,t=Date.now()){let n=Date.parse(e||``);if(Number.isNaN(n))return``;let r=Math.max(0,(t-n)/1e3);return O(r<60?`just now`:r<3600?D`${Math.floor(r/60)}m ago`:r<86400?D`${Math.floor(r/3600)}h ago`:D`${Math.floor(r/86400)}d ago`)}G([I({attribute:!1})],ns.prototype,`sections`,void 0),G([I({attribute:!1})],ns.prototype,`shown`,void 0),G([I({type:Boolean})],ns.prototype,`live`,void 0),G([I({type:Number})],ns.prototype,`earlier`,void 0),G([I({type:Boolean})],ns.prototype,`loading`,void 0),G([I({attribute:!1})],ns.prototype,`count`,void 0),G([I({reflect:!0})],ns.prototype,`mode`,void 0),G([I({attribute:!1})],ns.prototype,`memory`,void 0),G([I({attribute:!1})],ns.prototype,`markdown`,void 0),G([I({attribute:!1})],ns.prototype,`renderDetail`,void 0),G([I({attribute:!1})],ns.prototype,`strings`,void 0),G([L()],ns.prototype,`bulk`,void 0),G([L()],ns.prototype,`unseen`,void 0),G([L()],ns.prototype,`pinned`,void 0),G([L()],ns.prototype,`revealed`,void 0),G([vn(`.scroller`)],ns.prototype,`scroller`,void 0);var is=e=>e.charAt(0).toLocaleUpperCase(R())+e.slice(1),as=(...e)=>e.filter(e=>!!e),J=(...e)=>as(...e).join(` | `),os=new Map;function Y(e,t=R()){let n=os.get(t);return n||(n=new Intl.ListFormat(t,{type:`conjunction`}),os.set(t,n)),n.format(e)}var X=(e,t=` · `)=>`${e.kind??``}${e.unit?t+e.unit:``}`;function ss(e){let t=(e||``).trim();if(!t)return``;let n=(t.split(`
|
|
320
|
+
`)[0]||``).trim();return n.length>100?`${n.slice(0,100)}…`:n}function Z(e){let t=e??0;return t<1e3?String(Math.round(t)):t<1e4?`${(t/1e3).toFixed(1).replace(/\.0$/,``)}k`:t<1e6?`${Math.round(t/1e3)}k`:`${(t/1e6).toFixed(1).replace(/\.0$/,``)}M`}function cs(e){return e==null?`—`:e===0?`$0`:e<.001?`<$0.001`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function ls(e){let t=new Set(e.map(e=>e.usage_unknown??``));return t.has(`tokens`)?`tokens`:t.has(`calls`)?`calls`:``}function us(e){return e===`calls`?{label:O(`Tokens per API call unknown`),tip:O(`Only the token totals that the coding agent printed are known, not the tokens of each API call (usage_unknown)`)}:e===`tokens`?{label:O(`Tokens unknown`),tip:O(`The tokens of an agent session that ran are not known (usage_unknown)`)}:null}function ds(e){let t=new Map;for(let n of e)for(let[e,r]of Object.entries(n.unread_events??{}))t.set(e,(t.get(e)??0)+r);return[...t].map(([e,t])=>`${e} ×${t}`).join(`, `)}function fs(e){switch(e){case`done`:return O(`done`,{id:`outcome-done`});case`recovered`:return O(`done after retrying`);case`partial`:return O(`partly done`,{id:`outcome-partial`});case`failed`:return O(`failed`);case`not_started`:return O(`not started`);case`running`:return O(`running`);case`waiting`:return O(`waiting`);case`skipped`:return O(`skipped`);case`cancelled`:return O(`cancelled`,{id:`outcome-cancelled`})}}var ps=(e,t)=>e!==`waiting`||t?fs(e):O(`not run`);function Q(e,t){switch(e){case`done`:return O(D`${t} done`);case`recovered`:return O(D`${t} done after retrying`);case`partial`:return O(D`${t} partly done`);case`failed`:return O(D`${t} failed`);case`not_started`:return O(D`${t} not started`);case`running`:return O(D`${t} running`);case`waiting`:return O(D`${t} waiting`);case`skipped`:return O(D`${t} skipped`);case`cancelled`:return O(D`${t} cancelled`);case`not_run`:return O(D`${t} not run`)}}function ms(e,t){return e>0?t:`neutral`}function hs(e,t){return e===`running`?`running`:e===`unresponsive`?`attention`:t?.total?t.failed?`failed`:t.not_started||t.partial?`attention`:`done`:`neutral`}var gs={completed:`done`,partial:`attention`,invalid_input:`attention`,skipped:`muted`,cancelled:`muted`,timeout:`failed`,max_turns:`failed`,budget:`failed`,context_budget:`failed`,stalled:`failed`,auth_failed:`failed`,api_error:`failed`,rate_limited:`failed`,refused:`failed`,aborted:`failed`,denied:`failed`,error:`failed`,no_output:`failed`,launch_failed:`failed`,invalid_output:`failed`,credential_mismatch:`failed`},_s=(Object.keys(gs),e=>e!=null&&Object.hasOwn(gs,e));function vs(e){return _s(e)?gs[e]:`failed`}function ys(e){switch(e){case`done`:case`recovered`:return`done`;case`failed`:return`failed`;case`partial`:case`not_started`:return`attention`;case`running`:return`running`;case`waiting`:case`skipped`:case`cancelled`:return`muted`}}function bs(e){switch(e){case`valid`:return`done`;case`invalid`:case`failed`:return`failed`;case`refused`:return`attention`;case`running`:return`running`;case`pending`:return`muted`;case null:case void 0:return`neutral`}}var xs=e=>e===`waiting`?`pending`:Jr(ys(e));function Ss(e,t){return e?_s(e)?function(e,t){switch(e){case`completed`:return O(`done`,{id:`stop-completed`});case`skipped`:return O(`skipped`);case`cancelled`:return O(`cancelled`,{id:`stop-cancelled`});case`partial`:return O(`partly done`,{id:`stop-partial`});case`invalid_input`:{let e=new Set(Ie(t).map(e=>e.problem));return e.size===1&&e.has(`missing`)?O(`not started (input missing)`):e.size===1&&e.has(`checks`)?O(`not started (input failed checks)`):e.size===1&&e.has(`failed`)?O(`not started (earlier task failed)`):e.size===2&&e.has(`missing`)&&e.has(`checks`)?O(`not started (input missing and input failed checks)`):O(`not started`,{id:`stop-invalid-input`})}case`invalid_output`:return O(`failed checks`);case`timeout`:return O(`timed out`);case`max_turns`:return O(`turn limit reached`);case`budget`:return O(`cost limit reached`);case`context_budget`:return O(`context limit reached`);case`stalled`:return O(`stalled (no events)`);case`auth_failed`:return O(`authentication failed`);case`api_error`:return O(`API error`);case`rate_limited`:return O(`rate limited`);case`refused`:return O(`refused by the model`);case`aborted`:return O(`aborted`);case`denied`:return O(`permission denied`);case`error`:return O(`error`);case`no_output`:return O(`ended without a result`);case`launch_failed`:return O(`agent session did not start`);case`credential_mismatch`:return O(`wrong identity used`)}}(e,t):O(D`unknown (${e})`):`—`}function Cs(e,t,n){return t===`failed`?O(n?D`input ${e} is the output of failed task ${n.name}`:D`input ${e} is the output of a failed task`):t===`checks`?O(n?D`input ${e} from ${n.name} failed checks`:D`input ${e} failed checks`):n?n.outcome===`failed`?O(D`input ${e} is missing because ${n.name} failed`):n.outcome===`not_started`?O(D`input ${e} is missing because ${n.name} did not start`):n.outcome&&h(n.outcome)?O(D`input ${e} from ${n.name} is missing`):O(D`input ${e} is missing because ${n.name} did not finish`):O(D`input ${e} is missing`)}function ws(e,t,n,r){let i=e.attempts[e.attempts.length-1];if(i?.stop===`invalid_input`){let e=Ie(i.reason)[0];if(!e)return E(i.reason,n);let a=e.producer||r?.(e.path)||``,o=a?t.get(a):void 0;return Cs(E(e.path,n),e.problem,o?{name:X(o),outcome:o.outcome}:void 0)}let a=e.cause?t.get(e.cause):void 0;return a?O(D`earlier task ${X(a)} failed`):``}var Ts=()=>O(`An attempt after a failed attempt (retries)`),Es=e=>O(D`Attempt ${(e??0)+1}`);function Ds(e){let t=oe(e),n=e.map((e,n)=>t[n]?J(Es(e.attempt),O(`resumed run`)):Es(e.attempt));return n.map((t,r)=>n.indexOf(t)===n.lastIndexOf(t)?t:J(t,q(e[r]?.ts)))}function Os(e){return e<=0?``:O(e===1?`1 correction`:D`${e} corrections`)}var ks=e=>O(D`Pass ${e}`),As=e=>O(e<=1?`1 pass`:D`up to ${e} passes`),js=e=>O(e<=1?`1 pass`:D`${e} passes`),Ms=e=>e.map(([e,t])=>O(e<=1?D`1 pass: ${t}`:D`${e} passes: ${t}`)).join(` | `),Ns=()=>O(`loop`),Ps=e=>e?e===`ambient`?O(`default`):e:``,Fs=e=>e===`ambient`?O(`local credentials (ambient)`):``,Is=e=>e==null?`—`:`${Math.round(e)}%`;function Ls(e,t){if(!e||e===`allowed`)return``;let n=e.split(`,`),r=n.some(e=>[`rejected`,`exhausted`,`quota`,`blocked`].includes(e))?O(`limit reached`):n.every(e=>[`allowed_warning`,`warning`].includes(e))?O(`near the limit`):O(D`unknown (${e})`);return t?J(r,Rs(t)):r}function Rs(e){if(e===`five_hour`)return O(`5-hour`);if(e===`seven_day`)return O(`weekly`);let t=/^(five_hour|seven_day)_(.+)$/.exec(e);return t?t[1]===`five_hour`?O(D`5-hour (${t[2]})`):O(D`weekly (${t[2]})`):e}var zs=e=>O(D`account ${e.slice(0,6)}`),Bs=e=>J(O(D`weekly ${Is(e.seven_day_pct)}`),O(D`5-hour ${Is(e.five_hour_pct)}`));function Vs(e){let t=[e.seven_day_resets_at?O(D`Weekly usage ${Is(e.seven_day_pct)} (resets ${q(e.seven_day_resets_at,!0)})`):O(D`Weekly usage ${Is(e.seven_day_pct)}`),e.five_hour_resets_at?O(D`5-hour usage ${Is(e.five_hour_pct)} (resets ${q(e.five_hour_resets_at,!0)})`):O(D`5-hour usage ${Is(e.five_hour_pct)}`),...Object.entries(e.windows??{}).filter(([e])=>e!==`five_hour`&&e!==`seven_day`).map(([e,t])=>O(D`${is(Rs(e))} usage ${Is(t.pct)}`)),O(D`Reported ${q(e.observed_at,!0)}`)],n=Ls(e.status,e.status_window);return n&&t.push(O(D`Status: ${n}`)),e.threshold_pct!=null&&t.push(O(D`Warning threshold: ${Is(e.threshold_pct)}`)),e.overage_status&&t.push(O(D`Extra usage: ${function(e){return e===`allowed`||e===`allowed_warning`?O(`allowed`):e===`rejected`?O(`not allowed`):e}(e.overage_status)}`)),e.account&&t.push(O(D`Account: ${e.account}`)),t.join(`
|
|
321
|
+
`)}var Hs=e=>J(Bs(e),Ps(e.credential));function Us(e){let t=e[0];if(!t)return``;let n=e.length-1;return n?J(Hs(t.last),O(n===1?`1 more account`:D`${n} more accounts`)):Bs(t.last)}var Ws=e=>e.map(e=>e.credential?`${Ps(e.credential)}\n${Vs(e.last)}`:Vs(e.last)).join(`
|
|
322
322
|
|
|
323
|
-
`);function Fs(e,t){return E(e===`seven_day`?T`Weekly usage ${Q(t)}`:T`5-hour usage ${Q(t)}`)}var Is=e=>e==null?`—`:`${Number(e.toFixed(2))}%`,Ls=e=>E(T`limit ${Is(e)}`),Rs=e=>K(E(`Authentication failed`),e.model??``);function zs(e){return e.stop?Rs(e):e.rule?E(T`Usage rule: ${e.rule}`):K(Fs(e.window??``,e.pct),Ls(e.cap),e.until?E(T`until ${G(e.until,!0)}`):``)}var Bs=e=>K(E(T`Identity ${Ts(e.credential)} paused`),zs(e));function Vs(e){let t=new Set;return e.filter(e=>!t.has(e.credential)&&t.add(e.credential))}function Hs(e,t=``,n=``){let r=n?n.slice(n.lastIndexOf(`.`)+1):``;switch(e?.cause){case`deadline`:return E(r?T`Past the deadline of ${r}`:`Past the deadline`);case`grace_window`:return E(r?T`Past the deadline of ${r} and its finishing time`:`Past the deadline and its finishing time`);case`cannot_finish`:return K(E(r?T`Cannot finish before the deadline of ${r}`:`Cannot finish before the deadline`),e.need_s==null?``:E(T`needs ${B(e.need_s)}`),e.left_s==null?``:E(T`${B(e.left_s)} left`));case`dependency_not_queued`:return E(`An earlier task was never scheduled`);case`dependency_deferred`:return E(`An earlier task was not run`);case`rest`:{let n=Vs(e.rests??[]);return n.length?n.length===1?Bs(n[0]):K(Bs(n[0]),E(T`+${n.length-1} paused identities`)):t}default:return t}}var Us=e=>E(T`${e.model||e.route||`—`} (identity paused)`);function Ws(e){if(!e||e.five_hour_pct==null&&e.seven_day_pct==null)return``;let t=K(e.seven_day_pct==null?``:E(T`weekly ${Is(e.seven_day_pct)}`),e.five_hour_pct==null?``:E(T`5-hour ${Is(e.five_hour_pct)}`));return E(T`Limits: ${t}`)}var Gs=()=>E(`A new agent session on the next model after a failed one (Router hops)`),Ks=e=>e.model||e.route||`—`;function qs(e,t,n){let r=[...new Map((n??[]).map(e=>[e.route||e.model,e])).values()];if(!e||e.length+r.length<2||!e.length)return``;let i=[...r.map(Us),...e.map((t,n)=>n<e.length-1?E(T`${Ks(t)} (${ps(t.stop)})`):Ks(t))].join(` → `);return t==null?i:`${i} | ${B(t)}`}function Js(e){switch(e){case`valid`:return E(`passed`);case`invalid`:return E(`failed checks`);case`refused`:return E(`not written (task not started)`);case`failed`:return E(`not written (task failed)`);case`running`:return E(`not written yet (task running)`);case`pending`:return E(`not written yet (task waiting)`)}}function Ys(e){return e===`failed`?E(`The task failed before it wrote a file that passes its checks`):``}var Xs=()=>E(`Failed checks sent back to the same agent session, within its round or in a correction round (hook_errors, rounds)`),Zs=()=>E(`Another round in the same agent session after failed checks (rounds)`);function Qs(e,t){let n=(e??1)-1;return n<1?``:E(t?n===1?`after 1 correction round`:T`after ${n} correction rounds`:n===1?`1 correction round`:T`${n} correction rounds`)}function $s(e,t,n){let r=e.errors??[],i=Re(`invalid input: ${r.map(e=>e.replace(/^invalid input:\s*/,``)).join(`; `)}`)[0];if(!i)return r[0]?Xo(w(r[0],t)):``;let a=n?.(i.path);return Xo(ms(w(i.path,t),i.problem,a))}var ec=(e,t)=>e.ready?Ie(e.journal):t.quota??[],tc=e=>E(T`Agent sessions played from the recordings in ${e} (replay)`),nc=e=>!!e?.replay&&!e.stub,rc=()=>E(`replayed`),ic=()=>E(`Played from a recording (replayed)`);function ac(e){return e?.replay&&nc(e)?{text:E(`replay and new sessions`),title:(t=e.replay,E(T`Agent sessions played from the recordings in ${t}, and new agent sessions recorded there (replay, record_missing)`))}:e?.replay?{text:E(`replay`),title:tc(e.replay)}:e?.stub?{text:E(`stub agent`),title:E(`Tasks played by the stub agent with scripted replies (stub)`)}:null;var t}var oc=()=>E(`no report from host`),sc=e=>e.up?E(`up`):E(`no report`),cc=e=>e?.last_seen?E(T`Last report ${G(e.last_seen,!0)}`):``,lc=e=>E(e?T`Host ${e}`:`No host id`),uc=e=>E(e===1?`1 run`:T`${e} runs`);function dc(e){let t=e.filter(e=>!e.up).length;return K(e.length===1?E(`1 host`):E(T`${e.length} hosts`),t?E(T`${t} with no report`):``)}var fc=e=>({empty:e,sortAscending:E(`Sort ascending`),sortDescending:E(`Sort descending`)}),pc=()=>E(`Names this task holds while it runs (claims)`);function mc(e){switch(e){case`running`:return E(`running`,{id:`service-running`});case`stopped`:return E(`stopped`);case`failed`:return E(`did not start`);default:return E(`stop not recorded`)}}var hc=()=>E(`A deadline of its own (time_box)`),gc=()=>E(`Custom column (row_extras)`);function _c(e){if(e==null||e===``)return`—`;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)??`—`}catch{return`—`}}function vc(e,t){let n=e;return t.filter(e=>n[e]!==null&&n[e]!==void 0&&n[e]!==``).map(e=>[e,_c(n[e])])}function yc(e){switch(e){case`cost`:return E(`Cost`);case`tokens`:return E(`Tokens`);case`time`:return E(`Time`);case`sessions`:return E(`Agent sessions`)}}function bc(e){switch(e){case`cost`:return E(`Reported by the coding agent`);case`tokens`:return E(`Input, output, cache read and cache write`);case`time`:return E(`Time of the agent sessions, summed`);case`sessions`:return E(`Agent sessions started on the model`)}}function xc(e,t){switch(t){case`cost`:return e.cost_usd===null||e.cost_usd===void 0?`—`:X(e.cost_usd);case`tokens`:return Y(ke(e));case`time`:return B(e.wall_s??0);case`sessions`:return String(e.sessions)}}function Sc(e){let t=100*e;return t>0&&t<.05?`<0.1%`:Math.abs(t)<10?Math.round(10*t)/10+`%`:`${Math.round(t)}%`}var Cc=e=>String(Math.round(100*e)/100);function wc(e){switch(e){case`usd`:return X;case`pct`:return Sc;case`duration`:return B;case`tokens`:return Y;default:return Cc}}function Tc(e,t){return e==null||e===``?`—`:t===`datetime`&&typeof e==`string`?G(e,!0)||e:typeof e==`number`?wc(t)(e):typeof e==`boolean`?String(e):typeof e==`string`?e:JSON.stringify(e)}var Ec=e=>E(T`Exported ${G(e.exported_at,!0)}`);function Dc(e){return e===`transcripts`?E(`transcripts`):e===`processes`?E(`processes`):e}var Oc=e=>E(T`Not in this export: ${q(e.left_out.map(Dc))}`),kc=()=>E(`not in this export`),Ac=()=>E(`Trends`),jc=()=>E(`Totals of the runs in a period`);function Mc(e,t=I()){let n=new Date(`${e}T12:00:00Z`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,timeZone:`UTC`}).format(n)}var Nc=e=>E(T`${e} days`);function Pc(e=I()){let t=new Intl.DateTimeFormat(e,{weekday:`short`,timeZone:`UTC`});return Array.from({length:7},(e,n)=>t.format(new Date(Date.UTC(2026,9,12+n,12))))}var Fc=()=>({runs:E(`Runs`,{id:`trends-runs`}),attempts:E(`Attempts`),done:E(`Done`),cost:E(`Cost`),tokens:E(`Tokens`),time:E(`Time`),costByDay:E(`Cost by day`),costByDayTip:E(`Reported by the coding agent, on the day each attempt ended`),kinds:E(`Kinds`),kind:E(`Kind`),group:E(`Group`),tasks:E(`Tasks`),tasksDone:E(`Tasks done`),partial:E(`Partly done`,{id:`trends-partial`}),medianTime:E(`Median time`),totalTime:E(`Total time`),models:E(`Models`),model:E(`Model`),sessions:E(`Agent sessions`),calls:E(`API calls`),input:E(`Input`),output:E(`Output`),cacheRead:E(`Cache read`),cacheWrite:E(`Cache write`),outcomes:E(`Attempts not done`),outcome:E(`Outcome`),denials:E(`Denied tool calls`),toolCalls:E(`Tool calls`),pythonKinds:E(`Python tasks`),tool:E(`Tool`),usage:E(`Subscription usage`),usageTip:E(`The highest reading of each day`),deferred:E(`Not run`),cause:E(`Cause`),task:E(`Task`),when:E(`When`),rests:E(`Paused identities`),identity:E(`Identity`),event:E(`Event`),starts:E(`Run starts`),startsTip:E(`By weekday and hour, in the period's time zone`),run:E(`Run`),started:E(`Started`),trendPanels:E(`Custom views`)}),Ic=(e,t)=>`${e} | ${t}`,Lc=e=>{let t=/^(\S+) rests\b/.exec(e)?.[1];return E(t?T`Identity ${t} paused`:`Identity paused`)},Rc=(e,t)=>`${e} | ${t}`,zc=e=>e?E(T`Priority ${e}`):``,Bc=()=>E(`Tie-breaker in the queue's order (priority)`),Vc=()=>E(`Peak context`),Hc=()=>E(`Largest input of one API call, cache read and cache write included (peak_context)`);function Uc(e){let t=e.usage?.peak_context;return t==null?``:E(T`Peak context: ${function(e,t){let n=t?Math.round(100*e/t):null;return K(Y(e),n===null?``:E(T`${n}% of the context limit ${Y(t)}`))}(t,e.context_budget)}`)}function Wc(e){let t=e.usage?.peak_context,n=e.context_budget;return E(t!=null&&n?T`near the context limit (${Math.round(100*t/n)}%)`:`near the context limit`)}var Gc=()=>E(`Peak context above the warning threshold (context_warned)`),Kc=(e,t)=>t?`${e} / ${t}`:e,qc=e=>K(Kc(e.agent,e.model),e.credential?E(T`identity ${Ts(e.credential)}`):``,e.reason,e.kinds.length?E(T`kinds ${q(e.kinds)}`):``),Jc=e=>K(e.kind,`${Kc(e.from_agent,e.from_model)} → ${Kc(e.to_agent,e.to_model)}`),Yc=()=>E(`No available model`),Xc=()=>E(`Must stay unchanged`),Zc=()=>E(`Parts of the output file kept as before the task (preserve)`),Qc=()=>E(`Safety stops`),$c=e=>E(e===1?`1 safety stop`:T`${e} safety stops`),el=()=>E(`A safety classifier stopped part of the agent session, and the session went on (safety_stops)`);function tl(e){switch(e){case`response`:return E(`model response`);case`tool`:return E(`tool request`);case`unread`:return E(`unrecognized`);default:return e||`—`}}var nl=e=>K(tl(e.part),e.model,e.category,e.tool,G(e.ts,!0));function rl(e){switch(e){case`given_from`:return E(`given output`,{id:`edge-given`});case`after`:return E(`runs after`,{id:`edge-after`});case`created_from`:return E(`created after result`,{id:`edge-created`})}}function il(e){switch(e){case`passed`:return E(`same content at the start`);case`refused`:return E(`changed before the start`);case`not_checked`:return E(`not checked`,{id:`input-file-not-checked`})}}function al(e,t){let n=e[t];if(!n?.rerun)return null;let r=n.fingerprint_parts??{},i=e.slice(0,t).reverse().find(e=>Object.keys(e.fingerprint_parts??{}).length)?.fingerprint_parts??{},a=Object.keys(r).length&&Object.keys(i).length?[...new Set([...Object.keys(r),...Object.keys(i)])].filter(e=>r[e]!==i[e]):[];return{text:n.rerun,changed:a,divergence:n.rerun.startsWith(`divergence`)}}function ol(e){switch(e){case`definition`:return E(`definition`,{id:`part-definition`});case`params`:return E(`params`,{id:`part-params`});case`outside`:return E(`outside state`);case`output_of`:return E(`the file it fills in`);case`input_files`:return E(`input files`,{id:`part-input-files`});default:return e}}var sl=()=>E(`divergence`);function cl(e){return K(E(`Ran again after a resume`),e.divergence?sl():``,e.changed.length?E(T`Changed: ${q(e.changed.map(ol))}`):e.divergence?``:e.text)}function ll(e,t=``){let n=e.raised_at;return n?`${w(n.file,t)}:${n.line}`:``}function ul(e,t=``){let n=(e=>e.slice(e.lastIndexOf(`.`)+1)||e)(e.function),r=ll(e,t);return E(r?T`This failure stopped ${n} at ${r}`:T`This failure stopped ${n}`)}function dl(e,t,n){let r=n.toLowerCase();return e.filter(e=>(!t||e.kind===t)&&(!r||`${e.kind} ${e.unit} ${(e.claims??[]).join(` `)} ${e.key} ${e.last_stop}`.toLowerCase().includes(r)))}var fl={failed:0,not_started:1,partial:2,running:3,waiting:4};function pl(e){return e.map((e,t)=>({t:e,i:t})).sort((e,t)=>(fl[e.t.outcome]??9)-(fl[t.t.outcome]??9)||t.t.last_ts.localeCompare(e.t.last_ts)||e.i-t.i).map(e=>e.t)}var ml=[`key`,`unit`,`stop`,`kind`,`route`,`reason`],hl=e=>new Set(m(e).map(e=>e.key)),gl=e=>Math.max((e.rounds??1)-1,0)+(e.hook_errors??[]).length,_l=e=>gl(e)>0;function vl(e,t,n,r){let i=r.toLowerCase(),a=n===`retried`?hl(e):null;return e.filter(e=>!(n===`bad`&&!se(e))&&!(n===`fixup`&&!_l(e))&&!(a&&!a.has(e.key))&&!(n===`replayed`&&!e.replayed)&&!(n&&![`bad`,`fixup`,`retried`,`replayed`].includes(n)&&e.stop!==n)&&(!t||e.kind===t)&&(!i||ml.some(t=>String(e[t]??``).toLowerCase().includes(i))))}function yl(e){let t=new Map;for(let n of e)t.set(n.stop||`?`,(t.get(n.stop||`?`)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1])}function bl(e){let t=new Map;return e.forEach((e,n)=>{let r=t.get(e.key)??{count:0,lastOk:-1,lastOkTry:0};f(e)&&r.count++,e.ok&&(r.lastOk=n,r.lastOkTry=(e.attempt??0)+1),t.set(e.key,r)}),t}function xl({url:e,failure:t,status:n,type:r}){let i=t===`network`?E(`network error, no response`):t===`status`?E(T`the response status is ${n}`):r.includes(`html`)?E(`the response is HTML, not JSON`):E(`the response is not JSON`);return E(T`No monitor API at ${e}: ${i}`)}function Sl(e,t){let n=J(e),r=w(e.reason,t).slice(0,110);if(e.stop===`invalid_input`)return[`attention`,E(T`${n}: not started`),r];if(se(e))return[`failed`,E(T`${n}: ${ps(e.stop)}`),r];if(e.stop===`partial`)return[`attention`,E(T`${n}: ${ps(e.stop)}`),r];let i=qs(e.hops,e.wall_s,e.skipped_hops);return i?[`agent`,E(T`${n}: model switch`),i.slice(0,110)]:[`done`,E(T`${n}: done`),K(B(e.wall_s),e.model)]}z(`cae-segmented`,Ti);var Cl={done:`✓`,failed:`✕`,attention:`◌`,running:`●`,agent:`✦`},wl=class extends M{constructor(...e){super(...e),this.toasts=[],this.next=0}static{this.styles=[V,O` :host{position:fixed;right:18px;bottom:18px;display:flex;flex-direction:column;gap:8px;z-index:60;pointer-events:none;}.toast{pointer-events:auto;min-width:240px;max-width:380px;padding:10px 14px;border-radius:11px;background:var(--panel2);border:1px solid var(--line2);box-shadow:0 18px 40px color-mix(in srgb,var(--shadow) 60%,transparent);display:flex;gap:10px;align-items:flex-start;animation:toast-in 0.35s var(--ease) both;}.toast.out{animation:toast-out 0.35s var(--ease) both;}.ti{font-size:16px;line-height:1.2;}b{display:block;font-size:12.5px;}span.sub{font-size:11.5px;color:var(--text-muted);}.ti{color:var(--text-muted);}.toast[data-tone] .ti{color:var(--tone);}.toast[data-tone='failed'],.toast[data-tone='attention']{border-color:color-mix(in srgb,var(--tone) 50%,var(--line2));}.agent .ti{color:var(--agent);}`]}show(e,t,n=``){let r={id:this.next++,kind:e,title:t,sub:n,out:!1};this.toasts=[...this.toasts,r].slice(-4),setTimeout(()=>{this.toasts=this.toasts.map(e=>e.id===r.id?{...e,out:!0}:e),setTimeout(()=>this.toasts=this.toasts.filter(e=>e.id!==r.id),400)},5200)}render(){let e=e=>H(this.toasts.filter(t=>!t.out&&t.kind===`failed`===e),e=>e.id,e=>k`<p>${K(e.title,e.sub)}</p>`);return k`<div class="sr" role="status" aria-live="polite">${e(!1)}</div>
|
|
323
|
+
`);function Gs(e,t){return O(e===`seven_day`?D`Weekly usage ${Is(t)}`:D`5-hour usage ${Is(t)}`)}var Ks=e=>e==null?`—`:`${Number(e.toFixed(2))}%`,qs=e=>O(D`limit ${Ks(e)}`),Js=e=>J(O(`Authentication failed`),e.model??``);function Ys(e){return e.stop?Js(e):e.rule?O(D`Usage rule: ${e.rule}`):J(Gs(e.window??``,e.pct),qs(e.cap),e.until?O(D`until ${q(e.until,!0)}`):``)}var Xs=e=>J(O(D`Identity ${Ps(e.credential)} paused`),Ys(e));function Zs(e){let t=new Set;return e.filter(e=>!t.has(e.credential)&&t.add(e.credential))}function Qs(e,t=``,n=``){let r=n?n.slice(n.lastIndexOf(`.`)+1):``;switch(e?.cause){case`deadline`:return O(r?D`Past the deadline of ${r}`:`Past the deadline`);case`grace_window`:return O(r?D`Past the deadline of ${r} and its finishing time`:`Past the deadline and its finishing time`);case`cannot_finish`:return J(O(r?D`Cannot finish before the deadline of ${r}`:`Cannot finish before the deadline`),e.need_s==null?``:O(D`needs ${H(e.need_s)}`),e.left_s==null?``:O(D`${H(e.left_s)} left`));case`dependency_not_queued`:return O(`An earlier task was never scheduled`);case`dependency_deferred`:return O(`An earlier task was not run`);case`rest`:{let n=Zs(e.rests??[]);return n.length?n.length===1?Xs(n[0]):J(Xs(n[0]),O(D`+${n.length-1} paused identities`)):t}default:return t}}var $s=e=>O(D`${e.model||e.route||`—`} (identity paused)`);function ec(e){if(!e||e.five_hour_pct==null&&e.seven_day_pct==null)return``;let t=J(e.seven_day_pct==null?``:O(D`weekly ${Ks(e.seven_day_pct)}`),e.five_hour_pct==null?``:O(D`5-hour ${Ks(e.five_hour_pct)}`));return O(D`Limits: ${t}`)}var tc=()=>O(`A new agent session on the next model after a failed one (Router hops)`),nc=e=>e.model||e.route||`—`;function rc(e,t,n){let r=[...new Map((n??[]).map(e=>[e.route||e.model,e])).values()];if(!e||e.length+r.length<2||!e.length)return``;let i=[...r.map($s),...e.map((t,n)=>n<e.length-1?O(D`${nc(t)} (${Ss(t.stop)})`):nc(t))].join(` → `);return t==null?i:`${i} | ${H(t)}`}function ic(e){switch(e){case`valid`:return O(`passed`);case`invalid`:return O(`failed checks`);case`refused`:return O(`not written (task not started)`);case`failed`:return O(`not written (task failed)`);case`running`:return O(`not written yet (task running)`);case`pending`:return O(`not written yet (task waiting)`)}}function ac(e){return e===`failed`?O(`The task failed before it wrote a file that passes its checks`):``}var oc=()=>O(`Failed checks sent back to the same agent session, within its round or in a correction round (hook_errors, rounds)`),sc=()=>O(`Another round in the same agent session after failed checks (rounds)`);function cc(e,t){let n=(e??1)-1;return n<1?``:O(t?n===1?`after 1 correction round`:D`after ${n} correction rounds`:n===1?`1 correction round`:D`${n} correction rounds`)}function lc(e,t,n){let r=e.errors??[],i=Ie(`invalid input: ${r.map(e=>e.replace(/^invalid input:\s*/,``)).join(`; `)}`)[0];if(!i)return r[0]?is(E(r[0],t)):``;let a=n?.(i.path);return is(Cs(E(i.path,t),i.problem,a))}var uc=(e,t)=>e.ready?Pe(e.journal):t.quota??[],dc=e=>O(D`Agent sessions played from the recordings in ${e} (replay)`),fc=e=>!!e?.replay&&!e.stub,pc=()=>O(`replayed`),mc=()=>O(`Played from a recording (replayed)`);function hc(e){return e?.replay&&fc(e)?{text:O(`replay and new sessions`),title:(t=e.replay,O(D`Agent sessions played from the recordings in ${t}, and new agent sessions recorded there (replay, record_missing)`))}:e?.replay?{text:O(`replay`),title:dc(e.replay)}:e?.stub?{text:O(`stub agent`),title:O(`Tasks played by the stub agent with scripted replies (stub)`)}:null;var t}var gc=()=>O(`no report from host`),_c=e=>e.up?O(`up`):O(`no report`),vc=e=>e?.last_seen?O(D`Last report ${q(e.last_seen,!0)}`):``,yc=e=>O(e?D`Host ${e}`:`No host id`),bc=e=>O(e===1?`1 run`:D`${e} runs`);function xc(e){let t=e.filter(e=>!e.up).length;return J(e.length===1?O(`1 host`):O(D`${e.length} hosts`),t?O(D`${t} with no report`):``)}var Sc=e=>({empty:e,sortAscending:O(`Sort ascending`),sortDescending:O(`Sort descending`)}),Cc=()=>O(`Names this task holds while it runs (claims)`);function wc(e){switch(e){case`running`:return O(`running`,{id:`service-running`});case`stopped`:return O(`stopped`);case`failed`:return O(`did not start`);default:return O(`stop not recorded`)}}var Tc=()=>O(`A deadline of its own (time_box)`),Ec=()=>O(`Custom column (row_extras)`);function Dc(e){if(e==null||e===``)return`—`;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)??`—`}catch{return`—`}}function Oc(e,t){let n=e;return t.filter(e=>n[e]!==null&&n[e]!==void 0&&n[e]!==``).map(e=>[e,Dc(n[e])])}function kc(e){switch(e){case`cost`:return O(`Cost`);case`tokens`:return O(`Tokens`);case`time`:return O(`Time`);case`sessions`:return O(`Agent sessions`)}}function Ac(e){switch(e){case`cost`:return O(`Reported by the coding agent`);case`tokens`:return O(`Input, output, cache read and cache write`);case`time`:return O(`Time of the agent sessions, summed`);case`sessions`:return O(`Agent sessions started on the model`)}}function jc(e,t){switch(t){case`cost`:return e.cost_usd===null||e.cost_usd===void 0?`—`:cs(e.cost_usd);case`tokens`:return Z(De(e));case`time`:return H(e.wall_s??0);case`sessions`:return String(e.sessions)}}function Mc(e){let t=100*e;return t>0&&t<.05?`<0.1%`:Math.abs(t)<10?Math.round(10*t)/10+`%`:`${Math.round(t)}%`}var Nc=e=>String(Math.round(100*e)/100);function Pc(e){switch(e){case`usd`:return cs;case`pct`:return Mc;case`duration`:return H;case`tokens`:return Z;default:return Nc}}function Fc(e,t){return e==null||e===``?`—`:t===`datetime`&&typeof e==`string`?q(e,!0)||e:typeof e==`number`?Pc(t)(e):typeof e==`boolean`?String(e):typeof e==`string`?e:JSON.stringify(e)}var Ic=e=>O(D`Exported ${q(e.exported_at,!0)}`);function Lc(e){return e===`transcripts`?O(`transcripts`):e===`processes`?O(`processes`):e}var Rc=e=>O(D`Not in this export: ${Y(e.left_out.map(Lc))}`),zc=()=>O(`not in this export`),Bc=()=>O(`Trends`),Vc=()=>O(`Totals of the runs in a period`);function Hc(e,t=R()){let n=new Date(`${e}T12:00:00Z`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,timeZone:`UTC`}).format(n)}var Uc=e=>O(D`${e} days`);function Wc(e=R()){let t=new Intl.DateTimeFormat(e,{weekday:`short`,timeZone:`UTC`});return Array.from({length:7},(e,n)=>t.format(new Date(Date.UTC(2026,9,12+n,12))))}var Gc=()=>({runs:O(`Runs`,{id:`trends-runs`}),attempts:O(`Attempts`),done:O(`Done`),cost:O(`Cost`),tokens:O(`Tokens`),time:O(`Time`),costByDay:O(`Cost by day`),costByDayTip:O(`Reported by the coding agent, on the day each attempt ended`),kinds:O(`Kinds`),kind:O(`Kind`),group:O(`Group`),tasks:O(`Tasks`),tasksDone:O(`Tasks done`),partial:O(`Partly done`,{id:`trends-partial`}),medianTime:O(`Median time`),totalTime:O(`Total time`),models:O(`Models`),model:O(`Model`),sessions:O(`Agent sessions`),calls:O(`API calls`),input:O(`Input`),output:O(`Output`),cacheRead:O(`Cache read`),cacheWrite:O(`Cache write`),outcomes:O(`Attempts not done`),outcome:O(`Outcome`),denials:O(`Denied tool calls`),toolCalls:O(`Tool calls`),pythonKinds:O(`Python tasks`),tool:O(`Tool`),usage:O(`Subscription usage`),usageTip:O(`The highest reading of each day`),deferred:O(`Not run`),cause:O(`Cause`),task:O(`Task`),when:O(`When`),rests:O(`Paused identities`),identity:O(`Identity`),event:O(`Event`),starts:O(`Run starts`),startsTip:O(`By weekday and hour, in the period's time zone`),run:O(`Run`),started:O(`Started`),trendPanels:O(`Custom views`)}),Kc=(e,t)=>`${e} | ${t}`,qc=e=>{let t=/^(\S+) rests\b/.exec(e)?.[1];return O(t?D`Identity ${t} paused`:`Identity paused`)},Jc=(e,t)=>`${e} | ${t}`,Yc=e=>e?O(D`Priority ${e}`):``,Xc=()=>O(`Tie-breaker in the queue's order (priority)`),Zc=()=>O(`Peak context`),Qc=()=>O(`Largest input of one API call, cache read and cache write included (peak_context)`);function $c(e){let t=e.usage?.peak_context;return t==null?``:O(D`Peak context: ${function(e,t){let n=t?Math.round(100*e/t):null;return J(Z(e),n===null?``:O(D`${n}% of the context limit ${Z(t)}`))}(t,e.context_budget)}`)}function el(e){let t=e.usage?.peak_context,n=e.context_budget;return O(t!=null&&n?D`near the context limit (${Math.round(100*t/n)}%)`:`near the context limit`)}var tl=()=>O(`Peak context above the warning threshold (context_warned)`),nl=(e,t)=>t?`${e} / ${t}`:e,rl=e=>J(nl(e.agent,e.model),e.credential?O(D`identity ${Ps(e.credential)}`):``,e.reason,e.kinds.length?O(D`kinds ${Y(e.kinds)}`):``),il=e=>J(e.kind,`${nl(e.from_agent,e.from_model)} → ${nl(e.to_agent,e.to_model)}`),al=()=>O(`No available model`),ol=()=>O(`Must stay unchanged`),sl=()=>O(`Parts of the output file kept as before the task (preserve)`),cl=()=>O(`Safety stops`),ll=e=>O(e===1?`1 safety stop`:D`${e} safety stops`),ul=()=>O(`A safety classifier stopped part of the agent session, and the session went on (safety_stops)`);function dl(e){switch(e){case`response`:return O(`model response`);case`tool`:return O(`tool request`);case`unread`:return O(`unrecognized`);default:return e||`—`}}var fl=e=>J(dl(e.part),e.model,e.category,e.tool,q(e.ts,!0));function pl(e){switch(e){case`given_from`:return O(`given output`,{id:`edge-given`});case`after`:return O(`runs after`,{id:`edge-after`});case`created_from`:return O(`created after result`,{id:`edge-created`})}}function ml(e){switch(e){case`passed`:return O(`same content at the start`);case`refused`:return O(`changed before the start`);case`not_checked`:return O(`not checked`,{id:`input-file-not-checked`})}}function hl(e,t){let n=e[t];if(!n?.rerun)return null;let r=n.fingerprint_parts??{},i=e.slice(0,t).reverse().find(e=>Object.keys(e.fingerprint_parts??{}).length)?.fingerprint_parts??{},a=Object.keys(r).length&&Object.keys(i).length?[...new Set([...Object.keys(r),...Object.keys(i)])].filter(e=>r[e]!==i[e]):[];return{text:n.rerun,changed:a,divergence:n.rerun.startsWith(`divergence`)}}function gl(e){switch(e){case`definition`:return O(`definition`,{id:`part-definition`});case`params`:return O(`params`,{id:`part-params`});case`outside`:return O(`outside state`);case`output_of`:return O(`the file it fills in`);case`input_files`:return O(`input files`,{id:`part-input-files`});default:return e}}var _l=()=>O(`divergence`);function vl(e){return J(O(`Ran again after a resume`),e.divergence?_l():``,e.changed.length?O(D`Changed: ${Y(e.changed.map(gl))}`):e.divergence?``:e.text)}function yl(e,t=``){let n=e.raised_at;return n?`${E(n.file,t)}:${n.line}`:``}function bl(e,t=``){let n=(e=>e.slice(e.lastIndexOf(`.`)+1)||e)(e.function),r=yl(e,t);return O(r?D`This failure stopped ${n} at ${r}`:D`This failure stopped ${n}`)}function xl(e,t,n){let r=n.toLowerCase();return e.filter(e=>(!t||e.kind===t)&&(!r||`${e.kind} ${e.unit} ${(e.claims??[]).join(` `)} ${e.key} ${e.last_stop}`.toLowerCase().includes(r)))}var Sl={failed:0,not_started:1,partial:2,running:3,waiting:4},Cl=new Intl.Collator;function wl(e){return e.map((e,t)=>({t:e,i:t})).sort((e,t)=>(Sl[e.t.outcome]??9)-(Sl[t.t.outcome]??9)||Cl.compare(t.t.last_ts,e.t.last_ts)||e.i-t.i).map(e=>e.t)}var Tl=[`key`,`unit`,`stop`,`kind`,`route`,`reason`],El=e=>new Set(p(e).map(e=>e.key)),Dl=e=>Math.max((e.rounds??1)-1,0)+(e.hook_errors??[]).length,Ol=e=>Dl(e)>0;function kl(e,t,n,r){let i=r.toLowerCase(),a=n===`retried`?El(e):null;return e.filter(e=>!(n===`bad`&&!ae(e))&&!(n===`fixup`&&!Ol(e))&&!(a&&!a.has(e.key))&&!(n===`replayed`&&!e.replayed)&&!(n&&![`bad`,`fixup`,`retried`,`replayed`].includes(n)&&e.stop!==n)&&(!t||e.kind===t)&&(!i||Tl.some(t=>String(e[t]??``).toLowerCase().includes(i))))}function Al(e){let t=new Map;for(let n of e)t.set(n.stop||`?`,(t.get(n.stop||`?`)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1])}function jl(e){let t=new Map;return e.forEach((e,n)=>{let r=t.get(e.key)??{count:0,lastOk:-1,lastOkTry:0};d(e)&&r.count++,e.ok&&(r.lastOk=n,r.lastOkTry=(e.attempt??0)+1),t.set(e.key,r)}),t}function Ml({url:e,failure:t,status:n,type:r}){let i=t===`network`?O(`network error, no response`):t===`status`?O(D`the response status is ${n}`):r.includes(`html`)?O(`the response is HTML, not JSON`):O(`the response is not JSON`);return O(D`No monitor API at ${e}: ${i}`)}function Nl(e,t){let n=X(e),r=E(e.reason,t).slice(0,110);if(e.stop===`invalid_input`)return[`attention`,O(D`${n}: not started`),r];if(ae(e))return[`failed`,O(D`${n}: ${Ss(e.stop)}`),r];if(e.stop===`partial`)return[`attention`,O(D`${n}: ${Ss(e.stop)}`),r];let i=rc(e.hops,e.wall_s,e.skipped_hops);return i?[`agent`,O(D`${n}: model switch`),i.slice(0,110)]:[`done`,O(D`${n}: done`),J(H(e.wall_s),e.model)]}V(`cae-segmented`,Ti);var Pl={done:`✓`,failed:`✕`,attention:`◌`,running:`●`,agent:`✦`},Fl=class extends P{constructor(...e){super(...e),this.toasts=[],this.next=0}static{this.styles=[U,A` :host{position:fixed;right:18px;bottom:18px;display:flex;flex-direction:column;gap:8px;z-index:60;pointer-events:none;}.toast{pointer-events:auto;min-width:240px;max-width:380px;padding:10px 14px;border-radius:11px;background:var(--panel2);border:1px solid var(--line2);box-shadow:0 18px 40px color-mix(in srgb,var(--shadow) 60%,transparent);display:flex;gap:10px;align-items:flex-start;animation:toast-in 0.35s var(--ease) both;}.toast.out{animation:toast-out 0.35s var(--ease) both;}.ti{font-size:16px;line-height:1.2;}b{display:block;font-size:12.5px;}span.sub{font-size:11.5px;color:var(--text-muted);}.ti{color:var(--text-muted);}.toast[data-tone] .ti{color:var(--tone);}.toast[data-tone='failed'],.toast[data-tone='attention']{border-color:color-mix(in srgb,var(--tone) 50%,var(--line2));}.agent .ti{color:var(--agent);}`]}show(e,t,n=``){let r={id:this.next++,kind:e,title:t,sub:n,out:!1};this.toasts=[...this.toasts,r].slice(-4),setTimeout(()=>{this.toasts=this.toasts.map(e=>e.id===r.id?{...e,out:!0}:e),setTimeout(()=>this.toasts=this.toasts.filter(e=>e.id!==r.id),400)},5200)}render(){let e=e=>W(this.toasts.filter(t=>!t.out&&t.kind===`failed`===e),e=>e.id,e=>j`<p>${J(e.title,e.sub)}</p>`);return j`<div class="sr" role="status" aria-live="polite">${e(!1)}</div>
|
|
324
324
|
<div class="sr" role="alert" aria-live="assertive">${e(!0)}</div>
|
|
325
325
|
<div aria-hidden="true" style="display:contents">
|
|
326
|
-
${
|
|
327
|
-
<span class="ti">${
|
|
328
|
-
<div><b>${e.title}</b>${e.sub?
|
|
326
|
+
${W(this.toasts,e=>e.id,e=>j`<div class="toast ${e.kind===`agent`?`agent`:``} ${e.out?`out`:``}" data-tone=${e.kind===`agent`?N:e.kind}>
|
|
327
|
+
<span class="ti">${Pl[e.kind]}</span>
|
|
328
|
+
<div><b>${e.title}</b>${e.sub?j`<span class="sub">${e.sub}</span>`:N}</div>
|
|
329
329
|
</div>`)}
|
|
330
|
-
</div>`}};
|
|
331
|
-
<summary>${
|
|
332
|
-
${
|
|
333
|
-
</details>`;if(!n)return t.exists?r:
|
|
334
|
-
<summary>${
|
|
335
|
-
${
|
|
336
|
-
</details>`;return
|
|
337
|
-
${t.exists?e:
|
|
338
|
-
${
|
|
339
|
-
${r}`:n.length?
|
|
340
|
-
`);return
|
|
341
|
-
${(t===`output`?[[
|
|
342
|
-
</dl>`}var
|
|
330
|
+
</div>`}};G([L()],Fl.prototype,`toasts`,void 0),Fl=G([F(`ca-toasts`)],Fl);var Il=A` :host{display:flex;flex-direction:column;height:100%;min-height:0;font:13px/1.5 var(--sans);color:var(--text);background:var(--backdrop);container:ca-monitor / inline-size;}header{flex:none;display:flex;gap:14px;align-items:center;padding:10px 18px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bg) 75%,transparent);backdrop-filter:blur(10px);position:relative;z-index:20;}.brand{display:flex;align-items:center;gap:8px;font-weight:700;font-size:15px;letter-spacing:0.02em;}.brand{flex:none;max-width:30cqi;white-space:nowrap;}.brand span{overflow:hidden;text-overflow:ellipsis;}.brand svg{width:22px;height:22px;flex:none;}.logo-braces{stroke:var(--text);}.spark-a{stop-color:var(--accent);}.spark-b{stop-color:var(--agent);}.logo-spark{transform-origin:60px 60px;}:host([live]) .logo-spark{animation:core-beat 1.8s var(--ease) infinite;}.runbtn{display:flex;align-items:center;gap:10px;min-width:min(150px,100%);max-width:52cqi;cursor:pointer;padding:6px 13px;border-radius:999px;background:var(--panel);border:1px solid var(--line);color:var(--text);transition:border-color 0.2s,background 0.2s;}.runbtn:hover{border-color:var(--line2);background:var(--panel2);}.rn{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:none;max-width:40%;}.rs{color:var(--text-muted);font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.chev{color:var(--text-muted);}.hostchip{flex:none;font-family:var(--mono);font-size:11px;color:var(--text-2);padding:0 7px;border:1px solid var(--line2);border-radius:999px;white-space:nowrap;max-width:24ch;overflow:hidden;text-overflow:ellipsis;}.runbtn .pill{flex:none;font-size:11px;}ca-run-picker{inset-inline-start:110px;}.hdr-right{margin-left:auto;display:flex;align-items:center;gap:12px;flex:none;white-space:nowrap;}.nowline{font-size:12px;color:var(--text-2);white-space:nowrap;overflow:hidden;max-width:40cqi;display:inline-flex;align-items:center;gap:4px;}.clock{font-family:var(--mono);font-size:11.5px;color:var(--text-muted);}.langs{--cae-segmented-radius:999px;--cae-segmented-height:auto;--cae-segmented-padding:2px 9px;--cae-segmented-font-size:11px;--cae-segmented-divider:0;--cae-segmented-hover:var(--text-2);}.live-dot{width:9px;height:9px;border-radius:50%;background:var(--status-running);display:inline-block;animation:breathe 1.8s ease-in-out infinite;}.live-dot.off{background:var(--line2);animation:none;box-shadow:none;}.bar{flex:none;display:flex;gap:8px;padding:8px 18px;border-top:1px solid var(--line);align-items:center;flex-wrap:wrap;}.bar select,.bar input{background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:5px 9px;outline:none;font:inherit;font-size:12px;}.bar input:focus,.bar select:focus{border-color:var(--focus);box-shadow:0 0 0 calc(var(--focus-width) - 2px) var(--focus);}.api-error{flex:none;margin:0;padding:8px 18px;color:var(--status-failed);font:12px var(--mono);overflow-wrap:anywhere;}.api-error:empty{padding:0;}main{border-top:1px solid var(--line);flex:1 1 auto;min-height:0;overflow:auto;padding:16px 18px 48px;}main.stream{display:flex;flex-direction:column;overflow:hidden;padding-bottom:16px;}@container ca-monitor (max-width:1000px){header{flex-wrap:wrap;row-gap:8px;}}@container ca-monitor (max-width:760px){header{gap:8px;padding:8px 12px;}.runbtn{flex:1 1 0;min-width:0;max-width:none;}ca-run-picker{inset-inline:16px;width:auto;}.hdr-right{width:100%;margin-left:0;flex-wrap:wrap;row-gap:6px;}.nowline{max-width:none;flex:1 1 100%;}main{padding:12px 12px 40px;}.bar{padding:8px 12px;}.bar input{flex:1 1 10em;min-width:0;}}@container ca-monitor (max-width:420px){.brand{max-width:40cqi;}.runbtn{padding:6px 10px;gap:8px;}}`;function Ll(e){return[...[{id:`overview`,label:O(`Overview`),icon:`◎`},{id:`tasks`,label:O(`Tasks`,{id:`tab-tasks`}),icon:`≡`},{id:`journal`,label:O(`History`),icon:`▤`,tip:`journal.jsonl`},{id:`outputs`,label:O(`Outputs`),icon:`▣`},{id:`definitions`,label:O(`Definitions`),icon:`⌘`},{id:`procs`,label:O(`Processes`),icon:`⚙`},{id:`stream`,label:O(`Task detail`),icon:`✦`}].map(e=>({...e,panel:!1})),...e.filter(pe).map(e=>({id:`panel:${e.name}`,label:e.title||e.name,icon:e.icon||`▤`,tip:e.description?O(D`${e.description} (custom view)`):O(`Custom view`),panel:!0}))]}var Rl=e=>`tab-${e}`;function zl(e){let t=e.querySelector(`.tab.sel`),n=e.querySelector(`.tab-ind`);if(!t||!n)return;n.style.left=`${t.offsetLeft+10}px`,n.style.width=`${Math.max(12,t.offsetWidth-20)}px`,n.classList.contains(`init`)&&requestAnimationFrame(()=>n.classList.remove(`init`));let r=n.parentElement;r&&n.dataset.tab!==t.id&&(n.dataset.tab=t.id,t.offsetLeft-24<r.scrollLeft?r.scrollLeft=Math.max(0,t.offsetLeft-24):t.offsetLeft+t.offsetWidth+24>r.scrollLeft+r.clientWidth&&(r.scrollLeft=t.offsetLeft+t.offsetWidth+24-r.clientWidth))}var Bl=A` nav{flex:none;display:flex;gap:2px;padding:6px 18px 0;position:relative;overflow-x:auto;scrollbar-width:none;align-items:center;--shade:color-mix(in srgb,var(--text) 22%,transparent);background:linear-gradient(to right,var(--backdrop) 40%,transparent) left / 32px 100% no-repeat local,linear-gradient(to left,var(--backdrop) 40%,transparent) right / 32px 100% no-repeat local,radial-gradient(farthest-side at 0 50%,var(--shade),transparent) left / 12px 100% no-repeat scroll,radial-gradient(farthest-side at 100% 50%,var(--shade),transparent) right / 12px 100% no-repeat scroll;}nav::-webkit-scrollbar{display:none;}.tabs{flex:none;display:flex;gap:2px;align-items:center;}.tab{position:relative;background:none;border:none;padding:8px 14px 11px;color:var(--text-muted);cursor:pointer;font-weight:500;white-space:nowrap;transition:color 0.2s;}.tab:hover{color:var(--text-2);}.tab.sel{color:var(--text);font-weight:600;}.tab-label{display:inline-flex;flex-direction:column;}.tab-label::after{content:attr(data-label);font-weight:600;height:0;overflow:hidden;visibility:hidden;}.tab-ic{opacity:0.55;margin-right:6px;font-size:12px;}.tab.sel .tab-ic{opacity:1;color:var(--accent);}.badge{margin-left:6px;font-size:10px;font-weight:500;padding:0 6px;border-radius:999px;background:var(--raise);color:var(--text-2);font-variant-numeric:tabular-nums;}.badge[data-tone]{background:var(--tone-bg);color:var(--tone);}.tab-sep{width:1px;height:18px;background:var(--line2);margin:0 8px 3px;flex:none;align-self:center;}.tab-ind{position:absolute;bottom:0;left:0;width:0;height:2px;border-radius:2px;background:var(--accent);transition:left 0.3s var(--ease),width 0.3s var(--ease);}.tab-ind.init{transition:none;}.tabhint{margin-left:auto;padding-left:12px;white-space:nowrap;}@container ca-monitor (max-width:900px){.tabhint{display:none;}}@container ca-monitor (max-width:760px){nav{padding:4px 8px 0;}.tab{padding:8px 10px 11px;}}`;function $(e,t,n,{bubbles:r=!0}={}){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:r,composed:!0}))}function Vl(e,t,n){return n.key?j`<button type="button" class="taskchip" title=${n.key} @click=${t=>{t.stopPropagation(),$(e,`ca-open-task`,{key:n.key,...T(n)?{view:`output`}:{}})}}>${t}</button>`:j`<span class="taskchip">${t}</span>`}var Hl={},Ul=$r(class extends ei{constructor(){super(...arguments),this.ot=Hl}render(e,t){return t()}update(e,[t,n]){if(Array.isArray(t)){if(Array.isArray(this.ot)&&this.ot.length===t.length&&t.every((e,t)=>e===this.ot[t]))return Xt}else if(this.ot===t)return Xt;return this.ot=Array.isArray(t)?Array.from(t):t,this.render(t,n)}});function Wl(e,t){return e.startsWith(`list[`)||e===`array`?Array.isArray(t):e===`string`?typeof t==`string`:e===`integer`?Number.isInteger(t):e===`number`?typeof t==`number`:e===`boolean`?typeof t==`boolean`:e!==`object`||typeof t==`object`&&!!t&&!Array.isArray(t)}V(`cae-check-table`,Za);var Gl=e=>/^RootModel\[(.+)\]$/.exec(e)?.[1]??null,Kl=e=>/^Rows\[(.+)\]$/.exec(e)?.[1]??null;function ql(e){let t=e.file.content;return e.file.exists&&typeof t==`object`&&t&&!Array.isArray(t)?t:null}function Jl(e){if(!e.fields.length&&(e.schema_name===`text`||Gl(e.schema_name)!==null))return null;let t=ql(e),n=e.fields.map(e=>{let n={name:e.name,expected:e.type,optional:!e.required};if(!t)return{...n,hasValue:!1,verdict:`none`,verdictLabel:``};if(!(e.name in t))return e.required?{...n,hasValue:!1,verdict:`fail`,verdictLabel:O(`missing`),tip:O(`A required field that is not in the file`)}:{...n,hasValue:!1,verdict:`none`,verdictLabel:O(`absent (optional)`)};let r=t[e.name];return Wl(e.type,r)?{...n,hasValue:!0,value:r,verdict:`pass`,verdictLabel:O(`passed`)}:{...n,hasValue:!0,value:r,verdict:`fail`,verdictLabel:O(`wrong type`),tip:O(D`Expected ${e.type}`)}}),r=t?Object.keys(t).filter(t=>!e.fields.some(e=>e.name===t)):[];return[...n,...r.map(e=>({name:e,expected:O(`not in the schema`),extra:!0,hasValue:!0,value:t?.[e],verdict:`warn`,verdictLabel:O(`extra field`),tip:O(`Not in the schema`)}))]}function Yl(){return{name:O(`Field`),expected:O(`Expected`),actual:O(`In the file`),verdict:O(`Check`),optional:O(`optional`),items:e=>O(e===1?`1 item`:D`${e} items`),object:O(`object`)}}function Xl(e){let t=!!e.file.exists;return Qr(`ct-chip`,{text:t?O(`found`):e.required?O(`missing (required)`):O(`missing (optional)`),tone:t?`done`:e.required?`failed`:`muted`})}function Zl(e,t){return Qr(`ct-chip`,e?{text:t===void 0?ic(e):j`${ic(e)} <b>${t}</b>`,tone:bs(e),title:ac(e)}:{text:`—`})}function Ql(e){let t=e.content;return typeof t==`object`&&t?j`<cae-json-tree .value=${t}></cae-json-tree>`:j`<pre class="jtree">${typeof t==`string`?t:O(`Not JSON`)}</pre>`}function $l(e){let t=e.file,n=Jl(e),r=j`<details class="ct-raw">
|
|
331
|
+
<summary>${eu(t)}</summary>
|
|
332
|
+
${Ql(t)}
|
|
333
|
+
</details>`;if(!n)return t.exists?r:j``;if(e.format===`jsonl`){let e=j`<details class="ct-raw">
|
|
334
|
+
<summary>${J(function(e){let t=Array.isArray(e.content)?e.content.length:0;return O(t===1?`1 row`:D`${t} rows`)}(t),`${t.size??0} B`,t.mtime?O(D`written ${q(t.mtime,!0)}`):``,t.truncated?O(`truncated`):``)}</summary>
|
|
335
|
+
${Ql(t)}
|
|
336
|
+
</details>`;return j`<cae-check-table .rows=${n} .showValues=${!1} .strings=${Yl()}></cae-check-table>
|
|
337
|
+
${t.exists?e:N}`}return t.exists?j`<cae-check-table .rows=${n} .strings=${Yl()}></cae-check-table>
|
|
338
|
+
${ql(e)?N:j`<div class="meta note">${O(`Not a JSON object`)}</div>`}
|
|
339
|
+
${r}`:n.length?j`<cae-check-table .rows=${n} .showValues=${!1} .strings=${Yl()}></cae-check-table>`:j``}V(`cae-json-tree`,Ei);var eu=e=>J(O(`Whole file`),`${e.size??0} B`,e.mtime?O(D`written ${q(e.mtime,!0)}`):``,e.truncated?O(`truncated`):``);function tu(e){let t=Gl(e.schema_name),n=e.schema_name===`text`||t===`str`?O(`text`):t??Kl(e.schema_name)??e.schema_name;return j`<b class="jmono" title=${e.schema_ref||e.schema_name}>${n}</b>`}function nu(e){let t=e.schema_ref||e.schema_name;if(e.schema_name===`text`)return O(`text file`);if(e.format===`jsonl`)return O(j`JSON Lines, one object of schema ${tu(e)} per line`);let n=Gl(e.schema_name);return n===`str`?j`<span title=${t}>${O(`text (JSON string)`)}</span>`:n?j`<span title=${t}>${O(D`JSON value of type ${n}`)}</span>`:O(j`JSON object, schema ${tu(e)}`)}function ru(e,t){let n=nu(e),r=function(e){let t=e.validators??[];if(!t.length)return null;let n=(e.errors??[]).join(`
|
|
340
|
+
`);return j`${t.map((t,r)=>j`${r?`, `:``}<span class="jmono">${t}</span> ${(t=>e.status===`valid`?Ya(`pass`,O(`passed`)):n.includes(t)?Ya(`fail`,O(`failed checks`)):N)(t)}`)}`}(e);return j`<dl class="conds">
|
|
341
|
+
${(t===`output`?[[O(`Format`),n],...r?[[O(`Other checks`),r,O(`Checks beyond the schema (validators)`)]]:[],[O(`Must be written during the task`),e.fresh?O(`yes`):O(`no`),e.fresh?O(`A file from before the task does not count`):O(`A file from before the task counts`)],...e.preserve?.length?[[ol(),j`<span class="jmono">${e.preserve.join(`, `)}</span>`,sl()]]:[]]:[[O(`Format`),n],...r?[[O(`Other checks`),r,O(`Checks beyond the schema (validators)`)]]:[],[O(`Check time`),O(`when the task starts`)],[O(`Required`),e.required?O(`yes`):O(`no`)]]).map(([e,t,n])=>j`<dt>${e}</dt><dd title=${n??``}>${t}</dd>`)}
|
|
342
|
+
</dl>`}var iu=A` .ct-chip{display:inline-block;padding:1px 10px;border-radius:var(--radius-pill);font-size:11.5px;background:var(--raise);color:var(--text-2);white-space:nowrap;}.ct-chip b{margin-left:4px;}.ct-chip[data-tone]{background:var(--tone-bg);color:var(--tone);}.ct-chip[data-tone='done']{background:none;box-shadow:inset 0 0 0 1px var(--line2);color:var(--text-2);}`,au=A` ${iu} ${qa} .ct-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.ct-lead{margin:2px 0 8px;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 6px;}.conds{display:grid;grid-template-columns:fit-content(50%) minmax(0,1fr);gap:2px 14px;margin:2px 0 10px;font-size:12px;}.conds dt{color:var(--text-muted);overflow-wrap:anywhere;}.conds dd{margin:0;color:var(--text-2);min-width:0;overflow-wrap:anywhere;}.note{margin-top:6px;}.ct-raw{margin-top:8px;}.ct-raw>summary{cursor:pointer;color:var(--text-muted);font-size:12px;}.ct-err{color:var(--status-failed);white-space:pre-wrap;}.ct-fields{border-collapse:collapse;width:100%;}.ct-fields td{padding:2px 10px 2px 0;border:0;font-size:12px;}.ct-in{display:flex;align-items:center;gap:10px;padding:5px 4px;border-top:1px solid var(--line);}h4{margin:8px 0 6px;font-size:12px;color:var(--text-2);font-weight:600;}.io-card{border:1px solid var(--line);border-radius:10px;padding:10px 14px;margin-bottom:10px;background:var(--raise);}.io-hd{display:flex;align-items:center;gap:10px;margin-bottom:6px;}.io-from{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;margin:-2px 0 8px;}.io-hd .ct-path{flex:1;}.io-card.one .io-hd{margin-bottom:2px;}`;V(`cae-count`,ca),V(`cae-elapsed`,la);var ou=class extends P{constructor(...e){super(...e),this.procs=null}static{this.styles=[U,A` :host{display:block;}.ptree2{font-family:var(--mono);font-size:11.5px;max-height:220px;overflow:auto;}.pt-n{display:flex;gap:10px;align-items:center;padding:3px 6px 3px calc(6px + var(--d) * 18px);border-radius:6px;position:relative;}.pt-n:hover{background:color-mix(in srgb,var(--text) 4%,transparent);}.pt-n::before{content:'';position:absolute;left:calc(var(--d) * 18px - 8px);top:0;bottom:50%;width:8px;border-left:1px solid var(--line2);border-bottom:1px solid var(--line2);}.pt-n.root::before{display:none;}.pt-pid{color:var(--text-muted);min-width:58px;}.pt-cmd{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;color:var(--text-2);}.pt-n.llm .pt-cmd{color:var(--text);}.pt-n.llm .pt-pid{box-shadow:inset 2px 0 0 color-mix(in srgb,var(--agent) 70%,transparent);padding-left:6px;}.pt-age{color:var(--text-muted);}`]}render(){let e=this.procs?.tree[0];return e?j`<div class="ptree2">${this.node(e,0)}</div>`:j`<div class="meta">${O(`No running processes`)}</div>`}node(e,t){let n=e.full_cmd||e.cmd||``,r=(e.cmd||n).split(` `).slice(0,3).join(` `);return j`<div class="pt-n ${/\b(claude|omp)\b/.test(n)?`llm`:``} ${t?``:`root`}" style="--d:${t}" title=${n}>
|
|
343
343
|
<span class="pt-pid">${e.pid}</span>
|
|
344
|
-
<span class="pt-cmd">${e.key?
|
|
344
|
+
<span class="pt-cmd">${e.key?j`<b>${X(e)}</b> `:N}${r.length>70?`${r.slice(0,70)}…`:r}</span>
|
|
345
345
|
<cae-elapsed class="pt-age" .since=${Fr.at(`p:${e.pid}`,e.age_s)}></cae-elapsed>
|
|
346
346
|
</div>
|
|
347
|
-
${(e.children??[]).map(e=>this.node(e,t+1))}`}};function
|
|
348
|
-
${
|
|
349
|
-
</div>`}render(){if(!
|
|
350
|
-
${
|
|
351
|
-
<span class="num">${
|
|
347
|
+
${(e.children??[]).map(e=>this.node(e,t+1))}`}};function su(e){let t=e.filter(d),n=t.filter(T),r=t.filter(e=>!T(e)),i=e=>e.reduce((e,t)=>e+(t.wall_s||0),0),a=e=>[...new Set(e.map(e=>e.key))],o=e=>a(e).length,s=p(e),c=t.filter(Ol),l=t.filter(e=>(e.hops||[]).length>1);return{attempts:t.length,python:n.length,launches:r.length,bad:t.filter(e=>!e.ok).length,launchWall:i(r),pythonWall:i(n),retries:s.length,retriedTasks:o(s),retriedKeys:a(s),fixupKeys:a(c),fixups:c.reduce((e,t)=>e+Dl(t),0),fixupTasks:o(c),switches:l.reduce((e,t)=>e+(t.hops||[]).length-1,0),switchTasks:o(l),switchKeys:a(l)}}function cu(e){return e.startsWith(`task:`)?{key:e.slice(5)}:{stop:e.replace(/^history:/,``)}}function lu(e){let t=!1,n=!1,r=!1;for(let i of e){if(i.outcome!==`not_started`)continue;let e=i.attempts[i.attempts.length-1],a=e?.stop===`invalid_input`?Ie(e.reason):[];a.some(e=>e.problem===`missing`)&&(t=!0),a.some(e=>e.problem===`checks`)&&(n=!0),(a.some(e=>e.problem===`failed`)||!a.length&&i.cause)&&(r=!0)}return as(r?O(`Earlier task failed`):``,t?O(`Input missing`):``,n?O(`Input failed checks`):``)}G([I({attribute:!1})],ou.prototype,`procs`,void 0),ou=G([F(`ca-proc-tree`),k()],ou),V(`cae-stat-tiles`,_a),V(`cae-count`,ca);var uu=(e,t)=>({id:`history:${e}`,label:t});function du(e,t){let n=t.length===1?t[0]:void 0;if(!n)return;let r=e.find(e=>e.key===n);return{key:n,name:r?X(r):n}}function fu(e,t,n,r){let i=du(e,t);return i?{id:`task:${i.key}`,label:i.name}:uu(n,r)}function pu(e,t,n,r){if(!t)return[];let i=du(e,n);return i?[[i.name]]:n.length===t?[]:[[r(n.length)]]}function mu(e,t,n={}){let r=su(e),{outcomes:i,counts:a}=t,o=[{text:Q(`done`,a.doneTotal),tone:`neutral`},{text:a.skipped?Q(`skipped`,a.skipped):``,tone:`neutral`},{text:a.failed?Q(`failed`,a.failed):``,tone:ms(a.failed,`failed`)},{text:a.not_started?Q(`not_started`,a.not_started):``,tone:ms(a.not_started,`attention`)},{text:a.partial?Q(`partial`,a.partial):``,tone:ms(a.partial,`attention`)},{text:a.cancelled?Q(`cancelled`,a.cancelled):``,tone:`neutral`}];return[{id:`tasks`,label:O(`Tasks`,{id:`tasks`}),value:a.total,sub:[o]},{id:`attempts`,label:O(`Attempts`),value:r.attempts,sub:[as(r.launches===1?O(`1 agent session`):O(D`${r.launches} agent sessions`),r.python===1?O(`1 Python task attempt`):O(D`${r.python} Python task attempts`))],tip:O(`Attempts that ran, retries included (journal.jsonl)`)},...hu(e,n.highestCost??!0),{id:`bad`,tone:ms(r.bad,`failed`),label:O(`Failed attempts`),value:r.bad,sub:[],...r.bad?{action:uu(`bad`,O(`Failed attempts in history`))}:{}},{id:`notstarted`,tone:ms(a.not_started,`attention`),label:O(`Not started`),value:a.not_started,sub:a.not_started?[lu(i.values())]:[],...a.not_started?{action:uu(`invalid_input`,O(`Tasks not started in history`))}:{}},{id:`wall`,label:O(`Agent session time`),value:H(r.launchWall),sub:[[O(D`Python tasks: ${H(r.pythonWall)}`)]],tip:O(`Summed over agent sessions, including sessions that ran at once`)},{id:`retry`,label:O(`Retries`),value:r.retries,sub:pu(e,r.retries,r.retriedKeys,e=>O(D`${e} tasks retried`)),tip:Ts(),...r.retries?{action:fu(e,r.retriedKeys,`retried`,O(`Retried tasks in history`))}:{}},{id:`ct`,label:O(`Corrections`),value:r.fixups,sub:pu(e,r.fixups,r.fixupKeys,e=>O(D`${e} tasks with corrections`)),tip:oc(),...r.fixups?{action:fu(e,r.fixupKeys,`fixup`,O(`Attempts with corrections in history`))}:{}},{id:`fo`,label:O(`Model switches`),value:r.switches,sub:pu(e,r.switches,r.switchKeys,e=>O(D`${e} tasks with model switches`)),tip:tc()}]}function hu(e,t){let n=we(e);if(!n)return[];let r=Ee(e)[0];return[{id:`cost`,label:O(`Cost`),value:cs(n.cost),sub:t&&r&&r.share!==null?[[O(D`Highest cost: ${r.kind}`)],as(cs(r.spend.cost),O(D`${Math.round(100*r.share)}% of the total`))]:[[]],tip:O(`Reported by the coding agent`)},{id:`tokens`,label:O(`Tokens`),value:Z(Se(n)),sub:[as(O(D`${Z(n.input)} input`),O(D`${Z(n.output)} output`),O(D`${Z(n.cache_read+n.cache_creation)} cache`))],tip:J(O(D`${Z(n.cache_read)} cache read`),O(D`${Z(n.cache_creation)} cache write`),n.calls===1?O(`1 API call`):O(D`${n.calls} API calls`))}]}var gu=class extends P{constructor(...e){super(...e),this.journal=[],this.plan={nodes:[],groups:[]},this.noHighestCost=!1,this.onAction=e=>{e.stopPropagation();let t=cu(e.detail.action);`key`in t?$(this,`ca-open-task`,{key:t.key}):$(this,`ca-navigate`,{tab:`journal`,stop:t.stop})}}static{this.styles=A` :host{display:block;}`}render(){return j`<cae-stat-tiles exportparts="tiles, tile, label, value, sub, action" .tiles=${mu(this.journal,S(this.journal,this.plan),{highestCost:!this.noHighestCost})} @cae-action=${this.onAction}></cae-stat-tiles>`}};G([I({attribute:!1})],gu.prototype,`journal`,void 0),G([I({attribute:!1})],gu.prototype,`plan`,void 0),G([I({type:Boolean,attribute:`no-highest-cost`})],gu.prototype,`noHighestCost`,void 0),gu=G([F(`ca-kpis`),k()],gu);var _u=[`input`,`cache_read`,`cache_creation`,`output`],vu=class extends P{constructor(...e){super(...e),this.journal=[],this.top=5}static{this.styles=[U,ai,A` :host{display:block;}.kinds{display:grid;grid-template-columns:minmax(70px,max-content) minmax(0,420px) max-content max-content;justify-content:start;gap:8px 14px;align-items:center;}.kind{font-family:var(--mono);font-size:12px;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.bar{display:flex;height:12px;border-radius:4px;overflow:hidden;background:var(--track);}.bar i{display:block;height:100%;}.num{font-variant-numeric:tabular-nums;text-align:right;font-size:12px;white-space:nowrap;}.share{color:var(--text-muted);min-width:3.5em;}.seg-input{background:var(--tok-input);}.seg-cache_read{background:var(--tok-cache-read);}.seg-cache_creation{background:var(--tok-cache-write);}.seg-output{background:var(--tok-output);}.legend{margin-top:10px;}h4{margin:16px 0 6px;font-size:12px;color:var(--text-2);font-weight:600;}.top{display:grid;grid-template-columns:minmax(0,max-content) 64px 64px max-content;column-gap:20px;row-gap:4px;align-items:baseline;}.top a{font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}`]}partLabel(e){switch(e){case`input`:return O(`input`);case`cache_read`:return O(`cache read`);case`cache_creation`:return O(`cache write`);case`output`:return O(`output`)}}bar(e,t){let n=Se(e),r=t?100*n/t:0;return j`<div class="bar" title=${J(..._u.map(t=>`${this.partLabel(t)} ${Z(e[t])}`))} style="width:${Math.max(r,.5).toFixed(2)}%">
|
|
348
|
+
${_u.map(t=>e[t]&&n?j`<i class="seg-${t}" style="width:${(100*e[t]/n).toFixed(2)}%"></i>`:N)}
|
|
349
|
+
</div>`}render(){if(!we(this.journal))return j`<div class="meta">${O(`No tokens reported`)}</div>`;let e=Ee(this.journal),t=Math.max(1,...e.map(e=>Se(e.spend))),n=(r=this.journal,Te(r,e=>e.key)).slice(0,this.top);var r;return j`<div class="kinds">
|
|
350
|
+
${W(e,e=>e.id,e=>j`<span class="kind" title=${e.id}>${e.id}</span>${this.bar(e.spend,t)}
|
|
351
|
+
<span class="num">${J(Z(Se(e.spend)),cs(e.spend.cost))}</span>
|
|
352
352
|
<span class="num share">${e.share===null?``:`${Math.round(100*e.share)}%`}</span>`)}
|
|
353
353
|
</div>
|
|
354
|
-
${ii(
|
|
355
|
-
<h4>${
|
|
354
|
+
${ii(_u.map(e=>({label:this.partLabel(e),cls:`seg-${e}`})))}
|
|
355
|
+
<h4>${O(`Most expensive tasks`)}</h4>
|
|
356
356
|
<div class="top">
|
|
357
|
-
${n.map(e=>
|
|
358
|
-
<span class="num">${
|
|
359
|
-
<span class="num">${
|
|
360
|
-
<span class="num share">${e.share===null?``:
|
|
361
|
-
</div>`}};
|
|
362
|
-
<cae-segmented label=${
|
|
363
|
-
</div>`:
|
|
364
|
-
${function(e,t={}){let n=e.filter(e=>e.value>0),r=oi(n.map(e=>e.value)),i=n.reduce((e,t)=>e+t.value,0),a=t.labelAt??.15,o=(e,t)=>[e.label,si(r[t],e.value),e.text].filter(Boolean).join(` | `);return
|
|
365
|
-
<div class="share-bar" role="list" aria-label=${t.label||
|
|
366
|
-
${n.map((e,t)=>
|
|
357
|
+
${n.map(e=>j`<a class="lnk" href="#" title=${e.id} @click=${t=>{t.preventDefault(),$(this,`ca-open-task`,{key:e.id})}}>${X(e)}</a>
|
|
358
|
+
<span class="num">${Z(Se(e.spend))}</span>
|
|
359
|
+
<span class="num">${cs(e.spend.cost)}</span>
|
|
360
|
+
<span class="num share">${e.share===null?``:O(D`${Math.round(100*e.share)}%`)}</span>`)}
|
|
361
|
+
</div>`}};G([I({attribute:!1})],vu.prototype,`journal`,void 0),G([I({type:Number})],vu.prototype,`top`,void 0),vu=G([F(`ca-spend-breakdown`),k()],vu);var yu=6,bu=`var(--meter)`,xu=e=>`${e.agent}/${e.model}`;function Su(e){let t=e.length>6?5:6;return new Map(e.map((e,n)=>[xu(e),n<t?`var(--series-${n+1})`:bu]))}function Cu(e,t){let n=Su(e),r=[],i=0;for(let a of e){let e=Oe(a,t)??0,o=n.get(xu(a));o===`var(--meter)`?i+=e:r.push({id:xu(a),label:a.model,value:e,color:o,text:jc(a,t)})}return e.length>6&&r.push({id:`other`,label:O(`Other models`),value:i,color:bu}),r}function wu(e,t){let n=Su(e),r=e.map(e=>Oe(e,t)??0),i=oi(r),a=r.some(e=>e>0);return e.map((e,t)=>({id:xu(e),usage:e,colour:n.get(xu(e)),share:a?si(i[t],r[t]):`—`}))}var Tu=[`cost`,`tokens`,`time`,`sessions`],Eu=class extends P{constructor(...e){super(...e),this.models=[],this.measure=``}static{this.styles=[U,ci,A` :host{display:block;}.head{display:flex;justify-content:flex-end;margin-bottom:10px;overflow-x:auto;}.head cae-segmented{flex:none;}.wrap{overflow-x:auto;margin-top:14px;border-radius:6px;}.wrap:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}table{border-collapse:collapse;font-size:12px;font-variant-numeric:tabular-nums;}th{font-weight:500;color:var(--text-muted);text-align:right;padding:0 0 6px 28px;white-space:nowrap;border-bottom:1px solid var(--line);}th:first-child{text-align:left;padding-left:0;}th.on{color:var(--text);font-weight:600;}td{padding:7px 0 7px 28px;text-align:right;white-space:nowrap;color:var(--text-2);vertical-align:top;}tr + tr td{border-top:1px solid var(--line);}td:first-child{text-align:left;padding-left:0;}td.on{color:var(--text);}td.share{color:var(--text);font-weight:600;}.model{display:grid;grid-template-columns:10px max-content;column-gap:8px;align-items:baseline;}.model i{width:10px;height:10px;border-radius:3px;align-self:center;}.model b{font-family:var(--mono);font-weight:500;color:var(--text);}.model small{grid-column:2;font-size:11px;color:var(--text-muted);}`]}chosen(){let e=ke(this.models);return this.measure&&e.includes(this.measure)?this.measure:e[0]??`sessions`}render(){if(!this.models.length)return j`<div class="meta">${O(`No agent sessions`)}</div>`;let e=this.chosen(),t=ke(this.models),n=wu(this.models,e),r=this.models.some(e=>e.peak_context!=null);return j`${t.length>1?j`<div class="head">
|
|
362
|
+
<cae-segmented label=${O(`Measure`)} .value=${e} .options=${t.map(e=>({value:e,label:kc(e),title:Ac(e)}))} @cae-change=${e=>this.measure=e.detail.value}></cae-segmented>
|
|
363
|
+
</div>`:N}
|
|
364
|
+
${function(e,t={}){let n=e.filter(e=>e.value>0),r=oi(n.map(e=>e.value)),i=n.reduce((e,t)=>e+t.value,0),a=t.labelAt??.15,o=(e,t)=>[e.label,si(r[t],e.value),e.text].filter(Boolean).join(` | `);return j`<div class="share" part="share">
|
|
365
|
+
<div class="share-bar" role="list" aria-label=${t.label||N}>
|
|
366
|
+
${n.map((e,t)=>j`<span class="share-seg" role="listitem" tabindex="0" aria-label=${o(e,t)} data-id=${e.id} data-edge=${t===0?`start`:t===n.length-1?`end`:N} style=${ri({flexGrow:String(e.value/i),background:e.color})} ><span class="share-tip" aria-hidden="true">${o(e,t)}</span></span>`)}
|
|
367
367
|
</div>
|
|
368
|
-
${!1===t.names?j
|
|
369
|
-
${n.map((e,t)=>
|
|
368
|
+
${!1===t.names?N:j`<div class="share-names" aria-hidden="true">
|
|
369
|
+
${n.map((e,t)=>j`<span style=${ri({flexGrow:String(e.value/i)})} >${e.value/i>=a?j`<b>${e.label}</b> ${si(r[t],e.value)}`:N}</span>`)}
|
|
370
370
|
</div>`}
|
|
371
|
-
</div>`}(
|
|
372
|
-
<div class="wrap" data-scroll="x" tabindex="0" role="region" aria-label=${
|
|
371
|
+
</div>`}(Cu(this.models,e),{label:kc(e),names:!1})}
|
|
372
|
+
<div class="wrap" data-scroll="x" tabindex="0" role="region" aria-label=${O(`Models`)}>
|
|
373
373
|
<table>
|
|
374
374
|
<thead>
|
|
375
375
|
<tr>
|
|
376
|
-
<th scope="col">${
|
|
377
|
-
<th scope="col" class="on" title=${
|
|
378
|
-
${
|
|
379
|
-
<th scope="col">${
|
|
380
|
-
${r?
|
|
376
|
+
<th scope="col">${O(`Model`)}</th>
|
|
377
|
+
<th scope="col" class="on" title=${kc(e)}>${O(`Share`)}</th>
|
|
378
|
+
${Tu.map(t=>j`<th scope="col" class=${t===e?`on`:N} title=${Ac(t)}>${kc(t)}</th>`)}
|
|
379
|
+
<th scope="col">${O(`API calls`)}</th>
|
|
380
|
+
${r?j`<th scope="col" title=${Qc()}>${Zc()}</th>`:N}
|
|
381
381
|
</tr>
|
|
382
382
|
</thead>
|
|
383
383
|
<tbody>
|
|
384
|
-
${
|
|
384
|
+
${W(n,e=>e.id,t=>j`<tr>
|
|
385
385
|
<td>
|
|
386
386
|
<span class="model"><i style=${ri({background:t.colour})}></i><b>${t.usage.model}</b><small>${t.usage.agent}</small></span>
|
|
387
387
|
</td>
|
|
388
388
|
<td class="share">${t.share}</td>
|
|
389
|
-
${
|
|
389
|
+
${Tu.map(n=>j`<td class=${n===e?`on`:N}>${jc(t.usage,n)}</td>`)}
|
|
390
390
|
<td>${t.usage.calls??0}</td>
|
|
391
|
-
${r?
|
|
391
|
+
${r?j`<td>${t.usage.peak_context==null?`—`:Z(t.usage.peak_context)}</td>`:N}
|
|
392
392
|
</tr>`)}
|
|
393
393
|
</tbody>
|
|
394
394
|
</table>
|
|
395
|
-
</div>`}};
|
|
396
|
-
<span class="bar ${u}" title=${d?`${
|
|
395
|
+
</div>`}};G([I({attribute:!1})],Eu.prototype,`models`,void 0),G([L()],Eu.prototype,`measure`,void 0),Eu=G([F(`ca-model-usage`),k()],Eu);var Du=class extends P{static{this.styles=[U,A` :host{display:block;container-type:inline-size;}.rows{display:grid;grid-template-columns:max-content minmax(70px,420px) max-content max-content;justify-content:start;gap:10px 14px;align-items:center;}.name{font-size:12px;color:var(--text-2);white-space:nowrap;}.bar{position:relative;height:12px;border-radius:4px;background:var(--track);overflow:hidden;}.bar i{position:absolute;top:0;bottom:0;}.bar .before{left:0;background:var(--meter);opacity:0.45;}.bar .during{background:var(--meter);}.bar.hot .during,.bar.full .during,.bar.hot .before,.bar.full .before{background:var(--status-attention);}.bar .cap{width:2px;margin-left:-1px;background:var(--text);opacity:0.7;}.val.hot b,.val.full b{color:var(--status-attention);}.val{font-family:var(--mono);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap;}.val b{color:var(--text);}.val .lim{color:var(--text-muted);}.reset{font-size:11.5px;color:var(--text-muted);white-space:nowrap;}@container (max-width:460px){.rows{grid-template-columns:max-content minmax(70px,1fr) max-content;row-gap:2px;}.reset{grid-column:2 / -1;margin-bottom:6px;}}.status{margin-top:8px;}.acct{padding:10px 0;border-top:1px solid var(--line);}.acct:first-child{border-top:0;padding-top:0;}.acct-h{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;margin-bottom:8px;font-size:12px;}.acct-h i{font-style:normal;color:var(--text-muted);font-size:11px;}.acct-h b{font-family:var(--mono);color:var(--text);font-weight:600;}.rests{margin:8px 0 0;padding:0;list-style:none;font-size:11.5px;color:var(--text-2);}.rests li{padding:2px 0;}.rule{margin-bottom:10px;font-size:12px;color:var(--text-2);}.rule code{font-family:var(--mono);color:var(--text);}`]}constructor(){super(),this.journal=[],this.accounts=null,this.caps=[],this.rests=[],this.rule=``,this.live=!1,new Pr(this)}row(e,t,n,r,i){let a=n[`${e}_pct`],o=r[`${e}_pct`];if(a==null&&o==null)return N;let s=Math.max(0,Math.min(100,a??o??0)),c=Math.max(s,Math.min(100,o??s)),l=r[`${e}_resets_at`],u=c>=100||i!=null&&c>=i?`full`:c>=80?`hot`:``,d=i==null?``:qs(i);return j`<span class="name">${t}</span>
|
|
396
|
+
<span class="bar ${u}" title=${d?`${Is(a)} → ${Is(o)} | ${d}`:`${Is(a)} → ${Is(o)}`}>
|
|
397
397
|
<i class="before" style="width:${s}%"></i>
|
|
398
398
|
<i class="during" style="left:${s}%;width:${c-s}%"></i>
|
|
399
|
-
${i==null?j
|
|
399
|
+
${i==null?N:j`<i class="cap" style="left:${Math.min(100,i)}%" aria-hidden="true"></i>`}
|
|
400
400
|
</span>
|
|
401
|
-
<span class="val ${u}">${
|
|
402
|
-
<span class="reset" title=${l?
|
|
403
|
-
<div class="acct-h"><i>${
|
|
401
|
+
<span class="val ${u}">${Is(a)} → <b>${Is(o)}</b>${d?j` <span class="lim">| ${d}</span>`:N}</span>
|
|
402
|
+
<span class="reset" title=${l?q(l,!0):``}>${function(e,t=Date.now()){let n=Date.parse(e??``);if(Number.isNaN(n))return``;if(n<=t)return O(`reset`);let r=(n-t)/36e5,i=r>=48?O(D`${Math.floor(r/24)}d ${Math.floor(r%24)}h`):H((n-t)/1e3);return O(D`resets in ${i}`)}(l)}</span>`}paused(e){let t=Date.now(),n=e.find(e=>!e.ended&&(e.until?Date.parse(e.until)>t:this.live));return n?Xr({text:n.until?O(D`paused until ${q(n.until,!0)}`):O(`paused`),tone:`attention`,title:Ys(n)}):N}render(){let e=this.accounts??Pe(this.journal);if(!e.length&&!this.rests.length)return N;let t=new Map(this.caps.map(e=>[e.credential,e]));return j`${this.rule?j`<div class="rule" title="quota_rule">${O(`Usage rule`)} <code>${this.rule}</code></div>`:N}${e.map(n=>{let r=Ls(n.last.status,n.last.status_window),i=t.get(n.credential),a=this.rests.filter(e=>!(e.credential!==n.credential||e.account&&n.account&&e.account!==n.account)),o=!!n.account&&e.some(e=>e!==n&&e.credential===n.credential);return j`<div class="acct">
|
|
403
|
+
<div class="acct-h"><i>${O(`Identity`)}</i><b>${Ps(n.credential)||`—`}</b>${o?j`<i title=${O(D`Account: ${n.account??``}`)}>${zs(n.account??``)}</i>`:N}${r?Xr({text:r,tone:`attention`,title:n.last.status,mark:null}):N}${this.paused(a)}${i?j`<i title="max_five_hour_pct, max_seven_day_pct">${ec(i)}</i>`:N}</div>
|
|
404
404
|
<div class="rows">
|
|
405
|
-
${this.row(`seven_day`,
|
|
406
|
-
${this.row(`five_hour`,
|
|
405
|
+
${this.row(`seven_day`,O(`Weekly usage`),n.first,n.last,i?.seven_day_pct)}
|
|
406
|
+
${this.row(`five_hour`,O(`5-hour usage`),n.first,n.last,i?.five_hour_pct)}
|
|
407
407
|
</div>
|
|
408
408
|
${this.restList(a)}
|
|
409
|
-
</div>`})}${this.unread(e,t)}`}restList(e){return e.length?
|
|
410
|
-
<div class="acct-h"><i>${
|
|
409
|
+
</div>`})}${this.unread(e,t)}`}restList(e){return e.length?j`<ul class="rests" title="rests.jsonl">${e.map(e=>j`<li>${function(e){let t=e.ended?O(D`Paused ${q(e.since)} → ${q(e.ended)}`):O(D`Paused since ${q(e.since)}`);return e.stop?J(t,Js(e)):J(t,e.rule?O(D`Usage rule: ${e.rule}`):J(Gs(e.window??``,e.pct),qs(e.cap)))}(e)}</li>`)}</ul>`:N}unread(e,t){let n=new Set(e.map(e=>e.credential));return[...new Set(this.rests.map(e=>e.credential))].filter(e=>!n.has(e)).map(e=>{let n=this.rests.filter(t=>t.credential===e),r=t.get(e);return j`<div class="acct">
|
|
410
|
+
<div class="acct-h"><i>${O(`Identity`)}</i><b>${Ps(e)}</b>${this.paused(n)}${r?j`<i title="max_five_hour_pct, max_seven_day_pct">${ec(r)}</i>`:N}</div>
|
|
411
411
|
${this.restList(n)}
|
|
412
|
-
</div>`})}};
|
|
413
|
-
${this.services.map(t=>{let n=function(e,t){return e.start_error?`failed`:e.stopped_at?`stopped`:t?`running`:`unknown`}(t,this.live),r=t.key?e.get(t.key):void 0;return
|
|
414
|
-
${Zr({text:
|
|
415
|
-
<div><span class="name" title="services.jsonl">${t.name}</span>${t.address?
|
|
416
|
-
<div class="facts">${function(e){return e.start_error?
|
|
417
|
-
${t.key?
|
|
412
|
+
</div>`})}};G([I({attribute:!1})],Du.prototype,`journal`,void 0),G([I({attribute:!1})],Du.prototype,`accounts`,void 0),G([I({attribute:!1})],Du.prototype,`caps`,void 0),G([I({attribute:!1})],Du.prototype,`rests`,void 0),G([I()],Du.prototype,`rule`,void 0),G([I({type:Boolean})],Du.prototype,`live`,void 0),Du=G([F(`ca-quota`),k()],Du);var Ou={running:`running`,stopped:`done`,failed:`failed`,unknown:`muted`},ku=class extends P{constructor(...e){super(...e),this.services=[],this.nodes=[],this.live=!1}static{this.styles=[U,A` :host{display:block;}ul{margin:0;padding:0;list-style:none;display:grid;gap:8px;}li{display:grid;grid-template-columns:max-content 1fr;column-gap:10px;row-gap:2px;align-items:baseline;font-size:12px;}.name{font-family:var(--mono);color:var(--text);overflow-wrap:anywhere;}.addr{font-family:var(--mono);color:var(--text-2);overflow-wrap:anywhere;}.facts{grid-column:2;color:var(--text-2);overflow-wrap:anywhere;}.by{grid-column:2;}`]}render(){if(!this.services.length)return j`<div class="meta">${O(`No services`)}</div>`;let e=new Map(this.nodes.map(e=>[e.key,e]));return j`<ul>
|
|
413
|
+
${this.services.map(t=>{let n=function(e,t){return e.start_error?`failed`:e.stopped_at?`stopped`:t?`running`:`unknown`}(t,this.live),r=t.key?e.get(t.key):void 0;return j`<li>
|
|
414
|
+
${Zr({text:wc(n),tone:Ou[n]})}
|
|
415
|
+
<div><span class="name" title="services.jsonl">${t.name}</span>${t.address?j` <span class="addr">${t.address}</span>`:N}</div>
|
|
416
|
+
<div class="facts">${function(e){return e.start_error?J(q(e.started_at),e.start_error):J(O(D`Started ${q(e.started_at)} in ${H(e.start_s??0)}`),e.stopped_at?O(D`Stopped ${q(e.stopped_at)}`):``,function(e){switch(e){case`run_end`:return O(`The run ended`);case`interrupted`:return O(`The run was stopped by a signal`);default:return``}}(e.stop_cause),e.stop_error?O(`Stop failed`):``,e.stop_error)}(t)}</div>
|
|
417
|
+
${t.key?j`<div class="by">${Vl(this,r?X(r):t.key,r??{key:t.key})}</div>`:N}
|
|
418
418
|
</li>`})}
|
|
419
|
-
</ul>`}};U([P({attribute:!1})],gu.prototype,`services`,void 0),U([P({attribute:!1})],gu.prototype,`nodes`,void 0),U([P({type:Boolean})],gu.prototype,`live`,void 0),gu=U([N(`ca-services`),D()],gu),z(`cae-mark-matrix`,eo),z(`cae-layered-graph`,Ro);var _u=`loop:`,vu=[`given`,`after`,`created`],yu=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])},bu=e=>typeof e==`string`;function xu(e){let t=e.flow_calls;return Array.isArray(t)&&t.length!==0?new Map(t.filter(e=>e&&bu(e.id)&&bu(e.function)).map(e=>[e.id,e])):null}var Su=new WeakMap;function Cu(e){let t=Su.get(e);if(t)return t;let n=e.nodes.map(e=>{let t=function(e){let t=e.flow;if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=e;if(!t||typeof t!=`object`||!bu(t.function))break;let r=(Array.isArray(t.loops)?t.loops:[]).filter(e=>!!e&&typeof e.line==`number`);n.push({function:t.function,file:bu(t.file)?t.file:``,line:typeof t.line==`number`?t.line:0,loops:r.map(e=>e.line),passes:r.map(e=>typeof e.pass==`number`&&e.pass>=1?e.pass:1)})}return n}(e),n=e.created_from;return{n:e,frames:t,path:t.map(e=>e.function),from:Array.isArray(n)?n.filter(bu):[],call:bu(e.flow_call)?e.flow_call:``}}),r=new Map;for(let t of e.nodes)t.unit&&!r.has(t.unit)&&r.set(t.unit,r.size);let i={tasks:n,byKey:new Map(n.map(e=>[e.n.key,e])),calls:xu(e),unitRank:r,labels:new Map(e.groups.map(e=>[e.id,e.label]))};return Su.set(e,i),i}var wu=(e,t)=>t.every((t,n)=>e[n]===t),Tu=e=>e.slice(e.lastIndexOf(`.`)+1)||e,Eu=(e,t)=>t>0?e.frames[t-1]?.loops??[]:[],Du=(e,t)=>t>0?e.frames[t-1]?.passes??[]:[];function Ou(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=(e[n]??0)-(t[n]??0);if(r)return r}return 0}var ku=e=>e.map((t,n)=>`${_u}${e.slice(0,n+1).join(`.`)}`);function Au(e,t){let n=Eu(e,t),r=n.length?`@${n.join(`.`)}`:``;if(e.path.length<=t)return{id:`kind:${e.n.group}${r}`,type:`kind`,name:e.n.group,loops:n};let i=e.path[t];return{id:`flow:${i}${r}`,type:`flow`,name:i,loops:n}}function ju(e,t,n){if(!e.call)return{id:`>${t}`,own:!1};let r=e.call.split(`.`),i=r.map((e,t)=>r.slice(0,t+1).join(`.`)),a=0,o=0;if(n)for(let r=1;r<i.length;r++){let s=n.get(i[r])?.function,c=s===void 0?-1:e.frames.findIndex((e,t)=>t>o&&e.function===s);if(c<0||c>t)break;a=r,o=c}else a=Math.min(t,i.length-1),o=a;let s=i[a];return o===t?{id:s,own:!0}:{id:`${s}>${t}`,own:!1}}var Mu={failed:7,running:6,blocked:5,partial:4,pending:3,cancelled:2,skipped:1,done:0},Nu=e=>e.reduce((e,t)=>Mu[t.state]>Mu[e]?t.state:e,`done`),Pu=e=>e.reduce((e,t)=>Mu[t]>Mu[e]?t:e,`done`);function Fu(e){let t=e.filter(C).length;return t===0?`agent`:t===e.length?`python`:`mixed`}var Iu={running:`running`,returned:`done`,raised:`failed`,closed:`failed`},Lu=e=>e?.state===`raised`||e?.state===`closed`;function Ru(e,t){let n=e.map(e=>e.n);return{key:(n.find(e=>e.state===`running`)??n[n.length-1]??{key:``}).key,unit:t,state:Nu(n),count:n.length,keys:n.map(e=>e.key)}}function zu(e){let t=new Map,n=[];for(let r of e)r.n.unit?yu(t,r.n.unit,r):n.push(Ru([r],``));return{byUnit:new Map([...t].map(([e,t])=>[e,Ru(t,e)])),single:n}}function Bu(e,t,n,r){let i=(e,t)=>{let i=e.map(e=>e.own?r?.get(e.id):void 0),a=e.map((e,t)=>{let n=i[t],r=Nu(e.tasks.map(e=>e.n));return n&&Iu[n.state]?Pu([Iu[n.state],r]):r}),o=e.flatMap(e=>e.tasks),s=o.map(e=>e.n.key),c=e.find((e,t)=>a[t]===`running`)??e[e.length-1],l=i.find(Lu),u={key:c?.id??``,unit:t,state:Pu(a),count:s.length,keys:s,flow:n,counts:Vu(o)},d=c?.own?r?.get(c.id)?.time_box:null,f=d?function(e){let t=Date.parse(e.started_at);return Number.isNaN(t)?``:new Date(t+1e3*e.deadline_s).toISOString()}(d):``,p=f?{...u,deadlineAt:f}:u;return l?{...p,error:l.error??``}:p},a=new Map,o=[],s=function(e,t,n){let r=new Map;for(let i of e){let{id:e,own:a}=ju(i,t,n);(r.get(e)??r.set(e,{id:e,own:a,tasks:[],unit:``}).get(e))?.tasks.push(i)}for(let e of r.values()){let t=new Set(e.tasks.map(e=>e.n.unit||``));e.unit=t.size===1?[...t][0]:``}return[...r.values()]}(e,t,r);for(let e of s)e.unit?yu(a,e.unit,e):o.push(i([e],``));let c=r?s.filter(e=>e.own&&Lu(r.get(e.id))).length:0,l=s.map(e=>e.own?r?.get(e.id)?.time_box:null).find(e=>e)??null;return{byUnit:new Map([...a].map(([e,t])=>[e,i(t,e)])),single:o,calls:s.length,errors:c,timeBox:l}}function Vu(e){let t={total:e.length,done:0,partial:0,failed:0,running:0,pending:0,skipped:0,blocked:0,cancelled:0};for(let n of e)t[n.n.state]+=1;return t}function Hu(e,t){let n=new Map;for(let r of e){let e=r.n.unit||``,i=n.get(e);(!i||Ou(Du(r,t),i)>0)&&n.set(e,Du(r,t))}return e.filter(e=>Ou(Du(e,t),n.get(e.n.unit||``)??[])===0)}function Uu(e,t){let n=new Map;for(let r of e){let e=r.n.unit||``;(n.get(e)??n.set(e,new Set).get(e))?.add(Du(r,t).join(`.`))}return new Map([...n].map(([e,t])=>[e,t.size]))}var Wu=(e,t)=>t&&t>1?{...e,passes:t}:e;function Gu(e,t){let n=Cu(e);return Ku(n,t,n.tasks.filter(e=>wu(e.path,t)))}function Ku(e,t,n){let r=t.length,i=new Map,a=new Map;for(let e of n){let t=Au(e,r);(i.get(t.id)??i.set(t.id,{...t,tasks:[]}).get(t.id))?.tasks.push(e),a.set(e.n.key,t.id)}let o=new Map,s=new Map,c=new Map,l=new Map;for(let t of i.values()){let n=ku(t.loops),i=n[n.length-1]??null;n.forEach((e,t)=>l.set(e,n[t-1]??null)),i&&c.set(t.id,i);let a=i?Hu(t.tasks,r):t.tasks;s.set(t.id,a);let u=t.type===`kind`?zu(a):Bu(a,r,t.name,e.calls);if(i){let e=Uu(t.tasks,r);u.byUnit=new Map([...u.byUnit].map(([t,n])=>[t,Wu(n,e.get(t))]))}o.set(t.id,u)}let u=[...new Set([...o.values()].flatMap(e=>[...e.byUnit.keys()]))].sort((t,n)=>(e.unitRank.get(t)??0)-(e.unitRank.get(n)??0)),d=new Map,f=new Map;for(let e of i.values()){let t=ku(e.loops);for(let n of e.tasks){let e=Du(n,r);t.forEach((t,r)=>{d.set(t,Math.max(d.get(t)??1,e[r]??1));let i=f.get(t)??f.set(t,new Map).get(t),a=n.n.unit||``;(i?.get(a)??i?.set(a,new Set).get(a))?.add(e.slice(0,r+1).join(`.`))})}}let p=new Set,m=new Map,h=new Map,g=n=>{let i=0;for(;i<r&&n.path[i]===t[i];)i++;let a=Au(n,i);return{id:`stub:${i}:${a.id}`,label:a.type===`kind`?e.labels.get(a.name)??a.name:Tu(a.name)}};for(let t of n){let n=a.get(t.n.key),i=(i,o)=>{let s=a.get(i);if(s===n)return void(o!==`created`&&p.add(n));if(s!==void 0){let a=e.byKey.get(i),c=Eu(a,r),l=Eu(t,r),u=0;for(;u<c.length&&c[u]===l[u];)u++;let d=Ou(Du(a,r).slice(0,u),Du(t,r).slice(0,u))===0,f=`${s}\0${n}\0${o}`,p=m.get(f)??m.set(f,{from:s,to:n,type:o,tasks:new Set,samePass:!1}).get(f);p?.tasks.add(t.n.key),p&&d&&(p.samePass=!0);return}let c=e.byKey.get(i);if(!c)return;let l=g(c),u=`${l.id}\0${n}\0${o}`;(h.get(u)??h.set(u,{...l,to:n,type:o,tasks:new Set}).get(u))?.tasks.add(t.n.key)};for(let e of t.n.given_from??[])i(e,`given`);for(let e of t.n.after??[])i(e,`after`);for(let e of t.from)i(e,`created`)}let _=(e,t)=>e<t?-1:+(e>t),v=[...m.values()].filter(e=>!Ju(e.type).some(t=>m.has(`${e.from}\0${e.to}\0${t}`))).sort((e,t)=>_(`${e.from}\0${e.to}\0${e.type}`,`${t.from}\0${t.to}\0${t.type}`)),y=[...h.values()].filter(e=>!Ju(e.type).some(t=>h.has(`${e.id}\0${e.to}\0${t}`))).sort((e,t)=>_(`${e.id}\0${e.to}\0${e.type}`,`${t.id}\0${t.to}\0${t.type}`)),b=[...l.keys()].map(e=>{let i=new Map;for(let[t,n]of f.get(e)??[])t&&i.set(n.size,(i.get(n.size)??0)+1);return{id:e,local:e,layer:[...t],loop:Number(e.slice(5).split(`.`).pop()),file:n[0]?.frames[r-1]?.file??``,parent:l.get(e)??null,passes:d.get(e)??1,spread:[...i].sort((e,t)=>e[0]-t[0]),layers:[]}});return{model:{path:[...t],nodes:[...i.values()].map(n=>{let r=o.get(n.id),i=r.byUnit.size>0;return{id:n.id,type:n.type,name:n.name,label:n.type===`kind`?e.labels.get(n.name)??n.name:Tu(n.name),layer:[...t],kinds:[...new Set(n.tasks.map(e=>e.n.kind))],executor:n.type===`flow`?null:Fu(n.tasks.map(e=>e.n)),box:c.get(n.id)??null,units:i?u.map(e=>r.byUnit.get(e)??null):[],single:r.single,inOrder:p.has(n.id),counts:Vu(s.get(n.id)??[]),calls:r.calls??0,errors:r.errors??0,timeBox:r.timeBox??null}}),boxes:b,fns:[],edges:v.map(e=>({from:e.from,to:e.to,tasks:e.tasks.size,type:e.type,samePass:e.samePass,back:!1})),stubs:y.map(e=>({id:e.id,label:e.label,to:e.to,tasks:e.tasks.size,type:e.type})),units:u},drafts:i,ix:e}}var qu=e=>e===`given`?`solid`:e===`after`?`dotted`:`dashed`,Ju=e=>vu.slice(0,vu.indexOf(e));function Yu(e){return{nodes:e.nodes.map(e=>({id:e.id,cluster:e.box})),clusters:[...e.boxes.map(e=>({id:e.id,parent:e.parent,cycle:!0})),...e.fns.map(e=>({id:e.id,parent:e.parent,cycle:!1}))],edges:e.edges.map(e=>({from:e.from,to:e.to,style:qu(e.type),ranks:e.samePass})),stubs:e.stubs.map(e=>({id:e.id,to:e.to,style:qu(e.type)}))}}function Xu(e,t){let n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map(t.clusters.map(e=>[e.id,e.layers]));return{...t,path:e.path,nodes:t.drawn.map(e=>n.get(e)),boxes:e.boxes.map(e=>({...e,layers:r.get(e.id)??[]})),fns:e.fns,edges:e.edges.map((e,n)=>({...e,back:t.back[n]??!1})),stubs:e.stubs,units:e.units}}var Zu=`fx::`,Qu=(e,t)=>`${e.join(`/`)}/${t}`,$u=e=>e?.state===`raised`||e?.state===`closed`;function ed(e,t,n=!1){let r=t.length,i=new Map,a=new Set;if(e.calls)for(let t of e.calls.values())$u(t)&&a.add(t.id);for(let o of e.tasks){if(!wu(o.path,t))continue;let e=o.n.state,s=!!o.call&&[...a].some(e=>o.call===e||o.call.startsWith(`${e}.`)),c=null;for(let t=r;t<o.path.length;t++){let a=Au(o,t),l=o.path.slice(0,t),u=Qu(l,a.id),d=i.get(u);if(!d){let e={total:0,done:0,partial:0,failed:0,running:0,pending:0,skipped:0,blocked:0,cancelled:0},n=t>0?o.frames[t-1]?.file??``:``;d={key:u,layer:l,id:a.id,name:a.name,depth:t-r,loops:a.loops,file:n,counts:e,tasks:0,agent:0,failed:0,running:0,stuck:0,errors:!1,kids:new Set,fns:new Set,parent:c},i.set(u,d)}d.tasks+=1,d.counts.total+=1,d.counts[e]+=1,C(o.n)||(d.agent+=1),e===`failed`?d.failed+=1:e===`running`?d.running+=1:(e===`blocked`||e===`pending`&&!n)&&(d.stuck+=1),s&&(d.errors=!0);let f=Au(o,t+1);d.kids.add(f.id),f.type===`flow`&&d.fns.add(Qu(o.path.slice(0,t+1),f.id)),c=u}}return i}function td(e,t=new Set){return Math.log2(1+e.tasks)+(e.failed||e.errors?4:0)+(e.running?3:0)+(e.stuck?1.5:0)+(t.has(e.key)?6:0)}var nd=(e,t=new Set)=>e.agent>0||e.failed>0||e.errors||e.running>0||e.stuck>0||t.has(e.key),rd=(e,t)=>td(e,t)-1.5*e.depth;function id(e,t,n){let r=new Set,i=[],a=n.closed??new Set,o=n.open??new Set,s=t,c=new Set([...e.values()].filter(e=>e.parent===null).map(e=>e.key));for(;c.size;){let t=null,l=-1/0;for(let r of c){let i=e.get(r),a=o.has(r)?1/0:rd(i,n.toward);a>l&&(t=i,l=a)}if(!t)break;if(c.delete(t.key),a.has(t.key))continue;let u=t.kids.size-1;if(o.has(t.key)||n.all||!(s+u>n.budget)&&nd(t,n.toward)){r.add(t.key),o.has(t.key)||i.push(t.key),s+=u;for(let e of t.fns)c.add(e)}}return{open:r,auto:i}}function ad(e,t){let n=new Set,r=null;e.startsWith(`fx::`)?r=e.slice(4).split(`#`)[0]??null:e.includes(`::`)&&(r=e.slice(0,e.lastIndexOf(`::`)));for(let e=r;e!==null&&t.has(e);e=t.get(e)?.parent??null)n.add(e);return n}function od(e,t,n){let r=Cu(e),i=t.length,a=r.tasks.filter(e=>wu(e.path,t)),o=ed(r,t,n.live),s=new Set(a.map(e=>Au(e,i).id)).size,c=n.sel?ad(n.sel,o):n.toward,{open:l,auto:u}=id(o,s,{...n,toward:c}),d=sd(r,t,a,o,l),f=e=>lo(co(Yu(e))).span;if(n.maxSpan&&!n.all)for(;u.length&&f(d)>n.maxSpan;)l.delete(u.pop()),d=sd(r,t,a,o,l);return{model:d,open:l,stats:o}}function sd(e,t,n,r,i){let a=t.length,o=new Map,s=new Map([[``,[]]]);for(let e of n){let t=a,n=``;for(s.get(``)?.push(e);t<e.path.length;){let r=Qu(e.path.slice(0,t),Au(e,t).id);if(!i.has(r))break;n=r,yu(s,r,e),t++}o.set(e.n.key,{key:n,depth:t})}let c=new Map,l=new Map;for(let[n,i]of s){let a=r.get(n),o=a?[...a.layer,a.name]:[...t];l.set(n,o),c.set(n,Ku(e,o,i))}let u=(e,t)=>e===``?t:`${e}::${t}`,d=e=>{let t=r.get(e);return(t?c.get(t.parent??``):void 0)?.model.nodes.find(e=>e.id===t?.id)},f=e=>(e=>{let t=r.get(e);if(!t||t.parent===null)return!1;let n=c.get(t.parent);if(!n)return!1;let i=n.model.nodes.filter(e=>e.type===`flow`);return i.length===1&&i[0]?.id===t.id&&!i[0]?.box})(e)?f(r.get(e).parent):`${Zu}${e}`,p=[],m=[],h=new Map,g=new Set;for(let e of[...c.keys()].sort((e,t)=>e===``?-1:t===``?1:(r.get(e)?.depth??0)-(r.get(t)?.depth??0))){let t=c.get(e),n=l.get(e),a=e===``?null:f(e);if(e!==``){let t=d(e),n=r.get(e),i=t?{...t,id:u(n.parent??``,t.id)}:void 0,o={id:`${Zu}${e}`,key:e,node:i};if(a===`fx::${e}`){let e=t?.box?u(n.parent??``,t.box):n.parent===null?null:f(n.parent);h.set(a,{id:a,parent:e,parts:[o]})}else h.get(a)?.parts.push(o)}for(let r of t.model.boxes)m.push({...r,id:u(e,r.id),parent:r.parent?u(e,r.parent):a,layer:n});for(let r of t.model.nodes)r.type===`flow`&&i.has(Qu(n,r.id))||p.push({...r,id:u(e,r.id),box:r.box?u(e,r.box):a,layer:n});for(let e of t.model.units)g.add(e)}let _=[...g].sort((t,n)=>(e.unitRank.get(t)??0)-(e.unitRank.get(n)??0)),v=new Map([...c].map(([e,t])=>[e,t.model.units]));for(let e of p){let t=e.id.includes(`::`)?e.id.slice(0,e.id.lastIndexOf(`::`)):``,n=v.get(t)??[];if(!e.units.length)continue;let r=new Map(n.map((t,n)=>[t,e.units[n]??null]));e.units=_.map(e=>r.get(e)??null)}let y=e=>{let t=o.get(e.n.key);return u(t.key,Au(e,t.depth).id)},b=e=>e.path.slice(0,o.get(e.n.key).depth),x=new Set,S=new Map,ee=new Map;for(let r of n){let n=y(r),i=(i,o)=>{let s=e.byKey.get(i);if(!s)return;if(wu(s.path,t)){let e=y(s);if(e===n)return void(o!==`created`&&x.add(n));let t=b(s),i=b(r),a=0;for(;a<t.length&&a<i.length&&t[a]===i[a];)a++;let c=Eu(s,a),l=Eu(r,a),u=0;for(;u<c.length&&c[u]===l[u];)u++;let d=Ou(Du(s,a).slice(0,u),Du(r,a).slice(0,u))===0,f=`${e}\0${n}\0${o}`,p=S.get(f)??S.set(f,{from:e,to:n,type:o,tasks:new Set,samePass:!1}).get(f);p?.tasks.add(r.n.key),p&&d&&(p.samePass=!0);return}let c=0;for(;c<a&&s.path[c]===t[c];)c++;let l=Au(s,c),u={id:`stub:${c}:${l.id}`,label:l.type===`kind`?e.labels.get(l.name)??l.name:Tu(l.name)},d=`${u.id}\0${n}\0${o}`;(ee.get(d)??ee.set(d,{...u,to:n,type:o,tasks:new Set}).get(d))?.tasks.add(r.n.key)};for(let e of r.n.given_from??[])i(e,`given`);for(let e of r.n.after??[])i(e,`after`);for(let e of r.from)i(e,`created`)}for(let e of p)e.inOrder=x.has(e.id);let te=[...S.values()].filter(e=>!Ju(e.type).some(t=>S.has(`${e.from}\0${e.to}\0${t}`))).map(e=>({from:e.from,to:e.to,tasks:e.tasks.size,type:e.type,samePass:e.samePass,back:!1})),ne=[...ee.values()].filter(e=>!Ju(e.type).some(t=>ee.has(`${e.id}\0${e.to}\0${t}`))).map(e=>({id:e.id,label:e.label,to:e.to,tasks:e.tasks.size,type:e.type}));return{path:[...t],nodes:p,boxes:m,fns:[...h.values()],edges:te,stubs:ne,units:_}}function cd(e){let t=new Map,n=new Map;for(let r of e){let e=ld(r);t.set(r.key,e);for(let t of e)(n.get(t.key)??n.set(t.key,[]).get(t.key))?.push({key:r.key,type:t.type})}return{byKey:new Map(e.map(e=>[e.key,e])),earlier:t,later:n}}function ld(e){let t=new Map;for(let n of e.given_from??[])t.set(n,`given`);for(let n of e.after??[])t.has(n)||t.set(n,`after`);for(let n of e.created_from??[])t.has(n)||t.set(n,`created`);return[...t].map(([e,t])=>({key:e,type:t}))}var ud=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]);function dd(e,t){let n=new Map;for(let r of e?.entries??[]){if(!r.remaining)continue;let e=t.nodes.find(e=>e.type===`kind`?e.name===r.group&&ud(e.layer,r.flow):r.flow.length>e.layer.length&&ud(e.layer,r.flow.slice(0,e.layer.length))&&r.flow[e.layer.length]===e.name);e&&n.set(e.id,(n.get(e.id)??0)+r.remaining)}return n}function fd(e,t){let n=new Set(t.nodes.map(e=>`${e.group}\0${(e.flow??[]).map(e=>e.function).join(`\0`)}`)),r=new Map;for(let t of e?.entries??[])t.remaining&&!n.has(`${t.group}\0${t.flow.join(`\0`)}`)&&r.set(t.group,(r.get(t.group)??0)+t.remaining);return[...r].map(([e,t])=>({group:e,remaining:t}))}var pd=e=>!!e?.earlier_run&&e.remaining>0;function md(e,t,n,r,i=Gu(e,t)){let{drafts:a,ix:o}=i,s=Xu(i.model,co(Yu(i.model),r,!1)),c=s.boxes.find(e=>e.id===n);if(!c)return null;let l=t.length,u=c.id.slice(5).split(`.`).length-1,d=new Map(s.boxes.map(e=>[e.id,e])),f=new Map(s.nodes.map(e=>[e.id,e])),p=e=>Du(e,l).slice(u),m=e=>e.layers.flat().flatMap(e=>d.has(e)?m(d.get(e)):[e]),h=e=>m(e).flatMap(e=>a.get(e)?.tasks??[]),g=(e,t)=>e.length===t.length&&Ou(e,t)===0,_=(e,t)=>{let n=t.length;return[...new Set(h(e).map(p).filter(e=>e.length>n&&Ou(e.slice(0,n),t)===0).map(e=>e[n]))].sort((e,t)=>e-t).flatMap(n=>{let r=[...t,n],i=e.layers.flat().flatMap(e=>{let t=d.get(e);if(t){let e=_(t,r);return e.length?[{type:`loop`,box:t,kids:e}]:[]}let n=f.get(e);return n&&a.get(e)?.tasks.some(e=>g(p(e),r))?[{type:`node`,node:n,passes:r}]:[]});return i.length?[{type:`pass`,box:e,pass:n,kids:i}]:[]})},v=_(c,[]),y=[],b=e=>e.type===`node`?1:e.kids.reduce((e,t)=>e+b(t),0),x=e=>e.type===`node`?1:1+Math.max(0,...e.kids.map(x)),S=Math.max(1,...v.map(x)),ee=Array.from({length:S},()=>[]),te=(e,t)=>{let n=ee[t];if(e.type===`node`)return n.push({type:`node`,node:e.node,passes:e.passes,span:1,rows:S-t}),void y.push({node:e.node,passes:e.passes});n.push(e.type===`pass`?{type:`pass`,box:e.box,pass:e.pass,span:b(e),rows:1}:{type:`loop`,box:e.box,span:b(e),rows:1});for(let n of e.kids)te(n,t+1)};for(let e of v)te(e,0);let ne=h(c),re=new Set(ne.map(e=>e.n.unit||``)),ie=[...s.units.filter(e=>re.has(e)),...re.has(``)?[``]:[]],ae=new Map;return y.forEach((e,t)=>{for(let n of a.get(e.node.id)?.tasks??[])g(p(n),e.passes)&&yu(ae,`${t}\0${n.n.unit||``}`,n)}),{box:c,columns:y,head:ee,rows:ie.map(e=>{let t=y.map((t,n)=>{let r=ae.get(`${n}\0${e}`);return r?.length?((e,t,n)=>{let r=a.get(e.node.id);if(r.type===`kind`)return Ru(t,n);let i=Bu(t,l,r.name,o.calls);return n?i.byUnit.get(n)??i.single[0]??null:i.single[0]??null})(t,r,e):null});return{unit:e,passes:new Set(ne.filter(t=>(t.n.unit||``)===e).map(e=>Du(e,l).slice(0,u+1).join(`.`))).size,state:Pu(t.filter(e=>e!==null).map(e=>e.state)),cells:t}})}}function hd(e,t){let n=new Map(e.map((e,t)=>[e,t])),r=e=>t===`passes`?-e.passes:t===`state`?-Mu[e.state]:0;return[...e].sort((e,t)=>r(e)-r(t)||(n.get(e)??0)-(n.get(t)??0))}var gd=(e,t,n=[])=>`${e}${n.length?`|${n.join(`.`)}`:``}#${t.unit||t.key}`;function _d(e,t,n){if(!n)return null;let r=n.indexOf(`#`);if(r<0){let t=e.nodes.find(e=>e.id===n);if(t)return{type:`node`,id:n,node:t};let r=e.boxes.find(e=>e.id===n);if(r)return{type:`box`,id:n,box:r};let i=e.fns.flatMap(e=>e.parts).find(e=>e.id===n);return i?{type:`node`,id:n,node:i.node}:null}let[i=``,a]=n.slice(0,r).split(`|`),o=n.slice(r+1),s=e=>!!e&&(e.unit?e.unit===o:e.key===o);if(a!==void 0){if(!t)return null;let e=t.columns.findIndex(e=>e.node.id===i&&e.passes.join(`.`)===a),r=t.columns[e],o=t.rows.map(t=>t.cells[e]).find(s);return r&&o?{type:`mark`,id:n,node:r.node,mark:o,passes:r.passes}:null}let c=e.nodes.find(e=>e.id===i),l=c?[...c.units,...c.single].find(s):void 0;return c&&l?{type:`mark`,id:n,node:c,mark:l,passes:[]}:null}var vd=[`done`,`partial`,`running`,`pending`,`failed`,`blocked`,`skipped`,`cancelled`],yd={done:{tone:`done`,shape:`round`},partial:{tone:`attention`,shape:`half`},running:{tone:`running`,shape:`round`},pending:{tone:`neutral`,shape:`ring`},failed:{tone:`failed`,shape:`square`},blocked:{tone:`attention`,shape:`hatched`},skipped:{tone:`muted`,shape:`round`},cancelled:{tone:`muted`,shape:`ring`}};function bd(e){return Object.fromEntries(vd.map(t=>[t,{...yd[t],label:xd(t,e),rank:Mu[t],count:n=>Sd(t,n,e)}]))}function xd(e,t){return is(h(e),t)}function Sd(e,t,n){let r=h(e);return Z(r!==`waiting`||n?r:`not_run`,t)}function Cd(e){return E(T`${e.done} of ${e.total} tasks done`)}function wd(e,t){return[`failed`,`blocked`,`partial`,`running`,`pending`,`cancelled`,`skipped`].filter(t=>e[t]).map(n=>Sd(n,e[n],t))}function Td(e,t){let n=e.counts,r=[];return n.failed&&r.push([`err`,Sd(`failed`,n.failed,t)]),e.errors&&r.push([`err`,e.errors===1?E(`1 flow call stopped with an error`):E(T`${e.errors} flow calls stopped with an error`)]),n.blocked&&r.push([`warn`,Sd(`blocked`,n.blocked,t)]),n.partial&&r.push([`warn`,Sd(`partial`,n.partial,t)]),n.running&&r.push([`live`,Sd(`running`,n.running,t)]),n.pending&&r.push([`mut`,Sd(`pending`,n.pending,t)]),n.skipped&&r.push([`mut`,Sd(`skipped`,n.skipped,t)]),r}function Ed(e,t){let n=t?t.slice(t.lastIndexOf(`/`)+1):``;return n?`${n}:${e}`:E(T`line ${e}`)}function Dd(e){return e.executor===`agent`?E(`Agent task`):e.executor===`python`?E(`Python task`):e.executor===`mixed`?K(E(`Agent task`),E(`Python task`)):``}function Od(e){return e.type===`flow`?K(E(T`Function ${e.name}`),e.timeBox?E(T`Deadline ${B(e.timeBox.deadline_s)}`):``,Cd(e.counts)):K(e.label,Dd(e),Cd(e.counts))}function kd(e,t){let n=e=>{let n=t.nodes.find(t=>t.id===e);return n?n.box?E(T`${n.label} in the loop`):n.label:e},r=r=>[...t.stubs.filter(t=>t.to===e.id&&t.type===r).map(e=>e.label),...t.edges.filter(t=>t.to===e.id&&t.type===r).map(e=>n(e.from))];return{given:r(`given`),order:r(`after`),created:r(`created`),feeds:[...new Set(t.edges.filter(t=>t.from===e.id).map(e=>n(e.to)))]}}function Ad(e,t,n){let r=e.counts,{given:i,order:a,created:o,feeds:s}=kd(e,t);return[e.type===`flow`?K(E(T`Function ${e.label}`),Cd(r)):K(e.label,Dd(e),Cd(r)),...Td(e,n).map(([,e])=>e),i.length?E(T`Given output of: ${q(i)}`):``,a.length?E(T`Runs after: ${q(a)}`):``,o.length?E(T`Created after: ${q(o)}`):``,s.length?E(T`Later tasks: ${q(s)}`):``].filter(Boolean).join(`. `)}function jd(e,t,n,r=``){let i=t.flow?void 0:n.task,a=J({kind:t.count===1&&i?i.kind:e,unit:t.unit}),o=t.flow||t.state!==`blocked`?``:n.causeOf(t.key),s=o?E(T`Not started: ${o}`):xd(t.state,n.live),c=i?.attempts??1,l=c>1?E(T`${c} attempts`):``;return{name:a,parts:[s,r,t.passes?Ss(t.passes):``,l,t.flow||t.count>1?E(T`${t.count} tasks`):``,...t.counts?wd(t.counts,n.live):[],...t.error===void 0?[]:[E(`Flow call stopped with an error`),t.error],t.flow||t.state!==`done`&&t.state!==`partial`&&t.state!==`failed`||!i?.wall_s?``:B(i.wall_s)].filter(Boolean),id:t.flow?E(T`Flow call ${t.key}`):t.key}}var Md={err:`failed`,warn:`attention`,live:`running`,mut:`muted`};function Nd(e){return t=>{let{outcomes:n}=S(e.journal,e.plan),r=n.get(t);return r?hs(r,n,e.run):``}}var Pd=e=>{let t=Nd(e);return n=>({task:e.links.byKey.get(n.key),causeOf:t,live:e.live})},Fd=e=>E(T`Loop at ${Ed(e.loop,e.file)}`),Id=e=>e.executor===`mixed`?[`agent`,`python`]:e.executor?[e.executor]:[];function Ld(e,t,n=!1){let r=Pd(t),i=(e,t)=>{let{name:n,parts:i}=jd(e.label,t,r(t));return{id:gd(e.id,t),state:t.state,label:K(n,...i),tip:[n,i[0]??``].filter(Boolean).join(`
|
|
420
|
-
`),...t.passes?{badge:String(t.passes)}:{},name:t.unit||t.key,drill:!!t.flow}},a=
|
|
421
|
-
`),drill:!!n.flow}})(n,t))})),value:{label:
|
|
419
|
+
</ul>`}};G([I({attribute:!1})],ku.prototype,`services`,void 0),G([I({attribute:!1})],ku.prototype,`nodes`,void 0),G([I({type:Boolean})],ku.prototype,`live`,void 0),ku=G([F(`ca-services`),k()],ku),V(`cae-mark-matrix`,to),V(`cae-layered-graph`,qo);var Au=`loop:`,ju=[`given`,`after`,`created`],Mu=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])},Nu=e=>typeof e==`string`;function Pu(e){let t=e.flow_calls;return Array.isArray(t)&&t.length!==0?new Map(t.filter(e=>e&&Nu(e.id)&&Nu(e.function)).map(e=>[e.id,e])):null}var Fu=new WeakMap;function Iu(e){let t=Fu.get(e);if(t)return t;let n=e.nodes.map(e=>{let t=function(e){let t=e.flow;if(!Array.isArray(t))return[];let n=[];for(let e of t){let t=e;if(!t||typeof t!=`object`||!Nu(t.function))break;let r=(Array.isArray(t.loops)?t.loops:[]).filter(e=>!!e&&typeof e.line==`number`);n.push({function:t.function,file:Nu(t.file)?t.file:``,line:typeof t.line==`number`?t.line:0,loops:r.map(e=>e.line),passes:r.map(e=>typeof e.pass==`number`&&e.pass>=1?e.pass:1)})}return n}(e),n=e.created_from;return{n:e,frames:t,path:t.map(e=>e.function),from:Array.isArray(n)?n.filter(Nu):[],call:Nu(e.flow_call)?e.flow_call:``}}),r=new Map;for(let t of e.nodes)t.unit&&!r.has(t.unit)&&r.set(t.unit,r.size);let i={tasks:n,byKey:new Map(n.map(e=>[e.n.key,e])),calls:Pu(e),unitRank:r,labels:new Map(e.groups.map(e=>[e.id,e.label]))};return Fu.set(e,i),i}var Lu=(e,t)=>t.every((t,n)=>e[n]===t),Ru=e=>e.slice(e.lastIndexOf(`.`)+1)||e,zu=(e,t)=>t>0?e.frames[t-1]?.loops??[]:[],Bu=(e,t)=>t>0?e.frames[t-1]?.passes??[]:[];function Vu(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=(e[n]??0)-(t[n]??0);if(r)return r}return 0}var Hu=e=>e.map((t,n)=>`${Au}${e.slice(0,n+1).join(`.`)}`);function Uu(e,t){let n=zu(e,t),r=n.length?`@${n.join(`.`)}`:``;if(e.path.length<=t)return{id:`kind:${e.n.group}${r}`,type:`kind`,name:e.n.group,loops:n};let i=e.path[t];return{id:`flow:${i}${r}`,type:`flow`,name:i,loops:n}}function Wu(e,t,n){if(!e.call)return{id:`>${t}`,own:!1};let r=e.call.split(`.`),i=r.map((e,t)=>r.slice(0,t+1).join(`.`)),a=0,o=0;if(n)for(let r=1;r<i.length;r++){let s=n.get(i[r])?.function,c=s===void 0?-1:e.frames.findIndex((e,t)=>t>o&&e.function===s);if(c<0||c>t)break;a=r,o=c}else a=Math.min(t,i.length-1),o=a;let s=i[a];return o===t?{id:s,own:!0}:{id:`${s}>${t}`,own:!1}}var Gu={failed:7,running:6,blocked:5,partial:4,pending:3,cancelled:2,skipped:1,done:0},Ku=e=>e.reduce((e,t)=>Gu[t.state]>Gu[e]?t.state:e,`done`),qu=e=>e.reduce((e,t)=>Gu[t]>Gu[e]?t:e,`done`);function Ju(e){let t=e.filter(T).length;return t===0?`agent`:t===e.length?`python`:`mixed`}var Yu={running:`running`,returned:`done`,raised:`failed`,closed:`failed`},Xu=e=>e?.state===`raised`||e?.state===`closed`;function Zu(e,t){let n=e.map(e=>e.n);return{key:(n.find(e=>e.state===`running`)??n[n.length-1]??{key:``}).key,unit:t,state:Ku(n),count:n.length,keys:n.map(e=>e.key)}}function Qu(e){let t=new Map,n=[];for(let r of e)r.n.unit?Mu(t,r.n.unit,r):n.push(Zu([r],``));return{byUnit:new Map([...t].map(([e,t])=>[e,Zu(t,e)])),single:n}}function $u(e,t,n,r){let i=(e,t)=>{let i=e.map(e=>e.own?r?.get(e.id):void 0),a=e.map((e,t)=>{let n=i[t],r=Ku(e.tasks.map(e=>e.n));return n&&Yu[n.state]?qu([Yu[n.state],r]):r}),o=e.flatMap(e=>e.tasks),s=o.map(e=>e.n.key),c=e.find((e,t)=>a[t]===`running`)??e[e.length-1],l=i.find(Xu),u={key:c?.id??``,unit:t,state:qu(a),count:s.length,keys:s,flow:n,counts:ed(o)},d=c?.own?r?.get(c.id)?.time_box:null,f=d?function(e){let t=Date.parse(e.started_at);return Number.isNaN(t)?``:new Date(t+1e3*e.deadline_s).toISOString()}(d):``,p=f?{...u,deadlineAt:f}:u;return l?{...p,error:l.error??``}:p},a=new Map,o=[],s=function(e,t,n){let r=new Map;for(let i of e){let{id:e,own:a}=Wu(i,t,n);(r.get(e)??r.set(e,{id:e,own:a,tasks:[],unit:``}).get(e))?.tasks.push(i)}for(let e of r.values()){let t=new Set(e.tasks.map(e=>e.n.unit||``));e.unit=t.size===1?[...t][0]:``}return[...r.values()]}(e,t,r);for(let e of s)e.unit?Mu(a,e.unit,e):o.push(i([e],``));let c=r?s.filter(e=>e.own&&Xu(r.get(e.id))).length:0,l=s.map(e=>e.own?r?.get(e.id)?.time_box:null).find(e=>e)??null;return{byUnit:new Map([...a].map(([e,t])=>[e,i(t,e)])),single:o,calls:s.length,errors:c,timeBox:l}}function ed(e){let t={total:e.length,done:0,partial:0,failed:0,running:0,pending:0,skipped:0,blocked:0,cancelled:0};for(let n of e)t[n.n.state]+=1;return t}function td(e,t){let n=new Map;for(let r of e){let e=r.n.unit||``,i=n.get(e);(!i||Vu(Bu(r,t),i)>0)&&n.set(e,Bu(r,t))}return e.filter(e=>Vu(Bu(e,t),n.get(e.n.unit||``)??[])===0)}function nd(e,t){let n=new Map;for(let r of e){let e=r.n.unit||``;(n.get(e)??n.set(e,new Set).get(e))?.add(Bu(r,t).join(`.`))}return new Map([...n].map(([e,t])=>[e,t.size]))}var rd=(e,t)=>t&&t>1?{...e,passes:t}:e;function id(e,t){let n=Iu(e);return ad(n,t,n.tasks.filter(e=>Lu(e.path,t)))}function ad(e,t,n){let r=t.length,i=new Map,a=new Map;for(let e of n){let t=Uu(e,r);(i.get(t.id)??i.set(t.id,{...t,tasks:[]}).get(t.id))?.tasks.push(e),a.set(e.n.key,t.id)}let o=new Map,s=new Map,c=new Map,l=new Map;for(let t of i.values()){let n=Hu(t.loops),i=n[n.length-1]??null;n.forEach((e,t)=>l.set(e,n[t-1]??null)),i&&c.set(t.id,i);let a=i?td(t.tasks,r):t.tasks;s.set(t.id,a);let u=t.type===`kind`?Qu(a):$u(a,r,t.name,e.calls);if(i){let e=nd(t.tasks,r);u.byUnit=new Map([...u.byUnit].map(([t,n])=>[t,rd(n,e.get(t))]))}o.set(t.id,u)}let u=[...new Set([...o.values()].flatMap(e=>[...e.byUnit.keys()]))].sort((t,n)=>(e.unitRank.get(t)??0)-(e.unitRank.get(n)??0)),d=new Map,f=new Map;for(let e of i.values()){let t=Hu(e.loops);for(let n of e.tasks){let e=Bu(n,r);t.forEach((t,r)=>{d.set(t,Math.max(d.get(t)??1,e[r]??1));let i=f.get(t)??f.set(t,new Map).get(t),a=n.n.unit||``;(i?.get(a)??i?.set(a,new Set).get(a))?.add(e.slice(0,r+1).join(`.`))})}}let p=new Set,m=new Map,h=new Map,g=n=>{let i=0;for(;i<r&&n.path[i]===t[i];)i++;let a=Uu(n,i);return{id:`stub:${i}:${a.id}`,label:a.type===`kind`?e.labels.get(a.name)??a.name:Ru(a.name)}};for(let t of n){let n=a.get(t.n.key),i=(i,o)=>{let s=a.get(i);if(s===n)return void(o!==`created`&&p.add(n));if(s!==void 0){let a=e.byKey.get(i),c=zu(a,r),l=zu(t,r),u=0;for(;u<c.length&&c[u]===l[u];)u++;let d=Vu(Bu(a,r).slice(0,u),Bu(t,r).slice(0,u))===0,f=`${s}\0${n}\0${o}`,p=m.get(f)??m.set(f,{from:s,to:n,type:o,tasks:new Set,samePass:!1}).get(f);p?.tasks.add(t.n.key),p&&d&&(p.samePass=!0);return}let c=e.byKey.get(i);if(!c)return;let l=g(c),u=`${l.id}\0${n}\0${o}`;(h.get(u)??h.set(u,{...l,to:n,type:o,tasks:new Set}).get(u))?.tasks.add(t.n.key)};for(let e of t.n.given_from??[])i(e,`given`);for(let e of t.n.after??[])i(e,`after`);for(let e of t.from)i(e,`created`)}let _=(e,t)=>e<t?-1:+(e>t),v=[...m.values()].filter(e=>!sd(e.type).some(t=>m.has(`${e.from}\0${e.to}\0${t}`))).sort((e,t)=>_(`${e.from}\0${e.to}\0${e.type}`,`${t.from}\0${t.to}\0${t.type}`)),y=[...h.values()].filter(e=>!sd(e.type).some(t=>h.has(`${e.id}\0${e.to}\0${t}`))).sort((e,t)=>_(`${e.id}\0${e.to}\0${e.type}`,`${t.id}\0${t.to}\0${t.type}`)),b=[...l.keys()].map(e=>{let i=new Map;for(let[t,n]of f.get(e)??[])t&&i.set(n.size,(i.get(n.size)??0)+1);return{id:e,local:e,layer:[...t],loop:Number(e.slice(5).split(`.`).pop()),file:n[0]?.frames[r-1]?.file??``,parent:l.get(e)??null,passes:d.get(e)??1,spread:[...i].sort((e,t)=>e[0]-t[0]),layers:[]}});return{model:{path:[...t],nodes:[...i.values()].map(n=>{let r=o.get(n.id),i=r.byUnit.size>0;return{id:n.id,type:n.type,name:n.name,label:n.type===`kind`?e.labels.get(n.name)??n.name:Ru(n.name),layer:[...t],kinds:[...new Set(n.tasks.map(e=>e.n.kind))],executor:n.type===`flow`?null:Ju(n.tasks.map(e=>e.n)),box:c.get(n.id)??null,units:i?u.map(e=>r.byUnit.get(e)??null):[],single:r.single,inOrder:p.has(n.id),counts:ed(s.get(n.id)??[]),calls:r.calls??0,errors:r.errors??0,timeBox:r.timeBox??null}}),boxes:b,fns:[],edges:v.map(e=>({from:e.from,to:e.to,tasks:e.tasks.size,type:e.type,samePass:e.samePass,back:!1})),stubs:y.map(e=>({id:e.id,label:e.label,to:e.to,tasks:e.tasks.size,type:e.type})),units:u},drafts:i,ix:e}}var od=e=>e===`given`?`solid`:e===`after`?`dotted`:`dashed`,sd=e=>ju.slice(0,ju.indexOf(e));function cd(e){return{nodes:e.nodes.map(e=>({id:e.id,cluster:e.box})),clusters:[...e.boxes.map(e=>({id:e.id,parent:e.parent,cycle:!0})),...e.fns.map(e=>({id:e.id,parent:e.parent,cycle:!1}))],edges:e.edges.map(e=>({from:e.from,to:e.to,style:od(e.type),ranks:e.samePass})),stubs:e.stubs.map(e=>({id:e.id,to:e.to,style:od(e.type)}))}}function ld(e,t){let n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map(t.clusters.map(e=>[e.id,e.layers]));return{...t,path:e.path,nodes:t.drawn.map(e=>n.get(e)),boxes:e.boxes.map(e=>({...e,layers:r.get(e.id)??[]})),fns:e.fns,edges:e.edges.map((e,n)=>({...e,back:t.back[n]??!1})),stubs:e.stubs,units:e.units}}var ud=`fx::`,dd=(e,t)=>`${e.join(`/`)}/${t}`,fd=e=>e?.state===`raised`||e?.state===`closed`;function pd(e,t){if(!t.size)return!1;if(t.has(e))return!0;for(let n=e.indexOf(`.`);n>=0;n=e.indexOf(`.`,n+1))if(t.has(e.slice(0,n)))return!0;return!1}function md(e,t,n=!1){let r=t.length,i=new Map,a=new Set;if(e.calls)for(let t of e.calls.values())fd(t)&&a.add(t.id);for(let o of e.tasks){if(!Lu(o.path,t))continue;let e=o.n.state,s=!!o.call&&pd(o.call,a),c=null;for(let t=r;t<o.path.length;t++){let a=Uu(o,t),l=o.path.slice(0,t),u=dd(l,a.id),d=i.get(u);if(!d){let e={total:0,done:0,partial:0,failed:0,running:0,pending:0,skipped:0,blocked:0,cancelled:0},n=t>0?o.frames[t-1]?.file??``:``;d={key:u,layer:l,id:a.id,name:a.name,depth:t-r,loops:a.loops,file:n,counts:e,tasks:0,agent:0,failed:0,running:0,stuck:0,errors:!1,kids:new Set,fns:new Set,parent:c},i.set(u,d)}d.tasks+=1,d.counts.total+=1,d.counts[e]+=1,T(o.n)||(d.agent+=1),e===`failed`?d.failed+=1:e===`running`?d.running+=1:(e===`blocked`||e===`pending`&&!n)&&(d.stuck+=1),s&&(d.errors=!0);let f=Uu(o,t+1);d.kids.add(f.id),f.type===`flow`&&d.fns.add(dd(o.path.slice(0,t+1),f.id)),c=u}}return i}function hd(e,t=new Set){return Math.log2(1+e.tasks)+(e.failed||e.errors?4:0)+(e.running?3:0)+(e.stuck?1.5:0)+(t.has(e.key)?6:0)}var gd=(e,t=new Set)=>e.agent>0||e.failed>0||e.errors||e.running>0||e.stuck>0||t.has(e.key),_d=(e,t)=>hd(e,t)-1.5*e.depth;function vd(e,t,n){let r=new Set,i=[],a=n.closed??new Set,o=n.open??new Set,s=t,c=new Set([...e.values()].filter(e=>e.parent===null).map(e=>e.key));for(;c.size;){let t=null,l=-1/0;for(let r of c){let i=e.get(r),a=o.has(r)?1/0:_d(i,n.toward);a>l&&(t=i,l=a)}if(!t)break;if(c.delete(t.key),a.has(t.key))continue;let u=t.kids.size-1;if(o.has(t.key)||n.all||!(s+u>n.budget)&&gd(t,n.toward)){r.add(t.key),o.has(t.key)||i.push(t.key),s+=u;for(let e of t.fns)c.add(e)}}return{open:r,auto:i}}function yd(e,t){let n=new Set,r=null;e.startsWith(`fx::`)?r=e.slice(4).split(`#`)[0]??null:e.includes(`::`)&&(r=e.slice(0,e.lastIndexOf(`::`)));for(let e=r;e!==null&&t.has(e);e=t.get(e)?.parent??null)n.add(e);return n}function bd(e,t,n){let r=Iu(e),i=t.length,a=r.tasks.filter(e=>Lu(e.path,t)),o=md(r,t,n.live),s=new Set(a.map(e=>Uu(e,i).id)).size,c=n.sel?yd(n.sel,o):n.toward,{open:l,auto:u}=vd(o,s,{...n,toward:c}),d=xd(r,t,a,o,l),f=e=>go(mo(cd(e))).span;if(n.maxSpan&&!n.all)for(;u.length&&f(d)>n.maxSpan;)l.delete(u.pop()),d=xd(r,t,a,o,l);return{model:d,open:l,stats:o}}function xd(e,t,n,r,i){let a=t.length,o=new Map,s=new Map([[``,[]]]);for(let e of n){let t=a,n=``;for(s.get(``)?.push(e);t<e.path.length;){let r=dd(e.path.slice(0,t),Uu(e,t).id);if(!i.has(r))break;n=r,Mu(s,r,e),t++}o.set(e.n.key,{key:n,depth:t})}let c=new Map,l=new Map;for(let[n,i]of s){let a=r.get(n),o=a?[...a.layer,a.name]:[...t];l.set(n,o),c.set(n,ad(e,o,i))}let u=(e,t)=>e===``?t:`${e}::${t}`,d=e=>{let t=r.get(e);return(t?c.get(t.parent??``):void 0)?.model.nodes.find(e=>e.id===t?.id)},f=e=>(e=>{let t=r.get(e);if(!t||t.parent===null)return!1;let n=c.get(t.parent);if(!n)return!1;let i=n.model.nodes.filter(e=>e.type===`flow`);return i.length===1&&i[0]?.id===t.id&&!i[0]?.box})(e)?f(r.get(e).parent):`${ud}${e}`,p=[],m=[],h=new Map,g=new Set;for(let e of[...c.keys()].sort((e,t)=>e===``?-1:t===``?1:(r.get(e)?.depth??0)-(r.get(t)?.depth??0))){let t=c.get(e),n=l.get(e),a=e===``?null:f(e);if(e!==``){let t=d(e),n=r.get(e),i=t?{...t,id:u(n.parent??``,t.id)}:void 0,o={id:`${ud}${e}`,key:e,node:i};if(a===`fx::${e}`){let e=t?.box?u(n.parent??``,t.box):n.parent===null?null:f(n.parent);h.set(a,{id:a,parent:e,parts:[o]})}else h.get(a)?.parts.push(o)}for(let r of t.model.boxes)m.push({...r,id:u(e,r.id),parent:r.parent?u(e,r.parent):a,layer:n});for(let r of t.model.nodes)r.type===`flow`&&i.has(dd(n,r.id))||p.push({...r,id:u(e,r.id),box:r.box?u(e,r.box):a,layer:n});for(let e of t.model.units)g.add(e)}let _=[...g].sort((t,n)=>(e.unitRank.get(t)??0)-(e.unitRank.get(n)??0)),v=new Map([...c].map(([e,t])=>[e,t.model.units]));for(let e of p){let t=e.id.includes(`::`)?e.id.slice(0,e.id.lastIndexOf(`::`)):``,n=v.get(t)??[];if(!e.units.length)continue;let r=new Map(n.map((t,n)=>[t,e.units[n]??null]));e.units=_.map(e=>r.get(e)??null)}let y=e=>{let t=o.get(e.n.key);return u(t.key,Uu(e,t.depth).id)},b=e=>e.path.slice(0,o.get(e.n.key).depth),x=new Set,S=new Map,ee=new Map;for(let r of n){let n=y(r),i=(i,o)=>{let s=e.byKey.get(i);if(!s)return;if(Lu(s.path,t)){let e=y(s);if(e===n)return void(o!==`created`&&x.add(n));let t=b(s),i=b(r),a=0;for(;a<t.length&&a<i.length&&t[a]===i[a];)a++;let c=zu(s,a),l=zu(r,a),u=0;for(;u<c.length&&c[u]===l[u];)u++;let d=Vu(Bu(s,a).slice(0,u),Bu(r,a).slice(0,u))===0,f=`${e}\0${n}\0${o}`,p=S.get(f)??S.set(f,{from:e,to:n,type:o,tasks:new Set,samePass:!1}).get(f);p?.tasks.add(r.n.key),p&&d&&(p.samePass=!0);return}let c=0;for(;c<a&&s.path[c]===t[c];)c++;let l=Uu(s,c),u={id:`stub:${c}:${l.id}`,label:l.type===`kind`?e.labels.get(l.name)??l.name:Ru(l.name)},d=`${u.id}\0${n}\0${o}`;(ee.get(d)??ee.set(d,{...u,to:n,type:o,tasks:new Set}).get(d))?.tasks.add(r.n.key)};for(let e of r.n.given_from??[])i(e,`given`);for(let e of r.n.after??[])i(e,`after`);for(let e of r.from)i(e,`created`)}for(let e of p)e.inOrder=x.has(e.id);let C=[...S.values()].filter(e=>!sd(e.type).some(t=>S.has(`${e.from}\0${e.to}\0${t}`))).map(e=>({from:e.from,to:e.to,tasks:e.tasks.size,type:e.type,samePass:e.samePass,back:!1})),w=[...ee.values()].filter(e=>!sd(e.type).some(t=>ee.has(`${e.id}\0${e.to}\0${t}`))).map(e=>({id:e.id,label:e.label,to:e.to,tasks:e.tasks.size,type:e.type}));return{path:[...t],nodes:p,boxes:m,fns:[...h.values()],edges:C,stubs:w,units:_}}function Sd(e){let t=new Map,n=new Map;for(let r of e){let e=Cd(r);t.set(r.key,e);for(let t of e)(n.get(t.key)??n.set(t.key,[]).get(t.key))?.push({key:r.key,type:t.type})}return{byKey:new Map(e.map(e=>[e.key,e])),earlier:t,later:n}}function Cd(e){let t=new Map;for(let n of e.given_from??[])t.set(n,`given`);for(let n of e.after??[])t.has(n)||t.set(n,`after`);for(let n of e.created_from??[])t.has(n)||t.set(n,`created`);return[...t].map(([e,t])=>({key:e,type:t}))}var wd=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]);function Td(e,t){let n=new Map;for(let r of e?.entries??[]){if(!r.remaining)continue;let e=t.nodes.find(e=>e.type===`kind`?e.name===r.group&&wd(e.layer,r.flow):r.flow.length>e.layer.length&&wd(e.layer,r.flow.slice(0,e.layer.length))&&r.flow[e.layer.length]===e.name);e&&n.set(e.id,(n.get(e.id)??0)+r.remaining)}return n}function Ed(e,t){let n=new Set(t.nodes.map(e=>`${e.group}\0${(e.flow??[]).map(e=>e.function).join(`\0`)}`)),r=new Map;for(let t of e?.entries??[])t.remaining&&!n.has(`${t.group}\0${t.flow.join(`\0`)}`)&&r.set(t.group,(r.get(t.group)??0)+t.remaining);return[...r].map(([e,t])=>({group:e,remaining:t}))}var Dd=e=>!!e?.earlier_run&&e.remaining>0;function Od(e,t,n,r,i=id(e,t)){let{drafts:a,ix:o}=i,s=ld(i.model,mo(cd(i.model),r,!1)),c=s.boxes.find(e=>e.id===n);if(!c)return null;let l=t.length,u=c.id.slice(5).split(`.`).length-1,d=new Map(s.boxes.map(e=>[e.id,e])),f=new Map(s.nodes.map(e=>[e.id,e])),p=e=>Bu(e,l).slice(u),m=e=>e.layers.flat().flatMap(e=>d.has(e)?m(d.get(e)):[e]),h=e=>m(e).flatMap(e=>a.get(e)?.tasks??[]),g=e=>JSON.stringify(e),_=new Map,v=(e,t)=>{let n=_.get(e);if(!n){n=new Map;for(let t of a.get(e)?.tasks??[])Mu(n,g(p(t)),t);_.set(e,n)}return n.get(g(t))??[]},y=new Map,b=(e,t)=>((e,t)=>{let n=t.length,r=y.get(e);r||y.set(e,r=new Map);let i=r.get(n);if(!i){i=new Map;for(let t of h(e).map(p)){if(t.length<=n)continue;let e=g(t.slice(0,n));(i.get(e)??i.set(e,new Set).get(e))?.add(t[n])}r.set(n,i)}return[...i.get(g(t))??[]].sort((e,t)=>e-t)})(e,t).flatMap(n=>{let r=[...t,n],i=e.layers.flat().flatMap(e=>{let t=d.get(e);if(t){let e=b(t,r);return e.length?[{type:`loop`,box:t,kids:e}]:[]}let n=f.get(e);return n&&v(e,r).length?[{type:`node`,node:n,passes:r}]:[]});return i.length?[{type:`pass`,box:e,pass:n,kids:i}]:[]}),x=b(c,[]),S=[],ee=e=>e.type===`node`?1:e.kids.reduce((e,t)=>e+ee(t),0),C=e=>e.type===`node`?1:1+Math.max(0,...e.kids.map(C)),w=Math.max(1,...x.map(C)),te=Array.from({length:w},()=>[]),ne=(e,t)=>{let n=te[t];if(e.type===`node`)return n.push({type:`node`,node:e.node,passes:e.passes,span:1,rows:w-t}),void S.push({node:e.node,passes:e.passes});n.push(e.type===`pass`?{type:`pass`,box:e.box,pass:e.pass,span:ee(e),rows:1}:{type:`loop`,box:e.box,span:ee(e),rows:1});for(let n of e.kids)ne(n,t+1)};for(let e of x)ne(e,0);let re=h(c),ie=new Set(re.map(e=>e.n.unit||``)),ae=[...s.units.filter(e=>ie.has(e)),...ie.has(``)?[``]:[]],T=new Map;S.forEach((e,t)=>{for(let n of v(e.node.id,e.passes))Mu(T,`${t}\0${n.n.unit||``}`,n)});let oe=new Map;for(let e of re)Mu(oe,e.n.unit||``,e);return{box:c,columns:S,head:te,rows:ae.map(e=>{let t=S.map((t,n)=>{let r=T.get(`${n}\0${e}`);return r?.length?((e,t,n)=>{let r=a.get(e.node.id);if(r.type===`kind`)return Zu(t,n);let i=$u(t,l,r.name,o.calls);return n?i.byUnit.get(n)??i.single[0]??null:i.single[0]??null})(t,r,e):null});return{unit:e,passes:new Set((oe.get(e)??[]).map(e=>Bu(e,l).slice(0,u+1).join(`.`))).size,state:qu(t.filter(e=>e!==null).map(e=>e.state)),cells:t}})}}function kd(e,t){let n=new Map(e.map((e,t)=>[e,t])),r=e=>t===`passes`?-e.passes:t===`state`?-Gu[e.state]:0;return[...e].sort((e,t)=>r(e)-r(t)||(n.get(e)??0)-(n.get(t)??0))}var Ad=(e,t,n=[])=>`${e}${n.length?`|${n.join(`.`)}`:``}#${t.unit||t.key}`;function jd(e,t,n){if(!n)return null;let r=n.indexOf(`#`);if(r<0){let t=e.nodes.find(e=>e.id===n);if(t)return{type:`node`,id:n,node:t};let r=e.boxes.find(e=>e.id===n);if(r)return{type:`box`,id:n,box:r};let i=e.fns.flatMap(e=>e.parts).find(e=>e.id===n);return i?{type:`node`,id:n,node:i.node}:null}let[i=``,a]=n.slice(0,r).split(`|`),o=n.slice(r+1),s=e=>!!e&&(e.unit?e.unit===o:e.key===o);if(a!==void 0){if(!t)return null;let e=t.columns.findIndex(e=>e.node.id===i&&e.passes.join(`.`)===a),r=t.columns[e],o=t.rows.map(t=>t.cells[e]).find(s);return r&&o?{type:`mark`,id:n,node:r.node,mark:o,passes:r.passes}:null}let c=e.nodes.find(e=>e.id===i),l=c?[...c.units,...c.single].find(s):void 0;return c&&l?{type:`mark`,id:n,node:c,mark:l,passes:[]}:null}var Md=[`done`,`partial`,`running`,`pending`,`failed`,`blocked`,`skipped`,`cancelled`],Nd={done:{tone:`done`,shape:`round`},partial:{tone:`attention`,shape:`half`},running:{tone:`running`,shape:`round`},pending:{tone:`neutral`,shape:`ring`},failed:{tone:`failed`,shape:`square`},blocked:{tone:`attention`,shape:`hatched`},skipped:{tone:`muted`,shape:`round`},cancelled:{tone:`muted`,shape:`ring`}};function Pd(e){return Object.fromEntries(Md.map(t=>[t,{...Nd[t],label:Fd(t,e),rank:Gu[t],count:n=>Id(t,n,e)}]))}function Fd(e,t){return ps(m(e),t)}function Id(e,t,n){let r=m(e);return Q(r!==`waiting`||n?r:`not_run`,t)}function Ld(e){return O(D`${e.done} of ${e.total} tasks done`)}function Rd(e,t){return[`failed`,`blocked`,`partial`,`running`,`pending`,`cancelled`,`skipped`].filter(t=>e[t]).map(n=>Id(n,e[n],t))}function zd(e,t){let n=e.counts,r=[];return n.failed&&r.push([`err`,Id(`failed`,n.failed,t)]),e.errors&&r.push([`err`,e.errors===1?O(`1 flow call stopped with an error`):O(D`${e.errors} flow calls stopped with an error`)]),n.blocked&&r.push([`warn`,Id(`blocked`,n.blocked,t)]),n.partial&&r.push([`warn`,Id(`partial`,n.partial,t)]),n.running&&r.push([`live`,Id(`running`,n.running,t)]),n.pending&&r.push([`mut`,Id(`pending`,n.pending,t)]),n.skipped&&r.push([`mut`,Id(`skipped`,n.skipped,t)]),r}function Bd(e,t){let n=t?t.slice(t.lastIndexOf(`/`)+1):``;return n?`${n}:${e}`:O(D`line ${e}`)}function Vd(e){return e.executor===`agent`?O(`Agent task`):e.executor===`python`?O(`Python task`):e.executor===`mixed`?J(O(`Agent task`),O(`Python task`)):``}function Hd(e){return e.type===`flow`?J(O(D`Function ${e.name}`),e.timeBox?O(D`Deadline ${H(e.timeBox.deadline_s)}`):``,Ld(e.counts)):J(e.label,Vd(e),Ld(e.counts))}function Ud(e,t){let n=e=>{let n=t.nodes.find(t=>t.id===e);return n?n.box?O(D`${n.label} in the loop`):n.label:e},r=r=>[...t.stubs.filter(t=>t.to===e.id&&t.type===r).map(e=>e.label),...t.edges.filter(t=>t.to===e.id&&t.type===r).map(e=>n(e.from))];return{given:r(`given`),order:r(`after`),created:r(`created`),feeds:[...new Set(t.edges.filter(t=>t.from===e.id).map(e=>n(e.to)))]}}function Wd(e,t,n){let r=e.counts,{given:i,order:a,created:o,feeds:s}=Ud(e,t);return[e.type===`flow`?J(O(D`Function ${e.label}`),Ld(r)):J(e.label,Vd(e),Ld(r)),...zd(e,n).map(([,e])=>e),i.length?O(D`Given output of: ${Y(i)}`):``,a.length?O(D`Runs after: ${Y(a)}`):``,o.length?O(D`Created after: ${Y(o)}`):``,s.length?O(D`Later tasks: ${Y(s)}`):``].filter(Boolean).join(`. `)}function Gd(e,t,n,r=``){let i=t.flow?void 0:n.task,a=X({kind:t.count===1&&i?i.kind:e,unit:t.unit}),o=t.flow||t.state!==`blocked`?``:n.causeOf(t.key),s=o?O(D`Not started: ${o}`):Fd(t.state,n.live),c=i?.attempts??1,l=c>1?O(D`${c} attempts`):``;return{name:a,parts:[s,r,t.passes?js(t.passes):``,l,t.flow||t.count>1?O(D`${t.count} tasks`):``,...t.counts?Rd(t.counts,n.live):[],...t.error===void 0?[]:[O(`Flow call stopped with an error`),t.error],t.flow||t.state!==`done`&&t.state!==`partial`&&t.state!==`failed`||!i?.wall_s?``:H(i.wall_s)].filter(Boolean),id:t.flow?O(D`Flow call ${t.key}`):t.key}}var Kd={err:`failed`,warn:`attention`,live:`running`,mut:`muted`};function qd(e){return t=>{let{outcomes:n}=S(e.journal,e.plan),r=n.get(t);return r?ws(r,n,e.run):``}}var Jd=e=>{let t=qd(e);return n=>({task:e.links.byKey.get(n.key),causeOf:t,live:e.live})},Yd=e=>O(D`Loop at ${Bd(e.loop,e.file)}`),Xd=e=>e.executor===`mixed`?[`agent`,`python`]:e.executor?[e.executor]:[];function Zd(e,t,n=!1){let r=Jd(t),i=(e,t)=>{let{name:n,parts:i}=Gd(e.label,t,r(t));return{id:Ad(e.id,t),state:t.state,label:J(n,...i),tip:[n,i[0]??``].filter(Boolean).join(`
|
|
420
|
+
`),...t.passes?{badge:String(t.passes)}:{},name:t.unit||t.key,drill:!!t.flow}},a=Td(t.forecast,e),o=e.nodes.map(r=>{let o=r.counts,s=a.get(r.id),c=s?function(e){return{text:O(D`+${e}`),label:O(e===1?`1 more task expected (forecast)`:D`${e} more tasks expected (forecast)`)}}(s):null;return{id:r.id,label:r.label,tip:Hd(r),summary:c?J(Wd(r,e,t.live),c.label):Wd(r,e,t.live),...c?{expected:c}:{},cluster:r.box,icons:Xd(r),accent:r.executor===`agent`,drill:r.type===`flow`,marks:r.units.map(e=>e&&i(r,e)),loose:r.single.map(e=>i(r,e)),counts:o,progress:{done:o.done,total:o.total,label:Ld(o)},notes:zd(r,t.live).map(([e,t])=>({text:t,tone:Kd[e]})),look:o.failed||r.errors?`failed`:o.running?`running`:o.done+o.skipped===o.total?`done`:void 0,...r.type===`flow`&&n?{toggle:`closed`}:{}}}),s=e.fns.map(n=>{let r=n.parts[0].node,i=n.parts.map(e=>e.node.label).join(` › `),a=r.counts,o=zd(r,t.live).map(([,e])=>e);return{id:n.id,parent:n.parent,label:i,tip:r.name,note:`${a.done}/${a.total}`,...o.length?{detail:J(...o)}:{},summary:J(i,Wd(r,e,t.live)),chipLabel:O(D`Inside ${i}`),chipTip:J(O(`Function`),i),drill:!0,cycle:!1,toggle:`open`,path:n.parts.map(e=>({id:e.id,label:e.node.label,tip:e.node.name}))}}),c=e.boxes.map(e=>{let t=Yd(e),n=e.spread.length>1?Ms(e.spread):``,r=As(e.passes);return{id:e.id,parent:e.parent,label:Ns(),tip:J(Ns(),t),note:r,...n?{detail:n,detailTip:O(`Units by number of passes`)}:{},summary:J(t,r,n),chipLabel:J(O(D`Passes of the loop at ${Bd(e.loop,e.file)}`),r),chipTip:J(t,r),drill:!0,cycle:!0}});return{series:e.units,nodes:o,clusters:[...c,...s],edges:e.edges.map(e=>({from:e.from,to:e.to,style:od(e.type),weight:e.tasks,ranks:e.samePass})),stubs:e.stubs.map(e=>({id:e.id,label:e.label,to:e.to,style:od(e.type),weight:e.tasks}))}}function Qd(e,t,n){let r=id(e,t);return{input:Zd(r.model,{...n,plan:e}),proj:r}}function $d(e,t,n){let r=Jd(n),i=e.box,a=Yd(i),o=e.rows.filter(e=>e.unit).length,s=e.head.map(e=>e.map(e=>{if(e.type===`pass`)return{id:`${e.box.id}|${e.pass}`,label:ks(e.pass),tip:e.box.id===i.id?Yd(e.box):O(D`Nested loop at ${Bd(e.box.loop,e.box.file)}`),span:e.span,rows:e.rows,type:`group`};if(e.type===`loop`)return{id:e.box.id,label:Ns(),tip:O(D`Nested loop at ${Bd(e.box.loop,e.box.file)}`),code:!0,span:e.span,rows:e.rows,type:`group`};let t=e.node,n=t.type===`flow`;return{id:`${t.id}|${e.passes.join(`.`)}`,label:t.label,tip:n?O(D`Function ${t.name}`):J(t.label,Vd(t)),summary:n?t.label:J(t.label,Vd(t)),icons:t.executor&&t.executor!==`mixed`?[t.executor]:[],span:e.span,rows:e.rows,type:`column`}}));return{caption:a,...i.file?{captionTip:`${i.file}:${i.loop}`}:{},label:J(a,As(i.passes)),facts:[As(i.passes),i.spread.length>1?Ms(i.spread):``,O(o===1?`1 unit`:D`${o} units`)].filter(Boolean),head:s,columns:e.columns.map(e=>({id:`${e.node.id}|${e.passes.join(`.`)}`,groups:e.passes.map((t,n)=>e.passes.slice(0,n+1).join(`.`))})),rows:kd(e.rows,t).map(t=>({id:t.unit,label:t.unit||O(`No unit`),tip:t.unit||O(`Tasks that run once per run, not once per unit`),muted:!t.unit,value:t.passes,strong:t.passes>1,cells:t.cells.map((t,n)=>t&&((t,n)=>{let i=e.columns[t],a=i?.node.label??``,o=i?.passes??[],{name:s,parts:c}=Gd(a,n,r(n),Y(o.map(ks)));return{id:Ad(i?.node.id??``,n,o),state:n.state,label:J(s,...c),tip:[s,c[0]??``].filter(Boolean).join(`
|
|
421
|
+
`),drill:!!n.flow}})(n,t))})),value:{label:O(`Passes`),tip:O(`Passes of this loop`)},sorts:[{id:`order`,label:O(`Scheduled order`)},{id:`passes`,label:O(`Number of passes`)},{id:`state`,label:O(`Status`,{id:`status`})}],sort:t}}function ef(e,t,n,r,i,a,o){let s=Od(e,t,n,r,o);return s&&{input:$d(s,i,{...a,plan:e}),matrix:s}}function tf(e,t=[],n,r=!1){let{model:i}=id(e,t);return ld(i,mo(cd(i),n,r))}function nf(e){let t=Iu(e),n=[],r=new Set;if(t.calls)for(let e of t.calls.values())e.state!==`raised`&&e.state!==`closed`||r.add(e.id);let i=new Set;for(let e of r)for(let t=e.indexOf(`.`);t>=0;t=e.indexOf(`.`,t+1))i.add(e.slice(0,t));for(;;){let e=null,a=!0,o=[];for(let r of t.tasks){if(!Lu(r.path,n))continue;let t=Uu(r,n.length);if(t.type===`kind`||e&&e.id!==t.id){a=!1;break}e=t,o.push(r)}let s=o.some(e=>{return a=Wu(e,n.length,t.calls).id,r.has(a)&&!i.has(a);var a});if(!a||!e||s)return n;n.push(e.name)}}function rf(e){let t=e[e.length-1];return t?.startsWith(`loop:`)?{path:e.slice(0,-1),loop:t}:{path:[...e],loop:null}}function af(e,t){let{path:n,loop:r}=rf(t),i=Iu(e),a=t=>!r||id(e,t).model.boxes.some(e=>e.id===r);if(i.tasks.some(e=>Lu(e.path,n)))return a(n)?[...t]:null;let o=n[n.length-1];if(o===void 0)return null;let s=e=>{let t=new Map;for(let n of i.tasks)n.path.forEach((r,i)=>e(r)&&t.set(n.path.slice(0,i+1).join(`/`),n.path.slice(0,i+1)));return[...t.values()]},c=s(e=>e===o),l=c.length?c:s(e=>Ru(e)===o),u=l.length===1?l[0]:null;return u&&a(u)?r?[...u,r]:u:null}function of(e,t){if(e.length<=t.length)return null;let n=e.slice(0,-1);return n.length<=t.length?[]:n}function sf(e,t,n){return fi((e=>e?`⚙`:`✦`)(e),t,{cls:n??`k-ic `+(e?``:`llm`)})}var cf=A` .k-ic{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:6px;margin-right:7px;font-size:var(--font-size-sm);background:var(--raise);color:var(--text-muted);flex:none;}.k-ic.llm{background:var(--agent-bg);color:var(--agent);}`;function lf(e,t){t!==e.sel&&$(e.el,`ca-navigate`,{sel:t})}function uf(e,t,n=e.unit){let r=t.join(`/`);$(e.el,`ca-navigate`,{layer:r===e.auto.join(`/`)?``:r,unit:n})}function df(e,t){$(e.el,`ca-navigate`,{tab:`tasks`,kind:t.kinds.length===1?t.kinds[0]:``})}function ff(e,t,n){if(t.flow)return uf(e,[...n?.layer??e.graph.path,t.flow],t.unit||e.unit);let r=e.links.byKey.get(t.key);$(e.el,`ca-open-task`,t.state===`blocked`?{key:t.key,view:`input`}:r?.executor===`python`?{key:t.key,view:`output`}:{key:t.key})}function pf(e,t){return t.type===`mark`?ff(e,t.mark,t.node):t.type===`box`?uf(e,[...t.box.layer,t.box.local]):t.node.type===`flow`?uf(e,[...t.node.layer,t.node.name]):void df(e,t.node)}function mf(e,t){let n=function(e,t){let n=e=>{let r=e;for(;r.type===`fn`&&!t(r.id)&&r.kids.length===1&&r.kids[0]?.type===`fn`&&!t(r.kids[0].id);){let e=r.kids[0];r={...r,label:`${r.label} › ${e.label}`,tip:`${r.tip}\n${e.tip}`,kids:e.kids,parts:[...r.parts,...e.parts]}}return{...r,kids:r.kids.map(n)}};return e.map(n)}(t,t=>e.current(t)),r=(t,n=``)=>{let i=t.kids.length>0&&e.expanded(t.id),a=t.counts,o=a.total?Math.round((a.done+a.partial+a.skipped)/a.total*100):0,s=(t=>zd({counts:t.counts,errors:+!!t.errors},e.live))(t),c=s.map(([,e])=>e).join(`|`),l=c===n?[]:s,u=t.parts.some(t=>e.current(t.id)),d=t.parts.some(t=>e.here(t.id));return j`<li>
|
|
422
422
|
<div class="orow ${u?`cur`:``} ${t.parts.some(t=>e.selected(t.id))?`sel`:``}">
|
|
423
|
-
${t.kids.length?
|
|
424
|
-
<button type="button" class="oname" title=${t.tip||
|
|
425
|
-
${t.type===`loop`?
|
|
423
|
+
${t.kids.length?j`<button type="button" class="odisc" aria-expanded=${i} aria-label=${O(i?D`Fold ${t.label}`:D`Unfold ${t.label}`)} @click=${()=>e.expand(t.id,!i)}><span aria-hidden="true">${i?`▾`:`▸`}</span></button>`:j`<span class="odisc" aria-hidden="true"></span>`}
|
|
424
|
+
<button type="button" class="oname" title=${t.tip||N} aria-current=${d?`location`:N} @click=${n=>n.detail<2&&e.pick(t)} @dblclick=${()=>e.enter(t)} @keydown=${n=>{n.key===`Enter`&&(n.preventDefault(),e.enter(t))}}>
|
|
425
|
+
${t.type===`loop`?To(12):N}<span class="ol">${t.label}</span>
|
|
426
426
|
<span class="obar" aria-hidden="true"><i style="width:${o}%"></i></span>
|
|
427
|
-
<span class="ocount" title=${
|
|
427
|
+
<span class="ocount" title=${Ld(a)}>${a.done}/${a.total}</span>
|
|
428
428
|
</button>
|
|
429
|
-
${l.length?
|
|
429
|
+
${l.length?j`<div class="onote">${l.map(([e,t])=>j`<span class=${e}>${t}</span>`)}</div>`:N}
|
|
430
430
|
</div>
|
|
431
|
-
${i?
|
|
432
|
-
</li>`};return k`<nav class="outline" aria-label=${E(`Outline of the flow`)}><ul class="otree">${n.map(e=>r(e))}</ul></nav>`}var ef=[V,qd,qr,O` :host{display:flex;flex-direction:column;}cae-layered-graph{flex:auto;min-height:0;}.bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;margin-bottom:8px;font-size:12px;}.crumbs{display:flex;flex-wrap:wrap;align-items:center;gap:4px;list-style:none;margin:0;padding:0;}.crumbs li{display:inline-flex;align-items:center;gap:4px;}.crumbs .sep{color:var(--text-muted);}.crumbs button{all:unset;cursor:pointer;color:var(--accent);font-family:var(--mono);}.crumbs button:hover{text-decoration:underline;}.crumbs button:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.crumbs [aria-current]{font-family:var(--mono);color:var(--text);font-weight:600;}.pin{display:inline-flex;align-items:center;gap:8px;color:var(--text-2);}.pin b{font-family:var(--mono);}.missing{margin-bottom:8px;font-size:12px;color:var(--status-attention);}.missing code{font-family:var(--mono);}.card{display:contents;}.ic{display:block;flex:none;}.loop-ic{color:var(--text-2);}.in-ic{color:var(--text-muted);}.card h4{margin:0;display:flex;align-items:center;gap:7px;font-family:var(--mono);font-size:13px;font-weight:600;color:var(--text);overflow-wrap:anywhere;}.card h4 .mark{--m:11px;flex:none;cursor:default;animation:none;}.card h4 .mark:hover{transform:none;outline:none;}.card h4 .k-ic{width:18px;height:18px;margin:0;border-radius:5px;font-size:10px;}.card .sub{color:var(--text-2);}.card dl{display:grid;grid-template-columns:fit-content(42%) minmax(0,1fr);gap:4px 12px;margin:0;}.card dt{color:var(--text-muted);word-break:keep-all;overflow-wrap:break-word;}.card dd{margin:0;color:var(--text);overflow-wrap:anywhere;font-variant-numeric:tabular-nums;}.card dd .err{color:var(--status-failed);}.card dd .warn{color:var(--status-attention);}.card .acts{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;padding-top:2px;}.card .go{all:unset;cursor:pointer;color:var(--accent);overflow-wrap:anywhere;}.card .go.primary{font-weight:600;}.card .go:hover{text-decoration:underline;}.card .go:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.card .acts .switch{margin-left:auto;}.switch{all:unset;cursor:pointer;font-size:11.5px;color:var(--text-2);padding:2px 8px;border-radius:6px;border:1px solid var(--line);}.switch:hover{color:var(--text);border-color:var(--line2);}.switch:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.switch[aria-pressed='true']{color:var(--text);background:var(--accent-bg);border-color:var(--accent);}.opens{display:inline-flex;gap:6px;margin-left:auto;}.forecast{font-size:12px;color:var(--text-muted);margin:0 0 8px;display:flex;flex-wrap:wrap;align-items:center;gap:4px;}.forecast .expected-mark{display:inline-block;width:18px;height:10px;border:1.5px dotted var(--line2);border-radius:999px;margin-right:4px;}.unawaited{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 8px;}.card .down{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px;}.whole,.whole>.g{display:flex;flex-direction:column;flex:auto;min-height:0;min-width:0;}.whole.side{display:grid;grid-template-columns:minmax(200px,282px) minmax(0,1fr);gap:14px;align-items:start;}.outline{font-size:12px;max-height:70vh;overflow:auto;padding:2px 6px 2px 0;border-right:1px solid var(--line);}.otree,.otree ul{list-style:none;margin:0;padding:0;}.otree ul{padding-left:10px;}.orow{display:grid;grid-template-columns:16px minmax(0,1fr);align-items:start;border-radius:6px;}.orow.sel{background:var(--accent-bg);}.orow.cur .ol{font-weight:600;color:var(--text);}.odisc{all:unset;cursor:pointer;width:16px;text-align:center;color:var(--text-muted);font-size:10px;line-height:22px;}.odisc:focus-visible,.oname:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;border-radius:4px;}.oname{all:unset;cursor:pointer;display:flex;align-items:flex-start;gap:6px;min-width:0;padding:3px 6px 3px 2px;border-radius:6px;color:var(--text-2);}.oname:hover{background:var(--raise);color:var(--text);}.oname .loop-ic{flex:none;color:var(--text-muted);}.ol{flex:1;min-width:0;overflow-wrap:break-word;font-family:var(--mono);line-height:1.35;}.obar{flex:none;width:32px;height:4px;margin-top:6px;border-radius:2px;background:var(--track);overflow:hidden;}.obar i{display:block;height:100%;background:var(--meter);}.ocount{flex:none;font-size:11px;color:var(--text-muted);font-variant-numeric:tabular-nums;}.onote{grid-column:2;display:flex;flex-wrap:wrap;gap:0 8px;padding:0 6px 2px 2px;font-size:11px;}.onote .err{color:var(--status-failed);}.onote .warn{color:var(--status-attention);}.onote .live{color:var(--status-running);}.onote .mut{color:var(--text-muted);}.odet{margin-bottom:8px;}.odet>summary{cursor:pointer;font-size:12px;color:var(--text-2);padding:2px 0;}.odet .outline{border-right:none;max-height:50vh;}`],tf=[qd,O` .node .k-ic{width:16px;height:16px;margin-right:6px;border-radius:4px;font-size:9.5px;}.legend .k-ic{width:14px;height:14px;margin:0;border-radius:4px;font-size:8.5px;}.list .k-ic{width:16px;height:16px;border-radius:4px;font-size:9.5px;}.list .nm .k-ic{margin:0 -2px 0 0;}.matrix thead th.nh .k-ic{width:14px;height:14px;margin-right:5px;border-radius:4px;font-size:8.5px;vertical-align:-2px;}`],nf=e=>Math.max(14,Math.min(60,Math.round(e/34))),rf=e=>Math.max(8,Math.min(16,Math.round(e/105))),af=(e,t)=>t>0&&t/(180*e)<.6,of=`*all`,sf=`*none`,cf={...co({nodes:[],clusters:[],edges:[],stubs:[]}),path:[],nodes:[],boxes:[],fns:[],edges:[],stubs:[],units:[]},lf=class extends M{constructor(...e){super(...e),this.plan={nodes:[],groups:[]},this.forecast=null,this.journal=[],this.run=``,this.live=!1,this.controls=!0,this.layer=``,this.unit=``,this.sel=``,this.down=!1,this.tall=!1,this.sort=`order`,this.missing=``,this.fixLayer=null,this.replacing=!1,this.auto=[],this.segments=[],this.proj=null,this.model=null,this.graph=cf,this.input={series:[],nodes:[],clusters:[],edges:[],stubs:[]},this.prevOrder=void 0,this.matrix=null,this.matrixIn=null,this.orders=new Map,this.links=cd([]),this.states=bd(!1),this.locale=``,this.opened=null,this.closed=null,this.memRun=null,this.rev=0,this.budget=40,this.shownOpen=new Set,this.stats=new Map,this.focusToggle=``,this.flowStats=new Map,this.tree=[],this.folds=new Map,this.wide=!0,this.oh=this.outlineHost(),this.lights=()=>new Set,this.refocus=!1,this.cameFrom=``,this.h=this.partsHost(),this.onToggle=e=>this.toggle(e.detail.id,e.detail.open),this.onEscape=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=Gd(this.segments,this.auto);t&&(e.preventDefault(),this.refocus=!0,this.cameFrom=this.segments[this.segments.length-1]??``,Yd(this.h,t))},this.onSelect=e=>Jd(this.h,e.detail.id??``),this.onActivate=e=>{let t=_d(this.graph,this.matrix,e.detail.id);t?.type===`mark`?Zd(this.h,t.mark,t.node):t?.type===`node`&&Xd(this.h,t.node)},this.onDrill=e=>{let t=_d(this.graph,this.matrix,e.detail.id);t&&Qd(this.h,t)},this.onView=e=>{e.detail.view===`graph`&&this.matrix&&function(e){let t=e.segments[e.segments.length-1]??``,n=Gd(e.segments,e.auto)??[],r=e.auto.join(`/`);$(e.el,`ca-navigate`,{layer:n.join(`/`)===r?``:n.join(`/`),unit:e.unit,sel:t})}(this.h)}}static{this.styles=ef}static{this.properties={plan:{attribute:!1},forecast:{attribute:!1},journal:{attribute:!1},run:{},live:{type:Boolean},controls:{type:Boolean},layer:{},unit:{},sel:{},down:{state:!0},sort:{state:!0},missing:{state:!0},rev:{state:!0},budget:{state:!0},wide:{state:!0}}}willUpdate(e){if(e.has(`run`)&&this.orders.clear(),e.has(`layer`)&&e.get(`layer`)!==void 0){let e=this.renderRoot instanceof ShadowRoot?this.renderRoot.activeElement:null,t=e?.shadowRoot?.activeElement;this.refocus=e!==null&&!t?.closest(`.views`),this.replacing?this.replacing=!1:this.missing=``}e.has(`run`)&&e.get(`run`)!==void 0&&(this.missing=``),e.has(`plan`)&&(this.links=cd(this.plan.nodes)),(e.has(`plan`)||e.has(`live`))&&(this.flowStats=ed(Cu(this.plan),[],this.live),this.tree=function(e){let t=new Map;for(let n of e.values())(t.get(n.parent)??t.set(n.parent,[]).get(n.parent))?.push(n);let n=e=>{let r=[],i=new Map;for(let a of t.get(e)??[]){let e={id:a.key,type:`fn`,label:Tu(a.name),tip:a.name,layer:a.layer,name:a.name,counts:a.counts,errors:a.errors,kids:n(a.key),parts:[{id:a.key,layer:a.layer,name:a.name}]},t=r;a.loops.forEach((e,n)=>{let r=`${_u}${a.loops.slice(0,n+1).join(`.`)}`,o=`${a.layer.join(`/`)}|${r}`,s=i.get(o);if(!s){let e=a.loops[n];s={id:o,type:`loop`,label:E(T`Loop at ${Ed(e,a.file)}`),tip:a.file?`${a.file}:${e}`:``,layer:a.layer,name:r,counts:{total:0,done:0,partial:0,failed:0,running:0,pending:0,skipped:0,blocked:0,cancelled:0},errors:!1,kids:[],parts:[{id:o,layer:a.layer,name:r}]},i.set(o,s),t.push(s)}for(let e of Object.keys(s.counts))s.counts[e]+=a.counts[e];s.errors||=a.errors,t=s.kids}),t.push(e)}return r};return n(null)}(this.flowStats)),e.has(`run`)&&this.folds.clear();let t=e.has(`sel`)&&!!this.sel&&!Ud(this.segments).loop&&!_d(this.graph,this.matrix,this.sel),n=e.has(`plan`)||e.has(`layer`)||e.has(`run`)||e.has(`down`)||e.has(`rev`)||e.has(`budget`)||t;if(n){if(this.auto=Hd(this.plan),this.segments=this.layer?this.layer.split(`/`):this.auto,this.layer&&this.plan.nodes.length){let e=Wd(this.plan,this.segments);e?e.join(`/`)!==this.layer&&(this.segments=e,this.fixLayer=e.join(`/`)===this.auto.join(`/`)?``:e.join(`/`)):(this.missing=this.layer,this.segments=this.auto,this.fixLayer=``)}let{path:e,loop:t}=Ud(this.segments);if(t)this.proj=Gu(this.plan,e),this.model=this.proj.model;else{let t=this.memory(),n=this.openMode(),r=od(this.plan,e,{open:new Set(t.opened.values().filter(e=>!e.startsWith(`*`))),closed:new Set(t.closed.values()),all:n===`all`,budget:n===`none`?0:this.budget,maxSpan:rf(this.graphWidth()),sel:this.sel,live:this.live});this.proj=null,this.model=r.model,this.shownOpen=r.open,this.stats=r.stats}this.prevOrder=this.orders.get(e.join(`/`))}let r=I(),i=n||e.has(`journal`)||e.has(`live`)||e.has(`forecast`)||r!==this.locale;(i||e.has(`sort`))&&this.build(i,r)}build(e,t){let n=this.model;if(!n)return;let r=this.proj,{path:i,loop:a}=Ud(this.segments),o={plan:this.plan,journal:this.journal,run:this.run,live:this.live,links:this.links,forecast:this.forecast};if(e){this.locale=t,this.states=bd(this.live),this.input=Ld(n,o,!a);let e=co(this.input,this.prevOrder,this.down);this.tall=!this.down&&!a&&af(lo(e).span,this.graphWidth()),this.tall&&(e=co(this.input,this.prevOrder,!0)),this.graph=Xu(n,e),this.orders.set(i.join(`/`),e.order),this.lights=function(e,t,n){let r=n.nodes.flatMap(e=>[...e.units,...e.single].filter(e=>e!==null).map(t=>[gd(e.id,t),t])),i=new Map(r.map(([e,t])=>[e,t.key])),a=new Map;return n=>{let o=a.get(n);if(o)return o;let s=function(e,t,n){let r=e.filter(e=>e.unit?e.unit===n:e.key===n).map(e=>e.key),i=new Map(r.map(e=>[e,null]));for(let[e,n]of vu.entries()){let a=new Set(vu.slice(0,e+1));for(let e of[t.earlier,t.later]){let t=new Set(r),o=[...r];for(let r=o.pop();r!==void 0;r=o.pop())for(let s of e.get(r)??[])a.has(s.type)&&!t.has(s.key)&&(t.add(s.key),i.has(s.key)||i.set(s.key,n),o.push(s.key))}}return i}(e.nodes,t,i.get(n)??n),c=new Map;for(let[e,t]of r){let n=t.keys.filter(e=>s.has(e)).map(e=>s.get(e)??null);if(!n.length)continue;let r=vu.find(e=>n.includes(e));c.set(e,n.includes(null)||!r?null:qu(r))}return a.set(n,c),c}}(this.plan,this.links,this.graph)}let s=a&&r?Bd(this.plan,i,a,this.graph.order,this.sort,o,r):null;this.matrix=s?.matrix??null,this.matrixIn=s?.input??null}connectedCallback(){super.connectedCallback(),this.addEventListener(`keydown`,this.onEscape),this.resize=new ResizeObserver(()=>{let e=this.clientWidth,t=e>0&&e<640;t!==this.down&&(this.down=t);let n=e>0?nf(this.graphWidth()):this.budget;n!==this.budget&&(this.budget=n);let r=e===0||e>=1500;r!==this.wide&&(this.wide=r)}),this.resize.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.onEscape),this.resize?.disconnect()}memory(){return this.opened&&this.closed&&this.memRun===this.run||(this.memRun=this.run,this.opened=new Yn(`graph-open:${this.run}`,this),this.closed=new Yn(`graph-closed:${this.run}`,this)),{opened:this.opened,closed:this.closed}}openMode(){let{opened:e}=this.memory();return e.has(of)?`all`:e.has(sf)?`none`:`auto`}setMode(e){let{opened:t,closed:n}=this.memory();t.clear(),n.clear(),e===`all`&&t.set(of,!0),e===`none`&&t.set(sf,!0),Un(),this.rev++}placeOfNode(e){let t=this.graph.nodes.find(t=>t.id===e);if(!t||t.type!==`flow`)return null;let n=e.includes(`::`)?e.slice(e.lastIndexOf(`::`)+2):e;return Qu(t.layer,n)}toggle(e,t){let n=e.startsWith(`fx::`)?e.slice(4):this.placeOfNode(e);if(!n)return;let{opened:r,closed:i}=this.memory();r.set(n,t),i.set(n,!t),Un(),this.focusToggle=t?`${Zu}${n}`:this.nodeIdOf(n),this.rev++}nodeIdOf(e){let t=this.stats.get(e);if(!t)return``;let n=t.parent;return n!==null&&this.shownOpen.has(n)?`${n}::${t.id}`:t.id}updated(){if(this.focusToggle){let e=this.focusToggle;this.focusToggle=``;let t=this.renderRoot.querySelector(`cae-layered-graph`);t&&t.updateComplete.then(()=>t.focusToggle(e))}if(this.fixLayer!==null){let e=this.fixLayer;this.fixLayer=null,this.replacing=!0,$(this,`ca-navigate`,{layer:e,unit:this.unit,sel:this.sel,replace:!0})}if(this.refocus||this.cameFrom){let e=this.cameFrom;this.refocus=!1,this.cameFrom=``;let t=e.startsWith(`loop:`)?e:this.graph.nodes.find(t=>t.type===`flow`&&t.name===e)?.id??null,n=this.renderRoot.querySelector(`cae-layered-graph`);n&&n.updateComplete.then(()=>n.focusItem(e?t:null))}}render(){if(!this.plan.nodes.length)return k`<div class="blank" style="padding:24px">${this.live?E(`No tasks scheduled yet`):E(`No tasks scheduled`)}</div>`;let e=this.controls&&this.wide&&this.tree.length>0,t=this.controls&&this.tree.length?e?$d(this.oh,this.tree):k`<details class="odet"><summary>${E(`Outline of the flow`)}</summary>${$d(this.oh,this.tree)}</details>`:j;return k`<div class="whole ${e?`side`:``}">${t}<div class="g">${this.renderGraph()}</div></div>`}renderGraph(){let e=_d(this.graph,this.matrix,this.sel),t=this.graph.nodes.some(e=>e.type===`flow`);return k`<cae-layered-graph .graph=${this.input} .states=${this.states} .selected=${this.sel||null} .highlight=${this.unit||null} .order=${this.prevOrder} key=${this.segments.join(`/`)} direction=${this.down||this.tall?`down`:`across`} .matrix=${this.matrixIn} .related=${this.lights} .strings=${function(e,t){let n=E(`Enter: open`);return{graph:E(`Graph`,{id:`view-graph`}),table:E(`Table`,{id:`view-table`}),view:E(`View`),zoomIn:E(`Zoom in`),zoomInTip:E(`Zoom in (Ctrl + scroll)`),zoomOut:E(`Zoom out`),zoomOutTip:E(`Zoom out (Ctrl + scroll)`),showAll:E(`Show all`),graphKeys:[E(`Tab: next node`),E(`Arrow keys: marks`),E(`Shift + arrow keys: earlier and later tasks`),n],tableKeys:[E(`Tab: next row`),n],matrixKeys:[E(`Arrow keys: marks`),n],clearKey:E(`Esc: clear selection`),upKey:e?E(`Esc: up a level`):``,inspector:E(`Selected item`),stubTip:E(`Outside this layer`),more:e=>E(T`+${e}`),badge:E(`Passes`),solidEdge:rl(`given_from`),dottedEdge:rl(`after`),dashedEdge:rl(`created_from`),cycle:E(`Next pass`),drill:E(`Has a level below`),open:E(`Show inside`),close:E(`Hide inside`),iconNames:{agent:E(`agent task`),python:E(`Python task`)},nameHeader:E(t?`Kind or function`:`Kind`),statusHeader:E(`Status`,{id:`status`}),solidHeader:E(`Given output of`),dottedHeader:E(`Runs after`),dashedHeader:E(`Created after`),laterHeader:E(`Later tasks`),none:E(`none`,{id:`none`}),inCluster:e=>E(T`${e} in the loop`),list:e=>q(e)}}(!!Gd(this.segments,this.auto),t)} .matrixStrings=${{sortBy:E(`Sort units`),rowsHeader:E(`Unit`)}} .renderIcon=${uf} .iconStyles=${tf} .controls=${this.controls} @cae-select=${this.onSelect} @cae-activate=${this.onActivate} @cae-drill=${this.onDrill} @cae-view-change=${this.onView} @cae-toggle=${this.onToggle} @cae-sort=${e=>this.sort=e.detail.id}>
|
|
433
|
-
<div slot="crumbs">${function(e,t=null){let n=e.segments,r=e.unit;if(!n.length&&!r&&!t)return
|
|
434
|
-
${n.length?
|
|
431
|
+
${i?j`<ul>${t.kids.map(e=>r(e,c))}</ul>`:N}
|
|
432
|
+
</li>`};return j`<nav class="outline" aria-label=${O(`Outline of the flow`)}><ul class="otree">${n.map(e=>r(e))}</ul></nav>`}var hf=new Map,gf=null,_f=[U,cf,qr,A` :host{display:flex;flex-direction:column;}cae-layered-graph{flex:auto;min-height:0;}.bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;margin-bottom:8px;font-size:12px;}.crumbs{display:flex;flex-wrap:wrap;align-items:center;gap:4px;list-style:none;margin:0;padding:0;}.crumbs li{display:inline-flex;align-items:center;gap:4px;}.crumbs .sep{color:var(--text-muted);}.crumbs button{all:unset;cursor:pointer;color:var(--accent);font-family:var(--mono);}.crumbs button:hover{text-decoration:underline;}.crumbs button:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.crumbs [aria-current]{font-family:var(--mono);color:var(--text);font-weight:600;}.pin{display:inline-flex;align-items:center;gap:8px;color:var(--text-2);}.pin b{font-family:var(--mono);}.missing{margin-bottom:8px;font-size:12px;color:var(--status-attention);}.missing code{font-family:var(--mono);}.card{display:contents;}.ic{display:block;flex:none;}.loop-ic{color:var(--text-2);}.in-ic{color:var(--text-muted);}.card h4{margin:0;display:flex;align-items:center;gap:7px;font-family:var(--mono);font-size:13px;font-weight:600;color:var(--text);overflow-wrap:anywhere;}.card h4 .mark{--m:11px;flex:none;cursor:default;animation:none;}.card h4 .mark:hover{transform:none;outline:none;}.card h4 .k-ic{width:18px;height:18px;margin:0;border-radius:5px;font-size:10px;}.card .sub{color:var(--text-2);}.card dl{display:grid;grid-template-columns:fit-content(42%) minmax(0,1fr);gap:4px 12px;margin:0;}.card dt{color:var(--text-muted);word-break:keep-all;overflow-wrap:break-word;}.card dd{margin:0;color:var(--text);overflow-wrap:anywhere;font-variant-numeric:tabular-nums;}.card dd .err{color:var(--status-failed);}.card dd .warn{color:var(--status-attention);}.card .acts{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;padding-top:2px;}.card .go{all:unset;cursor:pointer;color:var(--accent);overflow-wrap:anywhere;}.card .go.primary{font-weight:600;}.card .go:hover{text-decoration:underline;}.card .go:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:2px;border-radius:3px;}.card .acts .switch{margin-left:auto;}.switch{all:unset;cursor:pointer;font-size:11.5px;color:var(--text-2);padding:2px 8px;border-radius:6px;border:1px solid var(--line);}.switch:hover{color:var(--text);border-color:var(--line2);}.switch:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.switch[aria-pressed='true']{color:var(--text);background:var(--accent-bg);border-color:var(--accent);}.opens{display:inline-flex;gap:6px;margin-left:auto;}.forecast{font-size:12px;color:var(--text-muted);margin:0 0 8px;display:flex;flex-wrap:wrap;align-items:center;gap:4px;}.forecast .expected-mark{display:inline-block;width:18px;height:10px;border:1.5px dotted var(--line2);border-radius:999px;margin-right:4px;}.unawaited{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 8px;}.card .down{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px;}.whole,.whole>.g{display:flex;flex-direction:column;flex:auto;min-height:0;min-width:0;}.whole.side{display:grid;grid-template-columns:minmax(200px,282px) minmax(0,1fr);gap:14px;align-items:start;}.outline{font-size:12px;max-height:70vh;overflow:auto;padding:2px 6px 2px 0;border-right:1px solid var(--line);}.otree,.otree ul{list-style:none;margin:0;padding:0;}.otree ul{padding-left:10px;}.orow{display:grid;grid-template-columns:16px minmax(0,1fr);align-items:start;border-radius:6px;}.orow.sel{background:var(--accent-bg);}.orow.cur .ol{font-weight:600;color:var(--text);}.odisc{all:unset;cursor:pointer;width:16px;text-align:center;color:var(--text-muted);font-size:10px;line-height:22px;}.odisc:focus-visible,.oname:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;border-radius:4px;}.oname{all:unset;cursor:pointer;display:flex;align-items:flex-start;gap:6px;min-width:0;padding:3px 6px 3px 2px;border-radius:6px;color:var(--text-2);}.oname:hover{background:var(--raise);color:var(--text);}.oname .loop-ic{flex:none;color:var(--text-muted);}.ol{flex:1;min-width:0;overflow-wrap:break-word;font-family:var(--mono);line-height:1.35;}.obar{flex:none;width:32px;height:4px;margin-top:6px;border-radius:2px;background:var(--track);overflow:hidden;}.obar i{display:block;height:100%;background:var(--meter);}.ocount{flex:none;font-size:11px;color:var(--text-muted);font-variant-numeric:tabular-nums;}.onote{grid-column:2;display:flex;flex-wrap:wrap;gap:0 8px;padding:0 6px 2px 2px;font-size:11px;}.onote .err{color:var(--status-failed);}.onote .warn{color:var(--status-attention);}.onote .live{color:var(--status-running);}.onote .mut{color:var(--text-muted);}.odet{margin-bottom:8px;}.odet>summary{cursor:pointer;font-size:12px;color:var(--text-2);padding:2px 0;}.odet .outline{border-right:none;max-height:50vh;}`],vf=[cf,A` .node .k-ic{width:16px;height:16px;margin-right:6px;border-radius:4px;font-size:9.5px;}.legend .k-ic{width:14px;height:14px;margin:0;border-radius:4px;font-size:8.5px;}.list .k-ic{width:16px;height:16px;border-radius:4px;font-size:9.5px;}.list .nm .k-ic{margin:0 -2px 0 0;}.matrix thead th.nh .k-ic{width:14px;height:14px;margin-right:5px;border-radius:4px;font-size:8.5px;vertical-align:-2px;}`],yf=e=>Math.max(14,Math.min(60,Math.round(e/34))),bf=e=>Math.max(8,Math.min(16,Math.round(e/105))),xf=(e,t)=>t>0&&t/(180*e)<.6,Sf=`*all`,Cf=`*none`,wf={...mo({nodes:[],clusters:[],edges:[],stubs:[]}),path:[],nodes:[],boxes:[],fns:[],edges:[],stubs:[],units:[]},Tf=class extends P{constructor(...e){super(...e),this.plan={nodes:[],groups:[]},this.forecast=null,this.journal=[],this.run=``,this.live=!1,this.controls=!0,this.layer=``,this.unit=``,this.sel=``,this.down=!1,this.tall=!1,this.sort=`order`,this.missing=``,this.fixLayer=null,this.replacing=!1,this.auto=[],this.segments=[],this.proj=null,this.model=null,this.graph=wf,this.input={series:[],nodes:[],clusters:[],edges:[],stubs:[]},this.prevOrder=void 0,this.matrix=null,this.matrixIn=null,this.orders=new Map,this.links=Sd([]),this.states=Pd(!1),this.locale=``,this.opened=null,this.closed=null,this.memRun=null,this.rev=0,this.budget=40,this.shownOpen=new Set,this.stats=new Map,this.focusToggle=``,this.flowStats=new Map,this.tree=[],this.folds=new Map,this.wide=!0,this.oh=this.outlineHost(),this.lights=()=>new Set,this.refocus=!1,this.cameFrom=``,this.h=this.partsHost(),this.onToggle=e=>this.toggle(e.detail.id,e.detail.open),this.onEscape=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=of(this.segments,this.auto);t&&(e.preventDefault(),this.refocus=!0,this.cameFrom=this.segments[this.segments.length-1]??``,uf(this.h,t))},this.onSelect=e=>lf(this.h,e.detail.id??``),this.onActivate=e=>{let t=jd(this.graph,this.matrix,e.detail.id);t?.type===`mark`?ff(this.h,t.mark,t.node):t?.type===`node`&&df(this.h,t.node)},this.onDrill=e=>{let t=jd(this.graph,this.matrix,e.detail.id);t&&pf(this.h,t)},this.onView=e=>{e.detail.view===`graph`&&this.matrix&&function(e){let t=e.segments[e.segments.length-1]??``,n=of(e.segments,e.auto)??[],r=e.auto.join(`/`);$(e.el,`ca-navigate`,{layer:n.join(`/`)===r?``:n.join(`/`),unit:e.unit,sel:t})}(this.h)},this.current=null,this.unfolded=null,this.items=null,this.selectedOf=null}static{this.styles=_f}static{this.properties={plan:{attribute:!1},forecast:{attribute:!1},journal:{attribute:!1},run:{},live:{type:Boolean},controls:{type:Boolean},layer:{},unit:{},sel:{},down:{state:!0},sort:{state:!0},missing:{state:!0},rev:{state:!0},budget:{state:!0},wide:{state:!0}}}willUpdate(e){if(e.has(`run`)&&this.orders.clear(),e.has(`layer`)&&e.get(`layer`)!==void 0){let e=this.renderRoot instanceof ShadowRoot?this.renderRoot.activeElement:null,t=e?.shadowRoot?.activeElement;this.refocus=e!==null&&!t?.closest(`.views`),this.replacing?this.replacing=!1:this.missing=``}e.has(`run`)&&e.get(`run`)!==void 0&&(this.missing=``),e.has(`plan`)&&(this.links=Sd(this.plan.nodes)),(e.has(`plan`)||e.has(`live`))&&(this.flowStats=md(Iu(this.plan),[],this.live),this.tree=function(e){let t=new Map;for(let n of e.values())(t.get(n.parent)??t.set(n.parent,[]).get(n.parent))?.push(n);let n=e=>{let r=[],i=new Map;for(let a of t.get(e)??[]){let e={id:a.key,type:`fn`,label:Ru(a.name),tip:a.name,layer:a.layer,name:a.name,counts:a.counts,errors:a.errors,kids:n(a.key),parts:[{id:a.key,layer:a.layer,name:a.name}]},t=r;a.loops.forEach((e,n)=>{let r=`${Au}${a.loops.slice(0,n+1).join(`.`)}`,o=`${a.layer.join(`/`)}|${r}`,s=i.get(o);if(!s){let e=a.loops[n];s={id:o,type:`loop`,label:O(D`Loop at ${Bd(e,a.file)}`),tip:a.file?`${a.file}:${e}`:``,layer:a.layer,name:r,counts:{total:0,done:0,partial:0,failed:0,running:0,pending:0,skipped:0,blocked:0,cancelled:0},errors:!1,kids:[],parts:[{id:o,layer:a.layer,name:r}]},i.set(o,s),t.push(s)}for(let e of Object.keys(s.counts))s.counts[e]+=a.counts[e];s.errors||=a.errors,t=s.kids}),t.push(e)}return r};return n(null)}(this.flowStats)),e.has(`run`)&&this.folds.clear();let t=e.has(`sel`)&&!!this.sel&&!rf(this.segments).loop&&!jd(this.graph,this.matrix,this.sel),n=e.has(`plan`)||e.has(`layer`)||e.has(`run`)||e.has(`down`)||e.has(`rev`)||e.has(`budget`)||t;if(n){if(this.auto=nf(this.plan),this.segments=this.layer?this.layer.split(`/`):this.auto,this.layer&&this.plan.nodes.length){let e=af(this.plan,this.segments);e?e.join(`/`)!==this.layer&&(this.segments=e,this.fixLayer=e.join(`/`)===this.auto.join(`/`)?``:e.join(`/`)):(this.missing=this.layer,this.segments=this.auto,this.fixLayer=``)}let{path:e,loop:t}=rf(this.segments);if(t)this.proj=id(this.plan,e),this.model=this.proj.model;else{let t=this.memory(),n=this.openMode(),r=bd(this.plan,e,{open:new Set(t.opened.values().filter(e=>!e.startsWith(`*`))),closed:new Set(t.closed.values()),all:n===`all`,budget:n===`none`?0:this.budget,maxSpan:bf(this.graphWidth()),sel:this.sel,live:this.live});this.proj=null,this.model=r.model,this.shownOpen=r.open,this.stats=r.stats}this.prevOrder=this.orders.get(e.join(`/`))}let r=R(),i=e.has(`journal`)&&this.plan.nodes.some(e=>e.state===`blocked`),a=n||i||e.has(`live`)||e.has(`forecast`)||r!==this.locale;(a||e.has(`sort`))&&this.build(a,r)}build(e,t){let n=this.model;if(!n)return;let r=this.proj,{path:i,loop:a}=rf(this.segments),o={plan:this.plan,journal:this.journal,run:this.run,live:this.live,links:this.links,forecast:this.forecast};if(e){this.locale=t,this.states=Pd(this.live),this.input=Zd(n,o,!a);let e=mo(this.input,this.prevOrder,this.down);this.tall=!this.down&&!a&&xf(go(e).span,this.graphWidth()),this.tall&&(e=mo(this.input,this.prevOrder,!0)),this.graph=ld(n,e),this.orders.set(i.join(`/`),e.order),this.lights=function(e,t,n){let r=n.nodes.flatMap(e=>[...e.units,...e.single].filter(e=>e!==null).map(t=>[Ad(e.id,t),t])),i=new Map(r.map(([e,t])=>[e,t.key])),a=new Map;return n=>{let o=a.get(n);if(o)return o;let s=function(e,t,n){let r=e.filter(e=>e.unit?e.unit===n:e.key===n).map(e=>e.key),i=new Map(r.map(e=>[e,null]));for(let[e,n]of ju.entries()){let a=new Set(ju.slice(0,e+1));for(let e of[t.earlier,t.later]){let t=new Set(r),o=[...r];for(let r=o.pop();r!==void 0;r=o.pop())for(let s of e.get(r)??[])a.has(s.type)&&!t.has(s.key)&&(t.add(s.key),i.has(s.key)||i.set(s.key,n),o.push(s.key))}}return i}(e.nodes,t,i.get(n)??n),c=new Map;for(let[e,t]of r){let n=t.keys.filter(e=>s.has(e)).map(e=>s.get(e)??null);if(!n.length)continue;let r=ju.find(e=>n.includes(e));c.set(e,n.includes(null)||!r?null:od(r))}return a.set(n,c),c}}(this.plan,this.links,this.graph)}let s=a&&r?ef(this.plan,i,a,this.graph.order,this.sort,o,r):null;this.matrix=s?.matrix??null,this.matrixIn=s?.input??null}connectedCallback(){super.connectedCallback(),this.addEventListener(`keydown`,this.onEscape),this.resize=new ResizeObserver(()=>{let e=this.clientWidth,t=e>0&&e<640;t!==this.down&&(this.down=t);let n=e>0?yf(this.graphWidth()):this.budget;n!==this.budget&&(this.budget=n);let r=e===0||e>=1500;r!==this.wide&&(this.wide=r)}),this.resize.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.onEscape),this.resize?.disconnect()}memory(){return this.opened&&this.closed&&this.memRun===this.run||(this.memRun=this.run,this.opened=new qn(`graph-open:${this.run}`,this),this.closed=new qn(`graph-closed:${this.run}`,this)),{opened:this.opened,closed:this.closed}}openMode(){let{opened:e}=this.memory();return e.has(Sf)?`all`:e.has(Cf)?`none`:`auto`}setMode(e){let{opened:t,closed:n}=this.memory();t.clear(),n.clear(),e===`all`&&t.set(Sf,!0),e===`none`&&t.set(Cf,!0),Vn(),this.rev++}placeOfNode(e){let t=this.graph.nodes.find(t=>t.id===e);if(!t||t.type!==`flow`)return null;let n=e.includes(`::`)?e.slice(e.lastIndexOf(`::`)+2):e;return dd(t.layer,n)}toggle(e,t){let n=e.startsWith(`fx::`)?e.slice(4):this.placeOfNode(e);if(!n)return;let{opened:r,closed:i}=this.memory();r.set(n,t),i.set(n,!t),Vn(),this.focusToggle=t?`${ud}${n}`:this.nodeIdOf(n),this.rev++}nodeIdOf(e){let t=this.stats.get(e);if(!t)return``;let n=t.parent;return n!==null&&this.shownOpen.has(n)?`${n}::${t.id}`:t.id}updated(){if(this.focusToggle){let e=this.focusToggle;this.focusToggle=``;let t=this.renderRoot.querySelector(`cae-layered-graph`);t&&t.updateComplete.then(()=>t.focusToggle(e))}if(this.fixLayer!==null){let e=this.fixLayer;this.fixLayer=null,this.replacing=!0,$(this,`ca-navigate`,{layer:e,unit:this.unit,sel:this.sel,replace:!0})}if(this.refocus||this.cameFrom){let e=this.cameFrom;this.refocus=!1,this.cameFrom=``;let t=e.startsWith(`loop:`)?e:this.graph.nodes.find(t=>t.type===`flow`&&t.name===e)?.id??null,n=this.renderRoot.querySelector(`cae-layered-graph`);n&&n.updateComplete.then(()=>n.focusItem(e?t:null))}}render(){if(!this.plan.nodes.length)return j`<div class="blank" style="padding:24px">${this.live?O(`No tasks scheduled yet`):O(`No tasks scheduled`)}</div>`;let e=this.controls&&this.wide&&this.tree.length>0,t=this.controls&&this.tree.length?e?mf(this.oh,this.tree):j`<details class="odet"><summary>${O(`Outline of the flow`)}</summary>${mf(this.oh,this.tree)}</details>`:N;return j`<div class="whole ${e?`side`:``}">${t}<div class="g">${this.renderGraph()}</div></div>`}renderGraph(){let e=jd(this.graph,this.matrix,this.sel),t=this.graph.nodes.some(e=>e.type===`flow`);return j`<cae-layered-graph .graph=${this.input} .states=${this.states} .selected=${this.sel||null} .highlight=${this.unit||null} .order=${this.prevOrder} key=${this.segments.join(`/`)} direction=${this.down||this.tall?`down`:`across`} .matrix=${this.matrixIn} .related=${this.lights} .strings=${function(e,t){let n=`${R()}|${e}|${t}`,r=hf.get(n);return r||hf.set(n,r=function(e,t){let n=O(`Enter: open`);return{graph:O(`Graph`,{id:`view-graph`}),table:O(`Table`,{id:`view-table`}),view:O(`View`),zoomIn:O(`Zoom in`),zoomInTip:O(`Zoom in (Ctrl + scroll)`),zoomOut:O(`Zoom out`),zoomOutTip:O(`Zoom out (Ctrl + scroll)`),showAll:O(`Show all`),graphKeys:[O(`Tab: next node`),O(`Arrow keys: marks`),O(`Shift + arrow keys: earlier and later tasks`),n],tableKeys:[O(`Tab: next row`),n],matrixKeys:[O(`Arrow keys: marks`),n],clearKey:O(`Esc: clear selection`),upKey:e?O(`Esc: up a level`):``,inspector:O(`Selected item`),stubTip:O(`Outside this layer`),more:e=>O(D`+${e}`),badge:O(`Passes`),solidEdge:pl(`given_from`),dottedEdge:pl(`after`),dashedEdge:pl(`created_from`),cycle:O(`Next pass`),drill:O(`Has a level below`),open:O(`Show inside`),close:O(`Hide inside`),iconNames:{agent:O(`agent task`),python:O(`Python task`)},nameHeader:O(t?`Kind or function`:`Kind`),statusHeader:O(`Status`,{id:`status`}),solidHeader:O(`Given output of`),dottedHeader:O(`Runs after`),dashedHeader:O(`Created after`),laterHeader:O(`Later tasks`),none:O(`none`,{id:`none`}),inCluster:e=>O(D`${e} in the loop`),list:e=>Y(e)}}(e,t)),r}(!!of(this.segments,this.auto),t)} .matrixStrings=${function(){let e=R();return gf?.locale!==e&&(gf={locale:e,words:{sortBy:O(`Sort units`),rowsHeader:O(`Unit`)}}),gf.words}()} .renderIcon=${Ef} .iconStyles=${vf} .controls=${this.controls} @cae-select=${this.onSelect} @cae-activate=${this.onActivate} @cae-drill=${this.onDrill} @cae-view-change=${this.onView} @cae-toggle=${this.onToggle} @cae-sort=${e=>this.sort=e.detail.id}>
|
|
433
|
+
<div slot="crumbs">${function(e,t=null){let n=e.segments,r=e.unit;if(!n.length&&!r&&!t)return N;let{path:i,loop:a}=rf(n),o=[...i.map((e,t)=>({name:Ru(e),tip:e,to:i.slice(0,t+1)})),...(a?a.slice(5).split(`.`):[]).map((t,n,r)=>{let a=Au+r.slice(0,n+1).join(`.`),o=e.graph.boxes.find(e=>e.id===a)?.file||e.matrix?.box.file||``,s=/^\d+$/.test(t);return{name:O(s?D`Loop at ${Bd(t,o)}`:`Loop`),tip:s&&o?`${o}:${t}`:``,to:[...i,a]}})];return j`<div class="bar">
|
|
434
|
+
${n.length?j`<nav aria-label=${O(`Pipeline layer`)}>
|
|
435
435
|
<ol class="crumbs">
|
|
436
|
-
<li><button type="button" @click=${()=>
|
|
437
|
-
${o.map((t,n)=>
|
|
438
|
-
${n===o.length-1?
|
|
436
|
+
<li><button type="button" @click=${()=>uf(e,[])}>${O(`Pipeline`)}</button></li>
|
|
437
|
+
${o.map((t,n)=>j`<li><span class="sep" aria-hidden="true">›</span>
|
|
438
|
+
${n===o.length-1?j`<span aria-current="page" title=${t.tip||N}>${t.name}</span>`:j`<button type="button" title=${t.tip||N} @click=${()=>uf(e,t.to)}>${t.name}</button>`}</li>`)}
|
|
439
439
|
</ol>
|
|
440
|
-
</nav>`:
|
|
441
|
-
${r?
|
|
442
|
-
<button type="button" class="switch" @click=${()=>$(e.el,`ca-navigate`,{unit:``})}>${
|
|
443
|
-
${t??
|
|
444
|
-
</div>`}(this.h,
|
|
445
|
-
<span class="meta">${n=t.length,
|
|
446
|
-
${t.map(t=>{let n=e.links.byKey.get(t);return
|
|
447
|
-
</div>`:
|
|
448
|
-
${e?function(e,t){return
|
|
440
|
+
</nav>`:N}
|
|
441
|
+
${r?j`<span class="pin">${O(D`Unit: ${r}`)}
|
|
442
|
+
<button type="button" class="switch" @click=${()=>$(e.el,`ca-navigate`,{unit:``})}>${O(`Clear highlight`)}</button></span>`:N}
|
|
443
|
+
${t??N}
|
|
444
|
+
</div>`}(this.h,rf(this.segments).loop||!this.controls?null:function(e,t){let n=(n,r)=>j`<button type="button" class="switch" aria-pressed=${e===n} @click=${()=>t(e===n?`auto`:n)}>${r}</button>`;return j`<span class="opens">${n(`all`,O(`Show all inside`))}${n(`none`,O(`Hide all inside`))}</span>`}(this.openMode(),e=>this.setMode(e)))}${function(e){if(!e)return N;let t=e.split(`/`),n=t[t.length-1]||e;return j`<div class="missing" role="status" title=${e}>${O(j`No layer <code>${n}</code> in this run`)}</div>`}(this.missing)}${this.segments.join(`/`)===this.auto.join(`/`)?j`${function(e,t){if(!Dd(t))return N;let n=(r=Ed(t,e)).length?O(D`Not in the plan yet: ${Y(r.map(e=>`${e.group} +${e.remaining}`))}`):``;var r,i;return j`<div class="forecast" title=${i=t,O(D`Tasks this run is expected to create and has not yet, from the run ${i.earlier_run} of the same flow (forecast)`)}><span class="expected-mark" aria-hidden="true"></span>${function(e){return J(e.remaining===1?O(`Forecast: 1 more task`):O(D`Forecast: ${e.remaining} more tasks`),e.wall_s?O(D`${H(e.wall_s)} of task time`):``,e.cost_usd!==null&&e.cost_usd!==void 0?cs(e.cost_usd):``)}(t)}${n?j`<span class="sep" aria-hidden="true"> | </span>${n}`:N}</div>`}(this.plan,this.forecast)}${function(e){let t=[...new Set((e.plan.flow_calls??[]).filter(e=>e.parent===null).flatMap(e=>e.unawaited??[]))];return t.length?j`<div class="unawaited" title=${O(`Tasks whose result no flow awaited, ordered a task after or returned (unawaited); they ran for their output files and changes`)}>
|
|
445
|
+
<span class="meta">${n=t.length,O(n===1?`1 task not awaited`:D`${n} tasks not awaited`)}</span>
|
|
446
|
+
${t.map(t=>{let n=e.links.byKey.get(t);return Vl(e.el,n?X(n):t,n??{key:t})})}
|
|
447
|
+
</div>`:N;var n}(this.h)}`:N}</div>
|
|
448
|
+
${e?function(e,t){return j`<div slot="inspector" class="card">${function(e,t){let n=(e,t)=>j`<dt>${e}</dt><dd>${t}</dd>`,r=(e,t,n=!1)=>j`<button type="button" class="go ${n?`primary`:``}" @click=${t}>${e}</button>`,i=j`<button type="button" class="switch" @click=${()=>lf(e,``)}>${O(`Clear selection`)}</button>`,a=e=>e.length?Y(e):O(`none`,{id:`none`});if(t.type===`box`){let a=t.box,o=Bd(a.loop,a.file);return j`<h4 title=${a.file?`${a.file}:${a.loop}`:N}>${To(16)}${O(D`Loop at ${o}`)}</h4>
|
|
449
449
|
<dl>
|
|
450
|
-
${n(
|
|
451
|
-
${a.spread.length>1?n(
|
|
450
|
+
${n(O(`Passes`),As(a.passes))}
|
|
451
|
+
${a.spread.length>1?n(O(`Units by number of passes`),Ms(a.spread)):N}
|
|
452
452
|
</dl>
|
|
453
|
-
<div class="acts">${r(
|
|
454
|
-
${r.length?e(
|
|
455
|
-
${i.length?e(
|
|
456
|
-
<div class="sub">${
|
|
453
|
+
<div class="acts">${r(O(D`Passes of the loop at ${o}`),()=>pf(e,t),!0)}${i}</div>`}if(t.type===`node`){let o=t.node,s=o.counts,{given:c,order:l,created:u,feeds:d}=Ud(o,e.graph),f=function(e,t,n,r,i){let a=!n.length&&!r.length&&!i.length;return j`${n.length||a?e(O(`Given output of`),t(n)):N}
|
|
454
|
+
${r.length?e(O(`Runs after`),t(r)):N}
|
|
455
|
+
${i.length?e(O(`Created after`),t(i)):N}`}(n,a,c,l,u),p=zd(o,e.live).map(([e,t])=>j`<div class=${e}>${t}</div>`);return o.type===`flow`?j`<h4 title=${o.name}>${Eo()}${o.label}</h4>
|
|
456
|
+
<div class="sub">${O(`Function`)}</div>
|
|
457
457
|
<dl>
|
|
458
|
-
${n(
|
|
459
|
-
${o.timeBox?n(
|
|
460
|
-
${n(
|
|
458
|
+
${n(O(`Flow calls`),o.calls)}
|
|
459
|
+
${o.timeBox?n(O(`Deadline`),j`<span title=${Tc()}>${function(e){let t=e.finishing_kinds??[];return J(H(e.deadline_s),e.grace_s&&t.length?O(D`finishing time ${H(e.grace_s)}`):``,t.length?O(D`finishing kinds: ${Y(t)}`):``)}(o.timeBox)}</span>`):N}
|
|
460
|
+
${n(O(`Tasks`,{id:`tasks`}),j`${Ld(s)}${p}`)}
|
|
461
461
|
${f}
|
|
462
|
-
${n(
|
|
462
|
+
${n(O(`Later tasks`),a(d))}
|
|
463
463
|
</dl>
|
|
464
|
-
<div class="acts">${r(
|
|
465
|
-
<div class="sub">${
|
|
464
|
+
<div class="acts">${r(O(D`Inside ${o.label}`),()=>pf(e,t),!0)}${i}</div>`:j`<h4>${o.executor&&o.executor!==`mixed`?sf(o.executor===`python`):N}${o.label}</h4>
|
|
465
|
+
<div class="sub">${Vd(o)}</div>
|
|
466
466
|
<dl>
|
|
467
|
-
${o.kinds.length>1?n(
|
|
468
|
-
${n(
|
|
467
|
+
${o.kinds.length>1?n(O(`Kinds`),Y(o.kinds)):N}
|
|
468
|
+
${n(O(`Tasks`,{id:`tasks`}),j`${Ld(s)}${p}`)}
|
|
469
469
|
${f}
|
|
470
|
-
${n(
|
|
470
|
+
${n(O(`Later tasks`),a(d))}
|
|
471
471
|
</dl>
|
|
472
|
-
<div class="acts">${r(
|
|
472
|
+
<div class="acts">${r(O(D`Tasks of ${o.label}`),()=>pf(e,t),!0)}${i}</div>`}let{node:o,mark:s,passes:c}=t,l=s.flow||s.count!==1?void 0:e.links.byKey.get(s.key),u=X({kind:l?.kind??o.label,unit:s.unit}),f=s.flow||s.state!==`blocked`?``:qd(e)(s.key),p=j`<span data-status class=${s.state===`failed`?`err`:s.state===`blocked`||s.state===`partial`?`warn`:``}>${Fd(s.state,e.live)}</span>`,m=Pd(e.live)[s.state],h=j`<h4 title=${s.flow?O(D`Flow call ${s.key}`):s.key}><i class="mark" data-tone=${z(m?.tone)} data-shape=${m?.shape??N} aria-hidden="true"></i>${u}</h4>`,g=c.length?Y(c.map(ks)):s.passes?js(s.passes):``;if(s.flow){let a=s.counts;return j`${h}
|
|
473
473
|
<dl>
|
|
474
|
-
${n(
|
|
475
|
-
${g?n(
|
|
476
|
-
${s.deadlineAt?n(
|
|
477
|
-
${a?n(
|
|
478
|
-
${s.error===void 0?
|
|
479
|
-
${function(e,t,n){let r=e.plan.flow_calls?.find(e=>e.id===n);if(!r||r.state!==`raised`)return
|
|
474
|
+
${n(O(`Status`,{id:`status`}),p)}
|
|
475
|
+
${g?n(O(`Pass`),g):N}
|
|
476
|
+
${s.deadlineAt?n(O(`Deadline`),j`<span title=${Tc()}>${_=s.deadlineAt,q(_,!0)}</span>`):N}
|
|
477
|
+
${a?n(O(`Tasks`,{id:`tasks`}),j`${Ld(a)}${Rd(a,e.live).map(e=>j`<div>${e}</div>`)}`):N}
|
|
478
|
+
${s.error===void 0?N:n(O(`Error`),j`<span class="err">${s.error||O(`Flow call stopped with an error`)}</span>`)}
|
|
479
|
+
${function(e,t,n){let r=e.plan.flow_calls?.find(e=>e.id===n);if(!r||r.state!==`raised`)return N;let i=r.raised_by?e.links.byKey.get(r.raised_by):void 0,a=i?X(i):r.raised_by??``,o=function(e,t,n=``){let r=yl(e,n);return t?O(r?D`Stopped at ${r} by the failure of ${t}`:D`Stopped by the failure of ${t}`):r?O(D`Stopped at ${r}`):``}(r,a,e.run);return o?t(O(`Stopped`,{id:`flow-call-stopped`}),j`<div>${o}</div>${r.raised_by?j`<div class="down">${Vl(e.el,a,i??{key:r.raised_by})}</div>`:N}`):N}(e,n,s.key)}
|
|
480
480
|
</dl>
|
|
481
|
-
<div class="acts">${r(
|
|
481
|
+
<div class="acts">${r(O(D`Inside ${Ru(s.flow)}`),()=>pf(e,t),!0)}${i}</div>`}var _;let v=new Set(s.keys),y=e.journal.filter(e=>v.has(e.key)).filter(d),b=y.map(e=>e.cost_usd).filter(e=>typeof e==`number`),x=y.reduce((e,t)=>e+(t.wall_s??0),0);return j`${h}
|
|
482
482
|
<dl>
|
|
483
|
-
${n(
|
|
484
|
-
${g?n(
|
|
485
|
-
${s.count>1?n(
|
|
486
|
-
${n(
|
|
487
|
-
${n(
|
|
488
|
-
${n(
|
|
489
|
-
${l?function(e,t,n){let r=(e.plan.flow_calls??[]).filter(e=>e.raised_by===n);return r.length?t(
|
|
483
|
+
${n(O(`Status`,{id:`status`}),f?j`${p}<div>${f}</div>`:p)}
|
|
484
|
+
${g?n(O(`Pass`),g):N}
|
|
485
|
+
${s.count>1?n(O(`Tasks`,{id:`tasks`}),O(D`${s.count} tasks`)):N}
|
|
486
|
+
${n(O(`Attempts`),y.length||O(`none`,{id:`none`}))}
|
|
487
|
+
${n(O(`Time`),y.length?H(x):O(`none`,{id:`none`}))}
|
|
488
|
+
${n(O(`Cost`),b.length?cs(b.reduce((e,t)=>e+t,0)):`—`)}
|
|
489
|
+
${l?function(e,t,n){let r=(e.plan.flow_calls??[]).filter(e=>e.raised_by===n);return r.length?t(O(`Stopped`,{id:`flow-call-stopped`}),r.map(t=>j`<div>${bl(t,e.run)}</div>`)):N}(e,n,l.key):N}
|
|
490
490
|
</dl>
|
|
491
|
-
<div class="acts">${r(
|
|
492
|
-
</cae-layered-graph>`}graphWidth(){let e=this.clientWidth||1200;return this.controls&&this.tree.length&&e>=1500?e-300:e}currentKeys(){let{path:
|
|
493
|
-
<div class="drv-ic" data-tone=${
|
|
491
|
+
<div class="acts">${r(O(`Task detail`),()=>pf(e,t),!0)}${o.kinds.length===1?r(O(D`Tasks of ${o.label}`),()=>df(e,o)):N}${i}</div>`}(e,t)}</div>`}(this.h,e):N}
|
|
492
|
+
</cae-layered-graph>`}graphWidth(){let e=this.clientWidth||1200;return this.controls&&this.tree.length&&e>=1500?e-300:e}currentKeys(){let e=this.current;if(e&&e.segments===this.segments&&e.stats===this.flowStats)return e.keys;let{path:t}=rf(this.segments),n=new Set;for(let e of this.flowStats.values()){let r=e.layer.length;r<t.length&&Lu(t,e.layer)&&t[r]===e.name&&n.add(e.key)}return this.current={segments:this.segments,stats:this.flowStats,keys:n},n}unfoldedKeys(){let e=this.currentKeys(),t=this.selectedItem(),n=this.unfolded;if(n&&n.current===e&&n.open===this.shownOpen&&n.selected===t)return n.want;let r=new Set([...e,...this.shownOpen,t]);return this.unfolded={current:e,open:this.shownOpen,selected:t,want:r,holds:new Map},r}itemById(e){if(this.items?.tree!==this.tree){let e=new Map,t=n=>{for(let r of n)e.has(r.id)||e.set(r.id,r),t(r.kids)};t(this.tree),this.items={tree:this.tree,byId:e}}return this.items.byId.get(e)}selectedItem(){let e=this.selectedOf;if(e&&e.sel===this.sel&&e.graph===this.graph)return e.item;let t=this.findSelectedItem();return this.selectedOf={sel:this.sel,graph:this.graph,item:t},t}findSelectedItem(){let e=this.sel;if(!e)return``;if(e.startsWith(`fx::`))return e.slice(4);let t=e.split(`#`)[0]??``;if(this.graph.nodes.find(e=>e.id===t)?.type===`flow`)return this.placeOfNode(t)??``;let n=this.graph.boxes.find(e=>e.id===t);return n?`${n.layer.join(`/`)}|${n.local}`:``}drawnId(e){let{path:t}=rf(this.segments);if(e.layer.length<t.length||!Lu(e.layer,t))return null;let n=[];for(let r=this.flowStats.get(e.type===`fn`?this.flowStats.get(e.id)?.parent??``:this.containerKey(e)??``);r&&r.layer.length>=t.length;r=this.flowStats.get(r.parent??``))n.unshift(r.key);let r=n[n.length-1]??``;if(e.type===`fn`){let t=this.flowStats.get(e.id);return t?this.shownOpen.has(e.id)?{id:`${ud}${e.id}`,open:n}:{id:r?`${r}::${t.id}`:t.id,open:n}:null}return{id:r?`${r}::${e.name}`:e.name,open:n}}containerKey(e){let{path:t}=rf(this.segments);if(e.layer.length===t.length)return``;for(let t of this.flowStats.values())if([...t.layer,t.name].join(`/`)===e.layer.join(`/`))return t.key;return null}outlineHost(){let e=this;return{get live(){return e.live},expanded(t){let n=e.folds.get(t);if(n!==void 0)return n;let r=e.unfoldedKeys(),i=e.unfolded?.holds??new Map,a=e=>{let t=i.get(e);return t===void 0&&i.set(e,t=r.has(e.id)||e.kids.some(a)),t},o=e.itemById(t);return!!o&&(e.tree.includes(o)||a(o))},expand(t,n){e.folds.set(t,n),e.requestUpdate()},current:t=>e.currentKeys().has(t),here:t=>{let{path:n}=rf(e.segments),r=e.flowStats.get(t);return!!r&&r.layer.length===n.length-1&&Lu(n,[...r.layer,r.name])},selected:t=>!!t&&e.selectedItem()===t,pick(t){let n=e.drawnId(t);if(!n){let n=t.type===`fn`?e.flowStats.get(t.id)?.id??``:t.name;$(e,`ca-navigate`,{layer:t.layer.join(`/`)===e.auto.join(`/`)?``:t.layer.join(`/`),unit:e.unit,sel:n});return}let{opened:r,closed:i}=e.memory(),a=!1;for(let t of n.open)e.shownOpen.has(t)||(a=!0),r.set(t,!0),i.set(t,!1);a&&e.rev++,lf(e.h,n.id)},enter(t){let n=t.parts[t.parts.length-1]??t;uf(e.h,[...n.layer,n.name])}}}partsHost(){let e=this;return{el:e,get plan(){return e.plan},get journal(){return e.journal},get run(){return e.run},get live(){return e.live},get sel(){return e.sel},get unit(){return e.unit},get segments(){return e.segments},get auto(){return e.auto},get graph(){return e.graph},get matrix(){return e.matrix},get links(){return e.links}}}};Tf=G([F(`ca-pipeline-graph`),k()],Tf);var Ef=e=>sf(e===`python`);function Df(e){if(!e||e.policy===`off`)return[];let t=[...(e.stopped??[]).map(e=>({label:al(),text:e,tone:`failed`,tip:``})),...(e.kept??[]).map(e=>({label:al(),text:J(e.kind,nl(e.agent,e.model),e.reason),tone:`attention`,tip:O(`A kind with no available model, run on its own model (kept)`)})),...(e.substituted??[]).map(e=>({label:O(`Model replaced`),text:il(e),tone:`attention`,tip:O(`A kind with no available model, run on the first model that answered (substitute)`)})),...(e.dropped??[]).map(e=>({label:O(`Unavailable`),text:rl(e),tone:`muted`,tip:``}))];return t.length?t:[{label:``,text:O(`all models available`),tone:`neutral`,tip:``}]}var Of={failed:`✕`,attention:`◌`,done:`✓`,running:``,muted:`■`,neutral:`■`},kf=class extends P{constructor(...e){super(...e),this.procs=null,this.plan={nodes:[],groups:[]}}static{this.styles=[U,Kr,A` :host{display:block;}.drv{display:flex;gap:14px;align-items:flex-start;}.drv-ic{width:42px;height:42px;border-radius:12px;flex:none;display:grid;place-items:center;font-size:16px;background:var(--raise);color:var(--text-muted);}.drv.on .drv-ic{background:var(--status-running-bg);box-shadow:0 0 0 1px color-mix(in srgb,var(--status-running) 35%,transparent),0 0 22px var(--status-running-bg);}.drv-ic[data-tone]{color:var(--tone);font-weight:700;}.drv-ic[data-tone='failed'],.drv-ic[data-tone='attention']{background:var(--tone-bg);}.drv.on .drv-ic .spin{width:18px;height:18px;}.drv-t{font-size:15px;font-weight:600;}.drv-up{font-family:var(--mono);font-size:12px;color:var(--status-running);margin-left:6px;font-weight:400;}.drv-cmd{margin-top:8px;}.drv-cmd summary{cursor:pointer;font-size:11px;color:var(--text-muted);}.pf{margin-top:10px;font-size:12px;}.pf-h{color:var(--text-muted);font-size:11px;margin-bottom:4px;}.pf-rows{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:3px 12px;margin:0;}.pf-rows dt{color:var(--text-muted);}.pf-rows dt[data-tone]{color:var(--tone);}.pf-rows dd{margin:0;color:var(--text-2);overflow-wrap:anywhere;}.drv-cmd code{display:block;margin-top:4px;white-space:pre-wrap;word-break:break-all;color:var(--text-2);max-height:120px;overflow:auto;}`]}stateTitle(){if(this.plan.preflight?.stopped?.length)return[O(`Ended before the first agent session`),`failed`];if(!this.plan.nodes.length)return[O(`Not running`),`neutral`];let e=function(e){let t=(...t)=>e.nodes.filter(e=>t.includes(e.state)).length;return{done:t(`done`),partial:t(`partial`),skipped:t(`skipped`),cancelled:t(`cancelled`),failed:t(`failed`),notStarted:t(`blocked`),left:t(`pending`,`running`)}}(this.plan);return e.failed?[e.failed===1?O(`Finished with 1 task failed`):O(D`Finished with ${e.failed} tasks failed`),`failed`]:e.left?[e.left===1?O(`Finished with 1 task not done`):O(D`Finished with ${e.left} tasks not done`),`attention`]:e.notStarted?[e.notStarted===1?O(`Finished with 1 task not started`):O(D`Finished with ${e.notStarted} tasks not started`),`attention`]:[O(`Finished`),`done`]}render(){let e=this.procs,t=this.summary;if(!e?.alive){let e=w(t)===`unresponsive`,[r,i]=e?[is(gc()),`attention`]:this.stateTitle();return j`<div class="drv off">
|
|
493
|
+
<div class="drv-ic" data-tone=${z(i)} aria-hidden="true">${Of[i]}</div>
|
|
494
494
|
<div>
|
|
495
|
-
<div class="drv-t tone-text" data-tone=${i===`done`?
|
|
496
|
-
<div class="meta">${
|
|
495
|
+
<div class="drv-t tone-text" data-tone=${i===`done`?N:z(i)}>${r}</div>
|
|
496
|
+
<div class="meta">${J(this.plan.preflight?.stopped?.length?(n=this.plan.preflight.stopped,O(D`No available model for ${Y(n)}`)):``,e?vc(this.host):``,O(t?.last_ts?e?D`Last activity ${q(t.last_ts,!0)}`:D`Ended ${q(t.last_ts,!0)}`:`No activity`),t?.run_group&&t.run_group!==ne(t)?O(D`Run group ${t.run_group}`):``,e?yc(t?.host_id??``):``)}</div>
|
|
497
497
|
${this.preflight()}
|
|
498
498
|
</div>
|
|
499
|
-
</div>`}var n;let r=Date.parse(e.started_at),i=Fr.at(`drv:${e.pid??``}`,Number.isNaN(r)?1:(Date.now()-r)/1e3),a=[[
|
|
499
|
+
</div>`}var n;let r=Date.parse(e.started_at),i=Fr.at(`drv:${e.pid??``}`,Number.isNaN(r)?1:(Date.now()-r)/1e3),a=[[O(`PID`),e.pid??`—`],...t&&e.run_group===ne(t)?[]:[[O(`Run group`),e.run_group]],[O(`Running at once (limit)`),e.max_workers||`—`],[O(`Started`),q(e.started_at,!0)]];return j`<div class="drv on">
|
|
500
500
|
<div class="drv-ic"><span class="spin"></span></div>
|
|
501
501
|
<div style="min-width:0">
|
|
502
|
-
<div class="drv-t">${
|
|
503
|
-
<div class="drv-facts">${a.map(([e,t])=>
|
|
502
|
+
<div class="drv-t">${O(`Running`)} <cae-elapsed class="drv-up" .since=${i}></cae-elapsed></div>
|
|
503
|
+
<div class="drv-facts">${a.map(([e,t])=>j`<span><i>${e}</i>${t}</span>`)}</div>
|
|
504
504
|
${this.preflight()}
|
|
505
|
-
<details class="drv-cmd"><summary>${
|
|
505
|
+
<details class="drv-cmd"><summary>${O(`Command line`)}</summary><code>${e.argv.join(` `)}</code></details>
|
|
506
506
|
</div>
|
|
507
|
-
</div>`}preflight(){let e=this.plan.preflight,t=
|
|
508
|
-
<div class="pf-h" title=${n=e.policy,
|
|
507
|
+
</div>`}preflight(){let e=this.plan.preflight,t=Df(e);return e&&t.length?j`<div class="pf">
|
|
508
|
+
<div class="pf-h" title=${n=e.policy,O(D`One request to each model before the first agent session (preflight, policy ${n})`)}>${O(`Model availability`)}</div>
|
|
509
509
|
<dl class="pf-rows">
|
|
510
|
-
${t.map(e=>
|
|
510
|
+
${t.map(e=>j`<dt data-tone=${z(e.tone)} title=${e.tip||N}>${e.label}</dt><dd class="jmono">${e.text}</dd>`)}
|
|
511
511
|
</dl>
|
|
512
|
-
</div>`:
|
|
513
|
-
`)}let i=
|
|
514
|
-
`)}function
|
|
515
|
-
${
|
|
512
|
+
</div>`:N;var n}};G([I({attribute:!1})],kf.prototype,`procs`,void 0),G([I({attribute:!1})],kf.prototype,`summary`,void 0),G([I({attribute:!1})],kf.prototype,`plan`,void 0),G([I({attribute:!1})],kf.prototype,`host`,void 0),kf=G([F(`ca-run-driver`),k()],kf),V(`cae-lanes`,ba);var Af=216e5,jf=e=>Or(R(),!1).format(new Date(e));function Mf(){return{py:{label:O(`Python task`),color:`var(--meter)`},llm:{label:O(`Agent task`),color:`var(--agent)`},run:{label:O(`running`),color:`var(--status-running)`,pattern:`striped`,group:1},bad:{label:O(`failed`),color:`var(--status-failed)`,pattern:`hatched`,group:1},idle:{label:O(`not started`),color:`var(--line2)`,pattern:`outline`,group:1}}}function Nf(e,t,n,r){if(!d(e)){let t=n.get(e.key),i=e.stop===`invalid_input`&&t?ws(t,n,r):``;return[X(e),i?O(D`Not started: ${i}`):Ss(e.stop,e.reason),e.key].join(`
|
|
513
|
+
`)}let i=rc(e.hops,null,e.skipped_hops),a=e.reason&&!e.ok?E(e.reason,r):``;return[X(e),J(Ss(e.stop),H(e.wall_s),O(D`ended ${jf(t)}`)),i?O(D`Model switch: ${i}`):e.model?O(D`Model ${e.model}`):``,a,e.key].filter(Boolean).join(`
|
|
514
|
+
`)}var Pf=new WeakMap;function Ff(e,t,n,r){let i=function(e,t,n){let r=R(),i=Pf.get(e);if(i&&i.outcomes===t&&i.run===n&&i.locale===r)return i.bars;let a=[];return e.forEach((e,r)=>{if(!e.ts)return;let i=Date.parse(e.ts);if(Number.isNaN(i))return;let o=d(e)?e.ok?T(e)?`py`:`llm`:`bad`:`idle`;a.push({lane:e.kind||`?`,bar:{id:`j${r}`,style:o,start:i-1e3*(e.wall_s||0),end:i,label:Nf(e,i,t,n)}})}),Pf.set(e,{outcomes:t,run:n,locale:r,bars:a}),a}(e,n,r);if(!i.length&&!t.length)return null;let a=-1/0;for(let e of i)a=Math.max(a,e.bar.end);for(let e of t)a=Math.max(a,e.t0);let o=i.filter(e=>e.bar.end>=a-Af),s=i.length-o.length;t.forEach((e,t)=>o.push({lane:e.kind,bar:{id:`live${t}`,style:`run`,start:e.t0,end:null,label:`${e.kind}\n${O(`running`)}`}}));let c=new Map;for(let{lane:e,bar:t}of[...o].sort((e,t)=>e.bar.start-t.bar.start))(c.get(e)??c.set(e,[]).get(e)).push(t);return{lanes:[...c].map(([e,t])=>({id:e,label:e,bars:t})),omitted:s}}var If=class extends P{constructor(...e){super(...e),this.journal=[],this.plan=null,this.procs=null,this.live=!1,this.run=``}static{this.styles=[U,A`:host{display:block;}`]}render(){let e=Date.now(),t=this.live?ue(this.procs).map(t=>({kind:t.kind,cls:t.cls,t0:Fr.at(t.id,t.ageS,e)})):[],n=Ff(this.journal,t,S(this.journal,this.plan).outcomes,this.run);return n?ko(this.run,j`<cae-lanes .lanes=${n.lanes} .barStyles=${Mf()} .omitted=${n.omitted} ?live=${this.live} locale=${R()} .strings=${{omitted:e=>O(e===1?`1 older attempt not shown`:D`${e} older attempts not shown`)}}></cae-lanes>`):j`<div class="blank" style="padding:28px"><span class="ic" aria-hidden="true">⏱</span>${this.live?O(`No finished attempts yet`):O(`No finished attempts`)}</div>`}};G([I({attribute:!1})],If.prototype,`journal`,void 0),G([I({attribute:!1})],If.prototype,`plan`,void 0),G([I({attribute:!1})],If.prototype,`procs`,void 0),G([I({type:Boolean})],If.prototype,`live`,void 0),G([I()],If.prototype,`run`,void 0),If=G([F(`ca-timeline`),k()],If);var Lf=class extends P{constructor(...e){super(...e),this.procs=null,this.live=!1}static{this.styles=[U,A` :host{display:block;container-type:inline-size;}.wks{display:grid;grid-template-columns:repeat(var(--n,3),minmax(0,1fr));gap:10px;}@container (max-width:860px){.wks{grid-template-columns:repeat(2,minmax(0,1fr));}}@container (max-width:360px){.wks{grid-template-columns:minmax(0,1fr);}}.wk{border-radius:11px;padding:10px 12px;border:1px solid var(--line);background:color-mix(in srgb,var(--text) 2.5%,transparent);min-width:0;position:relative;overflow:hidden;display:block;width:100%;color:inherit;text-align:start;}.wk>.meta{display:block;}.wk.py,.wk.llm{border-color:var(--line2);}.wk.llm{box-shadow:inset 3px 0 0 -1px color-mix(in srgb,var(--agent) 60%,transparent);cursor:pointer;}.wk.llm:hover{border-color:var(--accent);}.wk.idle{opacity:0.45;border-style:dashed;}.wk-top{display:flex;align-items:center;gap:8px;min-width:0;}.wk-top b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.wk-ic{width:24px;height:24px;border-radius:7px;flex:none;display:grid;place-items:center;background:var(--raise);font-size:12px;}.wk.llm .wk-ic{color:var(--agent);}.wk.py .wk-ic{color:var(--text-muted);}.wk-el{margin-left:auto;font-family:var(--mono);font-size:11.5px;color:var(--status-running);}.wk-bar{position:absolute;left:0;right:0;bottom:0;height:2px;overflow:hidden;}.wk-bar i{position:absolute;top:0;bottom:0;left:-30%;width:30%;background:linear-gradient(90deg,transparent,var(--status-running),transparent);animation:scan 1.8s linear infinite;}`]}render(){let e=this.live?ue(this.procs):[],t=Math.max(this.procs?.max_workers||1,e.length),n=Array.from({length:t-e.length},(e,t)=>t);return j`<div class="wks" style="--n:${Math.min(t,6)}">
|
|
515
|
+
${W(e,e=>e.id,e=>{let t=j`<span class="wk-top">${sf(e.cls!==`llm`,e.cls===`llm`?O(`Agent task`):O(`Python task`),`wk-ic`)}<b>${e.kind}</b>
|
|
516
516
|
<cae-elapsed class="wk-el" .since=${Fr.at(e.id,e.ageS)}></cae-elapsed></span>
|
|
517
517
|
<span class="meta">${e.detail}</span>
|
|
518
|
-
<span class="wk-bar"><i></i></span>`;return e.key?
|
|
519
|
-
${n.map(()=>
|
|
520
|
-
</div>`}};
|
|
518
|
+
<span class="wk-bar"><i></i></span>`;return e.key?j`<button type="button" class="wk ${e.cls}" @click=${()=>$(this,`ca-open-task`,{key:e.key})}>${t}</button>`:j`<div class="wk ${e.cls}">${t}</div>`})}
|
|
519
|
+
${n.map(()=>j`<div class="wk idle"><div class="wk-top"><b>${O(`Idle`)}</b></div></div>`)}
|
|
520
|
+
</div>`}};G([I({attribute:!1})],Lf.prototype,`procs`,void 0),G([I({type:Boolean})],Lf.prototype,`live`,void 0),Lf=G([F(`ca-workers`),k()],Lf);var Rf=[`invalid`,`refused`,`failed`,`running`,`pending`,`valid`];function zf(e){if(e.title)return e.title;if(e.type===`tiles`){let t=e.tiles[0];return t?`${t.label}: ${String(t.value)}`:``}if(e.type===`blocks`)for(let t of e.blocks){let e=fe(t),n=e?zf(e):``;if(n)return n}return``}function Bf(e){if(e===void 0)return O(`Loading…`);let t=fe(e);if(t)return zf(t);if(typeof e!=`object`||!e)return JSON.stringify(e);let n=Object.keys(e);if(!n.length)return O(`none`,{id:`none`});let r=`${n.slice(0,4).join(`, `)}${n.length>4?`, …`:``}`;return O(Array.isArray(e)?D`${n.length} items: ${r}`:D`${n.length} keys: ${r}`)}var Vf=class extends P{constructor(...e){super(...e),this.run=``,this.layer=``,this.unit=``,this.sel=``}static{this.styles=[U,A` :host{display:block;container-type:inline-size;}.ov{display:flex;flex-direction:column;gap:14px;}.band.status{display:grid;gap:14px;align-items:stretch;}.stack{display:flex;flex-direction:column;gap:14px;min-width:0;}.stack>.panel:first-child{flex:1;}.band.parts{display:grid;gap:14px;align-items:stretch;grid-template-columns:repeat(auto-fit,minmax(min(100%,max(440px,calc((100% - 14px) / 2))),1fr));}@container (min-width:894px){.band.parts>.panel:last-child:nth-child(odd){grid-column:1 / -1;}}.stack{grid-area:stack;}.problems{grid-area:problems;}.outputs{grid-area:outputs;}.row{grid-area:running;}.band.status{grid-template-areas:'stack' 'problems' 'outputs' 'running';}@container (min-width:760px){.band.status{grid-template-columns:minmax(240px,1fr) minmax(0,1.4fr);grid-template-areas:'stack problems' 'outputs outputs' 'running running';}}@container (min-width:1100px){.band.status{grid-template-columns:minmax(240px,1fr) minmax(0,1.3fr) minmax(0,1.3fr);grid-template-areas:'stack problems outputs' 'running running running';}}.ok{display:flex;align-items:baseline;gap:6px;color:var(--text-2);}.ok span[aria-hidden]{color:var(--status-done);}.ofl{grid-template-columns:minmax(0,1fr) auto;}.ofl>b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.ofl>.meta{overflow:hidden;text-overflow:ellipsis;}.ofl>.meta:last-child{grid-column:1 / -1;}.ogroup + .ogroup,.ogroup + .ct-row{margin-top:10px;}h3 a.hl{color:inherit;text-decoration:none;}h3 a.hl:hover{color:var(--accent);text-decoration:underline;}.ct-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px;}.pcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(320px,100%),1fr));gap:12px;}.pcard{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 12px;align-items:start;padding:12px 14px;border-radius:10px;background:var(--raise);border:1px solid var(--line);cursor:pointer;transition:border-color 0.15s,transform 0.15s;text-align:left;color:inherit;font:inherit;width:100%;min-width:0;}.pcard>div{min-width:0;}.pcard .meta{overflow-wrap:anywhere;}.pcard:hover{border-color:var(--accent);transform:translateY(-1px);}.pc-ic{width:34px;height:34px;display:grid;place-items:center;border-radius:9px;background:var(--well);color:var(--text-2);font-size:16px;}.pc-peek{font-family:var(--mono);font-size:11.5px;color:var(--text-2);margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pc-go{grid-column:2;color:var(--accent);font-size:12px;opacity:0.8;margin-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pcard:hover .pc-go{opacity:1;}.cur-units{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:8px 14px;}.cu{display:grid;grid-template-columns:90px 1fr 70px auto;gap:8px;align-items:center;}.cu-bar{height:5px;border-radius:3px;background:var(--track);overflow:hidden;}.cu-bar i{display:block;height:100%;background:var(--meter);}.fl>div.meta{grid-column:1 / 4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.ofl>.meta{white-space:nowrap;}.stopped{grid-column:1 / 4;color:var(--text-muted);font-size:11px;display:flex;flex-wrap:wrap;align-items:center;gap:4px;}.fl.muted{opacity:0.7;}.recovered{margin-top:8px;padding-top:6px;border-top:1px solid var(--line);}.more{font-size:12px;margin:6px 10px 0;}`]}go(e){$(this,`ca-navigate`,{tab:e})}open(e){$(this,`ca-open-task`,{key:e.key,...T(e)?{view:`output`}:{}})}render(){let e=this.state,t=le(e,this.summary),n=t?ue(e.procs).length:0,r=e.procs?.max_workers||null,i=this.info.panels.filter(pe),a=t&&n>0;return j`<div class="ov">
|
|
521
521
|
<div class="band status">
|
|
522
522
|
<div class="stack">
|
|
523
523
|
<section class="panel enter">
|
|
524
|
-
<h3>${
|
|
524
|
+
<h3>${O(`Run`)}</h3>
|
|
525
525
|
<ca-run-driver .procs=${e.procs} .summary=${this.summary} .plan=${e.plan} .host=${this.host}></ca-run-driver>
|
|
526
526
|
</section>
|
|
527
|
-
${t&&!a?this.runningCard(t,n,r):
|
|
527
|
+
${t&&!a?this.runningCard(t,n,r):N}
|
|
528
528
|
</div>
|
|
529
529
|
<section class="panel enter problems">
|
|
530
|
-
<h3>${
|
|
531
|
-
<span class="r"><a class="lnk" href="#" @click=${e=>this.nav(e,()=>$(this,`ca-navigate`,{tab:`journal`,stop:`bad`}))}>${
|
|
530
|
+
<h3>${O(`Problems`)}
|
|
531
|
+
<span class="r"><a class="lnk" href="#" @click=${e=>this.nav(e,()=>$(this,`ca-navigate`,{tab:`journal`,stop:`bad`}))}>${O(`Failed attempts in history`)}</a></span></h3>
|
|
532
532
|
${this.problems()}
|
|
533
533
|
</section>
|
|
534
534
|
<section class="panel enter outputs">
|
|
535
|
-
<h3 title=${
|
|
535
|
+
<h3 title=${O(`Checked files (OutputContract, InputContract)`)}><a class="hl" href="#" @click=${e=>this.nav(e,()=>this.go(`outputs`))}>${O(`Outputs`)}</a></h3>
|
|
536
536
|
${this.outputs()}
|
|
537
537
|
</section>
|
|
538
|
-
${a?
|
|
538
|
+
${a?j`<div class="row">${this.runningCard(t,n,r)}</div>`:N}
|
|
539
539
|
</div>
|
|
540
540
|
<section class="panel enter">
|
|
541
|
-
<h3 title=${
|
|
542
|
-
${t?
|
|
541
|
+
<h3 title=${O(`Every task the run scheduled, by kind (plan.jsonl)`)}>${O(`Pipeline`)}
|
|
542
|
+
${t?j`<span class="r">${this.progressLine()}</span>`:N}</h3>
|
|
543
543
|
<ca-pipeline-graph .plan=${e.plan} .forecast=${e.forecast} .journal=${e.journal} .run=${this.run} .layer=${this.layer} .unit=${this.unit} .sel=${this.sel} ?live=${t}></ca-pipeline-graph>
|
|
544
544
|
</section>
|
|
545
545
|
<section class="panel enter">
|
|
546
|
-
<h3 title=${
|
|
546
|
+
<h3 title=${O(`Counted from every finished attempt (journal.jsonl)`)}>${O(`Totals`)}</h3>
|
|
547
547
|
<ca-kpis .journal=${e.journal} .plan=${e.plan} no-highest-cost></ca-kpis>
|
|
548
548
|
</section>
|
|
549
549
|
<div class="band parts">
|
|
550
|
-
${t?
|
|
551
|
-
<h3><a class="hl" href="#" @click=${e=>this.nav(e,()=>this.go(`procs`))}>${
|
|
550
|
+
${t?j`<section class="panel enter">
|
|
551
|
+
<h3><a class="hl" href="#" @click=${e=>this.nav(e,()=>this.go(`procs`))}>${O(`Process tree`)}</a></h3>
|
|
552
552
|
<ca-proc-tree .procs=${e.procs}></ca-proc-tree>
|
|
553
|
-
</section>`:
|
|
554
|
-
${
|
|
555
|
-
<h3 title=${
|
|
553
|
+
</section>`:N}
|
|
554
|
+
${we(e.journal)?j`<section class="panel enter">
|
|
555
|
+
<h3 title=${O(`Reported by the coding agents`)}>${O(`Tokens and cost by kind`)}</h3>
|
|
556
556
|
<ca-spend-breakdown .journal=${e.journal}></ca-spend-breakdown>
|
|
557
|
-
</section>`:
|
|
558
|
-
${e.plan.models?.length?
|
|
559
|
-
<h3 title=${
|
|
557
|
+
</section>`:N}
|
|
558
|
+
${e.plan.models?.length?j`<section class="panel enter">
|
|
559
|
+
<h3 title=${O(`What the agent sessions spent on each model, each model of a model switch counted separately (Plan.models)`)}>${O(`Models`)}</h3>
|
|
560
560
|
<ca-model-usage .models=${e.plan.models}></ca-model-usage>
|
|
561
|
-
</section>`:
|
|
562
|
-
${
|
|
563
|
-
<h3 title=${
|
|
561
|
+
</section>`:N}
|
|
562
|
+
${Pe(e.journal).length||e.plan.rests?.length?j`<section class="panel enter">
|
|
563
|
+
<h3 title=${O(`Account-wide | first and last reading per account | read at each agent session start`)}>${O(`Subscription usage`)}</h3>
|
|
564
564
|
<ca-quota .journal=${e.journal} .caps=${e.plan.quota_caps??[]} .rests=${e.plan.rests??[]} .rule=${e.plan.quota_rule??``} ?live=${t}></ca-quota>
|
|
565
|
-
</section>`:
|
|
566
|
-
${e.plan.services?.length?
|
|
567
|
-
<h3 title=${
|
|
565
|
+
</section>`:N}
|
|
566
|
+
${e.plan.services?.length?j`<section class="panel enter">
|
|
567
|
+
<h3 title=${O(`A long-lived helper that the tasks holding one lock share (services.jsonl)`)}>${O(`Services`)}</h3>
|
|
568
568
|
<ca-services .services=${e.plan.services} .nodes=${e.plan.nodes} ?live=${t}></ca-services>
|
|
569
|
-
</section>`:
|
|
570
|
-
${e.cursor?
|
|
571
|
-
<h3 title=${
|
|
572
|
-
${this.cursor()}
|
|
573
|
-
</section>`:
|
|
569
|
+
</section>`:N}
|
|
570
|
+
${e.cursor?j`<section class="panel enter">
|
|
571
|
+
<h3 title=${O(`Stage and step per unit (CursorStore)`)}>${O(`Resume cursor`)}</h3>
|
|
572
|
+
${Ul([e.cursor,R()],()=>this.cursor())}
|
|
573
|
+
</section>`:N}
|
|
574
574
|
</div>
|
|
575
|
-
${i.length?
|
|
576
|
-
<h3 title=${
|
|
575
|
+
${i.length?j`<section class="panel enter views">
|
|
576
|
+
<h3 title=${O(`monitor.Panel`)}>${O(`Custom views`)}</h3>
|
|
577
577
|
${this.panelCards(i)}
|
|
578
|
-
</section>`:
|
|
578
|
+
</section>`:N}
|
|
579
579
|
<section class="panel enter">
|
|
580
|
-
<h3>${
|
|
580
|
+
<h3>${O(`Timeline`)}</h3>
|
|
581
581
|
<ca-timeline .journal=${e.journal} .plan=${e.plan} .procs=${e.procs} .live=${t} .run=${this.run}></ca-timeline>
|
|
582
582
|
</section>
|
|
583
|
-
</div>`}runningCard(e,t,n){return
|
|
584
|
-
<h3 title=${
|
|
585
|
-
${e?
|
|
586
|
-
${t?
|
|
587
|
-
</section>`}outputs(){let{contracts:e,tally:t}=this.state.outputs;if(!e.length)return
|
|
588
|
-
<div class="ct-row">${
|
|
589
|
-
${r.filter(([,t])=>t.status===e).map(([e,t])=>
|
|
590
|
-
<b class="jmono" title=${e.key}>${
|
|
591
|
-
<span class="meta">${
|
|
592
|
-
<span class="meta" title=${
|
|
583
|
+
</div>`}runningCard(e,t,n){return j`<section class="panel enter">
|
|
584
|
+
<h3 title=${O(`Limit: max_concurrent`)}>${O(`Running tasks`)}
|
|
585
|
+
${e?j`<span class="r">${O(n?D`${t} of ${n} running at once`:D`${t} running at once`)}</span>`:N}</h3>
|
|
586
|
+
${t?j`<ca-workers .procs=${this.state.procs} .live=${e}></ca-workers>`:j`<div class="meta">${O(`No tasks running`)}</div>`}
|
|
587
|
+
</section>`}outputs(){let{contracts:e,tally:t}=this.state.outputs;if(!e.length)return j`<div class="meta">${O(`No output files`)}</div>`;let n=e.flatMap(e=>(e.outputs??[]).map(t=>[e,t])).filter(([,e])=>e.status===`invalid`||e.status===`failed`),r=n.slice(0,5),i=Rf.filter(e=>t[e]&&r.some(([,t])=>t.status===e)),a=Rf.filter(e=>t[e]&&!i.includes(e));return j`${i.map(e=>j`<div class="ogroup" role="group" aria-label=${ic(e)}>
|
|
588
|
+
<div class="ct-row">${Zl(e,t[e])}</div>
|
|
589
|
+
${r.filter(([,t])=>t.status===e).map(([e,t])=>j`<button type="button" class="fl ofl" @click=${()=>this.go(`outputs`)}>
|
|
590
|
+
<b class="jmono" title=${e.key}>${X({kind:e.kind,unit:e.unit===e.key?``:e.unit})}</b>
|
|
591
|
+
<span class="meta">${nu(t)}</span>
|
|
592
|
+
<span class="meta" title=${E(t.errors?.[0]||t.path,this.run)}>${E(t.errors?.[0]||t.path,this.run)}</span>
|
|
593
593
|
</button>`)}
|
|
594
594
|
</div>`)}
|
|
595
|
-
${n.length>r.length?
|
|
596
|
-
${a.length||!i.length?
|
|
597
|
-
${a.length?a.map(e=>
|
|
598
|
-
</div>`:
|
|
599
|
-
${n.length||e.stage?
|
|
595
|
+
${n.length>r.length?j`<div class="more"><a class="lnk" href="#" @click=${e=>this.nav(e,()=>this.go(`outputs`))}>${n.length-r.length===1?O(`1 more output`):O(D`${n.length-r.length} more outputs`)}</a></div>`:N}
|
|
596
|
+
${a.length||!i.length?j`<div class="ct-row">
|
|
597
|
+
${a.length?a.map(e=>Zl(e,t[e])):j`<span class="meta">${O(`No checked files`)}</span>`}
|
|
598
|
+
</div>`:N}`}progressLine(){let e=function(e){let t=e.groups.reduce((e,t)=>e+t.total,0),n=e.groups.reduce((e,t)=>e+t.done,0),r=e.groups.reduce((e,t)=>e+(t.partial??0),0),i=e.groups.reduce((e,t)=>e+t.skipped,0),a=e.groups.reduce((e,t)=>e+(t.cancelled??0),0);return{total:t,done:n,partial:r,skipped:i,cancelled:a,pct:Math.round(100*(n+r+i+a)/Math.max(1,t))}}(this.state.plan);return J(O(D`${e.pct}%`),O(D`${e.done} of ${e.total} tasks done`),e.partial?Q(`partial`,e.partial):``,e.skipped?Q(`skipped`,e.skipped):``,e.cancelled?Q(`cancelled`,e.cancelled):``)}nav(e,t){e.preventDefault(),t()}cursor(){let e=this.state.cursor,t=Object.entries(e?.units??{});if(!e||!e.stage&&!t.length)return j`<div class="meta">${O(`No resume cursor`)}</div>`;let n=e.completed_stages??[];return j`<div class="chips" style="margin-bottom:10px">
|
|
599
|
+
${n.length||e.stage?j`${n.map(e=>j`<span class="chip" data-tone="done"><span aria-hidden="true">✓</span><span class="sr">${O(`done`,{id:`stage-done`})}</span> ${e}</span>`)}${e.stage?j`<span class="chip" data-tone="running"><span class="sr">${O(`current`)}</span>${e.stage}</span>`:N}`:j`<span class="meta">${O(`No stage`)}</span>`}
|
|
600
600
|
</div>
|
|
601
|
-
${t.length?
|
|
602
|
-
${t.map(([e,t])=>
|
|
601
|
+
${t.length?j`<div class="cur-units">
|
|
602
|
+
${t.map(([e,t])=>j`<div class="cu">
|
|
603
603
|
<span class="jmono">${e}</span>
|
|
604
|
-
<span class="meta">${
|
|
605
|
-
<span class="cu-bar" title=${t.completed.length===1?
|
|
606
|
-
${t.inflight.length?Xr({text:
|
|
607
|
-
`)}):
|
|
604
|
+
<span class="meta">${J(t.step||`—`,t.loop_pass?O(D`pass ${t.loop_pass}`):``)}</span>
|
|
605
|
+
<span class="cu-bar" title=${t.completed.length===1?O(`1 step done`):O(D`${t.completed.length} steps done`)}><i style="width:${Math.min(100,12*(t.completed.length+1))}%"></i></span>
|
|
606
|
+
${t.inflight.length?Xr({text:O(`running`),tone:`running`,title:t.inflight.join(`
|
|
607
|
+
`)}):N}
|
|
608
608
|
</div>`)}
|
|
609
|
-
</div>`:
|
|
610
|
-
${
|
|
609
|
+
</div>`:N}`}panelCards(e){return j`<div class="pcards">
|
|
610
|
+
${W(e,e=>e.name,e=>{let t=Bf(this.state.panels[e.name]);return j`<button type="button" class="pcard" @click=${()=>this.go(`panel:${e.name}`)}>
|
|
611
611
|
<span class="pc-ic" aria-hidden="true">${e.icon||`▤`}</span>
|
|
612
612
|
<div>
|
|
613
613
|
<b>${e.title||e.name}</b>
|
|
614
|
-
${e.description?
|
|
615
|
-
${t?
|
|
614
|
+
${e.description?j`<div class="meta">${e.description}</div>`:N}
|
|
615
|
+
${t?j`<div class="pc-peek">${t}</div>`:N}
|
|
616
616
|
</div>
|
|
617
|
-
<span class="pc-go">${
|
|
617
|
+
<span class="pc-go">${O(`Show view`)}</span>
|
|
618
618
|
</button>`})}
|
|
619
|
-
</div>`}nameButton(e){return
|
|
620
|
-
<span>${e.length===1?
|
|
621
|
-
${e.slice(0,4).map(e=>
|
|
622
|
-
${e.length>4?
|
|
623
|
-
</div>`:
|
|
624
|
-
${Zr({text:
|
|
625
|
-
${this.nameButton(e.task)}<span class="meta">${
|
|
626
|
-
<div class="meta" title=${c(e.task)}>${
|
|
619
|
+
</div>`}nameButton(e){return j`<button type="button" class="fl-name jmono" title=${e.key} @click=${()=>this.open(e)}>${this.name(e)}</button>`}openRow(e,t){e.target.closest(`button`)||this.open(t)}name(e){return X(e)}problems(){let{outcomes:e,problems:t}=S(this.state.journal,this.state.plan),{failed:n,notStarted:r,partial:i,recovered:a}=t,o=n.length+r.length+i.length,s=j`<div class="ok"><span aria-hidden="true">✓</span>${O(`No problems`)}</div>`;if(!o&&!a.length)return s;let c=e=>E(e.attempts[e.attempts.length-1]?.reason||`—`,this.run),l=e=>e.length?j`<div class="stopped">
|
|
620
|
+
<span>${e.length===1?O(`1 later task not started`):O(D`${e.length} later tasks not started`)}</span>
|
|
621
|
+
${e.slice(0,4).map(e=>Vl(this,this.name(e),e))}
|
|
622
|
+
${e.length>4?j`<span>${O(D`${e.length-4} more`)}</span>`:N}
|
|
623
|
+
</div>`:N,u=(e,t,n)=>e>t?j`<div class="more"><a class="lnk" href="#" @click=${e=>this.nav(e,()=>$(this,`ca-navigate`,{tab:`journal`,stop:n}))}>${O(e-t===1?`1 more in history`:D`${e-t} more in history`)}</a></div>`:N;return j`${o?N:s}${W(n.slice(0,5),e=>e.task.key,e=>{let t=e.task.attempts[e.task.attempts.length-1];return j`<div class="fl" @click=${t=>this.openRow(t,e.task)}>
|
|
624
|
+
${Zr({text:fs(`failed`),tone:`failed`})}
|
|
625
|
+
${this.nameButton(e.task)}<span class="meta">${q(t?.ts,!0)}</span>
|
|
626
|
+
<div class="meta" title=${c(e.task)}>${Ss(t?.stop)}: ${c(e.task)}</div>
|
|
627
627
|
${l(e.stopped)}
|
|
628
628
|
</div>`})}
|
|
629
629
|
${u(n.length,5,`bad`)}
|
|
630
|
-
${
|
|
631
|
-
${Zr({text:
|
|
630
|
+
${W(r.slice(0,5),e=>e.key,t=>j`<div class="fl" @click=${e=>this.openRow(e,t)}>
|
|
631
|
+
${Zr({text:fs(`not_started`),tone:`attention`})}
|
|
632
632
|
${this.nameButton(t)}<span></span>
|
|
633
|
-
${this.metaLine(
|
|
633
|
+
${this.metaLine(ws(t,e,this.run)?is(ws(t,e,this.run)):c(t))}
|
|
634
634
|
</div>`)}
|
|
635
635
|
${u(r.length,5,`invalid_input`)}
|
|
636
|
-
${
|
|
637
|
-
${Zr({text:
|
|
636
|
+
${W(i.slice(0,5),e=>e.key,e=>j`<div class="fl" @click=${t=>this.openRow(t,e)}>
|
|
637
|
+
${Zr({text:fs(`partial`),tone:ys(`partial`)})}
|
|
638
638
|
${this.nameButton(e)}<span></span>
|
|
639
639
|
${this.metaLine(c(e))}
|
|
640
640
|
</div>`)}
|
|
641
641
|
${u(i.length,5,`partial`)}
|
|
642
|
-
${a.length?
|
|
643
|
-
${Zr({text:
|
|
642
|
+
${a.length?j`<div class="recovered" role="group" aria-label=${is(fs(`recovered`))}>${W(a.slice(0,3),e=>e.key,e=>{let t=e.tries.filter(e=>!e.ok).length,n=e.tries.length;return j`<div class="fl muted" @click=${t=>this.openRow(t,e)}>
|
|
643
|
+
${Zr({text:fs(`recovered`),tone:ys(`recovered`)})}
|
|
644
644
|
${this.nameButton(e)}<span></span>
|
|
645
|
-
<div class="meta">${
|
|
645
|
+
<div class="meta">${O(t===1?D`Done on attempt ${n} | 1 failed attempt`:D`Done on attempt ${n} | ${t} failed attempts`)}</div>
|
|
646
646
|
</div>`})}
|
|
647
|
-
${u(a.length,3,`retried`)}</div>`:
|
|
648
|
-
${
|
|
649
|
-
${e.unit?
|
|
650
|
-
${e.claims?.length?
|
|
651
|
-
${e.priority?
|
|
652
|
-
</span>`;var i}},{id:`attempts`,header:
|
|
653
|
-
`):``}(t.deferredCause)||t.deferred:``;return
|
|
647
|
+
${u(a.length,3,`retried`)}</div>`:N}`}metaLine(e){return j`<div class="meta" title=${e}>${e}</div>`}};G([I({attribute:!1})],Vf.prototype,`state`,void 0),G([I({attribute:!1})],Vf.prototype,`summary`,void 0),G([I({attribute:!1})],Vf.prototype,`host`,void 0),G([I({attribute:!1})],Vf.prototype,`info`,void 0),G([I()],Vf.prototype,`run`,void 0),G([I()],Vf.prototype,`layer`,void 0),G([I()],Vf.prototype,`unit`,void 0),G([I()],Vf.prototype,`sel`,void 0),Vf=G([F(`ca-overview`),k()],Vf),V(`cae-data-table`,ha);var Hf=()=>O(`none`,{id:`none`});function Uf(e){let t=new Map;for(let n of e.all)t.set(`${n.kind}|${n.unit}`,(t.get(`${n.kind}|${n.unit}`)??0)+1);let n=Math.max(1,...e.rows.map(e=>e.wall_s)),r=new Map;for(let t of e.journal)Ce(r.get(t.key)??r.set(t.key,xe()).get(t.key),t);let i=e=>e.tries.length>0,a=(e,t)=>{if(!i(e))return j`<span class="jdim">${Hf()}</span>`;let n=r.get(e.key);return n?.reported?t(n):j`<span class="jdim">—</span>`};return[{id:`task`,header:O(`Task`),tip:O(`Kind · unit`),width:`minmax(220px, 0.6fr)`,rowHeader:!0,text:e=>e.key,cell:e=>{let n=T(e),r=e.pass!==null&&(t.get(`${e.kind}|${e.unit}`)??0)>1?e.pass:null;return j`<span class="grow jmono" title=${e.key}>
|
|
648
|
+
${sf(n,O(n?`Python task`:`Agent task`))}${e.kind}
|
|
649
|
+
${e.unit?j`<span class="jdim">· ${e.unit}</span>`:N}${r===null?N:j`<span class="pass">${ks(r)}</span>`}
|
|
650
|
+
${e.claims?.length?j`<span class="jdim also" title=${i=e.claims,J(Cc(),Y(i))}>${(e=>e.length>2?O(D`Locks ${e.length} names`):O(D`Locks ${Y(e)}`))(e.claims)}</span>`:N}
|
|
651
|
+
${e.priority?j`<span class="jdim also" title=${Xc()}>${Yc(e.priority)}</span>`:N}
|
|
652
|
+
</span>`;var i}},{id:`attempts`,header:O(`Attempts`),tip:O(`Attempts that ran`),align:`end`,width:`64px`,cell:e=>e.tries.length},{id:`time`,header:O(`Time`),tip:O(`Summed over all attempts`),align:`end`,width:`132px`,cell:e=>j`<span class="wall">${i(e)?j`${H(e.wall_s)}<span class="jdur"><i class=${T(e)?``:`llm`} style="width:${Math.max(4,Math.round(100*e.wall_s/n))}%"></i></span>`:j`<span class="jdim">${Hf()}</span><span class="jdur" style="visibility:hidden"></span>`}</span>`},{id:`tokens`,header:O(`Tokens`),tip:O(`Input and output, summed over all attempts`),align:`end`,width:`72px`,cell:e=>a(e,e=>j`<span title=${J(O(D`Cache read ${Z(e.cache_read)}`),O(D`Cache write ${Z(e.cache_creation)}`))}>${Z(e.input+e.output)}</span>`)},{id:`cost`,header:O(`Cost`),tip:O(`Reported by the coding agent`),align:`end`,width:`72px`,cell:e=>a(e,e=>cs(e.cost))},{id:`ended`,header:O(`Last attempt ended`),align:`end`,width:`128px`,cell:e=>j`<span class="meta">${i(e)?q(e.tries[e.tries.length-1]?.ts,!0):Hf()}</span>`},{id:`status`,header:O(`Status`,{id:`status`}),width:`minmax(240px, 1fr)`,cell:t=>{let n=function(e,t){return e.outcome===`not_started`?ws(e,t.outcomes,t.run):e.outcome===`partial`?E(e.attempts[e.attempts.length-1]?.reason??``,t.run):e.outcome===`waiting`&&e.deferred?Qs(e.deferredCause,e.deferred,e.deferredIn):e.outcome===`waiting`?function(e){let t=e[0];return t?e.length===1?O(D`waits for output of ${X(t)}`):O(D`waits for output of ${e.length} earlier tasks`):``}(e.waits_for.map(e=>t.outcomes.get(e)??{kind:e})):``}(t,e),r=t.outcome===`waiting`&&t.deferred?function(e){let t=e?.cause===`rest`?Zs(e.rests??[]):[];return t.length>1?t.map(Xs).join(`
|
|
653
|
+
`):``}(t.deferredCause)||t.deferred:``;return j`${Xr({text:ps(t.outcome,e.live&&!t.deferred),tone:ys(t.outcome),mark:xs(t.outcome),title:t.last_stop})}${n?j`<span class="cause" title=${r||N}>${n}</span>`:N}`}}]}var Wf=[Gr,cf,A` caption{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}tr{column-gap:20px;padding:6px 12px;}tbody tr{border-bottom:0;border-radius:8px;transition:background 0.15s;}thead tr{align-items:end;white-space:nowrap;padding:4px 12px 8px;margin-bottom:4px;}tbody [data-col='ended']{font-size:var(--font-size-sm);}.wall{display:flex;align-items:center;justify-content:flex-end;gap:8px;}.wall .jdur{width:56px;margin:0;flex:none;}.grow{display:flex;align-items:center;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.grow .jdim{margin-left:8px;}.pass{margin-left:8px;font-size:11px;color:var(--text-muted);}.cause{display:block;font-size:11px;color:var(--text-muted);margin-top:2px;white-space:normal;overflow-wrap:anywhere;}@container (max-width:760px){tr{grid-template-columns:minmax(0,1fr) 128px 90px;}[data-col='attempts'],[data-col='tokens'],[data-col='cost'],[data-col='ended']{display:none;}}`],Gf=class extends P{constructor(...e){super(...e),this.journal=[],this.plan=null,this.kind=``,this.q=``,this.live=!1,this.run=``,this.shown=null}static{this.styles=[U,A`:host{display:block;margin-top:4px;}`]}open(e,t){let n=e.find(e=>e.key===t);n&&$(this,`ca-open-task`,T(n)?{key:t,view:`output`}:{key:t})}render(){let e=this.plan?S(this.journal,this.plan):null,t=e?.rows??[],n=this.shown,r=n&&n.all===t&&n.kind===this.kind&&n.q===this.q?n.rows:wl(xl(t,this.kind,this.q));return this.shown={all:t,kind:this.kind,q:this.q,rows:r},r.length?j`<cae-data-table .columns=${Uf({run:this.run,live:this.live,outcomes:e?.outcomes??new Map,all:t,rows:r,journal:this.journal})} .rows=${r} .rowKey=${e=>e.key} .rowTone=${e=>e.outcome===`running`?`running`:void 0} .rowAttrs=${e=>({"data-executor":T(e)?`python`:`agent`})} .cellStyles=${Wf} .caption=${O(`Tasks`,{id:`tab-tasks`})} .strings=${Sc(O(`No tasks`))} @cae-activate=${e=>this.open(r,e.detail.id)} ></cae-data-table>`:j`<div class="blank"><span class="ic" aria-hidden="true">≡</span>${t.length?O(`No tasks match the filter`):O(`No tasks`)}</div>`}};function Kf(e){return e===`invalid_input`?fs(`not_started`):Ss(e)}G([I({attribute:!1})],Gf.prototype,`journal`,void 0),G([I({attribute:!1})],Gf.prototype,`plan`,void 0),G([I()],Gf.prototype,`kind`,void 0),G([I()],Gf.prototype,`q`,void 0),G([I({type:Boolean})],Gf.prototype,`live`,void 0),G([I()],Gf.prototype,`run`,void 0),Gf=G([F(`ca-task-table`),k()],Gf);var qf=e=>[...new Set([...(e.hops??[]).map(e=>e.credential),e.credential].filter(e=>!!e))];function Jf(e){let t=new Set(e.filter(d).map(e=>qf(e).join(`
|
|
654
654
|
`))),[n]=t;return t.size===1&&n&&!n.includes(`
|
|
655
|
-
`)?n:``}function
|
|
656
|
-
${
|
|
657
|
-
`)}:{},width:`minmax(150px,1fr)`,cell:e=>
|
|
658
|
-
`);return t?r?
|
|
659
|
-
`)||
|
|
660
|
-
`):``)||
|
|
661
|
-
`)}>${p}</span>`:
|
|
662
|
-
`)} >${
|
|
663
|
-
${
|
|
664
|
-
${
|
|
665
|
-
${
|
|
666
|
-
${
|
|
655
|
+
`)?n:``}function Yf(e){let t=Math.max(1,...e.rows.map(e=>e.wall_s||0)),n=jl(e.journal),r=new Map(e.journal.map((e,t)=>[e,t])),i=Jf(e.journal);return[{id:`ended`,header:O(`Ended`),width:`64px`,cell:e=>j`<span class="jmono" title=${q(e.ts,!0)}>${q(e.ts)}</span>`},{id:`task`,header:O(`Task`),width:`minmax(130px,0.8fr)`,rowHeader:!0,text:e=>e.key,cell:e=>{let t=T(e);return j`<span class="jmono" title=${e.key}>${sf(t,O(t?`Python task`:`Agent task`),``)}
|
|
656
|
+
${X(e)}</span>`}},{id:`outcome`,header:O(`Outcome`),tip:O(`How the attempt ended (stop)`),width:`minmax(150px,0.7fr)`,cell:t=>{let r=d(t),i=r&&(n.get(t.key)?.count??1)>1,a=r?Os(Dl(t)):``,o=e.replayMarks&&t.replayed?pc():``;return Zr({text:j`<span class="nw">${Kf(t.stop)}</span>${i||a||o?j`<span class="sub" title=${o?mc():N}>${J(i?Es(t.attempt):``,a,o)}</span>`:N}`,tone:vs(t.stop),cls:`two`,title:t.stop})}},{id:`agent`,header:O(i?`Agent, model`:`Agent, model, identity`),...i?{tip:[O(D`Identity: ${Ps(i)}`),Fs(i)].filter(Boolean).join(`
|
|
657
|
+
`)}:{},width:`minmax(150px,1fr)`,cell:e=>j`<span class="jmono jdim two" title=${J(e.route,rc(e.hops,null,e.skipped_hops))||N}>${d(e)?j`<span>${[e.agent,e.model].filter(Boolean).join(` / `)||`—`}</span>${function(e,t){let n=qf(e);if(!n.length)return N;let r=(e.quota??[])[0],i=r?O(D`Usage at session start (account-wide): ${Hs(r)}`):``,a=r&&n.length===1&&(r.credential??``)===n[0],o=r?a?Bs(r):Hs(r):``,s=[i,...n.map(Fs)].filter(Boolean).join(`
|
|
658
|
+
`);return t?r?j`<span class="sub" title=${s||N}><span class="q">${o}</span></span>`:N:j`<span class="sub" title=${s||N}>${n.map(e=>Ps(e)).join(` → `)}${r?j` <span class="q">${o}</span>`:N}</span>`}(e,i)}`:`—`}</span>`},{id:`tokens`,header:O(`Tokens`),tip:O(`Input / output | cache read / cache write`),align:`end`,width:`92px`,cell:e=>{let t=e.usage;return j`<span class="two" title=${[t?.resident==null?``:O(D`Input of the first API call: ${Z(t.resident)}`),$c(e)].filter(Boolean).join(`
|
|
659
|
+
`)||N}>${t?j`<span>${Z(t.input)} / ${Z(t.output)}</span><span class="sub">${Z(t.cache_read)} / ${Z(t.cache_creation)}</span>`:j`<span class="jdim">—</span>`}</span>`}},{id:`cost`,header:O(`Cost`),tip:O(`Reported by the coding agent`),align:`end`,width:`60px`,cell:e=>{let t=e.hops??[];return j`<span class="cost" title=${(t.length>1?t.map(e=>J(e.model||e.route||`—`,Ps(e.credential)||`—`,cs(e.cost_usd),Ss(e.stop))).join(`
|
|
660
|
+
`):``)||O(`Reported by the coding agent`)}>${cs(e.cost_usd)}</span>`}},{id:`time`,header:O(`Time`),align:`end`,width:`76px`,cell:e=>{let n=T(e);return d(e)?j`${H(e.wall_s)}<span class="jdur"><i class=${ae(e)?`bad`:n?``:`llm`} style="width:${Math.max(2,Math.round(100*(e.wall_s||0)/t))}%"></i></span>`:`—`}},{id:`reason`,header:O(`Reason`),width:`minmax(200px,2.2fr)`,cell:t=>{let i=ds([t]),a=us(ls([t])),o=t.safety_stops??[];return j`<span class="jwhy" title=${t.reason||N}>${(t=>{let i=d(t),a=rc(t.hops,null,t.skipped_hops),o=e.run||t.run_id||``,s=e.outcomes.get(t.key),c=t.stop===`invalid_input`&&s?ws({attempts:[t],cause:null},e.outcomes,o):``,l=c?is(c):t.ok&&i&&t.stop!==`partial`||!t.reason?``:E(t.reason,o),u=(e=>{let t=n.get(e.key);return!e.ok&&d(e)&&(t?.lastOk??-1)>(r.get(e)??0)?t?.lastOkTry??0:0})(t),f=u?O(D`Task done on attempt ${u}`):``,p=t.context_warned?el(t):``;return a||l||f||p?j`${a?j`<span class="nw" title=${O(`Model switch`)}>${a}</span><br />`:N}${l?j`${l}<br />`:N}${f?j`<span class="later">${f}</span>${p?j`<br />`:N}`:N}${p?j`<span class="tone-text" data-tone="attention" title=${[tl(),$c(t)].filter(Boolean).join(`
|
|
661
|
+
`)}>${p}</span>`:N}`:j`<span class="jdim">—</span>`})(t)}${o.length?j` <span class="tone-text nw" data-tone="attention" title=${[ul(),...o.map(fl)].join(`
|
|
662
|
+
`)} >${ll(o.length)}</span >`:N}${i?j` <span class="unread nw" title=${O(D`Events this contraagent version could not read (unread_events): ${i}`)} ><span aria-hidden="true">⚠</span> ${O(`Unrecognized events`)}</span >`:N}${a?j` <span class="unread nw" title=${a.tip}><span aria-hidden="true">⚠</span> ${a.label}</span>`:N}</span>`}},...(e.extras??[]).map(e=>({id:`x:${e}`,header:e,tip:Ec(),width:`minmax(80px,0.6fr)`,text:t=>Dc(t[e]),cell:t=>{let n=Dc(t[e]);return n===`—`?j`<span class="jdim">—</span>`:j`<span class="jmono" title=${n}>${n}</span>`}}))]}var Xf=[Gr,cf,A` caption{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}tr{column-gap:12px;row-gap:2px;padding:7px 12px;border-bottom:1px solid var(--line);font-size:12px;min-width:980px;}th,td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}tbody [data-col='outcome'],tbody [data-col='agent'],tbody [data-col='tokens'],tbody [data-col='reason']{white-space:normal;}tbody [data-col='ended'],tbody [data-col='task']{font-family:var(--mono);font-size:11.5px;}thead{position:sticky;top:0;z-index:1;}thead tr{color:var(--text-muted);font-size:11px;background:var(--bg);}tbody tr[data-key]:hover{background:var(--card);}tbody tr[data-executor='python']{opacity:0.85;}tbody tr[data-executor='python']:hover,tbody tr[data-executor='python'][data-tone='failed']{opacity:1;}tbody tr[data-ran='false']{opacity:0.8;}tbody tr[data-fresh]{animation:rowin 1.6s var(--ease);}tr.empty{min-width:0;}tr.empty td{font-size:var(--font-size-sm);}.jwhy{color:var(--text-2);overflow-wrap:anywhere;}.later{color:var(--status-done);}.nw{white-space:nowrap;}.unread{color:var(--status-attention);}.two{display:flex;flex-direction:column;line-height:1.35;}.jstop.two{display:grid;grid-template-columns:auto minmax(0,1fr);align-content:center;}.jstop.two>*{grid-column:2;}.jstop.two::before{grid-row:1;}.two .sub{color:var(--text-muted);font-size:11px;white-space:normal;overflow-wrap:anywhere;}[data-col='tokens'] .two>span{white-space:nowrap;}.sub .q{color:var(--text-2);font-family:var(--mono);white-space:nowrap;}.jstop .sub{font-weight:400;}.cost{font-variant-numeric:tabular-nums;color:var(--text-2);}`],Zf=class extends P{constructor(...e){super(...e),this.rows=[],this.plan=null,this.fresh=new Set,this.kind=``,this.stop=``,this.q=``,this.run=``,this.extras=[],this.replayMarks=!1,this.counts=null,this.shown=null}static{this.styles=[U,A` :host{display:block;}.jtally{display:flex;flex-wrap:wrap;gap:8px;padding:2px 0 12px;}.jchip{border:1px solid var(--line);border-radius:999px;padding:3px 11px;font-size:11.5px;color:var(--text-muted);cursor:pointer;transition:all 0.15s;background:none;}.jchip b{color:var(--text);}.jchip:hover{border-color:var(--line2);color:var(--text);}.jchip.on{background:var(--accent-bg);border-color:var(--accent);color:var(--text);}.jchip[data-tone='failed'],.jchip[data-tone='attention']{color:var(--tone);border-color:color-mix(in srgb,var(--tone) 40%,transparent);}`]}open(e,t){let n=e.find(e=>se(e)===t);n&&$(this,`ca-open-task`,T(n)?{key:n.key,view:`output`}:{key:n.key})}render(){let e=this.shown,t=e&&e.rows===this.rows&&e.kind===this.kind&&e.stop===this.stop&&e.q===this.q?e.shown:kl(this.rows,this.kind,this.stop,this.q).reverse();this.shown={rows:this.rows,kind:this.kind,stop:this.stop,q:this.q,shown:t},this.counts?.rows===this.rows&&this.counts.replayMarks===this.replayMarks||(this.counts={rows:this.rows,replayMarks:this.replayMarks,fixups:this.rows.filter(Ol).length,retried:El(this.rows).size,replayed:this.replayMarks?this.rows.filter(e=>e.replayed).length:0,tally:Al(this.rows)});let{fixups:n,retried:r,replayed:i,tally:a}=this.counts,o=(e,t,n,r,i=`neutral`)=>j`<button type="button" class="jchip ${this.stop===e?`on`:``}" data-tone=${z(i)} data-mark=${Jr(i)??N} aria-pressed=${this.stop===e} title=${r} @click=${()=>$(this,`ca-filter`,{stop:this.stop===e?``:e})}>${t} <b>${n}</b></button>`,s=Yf({run:this.run,outcomes:S(this.rows,this.plan).outcomes,journal:this.rows,rows:t,extras:this.extras,replayMarks:this.replayMarks});return j`<div class="jtally">
|
|
663
|
+
${a.map(([e,t])=>o(e,Kf(e),t,e,vs(e)))}
|
|
664
|
+
${n?o(`fixup`,O(`attempts with corrections`),n,oc()):N}
|
|
665
|
+
${r?o(`retried`,O(`tasks retried`),r,Ts()):N}
|
|
666
|
+
${i?o(`replayed`,O(`attempts replayed`),i,mc()):N}
|
|
667
667
|
</div>
|
|
668
|
-
<cae-data-table .columns=${
|
|
668
|
+
<cae-data-table .columns=${s} .rows=${t} .rowKey=${se} .rowTone=${e=>d(e)&&ae(e)?`failed`:void 0} .rowAttrs=${e=>({"data-executor":T(e)?`python`:`agent`,...d(e)?{}:{"data-ran":`false`},...this.fresh.has(se(e))?{"data-fresh":``}:{}})} .cellStyles=${Xf} .caption=${O(`History`)} .strings=${Sc(O(`No finished attempts`))} @cae-activate=${e=>this.open(t,e.detail.id)} ></cae-data-table>`}};G([I({attribute:!1})],Zf.prototype,`rows`,void 0),G([I({attribute:!1})],Zf.prototype,`plan`,void 0),G([I({attribute:!1})],Zf.prototype,`fresh`,void 0),G([I()],Zf.prototype,`kind`,void 0),G([I()],Zf.prototype,`stop`,void 0),G([I()],Zf.prototype,`q`,void 0),G([I()],Zf.prototype,`run`,void 0),G([I({attribute:!1})],Zf.prototype,`extras`,void 0),G([I({type:Boolean,attribute:`replay-marks`})],Zf.prototype,`replayMarks`,void 0),Zf=G([F(`ca-journal-table`),k()],Zf);var Qf=[`invalid`,`refused`,`failed`,`running`,`pending`,`valid`],$f=e=>e.split(`/`).slice(-2).join(`/`),ep=e=>X({kind:e.kind||e.key,unit:e.unit&&e.unit!==e.key?e.unit:``}),tp=e=>e?Qf.indexOf(e):Qf.length,np=new Intl.Collator,rp=class extends P{constructor(...e){super(...e),this.outputs=null,this.run=``,this.journal=[],this.plan=null,this.outcomes=new Map,this.sorted=null,this.writers=null,this.lastRows=null,this.open=new qn(`contracts:open`,this),this.producerOf=e=>{if(this.writers?.outputs!==this.outputs){let e=new Map;for(let t of this.outputs?.contracts??[])for(let n of t.outputs??[])e.has(n.path)||e.set(n.path,[t,n]);this.writers={outputs:this.outputs,by:e}}let t=this.writers.by.get(e);if(!t)return;let[n,r]=t;return{name:ep(n),written:!!r.file.exists,outcome:this.outcomes.get(n.key)?.outcome}}}static{this.styles=[U,au,cf,A` :host{display:block;container-type:inline-size;}.ct-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px;}.passed{margin:6px 0 0;padding:10px 0 8px;font:inherit;border-top:1px solid var(--line);}details.ct{border-top:1px solid var(--line);}details.ct>summary{list-style:none;cursor:pointer;padding:7px 4px;display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;}details.ct>summary>*{min-width:0;overflow-wrap:anywhere;}details.ct>summary::-webkit-details-marker{display:none;}details.ct>summary::before{content:'▸';color:var(--text-muted);width:10px;transition:transform 0.15s;}details.ct[open]>summary::before{transform:rotate(90deg);}details.ct>summary:hover{background:var(--raise);border-radius:8px;}.k-ic{margin-right:0;}.ct-f{margin-left:auto;white-space:nowrap;}.ct-body{padding:4px 10px 14px 24px;}@container (max-width:480px){.ct-body{padding:4px 0 14px 12px;}}.ct-links{margin-top:10px;font-size:12px;}.lead{margin:-4px 0 10px;}.one{display:flex;align-items:center;gap:10px;padding:7px 4px 7px 24px;border-top:1px solid var(--line);flex-wrap:wrap;}.why{color:var(--text-2);font-size:12px;}`]}render(){let e=this.outputs?.contracts??[];if(this.outcomes=this.plan?S(this.journal,this.plan).outcomes:new Map,!e.length)return j`<div class="blank"><span class="ic" aria-hidden="true">▣</span><b>${J(O(`No checked files`),O(`no task declares an OutputContract or an InputContract`))}</b></div>`;if(this.sorted?.outputs!==this.outputs){let t=e.flatMap(e=>(e.outputs??[]).map(t=>[e,t])).sort(([e,t],[n,r])=>tp(t.status)-tp(r.status)||np.compare(e.key,n.key));this.sorted={outputs:this.outputs,outs:t}}let t=this.sorted.outs,n=e.flatMap(e=>(e.inputs??[]).map(t=>[e,t])),r=t.filter(([,e])=>e.status!==`valid`),i=t.filter(([,e])=>e.status===`valid`),a=function(e){let t=e?.tally;return(t?Qf.filter(e=>e!==`valid`&&t[e]):[]).map(e=>Zl(e,t?.[e]))}(this.outputs);return j`<div class="g12">
|
|
669
669
|
<section class="panel c12">
|
|
670
|
-
<h3 title=${
|
|
671
|
-
${a.length?
|
|
672
|
-
${
|
|
673
|
-
${i.length?
|
|
674
|
-
<div role="group" aria-label=${
|
|
675
|
-
${
|
|
676
|
-
</div>`:
|
|
670
|
+
<h3 title=${O(`Files each task must write (OutputContract)`)}>${O(`Outputs`)}</h3>
|
|
671
|
+
${a.length?j`<div class="ct-row">${a}</div>`:N}
|
|
672
|
+
${W(r,([e,t])=>`out|${e.key}|${t.path}`,([e,t])=>this.outRow(e,t))}
|
|
673
|
+
${i.length?j`<h4 class="passed">${Zl(`valid`,i.length)}</h4>
|
|
674
|
+
<div role="group" aria-label=${ic(`valid`)}>
|
|
675
|
+
${W(i,([e,t])=>`out|${e.key}|${t.path}`,([e,t])=>this.outRow(e,t))}
|
|
676
|
+
</div>`:N}
|
|
677
677
|
</section>
|
|
678
|
-
${n.length?
|
|
679
|
-
<h3 title=${
|
|
680
|
-
${
|
|
681
|
-
</section>`:
|
|
682
|
-
</div>`}details(e,t,n){return
|
|
678
|
+
${n.length?j`<section class="panel c12">
|
|
679
|
+
<h3 title=${O(`Files each task reads (InputContract)`)}>${O(`Inputs`)}</h3>
|
|
680
|
+
${W(n,([e,t])=>`in|${e.key}|${t.path}`,([e,t])=>this.inRow(e,t))}
|
|
681
|
+
</section>`:N}
|
|
682
|
+
</div>`}details(e,t,n){return j`<details class="ct" ?open=${this.open.has(e)} @toggle=${t=>this.open.set(e,t.target.open)}>
|
|
683
683
|
<summary class="ct-sum">${t}</summary>
|
|
684
684
|
<div class="ct-body">${n}</div>
|
|
685
|
-
</details>`}link(e,t,n){return
|
|
686
|
-
<b class="jmono" title=${e.key}>${
|
|
687
|
-
${
|
|
688
|
-
<span class="why">${
|
|
689
|
-
</div>`;let n=t.file,r=t.status,i=t.rounds??0,a=t.errors??[],o=
|
|
690
|
-
${i>1?
|
|
685
|
+
</details>`}link(e,t,n){return j`<a class="lnk" href="#" @click=${n=>{n.preventDefault(),$(this,`ca-open-task`,{key:e,view:t})}}>${n}</a>`}who(e){let t=T(e);return j`${sf(t,O(t?`Python task`:`Agent task`))}
|
|
686
|
+
<b class="jmono" title=${e.key}>${ep(e)}</b>`}reasonOf(e){if(this.lastRows?.journal!==this.journal){let e=new Map;for(let t of this.journal)e.set(t.key,t);this.lastRows={journal:this.journal,by:e}}let t=this.lastRows.by.get(e);return t?E(t.reason,this.run):``}outRow(e,t){if(t.status===`refused`)return j`<div class="one">
|
|
687
|
+
${Zl(`refused`)}${this.who(e)}
|
|
688
|
+
<span class="why">${lc(t,this.run,this.producerOf)}</span>
|
|
689
|
+
</div>`;let n=t.file,r=t.status,i=t.rounds??0,a=t.errors??[],o=ep(e);return this.details(`out|${e.key}|${t.path}`,j`${r===`valid`?N:Zl(r)}
|
|
690
|
+
${i>1?j`<span class="meta" title=${sc()}>${cc(i,r===`valid`)}</span>`:N}
|
|
691
691
|
${this.who(e)}
|
|
692
|
-
<span class="jmono jdim ct-path" title=${t.path}>${
|
|
693
|
-
${r===`failed`&&this.reasonOf(e.key)?
|
|
694
|
-
<span class="meta ct-f">${n.exists?`${n.size??0} B`:r?
|
|
695
|
-
${
|
|
696
|
-
${a.length?
|
|
697
|
-
`)}</pre>`:
|
|
692
|
+
<span class="jmono jdim ct-path" title=${t.path}>${$f(t.path)}</span>
|
|
693
|
+
${r===`failed`&&this.reasonOf(e.key)?j`<span class="why">${this.reasonOf(e.key)}</span>`:N}
|
|
694
|
+
<span class="meta ct-f">${n.exists?`${n.size??0} B`:r?N:O(`No file`)}</span>`,j`${ru(t,`output`)}
|
|
695
|
+
${$l(t)}
|
|
696
|
+
${a.length?j`<h4>${O(`Errors`)}</h4><pre class="ct-err">${a.map(e=>E(e,this.run)).join(`
|
|
697
|
+
`)}</pre>`:N}
|
|
698
698
|
<div class="ct-links">
|
|
699
|
-
${this.link(e.key,`output`,
|
|
700
|
-
${
|
|
701
|
-
</div>`)}inRow(e,t){let n=t.file,r=!!n.exists;return this.details(`in|${e.key}|${t.path}`,
|
|
699
|
+
${this.link(e.key,`output`,O(D`${o}: input and output`))}
|
|
700
|
+
${T(e)?N:j`<br />${this.link(e.key,`transcript`,O(D`${o}: transcript`))}`}
|
|
701
|
+
</div>`)}inRow(e,t){let n=t.file,r=!!n.exists;return this.details(`in|${e.key}|${t.path}`,j`${Xl(t)}
|
|
702
702
|
${this.who(e)}
|
|
703
|
-
<span class="jmono jdim ct-path" title=${t.path}>${
|
|
704
|
-
<span class="meta ct-f">${r?`${n.size??0} B`:
|
|
705
|
-
${
|
|
706
|
-
<div class="ct-links">${this.link(e.key,`input`,
|
|
707
|
-
${o.length?
|
|
708
|
-
${o.map(e=>
|
|
703
|
+
<span class="jmono jdim ct-path" title=${t.path}>${$f(t.path)}</span>
|
|
704
|
+
<span class="meta ct-f">${r?`${n.size??0} B`:O(`No file`)}</span>`,j`${ru(t,`input`)}
|
|
705
|
+
${$l(t)}
|
|
706
|
+
<div class="ct-links">${this.link(e.key,`input`,O(D`${ep(e)}: input`))}</div>`)}};G([I({attribute:!1})],rp.prototype,`outputs`,void 0),G([I()],rp.prototype,`run`,void 0),G([I({attribute:!1})],rp.prototype,`journal`,void 0),G([I({attribute:!1})],rp.prototype,`plan`,void 0),rp=G([F(`ca-contracts`),k()],rp);var ip=e=>e.replace(/\$\{?([A-Za-z_]\w*)\}?/g,`<span class="pv">$&</span>`).replace(/\{\{contract\}\}/g,`<span class="pv pc">{{contract}}</span>`);function ap(e){let t=e.match(/^(TELEMETRY [^\n]*)\n+([\s\S]*)$/);return t?{head:t[1]??``,body:t[2]??``}:{head:``,body:e}}var op=new Set([`instructions`,`schema`,`agent`]),sp=class extends P{constructor(...e){super(...e),this.definition=null,this.memory=`definition`,this.open=new qn(`definition:open`,this),this.source=new qn(`definition:source`,this)}static{this.styles=[U,Wr,Kr,iu,A` :host{display:block;}.ct-in{display:flex;align-items:center;gap:10px;padding:5px 4px;border-top:1px solid var(--line);}.df{border-top:1px solid var(--line);}.df-hd{padding:6px 2px;display:flex;flex-wrap:wrap;gap:4px 10px;align-items:center;}.df-sum{flex:1 1 16em;min-width:0;display:flex;flex-wrap:wrap;gap:4px 10px;align-items:center;padding:0;background:none;border:0;color:inherit;text-align:start;cursor:pointer;}.df-sum .jmono{min-width:0;overflow-wrap:anywhere;}.df-tog{flex:none;margin-inline-start:auto;}.df-sum::before{content:'▸';color:var(--text-muted);width:10px;flex:none;transition:transform 0.15s;}.df-sum[aria-expanded='true']::before{transform:rotate(90deg);}.py-sig{font-family:var(--mono);font-size:14px;padding:10px 14px;background:var(--well);border:1px solid var(--line);border-radius:8px;overflow-x:auto;white-space:pre;}.py-where{margin:6px 2px 12px;font-family:var(--mono);font-size:11.5px;color:var(--text-muted);overflow-wrap:anywhere;}.py-doc{margin:0 0 12px;padding:8px 12px;border-left:3px solid var(--line2);color:var(--text-2);white-space:pre-wrap;line-height:1.6;}.src{display:grid;grid-template-columns:auto minmax(0,1fr);background:var(--well);border:1px solid var(--line);border-radius:8px;font-family:var(--mono);font-size:12px;line-height:1.55;max-height:520px;overflow:auto;}.src pre{margin:0;padding:10px 12px;white-space:pre;}.src .ln{color:var(--text-muted);text-align:right;user-select:none;border-right:1px solid var(--line);opacity:0.7;}`]}willUpdate(e){e.has(`memory`)&&(this.open=new qn(`${this.memory}:open`,this),this.source=new qn(`${this.memory}:source`,this))}render(){let e=this.definition;if(!e)return j`<div class="blank"><span class="ic" aria-hidden="true">⌘</span><b>${O(`No definition`)}</b></div>`;if(e.executor===`python`)return this.python(e);let t=e.plugin_dirs||[],n=e.output_from===`message`?J(e.output||``,O(`from the final message`)):e.output||``,r=e.preserve??[],i=[...e.base_kind?[[O(`Implementation of`),j`<span class="jmono" title=${O(`A kind that other kinds implement (base_kind)`)}>${e.base_kind}</span>`]]:[],[O(`Role`),e.role||O(`none`,{id:`none`})],[t.length>1?O(`Plugin directories`):O(`Plugin directory`),t.length?j`${t.map((e,t)=>j`${t?`, `:``}<span class="jmono" title=${e}>${(e=>{let t=e.split(`/`).filter(Boolean);return t.length>2?`…/${t.slice(-2).join(`/`)}`:e})(e)}</span>`)}`:O(`none`,{id:`none`})],[O(`Parameters`),e.params||O(`none`,{id:`none`})],[O(`Output`,{id:`definition-output`}),e.output_of?j`<span title=${O(`The kind whose output file this task writes (output_of)`)}>${J(n,(a=e.output_of,O(D`output of ${a}`)))}</span>`:n||O(`none`,{id:`none`})],...r.length?[[ol(),j`<span class="jmono" title=${sl()}>${r.join(`, `)}</span>`]]:[],...(e.validators||[]).length?[[O(`Other checks`),(e.validators||[]).join(`, `)]]:[],...Array.isArray(e.tools)&&e.tools.length===0?[[O(`Tools`),O(`none`,{id:`none`})]]:[]];var a;let o=Array.isArray(e.declared)?e.declared:[],s=t=>t.part===`agent`&&!!e.role&&t.path.replace(/^.*\//,``)===`${e.role}.md`,c=[...e.files||[]].sort((e,t)=>Number(s(t))-Number(s(e)));return j`<div class="drv-facts" style="margin-bottom:10px">${i.map(([e,t])=>j`<span><i>${e}</i>${t}</span>`)}</div>
|
|
707
|
+
${o.length?j`<h4 class="sect-h">${O(`Checked files`)}</h4>
|
|
708
|
+
${o.map(e=>j`<div class="ct-in">
|
|
709
709
|
<span class="ct-chip">${e.io}</span><span class="jmono">${e.path}</span>
|
|
710
|
-
<span class="meta" title=${
|
|
711
|
-
</div>`)}`:
|
|
712
|
-
${c.length?
|
|
713
|
-
`).length:0,i=e.retry_on??[],a=[[
|
|
710
|
+
<span class="meta" title=${O(`The schema the file is checked against`)}>${O(D`Schema ${e.schema}`)}</span>
|
|
711
|
+
</div>`)}`:N}
|
|
712
|
+
${c.length?j`<h4 class="sect-h">${O(`Files`)}</h4>${c.map(t=>this.file(t,s(t),!!e.role))}`:j`<div class="meta">${O(j`No files | defined in Python code (<code>TaskAdapter</code>)`)}</div>`}`}python(e){let t=(e.files||[]).find(e=>e.part===`source`),n=e.line??1,r=t?t.text.replace(/\n$/,``).split(`
|
|
713
|
+
`).length:0,i=e.retry_on??[],a=[[O(`Parameters`),e.params&&e.params!==`none`?e.params:O(`none`,{id:`none`})],[O(`Output`,{id:`definition-output`}),e.output&&e.output!==`none`?e.output:O(`none`,{id:`none`})],...(e.validators||[]).length?[[O(`Other checks`),(e.validators||[]).join(`, `)]]:[],...e.retries?[[O(`Retries`),j`<span title=${Ts()}>${o=e.retries,O(D`up to ${o}`)}</span>`]]:[],...e.retries&&i.length?[[O(`Retried exceptions`),j`<span class="jmono" title=${O(`Exceptions that give another attempt (retry_on)`)}>${i.join(`, `)}</span>`]]:[]];var o;return j`${e.signature?j`<div class="py-sig hl">${Ki(Wi(`def ${e.signature}`,`python`))}</div>`:N}
|
|
714
714
|
<div class="py-where">
|
|
715
|
-
${e.function??e.kind}${e.file?
|
|
715
|
+
${e.function??e.kind}${e.file?j` | <span title=${e.file}>${e.file.replace(/^.*\//,``)}${e.line?`:${e.line}`:``}</span>`:N}
|
|
716
716
|
</div>
|
|
717
|
-
${e.doc?
|
|
718
|
-
<div class="drv-facts" style="margin-bottom:12px">${a.map(([e,t])=>
|
|
719
|
-
${t?
|
|
717
|
+
${e.doc?j`<div class="py-doc">${e.doc}</div>`:N}
|
|
718
|
+
<div class="drv-facts" style="margin-bottom:12px">${a.map(([e,t])=>j`<span><i>${e}</i>${t}</span>`)}</div>
|
|
719
|
+
${t?j`<h4 class="sect-h">${O(`Source`)}</h4>
|
|
720
720
|
<div class="src">
|
|
721
721
|
<pre class="ln">${Array.from({length:r},(e,t)=>n+t).join(`
|
|
722
722
|
`)}</pre>
|
|
723
723
|
<pre class="hl">${Ki(Wi(t.text.replace(/\n$/,``),`python`))}</pre>
|
|
724
|
-
</div>`:
|
|
724
|
+
</div>`:N}`}file(e,t=!1,n=!1){let r=`${e.part}|${e.path}`,i=/\.md$/i.test(e.path),a=e.part===`instructions`,o=!i||this.source.has(r),s=e.part===`agent`&&n?t:op.has(e.part),c=this.open.has(r)||s&&!this.open.has(`closed:${r}`);return j`<div class="df">
|
|
725
725
|
<div class="df-hd">
|
|
726
|
-
<button type="button" class="df-sum" aria-expanded=${c?`true`:`false`} title=${t?
|
|
726
|
+
<button type="button" class="df-sum" aria-expanded=${c?`true`:`false`} title=${t?O(`Role of this kind`):N} @click=${()=>{this.open.set(r,!c),this.open.set(`closed:${r}`,c),this.requestUpdate()}}>
|
|
727
727
|
<span class="tag">${e.part}</span><span class="jmono">${e.path}</span>
|
|
728
728
|
</button>
|
|
729
|
-
${i?
|
|
729
|
+
${i?j`<button type="button" class="df-tog" @click=${()=>{this.source.set(r,!this.source.has(r)),this.requestUpdate()}}>${O(o?`Show rendered`:`Show source`)}</button>`:N}
|
|
730
730
|
</div>
|
|
731
|
-
${c?o?
|
|
732
|
-
</div
|
|
731
|
+
${c?o?j`<pre class="df-text"><code class="hl">${Ki(a?function(e){return ip(Ar(e))}(e.text):Wi(e.text,e.path))}</code></pre>`:Ki(Qi(e.text,a?ip:void 0)):N}
|
|
732
|
+
</div>`}};G([I({attribute:!1})],sp.prototype,`definition`,void 0),G([I()],sp.prototype,`memory`,void 0),sp=G([F(`ca-definition`),k()],sp);var cp=class extends P{constructor(...e){super(...e),this.run=``,this.live=!1,this.journal=[],this.plan=null,this.selected=null,this.defs=[],this.defsRun=``,this.timer=null}static{this.styles=[U,A` :host{display:block;container-type:inline-size;}.defs{display:grid;grid-template-columns:260px minmax(0,1fr);gap:14px;align-items:start;}.deflist{display:flex;flex-direction:column;gap:6px;}.defitem{padding:9px 12px;border-radius:10px;background:var(--panel);border:1px solid var(--line);cursor:pointer;color:inherit;text-align:start;display:flex;flex-direction:column;gap:2px;}.defitem:hover{border-color:var(--line2);}.defitem.sel{border-color:var(--accent);background:var(--accent-bg);}@container (max-width:720px){.defs{grid-template-columns:minmax(0,1fr);}}`]}disconnectedCallback(){super.disconnectedCallback(),this.clearTimer(),this.defsRun=``}connectedCallback(){super.connectedCallback(),this.run&&this.defsRun!==this.run&&this.load()}willUpdate(e){(e.has(`run`)||e.has(`client`))&&this.run&&this.client&&this.defsRun!==this.run&&(this.defs=[],this.load())}updated(){let e=new Set(this.tasks().filter(e=>!T(e)&&(e.tries.length||e.outcome===`running`)).map(e=>e.kind)).size;this.live&&this.defsRun===this.run&&this.defs.length<e&&!this.timer&&(this.timer=setTimeout(()=>{this.timer=null,this.load()},3e3))}tasks(){return[...S(this.journal,this.plan).outcomes.values()]}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}async load(){if(!this.client||!this.run)return;let e=this.run;this.defsRun=e;let t=[];try{t=await this.client.definitions(e)}catch{t=[]}e===this.run&&(this.defs=t)}render(){let e=this.defs,t=this.tasks(),n=[...new Set(t.filter(e=>T(e)).map(e=>e.kind))].filter(t=>!e.some(e=>e.kind===t));if(!e.length&&!n.length)return j`<div class="blank"><span class="ic" aria-hidden="true">⌘</span><b>${this.live?O(`No definitions yet`):O(`No definitions`)}</b></div>`;let r=this.selected!==null&&n.includes(this.selected)?this.selected:null,i=r?void 0:e.find(e=>e.kind===this.selected)??e.find(e=>e.plugin)??e[0],a=r??i?.kind??n[0]??``,o=e=>{let n=t.filter(t=>t.kind===e),r=n.length,i=n.reduce((e,t)=>e+t.tries.length,0);return as(O(r===1?`1 task`:D`${r} tasks`),O(i===1?`1 attempt`:D`${i} attempts`))};return j`<div class="defs">
|
|
733
733
|
<div class="deflist">
|
|
734
|
-
${
|
|
734
|
+
${W(e,e=>e.kind,e=>{return j`<button type="button" class="defitem ${e.kind===a?`sel`:``}" aria-current=${e.kind===a?`true`:N} @click=${()=>$(this,`ca-navigate`,{def:e.kind})}>
|
|
735
735
|
<b class="jmono">${e.kind}</b>
|
|
736
|
-
<span class="meta words">${ui([...e.base_kind?[(t=e.base_kind,
|
|
736
|
+
<span class="meta words">${ui([...e.base_kind?[(t=e.base_kind,O(D`Implementation of ${t}`))]:[],e.executor===`python`?`Python`:e.role?O(D`Role ${e.role}`):O(`No role`),...o(e.kind)])}</span>
|
|
737
737
|
</button>`;var t})}
|
|
738
|
-
${
|
|
738
|
+
${W(n,e=>e,e=>j`<button type="button" class="defitem ${e===a?`sel`:``}" aria-current=${e===a?`true`:N} @click=${()=>$(this,`ca-navigate`,{def:e})}>
|
|
739
739
|
<b class="jmono">${e}</b>
|
|
740
740
|
<span class="meta words">${ui([`Python`,...o(e)])}</span>
|
|
741
741
|
</button>`)}
|
|
742
742
|
</div>
|
|
743
743
|
<section class="panel">
|
|
744
|
-
${i?
|
|
745
|
-
${i.kind}<span class="r">${i.executor===`python`?
|
|
744
|
+
${i?j`<h3 title=${O(`As recorded when its first task started (definitions/<kind>.json)`)}>
|
|
745
|
+
${i.kind}<span class="r">${i.executor===`python`?O(`Python task`):i.plugin?O(D`Plugin ${i.name||``}`):O(`Defined in Python code`)}</span>
|
|
746
746
|
</h3>
|
|
747
|
-
<ca-definition .definition=${i} memory="definition:${i.kind}"></ca-definition>`:
|
|
747
|
+
<ca-definition .definition=${i} memory="definition:${i.kind}"></ca-definition>`:j`<h3>${a}<span class="r">${O(`Python task`)}</span></h3>
|
|
748
748
|
<ca-definition .definition=${null}></ca-definition>`}
|
|
749
749
|
</section>
|
|
750
|
-
</div>`}};
|
|
750
|
+
</div>`}};G([I({attribute:!1})],cp.prototype,`client`,void 0),G([I()],cp.prototype,`run`,void 0),G([I({type:Boolean})],cp.prototype,`live`,void 0),G([I({attribute:!1})],cp.prototype,`journal`,void 0),G([I({attribute:!1})],cp.prototype,`plan`,void 0),G([I({attribute:!1})],cp.prototype,`selected`,void 0),G([L()],cp.prototype,`defs`,void 0),cp=G([F(`ca-definitions`),k()],cp);var lp=class extends P{constructor(...e){super(...e),this.procs=null,this.unresponsive=!1,this.exported=!1}static{this.styles=[U,A` :host{display:block;}.cmd{word-break:break-all;}`]}open(e){$(this,`ca-open-task`,{key:e})}render(){let e=this.procs;if(!e?.alive){let e=this.exported?zc():this.unresponsive?gc():O(`not running`);return j`<div class="blank"><span class="ic" aria-hidden="true">⚙</span><b>${J(O(`No processes`),e)}</b></div>`}let t=e.python_tasks;return j`<div class="g12">
|
|
751
751
|
<section class="panel c12">
|
|
752
|
-
<h3 title=${
|
|
753
|
-
${e.launches.length?
|
|
754
|
-
<button type="button" class="fl-name jmono" @click=${()=>this.open(e.key)}>${
|
|
755
|
-
<span class="meta">${
|
|
752
|
+
<h3 title=${O(`One per task (Backend.run)`)}>${O(`Agent sessions running`)} <span class="r">${e.launches.length}</span></h3>
|
|
753
|
+
${e.launches.length?W(e.launches,e=>e.key,e=>j`<div class="fl" @click=${t=>!t.target.closest(`button`)&&this.open(e.key)}>
|
|
754
|
+
<button type="button" class="fl-name jmono" @click=${()=>this.open(e.key)}>${X(e)}</button>
|
|
755
|
+
<span class="meta">${J(O(D`PID ${e.pid}`),O(D`Model ${e.model||`—`}`),e.role?O(D`Role ${e.role}`):``)} |
|
|
756
756
|
<cae-elapsed .since=${Fr.at(`c:${e.key}`,e.age_s)}></cae-elapsed></span>
|
|
757
|
-
<div class="meta mono cmd">${(e.full_cmd||
|
|
758
|
-
</div>`):
|
|
757
|
+
<div class="meta mono cmd">${(e.full_cmd||O(`In the pipeline process`)).slice(0,400)}</div>
|
|
758
|
+
</div>`):j`<div class="meta">${O(`No agent sessions`)}</div>`}
|
|
759
759
|
</section>
|
|
760
|
-
${t.length?
|
|
761
|
-
<h3 title=${
|
|
762
|
-
${
|
|
763
|
-
<b class="jmono">${
|
|
764
|
-
<span class="meta">${
|
|
760
|
+
${t.length?j`<section class="panel c12">
|
|
761
|
+
<h3 title=${O(`Functions in the pipeline process`)}>${O(`Python tasks running`)} <span class="r">${t.length}</span></h3>
|
|
762
|
+
${W(t,e=>e.key,e=>j`<div class="fl">
|
|
763
|
+
<b class="jmono">${X(e)}</b>
|
|
764
|
+
<span class="meta">${O(D`PID ${e.pid}`)} | <cae-elapsed .since=${Fr.at(`p:${e.key}`,e.age_s)}></cae-elapsed></span>
|
|
765
765
|
</div>`)}
|
|
766
|
-
</section>`:
|
|
767
|
-
<section class="panel c12"><h3>${
|
|
768
|
-
</div>`}};
|
|
766
|
+
</section>`:N}
|
|
767
|
+
<section class="panel c12"><h3>${O(`Process tree`)}</h3><ca-proc-tree .procs=${e}></ca-proc-tree></section>
|
|
768
|
+
</div>`}};G([I({attribute:!1})],lp.prototype,`procs`,void 0),G([I({type:Boolean})],lp.prototype,`unresponsive`,void 0),G([I({type:Boolean})],lp.prototype,`exported`,void 0),lp=G([F(`ca-procs-view`),k()],lp),V(`cae-column-chart`,ja),V(`cae-line-chart`,Ma),V(`cae-heatmap`,Ia),V(`cae-state-grid`,Wa),V(`cae-bar-chart`,Ga),V(`cae-code`,Ji),V(`cae-tree`,sa);var up=[`failed`,`attention`,`done`,`running`,`muted`,`neutral`],dp=e=>typeof e._tone==`string`&&up.includes(e._tone)?e._tone:void 0,fp=new Set([`usd`,`pct`,`duration`,`tokens`,`number`]),pp=new WeakMap,mp=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return JSON.stringify(e);let t=pp.get(e);return t===void 0&&pp.set(e,t=JSON.stringify(e)),t},hp=new Intl.Collator,gp=[Gr,A` caption{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}tr{column-gap:12px;padding:6px 12px;border-bottom:1px solid var(--line);font-size:12px;min-width:560px;}th,td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}thead tr{color:var(--text-muted);font-size:11px;}tbody [data-align='end']{font-variant-numeric:tabular-nums;}tbody tr[data-tone='failed'],tbody tr[data-tone='attention']{box-shadow:inset 2px 0 0 var(--tone);}td a,th a{color:var(--accent);text-decoration:none;}td a:hover,th a:hover,td a:focus-visible,th a:focus-visible{text-decoration:underline;}`],_p=class extends P{constructor(...e){super(...e),this.baseUrl=``,this.label=``,this.sorts=new Map,this.sorted=new Map,this.picks=new Map}static{this.styles=[U,Wr,A` :host{display:block;}.note{font-size:var(--font-size-sm);color:var(--text-2);line-height:1.55;max-width:78ch;}.note>:first-child{margin-top:0;}.note>:last-child{margin-bottom:0;}.note[data-tone]{padding-left:10px;border-left:3px solid var(--line2);}.note[data-tone='failed']{border-left-color:var(--status-failed);}.note[data-tone='attention']{border-left-color:var(--status-attention);}.note[data-tone='done']{border-left-color:var(--status-done);}.note[data-tone='running']{border-left-color:var(--status-running);}.block + .block{margin-top:18px;}h4{margin:0 0 8px;font-size:var(--font-size-sm);font-weight:600;color:var(--text-2);}details>summary{cursor:pointer;margin-bottom:8px;font-size:var(--font-size-sm);font-weight:600;color:var(--text-2);}details:not([open])>summary{margin-bottom:0;}.block[data-anchor]{scroll-margin-top:12px;}.block[data-anchor]:focus{outline:none;}.pair{display:grid;grid-template-columns:minmax(180px,30%) minmax(0,1fr);gap:12px;align-items:start;}.pair>.tree{border:1px solid var(--line);border-radius:var(--radius-md);max-height:70vh;overflow:auto;}.pane{min-width:0;}@media (max-width:720px){.pair{grid-template-columns:minmax(0,1fr);}.pair>.tree{max-height:40vh;}}.embed{display:block;width:100%;height:calc(100dvh - 160px);min-height:320px;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface);}`]}render(){let e=fe(this.body);return e?this.draw(e,`0`):j`<cae-json-tree .value=${this.body??{}}></cae-json-tree>`}draw(e,t){let n=this.content(e,t),r=e.anchor||N;return e.title?e.collapsed?j`<details class="block" data-anchor=${r} tabindex=${e.anchor?-1:N}><summary>${e.title}</summary>${n}</details>`:j`<div class="block" data-anchor=${r} tabindex=${e.anchor?-1:N}><h4>${e.title}</h4>${n}</div>`:j`<div class="block" data-anchor=${r} tabindex=${e.anchor?-1:N}>${n}</div>`}code(e,t){return j`<cae-code .code=${e.text} .language=${e.language??``} .start=${e.start??1} .highlight=${e.highlight??[]} .path=${e.path??t??``} .label=${e.title??e.path??t??``} ?wrap=${!!e.wrap} .strings=${{copy:O(`Copy`),copied:O(`Copied`),wrap:O(`Wrap lines`),empty:O(`No text`),cut:(e,t)=>O(D`First ${e.toLocaleString(R())} of ${t.toLocaleString(R())} lines`)}}></cae-code>`}embed(e){let t=new URL(this.baseUrl?this.baseUrl.replace(/\/?$/,`/`):`./`,document.baseURI),n=new URL(e.url,t);return n.searchParams.set(`theme`,function(e){for(let t=e;t;t=t.parentNode??(t instanceof ShadowRoot?t.host:null)){let e=t instanceof Element?t.getAttribute(`data-ca-theme`):null;if(e)return e.includes(`light`)?`light`:`dark`}return matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}(this)),j`<iframe class="embed" src=${n.href} title=${e.title||this.label} style=${e.height?`height:${e.height}px`:N}></iframe>`}tree(e,t){let{items:n,nodes:r,first:i}=function(e){let t=new Map,n=null,r=(e,i)=>e.map(e=>{let a=i?`${i}/${e.name}`:e.name,o=e.id??a;return t.set(o,e),n===null&&e.code&&(n=o),{id:o,name:e.name,icon:e.icon??null,badge:e.badge??null,tone:e.tone??null,open:e.open??!0,selectable:!!e.code||!!e.link,children:e.children?.length?r(e.children,a):null}});return{items:r(e.nodes,``),nodes:t,first:e.selected??n}}(e),a=this.picks.get(t),o=a!==void 0&&r.has(a)?a:i,s=o?r.get(o):void 0,c=[...r.values()].some(e=>e.code),l=j`<cae-tree class="tree" .items=${n} .selected=${s?.code?o:null} .label=${e.title??``} .strings=${{empty:O(`No items`)}} @cae-select=${e=>this.choose(t,e.detail.id,r)}></cae-tree>`;return c?j`<div class="pair">
|
|
769
769
|
${l}
|
|
770
|
-
<div class="pane">${s?.code?this.code(s.code,o??``):
|
|
771
|
-
</div>`:l}choose(e,t,n){let r=t===null?void 0:n.get(t);r&&t!==null&&(r.code?this.picks=new Map(this.picks).set(e,t):r.link&&this.follow(r.link))}follow(e){if(e.anchor){let t=this.renderRoot.querySelector(`[data-anchor="${CSS.escape(e.anchor)}"]`);t?.scrollIntoView?.({block:`start`}),t?.focus({preventScroll:!0});return}let t=e.run?{run:e.run}:{};e.panel?$(this,`ca-navigate`,{page:``,...t,tab:`panel:${e.panel}`}):e.task&&$(this,`ca-navigate`,{page:``,...t,tab:`stream`,key:e.task,view:`transcript`,round:null})}content(e,t){let n={empty:
|
|
770
|
+
<div class="pane">${s?.code?this.code(s.code,o??``):j`<div class="meta">${O(`No selection`)}</div>`}</div>
|
|
771
|
+
</div>`:l}choose(e,t,n){let r=t===null?void 0:n.get(t);r&&t!==null&&(r.code?this.picks=new Map(this.picks).set(e,t):r.link&&this.follow(r.link))}follow(e){if(e.anchor){let t=this.renderRoot.querySelector(`[data-anchor="${CSS.escape(e.anchor)}"]`);t?.scrollIntoView?.({block:`start`}),t?.focus({preventScroll:!0});return}let t=e.run?{run:e.run}:{};e.panel?$(this,`ca-navigate`,{page:``,...t,tab:`panel:${e.panel}`}):e.task&&$(this,`ca-navigate`,{page:``,...t,tab:`stream`,key:e.task,view:`transcript`,round:null})}content(e,t){let n={empty:O(`No values`),showTable:O(`Show table`),showChart:O(`Show chart`),label:O(`Label`),other:O(`Other`),total:O(`Total`),none:`—`,scale:(e,t)=>O(D`${e} to ${t}`)};switch(e.type){case`blocks`:return j`${e.blocks.map((e,n)=>{let r=fe(e);return r?this.draw(r,`${t}.${n}`):j`<div class="block"><cae-json-tree .value=${e}></cae-json-tree></div>`})}`;case`tiles`:return j`<cae-stat-tiles .tiles=${r=e.tiles,r.map(e=>({id:e.id,label:e.label,value:e.value,tone:e.tone??void 0,tip:e.tip??void 0,sub:e.sub??[]}))} .bump=${!1}></cae-stat-tiles>`;case`table`:return this.table(e,t);case`columns`:return j`<cae-column-chart .label=${e.title??``} .x=${e.x} .series=${e.series} ?stacked=${!!e.stacked} .format=${Pc(e.unit)} .strings=${n}></cae-column-chart>`;case`lines`:return j`<cae-line-chart .label=${e.title??``} .x=${e.x} .series=${e.series} .format=${Pc(e.unit)} .strings=${n}></cae-line-chart>`;case`heatmap`:return j`<cae-heatmap .label=${e.title??``} .x=${e.x} .y=${e.y} .values=${e.values} .format=${Pc(e.unit)} .strings=${n}></cae-heatmap>`;case`hbars`:return j`<cae-bar-chart .label=${e.title??``} .bars=${e.bars.map(e=>({label:e.label,value:e.value,tone:e.tone??void 0}))} .format=${Pc(e.unit)} .strings=${n}></cae-bar-chart>`;case`status_grid`:return j`<cae-state-grid .label=${e.title??``} .x=${e.x} .y=${e.y} .cells=${e.cells} .strings=${n}></cae-state-grid>`;case`note`:return j`<div class="note" data-tone=${e.tone&&e.tone!==`neutral`?e.tone:N}>${Ki(Zi(e.text))}</div>`;case`code`:return this.code(e);case`tree`:return this.tree(e,t);case`embed`:return this.embed(e);default:return j`${N}`}var r}sortedRows(e,t,n,r){let i=this.sorted.get(e);if(i&&i.b===t&&i.sort===n)return i.rows;let a=r();return this.sorted.set(e,{b:t,sort:n,rows:a}),a}table(e,t){let n=(s=e).columns.map((e,t)=>{let n=e.format?fp.has(e.format):s.rows.some(t=>typeof t[e.id]==`number`),r=e.bar?Math.max(0,...s.rows.map(t=>Number(t[e.id])||0)):0;return{id:e.id,header:e.label,tip:e.tip??void 0,align:e.align??(n?`end`:`start`),rowHeader:t===0,compare:(t,n)=>function(e,t){let n=e=>e==null||e===``;return n(e)||n(t)?n(e)===n(t)?0:n(e)?1:-1:typeof e==`number`&&typeof t==`number`?e-t:hp.compare(mp(e),mp(t))}(t[e.id],n[e.id]),text:t=>Fc(t[e.id],e.format),cell:t=>{let n=t[e.id],i=Fc(n,e.format),a=e.link?function(e){if(typeof e!=`string`||!/^https?:\/\//i.test(e.trim()))return null;try{let t=new URL(e.trim());return t.protocol===`http:`||t.protocol===`https:`?t.href:null}catch{return null}}(t[e.link]):null;return a?j`<a href=${a} target="_blank" rel="noopener noreferrer">${i}</a>`:e.bar&&typeof n==`number`?j`${i}<span class="jdur" aria-hidden="true"><i style="width: ${r>0?100*Math.max(0,n)/r:0}%"></i></span>`:i}}}),r=e.rows,i=new Map(r.map((e,t)=>[e,String(t)])),a=this.sorts.get(t)??null,o=a?this.sortedRows(t,e,a,()=>function(e,t,n){let r=n&&t.find(e=>e.id===n.id);if(!n||!r)return[...e];let i=n.direction===`desc`?-1:1,{compare:a,text:o}=r,s=(e,t)=>{let n=o?o(e):r.cell(e,t);return typeof n==`number`||typeof n==`string`?n:``};return e.map((e,t)=>({r:e,i:t,v:a?0:s(e,t)})).sort((e,t)=>i*((e,t)=>a?a(e.r,t.r):typeof e.v==`number`&&typeof t.v==`number`?e.v-t.v:da.compare(String(e.v),String(t.v)))(e,t)||e.i-t.i).map(e=>e.r)}(r,n,a)):r;var s;return j`<cae-data-table .columns=${n} .rows=${o} .rowKey=${e=>i.get(e)??``} .rowTone=${dp} .activatable=${!1} .sort=${a} .cellStyles=${gp} .caption=${e.title??``} .strings=${Sc(O(`No rows`))} @cae-sort=${e=>this.sorts=new Map(this.sorts).set(t,e.detail)} ></cae-data-table>`}};G([I({attribute:!1})],_p.prototype,`body`,void 0),G([I({attribute:`base-url`})],_p.prototype,`baseUrl`,void 0),G([I()],_p.prototype,`label`,void 0),G([L()],_p.prototype,`sorts`,void 0),G([L()],_p.prototype,`picks`,void 0),_p=G([F(`ca-panel-body`),k()],_p);var vp=class extends P{constructor(...e){super(...e),this.name=``,this.baseUrl=``}static{this.styles=[U,A` :host{display:block;}.tab-ic{opacity:1;margin-right:6px;font-size:12px;}.desc{margin:-4px 0 12px;}`]}render(){if(this.data===void 0)return this.panel?j`<div class="blank"><span class="ic" aria-hidden="true">…</span>${O(`Loading…`)}</div>`:j`<div class="blank"><span class="ic" aria-hidden="true">▤</span>${O(D`No custom view named ${this.name}`)}</div>`;let e=this.panel;return j`<section class="panel">
|
|
772
772
|
<h3><span class="tab-ic" aria-hidden="true">${e?.icon||`▤`}</span>${e?.title||this.name}
|
|
773
|
-
<span class="r">${
|
|
774
|
-
${e?.description?
|
|
775
|
-
${
|
|
776
|
-
</section>`}};
|
|
777
|
-
`))/^Errors:\s*$/.test(r)?n=!0:n&&r.startsWith(`- `)?t.push(r.slice(2)):n&&r.trim()&&!r.startsWith(`- `)&&(n=!1);return t}z(`cae-transcript`,qo);var np=e=>!!e&&(e.prompt||``).startsWith(`The output file(s) you wrote do not pass their checks.`);function rp(e,t){let n=new Map(t.filter(e=>e.stop!==`invalid_input`&&e.stop!==`skipped`).map((e,t)=>[t+1,e])),r=[],i=0,a=0,o=0;return e.forEach((e,t)=>{let s=n.get(i)?.hops?.length??1;t>0&&np(e)?a++:t>0&&o+1<s?(o++,a=0):(i++,o=0,a=0);let c=n.get(i)?.hops?.[o],l=c?.model||c?.route||``,u=a?`fixup`:o?`switch`:`try`;r.push({kind:u,tryNo:i,fixupNo:a,hopNo:o,model:l,result:null,rejectedWith:[],switchedStop:``,switchedTo:``,row:null})}),r.forEach((t,i)=>{let a=r[i+1];if(a&&a.tryNo===t.tryNo&&a.hopNo!==t.hopNo)return t.result=`switched`,t.switchedStop=n.get(t.tryNo)?.hops?.[t.hopNo]?.stop??``,void(t.switchedTo=a.model);if(a&&a.tryNo===t.tryNo)return t.result=`rejected`,void(t.rejectedWith=tp(e[i+1]?.prompt));let o=n.get(t.tryNo)??null;t.row=o,t.result=o?o.ok?`ok`:`failed`:null}),r}var ip=e=>/\[([\w.-]+)\]/.exec(e)?.[1]??``;function ap(e){let t=/\[([\w.-]+)\]\s*(.*)$/.exec(e);return t?`${t[1]}: ${t[2]}`:e}function op(e,t,n=_s(e.tryNo-1)){return t>1?e.fixupNo?K(n,E(T`correction round ${e.fixupNo}`)):e.hopNo?K(n,E(`model switch`)):n:e.fixupNo?E(T`Correction round ${e.fixupNo}`):e.hopNo?E(`Model switch`):_s(0)}function sp(e){let t=e.model||E(`model`);return e.switchedTo?E(T`${t}: ${ps(e.switchedStop)} → ${e.switchedTo}`):E(T`${t}: ${ps(e.switchedStop)} → next model`)}var cp={claude:`Claude Code`,omp:`omp`,codex:`Codex`,opencode:`opencode`,gemini:`Gemini CLI`};function lp(e){let t=String(e||``).split(`/`).pop()??``;return cp[t]??t}var up=(e,t)=>{let n=e.indexOf(t);return n>=0?e[n+1]??``:``};function dp(e){let t=e.argv,n=/TELEMETRY [^\n]*role=([\w:-]+)/.exec(e.prompt||``)?.[1];return{agent:lp(t[0]),model:up(t,`--model`)||up(t,`-m`),role:n&&n!==`-`?n:``}}function fp(e){if(!e)return[];let t=[];return e.agent&&t.push({label:E(`coding agent`),value:e.agent,tip:E(`The CLI that ran the task (claude, omp)`)}),e.model&&t.push({label:E(`model`),value:e.model,tip:E(`The model the agent session ran on`),look:`mono`}),e.role&&t.push({label:E(`role`),value:e.role,tip:E(`The agent definition the coding agent ran as (agents/<role>.md)`),look:`quiet`}),t}function pp(e){let t=e.prompt||``,n=e.prompt_truncated||0;return[{id:`cmd`,code:!0,summary:E(`Command line`),text:e.argv.join(` `)},{id:`prompt`,summary:E(n?T`Prompt (${t.length} characters; ${n} characters not saved)`:T`Prompt (${t.length} characters)`),text:t+(n?`\n\n${E(T`(${n} characters not saved)`)}`:``)}]}function mp(e,t){if(e.result===`rejected`)return{tone:`attention`,title:E(`Output failed checks`),list:e.rejectedWith.map(e=>w(e,t)),note:E(`Sent in the correction prompt`)};if(e.result===`switched`)return{tone:`failed`,title:sp(e)};if(e.result===`failed`&&e.row){let n=w(e.row.reason,t)||ps(e.row.stop);return{tone:`failed`,title:E(T`Attempt ${e.tryNo} failed: ${n}`)}}}function hp(e,t,n){let r=t[t.length-1]?.tryNo??1,i=vs(n.rows.filter(f)),a=e.rounds.length-1;return e.rounds.map((e,o)=>{let s=t[o],[c,l,u]=s?function(e,t){switch(e.result){case`ok`:return[`✓`,E(`passed`),E(`Output passed checks`)];case`rejected`:return[`✕`,E(`failed checks`),E(`Output failed checks`)];case`switched`:return[`✕`,ps(e.switchedStop),sp(e)];case`failed`:return[`✕`,E(`failed`),w(e.row?.reason,t)||ps(e.row?.stop)];default:return[``,``,``]}}(s,n.run):[``,``,``],d=e.who?.model;return{id:e.id,title:s?op(s,r,i[s.tryNo-1]):String(o+1),facts:d?[d.replace(/^claude-/,``)]:[],verdict:c?{tone:c===`✓`?`done`:`failed`,text:l,tip:u}:void 0,active:o===a&&n.active,tags:e.launch?fp((f=e.who,p=n.shownWho,f&&p?{agent:f.agent===p.agent?``:f.agent,model:f.model===p.model?``:f.model,role:f.role===p.role?``:f.role}:f??null)):[],details:e.launch?pp(e.launch):[],items:e.items.map(e=>e.type===`event`?{...e,title:E(`API request sent again`)}:e),footer:s&&mp(s,n.run)};var f,p})}var gp=/\{\s*"title"\s*:\s*"((?:[^"\\]|\\.)*)"\s*,\s*"url"\s*:\s*"(https?:\/\/[^"\s]+)"/g,_p=/^\s*\[\d+\]\s+(.+)\n\s*(https?:\/\/\S+)/gm,vp=/https?:\/\/[^\s"'<>)\]]+/g;function yp(e){let t=e??``,n=[],r=new Set,i=(e,t)=>{r.has(t)||n.length>=20||(r.add(t),n.push({title:e.trim()||t,url:t}))};for(let e of t.matchAll(gp)){let t=e[1]??``;try{t=JSON.parse(`"${t}"`)}catch{}i(t,e[2]??``)}if(!n.length)for(let e of t.matchAll(_p))i(e[1]??``,e[2]??``);if(!n.length)for(let e of t.matchAll(vp))i(``,e[0].replace(/[.,;:!?]+$/,``));return n}var bp=()=>({rounds:[],tools:new Map,next:0}),xp=/session init:.*?model=([\w.\-:]+)/;function Sp(e){return`i`+e.next++}function Cp(e,t){let n={id:`r${e.rounds.length}`,launch:t,who:t?dp(t):null,items:[]};return e.rounds.push(n),n}function wp(e){return e.rounds[e.rounds.length-1]??Cp(e,null)}function Tp(e,t){t?e.name=t:e.name||=`tool`,e.icon=(e.name.split(/[_:]/).pop()??``).toLowerCase()}function Ep(e,t,n){let r=n?e.tools.get(n):void 0;return r||(r={type:`tool`,id:n?`call:${n}`:Sp(e),call:n,name:``,icon:``,summary:``,intent:``,body:``,output:null,status:`running`},n&&e.tools.set(n,r),t.items.push(r)),r}function Dp(e,t){let n=0;for(let i of t){let t=r(i);if(!t)continue;if(t.type===`launch`){Cp(e,t),n++;continue}let a=wp(e);switch(t.type){case`message_start`:case`message_end`:if(t.role!==`user`||!t.text)continue;a.items.push({type:`prompt`,id:Sp(e),text:t.text});break;case`turn_end`:if(!t.thinking)continue;a.items.push({type:`reasoning`,id:Sp(e),text:t.thinking});break;case`acall`:case`tool_execution_start`:case`tool_execution_update`:{let n=Ep(e,a,t.call);n.output===null?(Tp(n,t.tool),n.summary=$o(t.cmd),n.intent=t.intent||``,n.body=t.cmd||n.body,t.web_query&&(n.query=t.web_query),t.web_fetch&&(n.page=t.web_fetch)):!n.summary&&t.cmd&&(n.summary=$o(t.cmd));break}case`aresult`:case`tool_execution_end`:{let n=Ep(e,a,t.call);if(n.output!==null&&!t.out)break;Tp(n,t.tool),n.status=t.err?`error`:`ok`,!n.summary&&n.body&&(n.summary=$o(n.body)),n.output=t.out||`(no output)`,n.query&&(n.links=yp(n.output));break}case`message_update`:{if(!t.delta)continue;let n=a.items[a.items.length-1];n?.type===`message`?n.text+=t.delta:a.items.push({type:`message`,id:Sp(e),text:t.delta});break}case`auto_retry_start`:a.items.push({type:`event`,id:Sp(e),icon:`↻`,title:``,text:t.err??``});break;case`notice`:{let n=xp.exec(t.text||``)?.[1];n&&(a.who??={agent:``,model:``,role:``},a.who.model||(a.who.model=n)),a.items.push({type:`notice`,id:Sp(e),text:(t.text||``).replace(/\s+/g,` `).trim()});break}}n++}return n}var Op=class{constructor(e){this.host=e,this.model=bp(),this.behind=0,this.count=0,this.ready=!1,this.version=0,this.generation=0,this.loaded=``,this.close=null,e.addController(this)}get tailing(){return this.close!==null}hostDisconnected(){this.stop(),this.loaded=``}stop(){this.close?.(),this.close=null}load(e,t){if(this.stop(),this.loaded=e,this.generation++,this.version++,this.model=bp(),this.behind=0,this.count=0,this.ready=!1,t&&`events`in t)this.count=Dp(this.model,t.events),this.ready=!0;else if(t){let e=this.generation;this.close=function(e,t,n,r={}){return s(`${l(r)}/events/stream?run=${c(e)}&key=${c(t)}`,[`stream`],{...n,message:e=>n.message(e.data)},r)}(t.run,t.stream,{message:t=>this.onPage(t,e)},{baseUrl:t.baseUrl})}}append(e){e.length&&(this.count+=Dp(this.model,e),this.version++)}onPage(e,t){t===this.generation&&(!this.ready&&e.behind&&(this.behind=e.behind),this.count+=Dp(this.model,e.events),this.ready=!0,this.version++,this.host.requestUpdate())}async loadEarlier(e,t,n){let r=this.generation,i=Math.max(0,this.behind-3e3);this.behind=0,this.host.requestUpdate();let a=await e.stream(t,n,i);r===this.generation&&(this.model=bp(),Dp(this.model,a.events),this.version++,this.host.requestUpdate())}};function kp(e){return k`<cae-markdown .text=${e} .split=${Hf} .strings=${{showRendered:E(`Show rendered`),showSource:E(`Show source`)}}></cae-markdown>`}z(`cae-markdown`,ea);var Ap=class extends M{constructor(...e){super(...e),this.events=null,this.run=``,this.stream=null,this.baseUrl=``,this.client=null,this.live=!1,this.round=null,this.rows=[],this.shownWho=null,this.mode=`full`,this.shown=-1,this.feed=new Op(this),this.memory=null,this.drawn=null,this.lastSent=``,this.fed=null}static{this.styles=O` :host{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;position:relative;}:host([mode='none']){display:none;}:host([mode='tabs']){flex:none;}`}get source(){return this.events?`static`:this.run&&this.stream?`${this.run}\n${this.stream}`:``}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}willUpdate(e){let t=this.source;if(!e.has(`events`)&&t===this.feed.loaded)return;let n=this.fed,r=this.events;if(this.fed=r,r&&n&&t===this.feed.loaded&&function(e,t){if(e===t||e.length<t.length)return e===t;for(let n=t.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}(r,n))return void this.feed.append(r.slice(n.length));let{run:i,stream:a}=this,o=`transcript:${i}/${a??``}`,s=Jn(this),c=s===Wn?new Xn(`${o}:open`):new Yn(`${o}:open`,this),l=!this.events&&!!a;this.memory={isOpen:e=>c.has(e),setOpen:(e,t)=>c.set(e,t),scroll:()=>l?s.recall(`${o}:scroll`):void 0,setScroll:e=>l&&s.remember(`${o}:scroll`,e)},this.shown=-1,this.feed.load(t,this.events?{events:this.events}:t&&a?{run:i,stream:a,baseUrl:this.baseUrl}:null)}sections(){let e=this.live&&this.feed.tailing,t=this.shownWho,n=[this.feed.version,this.rows,this.run,e,I(),t?.agent,t?.model,t?.role];if(this.drawn?.key.every((e,t)=>e===n[t]))return this.drawn;let r=this.feed.model,i=rp(r.rounds.map(e=>e.launch),this.rows);return this.drawn={key:n,rounds:i,sections:hp(r,i,{run:this.run,rows:this.rows,active:e,shownWho:t})},this.drawn}render(){let e=this.feed,{sections:t}=this.sections();return Co(e.generation,k`<cae-transcript .sections=${t} .shown=${this.round===null?null:this.round-1} ?live=${this.live} .earlier=${e.behind} ?loading=${!e.ready} .count=${e.count} mode=${this.mode} .memory=${this.memory} .markdown=${Zi} .renderDetail=${e=>kp(e.text)} .strings=${{sections:E(`Agent sessions`),sectionsTip:[`${E(`Retry`)}: ${gs()}`,`${E(`Correction round`)}: ${Zs()}`,`${E(`Model switch`)}: ${Gs()}`].join(`
|
|
778
|
-
`),loadEarlier:e=>
|
|
779
|
-
`);return[{label:
|
|
773
|
+
<span class="r">${O(`Custom view`)}</span></h3>
|
|
774
|
+
${e?.description?j`<div class="meta desc">${e.description}</div>`:N}
|
|
775
|
+
${fe(this.data)?j`<ca-panel-body .body=${this.data} base-url=${this.baseUrl} label=${e?.title||this.name}></ca-panel-body>`:j`<cae-json-tree .value=${this.data}></cae-json-tree>`}
|
|
776
|
+
</section>`}};G([I()],vp.prototype,`name`,void 0),G([I({attribute:!1})],vp.prototype,`panel`,void 0),G([I({attribute:!1})],vp.prototype,`data`,void 0),G([I({attribute:`base-url`})],vp.prototype,`baseUrl`,void 0),vp=G([F(`ca-panel-view`),k()],vp);var yp=class{constructor(e){this.host=e,this.value=null,this.error=null,this.token=0}load(e,t,n){let r=++this.token;this.value=null,this.error=null,t&&n&&e&&this.fetch(r,e,t,n)}async fetch(e,t,n,r){let i,a=null;try{i=await t.task(n,r)}catch(e){i=(e=>({key:e,rows:[],launches:[],definition:null,io:{params:{},inputs:[],outputs:[],executor:`agent`,upstream:[],downstream:[]},stream:null}))(r),a=e}e===this.token&&(this.value=i,this.error=a,this.host.requestUpdate())}};function bp(e){let t=[],n=!1;for(let r of(e||``).split(`
|
|
777
|
+
`))/^Errors:\s*$/.test(r)?n=!0:n&&r.startsWith(`- `)?t.push(r.slice(2)):n&&r.trim()&&!r.startsWith(`- `)&&(n=!1);return t}V(`cae-transcript`,ns);var xp=e=>!!e&&(e.prompt||``).startsWith(`The output file(s) you wrote do not pass their checks.`);function Sp(e,t){let n=new Map(t.filter(e=>e.stop!==`invalid_input`&&e.stop!==`skipped`).map((e,t)=>[t+1,e])),r=[],i=0,a=0,o=0;return e.forEach((e,t)=>{let s=n.get(i)?.hops?.length??1;t>0&&xp(e)?a++:t>0&&o+1<s?(o++,a=0):(i++,o=0,a=0);let c=n.get(i)?.hops?.[o],l=c?.model||c?.route||``,u=a?`fixup`:o?`switch`:`try`;r.push({kind:u,tryNo:i,fixupNo:a,hopNo:o,model:l,result:null,rejectedWith:[],switchedStop:``,switchedTo:``,row:null})}),r.forEach((t,i)=>{let a=r[i+1];if(a&&a.tryNo===t.tryNo&&a.hopNo!==t.hopNo)return t.result=`switched`,t.switchedStop=n.get(t.tryNo)?.hops?.[t.hopNo]?.stop??``,void(t.switchedTo=a.model);if(a&&a.tryNo===t.tryNo)return t.result=`rejected`,void(t.rejectedWith=bp(e[i+1]?.prompt));let o=n.get(t.tryNo)??null;t.row=o,t.result=o?o.ok?`ok`:`failed`:null}),r}var Cp=e=>/\[([\w.-]+)\]/.exec(e)?.[1]??``;function wp(e){let t=/\[([\w.-]+)\]\s*(.*)$/.exec(e);return t?`${t[1]}: ${t[2]}`:e}function Tp(e,t,n=Es(e.tryNo-1)){return t>1?e.fixupNo?J(n,O(D`correction round ${e.fixupNo}`)):e.hopNo?J(n,O(`model switch`)):n:e.fixupNo?O(D`Correction round ${e.fixupNo}`):e.hopNo?O(`Model switch`):Es(0)}function Ep(e){let t=e.model||O(`model`);return e.switchedTo?O(D`${t}: ${Ss(e.switchedStop)} → ${e.switchedTo}`):O(D`${t}: ${Ss(e.switchedStop)} → next model`)}var Dp={claude:`Claude Code`,omp:`omp`,codex:`Codex`,opencode:`opencode`,gemini:`Gemini CLI`};function Op(e){let t=String(e||``).split(`/`).pop()??``;return Dp[t]??t}var kp=(e,t)=>{let n=e.indexOf(t);return n>=0?e[n+1]??``:``};function Ap(e){let t=e.argv,n=/TELEMETRY [^\n]*role=([\w:-]+)/.exec(e.prompt||``)?.[1];return{agent:Op(t[0]),model:kp(t,`--model`)||kp(t,`-m`),role:n&&n!==`-`?n:``}}function jp(e){if(!e)return[];let t=[];return e.agent&&t.push({label:O(`coding agent`),value:e.agent,tip:O(`The CLI that ran the task (claude, omp)`)}),e.model&&t.push({label:O(`model`),value:e.model,tip:O(`The model the agent session ran on`),look:`mono`}),e.role&&t.push({label:O(`role`),value:e.role,tip:O(`The agent definition the coding agent ran as (agents/<role>.md)`),look:`quiet`}),t}function Mp(e){let t=e.prompt||``,n=e.prompt_truncated||0;return[{id:`cmd`,code:!0,summary:O(`Command line`),text:e.argv.join(` `)},{id:`prompt`,summary:O(n?D`Prompt (${t.length} characters; ${n} characters not saved)`:D`Prompt (${t.length} characters)`),text:t+(n?`\n\n${O(D`(${n} characters not saved)`)}`:``)}]}function Np(e,t){if(e.result===`rejected`)return{tone:`attention`,title:O(`Output failed checks`),list:e.rejectedWith.map(e=>E(e,t)),note:O(`Sent in the correction prompt`)};if(e.result===`switched`)return{tone:`failed`,title:Ep(e)};if(e.result===`failed`&&e.row){let n=E(e.row.reason,t)||Ss(e.row.stop);return{tone:`failed`,title:O(D`Attempt ${e.tryNo} failed: ${n}`)}}}function Pp(e,t,n){let r=t[t.length-1]?.tryNo??1,i=Ds(n.rows.filter(d)),a=e.rounds.length-1;return e.rounds.map((e,o)=>{let s=t[o],[c,l,u]=s?function(e,t){switch(e.result){case`ok`:return[`✓`,O(`passed`),O(`Output passed checks`)];case`rejected`:return[`✕`,O(`failed checks`),O(`Output failed checks`)];case`switched`:return[`✕`,Ss(e.switchedStop),Ep(e)];case`failed`:return[`✕`,O(`failed`),E(e.row?.reason,t)||Ss(e.row?.stop)];default:return[``,``,``]}}(s,n.run):[``,``,``],d=e.who?.model;return{id:e.id,title:s?Tp(s,r,i[s.tryNo-1]):String(o+1),facts:d?[d.replace(/^claude-/,``)]:[],verdict:c?{tone:c===`✓`?`done`:`failed`,text:l,tip:u}:void 0,active:o===a&&n.active,tags:e.launch?jp((f=e.who,p=n.shownWho,f&&p?{agent:f.agent===p.agent?``:f.agent,model:f.model===p.model?``:f.model,role:f.role===p.role?``:f.role}:f??null)):[],details:e.launch?Mp(e.launch):[],items:e.items.map(e=>e.type===`event`?{...e,title:O(`API request sent again`)}:e),footer:s&&Np(s,n.run)};var f,p})}var Fp=/\{\s*"title"\s*:\s*"((?:[^"\\]|\\.)*)"\s*,\s*"url"\s*:\s*"(https?:\/\/[^"\s]+)"/g,Ip=/^\s*\[\d+\]\s+(.+)\n\s*(https?:\/\/\S+)/gm,Lp=/https?:\/\/[^\s"'<>)\]]+/g;function Rp(e){let t=e??``,n=[],r=new Set,i=(e,t)=>{r.has(t)||n.length>=20||(r.add(t),n.push({title:e.trim()||t,url:t}))};for(let e of t.matchAll(Fp)){let t=e[1]??``;try{t=JSON.parse(`"${t}"`)}catch{}i(t,e[2]??``)}if(!n.length)for(let e of t.matchAll(Ip))i(e[1]??``,e[2]??``);if(!n.length)for(let e of t.matchAll(Lp))i(``,e[0].replace(/[.,;:!?]+$/,``));return n}var zp=()=>({rounds:[],tools:new Map,next:0}),Bp=/session init:.*?model=([\w.\-:]+)/;function Vp(e){return`i`+e.next++}function Hp(e,t){let n={id:`r${e.rounds.length}`,launch:t,who:t?Ap(t):null,items:[]};return e.rounds.push(n),n}function Up(e){return e.rounds[e.rounds.length-1]??Hp(e,null)}function Wp(e,t){t?e.name=t:e.name||=`tool`,e.icon=(e.name.split(/[_:]/).pop()??``).toLowerCase()}function Gp(e,t,n){let r=n?e.tools.get(n):void 0;return r||(r={type:`tool`,id:n?`call:${n}`:Vp(e),call:n,name:``,icon:``,summary:``,intent:``,body:``,output:null,status:`running`},n&&e.tools.set(n,r),t.items.push(r)),r}function Kp(e,t){let n=0;for(let i of t){let t=r(i);if(!t)continue;if(t.type===`launch`){Hp(e,t),n++;continue}let a=Up(e);switch(t.type){case`message_start`:case`message_end`:if(t.role!==`user`||!t.text)continue;a.items.push({type:`prompt`,id:Vp(e),text:t.text});break;case`turn_end`:if(!t.thinking)continue;a.items.push({type:`reasoning`,id:Vp(e),text:t.thinking});break;case`acall`:case`tool_execution_start`:case`tool_execution_update`:{let n=Gp(e,a,t.call);n.output===null?(Wp(n,t.tool),n.summary=ss(t.cmd),n.intent=t.intent||``,n.body=t.cmd||n.body,t.web_query&&(n.query=t.web_query),t.web_fetch&&(n.page=t.web_fetch)):!n.summary&&t.cmd&&(n.summary=ss(t.cmd));break}case`aresult`:case`tool_execution_end`:{let n=Gp(e,a,t.call);if(n.output!==null&&!t.out)break;Wp(n,t.tool),n.status=t.err?`error`:`ok`,!n.summary&&n.body&&(n.summary=ss(n.body)),n.output=t.out||`(no output)`,n.query&&(n.links=Rp(n.output));break}case`message_update`:{if(!t.delta)continue;let n=a.items[a.items.length-1];n?.type===`message`?n.text+=t.delta:a.items.push({type:`message`,id:Vp(e),text:t.delta});break}case`auto_retry_start`:a.items.push({type:`event`,id:Vp(e),icon:`↻`,title:``,text:t.err??``});break;case`notice`:{let n=Bp.exec(t.text||``)?.[1];n&&(a.who??={agent:``,model:``,role:``},a.who.model||(a.who.model=n)),a.items.push({type:`notice`,id:Vp(e),text:(t.text||``).replace(/\s+/g,` `).trim()});break}}n++}return n}var qp=class{constructor(e){this.host=e,this.model=zp(),this.behind=0,this.count=0,this.ready=!1,this.version=0,this.generation=0,this.loaded=``,this.close=null,e.addController(this)}get tailing(){return this.close!==null}hostDisconnected(){this.stop(),this.loaded=``}stop(){this.close?.(),this.close=null}load(e,t){if(this.stop(),this.loaded=e,this.generation++,this.version++,this.model=zp(),this.behind=0,this.count=0,this.ready=!1,t&&`events`in t)this.count=Kp(this.model,t.events),this.ready=!0;else if(t){let e=this.generation;this.close=function(e,t,n,r={}){return s(`${l(r)}/events/stream?run=${c(e)}&key=${c(t)}`,[`stream`],{...n,message:e=>n.message(e.data)},r)}(t.run,t.stream,{message:t=>this.onPage(t,e)},{baseUrl:t.baseUrl})}}append(e){e.length&&(this.count+=Kp(this.model,e),this.version++)}onPage(e,t){t===this.generation&&(!this.ready&&e.behind&&(this.behind=e.behind),this.count+=Kp(this.model,e.events),this.ready=!0,this.version++,this.host.requestUpdate())}async loadEarlier(e,t,n){let r=this.generation,i=Math.max(0,this.behind-3e3);this.behind=0,this.host.requestUpdate();let a=await e.stream(t,n,i);r===this.generation&&(this.model=zp(),Kp(this.model,a.events),this.version++,this.host.requestUpdate())}};function Jp(e){return j`<cae-markdown .text=${e} .split=${ap} .strings=${{showRendered:O(`Show rendered`),showSource:O(`Show source`)}}></cae-markdown>`}V(`cae-markdown`,ea);var Yp=class extends P{constructor(...e){super(...e),this.events=null,this.run=``,this.stream=null,this.baseUrl=``,this.client=null,this.live=!1,this.round=null,this.rows=[],this.shownWho=null,this.mode=`full`,this.shown=-1,this.feed=new qp(this),this.memory=null,this.drawn=null,this.lastSent=``,this.fed=null}static{this.styles=A` :host{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;position:relative;}:host([mode='none']){display:none;}:host([mode='tabs']){flex:none;}`}get source(){return this.events?`static`:this.run&&this.stream?`${this.run}\n${this.stream}`:``}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}willUpdate(e){let t=this.source;if(!e.has(`events`)&&t===this.feed.loaded)return;let n=this.fed,r=this.events;if(this.fed=r,r&&n&&t===this.feed.loaded&&function(e,t){if(e===t||e.length<t.length)return e===t;for(let n=t.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}(r,n))return void this.feed.append(r.slice(n.length));let{run:i,stream:a}=this,o=`transcript:${i}/${a??``}`,s=Kn(this),c=s===Hn?new Jn(`${o}:open`):new qn(`${o}:open`,this),l=!this.events&&!!a;this.memory={isOpen:e=>c.has(e),setOpen:(e,t)=>c.set(e,t),scroll:()=>l?s.recall(`${o}:scroll`):void 0,setScroll:e=>l&&s.remember(`${o}:scroll`,e)},this.shown=-1,this.feed.load(t,this.events?{events:this.events}:t&&a?{run:i,stream:a,baseUrl:this.baseUrl}:null)}sections(){let e=this.live&&this.feed.tailing,t=this.shownWho,n=[this.feed.version,this.rows,this.run,e,R(),t?.agent,t?.model,t?.role];if(this.drawn?.key.every((e,t)=>e===n[t]))return this.drawn;let r=this.feed.model,i=Sp(r.rounds.map(e=>e.launch),this.rows);return this.drawn={key:n,rounds:i,sections:Pp(r,i,{run:this.run,rows:this.rows,active:e,shownWho:t})},this.drawn}render(){let e=this.feed,{sections:t}=this.sections();return ko(e.generation,j`<cae-transcript .sections=${t} .shown=${this.round===null?null:this.round-1} ?live=${this.live} .earlier=${e.behind} ?loading=${!e.ready} .count=${e.count} mode=${this.mode} .memory=${this.memory} .markdown=${Zi} .renderDetail=${e=>Jp(e.text)} .strings=${{sections:O(`Agent sessions`),sectionsTip:[`${O(`Retry`)}: ${Ts()}`,`${O(`Correction round`)}: ${sc()}`,`${O(`Model switch`)}: ${tc()}`].join(`
|
|
778
|
+
`),loadEarlier:e=>O(e===1?`Show 1 earlier line`:D`Show ${e} earlier lines`),newBelow:e=>O(e===1?`Show 1 new event`:D`Show ${e} new events`),newInLatest:e=>O(e===1?`Show 1 new event in the running agent session`:D`Show ${e} new events in the running agent session`),prompt:O(`Prompt`),assistant:O(`Assistant`),reasoning:O(`Reasoning`),characters:e=>O(D`${e} characters`),tool:O(`tool`),results:e=>O(e===1?`1 result`:D`${e} results`),done:O(`done`,{id:`tool-done`}),failed:O(`failed`),running:O(`running`),interrupted:O(`interrupted`),interruptedTip:O(`The run ended before the tool call returned`),query:O(`query`),page:O(`page`),fullText:O(`Full text`),showAll:e=>O(D`Show all (${e} characters)`),showLess:O(`Show less`)}} @cae-section-change=${e=>{e.stopPropagation(),$(this,`ca-navigate`,{round:e.detail.index===null?null:e.detail.index+1})}} @cae-section-shown=${e=>{e.stopPropagation(),this.shown=e.detail.index}} @cae-load-earlier=${t=>{t.stopPropagation(),this.stream&&e.loadEarlier(this.client??a({baseUrl:this.baseUrl}),this.run,this.stream)}}></cae-transcript>`)}updated(){let{rounds:e}=this.sections(),t=`${this.feed.version}|${this.shown}|${e.length}|${this.rows.length}`;t!==this.lastSent&&(this.lastSent=t,$(this,`ca-rounds`,{launches:this.feed.model.rounds.map(e=>e.launch),shown:this.shown,rounds:e},{bubbles:!1}))}revealWebSearch(e,t=0){let n=this.feed.model.rounds.flatMap(e=>e.items).filter(t=>t.type===`tool`&&t.query===e)[t],r=n&&this.view?this.view.reveal(n.id):-1;if(!(r<0))return{round:r===this.feed.model.rounds.length-1?null:r+1}}};G([I({attribute:!1})],Yp.prototype,`events`,void 0),G([I()],Yp.prototype,`run`,void 0),G([I({attribute:!1})],Yp.prototype,`stream`,void 0),G([I({attribute:`base-url`})],Yp.prototype,`baseUrl`,void 0),G([I({attribute:!1})],Yp.prototype,`client`,void 0),G([I({type:Boolean})],Yp.prototype,`live`,void 0),G([I({attribute:!1})],Yp.prototype,`round`,void 0),G([I({attribute:!1})],Yp.prototype,`rows`,void 0),G([I({attribute:!1})],Yp.prototype,`shownWho`,void 0),G([I({reflect:!0})],Yp.prototype,`mode`,void 0),G([L()],Yp.prototype,`shown`,void 0),G([vn(`cae-transcript`)],Yp.prototype,`view`,void 0),Yp=G([F(`ca-transcript`),k()],Yp);var Xp=e=>T(e.io)||e.rows.some(T),Zp=e=>!Xp(e)&&(!!e.stream||e.launches.length>0||e.rows.some(d)),Qp=e=>e.live?`running`:e.outcomes.get(e.detail.key)?.outcome??f(void 0,e.detail.rows),$p=(e,t)=>e.detail.io.upstream.find(e=>e.outputs.some(e=>e.path===t)),em=e=>t=>{let n=$p(e,t);if(!n)return;let r=n.outputs.find(e=>e.path===t);return{name:X(n),written:!!r?.file.exists,outcome:e.outcomes.get(n.key)?.outcome}},tm=e=>Os(Dl(e)),nm=(e,t)=>j`<a class="lnk" href="#" @click=${n=>{n.preventDefault(),$(e.host,`ca-open-task`,{key:t.key})}}>${X(t)}</a>`,rm=new Set([`key`,`rows`,`launches`,`stream`,`task_detail_error`,`definition`,`io`,`row_extras`]);function im(e){for(let t=e.launches.length-1;t>=0;t--){let n=e.launches[t],r=n?Ap(n).model:``;if(r)return r}return``}function am(e){let{rows:t,launches:n}=e.detail,r=t.slice().sort((e,t)=>String(e.ts).localeCompare(String(t.ts)))[t.length-1],i=n[0];return{agent:Op(i?.cmd?i.cmd.split(` `)[0]:r?.agent),model:i?.model||r?.model||im(e),role:i?.role||``}}function om(e){let t=[...new Set(e.flatMap(e=>[...(e.hops??[]).map(e=>e.credential),e.credential]).filter(e=>!!e))];if(!t.length)return[];let n=[O(`Account or API key the coding agent used (credential)`),...t.map(Fs)].filter(Boolean).join(`
|
|
779
|
+
`);return[{label:O(`identity`),value:Y(t.map(Ps)),tip:n,look:`quiet`}]}function sm(e,t,n=``,r={}){let i=t===`output`?j`${Zl(e.status)}${(e.rounds??0)>1?j` <span class="meta" title=${sc()}>${cc(e.rounds,e.status===`valid`)}</span>`:N}`:Xl(e),a=j`<div class="io-hd">${r.chip??i}<span class="jmono ct-path" title=${e.path}>${E(e.path,n)}</span></div>${r.origin?j`<div class="meta io-from">${r.origin}</div>`:N}`;if(t===`output`&&e.status===`refused`)return j`<div class="io-card one">${a}<div class="meta">${lc(e,n,r.producerOf)}</div></div>`;if(t===`output`&&e.status===`failed`&&!e.file.exists)return j`<div class="io-card one">${a}</div>`;let o=e.errors??[];return j`<div class="io-card">
|
|
780
780
|
${a}
|
|
781
|
-
${
|
|
782
|
-
${
|
|
783
|
-
${o.length?
|
|
784
|
-
`)}</pre>`:
|
|
785
|
-
</div>`}var
|
|
781
|
+
${ru(e,t)}
|
|
782
|
+
${$l(e)}
|
|
783
|
+
${o.length?j`<h4>${O(`Errors`)}</h4><pre class="ct-err">${o.map(e=>E(e,n)).join(`
|
|
784
|
+
`)}</pre>`:N}
|
|
785
|
+
</div>`}var cm=e=>!e.file.exists||e.status!=null&&e.status!==`valid`,lm=e=>Xr({text:fs(e),tone:ys(e),mark:xs(e)});function um(e){return e.map(e=>j`<span class="lineage" data-lineage=${e} title=${function(e){switch(e){case`given_from`:return O(`Its output is in the params of the later task (given_from)`);case`after`:return O(`The later task waits for it and is not given its output (after)`);case`created_from`:return O(`Its result reached the flow call just before the flow call created the later task (created_from)`)}}(e)}>${pl(e)}</span>`)}var dm=A` :host{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;position:relative;container-type:inline-size;}.taskmeta{flex:none;background:linear-gradient(180deg,var(--panel2),var(--panel));border:1px solid var(--line);border-radius:14px;padding:10px 12px;margin-bottom:8px;color:var(--text-2);}.tm-head{display:flex;gap:12px;align-items:center;}.tm-av{width:36px;height:36px;border-radius:11px;display:grid;place-items:center;font-size:16px;flex:none;background:var(--agent-bg);color:var(--agent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--agent) 35%,transparent);}.tm-av.py{background:var(--raise);color:var(--text-muted);box-shadow:none;}.tm-name{font-size:15px;font-weight:600;color:var(--text);display:flex;gap:8px;align-items:center;}.verdict{font-size:12.5px;color:var(--text);margin-top:2px;}.verdict[data-tone='failed'],.verdict[data-tone='attention']{color:var(--tone);}.verdict[data-tone='muted']{color:var(--text-muted);}.whos{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:6px;}.runchips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;}.spend{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:6px;font-size:12px;color:var(--text-muted);font-variant-numeric:tabular-nums;}.spend b{color:var(--text);font-weight:600;}.spend.quota{flex-direction:column;gap:0;}.usage-wrap{overflow-x:auto;margin:4px 0 12px;}.usage{width:auto;border-collapse:collapse;font-size:12px;font-variant-numeric:tabular-nums;}.usage th{text-align:right;font-weight:600;color:var(--text-muted);font-size:10.5px;white-space:nowrap;padding:6px 14px;border-bottom:1px solid var(--line2);vertical-align:bottom;}.usage td{text-align:right;padding:8px 14px;border-bottom:1px solid var(--line);white-space:nowrap;vertical-align:baseline;}.usage th:first-child,.usage td:first-child{padding-left:4px;}.usage td.l.jmono{font-size:12px;}.usage td.l:not(:first-child):not(.jmono){white-space:normal;min-width:12ch;}.usage th.l,.usage td.l{text-align:left;}.usage tr.hop td{padding-top:4px;padding-bottom:4px;color:var(--text-muted);}.usage tr.hop td:first-child{padding-left:28px;}.runchip{font-size:11px;padding:2px 9px;border-radius:999px;border:1px solid var(--line2);color:var(--text-2);}.runchip.ok>[aria-hidden]{color:var(--status-done);font-weight:700;}.runchip.part{border-color:color-mix(in srgb,var(--status-attention) 45%,transparent);background:var(--status-attention-bg);}.runchip.part>[aria-hidden]{color:var(--status-attention);font-weight:700;}.runchip.bad{border-color:color-mix(in srgb,var(--status-failed) 45%,transparent);color:var(--status-failed);background:var(--status-failed-bg);}.io-fold{margin-top:6px;}.io-fold>summary,.launch>summary{cursor:pointer;color:var(--text-muted);}.searches{margin:4px 0 0;padding-left:22px;}.unread{color:var(--status-attention);margin-top:4px;}.qlink{background:none;border:0;padding:0;color:var(--accent);cursor:pointer;text-align:left;font:inherit;}.qlink:hover{text-decoration:underline;}.tviews{flex:none;display:flex;flex-wrap:wrap;gap:4px;margin:2px 0 8px;border-bottom:1px solid var(--line);}@container (max-width:480px){.tviews{gap:0;}.tview{padding:6px 10px;}}.tview{background:none;border:0;border-bottom:2px solid transparent;color:var(--text-muted);padding:6px 14px;cursor:pointer;}.tview:hover{color:var(--text-2);}.tview.sel{color:var(--text);border-bottom-color:var(--accent);}.tview .badge{margin-left:6px;font-size:10px;padding:0 6px;border-radius:999px;background:var(--raise);color:var(--text-2);}.pane{flex:1 1 auto;min-height:0;overflow:auto;position:relative;}.upstream{margin-bottom:12px;}.up-hd{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;margin:2px 0 6px;}.down{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:6px;}.lineage{font-size:11px;color:var(--text-2);border:1.5px solid var(--line2);border-radius:999px;padding:0 7px;white-space:nowrap;}.lineage[data-lineage='after']{border-style:dotted;}.lineage[data-lineage='created_from']{border-style:dashed;}.notrans{flex:1 1 auto;border:1px solid var(--line);border-radius:14px;}details.upstream>summary{cursor:pointer;list-style:none;}details.upstream>summary::-webkit-details-marker{display:none;}.params td{vertical-align:top;}.from{color:var(--text-muted);white-space:nowrap;}`,fm=class extends P{constructor(...e){super(...e),this.baseUrl=``,this.run=``,this.taskKey=null,this.view=`transcript`,this.round=null,this.live=!1,this.journal=[],this.plan=null,this.exported=!1,this.replayMarks=!1,this.detail=new yp(this),this.launches=[],this.shownRound=-1,this.rounds=[],this.outcomes=new Map}static{this.styles=[U,au,Qo,cf,dm]}willUpdate(e){(e.has(`run`)||e.has(`taskKey`)||e.has(`client`))&&(this.detail.load(this.client,this.run,this.taskKey),this.launches=[],this.shownRound=-1,this.rounds=[]),this.outcomes=this.plan?S(this.journal,this.plan).outcomes:new Map}shownView(e){return this.view===`transcript`&&Xp(e)&&!e.stream?`output`:this.view}revealSearch(e,t){let n=this.transcriptEl?.revealWebSearch(e,t);$(this,`ca-navigate`,n?{view:`transcript`,round:n.round}:{view:`transcript`})}render(){let e=this.taskKey;if(!e)return j`<div class="blank"><span class="ic" aria-hidden="true">✦</span><b>${O(`No task selected`)}</b></div>`;let t=this.detail.value;if(!t)return j`<div class="taskmeta meta"><strong>${e}</strong> ${O(`Loading…`)}</div>`;let n={host:this,run:this.run,detail:t,live:t.launches.length>0&&this.live,journal:this.journal,plan:this.plan,outcomes:this.outcomes,launches:this.launches,shownRound:this.shownRound,rounds:this.rounds,exported:this.exported,replayMarks:this.replayMarks},r=this.shownView(t);return j`${function(e,t,n){let r=e.detail,i=e.live,{rows:a,launches:o}=r,s=Xp(r),c=Zp(r),l=a.slice().sort((e,t)=>String(e.ts).localeCompare(String(t.ts))),u=am(e),f=c?[...new Set(l.map(e=>e.model).filter(e=>!!e&&e!==u.model))]:[],p=a[0],m=a.filter(d),h=us(ls(m)),g=Object.entries(r).filter(([e])=>!rm.has(e)),[_,v]=function(e){let t=e.detail.rows,n=t.filter(d),r=t[t.length-1],i=Qp(e);switch(i){case`running`:return[O(`Running`),`neutral`];case`waiting`:{let t=e.plan?.nodes.find(t=>t.key===e.detail.key),n=t?.deferred?Qs(t.deferred_cause,t.deferred,function(e,t){let n=t?.flow_call;return n?e?.flow_calls?.find(e=>e.id===n)?.function??``:``}(e.plan,t.deferred_cause)):``;return n?[O(D`Not run: ${n}`),`attention`]:[O(`Waiting`),`muted`]}case`skipped`:return[O(`Skipped`),`muted`];case`not_started`:{let t=function(e){let t=e.detail,n=ws(e.outcomes.get(t.key)??{attempts:t.rows,cause:null},e.outcomes,e.run,t=>$p(e,t)?.key);if(n)return n;let r=Ie(t.rows[t.rows.length-1]?.reason)[0],i=r?$p(e,r.path):void 0;return r?Cs(E(r.path,e.run),r.problem,i?{name:X(i)}:void 0):``}(e);return[O(t?D`Not started: ${t}`:`Not started`),`attention`]}case`partial`:{let t=r?.reason&&_s(r.reason)?Ss(r.reason):E(r?.reason,e.run);return[O(t?D`Partly done: ${t}`:`Partly done`),`attention`]}case`failed`:{let t=E(r?.reason,e.run)||Ss(r?.stop);return[n.length>1?O(D`Failed on all ${n.length} attempts: ${t}`):O(D`Failed: ${t}`),`failed`]}}if(!r)return[fs(i),`neutral`];let a=n.filter(e=>!e.ok);if(a.length){let t=E(a[0]?.reason,e.run)||Ss(a[0]?.stop);return[a.length===1?O(D`Done on attempt ${n.length} | 1 failed attempt | first failure: ${t}`):O(D`Done on attempt ${n.length} | ${a.length} failed attempts | first failure: ${t}`),`neutral`]}let o=Dl(r);if(o>0){let t=[...(r.hook_errors??[]).flat(),...(r.round_errors??[]).flat(),...e.rounds.flatMap(e=>e.rejectedWith)],n=t[0]?wp(E(t[0],e.run)):``;return n?[O(o===1?D`Done after 1 correction | first failed check: ${n}`:D`Done after ${o} corrections | first failed check: ${n}`),`neutral`]:[O(o===1?`Done after 1 correction`:D`Done after ${o} corrections`),`neutral`]}let s=rc(r.hops,null,r.skipped_hops);return s?[O(D`Done after a model switch: ${s}`),`neutral`]:[O(`Done`),`neutral`]}(e),y=O(s?`Python task`:`Agent task`),b=e.plan?.nodes.find(e=>e.key===r.key);return j`<div class="taskmeta">
|
|
786
786
|
<div class="tm-head">
|
|
787
|
-
${
|
|
787
|
+
${sf(s,y,`tm-av `+(s?`py`:``))}
|
|
788
788
|
<div style="min-width:0">
|
|
789
|
-
<div class="tm-name" title=${t}>${
|
|
790
|
-
<div class="verdict" data-tone=${
|
|
791
|
-
${
|
|
792
|
-
${
|
|
793
|
-
</div>`:
|
|
794
|
-
${
|
|
795
|
-
${
|
|
796
|
-
${function(e,t){let n=e.map(e=>!!e.rerun).lastIndexOf(!0),r=n>=0?
|
|
797
|
-
${function(e){let t=(e.plan?.flow_calls??[]).filter(t=>t.raised_by===e.detail.key);return t.length?
|
|
798
|
-
${c?
|
|
799
|
-
${
|
|
800
|
-
${
|
|
801
|
-
</div>`:
|
|
802
|
-
${o.length?
|
|
803
|
-
${function(e,t){if(!e)return
|
|
804
|
-
<b title=${
|
|
805
|
-
<span>${
|
|
806
|
-
<span>${e.calls===1?
|
|
807
|
-
${n?
|
|
808
|
-
${r?
|
|
809
|
-
</div>`}(
|
|
810
|
-
${function(e,t){let n=
|
|
811
|
-
<span title=${[
|
|
812
|
-
`)}>${
|
|
813
|
-
</div>`}(e,
|
|
789
|
+
<div class="tm-name" title=${t}>${p?X(p):b?X(b):t.replace(/^python:/,``)} ${i?Xr({text:O(`running`),tone:`running`}):N}</div>
|
|
790
|
+
<div class="verdict" data-tone=${z(v)}>${_}</div>
|
|
791
|
+
${b?.claims?.length?j`<div class="meta" title=${Cc()}>
|
|
792
|
+
${O(`Locks`)} ${b.claims.map(e=>Xr({text:e}))}
|
|
793
|
+
</div>`:N}
|
|
794
|
+
${b?.priority?j`<div class="meta" title=${Xc()}>${Yc(b.priority)}</div>`:N}
|
|
795
|
+
${b?.cwd?j`<div class="meta" title=${O(`Directory the task worked in, named by its task call in place of the run's (cwd)`)}>${x=b.cwd,x?O(D`Working directory ${x}`):``}</div>`:N}
|
|
796
|
+
${function(e,t){let n=e.map(e=>!!e.rerun).lastIndexOf(!0),r=n>=0?hl(e,n):t?{text:t,changed:[],divergence:t.startsWith(`divergence`)}:null;return r?j`<div class="meta rerun" title=${r.text}>${vl(r)}${r.divergence?j` <span class="divergence" title=${O(`The flow gave other params for the same outputs of the tasks before it (divergence): a clock, randomness, outside state or changed flow code`)}>${Xr({text:_l(),tone:`attention`})}</span>`:N}</div>`:N}(a,b?.rerun)}
|
|
797
|
+
${function(e){let t=(e.plan?.flow_calls??[]).filter(t=>t.raised_by===e.detail.key);return t.length?j`${t.map(t=>j`<div class="meta stopped" title=${t.error??``}>${bl(t,e.run)}</div>`)}`:N}(e)}
|
|
798
|
+
${c?j`<div class="whos">
|
|
799
|
+
${Zo([...jp(u),...om(m)])}
|
|
800
|
+
${f.length?j`<span class="meta">${O(f.length===1?D`Earlier attempts used model ${f[0]??``}`:D`Earlier attempts used models ${Y(f)}`)}</span>`:N}
|
|
801
|
+
</div>`:N}
|
|
802
|
+
${o.length?j`<div class="meta">${o.length===1?O(`1 agent session running`):O(D`${o.length} agent sessions running`)}</div>`:N}
|
|
803
|
+
${function(e,t){if(!e)return N;let n=function(e){let t=null;for(let n of e){let e=n.usage?.peak_context;e!=null&&(t===null||e>(t.usage?.peak_context??0))&&(t=n)}return t}(t),r=t.find(e=>e.context_warned);return j`<div class="spend">
|
|
804
|
+
<b title=${O(`Reported by the coding agent`)}>${cs(e.cost)}</b>
|
|
805
|
+
<span>${O(D`Tokens: ${Z(e.input)} input, ${Z(e.output)} output, ${Z(e.cache_read)} cache read, ${Z(e.cache_creation)} cache write`)}</span>
|
|
806
|
+
<span>${e.calls===1?O(`1 API call`):O(D`${e.calls} API calls`)}</span>
|
|
807
|
+
${n?j`<span title=${Qc()}>${$c(n)}</span>`:N}
|
|
808
|
+
${r?j`<span class="tone-text" data-tone="attention" title=${tl()}>${el(r)}</span>`:N}
|
|
809
|
+
</div>`}(we(a),m)}
|
|
810
|
+
${function(e,t){let n=Me(e.journal.length?e.journal:t),r=t[0],i=t[t.length-1],a=r?Fe(r,n).start:null;if(!a||!i)return N;let o=Fe(i,n).next;return j`<div class="spend quota">
|
|
811
|
+
<span title=${[O(D`Usage at session start: ${Bs(a)}`),Vs(a),...o?[``,O(D`Usage after this task: ${Bs(o)}`),Vs(o)]:[]].join(`
|
|
812
|
+
`)}>${O(D`Usage: ${((e,t)=>t?J(O(D`weekly ${Is(e.seven_day_pct)} → ${Is(t.seven_day_pct)}`),O(D`5-hour ${Is(e.five_hour_pct)} → ${Is(t.five_hour_pct)}`)):Bs(e))(a,o)}`)}</span>
|
|
813
|
+
</div>`}(e,m)}
|
|
814
814
|
</div>
|
|
815
815
|
</div>
|
|
816
|
-
${
|
|
817
|
-
`),p=t.cost_usd!==null&&t.cost_usd!==void 0?
|
|
818
|
-
${(e=>e.stop===`partial`?
|
|
819
|
-
</span>`}(e,
|
|
820
|
-
${function(e,t){let n=e[e.length-1],r=n?
|
|
821
|
-
${function(e,t){let n=e.flatMap(e=>e.web_queries??[]),r=new Map;return n.length?
|
|
822
|
-
<summary>${n.length===1?
|
|
816
|
+
${m.length?j`<div class="runchips">${Ds(m).map((t,n)=>function(e,t,n,r,i){let a=t.stop===`partial`?`part`:t.ok?`ok`:`bad`,o=e.detail.rows,s=hl(o,o.indexOf(t)),c=!!e.replayMarks&&!!t.replayed,l=E(t.reason,e.run),u=rc(t.hops,null,t.skipped_hops),d=t.safety_stops?.length?ll(t.safety_stops.length):``,f=[O(D`Ended ${q(t.ts,!0)}`),tm(t),r&&t.model?O(D`Model ${t.model}`):``,u?O(D`Model switch: ${u}`):``,$c(t),t.context_warned?el(t):``,l,t.route||``,c?mc():``,s?vl(s):``,...Oc(t,i).map(([e,t])=>`${e}: ${t}`)].filter(Boolean).join(`
|
|
817
|
+
`),p=t.cost_usd!==null&&t.cost_usd!==void 0?cs(t.cost_usd):``;return j`<span class="runchip ${a}" title=${f}>
|
|
818
|
+
${(e=>e.stop===`partial`?j`<span aria-hidden="true">◌</span><span class="sr">${fs(`partial`)}</span>`:j`<span aria-hidden="true">${e.ok?`✓`:`✕`}</span><span class="sr">${e.ok?O(`passed`):O(`failed`)}</span>`)(t)} ${J(n,Ss(t.stop,t.reason),H(t.wall_s),p,d,c?pc():``,s?.divergence?_l():``)}
|
|
819
|
+
</span>`}(e,m[n],t,c,r.row_extras??[]))}</div>`:N}
|
|
820
|
+
${function(e,t){let n=e[e.length-1],r=n?Oc(n,t):[];if(!r.length)return N;let i=Ec();return j`<div class="whos">${Zo(r.map(([e,t])=>({label:e,value:t,tip:i,look:`quiet`})))}</div>`}(m,r.row_extras??[])}
|
|
821
|
+
${function(e,t){let n=e.flatMap(e=>e.web_queries??[]),r=new Map;return n.length?j`<details class="io-fold">
|
|
822
|
+
<summary>${n.length===1?O(`1 web search`):O(D`${n.length} web searches`)}</summary>
|
|
823
823
|
<ol class="meta searches">
|
|
824
|
-
${n.map(e=>{let n=r.get(e)??0;return r.set(e,n+1),
|
|
824
|
+
${n.map(e=>{let n=r.get(e)??0;return r.set(e,n+1),j`<li><button class="qlink jmono" @click=${()=>t(e,n)}>
|
|
825
825
|
${e}
|
|
826
826
|
</button></li>`})}
|
|
827
827
|
</ol>
|
|
828
|
-
</details>`:
|
|
829
|
-
${function(e){let t=
|
|
830
|
-
<summary title=${
|
|
831
|
-
<ul class="meta searches jmono">${r.map(e=>
|
|
832
|
-
</details>`:
|
|
833
|
-
${function(e){let t=
|
|
834
|
-
<summary title=${
|
|
835
|
-
<ul class="meta searches">${r.map(e=>
|
|
836
|
-
</details>`}(
|
|
837
|
-
${
|
|
838
|
-
<span aria-hidden="true">⚠</span> ${
|
|
839
|
-
</div>`:
|
|
840
|
-
${
|
|
841
|
-
${r.task_detail_error?
|
|
842
|
-
${o.map(e=>
|
|
843
|
-
<summary>${
|
|
844
|
-
<div class="meta">${
|
|
828
|
+
</details>`:N}(m,n)}
|
|
829
|
+
${function(e){let t=Ds(e),n=e.filter(e=>e.changes).length,r=e.flatMap((e,r)=>{let i=e.changes;if(!i)return[];let a=n>1?t[r]??``:``,o=new Set(i.removed),s=new Set(i.kept),c=(e,t)=>(e??[]).map(e=>J(a,e,function(e){switch(e){case`created`:return O(`created`);case`modified`:return O(`modified`);case`deleted`:return O(`deleted`);case`removed`:return O(`created, removed after the failed attempt`);case`kept`:return O(`created, kept after the failed attempt`)}}(((e,t)=>o.has(e)?`removed`:s.has(e)?`kept`:t)(e,t))));return[...c(i.created,`created`),...c(i.modified,`modified`),...c(i.deleted,`deleted`)]});return n?r.length?j`<details class="io-fold">
|
|
830
|
+
<summary title=${O(`Files under the task's declared patterns that its attempts created, modified or deleted (changes)`)}>${i=r.length,O(i===1?`1 changed file`:D`${i} changed files`)}</summary>
|
|
831
|
+
<ul class="meta searches jmono">${r.map(e=>j`<li>${e}</li>`)}</ul>
|
|
832
|
+
</details>`:j`<div class="meta">${O(`No changed files`)}</div>`:N;var i}(m)}
|
|
833
|
+
${function(e){let t=Ds(e),n=e.filter(e=>e.safety_stops?.length).length;if(!n)return N;let r=e.flatMap((e,r)=>(e.safety_stops??[]).map(e=>J(n>1?t[r]??``:``,fl(e))));return j`<details class="io-fold">
|
|
834
|
+
<summary title=${ul()}>${ll(r.length)}</summary>
|
|
835
|
+
<ul class="meta searches">${r.map(e=>j`<li>${e}</li>`)}</ul>
|
|
836
|
+
</details>`}(m)}
|
|
837
|
+
${ds(m)?j`<div class="meta unread" title=${O(`Events this contraagent version could not read (unread_events)`)}>
|
|
838
|
+
<span aria-hidden="true">⚠</span> ${O(D`Unrecognized events: ${ds(m)}`)}
|
|
839
|
+
</div>`:N}
|
|
840
|
+
${h?j`<div class="meta unread" title=${h.tip}><span aria-hidden="true">⚠</span> ${h.label}</div>`:N}
|
|
841
|
+
${r.task_detail_error?j`<div class="meta v-bad">${O(D`The task_detail callback failed: ${r.task_detail_error??``}`)}</div>`:N}
|
|
842
|
+
${o.map(e=>j`<details class="launch">
|
|
843
|
+
<summary>${J(O(D`Process ${e.pid??`—`}`),e.key||``)}</summary>
|
|
844
|
+
<div class="meta">${J(O(D`Plugin ${e.plugin||O(`none`,{id:`none`})}`),O(D`Model ${e.model||`—`}`),O(D`Role ${e.role||O(`none`,{id:`none`})}`))}</div>
|
|
845
845
|
</details>`)}
|
|
846
|
-
${
|
|
847
|
-
</div>`;var
|
|
848
|
-
${t.stream?
|
|
849
|
-
${t?
|
|
850
|
-
${r===`transcript`?j
|
|
851
|
-
${
|
|
852
|
-
${n}${i[e]?
|
|
846
|
+
${g.map(([e,t])=>j`<details class="io-fold"><summary>${e}</summary><cae-json-tree .value=${t}></cae-json-tree></details>`)}
|
|
847
|
+
</div>`;var x}(n,e,(e,t)=>this.revealSearch(e,t))} ${this.renderViews(t,r)}
|
|
848
|
+
${t.stream?j`<ca-transcript .run=${this.run} .stream=${t.stream} base-url=${this.baseUrl} .client=${this.client} .live=${n.live} .shownWho=${am(n)} .rows=${t.rows} .round=${this.round} mode=${r===`transcript`?`full`:r===`input`?`tabs`:`none`} @ca-rounds=${e=>{this.launches=e.detail.launches,this.shownRound=e.detail.shown,this.rounds=e.detail.rounds}}></ca-transcript>`:r===`transcript`?function(e){let t=e.detail,n=Qp(e);if(n===`not_started`){let t=function(e){let t=e.detail,n=Ie(t.rows[t.rows.length-1]?.reason)[0],r=n?.producer?e.outcomes.get(n.producer):void 0;if(r)return r;let i=n?$p(e,n.path):void 0;if(i)return i;let a=e.outcomes.get(t.key)?.cause;return a?e.outcomes.get(a):void 0}(e);return j`<div class="blank notrans"><span class="ic" aria-hidden="true">⊘</span><b>${J(O(`No transcript`),fs(n))}</b>
|
|
849
|
+
${t?j`<span>${O(j`Earlier task ${Vl(e.host,X(t),t)}`)}</span>`:N}</div>`}if(e.exported&&Zp(t))return j`<div class="blank notrans"><span class="ic" aria-hidden="true">✦</span><b>${J(O(`No transcript`),zc())}</b></div>`;if(Zp(t))return j`<div class="blank notrans"><span class="ic" aria-hidden="true">✦</span><b>${J(O(`No transcript`),O(`not saved (keep_transcripts = false)`))}</b></div>`;let r=n===`waiting`&&!!e.plan?.nodes.find(e=>e.key===t.key)?.deferred;return j`<div class="blank notrans"><span class="ic" aria-hidden="true">✦</span><b>${J(O(`No transcript`),r?ps(n,!1):fs(n))}</b></div>`}(n):N}
|
|
850
|
+
${r===`transcript`?N:j`<div class="pane">${this.renderPane(n,r)}</div>`}`}renderViews(e,t){let n=e.io,r=Xp(e)&&!e.stream,i={input:new Set([...n.inputs.map(e=>e.path),...(n.input_files??[]).map(e=>e.path),...n.upstream.filter(pm).flatMap(e=>e.outputs.map(e=>e.path))]).size+Object.keys(n.params).length,output:n.outputs.length};return j`<div class="tviews" role="tablist">
|
|
851
|
+
${Qn.filter(e=>!(r&&e===`transcript`)).map(e=>{let n={transcript:O(`Transcript`),input:O(`Input`),output:O(`Output`,{id:`view-output`}),definition:O(`Definition`)}[e];return j`<button type="button" role="tab" aria-selected=${e===t} class="tview ${e===t?`sel`:``}" @click=${()=>$(this,`ca-navigate`,{view:e})}>
|
|
852
|
+
${n}${i[e]?j`<span class="badge">${i[e]}</span>`:N}
|
|
853
853
|
</button>`})}
|
|
854
|
-
</div>`}renderPane(e,t){return t===`input`?function(e){let t=e.detail,n=t.io,r=Object.entries(n.params),{files:i,earlier:a}=function(e){let t=new Set(e.inputs.map(e=>e.path)),n=e.inputs.map(t=>{for(let n of e.upstream){let e=n.outputs.find(e=>e.path===t.path);if(e)return{spec:t,from:n,out:e}}return{spec:t,from:null,out:null}}),r=e.upstream.map(e=>({task:e,read:e.outputs.filter(e=>t.has(e.path)).length,rest:e.outputs.filter(e=>!t.has(e.path))})),i=e=>Number(e.task.outputs.some(
|
|
855
|
-
${r.length?
|
|
856
|
-
${r.map(([t,n])=>{let r=o(n);return
|
|
854
|
+
</div>`}renderPane(e,t){return t===`input`?function(e){let t=e.detail,n=t.io,r=Object.entries(n.params),{files:i,earlier:a}=function(e){let t=new Set(e.inputs.map(e=>e.path)),n=e.inputs.map(t=>{for(let n of e.upstream){let e=n.outputs.find(e=>e.path===t.path);if(e)return{spec:t,from:n,out:e}}return{spec:t,from:null,out:null}}),r=e.upstream.map(e=>({task:e,read:e.outputs.filter(e=>t.has(e.path)).length,rest:e.outputs.filter(e=>!t.has(e.path))})),i=e=>Number(e.task.outputs.some(cm));return{files:n,earlier:[...r].sort((e,t)=>i(t)-i(e))}}(n),o=e=>n.upstream.find(t=>t.outputs.some(t=>t.file.exists&&((e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}})(t.file.content,e))),s=new Set(r.map(([,e])=>o(e)?.key).filter(e=>!!e));return j`<h4 class="sect-h">${O(`Parameters`)}</h4>
|
|
855
|
+
${r.length?j`<table class="ct-fields params">
|
|
856
|
+
${r.map(([t,n])=>{let r=o(n);return j`<tr>
|
|
857
857
|
<td class="jmono">${t}</td>
|
|
858
|
-
<td>${typeof n==`object`&&n?
|
|
859
|
-
<td>${r?
|
|
858
|
+
<td>${typeof n==`object`&&n?j`<cae-json-tree .value=${n} .open=${0}></cae-json-tree>`:j`<span class="jmono">${(e=>typeof e==`string`?e:JSON.stringify(e)??String(e))(n)}</span>`}</td>
|
|
859
|
+
<td>${r?j`<span class="from">${O(j`From ${nm(e,r)}`)}</span>`:N}</td>
|
|
860
860
|
</tr>`})}
|
|
861
|
-
</table>`:
|
|
862
|
-
<h4 class="sect-h">${
|
|
863
|
-
${n.input_files?.length?n.input_files.map(t=>function(e,t){let n=t.check===`passed`?`done`:t.check===`refused`?`failed`:`neutral`,r=t.check===`passed`?`done`:t.check===`refused`?`failed`:`pending`,i=t.writer?e.detail.io.upstream.find(e=>e.key===t.writer)??e.outcomes.get(t.writer):void 0,a=t.writer?
|
|
864
|
-
<div class="io-hd">${Xr({text:
|
|
865
|
-
<div class="meta io-from"><span title=${t.sha256}>${
|
|
866
|
-
${t.reason?
|
|
867
|
-
</div>`}(e,t)):
|
|
868
|
-
${i.length?
|
|
869
|
-
${i.map(t=>function(e,t){let n=t.from,r=n?e.outcomes.get(n.key)?.outcome:void 0,i=n?
|
|
870
|
-
<h4 class="sect-h">${
|
|
871
|
-
${a.length?a.map(t=>function(e,t,n){let r=t.task,i=
|
|
872
|
-
${
|
|
873
|
-
${
|
|
874
|
-
${a?
|
|
875
|
-
${
|
|
861
|
+
</table>`:j`<div class="meta">${O(`No parameters`)}</div>`}
|
|
862
|
+
<h4 class="sect-h">${O(`Input files`)}</h4>
|
|
863
|
+
${n.input_files?.length?n.input_files.map(t=>function(e,t){let n=t.check===`passed`?`done`:t.check===`refused`?`failed`:`neutral`,r=t.check===`passed`?`done`:t.check===`refused`?`failed`:`pending`,i=t.writer?e.detail.io.upstream.find(e=>e.key===t.writer)??e.outcomes.get(t.writer):void 0,a=t.writer?j`<span>${O(j`Output of ${nm(e,i??{key:t.writer,kind:t.writer,unit:``})}`)}</span>`:N,o=function(e){return e.root?e.root===`out`?`out/${e.path}`:`${e.root}: ${e.path}`:null}(t),s=t.root&&t.root!==`out`?(c=t.root,l=t.path,O(D`${l} in the input root ${c}`)):t.path;var c,l;return j`<div class="io-card one infile">
|
|
864
|
+
<div class="io-hd">${Xr({text:ml(t.check),tone:n,mark:r})}<span class="jmono ct-path" title=${s}>${o??E(t.path,e.run)}</span></div>
|
|
865
|
+
<div class="meta io-from"><span title=${t.sha256}>${J(O(D`Param ${t.param}`),`sha256 ${t.sha256.slice(0,12)}`)}</span>${t.writer?j` | ${a}`:N}</div>
|
|
866
|
+
${t.reason?j`<div class="meta err">${t.reason}</div>`:N}
|
|
867
|
+
</div>`}(e,t)):j`<div class="meta">${O(`No input files`)}</div>`}
|
|
868
|
+
${i.length?j`<h4 class="sect-h">${O(`Checked files it reads`)}</h4>
|
|
869
|
+
${i.map(t=>function(e,t){let n=t.from,r=n?e.outcomes.get(n.key)?.outcome:void 0,i=n?j`<span>${O(j`Output of ${nm(e,n)}`)}</span>${r&&r!==`done`?lm(r):N}`:O(`File from before the run`),a=t.out?.status;if(!a)return sm(t.spec,`input`,e.run,{origin:i});let o=Zl(a);return sm({...t.spec,status:a},`input`,e.run,{origin:i,chip:o})}(e,t))}`:N}
|
|
870
|
+
<h4 class="sect-h">${O(`Earlier tasks`)}</h4>
|
|
871
|
+
${a.length?a.map(t=>function(e,t,n){let r=t.task,i=T(r)?O(`Python task`):O(`Agent task`),a=e.outcomes.get(r.key)?.outcome,o=r.outputs.length,s=o?J(O(o===1?`1 output file`:D`${o} output files`),t.read?t.read===1?O(`1 read by this task`):O(D`${t.read} read by this task`):``):O(`No output files`),c=j`<div class="up-hd">
|
|
872
|
+
${sf(T(r),i)}
|
|
873
|
+
${nm(e,r)}
|
|
874
|
+
${a?lm(a):N}
|
|
875
|
+
${um((r.lineage??[]).filter(e=>!(n&&e===`given_from`)))}
|
|
876
876
|
<span class="meta">${s}</span>
|
|
877
|
-
</div>`;if(!t.rest.length)return
|
|
878
|
-
${
|
|
879
|
-
${l?
|
|
880
|
-
${function(e,t){let n=t.filter(e=>
|
|
877
|
+
</div>`;if(!t.rest.length)return j`<div class="upstream">${c}</div>`;let l=t.rest.map(t=>sm(t,`output`,e.run,{producerOf:em(e)}));return t.rest.some(cm)?j`<div class="upstream">${c}${l}</div>`:j`<details class="upstream"><summary>${c}</summary>${l}</details>`}(e,t,s.has(t.task.key))):j`<div class="meta">${O(`No earlier tasks`)}</div>`}
|
|
878
|
+
${Xp(t)?N:function(e){let t=e.detail,n=e.launches.length,r=e.shownRound,i=e.rounds[r],a=e.rounds[e.rounds.length-1]?.tryNo??1,o=t.rows.filter(d),s=Ds(o),c=oe(o),l=e.launches[r]?.prompt??``,u=Qp(e);return j`<h4 class="sect-h">${O(`Prompt`)}${n>1&&i?j` <span class="meta">${Tp(i,a,s[i.tryNo-1])}: ${function(e,t=!1){return e.fixupNo?O(`same agent session, after failed checks`):e.hopNo?O(`new agent session on the next model`):e.tryNo>1&&t?O(`new agent session in the resumed run`):e.tryNo>1?O(D`new agent session after attempt ${e.tryNo-1} failed`):O(`first agent session`)}(i,c[i.tryNo-1]!==c[i.tryNo-2])}</span>`:N}</h4>
|
|
879
|
+
${l?Jp(l):j`<div class="meta">${t.stream?O(`Loading…`):Zp(t)?J(O(`No prompt`),O(`not saved (keep_transcripts = false)`)):J(O(`No prompt`),fs(u))}</div>`}`}(e)}`}(e):t===`output`?function(e){let t=e.detail,n=t.io;return j`${n.outputs.length?n.outputs.map(t=>sm(t,`output`,e.run,{producerOf:em(e)})):j`<div class="meta">${O(`No output files`)}</div>`}
|
|
880
|
+
${function(e,t){let n=t.filter(e=>d(e)&&(e.usage||e.cost_usd!==null&&e.cost_usd!==void 0));if(!n.length)return N;let r=j`<td class="jdim">—</td>`,i=Me(e.journal.length?e.journal:t),a=n.some(e=>(e.quota??[]).length),o=j`<td class="l jdim">—</td>`,s=(e,t)=>e?j`<td class="l" title=${Vs(e)}>${(e.credential??``)===(t??``)?Bs(e):Hs(e)}</td>`:o;return j`<h4 class="sect-h">${O(`Tokens and cost`)}</h4>
|
|
881
881
|
<div class="usage-wrap" data-scroll="x"><table class="usage">
|
|
882
882
|
<tr>
|
|
883
|
-
<th class="l"></th><th>${
|
|
884
|
-
<th>${
|
|
885
|
-
${a?
|
|
886
|
-
<th class="l" title=${
|
|
883
|
+
<th class="l"></th><th>${O(`Input`)}</th><th>${O(`Output`,{id:`tokens-output`})}</th><th>${O(`Cache read`)}</th><th>${O(`Cache write`)}</th>
|
|
884
|
+
<th>${O(`API calls`)}</th><th title=${O(`Reported by the coding agent`)}>${O(`Cost`)}</th><th class="l">${O(`Identity`)}</th>
|
|
885
|
+
${a?j`<th class="l" title=${O(`Subscription usage when the agent session started (account-wide)`)}>${O(`Usage at start`)}</th>
|
|
886
|
+
<th class="l" title=${O(`The first reading of the same account after this attempt ended`)}>${O(`Usage after`)}</th>`:N}
|
|
887
887
|
</tr>
|
|
888
|
-
${n.map(e=>{let t=e.usage,n=e.hops??[];return
|
|
889
|
-
<td class="l">${
|
|
890
|
-
${t?
|
|
891
|
-
<td>${
|
|
892
|
-
${a?
|
|
888
|
+
${n.map(e=>{let t=e.usage,n=e.hops??[];return j`<tr>
|
|
889
|
+
<td class="l">${Es(e.attempt)}</td>
|
|
890
|
+
${t?j`<td>${Z(t.input)}</td><td>${Z(t.output)}</td><td>${Z(t.cache_read)}</td><td>${Z(t.cache_creation)}</td><td>${t.calls}</td>`:j`${r}${r}${r}${r}${r}`}
|
|
891
|
+
<td>${cs(e.cost_usd)}</td><td class="l" title=${Fs(e.credential)||N}>${Ps(e.credential)||`—`}</td>
|
|
892
|
+
${a?j`${s(Fe(e,i).start,e.credential)}${s(Fe(e,i).next,e.credential)}`:N}
|
|
893
893
|
</tr>
|
|
894
|
-
${n.length>1?n.map(e=>
|
|
895
|
-
<td class="l">${
|
|
894
|
+
${n.length>1?n.map(e=>j`<tr class="hop">
|
|
895
|
+
<td class="l">${J(e.model||e.route||`—`,Ss(e.stop))}</td>
|
|
896
896
|
<td></td><td></td><td></td><td></td><td></td>
|
|
897
|
-
<td>${
|
|
898
|
-
${a?
|
|
899
|
-
</tr>`):
|
|
897
|
+
<td>${cs(e.cost_usd)}</td><td class="l" title=${Fs(e.credential)||N}>${Ps(e.credential)||`—`}</td>
|
|
898
|
+
${a?j`<td></td><td></td>`:N}
|
|
899
|
+
</tr>`):N}`})}
|
|
900
900
|
</table></div>`}(e,t.rows)}
|
|
901
|
-
<h4 class="sect-h">${
|
|
902
|
-
${n.downstream.length?function(e,t){let n=[`given_from`,`after`,`created_from`];return[...n,null].map(e=>[e,t.filter(t=>(e=>n.find(t=>(e.lineage??[]).includes(t))??null)(t)===e)]).filter(([,e])=>e.length).map(([t,n])=>
|
|
901
|
+
<h4 class="sect-h">${O(`Later tasks`)}</h4>
|
|
902
|
+
${n.downstream.length?function(e,t){let n=[`given_from`,`after`,`created_from`];return[...n,null].map(e=>[e,t.filter(t=>(e=>n.find(t=>(e.lineage??[]).includes(t))??null)(t)===e)]).filter(([,e])=>e.length).map(([t,n])=>j`<div class="down">${t?um([t]):N}${n.map(t=>Vl(e.host,X(t),t))}</div>`)}(e,n.downstream):j`<div class="meta">${O(`No later tasks`)}</div>`}`}(e):(e=>j`<ca-definition .definition=${e.detail.definition??null} memory="task-definition"></ca-definition>`)(e)}};G([I({attribute:!1})],fm.prototype,`client`,void 0),G([I({attribute:`base-url`})],fm.prototype,`baseUrl`,void 0),G([I()],fm.prototype,`run`,void 0),G([I({attribute:!1})],fm.prototype,`taskKey`,void 0),G([I()],fm.prototype,`view`,void 0),G([I({attribute:!1})],fm.prototype,`round`,void 0),G([I({type:Boolean})],fm.prototype,`live`,void 0),G([I({attribute:!1})],fm.prototype,`journal`,void 0),G([I({attribute:!1})],fm.prototype,`plan`,void 0),G([I({type:Boolean})],fm.prototype,`exported`,void 0),G([I({type:Boolean,attribute:`replay-marks`})],fm.prototype,`replayMarks`,void 0),G([vn(`ca-transcript`)],fm.prototype,`transcriptEl`,void 0),G([L()],fm.prototype,`launches`,void 0),G([L()],fm.prototype,`shownRound`,void 0),G([L()],fm.prototype,`rounds`,void 0),fm=G([F(`ca-task-view`),k()],fm);var pm=e=>!e.lineage?.length||e.lineage.some(e=>e!==`created_from`),mm=class extends P{constructor(){super(),new Pr(this)}createRenderRoot(){return this}render(){return new Date().toLocaleTimeString(R(),{hour12:!1})}};mm=G([F(`ca-clock`),k()],mm);var hm=()=>O(`Runs`,{id:`col-runs`}),gm=class extends P{constructor(...e){super(...e),this.hosts=null}static{this.styles=[U,A` :host{display:block;container-type:inline-size;}.g12{align-content:start;}table{width:100%;border-collapse:collapse;font-size:12.5px;}th,td{text-align:start;padding:8px 10px;border-top:1px solid var(--line);vertical-align:baseline;}thead th{border-top:0;font-size:11.5px;font-weight:600;color:var(--text-muted);white-space:nowrap;}tbody th{font-family:var(--mono);font-weight:600;color:var(--text);overflow-wrap:anywhere;}.num{font-family:var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap;}td.runs{color:var(--text-2);}@container (max-width:640px){thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);}tr{display:block;padding:8px 0;border-top:1px solid var(--line);}tbody tr:first-child{border-top:0;}th,td{display:flex;gap:12px;padding:2px 0;border:0;white-space:normal;}td::before{content:attr(data-label);flex:0 0 9em;color:var(--text-muted);font-family:var(--sans);font-size:11.5px;}}`]}row(e){let t=!e.up;return j`<tr>
|
|
903
903
|
<th scope="row">${e.host_id}</th>
|
|
904
|
-
<td data-label=${
|
|
905
|
-
<td data-label=${
|
|
906
|
-
<td data-label=${
|
|
907
|
-
<td data-label=${
|
|
908
|
-
</tr>`;var n}render(){let e=this.hosts?.hosts??[],t=this.hosts?.quota??[];return
|
|
904
|
+
<td data-label=${O(`Status`)}>${Zr({text:_c(e),tone:t?`attention`:`done`})}</td>
|
|
905
|
+
<td data-label=${O(`Last report`)} class="num" title=${e.last_seen}>${q(e.last_seen,!0)||`—`}</td>
|
|
906
|
+
<td data-label=${O(`Report interval`)} class="num">${e.interval_s==null?`—`:H(e.interval_s)}</td>
|
|
907
|
+
<td data-label=${hm()} class="runs" ><span>${bc(e.runs)}${e.running?j` | ${O(D`${e.running} running`)}`:N}${e.unresponsive?j` | <span class="tone-text" data-tone="attention">${n=e.unresponsive,O(D`${n} with no report from host`)}</span>`:N}</span></td >
|
|
908
|
+
</tr>`;var n}render(){let e=this.hosts?.hosts??[],t=this.hosts?.quota??[];return j`<div class="g12">
|
|
909
909
|
<section class="panel c12 enter">
|
|
910
|
-
<h3>${
|
|
911
|
-
${e.length?
|
|
910
|
+
<h3>${O(`Hosts`)}<span class="r">${xc(e)}</span></h3>
|
|
911
|
+
${e.length?j`<table>
|
|
912
912
|
<thead><tr>
|
|
913
|
-
<th scope="col">${
|
|
914
|
-
<th scope="col">${
|
|
913
|
+
<th scope="col">${O(`Host`)}</th><th scope="col">${O(`Status`)}</th><th scope="col">${O(`Last report`)}</th>
|
|
914
|
+
<th scope="col">${O(`Report interval`)}</th><th scope="col">${hm()}</th>
|
|
915
915
|
</tr></thead>
|
|
916
916
|
<tbody>${e.map(e=>this.row(e))}</tbody>
|
|
917
|
-
</table>`:
|
|
917
|
+
</table>`:j`<div class="meta">${O(`No hosts`)}</div>`}
|
|
918
918
|
</section>
|
|
919
|
-
${t.length?
|
|
920
|
-
<h3 title=${
|
|
919
|
+
${t.length?j`<section class="panel c12 enter">
|
|
920
|
+
<h3 title=${O(`Account-wide | first and last reading per account | read at each agent session start`)}>${O(`Subscription usage`)}</h3>
|
|
921
921
|
<ca-quota .accounts=${t} .rests=${t.flatMap(e=>e.rests??[])} live></ca-quota>
|
|
922
|
-
</section>`:
|
|
923
|
-
</div>`}};
|
|
924
|
-
${this.hub?
|
|
922
|
+
</section>`:N}
|
|
923
|
+
</div>`}};G([I({attribute:!1})],gm.prototype,`hosts`,void 0),gm=G([F(`ca-hosts`),k()],gm);var _m=e=>`run-${e}`,vm=class extends P{constructor(...e){super(...e),this.runs=[],this.current=``,this.open=!1,this.hub=!1,this.hosts=[],this.page=``,this.q=``,this.host=``,this.kb=-1}static{this.styles=[U,A` :host{position:absolute;top:50px;width:min(580px,calc(100cqi - 24px));max-height:min(72vh,660px);display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line2);border-radius:14px;box-shadow:0 24px 70px color-mix(in srgb,var(--shadow) 70%,transparent);opacity:0;transform:translateY(-6px) scale(0.985);pointer-events:none;z-index:40;visibility:hidden;container-type:inline-size;transition:opacity 0.16s var(--ease),transform 0.16s var(--ease),visibility 0s linear 0.16s;}:host([open]){opacity:1;transform:none;pointer-events:auto;visibility:visible;transition-delay:0s;}.search{padding:10px;border-bottom:1px solid var(--line);}input,select{background:var(--well);border:1px solid var(--line);color:var(--text);border-radius:9px;font:inherit;outline:none;}input{width:100%;padding:8px 11px;}input:focus,select:focus{border-color:var(--accent);}.list{overflow:auto;padding:6px;}.group{font-size:11.5px;font-weight:600;color:var(--text-muted);padding:10px 9px 4px;}.group .n{font-weight:400;margin-left:4px;}.keys{margin-top:6px;display:flex;gap:4px;align-items:center;}.item{display:grid;grid-template-columns:12px minmax(0,1fr) auto;gap:3px 10px;align-items:center;padding:7px 9px;border-radius:9px;cursor:pointer;}.item:hover,.item.kb{background:var(--raise);}.item.cur{box-shadow:inset 2px 0 0 var(--accent);background:var(--accent-bg);}.nm{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.when{font-size:11px;color:var(--text-muted);white-space:nowrap;}@container (max-width:480px){.when.page{grid-column:2 / 4;white-space:normal;}}.sub{grid-column:2 / 4;display:flex;gap:7px;flex-wrap:wrap;font-size:11px;color:var(--text-muted);}.row{display:flex;gap:8px;}select{max-width:40%;padding:0 8px;}.host{display:flex;gap:8px;flex-wrap:wrap;color:var(--text-2);border-top:1px solid var(--line);margin-top:6px;}.host b{font-family:var(--mono);color:var(--text);}.host .n{margin-left:auto;}.when[data-tone]{color:var(--tone);font-weight:600;}`]}connectedCallback(){super.connectedCallback(),this.setAttribute(`role`,`dialog`),this.setAttribute(`aria-modal`,`true`)}willUpdate(){this.setAttribute(`aria-label`,O(`Runs`))}updated(e){e.has(`open`)&&this.open&&(this.q=``,this.kb=-1,setTimeout(()=>this.input?.focus(),30))}groups(){let e=this.q.toLowerCase().trim(),t=this.runs.filter(t=>(!e||t.run.toLowerCase().includes(e)||(t.run_group||``).toLowerCase().includes(e))&&(!this.host||t.host_id===this.host));if(this.hub)return ie(t,this.hosts).map(({hostId:e,host:t,runs:n})=>{let r=e||yc(``),i=t?(e=>!e.up&&e.last_seen?O(D`no report since ${q(e.last_seen,!0)}`):_c(e))(t):``,a=bc(n.length);return[J(r,i,a),j`<b>${r}</b>${t?Zr({text:i,tone:t.up?`done`:`attention`,title:vc(t)}):N}<span class="n">${a}</span>`,n]});let n=e=>!e.running&&(e=>{let t=Date.parse(e.last_ts||``);return Number.isNaN(t)?1/0:(Date.now()-t)/1e3})(e)>=86400;return[[O(`Running`),t.filter(e=>e.running)],[O(`Last 24 hours`),t.filter(e=>!e.running&&!n(e))],[O(`Older`),t.filter(n)]].map(([e,t])=>[e,j`${e} <span class="n">${t.length}</span>`,t])}pick(e){this.close(),typeof e==`string`?e!==this.page&&$(this,`ca-navigate`,{page:e,run:``}):(e.run!==this.current||this.page)&&$(this,`ca-select-run`,{run:e.run})}close(){$(this,`ca-close`,{})}onDialogKey(e){e.key===`Escape`?this.close():e.key===`Tab`&&(e.preventDefault(),(e.target===this.input&&this.hub?this.select:this.input)?.focus())}onKey(e,t){if(e.key===`ArrowDown`)this.kb=Math.min(t.length-1,this.kb+1);else{if(e.key!==`ArrowUp`){if(e.key===`Enter`){e.preventDefault();let n=t[Math.max(0,this.kb)];n!==void 0&&this.pick(n);return}return}this.kb=Math.max(0,this.kb-1)}e.preventDefault(),this.updateComplete.then(()=>this.renderRoot.querySelector(`.item.kb`)?.scrollIntoView({block:`nearest`}))}render(){let e=this.groups().filter(e=>e[2].length),t=e.flatMap(e=>e[2]),n=this.q.trim()?[]:this.hub?[`trends`,`hosts`]:[`trends`],r=[...n,...t],i=r[this.kb]===void 0?N:_m(this.kb),a=j`<input placeholder=${O(`Search runs`)} aria-label=${O(`Search runs`)} autocomplete="off" .value=${this.q} role="combobox" aria-expanded=${r.length?`true`:`false`} aria-controls="runs" aria-autocomplete="list" aria-activedescendant=${i} @input=${e=>{this.q=e.target.value,this.kb=0}} @keydown=${e=>this.onKey(e,r)} />`,o=0;return j`<div class="search" @keydown=${e=>this.onDialogKey(e)}>
|
|
924
|
+
${this.hub?j`<div class="row">${a}${this.hostFilter()}</div>`:a}
|
|
925
925
|
<div class="keys meta" aria-hidden="true"><span class="kbd">↑</span><span class="kbd">↓</span> <span class="kbd">Enter</span> <span class="kbd">Esc</span></div>
|
|
926
926
|
</div>
|
|
927
927
|
<div class="list" @mousedown=${e=>e.preventDefault()}>
|
|
928
|
-
${r.length?
|
|
928
|
+
${r.length?j`<div id="runs" role="listbox" aria-label=${O(`Runs`)}>
|
|
929
929
|
${n.map(e=>this.item(e,o++))}
|
|
930
|
-
${e.map(([e,t,n])=>
|
|
930
|
+
${e.map(([e,t,n])=>j`<div role="group" aria-label=${e}>
|
|
931
931
|
<div class="group${this.hub?` host`:``}" aria-hidden="true">${t}</div>
|
|
932
932
|
${n.map(e=>this.item(e,o++))}
|
|
933
933
|
</div>`)}
|
|
934
|
-
</div>`:
|
|
935
|
-
</div>`}hostFilter(){return
|
|
936
|
-
<option value="" ?selected=${!this.host}>${
|
|
937
|
-
${
|
|
938
|
-
</select>`}counts(e){let t=e.tasks,n=[
|
|
939
|
-
${typeof e==`string`?n===`hosts`?
|
|
934
|
+
</div>`:j`<div class="blank"><span>${O(`No runs match the search`)}</span></div>`}
|
|
935
|
+
</div>`}hostFilter(){return j`<select aria-label=${O(`Host`)} title=${O(`Host`)} @change=${e=>{this.host=e.target.value,this.kb=-1}}>
|
|
936
|
+
<option value="" ?selected=${!this.host}>${O(`All hosts`)}</option>
|
|
937
|
+
${ie(this.runs,this.hosts).map(e=>j`<option value=${e.hostId} ?selected=${e.hostId===this.host}>${e.hostId||yc(``)}</option>`)}
|
|
938
|
+
</select>`}counts(e){let t=e.tasks,n=[O(D`${t.done} of ${t.total} tasks done`)];t.failed&&n.push(Q(`failed`,t.failed)),t.not_started&&n.push(Q(`not_started`,t.not_started)),t.partial&&n.push(Q(`partial`,t.partial)),t.skipped&&n.push(Q(`skipped`,t.skipped)),t.cancelled&&n.push(Q(`cancelled`,t.cancelled)),t.running&&n.push(Q(`running`,t.running)),t.waiting&&n.push(Q(`waiting`,t.waiting)),t.not_run&&n.push(Q(`not_run`,t.not_run));let r=(e=>C(e))(e);r!=null&&n.push(O(D`took ${H(r)}`)),e.cost_usd!==null&&e.cost_usd!==void 0&&n.push(cs(e.cost_usd));let i=Us(e.quota??[]);return i&&n.push(i),J(...n)}when(e){let t=w(e),n=q(e.last_ts,!0),r=t===`unresponsive`;return j`<span class="when" data-tone=${r?`attention`:N} data-mark=${r?`pending`:N} title=${r?J(vc(te(this.hosts,e)),O(D`Last activity ${n}`)):n} >${t===`running`?O(`running`):r?gc():rs(e.last_ts)}</span>`}item(e,t){let n=typeof e==`string`?e:null,r=n?n===this.page:!this.page&&e.run===this.current;return j`<div class=${`item${r?` cur`:``}${t===this.kb?` kb`:``}`} id=${_m(t)} role="option" aria-selected=${t===this.kb?`true`:`false`} aria-current=${r?n?`page`:`true`:N} @click=${()=>this.pick(e)}>
|
|
939
|
+
${typeof e==`string`?n===`hosts`?j`<span aria-hidden="true">⊞</span><span class="nm">${O(`Hosts`)}</span><span class="when page">${xc(this.hosts)}</span>`:j`<span aria-hidden="true">▥</span><span class="nm" title=${Vc()}>${Bc()}</span>`:j`<span class="dot" data-tone=${z(hs(w(e),e.tasks))} aria-hidden="true"></span><span class="nm" title=${this.hub?e.run:N}>${this.hub?ne(e):e.run}${hc(e)?j` ${Xr({...hc(e),tone:`muted`})}`:N}</span>
|
|
940
940
|
${this.when(e)}
|
|
941
941
|
<span class="sub">
|
|
942
|
-
${e.run_group&&e.run_group!==
|
|
942
|
+
${e.run_group&&e.run_group!==ne(e)?j`<span>${O(D`Run group ${e.run_group}`)}</span>`:N} <span title=${Ws(e.quota??[])}>${this.counts(e)}</span>
|
|
943
943
|
</span>`}
|
|
944
|
-
</div>`}};function
|
|
945
|
-
${n}<span>${
|
|
946
|
-
</button>`}render(){let e=
|
|
944
|
+
</div>`}};function ym(e){return e===`system`?O(`System`):e===`high-contrast`?O(`High contrast`):hr[e].label}G([I({attribute:!1})],vm.prototype,`runs`,void 0),G([I()],vm.prototype,`current`,void 0),G([I({type:Boolean,reflect:!0})],vm.prototype,`open`,void 0),G([I({type:Boolean})],vm.prototype,`hub`,void 0),G([I({attribute:!1})],vm.prototype,`hosts`,void 0),G([I()],vm.prototype,`page`,void 0),G([L()],vm.prototype,`q`,void 0),G([L()],vm.prototype,`host`,void 0),G([L()],vm.prototype,`kb`,void 0),G([vn(`input`)],vm.prototype,`input`,void 0),G([vn(`select`)],vm.prototype,`select`,void 0),vm=G([F(`ca-run-picker`),k()],vm);var bm=class extends P{constructor(...e){super(...e),this.value=`contraagent-dark`,this.system=`contraagent-dark`,this.open=!1,this.onDocDown=e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)}}static{this.styles=[U,A` :host{position:relative;display:inline-flex;}.trig{display:inline-flex;align-items:center;gap:6px;background:none;border:1px solid var(--line);border-radius:999px;padding:2px 10px 2px 7px;font-size:11px;color:var(--text-muted);cursor:pointer;}.trig:hover,.trig[aria-expanded='true']{color:var(--text);border-color:var(--line2);}.trig svg{width:13px;height:13px;}@media (max-width:480px){.trig{padding:4px 6px;}.trig .lbl{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}}.menu{position:absolute;right:0;top:calc(100% + 8px);min-width:236px;padding:6px;z-index:50;background:var(--panel);border:1px solid var(--line2);border-radius:12px;box-shadow:0 18px 48px color-mix(in srgb,var(--shadow) 65%,transparent);animation:enter 0.16s var(--ease) both;}.grp{font-size:11px;color:var(--text-muted);padding:8px 9px 4px;}[role='separator']{height:1px;background:var(--line);margin:6px 4px;}.item{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;width:100%;background:none;border:0;border-radius:8px;padding:6px 9px;text-align:left;cursor:pointer;color:var(--text-2);font-size:12px;}.item:hover{background:var(--raise);color:var(--text);}.item:focus-visible{outline-offset:-2px;}.item[aria-checked='true']{background:var(--accent-bg);color:var(--text);font-weight:600;}.item .meta{font-weight:400;}.item .sub{display:block;}.rd{width:12px;height:12px;border-radius:50%;border:1.5px solid var(--line2);display:grid;place-items:center;}[aria-checked='true'] .rd{border-color:var(--accent);}[aria-checked='true'] .rd::after{content:'';width:6px;height:6px;border-radius:50%;background:var(--accent);}.sw{display:inline-flex;gap:2px;align-items:flex-end;width:30px;height:18px;border-radius:5px;border:1px solid;padding:3px 4px;}.sw i{flex:1;height:4px;border-radius:2px;}.sw i:first-child{height:8px;}.sw.split{padding:0;overflow:hidden;gap:0;}.sw.split>span{flex:1;height:100%;display:flex;gap:2px;align-items:flex-end;padding:3px 2px;}`]}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`pointerdown`,this.onDocDown)}items(){return[...this.renderRoot.querySelectorAll(`.item`)]}updated(e){e.has(`open`)&&(this.open?document.addEventListener(`pointerdown`,this.onDocDown):document.removeEventListener(`pointerdown`,this.onDocDown)),e.has(`open`)&&this.open&&(this.items().find(e=>e.getAttribute(`aria-checked`)===`true`)??this.items()[0])?.focus()}close(e){this.open=!1,e&&this.trig?.focus()}choose(e){this.value=e,$(this,`ca-choose-theme`,{theme:e}),this.close(!0)}onTrigKey(e){e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),this.open=!0)}onMenuKey(e){let t=this.items(),n=t.indexOf(e.composedPath()[0]),r=e=>t[(e+t.length)%t.length]?.focus();if(e.key===`ArrowDown`)r(n+1);else if(e.key===`ArrowUp`)r(n-1);else if(e.key===`Home`)r(0);else if(e.key===`End`)r(t.length-1);else{if(e.key!==`Escape`)return e.key===`Tab`?void(this.open=!1):void 0;this.close(!0)}e.preventDefault(),e.stopPropagation()}item(e){let t=e===this.value,n=e===`system`?j`<span class="sw split" style="border-color:${hr[`contraagent-dark`].tokens.line2}" ><span style="background:${hr[`contraagent-dark`].tokens.card}"><i style="background:${hr[`contraagent-dark`].tokens.accent}"></i></span ><span style="background:${hr[`contraagent-light`].tokens.card}"><i style="background:${hr[`contraagent-light`].tokens.accent}"></i></span ></span>`:(e=>{let t=hr[e].tokens;return j`<span class="sw" style="background:${t.card};border-color:${t.line2}" ><i style="background:${t.accent}"></i><i style="background:${t[`code-string`]}"></i><i style="background:${t[`code-keyword`]}"></i ></span>`})(e);return j`<button type="button" class="item" role="menuitemradio" aria-checked=${t?`true`:`false`} tabindex="-1" data-theme=${e} @click=${()=>this.choose(e)}>
|
|
945
|
+
${n}<span>${ym(e)}${e===`system`?j`<span class="meta sub">${hr[this.system].label}</span>`:N}</span><span class="rd" aria-hidden="true"></span>
|
|
946
|
+
</button>`}render(){let e=fr.filter(e=>e===`system`||!pr.includes(e));return j`<button type="button" class="trig" aria-haspopup="menu" aria-expanded=${this.open?`true`:`false`} aria-controls="menu" title=${O(D`Theme: ${ym(this.value)}`)} @click=${()=>this.open=!this.open} @keydown=${e=>this.onTrigKey(e)}>
|
|
947
947
|
<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6.25" fill="none" stroke="currentColor" stroke-width="1.5" /><path d="M8 1.75a6.25 6.25 0 0 1 0 12.5z" fill="currentColor" /></svg>
|
|
948
|
-
<span class="lbl">${
|
|
948
|
+
<span class="lbl">${O(`Theme`)}</span>
|
|
949
949
|
</button>
|
|
950
|
-
${this.open?
|
|
950
|
+
${this.open?j`<div id="menu" class="menu" role="menu" aria-label=${O(`Theme`)} @keydown=${e=>this.onMenuKey(e)}>
|
|
951
951
|
${e.map(e=>this.item(e))}
|
|
952
952
|
<div role="separator"></div>
|
|
953
953
|
<div role="group" aria-labelledby="grp-editor">
|
|
954
|
-
<div class="grp" id="grp-editor">${
|
|
955
|
-
${
|
|
954
|
+
<div class="grp" id="grp-editor">${O(`Editor themes`)}</div>
|
|
955
|
+
${pr.map(e=>this.item(e))}
|
|
956
956
|
</div>
|
|
957
|
-
</div>`:
|
|
957
|
+
</div>`:N}`}};G([I()],bm.prototype,`value`,void 0),G([I()],bm.prototype,`system`,void 0),G([L()],bm.prototype,`open`,void 0),G([vn(`.trig`)],bm.prototype,`trig`,void 0),bm=G([F(`ca-theme-switch`),k()],bm);var xm=e=>(e.input??0)+(e.output??0)+(e.cache_read??0)+(e.cache_creation??0);function Sm(e,t){if(!e.totals.runs)return[];let n=Gc(),r=e.period.days.map(e=>Hc(e,t)),i=[],a=function(e){let t=new Map;for(let n of[...e.quota,...e.rests]){let e=n.credential??``;if(!n.account)continue;let r=t.get(e)??new Set;r.add(n.account),t.set(e,r)}return(e,n)=>{let r=e??``,i=Ps(r)||r||`—`;return n&&(t.get(r)?.size??0)>1?`${i} | ${zs(n)}`:i}}(e),o=e.totals,s=e.daily.filter(e=>Object.keys(e.cost_usd).length).length;var c,l;i.push({id:`totals`,wide:!0,body:{type:`tiles`,collapsed:!1,tiles:[{id:`runs`,label:n.runs,value:String(o.runs),sub:[]},{id:`attempts`,label:n.attempts,value:String(o.attempts),sub:[[(l=o.attempts?`${Math.round(o.ok/o.attempts*100)}%`:`—`,O(D`Done ${l}`)),...o.partial?[Q(`partial`,o.partial)]:[]]]},{id:`cost`,label:n.cost,value:o.cost_usd==null?`—`:cs(o.cost_usd),sub:s&&o.cost_usd!=null?[[(c=cs(o.cost_usd/s),O(D`${c} a day`))]]:[]},{id:`tokens`,label:n.tokens,value:Z(xm(o.tokens)),sub:[[`${n.input} ${Z(o.tokens.input)} | ${n.output} ${Z(o.tokens.output)}`]]},{id:`time`,label:n.time,value:H(o.wall_s),sub:[]}]}});let u=[...new Set(e.daily.flatMap(e=>Object.keys(e.cost_usd)))].map(t=>({s:t,total:e.daily.reduce((e,n)=>e+(n.cost_usd[t]??0),0)})).sort((e,t)=>t.total-e.total).map(e=>e.s);i.push({id:`cost-by-day`,wide:!0,body:{type:`columns`,collapsed:!1,title:n.costByDay,x:r,unit:`usd`,stacked:!0,series:u.map(t=>({name:t,values:e.daily.map(e=>e.cost_usd[t]??null)}))}});let d=(t,r,i,a)=>({id:t,wide:!0,body:{type:`table`,collapsed:a,title:r,columns:[{id:`kind`,label:n.kind},...e.kinds.some(e=>e.group&&e.group!==e.kind)?[{id:`group`,label:n.group}]:[],{id:`tasks`,label:n.tasks,align:`end`,format:`number`},{id:`passed`,label:n.tasksDone,align:`end`,format:`pct`},...i.some(e=>e.tasks_partial)?[{id:`partial`,label:n.partial,align:`end`,format:`number`}]:[],{id:`attempts`,label:n.attempts,align:`end`,format:`number`},{id:`median`,label:n.medianTime,align:`end`,format:`duration`},{id:`wall`,label:n.totalTime,align:`end`,format:`duration`},{id:`tokens`,label:n.tokens,align:`end`,format:`tokens`},{id:`cost`,label:n.cost,align:`end`,format:`usd`,bar:!0}],rows:[...i].sort((e,t)=>(t.cost_usd??0)-(e.cost_usd??0)||t.attempts-e.attempts).map(e=>({kind:e.kind,group:e.group,tasks:e.tasks,passed:e.tasks?e.tasks_ok/e.tasks:null,partial:e.tasks_partial??0,attempts:e.attempts,median:e.wall_s_median,wall:e.wall_s,tokens:xm(e.tokens),cost:e.cost_usd,...e.tasks_ok<e.tasks?{_tone:`attention`}:{}}))}}),f=e.kinds.filter(e=>e.executor!==`python`),p=e.kinds.filter(e=>e.executor===`python`);f.length&&i.push(d(`kinds`,n.kinds,f,!1)),p.length&&i.push(d(`python-kinds`,Kc(n.pythonKinds,p.length),p,f.length>0)),e.models.length&&i.push({id:`models`,wide:!0,body:{type:`table`,collapsed:!1,title:n.models,columns:[{id:`model`,label:n.model},{id:`sessions`,label:n.sessions,align:`end`,format:`number`},{id:`calls`,label:n.calls,align:`end`,format:`number`},{id:`input`,label:n.input,align:`end`,format:`tokens`},{id:`output`,label:n.output,align:`end`,format:`tokens`},{id:`cache_read`,label:n.cacheRead,align:`end`,format:`tokens`},{id:`cache_write`,label:n.cacheWrite,align:`end`,format:`tokens`},{id:`cost`,label:n.cost,align:`end`,format:`usd`,bar:!0},{id:`wall`,label:n.time,align:`end`,format:`duration`},...e.models.some(e=>e.peak_context!=null)?[{id:`peak`,label:Zc(),align:`end`,format:`tokens`,tip:Qc()}]:[]],rows:e.models.map(e=>{return{model:(t=e.agent,n=e.model,t?`${n||`—`} | ${t}`:n||`—`),sessions:e.sessions,calls:e.calls,input:e.input,output:e.output,cache_read:e.cache_read,cache_write:e.cache_creation,cost:e.cost_usd,wall:e.wall_s,peak:e.peak_context??null};var t,n})}}),e.quota.length&&i.push({id:`usage`,wide:!0,body:{type:`lines`,collapsed:!1,title:n.usage,x:r,unit:`pct`,series:e.quota.map(e=>({name:Jc(a(e.credential,e.account),Rs(e.window)),values:e.daily_peak.map(e=>e==null?null:e/100)}))}});let m=e.stops.filter(e=>e.stop!==`completed`&&e.stop!==`skipped`);return m.length&&i.push({id:`outcomes`,body:{type:`table`,collapsed:!1,title:n.outcomes,columns:[{id:`outcome`,label:n.outcome},{id:`attempts`,label:n.attempts,align:`end`,format:`number`,bar:!0},{id:`kinds`,label:n.kinds}],rows:m.map(e=>({outcome:Ss(e.stop),attempts:e.attempts,kinds:Object.entries(e.kinds).sort((e,t)=>t[1]-e[1]).map(([e,t])=>`${e} ${t}`).join(` | `),_tone:`failed`}))}}),e.denials.length&&i.push({id:`denials`,body:{type:`table`,collapsed:!1,title:n.denials,columns:[{id:`tool`,label:n.tool},{id:`count`,label:n.toolCalls,align:`end`,format:`number`,bar:!0},{id:`kinds`,label:n.kinds}],rows:e.denials.map(e=>({tool:e.tool,count:e.count,kinds:Object.entries(e.kinds).map(([e,t])=>`${e} ${t}`).join(` | `)}))}}),e.safety_stops.length&&i.push({id:`safety-stops`,body:{type:`table`,collapsed:!1,title:cl(),columns:[{id:`part`,label:O(`Stopped part`),tip:ul()},{id:`model`,label:n.model},{id:`count`,label:cl(),align:`end`,format:`number`,bar:!0},{id:`kinds`,label:n.kinds}],rows:e.safety_stops.map(e=>({part:dl(e.part),model:e.model||`—`,count:e.count,kinds:Object.entries(e.kinds).sort((e,t)=>t[1]-e[1]).map(([e,t])=>`${e} ${t}`).join(` | `)}))}}),e.deferred.length&&i.push({id:`deferred`,body:{type:`table`,collapsed:e.deferred.length>20,title:Kc(n.deferred,e.deferred.length),columns:[{id:`when`,label:n.when,format:`datetime`},{id:`task`,label:n.task},{id:`cause`,label:n.cause},{id:`run`,label:n.run}],rows:[...e.deferred].sort((e,t)=>t.ts.localeCompare(e.ts)).map(e=>({when:e.ts,task:e.key,cause:e.cause===`rest`?qc(e.reason):Qs({cause:e.cause},e.reason),run:e.run,_tone:`attention`}))}}),e.rests.length&&i.push({id:`rests`,body:{type:`table`,collapsed:!1,title:n.rests,columns:[{id:`when`,label:n.when,format:`datetime`},{id:`identity`,label:n.identity},{id:`event`,label:n.event},{id:`run`,label:n.run}],rows:[...e.rests].sort((e,t)=>(t.ts??``).localeCompare(e.ts??``)).map(e=>{return{when:e.ts,identity:a(e.credential,e.account),event:(t=e.event,t===`end`?O(`ended`):t===`start`?O(`started`):t||`—`),run:e.run};var t})}}),e.starts.counts.some(e=>e.some(e=>e>0))&&i.push({id:`starts`,wide:!0,body:{type:`heatmap`,collapsed:!1,title:n.starts,x:e.starts.hours.map(e=>String(e).padStart(2,`0`)),y:Wc(t),values:e.starts.counts.map(e=>e.map(e=>e||null)),unit:`number`}}),i.push({id:`runs`,wide:!0,body:{type:`table`,collapsed:!1,title:n.runs,columns:[{id:`run`,label:n.run},{id:`started`,label:n.started,format:`datetime`},{id:`attempts`,label:n.attempts,align:`end`,format:`number`},{id:`passed`,label:n.done,align:`end`,format:`pct`},...e.runs.some(e=>e.partial)?[{id:`partial`,label:n.partial,align:`end`,format:`number`}]:[],{id:`cost`,label:n.cost,align:`end`,format:`usd`,bar:!0},{id:`wall`,label:n.time,align:`end`,format:`duration`}],rows:e.runs.map(e=>({run:e.run,started:e.started_at||null,attempts:e.attempts,passed:e.attempts?e.ok/e.attempts:null,partial:e.partial??0,cost:e.cost_usd,wall:e.wall_s,...e.ok<e.attempts?{_tone:`attention`}:{}}))}}),i}var Cm=()=>Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`;function wm(e,t){let n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-t),n.toISOString().slice(0,10)}function Tm(e,t=new Date){let n=e.tz||Cm();return{...e.days===0&&e.from&&e.to?{from:e.from,to:e.to}:(()=>{let r=function(e,t=new Date){try{return new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(t)}catch{return t.toISOString().slice(0,10)}}(n,t);return{from:wm(r,Math.max(1,e.days)-1),to:r}})(),tz:n,...e.group?{run_group:e.group}:{}}}var Em=e=>[``,...new Set(e.filter(e=>e.scope===`trends`&&e.tab).map(e=>e.tab))],Dm=class extends P{constructor(...e){super(...e),this.view=null,this.days=14,this.from=``,this.to=``,this.tz=``,this.group=``,this.groups=[],this.panels=[],this.exported=!1,this.tab=``,this.tabFocus=new pi(this,{items:()=>[...this.renderRoot.querySelectorAll(`[role="tab"]`)],layout:`horizontal`,wrap:!0})}static{this.styles=[U,A` :host{display:block;}.controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;margin-bottom:14px;}.controls label{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted);}input,select{background:var(--well);border:1px solid var(--line);color:var(--text);border-radius:8px;font:inherit;font-size:12px;padding:4px 8px;}input:focus-visible,select:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:1px;}.period{font-size:12px;color:var(--text-2);}.loading{font-size:12px;color:var(--text-muted);}.err{font-size:12px;color:var(--status-failed);}.wide{margin-bottom:14px;}.pairs{columns:2 440px;column-gap:14px;margin-bottom:14px;}.pairs>.panel{break-inside:avoid;margin-bottom:14px;}.panel{display:block;}.tabs{display:flex;flex-wrap:wrap;gap:2px;border-bottom:1px solid var(--line);margin-bottom:14px;}.tab{background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;padding:8px 14px 9px;color:var(--text-muted);font:inherit;font-weight:500;cursor:pointer;white-space:nowrap;}.tab:hover{color:var(--text-2);}.tab[aria-selected='true']{color:var(--text);font-weight:600;border-bottom-color:var(--accent);}.tab:focus-visible{outline:var(--focus-width) solid var(--focus);outline-offset:-2px;}`]}go(e){$(this,`ca-navigate`,e)}render(){let e=this.view,t=this.panels.filter(e=>e.scope===`trends`),n=Em(t),r=n.includes(this.tab)?this.tab:``,i=t.filter(e=>(e.tab??``)===r),a=r?this.trendPanels(i,e?.panels??{},!1):this.trends(i);return j`<h2 class="sr">${Bc()}</h2>
|
|
958
958
|
${this.controls()}
|
|
959
|
-
${e?.error?
|
|
960
|
-
${n.length>1?
|
|
961
|
-
${e.map((e,n)=>
|
|
962
|
-
</div>`}updated(){let e=
|
|
963
|
-
${n&&!r.length?
|
|
964
|
-
${
|
|
965
|
-
${a.length?
|
|
966
|
-
${
|
|
967
|
-
${this.trendPanels(e,t?.panels??{},!0)}`}controls(){let e=this.view?.data,t=e?
|
|
968
|
-
<cae-segmented label=${
|
|
969
|
-
${this.days===0?
|
|
970
|
-
<label>${
|
|
971
|
-
<label>${
|
|
959
|
+
${e?.error?j`<p class="err" role="alert">${O(`No answer from the monitor`)} | ${e.error.message}</p>`:N}
|
|
960
|
+
${n.length>1?j`${this.tabList(n,r)}<div role="tabpanel" id="trends-tabpanel" aria-labelledby=${`trends-tab-${n.indexOf(r)}`}>${a}</div>`:a}`}tabList(e,t){return j`<div class="tabs" role="tablist" aria-label=${Bc()}>
|
|
961
|
+
${e.map((e,n)=>j`<button type="button" role="tab" class="tab" id=${`trends-tab-${n}`} aria-selected=${e===t?`true`:`false`} aria-controls="trends-tabpanel" @click=${()=>e!==t&&$(this,`ca-navigate`,{trendsTab:e})}>${e||O(`Summary`)}</button>`)}
|
|
962
|
+
</div>`}updated(){let e=Em(this.panels);this.tabFocus.set(Math.max(0,e.indexOf(this.tab)))}trends(e){let t=this.view,n=t?.data??null,r=n?Sm(n,R()):[],i=r.filter(e=>e.wide),a=r.filter(e=>!e.wide),o=[`totals`,`cost-by-day`,`kinds`,`python-kinds`,`models`,`usage`],s=i.filter(e=>o.includes(e.id)),c=i.filter(e=>!o.includes(e.id)),l=(e,t)=>j`<section class="panel" data-section=${t}><ca-panel-body .body=${e}></ca-panel-body></section>`;return j`${!n&&t?.loading?j`<p class="loading">${O(`Loading…`)}</p>`:N}
|
|
963
|
+
${n&&!r.length?j`<div class="blank small"><span>${O(`No runs in this period`)}</span></div>`:N}
|
|
964
|
+
${W(s,e=>e.id,e=>j`<div class="wide">${l(e.body,e.id)}</div>`)}
|
|
965
|
+
${a.length?j`<div class="pairs">${W(a,e=>e.id,e=>l(e.body,e.id))}</div>`:N}
|
|
966
|
+
${W(c,e=>e.id,e=>j`<div class="wide">${l(e.body,e.id)}</div>`)}
|
|
967
|
+
${this.trendPanels(e,t?.panels??{},!0)}`}controls(){let e=this.view?.data,t=e?j`<span class="period">${function(e,t,n=``,r=R()){let i=t.slice(0,4);return O(n?D`${Hc(e,r)} to ${Hc(t,r)}, ${i} | ${n}`:D`${Hc(e,r)} to ${Hc(t,r)}, ${i}`)}(e.period.from,e.period.to,this.exported?e.period.tz:``)}</span>`:N;if(this.exported)return j`<div class="controls"><span class="meta">${O(`Period of this export`)}</span>${t}</div>`;let n=this.days?String(this.days):`dates`,r=e?.period.to||new Date().toISOString().slice(0,10),i=[...new Set([this.tz,Intl.DateTimeFormat().resolvedOptions().timeZone,`UTC`].filter(Boolean))];return j`<div class="controls">
|
|
968
|
+
<cae-segmented label=${O(`Period`)} .value=${n} .options=${[...$n.map(e=>({value:String(e),label:Uc(e)})),{value:`dates`,label:O(`Dates`)}]} @cae-change=${e=>e.detail.value===`dates`?this.go({days:0,from:this.from||wm(r,(this.days||14)-1),to:this.to||r}):this.go({days:Number(e.detail.value),from:``,to:``})}></cae-segmented>
|
|
969
|
+
${this.days===0?j`<label>${O(`From`)} <input type="date" .value=${this.from} max=${this.to||N} @change=${e=>this.go({days:0,from:e.target.value,to:this.to})} /></label>
|
|
970
|
+
<label>${O(`To`)} <input type="date" .value=${this.to} min=${this.from||N} @change=${e=>this.go({days:0,from:this.from,to:e.target.value})} /></label>`:N}
|
|
971
|
+
<label>${O(`Time zone`)}
|
|
972
972
|
<select @change=${e=>this.go({tz:e.target.value})}>
|
|
973
|
-
${i.map(e=>
|
|
973
|
+
${i.map(e=>j`<option value=${e} ?selected=${e===(this.tz||i[0])}>${e}</option>`)}
|
|
974
974
|
</select></label>
|
|
975
|
-
${this.groups.length>1?
|
|
975
|
+
${this.groups.length>1?j`<label>${O(`Run group`)}
|
|
976
976
|
<select @change=${e=>this.go({group:e.target.value})}>
|
|
977
|
-
<option value="" ?selected=${!this.group}>${
|
|
978
|
-
${this.groups.map(e=>
|
|
979
|
-
</select></label>`:
|
|
977
|
+
<option value="" ?selected=${!this.group}>${O(`All run groups`)}</option>
|
|
978
|
+
${this.groups.map(e=>j`<option value=${e} ?selected=${e===this.group}>${e}</option>`)}
|
|
979
|
+
</select></label>`:N}
|
|
980
980
|
${t}
|
|
981
|
-
${this.view?.loading&&e?
|
|
982
|
-
</div>`}trendPanels(e,t,n){return e.length?
|
|
983
|
-
${e.map(e=>
|
|
984
|
-
<h3>${e.icon} ${e.title||e.name}${e.description?
|
|
985
|
-
${t[e.name]?
|
|
986
|
-
</section>`)}`:
|
|
981
|
+
${this.view?.loading&&e?j`<span class="loading" aria-live="polite">${O(`Loading…`)}</span>`:N}
|
|
982
|
+
</div>`}trendPanels(e,t,n){return e.length?j`${n?j`<h3 class="sect-h">${Gc().trendPanels}</h3>`:N}
|
|
983
|
+
${e.map(e=>j`<section class="panel wide" data-panel=${e.name}>
|
|
984
|
+
<h3>${e.icon} ${e.title||e.name}${e.description?j`<span class="r">${e.description}</span>`:N}</h3>
|
|
985
|
+
${t[e.name]?j`<ca-panel-body .body=${t[e.name]}></ca-panel-body>`:j`<p class="loading">${O(`Loading…`)}</p>`}
|
|
986
|
+
</section>`)}`:N}};G([I({attribute:!1})],Dm.prototype,`view`,void 0),G([I({type:Number})],Dm.prototype,`days`,void 0),G([I()],Dm.prototype,`from`,void 0),G([I()],Dm.prototype,`to`,void 0),G([I()],Dm.prototype,`tz`,void 0),G([I()],Dm.prototype,`group`,void 0),G([I({attribute:!1})],Dm.prototype,`groups`,void 0),G([I({attribute:!1})],Dm.prototype,`panels`,void 0),G([I({type:Boolean})],Dm.prototype,`exported`,void 0),G([I()],Dm.prototype,`tab`,void 0),Dm=G([F(`ca-trends`),k()],Dm);var Om=class extends P{static{this.styles=[wr,U,Bl,Il]}constructor(){super(),this.baseUrl=``,this.exportUrl=``,this.history=`url`,this.shortcuts=``,this.run=``,this.locale=``,this.theme=``,this.live=!1,this.pickerOpen=!1,this.qDraft=null,this.themes=new Er(this,{theme:()=>this.theme,pageWide:()=>this.history===`url`}),this.tabFocus=new pi(this,{items:()=>[...this.renderRoot.querySelectorAll(`[role="tablist"] [role="tab"]`)],layout:`horizontal`,wrap:!0}),this.storeBase=``,this.viewRouterMode=`url`,this.storeCleanups=[],this.mainScroll=new Xn(`main`,()=>Kn(this)),this.pendingScroll=null,this.qTimer=null,this.cleanups=[],this.localMemory=new Un,this.onOutsideClick=e=>{e.composedPath().some(e=>e instanceof HTMLElement&&(e.localName===`ca-run-picker`||e.classList.contains(`runbtn`)))||(this.pickerOpen=!1)},this.outsideClickOn=!1,this.navObserver=null,this.navObserved=null,this.locales=!1,this.language=new cr(this,{locale:()=>this.locale,pageWide:()=>this.history===`url`}),new lr(this,e=>this.onKey(e),()=>this.shortcutScope)}async scheduleUpdate(){return await this.language.ready,super.scheduleUpdate()}connectedCallback(){this.locales=Dn(),function(e=document){if(Tr.has(e))return;let t=Cr.styleSheet;t&&`adoptedStyleSheets`in e&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,t],Tr.add(e))}(this.ownerDocument),super.connectedCallback(),this.openStore(),this.openViewRouter(),this.store.start(),this.cleanups.push(()=>{this.listenOutside(!1),this.navObserver?.disconnect(),this.navObserver=null,this.navObserved=null}),this.addEventListener(`ca-open-task`,e=>{this.navigate({tab:`stream`,key:e.detail.key,...e.detail.view?{view:e.detail.view}:{}})}),this.addEventListener(`ca-navigate`,e=>{let{replace:t,...n}=e.detail;this.navigate(n,{replace:!0===t})}),this.addEventListener(`ca-select-run`,e=>this.navigate({run:e.detail.run,page:``})),this.addEventListener(`ca-filter`,e=>this.navigate(e.detail)),this.addEventListener(`ca-choose-theme`,e=>{this.theme=e.detail.theme,function(e,t=Sr()){try{t?.setItem(xr,e)}catch{}}(e.detail.theme)})}get source(){return this.exportUrl?`export:${this.exportUrl}`:this.baseUrl}openStore(){if(this.storeBase=this.source,this.exportUrl){let e=function(e,t={}){let n=e.endsWith(`/`)?e:`${e}/`,r=t.fetch??globalThis.fetch,a=new Map;function o(e){let t=a.get(e);return t||(t=async function(e){let t;try{t=await r(new Request(e))}catch{throw new i(e,`network`)}let n=(t.headers.get(`Content-Type`)??``).split(`;`)[0].trim().toLowerCase();if(!t.ok)throw new i(e,`status`,t.status,n);try{return await t.json()}catch{throw new i(e,`not-json`,t.status,n)}}(n+e),t.catch(()=>a.delete(e)),a.set(e,t)),t}let s=(e,t)=>`runs/${_e(e)}/${t}`,c=e=>Promise.reject(new i(n+e,`status`,404));return{baseUrl:n.replace(/\/$/,``),file:o,info:()=>o(`info.json`),runs:()=>o(`runs.json`),hosts:()=>c(`hosts.json`),async journal(e,t=0){let n=await o(s(e,`journal.json`));return t>0?{entries:n.entries.slice(t),total:n.total}:n},definitions:e=>o(s(e,`definitions.json`)),async task(e,t){let[n,r,i,a]=await Promise.all([o(s(e,`tasks/${_e(ve(t))}.json`)),o(s(e,`journal.json`)),o(s(e,`definitions.json`)),o(s(e,`plan.json`))]),c=r.entries.filter(e=>e.key===t),l=c.at(-1)?.kind??a.nodes.find(e=>e.key===t)?.kind;return{...n,rows:c,definition:i.find(e=>e.kind===l)??null}},stream:(e,t)=>c(s(e,`streams/${_e(ve(t))}.json`)),panel:(e,t)=>o(s(e,`panels/${_e(t)}.json`)),trends:()=>o(`trends.json`),trendsPanel:e=>o(`trends/panels/${_e(e)}.json`)}}(new URL(this.exportUrl,this.ownerDocument.baseURI).href);this.store=new ge({client:e,openRunFeed:be(e),runsEveryMs:0})}else this.store=new ge({baseUrl:this.baseUrl});this.show(this.store.snapshot),this.storeCleanups.push(this.store.subscribe(e=>{this.show(e),this.pickDefaultRun()}),this.store.onNewRow(e=>this.toasts?.show(...Nl(e,this.snap.run))))}closeStore(){for(let e of this.storeCleanups.splice(0))e();this.store.stop()}openViewRouter(){this.viewRouterMode=this.history,Gn(this,this.history===`memory`?this.localMemory:null);let e=this.viewRoute?this.history===`memory`?this.viewRoute:{}:this.run?{run:this.run}:{};this.viewRouter=new sr(this.history,(e,t)=>this.onViewRoute(e,t),e,Vn),this.viewRouter.start()}willUpdate(e){this.isConnected&&this.store&&(this.source!==this.storeBase&&(this.closeStore(),this.openStore(),this.navigate({run:this.run},{replace:!0}),this.store.selectRun(this.viewRoute.run),this.store.start()),this.history!==this.viewRouterMode&&(this.viewRouter.stop(),this.openViewRouter()),e.has(`run`)&&e.get(`run`)!==void 0&&this.run&&this.navigate({run:this.run}))}show(e){e.error&&e.error!==this.snap?.error&&console.error(Ml(e.error)),this.snap=e,this.live=le(e.state,ce(e.runs,e.run))}get shortcutScope(){return(e=>e===`page`||e===`element`||e===`off`)(this.shortcuts)?this.shortcuts:this.history===`url`?`page`:`element`}listenOutside(e){e!==this.outsideClickOn&&(this.outsideClickOn=e,e?document.addEventListener(`click`,this.onOutsideClick):document.removeEventListener(`click`,this.onOutsideClick))}get shownTheme(){return this.themes.shown}disconnectedCallback(){super.disconnectedCallback();for(let e of this.cleanups.splice(0))e();Gn(this,null),this.viewRouter.stop(),this.closeStore(),this.mainScroll.detach()}navigate(e,t={}){this.viewRouter.navigate(e,t)}onViewRoute(e,t){let n=this.viewRoute;this.viewRoute=e,t!==`replace`&&(this.qDraft=null),this.store.selectRun(e.run);let r=n?.page===`trends`&&JSON.stringify(Tm(n))===JSON.stringify(Tm(e));e.page===`trends`?r||this.store.loadTrends(Tm(e)):this.store.closeTrends(),this.pickDefaultRun(),t!==`replace`&&(this.pendingScroll=t)}pickDefaultRun(){let{info:e,runs:t}=this.snap;if(this.viewRoute.page===`trends`)return;if(this.viewRoute.page===`hosts`){if(!e.api_version||e.hosts)return;this.navigate({page:``},{replace:!0})}let n=t[0];!this.viewRoute.run&&n&&this.navigate({run:n.run},{replace:!0})}onKey(e){if(e.key===`r`)e.preventDefault(),this.pickerOpen=!0;else if(e.key===`/`)e.preventDefault(),this.renderRoot.querySelector(`.bar input`)?.focus();else if(/^[1-9]$/.test(e.key)&&!this.viewRoute.page){let t=Ll(this.snap.info.panels)[Number(e.key)-1];t&&this.navigate({tab:t.id})}}selectedTab(){return Ll(this.snap.info.panels).findIndex(e=>e.id===this.viewRoute.tab)}closePicker(){let e=this.picker?.matches(`:focus-within`);this.pickerOpen=!1,e&&this.runBtn?.focus()}updated(){this.history===`url`&&this.snap&&(document.title=O(D`${this.snap.info.title} monitor`)),this.listenOutside(this.isConnected&&this.pickerOpen),this.observeNav(),this.snap&&this.viewRoute&&this.tabFocus.set(Math.max(0,this.selectedTab())),zl(this.renderRoot),this.main&&this.mainScroll.attach(this.main),this.pendingScroll&&=(this.pendingScroll===`push`?this.mainScroll.reset():this.mainScroll.restore(),null),this.snap&&this.viewRoute&&this.mainScroll.update(this.complete())}complete(){let{snap:e,viewRoute:t}=this;return t.page===`hosts`?e.hosts!==null:t.page===`trends`?!!e.trends?.data&&!e.trends.loading:e.run===t.run&&e.state.ready}observeNav(){let e=this.renderRoot.querySelector(`nav`);e&&typeof ResizeObserver<`u`&&this.navObserved!==e&&(this.navObserver?this.navObserver.disconnect():this.navObserver=new ResizeObserver(()=>zl(this.renderRoot)),this.navObserver.observe(e),this.navObserved=e)}setQ(e){this.qDraft=e,this.qTimer&&clearTimeout(this.qTimer),this.qTimer=setTimeout(()=>{this.qTimer=null,this.navigate({q:e})},250)}pickLocale(e){this.locale=e,Mn(e)}render(){if(!this.snap||!this.viewRoute)return N;let{snap:e,viewRoute:t}=this,n=ue(e.state.procs),r=S(e.state.journal,e.state.plan),i=this.selectedTab(),a=this.shortcutScope!==`off`,o=!!e.info.hosts,s=t.page===`hosts`,c=t.page===`trends`;return j`
|
|
987
987
|
<header>
|
|
988
|
-
${u=e.info.title,
|
|
988
|
+
${u=e.info.title,j`<div class="brand">
|
|
989
989
|
<svg viewBox="12 12 96 96" aria-hidden="true">
|
|
990
990
|
<defs>
|
|
991
991
|
<linearGradient id="brand-spark" x1="0" y1="0" x2="1" y2="1">
|
|
@@ -1003,43 +1003,43 @@ ${u=e.info.title,k`<div class="brand">
|
|
|
1003
1003
|
</svg>
|
|
1004
1004
|
<span title=${u}>${u}</span>
|
|
1005
1005
|
</div>`}
|
|
1006
|
-
<button type="button" class="runbtn" title=${
|
|
1006
|
+
<button type="button" class="runbtn" title=${O(a?`Switch run (r)`:`Switch run`)} aria-haspopup="dialog" aria-expanded=${this.pickerOpen?`true`:`false`} @click=${()=>this.pickerOpen=!this.pickerOpen}>
|
|
1007
1007
|
${s?this.hostsLabel():c?this.trendsLabel():this.runLabel(o,r)}
|
|
1008
1008
|
<span class="chev" aria-hidden="true">▾</span>
|
|
1009
1009
|
</button>
|
|
1010
1010
|
<div class="hdr-right">
|
|
1011
|
-
${((e,t)=>
|
|
1011
|
+
${((e,t)=>j`<span class="nowline">${t.length?O(j`Running ${t.slice(0,3).map(t=>Vl(e,X(t),{key:t.key}))}${t.length>3?j` <span>+${t.length-3}</span>`:N}`):N}</span>`)(this,n)}
|
|
1012
1012
|
<ca-theme-switch .value=${this.themes.choice} .system=${this.themes.system}></ca-theme-switch>
|
|
1013
|
-
${this.locales?
|
|
1014
|
-
${e.info.export?Xr({text:
|
|
1013
|
+
${this.locales?j`<cae-segmented class="langs" label=${O(`Language`)} .value=${R()} .options=${wn.map(e=>({value:e,label:Tn[e],lang:e}))} @cae-change=${e=>An(e.detail.value)&&this.pickLocale(e.detail.value)}></cae-segmented>`:N}
|
|
1014
|
+
${e.info.export?Xr({text:Ic(e.info.export),tone:`muted`,title:Rc(e.info.export)}):(e=>{let t=O(e?`Connected to the monitor server`:`Not connected to the monitor server`);return j`<span role="img" aria-label=${t} title=${t}><span class="live-dot ${e?``:`off`}"></span></span>`})(e.connected)}
|
|
1015
1015
|
<ca-clock class="clock"></ca-clock>
|
|
1016
1016
|
</div>
|
|
1017
1017
|
<ca-run-picker .runs=${e.runs} current=${t.run} ?open=${this.pickerOpen} ?hub=${o} .hosts=${e.hosts?.hosts??[]} page=${t.page} @ca-close=${()=>this.closePicker()}></ca-run-picker>
|
|
1018
1018
|
</header>
|
|
1019
|
-
${s?
|
|
1020
|
-
<main id="main" class=${t.tab===`stream`?`stream`:``} role="tabpanel" aria-labelledby=${i>=0?
|
|
1019
|
+
${s?j`${this.renderApiError()}<main id="main"><ca-hosts .hosts=${e.hosts}></ca-hosts></main>`:c?j`${this.renderApiError()}<main id="main"><ca-trends .view=${e.trends} days=${t.days} from=${t.from} to=${t.to} tz=${t.tz||Cm()} group=${t.group} .groups=${l=e.runs,[...new Set(l.map(e=>e.run_group).filter(e=>!!e))]} .panels=${e.info.panels} tab=${t.trendsTab} ?exported=${!!e.info.export}></ca-trends></main>`:j`${this.renderTabs(r,n.length)} ${this.renderBar(r)} ${this.renderApiError()}
|
|
1020
|
+
<main id="main" class=${t.tab===`stream`?`stream`:``} role="tabpanel" aria-labelledby=${i>=0?Rl(i):N} >${function({snap:e,viewRoute:t,derived:n,q:r,client:i,baseUrl:a}){let{state:o}=e;if(!t.run)return j`<div class="blank">${e.runsLoaded&&!e.error?j`<span class="ic" aria-hidden="true">✦</span><b>${O(`No runs yet`,{id:`no-runs-yet`})}</b>`:N}</div>`;let s=ce(e.runs,e.run),c=le(o,s);switch(t.tab){case`overview`:return j`<ca-overview .state=${o} .summary=${s} .host=${te(e.hosts?.hosts,s)} .info=${e.info} .run=${t.run} .layer=${t.layer} .unit=${t.unit} .sel=${t.sel}></ca-overview>`;case`tasks`:return j`<ca-task-table .run=${t.run} .journal=${o.journal} .plan=${o.plan} .kind=${t.kind} .q=${r} ?live=${c}></ca-task-table>`;case`journal`:return j`<ca-journal-table .run=${t.run} .rows=${o.journal} .plan=${o.plan} .fresh=${e.fresh} .kind=${t.kind} .stop=${t.stop} .q=${r} .extras=${s?.row_extras??[]} ?replay-marks=${fc(s)}></ca-journal-table>`;case`outputs`:return j`<ca-contracts .run=${t.run} .outputs=${o.outputs} .journal=${o.journal} .plan=${o.plan}></ca-contracts>`;case`definitions`:return j`<ca-definitions .client=${i} .run=${t.run} .journal=${o.journal} .plan=${o.plan} .live=${c} .selected=${t.def}></ca-definitions>`;case`procs`:return j`<ca-procs-view .procs=${o.procs} ?unresponsive=${w(s,!!o.procs?.alive)===`unresponsive`} ?exported=${!!e.info.export}></ca-procs-view>`;case`stream`:return j`<ca-task-view .client=${i} .journal=${o.journal} .plan=${o.plan} base-url=${a} .run=${t.run} .taskKey=${t.key??function(e){let t=e.filter(e=>e.executor!==`python`),n=t.find(e=>e.outcome===`running`);if(n)return n.key;let r=e=>e.tries[e.tries.length-1]?.ts??``;return t.filter(r).sort((e,t)=>r(t).localeCompare(r(e)))[0]?.key??null}(n.rows)} .view=${t.view} .round=${t.round} .live=${c} ?exported=${!!e.info.export} ?replay-marks=${fc(s)}></ca-task-view>`;default:{let n=t.tab.slice(6);return j`<ca-panel-view .name=${n} .panel=${e.info.panels.find(e=>e.name===n)} .data=${o.panels[n]} base-url=${a}></ca-panel-view>`}}}({snap:e,viewRoute:t,derived:r,q:this.qDraft??t.q,client:this.store.client,baseUrl:this.store.client.baseUrl})}</main>`}
|
|
1021
1021
|
<ca-toasts></ca-toasts>
|
|
1022
|
-
`;var l,u}runLabel(e,t){let{snap:n,viewRoute:r}=this,i=
|
|
1023
|
-
<span class="rn" title=${s?r.run:
|
|
1024
|
-
${s?
|
|
1025
|
-
${a===`unresponsive`?Xr({text:
|
|
1026
|
-
${
|
|
1027
|
-
<span class="rs" title=${i?
|
|
1028
|
-
<span class="rn">${
|
|
1029
|
-
<div class="tabs" role="tablist" aria-label=${
|
|
1030
|
-
${e.map((a,o)=>{let s=n(a.id),c=a.id===t;return
|
|
1031
|
-
<button type="button" role="tab" id=${
|
|
1032
|
-
<span class="tab-ic" aria-hidden="true">${a.icon}</span><span class="tab-label" data-label=${a.label}>${a.label}</span>${s&&s[0]!==``?
|
|
1022
|
+
`;var l,u}runLabel(e,t){let{snap:n,viewRoute:r}=this,i=ce(n.runs,n.run),a=w(i,!!n.state.procs?.alive),o=hs(a,i?.tasks),s=e?i?.host_id??``:``;return j`<span class="dot" data-tone=${z(o)} aria-hidden="true"></span>
|
|
1023
|
+
<span class="rn" title=${s?r.run:N}>${i&&s?ne(i):r.run||`—`}</span>
|
|
1024
|
+
${s?j`<span class="hostchip" title=${yc(s)}><span class="sr">${yc(s)}</span><span aria-hidden="true">${s}</span></span>`:N}
|
|
1025
|
+
${a===`unresponsive`?Xr({text:gc(),tone:`attention`,title:vc(te(n.hosts?.hosts,i))}):N}
|
|
1026
|
+
${hc(i)?Xr({...hc(i),tone:`muted`}):N}
|
|
1027
|
+
<span class="rs" title=${i?Ws(uc(n.state,i)):``}>${i?function(e,t,n=S(e.journal,e.plan)){let r=C(t),i=e.ready?we(e.journal)?.cost:t.cost_usd,a=i==null?``:cs(i),o=Us(uc(e,t)),s=J(r==null?``:O(D`took ${H(r)}`),a,o,t.running?O(`running`):``);if(!e.ready)return s;let c=n.counts,l=t.tasks.not_run?Q(`not_run`,t.tasks.not_run):``;return J(O(D`${c.doneTotal} of ${c.total} tasks done`),l,s)}(n.state,i,t):``}</span>`}trendsLabel(){return j`<span class="dot" data-tone="neutral" aria-hidden="true"></span><span class="rn" title=${Vc()}>${Bc()}</span>`}hostsLabel(){let e=this.snap.hosts?.hosts??[];return j`<span class="dot" data-tone=${z(e.some(e=>!e.up)?`attention`:`neutral`)} aria-hidden="true"></span>
|
|
1028
|
+
<span class="rn">${O(`Hosts`)}</span><span class="rs">${xc(e)}</span>`}renderApiError(){let{error:e}=this.snap;return j`<p class="api-error" role="alert">${e?j`<span class="ic" aria-hidden="true">✕</span> ${Ml(e)}`:N}</p>`}renderTabs(e,t){let{state:n}=this.snap,{tries:r}=e.tries,i=e.counts;return function(e,t,n,r,i,a=!0){return j`<nav data-scroll="x">
|
|
1029
|
+
<div class="tabs" role="tablist" aria-label=${O(`Views`)}>
|
|
1030
|
+
${e.map((a,o)=>{let s=n(a.id),c=a.id===t;return j`${a.panel&&!e[o-1]?.panel?j`<span class="tab-sep" aria-hidden="true" title=${O(`Custom views`)}></span>`:N}
|
|
1031
|
+
<button type="button" role="tab" id=${Rl(o)} aria-selected=${c?`true`:`false`} aria-controls=${i} class="tab ${a.panel?`panel-tab`:``} ${c?`sel`:``}" title=${a.tip??N} @click=${()=>r(a.id)}>
|
|
1032
|
+
<span class="tab-ic" aria-hidden="true">${a.icon}</span><span class="tab-label" data-label=${a.label}>${a.label}</span>${s&&s[0]!==``?j`<span class="badge" data-tone=${z(s[1])}>${s[0]}</span>`:N}
|
|
1033
1033
|
</button>`})}
|
|
1034
1034
|
</div>
|
|
1035
1035
|
<span class="tab-ind init" aria-hidden="true"></span>
|
|
1036
|
-
${a?
|
|
1037
|
-
<span class="kbd">r</span> ${
|
|
1038
|
-
</nav>`}(
|
|
1039
|
-
<select title=${
|
|
1040
|
-
<option value="" ?selected=${!t.kind}>${
|
|
1041
|
-
${n.map(e=>
|
|
1036
|
+
${a?j`<span class="tabhint meta" role="note" aria-label=${O(`Keyboard shortcuts`)} ><span aria-hidden="true"><span class="kbd">1</span>–<span class="kbd">${Math.min(9,e.length)}</span> ${O(`Tabs`)} |
|
|
1037
|
+
<span class="kbd">r</span> ${O(`Runs`)} | <span class="kbd">/</span> ${O(`Filter`)}</span></span >`:N}
|
|
1038
|
+
</nav>`}(Ll(this.snap.info.panels),this.viewRoute.tab,e=>e===`tasks`?[i.total||``,`neutral`]:e===`journal`?[r||``,`neutral`]:e===`procs`?[n.procs?.alive&&t||``,`running`]:null,e=>this.navigate({tab:e}),`main`,this.shortcutScope!==`off`)}renderBar(e){let{viewRoute:t}=this;if(t.tab!==`tasks`&&t.tab!==`journal`)return N;let{kinds:n}=e;return j`<div class="bar">
|
|
1039
|
+
<select title=${O(`Kind`)} aria-label=${O(`Kind`)} @change=${e=>this.navigate({kind:e.target.value})}>
|
|
1040
|
+
<option value="" ?selected=${!t.kind}>${O(`All kinds`)}</option>
|
|
1041
|
+
${n.map(e=>j`<option ?selected=${e===t.kind}>${e}</option>`)}
|
|
1042
1042
|
</select>
|
|
1043
|
-
<input placeholder=${
|
|
1043
|
+
<input placeholder=${O(`Filter`)} aria-label=${O(`Text filter`)} size="22" title=${this.shortcutScope===`off`?O(`Text filter`):O(`Text filter (/)`)} .value=${this.qDraft??t.q} @input=${e=>this.setQ(e.target.value)} />
|
|
1044
1044
|
<span class="meta" aria-live="polite">${this.shownLine(e)}</span>
|
|
1045
|
-
</div>`}shownLine(e){let{viewRoute:t}=this,n=this.qDraft??t.q;return t.tab===`journal`?t.kind||n||t.stop?(r=ee(
|
|
1045
|
+
</div>`}shownLine(e){let{viewRoute:t}=this,n=this.qDraft??t.q;return t.tab===`journal`?t.kind||n||t.stop?(r=ee(kl(this.snap.state.journal,t.kind,t.stop,n)),i=e.tries.tries,J(O(D`${r.tries} of ${i} attempts`),r.notStarted?Q(`not_started`,r.notStarted):``)):``:t.kind||n?((e,t)=>O(D`${e} of ${t} tasks`))(xl(e.rows,t.kind,n).length,e.counts.total):``;var r,i}};G([I({attribute:`base-url`})],Om.prototype,`baseUrl`,void 0),G([I({attribute:`export`})],Om.prototype,`exportUrl`,void 0),G([I()],Om.prototype,`history`,void 0),G([I()],Om.prototype,`shortcuts`,void 0),G([I()],Om.prototype,`run`,void 0),G([I()],Om.prototype,`locale`,void 0),G([I()],Om.prototype,`theme`,void 0),G([I({type:Boolean,reflect:!0})],Om.prototype,`live`,void 0),G([L()],Om.prototype,`snap`,void 0),G([L()],Om.prototype,`viewRoute`,void 0),G([L()],Om.prototype,`pickerOpen`,void 0),G([L()],Om.prototype,`qDraft`,void 0),G([vn(`main`)],Om.prototype,`main`,void 0),G([vn(`ca-toasts`)],Om.prototype,`toasts`,void 0),G([vn(`.runbtn`)],Om.prototype,`runBtn`,void 0),G([vn(`ca-run-picker`)],Om.prototype,`picker`,void 0),Om=G([F(`ca-monitor`),k()],Om);export{Zn as BUILTIN_TABS,mm as CaClock,rp as CaContracts,sp as CaDefinition,cp as CaDefinitions,gm as CaHosts,Zf as CaJournalTable,gu as CaKpis,Eu as CaModelUsage,Om as CaMonitor,Vf as CaOverview,_p as CaPanelBody,vp as CaPanelView,Tf as CaPipelineGraph,ou as CaProcTree,lp as CaProcsView,Du as CaQuota,kf as CaRunDriver,vm as CaRunPicker,ku as CaServices,vu as CaSpendBreakdown,Gf as CaTaskTable,fm as CaTaskView,If as CaTimeline,Fl as CaToasts,Yp as CaTranscript,Lf as CaWorkers,er as DEFAULT_VIEW_ROUTE,Tn as LOCALE_NAMES,Au as LOOP_SEGMENT,bu as OTHER_COLOUR,yu as SERIES_COLOURS,Qn as TASK_VIEWS,Af as TIMELINE_WINDOW_MS,$n as TREND_DAYS,sr as ViewRouter,Op as agentLabel,wn as allLocales,ar as applyPatch,Kp as applyTranscriptEvents,jl as attemptFacts,nf as autoLayer,yf as budgetFor,wp as checkMessage,Cp as checkName,Jl as checkRowsFromContract,Yl as checkTableStrings,Mn as chooseLocale,vd as chooseOpen,Sp as classifyRounds,bd as compound,Dn as configureLocales,ql as contentObject,Dl as correctionCount,_d as doi,$ as emit,zp as emptyTranscript,Ar as esc,Td as expectedByNode,as as factList,J as facts,kl as filterJournal,xl as filterTasks,ss as firstLine,bp as fixupErrors,H as fmtDur,Dd as forecastShown,ir as formatViewRoute,R as getLocale,Qd as graphFromPlan,Zd as graphInput,Ol as hadFixup,hd as interest,xp as isFixup,or as isNewPlace,Yf as journalColumns,Al as journalTally,X as kindUnit,cu as kpiAction,mu as kpiTiles,su as kpis,Mf as laneStyles,Ff as lanesFromJournal,Ap as launchWho,tf as layerGraph,Y as listText,q as localTime,Ad as markSel,ef as matrixFromPlan,$d as matrixInput,Su as modelColours,xu as modelId,wu as modelRows,Ed as notInPlan,gd as notable,of as parentLayer,jd as parseSelection,rr as parseViewRoute,Od as passMatrix,dd as placeKey,md as placeStats,jn as preferredLocale,Df as preflightRows,rs as relAgo,af as resolveLayer,El as retriedKeys,Gl as rootOf,Kl as rowOf,Nl as rowToast,is as sentence,On as setLocale,Cu as shareParts,Jf as sharedIdentity,Kf as shortStop,kd as sortPassRows,wl as sortTasks,bf as spanFor,rf as splitLayer,Uf as taskColumns,ep as taskName,Pd as taskStateStyles,Z as tokenCount,xf as tooWide,yd as towardOf,Pp as transcriptSections,Sm as trendSections,Wl as typeOk,ds as unreadEvents,ls as usageUnknown,us as usageUnknownWords,cs as usd,Rp as webResults,jp as whoTags};
|