@inkeep/open-knowledge 0.64.0 → 0.64.1
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/dist/{acp-harness-probe-DodNWez3.mjs → acp-harness-probe-BS2KKWDg.mjs} +2 -2
- package/dist/cli.mjs +51 -51
- package/dist/constants-VMvduCQu.mjs +2 -0
- package/dist/{git-handle-3QlrPfzF.mjs → git-handle-29BNYqgw.mjs} +2 -2
- package/dist/git-handle-DfQBBy3_.mjs +1 -0
- package/dist/index.mjs +105 -105
- package/dist/{init-DeSBToha.mjs → init-CB9b8ABp.mjs} +5 -5
- package/dist/init-C_7xLv5L.mjs +1 -0
- package/dist/{launch-json-removal-Db1ziD-H.mjs → launch-json-removal-lmoBoEPZ.mjs} +2 -2
- package/dist/loader-CqMTrIZH.mjs +1 -0
- package/dist/{loader-anKuU0KS.mjs → loader-DyT98uPM.mjs} +2 -2
- package/dist/md-manager-CZcRasmz.mjs +2 -0
- package/dist/{open-browser-W5CxYsJ4.mjs → open-browser-aU_PSdrG.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-C1REvdOf.mjs → preview-B0PMP9Tc.mjs} +2 -2
- package/dist/preview-BnhlaGQl.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Ckg5Pq_4.js → ActivityModeContent-rGNWFHTn.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-gQRcjJmF.js → AddPropertiesButton-2JRBAQEf.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-D-ZLGFAR.js → AgentDiffPane-DaORQqpS.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-D4jxeqvH.js → AgentThreadClientBinder-CJYGMIr6.js} +1 -1
- package/dist/public/assets/{BugReportHistory-DihyFd3f.js → BugReportHistory-Cuh__mug.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-CSNrPEOi.js → BugReportHistoryDialog-C_9BqWro.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DjB69jRg.js → CodeMirrorPropInput-B8JfraRG.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-DQ8IUXhF.js → ConsentDialogBody-CK9RceLc.js} +1 -1
- package/dist/public/assets/{DocumentContext-iKEZSiB2.js → DocumentContext-DyBKMWUQ.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-DEPlArB5.js → EditorModeToggle-CTMAAr-X.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CwJc4GMj.js → EnableSyncConfirmDialog-D80Aucr3.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-BCYrkDNU.js → ExcalidrawDocEditor-CMeQn_u0.js} +1 -1
- package/dist/public/assets/FeedbackForm-SUXnCd9B.js +1 -0
- package/dist/public/assets/{GraphPanel-DHmyVvBK.js → GraphPanel-CnxzWV5D.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-BKP46Eid.js → ImportSkillDialog-DUdFUw6e.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-HYgFdkkR.js → LintConfigEditor-BC8TYjz-.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-VBkp3E3_.js → ManagedArtifactProperties-Cr21JXmD.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DVT7r-wR.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-CLbFOZa8.js → MermaidDocEditor-CCEt4Opw.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-D7ELTVgR.js → PropertyDisplayRow-CTVCclTK.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-C1oy3fl2.js → ReportBugDialogBody-VIeqRFre.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-B7rMT9lS.js → SchemaConfigEditor-UcCzcUIa.js} +1 -1
- package/dist/public/assets/{SessionsHost-BxDNMNVk.js → SessionsHost-gxeaEpjc.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-Cg-2MbSs.js → SettingsDialogBody-CxoXcrrW.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-COPm8JOC.js → ShareBranchSwitchDialog-Cee3pwDa.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-qD-iDy_7.js → ShareReceiveDialog-blTr_HPx.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-BkGSRaoZ.js → ShareReceiveMissDialog-DJ9DvFJq.js} +1 -1
- package/dist/public/assets/{SkillCostValue-DgVDZJg4.js → SkillCostValue-DEly99Yk.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-CVlq-SCL.js → SkillEditBanner-bd1zvQfx.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-CP0nLWRp.js → SkillInstallMenu-sneUc7PA.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-6IYNkHCE.js → SkillOriginInline-BQIo2jSh.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DQAXaxz9.js → SkillToolbarControls-A3BqTaVC.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-Caq-eS5D.js → SlidesToolbarControls-DpcrHeKz.js} +1 -1
- package/dist/public/assets/{SourceEditor-iZTT-gls.js → SourceEditor-yCp7AOuC.js} +1 -1
- package/dist/public/assets/{TerminalPanel-hYpLMc82.js → TerminalPanel-DitPHk-i.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CqhdtLqo.js → TerminalWindowApp-CEMvQfmt.js} +1 -1
- package/dist/public/assets/{TextDocEditor-lp_L8pQg.js → TextDocEditor-Ckd918Mb.js} +1 -1
- package/dist/public/assets/{ThreadView-B0bXdy0X.js → ThreadView-DGR1KByM.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-jTy3D_Yh.js → TimelineDiffPane-CpgSHJGN.js} +1 -1
- package/dist/public/assets/{agent-diff-store-B7QUf8gQ.js → agent-diff-store-DzZwPUH2.js} +1 -1
- package/dist/public/assets/{auth-state-cache-CcdfpjLM.js → auth-state-cache-CEf8XB-q.js} +1 -1
- package/dist/public/assets/{bug-report-send-manager-Buxf0r5c.js → bug-report-send-manager-D19JO93p.js} +1 -1
- package/dist/public/assets/{chunk-BO2N2NFS-BVKS5mdX.js → chunk-BO2N2NFS-aa_rQr8f.js} +31 -31
- package/dist/public/assets/client-version-ow2B_U-6.js +1 -0
- package/dist/public/assets/{comment-chips-z8F67ebz.js → comment-chips-C076-HNt.js} +1 -1
- package/dist/public/assets/{config-provider-DcdQLVo-.js → config-provider-JYp7fF6x.js} +1 -1
- package/dist/public/assets/{dist-DSS3ixln2.js → dist-CWxNQtC52.js} +41 -41
- package/dist/public/assets/{doc-paths-oMq41Y7d.js → doc-paths-DgbGdxZ1.js} +1 -1
- package/dist/public/assets/{documents-events-DCcMe0wm.js → documents-events-DViu97ho.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-X5fV07Z_.js → file-tree-adapter-B2J82X4l.js} +1 -1
- package/dist/public/assets/{file-tree-utils-DL6Pvgvd.js → file-tree-utils-MiagXf7l.js} +1 -1
- package/dist/public/assets/{folder-config-api-Ca2OxXT-.js → folder-config-api-CNXuE5zD.js} +1 -1
- package/dist/public/assets/{highlighted-body-OFNGDK62-R5erL3S3.js → highlighted-body-OFNGDK62-eLakIx_-.js} +1 -1
- package/dist/public/assets/i18n-CqDKlhNm.js +1 -0
- package/dist/public/assets/{index-Cx0Su1s3.js → index-CVIfHBfN.js} +7 -7
- package/dist/public/assets/lib-DH_OjOEF.js +29 -0
- package/dist/public/assets/{lint-config-client-CumTSl-t.js → lint-config-client-RzlDcfLl.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-BYdFk19L.js → markdownlint-rule-browser-Bmk3lsoP.js} +1 -1
- package/dist/public/assets/mermaid-GHXKKRXX-ChsT7WMf.js +1 -0
- package/dist/public/assets/{page-list-cache-NegxJAbd.js → page-list-cache-CEyxAohw.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-kFxMX_hs.js → pending-receive-nav-store-CTqjXsBl.js} +1 -1
- package/dist/public/assets/{progress-BOWBNgYM.js → progress-OoUVKpXn.js} +1 -1
- package/dist/public/assets/{project-paths-C-SkuTbI.js → project-paths-BdGjLtxT.js} +1 -1
- package/dist/public/assets/{prop-types-nOgQFiCi.js → prop-types-CU7HQl68.js} +1 -1
- package/dist/public/assets/{receive-store-D9Px8yTN.js → receive-store-CJtiTNp3.js} +1 -1
- package/dist/public/assets/{selection-context-CYahjTQ5.js → selection-context-DR7ab7yE.js} +1 -1
- package/dist/public/assets/{skill-scope-DWsJ838z.js → skill-scope-BAozv3yS.js} +1 -1
- package/dist/public/assets/{skills-api-BLXzXEC-.js → skills-api-DY2ILAVx.js} +1 -1
- package/dist/public/assets/{src-DMJQ5Vxd.js → src-CGTpf8aj.js} +1 -1
- package/dist/public/assets/{tag-pill-input-DwIQ-TmP.js → tag-pill-input-llQtM5Z_.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-CJUCqJBv.js → target-navigation-intent-HQou_X-w.js} +1 -1
- package/dist/public/assets/{telemetry-impl-Bbh5su9o.js → telemetry-impl-BIepj08G.js} +1 -1
- package/dist/public/assets/{telemetry-startup-DVLjCMTC.js → telemetry-startup-B7OSl-z5.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-C-s_gqLX.js → terminal-cli-display-DTFiZBBc.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-CwapFFW5.js → terminal-launch-events-Bfi4m2vK.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-B16z13Uq.js → terminal-telemetry-CboX_HNN.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DOfSmyLX.js → typing-burst-detector-C4y2fKpb.js} +1 -1
- package/dist/public/assets/{uninstall-3RuzHXuR.js → uninstall-Bf9OgFpb.js} +1 -1
- package/dist/public/assets/{use-activity-panel-ewhIckJf.js → use-activity-panel-D_OG3gXD.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-BEWFuTWv.js → use-apply-config-color-theme-H1zX9cBU.js} +1 -1
- package/dist/public/assets/{use-collab-url-CwkAA1lj.js → use-collab-url-Dk-3M_go.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-C2sLeh-e.js → use-live-xterm-theme-ChdQbgac.js} +1 -1
- package/dist/public/assets/{use-open-skill-Bwm3tOLL.js → use-open-skill-BeZcrVWu.js} +1 -1
- package/dist/public/assets/{use-settings-route-DOVNFDSn.js → use-settings-route-CHUO6Vb3.js} +1 -1
- package/dist/public/assets/{use-skill-origin-Cyn5juIp.js → use-skill-origin-CLzO6XeG.js} +1 -1
- package/dist/public/assets/{use-skills-szHEgJLb.js → use-skills-B1r84pEp.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-Chvkm0XM.js → use-terminal-enabled-BCESHfrF.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-BN_8QKGi.js → use-timeline-entry-diff-Bs-prtib.js} +1 -1
- package/dist/public/assets/{use-workspace-DriKk3ci.js → use-workspace-DigIBtSV.js} +1 -1
- package/dist/public/index.html +47 -47
- package/dist/public/uninstall.html +4 -4
- package/dist/{repair-launch-json-Bh0ZbSGM.mjs → repair-launch-json-DGu77VVa.mjs} +2 -2
- package/dist/{repair-mcp-configs-C4QkDSa4.mjs → repair-mcp-configs-BKUZ3NzW.mjs} +2 -2
- package/dist/repair-skills-BABpOhB_.mjs +1 -0
- package/dist/{repair-skills-DquHsHSZ.mjs → repair-skills-CRG-r1Xh.mjs} +2 -2
- package/dist/{resolve-project-root-TgFFxl73.mjs → resolve-project-root-urAKqvDX.mjs} +4 -4
- package/dist/server-lock-C_5VGPQF.mjs +1 -0
- package/dist/{server-lock-DW446_ti.mjs → server-lock-_JWkU2Mh.mjs} +2 -2
- package/dist/{skill-teardown-DLbNuqvC.mjs → skill-teardown-CVMrfSeZ.mjs} +2 -2
- package/dist/{src-nJP2O0vw.mjs → src-BRlSw7bk.mjs} +1 -1
- package/dist/src-CjFV1e1Z.mjs +2039 -0
- package/dist/src-D6Ou79Ng.mjs +1 -0
- package/dist/{src-BSyYJ3UA.mjs → src-DBh4BCS2.mjs} +4 -4
- package/dist/{src-Cjs2mjwW.mjs → src-DhKkOAcb.mjs} +128 -128
- package/dist/start-CGzXGtnH.mjs +1 -0
- package/dist/{start-DXw9a2ML.mjs → start-DaYtIHPj.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-DfUFKoK2.mjs +0 -2
- package/dist/git-handle-ACPhpYTy.mjs +0 -1
- package/dist/init-sHqvUFdz.mjs +0 -1
- package/dist/loader-BdMPNOLm.mjs +0 -1
- package/dist/md-manager-CTy1swXK.mjs +0 -2
- package/dist/preview-CY1N1FhZ.mjs +0 -1
- package/dist/public/assets/FeedbackForm-Bmmb6Lzs.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CluUiwa8.js +0 -1
- package/dist/public/assets/client-version-B9jWAX8Y.js +0 -1
- package/dist/public/assets/i18n-CwbBw0OU.js +0 -1
- package/dist/public/assets/lib-CQqy20Z3.js +0 -29
- package/dist/public/assets/mermaid-GHXKKRXX-D2pBG5L4.js +0 -1
- package/dist/repair-skills-CiWDpMXb.mjs +0 -1
- package/dist/server-lock-CKYMJfzI.mjs +0 -1
- package/dist/src-2igu-66q.mjs +0 -2039
- package/dist/src-D5jc9qKa.mjs +0 -1
- package/dist/start-NSSGTzDh.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-CA0dewJJ.js";import{Dn as c,Gi as l,Qt as u,Wi as d,xn as f}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-CA0dewJJ.js";import{Dn as c,Gi as l,Qt as u,Wi as d,xn as f}from"./dist-CWxNQtC52.js";import{n as p}from"./dist-CuH7ikCn.js";import{r as m}from"./use-apply-config-theme-B1eLRQeV.js";import{t as h}from"./x-wQUDJS55.js";import{f as g,p as _,u as v}from"./doc-paths-DgbGdxZ1.js";import{n as y}from"./page-list-cache-CEyxAohw.js";import{f as b,h as x}from"./file-tree-adapter-B2J82X4l.js";import{t as ee}from"./use-live-xterm-theme-ChdQbgac.js";import{r as te}from"./terminal-command-events-ponJwwNv.js";import{t as S}from"./TerminalStartingNotice-7XmsKQfW.js";var C=a(),w=2,T=1,ne=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(w,Math.floor(u/e.css.cell.width)),rows:Math.max(T,Math.floor(l/e.css.cell.height))}}},E=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],D=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],O;function re(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var k=class{constructor(){if(this.version=`6`,!O){O=new Uint8Array(65536),O.fill(1),O[0]=0,O.fill(0,1,32),O.fill(0,127,160),O.fill(2,4352,4448),O[9001]=2,O[9002]=2,O.fill(2,11904,42192),O[12351]=1,O.fill(2,44032,55204),O.fill(2,63744,64256),O.fill(2,65040,65050),O.fill(2,65072,65136),O.fill(2,65280,65377),O.fill(2,65504,65511);for(let e=0;e<E.length;++e)O.fill(0,E[e][0],E[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?O[e]:re(e,D)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=$e.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return $e.createPropertyValue(0,n,r)}},A=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M.isErrorNoTelemetry(e)?new M(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./config-provider-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./config-provider-JYp7fF6x.js";import{t as o}from"./use-installed-clis-vg6izNL9.js";import{t as s}from"./use-live-xterm-theme-ChdQbgac.js";import{SessionsHost as c}from"./SessionsHost-gxeaEpjc.js";var l=i(),u=e(n(),1),d=t();function f(e){let t=(0,l.c)(5),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,d.jsx)(p,{bridge:n}),t[0]=n,t[1]=i);let o;return t[2]!==r||t[3]!==i?(o=(0,d.jsx)(a,{collabUrl:r,children:i}),t[2]=r,t[3]=i,t[4]=o):o=t[4],o}function p(e){let t=(0,l.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),a=s(i),f=o(),[p,g]=(0,u.useState)(null),_;t[0]===a.background?_=t[1]:(_=(0,d.jsx)(`div`,{ref:g,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:a.background}}),t[0]=a.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==f?(v=(0,d.jsx)(c,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:h,installedClis:f,container:p,isShowing:!0,onRequestEditorFocus:m}),t[2]=n,t[3]=p,t[4]=f,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,d.jsxs)(d.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function m(){}function h(e){e||window.close()}export{f as TerminalWindowApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-B8JfraRG.js";import{ls as s,pr as c,xs as l}from"./dist-CWxNQtC52.js";import{g as u}from"./config-provider-JYp7fF6x.js";import{Dt as d,P as f,Z as p,kt as m}from"./dist-EbTHn-HD.js";import{t as h}from"./cm-theme-CqnwWjn0.js";import{t as g}from"./dist-O5qpSCnc2.js";import{t as _}from"./text-viewer-languages-BtwF8E4F.js";import{t as v}from"./src-CGTpf8aj.js";var y=a(),b=e(n(),1),x=t(),S=h({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),C=h({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function w(e){let t=(0,y.c)(19),{docName:n,provider:a}=e,{_:h}=r(),w=n.slice(n.lastIndexOf(`/`)+1),T=(0,b.useRef)(null),{resolvedTheme:E}=i(),D;t[0]===a.document?D=t[1]:(D=a.document.getText(`source`),t[0]=a.document,t[1]=D);let O=D,k;t[2]===O?k=t[3]:(k=()=>new u(O),t[2]=O,t[3]=k);let[A]=(0,b.useState)(k),j;t[4]!==n||t[5]!==a.awareness||t[6]!==E||t[7]!==A||t[8]!==O?(j=()=>{let e=T.current;if(!e)return;let t=E===`dark`?S:C,r=new d,i=new d,u=(s[c(n)]??l(c(n)))!==null&&c(n)!==``,h=new p({state:m.create({doc:O.toString(),extensions:[g,v(O,a.awareness,{undoManager:A}),r.of([]),f(o),i.of(u?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e}),y=!1,b=c(n)||null;return b&&_(b,s[b]??l(b)).then(e=>{y||!e||h.dispatch({effects:r.reconfigure(e)})}),()=>{y=!0,h.destroy()}},t[4]=n,t[5]=a.awareness,t[6]=E,t[7]=A,t[8]=O,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==a||t[12]!==E||t[13]!==A||t[14]!==O?(M=[O,a,E,n,A],t[10]=n,t[11]=a,t[12]=E,t[13]=A,t[14]=O,t[15]=M):M=t[15],(0,b.useEffect)(j,M);let N=h({id:`xAlHfe`,values:{basename:w}}),P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,x.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-auto`}),t[16]=P):P=t[16];let F;return t[17]===N?F=t[18]:(F=(0,x.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":N,"data-text-doc-editor":``,children:P}),t[17]=N,t[18]=F),F}export{w as TextDocEditor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-highlighter-impl-Cd7bLu8y.js","./lib-B3XVxNhx.js","./html-void-elements-XfxYgU9i.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Jn as r,Kr as i,Or as a,Qn as o,er as s,i as c,lr as l,nr as u,tr as d}from"./DocumentContext-iKEZSiB2.js";import{t as f}from"./react-f2sANaYj.js";import{n as p,r as m}from"./dist-Nvb76hAm.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{i as g,o as _}from"./local-menu-action-bus-BuSRFm5g.js";import{t as v}from"./utils-CPqDy6Hr.js";import{t as y}from"./mascot-outline-CtS592mc.js";import{t as b}from"./button-CA0dewJJ.js";import{i as x,n as S,t as C}from"./tooltip-DPvMEqsq.js";import{c as w,i as T,t as E}from"./dialog-BH80AfFt.js";import{Tt as D}from"./CodeMirrorPropInput-DjB69jRg.js";import{c as O,d as k,f as A,l as j,m as M,n as N,o as P,p as F,r as ee,t as I}from"./dropdown-menu-BpLbh79a.js";import{a as te,c as ne,d as re,f as L,i as ie,l as ae,n as oe,o as R,p as se,r as ce,s as le,t as z,u as ue,v as B}from"./progress-BOWBNgYM.js";import{t as de}from"./switch-BeP1gMN6.js";import{Zr as fe,ft as pe}from"./dist-DSS3ixln2.js";import{n as me}from"./dist-CuH7ikCn.js";import{t as V}from"./dist-BIGNzOeF2.js";import{i as he,t as H}from"./history-BteF85_l.js";import{n as ge}from"./use-workspace-DriKk3ci.js";import{t as U}from"./createLucideIcon-CAkY8Blx.js";import{n as W,s as _e,u as ve}from"./Mermaid-NYQ6RsUB.js";import{t as ye}from"./RegisteredAgentIcon-Fkz5hv6G.js";import{t as G}from"./check-Bzwwm-o4.js";import{t as be}from"./chevron-down-xENV92Te.js";import{t as xe}from"./chevron-right-BVvjaUfh.js";import{o as K,r as Se,s as Ce}from"./prop-types-nOgQFiCi.js";import{n as we,t as q}from"./terminal-CFd7qrv_.js";import{t as Te}from"./list-plus-1_iMFVqs.js";import{t as Ee}from"./spinner-DmibE6UV.js";import{c as De,n as Oe,o as ke,s as Ae,t as je}from"./comment-chips-z8F67ebz.js";import{t as Me}from"./rotate-ccw-Dh7y6tzD.js";import{t as Ne}from"./square-pen-Blyr7NAu.js";import{t as Pe}from"./trash-2-BVoWHmfV.js";import{t as Fe}from"./wrench-JX3g_hHJ.js";import{t as Ie}from"./x-wQUDJS55.js";import{f as Le,s as Re}from"./doc-paths-oMq41Y7d.js";import{t as ze}from"./external-link-DGqXfQJy.js";import{t as Be}from"./badge-DGD9B_-e.js";import{t as Ve}from"./skeleton-DIxLroLR.js";import{t as He}from"./textarea-BtqZ3yY1.js";import{n as Ue}from"./agent-presence-C_iH_p3q.js";import{i as We,n as Ge}from"./chunk-BO2N2NFS-BVKS5mdX.js";import{n as Ke}from"./libesm-B7m5uxaw.js";import{a as qe,d as Je,f as Ye,m as Xe,n as Ze,p as Qe,r as $e,s as et}from"./thread-client-o-xHAmeK.js";import{n as tt}from"./thread-draft-staging-D-3dp2ov.js";var nt=U(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),rt=U(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),it=U(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),at=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),J=h(),ot=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),st=new Set([`auto`]);function ct(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function lt(e){let t=ct(e.id),n=ct(e.name??``);return st.has(t)||st.has(n)?!0:ot.test(t)||ot.test(n)}var ut={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function dt(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=ut[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&<(r)?`self-managed`:i}var Y=e(f(),1),X=n();function ft({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=pt(mt(r,i),t);if(!n)return Y.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!Y.isValidElement(n))return null;let o=n.props,s={...pt(a,o),ref:_t(a.ref,o.ref)};return Y.cloneElement(n,s)}function pt(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=_t(i,r):gt(n)&&typeof i==`function`&&typeof r==`function`?t[n]=ht(r,i):t[n]=r}}return t}function mt(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function ht(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function gt(e){return/^on[A-Z]/.test(e)}function _t(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var vt=8,yt=64,bt=0,xt=.5,St=180,Ct=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),wt={start:!1,end:!1},Tt={currentAnchorId:null,visibleMessageIds:[]};function Et({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return wt;let i=Rt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Dt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Tt;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of Ot(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+xt&&(u=e)}return l.length===0&&u===null?Tt:{currentAnchorId:u,visibleMessageIds:l}}function Ot(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function kt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function At(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function jt(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Mt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Nt({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of Ot(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function Pt({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Ft(t,i),o=t.getBoundingClientRect().height,s=Vt(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Ft(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function It(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Lt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Rt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Rt({content:e,spacer:t,viewport:n}){let r=Ot(e,t),i=Bt(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function zt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Bt(e){let t=window.getComputedStyle(e);return{end:Ut(t.paddingBlockEnd||t.paddingBottom),start:Ut(t.paddingBlockStart||t.paddingTop)}}function Vt(e){let t=e?.parentElement;return t?Bt(t):{end:0,start:0}}function Ht(e){if(!e)return 0;let t=window.getComputedStyle(e);return Ut(t.rowGap===`normal`?t.gap:t.rowGap)}function Ut(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Wt({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=Y.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},St))},[t]),S=Y.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=Y.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=xt){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=Y.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=Y.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(zt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=Y.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=Pt({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(Lt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:It(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=Y.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=Y.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:Y.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function Gt(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function Kt(e,t){return Gt(e,t)}function qt(){return Gt(Tt,Yt)}function Jt(e,t){return e.start===t.start&&e.end===t.end}function Yt(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function Xt({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=Y.useRef(e),a=Y.useRef(!1),o=Y.useRef(null),s=Y.useRef(!1),c=Y.useRef(t),l=Y.useRef(0),u=Y.useRef(null),d=Y.useRef(0),f=Y.useRef(e?`following-bottom`:`free-scrolling`),p=Y.useRef(new Map),m=Y.useRef(null),h=Y.useRef(null),g=Y.useRef(null),_=Y.useRef(r),v=Y.useRef(!0),y=Y.useRef(null),b=Y.useRef(n),x=Y.useRef(null),S=Y.useRef(0),C=Y.useRef(0),w=Y.useRef(null),T=Y.useRef(null),E=Y.useRef(null),D=Y.useRef(null),O=Y.useRef(null),k=Y.useRef(null),A=Y.useRef(null),j=Y.useRef(null),M=Y.useRef(new Set),N=Y.useRef(new WeakSet);return E.current===null&&(E.current=Kt(wt,Jt)),j.current===null&&(j.current=qt()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function Zt(e,t){return Y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Qt({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=vt,scrollPreviousItemPeek:r=yt,scrollMargin:i=bt}){let a=Xt({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,ee=Y.useRef(t);ee.current!==t&&(ee.current=t,d.current=!1);let I=Y.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),te=Y.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-xt;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),ne=Y.useCallback(()=>{let e=Et({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});te(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;I(t),k.setSnapshot(t)},[te,k,I]),re=Y.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,ne()}))},[ne]),L=Y.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(Dt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:ie,reanchorToAnchoredMessage:ae,scrollToElement:oe,scrollToEnd:R,scrollToMessage:se,scrollToStart:ce}=Wt({refs:a,commitScrollState:ne,scheduleStateCommit:re,scheduleVisibilitySync:L}),le=Y.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=It(e.element,t)-e.viewportTop;return Math.abs(n)<=xt?!1:(t.scrollTop+=n,e.viewportTop=It(e.element,t),re(),L(),!0)},[re,L]),z=Y.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Nt({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:It(n,t)}:null},[]),ue=Y.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,ie()&&z()}))},[z,ie]),B=Y.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Mt(Ot(t,D.current)):null;if(!t||!n||!r)e=R({behavior:`auto`});else{let i=Ft(r,n);e=Rt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?R({behavior:`auto`}):oe(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?R({behavior:`auto`}):ce({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,oe,R,ce]),de=Y.useCallback(()=>{let e=u.current;if(!e)return;let t=Ot(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ie())return;if(n===0){if(B()||t.length>0&&s.current&&R({behavior:`auto`}))return;ne(),L();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){le();return}if(t.length>n){let e=kt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&jt(t,n)){R({behavior:`auto`});return}oe(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=At(t,F.current);if(e){oe(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?R({behavior:`auto`}):(ne(),L())})(),z()},[B,z,ne,ie,le,L,oe,R]),fe=Y.useCallback(()=>{if(g.current===`following-bottom`&&s.current){R({behavior:`auto`});return}let e=E.current;if(ae()){s.current&&e>0&&E.current===0&&R({behavior:`auto`});return}re(),L()},[ae,re,L,R]),pe=Y.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){L();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}L()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),L()}},[L,N]),me=Y.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(Tt)},[N]),V=Y.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),L(),v.current?.messageId===e&&ue();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),L())},[ue,L]),he=Y.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),H=Y.useCallback(()=>I(k.getSnapshot()),[k,I]),ge=Zt(x,H),U=Zt(A,H),W=Y.useCallback(e=>{u.current=e},[]),_e=Y.useCallback(e=>{D.current=e,T.current=Ht(e?.parentElement??null)},[]),ve=Y.useCallback(()=>{ne(),L(),z()},[z,ne,L]),ye=Y.useMemo(()=>({handleContentChange:de,handleResize:fe,observeVisibility:pe,preserveScrollOnPrependRef:b,scrollToEnd:R,scrollToMessage:se,scrollToStart:ce,setContentElement:W,setRootElement:ge,setSpacerElement:_e,setViewportElement:U,stateStore:k,syncAfterScroll:ve,unobserveVisibility:me,userScrollIntent:he,viewportRef:A,visibilityStore:N}),[de,fe,pe,R,se,ce,W,ge,_e,U,k,ve,me,he,N]);return Y.useLayoutEffect(()=>{B()},[B]),Y.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),Y.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){R({behavior:`auto`});return}ne()},[e,ne,R]),{context:ye,registerMessage:V}}function $t(e){let t=Y.useRef(e);return t.current=e,t}var en=Y.createContext(null),tn=Y.createContext(null);function nn(){let e=Y.useContext(en);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function rn(){let e=Y.useContext(tn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function an(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=nn();return Y.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function on({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=Qt({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,X.jsx)(en.Provider,{value:o,children:(0,X.jsx)(tn.Provider,{value:s,children:t})})}function sn({children:e,...t}){let{setRootElement:n}=nn();return(0,X.jsx)(`div`,{ref:n,...t,children:e})}function cn({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=nn();f.current=o;let _=Y.useCallback(e=>{p(e),_t(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Ct.has(e.key)&&h(),n?.(e)}return Y.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,X.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function ln({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=nn(),u=Y.useRef(null),d=Y.useCallback(e=>{u.current=e,c(e),_t(n)?.(e)},[n,c]);return Y.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),Y.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,X.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,X.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function un({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=rn(),a=Y.useRef(null);return(0,X.jsx)(`div`,{ref:Y.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),_t(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function dn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=nn(),d=$t(r),f=Y.useCallback(e=>u.subscribe(e),[u]),p=Y.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=Y.useSyncExternalStore(f,p,p),h=Y.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return ft({defaultTagName:`button`,props:pt({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,X.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var fn={Provider:on,Root:sn,Viewport:cn,Content:ln,Item:un,Button:dn};function pn(e){let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(fn.Provider,{...e}),t[0]=e,t[1]=n),n}function mn(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(fn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hn(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(fn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gn(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(fn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _n(e){let t=(0,J.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=v(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,X.jsx)(fn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function vn(e){let t=(0,J.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=v(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let m;t[10]!==a||t[11]!==d||t[12]!==u?(m=a??(0,X.jsx)(b,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=m):m=t[13];let h;t[14]!==n||t[15]!==l?(h=n??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ve,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,X.jsx)(p,{id:`EQXPXf`}):(0,X.jsx)(p,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=h):h=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==m||t[22]!==h||t[23]!==u?(g=(0,X.jsx)(fn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:m,...i,children:h}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=m,t[22]=h,t[23]=u,t[24]=g):g=t[24],g}var yn=new Map,bn=0;function xn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Sn(){let e=xn();for(let[t,n]of yn)t((e-n)/1e3);if(yn.size===0){bn=0;return}bn=requestAnimationFrame(Sn)}function Cn(e){return yn.set(e,xn()),bn===0&&typeof requestAnimationFrame==`function`&&(bn=requestAnimationFrame(Sn)),()=>{yn.delete(e),yn.size===0&&bn!==0&&(cancelAnimationFrame(bn),bn=0)}}var Z=40,wn=15,Q=15,$=12.4,Tn={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},En=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,Dn=2.26,On=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function kn(e){let t=t=>{let n=e[(t-1+Z)%Z],r=e[(t+1)%Z];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Z;r++){let i=e[r],a=e[(r+1)%Z],o=t(r),s=t((r+1)%Z);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function An(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[wn+(e[0]-(i+a)/2)*c,Q+(e[1]-(o+s)/2)*c])}function jn(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Z)%Z],a=e[(r+1)%Z];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Mn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function Nn(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Z).fill(0),i=Array(Z).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Z);s=(s%Z+Z)%Z,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Z;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Z,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:kn(An(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return kn(An(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Z)%Z]+s[(t+1)%Z])*.07),a,o),i))}function o(e,n){return kn(An(t(e,Z),n))}function s(e,n,r){return kn(jn(t(e,Z),n,r))}function c(e,n,r){return kn(t(e,Z).map(e=>[wn+(e[0]-wn)*n,Q+(e[1]-Q)*r]))}function l(e,n,r=1){return kn(t(e,Z).map((e,t)=>{let i=t*2*Math.PI/Z,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[wn+(e[0]-wn)*a,Q+(e[1]-Q)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([wn+Math.cos(a)*t,Q+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(wn+Math.cos(i)*o).toFixed(2)} ${(Q+Math.sin(i)*o).toFixed(2)}`}return kn(An(jn(t(`${a}Z`,Z),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[wn+Math.cos(n)*e,Q+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[wn+Math.cos(t)*n,Q+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return kn(An(jn(t(`${a}Z`,Z),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Z;a++){let o=-Math.PI/2+a*2*Math.PI/Z,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([wn+Math.cos(o)*c,Q+Math.sin(o)*c])}return kn(i)}function m(e){let t=[];for(let n=0;n<Z;n++){let r=-Math.PI/2+n*2*Math.PI/Z;t.push([wn+Math.cos(r)*e,Q+Math.sin(r)*e])}return kn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function Pn(){let e=Mn();if(e===null)return null;try{let t=Nn(e),n=t.silhouette(y,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(On,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var Fn;function In(){return Fn===void 0&&(Fn=Pn()),Fn}var Ln=/-?\d+(?:\.\d+)?/g;function Rn(e){return{fragments:e[0].split(Ln),numbers:e.map(e=>(e.match(Ln)??[]).map(Number))}}function zn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function Bn(e){return e<.5?2*e*e:1-2*(1-e)**2}var Vn=.58;function Hn(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:Bn(r?Math.min(1,c/Vn):c)}}var Un=Tn,Wn=[Un.blobby,Un.triangle,Un.square,Un.sparkle,Un.comma,Un.pentagon,Un.hexagon,Un.blobby],Gn={[Un.comma]:-2.9},Kn={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},qn=20,Jn=8.4;function Yn(e){let t=(0,J.c)(22),{status:n,className:r,testId:i}=e,{_:a}=m(),o=(0,Y.useRef)(null),s=(0,Y.useRef)(null),c=W(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,En),e.setAttribute(`stroke-width`,String(Dn)),s.current?.removeAttribute(`transform`);return}let t=In();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Rn(t.paths),r=NaN,i=``;return Cn(t=>{let{from:a,to:o,t:c}=Hn(t,Wn.length,Jn,!0),l=n.numbers[Wn[a]],u=n.numbers[Wn[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=zn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=Gn[Wn[a]]??0,h=m+((Gn[Wn[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,Y.useEffect)(l,u);let[d,f]=(0,Y.useState)(``),p,h;t[3]===a?(p=t[4],h=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},h=[a],t[3]=a,t[4]=p,t[5]=h),(0,Y.useEffect)(p,h);let g;t[6]===r?g=t[7]:(g=v(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=g);let _;t[8]===d?_=t[9]:(_=(0,X.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`path`,{ref:o,d:En,fill:`none`,stroke:`currentColor`,strokeWidth:Dn,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,X.jsx)(`svg`,{width:qn,height:qn,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,X.jsxs)(`g`,{className:`ok-working-group`,children:[y,(0,X.jsxs)(`g`,{ref:s,children:[(0,X.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Kn.leftCx,cy:Kn.cy,rx:Kn.rx,ry:Kn.ry,fill:`currentColor`}),(0,X.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Kn.rightCx,cy:Kn.cy,rx:Kn.rx,ry:Kn.ry,fill:`currentColor`})]})]})})}),t[11]=b):b=t[11];let x;t[12]===n?x=t[13]:(x=(0,X.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,X.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==g||t[19]!==_||t[20]!==i?(C=(0,X.jsxs)(`div`,{className:g,"data-testid":i,children:[_,b,S]}),t[17]=S,t[18]=g,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function Xn(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function Zn(e){let t=Xn(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:V._({id:`GK5Ft_`,values:{0:r.name}})}function Qn(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?V._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?V._({id:`R6ABfU`}):null}var $n=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),er=700*1024;function tr(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function nr(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function rr(e){let t=e.type||``;if(!$n.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:er}};let n=await nr(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function ir(e){return or(e,e=>e.type.startsWith(`image/`))}function ar(e){return or(e,e=>e.size>0)}function or(e,t){if(e===null)return[];let n=[],r=e=>{e!==null&&t(e)&&n.push(e)},i=!1,a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];if(!t||t.kind!==`file`)continue;let n=t.getAsFile();n!==null&&(i=!0,r(n))}if(!i){let t=e.files;if(t)for(let e=0;e<t.length;e+=1)r(t[e]??null)}return n}function sr(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function cr(e,t={}){if((e.type||``).startsWith(`image/`))return rr(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=sr(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var lr=3,ur=lr*2+2;function dr(e){let t=e.split(`
|
|
2
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Jn as r,Kr as i,Or as a,Qn as o,er as s,i as c,lr as l,nr as u,tr as d}from"./DocumentContext-DyBKMWUQ.js";import{t as f}from"./react-f2sANaYj.js";import{n as p,r as m}from"./dist-Nvb76hAm.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{i as g,o as _}from"./local-menu-action-bus-BuSRFm5g.js";import{t as v}from"./utils-CPqDy6Hr.js";import{t as y}from"./mascot-outline-CtS592mc.js";import{t as b}from"./button-CA0dewJJ.js";import{i as x,n as S,t as C}from"./tooltip-DPvMEqsq.js";import{c as w,i as T,t as E}from"./dialog-BH80AfFt.js";import{Tt as D}from"./CodeMirrorPropInput-B8JfraRG.js";import{c as O,d as k,f as A,l as j,m as M,n as N,o as P,p as F,r as ee,t as I}from"./dropdown-menu-BpLbh79a.js";import{a as te,c as ne,d as re,f as L,i as ie,l as ae,n as oe,o as R,p as se,r as ce,s as le,t as z,u as ue,v as B}from"./progress-OoUVKpXn.js";import{t as de}from"./switch-BeP1gMN6.js";import{Zr as fe,ft as pe}from"./dist-CWxNQtC52.js";import{n as me}from"./dist-CuH7ikCn.js";import{t as V}from"./dist-BIGNzOeF2.js";import{i as he,t as H}from"./history-BteF85_l.js";import{n as ge}from"./use-workspace-DigIBtSV.js";import{t as U}from"./createLucideIcon-CAkY8Blx.js";import{n as W,s as _e,u as ve}from"./Mermaid-NYQ6RsUB.js";import{t as ye}from"./RegisteredAgentIcon-Fkz5hv6G.js";import{t as G}from"./check-Bzwwm-o4.js";import{t as be}from"./chevron-down-xENV92Te.js";import{t as xe}from"./chevron-right-BVvjaUfh.js";import{o as K,r as Se,s as Ce}from"./prop-types-CU7HQl68.js";import{n as we,t as q}from"./terminal-CFd7qrv_.js";import{t as Te}from"./list-plus-1_iMFVqs.js";import{t as Ee}from"./spinner-DmibE6UV.js";import{c as De,n as Oe,o as ke,s as Ae,t as je}from"./comment-chips-C076-HNt.js";import{t as Me}from"./rotate-ccw-Dh7y6tzD.js";import{t as Ne}from"./square-pen-Blyr7NAu.js";import{t as Pe}from"./trash-2-BVoWHmfV.js";import{t as Fe}from"./wrench-JX3g_hHJ.js";import{t as Ie}from"./x-wQUDJS55.js";import{f as Le,s as Re}from"./doc-paths-DgbGdxZ1.js";import{t as ze}from"./external-link-DGqXfQJy.js";import{t as Be}from"./badge-DGD9B_-e.js";import{t as Ve}from"./skeleton-DIxLroLR.js";import{t as He}from"./textarea-BtqZ3yY1.js";import{n as Ue}from"./agent-presence-C_iH_p3q.js";import{i as We,n as Ge}from"./chunk-BO2N2NFS-aa_rQr8f.js";import{n as Ke}from"./libesm-B7m5uxaw.js";import{a as qe,d as Je,f as Ye,m as Xe,n as Ze,p as Qe,r as $e,s as et}from"./thread-client-o-xHAmeK.js";import{n as tt}from"./thread-draft-staging-D-3dp2ov.js";var nt=U(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),rt=U(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),it=U(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),at=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),J=h(),ot=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),st=new Set([`auto`]);function ct(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function lt(e){let t=ct(e.id),n=ct(e.name??``);return st.has(t)||st.has(n)?!0:ot.test(t)||ot.test(n)}var ut={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function dt(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=ut[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&<(r)?`self-managed`:i}var Y=e(f(),1),X=n();function ft({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=pt(mt(r,i),t);if(!n)return Y.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!Y.isValidElement(n))return null;let o=n.props,s={...pt(a,o),ref:_t(a.ref,o.ref)};return Y.cloneElement(n,s)}function pt(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=_t(i,r):gt(n)&&typeof i==`function`&&typeof r==`function`?t[n]=ht(r,i):t[n]=r}}return t}function mt(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function ht(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function gt(e){return/^on[A-Z]/.test(e)}function _t(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var vt=8,yt=64,bt=0,xt=.5,St=180,Ct=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),wt={start:!1,end:!1},Tt={currentAnchorId:null,visibleMessageIds:[]};function Et({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return wt;let i=Rt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Dt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Tt;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of Ot(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+xt&&(u=e)}return l.length===0&&u===null?Tt:{currentAnchorId:u,visibleMessageIds:l}}function Ot(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function kt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function At(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function jt(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Mt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Nt({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of Ot(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function Pt({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Ft(t,i),o=t.getBoundingClientRect().height,s=Vt(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Ft(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function It(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Lt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Rt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Rt({content:e,spacer:t,viewport:n}){let r=Ot(e,t),i=Bt(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function zt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Bt(e){let t=window.getComputedStyle(e);return{end:Ut(t.paddingBlockEnd||t.paddingBottom),start:Ut(t.paddingBlockStart||t.paddingTop)}}function Vt(e){let t=e?.parentElement;return t?Bt(t):{end:0,start:0}}function Ht(e){if(!e)return 0;let t=window.getComputedStyle(e);return Ut(t.rowGap===`normal`?t.gap:t.rowGap)}function Ut(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Wt({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=Y.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},St))},[t]),S=Y.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=Y.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=xt){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=Y.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=Y.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(zt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=Y.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=Pt({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(Lt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:It(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=Y.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=Y.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:Y.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function Gt(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function Kt(e,t){return Gt(e,t)}function qt(){return Gt(Tt,Yt)}function Jt(e,t){return e.start===t.start&&e.end===t.end}function Yt(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function Xt({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=Y.useRef(e),a=Y.useRef(!1),o=Y.useRef(null),s=Y.useRef(!1),c=Y.useRef(t),l=Y.useRef(0),u=Y.useRef(null),d=Y.useRef(0),f=Y.useRef(e?`following-bottom`:`free-scrolling`),p=Y.useRef(new Map),m=Y.useRef(null),h=Y.useRef(null),g=Y.useRef(null),_=Y.useRef(r),v=Y.useRef(!0),y=Y.useRef(null),b=Y.useRef(n),x=Y.useRef(null),S=Y.useRef(0),C=Y.useRef(0),w=Y.useRef(null),T=Y.useRef(null),E=Y.useRef(null),D=Y.useRef(null),O=Y.useRef(null),k=Y.useRef(null),A=Y.useRef(null),j=Y.useRef(null),M=Y.useRef(new Set),N=Y.useRef(new WeakSet);return E.current===null&&(E.current=Kt(wt,Jt)),j.current===null&&(j.current=qt()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function Zt(e,t){return Y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Qt({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=vt,scrollPreviousItemPeek:r=yt,scrollMargin:i=bt}){let a=Xt({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,ee=Y.useRef(t);ee.current!==t&&(ee.current=t,d.current=!1);let I=Y.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),te=Y.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-xt;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),ne=Y.useCallback(()=>{let e=Et({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});te(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;I(t),k.setSnapshot(t)},[te,k,I]),re=Y.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,ne()}))},[ne]),L=Y.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(Dt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:ie,reanchorToAnchoredMessage:ae,scrollToElement:oe,scrollToEnd:R,scrollToMessage:se,scrollToStart:ce}=Wt({refs:a,commitScrollState:ne,scheduleStateCommit:re,scheduleVisibilitySync:L}),le=Y.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=It(e.element,t)-e.viewportTop;return Math.abs(n)<=xt?!1:(t.scrollTop+=n,e.viewportTop=It(e.element,t),re(),L(),!0)},[re,L]),z=Y.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Nt({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:It(n,t)}:null},[]),ue=Y.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,ie()&&z()}))},[z,ie]),B=Y.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Mt(Ot(t,D.current)):null;if(!t||!n||!r)e=R({behavior:`auto`});else{let i=Ft(r,n);e=Rt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?R({behavior:`auto`}):oe(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?R({behavior:`auto`}):ce({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,oe,R,ce]),de=Y.useCallback(()=>{let e=u.current;if(!e)return;let t=Ot(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ie())return;if(n===0){if(B()||t.length>0&&s.current&&R({behavior:`auto`}))return;ne(),L();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){le();return}if(t.length>n){let e=kt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&jt(t,n)){R({behavior:`auto`});return}oe(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=At(t,F.current);if(e){oe(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?R({behavior:`auto`}):(ne(),L())})(),z()},[B,z,ne,ie,le,L,oe,R]),fe=Y.useCallback(()=>{if(g.current===`following-bottom`&&s.current){R({behavior:`auto`});return}let e=E.current;if(ae()){s.current&&e>0&&E.current===0&&R({behavior:`auto`});return}re(),L()},[ae,re,L,R]),pe=Y.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){L();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}L()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),L()}},[L,N]),me=Y.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(Tt)},[N]),V=Y.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),L(),v.current?.messageId===e&&ue();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),L())},[ue,L]),he=Y.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),H=Y.useCallback(()=>I(k.getSnapshot()),[k,I]),ge=Zt(x,H),U=Zt(A,H),W=Y.useCallback(e=>{u.current=e},[]),_e=Y.useCallback(e=>{D.current=e,T.current=Ht(e?.parentElement??null)},[]),ve=Y.useCallback(()=>{ne(),L(),z()},[z,ne,L]),ye=Y.useMemo(()=>({handleContentChange:de,handleResize:fe,observeVisibility:pe,preserveScrollOnPrependRef:b,scrollToEnd:R,scrollToMessage:se,scrollToStart:ce,setContentElement:W,setRootElement:ge,setSpacerElement:_e,setViewportElement:U,stateStore:k,syncAfterScroll:ve,unobserveVisibility:me,userScrollIntent:he,viewportRef:A,visibilityStore:N}),[de,fe,pe,R,se,ce,W,ge,_e,U,k,ve,me,he,N]);return Y.useLayoutEffect(()=>{B()},[B]),Y.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),Y.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){R({behavior:`auto`});return}ne()},[e,ne,R]),{context:ye,registerMessage:V}}function $t(e){let t=Y.useRef(e);return t.current=e,t}var en=Y.createContext(null),tn=Y.createContext(null);function nn(){let e=Y.useContext(en);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function rn(){let e=Y.useContext(tn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function an(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=nn();return Y.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function on({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=Qt({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,X.jsx)(en.Provider,{value:o,children:(0,X.jsx)(tn.Provider,{value:s,children:t})})}function sn({children:e,...t}){let{setRootElement:n}=nn();return(0,X.jsx)(`div`,{ref:n,...t,children:e})}function cn({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=nn();f.current=o;let _=Y.useCallback(e=>{p(e),_t(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Ct.has(e.key)&&h(),n?.(e)}return Y.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,X.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function ln({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=nn(),u=Y.useRef(null),d=Y.useCallback(e=>{u.current=e,c(e),_t(n)?.(e)},[n,c]);return Y.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),Y.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,X.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,X.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function un({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=rn(),a=Y.useRef(null);return(0,X.jsx)(`div`,{ref:Y.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),_t(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function dn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=nn(),d=$t(r),f=Y.useCallback(e=>u.subscribe(e),[u]),p=Y.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=Y.useSyncExternalStore(f,p,p),h=Y.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return ft({defaultTagName:`button`,props:pt({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,X.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var fn={Provider:on,Root:sn,Viewport:cn,Content:ln,Item:un,Button:dn};function pn(e){let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(fn.Provider,{...e}),t[0]=e,t[1]=n),n}function mn(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(fn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hn(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(fn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gn(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(fn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _n(e){let t=(0,J.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=v(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,X.jsx)(fn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function vn(e){let t=(0,J.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=v(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let m;t[10]!==a||t[11]!==d||t[12]!==u?(m=a??(0,X.jsx)(b,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=m):m=t[13];let h;t[14]!==n||t[15]!==l?(h=n??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ve,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,X.jsx)(p,{id:`EQXPXf`}):(0,X.jsx)(p,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=h):h=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==m||t[22]!==h||t[23]!==u?(g=(0,X.jsx)(fn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:m,...i,children:h}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=m,t[22]=h,t[23]=u,t[24]=g):g=t[24],g}var yn=new Map,bn=0;function xn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Sn(){let e=xn();for(let[t,n]of yn)t((e-n)/1e3);if(yn.size===0){bn=0;return}bn=requestAnimationFrame(Sn)}function Cn(e){return yn.set(e,xn()),bn===0&&typeof requestAnimationFrame==`function`&&(bn=requestAnimationFrame(Sn)),()=>{yn.delete(e),yn.size===0&&bn!==0&&(cancelAnimationFrame(bn),bn=0)}}var Z=40,wn=15,Q=15,$=12.4,Tn={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},En=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,Dn=2.26,On=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function kn(e){let t=t=>{let n=e[(t-1+Z)%Z],r=e[(t+1)%Z];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Z;r++){let i=e[r],a=e[(r+1)%Z],o=t(r),s=t((r+1)%Z);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function An(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[wn+(e[0]-(i+a)/2)*c,Q+(e[1]-(o+s)/2)*c])}function jn(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Z)%Z],a=e[(r+1)%Z];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Mn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function Nn(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Z).fill(0),i=Array(Z).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Z);s=(s%Z+Z)%Z,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Z;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Z,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:kn(An(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return kn(An(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Z)%Z]+s[(t+1)%Z])*.07),a,o),i))}function o(e,n){return kn(An(t(e,Z),n))}function s(e,n,r){return kn(jn(t(e,Z),n,r))}function c(e,n,r){return kn(t(e,Z).map(e=>[wn+(e[0]-wn)*n,Q+(e[1]-Q)*r]))}function l(e,n,r=1){return kn(t(e,Z).map((e,t)=>{let i=t*2*Math.PI/Z,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[wn+(e[0]-wn)*a,Q+(e[1]-Q)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([wn+Math.cos(a)*t,Q+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(wn+Math.cos(i)*o).toFixed(2)} ${(Q+Math.sin(i)*o).toFixed(2)}`}return kn(An(jn(t(`${a}Z`,Z),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[wn+Math.cos(n)*e,Q+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[wn+Math.cos(t)*n,Q+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return kn(An(jn(t(`${a}Z`,Z),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Z;a++){let o=-Math.PI/2+a*2*Math.PI/Z,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([wn+Math.cos(o)*c,Q+Math.sin(o)*c])}return kn(i)}function m(e){let t=[];for(let n=0;n<Z;n++){let r=-Math.PI/2+n*2*Math.PI/Z;t.push([wn+Math.cos(r)*e,Q+Math.sin(r)*e])}return kn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function Pn(){let e=Mn();if(e===null)return null;try{let t=Nn(e),n=t.silhouette(y,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(On,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var Fn;function In(){return Fn===void 0&&(Fn=Pn()),Fn}var Ln=/-?\d+(?:\.\d+)?/g;function Rn(e){return{fragments:e[0].split(Ln),numbers:e.map(e=>(e.match(Ln)??[]).map(Number))}}function zn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function Bn(e){return e<.5?2*e*e:1-2*(1-e)**2}var Vn=.58;function Hn(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:Bn(r?Math.min(1,c/Vn):c)}}var Un=Tn,Wn=[Un.blobby,Un.triangle,Un.square,Un.sparkle,Un.comma,Un.pentagon,Un.hexagon,Un.blobby],Gn={[Un.comma]:-2.9},Kn={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},qn=20,Jn=8.4;function Yn(e){let t=(0,J.c)(22),{status:n,className:r,testId:i}=e,{_:a}=m(),o=(0,Y.useRef)(null),s=(0,Y.useRef)(null),c=W(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,En),e.setAttribute(`stroke-width`,String(Dn)),s.current?.removeAttribute(`transform`);return}let t=In();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Rn(t.paths),r=NaN,i=``;return Cn(t=>{let{from:a,to:o,t:c}=Hn(t,Wn.length,Jn,!0),l=n.numbers[Wn[a]],u=n.numbers[Wn[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=zn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=Gn[Wn[a]]??0,h=m+((Gn[Wn[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,Y.useEffect)(l,u);let[d,f]=(0,Y.useState)(``),p,h;t[3]===a?(p=t[4],h=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},h=[a],t[3]=a,t[4]=p,t[5]=h),(0,Y.useEffect)(p,h);let g;t[6]===r?g=t[7]:(g=v(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=g);let _;t[8]===d?_=t[9]:(_=(0,X.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`path`,{ref:o,d:En,fill:`none`,stroke:`currentColor`,strokeWidth:Dn,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,X.jsx)(`svg`,{width:qn,height:qn,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,X.jsxs)(`g`,{className:`ok-working-group`,children:[y,(0,X.jsxs)(`g`,{ref:s,children:[(0,X.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Kn.leftCx,cy:Kn.cy,rx:Kn.rx,ry:Kn.ry,fill:`currentColor`}),(0,X.jsx)(`ellipse`,{className:`ok-working-eye`,cx:Kn.rightCx,cy:Kn.cy,rx:Kn.rx,ry:Kn.ry,fill:`currentColor`})]})]})})}),t[11]=b):b=t[11];let x;t[12]===n?x=t[13]:(x=(0,X.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,X.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==g||t[19]!==_||t[20]!==i?(C=(0,X.jsxs)(`div`,{className:g,"data-testid":i,children:[_,b,S]}),t[17]=S,t[18]=g,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function Xn(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function Zn(e){let t=Xn(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:V._({id:`GK5Ft_`,values:{0:r.name}})}function Qn(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?V._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?V._({id:`R6ABfU`}):null}var $n=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),er=700*1024;function tr(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function nr(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function rr(e){let t=e.type||``;if(!$n.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:er}};let n=await nr(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function ir(e){return or(e,e=>e.type.startsWith(`image/`))}function ar(e){return or(e,e=>e.size>0)}function or(e,t){if(e===null)return[];let n=[],r=e=>{e!==null&&t(e)&&n.push(e)},i=!1,a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];if(!t||t.kind!==`file`)continue;let n=t.getAsFile();n!==null&&(i=!0,r(n))}if(!i){let t=e.files;if(t)for(let e=0;e<t.length;e+=1)r(t[e]??null)}return n}function sr(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function cr(e,t={}){if((e.type||``).startsWith(`image/`))return rr(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=sr(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var lr=3,ur=lr*2+2;function dr(e){let t=e.split(`
|
|
3
3
|
`);return t[t.length-1]===``&&t.pop(),t}function fr(e,t){if(e===null)return dr(t).map(e=>({type:`add`,text:e}));let n=[],r=Ke(e,t);for(let[e,t]of r.entries()){let i=dr(t.value);if(t.added){for(let e of i)n.push({type:`add`,text:e});continue}if(t.removed){for(let e of i)n.push({type:`del`,text:e});continue}if(i.length<=ur){for(let e of i)n.push({type:`ctx`,text:e});continue}let a=e>0?i.slice(0,lr):[],o=e<r.length-1?i.slice(-lr):[];for(let e of a)n.push({type:`ctx`,text:e});n.push({type:`gap`,count:i.length-a.length-o.length});for(let e of o)n.push({type:`ctx`,text:e})}return n}var pr=/^\[[^\]]{1,32}\]\s*/,mr=/\bhttps?:\/\/\S+/,hr=/\b[A-Z0-9]{3,8}(?:-[A-Z0-9]{3,8})+\b/;function gr(e){try{let t=new URL(e);return`${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return e}}function _r(e){let t,n,r=[];for(let i of e){let e=i.replace(pr,``).trim();if(e===``)continue;let a=e.match(mr);if(n===void 0&&a!==null){n=a[0].replace(/[).,]+$/,``);let e=new URLSearchParams(n.split(`?`)[1]??``).get(`user_code`);e!==null&&e!==``&&(t=e)}if(t===void 0){let n=e.match(hr);n!==null&&(t=n[0])}let o=t!==void 0&&e.includes(t),s=n!==void 0&&e.includes(n);!o&&!s&&r.push(e)}return{...t===void 0?{}:{code:t},...n===void 0?{}:{url:n},lines:r}}var vr=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function yr(e){return e.replace(vr,``)}function br(e){return yr(e).split(`
|
|
4
4
|
`).map(e=>{let t=e.replace(/\r+$/,``),n=t.lastIndexOf(`\r`);return n===-1?t:t.slice(n+1)}).join(`
|
|
5
5
|
`)}var xr=new Set(pe),Sr=/^(?:open[-_ ]?knowledge|ok)$/,Cr=/^(?:mcp[^a-z0-9]+)?(?:open[-_ ]?knowledge|ok)[^a-z0-9]+([a-z_]+)$/;function wr(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Tr(e){return Cr.exec(e.trim().toLowerCase())?.[1]??null}function Er(e,t){let n=ae(wr(t),`server`);if(n!==null&&!Sr.test(n.toLowerCase()))return null;let r=ue(t),i=[Tr(e),r?.tool??null].find(e=>e!==null&&xr.has(e));return i===void 0?null:{tool:i,args:r?.args??{}}}function Dr(e){return typeof e==`string`?e.trim()===``?[]:[e.trim()]:Array.isArray(e)?e.flatMap(Dr):typeof e==`object`&&e?Dr(e.path):[]}var Or=[`document`,`documents`,`folder`,`file`,`template`,`asset`,`path`,`from`,`name`];function kr(e){for(let t of Or){let n=Dr(e[t]);if(n.length>0)return n}return[]}function Ar(e){return e.replace(/\.mdx?$/i,``)}var jr=120;function Mr(e){if(typeof e!=`string`)return null;let t=e.replace(/\s+/g,` `).trim();return t===``?null:t.length>jr?`${t.slice(0,jr-1)}…`:t}function Nr(e,t){let n=kr(t),r=n[0],i=n.length>1?V._({id:`C7waqI`,values:{0:n.length}}):r===void 0?null:Ar(r);switch(e){case`write`:return{glyph:`edit`,text:i===null?V._({id:`tLX6LY`}):V._({id:`MvWBwz`,values:{subject:i}})};case`edit`:return{glyph:`edit`,text:i===null?V._({id:`Fx9aOF`}):V._({id:`7aNk5D`,values:{subject:i}})};case`delete`:return{glyph:`delete`,text:i===null?V._({id:`DcFr-y`}):V._({id:`Gb_h4G`,values:{subject:i}})};case`move`:{let e=Dr(t.to)[0];if(i===null||e===void 0)return{glyph:`move`,text:V._({id:`RGptDW`})};let n=Ar(e);return{glyph:`move`,text:V._({id:`pbyEp3`,values:{subject:i,destination:n}})}}case`search`:{let e=Mr(t.query);return{glyph:`search`,text:e===null?V._({id:`EvXKHE`}):V._({id:`yWfjqS`,values:{query:e}})}}case`exec`:{let e=Mr(t.command);return{glyph:`execute`,text:e===null?V._({id:`FS4Udk`}):V._({id:`a5gwRt`,values:{command:e}})}}case`lint`:case`audit`:return{glyph:`check`,text:i===null?V._({id:`7S7FNA`}):V._({id:`TEJiKw`,values:{subject:i}})};case`links`:return{glyph:`link`,text:i===null?V._({id:`vallqD`}):V._({id:`KDrbNG`,values:{subject:i}})};case`history`:return{glyph:`history`,text:i===null?V._({id:`Ug2xzC`}):V._({id:`90-wKT`,values:{subject:i}})};case`config`:{let e=Mr(t.key);return{glyph:`settings`,text:e===null?V._({id:`ZwpggY`}):V._({id:`-oHckY`,values:{key:e}})}}case`skills`:return{glyph:`read`,text:V._({id:`4mp6Tv`})};case`install`:return{glyph:`install`,text:i===null?V._({id:`4ErgAf`}):V._({id:`WbWtif`,values:{subject:i}})};case`import`:{let e=Mr(t.skill)??Mr(t.source);return{glyph:`install`,text:e===null?V._({id:`DhT_PK`}):V._({id:`hCattk`,values:{source:e}})}}case`palette`:return{glyph:`read`,text:V._({id:`7czmD1`})};case`preview_url`:return{glyph:`fetch`,text:V._({id:`UL-9ej`})};case`share_link`:return{glyph:`share`,text:i===null?V._({id:`ABq-cq`}):V._({id:`ibE3-O`,values:{subject:i}})};case`checkpoint`:return{glyph:`history`,text:V._({id:`5b3WD-`})};case`conflicts`:return{glyph:`check`,text:V._({id:`i94lQe`})};case`resolve_conflict`:return{glyph:`edit`,text:i===null?V._({id:`_YWqV2`}):V._({id:`AeLo3p`,values:{subject:i}})};case`restore_version`:return{glyph:`restore`,text:i===null?V._({id:`caiyaU`}):V._({id:`hS0wC4`,values:{subject:i}})};default:return{glyph:`other`,text:V._({id:`vhGTWU`,values:{tool:e}})}}}var Pr={read:`read`,edit:`edit`,delete:`delete`,move:`move`,search:`search`,execute:`execute`,think:`think`,fetch:`fetch`,switch_mode:`switch_mode`};function Fr(e){let t=Er(e.title,e.rawInput);return t===null?{text:e.title,glyph:Pr[e.toolKind]??`other`}:Nr(t.tool,t.args)}var Ir=new Map([{id:`shellscript`,aliases:[`bash`,`sh`,`shell`,`zsh`]},{id:`tsx`,aliases:[`typescript`,`ts`,`jsx`]},{id:`javascript`,aliases:[`js`]},{id:`json`,aliases:[`jsonc`]},{id:`python`,aliases:[`py`]},{id:`rust`,aliases:[`rs`]},{id:`go`,aliases:[]},{id:`css`,aliases:[]},{id:`html`,aliases:[]},{id:`markdown`,aliases:[`md`]},{id:`yaml`,aliases:[`yml`]},{id:`toml`,aliases:[]},{id:`sql`,aliases:[]},{id:`diff`,aliases:[]},{id:`dockerfile`,aliases:[`docker`]}].flatMap(e=>[[e.id,e.id],...e.aliases.map(t=>[t,e.id])])),Lr=[`github-light`,`github-dark`],Rr=400,zr=new Map,Br=new Map;function Vr(e,t){return`${t}:${e.length}:${e.slice(0,100)}:${e.length>100?e.slice(-100):``}`}var Hr={name:`shiki`,type:`code-highlighter`,getSupportedLanguages:()=>Array.from(Ir.keys()),supportsLanguage:e=>Ir.has(e),getThemes:()=>Lr,highlight(e,n){let r=Ir.get(e.language)??`text`,i=Vr(e.code,r),a=zr.get(i);if(a!==void 0)return a;if(n!==void 0){let e=Br.get(i)??new Set;e.add(n),Br.set(i,e)}return t(async()=>{let{tokenize:e}=await import(`./code-highlighter-impl-Cd7bLu8y.js`);return{tokenize:e}},__vite__mapDeps([0,1,2,3]),import.meta.url).then(async({tokenize:t})=>{let n=await t(e.code,r);if(zr.size>=Rr){let e=Math.floor(zr.size/2);for(let t of zr.keys()){if(e===0)break;zr.delete(t),--e}}zr.set(i,n);let a=Br.get(i);if(a!==void 0){Br.delete(i);for(let e of a)e(n)}}).catch(e=>{Br.delete(i),console.warn(`[code-highlighter] highlight failed, leaving plain text`,e)}),null}};function Ur(){return e=>{Wr(e)}}function Wr(e){let t=e.children;if(t===void 0)return;let n=[];for(let e of t){if(e.type===`text`&&e.value!==void 0&&e.value.includes(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-DLT5va9k.js","./chunk-CYidjpOJ.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./compiler-runtime-BfE3aGVn.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-CA0dewJJ.js";import{i as ne,n as re,t as ie}from"./tooltip-DPvMEqsq.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-BH80AfFt.js";import{l as de}from"./select-fWSYgcDA.js";import{n as fe,t as pe}from"./toggle-group-BlEg4yJE.js";import{Ct as me}from"./dist-DSS3ixln2.js";import{n as he}from"./dist-CuH7ikCn.js";import{t as ge}from"./chevron-down-xENV92Te.js";import{t as _e}from"./spinner-DmibE6UV.js";import{n as ve,t as ye}from"./panel-right-open-BXE3r3dB.js";import{t as be}from"./undo-2-CXHp9Ngg.js";import{t as xe}from"./x-wQUDJS55.js";import{t as Se}from"./timeline-diff-store-BaXPeva3.js";import{t as s}from"./lru-string-cache-CEQLtS-9.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-BN_8QKGi.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-DLT5va9k.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&he.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=me.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}he.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(fe,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(fe,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(pe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(de,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(ge,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
|
|
2
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-CA0dewJJ.js";import{i as ne,n as re,t as ie}from"./tooltip-DPvMEqsq.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-BH80AfFt.js";import{l as de}from"./select-fWSYgcDA.js";import{n as fe,t as pe}from"./toggle-group-BlEg4yJE.js";import{Ct as me}from"./dist-CWxNQtC52.js";import{n as he}from"./dist-CuH7ikCn.js";import{t as ge}from"./chevron-down-xENV92Te.js";import{t as _e}from"./spinner-DmibE6UV.js";import{n as ve,t as ye}from"./panel-right-open-BXE3r3dB.js";import{t as be}from"./undo-2-CXHp9Ngg.js";import{t as xe}from"./x-wQUDJS55.js";import{t as Se}from"./timeline-diff-store-BaXPeva3.js";import{t as s}from"./lru-string-cache-CEQLtS-9.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-Bs-prtib.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-DLT5va9k.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&he.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=me.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}he.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(fe,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(fe,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(pe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(de,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(ge,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Qn as n}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Qn as n}from"./DocumentContext-DyBKMWUQ.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{i as a,r as o,t as s}from"./cursor-Dy0g2caC.js";import{t as c}from"./copilot-BvcrBiQu.js";var l=i(),u=t();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function p(e){let t=(0,l.c)(17),r,i;if(t[0]===e?(r=t[1],i=t[2]):({icon:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`claude`){let e;return t[3]===i?e=t[4]:(e=(0,u.jsx)(a,{...i}),t[3]=i,t[4]=e),e}if(r===`cursor`){let e;return t[5]===i?e=t[6]:(e=(0,u.jsx)(s,{...i}),t[5]=i,t[6]=e),e}if(r===`windsurf`){let e;return t[7]===i?e=t[8]:(e=(0,u.jsx)(f,{...i}),t[7]=i,t[8]=e),e}if(r===`openai`){let e;return t[9]===i?e=t[10]:(e=(0,u.jsx)(o,{...i}),t[9]=i,t[10]=e),e}if(r===`cline`){let e;return t[11]===i?e=t[12]:(e=(0,u.jsx)(d,{...i}),t[11]=i,t[12]=e),e}if(r===`github`){let e;return t[13]===i?e=t[14]:(e=(0,u.jsx)(c,{...i}),t[13]=i,t[14]=e),e}let p=i,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(n,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}var m=e(r(),1),h=null,g=new Set;function _(){for(let e of g)e()}function v(e){h=e,_()}function y(e){if(h===null)return;let t=Math.max(0,Math.min(e,h.maxVersions));t!==h.keptCount&&(h={...h,keptCount:t},_())}function b(e,t,n){if(h===null||h.agentId!==e||h.docName!==t||h.maxVersions===n)return;let r=h.keptCount===h.maxVersions?n:Math.min(h.keptCount,n);h={...h,maxVersions:n,keptCount:r},_()}function x(){h!==null&&(h=null,_())}function S(e){return g.add(e),()=>{g.delete(e)}}function C(){return h}function w(){return(0,m.useSyncExternalStore)(S,C,C)}export{w as a,b as i,v as n,p as o,y as r,x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{_r as n,br as r,gr as i,i as a,ir as o,tr as s}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{_r as n,br as r,gr as i,i as a,ir as o,tr as s}from"./DocumentContext-DyBKMWUQ.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{t as f}from"./utils-CPqDy6Hr.js";import{T as p,_ as m,a as h,h as g,v as _,w as v,y}from"./SkillInstallMenu-sneUc7PA.js";import{t as b}from"./button-CA0dewJJ.js";import{t as x}from"./dist-mv8e6dBX.js";import{i as S,n as C,t as w}from"./tooltip-DPvMEqsq.js";import{a as T,c as E,i as D,n as O,o as k,s as A,t as j}from"./dialog-BH80AfFt.js";import{t as M}from"./alert-dialog-C8E8SkhJ.js";import{t as N}from"./checkbox-Bi7zk4c5.js";import{a as P,m as F,r as I,t as L}from"./dropdown-menu-BpLbh79a.js";import{t as R}from"./label-Bbz2bT-a.js";import{i as z,n as ee,o as te,s as ne,t as B}from"./select-fWSYgcDA.js";import{n as re,t as V}from"./radio-group-BsZGGl8l.js";import{a as H,i as U,n as ie,o as W,r as G,s as K,t as ae}from"./field-5c9smYxo.js";import{Ct as q,Gt as oe,Ht as se,Jt as ce,Ko as le,Ut as ue,Wt as de,Yo as fe,fo as pe,js as me,nn as J}from"./dist-CWxNQtC52.js";import{n as Y}from"./dist-CuH7ikCn.js";import{c as he}from"./use-settings-route-CHUO6Vb3.js";import{t as X}from"./dist-BIGNzOeF2.js";import{c as ge,v as _e,x as ve}from"./documents-events-DViu97ho.js";import{i as ye}from"./use-apply-config-theme-B1eLRQeV.js";import{t as be}from"./parse-api-error-DcnXKbfT.js";import{n as xe}from"./use-workspace-DigIBtSV.js";import{t as Se}from"./createLucideIcon-CAkY8Blx.js";import{h as Ce,n as we,r as Te,t as Ee}from"./EnableSyncConfirmDialog-D80Aucr3.js";import{c as De,s as Oe,u as ke}from"./Mermaid-NYQ6RsUB.js";import{t as Ae}from"./arrow-up-right-CXMA4cr5.js";import{t as je}from"./check-Bzwwm-o4.js";import{s as Me}from"./prop-types-CU7HQl68.js";import{n as Ne,t as Pe}from"./terminal-CFd7qrv_.js";import{a as Fe,r as Ie,t as Le}from"./folder-config-api-CNXuE5zD.js";import{t as Re}from"./spinner-DmibE6UV.js";import{t as ze}from"./refresh-cw-D41gUk_B.js";import{t as Be}from"./trash-2-BVoWHmfV.js";import{t as Ve}from"./triangle-alert-CJVfCxE0.js";import{t as He}from"./x-wQUDJS55.js";import{d as Ue,f as We,n as Ge,u as Ke,v as qe}from"./doc-paths-DgbGdxZ1.js";import"./config-provider-JYp7fF6x.js";import{S as Je,h as Ye,i as Xe,p as Ze,x as Qe}from"./skills-api-DY2ILAVx.js";import{p as $e,r as et,t as tt}from"./skill-scope-BAozv3yS.js";import{t as nt}from"./input-Cy2M_Avq.js";import{a as rt,i as it,r as at,t as ot}from"./popover-CA_JdlWS.js";import{t as st}from"./external-link-DGqXfQJy.js";import{t as ct}from"./badge-DGD9B_-e.js";import{t as lt}from"./use-skills-B1r84pEp.js";import{t as ut}from"./textarea-BtqZ3yY1.js";import{t as dt}from"./terminal-command-events-ponJwwNv.js";var ft=Se(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),pt=Se(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),mt=Se(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),ht=Se(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),gt=Se(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),_t=Se(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]);function vt(e){return e===`eperm`?X._({id:`XuQzrk`}):X._({id:`BUyQnq`})}async function yt(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:vt(t.reason)}}var Z=d(),Q=e(c(),1);function bt(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return ve(()=>{o(wt)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(St).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:X._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(xt),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function xt(e){return e+1}async function St(e){if(!e.ok){let t=await e.json().catch(Ct);throw Error(be(t)??`HTTP ${e.status}`)}return e.json()}function Ct(){return null}function wt(e){return e+1}function Tt(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>ve(()=>{a(Ot)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(Et).then(t=>{if(e)return;let n=J.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:X._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function Et(e){if(!e.ok){let t=await e.json().catch(Dt);throw Error(be(t)??`HTTP ${e.status}`)}return e.json()}function Dt(){return null}function Ot(e){return e+1}async function kt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function At(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&kt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return _e(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),jt=`github.com`,Mt=new Map;async function Nt(e){try{let t=await e.json(),n=q.safeParse(t);if(n.success)return n.data.title}catch{}}async function Pt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Ft(e){let t=e?.host??jt,n=await Pt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Nt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function It(e){let t=e?.host??jt,n=Mt.get(t);if(n)return n;let r=Ft(e).finally(()=>{Mt.delete(t)});return Mt.set(t,r),r}function Lt(e){let t=e.split(`
|
|
2
2
|
`);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Rt(){return{status:It,async repos(e){let t=e?.host??`github.com`,n=await Pt(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Nt(n)??X._({id:`sGZLfB`})};let r=Lt(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||X._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:X._({id:`sGZLfB`})};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await Pt(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await Nt(t)}}}}function zt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Bt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
3
3
|
`);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Vt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}var Ht=2e3,Ut=1e4;function Wt(e,t){return new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);function i(){clearTimeout(r),n()}t.addEventListener(`abort`,i,{once:!0})})}function Gt(e){fetch(`/api/local-op/auth/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({channel:e})}).catch(e=>{console.warn(`[auth-transport] Cancel request failed (best-effort):`,e instanceof Error?e.message:e)})}async function Kt(e,t,n,r){let i=Rt(),a=Ht;for(;!t.aborted&&Date.now()<n;){try{let n=await i.status(r?{host:r}:void 0);if(t.aborted)return;if(n.authenticated){e({type:`complete`,host:n.host,login:n.login,name:n.name,email:n.email});return}}catch(e){console.warn(`[auth-transport] Recovery probe failed:`,e instanceof Error?e.message:e)}await Wt(a,t),a=Math.min(a*1.5,Ut)}t.aborted||e({type:`error`,message:X._({id:`ve8vEM`})})}function qt(e,t,n){let r=!1,i=Vt((n,i)=>{let a=e=>{(e.type===`complete`||e.type===`error`)&&(r=!0),n(e)};(async()=>{let n=null;try{let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:i});if(!r.ok){let e=X._({id:`LnVIW4`});try{let t=q.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:X._({id:`LnVIW4`})});return}if(await Bt(r.body,e=>{let t;try{t=JSON.parse(e)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,e.slice(0,100)),`continue`}if(t&&typeof t==`object`&&t.type===`error`&&`problem`in t){let e=t.problem;return a({type:`error`,message:e?.detail||e?.title||X._({id:`29VNqC`})}),`terminal`}if(t.type===`ping`)return`continue`;let r=t;return r.type===`verification`&&(n=Date.now()+r.expires_in*1e3),a(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})||i.aborted)return;if(n===null){a({type:`error`,message:X._({id:`DskIkK`})});return}await Kt(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await Kt(a,i,n,t.host);return}a({type:`error`,message:X._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||Gt(n),i.cancel()}}}function Jt(){return{start(){return qt(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return qt(`/api/local-op/auth/gh-login`,{host:e,json:!0},`gh-login`)},async pat(e,t){try{let n=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,token:t})});if(n.ok){let e=await n.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let r=X._({id:`sNeKjP`});try{let e=q.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:X._({id:`Q5fqMz`})}}}}}function Yt(e){return{start(){return e.localOp.auth.start()}}}async function Xt(e){try{await navigator.clipboard.writeText(e)}catch{}}function Zt(e){let t=(0,Z.c)(25),{onSuccess:r,startFlow:i}=e,{_:a}=u(),[o,s]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(`https://github.com/login/device`),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(0),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[0]!==a||t[1]!==r||t[2]!==i?(C=async function(){h(null);try{let e=i();x.current=e.cancel;let t=e.events[Symbol.asyncIterator](),n=!1,o=await t.next();for(;!o.done;){let e=o.value;if(e.type===`verification`)s(e.user_code),d(e.verification_uri),_(Date.now()+e.expires_in*1e3),y(e.expires_in*1e3),Xt(e.user_code).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)});else if(e.type===`complete`){n=!0,r({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){n=!0,h(e.message);break}o=await t.next()}n||h(a({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&h(a({id:`Q5fqMz`}))}},t[0]=a,t[1]=r,t[2]=i,t[3]=C):C=t[3];let w=C,T;t[4]===w?T=t[5]:(T=()=>{let e=!1;return queueMicrotask(()=>{e||w()}),()=>{e=!0,x.current?.(),x.current=null,S.current&&clearInterval(S.current)}},t[4]=w,t[5]=T);let E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[6]=E):E=t[6],(0,Q.useEffect)(T,E);let D,O;t[7]!==a||t[8]!==g?(D=()=>{if(g!==null)return S.current=setInterval(()=>{let e=g-Date.now();e<=0?(y(0),S.current&&clearInterval(S.current),h(a({id:`ve8vEM`}))):y(e)},1e3),()=>{S.current&&clearInterval(S.current)}},O=[g,a],t[7]=a,t[8]=g,t[9]=D,t[10]=O):(D=t[9],O=t[10]),(0,Q.useEffect)(D,O);let k=Math.floor(v/6e4),A=Math.floor(v%6e4/1e3),j;t[11]===A?j=t[12]:(j=A.toString().padStart(2,`0`),t[11]=A,t[12]=j);let M=`${k}:${j}`,N;t[13]!==a||t[14]!==f||t[15]!==m||t[16]!==M||t[17]!==o||t[18]!==c?(N=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`eVPynQ`,values:{verificationUri:c},components:{0:(0,$.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>st(e,c),onAuxClick:e=>st(e,c),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(Ae,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(b,{type:`button`,variant:`outline`,"aria-label":a({id:`nCzR-G`,values:{userCode:o}}),onClick:()=>void Xt(o).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,$.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:o}),(0,$.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:f?(0,$.jsx)(je,{className:`size-4`}):(0,$.jsx)(n,{className:`size-4`})})]}),(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:f?(0,$.jsx)(l,{id:`80c4-P`}):null}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,$.jsx)(l,{id:`5y_9lO`})]}),(0,$.jsx)(`span`,{children:(0,$.jsx)(l,{id:`gYz2ep`,values:{timeLabel:M}})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:m?null:(0,$.jsx)(l,{id:`aWlJai`})}),t[13]=a,t[14]=f,t[15]=m,t[16]=M,t[17]=o,t[18]=c,t[19]=N):N=t[19];let P;t[20]===m?P=t[21]:(P=m&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:m}),t[20]=m,t[21]=P);let F;return t[22]!==N||t[23]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[N,P]}),t[22]=N,t[23]=P,t[24]=F):F=t[24],F}function Qt(e){let t=(0,Z.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:s}=u(),c;t[0]===n?c=t[1]:(c=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:(0,$.jsx)(l,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`gp3I7-`})}),t[2]=d):d=t[2];let f;t[3]===s?f=t[4]:(f=s({id:`6YtxFj`}),t[3]=s,t[4]=f);let p;t[5]!==s||t[6]!==n?(p=s({id:`J2Mv98`,values:{login:n}}),t[5]=s,t[6]=n,t[7]=p):p=t[7];let m;t[8]===i?m=t[9]:(m=e=>i(e.target.value),t[8]=i,t[9]=m);let h;t[10]!==r||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)(nt,{"aria-label":f,placeholder:p,value:r,onChange:m}),t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===s?g=t[16]:(g=s({id:`O3oNi5`}),t[15]=s,t[16]=g);let _;t[17]===s?_=t[18]:(_=s({id:`O3oNi5`}),t[17]=s,t[18]=_);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,$.jsx)(nt,{type:`email`,"aria-label":g,placeholder:_,value:a,onChange:v}),t[21]=a,t[22]=g,t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==c||t[27]!==y||t[28]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,d,h,y]}),t[26]=c,t[27]=y,t[28]=h,t[29]=b):b=t[29],b}function $t(e){let t=(0,Z.c)(37),{host:n,token:r,onTokenChange:i,error:a,onSubmit:o,showGhOption:s,onGhSignIn:c}=e,{_:d}=u(),f=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,p;t[0]!==n||t[1]!==c||t[2]!==s?(p=s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{type:`button`,onClick:c,children:(0,$.jsx)(l,{id:`_SDGzH`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(l,{id:`8L0EPw`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`8k6INX`,values:{host:n},components:{0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=c,t[2]=s,t[3]=p):p=t[3];let m,h;t[4]===f?(m=t[5],h=t[6]):(m=e=>st(e,f),h=e=>st(e,f),t[4]=f,t[5]=m,t[6]=h);let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(l,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ae,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=_):_=t[9];let v;t[10]!==f||t[11]!==m||t[12]!==h||t[13]!==g?(v=(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:m,onAuxClick:h,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[g,_]}),t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(l,{id:`Xg-Ntj`})}),t[15]=y):y=t[15];let x;t[16]===d?x=t[17]:(x=d({id:`p2LEhJ`}),t[16]=d,t[17]=x);let S;t[18]===i?S=t[19]:(S=e=>i(e.target.value),t[18]=i,t[19]=S);let C;t[20]===o?C=t[21]:(C=e=>{e.key===`Enter`&&o()},t[20]=o,t[21]=C);let w;t[22]!==C||t[23]!==x||t[24]!==S||t[25]!==r?(w=(0,$.jsx)(nt,{type:`password`,"aria-label":x,placeholder:`ghp_`,value:r,onChange:S,onKeyDown:C}),t[22]=C,t[23]=x,t[24]=S,t[25]=r,t[26]=w):w=t[26];let T;t[27]===a?T=t[28]:(T=a&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:a}),t[27]=a,t[28]=T);let E;t[29]===s?E=t[30]:(E=!s&&(0,$.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(l,{id:`qX-ABr`})}),(0,$.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{id:`jxtXZI`})}),(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{id:`9Vh9Jf`})})]})]}),t[29]=s,t[30]=E);let D;return t[31]!==p||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==v?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,v,y,w,T,E]}),t[31]=p,t[32]=w,t[33]=T,t[34]=E,t[35]=v,t[36]=D):D=t[36],D}var en=1e4;function tn(e){let t=(0,Z.c)(92),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s,queryTransport:c,host:d,ghAvailable:f}=e,{_:p}=u(),m;t[0]===s?m=t[1]:(m=s??Jt(),t[0]=s,t[1]=m);let h=m,g;t[2]===c?g=t[3]:(g=c??Rt(),t[2]=c,t[3]=g);let _=g,[v,y]=(0,Q.useState)(`auth`),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),[T,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,ee]=(0,Q.useState)(void 0),[te,ne]=(0,Q.useState)(void 0),B=d??z,re=!!B&&B!==`github.com`&&!!(f??te)&&typeof h.ghLogin==`function`,V=!a&&d===void 0,H,U;t[4]!==d||t[5]!==a||t[6]!==V||t[7]!==n?(H=()=>{n&&(S(null),w(``),M(``),P(``),I(null),R(!1),ee(void 0),ne(void 0),y(a||V?`checking`:d&&d!==`github.com`?`pat`:`auth`))},U=[n,a,d,V],t[4]=d,t[5]=a,t[6]=V,t[7]=n,t[8]=H,t[9]=U):(H=t[8],U=t[9]),(0,Q.useLayoutEffect)(H,U);let ie;t[10]!==a||t[11]!==n||t[12]!==_?(ie=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,y(t))},r=setTimeout(()=>t(`auth`),en);return _.status().then(n=>{e||(n.authenticated?(S({login:n.login,name:n.name,email:n.email}),w(n.name??``),M(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=a,t[11]=n,t[12]=_,t[13]=ie):ie=t[13];let W;t[14]!==a||t[15]!==n?(W=[n,a],t[14]=a,t[15]=n,t[16]=W):W=t[16],(0,Q.useEffect)(ie,W);let G;t[17]!==V||t[18]!==n||t[19]!==_?(G=()=>{if(!n||!V)return;let e=!1,t=t=>{e||(e=!0,y(t))},r=setTimeout(()=>t(`auth`),en);return _.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;ee(n.host),ne(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=V,t[18]=n,t[19]=_,t[20]=G):G=t[20];let K;t[21]!==V||t[22]!==n?(K=[n,V],t[21]=V,t[22]=n,t[23]=K):K=t[23],(0,Q.useEffect)(G,K);let ae;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(ae=function(e){if(S(e),a)w(e.name??``),M(e.email??``),y(`identity`);else{y(`done`),i?.(e),r(!1);let t=e.login;Y.success(p(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[24]=p,t[25]=a,t[26]=r,t[27]=i,t[28]=ae):ae=t[28];let q=ae,oe;t[29]!==p||t[30]!==B||t[31]!==q||t[32]!==L||t[33]!==N||t[34]!==h?(oe=async function(){let e=N.trim();if(!e||!B||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(B,e);R(!1),t.ok?q({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=B,t[31]=q,t[32]=L,t[33]=N,t[34]=h,t[35]=oe):oe=t[35];let se=oe,ce;t[36]!==p||t[37]!==x||t[38]!==r||t[39]!==i?(ce=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(nn);let n={...x??{login:``},name:e,email:t};y(`done`),i?.(n),r(!1);let a=n.login;Y.success(p(a?{id:`E_tNGD`,values:{login:a}}:{id:`cgl-gn`}))},t[36]=p,t[37]=x,t[38]=r,t[39]=i,t[40]=ce):ce=t[40];let le=ce,ue;t[41]!==p||t[42]!==x||t[43]!==r||t[44]!==i?(ue=function(){if(!x)return;y(`done`),i?.(x),r(!1);let e=x.login;Y.success(p(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[41]=p,t[42]=x,t[43]=r,t[44]=i,t[45]=ue):ue=t[45];let de=ue,fe;t[46]===r?fe=t[47]:(fe=function(){r(!1)},t[46]=r,t[47]=fe);let pe=fe,me;t[48]!==a||t[49]!==o||t[50]!==v?(me=(0,$.jsx)(A,{children:(0,$.jsx)(E,{children:o&&(v===`pat`||v===`gh-device`)?(0,$.jsx)(l,{id:`DUWgfT`}):o?(0,$.jsx)(l,{id:`X8kjQX`}):v===`pat`||v===`gh-device`?(0,$.jsx)(l,{id:`tzZ6ha`}):a&&v!==`auth`?(0,$.jsx)(l,{id:`29XZXN`}):(0,$.jsx)(l,{id:`3jod3l`})})}),t[48]=a,t[49]=o,t[50]=v,t[51]=me):me=t[51];let J;t[52]===v?J=t[53]:(J=v===`checking`&&(0,$.jsx)(O,{children:(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`gBbxn_`})})}),t[52]=v,t[53]=J);let he;t[54]!==q||t[55]!==pe||t[56]!==h||t[57]!==v?(he=v===`auth`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{children:(0,$.jsx)(Zt,{onSuccess:q,startFlow:()=>h.start()})}),(0,$.jsx)(k,{children:(0,$.jsx)(b,{variant:`outline`,className:`font-mono uppercase`,onClick:pe,children:(0,$.jsx)(l,{id:`dEgA5A`})})})]}),t[54]=q,t[55]=pe,t[56]=h,t[57]=v,t[58]=he):he=t[58];let X;t[59]!==re||t[60]!==B||t[61]!==pe||t[62]!==se||t[63]!==F||t[64]!==L||t[65]!==N||t[66]!==v?(X=v===`pat`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{children:(0,$.jsx)($t,{host:B??``,token:N,onTokenChange:P,error:F,onSubmit:se,showGhOption:re,onGhSignIn:()=>y(`gh-device`)})}),(0,$.jsxs)(k,{children:[(0,$.jsx)(b,{variant:`outline`,className:`font-mono uppercase`,onClick:pe,children:(0,$.jsx)(l,{id:`dEgA5A`})}),(0,$.jsx)(b,{onClick:se,disabled:!N.trim()||L,children:L?(0,$.jsx)(l,{id:`9zb2WA`}):(0,$.jsx)(l,{id:`iSLIjg`})})]})]}),t[59]=re,t[60]=B,t[61]=pe,t[62]=se,t[63]=F,t[64]=L,t[65]=N,t[66]=v,t[67]=X):X=t[67];let ge;t[68]!==B||t[69]!==q||t[70]!==pe||t[71]!==h||t[72]!==v?(ge=v===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{children:(0,$.jsx)(Zt,{onSuccess:q,startFlow:()=>h.ghLogin?.(B??``)??h.start()})}),(0,$.jsxs)(k,{children:[(0,$.jsx)(b,{variant:`ghost`,onClick:()=>y(`pat`),children:(0,$.jsx)(l,{id:`hLKfZe`})}),(0,$.jsx)(b,{variant:`outline`,className:`font-mono uppercase`,onClick:pe,children:(0,$.jsx)(l,{id:`dEgA5A`})})]})]}),t[68]=B,t[69]=q,t[70]=pe,t[71]=h,t[72]=v,t[73]=ge):ge=t[73];let _e;t[74]!==x||t[75]!==le||t[76]!==de||t[77]!==T||t[78]!==C||t[79]!==v?(_e=v===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{children:(0,$.jsx)(Qt,{login:x.login,name:C,onNameChange:w,email:T,onEmailChange:M})}),(0,$.jsxs)(k,{children:[(0,$.jsx)(b,{variant:`ghost`,onClick:de,children:(0,$.jsx)(l,{id:`6Uau97`})}),(0,$.jsx)(b,{onClick:()=>le(C.trim(),T.trim()),disabled:!C.trim()||!T.trim(),children:(0,$.jsx)(l,{id:`tfDRzk`})})]})]}),t[74]=x,t[75]=le,t[76]=de,t[77]=T,t[78]=C,t[79]=v,t[80]=_e):_e=t[80];let ve;t[81]!==me||t[82]!==J||t[83]!==he||t[84]!==X||t[85]!==ge||t[86]!==_e?(ve=(0,$.jsxs)(D,{className:`sm:max-w-md`,children:[me,J,he,X,ge,_e]}),t[81]=me,t[82]=J,t[83]=he,t[84]=X,t[85]=ge,t[86]=_e,t[87]=ve):ve=t[87];let ye;return t[88]!==r||t[89]!==n||t[90]!==ve?(ye=(0,$.jsx)(j,{open:n,onOpenChange:r,children:ve}),t[88]=r,t[89]=n,t[90]=ve,t[91]=ye):ye=t[91],ye}function nn(){}function rn(e){let t=(0,Z.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,u=(0,Q.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(l,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,$.jsx)(W,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(G,{children:(0,$.jsx)(l,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===r?m=t[5]:(m=e=>r(e.target.value),t[4]=r,t[5]=m);let h;t[6]!==s||t[7]!==u||t[8]!==a||t[9]!==c||t[10]!==m||t[11]!==n?(h=(0,$.jsx)(ut,{id:u,value:n,onChange:m,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=s,t[7]=u,t[8]=a,t[9]=c,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,$.jsxs)(ae,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}var an=/^[A-Za-z0-9_-]+$/;function on(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function sn(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var cn=0;function ln(){return cn+=1,`prop-${cn}`}function un(e){let{frontmatter:t,body:n}=le(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of fe(t).split(`
|
|
4
4
|
`)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:ln(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function dn(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{An as e,Ki as t,si as n}from"./dist-
|
|
1
|
+
import{An as e,Ki as t,si as n}from"./dist-CWxNQtC52.js";import{c as r,t as i}from"./trace-api-BslS_6CM.js";import{t as a}from"./propagation-api-B1_qxPZb.js";import{t as o}from"./createLucideIcon-CAkY8Blx.js";var s=o(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),c=`support@inkeep.com`;function l(e){return`mailto:${c}?subject=${encodeURIComponent(e)}`}function u(e){return e.split(/[\\/]/).pop()??e}function d(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${Math.max(1,Math.round(e/1024))} KB`:`${e} B`}var f=200,p=/^(?:#{1,6}|>)(?:[ \t]+|$)/;function m(r){if(typeof r==`string`)for(let i of r.split(/\r\n|\r|\n/)){let r=n(i);for(r=t(r).replace(/\s+/g,` `).trim();p.test(r);)r=r.replace(p,``).trim();if(r!==``)return e(r,f).trimEnd()}}var h=`open-knowledge-app`,g=`ok.bug-report.send.attempt`,_={traceparent:()=>void 0,end:()=>{}},v=_;function y(e={}){try{let t=i.getTracer(h).startSpan(g,{attributes:e});return t.isRecording()?b(t,i.setSpan(r,t)):(t.end(),v)}catch(e){return console.warn(`[bug-report-send-otel] span start failed:`,e instanceof Error?e:String(e)),v}}function b(e,t){let n=!1;return{traceparent(){try{let e={};return a.inject(t,e),e.traceparent}catch{return}},end(t,r){if(!n){n=!0;try{r&&e.setAttributes(r),e.setAttribute(`ok.bug_report.renderer_outcome`,t),e.end()}catch{}}}}}var x=200,S=3,C=.9;function w(e){if(e.kind===`history-row`){let{row:t}=e;return{zipPath:t.zipPath,zipSizeBytes:t.zipBytes,metadata:{level:t.bundleLevel===`unknown`?`standard`:t.bundleLevel,systemWide:t.systemWide,projectSlug:t.projectSlug,...t.note===void 0?{}:{note:t.note}}}}let{report:t,note:n,includeScreenshot:r}=e;return{zipPath:t.zipPath,zipSizeBytes:t.zipSizeBytes,metadata:{level:t.summary.level,systemWide:t.summary.systemWide,projectSlug:t.summary.projectSlug,note:n},includeScreenshot:r}}function T(e){let t=new Map,n=new Set,r=null;function i(){for(let e of n)try{e()}catch(e){console.warn(`[bug-report-send] subscriber threw:`,e)}}function a(e,t){e.state=t,r=null,i()}function o(e){return{operationId:e.operationId,zipPath:e.zipPath,zipSizeBytes:e.zipSizeBytes,requestSeq:e.requestSeq}}function s(e){e.fillTimer!==null&&(clearInterval(e.fillTimer),e.fillTimer=null)}function c(e){s(e);let t=Date.now();e.fillTimer=setInterval(()=>{if(e.state.status!==`sending`){s(e);return}let n=(Date.now()-t)/1e3,r=Math.min(C,1-Math.exp(-n/S)),i=Math.round(r*100);i!==e.state.fillPercent&&a(e,{...o(e),status:`sending`,fillPercent:i})},x)}function l(e,t){s(e),e.span.end(t.status===`email-draft`?`email-drafted`:t.status===`already-sending`?`joined`:t.status,{"ok.bug_report.request_seq":e.requestSeq}),a(e,{...o(e),...t})}function d(e,t){if(t.ok){l(e,{status:`sent`,reference:t.reference});return}if(t.reason===`email-draft`){l(e,{status:`email-draft`,mailtoUrl:t.fallback.mailtoUrl});return}if(t.reason===`send-in-flight`){l(e,{status:`already-sending`});return}l(e,{status:`failed`,mailtoUrl:t.fallback.mailtoUrl})}function f(e){e.span=y({"ok.bug_report.zip_bytes":e.input.zipSizeBytes,"ok.bug_report.include_screenshot":e.input.includeScreenshot===!0,"ok.bug_report.attempt":e.requestSeq}),a(e,{...o(e),status:`sending`,fillPercent:0}),c(e),m(e,e.input)}function p(e){return e.requestSeq+=1,e.state.status===`sending`?(a(e,{...o(e),status:`sending`,fillPercent:e.state.fillPercent}),e.state):(f(e),e.state)}async function m(t,n){try{let r=e();if(r===void 0){console.warn(`[bug-report-send] no desktop bridge; send cannot be dispatched`),l(t,{status:`failed`});return}let i=t.span.traceparent();d(t,await r.send({zipPath:n.zipPath,metadata:n.metadata,...n.includeScreenshot===void 0?{}:{includeScreenshot:n.includeScreenshot},...i===void 0?{}:{traceparent:i}}))}catch(e){console.warn(`[bug-report-send] IPC dispatch threw:`,e),l(t,{status:`failed`})}}return{startBugReportSend(e){let n=w(e),r=u(n.zipPath),i=t.get(r);if(i!==void 0)return i.input=n,p(i);let a={operationId:r,zipPath:n.zipPath,zipSizeBytes:n.zipSizeBytes,requestSeq:1},o={...a,input:n,fillTimer:null,state:{...a,status:`sending`,fillPercent:0},span:_};return t.set(r,o),f(o),o.state},retryBugReportSend(e){let n=t.get(e);n!==void 0&&p(n)},get(e){return t.get(e)?.state},getSnapshot(){return r??=[...t.values()].map(e=>e.state),r},subscribe(e){return n.add(e),()=>{n.delete(e)}}}}var E=T(()=>window.okDesktop?.bugReport);export{u as a,l as i,m as n,s as o,d as r,E as t};
|