hanoman 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.9.4",
3
- "sha": "7af321cc",
4
- "builtAt": "2026-09-23T06:02:12.160Z"
2
+ "version": "0.9.5",
3
+ "sha": "70b2121f",
4
+ "builtAt": "2026-09-23T06:48:13.618Z"
5
5
  }
package/dist/cli.js CHANGED
@@ -4621,7 +4621,7 @@ var init_runtime_defaults = __esm({
4621
4621
  "use strict";
4622
4622
  init_orchestration();
4623
4623
  init_zod();
4624
- RUNTIME_DEFAULTS_VERSION = "2026-09-23-v1";
4624
+ RUNTIME_DEFAULTS_VERSION = "2026-09-23-v2";
4625
4625
  zRuntimeDefaultState = external_exports.enum(["seeded", "user"]);
4626
4626
  zBuiltinRuntimeDefaults = external_exports.object({
4627
4627
  version: external_exports.string().default(RUNTIME_DEFAULTS_VERSION),
@@ -4642,98 +4642,98 @@ var init_runtime_defaults = __esm({
4642
4642
  {
4643
4643
  Brainstorm: cell("sonnet", "medium"),
4644
4644
  Objective: cell("sonnet", "medium"),
4645
- Spec: cell("opus", "medium"),
4646
- Plan: cell("sonnet", "medium"),
4647
- Execute: cell("sonnet", "medium")
4645
+ Spec: cell("opus", "high"),
4646
+ Plan: cell("opus", "high"),
4647
+ Execute: cell("sonnet", "high")
4648
4648
  },
4649
4649
  {
4650
4650
  Brainstorm: cell("gpt-5.6-terra", "medium"),
4651
4651
  Objective: cell("gpt-5.6-terra", "medium"),
4652
- Spec: cell("gpt-5.6-sol", "medium"),
4653
- Plan: cell("gpt-5.6-terra", "medium"),
4654
- Execute: cell("gpt-5.6-terra", "medium")
4652
+ Spec: cell("gpt-5.6-sol", "high"),
4653
+ Plan: cell("gpt-5.6-sol", "high"),
4654
+ Execute: cell("gpt-5.6-terra", "high")
4655
4655
  }
4656
4656
  ),
4657
4657
  qa: flow(
4658
4658
  {
4659
- Audit: cell("sonnet", "medium"),
4660
- Spec: cell("opus", "medium"),
4661
- Plan: cell("sonnet", "medium"),
4662
- Execute: cell("sonnet", "medium")
4659
+ Audit: cell("opus", "high"),
4660
+ Spec: cell("opus", "high"),
4661
+ Plan: cell("sonnet", "high"),
4662
+ Execute: cell("sonnet", "high")
4663
4663
  },
4664
4664
  {
4665
- Audit: cell("gpt-5.6-terra", "medium"),
4666
- Spec: cell("gpt-5.6-sol", "medium"),
4667
- Plan: cell("gpt-5.6-terra", "medium"),
4668
- Execute: cell("gpt-5.6-terra", "medium")
4665
+ Audit: cell("gpt-5.6-sol", "high"),
4666
+ Spec: cell("gpt-5.6-sol", "high"),
4667
+ Plan: cell("gpt-5.6-terra", "high"),
4668
+ Execute: cell("gpt-5.6-terra", "high")
4669
4669
  }
4670
4670
  ),
4671
4671
  scaffold: flow(
4672
4672
  {
4673
4673
  Brainstorm: cell("sonnet", "medium"),
4674
4674
  Objective: cell("sonnet", "medium"),
4675
- "Doc index": cell("opus", "medium")
4675
+ "Doc index": cell("opus", "high")
4676
4676
  },
4677
4677
  {
4678
4678
  Brainstorm: cell("gpt-5.6-terra", "medium"),
4679
4679
  Objective: cell("gpt-5.6-terra", "medium"),
4680
- "Doc index": cell("gpt-5.6-sol", "medium")
4680
+ "Doc index": cell("gpt-5.6-sol", "high")
4681
4681
  }
4682
4682
  ),
4683
4683
  reverse: flow(
4684
4684
  {
4685
4685
  Scan: cell("sonnet", "medium"),
4686
- "Docs teknis": cell("sonnet", "medium"),
4686
+ "Docs teknis": cell("sonnet", "high"),
4687
4687
  Wawancara: cell("sonnet", "medium"),
4688
- "Konvensi & index": cell("sonnet", "medium"),
4689
- "Serah terima": cell("sonnet", "medium")
4688
+ "Konvensi & index": cell("opus", "medium"),
4689
+ "Serah terima": cell("sonnet", "low")
4690
4690
  },
4691
4691
  {
4692
4692
  Scan: cell("gpt-5.6-terra", "medium"),
4693
- "Docs teknis": cell("gpt-5.6-terra", "medium"),
4693
+ "Docs teknis": cell("gpt-5.6-terra", "high"),
4694
4694
  Wawancara: cell("gpt-5.6-terra", "medium"),
4695
- "Konvensi & index": cell("gpt-5.6-terra", "medium"),
4696
- "Serah terima": cell("gpt-5.6-terra", "medium")
4695
+ "Konvensi & index": cell("gpt-5.6-sol", "medium"),
4696
+ "Serah terima": cell("gpt-5.6-terra", "low")
4697
4697
  }
4698
4698
  ),
4699
4699
  prd: flow(
4700
4700
  {
4701
4701
  Brainstorm: cell("sonnet", "medium"),
4702
- PRD: cell("opus", "medium")
4702
+ PRD: cell("opus", "high")
4703
4703
  },
4704
4704
  {
4705
4705
  Brainstorm: cell("gpt-5.6-terra", "medium"),
4706
- PRD: cell("gpt-5.6-sol", "medium")
4706
+ PRD: cell("gpt-5.6-sol", "high")
4707
4707
  }
4708
4708
  ),
4709
4709
  audit: flow(
4710
4710
  {
4711
- Audit: cell("sonnet", "medium"),
4711
+ Audit: cell("opus", "high"),
4712
4712
  Laporan: cell("sonnet", "medium")
4713
4713
  },
4714
4714
  {
4715
- Audit: cell("gpt-5.6-terra", "medium"),
4715
+ Audit: cell("gpt-5.6-sol", "high"),
4716
4716
  Laporan: cell("gpt-5.6-terra", "medium")
4717
4717
  }
4718
4718
  ),
4719
4719
  breakdown: flow(
4720
4720
  {
4721
- Analisis: cell("opus", "medium"),
4721
+ Analisis: cell("opus", "high"),
4722
4722
  Breakdown: cell("opus", "medium")
4723
4723
  },
4724
4724
  {
4725
- Analisis: cell("gpt-5.6-sol", "medium"),
4725
+ Analisis: cell("gpt-5.6-sol", "high"),
4726
4726
  Breakdown: cell("gpt-5.6-sol", "medium")
4727
4727
  }
4728
4728
  ),
4729
4729
  goal: flow(
4730
4730
  {
4731
- Goal: cell("sonnet", "medium"),
4732
- Verifikasi: cell("sonnet", "medium")
4731
+ Goal: cell("sonnet", "high"),
4732
+ Verifikasi: cell("opus", "medium")
4733
4733
  },
4734
4734
  {
4735
- Goal: cell("gpt-5.6-terra", "medium"),
4736
- Verifikasi: cell("gpt-5.6-terra", "medium")
4735
+ Goal: cell("gpt-5.6-terra", "high"),
4736
+ Verifikasi: cell("gpt-5.6-sol", "medium")
4737
4737
  }
4738
4738
  ),
4739
4739
  no_effort: flow(
package/dist/server.js CHANGED
@@ -4832,7 +4832,7 @@ var init_runtime_defaults = __esm({
4832
4832
  "use strict";
4833
4833
  init_orchestration();
4834
4834
  init_zod();
4835
- RUNTIME_DEFAULTS_VERSION = "2026-09-23-v1";
4835
+ RUNTIME_DEFAULTS_VERSION = "2026-09-23-v2";
4836
4836
  zRuntimeDefaultState = external_exports.enum(["seeded", "user"]);
4837
4837
  zBuiltinRuntimeDefaults = external_exports.object({
4838
4838
  version: external_exports.string().default(RUNTIME_DEFAULTS_VERSION),
@@ -4874,98 +4874,98 @@ var init_runtime_defaults = __esm({
4874
4874
  {
4875
4875
  Brainstorm: cell("sonnet", "medium"),
4876
4876
  Objective: cell("sonnet", "medium"),
4877
- Spec: cell("opus", "medium"),
4878
- Plan: cell("sonnet", "medium"),
4879
- Execute: cell("sonnet", "medium")
4877
+ Spec: cell("opus", "high"),
4878
+ Plan: cell("opus", "high"),
4879
+ Execute: cell("sonnet", "high")
4880
4880
  },
4881
4881
  {
4882
4882
  Brainstorm: cell("gpt-5.6-terra", "medium"),
4883
4883
  Objective: cell("gpt-5.6-terra", "medium"),
4884
- Spec: cell("gpt-5.6-sol", "medium"),
4885
- Plan: cell("gpt-5.6-terra", "medium"),
4886
- Execute: cell("gpt-5.6-terra", "medium")
4884
+ Spec: cell("gpt-5.6-sol", "high"),
4885
+ Plan: cell("gpt-5.6-sol", "high"),
4886
+ Execute: cell("gpt-5.6-terra", "high")
4887
4887
  }
4888
4888
  ),
4889
4889
  qa: flow(
4890
4890
  {
4891
- Audit: cell("sonnet", "medium"),
4892
- Spec: cell("opus", "medium"),
4893
- Plan: cell("sonnet", "medium"),
4894
- Execute: cell("sonnet", "medium")
4891
+ Audit: cell("opus", "high"),
4892
+ Spec: cell("opus", "high"),
4893
+ Plan: cell("sonnet", "high"),
4894
+ Execute: cell("sonnet", "high")
4895
4895
  },
4896
4896
  {
4897
- Audit: cell("gpt-5.6-terra", "medium"),
4898
- Spec: cell("gpt-5.6-sol", "medium"),
4899
- Plan: cell("gpt-5.6-terra", "medium"),
4900
- Execute: cell("gpt-5.6-terra", "medium")
4897
+ Audit: cell("gpt-5.6-sol", "high"),
4898
+ Spec: cell("gpt-5.6-sol", "high"),
4899
+ Plan: cell("gpt-5.6-terra", "high"),
4900
+ Execute: cell("gpt-5.6-terra", "high")
4901
4901
  }
4902
4902
  ),
4903
4903
  scaffold: flow(
4904
4904
  {
4905
4905
  Brainstorm: cell("sonnet", "medium"),
4906
4906
  Objective: cell("sonnet", "medium"),
4907
- "Doc index": cell("opus", "medium")
4907
+ "Doc index": cell("opus", "high")
4908
4908
  },
4909
4909
  {
4910
4910
  Brainstorm: cell("gpt-5.6-terra", "medium"),
4911
4911
  Objective: cell("gpt-5.6-terra", "medium"),
4912
- "Doc index": cell("gpt-5.6-sol", "medium")
4912
+ "Doc index": cell("gpt-5.6-sol", "high")
4913
4913
  }
4914
4914
  ),
4915
4915
  reverse: flow(
4916
4916
  {
4917
4917
  Scan: cell("sonnet", "medium"),
4918
- "Docs teknis": cell("sonnet", "medium"),
4918
+ "Docs teknis": cell("sonnet", "high"),
4919
4919
  Wawancara: cell("sonnet", "medium"),
4920
- "Konvensi & index": cell("sonnet", "medium"),
4921
- "Serah terima": cell("sonnet", "medium")
4920
+ "Konvensi & index": cell("opus", "medium"),
4921
+ "Serah terima": cell("sonnet", "low")
4922
4922
  },
4923
4923
  {
4924
4924
  Scan: cell("gpt-5.6-terra", "medium"),
4925
- "Docs teknis": cell("gpt-5.6-terra", "medium"),
4925
+ "Docs teknis": cell("gpt-5.6-terra", "high"),
4926
4926
  Wawancara: cell("gpt-5.6-terra", "medium"),
4927
- "Konvensi & index": cell("gpt-5.6-terra", "medium"),
4928
- "Serah terima": cell("gpt-5.6-terra", "medium")
4927
+ "Konvensi & index": cell("gpt-5.6-sol", "medium"),
4928
+ "Serah terima": cell("gpt-5.6-terra", "low")
4929
4929
  }
4930
4930
  ),
4931
4931
  prd: flow(
4932
4932
  {
4933
4933
  Brainstorm: cell("sonnet", "medium"),
4934
- PRD: cell("opus", "medium")
4934
+ PRD: cell("opus", "high")
4935
4935
  },
4936
4936
  {
4937
4937
  Brainstorm: cell("gpt-5.6-terra", "medium"),
4938
- PRD: cell("gpt-5.6-sol", "medium")
4938
+ PRD: cell("gpt-5.6-sol", "high")
4939
4939
  }
4940
4940
  ),
4941
4941
  audit: flow(
4942
4942
  {
4943
- Audit: cell("sonnet", "medium"),
4943
+ Audit: cell("opus", "high"),
4944
4944
  Laporan: cell("sonnet", "medium")
4945
4945
  },
4946
4946
  {
4947
- Audit: cell("gpt-5.6-terra", "medium"),
4947
+ Audit: cell("gpt-5.6-sol", "high"),
4948
4948
  Laporan: cell("gpt-5.6-terra", "medium")
4949
4949
  }
4950
4950
  ),
4951
4951
  breakdown: flow(
4952
4952
  {
4953
- Analisis: cell("opus", "medium"),
4953
+ Analisis: cell("opus", "high"),
4954
4954
  Breakdown: cell("opus", "medium")
4955
4955
  },
4956
4956
  {
4957
- Analisis: cell("gpt-5.6-sol", "medium"),
4957
+ Analisis: cell("gpt-5.6-sol", "high"),
4958
4958
  Breakdown: cell("gpt-5.6-sol", "medium")
4959
4959
  }
4960
4960
  ),
4961
4961
  goal: flow(
4962
4962
  {
4963
- Goal: cell("sonnet", "medium"),
4964
- Verifikasi: cell("sonnet", "medium")
4963
+ Goal: cell("sonnet", "high"),
4964
+ Verifikasi: cell("opus", "medium")
4965
4965
  },
4966
4966
  {
4967
- Goal: cell("gpt-5.6-terra", "medium"),
4968
- Verifikasi: cell("gpt-5.6-terra", "medium")
4967
+ Goal: cell("gpt-5.6-terra", "high"),
4968
+ Verifikasi: cell("gpt-5.6-sol", "medium")
4969
4969
  }
4970
4970
  ),
4971
4971
  no_effort: flow(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hanoman",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "Orchestrator + dashboard workflow docs-driven untuk sesi Claude Code / Codex",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1 +1 @@
1
- import{e as C,j as a,aq as A,a as y,c as b,d as w,S as H,N as q,aA as V,h as L,u as W,f as M,w as K,ay as N,A as _,aO as U,y as Q,x as Y,p as Z,B as G,D as J}from"./index-B_pRoVeM.js";import{R as n}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const X=[{mode:"backlog",label:"Rentang tanggal",hint:"backlog yang selesai di rentang itu"},{mode:"commit",label:"Rentang commit",hint:"perubahan repo antara dua revisi"},{mode:"version",label:"Versi rilis",hint:"perubahan yang masuk ke sebuah versi"}];function ee({p:t,onToast:o,onGenerated:g}){const[i,D]=n.useState("backlog"),[s,I]=n.useState(null),[h,f]=n.useState(""),[p,d]=n.useState(""),[x,B]=n.useState(""),[v,c]=n.useState(""),[j,u]=n.useState(""),[S,l]=n.useState(""),[m,R]=n.useState(!1);n.useEffect(()=>{let e=!0;return(async()=>{try{const r=await C.changelogSources(t.id);if(!e)return;I(r),f(r.defaultRange.from),d(r.defaultRange.to),r.tags[0]&&l(r.tags[0]),r.head&&c(r.head)}catch{}})(),()=>{e=!1}},[t.id]);const T=()=>i==="backlog"?{mode:i,from:h||void 0,to:p||void 0}:i==="commit"?{mode:i,fromSha:x,toSha:v}:{mode:i,fromTag:j||void 0,toTag:S},k=i==="backlog"?!0:i==="commit"?x.trim().length>=4&&v.trim().length>=4:S.trim().length>0;async function F(){R(!0);try{const e=await C.generateChangelog(t.id,T());o(e.generator==="agent"?"Changelog dibangkitkan":"Changelog dibangkitkan (draf ringkas)",e.generator==="agent"?"ok":"warn","file-text"),g==null||g(e)}catch(e){o(e.message||"Gagal membangkitkan changelog","err","x-circle")}finally{R(!1)}}const E=i==="version"&&s!==null&&s.tags.length===0,z=i==="commit"&&s!==null&&!!s.reason&&s.tags.length===0;return a.jsxs(A,{eyebrow:"changelog",title:"Ringkasan perubahan untuk pemakai",children:[a.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginBottom:12,lineHeight:1.5},children:"Teks pendek berorientasi pemakai — apa yang berubah bagi mereka, bukan apa yang disentuh di dalam kode."}),a.jsx("div",{style:{display:"flex",gap:6,marginBottom:12,flexWrap:"wrap"},children:X.map(e=>a.jsx(y,{size:"sm",variant:i===e.mode?"primary":"ghost",onClick:()=>D(e.mode),title:e.hint,children:e.label},e.mode))}),a.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-end",flexWrap:"wrap",marginBottom:12},children:[i==="backlog"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Dari tanggal",children:a.jsx(w,{"aria-label":"Dari tanggal",type:"date",value:h,onChange:e=>f(e.target.value)})}),a.jsx(b,{label:"Sampai tanggal",children:a.jsx(w,{"aria-label":"Sampai tanggal",type:"date",value:p,onChange:e=>d(e.target.value)})})]}),i==="commit"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Dari revisi",children:a.jsx(w,{"aria-label":"Dari revisi",mono:!0,placeholder:"mis. v1.0.0 atau 4f2a1c9",value:x,onChange:e=>B(e.target.value)})}),a.jsx(b,{label:"Sampai revisi",children:a.jsx(w,{"aria-label":"Sampai revisi",mono:!0,placeholder:"mis. HEAD atau 9d3b77e",value:v,onChange:e=>c(e.target.value)})})]}),i==="version"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Sejak versi",children:a.jsx(H,{"aria-label":"Sejak versi",value:j,onChange:e=>u(e.target.value),options:[{value:"",label:"versi sebelumnya"},...((s==null?void 0:s.tags)??[]).map(e=>({value:e,label:e}))]})}),a.jsx(b,{label:"Versi",children:a.jsx(H,{"aria-label":"Versi",value:S,onChange:e=>l(e.target.value),options:((s==null?void 0:s.tags)??[]).map(e=>({value:e,label:e}))})})]}),a.jsx(y,{leftIcon:"sparkles",onClick:()=>void F(),disabled:m||!k||E||z,children:m?"Membangkitkan…":"Bangkitkan"})]}),(E||z)&&a.jsx(q,{tone:"warn",children:s==null?void 0:s.reason})]})}const $=12,O={backlog:"rentang tanggal",commit:"rentang commit",version:"versi rilis"},ae=t=>new Date(t).toLocaleDateString("id-ID",{day:"numeric",month:"short",year:"numeric"});function te({c:t,active:o,onOpen:g}){return a.jsxs("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),g())},style:{display:"flex",alignItems:"center",gap:10,padding:"9px 10px",cursor:"pointer",borderRadius:"var(--radius-sm)",borderBottom:"1px solid var(--border-hair)",background:o?"var(--brass-100)":"transparent"},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:13.5,fontWeight:500,color:"var(--text-strong)"},children:t.title}),a.jsxs("div",{style:{fontSize:11.5,color:"var(--text-subtle)",marginTop:2},children:[O[t.mode]??t.mode," · ",ae(t.createdAt)," · ",t.itemCount," perubahan"]})]}),a.jsx(G,{tone:t.generator==="agent"?"ok":"warn",size:"sm",children:t.generator==="agent"?"naratif":"draf ringkas"})]})}function re({p:t,onToast:o,initialChangelogId:g}){const[i,D]=n.useState([]),[s,I]=n.useState(0),h=V("changelog",t.id),[f,p]=L(h,"page",1,Y),[d,x]=L(h,"q","",Z),[B,v]=n.useState(!0),[c,j]=L(h,"selectedId",null,Q),[u,S]=n.useState(null),l=n.useMemo(()=>i.find(e=>e.id===c)??((u==null?void 0:u.id)===c?u:null),[i,c,u]),m=n.useCallback(e=>{j(e?e.id:null),S(e)},[j]),[R,T]=n.useState(0);n.useEffect(()=>{let e=!0;const r=setTimeout(()=>{v(!0),C.listChangelogs(t.id,{q:d,page:f,limit:$}).then(P=>{e&&(D(P.items),I(P.total))}).catch(()=>{e&&(D([]),I(0))}).finally(()=>{e&&v(!1)})},d?220:0);return()=>{e=!1,clearTimeout(r)}},[t.id,d,f,R]),n.useEffect(()=>{if(!g)return;let e=!0;return C.getChangelog(t.id,g).then(r=>{e&&m(r)}).catch(()=>{e&&o("Rilis yang ditautkan tak ditemukan","warn","link-2-off")}),()=>{e=!1}},[t.id,g,o]);const k=J(s,f,$),{confirm:F,dialog:E}=W();async function z(e){try{if(!await F({title:`Hapus changelog "${e.title}"?`,message:"Rilis ini hilang dari riwayat project.",confirmLabel:"Hapus rilis",run:()=>C.deleteChangelog(t.id,e.id)}))return;c===e.id&&m(null),T(r=>r+1),o("Changelog dihapus","ok","trash-2")}catch{o("Gagal menghapus changelog","err","x-circle")}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[a.jsx(ee,{p:t,onToast:o,onGenerated:e=>{m(e),p(1),T(r=>r+1)}}),a.jsxs(A,{eyebrow:"rilis",title:"Riwayat changelog",actions:a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11.5,color:"var(--text-subtle)"},children:[s," rilis"]}),children:[a.jsx(w,{"aria-label":"Cari rilis",leftIcon:"search",placeholder:"cari judul atau isi rilis…",value:d,style:{width:"100%"},onChange:e=>{p(1),x(e.target.value)}}),a.jsxs("div",{"data-testid":"changelog-list",style:{maxHeight:340,overflowY:"auto",marginTop:10},children:[B&&i.length===0&&a.jsx(M,{kind:"loading",compact:!0}),!B&&i.length===0&&(d.trim()?a.jsx(M,{kind:"empty",icon:"search",compact:!0,title:"Tak ada rilis yang cocok",hint:`Tak ada rilis yang memuat “${d.trim()}”.`,action:()=>x(""),actionLabel:"Bersihkan pencarian",actionIcon:"x"}):a.jsx(M,{kind:"empty",icon:"megaphone",compact:!0,title:"Belum ada rilis",hint:"Bangkitkan changelog pertama project ini lewat kartu di atas."})),i.map(e=>a.jsx(te,{c:e,active:(l==null?void 0:l.id)===e.id,onOpen:()=>m(e)},e.id))]}),a.jsx(K,{page:k.page,pageCount:k.pageCount,total:s,from:k.from,to:k.to,onPage:p,unit:"rilis"})]}),l&&a.jsxs(A,{eyebrow:`rilis · ${O[l.mode]??l.mode}`,title:l.title,actions:a.jsxs("div",{className:"hn-row-actions",style:{display:"flex",gap:6},children:[a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"copy",onClick:()=>{var e;(e=navigator.clipboard)==null||e.writeText(l.body),o("Changelog disalin","ok","copy")},children:"Salin"}),a.jsx(y,{as:"a",size:"sm",variant:"ghost",leftIcon:"download",download:!0,href:`${_.changelogItem(t.id,l.id)}?download=md`,"aria-label":"Unduh .md",children:"Unduh .md"}),a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"link",onClick:()=>{var e;(e=navigator.clipboard)==null||e.writeText(U(t.id,l.id)),o("Link changelog disalin","ok","link")},children:"Salin link"}),a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"trash-2","aria-label":`Hapus ${l.title}`,onClick:()=>void z(l)})]}),children:[l.warning&&a.jsx(q,{tone:"warn",children:l.warning}),a.jsx(N,{text:l.body,name:"changelog.md"})]}),E]})}export{re as ChangelogScreen};
1
+ import{e as C,j as a,aq as A,a as y,c as b,d as w,S as H,N as q,aA as V,h as L,u as W,f as M,w as K,ay as N,A as _,aO as U,y as Q,x as Y,p as Z,B as G,D as J}from"./index-CCJTT5hd.js";import{R as n}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const X=[{mode:"backlog",label:"Rentang tanggal",hint:"backlog yang selesai di rentang itu"},{mode:"commit",label:"Rentang commit",hint:"perubahan repo antara dua revisi"},{mode:"version",label:"Versi rilis",hint:"perubahan yang masuk ke sebuah versi"}];function ee({p:t,onToast:o,onGenerated:g}){const[i,D]=n.useState("backlog"),[s,I]=n.useState(null),[h,f]=n.useState(""),[p,d]=n.useState(""),[x,B]=n.useState(""),[v,c]=n.useState(""),[j,u]=n.useState(""),[S,l]=n.useState(""),[m,R]=n.useState(!1);n.useEffect(()=>{let e=!0;return(async()=>{try{const r=await C.changelogSources(t.id);if(!e)return;I(r),f(r.defaultRange.from),d(r.defaultRange.to),r.tags[0]&&l(r.tags[0]),r.head&&c(r.head)}catch{}})(),()=>{e=!1}},[t.id]);const T=()=>i==="backlog"?{mode:i,from:h||void 0,to:p||void 0}:i==="commit"?{mode:i,fromSha:x,toSha:v}:{mode:i,fromTag:j||void 0,toTag:S},k=i==="backlog"?!0:i==="commit"?x.trim().length>=4&&v.trim().length>=4:S.trim().length>0;async function F(){R(!0);try{const e=await C.generateChangelog(t.id,T());o(e.generator==="agent"?"Changelog dibangkitkan":"Changelog dibangkitkan (draf ringkas)",e.generator==="agent"?"ok":"warn","file-text"),g==null||g(e)}catch(e){o(e.message||"Gagal membangkitkan changelog","err","x-circle")}finally{R(!1)}}const E=i==="version"&&s!==null&&s.tags.length===0,z=i==="commit"&&s!==null&&!!s.reason&&s.tags.length===0;return a.jsxs(A,{eyebrow:"changelog",title:"Ringkasan perubahan untuk pemakai",children:[a.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginBottom:12,lineHeight:1.5},children:"Teks pendek berorientasi pemakai — apa yang berubah bagi mereka, bukan apa yang disentuh di dalam kode."}),a.jsx("div",{style:{display:"flex",gap:6,marginBottom:12,flexWrap:"wrap"},children:X.map(e=>a.jsx(y,{size:"sm",variant:i===e.mode?"primary":"ghost",onClick:()=>D(e.mode),title:e.hint,children:e.label},e.mode))}),a.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-end",flexWrap:"wrap",marginBottom:12},children:[i==="backlog"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Dari tanggal",children:a.jsx(w,{"aria-label":"Dari tanggal",type:"date",value:h,onChange:e=>f(e.target.value)})}),a.jsx(b,{label:"Sampai tanggal",children:a.jsx(w,{"aria-label":"Sampai tanggal",type:"date",value:p,onChange:e=>d(e.target.value)})})]}),i==="commit"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Dari revisi",children:a.jsx(w,{"aria-label":"Dari revisi",mono:!0,placeholder:"mis. v1.0.0 atau 4f2a1c9",value:x,onChange:e=>B(e.target.value)})}),a.jsx(b,{label:"Sampai revisi",children:a.jsx(w,{"aria-label":"Sampai revisi",mono:!0,placeholder:"mis. HEAD atau 9d3b77e",value:v,onChange:e=>c(e.target.value)})})]}),i==="version"&&a.jsxs(a.Fragment,{children:[a.jsx(b,{label:"Sejak versi",children:a.jsx(H,{"aria-label":"Sejak versi",value:j,onChange:e=>u(e.target.value),options:[{value:"",label:"versi sebelumnya"},...((s==null?void 0:s.tags)??[]).map(e=>({value:e,label:e}))]})}),a.jsx(b,{label:"Versi",children:a.jsx(H,{"aria-label":"Versi",value:S,onChange:e=>l(e.target.value),options:((s==null?void 0:s.tags)??[]).map(e=>({value:e,label:e}))})})]}),a.jsx(y,{leftIcon:"sparkles",onClick:()=>void F(),disabled:m||!k||E||z,children:m?"Membangkitkan…":"Bangkitkan"})]}),(E||z)&&a.jsx(q,{tone:"warn",children:s==null?void 0:s.reason})]})}const $=12,O={backlog:"rentang tanggal",commit:"rentang commit",version:"versi rilis"},ae=t=>new Date(t).toLocaleDateString("id-ID",{day:"numeric",month:"short",year:"numeric"});function te({c:t,active:o,onOpen:g}){return a.jsxs("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),g())},style:{display:"flex",alignItems:"center",gap:10,padding:"9px 10px",cursor:"pointer",borderRadius:"var(--radius-sm)",borderBottom:"1px solid var(--border-hair)",background:o?"var(--brass-100)":"transparent"},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:13.5,fontWeight:500,color:"var(--text-strong)"},children:t.title}),a.jsxs("div",{style:{fontSize:11.5,color:"var(--text-subtle)",marginTop:2},children:[O[t.mode]??t.mode," · ",ae(t.createdAt)," · ",t.itemCount," perubahan"]})]}),a.jsx(G,{tone:t.generator==="agent"?"ok":"warn",size:"sm",children:t.generator==="agent"?"naratif":"draf ringkas"})]})}function re({p:t,onToast:o,initialChangelogId:g}){const[i,D]=n.useState([]),[s,I]=n.useState(0),h=V("changelog",t.id),[f,p]=L(h,"page",1,Y),[d,x]=L(h,"q","",Z),[B,v]=n.useState(!0),[c,j]=L(h,"selectedId",null,Q),[u,S]=n.useState(null),l=n.useMemo(()=>i.find(e=>e.id===c)??((u==null?void 0:u.id)===c?u:null),[i,c,u]),m=n.useCallback(e=>{j(e?e.id:null),S(e)},[j]),[R,T]=n.useState(0);n.useEffect(()=>{let e=!0;const r=setTimeout(()=>{v(!0),C.listChangelogs(t.id,{q:d,page:f,limit:$}).then(P=>{e&&(D(P.items),I(P.total))}).catch(()=>{e&&(D([]),I(0))}).finally(()=>{e&&v(!1)})},d?220:0);return()=>{e=!1,clearTimeout(r)}},[t.id,d,f,R]),n.useEffect(()=>{if(!g)return;let e=!0;return C.getChangelog(t.id,g).then(r=>{e&&m(r)}).catch(()=>{e&&o("Rilis yang ditautkan tak ditemukan","warn","link-2-off")}),()=>{e=!1}},[t.id,g,o]);const k=J(s,f,$),{confirm:F,dialog:E}=W();async function z(e){try{if(!await F({title:`Hapus changelog "${e.title}"?`,message:"Rilis ini hilang dari riwayat project.",confirmLabel:"Hapus rilis",run:()=>C.deleteChangelog(t.id,e.id)}))return;c===e.id&&m(null),T(r=>r+1),o("Changelog dihapus","ok","trash-2")}catch{o("Gagal menghapus changelog","err","x-circle")}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[a.jsx(ee,{p:t,onToast:o,onGenerated:e=>{m(e),p(1),T(r=>r+1)}}),a.jsxs(A,{eyebrow:"rilis",title:"Riwayat changelog",actions:a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11.5,color:"var(--text-subtle)"},children:[s," rilis"]}),children:[a.jsx(w,{"aria-label":"Cari rilis",leftIcon:"search",placeholder:"cari judul atau isi rilis…",value:d,style:{width:"100%"},onChange:e=>{p(1),x(e.target.value)}}),a.jsxs("div",{"data-testid":"changelog-list",style:{maxHeight:340,overflowY:"auto",marginTop:10},children:[B&&i.length===0&&a.jsx(M,{kind:"loading",compact:!0}),!B&&i.length===0&&(d.trim()?a.jsx(M,{kind:"empty",icon:"search",compact:!0,title:"Tak ada rilis yang cocok",hint:`Tak ada rilis yang memuat “${d.trim()}”.`,action:()=>x(""),actionLabel:"Bersihkan pencarian",actionIcon:"x"}):a.jsx(M,{kind:"empty",icon:"megaphone",compact:!0,title:"Belum ada rilis",hint:"Bangkitkan changelog pertama project ini lewat kartu di atas."})),i.map(e=>a.jsx(te,{c:e,active:(l==null?void 0:l.id)===e.id,onOpen:()=>m(e)},e.id))]}),a.jsx(K,{page:k.page,pageCount:k.pageCount,total:s,from:k.from,to:k.to,onPage:p,unit:"rilis"})]}),l&&a.jsxs(A,{eyebrow:`rilis · ${O[l.mode]??l.mode}`,title:l.title,actions:a.jsxs("div",{className:"hn-row-actions",style:{display:"flex",gap:6},children:[a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"copy",onClick:()=>{var e;(e=navigator.clipboard)==null||e.writeText(l.body),o("Changelog disalin","ok","copy")},children:"Salin"}),a.jsx(y,{as:"a",size:"sm",variant:"ghost",leftIcon:"download",download:!0,href:`${_.changelogItem(t.id,l.id)}?download=md`,"aria-label":"Unduh .md",children:"Unduh .md"}),a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"link",onClick:()=>{var e;(e=navigator.clipboard)==null||e.writeText(U(t.id,l.id)),o("Link changelog disalin","ok","link")},children:"Salin link"}),a.jsx(y,{size:"sm",variant:"ghost",leftIcon:"trash-2","aria-label":`Hapus ${l.title}`,onClick:()=>void z(l)})]}),children:[l.warning&&a.jsx(q,{tone:"warn",children:l.warning}),a.jsx(N,{text:l.body,name:"changelog.md"})]}),E]})}export{re as ChangelogScreen};
@@ -1 +1 @@
1
- import{i as ie,j as e,b as re,I as E}from"./index-B_pRoVeM.js";import{R as g}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const de="/assets/hnm-hero-rig-body-v01-DmbKJJHB.webp",ce="/assets/hnm-hero-rig-arm-ul-v01-CIAWAxFe.webp",he="/assets/hnm-hero-rig-arm-ur-v01-C0R0CZnp.webp",oe="/assets/hnm-hero-rig-arm-ml-v01-Kts3pjTf.webp",ge="/assets/hnm-hero-rig-arm-mr-v01-DQgnE6bD.webp",me="/assets/hnm-wayang-satria-alus-v01-CpfoXKTy.webp",ue="/assets/hnm-wayang-satria-gagah-v01-bLfIYAsv.webp",pe="/assets/hnm-wayang-putri-v01-F6p69kHq.webp",xe="/assets/hnm-wayang-panakawan-v01-1LGv-V8N.webp",q=[me,ue,pe,xe],z=a=>q[[...a].reduce((t,o)=>t+o.charCodeAt(0),0)%q.length],V=["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],C=a=>String(a).padStart(2,"0");function je(){return g.useMemo(()=>typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function Ne(){const[a,t]=g.useState(()=>new Date);return g.useEffect(()=>{const o=setInterval(()=>t(new Date),1e3);return()=>clearInterval(o)},[]),a}function ye(a,t){const[o,m]=g.useState(""),p=a.join("|");return g.useEffect(()=>{if(t||a.length===0){m(a[0]??"");return}let x=0,h=0,r=null,d=null;const l=()=>{const y=a[x%a.length]??"";h=0,r=setInterval(()=>{h++,m(y.slice(0,h)),h>=y.length&&r&&(clearInterval(r),r=null,d=setTimeout(()=>{x++,l()},3200))},26)};return l(),()=>{r&&clearInterval(r),d&&clearTimeout(d)}},[p,t]),o}function S(a,t){const[o,m]=g.useState(t?a:0);return g.useEffect(()=>{if(t){m(a);return}const p=performance.now(),x=900;let h=0;const r=d=>{const l=Math.min(1,(d-p)/x);m(Math.round(a*(1-Math.pow(1-l,3)))),l<1&&(h=requestAnimationFrame(r))};return h=requestAnimationFrame(r),()=>cancelAnimationFrame(h)},[a,t]),o}function M({icon:a,tone:t,label:o,value:m,sub:p}){return e.jsxs("div",{className:"hn-dlg-kpi",children:[e.jsx("span",{className:`hn-dlg-kpi-ic hn-dlg-tone-${t}`,children:e.jsx(E,{name:a,size:17})}),e.jsxs("span",{style:{minWidth:0},children:[e.jsx("span",{className:"hn-dlg-kpi-l",children:o}),e.jsx("span",{className:"hn-dlg-kpi-v",children:m}),e.jsx("span",{className:"hn-dlg-kpi-s",children:p})]})]})}function ke({projects:a,backlog:t,sessions:o,onOpenSession:m,onOpenProject:p,onGoto:x,onExit:h}){const r=je(),d=Ne();g.useEffect(()=>{const n=s=>{s.key==="Escape"&&h()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[h]);const l=o.filter(n=>!n.exited).sort((n,s)=>n.id.localeCompare(s.id)),y=new Set(l.map(n=>n.projectId)),f=a.filter(n=>!y.has(n.id)),R=l.filter(n=>!!n.decision&&!n.deciding).length,F=t.filter(n=>ie(n.startedAt)).length,Q=S(a.length,r),X=S(F,r),Z=S(l.length,r),_=S(R,r),ee=ye([l.length>0?`HANOMAN ONLINE · ${l.length} SESI HIDUP`:"HANOMAN ONLINE · KELIR SUNYI",`${F} TASK DIKERJAKAN HARI INI`,R>0?`${R} SESI MENUNGGU JAWABANMU`:"SEMUA SISTEM NORMAL",`${a.length} PROYEK DALAM PANTAUAN`],r),j={done:0,executing:0,planned:0,spec:0};for(const n of t)n.stage==="done"?j.done++:n.stage==="executing"?j.executing++:n.stage==="planned"?j.planned++:j.spec++;const D=t.length,ne=[{key:"executing",cls:"wind",label:"Execute"},{key:"done",cls:"leaf",label:"Done"},{key:"planned",cls:"amber",label:"Plan"},{key:"spec",cls:"brass",label:"Spec"}];let L=0;const O=ne.map(n=>{const s=D?j[n.key]/D*100:0,u={...n,n:j[n.key],frac:s,offset:25-L};return L+=s,u}),v=[];for(let n=6;n>=0;n--){const s=new Date(d.getFullYear(),d.getMonth(),d.getDate()-n),u=t.filter(i=>{if(!i.startedAt)return!1;const c=new Date(i.startedAt);return c.getFullYear()===s.getFullYear()&&c.getMonth()===s.getMonth()&&c.getDate()===s.getDate()}).length;v.push({label:`${s.getDate()} ${V[s.getMonth()]}`,n:u})}const $=Math.max(1,...v.map(n=>n.n)),se=v.map((n,s)=>`${32+s*35},${78-n.n/$*60}`).join(" "),ae=`${l.map(n=>n.id).join("|")}#${f.map(n=>n.id).join("|")}`,H=g.useRef(null),[P,W]=g.useState([]);g.useLayoutEffect(()=>{const n=H.current;if(!n||l.length===0&&f.length===0){W([]);return}const s=()=>{var J;const i=n.getBoundingClientRect();if(i.width<60)return;const c=(J=n.querySelector(".hn-dlg-hero-art"))==null?void 0:J.getBoundingClientRect(),b=c?c.left+c.width/2-i.left:i.width/2,w={};n.querySelectorAll("[data-hand]").forEach(N=>{const A=N.getBoundingClientRect();w[N.dataset.hand??""]={x:A.left+A.width/2-i.left,y:A.top+A.height/2-i.top}});const k={x:b,y:c?c.top-i.top+c.height*.36:i.height*.35},G=[];n.querySelectorAll(".hn-dlg-prj").forEach(N=>{const U=(N.querySelector(".hn-dlg-puppet img")??N).getBoundingClientRect(),T=U.left+U.width/2-i.left,K=U.top-i.top+1,B=!N.hasAttribute("data-puppet"),te=T<b?"l":"r",I=w[(B?"m":"u")+te]??k,le=B?Math.max(I.y,K)+26:Math.min(I.y,K)-16;G.push({d:`M ${I.x.toFixed(1)} ${I.y.toFixed(1)} Q ${((I.x+T)/2).toFixed(1)} ${le.toFixed(1)}, ${T.toFixed(1)} ${K.toFixed(1)}`,slack:B})}),W(G)};if(s(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(s);return u.observe(n),()=>u.disconnect()},[ae,l.length,f.length]);const Y=a.slice(0,6).map(n=>({id:n.id,name:n.name,text:n.activity,commit:n.commit,live:y.has(n.id)}));return e.jsxs("div",{className:"hn-dlg",children:[e.jsxs("div",{className:"hn-dlg-top hn-wrap-mobile",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[e.jsx("img",{className:"hn-dlg-blencong",src:re,alt:"","aria-hidden":"true","data-lit":l.length>0||void 0}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("h2",{className:"hn-dlg-title",children:"Dalang Hanoman"}),e.jsx("p",{className:"hn-dlg-boot","aria-live":"off",children:ee})]})]}),e.jsxs("div",{className:"hn-dlg-chips",children:[e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"calendar",size:13}),d.getDate()," ",V[d.getMonth()]," ",d.getFullYear()]}),e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"clock",size:13}),C(d.getHours()),":",C(d.getMinutes()),":",C(d.getSeconds())]}),e.jsx("button",{type:"button",className:"hn-dlg-exit",onClick:h,"aria-label":"Keluar dari panggung (Esc)",children:e.jsx(E,{name:"x",size:14})})]})]}),e.jsxs("div",{className:"hn-dlg-kpis",children:[e.jsx(M,{icon:"layout-grid",tone:"wind",label:"TOTAL PROYEK",value:Q,sub:"dalam pantauan"}),e.jsx(M,{icon:"check-circle-2",tone:"leaf",label:"TASK HARI INI",value:X,sub:"mulai dikerjakan"}),e.jsx(M,{icon:"activity",tone:"brass",label:"SESI BERJALAN",value:Z,sub:"wayang dimainkan"}),e.jsx(M,{icon:"hand",tone:"amber",label:"MENUNGGU KAMU",value:_,sub:"butuh keputusan"})]}),e.jsxs("div",{className:"hn-dlg-grid hn-grid-mobile",children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{className:"hn-dlg-hero",ref:H,children:[e.jsxs("svg",{className:"hn-dlg-hud",viewBox:"0 0 330 330","aria-hidden":"true",children:[e.jsx("g",{className:"hn-dlg-hud-a",children:e.jsx("circle",{cx:"165",cy:"165",r:"150",strokeDasharray:"3 14"})}),e.jsx("g",{className:"hn-dlg-hud-b",children:e.jsx("circle",{cx:"165",cy:"165",r:"126",strokeDasharray:"40 22"})})]}),P.length>0&&e.jsx("svg",{className:"hn-dlg-threads","aria-hidden":"true",focusable:"false",children:P.map((n,s)=>e.jsx("path",{d:n.d,className:n.slack?"hn-dlg-thread--slack":void 0,style:n.slack?void 0:{animationDelay:`${s%6*.3}s`}},s))}),e.jsx("div",{className:"hn-dlg-scan","aria-hidden":"true"}),e.jsxs("div",{className:"hn-dlg-hero-art","aria-hidden":"true",children:[e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ul",src:ce,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ur",src:he,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ml",src:oe,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--mr",src:ge,alt:""}),e.jsx("img",{className:"hn-dlg-rig-body",src:de,alt:""}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ul"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ur"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ml"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"mr"})]}),l.length>0||f.length>0?e.jsxs("div",{className:"hn-dlg-cards",role:"list","aria-label":"Wayang project",children:[l.map((n,s)=>{var w;const u=((w=a.find(k=>k.id===n.projectId))==null?void 0:w.name)??n.projectId,i=n.specId?t.find(k=>k.id===n.specId):void 0,c=!!n.decision&&!n.deciding,b=c?"menunggu jawabanmu":i?`${i.id} · ${i.stage}`:n.flow??"sesi terminal";return e.jsxs("button",{type:"button",className:"hn-dlg-prj","data-puppet":!0,"data-waiting":c||void 0,onClick:()=>m(n.id),"aria-label":`Buka terminal — ${u}, ${b}`,children:[e.jsx("span",{className:c?"hn-dlg-puppet hn-dlg-puppet--still":"hn-dlg-puppet",style:{animationDelay:`${s%6*.6}s`},children:e.jsx("img",{src:z(n.projectId),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:u}),e.jsx("span",{className:c?"hn-dlg-prj-sub hn-dlg-prj-sub--amber":"hn-dlg-prj-sub",children:b})]},n.id)}),f.map(n=>e.jsxs("button",{type:"button",className:"hn-dlg-prj hn-dlg-prj--off",onClick:()=>p(n),"aria-label":`Buka project ${n.name}`,children:[e.jsx("span",{className:"hn-dlg-puppet hn-dlg-puppet--still",children:e.jsx("img",{src:z(n.id),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:n.name}),e.jsx("span",{className:"hn-dlg-prj-sub hn-dlg-prj-sub--off",children:"tersandar di debog"})]},n.id))]}):e.jsxs("div",{className:"hn-dlg-empty",children:[e.jsx("div",{children:"Panggung sunyi — belum ada project di workspace."}),e.jsx("div",{children:"Tambahkan project dan sang dalang mengangkat wayangnya."})]})]}),e.jsxs("button",{type:"button",className:"hn-dlg-cmd",onClick:()=>x("terminal"),"aria-label":"Buka terminal — pusat kendali sesi",children:[e.jsx("span",{className:"hn-dlg-mic","aria-hidden":"true"}),e.jsxs("span",{className:"hn-dlg-cmd-t",children:[e.jsx("b",{children:"Perintah dalang"})," — buka Terminal untuk mengarahkan sesi yang berjalan…"]}),e.jsx("span",{className:"hn-dlg-cmd-k",children:"Terminal"})]})]}),e.jsxs("aside",{className:"hn-dlg-rail",children:[e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"AKTIVITAS TERAKHIR"}),Y.length===0?e.jsx("div",{className:"hn-dlg-mut",children:"Belum ada project."}):Y.map(n=>e.jsxs("div",{className:"hn-dlg-act",children:[e.jsx("span",{className:n.live?"hn-dlg-dot hn-dlg-dot--on":"hn-dlg-dot"}),e.jsxs("span",{className:"hn-dlg-act-x",children:[e.jsx("b",{children:n.name})," ",n.text]})]},n.id))]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DISTRIBUSI BACKLOG"}),e.jsxs("div",{className:"hn-dlg-donut-wrap",children:[e.jsxs("div",{className:"hn-dlg-donut",children:[e.jsxs("svg",{viewBox:"0 0 42 42",width:"112",height:"112","aria-hidden":"true",children:[e.jsx("circle",{className:"hn-dlg-ring",cx:"21",cy:"21",r:"15.9",strokeWidth:"5"}),O.map(n=>n.frac>0&&e.jsx("circle",{className:`hn-dlg-seg hn-dlg-seg--${n.cls}`,cx:"21",cy:"21",r:"15.9",strokeWidth:"5",strokeDasharray:`${n.frac} ${100-n.frac}`,strokeDashoffset:n.offset},n.key))]}),e.jsxs("div",{className:"hn-dlg-donut-c",children:[e.jsx("b",{children:D}),e.jsx("span",{children:"backlog"})]})]}),e.jsx("div",{className:"hn-dlg-leg",children:O.map(n=>e.jsxs("span",{children:[e.jsx("i",{className:`hn-dlg-seg--${n.cls}`}),n.label," ",e.jsx("b",{children:n.n})]},n.key))})]})]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DIMULAI · 7 HARI"}),e.jsxs("svg",{viewBox:"0 0 260 100",className:"hn-dlg-chart","aria-hidden":"true",children:[e.jsx("line",{x1:"24",y1:"18",x2:"252",y2:"18"}),e.jsx("line",{x1:"24",y1:"48",x2:"252",y2:"48"}),e.jsx("line",{x1:"24",y1:"78",x2:"252",y2:"78"}),e.jsx("text",{x:"8",y:"21",children:$}),e.jsx("text",{x:"10",y:"81",children:"0"}),e.jsx("polyline",{className:"hn-dlg-trend",points:se}),v.map((n,s)=>e.jsx("circle",{cx:32+s*35,cy:78-n.n/$*60,r:"2.4"},s)),v.map((n,s)=>s%2===0?e.jsx("text",{x:22+s*35,y:"94",children:n.label},`l${s}`):null)]})]})]})]}),e.jsx("div",{className:"hn-dlg-foot",children:"◈  HANOMAN · ORKESTRASI CERDAS · EKSEKUSI SEMPURNA  ◈"})]})}export{ke as DalangHanomanScreen};
1
+ import{i as ie,j as e,b as re,I as E}from"./index-CCJTT5hd.js";import{R as g}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";const de="/assets/hnm-hero-rig-body-v01-DmbKJJHB.webp",ce="/assets/hnm-hero-rig-arm-ul-v01-CIAWAxFe.webp",he="/assets/hnm-hero-rig-arm-ur-v01-C0R0CZnp.webp",oe="/assets/hnm-hero-rig-arm-ml-v01-Kts3pjTf.webp",ge="/assets/hnm-hero-rig-arm-mr-v01-DQgnE6bD.webp",me="/assets/hnm-wayang-satria-alus-v01-CpfoXKTy.webp",ue="/assets/hnm-wayang-satria-gagah-v01-bLfIYAsv.webp",pe="/assets/hnm-wayang-putri-v01-F6p69kHq.webp",xe="/assets/hnm-wayang-panakawan-v01-1LGv-V8N.webp",q=[me,ue,pe,xe],z=a=>q[[...a].reduce((t,o)=>t+o.charCodeAt(0),0)%q.length],V=["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],C=a=>String(a).padStart(2,"0");function je(){return g.useMemo(()=>typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function Ne(){const[a,t]=g.useState(()=>new Date);return g.useEffect(()=>{const o=setInterval(()=>t(new Date),1e3);return()=>clearInterval(o)},[]),a}function ye(a,t){const[o,m]=g.useState(""),p=a.join("|");return g.useEffect(()=>{if(t||a.length===0){m(a[0]??"");return}let x=0,h=0,r=null,d=null;const l=()=>{const y=a[x%a.length]??"";h=0,r=setInterval(()=>{h++,m(y.slice(0,h)),h>=y.length&&r&&(clearInterval(r),r=null,d=setTimeout(()=>{x++,l()},3200))},26)};return l(),()=>{r&&clearInterval(r),d&&clearTimeout(d)}},[p,t]),o}function S(a,t){const[o,m]=g.useState(t?a:0);return g.useEffect(()=>{if(t){m(a);return}const p=performance.now(),x=900;let h=0;const r=d=>{const l=Math.min(1,(d-p)/x);m(Math.round(a*(1-Math.pow(1-l,3)))),l<1&&(h=requestAnimationFrame(r))};return h=requestAnimationFrame(r),()=>cancelAnimationFrame(h)},[a,t]),o}function M({icon:a,tone:t,label:o,value:m,sub:p}){return e.jsxs("div",{className:"hn-dlg-kpi",children:[e.jsx("span",{className:`hn-dlg-kpi-ic hn-dlg-tone-${t}`,children:e.jsx(E,{name:a,size:17})}),e.jsxs("span",{style:{minWidth:0},children:[e.jsx("span",{className:"hn-dlg-kpi-l",children:o}),e.jsx("span",{className:"hn-dlg-kpi-v",children:m}),e.jsx("span",{className:"hn-dlg-kpi-s",children:p})]})]})}function ke({projects:a,backlog:t,sessions:o,onOpenSession:m,onOpenProject:p,onGoto:x,onExit:h}){const r=je(),d=Ne();g.useEffect(()=>{const n=s=>{s.key==="Escape"&&h()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[h]);const l=o.filter(n=>!n.exited).sort((n,s)=>n.id.localeCompare(s.id)),y=new Set(l.map(n=>n.projectId)),f=a.filter(n=>!y.has(n.id)),R=l.filter(n=>!!n.decision&&!n.deciding).length,F=t.filter(n=>ie(n.startedAt)).length,Q=S(a.length,r),X=S(F,r),Z=S(l.length,r),_=S(R,r),ee=ye([l.length>0?`HANOMAN ONLINE · ${l.length} SESI HIDUP`:"HANOMAN ONLINE · KELIR SUNYI",`${F} TASK DIKERJAKAN HARI INI`,R>0?`${R} SESI MENUNGGU JAWABANMU`:"SEMUA SISTEM NORMAL",`${a.length} PROYEK DALAM PANTAUAN`],r),j={done:0,executing:0,planned:0,spec:0};for(const n of t)n.stage==="done"?j.done++:n.stage==="executing"?j.executing++:n.stage==="planned"?j.planned++:j.spec++;const D=t.length,ne=[{key:"executing",cls:"wind",label:"Execute"},{key:"done",cls:"leaf",label:"Done"},{key:"planned",cls:"amber",label:"Plan"},{key:"spec",cls:"brass",label:"Spec"}];let L=0;const O=ne.map(n=>{const s=D?j[n.key]/D*100:0,u={...n,n:j[n.key],frac:s,offset:25-L};return L+=s,u}),v=[];for(let n=6;n>=0;n--){const s=new Date(d.getFullYear(),d.getMonth(),d.getDate()-n),u=t.filter(i=>{if(!i.startedAt)return!1;const c=new Date(i.startedAt);return c.getFullYear()===s.getFullYear()&&c.getMonth()===s.getMonth()&&c.getDate()===s.getDate()}).length;v.push({label:`${s.getDate()} ${V[s.getMonth()]}`,n:u})}const $=Math.max(1,...v.map(n=>n.n)),se=v.map((n,s)=>`${32+s*35},${78-n.n/$*60}`).join(" "),ae=`${l.map(n=>n.id).join("|")}#${f.map(n=>n.id).join("|")}`,H=g.useRef(null),[P,W]=g.useState([]);g.useLayoutEffect(()=>{const n=H.current;if(!n||l.length===0&&f.length===0){W([]);return}const s=()=>{var J;const i=n.getBoundingClientRect();if(i.width<60)return;const c=(J=n.querySelector(".hn-dlg-hero-art"))==null?void 0:J.getBoundingClientRect(),b=c?c.left+c.width/2-i.left:i.width/2,w={};n.querySelectorAll("[data-hand]").forEach(N=>{const A=N.getBoundingClientRect();w[N.dataset.hand??""]={x:A.left+A.width/2-i.left,y:A.top+A.height/2-i.top}});const k={x:b,y:c?c.top-i.top+c.height*.36:i.height*.35},G=[];n.querySelectorAll(".hn-dlg-prj").forEach(N=>{const U=(N.querySelector(".hn-dlg-puppet img")??N).getBoundingClientRect(),T=U.left+U.width/2-i.left,K=U.top-i.top+1,B=!N.hasAttribute("data-puppet"),te=T<b?"l":"r",I=w[(B?"m":"u")+te]??k,le=B?Math.max(I.y,K)+26:Math.min(I.y,K)-16;G.push({d:`M ${I.x.toFixed(1)} ${I.y.toFixed(1)} Q ${((I.x+T)/2).toFixed(1)} ${le.toFixed(1)}, ${T.toFixed(1)} ${K.toFixed(1)}`,slack:B})}),W(G)};if(s(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(s);return u.observe(n),()=>u.disconnect()},[ae,l.length,f.length]);const Y=a.slice(0,6).map(n=>({id:n.id,name:n.name,text:n.activity,commit:n.commit,live:y.has(n.id)}));return e.jsxs("div",{className:"hn-dlg",children:[e.jsxs("div",{className:"hn-dlg-top hn-wrap-mobile",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[e.jsx("img",{className:"hn-dlg-blencong",src:re,alt:"","aria-hidden":"true","data-lit":l.length>0||void 0}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("h2",{className:"hn-dlg-title",children:"Dalang Hanoman"}),e.jsx("p",{className:"hn-dlg-boot","aria-live":"off",children:ee})]})]}),e.jsxs("div",{className:"hn-dlg-chips",children:[e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"calendar",size:13}),d.getDate()," ",V[d.getMonth()]," ",d.getFullYear()]}),e.jsxs("span",{className:"hn-dlg-chip",children:[e.jsx(E,{name:"clock",size:13}),C(d.getHours()),":",C(d.getMinutes()),":",C(d.getSeconds())]}),e.jsx("button",{type:"button",className:"hn-dlg-exit",onClick:h,"aria-label":"Keluar dari panggung (Esc)",children:e.jsx(E,{name:"x",size:14})})]})]}),e.jsxs("div",{className:"hn-dlg-kpis",children:[e.jsx(M,{icon:"layout-grid",tone:"wind",label:"TOTAL PROYEK",value:Q,sub:"dalam pantauan"}),e.jsx(M,{icon:"check-circle-2",tone:"leaf",label:"TASK HARI INI",value:X,sub:"mulai dikerjakan"}),e.jsx(M,{icon:"activity",tone:"brass",label:"SESI BERJALAN",value:Z,sub:"wayang dimainkan"}),e.jsx(M,{icon:"hand",tone:"amber",label:"MENUNGGU KAMU",value:_,sub:"butuh keputusan"})]}),e.jsxs("div",{className:"hn-dlg-grid hn-grid-mobile",children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{className:"hn-dlg-hero",ref:H,children:[e.jsxs("svg",{className:"hn-dlg-hud",viewBox:"0 0 330 330","aria-hidden":"true",children:[e.jsx("g",{className:"hn-dlg-hud-a",children:e.jsx("circle",{cx:"165",cy:"165",r:"150",strokeDasharray:"3 14"})}),e.jsx("g",{className:"hn-dlg-hud-b",children:e.jsx("circle",{cx:"165",cy:"165",r:"126",strokeDasharray:"40 22"})})]}),P.length>0&&e.jsx("svg",{className:"hn-dlg-threads","aria-hidden":"true",focusable:"false",children:P.map((n,s)=>e.jsx("path",{d:n.d,className:n.slack?"hn-dlg-thread--slack":void 0,style:n.slack?void 0:{animationDelay:`${s%6*.3}s`}},s))}),e.jsx("div",{className:"hn-dlg-scan","aria-hidden":"true"}),e.jsxs("div",{className:"hn-dlg-hero-art","aria-hidden":"true",children:[e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ul",src:ce,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ur",src:he,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--ml",src:oe,alt:""}),e.jsx("img",{className:"hn-dlg-rig-arm hn-dlg-rig-arm--mr",src:ge,alt:""}),e.jsx("img",{className:"hn-dlg-rig-body",src:de,alt:""}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ul"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ur"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"ml"}),e.jsx("span",{className:"hn-dlg-hand","data-hand":"mr"})]}),l.length>0||f.length>0?e.jsxs("div",{className:"hn-dlg-cards",role:"list","aria-label":"Wayang project",children:[l.map((n,s)=>{var w;const u=((w=a.find(k=>k.id===n.projectId))==null?void 0:w.name)??n.projectId,i=n.specId?t.find(k=>k.id===n.specId):void 0,c=!!n.decision&&!n.deciding,b=c?"menunggu jawabanmu":i?`${i.id} · ${i.stage}`:n.flow??"sesi terminal";return e.jsxs("button",{type:"button",className:"hn-dlg-prj","data-puppet":!0,"data-waiting":c||void 0,onClick:()=>m(n.id),"aria-label":`Buka terminal — ${u}, ${b}`,children:[e.jsx("span",{className:c?"hn-dlg-puppet hn-dlg-puppet--still":"hn-dlg-puppet",style:{animationDelay:`${s%6*.6}s`},children:e.jsx("img",{src:z(n.projectId),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:u}),e.jsx("span",{className:c?"hn-dlg-prj-sub hn-dlg-prj-sub--amber":"hn-dlg-prj-sub",children:b})]},n.id)}),f.map(n=>e.jsxs("button",{type:"button",className:"hn-dlg-prj hn-dlg-prj--off",onClick:()=>p(n),"aria-label":`Buka project ${n.name}`,children:[e.jsx("span",{className:"hn-dlg-puppet hn-dlg-puppet--still",children:e.jsx("img",{src:z(n.id),alt:"","aria-hidden":"true"})}),e.jsx("span",{className:"hn-dlg-prj-name",children:n.name}),e.jsx("span",{className:"hn-dlg-prj-sub hn-dlg-prj-sub--off",children:"tersandar di debog"})]},n.id))]}):e.jsxs("div",{className:"hn-dlg-empty",children:[e.jsx("div",{children:"Panggung sunyi — belum ada project di workspace."}),e.jsx("div",{children:"Tambahkan project dan sang dalang mengangkat wayangnya."})]})]}),e.jsxs("button",{type:"button",className:"hn-dlg-cmd",onClick:()=>x("terminal"),"aria-label":"Buka terminal — pusat kendali sesi",children:[e.jsx("span",{className:"hn-dlg-mic","aria-hidden":"true"}),e.jsxs("span",{className:"hn-dlg-cmd-t",children:[e.jsx("b",{children:"Perintah dalang"})," — buka Terminal untuk mengarahkan sesi yang berjalan…"]}),e.jsx("span",{className:"hn-dlg-cmd-k",children:"Terminal"})]})]}),e.jsxs("aside",{className:"hn-dlg-rail",children:[e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"AKTIVITAS TERAKHIR"}),Y.length===0?e.jsx("div",{className:"hn-dlg-mut",children:"Belum ada project."}):Y.map(n=>e.jsxs("div",{className:"hn-dlg-act",children:[e.jsx("span",{className:n.live?"hn-dlg-dot hn-dlg-dot--on":"hn-dlg-dot"}),e.jsxs("span",{className:"hn-dlg-act-x",children:[e.jsx("b",{children:n.name})," ",n.text]})]},n.id))]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DISTRIBUSI BACKLOG"}),e.jsxs("div",{className:"hn-dlg-donut-wrap",children:[e.jsxs("div",{className:"hn-dlg-donut",children:[e.jsxs("svg",{viewBox:"0 0 42 42",width:"112",height:"112","aria-hidden":"true",children:[e.jsx("circle",{className:"hn-dlg-ring",cx:"21",cy:"21",r:"15.9",strokeWidth:"5"}),O.map(n=>n.frac>0&&e.jsx("circle",{className:`hn-dlg-seg hn-dlg-seg--${n.cls}`,cx:"21",cy:"21",r:"15.9",strokeWidth:"5",strokeDasharray:`${n.frac} ${100-n.frac}`,strokeDashoffset:n.offset},n.key))]}),e.jsxs("div",{className:"hn-dlg-donut-c",children:[e.jsx("b",{children:D}),e.jsx("span",{children:"backlog"})]})]}),e.jsx("div",{className:"hn-dlg-leg",children:O.map(n=>e.jsxs("span",{children:[e.jsx("i",{className:`hn-dlg-seg--${n.cls}`}),n.label," ",e.jsx("b",{children:n.n})]},n.key))})]})]}),e.jsxs("div",{className:"hn-dlg-card",children:[e.jsx("div",{className:"hn-dlg-rt",children:"DIMULAI · 7 HARI"}),e.jsxs("svg",{viewBox:"0 0 260 100",className:"hn-dlg-chart","aria-hidden":"true",children:[e.jsx("line",{x1:"24",y1:"18",x2:"252",y2:"18"}),e.jsx("line",{x1:"24",y1:"48",x2:"252",y2:"48"}),e.jsx("line",{x1:"24",y1:"78",x2:"252",y2:"78"}),e.jsx("text",{x:"8",y:"21",children:$}),e.jsx("text",{x:"10",y:"81",children:"0"}),e.jsx("polyline",{className:"hn-dlg-trend",points:se}),v.map((n,s)=>e.jsx("circle",{cx:32+s*35,cy:78-n.n/$*60,r:"2.4"},s)),v.map((n,s)=>s%2===0?e.jsx("text",{x:22+s*35,y:"94",children:n.label},`l${s}`):null)]})]})]})]}),e.jsx("div",{className:"hn-dlg-foot",children:"◈  HANOMAN · ORKESTRASI CERDAS · EKSEKUSI SEMPURNA  ◈"})]})}export{ke as DalangHanomanScreen};
@@ -1 +1 @@
1
- import{j as e,M as r,aw as d,ay as a,f as x}from"./index-B_pRoVeM.js";import"./react-DfGhg7ZW.js";function m({path:i,text:o,eyebrow:n,download:t,onClose:s}){const l=i.slice(i.lastIndexOf("/")+1)||i;return e.jsx(r,{open:!0,title:l,eyebrow:n??i,icon:"book-open",onClose:s,width:980,fillHeight:!0,children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[t&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",paddingBottom:6,borderBottom:"1px solid var(--border-hair)",marginBottom:8},children:e.jsx(d,{href:t})}),e.jsx("div",{"data-testid":"doc-preview-scroll",style:{flex:"1 1 0",minHeight:0,overflow:"auto",padding:"0 4px 8px"},children:o?e.jsx(a,{text:o,name:i}):e.jsx(x,{kind:"empty",icon:"file-text",title:"Berkas kosong",hint:i})})]})})}export{m as D};
1
+ import{j as e,M as r,aw as d,ay as a,f as x}from"./index-CCJTT5hd.js";import"./react-DfGhg7ZW.js";function m({path:i,text:o,eyebrow:n,download:t,onClose:s}){const l=i.slice(i.lastIndexOf("/")+1)||i;return e.jsx(r,{open:!0,title:l,eyebrow:n??i,icon:"book-open",onClose:s,width:980,fillHeight:!0,children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[t&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",paddingBottom:6,borderBottom:"1px solid var(--border-hair)",marginBottom:8},children:e.jsx(d,{href:t})}),e.jsx("div",{"data-testid":"doc-preview-scroll",style:{flex:"1 1 0",minHeight:0,overflow:"auto",padding:"0 4px 8px"},children:o?e.jsx(a,{text:o,name:i}):e.jsx(x,{kind:"empty",icon:"file-text",title:"Berkas kosong",hint:i})})]})})}export{m as D};
@@ -1,3 +1,3 @@
1
- import{h as re,u as oe,e as y,j as e,v as le,aq as T,am as de,a as j,f as b,aN as ce,I as k,B as $,aw as xe,ay as A,p as pe,aA as ue}from"./index-B_pRoVeM.js";import{R as l}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";function q(s){let a={...s,kids:s.kids.map(q)};for(;!a.cat&&a.kids.length===1;){const i=a.kids[0];a={...i,label:a.label+"/"+i.label}}return a}function G(s){const a={path:"",kids:[]};for(const i of s){if(i.cat==="."){a.kids.push({path:".",label:".",cat:i,kids:[]});continue}let r=a;for(const x of i.cat.split("/")){const g=r.path?r.path+"/"+x:x;let d=r.kids.find(t=>t.path===g);d||(d={path:g,label:x,kids:[]},r.kids.push(d)),r=d}r.cat=i}return a.kids.map(q)}function O(s){const a=s.find(i=>i.scored&&i.linked)??s.find(i=>i.scored)??s[0];return a&&a.files[0]?`${a.cat}/${a.files[0]}`:""}function I({node:s,selected:a,onSelect:i,depth:r=0}){var h,u,p;const[x,g]=l.useState(!1),d=((h=s.cat)==null?void 0:h.scored)??!0,t=((u=s.cat)==null?void 0:u.linked)??!0;return e.jsxs("div",{style:r===0?{borderBottom:"1px solid var(--border-hair)"}:void 0,children:[e.jsxs("button",{onClick:()=>g(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"9px 6px",paddingLeft:6+r*12,border:"none",background:"transparent",cursor:"pointer",textAlign:"left"},children:[e.jsx(k,{name:x?"chevron-down":"chevron-right",size:14,color:"var(--text-subtle)"}),e.jsx(k,{name:"folder",size:15,color:d?t?"var(--brass-500)":"var(--clay-500)":"var(--text-subtle)"}),e.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:12.5,color:"var(--text-strong)",fontWeight:500},children:[s.label,"/"]}),e.jsx("span",{style:{flex:1}}),s.cat&&d&&(s.cat.linked?e.jsx(k,{name:"link",size:13,color:"var(--leaf-600)"}):e.jsx(k,{name:"unlink",size:13,color:"var(--clay-500)"}))]}),x&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,paddingBottom:4},children:[s.kids.map(c=>e.jsx(I,{node:c,selected:a,onSelect:i,depth:r+1},c.path)),(p=s.cat)==null?void 0:p.files.map(c=>{const f=s.path+"/"+c,v=f===a;return e.jsxs("button",{onClick:()=>i(f),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",paddingLeft:18+r*12,borderRadius:"var(--radius-sm)",border:"none",cursor:"pointer",textAlign:"left",background:v?"var(--brass-100)":"transparent"},children:[e.jsx(k,{name:"file-text",size:13,color:v?"var(--brass-700)":"var(--text-subtle)"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:v?"var(--brass-700)":!d||t?"var(--text-body)":"var(--text-muted)",fontWeight:v?600:400},children:c})]},c)})]})]})}function ve({projectId:s,projectName:a,docStatus:i}){const[r,x]=l.useState([]),[g,d]=l.useState(0),[t,h]=re(ue("docs",s),"selected","",pe),[u,p]=l.useState({}),[c,f]=l.useState("preview"),[v,F]=l.useState("tree"),[w,M]=l.useState(""),[S,P]=l.useState(!1),{confirm:J,dialog:K}=oe(),[H,z]=l.useState("loading"),[U,V]=l.useState(0);l.useEffect(()=>{let n=!0;return z("loading"),y.getDocs(s).then(o=>{if(!n)return;const m=o.tree;x(m),d(o.coverage),p({}),f("preview"),z("ready"),h(O(m))}).catch(()=>{n&&(x([]),h(""),z("error"))}),()=>{n=!1}},[s,U]),l.useEffect(()=>{if(!t||t in u)return;let n=!0;return y.getDoc(s,t).then(o=>{n&&p(m=>({...m,[t]:o.content}))}).catch(()=>{n&&p(o=>({...o,[t]:null}))}),()=>{n=!1}},[t,s,u]);const D=!!t&&!(t in u),C=t?u[t]===null:!1,Q=()=>p(n=>{const o={...n};return delete o[t],o}),X=l.useMemo(()=>G(r.filter(n=>n.scored)),[r]),L=l.useMemo(()=>G(r.filter(n=>!n.scored)),[r]),N=u[t]??"",Y=t.includes("/")?t.slice(0,t.lastIndexOf("/")):".",B=r.find(n=>n.cat===Y),Z=t,_=i==="broken"?"err":i==="drift"?"warn":"ok",ee=i==="broken"?"broken":i==="drift"?"drift":"ok";function te(){M(N),f("edit")}function ne(){f("preview")}async function se(){await y.putDoc(s,t,w),p(n=>({...n,[t]:w})),f("preview")}function E(n){h(n),f("preview"),F("viewer")}async function R(){const n=await y.getDocs(s),o=n.tree;x(o),d(n.coverage),o.some(m=>m.files.some(ie=>`${m.cat}/${ie}`===t))||h(O(o))}async function W(){if(!S){P(!0);try{await R()}finally{P(!1)}}}async function ae(){t&&await J({title:`Hapus ${t}?`,message:"Berkas aslinya di disk ikut dihapus — dokumen ini adalah Source of Truth project.",confirmLabel:"Hapus dokumen",run:()=>y.deleteDoc(s,t)})&&(p(n=>{const o={...n};return delete o[t],o}),await R())}return e.jsxs(e.Fragment,{children:[e.jsx(le,{ariaLabel:"Panel Docs",active:v,onActiveChange:n=>F(n),masterWidth:288,className:"hn-workspace-panels",panels:[{id:"tree",label:"Files",className:"hn-panel-flex",content:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,minHeight:0,overflow:"auto"},children:[e.jsxs(T,{padding:0,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"12px 14px",borderBottom:"1px solid var(--border-hair)"},children:[e.jsxs("span",{className:"hn-eyebrow",children:["docs · ",a]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(de,{status:ee,size:"sm"}),e.jsx(j,{size:"sm",variant:"ghost",leftIcon:S?"loader":"radar",onClick:W,disabled:S,children:S?"…":"Muat ulang"})]})]}),e.jsx("div",{style:{padding:"4px 8px"},children:H==="loading"?e.jsx(b,{kind:"loading",compact:!0,title:"Memuat index…"}):H==="error"?e.jsx(b,{kind:"error",compact:!0,title:"Gagal memuat index docs",hint:a,action:()=>V(n=>n+1)}):r.length===0?e.jsx(b,{kind:"empty",compact:!0,icon:"folder-open",title:"Belum ada docs",hint:"Belum ada Markdown di repo ini.",action:W,actionLabel:"Muat ulang",actionIcon:"radar"}):e.jsxs(e.Fragment,{children:[X.map(n=>e.jsx(I,{node:n,selected:t,onSelect:E},n.path)),L.length>0&&e.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:"1px solid var(--border-hair)"},children:[e.jsx("div",{className:"hn-eyebrow",style:{padding:"4px 6px",color:"var(--text-subtle)"},children:"Lainnya (tidak dinilai)"}),L.map(n=>e.jsx(I,{node:n,selected:t,onSelect:E},n.path))]})]})})]}),e.jsxs(T,{padding:16,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("span",{className:"hn-eyebrow",children:"SoT coverage"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-muted)"},children:a})]}),e.jsx(ce,{value:g,showLabel:!0,label:"Kategori ter-index",tone:_})]})]})},{id:"viewer",label:"Dokumen",className:"hn-panel-flex",content:e.jsxs(T,{padding:0,fill:!0,children:[e.jsxs("div",{style:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:"1px solid var(--border-hair)",flexWrap:"wrap"},children:[e.jsx(k,{name:"file-text",size:15,color:"var(--text-muted)"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-strong)",fontWeight:500},children:Z}),B&&B.scored&&(B.linked?e.jsx($,{tone:"ok",size:"sm",icon:"link",children:"indexed"}):e.jsx($,{tone:"err",size:"sm",icon:"unlink",children:"unlinked"})),e.jsx("span",{style:{flex:1}}),c==="preview"?e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(xe,{href:n=>y.docDownloadUrl(s,t,n),disabled:!t||D||C}),e.jsx(j,{size:"sm",variant:"ghost",leftIcon:"trash-2",onClick:ae,disabled:!t,children:"Hapus"}),e.jsx(j,{size:"sm",variant:"secondary",leftIcon:"pencil",onClick:te,disabled:!t||D||C,children:"Edit"})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(j,{size:"sm",variant:"ghost",onClick:ne,children:"Batal"}),e.jsx(j,{size:"sm",leftIcon:"check",onClick:se,children:"Simpan"})]})]}),c==="preview"?e.jsx("div",{"data-testid":"doc-preview-scroll",style:{padding:"8px 30px 34px",flex:"1 1 auto",minHeight:0,overflow:"auto"},children:t?D?e.jsx(b,{kind:"loading",title:"Memuat dokumen…",hint:t}):C?e.jsx(b,{kind:"error",title:"Gagal memuat dokumen",hint:t,action:Q}):e.jsx(A,{text:N,name:t}):e.jsx(b,{kind:"empty",icon:"file-text",title:"Tidak ada dokumen dipilih",hint:"Pilih file dari pohon docs di kiri."})}):e.jsxs("div",{className:"hn-grid-mobile",style:{display:"grid",gridTemplateColumns:"1fr 1fr",flex:"1 1 auto",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-hair)",minHeight:0},children:[e.jsx("div",{style:{padding:"8px 14px",borderBottom:"1px solid var(--border-hair)",background:"var(--bone-100)"},children:e.jsx("span",{className:"hn-eyebrow",children:"Markdown"})}),e.jsx("textarea",{value:w,onChange:n=>M(n.target.value),spellCheck:!1,placeholder:`# Judul dokumen
1
+ import{h as re,u as oe,e as y,j as e,v as le,aq as T,am as de,a as j,f as b,aN as ce,I as k,B as $,aw as xe,ay as A,p as pe,aA as ue}from"./index-CCJTT5hd.js";import{R as l}from"./react-DfGhg7ZW.js";import"./markdown-CWEY34jk.js";import"./xterm-3VOAfa_q.js";function q(s){let a={...s,kids:s.kids.map(q)};for(;!a.cat&&a.kids.length===1;){const i=a.kids[0];a={...i,label:a.label+"/"+i.label}}return a}function G(s){const a={path:"",kids:[]};for(const i of s){if(i.cat==="."){a.kids.push({path:".",label:".",cat:i,kids:[]});continue}let r=a;for(const x of i.cat.split("/")){const g=r.path?r.path+"/"+x:x;let d=r.kids.find(t=>t.path===g);d||(d={path:g,label:x,kids:[]},r.kids.push(d)),r=d}r.cat=i}return a.kids.map(q)}function O(s){const a=s.find(i=>i.scored&&i.linked)??s.find(i=>i.scored)??s[0];return a&&a.files[0]?`${a.cat}/${a.files[0]}`:""}function I({node:s,selected:a,onSelect:i,depth:r=0}){var h,u,p;const[x,g]=l.useState(!1),d=((h=s.cat)==null?void 0:h.scored)??!0,t=((u=s.cat)==null?void 0:u.linked)??!0;return e.jsxs("div",{style:r===0?{borderBottom:"1px solid var(--border-hair)"}:void 0,children:[e.jsxs("button",{onClick:()=>g(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"9px 6px",paddingLeft:6+r*12,border:"none",background:"transparent",cursor:"pointer",textAlign:"left"},children:[e.jsx(k,{name:x?"chevron-down":"chevron-right",size:14,color:"var(--text-subtle)"}),e.jsx(k,{name:"folder",size:15,color:d?t?"var(--brass-500)":"var(--clay-500)":"var(--text-subtle)"}),e.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:12.5,color:"var(--text-strong)",fontWeight:500},children:[s.label,"/"]}),e.jsx("span",{style:{flex:1}}),s.cat&&d&&(s.cat.linked?e.jsx(k,{name:"link",size:13,color:"var(--leaf-600)"}):e.jsx(k,{name:"unlink",size:13,color:"var(--clay-500)"}))]}),x&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,paddingBottom:4},children:[s.kids.map(c=>e.jsx(I,{node:c,selected:a,onSelect:i,depth:r+1},c.path)),(p=s.cat)==null?void 0:p.files.map(c=>{const f=s.path+"/"+c,v=f===a;return e.jsxs("button",{onClick:()=>i(f),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",paddingLeft:18+r*12,borderRadius:"var(--radius-sm)",border:"none",cursor:"pointer",textAlign:"left",background:v?"var(--brass-100)":"transparent"},children:[e.jsx(k,{name:"file-text",size:13,color:v?"var(--brass-700)":"var(--text-subtle)"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:v?"var(--brass-700)":!d||t?"var(--text-body)":"var(--text-muted)",fontWeight:v?600:400},children:c})]},c)})]})]})}function ve({projectId:s,projectName:a,docStatus:i}){const[r,x]=l.useState([]),[g,d]=l.useState(0),[t,h]=re(ue("docs",s),"selected","",pe),[u,p]=l.useState({}),[c,f]=l.useState("preview"),[v,F]=l.useState("tree"),[w,M]=l.useState(""),[S,P]=l.useState(!1),{confirm:J,dialog:K}=oe(),[H,z]=l.useState("loading"),[U,V]=l.useState(0);l.useEffect(()=>{let n=!0;return z("loading"),y.getDocs(s).then(o=>{if(!n)return;const m=o.tree;x(m),d(o.coverage),p({}),f("preview"),z("ready"),h(O(m))}).catch(()=>{n&&(x([]),h(""),z("error"))}),()=>{n=!1}},[s,U]),l.useEffect(()=>{if(!t||t in u)return;let n=!0;return y.getDoc(s,t).then(o=>{n&&p(m=>({...m,[t]:o.content}))}).catch(()=>{n&&p(o=>({...o,[t]:null}))}),()=>{n=!1}},[t,s,u]);const D=!!t&&!(t in u),C=t?u[t]===null:!1,Q=()=>p(n=>{const o={...n};return delete o[t],o}),X=l.useMemo(()=>G(r.filter(n=>n.scored)),[r]),L=l.useMemo(()=>G(r.filter(n=>!n.scored)),[r]),N=u[t]??"",Y=t.includes("/")?t.slice(0,t.lastIndexOf("/")):".",B=r.find(n=>n.cat===Y),Z=t,_=i==="broken"?"err":i==="drift"?"warn":"ok",ee=i==="broken"?"broken":i==="drift"?"drift":"ok";function te(){M(N),f("edit")}function ne(){f("preview")}async function se(){await y.putDoc(s,t,w),p(n=>({...n,[t]:w})),f("preview")}function E(n){h(n),f("preview"),F("viewer")}async function R(){const n=await y.getDocs(s),o=n.tree;x(o),d(n.coverage),o.some(m=>m.files.some(ie=>`${m.cat}/${ie}`===t))||h(O(o))}async function W(){if(!S){P(!0);try{await R()}finally{P(!1)}}}async function ae(){t&&await J({title:`Hapus ${t}?`,message:"Berkas aslinya di disk ikut dihapus — dokumen ini adalah Source of Truth project.",confirmLabel:"Hapus dokumen",run:()=>y.deleteDoc(s,t)})&&(p(n=>{const o={...n};return delete o[t],o}),await R())}return e.jsxs(e.Fragment,{children:[e.jsx(le,{ariaLabel:"Panel Docs",active:v,onActiveChange:n=>F(n),masterWidth:288,className:"hn-workspace-panels",panels:[{id:"tree",label:"Files",className:"hn-panel-flex",content:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,minHeight:0,overflow:"auto"},children:[e.jsxs(T,{padding:0,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"12px 14px",borderBottom:"1px solid var(--border-hair)"},children:[e.jsxs("span",{className:"hn-eyebrow",children:["docs · ",a]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(de,{status:ee,size:"sm"}),e.jsx(j,{size:"sm",variant:"ghost",leftIcon:S?"loader":"radar",onClick:W,disabled:S,children:S?"…":"Muat ulang"})]})]}),e.jsx("div",{style:{padding:"4px 8px"},children:H==="loading"?e.jsx(b,{kind:"loading",compact:!0,title:"Memuat index…"}):H==="error"?e.jsx(b,{kind:"error",compact:!0,title:"Gagal memuat index docs",hint:a,action:()=>V(n=>n+1)}):r.length===0?e.jsx(b,{kind:"empty",compact:!0,icon:"folder-open",title:"Belum ada docs",hint:"Belum ada Markdown di repo ini.",action:W,actionLabel:"Muat ulang",actionIcon:"radar"}):e.jsxs(e.Fragment,{children:[X.map(n=>e.jsx(I,{node:n,selected:t,onSelect:E},n.path)),L.length>0&&e.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:"1px solid var(--border-hair)"},children:[e.jsx("div",{className:"hn-eyebrow",style:{padding:"4px 6px",color:"var(--text-subtle)"},children:"Lainnya (tidak dinilai)"}),L.map(n=>e.jsx(I,{node:n,selected:t,onSelect:E},n.path))]})]})})]}),e.jsxs(T,{padding:16,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("span",{className:"hn-eyebrow",children:"SoT coverage"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-muted)"},children:a})]}),e.jsx(ce,{value:g,showLabel:!0,label:"Kategori ter-index",tone:_})]})]})},{id:"viewer",label:"Dokumen",className:"hn-panel-flex",content:e.jsxs(T,{padding:0,fill:!0,children:[e.jsxs("div",{style:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:"1px solid var(--border-hair)",flexWrap:"wrap"},children:[e.jsx(k,{name:"file-text",size:15,color:"var(--text-muted)"}),e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-strong)",fontWeight:500},children:Z}),B&&B.scored&&(B.linked?e.jsx($,{tone:"ok",size:"sm",icon:"link",children:"indexed"}):e.jsx($,{tone:"err",size:"sm",icon:"unlink",children:"unlinked"})),e.jsx("span",{style:{flex:1}}),c==="preview"?e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(xe,{href:n=>y.docDownloadUrl(s,t,n),disabled:!t||D||C}),e.jsx(j,{size:"sm",variant:"ghost",leftIcon:"trash-2",onClick:ae,disabled:!t,children:"Hapus"}),e.jsx(j,{size:"sm",variant:"secondary",leftIcon:"pencil",onClick:te,disabled:!t||D||C,children:"Edit"})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(j,{size:"sm",variant:"ghost",onClick:ne,children:"Batal"}),e.jsx(j,{size:"sm",leftIcon:"check",onClick:se,children:"Simpan"})]})]}),c==="preview"?e.jsx("div",{"data-testid":"doc-preview-scroll",style:{padding:"8px 30px 34px",flex:"1 1 auto",minHeight:0,overflow:"auto"},children:t?D?e.jsx(b,{kind:"loading",title:"Memuat dokumen…",hint:t}):C?e.jsx(b,{kind:"error",title:"Gagal memuat dokumen",hint:t,action:Q}):e.jsx(A,{text:N,name:t}):e.jsx(b,{kind:"empty",icon:"file-text",title:"Tidak ada dokumen dipilih",hint:"Pilih file dari pohon docs di kiri."})}):e.jsxs("div",{className:"hn-grid-mobile",style:{display:"grid",gridTemplateColumns:"1fr 1fr",flex:"1 1 auto",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-hair)",minHeight:0},children:[e.jsx("div",{style:{padding:"8px 14px",borderBottom:"1px solid var(--border-hair)",background:"var(--bone-100)"},children:e.jsx("span",{className:"hn-eyebrow",children:"Markdown"})}),e.jsx("textarea",{value:w,onChange:n=>M(n.target.value),spellCheck:!1,placeholder:`# Judul dokumen
2
2
 
3
3
  Paragraf pembuka…`,style:{flex:1,width:"100%",boxSizing:"border-box",resize:"none",border:"none",outline:"none",padding:"16px 18px",fontFamily:"var(--font-mono)",fontSize:12.5,lineHeight:1.7,color:"var(--text-body)",background:"var(--surface-card)"}})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[e.jsx("div",{style:{padding:"8px 14px",borderBottom:"1px solid var(--border-hair)",background:"var(--bone-100)"},children:e.jsx("span",{className:"hn-eyebrow",children:"Preview langsung"})}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:"4px 24px 24px"},children:e.jsx(A,{text:w,name:t})})]})]})]})}]}),K]})}export{ve as DocsWorkspace,G as buildTree,O as firstDoc};