codeplane-darwin-x64-baseline 29.0.2 → 29.0.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.
- package/bin/codeplane +0 -0
- package/bin/runtime/tui/{_baseUniq-CrI-l4T--cb6yr85h.js → _baseUniq-9IXs6AhY-xerpsxzt.js} +1 -1
- package/bin/runtime/tui/{ar-CqzjnUvN-gaphv1km.js → ar-Bxa58vxZ-vt30m277.js} +1 -1
- package/bin/runtime/tui/{ar-CxO8Ew7O-stq9azvm.js → ar-CnXvFVLB-v0ce16jh.js} +1 -1
- package/bin/runtime/tui/{arc-Bt3WuS2u-gn91jh04.js → arc-D8LxKTdE-1faf5pds.js} +1 -1
- package/bin/runtime/tui/{architectureDiagram-Q4EWVU46-q_d4y-ss-be0rswpv.js → architectureDiagram-Q4EWVU46-DhlSOEKp-9ra6q39b.js} +1 -1
- package/bin/runtime/tui/{blockDiagram-DXYQGD6D-CuS4Kd7Z-mky2hrc6.js → blockDiagram-DXYQGD6D-DufDOzD4-86m5brwb.js} +1 -1
- package/bin/runtime/tui/{br-DRNVRO5v-1z50cx7x.js → br-Cg_ubWNg-px0kf2ge.js} +1 -1
- package/bin/runtime/tui/{br-DsEvYtyk-cee00zby.js → br-UxZZr_6Z-7ce7bqha.js} +1 -1
- package/bin/runtime/tui/{bs-CNNWsHRf-nk64sysf.js → bs-CK1F4XVi-p5tf3jap.js} +1 -1
- package/bin/runtime/tui/{bs-36LABFkb-kkpk3v7t.js → bs-CR3gfdfe-wacwd0jc.js} +1 -1
- package/bin/runtime/tui/{c4Diagram-AHTNJAMY-Dcnb_pkt-mrvvr6tn.js → c4Diagram-AHTNJAMY-BpBSKKdm-vjaa2kwd.js} +1 -1
- package/bin/runtime/tui/channel-BH1KxADU-2vmyx7px.js +1 -0
- package/bin/runtime/tui/{chunk-4BX2VUAB-CO-inVq2-3y8hh51f.js → chunk-4BX2VUAB-DzRqDDiV-hj8ysd51.js} +1 -1
- package/bin/runtime/tui/{chunk-4TB4RGXK-CsRL3WM2-7q9qn2jn.js → chunk-4TB4RGXK-BW6S0i1e-9tk67p28.js} +1 -1
- package/bin/runtime/tui/{chunk-55IACEB6-Rs_fhZZp-ajc25shr.js → chunk-55IACEB6-BTNwDbAG-vtxy5hh6.js} +1 -1
- package/bin/runtime/tui/{chunk-EDXVE4YY-DIx0q-SF-kxemqsve.js → chunk-EDXVE4YY-BeA4sIzu-gmfrgztm.js} +1 -1
- package/bin/runtime/tui/{chunk-FMBD7UC4-BRQ_JFcu-64dz1pwh.js → chunk-FMBD7UC4-HdZ8yap2-05xhm186.js} +1 -1
- package/bin/runtime/tui/{chunk-OYMX7WX6-Ebdl4euI-s0qw7xze.js → chunk-OYMX7WX6-CVrpIAjS-8qwa1145.js} +1 -1
- package/bin/runtime/tui/{chunk-QZHKN3VN-BZ_7uZiP-hegpq53e.js → chunk-QZHKN3VN-Bhl2DmvQ-k3d1zb9a.js} +1 -1
- package/bin/runtime/tui/{chunk-YZCP3GAM-CyC-R69k-ammnjh2q.js → chunk-YZCP3GAM-f0SI8KjW-4y4efwrt.js} +1 -1
- package/bin/runtime/tui/classDiagram-6PBFFD2Q-D5eOZCkq-8xtsn3zq.js +1 -0
- package/bin/runtime/tui/classDiagram-v2-HSJHXN6E-D5eOZCkq-8xtsn3zq.js +1 -0
- package/bin/runtime/tui/clone-BY5Ry5jo-av7jy9rk.js +1 -0
- package/bin/runtime/tui/{cose-bilkent-S5V4N54A-BSqzVFHJ-ndganpdt.js → cose-bilkent-S5V4N54A-DztI3YbS-79h0hgr0.js} +1 -1
- package/bin/runtime/tui/{da-Dv2JcMt1-8z1jcrs9.js → da-DOYtD_G8-5dww5d4x.js} +1 -1
- package/bin/runtime/tui/{da-NvyeAxA--9hdewfz7.js → da-YTnuRZG0-x261hzz8.js} +1 -1
- package/bin/runtime/tui/{dagre-KV5264BT-wmeb1Sky-2scbqre4.js → dagre-KV5264BT-CsCIBozr-sbv6kkmb.js} +1 -1
- package/bin/runtime/tui/{de-DY3mU7Ij-2z85w2cp.js → de-BcaXLEoj-y91gcsqq.js} +1 -1
- package/bin/runtime/tui/{de-BNlSevTf-9mftpp8r.js → de-CRYeTAqP-esjn5byn.js} +1 -1
- package/bin/runtime/tui/{diagram-5BDNPKRD-DgbhXvjf-trnrmxh2.js → diagram-5BDNPKRD-BnJQb0Qd-5zts51wk.js} +1 -1
- package/bin/runtime/tui/{diagram-G4DWMVQ6-DDKAglg7-a3st1vsy.js → diagram-G4DWMVQ6-DU2ybhZC-qf511q6q.js} +1 -1
- package/bin/runtime/tui/{diagram-MMDJMWI5-DhQ3ZudD-5z1583af.js → diagram-MMDJMWI5-CIXWKCHN-np7de2dm.js} +1 -1
- package/bin/runtime/tui/{diagram-TYMM5635-CE9eB_OA-etbk2b18.js → diagram-TYMM5635-CFD6w4wd-eg5hvarv.js} +1 -1
- package/bin/runtime/tui/{dialog-connect-provider-ChAd3tkx-wkt47a09.js → dialog-connect-provider-F-H6E-u1-v8m7jwd3.js} +2 -2
- package/bin/runtime/tui/{dialog-edit-project-4li3-60L-n1ny92hh.js → dialog-edit-project-DnYO9h5P-16tpq25r.js} +1 -1
- package/bin/runtime/tui/{dialog-fork-HUFJLsLl-whnrscsd.js → dialog-fork-DkqMfckK-34pdz9cb.js} +1 -1
- package/bin/runtime/tui/{dialog-manage-models-BPdz_BVi-rg7r3jmy.js → dialog-manage-models-C06j2ljJ-gtkcw8k6.js} +1 -1
- package/bin/runtime/tui/{dialog-quick-switcher-B4nARhhS-4p2fqa1a.js → dialog-quick-switcher-FgaoDDD5-qw2cg5wd.js} +1 -1
- package/bin/runtime/tui/{dialog-select-directory-C2S4PKyb-35dhkrgj.js → dialog-select-directory-BndJRkQ2-zxaepfbg.js} +1 -1
- package/bin/runtime/tui/{dialog-select-file-CBCZ_oh7-3qqw6p4p.js → dialog-select-file-CCkyv6t8-y748dbns.js} +1 -1
- package/bin/runtime/tui/{dialog-select-mcp-DLcb7boE-9azwb1y0.js → dialog-select-mcp-D7JALLGs-2gmvh9dp.js} +1 -1
- package/bin/runtime/tui/{dialog-select-model-unpaid-C1K9s5Tf-76mjmy04.js → dialog-select-model-unpaid-lAY_GSBz-dj3m1e5j.js} +2 -2
- package/bin/runtime/tui/{dialog-select-provider-BdYHSwX5-djsed6vk.js → dialog-select-provider-WQnY_rEG-bg0xjarc.js} +1 -1
- package/bin/runtime/tui/{dialog-select-server-3yVZhthq-8d561mme.js → dialog-select-server-BORmhWyb-b5p1p4fj.js} +1 -1
- package/bin/runtime/tui/{erDiagram-SMLLAGMA-78ferStj-zeg12722.js → erDiagram-SMLLAGMA-BXGJaqTk-kxdqq7g0.js} +1 -1
- package/bin/runtime/tui/{es-DYZno4IE-9s5f26ft.js → es-B9MgIIlj-b3w9ewkm.js} +1 -1
- package/bin/runtime/tui/{es-COqIzy42-y387feee.js → es-qMJD8V0Q-ry5ftk3x.js} +1 -1
- package/bin/runtime/tui/{file-icon-DL1tnIVn-btnkq57j.js → file-icon-CCBAkhZM-2gwspqbt.js} +1 -1
- package/bin/runtime/tui/{flowDiagram-DWJPFMVM-BJnkSNTI-bkz0yvmb.js → flowDiagram-DWJPFMVM-jBWYmDZq-kxns0z2t.js} +1 -1
- package/bin/runtime/tui/{fr-DO0PId1D-jd7qzre9.js → fr-Dj4Yz5vL-q1h2970a.js} +1 -1
- package/bin/runtime/tui/{fr-x6kwqk76-z68bq2g0.js → fr-ai2o852z-33y4dv7s.js} +1 -1
- package/bin/runtime/tui/{ganttDiagram-T4ZO3ILL-9bPC_sV--fk3h9gvs.js → ganttDiagram-T4ZO3ILL-Cjy4eHKx-2bnk0han.js} +1 -1
- package/bin/runtime/tui/{ghostty-web-C03EVwAY-dkxmakah.js → ghostty-web-DSo6UQNq-57mw690t.js} +1 -1
- package/bin/runtime/tui/{gitGraphDiagram-UUTBAWPF-C1j0ViDT-70a2fg75.js → gitGraphDiagram-UUTBAWPF-LTxZLrKJ-pm74f51t.js} +1 -1
- package/bin/runtime/tui/{graph-CsJ0qy-d-n8n22e78.js → graph-BeepcjUl-whp2pvdr.js} +1 -1
- package/bin/runtime/tui/{home-BcGhMErc-t43x76pb.js → home-Da1fa31c-5zehmxd5.js} +1 -1
- package/bin/runtime/tui/{index-Cv0n48xp-b4159vb9.js → index-BZ-S0u9J-6n51v4eh.js} +7 -7
- package/bin/runtime/tui/{index-56anftkv.html → index-dpegttnb.html} +1 -1
- package/bin/runtime/tui/{infoDiagram-42DDH7IO-6JGpSA3j-ebkbfgae.js → infoDiagram-42DDH7IO-XvoVHnE2-46rfk35a.js} +1 -1
- package/bin/runtime/tui/{ishikawaDiagram-UXIWVN3A-C9hXCKVL-gren4tmc.js → ishikawaDiagram-UXIWVN3A-BmrEY8zx-jfpd80y7.js} +1 -1
- package/bin/runtime/tui/{ja-CMTL5Sk5-2spe3ns2.js → ja-B9yIMfiQ-xjg3egg6.js} +1 -1
- package/bin/runtime/tui/{ja-JMpy37Uc-fd6t6ybf.js → ja-C-OtBco_-3jwjqzne.js} +1 -1
- package/bin/runtime/tui/{journeyDiagram-VCZTEJTY-CqUPYSuq-vwzf5hj1.js → journeyDiagram-VCZTEJTY-BsfL6ECd-5fe6t13a.js} +1 -1
- package/bin/runtime/tui/{kanban-definition-6JOO6SKY-BrhXfjm6-z5rcd31g.js → kanban-definition-6JOO6SKY-D8vM58MK-pysad1yn.js} +1 -1
- package/bin/runtime/tui/{ko-DmYX4FPm-5k0y6pk7.js → ko-DeUlkpYJ-8st0gh48.js} +1 -1
- package/bin/runtime/tui/{ko-BLfVgRVC-ez7ecktc.js → ko-GpoSr9YU-5x00hv6q.js} +1 -1
- package/bin/runtime/tui/{layout-BG0LKOds-vn3zteb9.js → layout-yL4YLn5k-vwqkj8m9.js} +1 -1
- package/bin/runtime/tui/{linear-B6z_eVLs-wx54nkb0.js → linear-Dm7w2IjW-dybfqj3h.js} +1 -1
- package/bin/runtime/tui/{list-DxMrcrlT-j0131tw9.js → list-mHeqHLaV-01rzvm9r.js} +1 -1
- package/bin/runtime/tui/{mermaid.core-KG6fOqNp-887mrkp4.js → mermaid.core-BcWOJL0e-a90bbh87.js} +5 -5
- package/bin/runtime/tui/{min-BMFElxPI-637bny7p.js → min-GkEKOeHy-me46pcb4.js} +1 -1
- package/bin/runtime/tui/{mindmap-definition-QFDTVHPH-VQh5eOMn-3pqevvyv.js → mindmap-definition-QFDTVHPH-DH2CaRDU-znxvhw6e.js} +1 -1
- package/bin/runtime/tui/{no-DEYV6Uly-gqk2cq39.js → no-C6IGXxj9-h236ej6a.js} +1 -1
- package/bin/runtime/tui/{no-Bc9vtFhi-28r4cc9s.js → no-sRjzWGyH-h8h46hc3.js} +1 -1
- package/bin/runtime/tui/node-main.js +2 -2
- package/bin/runtime/tui/{notifications-BM6XMPEX-zpq3wp3j.js → notifications-BCVGYtyk-pa6d4ysp.js} +1 -1
- package/bin/runtime/tui/{pieDiagram-DEJITSTG-BcmoZ9uY-2vcbx7p5.js → pieDiagram-DEJITSTG-Dwv46uF3-yrdabbdq.js} +1 -1
- package/bin/runtime/tui/{pl-CLJMEI_F-fh7c7009.js → pl-BdAUsQg4-qhmx9kj0.js} +1 -1
- package/bin/runtime/tui/{pl-Br4VMmme-qfrdkkhc.js → pl-D9PWP3j8-za96w2v5.js} +1 -1
- package/bin/runtime/tui/{provider-icon-DUeYJhIN-nc326wqt.js → provider-icon-Ch41KuaD-gjqjjbjr.js} +1 -1
- package/bin/runtime/tui/{quadrantDiagram-34T5L4WZ-Bg0bMjwT-s6vbjywz.js → quadrantDiagram-34T5L4WZ-C3YfUpMa-zqkxth8y.js} +1 -1
- package/bin/runtime/tui/{requirementDiagram-MS252O5E-Cx9MsWFO-ea70xs6x.js → requirementDiagram-MS252O5E-DDpZOCJX-wf8qqzm5.js} +1 -1
- package/bin/runtime/tui/{ru-CQKaC407-2n8mdcpp.js → ru-BvNMwfrc-zbdx5mz9.js} +1 -1
- package/bin/runtime/tui/{ru-BHemVjOf-kkn3n5g0.js → ru-PgTv2NAk-jjrwmc2q.js} +1 -1
- package/bin/runtime/tui/{sankeyDiagram-XADWPNL6-wo-ZgkR_-83c4qt2m.js → sankeyDiagram-XADWPNL6-BmntA3TU-16764atv.js} +1 -1
- package/bin/runtime/tui/{sequenceDiagram-FGHM5R23-B9_gjbyG-jg210sc9.js → sequenceDiagram-FGHM5R23-BOT_DlH5-9f7tbqb4.js} +1 -1
- package/bin/runtime/tui/{session-VvtgZb33-hqsfwxa4.js → session-B7TyS2pp-hx2pbeh2.js} +6 -6
- package/bin/runtime/tui/{settings-BxVsg7tx-hvqrcws2.js → settings-D2q6jv_8-d5a26cmj.js} +1 -1
- package/bin/runtime/tui/{stateDiagram-FHFEXIEX-B6ee5r7B-z4k5p6aa.js → stateDiagram-FHFEXIEX-Za5R_jyp-9v22b6pq.js} +1 -1
- package/bin/runtime/tui/stateDiagram-v2-QKLJ7IA2-BrCJd2LI-rvjbd1kk.js +1 -0
- package/bin/runtime/tui/{th-DiGw3usd-633crszg.js → th-BPTTGm6p-wg0qeygz.js} +1 -1
- package/bin/runtime/tui/{th-Bja74DRT-bjvgw0sp.js → th-D_11akW2-4kstyn2d.js} +1 -1
- package/bin/runtime/tui/{timeline-definition-GMOUNBTQ-C23LOyBF-y6s32cqs.js → timeline-definition-GMOUNBTQ-DC7fBu8f-9yyc4bbt.js} +1 -1
- package/bin/runtime/tui/{tr-CwGU-MHg-07wjmgsz.js → tr-BHxesFzI-42xpg237.js} +1 -1
- package/bin/runtime/tui/{tr-i4KWkJ3i-scpq03sz.js → tr-BlRsyU03-m97hgrvm.js} +1 -1
- package/bin/runtime/tui/{vennDiagram-DHZGUBPP-QTHAlouz-32bad2xh.js → vennDiagram-DHZGUBPP-BtanFrVi-jp0zhane.js} +1 -1
- package/bin/runtime/tui/{wardley-RL74JXVD-BkQiShQD-ed2hckad.js → wardley-RL74JXVD-B49gJluy-8hfag674.js} +1 -1
- package/bin/runtime/tui/{wardleyDiagram-NUSXRM2D-DpoVgYEi-8d1g06fw.js → wardleyDiagram-NUSXRM2D-D_Rywl2C-6e4ta96y.js} +1 -1
- package/bin/runtime/tui/{xychartDiagram-5P7HB3ND-DwAIgx2x-8h9d22ep.js → xychartDiagram-5P7HB3ND-Bjz9_ki6-px4fh6sb.js} +1 -1
- package/bin/runtime/tui/{zh-bOg8F16p-x2fsyy5j.js → zh-CMkkmie_-6hyczdtn.js} +1 -1
- package/bin/runtime/tui/{zh-DyyyQKUG-nfbxj5mv.js → zh-DcHmyx-m-kpk5cbgx.js} +1 -1
- package/bin/runtime/tui/{zht-BNARb445-kgavg6f5.js → zht-B2aVuJML-r734zysr.js} +1 -1
- package/bin/runtime/tui/{zht-CUj73aR3-wzstwhw1.js → zht-BC3GL0UB-bpxe0nw7.js} +1 -1
- package/package.json +1 -1
- package/bin/runtime/tui/channel-v1buZD1O-jmb8nrkc.js +0 -1
- package/bin/runtime/tui/classDiagram-6PBFFD2Q-CEtFAJQW-zp6ddmy2.js +0 -1
- package/bin/runtime/tui/classDiagram-v2-HSJHXN6E-CEtFAJQW-zp6ddmy2.js +0 -1
- package/bin/runtime/tui/clone-DiQslg9f-mkfpy3ra.js +0 -1
- package/bin/runtime/tui/stateDiagram-v2-QKLJ7IA2-CxzYjlRO-eq31tdxz.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as w,a0 as de,E as Q,G as Z,K as he,e as ue,l as J,ba as P,d as Y,b as pe,a as fe,q as me,t as ge,g as ye,s as Se,H as ve,bb as xe,z as be}from"./mermaid.core-KG6fOqNp.js";import{s as we}from"./chunk-EDXVE4YY-DIx0q-SF.js";import{p as Ce}from"./chunk-4BX2VUAB-CO-inVq2.js";import{p as Te}from"./wardley-RL74JXVD-BkQiShQD.js";import{b as I}from"./defaultLocale-DX6XiGOO.js";import{o as U}from"./ordinal-Cboi1Yqb.js";import"./index-Cv0n48xp.js";import"./min-BMFElxPI.js";import"./_baseUniq-CrI-l4T-.js";import"./init-Gi6I4Gst.js";function Le(e){var a=0,n=e.children,l=n&&n.length;if(!l)a=1;else for(;--l>=0;)a+=n[l].value;e.value=a}function $e(){return this.eachAfter(Le)}function Ae(e,a){let n=-1;for(const l of this)e.call(a,l,++n,this);return this}function Fe(e,a){for(var n=this,l=[n],r,o,d=-1;n=l.pop();)if(e.call(a,n,++d,this),r=n.children)for(o=r.length-1;o>=0;--o)l.push(r[o]);return this}function Ne(e,a){for(var n=this,l=[n],r=[],o,d,h,m=-1;n=l.pop();)if(r.push(n),o=n.children)for(d=0,h=o.length;d<h;++d)l.push(o[d]);for(;n=r.pop();)e.call(a,n,++m,this);return this}function Me(e,a){let n=-1;for(const l of this)if(e.call(a,l,++n,this))return l}function Ve(e){return this.eachAfter(function(a){for(var n=+e(a.data)||0,l=a.children,r=l&&l.length;--r>=0;)n+=l[r].value;a.value=n})}function _e(e){return this.eachBefore(function(a){a.children&&a.children.sort(e)})}function ke(e){for(var a=this,n=ze(a,e),l=[a];a!==n;)a=a.parent,l.push(a);for(var r=l.length;e!==n;)l.splice(r,0,e),e=e.parent;return l}function ze(e,a){if(e===a)return e;var n=e.ancestors(),l=a.ancestors(),r=null;for(e=n.pop(),a=l.pop();e===a;)r=e,e=n.pop(),a=l.pop();return r}function De(){for(var e=this,a=[e];e=e.parent;)a.push(e);return a}function Pe(){return Array.from(this)}function Be(){var e=[];return this.eachBefore(function(a){a.children||e.push(a)}),e}function Ee(){var e=this,a=[];return e.each(function(n){n!==e&&a.push({source:n.parent,target:n})}),a}function*Re(){var e=this,a,n=[e],l,r,o;do for(a=n.reverse(),n=[];e=a.pop();)if(yield e,l=e.children)for(r=0,o=l.length;r<o;++r)n.push(l[r]);while(n.length)}function ee(e,a){e instanceof Map?(e=[void 0,e],a===void 0&&(a=Ie)):a===void 0&&(a=He);for(var n=new j(e),l,r=[n],o,d,h,m;l=r.pop();)if((d=a(l.data))&&(m=(d=Array.from(d)).length))for(l.children=d,h=m-1;h>=0;--h)r.push(o=d[h]=new j(d[h])),o.parent=l,o.depth=l.depth+1;return n.eachBefore(Ge)}function We(){return ee(this).eachBefore(Oe)}function He(e){return e.children}function Ie(e){return Array.isArray(e)?e[1]:null}function Oe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Ge(e){var a=0;do e.height=a;while((e=e.parent)&&e.height<++a)}function j(e){this.data=e,this.depth=this.height=0,this.parent=null}j.prototype=ee.prototype={constructor:j,count:$e,each:Ae,eachAfter:Ne,eachBefore:Fe,find:Me,sum:Ve,sort:_e,path:ke,ancestors:De,descendants:Pe,leaves:Be,links:Ee,copy:We,[Symbol.iterator]:Re};function qe(e){if(typeof e!="function")throw new Error;return e}function O(){return 0}function G(e){return function(){return e}}function Xe(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ye(e,a,n,l,r){for(var o=e.children,d,h=-1,m=o.length,c=e.value&&(l-a)/e.value;++h<m;)d=o[h],d.y0=n,d.y1=r,d.x0=a,d.x1=a+=d.value*c}function je(e,a,n,l,r){for(var o=e.children,d,h=-1,m=o.length,c=e.value&&(r-n)/e.value;++h<m;)d=o[h],d.x0=a,d.x1=l,d.y0=n,d.y1=n+=d.value*c}var Ke=(1+Math.sqrt(5))/2;function Ue(e,a,n,l,r,o){for(var d=[],h=a.children,m,c,u=0,b=0,s=h.length,x,S,v=a.value,p,g,M,N,z,E,V;u<s;){x=r-n,S=o-l;do p=h[b++].value;while(!p&&b<s);for(g=M=p,E=Math.max(S/x,x/S)/(v*e),V=p*p*E,z=Math.max(M/V,V/g);b<s;++b){if(p+=c=h[b].value,c<g&&(g=c),c>M&&(M=c),V=p*p*E,N=Math.max(M/V,V/g),N>z){p-=c;break}z=N}d.push(m={value:p,dice:x<S,children:h.slice(u,b)}),m.dice?Ye(m,n,l,r,v?l+=S*p/v:o):je(m,n,l,v?n+=x*p/v:r,o),v-=p,u=b}return d}const Ze=(function e(a){function n(l,r,o,d,h){Ue(a,l,r,o,d,h)}return n.ratio=function(l){return e((l=+l)>1?l:1)},n})(Ke);function Je(){var e=Ze,a=!1,n=1,l=1,r=[0],o=O,d=O,h=O,m=O,c=O;function u(s){return s.x0=s.y0=0,s.x1=n,s.y1=l,s.eachBefore(b),r=[0],a&&s.eachBefore(Xe),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,p=s.x1-x,g=s.y1-x;p<S&&(S=p=(S+p)/2),g<v&&(v=g=(v+g)/2),s.x0=S,s.y0=v,s.x1=p,s.y1=g,s.children&&(x=r[s.depth+1]=o(s)/2,S+=c(s)-x,v+=d(s)-x,p-=h(s)-x,g-=m(s)-x,p<S&&(S=p=(S+p)/2),g<v&&(v=g=(v+g)/2),e(s,S,v,p,g))}return u.round=function(s){return arguments.length?(a=!!s,u):a},u.size=function(s){return arguments.length?(n=+s[0],l=+s[1],u):[n,l]},u.tile=function(s){return arguments.length?(e=qe(s),u):e},u.padding=function(s){return arguments.length?u.paddingInner(s).paddingOuter(s):u.paddingInner()},u.paddingInner=function(s){return arguments.length?(o=typeof s=="function"?s:G(+s),u):o},u.paddingOuter=function(s){return arguments.length?u.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s):u.paddingTop()},u.paddingTop=function(s){return arguments.length?(d=typeof s=="function"?s:G(+s),u):d},u.paddingRight=function(s){return arguments.length?(h=typeof s=="function"?s:G(+s),u):h},u.paddingBottom=function(s){return arguments.length?(m=typeof s=="function"?s:G(+s),u):m},u.paddingLeft=function(s){return arguments.length?(c=typeof s=="function"?s:G(+s),u):c},u}var ae=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=pe,this.getAccTitle=fe,this.setDiagramTitle=me,this.getDiagramTitle=ge,this.getAccDescription=ye,this.setAccDescription=Se}static{w(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){const e=ve,a=Q();return Z({...e.treemap,...a.treemap??{}})}addNode(e,a){this.nodes.push(e),this.levels.set(e,a),a===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,a){const n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},l=a.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");l&&l.forEach(r=>{xe(r)&&(n?.textStyles?n.textStyles.push(r):n.textStyles=[r]),n?.styles?n.styles.push(r):n.styles=[r]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){be(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function ne(e){if(!e.length)return[];const a=[],n=[];return e.forEach(l=>{const r={name:l.name,children:l.type==="Leaf"?void 0:[]};for(r.classSelector=l?.classSelector,l?.cssCompiledStyles&&(r.cssCompiledStyles=l.cssCompiledStyles),l.type==="Leaf"&&l.value!==void 0&&(r.value=l.value);n.length>0&&n[n.length-1].level>=l.level;)n.pop();if(n.length===0)a.push(r);else{const o=n[n.length-1].node;o.children?o.children.push(r):o.children=[r]}l.type!=="Leaf"&&n.push({node:r,level:l.level})}),a}w(ne,"buildHierarchy");var Qe=w((e,a)=>{Ce(e,a);const n=[];for(const o of e.TreemapRows??[])o.$type==="ClassDefStatement"&&a.addClass(o.className??"",o.styleText??"");for(const o of e.TreemapRows??[]){const d=o.item;if(!d)continue;const h=o.indent?parseInt(o.indent):0,m=et(d),c=d.classSelector?a.getStylesForClass(d.classSelector):[],u=c.length>0?c:void 0,b={level:h,name:m,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:u};n.push(b)}const l=ne(n),r=w((o,d)=>{for(const h of o)a.addNode(h,d),h.children&&h.children.length>0&&r(h.children,d+1)},"addNodesRecursively");r(l,0)},"populate"),et=w(e=>e.name?String(e.name):"","getItemName"),le={parser:{yy:void 0},parse:w(async e=>{try{const n=await Te("treemap",e);J.debug("Treemap AST:",n);const l=le.parser?.yy;if(!(l instanceof ae))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Qe(n,l)}catch(a){throw J.error("Error parsing treemap:",a),a}},"parse")},tt=10,B=10,q=25,at=w((e,a,n,l)=>{const r=l.db,o=r.getConfig(),d=o.padding??tt,h=r.getDiagramTitle(),m=r.getRoot(),{themeVariables:c}=Q();if(!m)return;const u=h?30:0,b=he(a),s=o.nodeWidth?o.nodeWidth*B:960,x=o.nodeHeight?o.nodeHeight*B:500,S=s,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ue(b,v,S,o.useMaxWidth);let p;try{const t=o.valueFormat||",";if(t==="$0,0")p=w(i=>"$"+I(",")(i),"valueFormat");else if(t.startsWith("$")&&t.includes(",")){const i=/\.\d+/.exec(t),f=i?i[0]:"";p=w(C=>"$"+I(","+f)(C),"valueFormat")}else if(t.startsWith("$")){const i=t.substring(1);p=w(f=>"$"+I(i||"")(f),"valueFormat")}else p=I(t)}catch(t){J.error("Error creating format function:",t),p=I(",")}const g=U().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),M=U().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),N=U().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);h&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);const z=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),E=ee(m).sum(t=>t.value??0).sort((t,i)=>(i.value??0)-(t.value??0)),te=Je().size([s,x]).paddingTop(t=>t.children&&t.children.length>0?q+B:0).paddingInner(d).paddingLeft(t=>t.children&&t.children.length>0?B:0).paddingRight(t=>t.children&&t.children.length>0?B:0).paddingBottom(t=>t.children&&t.children.length>0?B:0).round(!0)(E),re=te.descendants().filter(t=>t.children&&t.children.length>0),R=z.selectAll(".treemapSection").data(re).enter().append("g").attr("class","treemapSection").attr("transform",t=>`translate(${t.x0},${t.y0})`);R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",q).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",t=>t.depth===0?"display: none;":""),R.append("clipPath").attr("id",(t,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-12)).attr("height",q),R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class",(t,i)=>`treemapSection section${i}`).attr("fill",t=>g(t.data.name)).attr("fill-opacity",.6).attr("stroke",t=>M(t.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",t=>{if(t.depth===0)return"display: none;";const i=P({cssCompiledStyles:t.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),R.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",q/2).attr("dominant-baseline","middle").text(t=>t.depth===0?"":t.data.name).attr("font-weight","bold").attr("style",t=>{if(t.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+N(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=P({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(t){if(t.depth===0)return;const i=Y(this),f=t.data.name;i.text(f);const C=t.x1-t.x0,L=6;let $;o.showValues!==!1&&t.value?$=C-10-30-10-L:$=C-L-6;const A=Math.max(15,$),y=i.node();if(y.getComputedTextLength()>A){let T=f;for(;T.length>0;){if(T=f.substring(0,T.length-1),T.length===0){i.text("..."),y.getComputedTextLength()>A&&i.text("");break}if(i.text(T+"..."),y.getComputedTextLength()<=A)break}}}),o.showValues!==!1&&R.append("text").attr("class","treemapSectionValue").attr("x",t=>t.x1-t.x0-10).attr("y",q/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(t=>t.value?p(t.value):"").attr("font-style","italic").attr("style",t=>{if(t.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+N(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=P({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const se=te.leaves(),X=z.selectAll(".treemapLeafGroup").data(se).enter().append("g").attr("class",(t,i)=>`treemapNode treemapLeafGroup leaf${i}${t.data.classSelector?` ${t.data.classSelector}`:""}x`).attr("transform",t=>`translate(${t.x0},${t.y0})`);X.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class","treemapLeaf").attr("fill",t=>t.parent?g(t.parent.data.name):g(t.data.name)).attr("style",t=>P({cssCompiledStyles:t.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",t=>t.parent?g(t.parent.data.name):g(t.data.name)).attr("stroke-width",3),X.append("clipPath").attr("id",(t,i)=>`clip-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-4)).attr("height",t=>Math.max(0,t.y1-t.y0-4)),X.append("text").attr("class","treemapLabel").attr("x",t=>(t.x1-t.x0)/2).attr("y",t=>(t.y1-t.y0)/2).attr("style",t=>{const i="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+N(t.data.name)+";",f=P({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,i)=>`url(#clip-${a}-${i})`).text(t=>t.data.name).each(function(t){const i=Y(this),f=t.x1-t.x0,C=t.y1-t.y0,L=i.node(),$=4,D=f-2*$,A=C-2*$;if(D<10||A<10){i.style("display","none");return}let y=parseInt(i.style("font-size"),10);const _=8,F=28,T=.6,k=6,W=2;for(;L.getComputedTextLength()>D&&y>_;)y--,i.style("font-size",`${y}px`);let H=Math.max(k,Math.min(F,Math.round(y*T))),K=y+W+H;for(;K>A&&y>_&&(y--,H=Math.max(k,Math.min(F,Math.round(y*T))),!(H<k&&y===_));)i.style("font-size",`${y}px`),K=y+W+H;i.style("font-size",`${y}px`),(L.getComputedTextLength()>D||y<_||A<y)&&i.style("display","none")}),o.showValues!==!1&&X.append("text").attr("class","treemapValue").attr("x",i=>(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+N(i.data.name)+";",C=P({cssCompiledStyles:i.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${a}-${f})`).text(i=>i.value?p(i.value):"").each(function(i){const f=Y(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=Y(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const $=parseFloat(L.style("font-size")),D=28,A=.6,y=6,_=2,F=Math.max(y,Math.min(D,Math.round($*A)));f.style("font-size",`${F}px`);const k=(i.y1-i.y0)/2+$/2+_;f.attr("y",k);const W=i.x1-i.x0,oe=i.y1-i.y0-4,ce=W-8;f.node().getComputedTextLength()>ce||k+F>oe||F<y?f.style("display","none"):f.style("display",null)});const ie=o.diagramPadding??8;we(b,ie,"flowchart",o?.useMaxWidth||!1)},"draw"),nt=w(function(e,a){return a.db.getClasses()},"getClasses"),lt={draw:at,getClasses:nt},rt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},st=w(({treemap:e}={})=>{const a=de(),n=Q(),l=Z(a,n.themeVariables),r=Z(rt,e),o=r.titleColor??l.titleColor,d=r.labelColor??l.textColor,h=r.valueColor??l.textColor;return`
|
|
1
|
+
import{_ as w,a0 as de,E as Q,G as Z,K as he,e as ue,l as J,ba as P,d as Y,b as pe,a as fe,q as me,t as ge,g as ye,s as Se,H as ve,bb as xe,z as be}from"./mermaid.core-BcWOJL0e.js";import{s as we}from"./chunk-EDXVE4YY-BeA4sIzu.js";import{p as Ce}from"./chunk-4BX2VUAB-DzRqDDiV.js";import{p as Te}from"./wardley-RL74JXVD-B49gJluy.js";import{b as I}from"./defaultLocale-DX6XiGOO.js";import{o as U}from"./ordinal-Cboi1Yqb.js";import"./index-BZ-S0u9J.js";import"./min-GkEKOeHy.js";import"./_baseUniq-9IXs6AhY.js";import"./init-Gi6I4Gst.js";function Le(e){var a=0,n=e.children,l=n&&n.length;if(!l)a=1;else for(;--l>=0;)a+=n[l].value;e.value=a}function $e(){return this.eachAfter(Le)}function Ae(e,a){let n=-1;for(const l of this)e.call(a,l,++n,this);return this}function Fe(e,a){for(var n=this,l=[n],r,o,d=-1;n=l.pop();)if(e.call(a,n,++d,this),r=n.children)for(o=r.length-1;o>=0;--o)l.push(r[o]);return this}function Ne(e,a){for(var n=this,l=[n],r=[],o,d,h,m=-1;n=l.pop();)if(r.push(n),o=n.children)for(d=0,h=o.length;d<h;++d)l.push(o[d]);for(;n=r.pop();)e.call(a,n,++m,this);return this}function Me(e,a){let n=-1;for(const l of this)if(e.call(a,l,++n,this))return l}function Ve(e){return this.eachAfter(function(a){for(var n=+e(a.data)||0,l=a.children,r=l&&l.length;--r>=0;)n+=l[r].value;a.value=n})}function _e(e){return this.eachBefore(function(a){a.children&&a.children.sort(e)})}function ke(e){for(var a=this,n=ze(a,e),l=[a];a!==n;)a=a.parent,l.push(a);for(var r=l.length;e!==n;)l.splice(r,0,e),e=e.parent;return l}function ze(e,a){if(e===a)return e;var n=e.ancestors(),l=a.ancestors(),r=null;for(e=n.pop(),a=l.pop();e===a;)r=e,e=n.pop(),a=l.pop();return r}function De(){for(var e=this,a=[e];e=e.parent;)a.push(e);return a}function Pe(){return Array.from(this)}function Be(){var e=[];return this.eachBefore(function(a){a.children||e.push(a)}),e}function Ee(){var e=this,a=[];return e.each(function(n){n!==e&&a.push({source:n.parent,target:n})}),a}function*Re(){var e=this,a,n=[e],l,r,o;do for(a=n.reverse(),n=[];e=a.pop();)if(yield e,l=e.children)for(r=0,o=l.length;r<o;++r)n.push(l[r]);while(n.length)}function ee(e,a){e instanceof Map?(e=[void 0,e],a===void 0&&(a=Ie)):a===void 0&&(a=He);for(var n=new j(e),l,r=[n],o,d,h,m;l=r.pop();)if((d=a(l.data))&&(m=(d=Array.from(d)).length))for(l.children=d,h=m-1;h>=0;--h)r.push(o=d[h]=new j(d[h])),o.parent=l,o.depth=l.depth+1;return n.eachBefore(Ge)}function We(){return ee(this).eachBefore(Oe)}function He(e){return e.children}function Ie(e){return Array.isArray(e)?e[1]:null}function Oe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Ge(e){var a=0;do e.height=a;while((e=e.parent)&&e.height<++a)}function j(e){this.data=e,this.depth=this.height=0,this.parent=null}j.prototype=ee.prototype={constructor:j,count:$e,each:Ae,eachAfter:Ne,eachBefore:Fe,find:Me,sum:Ve,sort:_e,path:ke,ancestors:De,descendants:Pe,leaves:Be,links:Ee,copy:We,[Symbol.iterator]:Re};function qe(e){if(typeof e!="function")throw new Error;return e}function O(){return 0}function G(e){return function(){return e}}function Xe(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ye(e,a,n,l,r){for(var o=e.children,d,h=-1,m=o.length,c=e.value&&(l-a)/e.value;++h<m;)d=o[h],d.y0=n,d.y1=r,d.x0=a,d.x1=a+=d.value*c}function je(e,a,n,l,r){for(var o=e.children,d,h=-1,m=o.length,c=e.value&&(r-n)/e.value;++h<m;)d=o[h],d.x0=a,d.x1=l,d.y0=n,d.y1=n+=d.value*c}var Ke=(1+Math.sqrt(5))/2;function Ue(e,a,n,l,r,o){for(var d=[],h=a.children,m,c,u=0,b=0,s=h.length,x,S,v=a.value,p,g,M,N,z,E,V;u<s;){x=r-n,S=o-l;do p=h[b++].value;while(!p&&b<s);for(g=M=p,E=Math.max(S/x,x/S)/(v*e),V=p*p*E,z=Math.max(M/V,V/g);b<s;++b){if(p+=c=h[b].value,c<g&&(g=c),c>M&&(M=c),V=p*p*E,N=Math.max(M/V,V/g),N>z){p-=c;break}z=N}d.push(m={value:p,dice:x<S,children:h.slice(u,b)}),m.dice?Ye(m,n,l,r,v?l+=S*p/v:o):je(m,n,l,v?n+=x*p/v:r,o),v-=p,u=b}return d}const Ze=(function e(a){function n(l,r,o,d,h){Ue(a,l,r,o,d,h)}return n.ratio=function(l){return e((l=+l)>1?l:1)},n})(Ke);function Je(){var e=Ze,a=!1,n=1,l=1,r=[0],o=O,d=O,h=O,m=O,c=O;function u(s){return s.x0=s.y0=0,s.x1=n,s.y1=l,s.eachBefore(b),r=[0],a&&s.eachBefore(Xe),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,p=s.x1-x,g=s.y1-x;p<S&&(S=p=(S+p)/2),g<v&&(v=g=(v+g)/2),s.x0=S,s.y0=v,s.x1=p,s.y1=g,s.children&&(x=r[s.depth+1]=o(s)/2,S+=c(s)-x,v+=d(s)-x,p-=h(s)-x,g-=m(s)-x,p<S&&(S=p=(S+p)/2),g<v&&(v=g=(v+g)/2),e(s,S,v,p,g))}return u.round=function(s){return arguments.length?(a=!!s,u):a},u.size=function(s){return arguments.length?(n=+s[0],l=+s[1],u):[n,l]},u.tile=function(s){return arguments.length?(e=qe(s),u):e},u.padding=function(s){return arguments.length?u.paddingInner(s).paddingOuter(s):u.paddingInner()},u.paddingInner=function(s){return arguments.length?(o=typeof s=="function"?s:G(+s),u):o},u.paddingOuter=function(s){return arguments.length?u.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s):u.paddingTop()},u.paddingTop=function(s){return arguments.length?(d=typeof s=="function"?s:G(+s),u):d},u.paddingRight=function(s){return arguments.length?(h=typeof s=="function"?s:G(+s),u):h},u.paddingBottom=function(s){return arguments.length?(m=typeof s=="function"?s:G(+s),u):m},u.paddingLeft=function(s){return arguments.length?(c=typeof s=="function"?s:G(+s),u):c},u}var ae=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=pe,this.getAccTitle=fe,this.setDiagramTitle=me,this.getDiagramTitle=ge,this.getAccDescription=ye,this.setAccDescription=Se}static{w(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){const e=ve,a=Q();return Z({...e.treemap,...a.treemap??{}})}addNode(e,a){this.nodes.push(e),this.levels.set(e,a),a===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,a){const n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},l=a.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");l&&l.forEach(r=>{xe(r)&&(n?.textStyles?n.textStyles.push(r):n.textStyles=[r]),n?.styles?n.styles.push(r):n.styles=[r]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){be(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function ne(e){if(!e.length)return[];const a=[],n=[];return e.forEach(l=>{const r={name:l.name,children:l.type==="Leaf"?void 0:[]};for(r.classSelector=l?.classSelector,l?.cssCompiledStyles&&(r.cssCompiledStyles=l.cssCompiledStyles),l.type==="Leaf"&&l.value!==void 0&&(r.value=l.value);n.length>0&&n[n.length-1].level>=l.level;)n.pop();if(n.length===0)a.push(r);else{const o=n[n.length-1].node;o.children?o.children.push(r):o.children=[r]}l.type!=="Leaf"&&n.push({node:r,level:l.level})}),a}w(ne,"buildHierarchy");var Qe=w((e,a)=>{Ce(e,a);const n=[];for(const o of e.TreemapRows??[])o.$type==="ClassDefStatement"&&a.addClass(o.className??"",o.styleText??"");for(const o of e.TreemapRows??[]){const d=o.item;if(!d)continue;const h=o.indent?parseInt(o.indent):0,m=et(d),c=d.classSelector?a.getStylesForClass(d.classSelector):[],u=c.length>0?c:void 0,b={level:h,name:m,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:u};n.push(b)}const l=ne(n),r=w((o,d)=>{for(const h of o)a.addNode(h,d),h.children&&h.children.length>0&&r(h.children,d+1)},"addNodesRecursively");r(l,0)},"populate"),et=w(e=>e.name?String(e.name):"","getItemName"),le={parser:{yy:void 0},parse:w(async e=>{try{const n=await Te("treemap",e);J.debug("Treemap AST:",n);const l=le.parser?.yy;if(!(l instanceof ae))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Qe(n,l)}catch(a){throw J.error("Error parsing treemap:",a),a}},"parse")},tt=10,B=10,q=25,at=w((e,a,n,l)=>{const r=l.db,o=r.getConfig(),d=o.padding??tt,h=r.getDiagramTitle(),m=r.getRoot(),{themeVariables:c}=Q();if(!m)return;const u=h?30:0,b=he(a),s=o.nodeWidth?o.nodeWidth*B:960,x=o.nodeHeight?o.nodeHeight*B:500,S=s,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ue(b,v,S,o.useMaxWidth);let p;try{const t=o.valueFormat||",";if(t==="$0,0")p=w(i=>"$"+I(",")(i),"valueFormat");else if(t.startsWith("$")&&t.includes(",")){const i=/\.\d+/.exec(t),f=i?i[0]:"";p=w(C=>"$"+I(","+f)(C),"valueFormat")}else if(t.startsWith("$")){const i=t.substring(1);p=w(f=>"$"+I(i||"")(f),"valueFormat")}else p=I(t)}catch(t){J.error("Error creating format function:",t),p=I(",")}const g=U().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),M=U().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),N=U().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);h&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);const z=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),E=ee(m).sum(t=>t.value??0).sort((t,i)=>(i.value??0)-(t.value??0)),te=Je().size([s,x]).paddingTop(t=>t.children&&t.children.length>0?q+B:0).paddingInner(d).paddingLeft(t=>t.children&&t.children.length>0?B:0).paddingRight(t=>t.children&&t.children.length>0?B:0).paddingBottom(t=>t.children&&t.children.length>0?B:0).round(!0)(E),re=te.descendants().filter(t=>t.children&&t.children.length>0),R=z.selectAll(".treemapSection").data(re).enter().append("g").attr("class","treemapSection").attr("transform",t=>`translate(${t.x0},${t.y0})`);R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",q).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",t=>t.depth===0?"display: none;":""),R.append("clipPath").attr("id",(t,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-12)).attr("height",q),R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class",(t,i)=>`treemapSection section${i}`).attr("fill",t=>g(t.data.name)).attr("fill-opacity",.6).attr("stroke",t=>M(t.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",t=>{if(t.depth===0)return"display: none;";const i=P({cssCompiledStyles:t.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),R.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",q/2).attr("dominant-baseline","middle").text(t=>t.depth===0?"":t.data.name).attr("font-weight","bold").attr("style",t=>{if(t.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+N(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=P({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(t){if(t.depth===0)return;const i=Y(this),f=t.data.name;i.text(f);const C=t.x1-t.x0,L=6;let $;o.showValues!==!1&&t.value?$=C-10-30-10-L:$=C-L-6;const A=Math.max(15,$),y=i.node();if(y.getComputedTextLength()>A){let T=f;for(;T.length>0;){if(T=f.substring(0,T.length-1),T.length===0){i.text("..."),y.getComputedTextLength()>A&&i.text("");break}if(i.text(T+"..."),y.getComputedTextLength()<=A)break}}}),o.showValues!==!1&&R.append("text").attr("class","treemapSectionValue").attr("x",t=>t.x1-t.x0-10).attr("y",q/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(t=>t.value?p(t.value):"").attr("font-style","italic").attr("style",t=>{if(t.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+N(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=P({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const se=te.leaves(),X=z.selectAll(".treemapLeafGroup").data(se).enter().append("g").attr("class",(t,i)=>`treemapNode treemapLeafGroup leaf${i}${t.data.classSelector?` ${t.data.classSelector}`:""}x`).attr("transform",t=>`translate(${t.x0},${t.y0})`);X.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class","treemapLeaf").attr("fill",t=>t.parent?g(t.parent.data.name):g(t.data.name)).attr("style",t=>P({cssCompiledStyles:t.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",t=>t.parent?g(t.parent.data.name):g(t.data.name)).attr("stroke-width",3),X.append("clipPath").attr("id",(t,i)=>`clip-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-4)).attr("height",t=>Math.max(0,t.y1-t.y0-4)),X.append("text").attr("class","treemapLabel").attr("x",t=>(t.x1-t.x0)/2).attr("y",t=>(t.y1-t.y0)/2).attr("style",t=>{const i="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+N(t.data.name)+";",f=P({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,i)=>`url(#clip-${a}-${i})`).text(t=>t.data.name).each(function(t){const i=Y(this),f=t.x1-t.x0,C=t.y1-t.y0,L=i.node(),$=4,D=f-2*$,A=C-2*$;if(D<10||A<10){i.style("display","none");return}let y=parseInt(i.style("font-size"),10);const _=8,F=28,T=.6,k=6,W=2;for(;L.getComputedTextLength()>D&&y>_;)y--,i.style("font-size",`${y}px`);let H=Math.max(k,Math.min(F,Math.round(y*T))),K=y+W+H;for(;K>A&&y>_&&(y--,H=Math.max(k,Math.min(F,Math.round(y*T))),!(H<k&&y===_));)i.style("font-size",`${y}px`),K=y+W+H;i.style("font-size",`${y}px`),(L.getComputedTextLength()>D||y<_||A<y)&&i.style("display","none")}),o.showValues!==!1&&X.append("text").attr("class","treemapValue").attr("x",i=>(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+N(i.data.name)+";",C=P({cssCompiledStyles:i.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${a}-${f})`).text(i=>i.value?p(i.value):"").each(function(i){const f=Y(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=Y(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const $=parseFloat(L.style("font-size")),D=28,A=.6,y=6,_=2,F=Math.max(y,Math.min(D,Math.round($*A)));f.style("font-size",`${F}px`);const k=(i.y1-i.y0)/2+$/2+_;f.attr("y",k);const W=i.x1-i.x0,oe=i.y1-i.y0-4,ce=W-8;f.node().getComputedTextLength()>ce||k+F>oe||F<y?f.style("display","none"):f.style("display",null)});const ie=o.diagramPadding??8;we(b,ie,"flowchart",o?.useMaxWidth||!1)},"draw"),nt=w(function(e,a){return a.db.getClasses()},"getClasses"),lt={draw:at,getClasses:nt},rt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},st=w(({treemap:e}={})=>{const a=de(),n=Q(),l=Z(a,n.themeVariables),r=Z(rt,e),o=r.titleColor??l.titleColor,d=r.labelColor??l.textColor,h=r.valueColor??l.textColor;return`
|
|
2
2
|
.treemapNode.section {
|
|
3
3
|
stroke: ${r.sectionStrokeColor};
|
|
4
4
|
stroke-width: ${r.sectionStrokeWidth};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as k,g as R,t as E,q as I,a as _,b as F,_ as l,K as D,z,G as y,H as G,E as C,l as P,a0 as W,e as B}from"./mermaid.core-
|
|
1
|
+
import{s as k,g as R,t as E,q as I,a as _,b as F,_ as l,K as D,z,G as y,H as G,E as C,l as P,a0 as W,e as B}from"./mermaid.core-BcWOJL0e.js";import{p as H}from"./chunk-4BX2VUAB-DzRqDDiV.js";import{p as V}from"./wardley-RL74JXVD-B49gJluy.js";import"./index-BZ-S0u9J.js";import"./min-GkEKOeHy.js";import"./_baseUniq-9IXs6AhY.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:x},m=structuredClone(w),j=G.radar,q=l(()=>y({...j,...C().radar}),"getConfig"),b=l(()=>m.axes,"getAxes"),K=l(()=>m.curves,"getCurves"),N=l(()=>m.options,"getOptions"),U=l(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),X=l(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Y(t.entries)}))},"setCurves"),Y=l(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),Z=l(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});m.options={showLegend:t.showLegend?.value??x.showLegend,ticks:t.ticks?.value??x.ticks,max:t.max?.value??x.max,min:t.min?.value??x.min,graticule:t.graticule?.value??x.graticule}},"setOptions"),J=l(()=>{z(),m=structuredClone(w)},"clear"),$={getAxes:b,getCurves:K,getOptions:N,setAxes:U,setCurves:X,setOptions:Z,getConfig:q,clear:J,setAccTitle:F,getAccTitle:_,setDiagramTitle:I,getDiagramTitle:E,getAccDescription:R,setAccDescription:k},Q=l(a=>{H(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:l(async a=>{const t=await V("radar",a);P.debug(t),Q(t)},"parse")},et=l((a,t,e,r)=>{const s=r.db,o=s.getAxes(),i=s.getCurves(),n=s.getOptions(),c=s.getConfig(),d=s.getDiagramTitle(),p=D(t),u=at(p,c),g=n.max??Math.max(...i.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(c.width,c.height)/2;rt(u,o,v,n.ticks,n.graticule),st(u,o,v,c),M(u,o,i,h,g,n.graticule,c),T(u,i,n.showLegend,c),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),at=l((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return B(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=l((a,t,e,r,s)=>{if(s==="circle")for(let o=0;o<r;o++){const i=e*(o+1)/r;a.append("circle").attr("r",i).attr("class","radarGraticule")}else if(s==="polygon"){const o=t.length;for(let i=0;i<r;i++){const n=e*(i+1)/r,c=t.map((d,p)=>{const u=2*p*Math.PI/o-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",c).attr("class","radarGraticule")}}},"drawGraticule"),st=l((a,t,e,r)=>{const s=t.length;for(let o=0;o<s;o++){const i=t[o].label,n=2*o*Math.PI/s-Math.PI/2;a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*Math.cos(n)).attr("y2",e*r.axisScaleFactor*Math.sin(n)).attr("class","radarAxisLine"),a.append("text").text(i).attr("x",e*r.axisLabelFactor*Math.cos(n)).attr("y",e*r.axisLabelFactor*Math.sin(n)).attr("class","radarAxisLabel")}},"drawAxes");function M(a,t,e,r,s,o,i){const n=t.length,c=Math.min(i.width,i.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=A(g,r,s,c),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});o==="circle"?a.append("path").attr("d",L(u,i.curveTension)).attr("class",`radarCurve-${p}`):o==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}l(M,"drawCurves");function A(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}l(A,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const o=a[(s-1+e)%e],i=a[s],n=a[(s+1)%e],c=a[(s+2)%e],d={x:i.x+(n.x-o.x)*t,y:i.y+(n.y-o.y)*t},p={x:n.x-(c.x-i.x)*t,y:n.y-(c.y-i.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`}return`${r} Z`}l(L,"closedRoundCurve");function T(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,o=-(r.height/2+r.marginTop)*3/4,i=20;t.forEach((n,c)=>{const d=a.append("g").attr("transform",`translate(${s}, ${o+c*i})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${c}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}l(T,"drawLegend");var nt={draw:et},ot=l((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
|
|
2
2
|
.radarCurve-${r} {
|
|
3
3
|
color: ${s};
|
|
4
4
|
fill: ${s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as b,G as u,K as $,e as B,l as m,b as C,a as S,q as D,t as T,g as z,s as E,H as P,E as F,z as A}from"./mermaid.core-
|
|
1
|
+
import{_ as b,G as u,K as $,e as B,l as m,b as C,a as S,q as D,t as T,g as z,s as E,H as P,E as F,z as A}from"./mermaid.core-BcWOJL0e.js";import{p as W}from"./chunk-4BX2VUAB-DzRqDDiV.js";import{p as _}from"./wardley-RL74JXVD-B49gJluy.js";import"./index-BZ-S0u9J.js";import"./min-GkEKOeHy.js";import"./_baseUniq-9IXs6AhY.js";var N=P.packet,w=class{constructor(){this.packet=[],this.setAccTitle=C,this.getAccTitle=S,this.setDiagramTitle=D,this.getDiagramTitle=T,this.getAccDescription=z,this.setAccDescription=E}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){A(),this.packet=[]}},L=1e4,M=b((t,e)=>{W(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??=r+1,a!==r+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${r+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??=a+(d??1)-1,d??=i-a+1,r=i,m.debug(`Packet block ${a} - ${r} with label ${c}`);o.length<=l+1&&e.getPacket().length<L;){const[p,s]=Y({start:a,end:i,bits:d,label:c},n,l);if(o.push(p),p.end+1===n*l&&(e.pushWord(o),o=[],n++),!s)break;({start:a,end:i,bits:d,label:c}=s)}}e.pushWord(o)},"populate"),Y=b((t,e,r)=>{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},G=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),B(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())H(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),H=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),I={draw:G},K={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},O=b(({packet:t}={})=>{const e=u(K,t);return`
|
|
2
2
|
.packetByte {
|
|
3
3
|
font-size: ${e.byteFontSize};
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-select-provider-
|
|
2
|
-
import{Q as re,e as he,ag as ve,ah as me,X as fe,l as i,y as b,b as ge,C as xe,R as ye,f as be,a7 as _e,o as we,j as y,w as $e,h as M,k as ke,m as r,K as j,M as f,p as Y,ai as R,t as Se,N as Ce,I as De,v as Ie,T as F,B as G,J as ze,aj as Pe,z as Ee,ab as Ke}from"./index-Cv0n48xp.js";import{L as Z}from"./list-DxMrcrlT.js";import{P as Le}from"./provider-icon-DUeYJhIN.js";var Te=b("<a>");function ee(h){const L=he(),[x,k]=ve(h,["href","children","class"]);return(()=>{var o=Te();return o.$$click=O=>{x.href&&(O.preventDefault(),L.openLink(x.href))},me(o,fe({get href(){return x.href},get class(){return`text-text-strong underline ${x.class??""}`}},k),!1,!0),i(o,()=>x.children),o})()}re(["click"]);var Me=b('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),je=b('<form class="flex flex-col items-start gap-4">'),Fe=b('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span></span><span class="text-14-regular text-text-weak">'),Oe=b('<div class="text-14-regular text-text-base">'),Ae=b("<div>"),Ve=b('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span>'),te=b('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><form class="flex flex-col items-start gap-4">'),qe=b('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base flex items-center gap-4"><span>'),H=b('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Be=b('<div class="flex flex-col gap-6 px-2.5 pb-3"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><div class="px-2.5 pb-10 flex flex-col gap-6"><div tabindex=0>');function Re(h){const L=ge(),x=xe(),k=ye(),o=be(),O=_e(),J=()=>{Ke(()=>import("./dialog-select-provider-BdYHSwX5.js").then(e=>e.d),__vite__mapDeps([0,1,2,3,4])).then(e=>{L.show(()=>r(e.DialogSelectProvider,{}))})},C={value:!0},_={current:void 0};we(()=>{C.value=!1,_.current!==void 0&&(clearTimeout(_.current),_.current=void 0)});const S=y(()=>O.all().find(e=>e.id===h.provider)??x.data.provider.all.find(e=>e.id===h.provider)),A=y(()=>[{type:"api",label:o.t("provider.connect.method.apiKey")}]),[N]=$e(()=>h.provider,async()=>{const e=x.data.provider_auth[h.provider];if(e)return e;const t=await k.client.provider.auth();return C.value?(x.set("provider_auth",t.data??{}),t.data?.[h.provider]??A()):A()}),Q=y(()=>N.loading&&!x.data.provider_auth[h.provider]),I=y(()=>N.latest??x.data.provider_auth[h.provider]??A()),[d,ne]=M({methodIndex:void 0,authorization:void 0,state:"pending",error:void 0});function $(e){ne(Pe(t=>{if(e.type==="method.select"){t.methodIndex=e.index,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="method.reset"){t.methodIndex=void 0,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="auth.prompt"){t.state="prompt",t.error=void 0;return}if(e.type==="auth.pending"){t.state="pending",t.error=void 0;return}if(e.type==="auth.complete"){t.state="complete",t.authorization=e.authorization,t.error=void 0;return}t.state="error",t.error=e.error}))}const z=y(()=>d.methodIndex!==void 0?I().at(d.methodIndex):void 0),oe=e=>e?e.type==="api"?o.t("provider.connect.method.apiKey"):e.label??"":"";function T(e,t){if(e&&typeof e=="object"&&"data"in e){const n=e.data;if(typeof n?.message=="string"&&n.message)return n.message}if(e&&typeof e=="object"&&"error"in e){const n=T(e.error,"");if(n)return n}if(e&&typeof e=="object"&&"message"in e){const n=e.message;if(typeof n=="string"&&n)return n}return e instanceof Error&&e.message?e.message:typeof e=="string"&&e?e:t}async function V(e,t){_.current!==void 0&&(clearTimeout(_.current),_.current=void 0);const n=I()[e];if($({type:"method.select",index:e}),n.type==="oauth"){if(n.prompts?.length&&!t){$({type:"auth.prompt"});return}$({type:"auth.pending"});const s=Date.now();await k.client.provider.oauth.authorize({providerID:h.provider,method:e,inputs:t},{throwOnError:!0}).then(l=>{if(!C.value)return;const c=1e3-(Date.now()-s);if(c>0){_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout(()=>{_.current=void 0,C.value&&$({type:"auth.complete",authorization:l.data})},c);return}$({type:"auth.complete",authorization:l.data})}).catch(l=>{C.value&&$({type:"auth.error",error:T(l,o.t("common.requestFailed"))})})}}function ie(){const[e,t]=M({value:{},index:0}),n=y(()=>{const a=z();return a?.type!=="oauth"?[]:a.prompts??[]}),s=(a,p)=>{if(!a.when)return!0;const v=p[a.when.key];return v===void 0?!1:a.when.op==="eq"?v===a.when.value:v!==a.when.value},l=y(()=>{const a=n(),p=a.findIndex((v,K)=>K>=e.index&&s(v,e.value));if(p!==-1)return{index:p,prompt:a[p]}}),u=y(()=>{const a=l();return!a||a.prompt.type!=="text"?!1:(e.value[a.prompt.key]??"").trim().length>0});async function c(a,p){if(d.methodIndex===void 0)return;const v=n().findIndex((K,g)=>g>a&&s(K,p));if(v!==-1){t("index",v);return}await V(d.methodIndex,p)}async function m(a){a.preventDefault();const p=l();!p||p.prompt.type!=="text"||u()&&await c(p.index,e.value)}const w=()=>l(),P=y(()=>{const a=w()?.prompt;if(!(!a||a.type!=="text"))return a}),E=y(()=>{const a=w()?.prompt;if(!(!a||a.type!=="select"))return a});return(()=>{var a=je();return a.addEventListener("submit",m),i(a,r(j,{get children(){return[r(f,{get when(){return w()?.prompt.type==="text"},get children(){return[r(F,{type:"text",get label(){return P()?.message??""},get placeholder(){return P()?.placeholder},get value(){return Y(()=>!!P())()?e.value[P().key]??"":""},onChange:p=>{const v=P();v&&t("value",v.key,p)}}),r(G,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!u()},get children(){return o.t("common.continue")}})]}}),r(f,{get when(){return w()?.prompt.type==="select"},get children(){var p=Me(),v=p.firstChild,K=v.nextSibling;return i(v,()=>E()?.message),i(K,r(Z,{get items(){return E()?.options??[]},key:g=>g.value,get current(){return E()?.options.find(g=>g.value===e.value[E().key])},onSelect:g=>{if(!g)return;const D=E();if(!D)return;const B={...e.value,[D.key]:g.value};t("value",D.key,g.value),c(w().index,B)},children:g=>(()=>{var D=Fe(),B=D.firstChild,W=B.nextSibling,pe=W.nextSibling;return i(W,()=>g.label),i(pe,()=>g.hint),D})()})),p}})]}})),a})()}let X;function ae(e){e.key==="Enter"&&e.target instanceof HTMLInputElement||e.key!=="Escape"&&X?.onKeyDown(e)}let U=!1;ke(()=>{U||Q()||I().length===1&&(U=!0,V(0))});async function q(){await k.client.global.dispose(),L.close(),Ee({variant:"success",icon:"circle-check",title:o.t("provider.connect.toast.connected.title",{provider:S().name}),description:o.t("provider.connect.toast.connected.description",{provider:S().name})})}function le(){if(I().length===1){J();return}if(d.authorization){$({type:"method.reset"});return}if(d.methodIndex!==void 0){$({type:"method.reset"});return}J()}function se(){return[(()=>{var e=Oe();return i(e,()=>o.t("provider.connect.selectMethod",{provider:S().name})),e})(),(()=>{var e=Ae();return i(e,r(Z,{ref:t=>{X=t},items:I,key:t=>t?.label,onSelect:async(t,n)=>{t&&V(n)},children:t=>(()=>{var n=Ve(),s=n.firstChild,l=s.nextSibling;return i(l,()=>oe(t)),n})()})),e})()]}function ce(){const[e,t]=M({value:"",error:void 0});async function n(s){s.preventDefault();const l=s.currentTarget,c=new FormData(l).get("apiKey");if(!c?.trim()){t("error",o.t("provider.connect.apiKey.required"));return}t("error",void 0),await k.client.auth.set({providerID:h.provider,auth:{type:"api",key:c}}),await q()}return(()=>{var s=te(),l=s.firstChild,u=l.nextSibling;return i(l,()=>o.t("provider.connect.apiKey.description",{provider:S().name})),u.addEventListener("submit",n),i(u,r(F,{autofocus:!0,type:"text",get label(){return o.t("provider.connect.apiKey.label",{provider:S().name})},get placeholder(){return o.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return e.value},onChange:c=>t("value",c),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),i(u,r(G,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return o.t("common.continue")}}),null),s})()}function ue(){const[e,t]=M({value:"",error:void 0});async function n(s){s.preventDefault();const l=s.currentTarget,c=new FormData(l).get("code");if(!c?.trim()){t("error",o.t("provider.connect.oauth.code.required"));return}t("error",void 0);const m=await k.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex,code:c}).then(w=>w.error?{ok:!1,error:w.error}:{ok:!0}).catch(w=>({ok:!1,error:w}));if(m.ok){await q();return}t("error",T(m.error,o.t("provider.connect.oauth.code.invalid")))}return(()=>{var s=te(),l=s.firstChild,u=l.nextSibling;return i(l,()=>o.t("provider.connect.oauth.code.visit.prefix"),null),i(l,r(ee,{get href(){return d.authorization.url},get children(){return o.t("provider.connect.oauth.code.visit.link")}}),null),i(l,()=>o.t("provider.connect.oauth.code.visit.suffix",{provider:S().name}),null),u.addEventListener("submit",n),i(u,r(F,{autofocus:!0,type:"text",get label(){return o.t("provider.connect.oauth.code.label",{method:z()?.label??""})},get placeholder(){return o.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return e.value},onChange:c=>t("value",c),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),i(u,r(G,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return o.t("common.continue")}}),null),s})()}function de(){const e=y(()=>{const t=d.authorization?.instructions;return t?.includes(":")?t.split(":")[1]?.trim():t});return ze(()=>{(async()=>{const t=await k.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex}).then(n=>n.error?{ok:!1,error:n.error}:{ok:!0}).catch(n=>({ok:!1,error:n}));if(C.value){if(!t.ok){const n=T(t.error,o.t("common.requestFailed"));$({type:"auth.error",error:n});return}await q()}})()}),(()=>{var t=qe(),n=t.firstChild,s=n.nextSibling,l=s.firstChild;return i(n,()=>o.t("provider.connect.oauth.auto.visit.prefix"),null),i(n,r(ee,{get href(){return d.authorization.url},get children(){return o.t("provider.connect.oauth.auto.visit.link")}}),null),i(n,()=>o.t("provider.connect.oauth.auto.visit.suffix",{provider:S().name}),null),i(t,r(F,{get label(){return o.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return e()},readOnly:!0,copyable:!0}),s),i(s,r(R,{}),l),i(l,()=>o.t("provider.connect.status.waiting")),t})()}return r(Ie,{get title(){return r(De,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:le,get"aria-label"(){return o.t("common.goBack")}})},get children(){var e=Be(),t=e.firstChild,n=t.firstChild,s=t.nextSibling,l=s.firstChild;return i(t,r(Le,{get id(){return h.provider},class:"size-5 shrink-0 icon-strong-base"}),n),i(n,r(j,{get children(){return[r(f,{get when(){return Y(()=>h.provider==="anthropic")()&&z()?.label?.toLowerCase().includes("max")},get children(){return o.t("provider.connect.title.anthropicProMax")}}),r(f,{when:!0,get children(){return o.t("provider.connect.title",{provider:S().name})}})]}})),l.$$keydown=ae,i(l,r(j,{get children(){return[r(f,{get when(){return Q()},get children(){var u=H(),c=u.firstChild,m=c.firstChild;return i(c,r(R,{}),m),i(m,()=>o.t("provider.connect.status.inProgress")),u}}),r(f,{get when(){return d.methodIndex===void 0},get children(){return r(se,{})}}),r(f,{get when(){return d.state==="pending"},get children(){var u=H(),c=u.firstChild,m=c.firstChild;return i(c,r(R,{}),m),i(m,()=>o.t("provider.connect.status.inProgress")),u}}),r(f,{get when(){return d.state==="prompt"},get children(){return r(ie,{})}}),r(f,{get when(){return d.state==="error"},get children(){var u=H(),c=u.firstChild,m=c.firstChild;return i(c,r(Se,{name:"circle-ban-sign",class:"text-icon-critical-base"}),m),i(m,()=>o.t("provider.connect.status.failed",{error:d.error??""})),u}}),r(f,{get when(){return z()?.type==="api"},get children(){return r(ce,{})}}),r(f,{get when(){return z()?.type==="oauth"},get children(){return r(j,{get children(){return[r(f,{get when(){return d.authorization?.method==="code"},get children(){return r(ue,{})}}),r(f,{get when(){return d.authorization?.method==="auto"},get children(){return r(de,{})}})]}})}})]}})),Ce(()=>l.autofocus=d.methodIndex===void 0?!0:void 0),e}})}re(["keydown"]);const Ne=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Re},Symbol.toStringTag,{value:"Module"}));export{Re as D,ee as L,Ne as d};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-select-provider-WQnY_rEG.js","assets/index-BZ-S0u9J.js","assets/index-BG3RElAN.css","assets/list-mHeqHLaV.js","assets/provider-icon-Ch41KuaD.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Q as re,e as he,ag as ve,ah as me,X as fe,l as i,y as b,b as ge,C as xe,R as ye,f as be,a7 as _e,o as we,j as y,w as $e,h as M,k as ke,m as r,K as j,M as f,p as Y,ai as R,t as Se,N as Ce,I as De,v as Ie,T as F,B as G,J as ze,aj as Pe,z as Ee,ab as Ke}from"./index-BZ-S0u9J.js";import{L as Z}from"./list-mHeqHLaV.js";import{P as Le}from"./provider-icon-Ch41KuaD.js";var Te=b("<a>");function ee(h){const L=he(),[x,k]=ve(h,["href","children","class"]);return(()=>{var o=Te();return o.$$click=O=>{x.href&&(O.preventDefault(),L.openLink(x.href))},me(o,fe({get href(){return x.href},get class(){return`text-text-strong underline ${x.class??""}`}},k),!1,!0),i(o,()=>x.children),o})()}re(["click"]);var Me=b('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),je=b('<form class="flex flex-col items-start gap-4">'),Fe=b('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span></span><span class="text-14-regular text-text-weak">'),Oe=b('<div class="text-14-regular text-text-base">'),Ae=b("<div>"),Ve=b('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span>'),te=b('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><form class="flex flex-col items-start gap-4">'),qe=b('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base flex items-center gap-4"><span>'),H=b('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Be=b('<div class="flex flex-col gap-6 px-2.5 pb-3"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><div class="px-2.5 pb-10 flex flex-col gap-6"><div tabindex=0>');function Re(h){const L=ge(),x=xe(),k=ye(),o=be(),O=_e(),J=()=>{Ke(()=>import("./dialog-select-provider-WQnY_rEG.js").then(e=>e.d),__vite__mapDeps([0,1,2,3,4])).then(e=>{L.show(()=>r(e.DialogSelectProvider,{}))})},C={value:!0},_={current:void 0};we(()=>{C.value=!1,_.current!==void 0&&(clearTimeout(_.current),_.current=void 0)});const S=y(()=>O.all().find(e=>e.id===h.provider)??x.data.provider.all.find(e=>e.id===h.provider)),A=y(()=>[{type:"api",label:o.t("provider.connect.method.apiKey")}]),[N]=$e(()=>h.provider,async()=>{const e=x.data.provider_auth[h.provider];if(e)return e;const t=await k.client.provider.auth();return C.value?(x.set("provider_auth",t.data??{}),t.data?.[h.provider]??A()):A()}),Q=y(()=>N.loading&&!x.data.provider_auth[h.provider]),I=y(()=>N.latest??x.data.provider_auth[h.provider]??A()),[d,ne]=M({methodIndex:void 0,authorization:void 0,state:"pending",error:void 0});function $(e){ne(Pe(t=>{if(e.type==="method.select"){t.methodIndex=e.index,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="method.reset"){t.methodIndex=void 0,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="auth.prompt"){t.state="prompt",t.error=void 0;return}if(e.type==="auth.pending"){t.state="pending",t.error=void 0;return}if(e.type==="auth.complete"){t.state="complete",t.authorization=e.authorization,t.error=void 0;return}t.state="error",t.error=e.error}))}const z=y(()=>d.methodIndex!==void 0?I().at(d.methodIndex):void 0),oe=e=>e?e.type==="api"?o.t("provider.connect.method.apiKey"):e.label??"":"";function T(e,t){if(e&&typeof e=="object"&&"data"in e){const n=e.data;if(typeof n?.message=="string"&&n.message)return n.message}if(e&&typeof e=="object"&&"error"in e){const n=T(e.error,"");if(n)return n}if(e&&typeof e=="object"&&"message"in e){const n=e.message;if(typeof n=="string"&&n)return n}return e instanceof Error&&e.message?e.message:typeof e=="string"&&e?e:t}async function V(e,t){_.current!==void 0&&(clearTimeout(_.current),_.current=void 0);const n=I()[e];if($({type:"method.select",index:e}),n.type==="oauth"){if(n.prompts?.length&&!t){$({type:"auth.prompt"});return}$({type:"auth.pending"});const s=Date.now();await k.client.provider.oauth.authorize({providerID:h.provider,method:e,inputs:t},{throwOnError:!0}).then(l=>{if(!C.value)return;const c=1e3-(Date.now()-s);if(c>0){_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout(()=>{_.current=void 0,C.value&&$({type:"auth.complete",authorization:l.data})},c);return}$({type:"auth.complete",authorization:l.data})}).catch(l=>{C.value&&$({type:"auth.error",error:T(l,o.t("common.requestFailed"))})})}}function ie(){const[e,t]=M({value:{},index:0}),n=y(()=>{const a=z();return a?.type!=="oauth"?[]:a.prompts??[]}),s=(a,p)=>{if(!a.when)return!0;const v=p[a.when.key];return v===void 0?!1:a.when.op==="eq"?v===a.when.value:v!==a.when.value},l=y(()=>{const a=n(),p=a.findIndex((v,K)=>K>=e.index&&s(v,e.value));if(p!==-1)return{index:p,prompt:a[p]}}),u=y(()=>{const a=l();return!a||a.prompt.type!=="text"?!1:(e.value[a.prompt.key]??"").trim().length>0});async function c(a,p){if(d.methodIndex===void 0)return;const v=n().findIndex((K,g)=>g>a&&s(K,p));if(v!==-1){t("index",v);return}await V(d.methodIndex,p)}async function m(a){a.preventDefault();const p=l();!p||p.prompt.type!=="text"||u()&&await c(p.index,e.value)}const w=()=>l(),P=y(()=>{const a=w()?.prompt;if(!(!a||a.type!=="text"))return a}),E=y(()=>{const a=w()?.prompt;if(!(!a||a.type!=="select"))return a});return(()=>{var a=je();return a.addEventListener("submit",m),i(a,r(j,{get children(){return[r(f,{get when(){return w()?.prompt.type==="text"},get children(){return[r(F,{type:"text",get label(){return P()?.message??""},get placeholder(){return P()?.placeholder},get value(){return Y(()=>!!P())()?e.value[P().key]??"":""},onChange:p=>{const v=P();v&&t("value",v.key,p)}}),r(G,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!u()},get children(){return o.t("common.continue")}})]}}),r(f,{get when(){return w()?.prompt.type==="select"},get children(){var p=Me(),v=p.firstChild,K=v.nextSibling;return i(v,()=>E()?.message),i(K,r(Z,{get items(){return E()?.options??[]},key:g=>g.value,get current(){return E()?.options.find(g=>g.value===e.value[E().key])},onSelect:g=>{if(!g)return;const D=E();if(!D)return;const B={...e.value,[D.key]:g.value};t("value",D.key,g.value),c(w().index,B)},children:g=>(()=>{var D=Fe(),B=D.firstChild,W=B.nextSibling,pe=W.nextSibling;return i(W,()=>g.label),i(pe,()=>g.hint),D})()})),p}})]}})),a})()}let X;function ae(e){e.key==="Enter"&&e.target instanceof HTMLInputElement||e.key!=="Escape"&&X?.onKeyDown(e)}let U=!1;ke(()=>{U||Q()||I().length===1&&(U=!0,V(0))});async function q(){await k.client.global.dispose(),L.close(),Ee({variant:"success",icon:"circle-check",title:o.t("provider.connect.toast.connected.title",{provider:S().name}),description:o.t("provider.connect.toast.connected.description",{provider:S().name})})}function le(){if(I().length===1){J();return}if(d.authorization){$({type:"method.reset"});return}if(d.methodIndex!==void 0){$({type:"method.reset"});return}J()}function se(){return[(()=>{var e=Oe();return i(e,()=>o.t("provider.connect.selectMethod",{provider:S().name})),e})(),(()=>{var e=Ae();return i(e,r(Z,{ref:t=>{X=t},items:I,key:t=>t?.label,onSelect:async(t,n)=>{t&&V(n)},children:t=>(()=>{var n=Ve(),s=n.firstChild,l=s.nextSibling;return i(l,()=>oe(t)),n})()})),e})()]}function ce(){const[e,t]=M({value:"",error:void 0});async function n(s){s.preventDefault();const l=s.currentTarget,c=new FormData(l).get("apiKey");if(!c?.trim()){t("error",o.t("provider.connect.apiKey.required"));return}t("error",void 0),await k.client.auth.set({providerID:h.provider,auth:{type:"api",key:c}}),await q()}return(()=>{var s=te(),l=s.firstChild,u=l.nextSibling;return i(l,()=>o.t("provider.connect.apiKey.description",{provider:S().name})),u.addEventListener("submit",n),i(u,r(F,{autofocus:!0,type:"text",get label(){return o.t("provider.connect.apiKey.label",{provider:S().name})},get placeholder(){return o.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return e.value},onChange:c=>t("value",c),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),i(u,r(G,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return o.t("common.continue")}}),null),s})()}function ue(){const[e,t]=M({value:"",error:void 0});async function n(s){s.preventDefault();const l=s.currentTarget,c=new FormData(l).get("code");if(!c?.trim()){t("error",o.t("provider.connect.oauth.code.required"));return}t("error",void 0);const m=await k.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex,code:c}).then(w=>w.error?{ok:!1,error:w.error}:{ok:!0}).catch(w=>({ok:!1,error:w}));if(m.ok){await q();return}t("error",T(m.error,o.t("provider.connect.oauth.code.invalid")))}return(()=>{var s=te(),l=s.firstChild,u=l.nextSibling;return i(l,()=>o.t("provider.connect.oauth.code.visit.prefix"),null),i(l,r(ee,{get href(){return d.authorization.url},get children(){return o.t("provider.connect.oauth.code.visit.link")}}),null),i(l,()=>o.t("provider.connect.oauth.code.visit.suffix",{provider:S().name}),null),u.addEventListener("submit",n),i(u,r(F,{autofocus:!0,type:"text",get label(){return o.t("provider.connect.oauth.code.label",{method:z()?.label??""})},get placeholder(){return o.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return e.value},onChange:c=>t("value",c),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),i(u,r(G,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return o.t("common.continue")}}),null),s})()}function de(){const e=y(()=>{const t=d.authorization?.instructions;return t?.includes(":")?t.split(":")[1]?.trim():t});return ze(()=>{(async()=>{const t=await k.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex}).then(n=>n.error?{ok:!1,error:n.error}:{ok:!0}).catch(n=>({ok:!1,error:n}));if(C.value){if(!t.ok){const n=T(t.error,o.t("common.requestFailed"));$({type:"auth.error",error:n});return}await q()}})()}),(()=>{var t=qe(),n=t.firstChild,s=n.nextSibling,l=s.firstChild;return i(n,()=>o.t("provider.connect.oauth.auto.visit.prefix"),null),i(n,r(ee,{get href(){return d.authorization.url},get children(){return o.t("provider.connect.oauth.auto.visit.link")}}),null),i(n,()=>o.t("provider.connect.oauth.auto.visit.suffix",{provider:S().name}),null),i(t,r(F,{get label(){return o.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return e()},readOnly:!0,copyable:!0}),s),i(s,r(R,{}),l),i(l,()=>o.t("provider.connect.status.waiting")),t})()}return r(Ie,{get title(){return r(De,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:le,get"aria-label"(){return o.t("common.goBack")}})},get children(){var e=Be(),t=e.firstChild,n=t.firstChild,s=t.nextSibling,l=s.firstChild;return i(t,r(Le,{get id(){return h.provider},class:"size-5 shrink-0 icon-strong-base"}),n),i(n,r(j,{get children(){return[r(f,{get when(){return Y(()=>h.provider==="anthropic")()&&z()?.label?.toLowerCase().includes("max")},get children(){return o.t("provider.connect.title.anthropicProMax")}}),r(f,{when:!0,get children(){return o.t("provider.connect.title",{provider:S().name})}})]}})),l.$$keydown=ae,i(l,r(j,{get children(){return[r(f,{get when(){return Q()},get children(){var u=H(),c=u.firstChild,m=c.firstChild;return i(c,r(R,{}),m),i(m,()=>o.t("provider.connect.status.inProgress")),u}}),r(f,{get when(){return d.methodIndex===void 0},get children(){return r(se,{})}}),r(f,{get when(){return d.state==="pending"},get children(){var u=H(),c=u.firstChild,m=c.firstChild;return i(c,r(R,{}),m),i(m,()=>o.t("provider.connect.status.inProgress")),u}}),r(f,{get when(){return d.state==="prompt"},get children(){return r(ie,{})}}),r(f,{get when(){return d.state==="error"},get children(){var u=H(),c=u.firstChild,m=c.firstChild;return i(c,r(Se,{name:"circle-ban-sign",class:"text-icon-critical-base"}),m),i(m,()=>o.t("provider.connect.status.failed",{error:d.error??""})),u}}),r(f,{get when(){return z()?.type==="api"},get children(){return r(ce,{})}}),r(f,{get when(){return z()?.type==="oauth"},get children(){return r(j,{get children(){return[r(f,{get when(){return d.authorization?.method==="code"},get children(){return r(ue,{})}}),r(f,{get when(){return d.authorization?.method==="auto"},get children(){return r(de,{})}})]}})}})]}})),Ce(()=>l.autofocus=d.methodIndex===void 0?!0:void 0),e}})}re(["keydown"]);const Ne=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Re},Symbol.toStringTag,{value:"Module"}));export{Re as D,ee as L,Ne as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as ee,R as te,C as re,f as ae,j as F,U as oe,h as ne,i as ie,m as c,l as i,T as P,q as R,V as y,N as $,W as I,X as T,Y as K,Z as le,t as se,_ as ce,L as de,O as M,B as N,p as ue,v as ve,y as b,Q as ge}from"./index-
|
|
1
|
+
import{b as ee,R as te,C as re,f as ae,j as F,U as oe,h as ne,i as ie,m as c,l as i,T as P,q as R,V as y,N as $,W as I,X as T,Y as K,Z as le,t as se,_ as ce,L as de,O as M,B as N,p as ue,v as ve,y as b,Q as ge}from"./index-BZ-S0u9J.js";var fe=b('<div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5">'),me=b('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-3 items-start"><div class=relative><button type=button class="group relative size-16 shrink-0 overflow-hidden rounded-md border bg-transparent p-0 transition-colors cursor-pointer focus:outline-none focus-visible:border-border-interactive-focus"><div class="pointer-events-none absolute inset-0 flex items-center justify-center bg-[color-mix(in_srgb,var(--surface-raised-stronger-non-alpha)_30%,transparent)] transition-opacity"><div class="flex size-8 items-center justify-center rounded-md border border-border-weak-base bg-surface-raised-stronger-non-alpha/95 shadow-sm"></div></div></button></div><input id=icon-upload type=file accept=image/* class=hidden><div class="flex flex-col gap-1.5 text-12-regular text-text-weak self-center"><span></span><span></span></div></div></div></div><div class="flex justify-end gap-2 pt-1">'),pe=b('<div class="size-full flex items-center justify-center">'),be=b('<img class="size-full object-cover">'),he=b("<button type=button>");const xe=["pink","mint","orange","purple","cyan","lime"];function je(a){const l=a?.start;return typeof l=="string"?l:l?.command??""}function we(a,l){const p=a?.start;return{...a??{},start:!l||typeof p=="string"||!p?l:{...p,command:l}}}function ke(a){const l=ee(),p=te(),C=re(),n=ae(),k=F(()=>oe(a.project.worktree)),_=F(()=>a.project.name||k()),[e,s]=ne({name:_(),color:a.project.icon?.color,iconOverride:a.project.icon?.override,startup:je(a.project.commands),dragOver:!1,iconHover:!1});let S;function L(r){if(!r.type.startsWith("image/"))return;const o=new FileReader;o.onload=v=>{s("iconOverride",v.target?.result),s("iconHover",!1)},o.readAsDataURL(r)}function B(r){r.preventDefault(),s("dragOver",!1);const o=r.dataTransfer?.files[0];o&&L(o)}function G(r){r.preventDefault(),s("dragOver",!0)}function U(){s("dragOver",!1)}function V(r){const v=r.target.files?.[0];v&&L(v)}function W(){s("iconOverride","")}const h=ie(()=>({mutationFn:async()=>{const r=e.name.trim()===k()?"":e.name.trim(),o=e.startup.trim();if(a.project.id&&a.project.id!=="global"){await p.client.project.update({projectID:a.project.id,directory:a.project.worktree,name:r,icon:{color:e.color||"",override:e.iconOverride||""},commands:we(a.project.commands,o)}),C.project.icon(a.project.worktree,e.iconOverride||void 0),l.close();return}C.project.meta(a.project.worktree,{name:r,icon:{color:e.color||void 0,override:e.iconOverride||void 0},commands:{start:o||void 0}}),l.close()}}));function Y(r){r.preventDefault(),!h.isPending&&h.mutate()}return c(ve,{get title(){return n.t("dialog.project.edit.title")},class:"w-full max-w-[480px] mx-auto",fit:!0,get children(){var r=me(),o=r.firstChild,v=o.firstChild,D=v.firstChild,q=D.nextSibling,x=q.firstChild,g=x.firstChild,j=g.firstChild,Q=j.firstChild,O=x.nextSibling,X=O.nextSibling,E=X.firstChild,Z=E.nextSibling,z=o.nextSibling;return r.addEventListener("submit",Y),i(o,c(P,{autofocus:!0,type:"text",get label(){return n.t("dialog.project.edit.name")},get placeholder(){return k()},get value(){return e.name},onChange:t=>s("name",t)}),v),i(D,()=>n.t("dialog.project.edit.icon")),x.addEventListener("mouseleave",()=>s("iconHover",!1)),x.addEventListener("mouseenter",()=>s("iconHover",!0)),g.$$click=()=>{e.iconOverride&&e.iconHover?W():S?.click()},g.addEventListener("dragleave",U),g.addEventListener("dragover",G),g.addEventListener("drop",B),i(g,c(R,{get when(){return le({override:e.iconOverride})},keyed:!0,get fallback(){return(()=>{var t=pe();return i(t,c(I,T({get fallback(){return e.name||_()}},()=>K(e.color),{class:"size-full text-[32px]"}))),t})()},children:t=>(()=>{var u=be();return y(u,"src",t),$(()=>y(u,"alt",n.t("dialog.project.edit.icon.alt"))),u})()}),j),i(Q,c(se,{get name(){return e.iconOverride&&!e.dragOver?"trash":"cloud-upload"},size:"normal",class:"text-icon-strong-base"})),O.addEventListener("change",V),ce(t=>{S=t},O),i(E,()=>n.t("dialog.project.edit.icon.hint")),i(Z,()=>n.t("dialog.project.edit.icon.recommended")),i(o,c(R,{get when(){return!e.iconOverride},get children(){var t=fe(),u=t.firstChild,w=u.nextSibling;return i(u,()=>n.t("dialog.project.edit.color")),i(w,c(de,{each:xe,children:d=>(()=>{var m=he();return m.$$click=()=>s("color",e.color===d?void 0:d),i(m,c(I,T({get fallback(){return e.name||_()}},()=>K(d),{class:"size-full rounded"}))),$(f=>{var A=n.t("dialog.project.edit.color.select",{color:d}),H=e.color===d,J={"flex items-center justify-center size-10 p-0.5 rounded-lg overflow-hidden transition-colors cursor-pointer":!0,"bg-surface-base-active border border-border-strong-base shadow-[var(--shadow-xs)]":e.color===d,"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":e.color!==d};return A!==f.e&&y(m,"aria-label",f.e=A),H!==f.t&&y(m,"aria-pressed",f.t=H),f.a=M(m,J,f.a),f},{e:void 0,t:void 0,a:void 0}),m})()})),t}}),null),i(o,c(P,{multiline:!0,get label(){return n.t("dialog.project.edit.worktree.startup")},get description(){return n.t("dialog.project.edit.worktree.startup.description")},get placeholder(){return n.t("dialog.project.edit.worktree.startup.placeholder")},get value(){return e.startup},onChange:t=>s("startup",t),spellcheck:!1,class:"max-h-14 w-full overflow-y-auto font-mono text-xs"}),null),i(z,c(N,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return n.t("common.cancel")}}),null),i(z,c(N,{type:"submit",variant:"primary",size:"large",get disabled(){return h.isPending},get children(){return ue(()=>!!h.isPending)()?n.t("common.saving"):n.t("common.save")}}),null),$(t=>{var u={"border-border-interactive-base bg-surface-info-base/20":e.dragOver,"border-border-base hover:border-border-strong":!e.dragOver},w=!!(e.iconHover||e.dragOver),d=!e.iconHover&&!e.dragOver;return t.e=M(g,u,t.e),w!==t.t&&j.classList.toggle("opacity-100",t.t=w),d!==t.a&&j.classList.toggle("opacity-0",t.a=d),t},{e:void 0,t:void 0,a:void 0}),r}})}ge(["click"]);export{ke as DialogEditProject};
|
package/bin/runtime/tui/{dialog-fork-HUFJLsLl-whnrscsd.js → dialog-fork-DkqMfckK-34pdz9cb.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a4 as v,u as D,a0 as S,a1 as k,a5 as P,b as _,f as $,j as w,m as d,l as u,v as F,P as L,z as p,y as b}from"./index-
|
|
1
|
+
import{a4 as v,u as D,a0 as S,a1 as k,a5 as P,b as _,f as $,j as w,m as d,l as u,v as F,P as L,z as p,y as b}from"./index-BZ-S0u9J.js";import{L as I}from"./list-mHeqHLaV.js";import{e as T}from"./session-B7TyS2pp.js";import"./provider-icon-Ch41KuaD.js";import"./file-icon-CCBAkhZM.js";var q=b('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function C(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const z=()=>{const i=v(),g=D(),c=S(),l=k(),f=P(),h=_(),r=$(),x=w(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(n=>n.type==="text"&&!n.synthetic&&!n.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:C(new Date(s.time.created))})}return o.reverse()}),y=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=T(o,{directory:l.directory,attachmentName:r.t("common.attachment")}),m=L(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){p({title:r.t("common.requestFailed")});return}h.close(),f.set(s,void 0,{dir:m,id:e.data.id}),g(`/${m}/session/${e.data.id}`)}).catch(e=>{const n=e instanceof Error?e.message:String(e);p({title:r.t("common.requestFailed"),description:n})})};return d(F,{get title(){return r.t("command.session.fork")},get children(){return d(I,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:r.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return r.t("dialog.fork.empty")},key:t=>t.id,items:x,filterKeys:["text"],onSelect:y,children:t=>(()=>{var a=q(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{z as DialogFork};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a6 as y,f as b,b as D,m as o,l as n,a3 as c,a9 as I,B as k,v as $,y as g,aa as C,Q as P}from"./index-
|
|
1
|
+
import{a6 as y,f as b,b as D,m as o,l as n,a3 as c,a9 as I,B as k,v as $,y as g,aa as C,Q as P}from"./index-BZ-S0u9J.js";import{L}from"./list-mHeqHLaV.js";import{D as _}from"./dialog-select-provider-WQnY_rEG.js";import"./provider-icon-Ch41KuaD.js";import"./dialog-connect-provider-F-H6E-u1.js";var B=g("<span>"),V=g('<div class="w-full flex items-center justify-between gap-x-3"><span></span><div>');const E=()=>{const t=y(),a=b(),u=D(),v=()=>{u.show(()=>o(_,{}))},s=e=>C.indexOf(e),m=e=>t.model.list().filter(r=>r.provider.id===e),h=e=>m(e).every(r=>t.model.visible({modelID:r.id,providerID:r.provider.id})),f=(e,r)=>{m(e).forEach(i=>{t.model.setVisibility({modelID:i.id,providerID:i.provider.id},r)})};return o($,{get title(){return a.t("dialog.model.manage")},get description(){return a.t("dialog.model.manage.description")},get action(){return o(k,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:v,get children(){return a.t("command.provider.connect")}})},get children(){return o(L,{get search(){return{placeholder:a.t("dialog.model.search.placeholder"),autofocus:!0}},get emptyMessage(){return a.t("dialog.model.empty")},key:e=>`${e?.provider?.id}:${e?.id}`,get items(){return t.model.list()},filterKeys:["provider.name","name","id"],sortBy:(e,r)=>e.name.localeCompare(r.name),groupBy:e=>e.provider.id,groupHeader:e=>{const r=e.items[0].provider;return[(()=>{var i=B();return n(i,()=>r.name),i})(),o(I,{placement:"top",get value(){return a.t("dialog.model.manage.provider.toggle",{provider:r.name})},get children(){return o(c,{class:"-mr-1",get checked(){return h(r.id)},onChange:i=>f(r.id,i),hideLabel:!0,get children(){return r.name}})}})]},sortGroupsBy:(e,r)=>{const i=s(e.items[0].provider.id),l=s(r.items[0].provider.id),d=i>=0,p=l>=0;return d&&!p?-1:!d&&p?1:i-l},onSelect:e=>{if(!e)return;const r={modelID:e.id,providerID:e.provider.id};t.model.setVisibility(r,!t.model.visible(r))},children:e=>(()=>{var r=V(),i=r.firstChild,l=i.nextSibling;return n(i,()=>e.name),l.$$click=d=>d.stopPropagation(),n(l,o(c,{get checked(){return!!t.model.visible({modelID:e.id,providerID:e.provider.id})},onChange:d=>{t.model.setVisibility({modelID:e.id,providerID:e.provider.id},d)}})),r})()})}})};P(["click"]);export{E as DialogManageModels};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as B,u as V,f as W,A as X,C as Y,e as Z,c as ee,E as y,j as o,F as te,G as re,H as se,J as ie,m as c,l as n,T as ne,K as ce,M as E,L,t as le,q as A,p as ae,N as oe,O as ue,v as de,y as u,P as M,Q as he}from"./index-
|
|
1
|
+
import{b as B,u as V,f as W,A as X,C as Y,e as Z,c as ee,E as y,j as o,F as te,G as re,H as se,J as ie,m as c,l as n,T as ne,K as ce,M as E,L,t as le,q as A,p as ae,N as oe,O as ue,v as de,y as u,P as M,Q as he}from"./index-BZ-S0u9J.js";var fe=u('<div class="flex h-full items-center justify-center px-8 text-center text-14-regular text-text-weak">'),pe=u('<div class="flex flex-col gap-4">'),me=u('<div class="flex h-full min-h-0 flex-col gap-3 px-4 pb-4"><div class="shrink-0 [&_[data-slot=input-wrapper]:focus-within]:!border-border-weak-base [&_[data-slot=input-wrapper]:focus-within]:!shadow-none"></div><div class="min-h-0 flex-1 overflow-y-auto no-scrollbar">'),ge=u('<div class="flex flex-col gap-1"><div class="px-2 text-11-medium uppercase tracking-wider text-text-weak">'),we=u('<span class="shrink-0 rounded-sm bg-surface-base px-1 py-0.5 text-10-medium text-text-weak">'),ke=u('<div class="shrink-0 text-12-medium text-text-weak">'),xe=u('<button type=button class="group flex w-full min-w-0 items-center gap-3 rounded-md px-2 py-2 text-left focus:outline-none"><div class="flex size-8 shrink-0 items-center justify-center rounded-md bg-surface-base text-icon-weak"></div><div class="min-w-0 flex-1"><div class="flex items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="truncate text-12-regular text-text-weak">');function be(m){const f=B(),b=V(),i=W(),F=X(),I=Y(),P=Z(),z=ee(),[$,N]=y(""),[S,d]=y(0),g=o(()=>m.currentDirectory??""),O=o(()=>{const e=g();if(!e)return[];const[t]=I.child(e,{bootstrap:!0});return te(t,Date.now(),e).filter(r=>!r.time?.archived).slice(0,30).map(r=>({kind:"session",id:r.id,directory:e,title:re(r.title)??i.t("command.session.new"),subtitle:r.id,updated:r.time?.updated??r.time?.created??0}))}),T=o(()=>{const e=g();return F.projects.list().filter(t=>t.id!=="global").map(t=>({kind:"project",worktree:t.worktree,title:se(t),subtitle:t.worktree,current:t.worktree===e}))}),G=o(()=>{const e=[{kind:"action",id:"project.browse",icon:"folder-add-left",title:i.t("command.project.open"),subtitle:i.t("quickSwitcher.action.browseProject")}];return P.desktop&&e.push({kind:"action",id:"server.switch",icon:"server",title:i.t("command.server.switch"),subtitle:z.name??i.t("quickSwitcher.action.switchServer")}),e}),w=e=>{const t=$().trim().toLowerCase();return t?e.filter(s=>`${s.title} ${s.subtitle}`.toLowerCase().includes(t)):e},_=o(()=>{const e=[],t=w(O());t.length>0&&e.push({id:"sessions",title:i.t("quickSwitcher.section.sessions"),entries:t});const s=w(T());s.length>0&&e.push({id:"projects",title:i.t("quickSwitcher.section.projects"),entries:s});const r=w(G());return r.length>0&&e.push({id:"actions",title:i.t("quickSwitcher.section.actions"),entries:r}),e}),p=o(()=>_().flatMap(e=>e.entries)),j=e=>{if(e.kind==="session"){b(`/${M(e.directory)}/session/${e.id}`),f.close();return}if(e.kind==="project"){b(`/${M(e.worktree)}/session`),f.close();return}if(e.id==="project.browse"){f.close(),m.onChooseProject();return}if(e.id==="server.switch"){f.close(),m.onSwitchServer();return}},K=e=>{const t=p();if(e.key==="ArrowDown"){if(e.preventDefault(),t.length===0)return;d(s=>(s+1)%t.length);return}if(e.key==="ArrowUp"){if(e.preventDefault(),t.length===0)return;d(s=>(s-1+t.length)%t.length);return}if(e.key==="Enter"){e.preventDefault();const s=t[S()]??t[0];s&&j(s);return}e.key==="Escape"&&(e.preventDefault(),f.close())},q=e=>p().indexOf(e);ie(()=>{const e=p(),t=g(),s=e.findIndex(r=>r.kind==="project"&&r.current);s>=0?d(s):e.length>0&&t&&e[0]?.kind==="session"&&d(0)});const Q=e=>e.kind==="session"?"comment":e.kind==="project"?"folder":e.icon;return c(de,{get title(){return i.t("quickSwitcher.title")},size:"normal",get children(){var e=me(),t=e.firstChild,s=t.nextSibling;return e.$$keydown=K,n(t,c(ne,{get value(){return $()},onChange:r=>{N(r),d(0)},get placeholder(){return i.t("quickSwitcher.search.placeholder")},get label(){return i.t("quickSwitcher.search.label")},hideLabel:!0,autofocus:!0})),n(s,c(ce,{get children(){return[c(E,{get when(){return p().length===0},get children(){var r=fe();return n(r,()=>i.t("quickSwitcher.empty")),r}}),c(E,{when:!0,get children(){var r=pe();return n(r,c(L,{get each(){return _()},children:D=>(()=>{var k=ge(),R=k.firstChild;return n(R,()=>D.title),n(k,c(L,{get each(){return D.entries},children:l=>{const x=o(()=>q(l)===S());return(()=>{var h=xe(),C=h.firstChild,H=C.nextSibling,v=H.firstChild,J=v.firstChild,U=v.nextSibling;return h.$$click=()=>j(l),h.addEventListener("mouseenter",()=>d(q(l))),n(C,c(le,{get name(){return Q(l)},size:"small"})),n(J,()=>l.title),n(v,c(A,{get when(){return ae(()=>l.kind==="project")()&&l.current},get children(){var a=we();return n(a,()=>i.t("quickSwitcher.label.current")),a}}),null),n(U,()=>l.subtitle),n(h,c(A,{get when(){return x()},get children(){var a=ke();return n(a,()=>i.t("quickSwitcher.hint.enter")),a}}),null),oe(a=>ue(h,{"bg-surface-raised-base-hover":x(),"hover:bg-surface-raised-base-hover":!x()},a)),h})()}}),null),k})()})),r}})]}})),e}})}he(["keydown","click"]);export{be as DialogQuickSwitcher};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as T,R as H,A as U,b as V,f as J,E as N,j as W,w as Q,U as C,m as j,l as z,$ as X,v as Y,y as I}from"./index-
|
|
1
|
+
import{C as T,R as H,A as U,b as V,f as J,E as N,j as W,w as Q,U as C,m as j,l as z,$ as X,v as Y,y as I}from"./index-BZ-S0u9J.js";import{F as O}from"./file-icon-CCBAkhZM.js";import{L as tt,f as et}from"./list-mHeqHLaV.js";var rt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-strong whitespace-nowrap">~</span><span class="text-text-weak whitespace-nowrap">/'),nt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap"></span><span class="text-text-weak whitespace-nowrap">/');function K(r){return((r??"").split(/\r?\n/)[0]??"").replace(/[\u0000-\u001F\u007F]/g,"").trim()}function st(r){const t=r.replaceAll("\\","/");return t.startsWith("//")&&!t.startsWith("///")?"//"+t.slice(2).replace(/\/+/g,"/"):t.replace(/\/+/g,"/")}function v(r){const t=st(r);return/^[A-Za-z]:$/.test(t)?t+"/":t}function d(r){const t=v(r);return t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t)?t:t.replace(/\/+$/,"")}function ot(r,t){const o=d(r??""),c=d(t).replace(/^\/+/,"");return o?c?o.endsWith("/")?o+c:o+"/"+c:o:c}function L(r){const t=v(r);return t.startsWith("//")?"//":t.startsWith("/")?"/":/^[A-Za-z]:\//.test(t)?t.slice(0,3):""}function at(r){const t=d(r);if(t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t))return t;const o=t.lastIndexOf("/");return o<=0?"/":o===2&&/^[A-Za-z]:/.test(t)?t.slice(0,3):t.slice(0,o)}function it(r){const t=v(r.trim());return t?t.startsWith("~")?"tilde":L(t)?"absolute":"relative":"relative"}function G(r,t){const o=d(r);if(!t)return"";const c=d(t),x=o.toLowerCase(),u=c.toLowerCase();return x===u?"~":x.startsWith(u+"/")?"~"+o.slice(c.length):""}function Z(r,t,o){const c=d(r);return it(t)==="absolute"?c:G(c,o)||c}function B(r,t,o){const c=d(r),x=G(c,t),u=l=>l?l.endsWith("/")?l:l+"/":"",y=Array.from(new Set([c,u(c),x,u(x),C(c)].filter(Boolean))).join(`
|
|
2
2
|
`);return{absolute:c,search:y,group:o}}function ct(r){const t=new Set;return r.filter(o=>t.has(o.absolute)?!1:(t.add(o.absolute),!0))}function lt(r){const t=new Map;let o=0;const c=y=>{const l=r.start();if(!l)return;const a=v(y);if(!a)return{directory:d(l),path:""};const m=r.home();if(a==="~")return{directory:d(m||l),path:""};if(a.startsWith("~/"))return{directory:d(m||l),path:a.slice(2)};const i=L(a);return i?{directory:d(i),path:a.slice(i.length)}:{directory:d(l),path:a}},x=async y=>{const l=d(y),a=t.get(l);if(a)return a;const m=r.sdk.client.file.list({directory:l,path:""}).then(i=>i.data??[]).catch(()=>[]).then(i=>i.filter(f=>f.type==="directory").map(f=>({name:f.name,absolute:d(v(f.absolute))})));return t.set(l,m),m},u=async(y,l,a)=>{const m=await x(y);return l?et.go(l,m,{key:"name",limit:a}).map(i=>i.obj.absolute):m.slice(0,a).map(i=>i.absolute)};return async y=>{const l=++o,a=()=>l===o,m=K(y),i=c(m);if(!i)return[];const f=v(m),P=f.startsWith("~")||!!L(f)||f.includes("/"),$=v(i.path),_=()=>r.sdk.client.find.files({directory:i.directory,query:$,type:"directory",limit:50}).then(h=>h.data??[]).catch(()=>[]);if(!P){const h=await _();return a()?h.map(F=>ot(i.directory,F)).slice(0,50):[]}const k=$.replace(/^\/+/,"").split("/"),D=k.slice(0,k.length-1).filter(h=>h&&h!=="."),e=k[k.length-1]??"",p=12,n=4;let s=[i.directory];for(const h of D){if(!a())return[];if(h===".."){s=s.map(at);continue}const F=(await Promise.all(s.map(E=>u(E,h,n)))).flat();if(!a())return[];if(s=Array.from(new Set(F)).slice(0,p),s.length===0)return[]}const w=(await Promise.all(s.map(h=>u(h,e,50)))).flat();if(!a())return[];const g=Array.from(new Set(w)),b=f.startsWith("~")?d(i.directory):"";if(!!f.endsWith("/")||!e)return(b?Array.from(new Set([b,...g])):g).slice(0,50);const A=e.toLowerCase(),R=g.filter(h=>C(h).toLowerCase()===A)[0];if(!R)return g.slice(0,50);const q=await u(R,"",30);if(!a())return[];const M=Array.from(new Set([...g,...q]));return(b?Array.from(new Set([b,...M])):M).slice(0,50)}}function ht(r){const t=T(),o=H(),c=U(),x=V(),u=J(),[y,l]=N("");let a;const m=W(()=>!(t.data.path.home||t.data.path.directory)),[i]=Q(()=>m()?!0:void 0,async()=>o.client.path.get().then(e=>e.data).catch(()=>{}),{initialValue:void 0}),f=W(()=>t.data.path.home||i()?.home||""),P=W(()=>t.data.path.home||t.data.path.directory||i()?.home||i()?.directory),$=lt({sdk:o,home:f,start:P}),_=W(()=>{const e=c.projects.list(),p=new Map;for(const n of e){let s=0;const w=[n.worktree,...n.sandboxes??[]];for(const g of w){const b=t.child(g,{bootstrap:!1})[0].session;for(const S of b){if(S.time.archived)continue;const A=S.time.updated??S.time.created;A>s&&(s=A)}}p.set(n.worktree,s)}return e.map((n,s)=>({project:n,at:p.get(n.worktree)??0,index:s})).sort((n,s)=>s.at-n.at||n.index-s.index).slice(0,5).map(({project:n})=>{const s=B(n.worktree,f(),"recent"),w=n.name||C(n.worktree);return{...s,search:`${s.search}
|
|
3
3
|
${w}`}})}),k=async e=>{const n=(await $(e)).map(s=>B(s,f(),"folders"));return ct([..._(),...n])};function D(e){r.onSelect(r.multiple?[e]:e),x.close()}return j(Y,{get title(){return r.title??u.t("command.project.open")},get children(){return j(tt,{get search(){return{placeholder:u.t("dialog.directory.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.directory.empty")},get loadingMessage(){return u.t("common.loading")},items:k,key:e=>e.absolute,filterKeys:["search"],groupBy:e=>e.group,sortGroupsBy:(e,p)=>e.category===p.category?0:e.category==="recent"?-1:1,groupHeader:e=>e.category==="recent"?u.t("home.recentProjects"):u.t("command.project.open"),ref:e=>a=e,onFilter:e=>l(K(e)),onKeyEvent:(e,p)=>{if(e.key!=="Tab"||e.shiftKey||!p)return;e.preventDefault(),e.stopPropagation();const n=Z(p.absolute,y(),f());a?.setFilter(n.endsWith("/")?n:n+"/")},onSelect:e=>{e&&D(e.absolute)},children:e=>{const p=Z(e.absolute,y(),f());return p==="~"?(()=>{var n=rt(),s=n.firstChild,w=s.firstChild;return z(s,j(O,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),w),n})():(()=>{var n=nt(),s=n.firstChild,w=s.firstChild,g=w.firstChild,b=g.nextSibling;return z(s,j(O,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),w),z(g,()=>X(p)),z(b,()=>C(p)),n})()}})}})}export{ht as DialogSelectDirectory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as u,N as M,O as Q,y as S,al as V,f as X,A as Z,am as ee,b as te,u as ne,R as se,C as re,E as ae,j as b,o as ie,m as y,an as oe,K as ce,M as P,q as F,ao as le,t as de,ap as ue,$ as ge,U as j,v as fe,P as pe}from"./index-
|
|
1
|
+
import{l as u,N as M,O as Q,y as S,al as V,f as X,A as Z,am as ee,b as te,u as ne,R as se,C as re,E as ae,j as b,o as ie,m as y,an as oe,K as ce,M as P,q as F,ao as le,t as de,ap as ue,$ as ge,U as j,v as fe,P as pe}from"./index-BZ-S0u9J.js";import{F as he}from"./file-icon-CCBAkhZM.js";import{L as me}from"./list-mHeqHLaV.js";import{u as ye,c as we}from"./session-B7TyS2pp.js";import"./provider-icon-Ch41KuaD.js";var ve=S("<span data-component=keybind>");function be(t){return(()=>{var n=ve();return u(n,()=>t.children),M(i=>Q(n,{...t.classList,[t.class??""]:!!t.class},i)),n})()}var K=S('<span class="text-14-regular text-text-weak truncate">'),xe=S('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),$e=S('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),ke=S('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),Se=S('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const T=5,_e=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],q=t=>{const n=new Set,i=[];for(const p of t)n.has(p.id)||(n.add(p.id),i.push(p));return i},N=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),D=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Ce=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function Fe(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(r=>!r.disabled&&!r.id.startsWith("suggested.")&&r.id!=="file.open")),i=b(()=>{const r=t.language.t("palette.group.commands");return n().map(d=>N(d,r))}),p=b(()=>{const r=n(),d=new Map(_e.map((a,c)=>[a,c])),w=r.filter(a=>d.has(a.id)),o=w.length?w:r.slice(0,T),g=w.length?[...o].sort((a,c)=>(d.get(a.id)??0)-(d.get(c.id)??0)):o,v=t.language.t("palette.group.commands");return g.map(a=>N(a,v))});return{allowed:n,list:i,picks:p}}function De(t){const n=we({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:r=>r.startsWith("file://")?t.file.tab(r):r}),i=b(()=>{const r=n.openedTabs(),d=n.activeFileTab(),w=d?[d,...r.filter(a=>a!==d)]:r,o=new Set,g=t.language.t("palette.group.files"),v=[];for(const a of w){const c=t.file.pathFromTab(a);c&&(o.has(c)||(o.add(c),v.push(D(c,g))))}return v.slice(0,T)}),p=b(()=>{const r=t.language.t("palette.group.files");return t.file.tree.children("").filter(o=>o.type==="file").map(o=>o.path).sort((o,g)=>o.localeCompare(g)).slice(0,T).map(o=>D(o,r))});return{recent:i,root:p}}function Ee(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:p=>{if(!p.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const d=n.token,w=t.workspaces();return w.length===0?[]:(n.inflight=Promise.all(w.map(o=>{const g=t.label(o);return t.globalSDK.client.session.list({directory:o,roots:!0}).then(v=>(v.data??[]).filter(a=>!!a?.id).map(a=>({id:a.id,title:a.title??t.language.t("command.session.new"),description:g,directory:o,archived:a.time?.archived,updated:a.time?.updated}))).catch(()=>[])})).then(o=>{if(n.token!==d)return[];const g=new Set,v=t.language.t("command.category.session"),a=o.flat().filter(c=>{const x=`${c.directory}:${c.id}`;return g.has(x)?!1:(g.add(x),!0)}).map(c=>Ce(c,v));return n.cached=a,a}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Pe(t){const n=V(),i=X(),p=Z(),r=ee(),d=te(),w=ne(),o=se(),g=re(),{params:v,tabs:a,view:c}=ye(),x=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[R,z]=ae(!1),I=Fe({filesOnly:x,command:n,language:i}),_=De({file:r,tabs:a,language:i}),L=b(()=>oe(v.dir)??""),O=b(()=>{const e=L();if(e)return p.projects.list().find(s=>s.worktree===e||s.sandboxes?.includes(e))}),A=b(()=>{const e=L(),s=O();if(!s)return e?[e]:[];const l=[s.worktree,...s.sandboxes??[]];return e&&!l.includes(e)?[...l,e]:l}),G=b(()=>g.data.path.home),W=e=>{const s=O(),l=s&&e===s.worktree?i.t("workspace.type.local"):i.t("workspace.type.sandbox"),[h]=g.child(e,{bootstrap:!1}),f=G(),m=f?e.replace(f,"~"):e,$=h.vcs?.branch??j(e);return`${l} : ${$||m}`},{sessions:B}=Ee({workspaces:A,label:W,globalSDK:o,language:i}),H=async e=>{const s=e.trim();if(z(s.length>0),!s&&x()){const $=r.tree.state("")?.loaded,E=$?Promise.resolve():r.tree.list(""),C=q([..._.recent(),..._.root()]);return $||C.length>0?C:(await E,q([..._.recent(),..._.root()]))}if(!s)return[...I.picks(),..._.recent()];if(x()){const $=await r.searchFiles(s),E=i.t("palette.group.files");return $.map(C=>D(C,E))}const[l,h]=await Promise.all([r.searchFiles(s),Promise.resolve(B(s))]),f=i.t("palette.group.files"),m=l.map($=>D($,f));return[...I.list(),...h,...m]},U=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},Y=e=>{const s=r.tab(e);a().open(s),r.load(e),c().reviewPanel.opened()||c().reviewPanel.open(),p.fileTree.setTab("all"),t.onOpenFile?.(e),a().setActive(s)},J=e=>{if(e){if(k.committed=!0,k.cleanup=void 0,d.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;w(`/${pe(e.directory)}/session/${e.sessionID}`);return}e.path&&Y(e.path)}};return ie(()=>{k.committed||k.cleanup?.()}),y(fe,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return y(me,{get search(){return{placeholder:x()?i.t("session.header.searchFiles"):i.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return i.t(x()?"palette.empty.filesPrompt":"palette.empty")},get loadingMessage(){return i.t("common.loading")},items:H,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return R()?e=>e.category:()=>""},onMove:U,onSelect:J,children:e=>y(ce,{get fallback(){return(()=>{var s=Se(),l=s.firstChild,h=l.firstChild,f=h.firstChild,m=f.nextSibling;return u(l,y(he,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),h),u(f,()=>ge(e.path??"")),u(m,()=>j(e.path??"")),s})()},get children(){return[y(P,{get when(){return e.type==="command"},get children(){var s=xe(),l=s.firstChild,h=l.firstChild;return u(h,()=>e.title),u(l,y(F,{get when(){return e.description},get children(){var f=K();return u(f,()=>e.description),f}}),null),u(s,y(F,{get when(){return e.keybind},get children(){return y(be,{class:"rounded-[4px]",get children(){return le(e.keybind??"",i.t)}})}}),null),s}}),y(P,{get when(){return e.type==="session"},get children(){var s=ke(),l=s.firstChild,h=l.firstChild,f=h.firstChild;return u(l,y(de,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),h),u(f,()=>e.title),u(h,y(F,{get when(){return e.description},get children(){var m=K();return u(m,()=>e.description),M(()=>m.classList.toggle("opacity-70",!!e.archived)),m}}),null),u(s,y(F,{get when(){return e.updated},get children(){var m=$e();return u(m,()=>ue(new Date(e.updated).toISOString(),i.t)),m}}),null),M(()=>f.classList.toggle("opacity-70",!!e.archived)),s}})]}})})}})}export{Pe as DialogSelectFile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a0 as P,a1 as M,f as j,h as D,k as $,a2 as E,z as q,j as h,i as F,m as u,Q as K,l as c,q as v,p as b,a3 as z,v as B,y as m}from"./index-
|
|
1
|
+
import{a0 as P,a1 as M,f as j,h as D,k as $,a2 as E,z as q,j as h,i as F,m as u,Q as K,l as c,q as v,p as b,a3 as z,v as B,y as m}from"./index-BZ-S0u9J.js";import{L as O}from"./list-mHeqHLaV.js";var Q=m('<span class="text-11-regular text-text-weaker">'),T=m('<span class="text-11-regular text-text-weak">'),A=m('<span class="text-11-regular text-text-weaker truncate">'),G=m('<div class="w-full flex items-center justify-between gap-x-3"><div class="flex flex-col gap-0.5 min-w-0"><div class="flex items-center gap-2"><span class=truncate></span></div></div><div>');const H={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},N=()=>{const s=P(),d=M(),l=j(),[_,o]=D({done:!1,loading:!1});$(E(()=>s.data.mcp_ready,(e,t)=>{!e&&t&&o("done",!1)},{defer:!0})),$(()=>{if(!(_.done||_.loading)){if(s.data.mcp_ready){o("done",!0);return}o("loading",!0),d.client.mcp.status().then(e=>{s.set("mcp",e.data??{}),s.set("mcp_ready",!0),o("done",!0)}).catch(e=>{o("done",!0),q({variant:"error",title:l.t("common.requestFailed"),description:e instanceof Error?e.message:String(e)})}).finally(()=>{o("loading",!1)})}});const p=h(()=>Object.entries(s.data.mcp??{}).map(([e,t])=>({name:e,status:t.status})).sort((e,t)=>e.name.localeCompare(t.name))),n=F(()=>({mutationFn:async e=>{s.data.mcp[e]?.status==="connected"?await d.client.mcp.disconnect({name:e}):await d.client.mcp.connect({name:e});const i=await d.client.mcp.status();i.data&&s.set("mcp",i.data)}})),S=h(()=>p().filter(e=>e.status==="connected").length),k=h(()=>p().length);return u(B,{get title(){return l.t("dialog.mcp.title")},get description(){return l.t("dialog.mcp.description",{enabled:S(),total:k()})},get children(){return u(O,{get search(){return{placeholder:l.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return l.t("dialog.mcp.empty")},key:e=>e?.name??"",items:p,filterKeys:["name","status"],sortBy:(e,t)=>e.name.localeCompare(t.name),onSelect:e=>{!e||n.isPending||n.mutate(e.name)},children:e=>{const t=()=>s.data.mcp[e.name],i=()=>t()?.status,w=()=>{const r=i()?H[i()]:void 0;if(r)return l.t(r)},x=()=>{const r=t();return r?.status==="failed"?r.error:void 0},C=()=>i()==="connected";return(()=>{var r=G(),g=r.firstChild,f=g.firstChild,L=f.firstChild,y=g.nextSibling;return c(L,()=>e.name),c(f,u(v,{get when(){return w()},get children(){var a=Q();return c(a,w),a}}),null),c(f,u(v,{get when(){return b(()=>!!n.isPending)()&&n.variables===e.name},get children(){var a=T();return c(a,()=>l.t("common.loading.ellipsis")),a}}),null),c(g,u(v,{get when(){return x()},get children(){var a=A();return c(a,x),a}}),null),y.$$click=a=>a.stopPropagation(),c(y,u(z,{get checked(){return C()},get disabled(){return b(()=>!!n.isPending)()&&n.variables===e.name},onChange:()=>{n.isPending||n.mutate(e.name)}})),r})()}})}})};K(["click"]);export{N as DialogSelectMcp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-connect-provider-
|
|
2
|
-
import{a6 as k,b as E,a7 as I,f as L,m as l,l as r,a8 as f,q as p,a9 as S,p as M,aa as g,B as T,v as O,y as u,ab as x,Q as A}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-connect-provider-F-H6E-u1.js","assets/index-BZ-S0u9J.js","assets/index-BG3RElAN.css","assets/list-mHeqHLaV.js","assets/provider-icon-Ch41KuaD.js","assets/dialog-select-provider-WQnY_rEG.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a6 as k,b as E,a7 as I,f as L,m as l,l as r,a8 as f,q as p,a9 as S,p as M,aa as g,B as T,v as O,y as u,ab as x,Q as A}from"./index-BZ-S0u9J.js";import{L as w}from"./list-mHeqHLaV.js";import{P as B}from"./provider-icon-Ch41KuaD.js";import{M as R}from"./session-B7TyS2pp.js";import"./file-icon-CCBAkhZM.js";var K=u('<div class="flex flex-col gap-3 px-2.5"><div class="text-14-medium text-text-base px-2.5">'),V=u('<div class="px-1.5 pb-1.5"><div class="w-full rounded-sm border border-border-weak-base bg-surface-raised-base"><div class="w-full flex flex-col items-start gap-4 px-1.5 pt-4 pb-4"><div class="px-2 text-14-medium text-text-base"></div><div class=w-full>'),j=u('<div class="w-full flex items-center gap-x-2.5"><span>'),$=u('<div class="text-14-regular text-text-weak">'),q=u('<div class="w-full flex items-center gap-x-3"><span>');const G=b=>{const m=b.model??k().model,v=E(),y=I(),o=L(),D=t=>{x(()=>import("./dialog-connect-provider-F-H6E-u1.js").then(n=>n.d),__vite__mapDeps([0,1,2,3,4])).then(n=>{v.show(()=>l(n.DialogConnectProvider,{provider:t}))})},C=()=>{x(()=>import("./dialog-select-provider-WQnY_rEG.js").then(t=>t.d),__vite__mapDeps([5,1,2,3,4,0])).then(t=>{v.show(()=>l(t.DialogSelectProvider,{}))})};let h;const P=t=>{t.key!=="Escape"&&h?.onKeyDown(t)};return l(O,{get title(){return o.t("dialog.model.select.title")},class:"overflow-y-auto [&_[data-slot=dialog-body]]:overflow-visible [&_[data-slot=dialog-body]]:flex-none",get children(){return[(()=>{var t=K(),n=t.firstChild;return t.$$keydown=P,r(n,()=>o.t("dialog.model.unpaid.freeModels.title")),r(t,l(w,{class:"[&_[data-slot=list-scroll]]:overflow-visible",ref:e=>h=e,get items(){return m.list},get current(){return m.current()},key:e=>`${e.provider.id}:${e.id}`,itemWrapper:(e,d)=>l(S,{class:"w-full",placement:"right-start",gutter:12,get value(){return l(R,{model:e,get latest(){return e.latest},get free(){return M(()=>e.provider.id==="codeplane")()&&(!e.cost||e.cost.input===0)}})},children:d}),onSelect:e=>{m.set(e?{modelID:e.id,providerID:e.provider.id}:void 0,{recent:!0}),v.close()},children:e=>(()=>{var d=j(),c=d.firstChild;return r(c,()=>e.name),r(d,l(f,{get children(){return o.t("model.tag.free")}}),null),r(d,l(p,{get when(){return e.latest},get children(){return l(f,{get children(){return o.t("model.tag.latest")}})}}),null),d})()}),null),t})(),(()=>{var t=V(),n=t.firstChild,e=n.firstChild,d=e.firstChild,c=d.nextSibling;return r(d,()=>o.t("dialog.model.unpaid.addMore.title")),r(c,l(w,{class:"w-full px-0",key:a=>a?.id,get items(){return y.popular},activeIcon:"plus-small",sortBy:(a,i)=>g.includes(a.id)&&g.includes(i.id)?g.indexOf(a.id)-g.indexOf(i.id):a.name.localeCompare(i.name),onSelect:a=>{a&&D(a.id)},children:a=>(()=>{var i=q(),_=i.firstChild;return r(i,l(B,{"data-slot":"list-item-extra-icon",get id(){return a.id}}),_),r(_,()=>a.name),r(i,l(p,{get when(){return a.id==="codeplane"},get children(){var s=$();return r(s,()=>o.t("dialog.provider.codeplane.tagline")),s}}),null),r(i,l(p,{get when(){return a.id==="codeplane"},get children(){return l(f,{get children(){return o.t("dialog.provider.tag.recommended")}})}}),null),r(i,l(p,{get when(){return a.id==="anthropic"},get children(){var s=$();return r(s,()=>o.t("dialog.provider.anthropic.note")),s}}),null),i})()}),null),r(c,l(T,{variant:"ghost",class:"w-full justify-start px-[11px] py-3.5 gap-4.5 text-14-medium",icon:"dot-grid",onClick:C,get children(){return o.t("dialog.provider.viewAll")}}),null),t})()]}})};A(["keydown"]);export{G as DialogSelectModelUnpaid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as se,C as pe,R as ge,f as ne,c as he,h as fe,i as Y,z,k as be,o as ye,m as a,l as n,T as x,B as F,q as M,L as Z,I as V,N as ee,V as re,p as we,v as le,y as A,aq as J,aj as B,a7 as xe,a8 as te,aa as U}from"./index-Cv0n48xp.js";import{L as ke}from"./list-DxMrcrlT.js";import{P as de}from"./provider-icon-DUeYJhIN.js";import{L as Ce,D as Se}from"./dialog-connect-provider-ChAd3tkx.js";const _e=/^[a-z0-9][a-z0-9-_]*$/,Le="@ai-sdk/openai-compatible";function De(i){return new URL("/provider/custom-models",i).toString()}async function $e(i,v){if(!i.ok)throw new Error(v);if(i.headers.get("content-type")?.split(";")[0].trim().toLowerCase()!=="application/json")throw new Error(v);const p=await i.json().catch(()=>{});if(!p||typeof p!="object"||!Array.isArray(p.models))throw new Error(v);return p}function Ie(i){const v=i.form.providerID.trim(),d=i.form.name.trim(),p=i.form.baseURL.trim(),r=i.form.apiKey.trim(),k=r.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),s=r&&!k?r:void 0,t=v?_e.test(v)?void 0:i.t("provider.custom.error.providerID.format"):i.t("provider.custom.error.providerID.required"),m=d?void 0:i.t("provider.custom.error.name.required"),g=p?/^https?:\/\//.test(p)?void 0:i.t("provider.custom.error.baseURL.format"):i.t("provider.custom.error.baseURL.required"),y=i.disabledProviders.includes(v),C=t?void 0:i.existingProviderIDs.has(v)&&!y?i.t("provider.custom.error.providerID.exists"):void 0,O=new Set,L=i.form.models.map(l=>{const f=l.id.trim(),e=f?O.has(f)?i.t("provider.custom.error.duplicate"):(()=>{O.add(f)})():i.t("provider.custom.error.required"),o=l.name.trim()?void 0:i.t("provider.custom.error.required");return{id:e,name:o}}),j=L.every(l=>!l.id&&!l.name),G=Object.fromEntries(i.form.models.map(l=>[l.id.trim(),{name:l.name.trim()}])),w=new Set,D=i.form.headers.map(l=>{const f=l.key.trim(),e=l.value.trim();if(!f&&!e)return{};const o=f?w.has(f.toLowerCase())?i.t("provider.custom.error.duplicate"):(()=>{w.add(f.toLowerCase())})():i.t("provider.custom.error.required"),c=e?void 0:i.t("provider.custom.error.required");return{key:o,value:c}}),$=D.every(l=>!l.key&&!l.value),I=Object.fromEntries(i.form.headers.map(l=>({key:l.key.trim(),value:l.value.trim()})).filter(l=>!!l.key&&!!l.value).map(l=>[l.key,l.value])),E={providerID:t??C,name:m,baseURL:g};return!t&&!C&&!m&&!g&&j&&$?{err:E,models:L,headers:D,result:{providerID:v,name:d,key:s,config:{npm:Le,name:d,...k?{env:[k]}:{},options:{baseURL:p,...Object.keys(I).length?{headers:I}:{}},models:G}}}:{err:E,models:L,headers:D}}let Ee=0;const ce=()=>`row-${Ee++}`,W=()=>({row:ce(),id:"",name:"",err:{}}),oe=()=>({row:ce(),key:"",value:"",err:{}});var Pe=A('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-6"><p class="text-14-regular text-text-base"></p><div class="flex flex-col gap-4"></div><div class="flex flex-col gap-3"><div class="flex items-center justify-between gap-3"><label class="text-12-medium text-text-weak"></label></div></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak">'),ie=A('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function Re(i){const v=se(),d=pe(),p=ge(),r=ne(),k=he(),[s,t]=fe({providerID:"",name:"",baseURL:"",apiKey:"",models:[W()],headers:[oe()],err:{}}),m=()=>{if(i.back==="close"){v.close();return}v.show(()=>a(ue,{}))},g=()=>{t("models",B(e=>{e.push(W())}))},y=e=>{s.models.length<=1||t("models",B(o=>{o.splice(e,1)}))},C=()=>{t("headers",B(e=>{e.push(oe())}))},O=e=>{s.headers.length<=1||t("headers",B(o=>{o.splice(e,1)}))},L=()=>Object.fromEntries(s.headers.map(e=>({key:e.key.trim(),value:e.value.trim()})).filter(e=>!!e.key&&!!e.value).map(e=>[e.key,e.value])),j=()=>/^https?:\/\//.test(s.baseURL.trim()),G=()=>j()&&(!!s.apiKey.trim()||s.headers.some(e=>e.key.trim().toLowerCase()==="authorization"&&!!e.value.trim())),w=Y(()=>({mutationFn:async e=>{const o=k.current;if(!o)throw new Error(r.t("error.globalSDK.noServerAvailable"));const c=await fetch(De(o.http.url),{method:"POST",headers:{"content-type":"application/json",...o.http.password?{Authorization:`Basic ${btoa(`${o.http.username??"codeplane"}:${o.http.password}`)}`}:{}},body:JSON.stringify({baseURL:s.baseURL.trim(),apiKey:s.apiKey.trim().match(/^\{env:[^}]+\}$/)?void 0:s.apiKey.trim()||void 0,headers:L()})}),h=await $e(c,r.t("provider.custom.models.fetch.error"));if(h.models.length===0)throw new Error(r.t("provider.custom.models.fetch.empty"));return h},onSuccess:(e,o)=>{t("models",e.models.map(c=>({...W(),id:c.id,name:c.name}))),!o?.silent&&z({variant:"success",icon:"circle-check",title:r.t("provider.custom.models.fetch.success",{count:e.models.length})})},onError:(e,o)=>{if(o?.silent)return;const c=e instanceof Error?e.message:String(e);z({title:r.t("common.requestFailed"),description:c})}}));let D="";be(()=>{const e=JSON.stringify({baseURL:s.baseURL.trim(),apiKey:s.apiKey.trim(),headers:L()});if(!s.models.every(h=>!h.id.trim()&&!h.name.trim())||!G()||w.isPending||e===D)return;const c=setTimeout(()=>{D=e,w.mutate({silent:!0})},600);ye(()=>clearTimeout(c))});const $=(e,o)=>{t(e,o),e!=="apiKey"&&t("err",e,void 0)},I=(e,o,c)=>{J(()=>{t("models",e,o,c),t("models",e,"err",o,void 0)})},E=(e,o,c)=>{J(()=>{t("headers",e,o,c),t("headers",e,"err",o,void 0)})},Q=()=>{const e=Ie({form:s,t:r.t,disabledProviders:d.data.config.disabled_providers??[],existingProviderIDs:new Set(d.data.provider.all.map(o=>o.id))});return J(()=>{t("err",e.err),e.models.forEach((o,c)=>t("models",c,"err",o)),e.headers.forEach((o,c)=>t("headers",c,"err",o))}),e.result},l=Y(()=>({mutationFn:async e=>{const c=(d.data.config.disabled_providers??[]).filter(h=>h!==e.providerID);return e.key&&await p.client.auth.set({providerID:e.providerID,auth:{type:"api",key:e.key}}),await d.updateConfig({provider:{[e.providerID]:e.config},disabled_providers:c}),e},onSuccess:e=>{v.close(),z({variant:"success",icon:"circle-check",title:r.t("provider.connect.toast.connected.title",{provider:e.name}),description:r.t("provider.connect.toast.connected.description",{provider:e.name})})},onError:e=>{const o=e instanceof Error?e.message:String(e);z({title:r.t("common.requestFailed"),description:o})}})),f=e=>{if(e.preventDefault(),l.isPending)return;const o=Q();o&&l.mutate(o)};return a(le,{get title(){return a(V,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:m,get"aria-label"(){return r.t("common.goBack")}})},transition:!0,get children(){var e=Pe(),o=e.firstChild,c=o.firstChild,h=o.nextSibling,T=h.firstChild,P=T.nextSibling,q=P.nextSibling,X=q.firstChild,me=X.firstChild,H=q.nextSibling,ve=H.firstChild;return n(o,a(de,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),c),n(c,()=>r.t("provider.custom.title")),h.addEventListener("submit",f),n(T,()=>r.t("provider.custom.description.prefix"),null),n(T,a(Ce,{href:"https://github.com/devinoldenburg/codeplane",tabIndex:-1,get children(){return r.t("provider.custom.description.link")}}),null),n(T,()=>r.t("provider.custom.description.suffix"),null),n(P,a(x,{autofocus:!0,get label(){return r.t("provider.custom.field.providerID.label")},get placeholder(){return r.t("provider.custom.field.providerID.placeholder")},get description(){return r.t("provider.custom.field.providerID.description")},get value(){return s.providerID},onChange:u=>$("providerID",u),get validationState(){return s.err.providerID?"invalid":void 0},get error(){return s.err.providerID}}),null),n(P,a(x,{get label(){return r.t("provider.custom.field.name.label")},get placeholder(){return r.t("provider.custom.field.name.placeholder")},get value(){return s.name},onChange:u=>$("name",u),get validationState(){return s.err.name?"invalid":void 0},get error(){return s.err.name}}),null),n(P,a(x,{get label(){return r.t("provider.custom.field.baseURL.label")},get placeholder(){return r.t("provider.custom.field.baseURL.placeholder")},get value(){return s.baseURL},onChange:u=>$("baseURL",u),get validationState(){return s.err.baseURL?"invalid":void 0},get error(){return s.err.baseURL}}),null),n(P,a(x,{get label(){return r.t("provider.custom.field.apiKey.label")},get placeholder(){return r.t("provider.custom.field.apiKey.placeholder")},get description(){return r.t("provider.custom.field.apiKey.description")},get value(){return s.apiKey},onChange:u=>$("apiKey",u)}),null),n(me,()=>r.t("provider.custom.models.label")),n(X,a(F,{type:"button",size:"small",variant:"ghost",onClick:()=>w.mutate({}),get disabled(){return!j()||w.isPending},get children(){return a(M,{get when(){return!w.isPending},get fallback(){return r.t("provider.custom.models.fetch.loading")},get children(){return r.t("provider.custom.models.fetch")}})}}),null),n(q,a(Z,{get each(){return s.models},children:(u,S)=>(()=>{var b=ie(),R=b.firstChild,N=R.nextSibling;return n(R,a(x,{get label(){return r.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.id.placeholder")},get value(){return u.id},onChange:_=>I(S(),"id",_),get validationState(){return u.err.id?"invalid":void 0},get error(){return u.err.id}})),n(N,a(x,{get label(){return r.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.name.placeholder")},get value(){return u.name},onChange:_=>I(S(),"name",_),get validationState(){return u.err.name?"invalid":void 0},get error(){return u.err.name}})),n(b,a(V,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>y(S()),get disabled(){return s.models.length<=1},get"aria-label"(){return r.t("provider.custom.models.remove")}}),null),ee(()=>re(b,"data-row",u.row)),b})()}),null),n(q,a(F,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:g,class:"self-start",get children(){return r.t("provider.custom.models.add")}}),null),n(ve,()=>r.t("provider.custom.headers.label")),n(H,a(Z,{get each(){return s.headers},children:(u,S)=>(()=>{var b=ie(),R=b.firstChild,N=R.nextSibling;return n(R,a(x,{get label(){return r.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.key.placeholder")},get value(){return u.key},onChange:_=>E(S(),"key",_),get validationState(){return u.err.key?"invalid":void 0},get error(){return u.err.key}})),n(N,a(x,{get label(){return r.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.value.placeholder")},get value(){return u.value},onChange:_=>E(S(),"value",_),get validationState(){return u.err.value?"invalid":void 0},get error(){return u.err.value}})),n(b,a(V,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>O(S()),get disabled(){return s.headers.length<=1},get"aria-label"(){return r.t("provider.custom.headers.remove")}}),null),ee(()=>re(b,"data-row",u.row)),b})()}),null),n(H,a(F,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:C,class:"self-start",get children(){return r.t("provider.custom.headers.add")}}),null),n(h,a(F,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return l.isPending},get children(){return we(()=>!!l.isPending)()?r.t("common.saving"):r.t("common.submit")}}),null),e}})}var ae=A('<div class="text-14-regular text-text-weak">'),Ue=A('<div class="px-1.25 w-full flex items-center gap-x-3"><span>');const K="_custom",ue=()=>{const i=se(),v=xe(),d=ne(),p=()=>d.t("dialog.provider.group.popular"),r=()=>d.t("dialog.provider.group.other"),k=()=>d.t("settings.providers.tag.custom"),s=t=>{if(t==="anthropic")return d.t("dialog.provider.anthropic.note");if(t==="openai")return d.t("dialog.provider.openai.note");if(t.startsWith("github-copilot"))return d.t("dialog.provider.copilot.note")};return a(le,{get title(){return d.t("command.provider.connect")},transition:!0,get children(){return a(ke,{get search(){return{placeholder:d.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return d.t("dialog.provider.empty")},activeIcon:"plus-small",key:t=>t?.id,items:()=>(d.locale(),[{id:K,name:k()},...v.all()]),filterKeys:["id","name"],groupBy:t=>U.includes(t.id)?p():r(),sortBy:(t,m)=>t.id===K?-1:m.id===K?1:U.includes(t.id)&&U.includes(m.id)?U.indexOf(t.id)-U.indexOf(m.id):t.name.localeCompare(m.name),sortGroupsBy:(t,m)=>{const g=p();return t.category===g&&m.category!==g?-1:m.category===g&&t.category!==g?1:0},onSelect:t=>{if(t){if(t.id===K){i.show(()=>a(Re,{back:"providers"}));return}i.show(()=>a(Se,{get provider(){return t.id}}))}},children:t=>(()=>{var m=Ue(),g=m.firstChild;return n(m,a(de,{"data-slot":"list-item-extra-icon",get id(){return t.id}}),g),n(g,()=>t.name),n(m,a(M,{get when(){return t.id==="codeplane"},get children(){var y=ae();return n(y,()=>d.t("dialog.provider.codeplane.tagline")),y}}),null),n(m,a(M,{get when(){return t.id===K},get children(){return a(te,{get children(){return d.t("settings.providers.tag.custom")}})}}),null),n(m,a(M,{get when(){return t.id==="codeplane"},get children(){return a(te,{get children(){return d.t("dialog.provider.tag.recommended")}})}}),null),n(m,a(M,{get when(){return s(t.id)},keyed:!0,children:y=>(()=>{var C=ae();return n(C,y),C})()}),null),m})()})}})},Te=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectProvider:ue},Symbol.toStringTag,{value:"Module"}));export{ue as D,Re as a,Te as d};
|
|
1
|
+
import{b as se,C as pe,R as ge,f as ne,c as he,h as fe,i as Y,z,k as be,o as ye,m as a,l as n,T as x,B as F,q as M,L as Z,I as V,N as ee,V as re,p as we,v as le,y as A,aq as J,aj as B,a7 as xe,a8 as te,aa as U}from"./index-BZ-S0u9J.js";import{L as ke}from"./list-mHeqHLaV.js";import{P as de}from"./provider-icon-Ch41KuaD.js";import{L as Ce,D as Se}from"./dialog-connect-provider-F-H6E-u1.js";const _e=/^[a-z0-9][a-z0-9-_]*$/,Le="@ai-sdk/openai-compatible";function De(i){return new URL("/provider/custom-models",i).toString()}async function $e(i,v){if(!i.ok)throw new Error(v);if(i.headers.get("content-type")?.split(";")[0].trim().toLowerCase()!=="application/json")throw new Error(v);const p=await i.json().catch(()=>{});if(!p||typeof p!="object"||!Array.isArray(p.models))throw new Error(v);return p}function Ie(i){const v=i.form.providerID.trim(),d=i.form.name.trim(),p=i.form.baseURL.trim(),r=i.form.apiKey.trim(),k=r.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),s=r&&!k?r:void 0,t=v?_e.test(v)?void 0:i.t("provider.custom.error.providerID.format"):i.t("provider.custom.error.providerID.required"),m=d?void 0:i.t("provider.custom.error.name.required"),g=p?/^https?:\/\//.test(p)?void 0:i.t("provider.custom.error.baseURL.format"):i.t("provider.custom.error.baseURL.required"),y=i.disabledProviders.includes(v),C=t?void 0:i.existingProviderIDs.has(v)&&!y?i.t("provider.custom.error.providerID.exists"):void 0,O=new Set,L=i.form.models.map(l=>{const f=l.id.trim(),e=f?O.has(f)?i.t("provider.custom.error.duplicate"):(()=>{O.add(f)})():i.t("provider.custom.error.required"),o=l.name.trim()?void 0:i.t("provider.custom.error.required");return{id:e,name:o}}),j=L.every(l=>!l.id&&!l.name),G=Object.fromEntries(i.form.models.map(l=>[l.id.trim(),{name:l.name.trim()}])),w=new Set,D=i.form.headers.map(l=>{const f=l.key.trim(),e=l.value.trim();if(!f&&!e)return{};const o=f?w.has(f.toLowerCase())?i.t("provider.custom.error.duplicate"):(()=>{w.add(f.toLowerCase())})():i.t("provider.custom.error.required"),c=e?void 0:i.t("provider.custom.error.required");return{key:o,value:c}}),$=D.every(l=>!l.key&&!l.value),I=Object.fromEntries(i.form.headers.map(l=>({key:l.key.trim(),value:l.value.trim()})).filter(l=>!!l.key&&!!l.value).map(l=>[l.key,l.value])),E={providerID:t??C,name:m,baseURL:g};return!t&&!C&&!m&&!g&&j&&$?{err:E,models:L,headers:D,result:{providerID:v,name:d,key:s,config:{npm:Le,name:d,...k?{env:[k]}:{},options:{baseURL:p,...Object.keys(I).length?{headers:I}:{}},models:G}}}:{err:E,models:L,headers:D}}let Ee=0;const ce=()=>`row-${Ee++}`,W=()=>({row:ce(),id:"",name:"",err:{}}),oe=()=>({row:ce(),key:"",value:"",err:{}});var Pe=A('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-6"><p class="text-14-regular text-text-base"></p><div class="flex flex-col gap-4"></div><div class="flex flex-col gap-3"><div class="flex items-center justify-between gap-3"><label class="text-12-medium text-text-weak"></label></div></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak">'),ie=A('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function Re(i){const v=se(),d=pe(),p=ge(),r=ne(),k=he(),[s,t]=fe({providerID:"",name:"",baseURL:"",apiKey:"",models:[W()],headers:[oe()],err:{}}),m=()=>{if(i.back==="close"){v.close();return}v.show(()=>a(ue,{}))},g=()=>{t("models",B(e=>{e.push(W())}))},y=e=>{s.models.length<=1||t("models",B(o=>{o.splice(e,1)}))},C=()=>{t("headers",B(e=>{e.push(oe())}))},O=e=>{s.headers.length<=1||t("headers",B(o=>{o.splice(e,1)}))},L=()=>Object.fromEntries(s.headers.map(e=>({key:e.key.trim(),value:e.value.trim()})).filter(e=>!!e.key&&!!e.value).map(e=>[e.key,e.value])),j=()=>/^https?:\/\//.test(s.baseURL.trim()),G=()=>j()&&(!!s.apiKey.trim()||s.headers.some(e=>e.key.trim().toLowerCase()==="authorization"&&!!e.value.trim())),w=Y(()=>({mutationFn:async e=>{const o=k.current;if(!o)throw new Error(r.t("error.globalSDK.noServerAvailable"));const c=await fetch(De(o.http.url),{method:"POST",headers:{"content-type":"application/json",...o.http.password?{Authorization:`Basic ${btoa(`${o.http.username??"codeplane"}:${o.http.password}`)}`}:{}},body:JSON.stringify({baseURL:s.baseURL.trim(),apiKey:s.apiKey.trim().match(/^\{env:[^}]+\}$/)?void 0:s.apiKey.trim()||void 0,headers:L()})}),h=await $e(c,r.t("provider.custom.models.fetch.error"));if(h.models.length===0)throw new Error(r.t("provider.custom.models.fetch.empty"));return h},onSuccess:(e,o)=>{t("models",e.models.map(c=>({...W(),id:c.id,name:c.name}))),!o?.silent&&z({variant:"success",icon:"circle-check",title:r.t("provider.custom.models.fetch.success",{count:e.models.length})})},onError:(e,o)=>{if(o?.silent)return;const c=e instanceof Error?e.message:String(e);z({title:r.t("common.requestFailed"),description:c})}}));let D="";be(()=>{const e=JSON.stringify({baseURL:s.baseURL.trim(),apiKey:s.apiKey.trim(),headers:L()});if(!s.models.every(h=>!h.id.trim()&&!h.name.trim())||!G()||w.isPending||e===D)return;const c=setTimeout(()=>{D=e,w.mutate({silent:!0})},600);ye(()=>clearTimeout(c))});const $=(e,o)=>{t(e,o),e!=="apiKey"&&t("err",e,void 0)},I=(e,o,c)=>{J(()=>{t("models",e,o,c),t("models",e,"err",o,void 0)})},E=(e,o,c)=>{J(()=>{t("headers",e,o,c),t("headers",e,"err",o,void 0)})},Q=()=>{const e=Ie({form:s,t:r.t,disabledProviders:d.data.config.disabled_providers??[],existingProviderIDs:new Set(d.data.provider.all.map(o=>o.id))});return J(()=>{t("err",e.err),e.models.forEach((o,c)=>t("models",c,"err",o)),e.headers.forEach((o,c)=>t("headers",c,"err",o))}),e.result},l=Y(()=>({mutationFn:async e=>{const c=(d.data.config.disabled_providers??[]).filter(h=>h!==e.providerID);return e.key&&await p.client.auth.set({providerID:e.providerID,auth:{type:"api",key:e.key}}),await d.updateConfig({provider:{[e.providerID]:e.config},disabled_providers:c}),e},onSuccess:e=>{v.close(),z({variant:"success",icon:"circle-check",title:r.t("provider.connect.toast.connected.title",{provider:e.name}),description:r.t("provider.connect.toast.connected.description",{provider:e.name})})},onError:e=>{const o=e instanceof Error?e.message:String(e);z({title:r.t("common.requestFailed"),description:o})}})),f=e=>{if(e.preventDefault(),l.isPending)return;const o=Q();o&&l.mutate(o)};return a(le,{get title(){return a(V,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:m,get"aria-label"(){return r.t("common.goBack")}})},transition:!0,get children(){var e=Pe(),o=e.firstChild,c=o.firstChild,h=o.nextSibling,T=h.firstChild,P=T.nextSibling,q=P.nextSibling,X=q.firstChild,me=X.firstChild,H=q.nextSibling,ve=H.firstChild;return n(o,a(de,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),c),n(c,()=>r.t("provider.custom.title")),h.addEventListener("submit",f),n(T,()=>r.t("provider.custom.description.prefix"),null),n(T,a(Ce,{href:"https://github.com/devinoldenburg/codeplane",tabIndex:-1,get children(){return r.t("provider.custom.description.link")}}),null),n(T,()=>r.t("provider.custom.description.suffix"),null),n(P,a(x,{autofocus:!0,get label(){return r.t("provider.custom.field.providerID.label")},get placeholder(){return r.t("provider.custom.field.providerID.placeholder")},get description(){return r.t("provider.custom.field.providerID.description")},get value(){return s.providerID},onChange:u=>$("providerID",u),get validationState(){return s.err.providerID?"invalid":void 0},get error(){return s.err.providerID}}),null),n(P,a(x,{get label(){return r.t("provider.custom.field.name.label")},get placeholder(){return r.t("provider.custom.field.name.placeholder")},get value(){return s.name},onChange:u=>$("name",u),get validationState(){return s.err.name?"invalid":void 0},get error(){return s.err.name}}),null),n(P,a(x,{get label(){return r.t("provider.custom.field.baseURL.label")},get placeholder(){return r.t("provider.custom.field.baseURL.placeholder")},get value(){return s.baseURL},onChange:u=>$("baseURL",u),get validationState(){return s.err.baseURL?"invalid":void 0},get error(){return s.err.baseURL}}),null),n(P,a(x,{get label(){return r.t("provider.custom.field.apiKey.label")},get placeholder(){return r.t("provider.custom.field.apiKey.placeholder")},get description(){return r.t("provider.custom.field.apiKey.description")},get value(){return s.apiKey},onChange:u=>$("apiKey",u)}),null),n(me,()=>r.t("provider.custom.models.label")),n(X,a(F,{type:"button",size:"small",variant:"ghost",onClick:()=>w.mutate({}),get disabled(){return!j()||w.isPending},get children(){return a(M,{get when(){return!w.isPending},get fallback(){return r.t("provider.custom.models.fetch.loading")},get children(){return r.t("provider.custom.models.fetch")}})}}),null),n(q,a(Z,{get each(){return s.models},children:(u,S)=>(()=>{var b=ie(),R=b.firstChild,N=R.nextSibling;return n(R,a(x,{get label(){return r.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.id.placeholder")},get value(){return u.id},onChange:_=>I(S(),"id",_),get validationState(){return u.err.id?"invalid":void 0},get error(){return u.err.id}})),n(N,a(x,{get label(){return r.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.name.placeholder")},get value(){return u.name},onChange:_=>I(S(),"name",_),get validationState(){return u.err.name?"invalid":void 0},get error(){return u.err.name}})),n(b,a(V,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>y(S()),get disabled(){return s.models.length<=1},get"aria-label"(){return r.t("provider.custom.models.remove")}}),null),ee(()=>re(b,"data-row",u.row)),b})()}),null),n(q,a(F,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:g,class:"self-start",get children(){return r.t("provider.custom.models.add")}}),null),n(ve,()=>r.t("provider.custom.headers.label")),n(H,a(Z,{get each(){return s.headers},children:(u,S)=>(()=>{var b=ie(),R=b.firstChild,N=R.nextSibling;return n(R,a(x,{get label(){return r.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.key.placeholder")},get value(){return u.key},onChange:_=>E(S(),"key",_),get validationState(){return u.err.key?"invalid":void 0},get error(){return u.err.key}})),n(N,a(x,{get label(){return r.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.value.placeholder")},get value(){return u.value},onChange:_=>E(S(),"value",_),get validationState(){return u.err.value?"invalid":void 0},get error(){return u.err.value}})),n(b,a(V,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>O(S()),get disabled(){return s.headers.length<=1},get"aria-label"(){return r.t("provider.custom.headers.remove")}}),null),ee(()=>re(b,"data-row",u.row)),b})()}),null),n(H,a(F,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:C,class:"self-start",get children(){return r.t("provider.custom.headers.add")}}),null),n(h,a(F,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return l.isPending},get children(){return we(()=>!!l.isPending)()?r.t("common.saving"):r.t("common.submit")}}),null),e}})}var ae=A('<div class="text-14-regular text-text-weak">'),Ue=A('<div class="px-1.25 w-full flex items-center gap-x-3"><span>');const K="_custom",ue=()=>{const i=se(),v=xe(),d=ne(),p=()=>d.t("dialog.provider.group.popular"),r=()=>d.t("dialog.provider.group.other"),k=()=>d.t("settings.providers.tag.custom"),s=t=>{if(t==="anthropic")return d.t("dialog.provider.anthropic.note");if(t==="openai")return d.t("dialog.provider.openai.note");if(t.startsWith("github-copilot"))return d.t("dialog.provider.copilot.note")};return a(le,{get title(){return d.t("command.provider.connect")},transition:!0,get children(){return a(ke,{get search(){return{placeholder:d.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return d.t("dialog.provider.empty")},activeIcon:"plus-small",key:t=>t?.id,items:()=>(d.locale(),[{id:K,name:k()},...v.all()]),filterKeys:["id","name"],groupBy:t=>U.includes(t.id)?p():r(),sortBy:(t,m)=>t.id===K?-1:m.id===K?1:U.includes(t.id)&&U.includes(m.id)?U.indexOf(t.id)-U.indexOf(m.id):t.name.localeCompare(m.name),sortGroupsBy:(t,m)=>{const g=p();return t.category===g&&m.category!==g?-1:m.category===g&&t.category!==g?1:0},onSelect:t=>{if(t){if(t.id===K){i.show(()=>a(Re,{back:"providers"}));return}i.show(()=>a(Se,{get provider(){return t.id}}))}},children:t=>(()=>{var m=Ue(),g=m.firstChild;return n(m,a(de,{"data-slot":"list-item-extra-icon",get id(){return t.id}}),g),n(g,()=>t.name),n(m,a(M,{get when(){return t.id==="codeplane"},get children(){var y=ae();return n(y,()=>d.t("dialog.provider.codeplane.tagline")),y}}),null),n(m,a(M,{get when(){return t.id===K},get children(){return a(te,{get children(){return d.t("settings.providers.tag.custom")}})}}),null),n(m,a(M,{get when(){return t.id==="codeplane"},get children(){return a(te,{get children(){return d.t("dialog.provider.tag.recommended")}})}}),null),n(m,a(M,{get when(){return s(t.id)},keyed:!0,children:y=>(()=>{var C=ae();return n(C,y),C})()}),null),m})()})}})},Te=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectProvider:ue},Symbol.toStringTag,{value:"Module"}));export{ue as D,Re as a,Te as d};
|