okengine 0.15.2 → 0.16.0
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/package.json +1 -1
- package/site/content/docs/elements/flow.mdx +6 -0
- package/site/content/docs/elements/gate.mdx +55 -0
- package/site/content/docs/elements/store.mdx +13 -15
- package/site/content/docs/elements/vault.mdx +3 -0
- package/site/content/docs/reference/client.mdx +3 -0
- package/site/content/docs/reference/fx.mdx +29 -18
- package/site/content/docs/reference/security.md +1 -1
- package/src/auth/api-key-sql.test.ts +47 -0
- package/src/auth/api-key-sql.ts +254 -0
- package/src/auth/api-keys.ts +273 -14
- package/src/auth/auth.test.ts +56 -0
- package/src/auth/config.ts +5 -5
- package/src/auth/index.ts +25 -1
- package/src/auth/schema.ts +8 -0
- package/src/cli/attach-host-console.test.ts +37 -0
- package/src/cli/attach-host-console.ts +6 -0
- package/src/compiler/effects-infer.ts +17 -2
- package/src/console/server/access.test.ts +116 -8
- package/src/console/server/access.ts +70 -23
- package/src/console/server/app.ts +1 -0
- package/src/console/server/dev-identities.test.ts +127 -0
- package/src/console/server/dev-identities.ts +229 -0
- package/src/console/server/flows-invoke.test.ts +21 -4
- package/src/console/server/flows.ts +113 -58
- package/src/console/server/gates.test.ts +24 -0
- package/src/console/server/gates.ts +8 -21
- package/src/console/server/index.ts +1 -0
- package/src/console/server/live.test.ts +26 -1
- package/src/console/server/live.ts +4 -2
- package/src/console/server/operator-db.ts +2 -0
- package/src/console/server/state.ts +29 -55
- package/src/console/ui-next/dist/assets/access-page-CAGHrA9H.js +4 -0
- package/src/console/ui-next/dist/assets/{agent-disclosure-C0X1fbWF.js → agent-disclosure-BP0Y0Sux.js} +1 -1
- package/src/console/ui-next/dist/assets/cache-glyph-B5X-NM0-.js +1 -0
- package/src/console/ui-next/dist/assets/call-pii-button-ChAUiLo9.js +1 -0
- package/src/console/ui-next/dist/assets/collapsible-DGnOM2ph.js +1 -0
- package/src/console/ui-next/dist/assets/copy-inline-button-DBHhgHKP.js +1 -0
- package/src/console/ui-next/dist/assets/detail-header-DhHM1iaZ.js +1 -0
- package/src/console/ui-next/dist/assets/dropdown-menu-_NjTEo5_.js +1 -0
- package/src/console/ui-next/dist/assets/element-icons-BVXtRyd3.js +1 -0
- package/src/console/ui-next/dist/assets/explorer-empty-2uIhBu0_.js +1 -0
- package/src/console/ui-next/dist/assets/flows-page-B-OUtiAu.js +1 -0
- package/src/console/ui-next/dist/assets/{highlighted-json-CS_O8L-r.js → highlighted-json-Awq7gYdu.js} +1 -1
- package/src/console/ui-next/dist/assets/http-method-_UHM2ODJ.js +1 -0
- package/src/console/ui-next/dist/assets/index-CGoZkILK.js +66 -0
- package/src/console/ui-next/dist/assets/index-Ck88Jmv8.css +2 -0
- package/src/console/ui-next/dist/assets/link-BX6Vqztd.js +1 -0
- package/src/console/ui-next/dist/assets/observability-page-BDyXalNR.js +4 -0
- package/src/console/ui-next/dist/assets/replica-lag-DKRrbvdo.js +18 -0
- package/src/console/ui-next/dist/assets/request-meta-DV0ywz7t.js +1 -0
- package/src/console/ui-next/dist/assets/shortcut-JQIZlWfm.js +1 -0
- package/src/console/ui-next/dist/assets/shortcut-keys-DKxNTe_m.js +1 -0
- package/src/console/ui-next/dist/assets/skeleton-D-czQJT6.js +1 -0
- package/src/console/ui-next/dist/assets/store-page-Xh8Kn3rx.js +41 -0
- package/src/console/ui-next/dist/assets/trace-detail-sheet-B09O8rA6.js +2 -0
- package/src/console/ui-next/dist/assets/tree-expand-toggle-DkOXA12R.js +54 -0
- package/src/console/ui-next/dist/assets/units-page-Dpk40kOQ.js +1 -0
- package/src/console/ui-next/dist/assets/{use-vault-list-BLbZhzyF.js → use-vault-list-uk4WVboC.js} +1 -1
- package/src/console/ui-next/dist/assets/useMutation-B8EO02Ej.js +1 -0
- package/src/console/ui-next/dist/assets/useRender-BE2A9BWC.js +1 -0
- package/src/console/ui-next/dist/assets/vault-page-B1dB9Ft0.js +2 -0
- package/src/console/ui-next/dist/index.html +11 -9
- package/src/console/ui-next/index.html +3 -3
- package/src/console/ui-next/src/client.ts +167 -0
- package/src/console/ui-next/src/components/shell/app-sidebar.tsx +2 -0
- package/src/console/ui-next/src/components/shell/command-items.test.ts +1 -0
- package/src/console/ui-next/src/components/shell/command-items.ts +8 -0
- package/src/console/ui-next/src/components/shell/shell-layout.tsx +2 -1
- package/src/console/ui-next/src/components/ui/sheet-form.tsx +8 -3
- package/src/console/ui-next/src/features/access/access-page.tsx +347 -0
- package/src/console/ui-next/src/features/access/data/use-access.ts +23 -0
- package/src/console/ui-next/src/features/access/detail/access-detail.tsx +552 -0
- package/src/console/ui-next/src/features/access/explorer/access-list.tsx +125 -0
- package/src/console/ui-next/src/features/access/lib/format-when.test.ts +139 -0
- package/src/console/ui-next/src/features/access/lib/format-when.ts +296 -0
- package/src/console/ui-next/src/features/access/lib/scope-groups.test.ts +34 -0
- package/src/console/ui-next/src/features/access/lib/scope-groups.ts +40 -0
- package/src/console/ui-next/src/features/access/sheets/access-allow-fields.tsx +236 -0
- package/src/console/ui-next/src/features/access/sheets/access-create-sheet.tsx +316 -0
- package/src/console/ui-next/src/features/access/sheets/access-edit-sheet.tsx +240 -0
- package/src/console/ui-next/src/features/access/sheets/access-expiry-fields.tsx +66 -0
- package/src/console/ui-next/src/features/access/sheets/access-refresh-sheet.tsx +104 -0
- package/src/console/ui-next/src/features/access/sheets/access-scope-field.tsx +115 -0
- package/src/console/ui-next/src/features/access/sheets/access-secret-sheet.tsx +89 -0
- package/src/console/ui-next/src/features/access/sheets/access-sheet-search.tsx +49 -0
- package/src/console/ui-next/src/features/access/state/access-selection.ts +84 -0
- package/src/console/ui-next/src/features/auth/auth-redirect.test.ts +5 -0
- package/src/console/ui-next/src/features/auth/auth-redirect.ts +18 -2
- package/src/console/ui-next/src/features/not-found/not-found-page.tsx +1 -1
- package/src/console/ui-next/src/lib/document-meta.test.ts +1 -0
- package/src/console/ui-next/src/lib/document-meta.ts +2 -1
- package/src/console/ui-next/src/lib/last-module-search.test.ts +1 -0
- package/src/console/ui-next/src/lib/last-module-search.ts +2 -1
- package/src/console/ui-next/src/lib/shortcut.test.ts +2 -0
- package/src/console/ui-next/src/lib/shortcut.ts +3 -0
- package/src/console/ui-next/src/router.tsx +10 -1
- package/src/console/ui-next/ui-next-seed-app-schema.ts +88 -37
- package/src/console/ui-next/ui-next-seed-store.ts +43 -15
- package/src/console/xss.gate.test.ts +1 -0
- package/src/elements/gate/declare.ts +2 -0
- package/src/elements/store/cache.ts +1 -1
- package/src/elements/store/runtime.ts +14 -0
- package/src/elements/store/schema-decl.ts +99 -41
- package/src/elements/store/sql-select.types.test.ts +71 -0
- package/src/elements/store/sql-session.ts +54 -32
- package/src/elements/store.ts +3 -0
- package/src/index.ts +1 -0
- package/src/kernel/api-key-host-persist.test.ts +143 -0
- package/src/kernel/app.ts +14 -2
- package/src/kernel/auth-resolve.ts +10 -5
- package/src/kernel/boot.test.ts +4 -4
- package/src/kernel/fx-auth-keys.test.ts +88 -0
- package/src/kernel/fx-auth-keys.ts +198 -0
- package/src/kernel/fx.test.ts +17 -1
- package/src/kernel/fx.ts +36 -18
- package/src/kernel/pipeline-api-key.test.ts +192 -7
- package/src/kernel/pipeline.ts +4 -2
- package/src/manifest/types.ts +9 -3
- package/src/release/build-lib.ts +1 -0
- package/src/console/ui-next/dist/assets/cache-glyph-F1FI122b.js +0 -1
- package/src/console/ui-next/dist/assets/call-pii-button-DEDCl_j3.js +0 -1
- package/src/console/ui-next/dist/assets/collapsible-LPqGvfoz.js +0 -1
- package/src/console/ui-next/dist/assets/confirm-sheet-3ptDzXbz.js +0 -1
- package/src/console/ui-next/dist/assets/explorer-empty-BvYrygyO.js +0 -1
- package/src/console/ui-next/dist/assets/flows-page-Dluo1Bd7.js +0 -1
- package/src/console/ui-next/dist/assets/http-method--sWDdXSB.js +0 -1
- package/src/console/ui-next/dist/assets/index-Ca3HZMVq.js +0 -66
- package/src/console/ui-next/dist/assets/index-UtTDRQpS.css +0 -2
- package/src/console/ui-next/dist/assets/link-COeyggt-.js +0 -1
- package/src/console/ui-next/dist/assets/observability-page-HK9-BO8z.js +0 -4
- package/src/console/ui-next/dist/assets/replica-lag-DBIFFf7d.js +0 -18
- package/src/console/ui-next/dist/assets/sheet-form-Dnwa5oOR.js +0 -1
- package/src/console/ui-next/dist/assets/shortcut-Cgzuv4k1.js +0 -1
- package/src/console/ui-next/dist/assets/shortcut-keys-CoqwEIi0.js +0 -1
- package/src/console/ui-next/dist/assets/skeleton-BHcfDYcb.js +0 -1
- package/src/console/ui-next/dist/assets/store-page-BSohH3wM.js +0 -41
- package/src/console/ui-next/dist/assets/trace-detail-sheet-CFIGRnnA.js +0 -2
- package/src/console/ui-next/dist/assets/tree-expand-toggle-BgLl34w7.js +0 -54
- package/src/console/ui-next/dist/assets/units-page-B0cFE76A.js +0 -1
- package/src/console/ui-next/dist/assets/vault-page-B1SbYe10.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Br as t,Cr as n,E as r,F as i,Fo as a,Jr as o,L as s,Mi as c,P as l,_r as u,ar as d,br as f,cr as p,gr as m,hr as h,kr as g,li as _,mr as v,vr as y,wr as b,x}from"./shortcut-keys-DKxNTe_m.js";import{r as S}from"./react-dom-Bph1y7z7.js";import{A as C,a as w,c as T,d as E,o as D,p as O,r as k,s as A,t as ee}from"./xyflow-D7n4g6go.js";import{n as j,t as te}from"./react-D8E3mtu1.js";import{t as ne}from"./duration-tone-sC3lGABz.js";import{a as re,i as ie,n as ae,o as oe,r as se,t as ce}from"./trace-detail-sheet-B09O8rA6.js";import{r as le}from"./preload-helper-oH4irX4C.js";import{d as ue,t as de}from"./index-CGoZkILK.js";import{a as fe,c as pe,d as me,f as he,i as ge,l as _e,n as ve,o as ye,p as be,r as xe,t as M,u as Se}from"./element-icons-BVXtRyd3.js";import{a as Ce,c as we,i as Te,l as Ee,o as De,s as Oe}from"./highlighted-json-Awq7gYdu.js";import{C as N,S as ke,_ as P,b as Ae,d as je,f as Me,g as F,h as I,p as Ne,v as L,y as R}from"./request-meta-DV0ywz7t.js";import{a as Pe,c as z,i as Fe,n as Ie,o as Le,r as Re,t as ze}from"./cache-glyph-B5X-NM0-.js";import{t as Be}from"./agent-disclosure-BP0Y0Sux.js";var B=e(S(),1),V=[`flow`,`signal`,`store`,`clock`,`gate`,`vault`,`channel`,`ai`];function H(e,t,n){return{x:P.cx+t*Math.cos(e)-n.width/2,y:P.cy+t*Math.sin(e)-n.height/2}}function Ve(e){if(e<=0)return[];let t=2*Math.PI/e;return Array.from({length:e},(e,n)=>-Math.PI/2+n*t)}var He=2*Math.PI/V.length;function Ue(e,t,n=P.typeRing){if(t<=0)return[];if(t===1)return[e];let r=(L.type.width+10)/n,i=Math.min(r*(t-1),He*.7);return Array.from({length:t},(n,r)=>e-i/2+r/(t-1)*i)}function We(e,t){if(t<=0)return[];let n=P.typeRing,r=P.typeRing+P.typeRow;if(t===1)return[{angle:e,radius:n}];if(t===4)return Ke(e,n,r);if(t<=3)return Ue(e,t,n).map(e=>({angle:e,radius:n}));let i=Math.ceil(t/2),a=t-i;return[...Ue(e,i,n).map(e=>({angle:e,radius:n})),...Ue(e,a,r).map(e=>({angle:e,radius:r}))]}function Ge(e){return Math.abs(Math.cos(e))*L.type.height+Math.abs(Math.sin(e))*L.type.width}function Ke(e,t,n){let r=(Ge(e)+24)/t;return[{angle:e-r/2,radius:t},{angle:e+r/2,radius:t},{angle:e-r/2,radius:n},{angle:e+r/2,radius:n}]}function qe(e){let t=new Set([`flow`]),n=e.trigger;(n?.cron||n?.every)&&t.add(`clock`),n?.signal&&t.add(`signal`),(e.gates?.length??0)>0&&t.add(`gate`);let r=e.effects;return((r?.reads?.length??0)>0||(r?.writes?.length??0)>0)&&t.add(`store`),(r?.emits?.length??0)>0&&t.add(`signal`),(r?.sends?.length??0)>0&&t.add(`channel`),(r?.asks?.length??0)>0&&t.add(`ai`),(r?.secrets?.length??0)>0&&t.add(`vault`),V.filter(e=>t.has(e))}function Je(e){let t=new Set([`flow`]);(e.trigger===`cron`||e.trigger===`every`)&&t.add(`clock`),e.trigger===`signal`&&t.add(`signal`),e.gates.length>0&&t.add(`gate`);for(let n of e.effects)switch(n.kind){case`read`:case`write`:t.add(`store`);break;case`emit`:t.add(`signal`);break;case`send`:t.add(`channel`);break;case`ask`:t.add(`ai`);break;case`secret`:t.add(`vault`)}return V.filter(e=>t.has(e))}function Ye(e,t){let n=new Map,r=(e,t,r)=>{n.has(e)||n.set(e,r===void 0?{id:e,label:t}:{id:e,label:t,badge:r})};switch(t){case`flow`:for(let t of Object.keys(e.flows??{}).sort())r(`flow:${t}`,Re(t),z(t));break;case`signal`:for(let t of Object.keys(e.signals??{}).sort())r(`signal:${t}`,t,`signal`);for(let t of Object.values(e.flows??{})){t.trigger?.signal&&r(`signal:${t.trigger.signal}`,t.trigger.signal,`signal`);for(let e of t.effects?.emits??[])r(`signal:${e}`,e,`signal`)}break;case`store`:for(let[t,n]of Object.entries(e.stores??{})){let e=n.facet;for(let t of Object.keys(n.tables??{}).sort())r(`${e}:${t}`,t,e);let i=n.namespaces&&n.namespaces.length>0?n.namespaces:[];e===`kv`&&i.length===0&&r(`kv:${t}`,t,`kv`);for(let e of[...i].sort())r(`kv:${e}`,e,`kv`);for(let e of[...n.buckets??[]].sort())r(`files:${e}`,e,`files`);for(let e of[...n.indexes??[]].sort())r(`index:${e}`,e,`index`)}for(let t of Object.values(e.flows??{}))for(let e of[...t.effects?.reads??[],...t.effects?.writes??[]]){let t=Xe(e);t&&r(t.id,t.label,t.badge)}break;case`clock`:for(let[t,n]of Object.entries(e.clocks??{}).sort(([e],[t])=>e.localeCompare(t)))r(`clock:${t}`,t,n.cron?`cron`:n.every?`every`:`clock`);for(let[t,n]of Object.entries(e.flows??{}))n.trigger?.cron&&r(`clock:${t}`,n.trigger.cron,`cron`),n.trigger?.every&&r(`clock:${t}`,n.trigger.every,`every`);break;case`gate`:for(let t of Object.keys(e.gates??{}).sort())r(`gate:${t}`,t,`gate`);for(let t of Object.values(e.flows??{}))for(let e of t.gates??[])r(`gate:${e}`,e,`gate`);break;case`vault`:for(let t of Object.keys(e.vault??{}).sort())r(`vault:${t}`,t,`vault`);for(let t of Object.values(e.flows??{}))for(let e of t.effects?.secrets??[])r(`vault:${e}`,e,`vault`);break;case`channel`:for(let t of Object.keys(e.channels??{}).sort())r(`channel:${t}`,t,`channel`);for(let t of Object.values(e.flows??{}))for(let e of t.effects?.sends??[])r(`channel:${e}`,e,`channel`);break;case`ai`:for(let t of Object.keys(e.ai?.prompts??{}).sort())r(`ai:${t}`,t,`prompt`);for(let t of Object.keys(e.ai?.agents??{}).sort())r(`ai:${t}`,t,`agent`);for(let t of Object.values(e.flows??{}))for(let e of t.effects?.asks??[])r(`ai:${e}`,e,`prompt`)}return[...n.values()].sort((e,t)=>e.label.localeCompare(t.label))}function Xe(e){return e.startsWith(`sql:`)?{id:e,label:e.slice(4),badge:`sql`}:e.startsWith(`kv:`)?{id:e,label:e.slice(3),badge:`kv`}:e.startsWith(`files:`)?{id:e,label:e.slice(6),badge:`files`}:e.startsWith(`index:`)?{id:e,label:e.slice(6),badge:`index`}:null}var Ze={flow:je.map(e=>({kind:e,label:Me[e].label})),signal:[{kind:`once`,label:`once`},{kind:`broadcast`,label:`broadcast`},{kind:`live`,label:`live`}],store:[{kind:`sql`,label:`SQL`},{kind:`kv`,label:`KV`},{kind:`files`,label:`Files`},{kind:`index`,label:`Index`}],clock:[{kind:`cron`,label:`cron`},{kind:`every`,label:`every`}],gate:[{kind:`policy`,label:`policy`},{kind:`scope`,label:`scope`},{kind:`rate`,label:`rate`},{kind:`flag`,label:`flag`}],vault:[{kind:`secret`,label:`secret`},{kind:`config`,label:`config`},{kind:`env`,label:`env`}],channel:[{kind:`email`,label:`email`},{kind:`sms`,label:`SMS`},{kind:`whatsapp`,label:`WA`},{kind:`push`,label:`Push`}],ai:[{kind:`model`,label:`model`},{kind:`prompt`,label:`prompt`},{kind:`embed`,label:`embed`},{kind:`agent`,label:`agent`}]};function Qe(e,t){return Ze[t].map(e=>({id:`type:${t}:${e.kind}`,label:e.label,badge:e.kind}))}function $e(e,t){return t?.kind===`rate`||e.startsWith(`rate:`)?`rate`:e.startsWith(`flag:`)?`flag`:(t?.scopes?.length??0)>0?`scope`:`policy`}function et(e){return e?.sensitive===!1?`config`:`secret`}function tt(e,t){let n=t.split(`@`)[0]??t;return e.ai?.agents?.[n]?`agent`:e.ai?.models?.[n]?`model`:`prompt`}function nt(e,t,n){let r=`type:${n}:`;switch(n){case`flow`:return[`${r}${Ne(t.trigger)}`];case`store`:{let e=new Set;for(let n of[...t.effects?.reads??[],...t.effects?.writes??[]]){let t=Xe(n);t?.badge&&e.add(t.badge)}return[...e].map(e=>`${r}${e}`)}case`signal`:{let n=[...t.trigger?.signal?[t.trigger.signal]:[],...t.effects?.emits??[]],i=new Set;for(let t of n){let n=e.signals?.[t]?.delivery;n&&i.add(n)}return[...i].map(e=>`${r}${e}`)}case`clock`:{let e=[];return t.trigger?.cron&&e.push(`${r}cron`),t.trigger?.every&&e.push(`${r}every`),e}case`gate`:return[...new Set((t.gates??[]).map(t=>$e(t,e.gates?.[t])))].map(e=>`${r}${e}`);case`vault`:return[...new Set((t.effects?.secrets??[]).map(t=>et(e.vault?.[t])))].map(e=>`${r}${e}`);case`channel`:{let n=new Set;for(let r of t.effects?.sends??[]){let t=e.channels?.[r]?.medium;t&&t!==`any`&&n.add(t)}return[...n].map(e=>`${r}${e}`)}case`ai`:return[...new Set((t.effects?.asks??[]).map(t=>tt(e,t)))].map(e=>`${r}${e}`)}}function rt(e){let t=e?.flows??{},n=new Map;for(let e of Object.keys(t).sort()){let t=z(e),r=n.get(t)??[];r.push(e),n.set(t,r)}let r=new Map,i=new Map,a=new Map;for(let[e,o]of n){let n=new Set;for(let i of o){let o=t[i];if(o)for(let t of qe(o)){n.add(t);let o=`${e}\0${t}`;r.set(o,(r.get(o)??0)+1);let s=a.get(t)??new Set;s.add(i),a.set(t,s)}}i.set(e,n)}let o=[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({unit:e,flowCount:t.length,elements:V.filter(t=>i.get(e)?.has(t)),live:0,errors:0})),s=V.map(t=>({element:t,resourceCount:e?Ye(e,t).length:0,flowCount:a.get(t)?.size??0,live:0,errors:0})),c=[];for(let e of o)for(let t of e.elements)c.push({unit:e.unit,element:t,flowCount:r.get(`${e.unit}\0${t}`)??0});return{units:o,hubs:s,couplings:c}}function it(e,t){let n=new Map,r=new Map,i=new Map,a=new Map;for(let e of t){let t=e.unit??z(e.flow);n.set(t,(n.get(t)??0)+1),e.error&&r.set(t,(r.get(t)??0)+1);for(let t of Je(e))i.set(t,(i.get(t)??0)+1),e.error&&a.set(t,(a.get(t)??0)+1)}return{couplings:e.couplings,units:e.units.map(e=>({...e,live:n.get(e.unit)??0,errors:r.get(e.unit)??0})),hubs:e.hubs.map(e=>({...e,live:i.get(e.element)??0,errors:a.get(e.element)??0}))}}function at(e,t=[],n=null){if(!e||Object.keys(e.flows??{}).length===0)return{nodes:[],edges:[],units:[],hubs:[]};let r=it(rt(e),t),i=n?.element,a=r.hubs.find(e=>e.element===`flow`)?.live??0,o=r.hubs.find(e=>e.element===`flow`)?.errors??0,s=[],c=[];s.push(ot(`orbit:elements`,P.elementRing)),s.push(ot(`orbit:types`,P.typeRing)),s.push(ot(`orbit:spokes`,P.spokeRing)),s.push({id:`law:oke`,type:`law`,position:{x:P.cx-L.law.width/2,y:P.cy-L.law.height/2},data:{kind:`law`,label:e.app,refId:`oke`,badge:String(r.units.reduce((e,t)=>e+t.flowCount,0)),live:a,errors:o},selectable:!1,draggable:!1,zIndex:F.leaf,width:L.law.width,height:L.law.height,style:{width:L.law.width,height:L.law.height,overflow:`visible`}});let l=Ve(V.length);if(r.hubs.forEach((e,t)=>{let n=l[t]??0,r=L.hub;s.push({id:`element:${e.element}`,type:`element`,position:H(n,P.elementRing,r),data:{kind:`element`,label:M[e.element].symbol,refId:e.element,badge:String(e.resourceCount),live:e.live,errors:e.errors,dimmed:i!=null&&e.element!==i},draggable:!1,zIndex:F.leaf,width:r.width,height:r.height,style:{width:r.width,height:r.height}}),c.push(U(`element:${e.element}`,`law:oke`,e.element,1,!0))}),!i||i===`flow`){let t=L.type;r.hubs.forEach((n,r)=>{let i=l[r]??0,a=Qe(e,n.element),o=We(i,a.length);a.forEach((e,r)=>{let a=o[r]??{angle:i,radius:P.typeRing};s.push({id:e.id,type:`typeChip`,position:H(a.angle,a.radius,t),data:{kind:n.element,label:e.label,refId:e.id,...e.badge===void 0?{}:{badge:e.badge,facet:e.badge}},draggable:!1,zIndex:F.leaf,width:t.width,height:t.height,style:{width:t.width,height:t.height}}),c.push(U(e.id,`element:${n.element}`,n.element,1))})})}if(i&&i!==`flow`){let t=Ye(e,i),n=Ae.store,r=Ve(t.length);t.forEach((e,t)=>{let a=r[t]??0;s.push({id:e.id,type:i,position:H(a,P.spokeRing,n),data:{kind:i,label:e.label,refId:e.id,...e.badge===void 0?{}:{badge:e.badge,facet:e.badge}},draggable:!1,zIndex:F.leaf,width:n.width,height:n.height,style:{width:n.width,height:n.height}}),c.push(U(e.id,`element:${i}`,i,1))})}else{let t=L.unit,n=Ve(r.units.length);r.units.forEach((e,r)=>{let i=n[r]??0;s.push({id:`unit:${e.unit}`,type:`unitChip`,position:H(i,P.spokeRing,t),data:{kind:`unit`,label:e.unit,refId:e.unit,badge:String(e.flowCount),elements:e.elements.filter(e=>e!==`flow`),live:e.live,errors:e.errors},draggable:!1,zIndex:F.leaf,width:t.width,height:t.height,style:{width:t.width,height:t.height}})});let a=new Map;for(let t of Object.keys(e.flows??{}).sort()){let e=z(t),n=a.get(e)??[];n.push(t),a.set(e,n)}for(let t of r.units){let n=new Map,r=new Set;for(let o of a.get(t.unit)??[]){let t=e.flows?.[o];if(t)for(let a of qe(t)){if(i===`flow`&&a!==`flow`)continue;let o=nt(e,t,a);o.length===0&&r.add(a);for(let e of o)n.set(e,(n.get(e)??0)+1)}}for(let[e,r]of n){let n=e.slice(5).split(`:`)[0];!n||!(n in R)||c.push(U(`unit:${t.unit}`,e,n,r))}for(let e of r)c.push(U(`unit:${t.unit}`,`element:${e}`,e,1))}}return{nodes:s,edges:c,units:r.units,hubs:r.hubs}}function ot(e,t){let n=t*2;return{id:e,type:`orbit`,position:{x:P.cx-t,y:P.cy-t},data:{kind:`law`,label:``,refId:e},selectable:!1,draggable:!1,zIndex:F.edge,width:n,height:n,style:{width:n,height:n}}}function st(e,t){return t===`law:oke`?`trunk`:e.startsWith(`type:`)&&t.startsWith(`element:`)?`bind`:`spoke`}function ct(e){return e===`trunk`?.14:e===`bind`?.2:0}function U(e,t,n,r,i=!1){let a=i?`trunk`:st(e,t),o=a===`trunk`?1.15:1+Math.min(1.25,Math.log2(1+r)*.45);return{id:`couple:${e}->${t}`,source:e,target:t,sourceHandle:`center`,targetHandle:`center`,type:`straight`,data:{kind:`couple`},style:{stroke:I.couple,strokeWidth:o,opacity:ct(a)},zIndex:F.edge}}function lt(e){if(e.startsWith(`element:`)){let t=e.slice(8);return t in R?t:null}if(e.startsWith(`type:`)){let t=e.slice(5).split(`:`)[0];return t&&t in R?t:null}return null}function ut(e,t){for(let n of[t,e]){let e=lt(n);if(e)return R[e].accent}return I.couple}function dt(e,t){let n=new Set,r=new Set,i=(e,t)=>{r.add(`couple:${e}->${t}`)};if(!e)return{nodeIds:n,edgeIds:r};for(let r of t){let t=e.flows?.[r];if(!t)continue;let a=`unit:${z(r)}`;n.add(a);for(let r of qe(t)){let o=`element:${r}`;n.add(o),n.add(`law:oke`),i(o,`law:oke`);let s=nt(e,t,r);s.length===0&&i(a,o);for(let e of s)n.add(e),i(a,e),i(e,o)}}return{nodeIds:n,edgeIds:r}}function ft(e,t,n={}){let r=n.hoverNodeId??null,i=n.highlightedFlowIds??new Set,a=n.highlightedNodeIds??new Set,o=dt(n.manifest,i),s=o.nodeIds.size>0||a.size>0,c=r!=null,l=r==null?null:pt(r,t);return{nodes:e.map(e=>{if(e.type===`orbit`)return{...e,data:{...e.data,highlighted:!1,dimmed:!1}};let t=o.nodeIds.has(e.id)||a.has(e.id)||i.has(e.data.refId),n=l?.has(e.id)===!0;return{...e,data:{...e.data,highlighted:t||c&&e.id===r,dimmed:e.id===`law:oke`?!1:s&&!t||c&&!n}}}),edges:t.map(e=>{let t=l!=null&&l.has(e.source)&&l.has(e.target),n=s&&o.edgeIds.has(e.id),r=c?t:n,i=st(e.source,e.target),a=c||s?r?1:ct(i)*.35:ct(i);return{...e,animated:r,style:{...e.style,stroke:r?ut(e.source,e.target):I.couple,opacity:a,strokeWidth:r?2.25:e.style?.strokeWidth}}})}}function W(e,t){let n=[];for(let r of e)r.source===t?n.push(r.target):r.target===t&&n.push(r.source);return n}function pt(e,t){let n=new Set([e]),r=e=>n.add(e);if(e.startsWith(`unit:`)){for(let n of W(t,e)){if(r(n),n.startsWith(`type:`)){for(let e of W(t,n))if(e.startsWith(`element:`)){r(e);for(let n of W(t,e))n===`law:oke`&&r(n)}}if(n.startsWith(`element:`))for(let e of W(t,n))e===`law:oke`&&r(e)}return n}if(e.startsWith(`type:`)){for(let n of W(t,e))r(n);let i=[...n].find(e=>e.startsWith(`element:`));if(i)for(let e of W(t,i))e===`law:oke`&&r(e);return n}if(e.startsWith(`element:`)||e===`law:oke`)for(let n of W(t,e))r(n);return n}var G=C(),mt={flow:M.flow.icon,signal:M.signal.icon,store:M.store.icon,clock:M.clock.icon,gate:M.gate.icon,vault:M.vault.icon,channel:M.channel.icon,ai:M.ai.icon},ht={flow:`rounded-xl`,store:`rounded-md`,signal:`rounded-full`,clock:`rounded-lg`,gate:`rounded-md`,vault:`rounded-md`,channel:`rounded-xl`,ai:`rounded-2xl`};function K(e,t){return n(`group relative flex h-full w-full items-center gap-2.5 border-2 px-2.5 text-xs transition-[opacity,filter,box-shadow,border-color] duration-200`,ht[t],e.dimmed&&`opacity-30 saturate-[0.35]`,e.highlighted&&`z-10`,e.focused&&`z-10`)}function q(e,t){let n=R[e],r=`color-mix(in oklab, ${n.accent} 20%, var(--card))`;return t.highlighted||t.focused?{borderColor:n.accent,background:`color-mix(in oklab, ${n.accent} 26%, var(--card))`,boxShadow:`0 0 0 1px ${n.accent}, 0 0 22px ${n.glow}`}:{borderColor:`color-mix(in oklab, ${n.accent} 78%, var(--border))`,background:r,boxShadow:`inset 3px 0 0 ${n.accent}`}}function J({data:e,kind:t,className:n,style:r,children:i,...a}){let o=j(),s=R[t];return(0,G.jsx)(te.div,{className:n,style:r,initial:!1,whileHover:o?void 0:{scale:1.04},whileTap:o?void 0:{scale:.97},animate:{scale:o?1:e.active?[1,1.08,1]:e.highlighted?1.02:1,boxShadow:e.active?`0 0 0 2px ${s.accent}, 0 0 30px ${s.glow}`:void 0},transition:e.active?{duration:.5,ease:`easeInOut`}:{type:`spring`,stiffness:400,damping:28},...a,children:i})}function gt({kind:e,size:t=`sm`}){let r=R[e];return(0,G.jsx)(`span`,{className:n(`flex shrink-0 items-center justify-center border`,t===`md`?`size-9`:`size-7`,e===`signal`?`rounded-full`:e===`store`||e===`gate`||e===`vault`?`rounded-md`:`rounded-full`),style:{color:r.accent,background:r.well,borderColor:`color-mix(in oklab, ${r.accent} 55%, transparent)`},"aria-hidden":!0,children:(0,G.jsx)(b,{icon:mt[e],size:t===`md`?17:15,strokeWidth:1.9})})}function _t({text:e}){return(0,G.jsx)(`span`,{className:`rounded border border-border/70 bg-background/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.16em] text-muted-foreground`,children:e})}function vt({type:e,kind:t}){let n=R[t];return(0,G.jsx)(w,{type:e,position:e===`source`?O.Right:O.Left,className:`!size-2 !border-0`,style:{background:n.accent}})}function Y({type:e}){return(0,G.jsx)(w,{id:`center`,type:e,position:e===`source`?O.Right:O.Left,isConnectable:!1,className:`oke-center-handle !top-1/2 !left-1/2 !size-px !-translate-x-1/2 !-translate-y-1/2 !border-0 !bg-transparent !opacity-0`})}function yt({live:e,errors:t}){return e<=0?null:(0,G.jsx)(`span`,{className:n(`size-2 shrink-0 rounded-full`,t>0?`bg-rose-400`:`bg-emerald-400`,e>0&&`animate-pulse`),title:t>0?`${e} live · ${t} failed`:`${e} live`})}function bt({elements:e}){return e.length===0?null:(0,G.jsx)(`span`,{className:`mt-0.5 flex items-center gap-1`,"aria-hidden":!0,children:e.map(e=>(0,G.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:R[e].accent},title:M[e].label},e))})}function xt({data:e}){return(0,G.jsx)(`div`,{className:`h-full w-full rounded-xl border border-dashed border-foreground/25 bg-muted/35 px-3 pt-1.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:e.label}),e.badge?(0,G.jsx)(_t,{text:e.badge}):null]})})}function St({data:e}){let t=e.kind in R?e.kind:`flow`;return(0,G.jsxs)(J,{data:e,kind:t,className:n(K(e,t),`justify-center gap-0 rounded-full px-2`),style:q(t,e),"data-slot":`type-chip`,"data-type":e.refId,children:[(0,G.jsx)(Y,{type:`source`}),(0,G.jsx)(Y,{type:`target`}),(0,G.jsx)(`div`,{className:`min-w-0 truncate text-center text-[10px] leading-none font-medium tracking-wide text-foreground`,children:e.label})]})}function Ct({data:e}){return(0,G.jsxs)(J,{data:e,kind:`flow`,className:n(K(e,`flow`),`rounded-full px-2.5`),style:q(`flow`,e),"data-slot":`unit-chip`,"data-unit":e.refId,children:[(0,G.jsx)(Y,{type:`source`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium tracking-wide text-foreground uppercase`,children:e.label}),(0,G.jsx)(yt,{live:e.live??0,errors:e.errors??0})]}),(0,G.jsx)(bt,{elements:e.elements??[]})]}),e.badge?(0,G.jsx)(_t,{text:e.badge}):null]})}function wt({data:e}){let t=Ot(e.refId)??`flow`,r=R[t];return(0,G.jsxs)(J,{data:e,kind:t,className:n(K(e,t),`flex-col justify-center gap-0.5 rounded-full px-1.5 text-center`),style:{...q(t,e),boxShadow:e.highlighted?`0 0 0 1px ${r.accent}, 0 0 22px ${r.glow}`:`0 0 0 1px color-mix(in oklab, ${r.accent} 55%, transparent)`},"data-slot":`element-hub`,"data-element":t,children:[(0,G.jsx)(Y,{type:`target`}),(0,G.jsx)(Y,{type:`source`}),(0,G.jsx)(`span`,{className:`text-[18px] font-semibold tracking-tight text-foreground`,title:M[t].label,children:e.label})]})}function Tt(e){return e>=40?1.05:e>=12?1.55:2.2}function Et({data:e}){let t=j(),r=e.live??0,i=e.errors??0,[a,o]=(0,B.useState)(0),s=(0,B.useRef)(r);(0,B.useEffect)(()=>{r>s.current&&o(e=>e+1),s.current=r},[r]);let c=r>0,l=Tt(r),u=i>0?`var(--color-rose-400)`:`var(--foreground)`;return(0,G.jsxs)(`div`,{className:n(`relative flex h-full w-full items-center justify-center overflow-visible`,e.highlighted&&`z-10`),"data-slot":`law-hub`,"data-live":r,children:[(0,G.jsx)(Y,{type:`target`}),!t&&c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`oke-law-ripple`,style:{animationDuration:`${l}s`,color:u}}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`oke-law-ripple`,style:{animationDuration:`${l}s`,animationDelay:`${l/2}s`,color:u}})]}):null,a>0&&!t?(0,G.jsx)(`span`,{"aria-hidden":!0,className:`oke-law-hit`,style:{color:u}},a):null,(0,G.jsx)(te.div,{className:`flex h-full w-full items-center justify-center rounded-full border-4 bg-card px-4 text-center`,style:{borderColor:`color-mix(in oklab, var(--foreground) 82%, var(--border))`,boxShadow:e.highlighted?`0 0 0 1px ${u}, 0 0 36px color-mix(in oklab, ${u} 28%, transparent)`:`inset 0 0 28px color-mix(in oklab, var(--foreground) 7%, transparent), 0 0 22px color-mix(in oklab, ${u} ${c?16:6}%, transparent)`},animate:t||!c?{scale:1}:{scale:[1,1.045,1]},transition:t||!c?{duration:0}:{duration:l,repeat:1/0,ease:`easeInOut`},children:(0,G.jsx)(de,{className:`h-7 w-auto text-foreground`})})]})}function Dt(){return(0,G.jsx)(`div`,{className:`pointer-events-none h-full w-full rounded-full border border-dashed border-foreground/15`,"data-slot":`orbit`})}function Ot(e){return e in R?e:null}function X({data:e,kind:t,slot:n}){return(0,G.jsxs)(J,{data:e,kind:t,className:K(e,t),style:q(t,e),"data-slot":n,"data-flow-id":t===`flow`?e.refId:void 0,"data-highlighted":e.highlighted?`true`:`false`,children:[(0,G.jsx)(vt,{type:`target`,kind:t}),(0,G.jsx)(Y,{type:`source`}),(0,G.jsx)(gt,{kind:t}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e.label}),(0,G.jsx)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:(0,G.jsx)(_t,{text:e.badge??e.plane??e.facet??t})})]}),t===`flow`||t===`signal`?(0,G.jsx)(vt,{type:`source`,kind:t}):null]})}function kt({data:e}){return(0,G.jsx)(X,{data:e,kind:`flow`,slot:`flow-node`})}function At({data:e}){return(0,G.jsx)(X,{data:e,kind:`store`,slot:`store-node`})}function jt({data:e}){return(0,G.jsx)(X,{data:e,kind:`signal`,slot:`signal-node`})}function Mt({data:e}){return(0,G.jsx)(X,{data:e,kind:`ai`,slot:`ai-node`})}function Nt({data:e}){return(0,G.jsx)(X,{data:e,kind:`clock`,slot:`clock-node`})}function Pt({data:e}){return(0,G.jsx)(X,{data:e,kind:`gate`,slot:`gate-node`})}function Ft({data:e}){return(0,G.jsx)(X,{data:e,kind:`vault`,slot:`vault-node`})}function It({data:e}){return(0,G.jsx)(X,{data:e,kind:`channel`,slot:`channel-node`})}var Lt={unit:xt,unitChip:Ct,typeChip:St,element:wt,law:Et,orbit:Dt,flow:kt,store:At,signal:jt,ai:Mt,clock:Nt,gate:Pt,vault:Ft,channel:It};function Rt(e,t){let n=e.flows??{},r=new Set;if(t.kind===`unit`){for(let e of Object.keys(n))z(e)===t.unit&&r.add(e);let e=[];for(let t of r)for(let r of n[t]?.effects?.calls??[])N(r)||e.push(r);for(let t of e)r.add(t)}else if(t.kind===`flow`){r.add(t.flowId);let e=n[t.flowId];for(let t of e?.effects?.calls??[])N(t)||r.add(t);for(let[e,i]of Object.entries(n))i.effects?.calls?.includes(t.flowId)&&r.add(e)}else for(let[e,i]of Object.entries(n))zt(i,e,t.nodeId)&&r.add(e);let i={};for(let e of r){let t=n[e];t&&(i[e]=t)}return{...e,flows:i}}function zt(e,t,n){if(n===`flow:${t}`||n===`clock:${t}`&&(e.trigger?.cron||e.trigger?.every)||e.trigger?.signal&&n===`signal:${e.trigger.signal}`||e.gates?.some(e=>n===`gate:${e}`))return!0;let r=e.effects;return r?!!(r.reads?.some(e=>e===n)||r.writes?.some(e=>e===n)||r.emits?.some(e=>n===`signal:${e}`)||r.sends?.some(e=>n===`channel:${e}`)||r.asks?.some(e=>n===`ai:${e}`)||r.secrets?.some(e=>n===`vault:${e}`)||r.calls?.some(e=>{let t=N(e);return t?n===ke(t.server):n===`flow:${e}`})):!1}var Bt=[`!=`,`>=`,`<=`,`=`,`>`,`<`],Vt={clauses:[]},Ht=[`flow`,`unit`,`trigger`,`plane`,`tenant`,`principal`,`cache`,`replica`,`error`,`buildVersion`,`promptVersion`,`duration`];function Ut(e){if(!e||!e.trim())return Vt;let t=e.split(/\s+AND\s+/i).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){let t=en(e);t&&n.push(t)}return{clauses:n}}function Z(e,t){return{clauses:[...e.clauses.filter(e=>e.dimension!==t.dimension),t]}}function Wt(e,t){return{clauses:e.clauses.filter(e=>e.dimension!==t)}}function Gt(e,t){return e.dimension===t.dimension&&e.op===t.op&&e.value===t.value}function Kt(e,t){return e.clauses.some(e=>Gt(e,t))}function qt(e,t){return Kt(e,t)?Wt(e,t.dimension):Z(e,t)}function Jt(e){let t=rn(e.dimension,e.value);return`${e.dimension} ${e.op} ${t}`}function Yt(e,t){for(let n of t.clauses)if(!an(e,n))return!1;return!0}function Xt(e,t){return t.clauses.length===0?[...e]:e.filter(e=>Yt(e,t))}function Zt(e){let t=/^(-?\d+(?:\.\d+)?)\s*(ms|s|m)?$/i.exec(e.trim());if(!t)return;let n=Number(t[1]),r=(t[2]??`ms`).toLowerCase();if(r===`ms`)return n;if(r===`s`)return n*1e3;if(r===`m`)return n*6e4}function Qt(e,t){switch(t){case`flow`:return e.flow;case`unit`:return e.unit??null;case`trigger`:return e.trigger;case`plane`:return e.plane;case`tenant`:return e.tenant??null;case`principal`:return e.principal??null;case`cache`:return e.cache;case`replica`:return e.replica??null;case`replicaLagMs`:case`replica_lag_ms`:return e.replicaLagMs??null;case`error`:case`error_code`:return e.error??null;case`buildVersion`:case`build_version`:return e.buildVersion??null;case`promptVersion`:case`prompt_version`:return e.promptVersion??null;case`cost`:return e.cost??null;case`duration`:case`duration_ms`:return e.durationMs;case`gates`:return e.gates.join(`,`);default:return e.dimensions[t]}}function $t(e){let t=new Set(Ht);for(let n of e)for(let e of Object.keys(n.dimensions))t.add(e);return[...t].sort()}function en(e){let t=null,n=-1;for(let r of Bt){let i=e.indexOf(` ${r} `);if(i!==-1){t=r,n=i;break}}if(t===null||n<0)return null;let r=e.slice(0,n).trim(),i=e.slice(n+t.length+2).trim();if(!r||!i)return null;let a=tn(r,i);return a===void 0?null:{dimension:r,op:t,value:a}}function tn(e,t){return e===`duration`||e===`duration_ms`?Zt(t):t===`true`?!0:t===`false`?!1:t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):/^-?\d+(\.\d+)?$/.test(t)?Number(t):t}function nn(e,t){return rn(e,t)}function rn(e,t){if(e===`duration`||e===`duration_ms`){let e=typeof t==`number`?t:Number(t);return Number.isFinite(e)?e>=6e4&&e%6e4==0?`${e/6e4}m`:e>=1e3&&e%1e3==0?`${e/1e3}s`:`${e}ms`:String(t)}return typeof t==`string`&&/\s/.test(t)?`"${t}"`:String(t)}function an(e,t){let n=Qt(e,t.dimension);if(n==null)return t.op===`!=`;let r=t.value;if(t.op===`=`)return on(n,r);if(t.op===`!=`)return!on(n,r);let i=Q(n),a=Q(r);return i===void 0||a===void 0?!1:t.op===`>`?i>a:t.op===`<`?i<a:t.op===`>=`?i>=a:t.op===`<=`&&i<=a}function on(e,t){if(typeof e==`number`||typeof t==`number`){let n=Q(e),r=Q(t);if(n!==void 0&&r!==void 0)return n===r}return String(e)===String(t)}function Q(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`boolean`)return;let t=Number(e);return Number.isFinite(t)?t:void 0}var sn=new Set(Object.keys(M));function cn(e){if(e.startsWith(`flow:`))return{kind:`flow`,flowId:e.slice(5)};if(e.startsWith(`signal:`))return{kind:`signal`,signal:e.slice(7)};if(e.startsWith(`unit:`))return{kind:`unit`,unit:e.slice(5)};if(e.startsWith(`element:`)){let t=e.slice(8);return sn.has(t)?{kind:`element`,element:t}:null}if(e.startsWith(`type:`)){let t=e.slice(5).split(`:`)[0];return t&&sn.has(t)?{kind:`element`,element:t}:null}return e.startsWith(`sql:`)||e.startsWith(`kv:`)||e.startsWith(`files:`)||e.startsWith(`index:`)||e.startsWith(`vault:`)||e.startsWith(`channel:`)||e.startsWith(`gate:`)||e.startsWith(`clock:`)||e.startsWith(`ai:`)?{kind:`resource`,nodeId:e}:null}function ln(e){switch(e.kind){case`flow`:return e.flowId;case`signal`:return`signal:${e.signal}`;case`unit`:return e.unit;case`element`:return M[e.element].label;case`resource`:return e.nodeId}}function un(e,t){return t?.kind===`flow`?Z(e,{dimension:`flow`,op:`=`,value:t.flowId}):t?.kind===`unit`?Z(e,{dimension:`unit`,op:`=`,value:t.unit}):e}function dn(e,t,n){if(t.kind===`flow`)return Yt(e,{clauses:[{dimension:`flow`,op:`=`,value:t.flowId}]});if(t.kind===`unit`)return(e.unit??z(e.flow))===t.unit;if(t.kind===`element`)return t.element===`flow`||Je(e).includes(t.element);if(t.kind===`resource`)return fn(e,t.nodeId,n);let r=n?.flows??{};for(let[n,i]of Object.entries(r))if(n===e.flow&&(i.trigger?.signal===t.signal||i.effects?.emits?.includes(t.signal)))return!0;return!1}function fn(e,t,n){let r=t.includes(`:`)?t.slice(t.indexOf(`:`)+1):t;if(e.effects.some(e=>e.resource===t||e.resource===r)||e.gates.some(e=>t===`gate:${e}`))return!0;let i=n?.flows?.[e.flow];return!!(i&&zt(i,e.flow,t))}function pn(e,t,n){return t?e.filter(e=>dn(e,t,n)):[...e]}function mn(e){return e?e.kind===`unit`||e.kind===`flow`||e.kind===`resource`?e:e.kind===`signal`?{kind:`resource`,nodeId:`signal:${e.signal}`}:null:null}function hn({manifest:e,runs:t=[],graphFilter:n,highlightedFlowIds:r,highlightedNodeIds:i,follow:a,activeNodeId:o=null,focusedNodeId:s=null,orchestraLabel:c=null,onNodeClick:l,onPaneClick:u}){let{fitView:d}=E(),{theme:f}=le(),[p,m]=(0,B.useState)(null),h=f===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:f,g=mn(n),_=n?.kind===`element`?n.element:null,v=g===null,y=(0,B.useMemo)(()=>at(e,t,_?{kind:`element`,element:_}:null),[e,t,_]),b=(0,B.useMemo)(()=>Le(!g||!e?e:Rt(e,g)),[e,g]),x=(0,B.useMemo)(()=>ft(y.nodes,y.edges,{hoverNodeId:p,highlightedFlowIds:r,highlightedNodeIds:i,manifest:e}),[y.nodes,y.edges,p,r,i,e]),S=(0,B.useMemo)(()=>Fe(b.nodes,r,i,{activeNodeId:o,focusedNodeId:s}),[b.nodes,r,i,o,s]),C=(0,B.useMemo)(()=>Pe(b.edges,S),[b.edges,S]),w=v?x.nodes:S,O=v?x.edges:C;return(0,B.useEffect)(()=>{d({duration:280,padding:.18})},[v,n,e,d]),(0,B.useEffect)(()=>{if(!a||v||r.size===0)return;let e=[...r].map(e=>`flow:${e}`);d({nodes:e.map(e=>({id:e})),duration:300,padding:.2})},[a,v,r,d]),(0,G.jsxs)(`div`,{className:`relative h-full w-full`,children:[n?(0,G.jsxs)(`button`,{type:`button`,"data-slot":`flow-graph-map`,onClick:()=>u?.(),className:`absolute top-2 left-2 z-10 inline-flex max-w-[min(100%-1rem,20rem)] items-center gap-1.5 truncate rounded-md border border-border/70 bg-card/90 px-2 py-1 text-[10px] font-medium text-muted-foreground shadow-sm backdrop-blur-sm transition-colors hover:border-border hover:text-foreground`,children:[(0,G.jsx)(`span`,{className:`text-foreground`,children:`Map`}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,G.jsx)(`span`,{className:`truncate`,children:ln(n)})]}):(0,G.jsx)(`div`,{className:`pointer-events-none absolute top-2 left-2 z-10 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:c?(0,G.jsxs)(G.Fragment,{children:[`Orchestra `,(0,G.jsx)(`span`,{className:`text-foreground normal-case`,children:c})]}):`Hover a unit — spokes light the elements it touches`}),(0,G.jsxs)(T,{nodes:w,edges:O,nodeTypes:Lt,colorMode:h,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,proOptions:{hideAttribution:!0},minZoom:.15,maxZoom:1.6,defaultEdgeOptions:{type:`smoothstep`,zIndex:F.edge},zIndexMode:`manual`,onNodeClick:(e,t)=>l?.(t.id),onPaneClick:()=>u?.(),onNodeMouseEnter:(e,t)=>m(t.id),onNodeMouseLeave:()=>m(null),children:[(0,G.jsx)(ee,{gap:24,size:1,color:`color-mix(in oklab, var(--foreground) 14%, transparent)`}),(0,G.jsx)(k,{showInteractive:!1}),(0,G.jsx)(D,{pannable:!0,zoomable:!0,ariaLabel:`Flow graph overview`,bgColor:`var(--card)`,maskColor:`color-mix(in oklab, var(--background) 55%, transparent)`,nodeColor:gn,nodeStrokeColor:_n,nodeStrokeWidth:12,nodeBorderRadius:10})]})]})}function gn(e){if(e.type===`orbit`)return`transparent`;let t=e.data.kind;if(t===`law`)return`color-mix(in oklab, var(--foreground) 45%, transparent)`;if(t===`unit`)return`color-mix(in oklab, var(--foreground) 8%, transparent)`;if(t===`element`){let t=e.data.refId;return R[t]?.accent??`#64748B`}return t in R?R[t].accent:`#64748B`}function _n(e){return e.data.kind===`unit`?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`transparent`}function vn(e){let{leading:t,...n}=e;return(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,"data-slot":`flow-graph`,children:[t?(0,G.jsxs)(`header`,{className:h,children:[t,(0,G.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0})]}):null,(0,G.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,G.jsx)(A,{children:(0,G.jsx)(hn,{...n})})})]})}var yn=`orch-`;function bn(e){return e.startsWith(yn)}function xn(e,t){return e&&t}function Sn(e,t=Math.random){let n=e.filter(e=>!bn(e.id)&&e.flow.length>0);return n.length===0?null:n[Math.floor(t()*n.length)]??null}function Cn(e,t,n){let r=t-e.startedAt,i=e.flow.replaceAll(`.`,`-`);return{...e,id:`${yn}${n}-${i}`,parentId:null,startedAt:t,endedAt:t+e.durationMs,effects:e.effects.map(e=>({...e,timestamp:e.timestamp+r})),logs:e.logs.map(e=>({...e,at:e.at+r}))}}function wn(e=Math.random){return 1800+Math.floor(e()*1600)}var Tn=1400;function En(e){let t=a(),[n,r]=(0,B.useState)(null),i=(0,B.useRef)(0),o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=(0,B.useRef)(e.paused);return c.current=e.paused,(0,B.useEffect)(()=>{if(!xn(!1,e.enabled))return;let n=()=>{o.current&&=(clearTimeout(o.current),null)},a=()=>{if(c.current||document.hidden)return;let e=Sn(t.getQueryData(De)??[]);if(!e)return;i.current+=1;let a=Cn(e,Date.now(),i.current);t.setQueryData(De,e=>Ee(e??[],a)),r({flowId:a.flow,runId:a.id}),n(),o.current=setTimeout(()=>{r(null),o.current=null},Tn)},l=e=>{s.current=setTimeout(()=>{a(),l(wn())},e)};l(700);let u=()=>{document.hidden&&(r(null),n())};return document.addEventListener(`visibilitychange`,u),()=>{document.removeEventListener(`visibilitychange`,u),s.current&&clearTimeout(s.current),n(),r(null)}},[e.enabled,t]),e.paused?null:n}function Dn(e,t){let n=new Set;if(!t)return n;let r=new Map,i=new Map;for(let t of e)r.set(t.id,t);for(let t of e){if(!t.parentId)continue;let e=i.get(t.parentId)??[];e.push(t),i.set(t.parentId,e)}let a=r.get(t);if(!a)return n;let o=a,s=new Set;for(;o&&!s.has(o.id);)s.add(o.id),n.add(o.flow),o=o.parentId?r.get(o.parentId):void 0;let c=[a];for(;c.length>0;){let e=c.shift();if(!e)break;for(let t of i.get(e.id)??[])s.has(t.id)||(s.add(t.id),n.add(t.flow),c.push(t))}return n}var On=[{id:`signal`,label:`Signal`,expr:`trigger = signal`},{id:`clock`,label:`Clock`,expr:`trigger = cron`},{id:`cache-miss`,label:`Cache miss`,expr:`cache = miss`},{id:`slow`,label:`Slow`,expr:`duration > 100ms`}],kn=`h-7 min-w-0 rounded-none border-0 bg-transparent px-0 font-mono text-[11px] text-foreground shadow-none outline-none focus-visible:ring-0 dark:bg-transparent`,$=`rounded-none border-0 bg-transparent px-1.5 py-1 text-[11px] text-foreground/70 shadow-none transition-colors hover:bg-muted/50 hover:text-foreground`,An=`grid grid-cols-[minmax(0,1fr)_1.25rem_minmax(0,1fr)_1.25rem] items-center gap-x-1`;function jn({query:e,runs:t,onChange:i}){let a=(0,B.useMemo)(()=>$t(t),[t]),o=(0,B.useMemo)(()=>[...new Set([...Ht,...a])].sort(),[a]),[s,c]=(0,B.useState)(`trigger`),[l,u]=(0,B.useState)(`=`),[d,f]=(0,B.useState)(`signal`),[p,m]=(0,B.useState)(!1),h=()=>{let t=Ut(`${s} ${l} ${d}`).clauses[0];t&&(i(Z(e,t)),m(!1))};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-border/60 px-2 py-1.5`,"data-slot":`traces-advanced-filters`,children:[e.clauses.length>0?(0,G.jsx)(`ul`,{"aria-label":`Active filters`,className:`flex flex-col gap-0.5`,children:e.clauses.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Mn,{clause:t,onRemove:()=>i(Wt(e,t.dimension))})},t.dimension))}):null,p?(0,G.jsxs)(`div`,{className:An,"data-slot":`traces-advanced-composer`,children:[(0,G.jsx)(`select`,{"aria-label":`Filter dimension`,className:kn,value:s,onChange:e=>c(e.target.value),children:o.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(`select`,{"aria-label":`Filter operator`,className:n(kn,`text-center text-foreground/70`),value:l,onChange:e=>u(e.target.value),children:[`=`,`!=`,`>`,`<`,`>=`,`<=`].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(r,{"aria-label":`Filter value`,flat:!0,className:`h-7 px-0 font-mono text-[11px]`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()}}),(0,G.jsx)(`button`,{type:`button`,className:$,onClick:h,children:`Add`})]}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[On.map(t=>{let r=Ut(t.expr).clauses[0],a=r!==void 0&&Kt(e,r);return(0,G.jsx)(`button`,{type:`button`,"aria-pressed":a,disabled:r===void 0,onClick:()=>{r&&i(qt(e,r))},className:n($,a?`font-medium text-foreground`:`text-foreground/70`),children:t.label},t.id)}),(0,G.jsx)(`button`,{type:`button`,"aria-expanded":p,className:n($,`ml-auto`,p&&`text-foreground`),onClick:()=>m(e=>!e),children:p?`Cancel`:`Add clause`}),e.clauses.length>0?(0,G.jsx)(`button`,{type:`button`,className:$,onClick:()=>i(Ut(``)),children:`Clear`}):null]})]})}function Mn({clause:e,onRemove:r}){let i=Jt(e);return(0,G.jsxs)(`div`,{className:An,"data-slot":`traces-advanced-clause`,children:[(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px] text-foreground/80`,children:e.dimension}),(0,G.jsx)(`span`,{className:`text-center font-mono text-[11px] text-foreground/65`,"aria-hidden":!0,children:e.op}),(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px] text-foreground`,children:nn(e.dimension,e.value)}),(0,G.jsx)(`button`,{type:`button`,className:n($,`flex size-5 items-center justify-center text-foreground/55 hover:text-destructive`),"aria-label":`Remove ${i}`,onClick:r,children:(0,G.jsx)(b,{icon:t,className:`size-3`})})]})}var Nn={query:``,status:`all`,advanced:Vt};function Pn(e,t){let n=t.trim().toLowerCase();return!n||[e.flow,e.unit??``,e.trigger,e.cache,e.id,e.error??``,e.errorMessage??``].some(e=>e.toLowerCase().includes(n))}function Fn(e,t){return Xt(e.filter(e=>!(!Pn(e,t.query)||t.status===`errors`&&e.error===null)),t.advanced)}function In(e,t=Date.now()){let n=t-e;return n<1e3?`just now`:n<6e4?`${Math.floor(n/1e3)}s ago`:n<36e5?`${Math.floor(n/6e4)}m ago`:`${Math.floor(n/36e5)}h ago`}function Ln(e,t=Date.now()){let n=In(e.startedAt,t),r=e.error!==null;return{text:n,title:r?e.errorMessage?`${e.error} — ${e.errorMessage}`:e.error??n:n,failed:r}}function Rn({run:e,selected:t,onSelect:r,copyText:a=async e=>{await navigator.clipboard.writeText(e)}}){let c=Ln(e),u=c.failed,d=ae(e.trigger),f=e.cache,[p,m]=(0,B.useState)(null),h=async t=>{t.stopPropagation();try{await a(se(e)),m(`Copied run id`)}catch{m(`Copy failed`)}};return(0,G.jsxs)(`div`,{"data-slot":`trace-row`,"data-run-id":e.id,"data-selected":t?`true`:`false`,"data-failed":u?`true`:`false`,"data-cache":e.cache,className:n(`group relative flex w-full items-stretch border-b border-border/60 text-xs transition-colors`,`hover:bg-muted/50 focus-within:bg-muted/50`,t&&`bg-muted/70`,u&&`bg-destructive/[0.04]`),children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:n(`absolute inset-y-0 left-0 w-0.5`,t&&!u&&`bg-sky-500`,u&&`bg-destructive`)}),(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>r(e.id),className:`flex min-w-0 flex-1 items-center gap-2 py-1.5 pr-1 pl-0 text-left outline-none`,children:[(0,G.jsx)(`span`,{className:n(`ml-2.5 size-1.5 shrink-0 rounded-full`,u?`bg-destructive`:`bg-emerald-500`),"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,title:d.label,"aria-hidden":!0,children:(0,G.jsx)(b,{icon:d.icon,className:`size-3.5`})}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:e.flow}),(0,G.jsx)(ze,{cache:f,dataSlot:`trace-row-cache`}),(0,G.jsx)(`span`,{className:n(`w-10 shrink-0 text-right tabular-nums font-medium`,ne(e.durationMs)),children:Te(e.durationMs)}),(0,G.jsx)(`span`,{className:`w-14 shrink-0 truncate text-right tabular-nums text-muted-foreground`,title:c.title,"data-slot":`trace-row-meta`,children:c.text})]}),(0,G.jsx)(`div`,{className:n(`flex shrink-0 items-center gap-0.5 pr-1.5 opacity-0 transition-opacity`,`group-hover:opacity-100 group-focus-within:opacity-100`,p&&`opacity-100`),children:(0,G.jsxs)(l,{children:[(0,G.jsx)(s,{render:e=>(0,G.jsx)(x,{...e,type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Copy run ID`,"data-slot":`trace-copy-id`,onClick:t=>{e.onClick?.(t),h(t)},children:(0,G.jsx)(b,{icon:o,className:`size-3`})})}),(0,G.jsx)(i,{side:`top`,children:`Copy run ID`})]})}),p?(0,G.jsx)(`span`,{className:`sr-only`,role:`status`,children:p}):null]})}var zn=[{value:`all`,label:`All`,icon:c},{value:`errors`,label:`Errors`,icon:g}];function Bn({runs:e,selectedRunId:t,onSelect:r,liveStatus:a,manifest:o,graphFilter:c,onGraphFilterChange:p,focusEffectIndex:g,onFocusEffectChange:v,playbackKey:x,onReplayStart:S,selectedRun:C}){let[w,T]=(0,B.useState)(Nn),[E,D]=(0,B.useState)(!1);(0,B.useEffect)(()=>{(c?.kind===`flow`||c?.kind===`unit`)&&T(e=>({...e,advanced:un(e.advanced,c)}))},[c]);let O=(0,B.useMemo)(()=>pn(Fn(e,w),c,o),[e,w,c,o]),k=(0,B.useMemo)(()=>C===void 0?t?e.find(e=>e.id===t)??null:null:C,[C,e,t]),A=w.advanced.clauses.length>0,ee=e=>{T(t=>({...t,query:e}))},j=e=>{T(t=>({...t,status:e}))};return(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-slot":`traces-pane`,children:[(0,G.jsxs)(`div`,{className:`shrink-0 border-b border-border/60`,children:[(0,G.jsxs)(`div`,{className:n(f,`border-b-0`),children:[(0,G.jsx)(pe,{value:w.query,onChange:e=>ee(e.target.value),placeholder:`Search traces…`,"aria-label":`Search traces`,"data-slot":`traces-search`}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-stretch pr-0.5`,children:[e.length>0?(0,G.jsxs)(l,{children:[(0,G.jsx)(s,{render:e=>(0,G.jsxs)(`button`,{...e,type:`button`,"aria-expanded":E,"aria-controls":`traces-advanced-panel`,"aria-label":A?`Advanced filters, ${w.advanced.clauses.length} active`:`Advanced filters`,"data-slot":`traces-advanced-toggle`,onClick:t=>{e.onClick?.(t),D(e=>!e)},className:n(d,`relative`,(E||A)&&`text-foreground`),children:[(0,G.jsx)(b,{icon:_,className:`size-3`,"aria-hidden":!0}),A?(0,G.jsx)(`span`,{className:`absolute -top-0.5 -inset-e-0.5 flex size-3.5 items-center justify-center rounded-full bg-foreground text-[8px] font-medium text-background`,"aria-hidden":!0,children:w.advanced.clauses.length}):null]})}),(0,G.jsx)(i,{side:`bottom`,children:`Advanced`})]}):null,e.length>0?(0,G.jsx)(`span`,{className:`mx-0.5 h-3 w-px bg-border/60`,"aria-hidden":!0}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 pr-0.5 text-[10px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:a===`open`?`size-1.5 rounded-full bg-emerald-500`:`size-1.5 rounded-full bg-muted-foreground`,"aria-hidden":!0}),a===`open`?`live`:`polling`]})]})]}),e.length>0?(0,G.jsx)(`div`,{className:n(h,`border-t border-b-0`),"data-slot":`traces-filters`,children:(0,G.jsx)(`div`,{className:`flex shrink-0 items-stretch`,role:`group`,"aria-label":`Status filter`,children:zn.map(({value:e,label:t,icon:r})=>{let i=w.status===e;return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>j(e),className:n(u,`font-semibold tracking-[0.08em] uppercase`,i?e===`errors`?`text-destructive`:m:y),children:[(0,G.jsx)(b,{icon:r,className:`size-3`,"aria-hidden":!0}),t]},e)})})}):null,e.length>0&&c?(0,G.jsxs)(`button`,{type:`button`,"data-slot":`traces-graph-filter`,onClick:()=>p(null),title:`Clear graph filter`,className:`mx-2 mb-1.5 inline-flex max-w-full items-center gap-1 self-start truncate rounded-md border border-sky-500/40 bg-sky-500/10 px-2 py-0.5 text-[10px] font-medium text-sky-700 transition-colors hover:bg-sky-500/20 dark:text-sky-400`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:ln(c)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`×`})]}):null]}),e.length>0?(0,G.jsx)(Be,{id:`traces-advanced-panel`,role:`region`,"aria-label":`Advanced filters`,open:E,className:`shrink-0`,children:(0,G.jsx)(jn,{query:w.advanced,runs:e,onChange:e=>{T(t=>({...t,advanced:e}))}})}):null,(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:e.length===0?(0,G.jsx)(_e,{className:`border-none`,children:(0,G.jsxs)(me,{children:[(0,G.jsx)(he,{variant:`icon`,children:(0,G.jsx)(b,{icon:M.flow.icon})}),(0,G.jsx)(be,{children:`No traces yet`}),(0,G.jsx)(Se,{children:`No runs for the flows on this graph yet. Trigger a flow to see live activity here.`})]})}):O.length===0?(0,G.jsx)(_e,{className:`border-none`,children:(0,G.jsxs)(me,{children:[(0,G.jsx)(be,{children:`No matching traces`}),(0,G.jsx)(Se,{children:`Nothing in this list matches the current search, status, or advanced filters.`})]})}):O.map(e=>(0,G.jsx)(Rn,{run:e,selected:e.id===t,onSelect:e=>r(e===t?null:e)},e.id))}),(0,G.jsx)(ce,{run:k,onClose:()=>r(null),focusEffectIndex:g,onFocusEffectChange:v,playbackKey:x,onReplayStart:S})]})}function Vn(){let e=we(),t=Oe(),n=Ce(!0),{selectedRunId:r,selectedFlowId:i,follow:a,setSelectedRun:o,setSelectedFlow:s}=ue(),c=ve(),l=(0,G.jsx)(ye,{open:c.open,onToggle:c.toggle,noun:`traces`,controlsId:`overview-traces`,dataSlot:`overview-traces-toggle`}),[u,d]=(0,B.useState)(null),[f,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(0),[_,y]=(0,B.useState)(null),b=(0,B.useRef)(null),x=(0,B.useMemo)(()=>new Set(Object.keys(e.data?.flows??{})),[e.data]),S=(0,B.useMemo)(()=>Ie(t.data??[],x),[t.data,x]),C=En({enabled:!!e.data&&S.length>0,paused:r!=null||u!=null});(0,B.useEffect)(()=>{i&&d(e=>e?.kind===`flow`&&e.flowId===i?e:{kind:`flow`,flowId:i})},[i]);let w=(0,B.useCallback)(e=>{d(e),e?.kind===`flow`?s(e.flowId):s(null)},[s]),T=(0,B.useMemo)(()=>{let e=Dn(t.data??[],r);return e.size>0?e:i?new Set([i]):C?.flowId?new Set([C.flowId]):e},[t.data,r,i,C?.flowId]),E=(0,B.useMemo)(()=>{let t=new Set,n=e.data?.flows??{};for(let e of T){let r=n[e];if(r){r.trigger?.signal&&t.add(`signal:${r.trigger.signal}`),(r.trigger?.cron||r.trigger?.every)&&t.add(`clock:${e}`);for(let e of r.gates??[])t.add(`gate:${e}`);for(let e of r.effects?.reads??[])t.add(e);for(let e of r.effects?.writes??[])t.add(e);for(let e of r.effects?.emits??[])t.add(`signal:${e}`);for(let e of r.effects?.sends??[])t.add(`channel:${e}`);for(let e of r.effects?.asks??[])t.add(`ai:${e}`);for(let e of r.effects?.secrets??[])t.add(`vault:${e}`)}}return t},[T,e.data]),D=(0,B.useMemo)(()=>r?t.data?.find(e=>e.id===r)??null:null,[t.data,r]),O=(0,B.useCallback)(e=>{let t=cn(e);t&&w(u&&u.kind===t.kind&&JSON.stringify(u)===JSON.stringify(t)?null:t)},[w,u]),k=(0,B.useCallback)(()=>{w(null)},[w]),A=(0,B.useCallback)(()=>{g(e=>e+1)},[]);return(0,B.useEffect)(()=>{if(h===0||!D)return;let n=oe(Dn(t.data??[],D.id),e.data??null);if(n.length===0)return;let r=re(D.durationMs),i=performance.now();return y(n[0]??null),b.current=setInterval(()=>{let e=Math.min(1,(performance.now()-i)/r);y(ie(n,e)),e>=1&&b.current&&(clearInterval(b.current),b.current=null,setTimeout(()=>y(null),400))},60),()=>{b.current&&=(clearInterval(b.current),null),y(null)}},[h,D,t.data,e.data]),(0,G.jsx)(`div`,{className:p,"data-slot":`flows-page`,children:(0,G.jsxs)(fe,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[(0,G.jsx)(ge,{panelRef:c.panelRef,collapsible:!0,collapsedSize:0,defaultSize:v.start.defaultSize,minSize:v.start.minSize,maxSize:`50%`,onResize:c.onResize,className:`min-h-0`,children:(0,G.jsx)(`div`,{id:`overview-traces`,className:`h-full min-h-0 overflow-hidden`,"data-slot":`overview-traces`,children:(0,G.jsx)(Bn,{runs:S,selectedRunId:r,onSelect:o,liveStatus:n,manifest:e.data??null,graphFilter:u,onGraphFilterChange:w,focusEffectIndex:f,onFocusEffectChange:m,playbackKey:h,onReplayStart:A,selectedRun:D})})}),c.open?(0,G.jsx)(xe,{withHandle:!0}):null,(0,G.jsx)(ge,{defaultSize:v.end.defaultSize,minSize:v.end.minSize,className:`min-h-0`,children:(0,G.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:(0,G.jsx)(vn,{manifest:e.data??null,runs:S,graphFilter:u,highlightedFlowIds:T,highlightedNodeIds:E,orchestraLabel:C?.flowId??null,follow:a,activeNodeId:_,onNodeClick:O,onPaneClick:k,leading:l})})})]})})}export{Vn as FlowsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Ea as r,Eo as i,Oa as a,Oo as o}from"./shortcut-keys-CoqwEIi0.js";import{r as s}from"./react-dom-Bph1y7z7.js";import{A as c}from"./xyflow-D7n4g6go.js";import{r as l,t as u}from"./preload-helper-oH4irX4C.js";var d=t(s(),1),f=500;function p(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[t,...e].slice(0,f);let r=e.slice();return r[n]=t,r}function m(e,t){let n=e;for(let e of t)n=p(n,e);return n}async function h(e,t){let n=await e();n.error||t([...n.data?.runs??[]])}function g(e){let t=e.pollMs??5e3,n=e.reconnectMs??2e3,r=e.setTimeout??setTimeout,i=e.clearTimeout??clearTimeout,a=e.setInterval??setInterval,o=e.clearInterval??clearInterval,s=null,c=null,l=null,u=!0,d=()=>{c!==null&&(o(c),c=null)},f=()=>{c===null&&(c=a(()=>{e.onPoll()},t))},p=()=>{if(u)return;l!==null&&(i(l),l=null);let t=`${e.protocol}//${e.host}/console/live`;s=new e.WebSocket(t),e.setStatus(`connecting`),s.onopen=()=>{u||(e.setStatus(`open`),d())},s.onmessage=t=>{if(!u)try{e.onMessage(JSON.parse(String(t.data)))}catch{}},s.onclose=()=>{u||(e.setStatus(`closed`),f(),l=r(()=>{l=null,u||p()},n))},s.onerror=()=>{s?.close()}};return{start(){u=!1,p()},stop(){u=!0,d(),l!==null&&(i(l),l=null),s?.close(),s=null}}}var _=[`console.manifest.get`];function v(){return i({queryKey:_,queryFn:async()=>{let e=await r();if(e.error)throw Error(e.error.code);return e.data?.manifest??null}})}var y=[`console.runs.list`];function ee(){return i({queryKey:y,queryFn:async()=>{let e=await a();if(e.error)throw Error(e.error.code);return e.data?.runs??[]}})}function te(e){let t=o(),[n,r]=(0,d.useState)(`connecting`);return(0,d.useEffect)(()=>{if(!e)return;let n=e=>{if(e.type===`manifest`){t.setQueryData(_,e.manifest);return}if(e.type===`manifest.diff`){t.setQueryData(_,e.after);return}if(e.type===`run`){t.setQueryData(y,t=>p(t??[],e.run));return}if(e.type===`runs.batch`){t.setQueryData(y,t=>m(t??[],e.runs));return}},i=window.location.protocol===`https:`?`wss:`:`ws:`,o=g({WebSocket:globalThis.WebSocket,host:window.location.host,protocol:i,setStatus:r,onMessage:n,onPoll:()=>{h(a,e=>{t.setQueryData(y,e)})}});return o.start(),()=>{o.stop()}},[e,t]),n}function ne(e){if(!Number.isFinite(e)||e<0)return`0μs`;if(e<1)return`${Math.round(e*1e3)}μs`;if(e<1e3){let t=Math.round(e*10)/10;return Number.isInteger(t)?`${t}ms`:`${t.toFixed(1)}ms`}let t=e/1e3,n=Math.round(t*10)/10;return Number.isInteger(n)?`${n}s`:`${n.toFixed(1)}s`}function re(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ie=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ae=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oe={};function se(e,t){return((t||oe).jsx?ae:ie).test(e)}var ce=/[ \t\n\f\r]/g;function le(e){return typeof e==`object`?e.type===`text`&&ue(e.value):ue(e)}function ue(e){return e.replace(ce,``)===``}var de=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};de.prototype.normal={},de.prototype.property={},de.prototype.space=void 0;function fe(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new de(n,r,t)}function pe(e){return e.toLowerCase()}var b=class{constructor(e,t){this.attribute=t,this.property=e}};b.prototype.attribute=``,b.prototype.booleanish=!1,b.prototype.boolean=!1,b.prototype.commaOrSpaceSeparated=!1,b.prototype.commaSeparated=!1,b.prototype.defined=!1,b.prototype.mustUseProperty=!1,b.prototype.number=!1,b.prototype.overloadedBoolean=!1,b.prototype.property=``,b.prototype.spaceSeparated=!1,b.prototype.space=void 0;var me=e({boolean:()=>x,booleanish:()=>S,commaOrSpaceSeparated:()=>E,commaSeparated:()=>T,number:()=>C,overloadedBoolean:()=>ge,spaceSeparated:()=>w}),he=0,x=D(),S=D(),ge=D(),C=D(),w=D(),T=D(),E=D();function D(){return 2**++he}var _e=Object.keys(me),ve=class extends b{constructor(e,t,n,r){let i=-1;if(super(e,t),ye(this,`space`,r),typeof n==`number`)for(;++i<_e.length;){let e=_e[i];ye(this,_e[i],(n&me[e])===me[e])}}};ve.prototype.defined=!0;function ye(e,t,n){n&&(e[t]=n)}function be(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ve(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[pe(r)]=r,n[pe(a.attribute)]=r}return new de(t,n,e.space)}var xe=be({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:S,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:w,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:C,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:w,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:S,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Se(e,t){return t in e?e[t]:t}function Ce(e,t){return Se(e,t.toLowerCase())}var we=be({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:T,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:w,autoFocus:x,autoPlay:x,blocking:w,capture:null,charSet:null,checked:x,cite:null,className:w,closedBy:null,colorSpace:null,cols:C,colSpan:C,command:null,commandFor:null,content:null,contentEditable:S,controls:x,controlsList:w,coords:C|T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:ge,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:w,height:C,hidden:ge,high:C,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:w,itemRef:w,itemScope:x,itemType:w,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:x,optimum:C,pattern:null,ping:w,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:w,required:x,reversed:x,rows:C,rowSpan:C,sandbox:w,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:S,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:T,part:w,prefix:null,property:null,results:C,security:null,unselectable:null},space:`html`,transform:Ce}),Te=be({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:E,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:w,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:T,g2:T,glyphName:T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:E,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:w,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:E,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:E,rev:E,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:E,requiredFeatures:E,requiredFonts:E,requiredFormats:E,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:E,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:E,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:E,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Se}),Ee=be({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),De=be({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ce}),Oe=be({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ke={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ae=/[A-Z]/g,je=/-[a-z]/g,Me=/^data[-\w.:]+$/i;function Ne(e,t){let n=pe(t),r=t,i=b;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Me.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(je,Fe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!je.test(e)){let n=e.replace(Ae,Pe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ve}return new i(r,t)}function Pe(e){return`-`+e.toLowerCase()}function Fe(e){return e.charAt(1).toUpperCase()}var Ie=fe([xe,we,Ee,De,Oe],`html`),Le=fe([xe,Te,Ee,De,Oe],`svg`);function Re(e){return e.join(` `).trim()}var ze=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
1
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Fa as r,Fo as i,Na as a,No as o}from"./shortcut-keys-DKxNTe_m.js";import{r as s}from"./react-dom-Bph1y7z7.js";import{A as c}from"./xyflow-D7n4g6go.js";import{r as l,t as u}from"./preload-helper-oH4irX4C.js";var d=t(s(),1),f=500;function p(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[t,...e].slice(0,f);let r=e.slice();return r[n]=t,r}function m(e,t){let n=e;for(let e of t)n=p(n,e);return n}async function h(e,t){let n=await e();n.error||t([...n.data?.runs??[]])}function g(e){let t=e.pollMs??5e3,n=e.reconnectMs??2e3,r=e.setTimeout??setTimeout,i=e.clearTimeout??clearTimeout,a=e.setInterval??setInterval,o=e.clearInterval??clearInterval,s=null,c=null,l=null,u=!0,d=()=>{c!==null&&(o(c),c=null)},f=()=>{c===null&&(c=a(()=>{e.onPoll()},t))},p=()=>{if(u)return;l!==null&&(i(l),l=null);let t=`${e.protocol}//${e.host}/console/live`;s=new e.WebSocket(t),e.setStatus(`connecting`),s.onopen=()=>{u||(e.setStatus(`open`),d())},s.onmessage=t=>{if(!u)try{e.onMessage(JSON.parse(String(t.data)))}catch{}},s.onclose=()=>{u||(e.setStatus(`closed`),f(),l=r(()=>{l=null,u||p()},n))},s.onerror=()=>{s?.close()}};return{start(){u=!1,p()},stop(){u=!0,d(),l!==null&&(i(l),l=null),s?.close(),s=null}}}var _=[`console.manifest.get`];function v(){return o({queryKey:_,queryFn:async()=>{let e=await a();if(e.error)throw Error(e.error.code);return e.data?.manifest??null}})}var y=[`console.runs.list`];function ee(){return o({queryKey:y,queryFn:async()=>{let e=await r();if(e.error)throw Error(e.error.code);return e.data?.runs??[]}})}function te(e){let t=i(),[n,a]=(0,d.useState)(`connecting`);return(0,d.useEffect)(()=>{if(!e)return;let n=e=>{if(e.type===`manifest`){t.setQueryData(_,e.manifest);return}if(e.type===`manifest.diff`){t.setQueryData(_,e.after);return}if(e.type===`run`){t.setQueryData(y,t=>p(t??[],e.run));return}if(e.type===`runs.batch`){t.setQueryData(y,t=>m(t??[],e.runs));return}},i=window.location.protocol===`https:`?`wss:`:`ws:`,o=g({WebSocket:globalThis.WebSocket,host:window.location.host,protocol:i,setStatus:a,onMessage:n,onPoll:()=>{h(r,e=>{t.setQueryData(y,e)})}});return o.start(),()=>{o.stop()}},[e,t]),n}function ne(e){if(!Number.isFinite(e)||e<0)return`0μs`;if(e<1)return`${Math.round(e*1e3)}μs`;if(e<1e3){let t=Math.round(e*10)/10;return Number.isInteger(t)?`${t}ms`:`${t.toFixed(1)}ms`}let t=e/1e3,n=Math.round(t*10)/10;return Number.isInteger(n)?`${n}s`:`${n.toFixed(1)}s`}function re(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ie=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ae=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oe={};function se(e,t){return((t||oe).jsx?ae:ie).test(e)}var ce=/[ \t\n\f\r]/g;function le(e){return typeof e==`object`?e.type===`text`&&ue(e.value):ue(e)}function ue(e){return e.replace(ce,``)===``}var de=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};de.prototype.normal={},de.prototype.property={},de.prototype.space=void 0;function fe(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new de(n,r,t)}function pe(e){return e.toLowerCase()}var b=class{constructor(e,t){this.attribute=t,this.property=e}};b.prototype.attribute=``,b.prototype.booleanish=!1,b.prototype.boolean=!1,b.prototype.commaOrSpaceSeparated=!1,b.prototype.commaSeparated=!1,b.prototype.defined=!1,b.prototype.mustUseProperty=!1,b.prototype.number=!1,b.prototype.overloadedBoolean=!1,b.prototype.property=``,b.prototype.spaceSeparated=!1,b.prototype.space=void 0;var me=e({boolean:()=>x,booleanish:()=>S,commaOrSpaceSeparated:()=>E,commaSeparated:()=>T,number:()=>C,overloadedBoolean:()=>ge,spaceSeparated:()=>w}),he=0,x=D(),S=D(),ge=D(),C=D(),w=D(),T=D(),E=D();function D(){return 2**++he}var _e=Object.keys(me),ve=class extends b{constructor(e,t,n,r){let i=-1;if(super(e,t),ye(this,`space`,r),typeof n==`number`)for(;++i<_e.length;){let e=_e[i];ye(this,_e[i],(n&me[e])===me[e])}}};ve.prototype.defined=!0;function ye(e,t,n){n&&(e[t]=n)}function be(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ve(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[pe(r)]=r,n[pe(a.attribute)]=r}return new de(t,n,e.space)}var xe=be({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:S,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:w,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:C,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:w,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:S,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Se(e,t){return t in e?e[t]:t}function Ce(e,t){return Se(e,t.toLowerCase())}var we=be({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:T,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:w,autoFocus:x,autoPlay:x,blocking:w,capture:null,charSet:null,checked:x,cite:null,className:w,closedBy:null,colorSpace:null,cols:C,colSpan:C,command:null,commandFor:null,content:null,contentEditable:S,controls:x,controlsList:w,coords:C|T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:ge,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:w,height:C,hidden:ge,high:C,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:w,itemRef:w,itemScope:x,itemType:w,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:x,optimum:C,pattern:null,ping:w,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:w,required:x,reversed:x,rows:C,rowSpan:C,sandbox:w,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:S,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:T,part:w,prefix:null,property:null,results:C,security:null,unselectable:null},space:`html`,transform:Ce}),Te=be({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:E,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:w,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:T,g2:T,glyphName:T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:E,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:w,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:E,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:E,rev:E,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:E,requiredFeatures:E,requiredFonts:E,requiredFormats:E,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:E,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:E,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:E,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Se}),Ee=be({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),De=be({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ce}),Oe=be({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ke={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ae=/[A-Z]/g,je=/-[a-z]/g,Me=/^data[-\w.:]+$/i;function Ne(e,t){let n=pe(t),r=t,i=b;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Me.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(je,Fe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!je.test(e)){let n=e.replace(Ae,Pe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ve}return new i(r,t)}function Pe(e){return`-`+e.toLowerCase()}function Fe(e){return e.charAt(1).toUpperCase()}var Ie=fe([xe,we,Ee,De,Oe],`html`),Le=fe([xe,Te,Ee,De,Oe],`svg`);function Re(e){return e.join(` `).trim()}var ze=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
2
2
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function ee(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function te(){var e=[];v(e);for(var t;t=ee();)t!==!1&&(e.push(t),v(e));return e}return _(),te()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Be=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(ze());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Ve=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),He=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Be()),r=Ve();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Ue=We(`start`);function We(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ge(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?qe(e.position):`start`in e||`end`in e?qe(e):`line`in e||`column`in e?Ke(e):``}function Ke(e){return Je(e&&e.line)+`:`+Je(e&&e.column)}function qe(e){return Ke(e&&e.start)+`-`+Ke(e&&e.end)}function Je(e){return e&&typeof e==`number`?e:1}var O=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ge(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};O.prototype.file=``,O.prototype.name=``,O.prototype.reason=``,O.prototype.message=``,O.prototype.stack=``,O.prototype.column=void 0,O.prototype.line=void 0,O.prototype.ancestors=void 0,O.prototype.cause=void 0,O.prototype.fatal=void 0,O.prototype.place=void 0,O.prototype.ruleId=void 0,O.prototype.source=void 0;var Ye=t(He(),1),Xe={}.hasOwnProperty,Ze=new Map,Qe=/[A-Z]/g,$e=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),et=new Set([`td`,`th`]);function tt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=ft(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=dt(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Le:Ie,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=nt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function nt(e,t,n){if(t.type===`element`)return rt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return it(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ot(e,t,n);if(t.type===`mdxjsEsm`)return at(e,t);if(t.type===`root`)return st(e,t,n);if(t.type===`text`)return ct(e,t)}function rt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Le,e.schema=i),e.ancestors.push(t);let a=vt(e,t.tagName,!1),o=pt(e,t),s=ht(e,t);return $e.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!le(e)})),lt(e,o,a,t),ut(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function it(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}yt(e,t.position)}function at(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yt(e,t.position)}function ot(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Le,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:vt(e,t.name,!0),o=mt(e,t),s=ht(e,t);return lt(e,o,a,t),ut(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function st(e,t,n){let r={};return ut(r,ht(e,t)),e.create(t,e.Fragment,r,n)}function ct(e,t){return t.value}function lt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ut(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function dt(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function ft(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ue(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function pt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Xe.call(t.properties,i)){let a=gt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&et.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function mt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else yt(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else yt(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function ht(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ze;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=nt(e,a,o);s!==void 0&&n.push(s)}return n}function gt(e,t,n){let r=Ne(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?re(n):Re(n)),r.property===`style`){let t=typeof n==`object`?n:_t(e,String(n));return e.stylePropertyNameCase===`css`&&(t=bt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ke[r.property]||r.property:r.attribute,n]}}function _t(e,t){try{return(0,Ye.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new O("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function vt(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=se(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=se(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Xe.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);yt(e)}function yt(e,t){let n=new O("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function bt(e){let t={},n;for(n in e)Xe.call(e,n)&&(t[xt(n)]=e[n]);return t}function xt(e){let t=e.replace(Qe,St);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function St(e){return`-`+e.toLowerCase()}var k=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ct(e){return wt(e)}function wt(e){return Array.isArray(e)?Tt(e):e instanceof RegExp?e:typeof e==`object`?Et(e):e}function Tt(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=wt(e[n]);return t}function Et(e){let t={};for(let n in e)t[n]=wt(e[n]);return t}function Dt(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Ot(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Ot(e.substring(0,e.length-1)):e.substr(~t+1)}var kt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,At=class{static hasCaptures(e){return e!==null&&(kt.lastIndex=0,kt.test(e))}static replaceCaptures(e,t,n){return e.replace(kt,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function jt(e,t){return e<t?-1:+(e>t)}function Mt(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=jt(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Nt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Pt(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ft=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},It=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Vt(e),t)}static createFromParsedTheme(e,t){return Ut(e,t)}_cachedMatchRoot=new Ft(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Rt(e.parent,t.parentScopes));return n?new Bt(n.fontStyle,n.foreground,n.background):null}},Lt=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Rt(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!zt(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function zt(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Bt=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Vt(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&Nt(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Nt(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ht(l,u,e,o,s,c)}}return n}var Ht=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},A=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(A||{});function Ut(e,t){e.sort((e,t)=>{let n=jt(e.scope,t.scope);return n!==0||(n=Mt(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Wt(t),o=new Bt(n,a.getId(r),a.getId(i)),s=new qt(new Kt(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new It(a,o,s)}var Wt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Gt=Object.freeze([]),Kt=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Gt,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},qt=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Kt.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Mt(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Kt(e,t,n,r,i))}},Jt=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Xt(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Yt(e){return e}function Xt(e){return e}function Zt(e,t){let n=[],r=$t(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Qt(i)){let e=[];do e.push(i),i=r.next();while(Qt(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Qt(e){return!!e&&!!e.match(/[\w\.:]+/)}function $t(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function en(e){typeof e.dispose==`function`&&e.dispose()}var tn=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},nn=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},rn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},an=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new tn(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new rn;for(let n of e)on(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof tn){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function on(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof tn?cn({baseGrammar:a,selfGrammar:i},r):sn(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new tn(e))}function sn(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];ln([r],t,n)}}function cn(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&ln(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&ln(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function ln(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Dt({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&ln(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=hn(i);switch(a.kind){case 0:cn({...t,selfGrammar:t.baseGrammar},n);break;case 1:cn(t,n);break;case 2:sn(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?sn(a.ruleName,i,n):cn(i,n)}else a.kind===4?n.add(new nn(a.scopeName,a.ruleName)):n.add(new tn(a.scopeName))}}}var un=class{kind=0},dn=class{kind=1},fn=class{constructor(e){this.ruleName=e}kind=2},pn=class{constructor(e){this.scopeName=e}kind=3},mn=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function hn(e){if(e===`$base`)return new un;if(e===`$self`)return new dn;let t=e.indexOf(`#`);return t===-1?new pn(e):t===0?new fn(e.substring(1)):new mn(e.substring(0,t),e.substring(t+1))}var gn=/\\(\d+)/,_n=/\\(\d+)/g,vn=-1,yn=-2;function bn(e){return e}function xn(e){return e}var Sn=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=At.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=At.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Ot(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:At.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:At.replaceCaptures(this._contentName,e,t)}},Cn=class extends Sn{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},wn=class extends Sn{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new kn(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new An,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tn=class extends Sn{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new An,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},En=class extends Sn{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new kn(i,this.id),this.beginCaptures=a,this._end=new kn(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new An;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Dn=class extends Sn{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new kn(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new kn(o,yn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new An;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new An,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},On=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Cn(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new wn(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Dt({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Tn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Dn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new En(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=hn(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Tn||e instanceof En||e instanceof Dn)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},kn=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&gn.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return _n.lastIndex=0,this.source.replace(_n,(e,t)=>Pt(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},An=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new jn(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new jn(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},jn=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
3
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Mn=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Nn=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Mn(e,8),this._embeddedLanguagesMatcher=new Pn(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Mn(0,0);_getBasicScopeAttributes=new Ft(e=>new Mn(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Pn=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Pt(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Fn=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function In(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ln(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Fn(i,!0);f()}return new Fn(i,!1);function f(){let o=Rn(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===vn){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Un(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof En){let r=o;Un(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Dn){let r=o;Un(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Un(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Ln(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Dn&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Hn(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==yn){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Un(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Rn(e,t,n,r,i,a){let o=zn(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Bn(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function zn(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Vn(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Bn(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Vn(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Vn(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Hn(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Un(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));In(e,p,n&&d.start===0,d.start,f,i,!1,0),en(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Wn(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Wn=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Gn(e,t,n,r,i,a,o,s){return new Yn(e,t,n,r,i,a,o,s)}function Kn(e,t,n,r,i){let a=Zt(t,qn),o=On.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function qn(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Jn(t[r],e))return n=r+1,!0;return!1})}function Jn(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Yn=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Nn(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Xn(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Zt(e,qn);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Kn(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Kn(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(bn(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[xn(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Xn(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=On.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Qn.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Jt.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Zn.createRootAndLookUpScopeName(a,r,this):Zn.createRoot(`unknown`,r),t=new Qn(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
4
|
`;let a=this.createOnigString(e),o=a.content.length,s=new er(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=In(this,a,i,0,t,s,!0,r);return en(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Xn(e,t){return e=Ct(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Zn=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Lt.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Lt(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Lt(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Jt.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Qn=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Zn.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:xn(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Zn.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,bn(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Zn.fromExtension(r,n.contentNameScopesList))}},$n=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Zt(e,qn).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Zt(e,qn).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},er=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Jt.set(n,0,Yt(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Jt.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},tr=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Gn(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},nr=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new tr(It.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(It.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new $n(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new an(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},rr=Qn.NULL,ir=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],ar={}.hasOwnProperty;function or(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&ar.call(t,e)){let n=String(t[e]);i=ar.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var sr=/["&'<>`]/g,cr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,lr=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ur=/[|\\{}()[\]^$+*?.]/g,dr=new WeakMap;function fr(e,t){if(e=e.replace(t.subset?pr(t.subset):sr,r),t.subset||t.escapeOnly)return e;return e.replace(cr,n).replace(lr,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function pr(e){let t=dr.get(e);return t||(t=mr(e),dr.set(e,t)),t}function mr(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(ur,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var hr=/[\dA-Fa-f]/;function gr(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!hr.test(String.fromCharCode(t))?r:r+`;`}var _r=/\d/;function vr(e,t,n){let r=`&#`+String(e);return n&&t&&!_r.test(String.fromCharCode(t))?r:r+`;`}var yr=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),br={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},xr=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Sr={}.hasOwnProperty,Cr={},wr;for(wr in br)Sr.call(br,wr)&&(Cr[br[wr]]=wr);var Tr=/[^\dA-Za-z]/;function Er(e,t,n,r){let i=String.fromCharCode(e);if(Sr.call(Cr,i)){let e=Cr[i],a=`&`+e;return n&&yr.includes(e)&&!xr.includes(e)&&(!r||t&&t!==61&&Tr.test(String.fromCharCode(t)))?a:a+`;`}return``}function Dr(e,t,n){let r=gr(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Er(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=vr(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Or(e,t){return fr(e,Object.assign({format:Dr},t))}var kr=/^>|^->|<!--|-->|--!>|<!-$/g,Ar=[`>`],jr=[`<`,`>`];function Mr(e,t,n,r){return r.settings.bogusComments?`<?`+Or(e.value,Object.assign({},r.settings.characterReferences,{subset:Ar}))+`>`:`<!--`+e.value.replace(kr,i)+`-->`;function i(e){return Or(e,Object.assign({},r.settings.characterReferences,{subset:jr}))}}function Nr(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Pr(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var j=Lr(1),Fr=Lr(-1),Ir=[];function Lr(e){return t;function t(t,n,r){let i=t?t.children:Ir,a=(n||0)+e,o=i[a];if(!r)for(;o&&le(o);)a+=e,o=i[a];return o}}var Rr={}.hasOwnProperty;function zr(e){return t;function t(t,n,r){return Rr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Br=zr({body:Ur,caption:Vr,colgroup:Vr,dd:qr,dt:Kr,head:Vr,html:Hr,li:Gr,optgroup:Yr,option:Xr,p:Wr,rp:Jr,rt:Jr,tbody:Qr,td:ti,tfoot:$r,th:ti,thead:Zr,tr:ei});function Vr(e,t,n){let r=j(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&le(r.value.charAt(0)))}function Hr(e,t,n){let r=j(n,t);return!r||r.type!==`comment`}function Ur(e,t,n){let r=j(n,t);return!r||r.type!==`comment`}function Wr(e,t,n){let r=j(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Gr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Kr(e,t,n){let r=j(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function qr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function Jr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Yr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Xr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Zr(e,t,n){let r=j(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Qr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function $r(e,t,n){return!j(n,t)}function ei(e,t,n){let r=j(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ti(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ni=zr({body:ai,colgroup:oi,head:ii,html:ri,tbody:si});function ri(e){let t=j(e,-1);return!t||t.type!==`comment`}function ii(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ai(e){let t=j(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&le(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function oi(e,t,n){let r=Fr(n,t),i=j(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Br(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function si(e,t,n){let r=Fr(n,t),i=j(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Br(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var ci={name:[[`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ar as e,Dr as t,Gi as n,Ri as r,Ui as i,ii as a,ri as o,ti as s,ua as c}from"./shortcut-keys-DKxNTe_m.js";function l(e){switch((e??``).toUpperCase()){case`GET`:case`HEAD`:case`DELETE`:return!1;default:return!0}}function u(e){switch((e??``).toUpperCase()){case`GET`:return 0;case`POST`:return 1;case`QUERY`:return 2;case`PUT`:case`PATCH`:return 3;case`DELETE`:return 4;case`HEAD`:return 5;case`OPTIONS`:return 6;default:return e?7:8}}function d(l){switch(l.toUpperCase()){case`GET`:return c;case`QUERY`:return i;case`POST`:return t;case`PUT`:return o;case`PATCH`:return r;case`DELETE`:return s;case`HEAD`:return a;case`OPTIONS`:return n;default:return e}}function f(e){switch(e.toUpperCase()){case`GET`:return`border-emerald-500/35 bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`POST`:return`border-sky-500/35 bg-sky-500/15 text-sky-700 dark:text-sky-400`;case`PUT`:return`border-amber-500/35 bg-amber-500/15 text-amber-800 dark:text-amber-400`;case`PATCH`:return`border-violet-500/35 bg-violet-500/15 text-violet-700 dark:text-violet-400`;case`DELETE`:return`border-rose-500/35 bg-rose-500/15 text-rose-700 dark:text-rose-400`;case`HEAD`:return`border-slate-500/35 bg-slate-500/15 text-slate-700 dark:text-slate-300`;case`OPTIONS`:return`border-zinc-500/35 bg-zinc-500/15 text-zinc-700 dark:text-zinc-300`;case`QUERY`:return`border-emerald-500/35 bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;default:return`border-border bg-muted text-muted-foreground`}}function p(e){switch(e.toUpperCase()){case`GET`:return`bg-emerald-500`;case`POST`:return`bg-sky-500`;case`PUT`:return`bg-amber-500`;case`PATCH`:return`bg-violet-500`;case`DELETE`:return`bg-rose-500`;case`HEAD`:return`bg-slate-400`;case`OPTIONS`:return`bg-zinc-400`;case`QUERY`:return`bg-emerald-500`;default:return`bg-muted-foreground`}}export{u as a,p as i,l as n,d as r,f as t};
|