@distrohelena/canton-explorer 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.api-8w-mShFJ.js","assets/editor-C5uazxST.css"])))=>i.map(i=>d[i]);
2
+ import{A as e,C as t,D as n,E as r,M as i,N as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,i as _,j as v,k as y,l as b,m as x,n as S,o as ee,p as C,r as te,s as ne,t as w,u as T,v as E,w as D,x as re,y as O}from"./index-Yd5H2RaX.js";var k={class:`debugger-control-panel`,"data-testid":`debugger-control-panel`,"aria-label":`Debugger controls`},A={class:`debugger-control-panel__actions`},j=[`disabled`],M=[`disabled`],N=[`disabled`],P=[`disabled`],F=[`disabled`],I=[`disabled`],ie=O({__name:`DebuggerControlPanel`,props:{actionLoading:{type:Boolean},isTerminal:{type:Boolean},currentStepIndex:{}},emits:[`drag-start`,`refresh`,`action`],setup(e){return(n,r)=>(t(),h(`section`,k,[C(`div`,{class:`debugger-control-panel__handle`,"data-testid":`debugger-control-panel-handle`,onPointerdown:r[0]||=T(e=>n.$emit(`drag-start`,e),[`stop`,`prevent`])},[...r[7]||=[C(`span`,{class:`debugger-control-panel__title`},`Replay Controls`,-1),C(`span`,{class:`debugger-control-panel__meta`},`drag to reposition`,-1)]],32),C(`div`,A,[C(`button`,{type:`button`,class:`debugger-control-panel__button`,disabled:e.actionLoading||e.currentStepIndex<=0,onClick:r[1]||=e=>n.$emit(`action`,`step-back`)},` Step Back `,8,j),C(`button`,{type:`button`,class:`debugger-control-panel__button`,disabled:e.actionLoading,onClick:r[2]||=e=>n.$emit(`refresh`)},` Refresh `,8,M),C(`button`,{type:`button`,class:`debugger-control-panel__button`,disabled:e.actionLoading||e.isTerminal,onClick:r[3]||=e=>n.$emit(`action`,`step-into`)},` Step Into `,8,N),C(`button`,{type:`button`,class:`debugger-control-panel__button`,disabled:e.actionLoading||e.isTerminal,onClick:r[4]||=e=>n.$emit(`action`,`step-over`)},` Step Over `,8,P),C(`button`,{type:`button`,class:`debugger-control-panel__button`,disabled:e.actionLoading||e.isTerminal,onClick:r[5]||=e=>n.$emit(`action`,`step-out`)},` Step Out `,8,F),C(`button`,{type:`button`,class:`debugger-control-panel__button`,disabled:e.actionLoading||e.isTerminal,onClick:r[6]||=e=>n.$emit(`action`,`continue`)},` Continue `,8,I)])]))}}),ae={class:`debugger-event-list`,"data-testid":`debugger-event-list`},oe={class:`debugger-event-list__header`},L={class:`debugger-event-list__count`},R={class:`debugger-event-list__tabs`,role:`tablist`,"aria-label":`Ledger event views`},se=[`aria-selected`],z=[`aria-selected`],B={key:0,class:`debugger-event-list__empty`},V={key:1,class:`debugger-event-list__empty`},H={key:2,class:`debugger-event-list__empty`},U={key:3,class:`debugger-event-list__items`},W=[`data-testid`,`onClick`],G={class:`debugger-event-list__ordinal`},ce={class:`debugger-event-list__summary`},K={class:`debugger-event-list__location`},q={key:4,class:`debugger-event-list__items`},J=[`data-testid`,`aria-expanded`,`onClick`],le={class:`debugger-event-list__ordinal`},ue={class:`debugger-event-list__summary`},de={class:`debugger-event-list__location`},Y=[`data-testid`],X={class:`debugger-event-list__detail-grid`},Z={class:`debugger-event-list__detail-block`},fe={class:`debugger-event-list__detail-block`},pe=O({__name:`DebuggerEventList`,props:{realEvents:{},replayEvents:{},currentStepId:{},loading:{type:Boolean}},emits:[`selectStep`],setup(e,{emit:n}){let r=e,i=n,s=o(`real`),l=o(new Set),u=m(()=>s.value===`real`?r.realEvents.length:r.replayEvents.length);function d(e){let t=e.templateId?.entityName??`unknown-template`,n=e.choice?`.${e.choice}`:``,r=e.targetContractId??e.createdContractId;return[e.kind??`event`,`${t}${n}`,r].filter(Boolean).join(` `)}function f(e){e&&i(`selectStep`,e)}function _(e){return e.stepId??`event-${e.stepIndex}`}function y(e){return l.value.has(_(e))}function b(e){let t=new Set(l.value),n=_(e);t.has(n)?t.delete(n):t.add(n),l.value=t}function x(e){if(e==null)return`n/a`;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}return c(()=>r.replayEvents.map(e=>_(e)),e=>{let t=new Set(e);l.value=new Set([...l.value].filter(e=>t.has(e)))}),(n,i)=>(t(),h(`section`,ae,[C(`div`,oe,[i[2]||=C(`h3`,null,`Ledger Events`,-1),C(`span`,L,a(u.value)+` events`,1)]),C(`div`,R,[C(`button`,{type:`button`,role:`tab`,class:v([`debugger-event-list__tab`,{"debugger-event-list__tab--active":s.value===`real`}]),"aria-selected":s.value===`real`,onClick:i[0]||=e=>s.value=`real`},` Real Events `,10,se),C(`button`,{type:`button`,role:`tab`,class:v([`debugger-event-list__tab`,{"debugger-event-list__tab--active":s.value===`replay`}]),"aria-selected":s.value===`replay`,onClick:i[1]||=e=>s.value=`replay`},` Replay Events `,10,z)]),e.loading?(t(),h(`p`,B,`Loading ledger events…`)):s.value===`real`&&e.realEvents.length===0?(t(),h(`p`,V,` No real ledger events are available for this update. `)):s.value===`replay`&&e.replayEvents.length===0?(t(),h(`p`,H,` No replay ledger events were emitted in this session. `)):s.value===`real`?(t(),h(`ol`,U,[(t(!0),h(p,null,D(r.realEvents,n=>(t(),h(`li`,{key:n.stepId??`real-event-${n.stepIndex}`,class:`debugger-event-list__item`},[C(`button`,{type:`button`,class:v([`debugger-event-list__button`,{"debugger-event-list__button--active":n.stepId===e.currentStepId}]),"data-testid":`real-debugger-event-${n.stepIndex}`,onClick:e=>f(n.stepId)},[C(`span`,G,`#`+a(n.eventOrdinal??n.stepIndex),1),C(`span`,ce,a(d(n)),1),C(`span`,K,a(n.sourceLocation?.startLine??`n/a`),1)],10,W)]))),128))])):(t(),h(`ol`,q,[(t(!0),h(p,null,D(r.replayEvents,e=>(t(),h(`li`,{key:_(e),class:`debugger-event-list__item`},[C(`button`,{type:`button`,class:v([`debugger-event-list__button`,{"debugger-event-list__button--expanded":y(e)}]),"data-testid":`debugger-event-${e.stepIndex}`,"aria-expanded":y(e),onClick:t=>b(e)},[C(`span`,le,`#`+a(e.eventOrdinal??e.stepIndex),1),C(`span`,ue,a(d(e)),1),C(`span`,de,a(e.sourceLocation?.startLine??`n/a`),1)],10,J),y(e)?(t(),h(`div`,{key:0,class:`debugger-event-list__details`,"data-testid":`debugger-event-details-${e.stepIndex}`},[C(`dl`,X,[C(`div`,null,[i[3]||=C(`dt`,null,`Kind`,-1),C(`dd`,null,a(e.kind??`n/a`),1)]),C(`div`,null,[i[4]||=C(`dt`,null,`Template`,-1),C(`dd`,null,a(e.templateId?.entityName??`n/a`),1)]),C(`div`,null,[i[5]||=C(`dt`,null,`Choice`,-1),C(`dd`,null,a(e.choice??`n/a`),1)]),C(`div`,null,[i[6]||=C(`dt`,null,`Contract`,-1),C(`dd`,null,a(e.targetContractId??e.createdContractId??`n/a`),1)]),C(`div`,null,[i[7]||=C(`dt`,null,`Phase`,-1),C(`dd`,null,a(e.phase),1)]),C(`div`,null,[i[8]||=C(`dt`,null,`Source`,-1),C(`dd`,null,a(e.sourceLocation?.startLine??`n/a`),1)])]),C(`div`,Z,[i[9]||=C(`h4`,null,`Choice Argument`,-1),C(`pre`,null,a(x(e.choiceArgument)),1)]),C(`div`,fe,[i[10]||=C(`h4`,null,`Payload`,-1),C(`pre`,null,a(x(e.payload)),1)])],8,Y)):g(``,!0)]))),128))]))]))}}),me={class:`debugger-scope-panel`,"data-testid":`debugger-scope-panel`},he={class:`debugger-scope-panel__header`},ge={class:`debugger-scope-panel__count`},_e={key:0,class:`debugger-scope-panel__empty`},ve=[`aria-expanded`,`onClick`],ye={class:`debugger-scope-panel__scope-header`},be={class:`debugger-scope-panel__scope-meta`},xe={class:`debugger-scope-panel__scope-id`},Se={class:`debugger-scope-panel__scope-chevron`,"aria-hidden":`true`},Ce={key:0,class:`debugger-scope-panel__variables`},Q={class:`debugger-scope-panel__variable-meta`},we={class:`debugger-scope-panel__kind`},Te={class:`debugger-scope-panel__value-block`},Ee={key:0,class:`debugger-scope-panel__contract-type`},De={key:1,class:`debugger-scope-panel__empty`},Oe=O({__name:`DebuggerScopePanel`,props:{scopes:{},nodeId:{}},setup(n){let i=n,s=o(new Set);function u(e,t){return t===`contractId`&&e===`selfContractId`?`self`:e??`value`}function d(e,t){let n=e??t??`Frame`;if(!n.startsWith(`$`))return n;let r=n.replace(/^\$+/,``),i=/^sc_(.+?)_(\d+)$/.exec(r);return i?`generated helper from ${i[1]}`:`generated helper`}function f(e,t){return e!==`contractId`||!i.nodeId||!t?null:`/nodes/${encodeURIComponent(i.nodeId)}/contracts/${encodeURIComponent(t)}`}function m(e,t){return e!==`party`||!t?null:`/parties/${encodeURIComponent(t)}`}function _(e){return e.frameId??e.name??`scope`}function v(e){return s.value.has(_(e))}function y(e){let t=new Set(s.value),n=_(e);t.has(n)?t.delete(n):t.add(n),s.value=t}return c(()=>i.scopes.map(e=>_(e)),e=>{let t=new Set(e);s.value=new Set([...s.value].filter(e=>t.has(e)))}),(i,o)=>(t(),h(`section`,me,[C(`div`,he,[o[0]||=C(`h3`,null,`In-Scope Variables`,-1),C(`span`,ge,a(n.scopes.length)+` frames`,1)]),n.scopes.length===0?(t(),h(`p`,_e,` No scoped variables are available at this step. `)):g(``,!0),(t(!0),h(p,null,D(n.scopes,n=>(t(),h(`div`,{key:_(n),class:`debugger-scope-panel__scope`},[C(`button`,{type:`button`,class:`debugger-scope-panel__scope-toggle`,"aria-expanded":!v(n),onClick:e=>y(n)},[C(`div`,ye,[C(`h4`,null,a(d(n.name,n.frameId)),1),C(`div`,be,[C(`span`,xe,a(n.frameId??`anonymous`),1),C(`span`,Se,a(v(n)?`▸`:`▾`),1)])])],8,ve),!v(n)&&n.variables.length>0?(t(),h(`ul`,Ce,[(t(!0),h(p,null,D(n.variables,i=>(t(),h(`li`,{key:`${n.frameId??`scope`}:${i.name??`variable`}`,class:`debugger-scope-panel__variable`},[C(`div`,Q,[C(`strong`,null,a(u(i.name,i.kind)),1),C(`span`,we,a(i.kind??`value`),1)]),C(`div`,Te,[C(`code`,null,[f(i.kind,i.value)?(t(),x(e(ne),{key:0,class:`debugger-scope-panel__value-link`,to:f(i.kind,i.value)??``,target:`_blank`,rel:`noreferrer`},{default:r(()=>[l(a(i.value??`null`),1)]),_:2},1032,[`to`])):m(i.kind,i.value)?(t(),x(e(ne),{key:1,class:`debugger-scope-panel__value-link`,to:m(i.kind,i.value)??``,target:`_blank`,rel:`noreferrer`},{default:r(()=>[l(a(i.value??`null`),1)]),_:2},1032,[`to`])):(t(),h(p,{key:2},[l(a(i.value??`null`),1)],64))]),i.kind===`contractId`&&i.contractType?(t(),h(`div`,Ee,a(i.contractType),1)):g(``,!0)])]))),128))])):v(n)?g(``,!0):(t(),h(`p`,De,`No variables in this frame.`))]))),128))]))}});function ke(e){return new Worker(`/assets/editor.worker-DQJwLooG.js`,{name:e?.name})}function Ae(e){return new Worker(`/assets/json.worker-DR52qCex.js`,{name:e?.name})}function je(e){return new Worker(`/assets/css.worker-BKx7BC4h.js`,{name:e?.name})}function Me(e){return new Worker(`/assets/html.worker-ChRLLxCa.js`,{name:e?.name})}function Ne(e){return new Worker(`/assets/ts.worker-Cqvg7802.js`,{name:e?.name})}var Pe=`canton-explorer-noctis-uva`,Fe=`daml`,Ie=null;function Le(){let e=globalThis;e.MonacoEnvironment||={getWorker(e,t){switch(t){case`json`:return new Ae;case`css`:case`scss`:case`less`:return new je;case`html`:case`handlebars`:case`razor`:return new Me;case`typescript`:case`javascript`:return new Ne;default:return new ke}}}}function Re(e){e.languages.register({id:Fe,extensions:[`.daml`],aliases:[`DAML`,`daml`]}),e.languages.setLanguageConfiguration(Fe,{comments:{lineComment:`--`,blockComment:[`{-`,`-}`]},brackets:[[`{`,`}`],[`[`,`]`],[`(`,`)`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`}],surroundingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`}],indentationRules:{increaseIndentPattern:/^.*(\b(where|of|do|let|then|else)\b.*|[\[{(])$/,decreaseIndentPattern:/^\s*[\]})]/}}),e.languages.setMonarchTokensProvider(Fe,{defaultToken:``,tokenPostfix:`.daml`,keywords:`module.where.import.as.qualified.hiding.template.with.signatory.observer.controller.choice.nonconsuming.key.maintainer.archive.fetch.fetchByKey.lookupByKey.to.do.let.in.if.then.else.case.of.data.type.newtype.class.instance.deriving.interface.view.method.exception.message.exercise.exerciseByKey.create.createAndExercise.submit.submitMustFail.return.forall.from.when.unless.has.implements.interface.this.self.enum.struct`.split(`.`),builtins:[`True`,`False`,`None`,`Some`,`Optional`,`Text`,`Int`,`Decimal`,`Numeric`,`Bool`,`Party`,`Time`,`Date`,`RelTime`,`ContractId`,`Update`,`Scenario`,`Any`,`AnyException`,`List`,`Map`,`TextMap`,`Unit`],operators:[`=`,`->`,`<-`,`=>`,`::`,`:`,`\\`,`|`,`.`,`,`,`;`,`==`,`/=`,`<`,`>`,`<=`,`>=`,`&&`,`||`,`+`,`-`,`*`,`/`,`++`,`$`],escapes:/\\(?:[abfnrtv\\\"']|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/[ \t\r\n]+/,`white`],[/--.*$/,`comment`],[/\{-/,{token:`comment`,next:`@comment`}],[/"([^"\\]|\\.)*$/,`string.invalid`],[/"/,{token:`string.quote`,bracket:`@open`,next:`@string`}],[/'[^\\']'/,`string`],[/'/,`string.invalid`],[/\b[0-9][0-9_]*(\.[0-9_]+)?\b/,`number`],[/\b[A-Z][\w']*(\.[A-Z][\w']*)*\b/,{cases:{"@builtins":`type`,"@default":`type.identifier`}}],[/\b[a-z_][\w']*\b/,{cases:{"@keywords":`keyword`,"@default":`identifier`}}],[/[{}()[\]]/,`@brackets`],[/[;,.]/,`delimiter`],[/[:!#$%&*+./<=>?@\\^|\-~]+/,{cases:{"@operators":`operator`,"@default":`operator`}}]],comment:[[/[^\{-]+/,`comment`],[/\{-/,{token:`comment`,next:`@push`}],[/-\}/,{token:`comment`,next:`@pop`}],[/[\{-]/,`comment`]],string:[[/[^\\"]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/"/,{token:`string.quote`,bracket:`@close`,next:`@pop`}]]}})}function ze(e){e.editor.defineTheme(Pe,{base:`vs-dark`,inherit:!0,rules:[{token:``,foreground:`D8D3E8`,background:`252845`},{token:`comment`,foreground:`A39DBA`,fontStyle:`italic`},{token:`string`,foreground:`7FE6D7`},{token:`string.escape`,foreground:`FAD7A0`},{token:`number`,foreground:`A89BFF`},{token:`keyword`,foreground:`FFB86C`},{token:`operator`,foreground:`F2EFFA`},{token:`delimiter`,foreground:`D8D3E8`},{token:`type`,foreground:`7AD7FF`},{token:`type.identifier`,foreground:`7AD7FF`},{token:`identifier`,foreground:`F0E9FF`},{token:`identifier.daml`,foreground:`F0E9FF`},{token:`keyword.daml`,foreground:`FFB86C`},{token:`type.identifier.daml`,foreground:`7AD7FF`},{token:`variable`,foreground:`F0E9FF`},{token:`variable.parameter`,foreground:`FFCAA1`,fontStyle:`italic`},{token:`function`,foreground:`7AD7FF`},{token:`function.call`,foreground:`7FE6D7`},{token:`tag`,foreground:`FFB86C`},{token:`attribute.name`,foreground:`FFCAA1`}],colors:{"editor.background":`#252845`,"editor.foreground":`#D8D3E8`,"editorLineNumber.foreground":`#787291`,"editorLineNumber.activeForeground":`#D8D3E8`,"editorCursor.foreground":`#FFB86C`,"editor.selectionBackground":`#3A3E67`,"editor.inactiveSelectionBackground":`#303356`,"editor.lineHighlightBackground":`#2B2E4C`,"editorLineNumber.dimmedForeground":`#605B77`,"editorIndentGuide.background1":`#3A3D59`,"editorIndentGuide.activeBackground1":`#5A5E84`,"editorWhitespace.foreground":`#4A4E72`,"editorGutter.background":`#252845`,"editorWidget.background":`#2B2F4D`,"editorWidget.border":`#484C6B`,"scrollbarSlider.background":`#52577466`,"scrollbarSlider.hoverBackground":`#666C8C88`,"scrollbarSlider.activeBackground":`#7A82A699`}})}async function Be(){return Ie||=w(()=>import(`./editor.api-8w-mShFJ.js`).then(e=>(Le(),Re(e),ze(e),e)),__vite__mapDeps([0,1])),Ie}var Ve={class:`monaco-surface`},He={key:0,class:`monaco-surface__state monaco-surface__state--loading`},Ue={key:1,class:`monaco-surface__state monaco-surface__state--error`},We=[`aria-label`],Ge=O({__name:`MonacoCodeSurface`,props:{modelValue:{},language:{default:`plaintext`},theme:{default:`dark`},readOnly:{type:Boolean,default:!0},ariaLabel:{default:`Code editor`},highlightRange:{default:null}},setup(e){let r=e,i=o(null),l=o(!0),u=o(null),d=y(null),f=y(null),p=y(null),m=null,_=[];function v(e){return e===`light`?`vs`:Pe}async function x(){if(i.value){l.value=!0,u.value=null;try{let e=await Be();if(!i.value)return;d.value=e,p.value=e.editor.createModel(r.modelValue,r.language),e.editor.setTheme(v(r.theme)),f.value=e.editor.create(i.value,{model:p.value,readOnly:r.readOnly,automaticLayout:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,lineNumbers:`on`,wordWrap:`on`,glyphMargin:!0,renderLineHighlight:`all`,fontSize:13,tabSize:2,ariaLabel:r.ariaLabel}),m=new ResizeObserver(e=>{let t=e[0],n=t?.contentRect.width??i.value?.clientWidth??0,r=t?.contentRect.height??i.value?.clientHeight??0;n>0&&r>0&&f.value?.layout({width:n,height:r})}),m.observe(i.value),S()}catch(e){u.value=e instanceof Error?e.message:`Failed to load Monaco editor`}finally{l.value=!1}}}function S(){let e=d.value,t=f.value;if(!e||!t)return;if(!r.highlightRange){_=t.deltaDecorations(_,[]);return}let{startLine:n,startColumn:i,endLine:a,endColumn:o}=r.highlightRange;_=t.deltaDecorations(_,[{range:new e.Range(n,i,a,o),options:{className:`monaco-surface__highlight`,isWholeLine:!1}},{range:new e.Range(n,1,n,1),options:{isWholeLine:!0,className:`monaco-surface__execution-line`,linesDecorationsClassName:`monaco-surface__execution-line-gutter`}}]),t.revealLineInCenter(n)}return c(()=>r.modelValue,e=>{!p.value||e===p.value.getValue()||p.value.setValue(e)}),c(()=>r.language,e=>{!p.value||!d.value||d.value.editor.setModelLanguage(p.value,e)}),c(()=>r.theme,e=>{d.value?.editor.setTheme(v(e))}),c(()=>r.readOnly,e=>{f.value?.updateOptions({readOnly:e})}),c(()=>r.highlightRange,()=>{S()},{deep:!0}),s(()=>{x()}),re(()=>{m?.disconnect(),f.value&&(_=f.value.deltaDecorations(_,[])),f.value?.dispose(),p.value?.dispose()}),(r,o)=>(t(),h(`div`,Ve,[l.value?(t(),h(`div`,He,` Loading editor... `)):u.value?(t(),h(`div`,Ue,a(u.value),1)):g(``,!0),n(C(`div`,{ref_key:`container`,ref:i,class:`monaco-surface__editor`,"aria-label":e.ariaLabel},null,8,We),[[b,!l.value&&!u.value]])]))}}),Ke={class:`debugger-view`},qe={key:0,class:`node-detail__message node-detail__message--error`},Je={key:1,class:`node-detail__message`},Ye={class:`debugger-view__editor-shell`,"data-testid":`debugger-editor-shell`},Xe={class:`debugger-view__summary`,"data-testid":`debugger-summary`},Ze={class:`debugger-view__summary-columns`},Qe={class:`debugger-view__summary-column debugger-view__summary-column--context`,"data-testid":`debugger-summary-context`},$e={class:`debugger-view__summary-header`},et={class:`debugger-view__panel-meta`},tt={class:`debugger-view__signal-row`},nt={class:`debugger-view__status`},rt={class:`debugger-view__status`},it={class:`debugger-view__summary-section`},at={class:`debugger-view__panel-copy`},ot={class:`detail-grid debugger-view__summary-grid`},st={class:`update-detail__id`},ct={class:`debugger-view__summary-item debugger-view__summary-item--canonical`},lt={class:`update-detail__canonical`},ut={key:1},dt={class:`update-detail__canonical`},ft={class:`debugger-view__summary-column debugger-view__summary-column--events`,"data-testid":`debugger-summary-events`},pt=14,mt=320,ht=420,gt=48,$=16,_t=O({__name:`DebuggerView`,setup(n){let p=f(),v=o(`dark`),y=o(null),b=o([]),w=o(!1),T=o(!1),D=o(!1),O=o(null),k=o(null),A=o(null),j=o(null),M=o(typeof window>`u`?1280:window.innerWidth),N=o(null),P=null,F=null,I=null,ae=0,oe=0;function L(){v.value=document.documentElement.dataset.theme===`light`?`light`:`dark`}let R=m(()=>M.value<=980);function se(e){let t=k.value;if(!t)return e;let n=Math.max(ht,t.clientWidth-mt-pt);return Math.min(Math.max(e,ht),n)}function z(e){j.value=se(e)}function B(){F=null,window.removeEventListener(`pointermove`,q),window.removeEventListener(`pointerup`,J),window.removeEventListener(`pointercancel`,J),document.body.classList.remove(`debugger-view--resizing`)}function V(e){let t=k.value,n=A.value;if(!t||!n)return e;let r=Math.max($,t.clientWidth-n.offsetWidth-$),i=Math.max($,t.clientHeight-n.offsetHeight-$);return{x:Math.min(Math.max(e.x,$),r),y:Math.min(Math.max(e.y,$),i)}}function H(){if(R.value)return;let e=k.value,t=A.value;if(!e||!t)return;let n=Math.max($,Math.round((e.clientWidth-t.offsetWidth)/2));N.value=V({x:n,y:$})}function U(){I=null,window.removeEventListener(`pointermove`,W),window.removeEventListener(`pointerup`,G),window.removeEventListener(`pointercancel`,G),document.body.classList.remove(`debugger-view--dragging-panel`)}function W(e){let t=k.value;if(!t)return;let n=t.getBoundingClientRect();N.value=V({x:e.clientX-n.left-ae,y:e.clientY-n.top-oe})}function G(e){e&&I!==null&&e.pointerId!==I||U()}function ce(e){if(R.value||!A.value)return;let t=A.value.getBoundingClientRect();I=e.pointerId,ae=e.clientX-t.left,oe=e.clientY-t.top,document.body.classList.add(`debugger-view--dragging-panel`),window.addEventListener(`pointermove`,W),window.addEventListener(`pointerup`,G),window.addEventListener(`pointercancel`,G)}function K(){if(M.value=window.innerWidth,R.value){U();return}if(N.value===null){d().then(()=>{H()});return}N.value=V(N.value)}function q(e){let t=k.value;if(!t)return;let n=t.getBoundingClientRect();z(e.clientX-n.left)}function J(e){e&&F!==null&&e.pointerId!==F||B()}function le(e){window.innerWidth<=980||(F=e.pointerId,document.body.classList.add(`debugger-view--resizing`),window.addEventListener(`pointermove`,q),window.addEventListener(`pointerup`,J),window.addEventListener(`pointercancel`,J),q(e))}function ue(e){let t=k.value;if(!t)return;let n=Math.max(ht,Math.round((t.clientWidth-pt)*.6));z((j.value??n)+e)}function de(e){window.innerWidth<=980||(e.key===`ArrowLeft`&&(e.preventDefault(),ue(-48)),e.key===`ArrowRight`&&(e.preventDefault(),ue(gt)))}let Y=m(()=>{let e=p.query.nodeId;return typeof e==`string`&&e.trim().length>0?e.trim():null}),X=m(()=>{let e=p.query.updateId;return typeof e==`string`&&e.trim().length>0?e.trim():null}),Z=m(()=>{let e=p.query.eventOffset;return typeof e==`string`&&e.trim().length>0?e.trim():null}),fe=m(()=>y.value?.source?.content?y.value.source.content:y.value?JSON.stringify(y.value.currentStep,null,2):``),me=m(()=>(y.value?.source?.path?.toLowerCase()??``).endsWith(`.daml`)?`daml`:`plaintext`),he=m(()=>{let e=y.value?.source;return!e||e.startLine===null||e.startColumn===null||e.endLine===null||e.endColumn===null?null:{startLine:e.startLine,startColumn:e.startColumn,endLine:e.endLine,endColumn:e.endColumn}}),ge=m(()=>y.value?`${y.value.currentStepIndex+1} / ${Math.max(1,y.value.stepCount)}`:`Not loaded`),_e=m(()=>y.value?y.value.currentStep.phase.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase()):`n/a`),ve=m(()=>!y.value?.nodeId||!y.value.offset?null:`/nodes/${encodeURIComponent(y.value.nodeId)}/updates/${encodeURIComponent(y.value.offset)}`),ye=m(()=>y.value?.currentStep.scopes??[]),be=m(()=>b.value),xe=m(()=>y.value?b.value.filter(e=>e.stepIndex<=y.value.currentStepIndex):[]),Se=m(()=>j.value===null?void 0:{gridTemplateColumns:`${j.value}px ${pt}px minmax(${mt}px, 1fr)`}),Ce=m(()=>R.value?{top:`${$}px`,left:`${$}px`,right:`${$}px`}:N.value===null?{visibility:`hidden`}:{left:`${N.value.x}px`,top:`${N.value.y}px`});async function Q(e){D.value=!0;try{let t=await te(e);b.value=t.replayEvents}finally{D.value=!1}}async function we(){if(!Y.value||!Z.value){y.value=null,O.value=`Open the debugger from an update detail page to launch a replay session.`;return}w.value=!0,O.value=null;try{let e=await S(Y.value,Z.value);y.value=e,await Q(e.sessionId)}catch(e){O.value=e instanceof Error?e.message:`Unknown error`,y.value=null,b.value=[]}finally{w.value=!1}}async function Te(e){if(y.value?.sessionId){T.value=!0,O.value=null;try{let t=await ee(y.value.sessionId,e);y.value=t,await Q(t.sessionId)}catch(e){O.value=e instanceof Error?e.message:`Unknown error`}finally{T.value=!1}}}async function Ee(){if(y.value?.sessionId){w.value=!0,O.value=null;try{let e=await _(y.value.sessionId);y.value=e,await Q(e.sessionId)}catch(e){O.value=e instanceof Error?e.message:`Unknown error`}finally{w.value=!1}}}async function De(e){if(y.value?.sessionId){T.value=!0,O.value=null;try{let t=await u(y.value.sessionId,e);y.value=t,await Q(t.sessionId)}catch(e){O.value=e instanceof Error?e.message:`Unknown error`}finally{T.value=!1}}}return c([Y,Z],()=>{N.value=null,we()}),c(()=>y.value?.sessionId,async e=>{e&&(await d(),H())}),s(()=>{L(),M.value=window.innerWidth,P=new MutationObserver(()=>{L()}),P.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),window.addEventListener(`resize`,K),we()}),re(()=>{P?.disconnect(),B(),U(),window.removeEventListener(`resize`,K)}),(n,o)=>(t(),h(`section`,Ke,[O.value?(t(),h(`p`,qe,a(O.value),1)):w.value&&!y.value?(t(),h(`p`,Je,`Loading debugger session...`)):g(``,!0),y.value?(t(),h(`div`,{key:2,ref_key:`workspace`,ref:k,class:`debugger-view__workspace`,style:i(Se.value),"data-testid":`debugger-workspace`},[C(`div`,{ref_key:`controlPanel`,ref:A,class:`debugger-view__floating-controls`,style:i(Ce.value),"data-testid":`debugger-floating-controls`},[E(ie,{"action-loading":T.value,"is-terminal":y.value.isTerminal,"current-step-index":y.value.currentStepIndex,onDragStart:ce,onRefresh:Ee,onAction:Te},null,8,[`action-loading`,`is-terminal`,`current-step-index`])],4),C(`section`,Ye,[E(Ge,{"model-value":fe.value,theme:v.value,language:me.value,"highlight-range":he.value,"aria-label":`DAML debugger code surface`},null,8,[`model-value`,`theme`,`language`,`highlight-range`])]),C(`div`,{class:`debugger-view__divider`,role:`separator`,"aria-label":`Resize editor panel`,"aria-orientation":`vertical`,tabindex:`0`,"data-testid":`debugger-editor-divider`,onPointerdown:le,onKeydown:de},null,32),C(`aside`,Xe,[C(`div`,Ze,[C(`div`,Qe,[C(`div`,$e,[C(`div`,et,[C(`div`,tt,[o[0]||=C(`span`,{class:`debugger-view__signal`},`Replay Session`,-1),C(`span`,nt,a(ge.value),1),C(`span`,rt,a(_e.value),1)]),o[1]||=C(`h2`,null,`Launch Context`,-1)])]),C(`div`,it,[o[2]||=C(`h3`,null,`Execution Script`,-1),C(`p`,at,a(y.value.source?.path??`Source mapping unavailable for this step.`),1)]),C(`dl`,ot,[C(`div`,null,[o[3]||=C(`dt`,null,`Node`,-1),C(`dd`,null,a(y.value.nodeId),1)]),C(`div`,null,[o[4]||=C(`dt`,null,`Event Offset`,-1),C(`dd`,st,a(y.value.offset),1)]),C(`div`,ct,[o[5]||=C(`dt`,null,`Canonical Update ID`,-1),C(`dd`,lt,[ve.value&&(y.value.updateId??X.value)?(t(),x(e(ne),{key:0,class:`update-detail__debug-action`,to:ve.value,target:`_blank`,rel:`noreferrer`},{default:r(()=>[l(a(y.value.updateId??X.value),1)]),_:1},8,[`to`])):(t(),h(`span`,ut,a(y.value.updateId??X.value??`n/a`),1))])]),C(`div`,null,[o[6]||=C(`dt`,null,`Session`,-1),C(`dd`,dt,a(y.value.sessionId),1)]),C(`div`,null,[o[7]||=C(`dt`,null,`Step`,-1),C(`dd`,null,a(ge.value),1)]),C(`div`,null,[o[8]||=C(`dt`,null,`Phase`,-1),C(`dd`,null,a(_e.value),1)])]),E(Oe,{scopes:ye.value,"node-id":y.value.nodeId},null,8,[`scopes`,`node-id`])]),C(`div`,ft,[E(pe,{"real-events":be.value,"replay-events":xe.value,"current-step-id":y.value.currentStep.stepId,loading:D.value,onSelectStep:De},null,8,[`real-events`,`replay-events`,`current-step-id`,`loading`])])])])],4)):g(``,!0)]))}});export{_t as default};