termdock 1.4.58 → 1.4.59
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/client/assets/{ModelPreview-61nSx12D.js → ModelPreview-DH-7pHJF.js} +1 -1
- package/dist/client/assets/{abnfDiagram-VRR7QNED-BRaoNJNg.js → abnfDiagram-VRR7QNED-Ct00-XnB.js} +1 -1
- package/dist/client/assets/{arc-ChEiSO2-.js → arc-BbTXkvLg.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZJ3FMSHR-D_xQyNmF.js → architectureDiagram-ZJ3FMSHR-CmuzCqen.js} +1 -1
- package/dist/client/assets/{blockDiagram-677ZJIJ3-DVOAM4qN.js → blockDiagram-677ZJIJ3-CCluwOk7.js} +1 -1
- package/dist/client/assets/{c4Diagram-LMCZKHZV-Cc-48vfg.js → c4Diagram-LMCZKHZV-BIKbP4LS.js} +1 -1
- package/dist/client/assets/channel-LdBDFRps.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-UAHUubcw.js → chunk-2Q5K7J3B-BDwk6RC_.js} +1 -1
- package/dist/client/assets/{chunk-32BRIVSS-Cimn5JXL.js → chunk-32BRIVSS-DnwdpIMs.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-Cl_vJF6p.js → chunk-5VM5RSS4-CwCLJYkK.js} +1 -1
- package/dist/client/assets/{chunk-EX3LRPZG-Bj9qUUrs.js → chunk-EX3LRPZG-BOZ7Q5SG.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BIOZ8K7P.js → chunk-JWPE2WC7-BRP7egWP.js} +1 -1
- package/dist/client/assets/{chunk-MOJQB5TN-BpUcO16P.js → chunk-MOJQB5TN-DjR8pTwa.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-BuWJZ-E7.js → chunk-RYQCIY6F-Cd7R_v4u.js} +1 -1
- package/dist/client/assets/{chunk-V7JOEXUC-BGksDUMf.js → chunk-V7JOEXUC-B5mnq3DX.js} +1 -1
- package/dist/client/assets/{chunk-VR4S4FIN-Bu4FNsFG.js → chunk-VR4S4FIN-Dc58ALhF.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C747NL4e.js → chunk-XXDRQBXY-BlHAakeI.js} +1 -1
- package/dist/client/assets/classDiagram-OUVF2IWQ-B836Ofsf.js +1 -0
- package/dist/client/assets/classDiagram-v2-EOCWNBFH-B836Ofsf.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CwUS-0dG.js → cose-bilkent-JH36ORCC-CVfKk5v7.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-Yc3IgEzp.js → cynefin-VYW2F7L2-DFwNttbS.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-TSTJHNR4-BVhWzLHN.js → cynefinDiagram-TSTJHNR4-Bh7AF6Wm.js} +1 -1
- package/dist/client/assets/{dagre-VKFMJZFB-Cv6C59Oq.js → dagre-VKFMJZFB-DuSTc5Sy.js} +1 -1
- package/dist/client/assets/{diagram-FQU43EPY-ypBhq0eg.js → diagram-FQU43EPY-C7XMbUXe.js} +1 -1
- package/dist/client/assets/{diagram-G47NLZAW-BVfpD5aM.js → diagram-G47NLZAW-DZa2dWvr.js} +1 -1
- package/dist/client/assets/{diagram-NH7WQ7WH-z_7hVWHm.js → diagram-NH7WQ7WH-B6_wGIDm.js} +1 -1
- package/dist/client/assets/{diagram-OA4YK3LP--pjbsL71.js → diagram-OA4YK3LP-CHOs8m-t.js} +1 -1
- package/dist/client/assets/{diagram-WEI45ONY-DG5ywAU1.js → diagram-WEI45ONY-BDjbzb1X.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-CCIWWBDH-B-zJSOIe.js → ebnfDiagram-CCIWWBDH-DARvicrf.js} +1 -1
- package/dist/client/assets/{erDiagram-Q63AITRT-Dgfdeoem.js → erDiagram-Q63AITRT-AaNcwwTP.js} +1 -1
- package/dist/client/assets/{flowDiagram-23GEKE2U-BzNUcZ_y.js → flowDiagram-23GEKE2U-B3xYW3Ac.js} +1 -1
- package/dist/client/assets/{ganttDiagram-NO4QXBWP-D4fODXRJ.js → ganttDiagram-NO4QXBWP-CqG72bE2.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-IHSO6WYX-CVFbwr96.js → gitGraphDiagram-IHSO6WYX-mKeuquZY.js} +1 -1
- package/dist/client/assets/{index-Cqa6PnoN.js → index-wM1B1hbM.js} +5 -5
- package/dist/client/assets/{infoDiagram-FWYZ7A6U-xRExMCZi.js → infoDiagram-FWYZ7A6U-DPAUPRi0.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-FXEZZL3T-D5gPKTMY.js → ishikawaDiagram-FXEZZL3T-D-6UZHyN.js} +1 -1
- package/dist/client/assets/{journeyDiagram-5HDEW3XC-DFVGOXq2.js → journeyDiagram-5HDEW3XC-DOZJ9ip9.js} +1 -1
- package/dist/client/assets/{kanban-definition-HUTT4EX6-VnuzEXI9.js → kanban-definition-HUTT4EX6-DB3ae5AM.js} +1 -1
- package/dist/client/assets/{linear-ISY1iz4m.js → linear-Bha1cE7s.js} +1 -1
- package/dist/client/assets/{mermaid.core-XMpOdh8Z.js → mermaid.core-DSPzdUTe.js} +4 -4
- package/dist/client/assets/{mindmap-definition-LN4V7U3C-DXIJqMWL.js → mindmap-definition-LN4V7U3C-DKKUZo_x.js} +1 -1
- package/dist/client/assets/{pegDiagram-2B236MQR-Dkqzsn7W.js → pegDiagram-2B236MQR-DaV3xDvd.js} +1 -1
- package/dist/client/assets/{pieDiagram-ENE6RG2P-D1qvzVBt.js → pieDiagram-ENE6RG2P-DVkjTBsT.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-ABIIQ3AL-Dr1apfjL.js → quadrantDiagram-ABIIQ3AL-C-bZjtId.js} +1 -1
- package/dist/client/assets/{railroadDiagram-RFXS5EU6-Dp_FNTnd.js → railroadDiagram-RFXS5EU6-Cf0UEv0O.js} +1 -1
- package/dist/client/assets/{requirementDiagram-TGXJPOKE-GKLu7ydu.js → requirementDiagram-TGXJPOKE-VIxA-DHJ.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-HTMAVEWB-uJo0tY9y.js → sankeyDiagram-HTMAVEWB-B7cqKt39.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-DBY2YBRQ-C8Zq7QHv.js → sequenceDiagram-DBY2YBRQ-DB52or-d.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-BtfUigZL.js → sizeCapture-X5ZJPWSS-C-Hy7dNK.js} +1 -1
- package/dist/client/assets/{stateDiagram-2N3HPSRC-KMdP8MQY.js → stateDiagram-2N3HPSRC-CrjCbVZF.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-6OUMAXLB-DXnU7NjN.js +1 -0
- package/dist/client/assets/{swimlanes-5IMT3BWC-vJu62bHW.js → swimlanes-5IMT3BWC-C2UEDf_r.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-G3AALYLV-DTDpRtmY.js +8 -0
- package/dist/client/assets/{timeline-definition-FHXFAJF6-CcojDYXw.js → timeline-definition-FHXFAJF6-Cz7nYQhl.js} +1 -1
- package/dist/client/assets/{vennDiagram-L72KCM5P-Cq5SjfHg.js → vennDiagram-L72KCM5P-DPs4clHV.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-EHGQE667-2gZ7eseh.js → wardleyDiagram-EHGQE667-Bd39mz6c.js} +1 -1
- package/dist/client/assets/{xychartDiagram-FW5EYKEG-D3anl8U4.js → xychartDiagram-FW5EYKEG-B8RKfuGf.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/sw.js +1 -1
- package/dist/server/routes/filesystem.js +52 -4
- package/package.json +1 -1
- package/runtime-manifest.json +2 -2
- package/dist/client/assets/channel-DkNmSW2h.js +0 -1
- package/dist/client/assets/classDiagram-OUVF2IWQ-CURiehPw.js +0 -1
- package/dist/client/assets/classDiagram-v2-EOCWNBFH-CURiehPw.js +0 -1
- package/dist/client/assets/stateDiagram-v2-6OUMAXLB-DNy6MGiD.js +0 -1
- package/dist/client/assets/swimlanesDiagram-G3AALYLV-DScmQyCA.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ca-rq7yX.js","assets/react-XDCjal2T.js","assets/ModelPreview-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ca-rq7yX.js","assets/react-XDCjal2T.js","assets/ModelPreview-DH-7pHJF.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/katex-55ZPZeOF.css","assets/mermaid.core-DSPzdUTe.js","assets/purify.es-CC4Brkr_.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as gm,a as hC,g as r4}from"./react-XDCjal2T.js";import{b as w,R as D,r as dc,a as pC}from"./dnd-BCFAPC0L.js";import{L as mC,l as gC}from"./terminal-C7X98Amf.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Mg={exports:{}},b0={};var x5;function bC(){if(x5)return b0;x5=1;var e=gm(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(u,d,h){var m,b={},x=null,v=null;h!==void 0&&(x=""+h),d.key!==void 0&&(x=""+d.key),d.ref!==void 0&&(v=d.ref);for(m in d)n.call(d,m)&&!i.hasOwnProperty(m)&&(b[m]=d[m]);if(u&&u.defaultProps)for(m in d=u.defaultProps,d)b[m]===void 0&&(b[m]=d[m]);return{$$typeof:t,type:u,key:x,ref:v,props:b,_owner:s.current}}return b0.Fragment=r,b0.jsx=a,b0.jsxs=a,b0}var y5;function xC(){return y5||(y5=1,Mg.exports=bC()),Mg.exports}var l=xC(),gh={},v5;function yC(){if(v5)return gh;v5=1;var e=hC();return gh.createRoot=e.createRoot,gh.hydrateRoot=e.hydrateRoot,gh}var vC=yC();const wC=r4(vC);function w5(e){return e!==null&&typeof e=="object"&&"constructor"in e&&e.constructor===Object}function Qb(e={},t={}){const r=["__proto__","constructor","prototype"];Object.keys(t).filter(n=>r.indexOf(n)<0).forEach(n=>{typeof e[n]>"u"?e[n]=t[n]:w5(t[n])&&w5(e[n])&&Object.keys(t[n]).length>0&&Qb(e[n],t[n])})}const n4={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function eu(){const e=typeof document<"u"?document:{};return Qb(e,n4),e}const AC={document:n4,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(e){return typeof setTimeout>"u"?(e(),null):setTimeout(e,0)},cancelAnimationFrame(e){typeof setTimeout>"u"||clearTimeout(e)}};function xo(){const e=typeof window<"u"?window:{};return Qb(e,AC),e}function TC(e=""){return e.trim().split(" ").filter(t=>!!t.trim())}function SC(e){const t=e;Object.keys(t).forEach(r=>{try{t[r]=null}catch{}try{delete t[r]}catch{}})}function s4(e,t=0){return setTimeout(e,t)}function Rp(){return Date.now()}function CC(e){const t=xo();let r;return t.getComputedStyle&&(r=t.getComputedStyle(e,null)),!r&&e.currentStyle&&(r=e.currentStyle),r||(r=e.style),r}function _C(e,t="x"){const r=xo();let n,s,i;const a=CC(e);return r.WebKitCSSMatrix?(s=a.transform||a.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(u=>u.replace(",",".")).join(", ")),i=new r.WebKitCSSMatrix(s==="none"?"":s)):(i=a.MozTransform||a.OTransform||a.MsTransform||a.msTransform||a.transform||a.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),n=i.toString().split(",")),t==="x"&&(r.WebKitCSSMatrix?s=i.m41:n.length===16?s=parseFloat(n[12]):s=parseFloat(n[4])),t==="y"&&(r.WebKitCSSMatrix?s=i.m42:n.length===16?s=parseFloat(n[13]):s=parseFloat(n[5])),s||0}function bh(e){return typeof e=="object"&&e!==null&&e.constructor&&Object.prototype.toString.call(e).slice(8,-1)==="Object"}function kC(e){return typeof window<"u"&&typeof window.HTMLElement<"u"?e instanceof HTMLElement:e&&(e.nodeType===1||e.nodeType===11)}function Ho(...e){const t=Object(e[0]);for(let r=1;r<e.length;r+=1){const n=e[r];if(n!=null&&!kC(n)){const s=Object.keys(Object(n)).filter(i=>i!=="__proto__"&&i!=="constructor"&&i!=="prototype");for(let i=0,a=s.length;i<a;i+=1){const u=s[i],d=Object.getOwnPropertyDescriptor(n,u);d!==void 0&&d.enumerable&&(bh(t[u])&&bh(n[u])?n[u].__swiper__?t[u]=n[u]:Ho(t[u],n[u]):!bh(t[u])&&bh(n[u])?(t[u]={},n[u].__swiper__?t[u]=n[u]:Ho(t[u],n[u])):t[u]=n[u])}}}return t}function Bu(e,t,r){e.style.setProperty(t,r)}function i4({swiper:e,targetPosition:t,side:r}){const n=xo(),s=-e.translate;let i=null,a;const u=e.params.speed;e.wrapperEl.style.scrollSnapType="none",n.cancelAnimationFrame(e.cssModeFrameID);const d=t>s?"next":"prev",h=(b,x)=>d==="next"&&b>=x||d==="prev"&&b<=x,m=()=>{a=new Date().getTime(),i===null&&(i=a);const b=Math.max(Math.min((a-i)/u,1),0),x=.5-Math.cos(b*Math.PI)/2;let v=s+x*(t-s);if(h(v,t)&&(v=t),e.wrapperEl.scrollTo({[r]:v}),h(v,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[r]:v})}),n.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=n.requestAnimationFrame(m)};m()}function bl(e,t=""){const r=xo(),n=[...e.children];return r.HTMLSlotElement&&e instanceof HTMLSlotElement&&n.push(...e.assignedElements()),t?n.filter(s=>s.matches(t)):n}function LC(e,t){const r=[t];for(;r.length>0;){const n=r.shift();if(e===n)return!0;r.push(...n.children,...n.shadowRoot?n.shadowRoot.children:[],...n.assignedElements?n.assignedElements():[])}}function EC(e,t){const r=xo();let n=t.contains(e);return!n&&r.HTMLSlotElement&&t instanceof HTMLSlotElement&&(n=[...t.assignedElements()].includes(e),n||(n=LC(e,t))),n}function Np(e){try{console.warn(e);return}catch{}}function x2(e,t=[]){const r=document.createElement(e);return r.classList.add(...Array.isArray(t)?t:TC(t)),r}function IC(e,t){const r=[];for(;e.previousElementSibling;){const n=e.previousElementSibling;t?n.matches(t)&&r.push(n):r.push(n),e=n}return r}function MC(e,t){const r=[];for(;e.nextElementSibling;){const n=e.nextElementSibling;t?n.matches(t)&&r.push(n):r.push(n),e=n}return r}function Jl(e,t){return xo().getComputedStyle(e,null).getPropertyValue(t)}function A5(e){let t=e,r;if(t){for(r=0;(t=t.previousSibling)!==null;)t.nodeType===1&&(r+=1);return r}}function RC(e,t){const r=[];let n=e.parentElement;for(;n;)r.push(n),n=n.parentElement;return r}function T5(e,t,r){const n=xo();return e[t==="width"?"offsetWidth":"offsetHeight"]+parseFloat(n.getComputedStyle(e,null).getPropertyValue(t==="width"?"margin-right":"margin-top"))+parseFloat(n.getComputedStyle(e,null).getPropertyValue(t==="width"?"margin-left":"margin-bottom"))}function S5(e,t=""){typeof trustedTypes<"u"?e.innerHTML=trustedTypes.createPolicy("html",{createHTML:r=>r}).createHTML(t):e.innerHTML=t}let Rg;function NC(){const e=xo(),t=eu();return{smoothScroll:t.documentElement&&t.documentElement.style&&"scrollBehavior"in t.documentElement.style,touch:!!("ontouchstart"in e||e.DocumentTouch&&t instanceof e.DocumentTouch)}}function o4(){return Rg||(Rg=NC()),Rg}let Ng;function DC({userAgent:e}={}){const t=o4(),r=xo(),n=r.navigator.platform,s=e||r.navigator.userAgent,i={ios:!1,android:!1},a=r.screen.width,u=r.screen.height,d=s.match(/(Android);?[\s\/]+([\d.]+)?/);let h=s.match(/(iPad)(?!\1).*OS\s([\d_]+)/);const m=s.match(/(iPod)(.*OS\s([\d_]+))?/),b=!h&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),x=n==="Win32";let v=n==="MacIntel";const A=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!h&&v&&t.touch&&A.indexOf(`${a}x${u}`)>=0&&(h=s.match(/(Version)\/([\d.]+)/),h||(h=[0,1,"13_0_0"]),v=!1),d&&!x&&(i.os="android",i.android=!0),(h||b||m)&&(i.os="ios",i.ios=!0),i}function a4(e={}){return Ng||(Ng=DC(e)),Ng}let Dg;function BC(){const e=xo(),t=a4();let r=!1;function n(){const u=e.navigator.userAgent.toLowerCase();return u.indexOf("safari")>=0&&u.indexOf("chrome")<0&&u.indexOf("android")<0}if(n()){const u=String(e.navigator.userAgent);if(u.includes("Version/")){const[d,h]=u.split("Version/")[1].split(" ")[0].split(".").map(m=>Number(m));r=d<16||d===16&&h<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent),i=n(),a=i||s&&t.ios;return{isSafari:r||i,needPerspectiveFix:r,need3dFix:a,isWebView:s}}function l4(){return Dg||(Dg=BC()),Dg}function PC({swiper:e,on:t,emit:r}){const n=xo();let s=null,i=null;const a=()=>{!e||e.destroyed||!e.initialized||(r("beforeResize"),r("resize"))},u=()=>{!e||e.destroyed||!e.initialized||(s=new ResizeObserver(m=>{i=n.requestAnimationFrame(()=>{const{width:b,height:x}=e;let v=b,A=x;m.forEach(({contentBoxSize:S,contentRect:k,target:L})=>{L&&L!==e.el||(v=k?k.width:(S[0]||S).inlineSize,A=k?k.height:(S[0]||S).blockSize)}),(v!==b||A!==x)&&a()})}),s.observe(e.el))},d=()=>{i&&n.cancelAnimationFrame(i),s&&s.unobserve&&e.el&&(s.unobserve(e.el),s=null)},h=()=>{!e||e.destroyed||!e.initialized||r("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof n.ResizeObserver<"u"){u();return}n.addEventListener("resize",a),n.addEventListener("orientationchange",h)}),t("destroy",()=>{d(),n.removeEventListener("resize",a),n.removeEventListener("orientationchange",h)})}function jC({swiper:e,extendParams:t,on:r,emit:n}){const s=[],i=xo(),a=(h,m={})=>{const b=i.MutationObserver||i.WebkitMutationObserver,x=new b(v=>{if(e.__preventObserver__)return;if(v.length===1){n("observerUpdate",v[0]);return}const A=function(){n("observerUpdate",v[0])};i.requestAnimationFrame?i.requestAnimationFrame(A):i.setTimeout(A,0)});x.observe(h,{attributes:typeof m.attributes>"u"?!0:m.attributes,childList:e.isElement||(typeof m.childList>"u"?!0:m).childList,characterData:typeof m.characterData>"u"?!0:m.characterData}),s.push(x)},u=()=>{if(e.params.observer){if(e.params.observeParents){const h=RC(e.hostEl);for(let m=0;m<h.length;m+=1)a(h[m])}a(e.hostEl,{childList:e.params.observeSlideChildren}),a(e.wrapperEl,{attributes:!1})}},d=()=>{s.forEach(h=>{h.disconnect()}),s.splice(0,s.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),r("init",u),r("destroy",d)}var FC={on(e,t,r){const n=this;if(!n.eventsListeners||n.destroyed||typeof t!="function")return n;const s=r?"unshift":"push";return e.split(" ").forEach(i=>{n.eventsListeners[i]||(n.eventsListeners[i]=[]),n.eventsListeners[i][s](t)}),n},once(e,t,r){const n=this;if(!n.eventsListeners||n.destroyed||typeof t!="function")return n;function s(...i){n.off(e,s),s.__emitterProxy&&delete s.__emitterProxy,t.apply(n,i)}return s.__emitterProxy=t,n.on(e,s,r)},onAny(e,t){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;const n=t?"unshift":"push";return r.eventsAnyListeners.indexOf(e)<0&&r.eventsAnyListeners[n](e),r},offAny(e){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsAnyListeners)return t;const r=t.eventsAnyListeners.indexOf(e);return r>=0&&t.eventsAnyListeners.splice(r,1),t},off(e,t){const r=this;return!r.eventsListeners||r.destroyed||!r.eventsListeners||e.split(" ").forEach(n=>{typeof t>"u"?r.eventsListeners[n]=[]:r.eventsListeners[n]&&r.eventsListeners[n].forEach((s,i)=>{(s===t||s.__emitterProxy&&s.__emitterProxy===t)&&r.eventsListeners[n].splice(i,1)})}),r},emit(...e){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsListeners)return t;let r,n,s;return typeof e[0]=="string"||Array.isArray(e[0])?(r=e[0],n=e.slice(1,e.length),s=t):(r=e[0].events,n=e[0].data,s=e[0].context||t),n.unshift(s),(Array.isArray(r)?r:r.split(" ")).forEach(a=>{t.eventsAnyListeners&&t.eventsAnyListeners.length&&t.eventsAnyListeners.forEach(u=>{u.apply(s,[a,...n])}),t.eventsListeners&&t.eventsListeners[a]&&t.eventsListeners[a].forEach(u=>{u.apply(s,n)})}),t}};function QC(){const e=this;let t,r;const n=e.el;typeof e.params.width<"u"&&e.params.width!==null?t=e.params.width:t=n.clientWidth,typeof e.params.height<"u"&&e.params.height!==null?r=e.params.height:r=n.clientHeight,!(t===0&&e.isHorizontal()||r===0&&e.isVertical())&&(t=t-parseInt(Jl(n,"padding-left")||0,10)-parseInt(Jl(n,"padding-right")||0,10),r=r-parseInt(Jl(n,"padding-top")||0,10)-parseInt(Jl(n,"padding-bottom")||0,10),Number.isNaN(t)&&(t=0),Number.isNaN(r)&&(r=0),Object.assign(e,{width:t,height:r,size:e.isHorizontal()?t:r}))}function OC(){const e=this;function t(z,V){return parseFloat(z.getPropertyValue(e.getDirectionLabel(V))||0)}const r=e.params,{wrapperEl:n,slidesEl:s,rtlTranslate:i,wrongRTL:a}=e,u=e.virtual&&r.virtual.enabled,d=u?e.virtual.slides.length:e.slides.length,h=bl(s,`.${e.params.slideClass}, swiper-slide`),m=u?e.virtual.slides.length:h.length;let b=[];const x=[],v=[];let A=r.slidesOffsetBefore;typeof A=="function"&&(A=r.slidesOffsetBefore.call(e));let S=r.slidesOffsetAfter;typeof S=="function"&&(S=r.slidesOffsetAfter.call(e));const k=e.snapGrid.length,L=e.slidesGrid.length,R=e.size-A-S;let B=r.spaceBetween,Q=-A,T=0,O=0;if(typeof R>"u")return;typeof B=="string"&&B.indexOf("%")>=0?B=parseFloat(B.replace("%",""))/100*R:typeof B=="string"&&(B=parseFloat(B)),e.virtualSize=-B-A-S,h.forEach(z=>{i?z.style.marginLeft="":z.style.marginRight="",z.style.marginBottom="",z.style.marginTop=""}),r.centeredSlides&&r.cssMode&&(Bu(n,"--swiper-centered-offset-before",""),Bu(n,"--swiper-centered-offset-after","")),r.cssMode&&(Bu(n,"--swiper-slides-offset-before",`${A}px`),Bu(n,"--swiper-slides-offset-after",`${S}px`));const I=r.grid&&r.grid.rows>1&&e.grid;I?e.grid.initSlides(h):e.grid&&e.grid.unsetSlides();let N;const U=r.slidesPerView==="auto"&&r.breakpoints&&Object.keys(r.breakpoints).filter(z=>typeof r.breakpoints[z].slidesPerView<"u").length>0;for(let z=0;z<m;z+=1){N=0;const V=h[z];if(!(V&&(I&&e.grid.updateSlide(z,V,h),Jl(V,"display")==="none"))){if(u&&r.slidesPerView==="auto")r.virtual.slidesPerViewAutoSlideSize&&(N=r.virtual.slidesPerViewAutoSlideSize),N&&V&&(r.roundLengths&&(N=Math.floor(N)),V.style[e.getDirectionLabel("width")]=`${N}px`);else if(r.slidesPerView==="auto"){U&&(V.style[e.getDirectionLabel("width")]="");const K=getComputedStyle(V),ne=V.style.transform,oe=V.style.webkitTransform;if(ne&&(V.style.transform="none"),oe&&(V.style.webkitTransform="none"),r.roundLengths)N=e.isHorizontal()?T5(V,"width"):T5(V,"height");else{const ye=t(K,"width"),Ce=t(K,"padding-left"),_e=t(K,"padding-right"),me=t(K,"margin-left"),le=t(K,"margin-right"),he=K.getPropertyValue("box-sizing");if(he&&he==="border-box")N=ye+me+le;else{const{clientWidth:Ke,offsetWidth:Je}=V;N=ye+Ce+_e+me+le+(Je-Ke)}}ne&&(V.style.transform=ne),oe&&(V.style.webkitTransform=oe),r.roundLengths&&(N=Math.floor(N))}else N=(R-(r.slidesPerView-1)*B)/r.slidesPerView,r.roundLengths&&(N=Math.floor(N)),V&&(V.style[e.getDirectionLabel("width")]=`${N}px`);V&&(V.swiperSlideSize=N),v.push(N),r.centeredSlides?(Q=Q+N/2+T/2+B,T===0&&z!==0&&(Q=Q-R/2-B),z===0&&(Q=Q-R/2-B),Math.abs(Q)<1/1e3&&(Q=0),r.roundLengths&&(Q=Math.floor(Q)),O%r.slidesPerGroup===0&&b.push(Q),x.push(Q)):(r.roundLengths&&(Q=Math.floor(Q)),(O-Math.min(e.params.slidesPerGroupSkip,O))%e.params.slidesPerGroup===0&&b.push(Q),x.push(Q),Q=Q+N+B),e.virtualSize+=N+B,T=N,O+=1}}if(e.virtualSize=Math.max(e.virtualSize,R)+S,i&&a&&(r.effect==="slide"||r.effect==="coverflow")&&(n.style.width=`${e.virtualSize+B}px`),r.setWrapperSize&&(n.style[e.getDirectionLabel("width")]=`${e.virtualSize+B}px`),I&&e.grid.updateWrapperSize(N,b),!r.centeredSlides){const z=r.slidesPerView!=="auto"&&r.slidesPerView%1!==0,V=r.snapToSlideEdge&&!r.loop&&(r.slidesPerView==="auto"||z);let K=b.length;if(V){let oe;if(r.slidesPerView==="auto"){oe=1;let ye=0;for(let Ce=v.length-1;Ce>=0&&(ye+=v[Ce]+(Ce<v.length-1?B:0),ye<=R);Ce-=1)oe=v.length-Ce}else oe=Math.floor(r.slidesPerView);K=Math.max(m-oe,0)}const ne=[];for(let oe=0;oe<b.length;oe+=1){let ye=b[oe];r.roundLengths&&(ye=Math.floor(ye)),V?oe<=K&&ne.push(ye):b[oe]<=e.virtualSize-R&&ne.push(ye)}b=ne,Math.floor(e.virtualSize-R)-Math.floor(b[b.length-1])>1&&(V||b.push(e.virtualSize-R))}if(u&&r.loop){const z=v[0]+B;if(r.slidesPerGroup>1){const V=Math.ceil((e.virtual.slidesBefore+e.virtual.slidesAfter)/r.slidesPerGroup),K=z*r.slidesPerGroup;for(let ne=0;ne<V;ne+=1)b.push(b[b.length-1]+K)}for(let V=0;V<e.virtual.slidesBefore+e.virtual.slidesAfter;V+=1)r.slidesPerGroup===1&&b.push(b[b.length-1]+z),x.push(x[x.length-1]+z),e.virtualSize+=z}if(b.length===0&&(b=[0]),B!==0){const z=e.isHorizontal()&&i?"marginLeft":e.getDirectionLabel("marginRight");h.filter((V,K)=>!r.cssMode||r.loop?!0:K!==h.length-1).forEach(V=>{V.style[z]=`${B}px`})}if(r.centeredSlides&&r.centeredSlidesBounds){let z=0;v.forEach(K=>{z+=K+(B||0)}),z-=B;const V=z>R?z-R:0;b=b.map(K=>K<=0?-A:K>V?V+S:K)}if(r.centerInsufficientSlides){let z=0;if(v.forEach(V=>{z+=V+(B||0)}),z-=B,z<R){const V=(R-z)/2;b.forEach((K,ne)=>{b[ne]=K-V}),x.forEach((K,ne)=>{x[ne]=K+V})}}if(Object.assign(e,{slides:h,snapGrid:b,slidesGrid:x,slidesSizesGrid:v}),r.centeredSlides&&r.cssMode&&!r.centeredSlidesBounds){Bu(n,"--swiper-centered-offset-before",`${-b[0]}px`),Bu(n,"--swiper-centered-offset-after",`${e.size/2-v[v.length-1]/2}px`);const z=-e.snapGrid[0],V=-e.slidesGrid[0];e.snapGrid=e.snapGrid.map(K=>K+z),e.slidesGrid=e.slidesGrid.map(K=>K+V)}if(m!==d&&e.emit("slidesLengthChange"),b.length!==k&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),x.length!==L&&e.emit("slidesGridLengthChange"),r.watchSlidesProgress&&e.updateSlidesOffset(),e.emit("slidesUpdated"),!u&&!r.cssMode&&(r.effect==="slide"||r.effect==="fade")){const z=`${r.containerModifierClass}backface-hidden`,V=e.el.classList.contains(z);m<=r.maxBackfaceHiddenSlides?V||e.el.classList.add(z):V&&e.el.classList.remove(z)}}function $C(e){const t=this,r=[],n=t.virtual&&t.params.virtual.enabled;let s=0,i;typeof e=="number"?t.setTransition(e):e===!0&&t.setTransition(t.params.speed);const a=u=>n?t.slides[t.getSlideIndexByData(u)]:t.slides[u];if(t.params.slidesPerView!=="auto"&&t.params.slidesPerView>1)if(t.params.centeredSlides)(t.visibleSlides||[]).forEach(u=>{r.push(u)});else for(i=0;i<Math.ceil(t.params.slidesPerView);i+=1){const u=t.activeIndex+i;if(u>t.slides.length&&!n)break;r.push(a(u))}else r.push(a(t.activeIndex));for(i=0;i<r.length;i+=1)if(typeof r[i]<"u"){const u=r[i].offsetHeight;s=u>s?u:s}(s||s===0)&&(t.wrapperEl.style.height=`${s}px`)}function HC(){const e=this,t=e.slides,r=e.isElement?e.isHorizontal()?e.wrapperEl.offsetLeft:e.wrapperEl.offsetTop:0;for(let n=0;n<t.length;n+=1)t[n].swiperSlideOffset=(e.isHorizontal()?t[n].offsetLeft:t[n].offsetTop)-r-e.cssOverflowAdjustment()}const C5=(e,t,r)=>{t&&!e.classList.contains(r)?e.classList.add(r):!t&&e.classList.contains(r)&&e.classList.remove(r)};function UC(e=this&&this.translate||0){const t=this,r=t.params,{slides:n,rtlTranslate:s,snapGrid:i}=t;if(n.length===0)return;typeof n[0].swiperSlideOffset>"u"&&t.updateSlidesOffset();let a=-e;s&&(a=e),t.visibleSlidesIndexes=[],t.visibleSlides=[];let u=r.spaceBetween;typeof u=="string"&&u.indexOf("%")>=0?u=parseFloat(u.replace("%",""))/100*t.size:typeof u=="string"&&(u=parseFloat(u));for(let d=0;d<n.length;d+=1){const h=n[d];let m=h.swiperSlideOffset;r.cssMode&&r.centeredSlides&&(m-=n[0].swiperSlideOffset);const b=(a+(r.centeredSlides?t.minTranslate():0)-m)/(h.swiperSlideSize+u),x=(a-i[0]+(r.centeredSlides?t.minTranslate():0)-m)/(h.swiperSlideSize+u),v=-(a-m),A=v+t.slidesSizesGrid[d],S=v>=0&&v<=t.size-t.slidesSizesGrid[d],k=v>=0&&v<t.size-1||A>1&&A<=t.size||v<=0&&A>=t.size;k&&(t.visibleSlides.push(h),t.visibleSlidesIndexes.push(d)),C5(h,k,r.slideVisibleClass),C5(h,S,r.slideFullyVisibleClass),h.progress=s?-b:b,h.originalProgress=s?-x:x}}function zC(e){const t=this;if(typeof e>"u"){const m=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*m||0}const r=t.params,n=t.maxTranslate()-t.minTranslate();let{progress:s,isBeginning:i,isEnd:a,progressLoop:u}=t;const d=i,h=a;if(n===0)s=0,i=!0,a=!0;else{s=(e-t.minTranslate())/n;const m=Math.abs(e-t.minTranslate())<1,b=Math.abs(e-t.maxTranslate())<1;i=m||s<=0,a=b||s>=1,m&&(s=0),b&&(s=1)}if(r.loop){const m=t.getSlideIndexByData(0),b=t.getSlideIndexByData(t.slides.length-1),x=t.slidesGrid[m],v=t.slidesGrid[b],A=t.slidesGrid[t.slidesGrid.length-1],S=Math.abs(e);S>=x?u=(S-x)/A:u=(S+A-v)/A,u>1&&(u-=1)}Object.assign(t,{progress:s,progressLoop:u,isBeginning:i,isEnd:a}),(r.watchSlidesProgress||r.centeredSlides&&r.autoHeight)&&t.updateSlidesProgress(e),i&&!d&&t.emit("reachBeginning toEdge"),a&&!h&&t.emit("reachEnd toEdge"),(d&&!i||h&&!a)&&t.emit("fromEdge"),t.emit("progress",s)}const Bg=(e,t,r)=>{t&&!e.classList.contains(r)?e.classList.add(r):!t&&e.classList.contains(r)&&e.classList.remove(r)};function GC(){const e=this,{slides:t,params:r,slidesEl:n,activeIndex:s}=e,i=e.virtual&&r.virtual.enabled,a=e.grid&&r.grid&&r.grid.rows>1,u=b=>bl(n,`.${r.slideClass}${b}, swiper-slide${b}`)[0];let d,h,m;if(i)if(r.loop){let b=s-e.virtual.slidesBefore;b<0&&(b=e.virtual.slides.length+b),b>=e.virtual.slides.length&&(b-=e.virtual.slides.length),d=u(`[data-swiper-slide-index="${b}"]`)}else d=u(`[data-swiper-slide-index="${s}"]`);else a?(d=t.find(b=>b.column===s),m=t.find(b=>b.column===s+1),h=t.find(b=>b.column===s-1)):d=t[s];d&&(a||(m=MC(d,`.${r.slideClass}, swiper-slide`)[0],r.loop&&!m&&(m=t[0]),h=IC(d,`.${r.slideClass}, swiper-slide`)[0],r.loop&&!h===0&&(h=t[t.length-1]))),t.forEach(b=>{Bg(b,b===d,r.slideActiveClass),Bg(b,b===m,r.slideNextClass),Bg(b,b===h,r.slidePrevClass)}),e.emitSlidesClasses()}const lp=(e,t)=>{if(!e||e.destroyed||!e.params)return;const r=()=>e.isElement?"swiper-slide":`.${e.params.slideClass}`,n=t.closest(r());if(n){let s=n.querySelector(`.${e.params.lazyPreloaderClass}`);!s&&e.isElement&&(n.shadowRoot?s=n.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{n.shadowRoot&&(s=n.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`),s&&!s.lazyPreloaderManaged&&s.remove())})),s&&!s.lazyPreloaderManaged&&s.remove()}},Pg=(e,t)=>{if(!e.slides[t])return;const r=e.slides[t].querySelector('[loading="lazy"]');r&&r.removeAttribute("loading")},y2=e=>{if(!e||e.destroyed||!e.params)return;let t=e.params.lazyPreloadPrevNext;const r=e.slides.length;if(!r||!t||t<0)return;t=Math.min(t,r);const n=e.params.slidesPerView==="auto"?e.slidesPerViewDynamic():Math.ceil(e.params.slidesPerView),s=e.activeIndex;if(e.params.grid&&e.params.grid.rows>1){const a=s,u=[a-t];u.push(...Array.from({length:t}).map((d,h)=>a+n+h)),e.slides.forEach((d,h)=>{u.includes(d.column)&&Pg(e,h)});return}const i=s+n-1;if(e.params.rewind||e.params.loop)for(let a=s-t;a<=i+t;a+=1){const u=(a%r+r)%r;(u<s||u>i)&&Pg(e,u)}else for(let a=Math.max(s-t,0);a<=Math.min(i+t,r-1);a+=1)a!==s&&(a>i||a<s)&&Pg(e,a)};function WC(e){const{slidesGrid:t,params:r}=e,n=e.rtlTranslate?e.translate:-e.translate;let s;for(let i=0;i<t.length;i+=1)typeof t[i+1]<"u"?n>=t[i]&&n<t[i+1]-(t[i+1]-t[i])/2?s=i:n>=t[i]&&n<t[i+1]&&(s=i+1):n>=t[i]&&(s=i);return r.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function VC(e){const t=this,r=t.rtlTranslate?t.translate:-t.translate,{snapGrid:n,params:s,activeIndex:i,realIndex:a,snapIndex:u}=t;let d=e,h;const m=v=>{let A=v-t.virtual.slidesBefore;return A<0&&(A=t.virtual.slides.length+A),A>=t.virtual.slides.length&&(A-=t.virtual.slides.length),A};if(typeof d>"u"&&(d=WC(t)),n.indexOf(r)>=0)h=n.indexOf(r);else{const v=Math.min(s.slidesPerGroupSkip,d);h=v+Math.floor((d-v)/s.slidesPerGroup)}if(h>=n.length&&(h=n.length-1),d===i&&!t.params.loop){h!==u&&(t.snapIndex=h,t.emit("snapIndexChange"));return}if(d===i&&t.params.loop&&t.virtual&&t.params.virtual.enabled){t.realIndex=m(d);return}const b=t.grid&&s.grid&&s.grid.rows>1;let x;if(t.virtual&&s.virtual.enabled)s.loop?x=m(d):x=d;else if(b){const v=t.slides.find(S=>S.column===d);let A=parseInt(v.getAttribute("data-swiper-slide-index"),10);Number.isNaN(A)&&(A=Math.max(t.slides.indexOf(v),0)),x=Math.floor(A/s.grid.rows)}else if(t.slides[d]){const v=t.slides[d].getAttribute("data-swiper-slide-index");v?x=parseInt(v,10):x=d}else x=d;Object.assign(t,{previousSnapIndex:u,snapIndex:h,previousRealIndex:a,realIndex:x,previousIndex:i,activeIndex:d}),t.initialized&&y2(t),t.emit("activeIndexChange"),t.emit("snapIndexChange"),(t.initialized||t.params.runCallbacksOnInit)&&(a!==x&&t.emit("realIndexChange"),t.emit("slideChange"))}function qC(e,t){const r=this,n=r.params;let s=e.closest(`.${n.slideClass}, swiper-slide`);!s&&r.isElement&&t&&t.length>1&&t.includes(e)&&[...t.slice(t.indexOf(e)+1,t.length)].forEach(u=>{!s&&u.matches&&u.matches(`.${n.slideClass}, swiper-slide`)&&(s=u)});let i=!1,a;if(s){for(let u=0;u<r.slides.length;u+=1)if(r.slides[u]===s){i=!0,a=u;break}}if(s&&i)r.clickedSlide=s,r.virtual&&r.params.virtual.enabled?r.clickedIndex=parseInt(s.getAttribute("data-swiper-slide-index"),10):r.clickedIndex=a;else{r.clickedSlide=void 0,r.clickedIndex=void 0;return}n.slideToClickedSlide&&r.clickedIndex!==void 0&&r.clickedIndex!==r.activeIndex&&r.slideToClickedSlide()}var YC={updateSize:QC,updateSlides:OC,updateAutoHeight:$C,updateSlidesOffset:HC,updateSlidesProgress:UC,updateProgress:zC,updateSlidesClasses:GC,updateActiveIndex:VC,updateClickedSlide:qC};function KC(e=this.isHorizontal()?"x":"y"){const t=this,{params:r,rtlTranslate:n,translate:s,wrapperEl:i}=t;if(r.virtualTranslate)return n?-s:s;if(r.cssMode)return s;let a=_C(i,e);return a+=t.cssOverflowAdjustment(),n&&(a=-a),a||0}function ZC(e,t){const r=this,{rtlTranslate:n,params:s,wrapperEl:i,progress:a}=r;let u=0,d=0;const h=0;r.isHorizontal()?u=n?-e:e:d=e,s.roundLengths&&(u=Math.floor(u),d=Math.floor(d)),r.previousTranslate=r.translate,r.translate=r.isHorizontal()?u:d,s.cssMode?i[r.isHorizontal()?"scrollLeft":"scrollTop"]=r.isHorizontal()?-u:-d:s.virtualTranslate||(r.isHorizontal()?u-=r.cssOverflowAdjustment():d-=r.cssOverflowAdjustment(),i.style.transform=`translate3d(${u}px, ${d}px, ${h}px)`);let m;const b=r.maxTranslate()-r.minTranslate();b===0?m=0:m=(e-r.minTranslate())/b,m!==a&&r.updateProgress(e),r.emit("setTranslate",r.translate,t)}function XC(){return-this.snapGrid[0]}function JC(){return-this.snapGrid[this.snapGrid.length-1]}function e_(e=0,t=this.params.speed,r=!0,n=!0,s){const i=this,{params:a,wrapperEl:u}=i;if(i.animating&&a.preventInteractionOnTransition)return!1;const d=i.minTranslate(),h=i.maxTranslate();let m;if(n&&e>d?m=d:n&&e<h?m=h:m=e,i.updateProgress(m),a.cssMode){const b=i.isHorizontal();if(t===0)u[b?"scrollLeft":"scrollTop"]=-m;else{if(!i.support.smoothScroll)return i4({swiper:i,targetPosition:-m,side:b?"left":"top"}),!0;u.scrollTo({[b?"left":"top"]:-m,behavior:"smooth"})}return!0}return t===0?(i.setTransition(0),i.setTranslate(m),r&&(i.emit("beforeTransitionStart",t,s),i.emit("transitionEnd"))):(i.setTransition(t),i.setTranslate(m),r&&(i.emit("beforeTransitionStart",t,s),i.emit("transitionStart")),i.animating||(i.animating=!0,i.onTranslateToWrapperTransitionEnd||(i.onTranslateToWrapperTransitionEnd=function(x){!i||i.destroyed||x.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onTranslateToWrapperTransitionEnd),i.onTranslateToWrapperTransitionEnd=null,delete i.onTranslateToWrapperTransitionEnd,i.animating=!1,r&&i.emit("transitionEnd"))}),i.wrapperEl.addEventListener("transitionend",i.onTranslateToWrapperTransitionEnd))),!0}var t_={getTranslate:KC,setTranslate:ZC,minTranslate:XC,maxTranslate:JC,translateTo:e_};function r_(e,t){const r=this;r.params.cssMode||(r.wrapperEl.style.transitionDuration=`${e}ms`,r.wrapperEl.style.transitionDelay=e===0?"0ms":""),r.emit("setTransition",e,t)}function c4({swiper:e,runCallbacks:t,direction:r,step:n}){const{activeIndex:s,previousIndex:i}=e;let a=r;a||(s>i?a="next":s<i?a="prev":a="reset"),e.emit(`transition${n}`),t&&a==="reset"?e.emit(`slideResetTransition${n}`):t&&s!==i&&(e.emit(`slideChangeTransition${n}`),a==="next"?e.emit(`slideNextTransition${n}`):e.emit(`slidePrevTransition${n}`))}function n_(e=!0,t){const r=this,{params:n}=r;n.cssMode||(n.autoHeight&&r.updateAutoHeight(),c4({swiper:r,runCallbacks:e,direction:t,step:"Start"}))}function s_(e=!0,t){const r=this,{params:n}=r;r.animating=!1,!n.cssMode&&(r.setTransition(0),c4({swiper:r,runCallbacks:e,direction:t,step:"End"}))}var i_={setTransition:r_,transitionStart:n_,transitionEnd:s_};function o_(e=0,t,r=!0,n,s){typeof e=="string"&&(e=parseInt(e,10));const i=this;let a=e;a<0&&(a=0);const{params:u,snapGrid:d,slidesGrid:h,previousIndex:m,activeIndex:b,rtlTranslate:x,wrapperEl:v,enabled:A}=i;if(!A&&!n&&!s||i.destroyed||i.animating&&u.preventInteractionOnTransition)return!1;typeof t>"u"&&(t=i.params.speed);const S=Math.min(i.params.slidesPerGroupSkip,a);let k=S+Math.floor((a-S)/i.params.slidesPerGroup);k>=d.length&&(k=d.length-1);const L=-d[k];if(u.normalizeSlideIndex)for(let I=0;I<h.length;I+=1){const N=-Math.floor(L*100),U=Math.floor(h[I]*100),z=Math.floor(h[I+1]*100);typeof h[I+1]<"u"?N>=U&&N<z-(z-U)/2?a=I:N>=U&&N<z&&(a=I+1):N>=U&&(a=I)}if(i.initialized&&a!==b&&(!i.allowSlideNext&&(x?L>i.translate&&L>i.minTranslate():L<i.translate&&L<i.minTranslate())||!i.allowSlidePrev&&L>i.translate&&L>i.maxTranslate()&&(b||0)!==a))return!1;a!==(m||0)&&r&&i.emit("beforeSlideChangeStart"),i.updateProgress(L);let R;a>b?R="next":a<b?R="prev":R="reset";const B=i.virtual&&i.params.virtual.enabled;if(!(B&&s)&&(x&&-L===i.translate||!x&&L===i.translate))return i.updateActiveIndex(a),u.autoHeight&&i.updateAutoHeight(),i.updateSlidesClasses(),u.effect!=="slide"&&i.setTranslate(L),R!=="reset"&&(i.transitionStart(r,R),i.transitionEnd(r,R)),!1;if(u.cssMode){const I=i.isHorizontal(),N=x?L:-L;if(t===0)B&&(i.wrapperEl.style.scrollSnapType="none",i._immediateVirtual=!0),B&&!i._cssModeVirtualInitialSet&&i.params.initialSlide>0?(i._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{v[I?"scrollLeft":"scrollTop"]=N})):v[I?"scrollLeft":"scrollTop"]=N,B&&requestAnimationFrame(()=>{i.wrapperEl.style.scrollSnapType="",i._immediateVirtual=!1});else{if(!i.support.smoothScroll)return i4({swiper:i,targetPosition:N,side:I?"left":"top"}),!0;v.scrollTo({[I?"left":"top"]:N,behavior:"smooth"})}return!0}const O=l4().isSafari;return B&&!s&&O&&i.isElement&&i.virtual.update(!1,!1,a),i.setTransition(t),i.setTranslate(L),i.updateActiveIndex(a),i.updateSlidesClasses(),i.emit("beforeTransitionStart",t,n),i.transitionStart(r,R),t===0?i.transitionEnd(r,R):i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(N){!i||i.destroyed||N.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(r,R))}),i.wrapperEl.addEventListener("transitionend",i.onSlideToWrapperTransitionEnd)),!0}function a_(e=0,t,r=!0,n){typeof e=="string"&&(e=parseInt(e,10));const s=this;if(s.destroyed)return;typeof t>"u"&&(t=s.params.speed);const i=s.grid&&s.params.grid&&s.params.grid.rows>1;let a=e;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)a=a+s.virtual.slidesBefore;else{let u;if(i){const S=a*s.params.grid.rows;u=s.slides.find(k=>k.getAttribute("data-swiper-slide-index")*1===S).column}else u=s.getSlideIndexByData(a);const d=i?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:h,slidesOffsetBefore:m,slidesOffsetAfter:b}=s.params,x=h||!!m||!!b;let v=s.params.slidesPerView;v==="auto"?v=s.slidesPerViewDynamic():(v=Math.ceil(parseFloat(s.params.slidesPerView,10)),x&&v%2===0&&(v=v+1));let A=d-u<v;if(x&&(A=A||u<Math.ceil(v/2)),n&&x&&s.params.slidesPerView!=="auto"&&!i&&(A=!1),A){const S=x?u<s.activeIndex?"prev":"next":u-s.activeIndex-1<s.params.slidesPerView?"next":"prev";s.loopFix({direction:S,slideTo:!0,activeSlideIndex:S==="next"?u+1:u-d+1,slideRealIndex:S==="next"?s.realIndex:void 0})}if(i){const S=a*s.params.grid.rows;a=s.slides.find(k=>k.getAttribute("data-swiper-slide-index")*1===S).column}else a=s.getSlideIndexByData(a)}return requestAnimationFrame(()=>{s.slideTo(a,t,r,n)}),s}function l_(e,t=!0,r){const n=this,{enabled:s,params:i,animating:a}=n;if(!s||n.destroyed)return n;typeof e>"u"&&(e=n.params.speed);let u=i.slidesPerGroup;i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(u=Math.max(n.slidesPerViewDynamic("current",!0),1));const d=n.activeIndex<i.slidesPerGroupSkip?1:u,h=n.virtual&&i.virtual.enabled;if(i.loop){if(a&&!h&&i.loopPreventsSliding)return!1;if(n.loopFix({direction:"next"}),n._clientLeft=n.wrapperEl.clientLeft,n.activeIndex===n.slides.length-1&&i.cssMode)return requestAnimationFrame(()=>{n.slideTo(n.activeIndex+d,e,t,r)}),!0}return i.rewind&&n.isEnd?n.slideTo(0,e,t,r):n.slideTo(n.activeIndex+d,e,t,r)}function c_(e,t=!0,r){const n=this,{params:s,snapGrid:i,slidesGrid:a,rtlTranslate:u,enabled:d,animating:h}=n;if(!d||n.destroyed)return n;typeof e>"u"&&(e=n.params.speed);const m=n.virtual&&s.virtual.enabled;if(s.loop){if(h&&!m&&s.loopPreventsSliding)return!1;n.loopFix({direction:"prev"}),n._clientLeft=n.wrapperEl.clientLeft}const b=u?n.translate:-n.translate;function x(R){return R<0?-Math.floor(Math.abs(R)):Math.floor(R)}const v=x(b),A=i.map(R=>x(R)),S=s.freeMode&&s.freeMode.enabled;let k=i[A.indexOf(v)-1];if(typeof k>"u"&&(s.cssMode||S)){let R;i.forEach((B,Q)=>{v>=B&&(R=Q)}),typeof R<"u"&&(k=S?i[R]:i[R>0?R-1:R])}let L=0;if(typeof k<"u"&&(L=a.indexOf(k),L<0&&(L=n.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(L=L-n.slidesPerViewDynamic("previous",!0)+1,L=Math.max(L,0))),s.rewind&&n.isBeginning){const R=n.params.virtual&&n.params.virtual.enabled&&n.virtual?n.virtual.slides.length-1:n.slides.length-1;return n.slideTo(R,e,t,r)}else if(s.loop&&n.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{n.slideTo(L,e,t,r)}),!0;return n.slideTo(L,e,t,r)}function u_(e,t=!0,r){const n=this;if(!n.destroyed)return typeof e>"u"&&(e=n.params.speed),n.slideTo(n.activeIndex,e,t,r)}function d_(e,t=!0,r,n=.5){const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);let i=s.activeIndex;const a=Math.min(s.params.slidesPerGroupSkip,i),u=a+Math.floor((i-a)/s.params.slidesPerGroup),d=s.rtlTranslate?s.translate:-s.translate;if(d>=s.snapGrid[u]){const h=s.snapGrid[u],m=s.snapGrid[u+1];d-h>(m-h)*n&&(i+=s.params.slidesPerGroup)}else{const h=s.snapGrid[u-1],m=s.snapGrid[u];d-h<=(m-h)*n&&(i-=s.params.slidesPerGroup)}return i=Math.max(i,0),i=Math.min(i,s.slidesGrid.length-1),s.slideTo(i,e,t,r)}function f_(){const e=this;if(e.destroyed)return;const{params:t,slidesEl:r}=e,n=t.slidesPerView==="auto"?e.slidesPerViewDynamic():t.slidesPerView;let s=e.getSlideIndexWhenGrid(e.clickedIndex),i;const a=e.isElement?"swiper-slide":`.${t.slideClass}`,u=e.grid&&e.params.grid&&e.params.grid.rows>1;if(t.loop){if(e.animating)return;i=parseInt(e.clickedSlide.getAttribute("data-swiper-slide-index"),10),t.centeredSlides?e.slideToLoop(i):s>(u?(e.slides.length-n)/2-(e.params.grid.rows-1):e.slides.length-n)?(e.loopFix(),s=e.getSlideIndex(bl(r,`${a}[data-swiper-slide-index="${i}"]`)[0]),s4(()=>{e.slideTo(s)})):e.slideTo(s)}else e.slideTo(s)}var h_={slideTo:o_,slideToLoop:a_,slideNext:l_,slidePrev:c_,slideReset:u_,slideToClosest:d_,slideToClickedSlide:f_};function p_(e,t){const r=this,{params:n,slidesEl:s}=r;if(!n.loop||r.virtual&&r.params.virtual.enabled)return;const i=()=>{bl(s,`.${n.slideClass}, swiper-slide`).forEach((A,S)=>{A.setAttribute("data-swiper-slide-index",S)})},a=()=>{const v=bl(s,`.${n.slideBlankClass}`);v.forEach(A=>{A.remove()}),v.length>0&&(r.recalcSlides(),r.updateSlides())},u=r.grid&&n.grid&&n.grid.rows>1;n.loopAddBlankSlides&&(n.slidesPerGroup>1||u)&&a();const d=n.slidesPerGroup*(u?n.grid.rows:1),h=r.slides.length%d!==0,m=u&&r.slides.length%n.grid.rows!==0,b=v=>{for(let A=0;A<v;A+=1){const S=r.isElement?x2("swiper-slide",[n.slideBlankClass]):x2("div",[n.slideClass,n.slideBlankClass]);r.slidesEl.append(S)}};if(h){if(n.loopAddBlankSlides){const v=d-r.slides.length%d;b(v),r.recalcSlides(),r.updateSlides()}else Np("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");i()}else if(m){if(n.loopAddBlankSlides){const v=n.grid.rows-r.slides.length%n.grid.rows;b(v),r.recalcSlides(),r.updateSlides()}else Np("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)");i()}else i();const x=n.centeredSlides||!!n.slidesOffsetBefore||!!n.slidesOffsetAfter;r.loopFix({slideRealIndex:e,direction:x?void 0:"next",initial:t})}function m_({slideRealIndex:e,slideTo:t=!0,direction:r,setTranslate:n,activeSlideIndex:s,initial:i,byController:a,byMousewheel:u}={}){const d=this;if(!d.params.loop)return;d.emit("beforeLoopFix");const{slides:h,allowSlidePrev:m,allowSlideNext:b,slidesEl:x,params:v}=d,{centeredSlides:A,slidesOffsetBefore:S,slidesOffsetAfter:k,initialSlide:L}=v,R=A||!!S||!!k;if(d.allowSlidePrev=!0,d.allowSlideNext=!0,d.virtual&&v.virtual.enabled){t&&(!R&&d.snapIndex===0?d.slideTo(d.virtual.slides.length,0,!1,!0):R&&d.snapIndex<v.slidesPerView?d.slideTo(d.virtual.slides.length+d.snapIndex,0,!1,!0):d.snapIndex===d.snapGrid.length-1&&d.slideTo(d.virtual.slidesBefore,0,!1,!0)),d.allowSlidePrev=m,d.allowSlideNext=b,d.emit("loopFix");return}let B=v.slidesPerView;B==="auto"?B=d.slidesPerViewDynamic():(B=Math.ceil(parseFloat(v.slidesPerView,10)),R&&B%2===0&&(B=B+1));const Q=v.slidesPerGroupAuto?B:v.slidesPerGroup;let T=R?Math.max(Q,Math.ceil(B/2)):Q;T%Q!==0&&(T+=Q-T%Q),T+=v.loopAdditionalSlides,d.loopedSlides=T;const O=d.grid&&v.grid&&v.grid.rows>1;h.length<B+T||d.params.effect==="cards"&&h.length<B+T*2?Np("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):O&&v.grid.fill==="row"&&Np("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const I=[],N=[],U=O?Math.ceil(h.length/v.grid.rows):h.length,z=i&&U-L<B&&!R;let V=z?L:d.activeIndex;typeof s>"u"?s=d.getSlideIndex(h.find(me=>me.classList.contains(v.slideActiveClass))):V=s;const K=r==="next"||!r,ne=r==="prev"||!r;let oe=0,ye=0;const _e=(O?h[s].column:s)+(R&&typeof n>"u"?-B/2+.5:0);if(_e<T){oe=Math.max(T-_e,Q);for(let me=0;me<T-_e;me+=1){const le=me-Math.floor(me/U)*U;if(O){const he=U-le-1;for(let Ke=h.length-1;Ke>=0;Ke-=1)h[Ke].column===he&&I.push(Ke)}else I.push(U-le-1)}}else if(_e+B>U-T){ye=Math.max(_e-(U-T*2),Q),z&&(ye=Math.max(ye,B-U+L+1));for(let me=0;me<ye;me+=1){const le=me-Math.floor(me/U)*U;O?h.forEach((he,Ke)=>{he.column===le&&N.push(Ke)}):N.push(le)}}if(d.__preventObserver__=!0,requestAnimationFrame(()=>{d.__preventObserver__=!1}),d.params.effect==="cards"&&h.length<B+T*2&&(N.includes(s)&&N.splice(N.indexOf(s),1),I.includes(s)&&I.splice(I.indexOf(s),1)),ne&&I.forEach(me=>{h[me].swiperLoopMoveDOM=!0,x.prepend(h[me]),h[me].swiperLoopMoveDOM=!1}),K&&N.forEach(me=>{h[me].swiperLoopMoveDOM=!0,x.append(h[me]),h[me].swiperLoopMoveDOM=!1}),d.recalcSlides(),v.slidesPerView==="auto"?d.updateSlides():O&&(I.length>0&&ne||N.length>0&&K)&&d.slides.forEach((me,le)=>{d.grid.updateSlide(le,me,d.slides)}),v.watchSlidesProgress&&d.updateSlidesOffset(),t){if(I.length>0&&ne){if(typeof e>"u"){const me=d.slidesGrid[V],he=d.slidesGrid[V+oe]-me;u?d.setTranslate(d.translate-he):(d.slideTo(V+Math.ceil(oe),0,!1,!0),n&&(d.touchEventsData.startTranslate=d.touchEventsData.startTranslate-he,d.touchEventsData.currentTranslate=d.touchEventsData.currentTranslate-he))}else if(n){const me=O?I.length/v.grid.rows:I.length;d.slideTo(d.activeIndex+me,0,!1,!0),d.touchEventsData.currentTranslate=d.translate}}else if(N.length>0&&K)if(typeof e>"u"){const me=d.slidesGrid[V],he=d.slidesGrid[V-ye]-me;u?d.setTranslate(d.translate-he):(d.slideTo(V-ye,0,!1,!0),n&&(d.touchEventsData.startTranslate=d.touchEventsData.startTranslate-he,d.touchEventsData.currentTranslate=d.touchEventsData.currentTranslate-he))}else{const me=O?N.length/v.grid.rows:N.length;d.slideTo(d.activeIndex-me,0,!1,!0)}}if(d.allowSlidePrev=m,d.allowSlideNext=b,d.controller&&d.controller.control&&!a){const me={slideRealIndex:e,direction:r,setTranslate:n,activeSlideIndex:s,byController:!0};Array.isArray(d.controller.control)?d.controller.control.forEach(le=>{!le.destroyed&&le.params.loop&&le.loopFix({...me,slideTo:le.params.slidesPerView===v.slidesPerView?t:!1})}):d.controller.control instanceof d.constructor&&d.controller.control.params.loop&&d.controller.control.loopFix({...me,slideTo:d.controller.control.params.slidesPerView===v.slidesPerView?t:!1})}d.emit("loopFix")}function g_(){const e=this,{params:t,slidesEl:r}=e;if(!t.loop||!r||e.virtual&&e.params.virtual.enabled)return;e.recalcSlides();const n=[];e.slides.forEach(s=>{const i=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;n[i]=s}),e.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),n.forEach(s=>{r.append(s)}),e.recalcSlides(),e.slideTo(e.realIndex,0)}var b_={loopCreate:p_,loopFix:m_,loopDestroy:g_};function x_(e){const t=this;if(!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)return;const r=t.params.touchEventsTarget==="container"?t.el:t.wrapperEl;t.isElement&&(t.__preventObserver__=!0),r.style.cursor="move",r.style.cursor=e?"grabbing":"grab",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1})}function y_(){const e=this;e.params.watchOverflow&&e.isLocked||e.params.cssMode||(e.isElement&&(e.__preventObserver__=!0),e[e.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1}))}var v_={setGrabCursor:x_,unsetGrabCursor:y_};function w_(e,t=this){function r(n){if(!n||n===eu()||n===xo())return null;n.assignedSlot&&(n=n.assignedSlot);const s=n.closest(e);return!s&&!n.getRootNode?null:s||r(n.getRootNode().host)}return r(t)}function _5(e,t,r){const n=xo(),{params:s}=e,i=s.edgeSwipeDetection,a=s.edgeSwipeThreshold;return i&&(r<=a||r>=n.innerWidth-a)?i==="prevent"?(t.preventDefault(),!0):!1:!0}function A_(e){const t=this;if(t.destroyed)return;const r=eu();let n=e;n.originalEvent&&(n=n.originalEvent);const s=t.touchEventsData;if(n.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==n.pointerId)return;s.pointerId=n.pointerId}else n.type==="touchstart"&&n.targetTouches.length===1&&(s.touchId=n.targetTouches[0].identifier);if(n.type==="touchstart"){_5(t,n,n.targetTouches[0].pageX);return}const{params:i,touches:a,enabled:u}=t;if(!u||!i.simulateTouch&&n.pointerType==="mouse"||t.animating&&i.preventInteractionOnTransition)return;!t.animating&&i.cssMode&&i.loop&&t.loopFix();let d=n.target;if(i.touchEventsTarget==="wrapper"&&!EC(d,t.wrapperEl)||"which"in n&&n.which===3||"button"in n&&n.button>0||s.isTouched&&s.isMoved)return;const h=!!i.noSwipingClass&&i.noSwipingClass!=="",m=n.composedPath?n.composedPath():n.path;h&&n.target&&n.target.shadowRoot&&m&&(d=m[0]);const b=i.noSwipingSelector?i.noSwipingSelector:`.${i.noSwipingClass}`,x=!!(n.target&&n.target.shadowRoot);if(i.noSwiping&&(x?w_(b,d):d.closest(b))){t.allowClick=!0;return}if(i.swipeHandler&&!d.closest(i.swipeHandler))return;a.currentX=n.pageX,a.currentY=n.pageY;const v=a.currentX,A=a.currentY;if(!_5(t,n,v))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=v,a.startY=A,s.touchStartTime=Rp(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,i.threshold>0&&(s.allowThresholdMove=!1);let S=!0;d.matches(s.focusableElements)&&(S=!1,d.nodeName==="SELECT"&&(s.isTouched=!1)),r.activeElement&&r.activeElement.matches(s.focusableElements)&&r.activeElement!==d&&(n.pointerType==="mouse"||n.pointerType!=="mouse"&&!d.matches(s.focusableElements))&&r.activeElement.blur();const k=S&&t.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||k)&&!d.isContentEditable&&n.preventDefault(),i.freeMode&&i.freeMode.enabled&&t.freeMode&&t.animating&&!i.cssMode&&t.freeMode.onTouchStart(),t.emit("touchStart",n)}function T_(e){const t=eu(),r=this;if(r.destroyed)return;const n=r.touchEventsData,{params:s,touches:i,rtlTranslate:a,enabled:u}=r;if(!u||!s.simulateTouch&&e.pointerType==="mouse")return;let d=e;if(d.originalEvent&&(d=d.originalEvent),d.type==="pointermove"&&(n.touchId!==null||d.pointerId!==n.pointerId))return;let h;if(d.type==="touchmove"){if(h=[...d.changedTouches].find(T=>T.identifier===n.touchId),!h||h.identifier!==n.touchId)return}else h=d;if(!n.isTouched){n.startMoving&&n.isScrolling&&r.emit("touchMoveOpposite",d);return}const m=h.pageX,b=h.pageY;if(d.preventedByNestedSwiper){i.startX=m,i.startY=b;return}if(!r.allowTouchMove){d.target.matches(n.focusableElements)||(r.allowClick=!1),n.isTouched&&(Object.assign(i,{startX:m,startY:b,currentX:m,currentY:b}),n.touchStartTime=Rp());return}if(s.touchReleaseOnEdges&&!s.loop)if(r.isVertical()){if(b<i.startY&&r.translate<=r.maxTranslate()||b>i.startY&&r.translate>=r.minTranslate()){n.isTouched=!1,n.isMoved=!1;return}}else{if(a&&(m>i.startX&&-r.translate<=r.maxTranslate()||m<i.startX&&-r.translate>=r.minTranslate()))return;if(!a&&(m<i.startX&&r.translate<=r.maxTranslate()||m>i.startX&&r.translate>=r.minTranslate()))return}if(t.activeElement&&t.activeElement.matches(n.focusableElements)&&t.activeElement!==d.target&&d.pointerType!=="mouse"&&t.activeElement.blur(),t.activeElement&&d.target===t.activeElement&&d.target.matches(n.focusableElements)){n.isMoved=!0,r.allowClick=!1;return}n.allowTouchCallbacks&&r.emit("touchMove",d),i.previousX=i.currentX,i.previousY=i.currentY,i.currentX=m,i.currentY=b;const x=i.currentX-i.startX,v=i.currentY-i.startY;if(r.params.threshold&&Math.sqrt(x**2+v**2)<r.params.threshold)return;if(typeof n.isScrolling>"u"){let T;r.isHorizontal()&&i.currentY===i.startY||r.isVertical()&&i.currentX===i.startX?n.isScrolling=!1:x*x+v*v>=25&&(T=Math.atan2(Math.abs(v),Math.abs(x))*180/Math.PI,n.isScrolling=r.isHorizontal()?T>s.touchAngle:90-T>s.touchAngle)}if(n.isScrolling&&r.emit("touchMoveOpposite",d),typeof n.startMoving>"u"&&(i.currentX!==i.startX||i.currentY!==i.startY)&&(n.startMoving=!0),n.isScrolling||d.type==="touchmove"&&n.preventTouchMoveFromPointerMove){n.isTouched=!1;return}if(!n.startMoving)return;r.allowClick=!1,!s.cssMode&&d.cancelable&&d.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&d.stopPropagation();let A=r.isHorizontal()?x:v,S=r.isHorizontal()?i.currentX-i.previousX:i.currentY-i.previousY;s.oneWayMovement&&(A=Math.abs(A)*(a?1:-1),S=Math.abs(S)*(a?1:-1)),i.diff=A,A*=s.touchRatio,a&&(A=-A,S=-S);const k=r.touchesDirection;r.swipeDirection=A>0?"prev":"next",r.touchesDirection=S>0?"prev":"next";const L=r.params.loop&&!s.cssMode,R=r.touchesDirection==="next"&&r.allowSlideNext||r.touchesDirection==="prev"&&r.allowSlidePrev;if(!n.isMoved){if(L&&R&&r.loopFix({direction:r.swipeDirection}),n.startTranslate=r.getTranslate(),r.setTransition(0),r.animating){const T=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});r.wrapperEl.dispatchEvent(T)}n.allowMomentumBounce=!1,s.grabCursor&&(r.allowSlideNext===!0||r.allowSlidePrev===!0)&&r.setGrabCursor(!0),r.emit("sliderFirstMove",d)}if(new Date().getTime(),s._loopSwapReset!==!1&&n.isMoved&&n.allowThresholdMove&&k!==r.touchesDirection&&L&&R&&Math.abs(A)>=1){Object.assign(i,{startX:m,startY:b,currentX:m,currentY:b,startTranslate:n.currentTranslate}),n.loopSwapReset=!0,n.startTranslate=n.currentTranslate;return}r.emit("sliderMove",d),n.isMoved=!0,n.currentTranslate=A+n.startTranslate;let B=!0,Q=s.resistanceRatio;if(s.touchReleaseOnEdges&&(Q=0),A>0?(L&&R&&n.allowThresholdMove&&n.currentTranslate>(s.centeredSlides?r.minTranslate()-r.slidesSizesGrid[r.activeIndex+1]-(s.slidesPerView!=="auto"&&r.slides.length-s.slidesPerView>=2?r.slidesSizesGrid[r.activeIndex+1]+r.params.spaceBetween:0)-r.params.spaceBetween:r.minTranslate())&&r.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),n.currentTranslate>r.minTranslate()&&(B=!1,s.resistance&&(n.currentTranslate=r.minTranslate()-1+(-r.minTranslate()+n.startTranslate+A)**Q))):A<0&&(L&&R&&n.allowThresholdMove&&n.currentTranslate<(s.centeredSlides?r.maxTranslate()+r.slidesSizesGrid[r.slidesSizesGrid.length-1]+r.params.spaceBetween+(s.slidesPerView!=="auto"&&r.slides.length-s.slidesPerView>=2?r.slidesSizesGrid[r.slidesSizesGrid.length-1]+r.params.spaceBetween:0):r.maxTranslate())&&r.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:r.slides.length-(s.slidesPerView==="auto"?r.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),n.currentTranslate<r.maxTranslate()&&(B=!1,s.resistance&&(n.currentTranslate=r.maxTranslate()+1-(r.maxTranslate()-n.startTranslate-A)**Q))),B&&(d.preventedByNestedSwiper=!0),!r.allowSlideNext&&r.swipeDirection==="next"&&n.currentTranslate<n.startTranslate&&(n.currentTranslate=n.startTranslate),!r.allowSlidePrev&&r.swipeDirection==="prev"&&n.currentTranslate>n.startTranslate&&(n.currentTranslate=n.startTranslate),!r.allowSlidePrev&&!r.allowSlideNext&&(n.currentTranslate=n.startTranslate),s.threshold>0)if(Math.abs(A)>s.threshold||n.allowThresholdMove){if(!n.allowThresholdMove){n.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,n.currentTranslate=n.startTranslate,i.diff=r.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY;return}}else{n.currentTranslate=n.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&r.freeMode||s.watchSlidesProgress)&&(r.updateActiveIndex(),r.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&r.freeMode&&r.freeMode.onTouchMove(),r.updateProgress(n.currentTranslate),r.setTranslate(n.currentTranslate))}function S_(e){const t=this;if(t.destroyed)return;const r=t.touchEventsData;let n=e;n.originalEvent&&(n=n.originalEvent);let s;if(n.type==="touchend"||n.type==="touchcancel"){if(s=[...n.changedTouches].find(T=>T.identifier===r.touchId),!s||s.identifier!==r.touchId)return}else{if(r.touchId!==null||n.pointerId!==r.pointerId)return;s=n}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(n.type)&&!(["pointercancel","contextmenu"].includes(n.type)&&(t.browser.isSafari||t.browser.isWebView)))return;r.pointerId=null,r.touchId=null;const{params:a,touches:u,rtlTranslate:d,slidesGrid:h,enabled:m}=t;if(!m||!a.simulateTouch&&n.pointerType==="mouse")return;if(r.allowTouchCallbacks&&t.emit("touchEnd",n),r.allowTouchCallbacks=!1,!r.isTouched){r.isMoved&&a.grabCursor&&t.setGrabCursor(!1),r.isMoved=!1,r.startMoving=!1;return}a.grabCursor&&r.isMoved&&r.isTouched&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!1);const b=Rp(),x=b-r.touchStartTime;if(t.allowClick){const T=n.path||n.composedPath&&n.composedPath();t.updateClickedSlide(T&&T[0]||n.target,T),t.emit("tap click",n),x<300&&b-r.lastClickTime<300&&t.emit("doubleTap doubleClick",n)}if(r.lastClickTime=Rp(),s4(()=>{t.destroyed||(t.allowClick=!0)}),!r.isTouched||!r.isMoved||!t.swipeDirection||u.diff===0&&!r.loopSwapReset||r.currentTranslate===r.startTranslate&&!r.loopSwapReset){r.isTouched=!1,r.isMoved=!1,r.startMoving=!1;return}r.isTouched=!1,r.isMoved=!1,r.startMoving=!1;let v;if(a.followFinger?v=d?t.translate:-t.translate:v=-r.currentTranslate,a.cssMode)return;if(a.freeMode&&a.freeMode.enabled){t.freeMode.onTouchEnd({currentPos:v});return}const A=v>=-t.maxTranslate()&&!t.params.loop;let S=0,k=t.slidesSizesGrid[0];for(let T=0;T<h.length;T+=T<a.slidesPerGroupSkip?1:a.slidesPerGroup){const O=T<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;typeof h[T+O]<"u"?(A||v>=h[T]&&v<h[T+O])&&(S=T,k=h[T+O]-h[T]):(A||v>=h[T])&&(S=T,k=h[h.length-1]-h[h.length-2])}let L=null,R=null;a.rewind&&(t.isBeginning?R=a.virtual&&a.virtual.enabled&&t.virtual?t.virtual.slides.length-1:t.slides.length-1:t.isEnd&&(L=0));const B=(v-h[S])/k,Q=S<a.slidesPerGroupSkip-1?1:a.slidesPerGroup;if(x>a.longSwipesMs){if(!a.longSwipes){t.slideTo(t.activeIndex);return}t.swipeDirection==="next"&&(B>=a.longSwipesRatio?t.slideTo(a.rewind&&t.isEnd?L:S+Q):t.slideTo(S)),t.swipeDirection==="prev"&&(B>1-a.longSwipesRatio?t.slideTo(S+Q):R!==null&&B<0&&Math.abs(B)>a.longSwipesRatio?t.slideTo(R):t.slideTo(S))}else{if(!a.shortSwipes){t.slideTo(t.activeIndex);return}t.navigation&&(n.target===t.navigation.nextEl||n.target===t.navigation.prevEl)?n.target===t.navigation.nextEl?t.slideTo(S+Q):t.slideTo(S):(t.swipeDirection==="next"&&t.slideTo(L!==null?L:S+Q),t.swipeDirection==="prev"&&t.slideTo(R!==null?R:S))}}function k5(){const e=this,{params:t,el:r}=e;if(r&&r.offsetWidth===0)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:n,allowSlidePrev:s,snapGrid:i}=e,a=e.virtual&&e.params.virtual.enabled;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses();const u=a&&t.loop;if((t.slidesPerView==="auto"||t.slidesPerView>1)&&e.isEnd&&!e.isBeginning&&!e.params.centeredSlides&&!u){const d=a?e.virtual.slides:e.slides;e.slideTo(d.length-1,0,!1,!0)}else e.params.loop&&!a?e.slideToLoop(e.realIndex,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0);e.autoplay&&e.autoplay.running&&e.autoplay.paused&&(clearTimeout(e.autoplay.resizeTimeout),e.autoplay.resizeTimeout=setTimeout(()=>{e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.resume()},500)),e.allowSlidePrev=s,e.allowSlideNext=n,e.params.watchOverflow&&i!==e.snapGrid&&e.checkOverflow()}function C_(e){const t=this;t.destroyed||t.enabled&&(t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation())))}function __(){const e=this;if(e.destroyed)return;const{wrapperEl:t,rtlTranslate:r,enabled:n}=e;if(!n)return;e.previousTranslate=e.translate,e.isHorizontal()?e.translate=-t.scrollLeft:e.translate=-t.scrollTop,e.translate===0&&(e.translate=0),e.updateActiveIndex(),e.updateSlidesClasses();let s;const i=e.maxTranslate()-e.minTranslate();i===0?s=0:s=(e.translate-e.minTranslate())/i,s!==e.progress&&e.updateProgress(r?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}function k_(e){const t=this;t.destroyed||(lp(t,e.target),!(t.params.cssMode||t.params.slidesPerView!=="auto"&&!t.params.autoHeight)&&t.update())}function L_(){const e=this;e.destroyed||e.documentTouchHandlerProceeded||(e.documentTouchHandlerProceeded=!0,e.params.touchReleaseOnEdges&&(e.el.style.touchAction="auto"))}const u4=(e,t)=>{const r=eu(),{params:n,el:s,wrapperEl:i,device:a}=e,u=!!n.nested,d=t==="on"?"addEventListener":"removeEventListener",h=t;!s||typeof s=="string"||(r[d]("touchstart",e.onDocumentTouchStart,{passive:!1,capture:u}),s[d]("touchstart",e.onTouchStart,{passive:!1}),s[d]("pointerdown",e.onTouchStart,{passive:!1}),r[d]("touchmove",e.onTouchMove,{passive:!1,capture:u}),r[d]("pointermove",e.onTouchMove,{passive:!1,capture:u}),r[d]("touchend",e.onTouchEnd,{passive:!0}),r[d]("pointerup",e.onTouchEnd,{passive:!0}),r[d]("pointercancel",e.onTouchEnd,{passive:!0}),r[d]("touchcancel",e.onTouchEnd,{passive:!0}),r[d]("pointerout",e.onTouchEnd,{passive:!0}),r[d]("pointerleave",e.onTouchEnd,{passive:!0}),r[d]("contextmenu",e.onTouchEnd,{passive:!0}),(n.preventClicks||n.preventClicksPropagation)&&s[d]("click",e.onClick,!0),n.cssMode&&i[d]("scroll",e.onScroll),n.updateOnWindowResize?e[h](a.ios||a.android?"resize orientationchange observerUpdate":"resize observerUpdate",k5,!0):e[h]("observerUpdate",k5,!0),s[d]("load",e.onLoad,{capture:!0}))};function E_(){const e=this,{params:t}=e;e.onTouchStart=A_.bind(e),e.onTouchMove=T_.bind(e),e.onTouchEnd=S_.bind(e),e.onDocumentTouchStart=L_.bind(e),t.cssMode&&(e.onScroll=__.bind(e)),e.onClick=C_.bind(e),e.onLoad=k_.bind(e),u4(e,"on")}function I_(){u4(this,"off")}var M_={attachEvents:E_,detachEvents:I_};const L5=(e,t)=>e.grid&&t.grid&&t.grid.rows>1;function R_(){const e=this,{realIndex:t,initialized:r,params:n,el:s}=e,i=n.breakpoints;if(!i||i&&Object.keys(i).length===0)return;const a=eu(),u=n.breakpointsBase==="window"||!n.breakpointsBase?n.breakpointsBase:"container",d=["window","container"].includes(n.breakpointsBase)||!n.breakpointsBase?e.el:a.querySelector(n.breakpointsBase),h=e.getBreakpoint(i,u,d);if(!h||e.currentBreakpoint===h)return;const b=(h in i?i[h]:void 0)||e.originalParams,x=L5(e,n),v=L5(e,b),A=e.params.grabCursor,S=b.grabCursor,k=n.enabled;x&&!v?(s.classList.remove(`${n.containerModifierClass}grid`,`${n.containerModifierClass}grid-column`),e.emitContainerClasses()):!x&&v&&(s.classList.add(`${n.containerModifierClass}grid`),(b.grid.fill&&b.grid.fill==="column"||!b.grid.fill&&n.grid.fill==="column")&&s.classList.add(`${n.containerModifierClass}grid-column`),e.emitContainerClasses()),A&&!S?e.unsetGrabCursor():!A&&S&&e.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(O=>{if(typeof b[O]>"u")return;const I=n[O]&&n[O].enabled,N=b[O]&&b[O].enabled;I&&!N&&e[O].disable(),!I&&N&&e[O].enable()});const L=b.direction&&b.direction!==n.direction,R=n.loop&&(b.slidesPerView!==n.slidesPerView||L),B=n.loop;L&&r&&e.changeDirection(),Ho(e.params,b);const Q=e.params.enabled,T=e.params.loop;Object.assign(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),k&&!Q?e.disable():!k&&Q&&e.enable(),e.currentBreakpoint=h,e.emit("_beforeBreakpoint",b),r&&(R?(e.loopDestroy(),e.loopCreate(t),e.updateSlides()):!B&&T?(e.loopCreate(t),e.updateSlides()):B&&!T&&e.loopDestroy()),e.emit("breakpoint",b)}function N_(e,t="window",r){if(!e||t==="container"&&!r)return;let n=!1;const s=xo(),i=t==="window"?s.innerHeight:r.clientHeight,a=Object.keys(e).map(u=>{if(typeof u=="string"&&u.indexOf("@")===0){const d=parseFloat(u.substr(1));return{value:i*d,point:u}}return{value:u,point:u}});a.sort((u,d)=>parseInt(u.value,10)-parseInt(d.value,10));for(let u=0;u<a.length;u+=1){const{point:d,value:h}=a[u];t==="window"?s.matchMedia(`(min-width: ${h}px)`).matches&&(n=d):h<=r.clientWidth&&(n=d)}return n||"max"}var D_={setBreakpoint:R_,getBreakpoint:N_};function B_(e,t){const r=[];return e.forEach(n=>{typeof n=="object"?Object.keys(n).forEach(s=>{n[s]&&r.push(t+s)}):typeof n=="string"&&r.push(t+n)}),r}function P_(){const e=this,{classNames:t,params:r,rtl:n,el:s,device:i}=e,a=B_(["initialized",r.direction,{"free-mode":e.params.freeMode&&r.freeMode.enabled},{autoheight:r.autoHeight},{rtl:n},{grid:r.grid&&r.grid.rows>1},{"grid-column":r.grid&&r.grid.rows>1&&r.grid.fill==="column"},{android:i.android},{ios:i.ios},{"css-mode":r.cssMode},{centered:r.cssMode&&r.centeredSlides},{"watch-progress":r.watchSlidesProgress}],r.containerModifierClass);t.push(...a),s.classList.add(...t),e.emitContainerClasses()}function j_(){const e=this,{el:t,classNames:r}=e;!t||typeof t=="string"||(t.classList.remove(...r),e.emitContainerClasses())}var F_={addClasses:P_,removeClasses:j_};function Q_(){const e=this,{isLocked:t,params:r}=e,{slidesOffsetBefore:n}=r;if(n){const s=e.slides.length-1,i=e.slidesGrid[s]+e.slidesSizesGrid[s]+n*2;e.isLocked=e.size>i}else e.isLocked=e.snapGrid.length===1;r.allowSlideNext===!0&&(e.allowSlideNext=!e.isLocked),r.allowSlidePrev===!0&&(e.allowSlidePrev=!e.isLocked),t&&t!==e.isLocked&&(e.isEnd=!1),t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock")}var O_={checkOverflow:Q_},v2={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,snapToSlideEdge:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function $_(e,t){return function(n={}){const s=Object.keys(n)[0],i=n[s];if(typeof i!="object"||i===null){Ho(t,n);return}if(e[s]===!0&&(e[s]={enabled:!0}),s==="navigation"&&e[s]&&e[s].enabled&&!e[s].prevEl&&!e[s].nextEl&&(e[s].auto=!0),["pagination","scrollbar"].indexOf(s)>=0&&e[s]&&e[s].enabled&&!e[s].el&&(e[s].auto=!0),!(s in e&&"enabled"in i)){Ho(t,n);return}typeof e[s]=="object"&&!("enabled"in e[s])&&(e[s].enabled=!0),e[s]||(e[s]={enabled:!1}),Ho(t,n)}}const jg={eventsEmitter:FC,update:YC,translate:t_,transition:i_,slide:h_,loop:b_,grabCursor:v_,events:M_,breakpoints:D_,checkOverflow:O_,classes:F_},Fg={};let Ob=class ml{constructor(...t){let r,n;t.length===1&&t[0].constructor&&Object.prototype.toString.call(t[0]).slice(8,-1)==="Object"?n=t[0]:[r,n]=t,n||(n={}),n=Ho({},n),r&&!n.el&&(n.el=r);const s=eu();if(n.el&&typeof n.el=="string"&&s.querySelectorAll(n.el).length>1){const d=[];return s.querySelectorAll(n.el).forEach(h=>{const m=Ho({},n,{el:h});d.push(new ml(m))}),d}const i=this;i.__swiper__=!0,i.support=o4(),i.device=a4({userAgent:n.userAgent}),i.browser=l4(),i.eventsListeners={},i.eventsAnyListeners=[],i.modules=[...i.__modules__],n.modules&&Array.isArray(n.modules)&&n.modules.forEach(d=>{typeof d=="function"&&i.modules.indexOf(d)<0&&i.modules.push(d)});const a={};i.modules.forEach(d=>{d({params:n,swiper:i,extendParams:$_(n,a),on:i.on.bind(i),once:i.once.bind(i),off:i.off.bind(i),emit:i.emit.bind(i)})});const u=Ho({},v2,a);return i.params=Ho({},u,Fg,n),i.originalParams=Ho({},i.params),i.passedParams=Ho({},n),i.params&&i.params.on&&Object.keys(i.params.on).forEach(d=>{i.on(d,i.params.on[d])}),i.params&&i.params.onAny&&i.onAny(i.params.onAny),Object.assign(i,{enabled:i.params.enabled,el:r,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return i.params.direction==="horizontal"},isVertical(){return i.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:i.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:i.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),i.emit("_swiper"),i.params.init&&i.init(),i}getDirectionLabel(t){return this.isHorizontal()?t:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[t]}getSlideIndex(t){const{slidesEl:r,params:n}=this,s=bl(r,`.${n.slideClass}, swiper-slide`),i=A5(s[0]);return A5(t)-i}getSlideIndexByData(t){return this.getSlideIndex(this.slides.find(r=>r.getAttribute("data-swiper-slide-index")*1===t))}getSlideIndexWhenGrid(t){return this.grid&&this.params.grid&&this.params.grid.rows>1&&(this.params.grid.fill==="column"?t=Math.floor(t/this.params.grid.rows):this.params.grid.fill==="row"&&(t=t%Math.ceil(this.slides.length/this.params.grid.rows))),t}recalcSlides(){const t=this,{slidesEl:r,params:n}=t;t.slides=bl(r,`.${n.slideClass}, swiper-slide`)}enable(){const t=this;t.enabled||(t.enabled=!0,t.params.grabCursor&&t.setGrabCursor(),t.emit("enable"))}disable(){const t=this;t.enabled&&(t.enabled=!1,t.params.grabCursor&&t.unsetGrabCursor(),t.emit("disable"))}setProgress(t,r){const n=this;t=Math.min(Math.max(t,0),1);const s=n.minTranslate(),a=(n.maxTranslate()-s)*t+s;n.translateTo(a,typeof r>"u"?0:r),n.updateActiveIndex(),n.updateSlidesClasses()}emitContainerClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const r=t.el.className.split(" ").filter(n=>n.indexOf("swiper")===0||n.indexOf(t.params.containerModifierClass)===0);t.emit("_containerClasses",r.join(" "))}getSlideClasses(t){const r=this;return r.destroyed?"":t.className.split(" ").filter(n=>n.indexOf("swiper-slide")===0||n.indexOf(r.params.slideClass)===0).join(" ")}emitSlidesClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const r=[];t.slides.forEach(n=>{const s=t.getSlideClasses(n);r.push({slideEl:n,classNames:s}),t.emit("_slideClass",n,s)}),t.emit("_slideClasses",r)}slidesPerViewDynamic(t="current",r=!1){const n=this,{params:s,slides:i,slidesGrid:a,slidesSizesGrid:u,size:d,activeIndex:h}=n;let m=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let b=i[h]?Math.ceil(i[h].swiperSlideSize):0,x;for(let v=h+1;v<i.length;v+=1)i[v]&&!x&&(b+=Math.ceil(i[v].swiperSlideSize),m+=1,b>d&&(x=!0));for(let v=h-1;v>=0;v-=1)i[v]&&!x&&(b+=i[v].swiperSlideSize,m+=1,b>d&&(x=!0))}else if(t==="current")for(let b=h+1;b<i.length;b+=1)(r?a[b]+u[b]-a[h]<d:a[b]-a[h]<d)&&(m+=1);else for(let b=h-1;b>=0;b-=1)a[h]-a[b]<d&&(m+=1);return m}update(){const t=this;if(!t||t.destroyed)return;const{snapGrid:r,params:n}=t;n.breakpoints&&t.setBreakpoint(),[...t.el.querySelectorAll('[loading="lazy"]')].forEach(a=>{a.complete&&lp(t,a)}),t.updateSize(),t.updateSlides(),t.updateProgress(),t.updateSlidesClasses();function s(){const a=t.rtlTranslate?t.translate*-1:t.translate,u=Math.min(Math.max(a,t.maxTranslate()),t.minTranslate());t.setTranslate(u),t.updateActiveIndex(),t.updateSlidesClasses()}let i;if(n.freeMode&&n.freeMode.enabled&&!n.cssMode)s(),n.autoHeight&&t.updateAutoHeight();else{if((n.slidesPerView==="auto"||n.slidesPerView>1)&&t.isEnd&&!n.centeredSlides){const a=t.virtual&&n.virtual.enabled?t.virtual.slides:t.slides;i=t.slideTo(a.length-1,0,!1,!0)}else i=t.slideTo(t.activeIndex,0,!1,!0);i||s()}n.watchOverflow&&r!==t.snapGrid&&t.checkOverflow(),t.emit("update")}changeDirection(t,r=!0){const n=this,s=n.params.direction;return t||(t=s==="horizontal"?"vertical":"horizontal"),t===s||t!=="horizontal"&&t!=="vertical"||(n.el.classList.remove(`${n.params.containerModifierClass}${s}`),n.el.classList.add(`${n.params.containerModifierClass}${t}`),n.emitContainerClasses(),n.params.direction=t,n.slides.forEach(i=>{t==="vertical"?i.style.width="":i.style.height=""}),n.emit("changeDirection"),r&&n.update()),n}changeLanguageDirection(t){const r=this;r.rtl&&t==="rtl"||!r.rtl&&t==="ltr"||(r.rtl=t==="rtl",r.rtlTranslate=r.params.direction==="horizontal"&&r.rtl,r.rtl?(r.el.classList.add(`${r.params.containerModifierClass}rtl`),r.el.dir="rtl"):(r.el.classList.remove(`${r.params.containerModifierClass}rtl`),r.el.dir="ltr"),r.update())}mount(t){const r=this;if(r.mounted)return!0;let n=t||r.params.el;if(typeof n=="string"&&(n=document.querySelector(n)),!n)return!1;n.swiper=r,n.parentNode&&n.parentNode.host&&n.parentNode.host.nodeName===r.params.swiperElementNodeName.toUpperCase()&&(r.isElement=!0);const s=()=>`.${(r.params.wrapperClass||"").trim().split(" ").join(".")}`;let a=n&&n.shadowRoot&&n.shadowRoot.querySelector?n.shadowRoot.querySelector(s()):bl(n,s())[0];return!a&&r.params.createElements&&(a=x2("div",r.params.wrapperClass),n.append(a),bl(n,`.${r.params.slideClass}`).forEach(u=>{a.append(u)})),Object.assign(r,{el:n,wrapperEl:a,slidesEl:r.isElement&&!n.parentNode.host.slideSlots?n.parentNode.host:a,hostEl:r.isElement?n.parentNode.host:n,mounted:!0,rtl:n.dir.toLowerCase()==="rtl"||Jl(n,"direction")==="rtl",rtlTranslate:r.params.direction==="horizontal"&&(n.dir.toLowerCase()==="rtl"||Jl(n,"direction")==="rtl"),wrongRTL:Jl(a,"display")==="-webkit-box"}),!0}init(t){const r=this;if(r.initialized||r.mount(t)===!1)return r;r.emit("beforeInit"),r.params.breakpoints&&r.setBreakpoint(),r.addClasses(),r.updateSize(),r.updateSlides(),r.params.watchOverflow&&r.checkOverflow(),r.params.grabCursor&&r.enabled&&r.setGrabCursor(),r.params.loop&&r.virtual&&r.params.virtual.enabled?r.slideTo(r.params.initialSlide+r.virtual.slidesBefore,0,r.params.runCallbacksOnInit,!1,!0):r.slideTo(r.params.initialSlide,0,r.params.runCallbacksOnInit,!1,!0),r.params.loop&&r.loopCreate(void 0,!0),r.attachEvents();const s=[...r.el.querySelectorAll('[loading="lazy"]')];return r.isElement&&s.push(...r.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(i=>{i.complete?lp(r,i):i.addEventListener("load",a=>{lp(r,a.target)})}),y2(r),r.initialized=!0,y2(r),r.emit("init"),r.emit("afterInit"),r}destroy(t=!0,r=!0){const n=this,{params:s,el:i,wrapperEl:a,slides:u}=n;return typeof n.params>"u"||n.destroyed||(n.emit("beforeDestroy"),n.initialized=!1,n.detachEvents(),s.loop&&n.loopDestroy(),r&&(n.removeClasses(),i&&typeof i!="string"&&i.removeAttribute("style"),a&&a.removeAttribute("style"),u&&u.length&&u.forEach(d=>{d.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),d.removeAttribute("style"),d.removeAttribute("data-swiper-slide-index")})),n.emit("destroy"),Object.keys(n.eventsListeners).forEach(d=>{n.off(d)}),t!==!1&&(n.el&&typeof n.el!="string"&&(n.el.swiper=null),SC(n)),n.destroyed=!0),null}static extendDefaults(t){Ho(Fg,t)}static get extendedDefaults(){return Fg}static get defaults(){return v2}static installModule(t){ml.prototype.__modules__||(ml.prototype.__modules__=[]);const r=ml.prototype.__modules__;typeof t=="function"&&r.indexOf(t)<0&&r.push(t)}static use(t){return Array.isArray(t)?(t.forEach(r=>ml.installModule(r)),ml):(ml.installModule(t),ml)}};Object.keys(jg).forEach(e=>{Object.keys(jg[e]).forEach(t=>{Ob.prototype[t]=jg[e][t]})});Ob.use([PC,jC]);const d4=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_snapToSlideEdge","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function Vc(e){return typeof e=="object"&&e!==null&&e.constructor&&Object.prototype.toString.call(e).slice(8,-1)==="Object"&&!e.__swiper__}function dd(e,t){const r=["__proto__","constructor","prototype"];Object.keys(t).filter(n=>r.indexOf(n)<0).forEach(n=>{typeof e[n]>"u"?e[n]=t[n]:Vc(t[n])&&Vc(e[n])&&Object.keys(t[n]).length>0?t[n].__swiper__?e[n]=t[n]:dd(e[n],t[n]):e[n]=t[n]})}function f4(e={}){return e.navigation&&typeof e.navigation.nextEl>"u"&&typeof e.navigation.prevEl>"u"}function h4(e={}){return e.pagination&&typeof e.pagination.el>"u"}function p4(e={}){return e.scrollbar&&typeof e.scrollbar.el>"u"}function m4(e=""){const t=e.split(" ").map(n=>n.trim()).filter(n=>!!n),r=[];return t.forEach(n=>{r.indexOf(n)<0&&r.push(n)}),r.join(" ")}function H_(e=""){return e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function U_({swiper:e,slides:t,passedParams:r,changedParams:n,nextEl:s,prevEl:i,scrollbarEl:a,paginationEl:u}){const d=n.filter(N=>N!=="children"&&N!=="direction"&&N!=="wrapperClass"),{params:h,pagination:m,navigation:b,scrollbar:x,virtual:v,thumbs:A}=e;let S,k,L,R,B,Q,T,O;n.includes("thumbs")&&r.thumbs&&r.thumbs.swiper&&!r.thumbs.swiper.destroyed&&h.thumbs&&(!h.thumbs.swiper||h.thumbs.swiper.destroyed)&&(S=!0),n.includes("controller")&&r.controller&&r.controller.control&&h.controller&&!h.controller.control&&(k=!0),n.includes("pagination")&&r.pagination&&(r.pagination.el||u)&&(h.pagination||h.pagination===!1)&&m&&!m.el&&(L=!0),n.includes("scrollbar")&&r.scrollbar&&(r.scrollbar.el||a)&&(h.scrollbar||h.scrollbar===!1)&&x&&!x.el&&(R=!0),n.includes("navigation")&&r.navigation&&(r.navigation.prevEl||i)&&(r.navigation.nextEl||s)&&(h.navigation||h.navigation===!1)&&b&&!b.prevEl&&!b.nextEl&&(B=!0);const I=N=>{e[N]&&(e[N].destroy(),N==="navigation"?(e.isElement&&(e[N].prevEl.remove(),e[N].nextEl.remove()),h[N].prevEl=void 0,h[N].nextEl=void 0,e[N].prevEl=void 0,e[N].nextEl=void 0):(e.isElement&&e[N].el.remove(),h[N].el=void 0,e[N].el=void 0))};n.includes("loop")&&e.isElement&&(h.loop&&!r.loop?Q=!0:!h.loop&&r.loop?T=!0:O=!0),d.forEach(N=>{if(Vc(h[N])&&Vc(r[N]))Object.assign(h[N],r[N]),(N==="navigation"||N==="pagination"||N==="scrollbar")&&"enabled"in r[N]&&!r[N].enabled&&I(N);else{const U=r[N];(U===!0||U===!1)&&(N==="navigation"||N==="pagination"||N==="scrollbar")?U===!1&&I(N):h[N]=r[N]}}),d.includes("controller")&&!k&&e.controller&&e.controller.control&&h.controller&&h.controller.control&&(e.controller.control=h.controller.control),n.includes("children")&&t&&v&&h.virtual.enabled?(v.slides=t,v.update(!0)):n.includes("virtual")&&v&&h.virtual.enabled&&(t&&(v.slides=t),v.update(!0)),n.includes("children")&&t&&h.loop&&(O=!0),S&&A.init()&&A.update(!0),k&&(e.controller.control=h.controller.control),L&&(e.isElement&&(!u||typeof u=="string")&&(u=document.createElement("div"),u.classList.add("swiper-pagination"),u.part.add("pagination"),e.el.appendChild(u)),u&&(h.pagination.el=u),m.init(),m.render(),m.update()),R&&(e.isElement&&(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-scrollbar"),a.part.add("scrollbar"),e.el.appendChild(a)),a&&(h.scrollbar.el=a),x.init(),x.updateSize(),x.setTranslate()),B&&(e.isElement&&((!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-next"),S5(s,e.navigation.arrowSvg),s.part.add("button-next"),e.el.appendChild(s)),(!i||typeof i=="string")&&(i=document.createElement("div"),i.classList.add("swiper-button-prev"),S5(i,e.navigation.arrowSvg),i.part.add("button-prev"),e.el.appendChild(i))),s&&(h.navigation.nextEl=s),i&&(h.navigation.prevEl=i),b.init(),b.update()),n.includes("allowSlideNext")&&(e.allowSlideNext=r.allowSlideNext),n.includes("allowSlidePrev")&&(e.allowSlidePrev=r.allowSlidePrev),n.includes("direction")&&e.changeDirection(r.direction,!1),(Q||O)&&e.loopDestroy(),(T||O)&&e.loopCreate(),e.update()}function z_(e={},t=!0){const r={on:{}},n={},s={};dd(r,v2),r._emitClasses=!0,r.init=!1;const i={},a=d4.map(d=>d.replace(/_/,"")),u=Object.assign({},e);return Object.keys(u).forEach(d=>{typeof e[d]>"u"||(a.indexOf(d)>=0?Vc(e[d])?(r[d]={},s[d]={},dd(r[d],e[d]),dd(s[d],e[d])):(r[d]=e[d],s[d]=e[d]):d.search(/on[A-Z]/)===0&&typeof e[d]=="function"?t?n[`${d[2].toLowerCase()}${d.substr(3)}`]=e[d]:r.on[`${d[2].toLowerCase()}${d.substr(3)}`]=e[d]:i[d]=e[d])}),["navigation","pagination","scrollbar"].forEach(d=>{r[d]===!0&&(r[d]={}),r[d]===!1&&delete r[d]}),{params:r,passedParams:s,rest:i,events:n}}function G_({el:e,nextEl:t,prevEl:r,paginationEl:n,scrollbarEl:s,swiper:i},a){f4(a)&&t&&r&&(i.params.navigation.nextEl=t,i.originalParams.navigation.nextEl=t,i.params.navigation.prevEl=r,i.originalParams.navigation.prevEl=r),h4(a)&&n&&(i.params.pagination.el=n,i.originalParams.pagination.el=n),p4(a)&&s&&(i.params.scrollbar.el=s,i.originalParams.scrollbar.el=s),i.init(e)}function W_(e,t,r,n,s){const i=[];if(!t)return i;const a=d=>{i.indexOf(d)<0&&i.push(d)};if(r&&n){const d=n.map(s),h=r.map(s);d.join("")!==h.join("")&&a("children"),n.length!==r.length&&a("children")}return d4.filter(d=>d[0]==="_").map(d=>d.replace(/_/,"")).forEach(d=>{if(d in e&&d in t)if(Vc(e[d])&&Vc(t[d])){const h=Object.keys(e[d]),m=Object.keys(t[d]);h.length!==m.length?a(d):(h.forEach(b=>{e[d][b]!==t[d][b]&&a(d)}),m.forEach(b=>{e[d][b]!==t[d][b]&&a(d)}))}else e[d]!==t[d]&&a(d)}),i}const V_=e=>{!e||e.destroyed||!e.params.virtual||e.params.virtual&&!e.params.virtual.enabled||(e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.emit("_virtualUpdated"),e.parallax&&e.params.parallax&&e.params.parallax.enabled&&e.parallax.setTranslate())};function Dp(){return Dp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Dp.apply(this,arguments)}function g4(e){return e.type&&e.type.displayName&&e.type.displayName.includes("SwiperSlide")}function b4(e){const t=[];return D.Children.toArray(e).forEach(r=>{g4(r)?t.push(r):r.props&&r.props.children&&b4(r.props.children).forEach(n=>t.push(n))}),t}function q_(e){const t=[],r={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return D.Children.toArray(e).forEach(n=>{if(g4(n))t.push(n);else if(n.props&&n.props.slot&&r[n.props.slot])r[n.props.slot].push(n);else if(n.props&&n.props.children){const s=b4(n.props.children);s.length>0?s.forEach(i=>t.push(i)):r["container-end"].push(n)}else r["container-end"].push(n)}),{slides:t,slots:r}}function Y_(e,t,r){if(!r)return null;const n=m=>{let b=m;return m<0?b=t.length+m:b>=t.length&&(b=b-t.length),b},s=e.isHorizontal()?{[e.rtlTranslate?"right":"left"]:`${r.offset}px`}:{top:`${r.offset}px`},{from:i,to:a}=r,u=e.params.loop?-t.length:0,d=e.params.loop?t.length*2:t.length,h=[];for(let m=u;m<d;m+=1)m>=i&&m<=a&&h.push(t[n(m)]);return h.map((m,b)=>D.cloneElement(m,{swiper:e,style:s,key:m.props.virtualIndex||m.key||`slide-${b}`}))}function J0(e,t){return typeof window>"u"?w.useEffect(e,t):w.useLayoutEffect(e,t)}const E5=w.createContext(null),K_=w.createContext(null),Pf=w.forwardRef(({className:e,tag:t="div",wrapperTag:r="div",children:n,onSwiper:s,...i}={},a)=>{let u=!1;const[d,h]=w.useState("swiper"),[m,b]=w.useState(null),[x,v]=w.useState(!1),A=w.useRef(!1),S=w.useRef(null),k=w.useRef(null),L=w.useRef(null),R=w.useRef(null),B=w.useRef(null),Q=w.useRef(null),T=w.useRef(null),O=w.useRef(null),{params:I,passedParams:N,rest:U,events:z}=z_(i),{slides:V,slots:K}=q_(n),ne=()=>{v(!x)};Object.assign(I.on,{_containerClasses(me,le){h(le)}});const oe=()=>{Object.assign(I.on,z),u=!0;const me={...I};if(delete me.wrapperClass,k.current=new Ob(me),k.current.virtual&&k.current.params.virtual.enabled){k.current.virtual.slides=V;const le={cache:!1,slides:V,renderExternal:b,renderExternalUpdate:!1};dd(k.current.params.virtual,le),dd(k.current.originalParams.virtual,le)}};S.current||oe(),k.current&&k.current.on("_beforeBreakpoint",ne);const ye=()=>{u||!z||!k.current||Object.keys(z).forEach(me=>{k.current.on(me,z[me])})},Ce=()=>{!z||!k.current||Object.keys(z).forEach(me=>{k.current.off(me,z[me])})};w.useEffect(()=>()=>{k.current&&k.current.off("_beforeBreakpoint",ne)}),w.useEffect(()=>{!A.current&&k.current&&(k.current.emitSlidesClasses(),A.current=!0)}),J0(()=>{if(a&&(a.current=S.current),!!S.current)return k.current.destroyed&&oe(),G_({el:S.current,nextEl:B.current,prevEl:Q.current,paginationEl:T.current,scrollbarEl:O.current,swiper:k.current},I),s&&!k.current.destroyed&&s(k.current),()=>{k.current&&!k.current.destroyed&&k.current.destroy(!0,!1)}},[]),J0(()=>{ye();const me=W_(N,L.current,V,R.current,le=>le.key);return L.current=N,R.current=V,me.length&&k.current&&!k.current.destroyed&&U_({swiper:k.current,slides:V,passedParams:N,changedParams:me,nextEl:B.current,prevEl:Q.current,scrollbarEl:O.current,paginationEl:T.current}),()=>{Ce()}}),J0(()=>{V_(k.current)},[m]);function _e(){return I.virtual?Y_(k.current,V,m):V.map((me,le)=>D.cloneElement(me,{swiper:k.current,swiperSlideIndex:le}))}return D.createElement(t,Dp({ref:S,className:m4(`${d}${e?` ${e}`:""}`)},U),D.createElement(K_.Provider,{value:k.current},K["container-start"],D.createElement(r,{className:H_(I.wrapperClass)},K["wrapper-start"],_e(),K["wrapper-end"]),f4(I)&&D.createElement(D.Fragment,null,D.createElement("div",{ref:Q,className:"swiper-button-prev"}),D.createElement("div",{ref:B,className:"swiper-button-next"})),p4(I)&&D.createElement("div",{ref:O,className:"swiper-scrollbar"}),h4(I)&&D.createElement("div",{ref:T,className:"swiper-pagination"}),K["container-end"]))});Pf.displayName="Swiper";const qc=w.forwardRef(({tag:e="div",children:t,className:r="",swiper:n,zoom:s,lazy:i,virtualIndex:a,swiperSlideIndex:u,...d}={},h)=>{const m=w.useRef(null),[b,x]=w.useState("swiper-slide"),[v,A]=w.useState(!1);function S(B,Q,T){Q===m.current&&x(T)}J0(()=>{if(typeof u<"u"&&(m.current.swiperSlideIndex=u),h&&(h.current=m.current),!(!m.current||!n)){if(n.destroyed){b!=="swiper-slide"&&x("swiper-slide");return}return n.on("_slideClass",S),()=>{n&&n.off("_slideClass",S)}}}),J0(()=>{n&&m.current&&!n.destroyed&&x(n.getSlideClasses(m.current))},[n]);const k={isActive:b.indexOf("swiper-slide-active")>=0,isVisible:b.indexOf("swiper-slide-visible")>=0,isFullyVisible:b.indexOf("swiper-slide-fully-visible")>=0,isPrev:b.indexOf("swiper-slide-prev")>=0,isNext:b.indexOf("swiper-slide-next")>=0},L=()=>typeof t=="function"?t(k):t,R=()=>{A(!0)};return D.createElement(e,Dp({ref:m,className:m4(`${b}${r?` ${r}`:""}`),"data-swiper-slide-index":a,onLoad:R},d),s&&D.createElement(E5.Provider,{value:k},D.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof s=="number"?s:void 0},L(),i&&!v&&D.createElement("div",{className:"swiper-lazy-preloader",ref:B=>{B&&(B.lazyPreloaderManaged=!0)}}))),!s&&D.createElement(E5.Provider,{value:k},L(),i&&!v&&D.createElement("div",{className:"swiper-lazy-preloader",ref:B=>{B&&(B.lazyPreloaderManaged=!0)}})))});qc.displayName="SwiperSlide";const Di=[];for(let e=0;e<256;++e)Di.push((e+256).toString(16).slice(1));function Z_(e,t=0){return(Di[e[t+0]]+Di[e[t+1]]+Di[e[t+2]]+Di[e[t+3]]+"-"+Di[e[t+4]]+Di[e[t+5]]+"-"+Di[e[t+6]]+Di[e[t+7]]+"-"+Di[e[t+8]]+Di[e[t+9]]+"-"+Di[e[t+10]]+Di[e[t+11]]+Di[e[t+12]]+Di[e[t+13]]+Di[e[t+14]]+Di[e[t+15]]).toLowerCase()}let Qg;const X_=new Uint8Array(16);function J_(){if(!Qg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qg=crypto.getRandomValues.bind(crypto)}return Qg(X_)}const ek=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),I5={randomUUID:ek};function tk(e,t,r){e=e||{};const n=e.random??e.rng?.()??J_();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Z_(n)}function rk(e,t,r){return I5.randomUUID&&!e?I5.randomUUID():tk(e)}const nk={},M5=e=>{let t;const r=new Set,n=(m,b)=>{const x=typeof m=="function"?m(t):m;if(!Object.is(x,t)){const v=t;t=b??(typeof x!="object"||x===null)?x:Object.assign({},t,x),r.forEach(A=>A(t,v))}},s=()=>t,d={setState:n,getState:s,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(nk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},h=t=e(n,s,d);return d},sk=e=>e?M5(e):M5;var Og={exports:{}},$g={},Hg={exports:{}},Ug={};var R5;function ik(){if(R5)return Ug;R5=1;var e=gm();function t(b,x){return b===x&&(b!==0||1/b===1/x)||b!==b&&x!==x}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function u(b,x){var v=x(),A=n({inst:{value:v,getSnapshot:x}}),S=A[0].inst,k=A[1];return i(function(){S.value=v,S.getSnapshot=x,d(S)&&k({inst:S})},[b,v,x]),s(function(){return d(S)&&k({inst:S}),b(function(){d(S)&&k({inst:S})})},[b]),a(v),v}function d(b){var x=b.getSnapshot;b=b.value;try{var v=x();return!r(b,v)}catch{return!0}}function h(b,x){return x()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return Ug.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Ug}var N5;function ok(){return N5||(N5=1,Hg.exports=ik()),Hg.exports}var D5;function ak(){if(D5)return $g;D5=1;var e=gm(),t=ok();function r(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,u=e.useMemo,d=e.useDebugValue;return $g.useSyncExternalStoreWithSelector=function(h,m,b,x,v){var A=i(null);if(A.current===null){var S={hasValue:!1,value:null};A.current=S}else S=A.current;A=u(function(){function L(O){if(!R){if(R=!0,B=O,O=x(O),v!==void 0&&S.hasValue){var I=S.value;if(v(I,O))return Q=I}return Q=O}if(I=Q,n(B,O))return I;var N=x(O);return v!==void 0&&v(I,N)?(B=O,I):(B=O,Q=N)}var R=!1,B,Q,T=b===void 0?null:b;return[function(){return L(m())},T===null?void 0:function(){return L(T())}]},[m,b,x,v]);var k=s(h,A[0],A[1]);return a(function(){S.hasValue=!0,S.value=k},[k]),d(k),k},$g}var B5;function lk(){return B5||(B5=1,Og.exports=ak()),Og.exports}var ck=lk();const uk=r4(ck),x4={},{useDebugValue:dk}=D,{useSyncExternalStoreWithSelector:fk}=uk;let P5=!1;const hk=e=>e;function pk(e,t=hk,r){(x4?"production":void 0)!=="production"&&r&&!P5&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),P5=!0);const n=fk(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return dk(n),n}const j5=e=>{(x4?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?sk(e):e,r=(n,s)=>pk(t,n,s);return Object.assign(r,t),r},y4=e=>e?j5(e):j5,Bp="auth:unauthorized";let od=null;class bm extends Error{constructor(t,r,n){super(t),this.status=r,this.code=n,this.name="TerminalApiError"}status;code}async function mk(){const e=await fetch("/api/terminal/quota");if(!e.ok)throw new bm("Failed to fetch quota",e.status);return e.json()}async function gk(){const e=await Sn(),t=await fetch("/api/terminal/quota/refresh",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new bm("Failed to refresh quota",t.status);return t.json()}const tu=8e3,Ja=1e4,fd=45e3;let bk=0;const cp=[];let zg=!1;function zl(e,t={}){if(typeof window>"u")return;const r=JSON.stringify({level:e==="error"||e==="timeout_or_abort"||e==="response_body_timeout"||e==="response_body_parse_error"?"warn":"info",message:`DIFF_API ${e}`,data:{seq:++bk,ts:Date.now(),...t}});cp.push(r),xk()}async function xk(){if(!zg){zg=!0;try{for(;cp.length>0;){const e=cp[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),cp.shift()}catch{break}}}finally{zg=!1}}}function yk(e,t,r){const n=new AbortController;let s=setTimeout(()=>{n.abort(new DOMException(r,"TimeoutError"))},t);const i=()=>n.abort(e?.reason);return e&&(e.aborted?i():e.addEventListener("abort",i,{once:!0})),{signal:n.signal,cleanup:()=>{s&&(clearTimeout(s),s=null),e?.removeEventListener("abort",i)}}}async function ni(e,t,r,n){const{signal:s,cleanup:i}=yk(t?.signal??void 0,r,n);try{return await fetch(e,{...t,signal:s})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(n):a}finally{i()}}async function vk(e,t,r){let n=null;const s=new Promise((i,a)=>{n=setTimeout(()=>a(new Error(r)),t)});try{return await Promise.race([e.text(),s])}finally{n&&clearTimeout(n)}}if(typeof window<"u"&&!window.__termdockFetchPatched){window.__termdockFetchPatched=!0;const e=window.fetch.bind(window);window.fetch=async(...t)=>{const r=await e(...t);if(r.status===401){od=null;try{window.dispatchEvent(new CustomEvent(Bp))}catch{}}return r}}async function Sn(){if(od)return od;const e=await fetch("/api/csrf-token");if(!e.ok)throw new Error("Failed to get CSRF token");return od=(await e.json()).csrfToken,od}function v4(){od=null}const wk=2e4,F5=8e3,Ak=1500,Io=new Map,Tk=24,Sk=40,Ck=40;function _k(e){return e.retryState.retryCount>=2||e.pendingInputs.length>=Ck?"congested":e.retryState.retryCount>=1||e.pendingInputs.length>=8?"degraded":"good"}function Q5(e){if(e.pendingInputs.length===0||e.ws.readyState!==WebSocket.OPEN)return;const t=e.pendingInputs.splice(0);for(const r of t)try{e.ws.send(JSON.stringify({type:"input",data:r}))}catch{}}function w4(e){if(e.ws.readyState!==WebSocket.OPEN)return;const t=_k(e);if(t==="good"){Q5(e);return}if(e.inputFlushTimer)return;const r=t==="congested"?Sk:Tk;e.inputFlushTimer=setTimeout(()=>{e.inputFlushTimer=null,Q5(e)},r)}const ef=new Map;function kk(e,t,r,n){const s=ef.get(e);s&&(ef.delete(e),t?s.resolve({success:!0,layout:r}):s.reject(new Error(n||"Tmux action failed")))}function Lk(e,t){const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/terminal/${e}/ws`;return t>0?`${n}?since=${t}`:n}const O5=new Map;async function Ek(e){const t=await Sn(),r=await fetch("/api/terminal/create",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({cols:e.cols||80,rows:e.rows||24,mode:e.mode||"shell",tmuxSessionName:e.tmuxSessionName,cwd:e.cwd,termType:e.termType})});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to create terminal"}));throw new Error(n.error||"Failed to create terminal session")}return r.json()}function Ik(e,t,r,n={}){const{maxRetries:s=10,initialRetryDelay:i=1e3,maxRetryDelay:a=2e4,connectionTimeout:u=15e3}=n,d={maxRetries:s,initialDelayMs:i,maxDelayMs:a,connectionTimeoutMs:u,retryCount:0,retryTimeout:null,connectionTimeoutId:null,isClosed:!1};let h=null,m=O5.get(e)??0;O5.delete(e);const b=[];let x=!1,v=null;const A=new WeakSet,S=()=>{d.retryTimeout&&(clearTimeout(d.retryTimeout),d.retryTimeout=null),d.connectionTimeoutId&&(clearTimeout(d.connectionTimeoutId),d.connectionTimeoutId=null),v&&(clearTimeout(v),v=null)},k=T=>{T.heartbeatTimer&&(clearInterval(T.heartbeatTimer),T.heartbeatTimer=null),T.pongTimer&&(clearTimeout(T.pongTimer),T.pongTimer=null),T.inputFlushTimer&&(clearTimeout(T.inputFlushTimer),T.inputFlushTimer=null)},L=T=>{k(T),T.heartbeatTimer=setInterval(()=>{if(T.ws.readyState===WebSocket.OPEN){try{T.ws.send(JSON.stringify({type:"ping"}))}catch{}T.pongTimer&&clearTimeout(T.pongTimer),T.pongTimer=setTimeout(()=>{if(Date.now()-T.lastInboundAt>=F5)try{T.ws.close()}catch{}},F5)}},wk)},R=()=>{if(d.isClosed=!0,S(),h){k(h),Io.delete(e);try{h.ws.close()}catch{}h=null}},B=()=>{if(d.isClosed)return;if(h){A.add(h.ws),k(h);try{h.ws.close()}catch{}}const T=Lk(e,m),O=new WebSocket(T);x=!1,d.connectionTimeoutId=setTimeout(()=>{O.readyState!==WebSocket.OPEN&&(O.close(),Q(new Error("WebSocket connection timeout"),!1))},u);const I={ws:O,onEvent:t,onError:r,reconnectNow:()=>{if(!d.isClosed&&!v){if(S(),h){A.add(h.ws),k(h);try{h.ws.close()}catch{}}t({type:"reconnecting",attempt:Math.min(d.retryCount+1,s),maxAttempts:s}),d.retryCount=Math.min(d.retryCount+1,s),x=!0,v=setTimeout(()=>{v=null,x=!1,B()},0)}},retryState:d,lastSeq:m,pendingInputs:b,inputFlushTimer:null,heartbeatTimer:null,pongTimer:null,lastInboundAt:Date.now()};O.onopen=()=>{S(),d.retryCount=0,I.lastInboundAt=Date.now(),L(I),w4(I)},O.onmessage=N=>{I.lastInboundAt=Date.now();try{const U=JSON.parse(N.data);if(U.type==="pong"){I.pongTimer&&(clearTimeout(I.pongTimer),I.pongTimer=null);return}if(U.type==="tmux-result"&&U.reqId){kk(U.reqId,U.success!==!1,U.layout,U.error);return}if(U.type==="tmux-layout"&&U.layout){t({type:"tmux-layout",layout:U.layout});return}if(U.type==="active-program"){t({type:"active-program",activeProgram:U.activeProgram,activeProgramRaw:U.activeProgramRaw,activeProgramSource:U.activeProgramSource});return}if(U.type==="cwd"){t({type:"cwd",cwd:U.cwd});return}if(U.type==="agent-status"){t({type:"agent-status",agentStatus:U.agentStatus??null,agentIndicator:U.agentIndicator??null,agent:U.agent??null,agentMessage:U.agentMessage??null,agentNativeSessionId:U.agentNativeSessionId??null,agentRich:U.agentRich===!0,agentActivity:typeof U.agentActivity=="number"?U.agentActivity:0,agentCwd:U.agentCwd??null,reviewed:typeof U.reviewed=="boolean"?U.reviewed:null});return}if(U.type==="git-status"){t({type:"git-status",gitStatus:U.gitStatus??null});return}if(U.type==="quota-status"&&Array.isArray(U.providers)){window.dispatchEvent(new CustomEvent("termdock:quota-update",{detail:U.providers}));return}if(U.type==="focus-mode"){t({type:"focus-mode",focusTrackingRequested:U.focusTrackingRequested===!0});return}if(U.type==="resize-ack"){t({type:"resize-ack",seq:typeof U.seq=="number"?U.seq:void 0,cols:typeof U.cols=="number"?U.cols:void 0,rows:typeof U.rows=="number"?U.rows:void 0,ok:U.ok!==!1,error:typeof U.error=="string"?U.error:void 0});return}if(U.type==="pty-size"){t({type:"pty-size",cols:typeof U.cols=="number"?U.cols:void 0,rows:typeof U.rows=="number"?U.rows:void 0,source:typeof U.source=="string"?U.source:void 0});return}if(U.type==="shell-title"){t({type:"shell-title",title:typeof U.title=="string"?U.title:""});return}if(U.type==="prompt-state"){t({type:"prompt-state",state:U.state==="running"?"running":"idle",exitCode:typeof U.exitCode=="number"?U.exitCode:void 0});return}const z=U;if(z.type==="connected"){typeof z.replayLastSeq=="number"&&z.replayLastSeq>0&&(m=z.replayLastSeq,I.lastSeq=m),t(z);return}if(z.type==="exit"){R(),t(z);return}t(z),z.type==="data"&&typeof z.seq=="number"&&Number.isFinite(z.seq)&&z.seq>m&&(m=z.seq,I.lastSeq=m)}catch(U){r?.(U,!1)}},O.onerror=()=>{A.has(O)||(S(),k(I),x||(x=!0,Q(new Error("WebSocket connection error"),!1)))},O.onclose=N=>{if(!A.has(O)&&(S(),k(I),!d.isClosed&&!x)){if(x=!0,N.code===4001){console.warn("[Terminal] WS 4001: Session not found on server",{code:N.code,reason:N.reason,stack:new Error().stack}),Q(new Error("Session not found on server"),!0);return}if(N.code===4003||N.code===4401){try{window.dispatchEvent(new CustomEvent(Bp))}catch{}Q(new Error("Authentication required"),!0);return}Q(new Error("WebSocket connection closed"),!1)}},h=I,Io.set(e,h)},Q=(T,O)=>{if(!d.isClosed)if(d.retryCount<s&&!O){d.retryCount++;const I=Math.min(i*Math.pow(2,d.retryCount-1),a);t({type:"reconnecting",attempt:d.retryCount,maxAttempts:s}),d.retryTimeout=setTimeout(()=>{d.isClosed||B()},I)}else r?.(T,O||d.retryCount>=s),R()};return B(),R}async function Mk(e,t){const r=Io.get(e);if(r){if(r.ws.readyState===WebSocket.OPEN){r.pendingInputs.push(t),w4(r);return}if(r.ws.readyState===WebSocket.CONNECTING){r.pendingInputs.push(t);return}}const n=await Sn(),s=await fetch(`/api/terminal/${e}/input`,{method:"POST",headers:{"Content-Type":"text/plain","X-XSRF-TOKEN":n},body:t});if(!s.ok){const i=await s.json().catch(()=>({error:"Failed to send input"}));throw new Error(i.error||"Failed to send terminal input")}}function Rk(e){const t=Io.get(e);if(!t)return!1;if(t.ws.readyState!==WebSocket.OPEN)return t.reconnectNow(),!0;const r=t.lastInboundAt;try{t.ws.send(JSON.stringify({type:"ping"}))}catch{}return setTimeout(()=>{t.lastInboundAt<=r&&t.reconnectNow()},Ak),!0}function $5(e,t,r){const n=Io.get(e);if(!(!n||n.ws.readyState!==WebSocket.OPEN))try{n.ws.send(JSON.stringify({type:"focus",focused:t,reason:r}))}catch{}}function H5(e,t,r){const n=Io.get(e);if(!(!n||n.ws.readyState!==WebSocket.OPEN))try{n.ws.send(JSON.stringify({type:"viewing",viewing:t,reason:r}))}catch{}}function U5(e){const t=Io.get(e);if(!(!t||t.ws.readyState!==WebSocket.OPEN))try{t.ws.send(JSON.stringify({type:"agent-review-ack"}))}catch{}}function z5(e,t,r){const n=Io.get(e);if(!(!n||n.ws.readyState!==WebSocket.OPEN))try{n.ws.send(JSON.stringify({type:"flow-control",paused:t,reason:r}))}catch{}}async function Nk(e,t,r,n){const s=Io.get(e);if(s&&s.ws.readyState===WebSocket.OPEN)try{s.ws.send(JSON.stringify({type:"resize",cols:t,rows:r,seq:n}));return}catch{}const i=await Sn(),a=await fetch(`/api/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":i},body:JSON.stringify({cols:t,rows:r,seq:n})});if(!a.ok){const d=await a.json().catch(()=>({error:"Failed to resize terminal"}));throw new Error(d.error||"Failed to resize terminal")}const u=await a.json().catch(()=>({success:!0}));if(u?.success===!1||u?.ok===!1)throw new Error(u?.error||"Failed to resize terminal")}async function Dk(e,t){const r=Io.get(e);if(r&&r.ws.readyState===WebSocket.OPEN)return t.action==="scroll"?(r.ws.send(JSON.stringify({type:"tmux",...t})),{success:!0}):new Promise((i,a)=>{const u=Math.random().toString(36).substring(7);ef.set(u,{resolve:i,reject:a}),r.ws.send(JSON.stringify({type:"tmux",reqId:u,...t})),setTimeout(()=>{ef.has(u)&&(ef.delete(u),a(new Error("Tmux action timed out")))},3e4)});const n=await Sn(),s=await fetch(`/api/terminal/${e}/tmux`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify(t)});if(!s.ok){const i=await s.json().catch(()=>({error:"Failed to execute tmux action"}));throw new Error(i.error||"Failed to execute tmux action")}return s.json()}async function A4(e){const t=Io.get(e);if(t){t.retryState.isClosed=!0;try{t.ws.close()}catch{}Io.delete(e)}const r=await Sn(),n=await fetch(`/api/terminal/${e}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":r}});if(n.status!==404&&!n.ok){const s=await n.json().catch(()=>({error:"Failed to close terminal"}));throw new Error(s.error||"Failed to close terminal")}}async function Bk(e,t){const r=Io.get(e);if(r){r.retryState.isClosed=!0;try{r.ws.close()}catch{}Io.delete(e)}const n=await Sn(),s=await fetch(`/api/terminal/${e}/restart`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify({...t.cwd?{cwd:t.cwd}:{},cols:t.cols??80,rows:t.rows??24,mode:t.mode,tmuxSessionName:t.tmuxSessionName})});if(!s.ok){const i=await s.json().catch(()=>({error:"Failed to restart terminal"}));throw new Error(i.error||"Failed to restart terminal session")}return s.json()}async function Pk(e){const t=await fetch(`/api/terminal/${e}/health`,{method:"GET"});if(!t.ok){if(t.status===404)return{healthy:!1,sessionId:e};const r=await t.json().catch(()=>({error:"Failed to check terminal health"}));throw new Error(r.error||"Failed to check terminal health")}return t.json()}async function jk(e){const t=await Sn(),r=await fetch("/api/terminal/force-kill",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to force kill terminal"}));throw new Error(n.error||"Failed to force kill terminal")}}async function w2(){const e=await fetch("/api/terminal/tmux/sessions",{method:"GET"});if(!e.ok){const r=await e.json().catch(()=>({error:"Failed to list tmux sessions"}));throw new Error(r.error||"Failed to list tmux sessions")}const t=await e.json();return Array.isArray(t.sessions)?t.sessions:[]}async function A2(){const e=await fetch("/api/terminal/tmux/status",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to get tmux status"}));throw new Error(t.error||"Failed to get tmux status")}return e.json()}async function T4(e){const t=e.trim();if(!t)throw new Error("tmux session name is required");const r=await Sn(),n=await fetch(`/api/terminal/tmux/sessions/${encodeURIComponent(t)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":r}});if(!n.ok){const i=await n.json().catch(()=>({error:"Failed to kill tmux session"}));throw new Error(i.error||"Failed to kill tmux session")}const s=await n.json();return{cleanedSessions:Array.isArray(s.cleanedSessions)?s.cleanedSessions:[],alreadyGone:!!s.alreadyGone}}const xh=new Map;function Fk(e){return JSON.stringify({preferredFrontendSessionId:e.preferredFrontendSessionId??null,mode:e.mode??null,tmuxSessionName:e.tmuxSessionName??null,cwd:e.cwd??null,termType:e.termType??null,createIfEmpty:e.createIfEmpty===!0,requireExisting:e.requireExisting===!0})}async function Qk(){const e=await fetch("/api/terminal/session-inventory",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to load session inventory"}));throw new Error(t.error||"Failed to load session inventory")}return e.json()}async function S4(e){const t=Fk(e),r=xh.get(t);if(r)return r;const n=await Sn(),s=fetch("/api/terminal/session-inventory/open",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify(e)}).then(async i=>{if(!i.ok){const a=await i.json().catch(()=>({error:"Failed to open session"}));throw new bm(a.error||"Failed to open session",i.status,typeof a.code=="string"?a.code:void 0)}return i.json()}).finally(()=>{xh.get(t)===s&&xh.delete(t)});return xh.set(t,s),s}async function up(e,t){const r=await Sn(),n=await fetch(`/api/terminal/session-inventory/sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>({error:"Failed to update session"}));throw new Error(s.error||"Failed to update session")}return n.json()}async function Ok(e){const t=await Sn(),r=await fetch("/api/terminal/session-inventory/reorder",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({sessionIds:e})});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to reorder sessions"}));throw new Error(n.error||"Failed to reorder sessions")}return r.json()}async function $k(e){const t=await Sn(),r=await fetch(`/api/terminal/session-inventory/sessions/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to remove session"}));throw new Error(n.error||"Failed to remove session")}}async function Hk(){const e=await Sn(),t=await fetch("/api/terminal/session-inventory/sessions",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok){const r=await t.json().catch(()=>({error:"Failed to clear sessions"}));throw new Error(r.error||"Failed to clear sessions")}}async function G5(){const e=await fetch("/api/terminal/toolbar-presets",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to load toolbar presets"}));throw new Error(t.error||"Failed to load toolbar presets")}return e.json()}async function Uk(e){const t=await Sn(),r=await fetch("/api/terminal/toolbar-presets",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to save toolbar presets"})),s=new Error(n.error||"Failed to save toolbar presets");throw s.current=n.current,s.code=n.code,s}return r.json()}async function C4(){const e=await fetch("/api/terminal/settings",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to load settings"}));throw new Error(t.error||"Failed to load settings")}return e.json()}async function dp(e){const t=await Sn(),r=await fetch("/api/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to update settings"}));throw new Error(n.error||"Failed to update settings")}return r.json()}async function zk(){const e=await fetch("/api/terminal/context-draft",{method:"GET"});if(!e.ok){const t=await e.json().catch(()=>({error:"Failed to load context draft"}));throw new Error(t.error||"Failed to load context draft")}return e.json()}async function Gk(e,t){const r=await Sn(),n=await fetch("/api/terminal/context-draft",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify({text:e,origin:t})});if(!n.ok){const s=await n.json().catch(()=>({error:"Failed to update context draft"}));throw new Error(s.error||"Failed to update context draft")}return n.json()}async function Wk(){const e=await fetch("/api/auth/status");if(!e.ok)throw new Error("Failed to query auth status");return e.json()}async function Vk(e){const t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(t.ok)return v4(),{ok:!0};const r=await t.json().catch(()=>null);return t.status===429?{ok:!1,rateLimited:!0,retryAfterMs:typeof r?.retryAfterMs=="number"?r.retryAfterMs:void 0,error:r?.error||"Too many failed attempts. Please wait and try again."}:{ok:!1,error:r?.error||"Login failed"}}async function qk(){const e=await Sn();await fetch("/api/auth/logout",{method:"POST",headers:{"X-XSRF-TOKEN":e}}),v4()}async function Yk(){const e=await fetch("/api/terminal/agent-hooks");if(!e.ok)throw new Error("Failed to get agent hooks");const t=await e.json();return Array.isArray(t?.agents)?t.agents:[]}async function Kk(e){const t=await Sn(),r=await fetch(`/api/terminal/agent-hooks/${encodeURIComponent(e)}/install`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),n=await r.json().catch(()=>({}));if(!r.ok)throw new Error(n.error||"Failed to install agent hooks");return{summary:n.summary??"Installed",devMode:n.devMode===!0}}async function Zk(e){const t=await Sn(),r=await fetch(`/api/terminal/agent-hooks/${encodeURIComponent(e)}/uninstall`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),n=await r.json().catch(()=>({}));if(!r.ok)throw new Error(n.error||"Failed to uninstall agent hooks");return n.summary??"Removed"}async function Xk(){const e=await fetch("/api/terminal/agent-plugins");if(!e.ok)throw new Error("Failed to get agent plugins");return await e.json()}async function Jk(e){const t=await Sn(),r=await fetch("/api/terminal/agent-plugins",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)}),n=await r.json().catch(()=>({}));if(!r.ok)throw new Error(n.error||"Failed to create agent plugin");return n}async function eL(e){const t=await Sn(),r=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!r.ok){const n=await r.json().catch(()=>({}));throw new Error(n.error||"Failed to delete agent plugin")}}async function tL(e){const t=await Sn(),r=await fetch(`/api/terminal/${encodeURIComponent(e)}/agent-resume`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),n=await r.json().catch(()=>({}));if(!r.ok)throw new Error(n.error||"Failed to resume agent session");return{command:n.command??""}}async function Pu(e){const t=await Sn(),r=await fetch("/api/terminal/program-rules",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:"Failed to update program rules"}));throw new Error(n.error||"Failed to update program rules")}return r.json()}async function rL(){const e=await Sn(),t=await fetch("/api/terminal/program-rules",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Error("Failed to reset program rules");return t.json()}async function nL(){const e=await fetch("/api/terminal/program-detection");if(!e.ok)throw new Error("Failed to get program detection config");return e.json()}async function W5(e){const t=await Sn(),r=await fetch("/api/terminal/program-detection",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!r.ok)throw new Error("Failed to save program detection config");return r.json()}async function sL(){const e=await Sn(),t=await fetch("/api/terminal/program-detection",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Error("Failed to reset program detection config");return t.json()}const iL={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".bmp":"image/bmp",".ico":"image/x-icon",".svg":"image/svg+xml"};function _4(e){const t=e.lastIndexOf(".");return t<0?null:iL[e.slice(t).toLowerCase()]??null}function $b(e){return _4(e)!==null}const oL={".mp4":"video/mp4",".m4v":"video/x-m4v",".webm":"video/webm",".mov":"video/quicktime",".ogv":"video/ogg",".mpeg":"video/mpeg",".mpg":"video/mpeg"};function k4(e){const t=e.lastIndexOf(".");return t<0?null:oL[e.slice(t).toLowerCase()]??null}function L4(e){return k4(e)!==null}function aL(e){return`/api/terminal/fs/video?path=${encodeURIComponent(e)}&action=view_file`}const lL=[".stl",".glb",".gltf"];function E4(e){const t=e.lastIndexOf(".");if(t<0)return null;const r=e.slice(t).toLowerCase();return lL.includes(r)?r:null}function I4(e){return E4(e)!==null}const cL=[".html",".htm"];function yh(e){const t=e.lastIndexOf(".");if(t<0)return!1;const r=e.slice(t).toLowerCase();return cL.includes(r)}function uL(e){return`/api/terminal/fs/preview/${e.split(/[\\/]+/).filter(Boolean).map(r=>encodeURIComponent(r)).join("/")}`}const dL={".stl":"model/stl",".glb":"model/gltf-binary",".gltf":"model/gltf+json"};async function M4(e,t,r,n="list_directory",s){const i=new URLSearchParams({path:e});r&&i.set("showHidden","true"),i.set("action",n),s&&i.set("requestSlotId",s);const a=await ni(`/api/terminal/fs/list?${i}`,{signal:t},tu,"Directory listing took too long. The folder may be on slow storage or blocked by another process.");if(!a.ok){const u=await a.json().catch(()=>({error:"Failed to list directory"}));throw new Error(u.error||"Failed to list directory")}return a.json()}async function fL(e,t,r,n,s,i="name",a){const u=new URLSearchParams({path:e,query:t,stream:"true"});s&&u.set("showHidden","true"),i==="content"&&u.set("mode","content"),a&&u.set("requestSlotId",a);const d=await fetch(`/api/terminal/fs/search?${u}`,{signal:n});if(!d.ok||!d.body){const v=await d.json().catch(()=>({error:"Failed to search files"}));throw new Error(v.error||"Failed to search files")}const h=d.body.getReader(),m=new TextDecoder;let b="";const x=v=>{if(!v.trim())return;const A=JSON.parse(v);if(A.type==="meta")r({path:A.path,query:A.query,engine:A.engine,mode:A.mode,limited:A.limited});else if(A.type==="batch")r({entries:A.entries??[]});else if(A.type==="content-batch")r({contentEntries:A.contentEntries??[]});else{if(A.type==="error")throw new Error(A.message||"Search failed");A.type==="done"&&r({total:A.total,truncated:A.truncated,limited:A.limited,engine:A.engine,mode:A.mode,done:!0})}};for(;;){const{value:v,done:A}=await h.read();if(A)break;b+=m.decode(v,{stream:!0});let S=b.indexOf(`
|
|
3
3
|
`);for(;S>=0;)x(b.slice(0,S)),b=b.slice(S+1),S=b.indexOf(`
|
|
4
4
|
`)}b+=m.decode(),x(b)}async function hL(e,t,r){const n=new URLSearchParams;n.set("roots",e.join("|"));const s=await fetch(`/api/terminal/fs/watch?${n}`,{signal:r});if(!s.ok||!s.body){const h=await s.json().catch(()=>({error:"Failed to watch files"}));throw new Error(h.error||"Failed to watch files")}const i=s.body.getReader(),a=new TextDecoder;let u="";const d=h=>{if(!h.trim())return;const m=JSON.parse(h);m.type==="events"&&m.events?.length&&t(m.events)};for(;;){const{value:h,done:m}=await i.read();if(m)break;u+=a.decode(h,{stream:!0});let b=u.indexOf(`
|
|
@@ -166,12 +166,12 @@ ${I.desc}`:""}`,"aria-pressed":A===I.key,onPointerEnter:()=>v(I.key),onPointerLe
|
|
|
166
166
|
`)?`
|
|
167
167
|
`:`
|
|
168
168
|
|
|
169
|
-
`;return`${e}${n}${r}`}function Fq(e,t){const r=e.trim();return r?t?`${r}\r`:/\s$/.test(e)?e:`${r} `:""}const Sb="termdock:right-sidebar:html-view-mode-by-file:v1";function Qq(e){return e==="preview"||e==="source"}function NA(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(Qq)}function DA(e,t){if(!t)return null;const r=e&&!t.startsWith("/")?`${e}/${t}`:t;return e?`${e}::${r}`:r}function n6(e,t){const r=DA(e,t);return r?Ln(Sb,NA)?.[r]??"source":"source"}function Oq(e,t,r){const n=DA(e,t);if(!n)return;const s=Ln(Sb,NA)??{};Br(Sb,{...s,[n]:r})}function J1(e){const t=Number.isFinite(e)&&e>0?Math.floor(e):0,r=Math.floor(t/3600),n=Math.floor(t%3600/60),s=t%60,i=String(n).padStart(2,"0"),a=String(s).padStart(2,"0");return r>0?`${r}:${i}:${a}`:`${i}:${a}`}function $q(e,t,r){return!Number.isFinite(r)||r<=0||!t.width?0:Math.min(1,Math.max(0,(e-t.left)/t.width))*r}function Hq({url:e,onLoadError:t}){const{t:r}=jr(),n=w.useRef(null),s=w.useRef(null),i=w.useRef(!1),a=w.useRef(null),u=w.useRef(0),[d,h]=w.useState(0),[m,b]=w.useState(0),[x,v]=w.useState(!1),[A,S]=w.useState(!1),[k,L]=w.useState(null);w.useEffect(()=>()=>{a.current!==null&&cancelAnimationFrame(a.current)},[]);const R=w.useCallback(V=>{const K=n.current;if(!K)return;const ne=Number.isFinite(K.duration)?K.duration:V;K.currentTime=Math.min(Math.max(V,0),ne)},[]),B=w.useCallback(V=>{const K=s.current,ne=n.current;if(!K||!ne)return;const oe=K.getBoundingClientRect(),ye=$q(V,oe,ne.duration);u.current=ye,L(ye),a.current===null&&(a.current=requestAnimationFrame(()=>{a.current=null,R(u.current)}))},[R]),Q=w.useCallback(()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null),R(u.current)},[R]),T=w.useCallback(V=>{const K=n.current;if(!(!K||!Number.isFinite(K.duration)||K.duration<=0)){i.current=!K.paused,K.pause(),S(!0);try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}B(V.clientX)}},[B]),O=w.useCallback(()=>{Q(),S(!1),L(null);const V=n.current;V&&i.current&&!V.ended&&V.play().catch(()=>{}),i.current=!1},[Q]),I=w.useCallback(()=>{const V=n.current;V&&(V.paused?V.play().catch(()=>{}):V.pause())},[]),N=w.useCallback(V=>{const K=n.current;if(!K||!Number.isFinite(K.duration))return;const ne=V.shiftKey?10:5;let oe=null;V.key==="ArrowLeft"?oe=K.currentTime-ne:V.key==="ArrowRight"?oe=K.currentTime+ne:V.key==="Home"?oe=0:V.key==="End"&&(oe=K.duration),oe!==null&&(V.preventDefault(),R(oe))},[R]),U=A&&k!==null?k:m,z=d>0?Math.min(1,Math.max(0,U/d)):0;return l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-background","data-testid":"file-preview-video-player",children:[l.jsxs("div",{className:"relative min-h-0 flex-1",children:[l.jsx("video",{ref:n,"data-testid":"file-preview-video",className:"h-full w-full object-contain",src:e,preload:"metadata",playsInline:!0,onClick:I,onPlay:()=>v(!0),onPause:()=>v(!1),onTimeUpdate:V=>b(V.currentTarget.currentTime),onLoadedMetadata:V=>h(Number.isFinite(V.currentTarget.duration)?V.currentTarget.duration:0),onDurationChange:V=>h(Number.isFinite(V.currentTarget.duration)?V.currentTarget.duration:0),onError:t,children:r("rightSidebar.videoUnsupported")}),A&&k!==null&&l.jsx("div",{className:"pointer-events-none absolute bottom-1 z-10 -translate-x-1/2 rounded-md bg-surface-elevated px-2 py-1 text-[11px] font-medium text-foreground shadow-md",style:{left:`${z*100}%`},"data-testid":"file-preview-video-scrub-time",children:J1(k)})]}),l.jsx("div",{"data-testid":"file-preview-video-controls",className:`shrink-0 border-t border-border/60 bg-background px-2 py-1.5 ${B9}`,[P9]:"",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{type:"button",onClick:I,"aria-label":r(x?"rightSidebar.videoPause":"rightSidebar.videoPlay"),title:r(x?"rightSidebar.videoPause":"rightSidebar.videoPlay"),className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-foreground transition hover:bg-surface-elevated active:scale-95","data-testid":"file-preview-video-play",children:x?l.jsx(FI,{size:14}):l.jsx(VI,{size:14})}),l.jsxs("div",{ref:s,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(d),"aria-valuenow":Math.floor(U),tabIndex:0,className:"group relative h-5 min-w-0 flex-1 cursor-pointer touch-none py-2","data-testid":"file-preview-video-track",onPointerDown:T,onPointerMove:V=>{A&&B(V.clientX)},onPointerUp:O,onPointerCancel:O,onKeyDown:N,children:[l.jsx("div",{className:"h-1 w-full rounded-full bg-surface-elevated"}),l.jsx("div",{className:"absolute inset-y-0 left-0 my-auto h-1 rounded-full bg-primary",style:{width:`${z*100}%`}}),l.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary shadow",style:{left:`${z*100}%`}})]}),l.jsxs("div",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground","data-testid":"file-preview-video-time",children:[J1(U)," / ",J1(d)]})]})})]})}const qx="termdock:right-sidebar:file-tree-scroll:v1",Yx="termdock:right-sidebar:file-preview-reading-state:v1",X0="termdock:right-sidebar:file-tree-width:v1",BA="termdock:right-sidebar:markdown-view-mode:v1",PA="termdock:right-sidebar:diff-change-list-mode:v1",jA="termdock:right-sidebar:diff-wrap:v1",FA="termdock:diff-viewer:view-type:v1",QA="termdock:right-sidebar:file-search-mode:v1",e2="termdock:right-sidebar:collapsed-git-repo-groups:v1",s6="termdock:right-sidebar:collapsed-diff-directories:v1",t2="termdock:right-sidebar:branch-audit-module-open:v1",OA="termdock:right-sidebar:branch-audit-module:v1",Uq=150,$A="termdock:right-sidebar:git-bundle-snapshots:v1",HA="termdock:right-sidebar:active-git-repo:v1",i6="termdock:right-sidebar:context-draft-enabled:v1",o6="termdock:right-sidebar:context-draft-collapsed:v1",r2="termdock:right-sidebar:context-draft-text:v1",zq=300,Gq=20,Wq=120,Vq=8,qq=1440*60*1e3,Yq=250,Kq=250,Zq=120,Xq=700,n2=600,a6=[2e3,5e3,15e3,3e4],Jq=320,eY=500,tY=20,rY=12e3,Cb=300,l6=240,nY=560,sY=600,iY=720,UA="border-r px-2 py-1.5 sm:px-3 sm:py-2",um="max-w-[18rem] whitespace-normal break-words sm:max-w-[27rem]",zA=`${UA} border-b border-border/15 font-semibold last:border-r-0`,GA=`${UA} border-border/10 align-top text-muted-foreground last:border-r-0`,Kx="termdock-file-preview-horizontal-scroll",oY=w.lazy(()=>kd(()=>import("./ModelPreview-61nSx12D.js"),__vite__mapDeps([2,3,1,4]))),WA=`${Kx} termdock-md-table-scroll max-w-full overflow-x-auto overflow-y-hidden rounded-lg border border-border/20 bg-surface`,aY=new Set([".md",".markdown",".mdown",".mkdn",".mkd"]);function lY(e){return e==="preview"||e==="source"}function cY(e){return e==="list"||e==="tree"||e==="ai"}function c6(){return Ln(BA,lY)??"preview"}function uY(){return Ln(PA,cY)??"tree"}function Ep(e){return typeof e=="boolean"}function dY(e){return typeof e=="string"}function fY(){return Ln(jA,Ep)??!0}function hY(e){return e==="unified"||e==="split"}function pY(){return Ln(FA,hY)??"unified"}function mY(e){return e==="name"||e==="content"||e==="regex"}function gY(){return Ln(QA,mY)??"name"}function Xh(e){return e===void 0||Array.isArray(e)&&e.every(t=>typeof t=="string")}function VA(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.path=="string"&&typeof t.absolutePath=="string"&&typeof t.status=="string"&&typeof t.staged=="boolean"&&typeof t.unstaged=="boolean"&&typeof t.untracked=="boolean"&&typeof t.tracked=="boolean"&&typeof t.canStage=="boolean"&&typeof t.canUnstage=="boolean"&&typeof t.canStash=="boolean"&&typeof t.canRestoreWorktree=="boolean"&&(t.repoRoot===void 0||typeof t.repoRoot=="string")&&(t.repoRelativeRoot===void 0||typeof t.repoRelativeRoot=="string")&&(t.repoName===void 0||typeof t.repoName=="string")&&(t.oldPath===void 0||typeof t.oldPath=="string")&&(t.indexStatus===void 0||typeof t.indexStatus=="string")&&(t.worktreeStatus===void 0||typeof t.worktreeStatus=="string")}function bY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.path=="string"&&typeof t.absolutePath=="string"&&typeof t.status=="string"}function qA(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.available=="boolean"&&(t.cwd===void 0||typeof t.cwd=="string")&&(t.root===void 0||typeof t.root=="string")&&(t.branch===void 0||t.branch===null||typeof t.branch=="string")&&Xh(t.remotes)&&Xh(t.branches)&&Xh(t.remoteBranches)&&(t.upstream===void 0||t.upstream===null||typeof t.upstream=="string")&&(t.upstreamRemote===void 0||t.upstreamRemote===null||typeof t.upstreamRemote=="string")&&(t.upstreamBranch===void 0||t.upstreamBranch===null||typeof t.upstreamBranch=="string")&&(t.ahead===void 0||t.ahead===null||typeof t.ahead=="number")&&(t.behind===void 0||t.behind===null||typeof t.behind=="number")&&(t.status===void 0||typeof t.status=="string")&&Xh(t.recentCommits)&&(t.changedFiles===void 0||Array.isArray(t.changedFiles)&&t.changedFiles.every(bY))&&(t.truncated===void 0||typeof t.truncated=="boolean")&&(t.error===void 0||typeof t.error=="string")&&(t.code===void 0||typeof t.code=="string")}function xY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.id=="string"&&typeof t.root=="string"&&(t.displayRoot===void 0||typeof t.displayRoot=="string")&&typeof t.relativeRoot=="string"&&typeof t.name=="string"&&typeof t.depth=="number"&&typeof t.nested=="boolean"&&typeof t.available=="boolean"&&Array.isArray(t.files)&&t.files.every(VA)&&(t.context===null||t.context===void 0||qA(t.context))&&(t.untrackedDeferred===void 0||typeof t.untrackedDeferred=="boolean")&&(t.error===void 0||typeof t.error=="string")}function yY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.root=="string"&&typeof t.label=="string"&&(t.branch===void 0||t.branch===null||typeof t.branch=="string")&&typeof t.count=="number"&&typeof t.staged=="number"}function vY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.available=="boolean"&&Array.isArray(t.files)&&t.files.every(VA)&&(t.context===null||t.context===void 0||qA(t.context))&&(t.repositories===void 0||Array.isArray(t.repositories)&&t.repositories.every(xY))&&(t.repoFilters===void 0||Array.isArray(t.repoFilters)&&t.repoFilters.every(yY))&&(t.truncatedRepositories===void 0||typeof t.truncatedRepositories=="boolean")&&(t.untrackedDeferred===void 0||typeof t.untrackedDeferred=="boolean")&&(t.error===void 0||typeof t.error=="string")&&(t.code===void 0||typeof t.code=="string")}function wY(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;const r=t;return typeof r.updatedAt=="number"&&vY(r.bundle)})}function YA(){return Ln($A,wY)??{}}function AY(e){if(!e)return null;const t=YA()[e];return!t||Date.now()-t.updatedAt>qq?null:t}function TY(e){const t={...e};return delete t.cached,delete t.stale,delete t.cacheAgeMs,delete t.nestedDeferred,t}function u6(e,t){if(!e||!t.available||t.error)return;const r=YA();r[e]={bundle:TY(t),updatedAt:Date.now()};const n=Object.entries(r).sort(([,s],[,i])=>i.updatedAt-s.updatedAt).slice(0,Vq);Br($A,Object.fromEntries(n))}function d6(e){return e.repositories??(e.context?.root?[{id:e.context.root,root:e.context.root,relativeRoot:".",name:go(e.context.root)||e.context.root,depth:0,nested:!1,available:e.available,files:e.files,context:e.context,error:e.error}]:[])}function SY(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string")}function KA(){return Ln(HA,SY)??{}}function f6(e){if(!e)return;const t=KA();return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function s2(e,t){e&&Br(HA,{...KA(),[e]:t})}function h6(e,t){if(!t)return null;const r=new Set((e.repoFilters??[]).map(n=>n.root));return r.has(t)?t:r.size>0?null:(e.repositories??[]).some(n=>n.root===t)?t:null}function _b(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function p6(e){const t=Ln(e,_b);return t?new Set(t):new Set}function i2(e,t){Br(e,[...t])}function CY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.filePath=="string"&&typeof t.hunkHeader=="string"&&typeof t.hunkIndex=="number"&&typeof t.fingerprint=="string"&&typeof t.additions=="number"&&typeof t.deletions=="number"&&typeof t.diff=="string"&&(t.oldPath===void 0||t.oldPath===null||typeof t.oldPath=="string")&&(t.newPath===void 0||t.newPath===null||typeof t.newPath=="string")&&(t.source===void 0||t.source==="committed"||t.source==="uncommitted"||t.source==="unknown")&&(t.commit===void 0||t.commit===null||typeof t.commit=="string")}function _Y(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.available=="boolean"&&(t.repoRoot===void 0||typeof t.repoRoot=="string")&&(t.workspaceRoot===void 0||typeof t.workspaceRoot=="string")&&(t.baseRef===void 0||typeof t.baseRef=="string")&&(t.baseBranch===void 0||typeof t.baseBranch=="string")&&(t.currentBranch===void 0||t.currentBranch===null||typeof t.currentBranch=="string")&&(t.headRef===void 0||t.headRef===null||typeof t.headRef=="string")&&(t.diffFingerprint===void 0||typeof t.diffFingerprint=="string")&&(t.stat===void 0||typeof t.stat=="string")&&(t.files===void 0||_b(t.files))&&(t.hunks===void 0||Array.isArray(t.hunks)&&t.hunks.every(CY))&&(t.commits===void 0||_b(t.commits))&&(t.commitCount===void 0||typeof t.commitCount=="number")&&(t.diff===void 0||typeof t.diff=="string")&&(t.truncated===void 0||typeof t.truncated=="boolean")&&(t.error===void 0||typeof t.error=="string")}function kY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.key=="string"&&_Y(t.diff)&&typeof t.repoLabel=="string"&&typeof t.createdAt=="number"}function LY(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;const r=t;return Array.isArray(r.selectedRepoRoots)&&r.selectedRepoRoots.every(n=>typeof n=="string")&&!!r.repoTargetBranches&&typeof r.repoTargetBranches=="object"&&!Array.isArray(r.repoTargetBranches)&&Object.values(r.repoTargetBranches).every(n=>typeof n=="string")&&(r.repoBaseBranches===void 0||!!r.repoBaseBranches&&typeof r.repoBaseBranches=="object"&&!Array.isArray(r.repoBaseBranches)&&Object.values(r.repoBaseBranches).every(n=>typeof n=="string"))&&(r.previewEntries===void 0||Array.isArray(r.previewEntries)&&r.previewEntries.every(kY))&&(r.selectedPreviewKey===void 0||r.selectedPreviewKey===null||typeof r.selectedPreviewKey=="string")&&(r.selectedPreviewFileKey===void 0||r.selectedPreviewFileKey===null||typeof r.selectedPreviewFileKey=="string")&&(r.previewDetailOpen===void 0||typeof r.previewDetailOpen=="boolean")&&(r.previewScrollTops===void 0||!!r.previewScrollTops&&typeof r.previewScrollTops=="object"&&!Array.isArray(r.previewScrollTops)&&Object.values(r.previewScrollTops).every(n=>typeof n=="number"))&&(r.previewMobileSlideIndex===void 0||typeof r.previewMobileSlideIndex=="number")&&(r.includeUncommitted===void 0||typeof r.includeUncommitted=="boolean")&&typeof r.updatedAt=="number"})}function m6(){return Ln(OA,LY)??{}}function g6(e){return[e.repoRoot,e.baseRef,e.branchName??"",e.headRef??"",e.diffFingerprint??""].join("\0")}function b6(e){const t=e?.trim()??"",r=t.indexOf("/");return r>=0?t.slice(r+1):t}function ZA(e,t){const r=e?.trim(),n=t?.trim();return!r||!n?!1:r===n||b6(r)===b6(n)}function x6(e){const t=e?.branch??null;return[e?.upstream,...e?.remoteBranches??[],...e?.branches??[]].find(n=>n&&!ZA(n,t))??""}function kb(e,t){const r=Math.max(l6,t-320),n=Math.min(nY,r);return Math.min(n,Math.max(l6,e))}function EY(e){return typeof e=="number"&&Number.isFinite(e)}function IY(e){return kb(Ln(X0,EY)??Cb,e)}function XA(e){const t=e.split(/[\\/]/).pop()??e,r=t.lastIndexOf(".");return r>=0?t.slice(r).toLowerCase():""}function Jh(e){return aY.has(XA(e))}function JA(e){const t=e.trim().replace(/\s+/g,"");return/^-{3,}$/.test(t)||/^\*{3,}$/.test(t)||/^_{3,}$/.test(t)}function Lb(e){const t=e.trim();return/^#{1,6}\s+/.test(t)||JA(e)||/^>\s?/.test(t)||/^(```|~~~)/.test(t)||/^(?:[-+*]|\d+[.)])\s+/.test(t)}function MY(e){const t=e.trim();return/^(https?:|mailto:|#|\/|\.\/|\.\.\/)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/[<>]/.test(t)?t:null}const eT=w.createContext(null);function Ip(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function tT(e){return e.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/[`*_~]/g,"").replace(/<[^>]+>/g,"").trim()}function rT(e){return e.replace(/\s+#+\s*$/,"").trim()}function Eb(e,t){const n=tT(e).toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section",s=t.headingSlugCounts.get(n)??0;return t.headingSlugCounts.set(n,s+1),s===0?n:`${n}-${s}`}function y6(e){return tT(e)||e.trim()}function dm(e){const t=e.match(/^\s{0,3}\[([^\]]+)\]:\s+(.+?)\s*$/);if(!t)return null;const r=Mb(t[2]);return r?{id:Ip(t[1]),definition:{href:r.href,title:r.title}}:null}function RY(e){const t=new Map;for(const r of e){const n=dm(r);n&&t.set(n.id,n.definition)}return t}function nT(e){return e.trim().toLowerCase()}function sT(e){const t=e.match(/^\s{0,3}\[\^([^\]]+)\]:\s+(.+)\s*$/);return t?{id:nT(t[1]),text:t[2]}:null}function NY(e){const t=new Map;let r=null;for(const n of e){const s=sT(n);if(s){r=s.id,t.set(s.id,{id:s.id,text:s.text,index:t.size+1});continue}if(r&&/^\s{4,}\S/.test(n)){const i=t.get(r);i&&(i.text=`${i.text} ${n.trim()}`);continue}n.trim()&&(r=null)}return t}function DY(e){const t=new Set;let r=!1;return e.forEach((n,s)=>{if(sT(n)){t.add(s),r=!0;return}if(r&&/^\s{4,}\S/.test(n)){t.add(s);return}n.trim()&&(r=!1)}),t}function BY(e){const t=[...e];let r=0;const n=e[0]?.trim();if(n==="---"||n==="+++"){for(t[0]="",r=1;r<e.length&&e[r].trim()!==n;)t[r]="",r+=1;r<e.length&&(t[r]="",r+=1)}for(;r<e.length;){const s=e[r].trim();if(s.startsWith("<!--")){if(t[r]="",!s.includes("-->")){for(r+=1;r<e.length&&!e[r].includes("-->");)t[r]="",r+=1;r<e.length&&(t[r]="")}r+=1;continue}r+=1}return t}function PY(e){const t=e.replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?r===0?"/":"":t.slice(0,r)}function v6(e){const t=e.split(/[?#]/,1)[0],r=t.startsWith("/"),n=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){n.length>0&&n.pop();continue}n.push(i)}return`${r?"/":""}${n.join("/")}`||(r?"/":".")}function jY(e,t,r){const n=e.trim();if(!n||/^(?:javascript|data):/i.test(n))return null;if(/^https?:\/\//i.test(n))return n;if(!$b(n.split(/[?#]/,1)[0]))return null;let s;if(n.startsWith("/")){const i=r&&(n===r||n.startsWith(`${r}/`));s=v6(r&&!i?`${r}/${n.slice(1)}`:n)}else{if(!t)return null;s=v6(`${PY(t)}/${n}`)}return`/api/terminal/fs/blob?path=${encodeURIComponent(s)}`}const Ib=128,FY=360,o2=480;function Zx(e){try{return/\.svg(?=$|[?#&])/i.test(decodeURIComponent(e))}catch{return!1}}function QY(e,t,r,n){if(!t||!r)return null;let s,i;return Zx(e)?(i=Math.min(Math.max(r,Ib),FY),s=t*i/r):(s=t,i=r),n>0&&s>n&&(i=i*n/s,s=n),i>o2&&(s=s*o2/i,i=o2),{width:Math.max(1,Math.round(s)),height:Math.max(1,Math.round(i))}}function OY(e){if(!e.startsWith("/api/terminal/fs/blob?"))return null;try{return new URLSearchParams(e.slice(e.indexOf("?"))).get("path")}catch{return null}}function iT(e){const t=OY(e),r=At(n=>t?(n.fileChangeVersions.get(t)??0)+n.fileWatchEpoch:0);return t&&r>0?`${e}&v=${r}`:e}function $Y({src:e,alt:t,title:r}){const n=Zx(e),s=iT(e),i=w.useRef(null),[a,u]=w.useState(!1),[d,h]=w.useState(0),[m,b]=w.useState({status:"loading"}),[x,v]=w.useState(null);w.useLayoutEffect(()=>{const k=i.current,L=k?.parentElement?.parentElement??k?.parentElement;if(!L)return;const R=()=>h(L.clientWidth);if(R(),typeof ResizeObserver>"u")return;const B=new ResizeObserver(R);return B.observe(L),()=>B.disconnect()},[]),w.useEffect(()=>{if(a)return;const k=i.current;if(!k||typeof IntersectionObserver>"u"){u(!0);return}const L=new IntersectionObserver(R=>{R.some(B=>B.isIntersecting)&&(u(!0),L.disconnect())},{rootMargin:"400px"});return L.observe(k),()=>L.disconnect()},[a]),w.useEffect(()=>{if(!a)return;const k=new AbortController;let L=null;b({status:"loading"});const R=window.setTimeout(()=>{k.abort(new DOMException("Image fetch timed out","TimeoutError"))},15e3);return fetch(s,{signal:k.signal}).then(async B=>{if(!B.ok)throw new Error(`HTTP ${B.status}`);const Q=Number(B.headers.get("X-Image-Width"))||0,T=Number(B.headers.get("X-Image-Height"))||0;return{blob:await B.blob(),width:Q,height:T}}).then(({blob:B,width:Q,height:T})=>{k.signal.aborted||(L=URL.createObjectURL(B),Q>0&&T>0&&v({width:Q,height:T}),b({status:"ready",objectUrl:L}))}).catch(()=>{const B=k.signal.reason;k.signal.aborted&&!(B instanceof DOMException&&B.name==="TimeoutError")||b({status:"fallback"})}).finally(()=>{window.clearTimeout(R)}),()=>{window.clearTimeout(R),k.abort(),L&&URL.revokeObjectURL(L)}},[a,s]);const A=QY(e,x?.width??0,x?.height??0,d),S=A??{width:Ib*2,height:Ib};return l.jsx("div",{ref:i,className:"block max-w-full",style:A?{width:A.width,height:A.height}:void 0,children:m.status==="ready"?l.jsx("img",{src:m.objectUrl,alt:t,title:r,decoding:"async",className:`${n?"":"termdock-fade-in "}block max-h-[480px] max-w-full object-contain`,style:A?{width:A.width,height:A.height}:void 0,onLoad:k=>{if(x)return;const L=k.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):m.status==="fallback"?l.jsx("img",{src:s,alt:t,title:r,loading:"lazy",decoding:"async",className:"block max-h-[480px] max-w-full object-contain",style:A?{width:A.width,height:A.height}:void 0,onLoad:k=>{if(x)return;const L=k.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):l.jsx("div",{"aria-hidden":!0,className:"flex max-w-full animate-pulse items-center justify-center rounded bg-surface-elevated/60",style:{width:S.width,height:S.height},children:l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:t||"…"})})})}function a2(e,t,r,n,s){const i=jY(r,s.markdownFilePath,s.rootPath);if(!i)return``;const a=s.images.length;s.images.push({kind:"image",src:i,alt:t,title:n});const u=l.jsx($Y,{src:i,alt:t,title:n});return s.onImageOpen?l.jsx("button",{type:"button",className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2 text-left transition hover:border-border-strong focus:outline-none focus:ring-2 focus:ring-ring/45",title:n||t||"Open image",onClick:d=>{d.stopPropagation(),s.onImageOpen?.(a)},children:u},e):l.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:u},e)}function l2(e){let t=e,r="";for(;/[.,;:!?)]$/.test(t);)r=`${t.slice(-1)}${r}`,t=t.slice(0,-1);return{linkText:t,suffix:r}}function w6(e){return/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(e)}function Mb(e){const t=e.trim(),r=t.match(/^<([^>]+)>(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(r)return{href:r[1],title:r[2]??r[3]??r[4]};const n=t.match(/^(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);return n?{href:n[1],title:n[2]??n[3]??n[4]}:null}const oT="",HY=/\\([\\`*{}\[\]#+\-.!_|~>$])/g;function UY(e){return e.replace(HY,(t,r)=>`${oT}${r.charCodeAt(0).toString(16).padStart(4,"0")}`)}function A6(e){return e.replace(new RegExp(`${oT}([0-9a-f]{4})`,"g"),(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\([()])/g,"$1")}function zY(e){const t=e.replace(/[\r\n]+/g," ");return/^ .+ $/.test(t)&&/[^ ]/.test(t.slice(1,-1))?t.slice(1,-1):t}const aT={ALLOWED_TAGS:["a","abbr","b","blockquote","br","code","del","details","div","em","i","kbd","li","mark","ol","p","pre","s","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],ALLOWED_ATTR:["href","title","class","id","colspan","rowspan"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!0};let ep=null;function lT(){return ep||(ep=kd(()=>import("./purify.es-CC4Brkr_.js"),[]).then(e=>e.default??e).catch(e=>{throw ep=null,e})),ep}function cT({html:e}){const{t}=jr(),[r,n]=w.useState(null);return w.useEffect(()=>{let s=!1;return n(null),lT().then(i=>{s||n(i.sanitize(e,aT))}).catch(()=>{s||n("")}),()=>{s=!0}},[e]),r===null?l.jsx("div",{className:"py-2 text-xs text-muted-foreground",children:t("rightSidebar.renderingHtml")}):r?l.jsx("div",{className:"text-muted-foreground",dangerouslySetInnerHTML:{__html:r}}):null}function GY({html:e}){const[t,r]=w.useState(null);return w.useEffect(()=>{let n=!1;return r(null),lT().then(s=>{n||r(s.sanitize(e,aT))}).catch(()=>{n||r("")}),()=>{n=!0}},[e]),t===null?null:t?l.jsx("span",{dangerouslySetInnerHTML:{__html:t}}):e}function uT(e){const t=e.trim().match(/^<(div|section|article|aside|table|p|ul|ol|li|blockquote|pre|figure|figcaption)\b[^>]*>/i);if(!t)return null;const r=t[1].toLowerCase();return{tag:r,selfContained:new RegExp(`</${r}>`,"i").test(e)}}let tp=null;function WY(){return tp||(tp=Promise.all([kd(()=>import("./katex-DnlPpQZa.js"),[]),kd(()=>Promise.resolve({}),__vite__mapDeps([5]))]).then(([e])=>e.default??e).catch(e=>{throw tp=null,e})),tp}function Df({tex:e,display:t=!1}){const[r,n]=w.useState(null),[s,i]=w.useState(!1);if(w.useEffect(()=>{let u=!1;return n(null),i(!1),WY().then(d=>{u||n(d.renderToString(e,{displayMode:t,throwOnError:!1,trust:!1,strict:"ignore"}))}).catch(()=>{u||i(!0)}),()=>{u=!0}},[t,e]),s)return l.jsx("code",{className:"rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground",children:t?`$$${e}$$`:`$${e}$`});if(!r)return l.jsx("span",{className:"text-muted-foreground/70",children:t?"Rendering formula...":e});const a=t?"my-2 overflow-auto rounded-md bg-surface-2 px-3 py-2 text-center":"inline-block align-middle";return l.jsx("span",{className:a,dangerouslySetInnerHTML:{__html:r}})}function VY(e,t,r){if(/^<br\s*\/?>$/i.test(e))return l.jsx("br",{},t);const n=e.match(/^<(kbd|mark|sub|sup)>(.*?)<\/\1>$/i);if(!n)return/^<(a|abbr|span|b|strong|em|i|u|s|del|code)\b[\s\S]*<\/\1>$/i.test(e)?l.jsx(GY,{html:e},t):null;const s=n[1].toLowerCase(),i=ri(n[2],`${t}-${s}`,!0,r);return s==="kbd"?l.jsx("kbd",{className:"rounded border border-border/30 bg-surface-2 px-1.5 py-0.5 font-mono text-[0.85em] text-foreground shadow-sm",children:i},t):s==="mark"?l.jsx("mark",{className:"rounded bg-warning/25 px-0.5 text-foreground",children:i},t):s==="sub"?l.jsx("sub",{children:i},t):l.jsx("sup",{children:i},t)}function ri(e,t,r=!0,n){const s=UY(e),i=/(\\\([^)]*\\\)|\$[^$\n]+\$|<br\s*\/?>|<(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)\b[\s\S]*?<\/(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)>|!?\[[^\]]*\]\((?:<[^>]+>|(?:[^\s()]+|\([^()\s]*\))+)(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\)|!?\[[^\]]+\]\[[^\]]*\]|!?\[[^\]]+\]|\[\^[^\]]+\]|(`+)([\s\S]*?)\2|~~[^~]+~~|\*\*[^*]+\*\*|__[^_]+__|\*[^*\s][^*]*\*|_[^_\s][^_]*_|<https?:\/\/[^>\s]+>|<[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+>|https?:\/\/[^\s<]+|www\.[^\s<]+|[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+)/gi,a=[];let u=0,d;for(;(d=i.exec(s))!==null;){d.index>u&&a.push(A6(s.slice(u,d.index)));const h=d[0],m=`${t}-${d.index}`,b=h.startsWith("<")?VY(h,m,n):null;if(b)a.push(b);else if(h.startsWith("\\(")&&h.endsWith("\\)"))a.push(l.jsx(Df,{tex:h.slice(2,-2)},m));else if(h.startsWith("$")&&h.endsWith("$"))a.push(l.jsx(Df,{tex:h.slice(1,-1)},m));else if(h.startsWith("`")){const x=h.match(/^`+/)?.[0].length??1;a.push(l.jsx("code",{className:`${r?"break-all":"whitespace-nowrap"} rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground`,children:zY(h.slice(x,-x))},m))}else if(h.startsWith("~~"))a.push(l.jsx("del",{className:"text-muted-foreground decoration-border-strong",children:ri(h.slice(2,-2),`${m}-del`,r,n)},m));else if(h.startsWith("**")||h.startsWith("__"))a.push(l.jsx("strong",{className:"font-semibold text-foreground",children:ri(h.slice(2,-2),`${m}-strong`,r,n)},m));else if(h.startsWith("*")||h.startsWith("_"))a.push(l.jsx("em",{className:"italic",children:ri(h.slice(1,-1),`${m}-em`,r,n)},m));else if(h.startsWith("![")){const x=h.match(/^!\[([^\]]*)\]\((.*)\)$/),v=h.match(/^!\[([^\]]+)\]\[([^\]]*)\]$/),A=h.match(/^!\[([^\]]+)\]$/);if(x){const S=Mb(x[2]);a.push(S?a2(m,x[1],S.href,S.title,n):h)}else if(v){const S=v[2]||v[1],k=n.referenceDefinitions.get(Ip(S));a.push(k?a2(m,v[1],k.href,k.title,n):h)}else if(A){const S=n.referenceDefinitions.get(Ip(A[1]));a.push(S?a2(m,A[1],S.href,S.title,n):h)}else a.push(h)}else if(h.startsWith("[^")){const x=nT(h.slice(2,-1)),v=n.footnoteDefinitions.get(x);a.push(v?l.jsx("sup",{id:`fnref-${v.id}`,title:v.text,className:"ml-0.5 rounded bg-surface-2 px-1 text-[0.72em] font-semibold text-primary",children:l.jsx("a",{href:`#fn-${v.id}`,className:"text-primary no-underline",children:v.index})},m):h)}else if(h.startsWith("<http")){const x=h.slice(1,-1);a.push(l.jsx("a",{href:x,target:"_blank",rel:"noreferrer",className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m))}else if(h.startsWith("<")&&h.endsWith(">")&&w6(h.slice(1,-1))){const x=h.slice(1,-1);a.push(l.jsx("a",{href:`mailto:${x}`,className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m))}else if(w6(l2(h).linkText)){const{linkText:x,suffix:v}=l2(h);a.push(l.jsx("a",{href:`mailto:${x}`,className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m)),v&&a.push(v)}else if(h.startsWith("http")||h.startsWith("www.")){const{linkText:x,suffix:v}=l2(h),A=x.startsWith("www.")?`https://${x}`:x;a.push(l.jsx("a",{href:A,target:"_blank",rel:"noreferrer",className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m)),v&&a.push(v)}else{const x=h.match(/^\[([^\]]+)\]\((.*)\)$/),v=h.match(/^\[([^\]]+)\]\[([^\]]*)\]$/),A=h.match(/^\[([^\]]+)\]$/),S=v?v[2]||v[1]:A?.[1]??null,k=S?n.referenceDefinitions.get(Ip(S)):null,L=x?Mb(x[2]):null,R=L?.href??k?.href??null,B=R?MY(R):null,Q=x?.[1]??v?.[1]??A?.[1]??"";a.push(B?l.jsx("a",{href:B,title:L?.title??k?.title,target:"_blank",rel:"noreferrer",className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:ri(Q,`${m}-link`,r,n)},m):h)}u=i.lastIndex}return u<s.length&&a.push(A6(s.slice(u))),a.length>0?a:[e]}function dT(e){return/(?: {2,}|\\)$/.test(e)}function fT(e){return e.replace(/(?: {2,}|\\)$/,"")}function fm(e){return/^(?: {4}|\t)/.test(e)}function hT(e){return e.startsWith(" ")?e.slice(1):e.replace(/^ {4}/,"")}function pT(e,t,r){const n=[];return e.forEach((s,i)=>{const a=dT(s);n.push(...ri(fT(s),`${t}-${i}`,!0,r)),i<e.length-1&&n.push(a?l.jsx("br",{},`${t}-${i}-br`):" ")}),n}function Rb(e,t,r){const n=[],s=[];return e.forEach((i,a)=>{s.push(dT(i)),n.push(ri(fT(i),`${t}-${a}`,!0,r))}),{perLine:n,hardBreaks:s}}function Nb(e,t,r,n,s){const i=[];return e.forEach((a,u)=>{const d=r[u]??0,h=!!(s&&d>=s.start&&d<=s.end);i.push(l.jsx("span",{"data-md-ref-start":d,"data-md-ref-end":d,"data-selected":h?"true":void 0,children:a},`${n}-ref-${u}`)),u<e.length-1&&i.push(t[u]?l.jsx("br",{},`${n}-${u}-br`):" ")}),i}function Bf(e){const t=e.trim().replace(/^\|/,"").replace(/\|$/,""),r=[];let n="",s=!1,i=0,a=0;for(let u=0;u<t.length;u+=1){const d=t[u];if(s){n+=d,s=!1;continue}if(d==="\\"){s=!0;continue}if(d==="`"){const h=u;for(;u+1<t.length&&t[u+1]==="`";)u+=1;const m=u-h+1;n+="`".repeat(m),i===0?i=m:i===m&&(i=0);continue}if(i===0&&d==="["?a+=1:i===0&&d==="]"&&a>0&&(a-=1),d==="|"&&i===0&&a===0){r.push(n.trim()),n="";continue}n+=d}return s&&(n+="\\"),r.push(n.trim()),r}function mT(e){return Bf(e).map(t=>/^:-+:$/.test(t)?"center":/^-+:$/.test(t)?"right":/^:-+$/.test(t)?"left":null)}function hm(e){return e==="center"?"text-center":e==="right"?"text-right":"text-left"}function pm(e){return/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/.test(e.trim())}function qY(e,t){return e>96||e>44&&t>.35}function Xx(e){return(e.match(/^\s*/)?.[0]??"").replace(/\t/g," ").length}function Jx(e){const t=e.trim().match(/^([-+*]|\d+[.)])\s+(.+)$/);if(!t)return null;const r=/^\d+[.)]$/.test(t[1]);return{ordered:r,start:r?Number.parseInt(t[1],10):void 0,content:t[2]}}function gT(e,t,r,n,s,i=new Set){const a=[],u=[];let d=t;for(;d<e.length;){const h=e[d];if(s&&(dm(h)||i.has(d))){d+=1;continue}const m=Jx(h),b=Xx(h);if(!m){if(b>r&&u.length>0){([...u].reverse().find(S=>S.indent<b)?.item??u[u.length-1].item).paragraphs.push(h.trim());for(const S of u)S.item.lineEnd=d+1;d+=1;continue}break}if(b<r||b===r&&m.ordered!==n)break;const x={content:m.content,ordered:m.ordered,start:m.start,children:[],paragraphs:[],lineStart:d+1,lineEnd:d+1};for(;u.length>0&&u[u.length-1].indent>=b;)u.pop();const v=u[u.length-1]?.item??null;v?v.children.push(x):a.push(x),u.push({indent:b,item:x});for(const A of u)A.item.lineEnd=d+1;d+=1}return{items:a,nextIndex:d}}function e5(e,t,r,n=0){return e.map((s,i)=>{const a=s.content.match(/^\[([ xX])\]\s+(.+)$/);return{key:`item-${i}`,taskItem:!!a,refStart:s.lineStart+n,refEnd:s.lineEnd+n,content:l.jsxs(l.Fragment,{children:[a?l.jsx("input",{type:"checkbox",checked:a[1].toLowerCase()==="x",readOnly:!0,className:"mr-2 align-[-2px] accent-primary"}):null,ri(a?.[2]??s.content,`li-${t}-${i}`,!0,r),s.paragraphs.length>0&&l.jsx("div",{className:"mt-1 space-y-1 text-muted-foreground",children:s.paragraphs.map((u,d)=>l.jsx("p",{children:ri(u,`li-${t}-${i}-p-${d}`,!0,r)},`paragraph-${d}`))})]}),groups:YY(s.children,`${t}-${i}`,r,n)}})}function YY(e,t,r,n=0){const s=[];for(const i of e){const a=s[s.length-1];a&&a.ordered===i.ordered?a.items.push(i):s.push({ordered:i.ordered,items:[i]})}return s.map((i,a)=>({ordered:i.ordered,start:i.ordered?i.items[0]?.start:void 0,items:e5(i.items,`${t}-g${a}`,r,n)}))}function t5(e,t){return e.map(r=>{const n=!!(t&&r.refStart<=t.end&&r.refEnd>=t.start);return l.jsxs("li",{className:r.taskItem?"list-none":void 0,"data-md-ref-start":r.refStart,"data-md-ref-end":r.refEnd,"data-selected":n?"true":void 0,children:[r.content,r.groups.length>0&&KY(r.groups,t)]},r.key)})}function KY(e,t){return e.map((r,n)=>{const s=r.ordered?"ol":"ul";return l.jsx(s,{start:r.start,className:`${r.ordered?"list-decimal":"list-disc"} mt-1 space-y-0.5 pl-4 marker:text-muted-foreground/60`,children:t5(r.items,t)},`nested-${n}`)})}function ZY(e){const t=Array.from(e.footnoteDefinitions.values()).sort((r,n)=>r.index-n.index);return t.length===0?null:l.jsxs("section",{className:"mt-3 border-t border-border/20 pt-2 text-[12px] leading-5 text-muted-foreground",children:[l.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:e.footnotesLabel}),l.jsx("ol",{className:"list-decimal space-y-1 pl-5",children:t.map(r=>l.jsxs("li",{id:`fn-${r.id}`,children:[ri(r.text,`footnote-${r.id}`,!0,e)," ",l.jsx("a",{href:`#fnref-${r.id}`,className:"text-primary no-underline","aria-label":e.backToFootnoteLabel(r.index),children:"↩"})]},r.id))})]})}function XY(e,t,r,n){const s=[];let i=0;const a=u=>n?.[u]??u+1;for(;i<e.length;){const u=e[i],d=u.trim();if(!d){i+=1;continue}if(/^<details>\s*$/i.test(d)){const L=i;let R="Details";const B=[];for(i+=1;i<e.length&&!/^<\/details>\s*$/i.test(e[i].trim());){const Q=e[i].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);Q?R=Q[1].trim()||R:B.push(e[i].trimStart()),i+=1}i<e.length&&(i+=1),s.push({kind:"static",node:l.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[l.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:ri(R,`${t}-details-${L}-summary`,!0,r)}),B.length>0&&l.jsx("div",{className:"mt-2 text-sm leading-6",children:pT(B,`${t}-details-${L}`,r)})]},`${t}-details-${L}`)});continue}const h=uT(u);if(h){const L=[u],R=i;for(i+=1;i<e.length&&!h.selfContained&&!new RegExp(`</${h.tag}>`,"i").test(e[i]);)L.push(e[i]),i+=1;i<e.length&&!h.selfContained&&(L.push(e[i]),i+=1),s.push({kind:"static",node:l.jsx(cT,{html:L.join(`
|
|
169
|
+
`;return`${e}${n}${r}`}function Fq(e,t){const r=e.trim();return r?t?`${r}\r`:/\s$/.test(e)?e:`${r} `:""}const Sb="termdock:right-sidebar:html-view-mode-by-file:v1";function Qq(e){return e==="preview"||e==="source"}function NA(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(Qq)}function DA(e,t){if(!t)return null;const r=e&&!t.startsWith("/")?`${e}/${t}`:t;return e?`${e}::${r}`:r}function n6(e,t){const r=DA(e,t);return r?Ln(Sb,NA)?.[r]??"source":"source"}function Oq(e,t,r){const n=DA(e,t);if(!n)return;const s=Ln(Sb,NA)??{};Br(Sb,{...s,[n]:r})}function J1(e){const t=Number.isFinite(e)&&e>0?Math.floor(e):0,r=Math.floor(t/3600),n=Math.floor(t%3600/60),s=t%60,i=String(n).padStart(2,"0"),a=String(s).padStart(2,"0");return r>0?`${r}:${i}:${a}`:`${i}:${a}`}function $q(e,t,r){return!Number.isFinite(r)||r<=0||!t.width?0:Math.min(1,Math.max(0,(e-t.left)/t.width))*r}function Hq({url:e,onLoadError:t}){const{t:r}=jr(),n=w.useRef(null),s=w.useRef(null),i=w.useRef(!1),a=w.useRef(null),u=w.useRef(0),[d,h]=w.useState(0),[m,b]=w.useState(0),[x,v]=w.useState(!1),[A,S]=w.useState(!1),[k,L]=w.useState(null);w.useEffect(()=>()=>{a.current!==null&&cancelAnimationFrame(a.current)},[]);const R=w.useCallback(V=>{const K=n.current;if(!K)return;const ne=Number.isFinite(K.duration)?K.duration:V;K.currentTime=Math.min(Math.max(V,0),ne)},[]),B=w.useCallback(V=>{const K=s.current,ne=n.current;if(!K||!ne)return;const oe=K.getBoundingClientRect(),ye=$q(V,oe,ne.duration);u.current=ye,L(ye),a.current===null&&(a.current=requestAnimationFrame(()=>{a.current=null,R(u.current)}))},[R]),Q=w.useCallback(()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null),R(u.current)},[R]),T=w.useCallback(V=>{const K=n.current;if(!(!K||!Number.isFinite(K.duration)||K.duration<=0)){i.current=!K.paused,K.pause(),S(!0);try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}B(V.clientX)}},[B]),O=w.useCallback(()=>{Q(),S(!1),L(null);const V=n.current;V&&i.current&&!V.ended&&V.play().catch(()=>{}),i.current=!1},[Q]),I=w.useCallback(()=>{const V=n.current;V&&(V.paused?V.play().catch(()=>{}):V.pause())},[]),N=w.useCallback(V=>{const K=n.current;if(!K||!Number.isFinite(K.duration))return;const ne=V.shiftKey?10:5;let oe=null;V.key==="ArrowLeft"?oe=K.currentTime-ne:V.key==="ArrowRight"?oe=K.currentTime+ne:V.key==="Home"?oe=0:V.key==="End"&&(oe=K.duration),oe!==null&&(V.preventDefault(),R(oe))},[R]),U=A&&k!==null?k:m,z=d>0?Math.min(1,Math.max(0,U/d)):0;return l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-background","data-testid":"file-preview-video-player",children:[l.jsxs("div",{className:"relative min-h-0 flex-1",children:[l.jsx("video",{ref:n,"data-testid":"file-preview-video",className:"h-full w-full object-contain",src:e,preload:"metadata",playsInline:!0,onClick:I,onPlay:()=>v(!0),onPause:()=>v(!1),onTimeUpdate:V=>b(V.currentTarget.currentTime),onLoadedMetadata:V=>h(Number.isFinite(V.currentTarget.duration)?V.currentTarget.duration:0),onDurationChange:V=>h(Number.isFinite(V.currentTarget.duration)?V.currentTarget.duration:0),onError:t,children:r("rightSidebar.videoUnsupported")}),A&&k!==null&&l.jsx("div",{className:"pointer-events-none absolute bottom-1 z-10 -translate-x-1/2 rounded-md bg-surface-elevated px-2 py-1 text-[11px] font-medium text-foreground shadow-md",style:{left:`${z*100}%`},"data-testid":"file-preview-video-scrub-time",children:J1(k)})]}),l.jsx("div",{"data-testid":"file-preview-video-controls",className:`shrink-0 border-t border-border/60 bg-background px-2 py-1.5 ${B9}`,[P9]:"",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{type:"button",onClick:I,"aria-label":r(x?"rightSidebar.videoPause":"rightSidebar.videoPlay"),title:r(x?"rightSidebar.videoPause":"rightSidebar.videoPlay"),className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-foreground transition hover:bg-surface-elevated active:scale-95","data-testid":"file-preview-video-play",children:x?l.jsx(FI,{size:14}):l.jsx(VI,{size:14})}),l.jsxs("div",{ref:s,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(d),"aria-valuenow":Math.floor(U),tabIndex:0,className:"group relative h-5 min-w-0 flex-1 cursor-pointer touch-none py-2","data-testid":"file-preview-video-track",onPointerDown:T,onPointerMove:V=>{A&&B(V.clientX)},onPointerUp:O,onPointerCancel:O,onKeyDown:N,children:[l.jsx("div",{className:"h-1 w-full rounded-full bg-surface-elevated"}),l.jsx("div",{className:"absolute inset-y-0 left-0 my-auto h-1 rounded-full bg-primary",style:{width:`${z*100}%`}}),l.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary shadow",style:{left:`${z*100}%`}})]}),l.jsxs("div",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground","data-testid":"file-preview-video-time",children:[J1(U)," / ",J1(d)]})]})})]})}const qx="termdock:right-sidebar:file-tree-scroll:v1",Yx="termdock:right-sidebar:file-preview-reading-state:v1",X0="termdock:right-sidebar:file-tree-width:v1",BA="termdock:right-sidebar:markdown-view-mode:v1",PA="termdock:right-sidebar:diff-change-list-mode:v1",jA="termdock:right-sidebar:diff-wrap:v1",FA="termdock:diff-viewer:view-type:v1",QA="termdock:right-sidebar:file-search-mode:v1",e2="termdock:right-sidebar:collapsed-git-repo-groups:v1",s6="termdock:right-sidebar:collapsed-diff-directories:v1",t2="termdock:right-sidebar:branch-audit-module-open:v1",OA="termdock:right-sidebar:branch-audit-module:v1",Uq=150,$A="termdock:right-sidebar:git-bundle-snapshots:v1",HA="termdock:right-sidebar:active-git-repo:v1",i6="termdock:right-sidebar:context-draft-enabled:v1",o6="termdock:right-sidebar:context-draft-collapsed:v1",r2="termdock:right-sidebar:context-draft-text:v1",zq=300,Gq=20,Wq=120,Vq=8,qq=1440*60*1e3,Yq=250,Kq=250,Zq=120,Xq=700,n2=600,a6=[2e3,5e3,15e3,3e4],Jq=320,eY=500,tY=20,rY=12e3,Cb=300,l6=240,nY=560,sY=600,iY=720,UA="border-r px-2 py-1.5 sm:px-3 sm:py-2",um="max-w-[18rem] whitespace-normal break-words sm:max-w-[27rem]",zA=`${UA} border-b border-border/15 font-semibold last:border-r-0`,GA=`${UA} border-border/10 align-top text-muted-foreground last:border-r-0`,Kx="termdock-file-preview-horizontal-scroll",oY=w.lazy(()=>kd(()=>import("./ModelPreview-DH-7pHJF.js"),__vite__mapDeps([2,3,1,4]))),WA=`${Kx} termdock-md-table-scroll max-w-full overflow-x-auto overflow-y-hidden rounded-lg border border-border/20 bg-surface`,aY=new Set([".md",".markdown",".mdown",".mkdn",".mkd"]);function lY(e){return e==="preview"||e==="source"}function cY(e){return e==="list"||e==="tree"||e==="ai"}function c6(){return Ln(BA,lY)??"preview"}function uY(){return Ln(PA,cY)??"tree"}function Ep(e){return typeof e=="boolean"}function dY(e){return typeof e=="string"}function fY(){return Ln(jA,Ep)??!0}function hY(e){return e==="unified"||e==="split"}function pY(){return Ln(FA,hY)??"unified"}function mY(e){return e==="name"||e==="content"||e==="regex"}function gY(){return Ln(QA,mY)??"name"}function Xh(e){return e===void 0||Array.isArray(e)&&e.every(t=>typeof t=="string")}function VA(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.path=="string"&&typeof t.absolutePath=="string"&&typeof t.status=="string"&&typeof t.staged=="boolean"&&typeof t.unstaged=="boolean"&&typeof t.untracked=="boolean"&&typeof t.tracked=="boolean"&&typeof t.canStage=="boolean"&&typeof t.canUnstage=="boolean"&&typeof t.canStash=="boolean"&&typeof t.canRestoreWorktree=="boolean"&&(t.repoRoot===void 0||typeof t.repoRoot=="string")&&(t.repoRelativeRoot===void 0||typeof t.repoRelativeRoot=="string")&&(t.repoName===void 0||typeof t.repoName=="string")&&(t.oldPath===void 0||typeof t.oldPath=="string")&&(t.indexStatus===void 0||typeof t.indexStatus=="string")&&(t.worktreeStatus===void 0||typeof t.worktreeStatus=="string")}function bY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.path=="string"&&typeof t.absolutePath=="string"&&typeof t.status=="string"}function qA(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.available=="boolean"&&(t.cwd===void 0||typeof t.cwd=="string")&&(t.root===void 0||typeof t.root=="string")&&(t.branch===void 0||t.branch===null||typeof t.branch=="string")&&Xh(t.remotes)&&Xh(t.branches)&&Xh(t.remoteBranches)&&(t.upstream===void 0||t.upstream===null||typeof t.upstream=="string")&&(t.upstreamRemote===void 0||t.upstreamRemote===null||typeof t.upstreamRemote=="string")&&(t.upstreamBranch===void 0||t.upstreamBranch===null||typeof t.upstreamBranch=="string")&&(t.ahead===void 0||t.ahead===null||typeof t.ahead=="number")&&(t.behind===void 0||t.behind===null||typeof t.behind=="number")&&(t.status===void 0||typeof t.status=="string")&&Xh(t.recentCommits)&&(t.changedFiles===void 0||Array.isArray(t.changedFiles)&&t.changedFiles.every(bY))&&(t.truncated===void 0||typeof t.truncated=="boolean")&&(t.error===void 0||typeof t.error=="string")&&(t.code===void 0||typeof t.code=="string")}function xY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.id=="string"&&typeof t.root=="string"&&(t.displayRoot===void 0||typeof t.displayRoot=="string")&&typeof t.relativeRoot=="string"&&typeof t.name=="string"&&typeof t.depth=="number"&&typeof t.nested=="boolean"&&typeof t.available=="boolean"&&Array.isArray(t.files)&&t.files.every(VA)&&(t.context===null||t.context===void 0||qA(t.context))&&(t.untrackedDeferred===void 0||typeof t.untrackedDeferred=="boolean")&&(t.error===void 0||typeof t.error=="string")}function yY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.root=="string"&&typeof t.label=="string"&&(t.branch===void 0||t.branch===null||typeof t.branch=="string")&&typeof t.count=="number"&&typeof t.staged=="number"}function vY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.available=="boolean"&&Array.isArray(t.files)&&t.files.every(VA)&&(t.context===null||t.context===void 0||qA(t.context))&&(t.repositories===void 0||Array.isArray(t.repositories)&&t.repositories.every(xY))&&(t.repoFilters===void 0||Array.isArray(t.repoFilters)&&t.repoFilters.every(yY))&&(t.truncatedRepositories===void 0||typeof t.truncatedRepositories=="boolean")&&(t.untrackedDeferred===void 0||typeof t.untrackedDeferred=="boolean")&&(t.error===void 0||typeof t.error=="string")&&(t.code===void 0||typeof t.code=="string")}function wY(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;const r=t;return typeof r.updatedAt=="number"&&vY(r.bundle)})}function YA(){return Ln($A,wY)??{}}function AY(e){if(!e)return null;const t=YA()[e];return!t||Date.now()-t.updatedAt>qq?null:t}function TY(e){const t={...e};return delete t.cached,delete t.stale,delete t.cacheAgeMs,delete t.nestedDeferred,t}function u6(e,t){if(!e||!t.available||t.error)return;const r=YA();r[e]={bundle:TY(t),updatedAt:Date.now()};const n=Object.entries(r).sort(([,s],[,i])=>i.updatedAt-s.updatedAt).slice(0,Vq);Br($A,Object.fromEntries(n))}function d6(e){return e.repositories??(e.context?.root?[{id:e.context.root,root:e.context.root,relativeRoot:".",name:go(e.context.root)||e.context.root,depth:0,nested:!1,available:e.available,files:e.files,context:e.context,error:e.error}]:[])}function SY(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string")}function KA(){return Ln(HA,SY)??{}}function f6(e){if(!e)return;const t=KA();return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function s2(e,t){e&&Br(HA,{...KA(),[e]:t})}function h6(e,t){if(!t)return null;const r=new Set((e.repoFilters??[]).map(n=>n.root));return r.has(t)?t:r.size>0?null:(e.repositories??[]).some(n=>n.root===t)?t:null}function _b(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function p6(e){const t=Ln(e,_b);return t?new Set(t):new Set}function i2(e,t){Br(e,[...t])}function CY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.filePath=="string"&&typeof t.hunkHeader=="string"&&typeof t.hunkIndex=="number"&&typeof t.fingerprint=="string"&&typeof t.additions=="number"&&typeof t.deletions=="number"&&typeof t.diff=="string"&&(t.oldPath===void 0||t.oldPath===null||typeof t.oldPath=="string")&&(t.newPath===void 0||t.newPath===null||typeof t.newPath=="string")&&(t.source===void 0||t.source==="committed"||t.source==="uncommitted"||t.source==="unknown")&&(t.commit===void 0||t.commit===null||typeof t.commit=="string")}function _Y(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.available=="boolean"&&(t.repoRoot===void 0||typeof t.repoRoot=="string")&&(t.workspaceRoot===void 0||typeof t.workspaceRoot=="string")&&(t.baseRef===void 0||typeof t.baseRef=="string")&&(t.baseBranch===void 0||typeof t.baseBranch=="string")&&(t.currentBranch===void 0||t.currentBranch===null||typeof t.currentBranch=="string")&&(t.headRef===void 0||t.headRef===null||typeof t.headRef=="string")&&(t.diffFingerprint===void 0||typeof t.diffFingerprint=="string")&&(t.stat===void 0||typeof t.stat=="string")&&(t.files===void 0||_b(t.files))&&(t.hunks===void 0||Array.isArray(t.hunks)&&t.hunks.every(CY))&&(t.commits===void 0||_b(t.commits))&&(t.commitCount===void 0||typeof t.commitCount=="number")&&(t.diff===void 0||typeof t.diff=="string")&&(t.truncated===void 0||typeof t.truncated=="boolean")&&(t.error===void 0||typeof t.error=="string")}function kY(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.key=="string"&&_Y(t.diff)&&typeof t.repoLabel=="string"&&typeof t.createdAt=="number"}function LY(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;const r=t;return Array.isArray(r.selectedRepoRoots)&&r.selectedRepoRoots.every(n=>typeof n=="string")&&!!r.repoTargetBranches&&typeof r.repoTargetBranches=="object"&&!Array.isArray(r.repoTargetBranches)&&Object.values(r.repoTargetBranches).every(n=>typeof n=="string")&&(r.repoBaseBranches===void 0||!!r.repoBaseBranches&&typeof r.repoBaseBranches=="object"&&!Array.isArray(r.repoBaseBranches)&&Object.values(r.repoBaseBranches).every(n=>typeof n=="string"))&&(r.previewEntries===void 0||Array.isArray(r.previewEntries)&&r.previewEntries.every(kY))&&(r.selectedPreviewKey===void 0||r.selectedPreviewKey===null||typeof r.selectedPreviewKey=="string")&&(r.selectedPreviewFileKey===void 0||r.selectedPreviewFileKey===null||typeof r.selectedPreviewFileKey=="string")&&(r.previewDetailOpen===void 0||typeof r.previewDetailOpen=="boolean")&&(r.previewScrollTops===void 0||!!r.previewScrollTops&&typeof r.previewScrollTops=="object"&&!Array.isArray(r.previewScrollTops)&&Object.values(r.previewScrollTops).every(n=>typeof n=="number"))&&(r.previewMobileSlideIndex===void 0||typeof r.previewMobileSlideIndex=="number")&&(r.includeUncommitted===void 0||typeof r.includeUncommitted=="boolean")&&typeof r.updatedAt=="number"})}function m6(){return Ln(OA,LY)??{}}function g6(e){return[e.repoRoot,e.baseRef,e.branchName??"",e.headRef??"",e.diffFingerprint??""].join("\0")}function b6(e){const t=e?.trim()??"",r=t.indexOf("/");return r>=0?t.slice(r+1):t}function ZA(e,t){const r=e?.trim(),n=t?.trim();return!r||!n?!1:r===n||b6(r)===b6(n)}function x6(e){const t=e?.branch??null;return[e?.upstream,...e?.remoteBranches??[],...e?.branches??[]].find(n=>n&&!ZA(n,t))??""}function kb(e,t){const r=Math.max(l6,t-320),n=Math.min(nY,r);return Math.min(n,Math.max(l6,e))}function EY(e){return typeof e=="number"&&Number.isFinite(e)}function IY(e){return kb(Ln(X0,EY)??Cb,e)}function XA(e){const t=e.split(/[\\/]/).pop()??e,r=t.lastIndexOf(".");return r>=0?t.slice(r).toLowerCase():""}function Jh(e){return aY.has(XA(e))}function JA(e){const t=e.trim().replace(/\s+/g,"");return/^-{3,}$/.test(t)||/^\*{3,}$/.test(t)||/^_{3,}$/.test(t)}function Lb(e){const t=e.trim();return/^#{1,6}\s+/.test(t)||JA(e)||/^>\s?/.test(t)||/^(```|~~~)/.test(t)||/^(?:[-+*]|\d+[.)])\s+/.test(t)}function MY(e){const t=e.trim();return/^(https?:|mailto:|#|\/|\.\/|\.\.\/)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/[<>]/.test(t)?t:null}const eT=w.createContext(null);function Ip(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function tT(e){return e.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/[`*_~]/g,"").replace(/<[^>]+>/g,"").trim()}function rT(e){return e.replace(/\s+#+\s*$/,"").trim()}function Eb(e,t){const n=tT(e).toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section",s=t.headingSlugCounts.get(n)??0;return t.headingSlugCounts.set(n,s+1),s===0?n:`${n}-${s}`}function y6(e){return tT(e)||e.trim()}function dm(e){const t=e.match(/^\s{0,3}\[([^\]]+)\]:\s+(.+?)\s*$/);if(!t)return null;const r=Mb(t[2]);return r?{id:Ip(t[1]),definition:{href:r.href,title:r.title}}:null}function RY(e){const t=new Map;for(const r of e){const n=dm(r);n&&t.set(n.id,n.definition)}return t}function nT(e){return e.trim().toLowerCase()}function sT(e){const t=e.match(/^\s{0,3}\[\^([^\]]+)\]:\s+(.+)\s*$/);return t?{id:nT(t[1]),text:t[2]}:null}function NY(e){const t=new Map;let r=null;for(const n of e){const s=sT(n);if(s){r=s.id,t.set(s.id,{id:s.id,text:s.text,index:t.size+1});continue}if(r&&/^\s{4,}\S/.test(n)){const i=t.get(r);i&&(i.text=`${i.text} ${n.trim()}`);continue}n.trim()&&(r=null)}return t}function DY(e){const t=new Set;let r=!1;return e.forEach((n,s)=>{if(sT(n)){t.add(s),r=!0;return}if(r&&/^\s{4,}\S/.test(n)){t.add(s);return}n.trim()&&(r=!1)}),t}function BY(e){const t=[...e];let r=0;const n=e[0]?.trim();if(n==="---"||n==="+++"){for(t[0]="",r=1;r<e.length&&e[r].trim()!==n;)t[r]="",r+=1;r<e.length&&(t[r]="",r+=1)}for(;r<e.length;){const s=e[r].trim();if(s.startsWith("<!--")){if(t[r]="",!s.includes("-->")){for(r+=1;r<e.length&&!e[r].includes("-->");)t[r]="",r+=1;r<e.length&&(t[r]="")}r+=1;continue}r+=1}return t}function PY(e){const t=e.replace(/\/+$/,""),r=t.lastIndexOf("/");return r<=0?r===0?"/":"":t.slice(0,r)}function v6(e){const t=e.split(/[?#]/,1)[0],r=t.startsWith("/"),n=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){n.length>0&&n.pop();continue}n.push(i)}return`${r?"/":""}${n.join("/")}`||(r?"/":".")}function jY(e,t,r){const n=e.trim();if(!n||/^(?:javascript|data):/i.test(n))return null;if(/^https?:\/\//i.test(n))return n;if(!$b(n.split(/[?#]/,1)[0]))return null;let s;if(n.startsWith("/")){const i=r&&(n===r||n.startsWith(`${r}/`));s=v6(r&&!i?`${r}/${n.slice(1)}`:n)}else{if(!t)return null;s=v6(`${PY(t)}/${n}`)}return`/api/terminal/fs/blob?path=${encodeURIComponent(s)}`}const Ib=128,FY=360,o2=480;function Zx(e){try{return/\.svg(?=$|[?#&])/i.test(decodeURIComponent(e))}catch{return!1}}function QY(e,t,r,n){if(!t||!r)return null;let s,i;return Zx(e)?(i=Math.min(Math.max(r,Ib),FY),s=t*i/r):(s=t,i=r),n>0&&s>n&&(i=i*n/s,s=n),i>o2&&(s=s*o2/i,i=o2),{width:Math.max(1,Math.round(s)),height:Math.max(1,Math.round(i))}}function OY(e){if(!e.startsWith("/api/terminal/fs/blob?"))return null;try{return new URLSearchParams(e.slice(e.indexOf("?"))).get("path")}catch{return null}}function iT(e){const t=OY(e),r=At(n=>t?(n.fileChangeVersions.get(t)??0)+n.fileWatchEpoch:0);return t&&r>0?`${e}&v=${r}`:e}function $Y({src:e,alt:t,title:r}){const n=Zx(e),s=iT(e),i=w.useRef(null),[a,u]=w.useState(!1),[d,h]=w.useState(0),[m,b]=w.useState({status:"loading"}),[x,v]=w.useState(null);w.useLayoutEffect(()=>{const k=i.current,L=k?.parentElement?.parentElement??k?.parentElement;if(!L)return;const R=()=>h(L.clientWidth);if(R(),typeof ResizeObserver>"u")return;const B=new ResizeObserver(R);return B.observe(L),()=>B.disconnect()},[]),w.useEffect(()=>{if(a)return;const k=i.current;if(!k||typeof IntersectionObserver>"u"){u(!0);return}const L=new IntersectionObserver(R=>{R.some(B=>B.isIntersecting)&&(u(!0),L.disconnect())},{rootMargin:"400px"});return L.observe(k),()=>L.disconnect()},[a]),w.useEffect(()=>{if(!a)return;const k=new AbortController;let L=null;b({status:"loading"});const R=window.setTimeout(()=>{k.abort(new DOMException("Image fetch timed out","TimeoutError"))},15e3);return fetch(s,{signal:k.signal}).then(async B=>{if(!B.ok)throw new Error(`HTTP ${B.status}`);const Q=Number(B.headers.get("X-Image-Width"))||0,T=Number(B.headers.get("X-Image-Height"))||0;return{blob:await B.blob(),width:Q,height:T}}).then(({blob:B,width:Q,height:T})=>{k.signal.aborted||(L=URL.createObjectURL(B),Q>0&&T>0&&v({width:Q,height:T}),b({status:"ready",objectUrl:L}))}).catch(()=>{const B=k.signal.reason;k.signal.aborted&&!(B instanceof DOMException&&B.name==="TimeoutError")||b({status:"fallback"})}).finally(()=>{window.clearTimeout(R)}),()=>{window.clearTimeout(R),k.abort(),L&&URL.revokeObjectURL(L)}},[a,s]);const A=QY(e,x?.width??0,x?.height??0,d),S=A??{width:Ib*2,height:Ib};return l.jsx("div",{ref:i,className:"block max-w-full",style:A?{width:A.width,height:A.height}:void 0,children:m.status==="ready"?l.jsx("img",{src:m.objectUrl,alt:t,title:r,decoding:"async",className:`${n?"":"termdock-fade-in "}block max-h-[480px] max-w-full object-contain`,style:A?{width:A.width,height:A.height}:void 0,onLoad:k=>{if(x)return;const L=k.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):m.status==="fallback"?l.jsx("img",{src:s,alt:t,title:r,loading:"lazy",decoding:"async",className:"block max-h-[480px] max-w-full object-contain",style:A?{width:A.width,height:A.height}:void 0,onLoad:k=>{if(x)return;const L=k.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):l.jsx("div",{"aria-hidden":!0,className:"flex max-w-full animate-pulse items-center justify-center rounded bg-surface-elevated/60",style:{width:S.width,height:S.height},children:l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:t||"…"})})})}function a2(e,t,r,n,s){const i=jY(r,s.markdownFilePath,s.rootPath);if(!i)return``;const a=s.images.length;s.images.push({kind:"image",src:i,alt:t,title:n});const u=l.jsx($Y,{src:i,alt:t,title:n});return s.onImageOpen?l.jsx("button",{type:"button",className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2 text-left transition hover:border-border-strong focus:outline-none focus:ring-2 focus:ring-ring/45",title:n||t||"Open image",onClick:d=>{d.stopPropagation(),s.onImageOpen?.(a)},children:u},e):l.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:u},e)}function l2(e){let t=e,r="";for(;/[.,;:!?)]$/.test(t);)r=`${t.slice(-1)}${r}`,t=t.slice(0,-1);return{linkText:t,suffix:r}}function w6(e){return/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(e)}function Mb(e){const t=e.trim(),r=t.match(/^<([^>]+)>(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(r)return{href:r[1],title:r[2]??r[3]??r[4]};const n=t.match(/^(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);return n?{href:n[1],title:n[2]??n[3]??n[4]}:null}const oT="",HY=/\\([\\`*{}\[\]#+\-.!_|~>$])/g;function UY(e){return e.replace(HY,(t,r)=>`${oT}${r.charCodeAt(0).toString(16).padStart(4,"0")}`)}function A6(e){return e.replace(new RegExp(`${oT}([0-9a-f]{4})`,"g"),(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\([()])/g,"$1")}function zY(e){const t=e.replace(/[\r\n]+/g," ");return/^ .+ $/.test(t)&&/[^ ]/.test(t.slice(1,-1))?t.slice(1,-1):t}const aT={ALLOWED_TAGS:["a","abbr","b","blockquote","br","code","del","details","div","em","i","kbd","li","mark","ol","p","pre","s","span","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],ALLOWED_ATTR:["href","title","class","id","colspan","rowspan"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!0};let ep=null;function lT(){return ep||(ep=kd(()=>import("./purify.es-CC4Brkr_.js"),[]).then(e=>e.default??e).catch(e=>{throw ep=null,e})),ep}function cT({html:e}){const{t}=jr(),[r,n]=w.useState(null);return w.useEffect(()=>{let s=!1;return n(null),lT().then(i=>{s||n(i.sanitize(e,aT))}).catch(()=>{s||n("")}),()=>{s=!0}},[e]),r===null?l.jsx("div",{className:"py-2 text-xs text-muted-foreground",children:t("rightSidebar.renderingHtml")}):r?l.jsx("div",{className:"text-muted-foreground",dangerouslySetInnerHTML:{__html:r}}):null}function GY({html:e}){const[t,r]=w.useState(null);return w.useEffect(()=>{let n=!1;return r(null),lT().then(s=>{n||r(s.sanitize(e,aT))}).catch(()=>{n||r("")}),()=>{n=!0}},[e]),t===null?null:t?l.jsx("span",{dangerouslySetInnerHTML:{__html:t}}):e}function uT(e){const t=e.trim().match(/^<(div|section|article|aside|table|p|ul|ol|li|blockquote|pre|figure|figcaption)\b[^>]*>/i);if(!t)return null;const r=t[1].toLowerCase();return{tag:r,selfContained:new RegExp(`</${r}>`,"i").test(e)}}let tp=null;function WY(){return tp||(tp=Promise.all([kd(()=>import("./katex-DnlPpQZa.js"),[]),kd(()=>Promise.resolve({}),__vite__mapDeps([5]))]).then(([e])=>e.default??e).catch(e=>{throw tp=null,e})),tp}function Df({tex:e,display:t=!1}){const[r,n]=w.useState(null),[s,i]=w.useState(!1);if(w.useEffect(()=>{let u=!1;return n(null),i(!1),WY().then(d=>{u||n(d.renderToString(e,{displayMode:t,throwOnError:!1,trust:!1,strict:"ignore"}))}).catch(()=>{u||i(!0)}),()=>{u=!0}},[t,e]),s)return l.jsx("code",{className:"rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground",children:t?`$$${e}$$`:`$${e}$`});if(!r)return l.jsx("span",{className:"text-muted-foreground/70",children:t?"Rendering formula...":e});const a=t?"my-2 overflow-auto rounded-md bg-surface-2 px-3 py-2 text-center":"inline-block align-middle";return l.jsx("span",{className:a,dangerouslySetInnerHTML:{__html:r}})}function VY(e,t,r){if(/^<br\s*\/?>$/i.test(e))return l.jsx("br",{},t);const n=e.match(/^<(kbd|mark|sub|sup)>(.*?)<\/\1>$/i);if(!n)return/^<(a|abbr|span|b|strong|em|i|u|s|del|code)\b[\s\S]*<\/\1>$/i.test(e)?l.jsx(GY,{html:e},t):null;const s=n[1].toLowerCase(),i=ri(n[2],`${t}-${s}`,!0,r);return s==="kbd"?l.jsx("kbd",{className:"rounded border border-border/30 bg-surface-2 px-1.5 py-0.5 font-mono text-[0.85em] text-foreground shadow-sm",children:i},t):s==="mark"?l.jsx("mark",{className:"rounded bg-warning/25 px-0.5 text-foreground",children:i},t):s==="sub"?l.jsx("sub",{children:i},t):l.jsx("sup",{children:i},t)}function ri(e,t,r=!0,n){const s=UY(e),i=/(\\\([^)]*\\\)|\$[^$\n]+\$|<br\s*\/?>|<(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)\b[\s\S]*?<\/(?:a|abbr|span|b|strong|em|i|u|s|del|code|kbd|mark|sub|sup)>|!?\[[^\]]*\]\((?:<[^>]+>|(?:[^\s()]+|\([^()\s]*\))+)(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\)|!?\[[^\]]+\]\[[^\]]*\]|!?\[[^\]]+\]|\[\^[^\]]+\]|(`+)([\s\S]*?)\2|~~[^~]+~~|\*\*[^*]+\*\*|__[^_]+__|\*[^*\s][^*]*\*|_[^_\s][^_]*_|<https?:\/\/[^>\s]+>|<[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+>|https?:\/\/[^\s<]+|www\.[^\s<]+|[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+)/gi,a=[];let u=0,d;for(;(d=i.exec(s))!==null;){d.index>u&&a.push(A6(s.slice(u,d.index)));const h=d[0],m=`${t}-${d.index}`,b=h.startsWith("<")?VY(h,m,n):null;if(b)a.push(b);else if(h.startsWith("\\(")&&h.endsWith("\\)"))a.push(l.jsx(Df,{tex:h.slice(2,-2)},m));else if(h.startsWith("$")&&h.endsWith("$"))a.push(l.jsx(Df,{tex:h.slice(1,-1)},m));else if(h.startsWith("`")){const x=h.match(/^`+/)?.[0].length??1;a.push(l.jsx("code",{className:`${r?"break-all":"whitespace-nowrap"} rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground`,children:zY(h.slice(x,-x))},m))}else if(h.startsWith("~~"))a.push(l.jsx("del",{className:"text-muted-foreground decoration-border-strong",children:ri(h.slice(2,-2),`${m}-del`,r,n)},m));else if(h.startsWith("**")||h.startsWith("__"))a.push(l.jsx("strong",{className:"font-semibold text-foreground",children:ri(h.slice(2,-2),`${m}-strong`,r,n)},m));else if(h.startsWith("*")||h.startsWith("_"))a.push(l.jsx("em",{className:"italic",children:ri(h.slice(1,-1),`${m}-em`,r,n)},m));else if(h.startsWith("![")){const x=h.match(/^!\[([^\]]*)\]\((.*)\)$/),v=h.match(/^!\[([^\]]+)\]\[([^\]]*)\]$/),A=h.match(/^!\[([^\]]+)\]$/);if(x){const S=Mb(x[2]);a.push(S?a2(m,x[1],S.href,S.title,n):h)}else if(v){const S=v[2]||v[1],k=n.referenceDefinitions.get(Ip(S));a.push(k?a2(m,v[1],k.href,k.title,n):h)}else if(A){const S=n.referenceDefinitions.get(Ip(A[1]));a.push(S?a2(m,A[1],S.href,S.title,n):h)}else a.push(h)}else if(h.startsWith("[^")){const x=nT(h.slice(2,-1)),v=n.footnoteDefinitions.get(x);a.push(v?l.jsx("sup",{id:`fnref-${v.id}`,title:v.text,className:"ml-0.5 rounded bg-surface-2 px-1 text-[0.72em] font-semibold text-primary",children:l.jsx("a",{href:`#fn-${v.id}`,className:"text-primary no-underline",children:v.index})},m):h)}else if(h.startsWith("<http")){const x=h.slice(1,-1);a.push(l.jsx("a",{href:x,target:"_blank",rel:"noreferrer",className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m))}else if(h.startsWith("<")&&h.endsWith(">")&&w6(h.slice(1,-1))){const x=h.slice(1,-1);a.push(l.jsx("a",{href:`mailto:${x}`,className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m))}else if(w6(l2(h).linkText)){const{linkText:x,suffix:v}=l2(h);a.push(l.jsx("a",{href:`mailto:${x}`,className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m)),v&&a.push(v)}else if(h.startsWith("http")||h.startsWith("www.")){const{linkText:x,suffix:v}=l2(h),A=x.startsWith("www.")?`https://${x}`:x;a.push(l.jsx("a",{href:A,target:"_blank",rel:"noreferrer",className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:x},m)),v&&a.push(v)}else{const x=h.match(/^\[([^\]]+)\]\((.*)\)$/),v=h.match(/^\[([^\]]+)\]\[([^\]]*)\]$/),A=h.match(/^\[([^\]]+)\]$/),S=v?v[2]||v[1]:A?.[1]??null,k=S?n.referenceDefinitions.get(Ip(S)):null,L=x?Mb(x[2]):null,R=L?.href??k?.href??null,B=R?MY(R):null,Q=x?.[1]??v?.[1]??A?.[1]??"";a.push(B?l.jsx("a",{href:B,title:L?.title??k?.title,target:"_blank",rel:"noreferrer",className:`${r?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:ri(Q,`${m}-link`,r,n)},m):h)}u=i.lastIndex}return u<s.length&&a.push(A6(s.slice(u))),a.length>0?a:[e]}function dT(e){return/(?: {2,}|\\)$/.test(e)}function fT(e){return e.replace(/(?: {2,}|\\)$/,"")}function fm(e){return/^(?: {4}|\t)/.test(e)}function hT(e){return e.startsWith(" ")?e.slice(1):e.replace(/^ {4}/,"")}function pT(e,t,r){const n=[];return e.forEach((s,i)=>{const a=dT(s);n.push(...ri(fT(s),`${t}-${i}`,!0,r)),i<e.length-1&&n.push(a?l.jsx("br",{},`${t}-${i}-br`):" ")}),n}function Rb(e,t,r){const n=[],s=[];return e.forEach((i,a)=>{s.push(dT(i)),n.push(ri(fT(i),`${t}-${a}`,!0,r))}),{perLine:n,hardBreaks:s}}function Nb(e,t,r,n,s){const i=[];return e.forEach((a,u)=>{const d=r[u]??0,h=!!(s&&d>=s.start&&d<=s.end);i.push(l.jsx("span",{"data-md-ref-start":d,"data-md-ref-end":d,"data-selected":h?"true":void 0,children:a},`${n}-ref-${u}`)),u<e.length-1&&i.push(t[u]?l.jsx("br",{},`${n}-${u}-br`):" ")}),i}function Bf(e){const t=e.trim().replace(/^\|/,"").replace(/\|$/,""),r=[];let n="",s=!1,i=0,a=0;for(let u=0;u<t.length;u+=1){const d=t[u];if(s){n+=d,s=!1;continue}if(d==="\\"){s=!0;continue}if(d==="`"){const h=u;for(;u+1<t.length&&t[u+1]==="`";)u+=1;const m=u-h+1;n+="`".repeat(m),i===0?i=m:i===m&&(i=0);continue}if(i===0&&d==="["?a+=1:i===0&&d==="]"&&a>0&&(a-=1),d==="|"&&i===0&&a===0){r.push(n.trim()),n="";continue}n+=d}return s&&(n+="\\"),r.push(n.trim()),r}function mT(e){return Bf(e).map(t=>/^:-+:$/.test(t)?"center":/^-+:$/.test(t)?"right":/^:-+$/.test(t)?"left":null)}function hm(e){return e==="center"?"text-center":e==="right"?"text-right":"text-left"}function pm(e){return/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/.test(e.trim())}function qY(e,t){return e>96||e>44&&t>.35}function Xx(e){return(e.match(/^\s*/)?.[0]??"").replace(/\t/g," ").length}function Jx(e){const t=e.trim().match(/^([-+*]|\d+[.)])\s+(.+)$/);if(!t)return null;const r=/^\d+[.)]$/.test(t[1]);return{ordered:r,start:r?Number.parseInt(t[1],10):void 0,content:t[2]}}function gT(e,t,r,n,s,i=new Set){const a=[],u=[];let d=t;for(;d<e.length;){const h=e[d];if(s&&(dm(h)||i.has(d))){d+=1;continue}const m=Jx(h),b=Xx(h);if(!m){if(b>r&&u.length>0){([...u].reverse().find(S=>S.indent<b)?.item??u[u.length-1].item).paragraphs.push(h.trim());for(const S of u)S.item.lineEnd=d+1;d+=1;continue}break}if(b<r||b===r&&m.ordered!==n)break;const x={content:m.content,ordered:m.ordered,start:m.start,children:[],paragraphs:[],lineStart:d+1,lineEnd:d+1};for(;u.length>0&&u[u.length-1].indent>=b;)u.pop();const v=u[u.length-1]?.item??null;v?v.children.push(x):a.push(x),u.push({indent:b,item:x});for(const A of u)A.item.lineEnd=d+1;d+=1}return{items:a,nextIndex:d}}function e5(e,t,r,n=0){return e.map((s,i)=>{const a=s.content.match(/^\[([ xX])\]\s+(.+)$/);return{key:`item-${i}`,taskItem:!!a,refStart:s.lineStart+n,refEnd:s.lineEnd+n,content:l.jsxs(l.Fragment,{children:[a?l.jsx("input",{type:"checkbox",checked:a[1].toLowerCase()==="x",readOnly:!0,className:"mr-2 align-[-2px] accent-primary"}):null,ri(a?.[2]??s.content,`li-${t}-${i}`,!0,r),s.paragraphs.length>0&&l.jsx("div",{className:"mt-1 space-y-1 text-muted-foreground",children:s.paragraphs.map((u,d)=>l.jsx("p",{children:ri(u,`li-${t}-${i}-p-${d}`,!0,r)},`paragraph-${d}`))})]}),groups:YY(s.children,`${t}-${i}`,r,n)}})}function YY(e,t,r,n=0){const s=[];for(const i of e){const a=s[s.length-1];a&&a.ordered===i.ordered?a.items.push(i):s.push({ordered:i.ordered,items:[i]})}return s.map((i,a)=>({ordered:i.ordered,start:i.ordered?i.items[0]?.start:void 0,items:e5(i.items,`${t}-g${a}`,r,n)}))}function t5(e,t){return e.map(r=>{const n=!!(t&&r.refStart<=t.end&&r.refEnd>=t.start);return l.jsxs("li",{className:r.taskItem?"list-none":void 0,"data-md-ref-start":r.refStart,"data-md-ref-end":r.refEnd,"data-selected":n?"true":void 0,children:[r.content,r.groups.length>0&&KY(r.groups,t)]},r.key)})}function KY(e,t){return e.map((r,n)=>{const s=r.ordered?"ol":"ul";return l.jsx(s,{start:r.start,className:`${r.ordered?"list-decimal":"list-disc"} mt-1 space-y-0.5 pl-4 marker:text-muted-foreground/60`,children:t5(r.items,t)},`nested-${n}`)})}function ZY(e){const t=Array.from(e.footnoteDefinitions.values()).sort((r,n)=>r.index-n.index);return t.length===0?null:l.jsxs("section",{className:"mt-3 border-t border-border/20 pt-2 text-[12px] leading-5 text-muted-foreground",children:[l.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:e.footnotesLabel}),l.jsx("ol",{className:"list-decimal space-y-1 pl-5",children:t.map(r=>l.jsxs("li",{id:`fn-${r.id}`,children:[ri(r.text,`footnote-${r.id}`,!0,e)," ",l.jsx("a",{href:`#fnref-${r.id}`,className:"text-primary no-underline","aria-label":e.backToFootnoteLabel(r.index),children:"↩"})]},r.id))})]})}function XY(e,t,r,n){const s=[];let i=0;const a=u=>n?.[u]??u+1;for(;i<e.length;){const u=e[i],d=u.trim();if(!d){i+=1;continue}if(/^<details>\s*$/i.test(d)){const L=i;let R="Details";const B=[];for(i+=1;i<e.length&&!/^<\/details>\s*$/i.test(e[i].trim());){const Q=e[i].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);Q?R=Q[1].trim()||R:B.push(e[i].trimStart()),i+=1}i<e.length&&(i+=1),s.push({kind:"static",node:l.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[l.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:ri(R,`${t}-details-${L}-summary`,!0,r)}),B.length>0&&l.jsx("div",{className:"mt-2 text-sm leading-6",children:pT(B,`${t}-details-${L}`,r)})]},`${t}-details-${L}`)});continue}const h=uT(u);if(h){const L=[u],R=i;for(i+=1;i<e.length&&!h.selfContained&&!new RegExp(`</${h.tag}>`,"i").test(e[i]);)L.push(e[i]),i+=1;i<e.length&&!h.selfContained&&(L.push(e[i]),i+=1),s.push({kind:"static",node:l.jsx(cT,{html:L.join(`
|
|
170
170
|
`)},`${t}-html-${R}`)});continue}const m=d.match(/^(```|~~~)\s*(.*)$/);if(m){const L=[],R=m[1],B=m[2]?.trim(),Q=i;for(i+=1;i<e.length&&!e[i].trim().startsWith(R);)L.push(e[i]),i+=1;i<e.length&&(i+=1),B.toLowerCase()==="mermaid"?s.push({kind:"static",node:l.jsx(xT,{code:L.join(`
|
|
171
171
|
`),blockKey:`${t}-code-${Q}`},`${t}-code-${Q}`)}):["math","latex","tex"].includes(B.toLowerCase())?s.push({kind:"static",node:l.jsx(Df,{tex:L.join(`
|
|
172
172
|
`),display:!0},`${t}-code-${Q}`)}):s.push({kind:"code",key:`${t}-code-${Q}`,code:L.join(`
|
|
173
173
|
`),lang:B,blockKey:`${t}-code-${Q}`,codeStartLine:a(Q)+1});continue}if(fm(u)){const L=[],R=i;for(;i<e.length&&(fm(e[i])||!e[i].trim());)L.push(e[i].trim()?hT(e[i]):""),i+=1;s.push({kind:"code",key:`${t}-indented-code-${R}`,code:L.join(`
|
|
174
|
-
`).replace(/\n+$/,""),lang:"",blockKey:`${t}-indented-code-${R}`,codeStartLine:a(R)});continue}const b=d.match(/^(#{1,6})\s+(.+)$/);if(b){const R=`h${Math.min(6,b[1].length+1)}`,B=rT(b[2]),Q=Eb(B,r);s.push({kind:"static",node:l.jsx(R,{id:Q,className:"scroll-mt-16 font-semibold text-foreground",children:ri(B,`${t}-heading-${i}`,!0,r)},`${t}-heading-${i}`)}),i+=1;continue}if(i+1<e.length&&u.includes("|")&&pm(e[i+1])){const L=Bf(u),R=mT(e[i+1]),B=[],Q=i;for(i+=2;i<e.length&&e[i].includes("|")&&e[i].trim();)B.push(Bf(e[i])),i+=1;s.push({kind:"static",node:l.jsx("div",{className:WA,"data-markdown-table-scroll":!0,children:l.jsxs("table",{className:"w-max min-w-full max-w-none table-auto border-collapse text-left text-[11px] sm:text-xs",children:[l.jsx("thead",{className:"bg-surface-2 text-foreground",children:l.jsx("tr",{children:L.map((T,O)=>l.jsx("th",{className:`${zA} ${hm(R[O]??null)}`,children:l.jsx("div",{className:um,children:ri(T,`${t}-th-${Q}-${O}`,!0,r)})},`h-${O}`))})}),l.jsx("tbody",{children:B.map((T,O)=>l.jsx("tr",{className:"border-t border-border/10",children:L.map((I,N)=>l.jsx("td",{className:`${GA} ${hm(R[N]??null)}`,children:l.jsx("div",{className:um,children:ri(T[N]??"",`${t}-td-${Q}-${O}-${N}`,!0,r)})},`c-${N}`))},`r-${O}`))})]})},`${t}-table-${Q}`)});continue}const x=Jx(u);if(x){const L=x.ordered,R=Xx(u),B=x.start,Q=i,T=gT(e,i,R,L,!1);i=T.nextIndex,s.push({kind:"list",keyPrefix:`${t}-list-${Q}`,ordered:L,start:L?B:void 0,renders:e5(T.items,`${t}-list-${Q}`,r,a(0)-1)});continue}const v=[u.trimStart()],A=[a(i)],S=i;for(i+=1;i<e.length&&e[i].trim()&&!Lb(e[i])&&!(i+1<e.length&&e[i].includes("|")&&pm(e[i+1]));)v.push(e[i].trimStart()),A.push(a(i)),i+=1;const k=Rb(v,`${t}-p-${S}`,r);s.push({kind:"paragraph",keyPrefix:`${t}-p-${S}`,perLine:k.perLine,hardBreaks:k.hardBreaks,lineNums:A})}return s}function JY(e,t){return e.map(r=>{switch(r.kind){case"static":return r.node;case"paragraph":return l.jsx("p",{children:Nb(r.perLine,r.hardBreaks,r.lineNums,r.keyPrefix,t)},r.keyPrefix);case"list":{const n=r.ordered?"ol":"ul";return l.jsx(n,{start:r.start,className:`${r.ordered?"list-decimal":"list-disc"} space-y-0.5 pl-4 marker:text-muted-foreground/70`,children:t5(r.renders,t)},r.keyPrefix)}case"code":return l.jsx(mm,{code:r.code,lang:r.lang,blockKey:r.blockKey,codeStartLine:r.codeStartLine,lineRange:t},r.key)}})}let rp=null,T6=!1;const np=16,bT=192;function eK(){return rp||(rp=kd(()=>import("./mermaid.core-
|
|
174
|
+
`).replace(/\n+$/,""),lang:"",blockKey:`${t}-indented-code-${R}`,codeStartLine:a(R)});continue}const b=d.match(/^(#{1,6})\s+(.+)$/);if(b){const R=`h${Math.min(6,b[1].length+1)}`,B=rT(b[2]),Q=Eb(B,r);s.push({kind:"static",node:l.jsx(R,{id:Q,className:"scroll-mt-16 font-semibold text-foreground",children:ri(B,`${t}-heading-${i}`,!0,r)},`${t}-heading-${i}`)}),i+=1;continue}if(i+1<e.length&&u.includes("|")&&pm(e[i+1])){const L=Bf(u),R=mT(e[i+1]),B=[],Q=i;for(i+=2;i<e.length&&e[i].includes("|")&&e[i].trim();)B.push(Bf(e[i])),i+=1;s.push({kind:"static",node:l.jsx("div",{className:WA,"data-markdown-table-scroll":!0,children:l.jsxs("table",{className:"w-max min-w-full max-w-none table-auto border-collapse text-left text-[11px] sm:text-xs",children:[l.jsx("thead",{className:"bg-surface-2 text-foreground",children:l.jsx("tr",{children:L.map((T,O)=>l.jsx("th",{className:`${zA} ${hm(R[O]??null)}`,children:l.jsx("div",{className:um,children:ri(T,`${t}-th-${Q}-${O}`,!0,r)})},`h-${O}`))})}),l.jsx("tbody",{children:B.map((T,O)=>l.jsx("tr",{className:"border-t border-border/10",children:L.map((I,N)=>l.jsx("td",{className:`${GA} ${hm(R[N]??null)}`,children:l.jsx("div",{className:um,children:ri(T[N]??"",`${t}-td-${Q}-${O}-${N}`,!0,r)})},`c-${N}`))},`r-${O}`))})]})},`${t}-table-${Q}`)});continue}const x=Jx(u);if(x){const L=x.ordered,R=Xx(u),B=x.start,Q=i,T=gT(e,i,R,L,!1);i=T.nextIndex,s.push({kind:"list",keyPrefix:`${t}-list-${Q}`,ordered:L,start:L?B:void 0,renders:e5(T.items,`${t}-list-${Q}`,r,a(0)-1)});continue}const v=[u.trimStart()],A=[a(i)],S=i;for(i+=1;i<e.length&&e[i].trim()&&!Lb(e[i])&&!(i+1<e.length&&e[i].includes("|")&&pm(e[i+1]));)v.push(e[i].trimStart()),A.push(a(i)),i+=1;const k=Rb(v,`${t}-p-${S}`,r);s.push({kind:"paragraph",keyPrefix:`${t}-p-${S}`,perLine:k.perLine,hardBreaks:k.hardBreaks,lineNums:A})}return s}function JY(e,t){return e.map(r=>{switch(r.kind){case"static":return r.node;case"paragraph":return l.jsx("p",{children:Nb(r.perLine,r.hardBreaks,r.lineNums,r.keyPrefix,t)},r.keyPrefix);case"list":{const n=r.ordered?"ol":"ul";return l.jsx(n,{start:r.start,className:`${r.ordered?"list-decimal":"list-disc"} space-y-0.5 pl-4 marker:text-muted-foreground/70`,children:t5(r.renders,t)},r.keyPrefix)}case"code":return l.jsx(mm,{code:r.code,lang:r.lang,blockKey:r.blockKey,codeStartLine:r.codeStartLine,lineRange:t},r.key)}})}let rp=null,T6=!1;const np=16,bT=192;function eK(){return rp||(rp=kd(()=>import("./mermaid.core-DSPzdUTe.js").then(e=>e.aJ),__vite__mapDeps([6,1,7])).then(e=>e.default??e).catch(e=>{throw rp=null,e})),rp}function tK(e){T6||(e.initialize({startOnLoad:!1,securityLevel:"strict",theme:"neutral"}),T6=!0)}function rK(e){const t=e.match(/\sviewBox=(["'])([^"']+)\1/i);if(!t)return e;const[,,r]=t,n=r.trim().split(/[\s,]+/).map(Number),[,,s,i]=n;if(!Number.isFinite(s)||!Number.isFinite(i)||s<=0||i<=0)return e;const a=Math.max(bT,Math.ceil(s)),u=Math.ceil(a/s*i);return e.replace(/<svg\b([^>]*)>/i,(d,h)=>`<svg${h.replace(/\s(?:width|height)=(["']).*?\1/gi,"").replace(/\sstyle=(["']).*?\1/gi,"")} width="${a}" height="${u}">`)}function nK(e){const t=e?.querySelector("svg");if(!t)return;let r;try{r=t.getBBox()}catch{return}if(!Number.isFinite(r.width)||!Number.isFinite(r.height)||r.width<=0||r.height<=0)return;const n=r.x-np,s=r.y-np,i=r.width+np*2,a=r.height+np*2,u=Math.max(bT,Math.ceil(i)),d=Math.ceil(u/i*a);t.setAttribute("viewBox",`${n} ${s} ${i} ${a}`),t.setAttribute("width",String(u)),t.setAttribute("height",String(d)),t.removeAttribute("style")}function sK(e){const t=e.trim().split(/\s+/,1)[0]?.toLowerCase();if(!t)return null;const r=t.replace(/^language-/,"");return Rf(`code.${r}`)??r}function xT({code:e,blockKey:t}){const{t:r}=jr(),[n,s]=w.useState(null),[i,a]=w.useState(!1),u=w.useRef(null),d=w.useContext(eT);w.useEffect(()=>{let m=!1;return s(null),a(!1),eK().then(async b=>{tK(b);const x=`termdock-md-mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`,{svg:v}=await b.render(x,e);m||s(rK(v))}).catch(()=>{m||a(!0)}),()=>{m=!0}},[t,e]),w.useLayoutEffect(()=>{n&&nK(u.current)},[n]);const h=w.useCallback(()=>{const m=u.current?.querySelector("svg")?.outerHTML??n;m&&d?.(m)},[d,n]);return i?l.jsx(mm,{code:e,lang:"mermaid",blockKey:`${t}-fallback`}):l.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[l.jsx("div",{className:"border-b border-border/15 bg-surface-2 px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"mermaid"}),l.jsx("div",{className:"bg-surface p-3",children:n?l.jsx("button",{type:"button",className:"block max-w-full rounded text-left focus:outline-none focus:ring-2 focus:ring-ring/45",title:r("rightSidebar.openMermaidDiagram"),onClick:m=>{m.stopPropagation(),h()},children:l.jsx("span",{ref:u,role:"img","aria-label":r("rightSidebar.mermaidDiagram"),className:"block max-h-[70vh] max-w-full overflow-auto rounded bg-white p-2 text-slate-900 [&_svg]:block [&_svg]:h-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:{__html:n}})}):l.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:r("rightSidebar.renderingDiagram")})})]})}function mm({code:e,lang:t,blockKey:r,codeStartLine:n,lineRange:s}){const i=sK(t),[a,u]=w.useState(null);w.useEffect(()=>{if(!i||!bA(e)){u(null);return}let h=!1;return xA().then(m=>{if(h||!m.registered(i)){h||u(null);return}try{u(yA(m,e,i))}catch{h||u(null)}}).catch(()=>{h||u(null)}),()=>{h=!0}},[r,e,i]);const d=a??(e||" ").split(`
|
|
175
175
|
`).map(h=>[h||" "]);return l.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[t&&l.jsx("div",{className:"border-b border-border/15 bg-surface-2 px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:t}),l.jsx("pre",{className:`${Kx} termdock-code overflow-auto p-3 text-[11px] leading-relaxed text-foreground`,children:l.jsx("code",{children:d.map((h,m)=>{const b=n!=null?n+m:null,x=!!(s&&b!=null&&b>=s.start&&b<=s.end);return l.jsxs("span",{"data-md-ref-start":b??void 0,"data-md-ref-end":b??void 0,"data-selected":x?"true":void 0,children:[h,m<d.length-1?`
|
|
176
176
|
`:null]},`${r}-line-${m}`)})})})]})}function iK(e,t,r,n,s){e=BY(e);const i=RY(e),a=DY(e),u=[],d={markdownFilePath:t,rootPath:r,referenceDefinitions:i,footnoteDefinitions:NY(e),headingSlugCounts:new Map,images:u,onImageOpen:n,footnotesLabel:s?.footnotes??"Footnotes",backToFootnoteLabel:s?.backToFootnote??(x=>`Back to footnote ${x}`)},h=[];let m=0;for(;m<e.length;){const x=e[m],v=x.trim();if(dm(x)||a.has(m)){m+=1;continue}if(!v){m+=1;continue}if(/^<details>\s*$/i.test(v)){const O=m;let I="Details";const N=[];for(m+=1;m<e.length&&!/^<\/details>\s*$/i.test(e[m].trim());){const U=e[m].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);U?I=U[1].trim()||I:N.push(e[m].trimStart()),m+=1}m<e.length&&(m+=1),h.push({key:`details-${O}`,startLine:O+1,endLine:m,content:l.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[l.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:ri(I,`details-${O}-summary`,!0,d)}),N.length>0&&l.jsx("div",{className:"mt-2 text-sm leading-6",children:pT(N,`details-${O}`,d)})]})});continue}const A=uT(x);if(A){const O=[x],I=m;for(m+=1;m<e.length&&!A.selfContained&&!new RegExp(`</${A.tag}>`,"i").test(e[m]);)O.push(e[m]),m+=1;m<e.length&&!A.selfContained&&(O.push(e[m]),m+=1),h.push({key:`html-${I}`,startLine:I+1,endLine:m,content:l.jsx(cT,{html:O.join(`
|
|
177
177
|
`)})});continue}const S=v.match(/^(```|~~~)\s*(.*)$/);if(S){const O=[],I=S[1],N=S[2]?.trim(),U=m;for(m+=1;m<e.length&&!e[m].trim().startsWith(I);)O.push(e[m]),m+=1;m<e.length&&(m+=1),h.push({key:`code-${U}`,startLine:U+1,endLine:m,fineGrained:N.toLowerCase()!=="mermaid"&&!["math","latex","tex"].includes(N.toLowerCase()),content:N.toLowerCase()==="mermaid"?l.jsx(xT,{code:O.join(`
|
|
@@ -206,7 +206,7 @@ ${Le}
|
|
|
206
206
|
`)},[qn,Is,ln,Rr,fe]),ug=w.useCallback((_="generate")=>{const $=_==="generate"?s0:[_==="regenerate"?"模式:重新生成。请基于当前分支导出结果重新生成全部 hunk 解释并覆盖写回。":"模式:补充失效。请基于当前分支导出结果只补充新增、变更或已失效的 hunk 解释,仍有效的解释不要重复写回。","",s0].join(`
|
|
207
207
|
`);so(T("rightSidebar.branchAuditShort"),$,`context:branch-audit-scope:${_}`),s||r()},[s0,so,r,s,T]),dg=w.useCallback(async()=>{if(!fe||Is.length===0)return;const _=fe;pr(!0),sn(null),Te(null),ft(null);try{const $=await Promise.all(Is.map(async St=>{const Pt=ln[St.root]?.trim();if(!Pt)throw new Error(T("rightSidebar.branchAuditMissingBase",{repo:St.label}));const Dr=(Rr[St.root]||St.branch||"").trim();return AL({cwd:fe,repoRoot:St.root,base:Pt,head:Dr&&Dr!==St.branch?Dr:null,includeUncommitted:qn,requestSlotId:`right-sidebar-branch-preview:${St.root}`})}));if(!zr(_))return;const q=$.find(St=>!St.available);if(q){sn(q.error??"Branch diff is unavailable");return}const xe=$.length===1?$[0]:{available:!0,workspaceRoot:fe,repoRoot:fe,baseRef:$.map(St=>St.baseRef??St.baseBranch).filter(Boolean).join(", "),currentBranch:$.map(St=>St.currentBranch??"HEAD").filter(Boolean).join(", "),headRef:$.map(St=>St.headRef).filter(Boolean).join(", "),diffFingerprint:$.map(St=>St.diffFingerprint).filter(Boolean).join("+"),stat:$.map(St=>St.stat).filter(Boolean).join(`
|
|
208
208
|
`),files:$.flatMap((St,Pt)=>{const Dr=Is[Pt];return(St.files??[]).map($n=>`${Dr?.label??St.repoRoot??"repo"}/${$n}`)}),hunks:$.flatMap((St,Pt)=>{const $n=Is[Pt]?.label??St.repoRoot??"repo";return(St.hunks??[]).map(Lr=>({...Lr,filePath:`${$n}/${Lr.filePath}`,oldPath:Lr.oldPath?`${$n}/${Lr.oldPath}`:Lr.oldPath,newPath:Lr.newPath?`${$n}/${Lr.newPath}`:Lr.newPath}))}),commits:$.flatMap(St=>St.commits??[]),commitCount:$.reduce((St,Pt)=>St+(Pt.commitCount??Pt.commits?.length??0),0),diff:$.map(St=>St.diff).filter(Boolean).join(`
|
|
209
|
-
`),truncated:$.some(St=>St.truncated)},ve=Date.now(),Fe=["preview",xe.repoRoot??fe,xe.baseRef??xe.baseBranch??"",xe.currentBranch??"",xe.headRef??"",xe.diffFingerprint??ve].join("\0"),dt=Is.length===1?Is[0].label:`${Is.length} repos`;Te(xe),Xt(St=>[{key:Fe,diff:xe,repoLabel:dt,createdAt:ve},...St.filter(Pt=>Pt.key!==Fe)].slice(0,8)),Qr(St=>St[Fe]===void 0?St:{...St,[Fe]:0}),wn(Fe),Ui(xe.hunks?.[0]?`${xe.hunks[0].filePath}\0${xe.hunks[0].hunkHeader}\0${xe.hunks[0].hunkIndex}`:null),J(!0)}catch($){if(!zr(_)||hl($))return;sn($ instanceof Error?$.message:"Failed to load branch diff")}finally{zr(_)&&pr(!1)}},[qn,Is,ln,Rr,zr,fe,T]),fg=w.useCallback(_=>{Te(_.diff),sn(null),wn(_.key),Ui(_.diff.hunks?.[0]?`${_.diff.hunks[0].filePath}\0${_.diff.hunks[0].hunkHeader}\0${_.diff.hunks[0].hunkIndex}`:null),J(!0)},[]),hg=w.useCallback(_=>{Xt($=>$.filter(q=>q.key!==_)),Qr($=>{if(!(_ in $))return $;const q={...$};return delete q[_],q}),xn===_&&(wn(null),Te(null),J(!1))},[xn]),th=w.useCallback(_=>{const $=Dl.find(q=>q.key===_);$&&(Te(null),sn(null),wn(_),Ui($.records[0]?.filePath??null),J(!0))},[Dl]),rh=w.useCallback(async _=>{if(!fe||!Er)return;const[$]=_.split(/\s+/);if($){pe($),at(null),ft(null);try{const q=await TL({cwd:fe,repoRoot:Er,commit:$,requestSlotId:"right-sidebar-commit-diff"});if(!q.available){at(q.error??"Commit diff is unavailable");return}ft(q);const xe=q.hunks?.[0];on(xe?`${xe.filePath}\0${xe.hunkHeader}\0${xe.hunkIndex}`:null)}catch(q){at(q instanceof Error?q.message:"Failed to load commit diff")}finally{pe(null)}}},[Er,fe]),nh=w.useCallback(_=>{if(!yt||!xn)return;const $=Math.max(0,Math.round(_));Qr(q=>Math.abs((q[xn]??0)-$)<24?q:{...q,[xn]:$})},[yt,xn]);w.useEffect(()=>{!It||!ot||!yt||Ps(1)},[ot,yt,It,Ps]);const i0=w.useCallback(_=>{_&&Ur($=>oq($,_))},[]),Cu=Ut.key===rn?Ut.key:null,yc=w.useCallback(_=>{const $=At.getState(),q=IK();ip("select_diff_file",{interactionId:q,path:_,previousSelectedFilePath:$.selectedFilePath,rootPath:$.rootPath,activeGitRepoRoot:he,changedFiles:$.changedFiles.size,gitBundleLoading:$.gitBundleLoading,gitBundleLastLoadedAt:$.gitBundleLastLoadedAt,rightTab:$.rightTab}),An(_),hn("diff"),It&&_&&Ps(1),i0(_),queueMicrotask(()=>{const xe=At.getState();ip("select_diff_file_after",{interactionId:q,requestedPath:_,selectedFilePath:xe.selectedFilePath,rootPath:xe.rootPath,rightTab:xe.rightTab,changedFiles:xe.changedFiles.size,activeGitRepoRoot:he})})},[he,It,i0,An,hn,Ps]),sh=w.useCallback(_=>{const $=Array.from(cr.values()).find(q=>{const xe=Lo(q,fe),ve=Os(q);return q.path===_.filePath||ve===_.filePath||q.absolutePath===_.filePath||(xe?`${xe}/${q.path}`===_.filePath:!1)||_.repoRoot&&xe===_.repoRoot&&q.path===_.filePath});if($){yc(Os($)),window.setTimeout(()=>Bc(_),90),window.setTimeout(()=>Bc(_),320),window.setTimeout(()=>Bc(_),760);return}Bc(_)},[cr,fe,yc]),_u=w.useCallback(({slideToDetail:_}={})=>kt.length>0?l.jsx(cm,{walkthroughs:kt,repoRoot:he,onNavigate:$=>{It&&window.requestAnimationFrame(()=>_?.()),sh($)}}):l.jsxs("div",{className:"rounded-lg border border-border/15 bg-surface px-3 py-6 text-center text-xs text-muted-foreground",children:[l.jsx(ic,{size:18,className:"mx-auto mb-2 text-muted-foreground/80"}),T("rightSidebar.changeWalkthroughEmpty")]}),[he,kt,sh,It,T]),pg=w.useCallback(_=>{_&&Ar($=>{const q=new Set($);return q.has(_)?q.delete(_):q.add(_),i2(e2,q),q})},[]),o0=w.useCallback(_=>{qt($=>{const q=new Set($);return q.has(_)?q.delete(_):q.add(_),i2(s6,q),q})},[]),Ta=w.useCallback(_=>{it(_),Br(PA,_)},[]);w.useEffect(()=>{ol||dr!=="ai"||Ta("tree")},[dr,Ta,ol]);const vc=w.useCallback(()=>{Nt(_=>{const $=!_;return Br(jA,$),$})},[]),ih=w.useCallback(_=>{zt(_),Br(FA,_)},[]),a0=w.useMemo(()=>({algorithm:"histogram",whitespace:"default"}),[]),oh=w.useCallback(_=>{K(_),Br(QA,_)},[]),ku=w.useCallback(async(_,$,q,xe)=>{let ve=_;for(;ve.ok&&ve.status==="running";)await new Promise(dt=>window.setTimeout(dt,1500)),ve=await X5({jobId:ve.jobId,cwd:$.cwd,action:$.action});if(!ve.ok)throw new Error("Git action status is unavailable");if(ve.status==="error")throw new Error(ve.error||ve.message||"Git action failed");const Fe={action:$.action,path:xe,label:q};return rs(Fe),window.setTimeout(()=>rs(dt=>dt?.action===Fe.action&&dt.path===Fe.path?null:dt),1400),ve},[]),Xs=w.useCallback(async(_,$,q)=>{const xe=fe;fe&&We.current.delete(fe),Yn(null),rs(null),Vs({action:_.action,path:q});try{const ve=await kL(_),Fe=await ku(ve,_,$,q);if(!zr(xe))return!1;const dt=fe?await Gg(fe,void 0,{includeNested:!0,cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:H0(fe)}).catch(()=>Fe.bundle):Fe.bundle;return zr(xe)?(dt&&Tr(dt,{reloadDiff:!0,cacheOnly:!0}),ii(null),!0):!1}catch(ve){return rs(null),Yn(T("rightSidebar.gitActionFailed",{message:ve instanceof Error?ve.message:"Unknown error"})),!1}finally{zr(xe)&&Vs(null)}},[Tr,zr,fe,T,ku]),Sa=w.useCallback((_,$,q)=>{if($){if(_==="stage-all"){Xs({action:"stage-all",cwd:$},T("rightSidebar.stageAll"),`repo:${$}`);return}ii({kind:"stash-all",repoRoot:$,repoLabel:q})}},[Xs,T]),l0=w.useCallback(_=>{Ke(_),s2(fe,_),ai(""),Gi(""),Ci(""),An(Vd(_)),Xr||hn("diff")},[Vd,Xr,fe,An,hn]),mg=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=Si.trim();!_||_===mr?.branch||await Xs({action:"switch-branch",cwd:Er,branch:_},T("rightSidebar.switchBranch"))},[mr?.branch,Er,Wn,Xs,Si,T]),ah=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=fs.trim();if(!_)return;await Xs({action:"commit",cwd:Er,message:_},T("rightSidebar.commitChanges"))&&hs("")},[Er,fs,Wn,Xs,T]),gg=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=as.trim(),$=li.trim();await Xs({action:"push",cwd:Er,..._?{remote:_}:{},...$?{branch:$}:{}},T("rightSidebar.pushChanges"))},[Er,li,as,Wn,Xs,T]),bg=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=as.trim(),$=li.trim();await Xs({action:"pull",cwd:Er,..._?{remote:_}:{},...$?{branch:$}:{}},T("rightSidebar.pullChanges"))},[Er,li,as,Wn,Xs,T]);w.useEffect(()=>{if(!Xr||!Er||Mr)return;let _=!1;const $={push:T("rightSidebar.pushChanges"),pull:T("rightSidebar.pullChanges"),commit:T("rightSidebar.commitChanges"),"switch-branch":T("rightSidebar.switchBranch"),"stage-all":T("rightSidebar.stageAll"),"stash-all":T("rightSidebar.stashAll")};return(async()=>{for(const q of["push","pull","commit","switch-branch","stage-all","stash-all"]){if(_)return;const xe=await X5({cwd:Er,action:q}).catch(()=>null);if(!xe?.ok||xe.status!=="running")continue;const ve={action:q,cwd:Er},Fe=$[q]??q;Vs({action:q});try{const dt=await ku(xe,ve,Fe);if(_||!zr(fe))return;const St=fe?await Gg(fe,void 0,{includeNested:!0,cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:H0(fe)}).catch(()=>dt.bundle):dt.bundle;St&&Tr(St,{reloadDiff:!0,cacheOnly:!0})}catch(dt){_||Yn(T("rightSidebar.gitActionFailed",{message:dt instanceof Error?dt.message:"Unknown error"}))}finally{_||Vs(null)}return}})(),()=>{_=!0}},[Er,Tr,Xr,zr,fe,Mr,T,ku]);const c0=In?.action==="commit",u0=In?.action==="switch-branch",d0=In?.action==="pull",f0=In?.action==="push",Lu=Xr||oi,h0=mc?T("rightSidebar.changeAuditScopeAll"):Es.length===1?Es[0].label:`${Es.length} repos`,xg=Es.length>0,lh=Is.length>0,yg=fe?l.jsx(S6,{open:Jr,onOpenChange:zn,showScopePicker:!0,selectedAll:mc,repos:wo,selectedRoots:xu,onToggleRepo:og,onGenerate:()=>ug(r0?"regenerate":"generate"),disabled:!xg,generateDisabled:!lh,inserted:et?.startsWith("context:branch-audit-scope:")??!1,buttonLabel:T(r0?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),insertedLabel:T("rightSidebar.inserted"),title:T("rightSidebar.branchAuditGenerateTitle"),ariaLabel:T("rightSidebar.branchAuditShort"),scopeTitle:T("rightSidebar.changeAuditScopeLabel"),scopeLabel:h0,allLabel:T("rightSidebar.changeAuditScopeAll"),generateLabel:T(r0?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),onSecondaryAction:()=>{dg()},secondaryDisabled:!lh||Wt,secondaryLabel:T("rightSidebar.branchAuditViewDiff"),secondaryTitle:T("rightSidebar.branchAuditViewDiffTitle"),secondaryLoading:Wt,loading:En.size>0,statusTitle:En.size>0?T("rightSidebar.branchCandidatesLoading"):void 0,extraContent:l.jsxs("div",{className:"mb-2 space-y-1.5",children:[l.jsxs("label",{className:"flex cursor-pointer items-center justify-between gap-3 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-foreground",children:[l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block font-medium",children:T("rightSidebar.includeUncommitted")}),l.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:T("rightSidebar.includeUncommittedHint")})]}),l.jsx("input",{type:"checkbox",checked:qn,onChange:_=>_n(_.target.checked),className:"h-4 w-4 shrink-0 accent-[rgb(var(--primary-rgb))]"})]}),Rl.length>0&&l.jsx("div",{className:"rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[10px] text-[color:var(--warning)]",children:T("rightSidebar.missingBaseReposSkipped",{repositories:Rl.map(_=>_.label).join(O==="zh"?"、":", ")})})]}),renderRepoExtra:_=>{const $=Ei.get(_.root),q=[],xe=new Set,ve=(Pt,Dr)=>{!Pt||xe.has(Pt)||(xe.add(Pt),q.push({value:Pt,label:Pt,meta:Dr}))};ve(Rr[_.root]||$?.context?.branch,T("rightSidebar.pushCurrentBranchBadge"));for(const Pt of $?.context?.branches??[])ve(Pt,Pt===$?.context?.branch?T("rightSidebar.pushCurrentBranchBadge"):T("rightSidebar.localBranch"));for(const Pt of $?.context?.remoteBranches??[])ve(Pt,T("rightSidebar.remoteBranch"));const Fe=[],dt=new Set,St=(Pt,Dr)=>{!Pt||dt.has(Pt)||(dt.add(Pt),Fe.push({value:Pt,label:Pt,meta:Dr}))};St(ln[_.root],ln[_.root]?T("rightSidebar.pushUpstreamBadge"):void 0),St($?.context?.upstream,$?.context?.upstream?T("rightSidebar.pushUpstreamBadge"):void 0);for(const Pt of $?.context?.remoteBranches??[])St(Pt,"remote");for(const Pt of $?.context?.branches??[])St(Pt,Pt===$?.context?.branch?T("rightSidebar.pushCurrentBranchBadge"):"local");return l.jsxs("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:[l.jsx(qu,{label:T("rightSidebar.currentBranchLabel"),value:Rr[_.root]||$?.context?.branch||"",options:q,placeholder:T("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:T("rightSidebar.switchBranchSearchPlaceholder"),emptyText:T("rightSidebar.switchNoBranches"),onChange:Pt=>{ds(Dr=>({...Dr,[_.root]:Pt}))}}),l.jsx(qu,{label:T("rightSidebar.branchAuditBaseLabel"),value:ln[_.root]||"",options:Fe,placeholder:T("rightSidebar.branchAuditBasePlaceholder"),searchPlaceholder:T("rightSidebar.branchAuditBaseSearchPlaceholder"),emptyText:T("rightSidebar.branchAuditBaseEmpty"),onChange:Pt=>{Cn(Dr=>({...Dr,[_.root]:Pt}))}})]})}}):null,ch=U0(ct.reduce((_,$)=>Math.max(_,$.injectedAt??0),0),O),vg=fe?l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("button",{type:"button",onClick:()=>Sr(_=>{const $=!_;return Br(t2,$),$}),className:"group flex w-full items-center gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":fn,children:[l.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:l.jsx(ic,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-[12px] font-semibold text-foreground",children:T("rightSidebar.branchAuditTitle")}),l.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:h0})]}),l.jsx("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${fn?"rotate-90":""}`,children:l.jsx(Xa,{size:13})})]}),fn&&l.jsxs("div",{className:"mt-2 rounded-lg border border-border/10 bg-surface/60 p-2",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0 text-[11px] text-muted-foreground",children:[T("rightSidebar.changeAuditScopeLabel"),": ",h0]}),yg]}),vr&&l.jsx("div",{className:"mb-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:vr}),l.jsxs("div",{className:"mt-2 space-y-1.5",children:[Zt.map(_=>l.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${xn===_.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[l.jsxs("button",{type:"button",onClick:()=>fg(_),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:_.repoLabel}),l.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-muted-foreground",children:[_.diff.hunks?.length??0," hunk"]})]}),l.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[10px] text-muted-foreground",children:[l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.diff.currentBranch??"HEAD"}),l.jsx("span",{className:"text-muted-foreground/60",children:"→"}),l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.diff.baseRef??_.diff.baseBranch}),l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:T("rightSidebar.branchAuditViewDiff")})]}),U0(_.createdAt,O)&&l.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/70",children:U0(_.createdAt,O)})]}),l.jsx("button",{type:"button",onClick:()=>hg(_.key),className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:T("common.delete"),"aria-label":T("common.delete"),children:l.jsx(Na,{size:12})})]},_.key)),Dl.length>0?Dl.slice(0,Math.max(0,8-Zt.length)).map(_=>l.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${xn===_.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[l.jsxs("button",{type:"button",onClick:()=>th(_.key),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:_.repoLabel}),l.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-muted-foreground",children:[_.records.length," hunk"]})]}),l.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[10px] text-muted-foreground",children:[l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.branchName??"HEAD"}),l.jsx("span",{className:"text-muted-foreground/60",children:"→"}),l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.baseRef}),_.diffFingerprint&&l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.diffFingerprint})]}),U0(_.latestInjectedAt,O)&&l.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/70",children:T("rightSidebar.branchAuditGeneratedAt",{time:U0(_.latestInjectedAt,O)??""})})]}),l.jsx("button",{type:"button",onClick:()=>{sg(_)},className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:T("rightSidebar.branchAuditClearTitle"),"aria-label":T("rightSidebar.branchAuditClearTitle"),children:l.jsx(Na,{size:12})})]},_.key)):Zt.length===0?l.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:T("rightSidebar.branchAuditEmpty")}):null]})]})]}):null,Eu=ts&&fe&&Il?l.jsxs("div",{className:Lu?"overflow-visible":"overflow-hidden",children:[vg,l.jsxs("button",{type:"button",onClick:()=>{Xr||Ns(_=>{const $=!_;return $&&Er&&!Il&&!Bn&&Tn(Er),$})},"aria-expanded":Lu,className:`group flex w-full items-center gap-2 px-1 py-1.5 text-left transition ${Xr?"cursor-default":"rounded-lg hover:bg-surface-2 active:scale-[0.99]"}`,children:[l.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:l.jsx(ua,{size:14})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-foreground",children:T("rightSidebar.gitQuickActions")}),l.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[l.jsxs("span",{className:`inline-flex min-w-[4.5rem] items-center justify-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${il.staged>0?"bg-accent/10 text-accent":"bg-surface-2 text-muted-foreground"}`,children:[Bn&&l.jsx(en,{size:10,className:"animate-spin"}),il.staged>0?T("rightSidebar.stagedCount",{count:il.staged}):T("rightSidebar.noStagedChangesShort")]}),!Xr&&l.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${Lu?"rotate-90":""}`,children:l.jsx(Xa,{size:13})})]})]}),Lu&&l.jsxs("div",{className:"space-y-0",children:[di.length>1&&l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsx("div",{className:"mb-2 flex items-center justify-between gap-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.gitRepositorySectionTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Zf})]})}),l.jsx(qu,{label:T("rightSidebar.gitRepositoryLabel"),value:Er??"",options:di,placeholder:T("rightSidebar.gitRepositoryPlaceholder"),searchPlaceholder:T("rightSidebar.gitRepositorySearchPlaceholder"),emptyText:T("rightSidebar.gitRepositoryEmpty"),disabled:!!Mr,onChange:_=>{l0(_||null)}}),Wn&&l.jsx("div",{className:"mt-2 rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[11px] text-[color:var(--warning)]",children:T("rightSidebar.selectRepositoryForGitActions")})]}),l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.branchSectionTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Km})]}),l.jsxs("button",{type:"button",onClick:()=>{mg()},disabled:!tg,className:`relative inline-flex h-7 shrink-0 items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${u0?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:T("rightSidebar.switchBranch"),children:[l.jsx("span",{className:Mr?.action==="switch-branch"||u0?"opacity-0":"",children:T("rightSidebar.switchBranch")}),Mr?.action==="switch-branch"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),u0&&Mr?.action!=="switch-branch"&&l.jsx("span",{className:"absolute",children:"✓"})]})]}),l.jsx(qu,{label:T("rightSidebar.currentBranchLabel"),value:Si,options:Zm,placeholder:T("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:T("rightSidebar.switchBranchSearchPlaceholder"),emptyText:T("rightSidebar.switchNoBranches"),disabled:!!Mr,onChange:ai})]}),l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.commitSectionTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Wn?T("rightSidebar.selectRepositoryForGitActions"):il.staged>0?T("rightSidebar.commitReadyHint",{count:il.staged}):T("rightSidebar.commitNeedsStaged")})]}),l.jsxs("button",{type:"button",onClick:()=>{ah()},disabled:!!Mr||Wn||il.staged===0||!fs.trim(),className:`relative inline-flex h-7 shrink-0 items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition active:scale-95 ${c0?"bg-accent/10 text-accent disabled:bg-accent/10 disabled:text-accent":"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-surface-2 disabled:text-muted-foreground"} disabled:cursor-not-allowed`,title:Wn?T("rightSidebar.selectRepositoryForGitActions"):il.staged===0?T("rightSidebar.commitNeedsStaged"):T("rightSidebar.commitChanges"),children:[l.jsx("span",{className:Mr?.action==="commit"||c0?"opacity-0":"",children:T("rightSidebar.commitChanges")}),Mr?.action==="commit"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),c0&&Mr?.action!=="commit"&&l.jsx("span",{className:"absolute",children:"✓"})]})]}),l.jsx("input",{value:fs,onChange:_=>hs(_.target.value),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),ah())},placeholder:T("rightSidebar.commitMessagePlaceholder"),disabled:!!Mr,className:"w-full rounded-md border border-border/15 bg-surface-2 px-2.5 py-1.5 text-[12px] text-foreground outline-none transition placeholder:text-muted-foreground/70 focus:border-primary/35 focus:ring-1 focus:ring-primary/25 disabled:cursor-not-allowed disabled:opacity-60",maxLength:300})]}),l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("button",{type:"button",onClick:()=>Vt(_=>!_),className:"group flex w-full items-center justify-between gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":wt,children:[l.jsx("span",{className:"min-w-0 text-[11px] font-semibold text-foreground",children:T("rightSidebar.recentCommitsTitle")}),l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[Ue&&l.jsx(en,{size:12,className:"animate-spin text-muted-foreground"}),l.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${wt?"rotate-90":""}`,children:l.jsx(Xa,{size:13})})]})]}),wt&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[l.jsx(hp,{size:12,className:"shrink-0"}),l.jsx("input",{value:or,onChange:_=>tr(_.target.value),placeholder:T("rightSidebar.recentCommitsSearchPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1}),or&&l.jsx("button",{type:"button",onClick:()=>tr(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":T("rightSidebar.clearSearch"),children:l.jsx(Rs,{size:12})})]}),l.jsxs("div",{className:"max-h-56 space-y-1 overflow-y-auto overscroll-contain pr-1",onScroll:mu,children:[$e.length>0?$e.map(_=>{const[$,...q]=_.split(/\s+/),xe=q.join(" ")||_;return l.jsxs("button",{type:"button",onClick:()=>{rh(_)},className:"flex w-full min-w-0 items-start gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-left font-mono text-[10px] transition hover:bg-surface-elevated active:scale-[0.99]",title:xe,children:[l.jsx("span",{className:"shrink-0 text-[color:var(--diff-hunk-accent)]",children:$}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",title:xe,children:xe}),te===$&&l.jsx(en,{size:11,className:"shrink-0 animate-spin text-muted-foreground"})]},_)}):Ue?l.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-2 text-center text-[11px] text-muted-foreground",children:T("common.loading")}):l.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:T("rightSidebar.recentCommitsEmpty")}),Et&&l.jsx("div",{className:"flex justify-center rounded-md bg-surface-2 px-2 py-2 text-muted-foreground",children:l.jsx(en,{size:12,className:"animate-spin"})}),Jt&&!Et&&$e.length>0&&l.jsx("button",{type:"button",onClick:()=>{Ml({reset:!1})},className:"w-full rounded-md bg-surface-2 px-2 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:T("rightSidebar.recentCommitsLoadMore")})]})]}),Me&&l.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:Me}),mt&&l.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:mt})]}),l.jsxs("div",{className:"px-1 py-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.pushSectionTitle")}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[l.jsxs("button",{type:"button",onClick:()=>{bg()},disabled:!Jm,className:`relative inline-flex h-7 min-w-[3.25rem] items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${d0?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:T("rightSidebar.pullChanges"),children:[l.jsx("span",{className:Mr?.action==="pull"||d0?"opacity-0":"",children:T("rightSidebar.pullChanges")}),Mr?.action==="pull"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),d0&&Mr?.action!=="pull"&&l.jsx("span",{className:"absolute",children:"✓"})]}),l.jsxs("button",{type:"button",onClick:()=>{gg()},disabled:!eg,className:`relative inline-flex h-7 min-w-[3.25rem] items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${f0?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:T("rightSidebar.pushChanges"),children:[l.jsx("span",{className:Mr?.action==="push"||f0?"opacity-0":"",children:T("rightSidebar.pushChanges")}),Mr?.action==="push"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),f0&&Mr?.action!=="push"&&l.jsx("span",{className:"absolute",children:"✓"})]})]})]}),l.jsxs("div",{className:`mb-2 flex min-w-0 items-center justify-between gap-2 rounded-md px-2 py-1.5 text-[11px] ${Xo.className}`,title:mr?.upstream??void 0,children:[l.jsx("span",{className:"truncate font-medium",children:Xo.text}),l.jsx("span",{className:"w-[6.5rem] shrink-0 truncate text-right text-[10px] opacity-75",children:mr?.upstream??""})]}),l.jsxs("div",{className:`grid gap-1.5 ${Xf?"grid-cols-2":"grid-cols-1"}`,children:[Xf&&l.jsx(qu,{label:T("rightSidebar.pushRemoteLabel"),value:as,options:qd,placeholder:T("rightSidebar.pushRemotePlaceholder"),searchPlaceholder:T("rightSidebar.pushRemoteSearchPlaceholder"),emptyText:T("rightSidebar.pushNoRemotes"),disabled:!!Mr,onChange:Gi}),l.jsx(qu,{label:T("rightSidebar.pushBranchLabel"),value:li,options:Xm,placeholder:T("rightSidebar.pushBranchPlaceholder",{branch:mr?.branch??"HEAD"}),searchPlaceholder:T("rightSidebar.pushBranchSearchPlaceholder"),emptyText:T("rightSidebar.pushNoBranches"),disabled:!!Mr,onChange:Ci})]})]})]})]}):null,wg=w.useCallback(_=>{const $=Lo(_,fe);if(!$)return[];const q=f2(_),xe=[];return _.canStage&&xe.push({key:"stage-file",label:T("rightSidebar.stageFile"),onClick:()=>{Xs({action:"stage-file",cwd:$,paths:[_.path]},T("rightSidebar.stageFile"),q)}}),_.canUnstage&&xe.push({key:"unstage-file",label:T("rightSidebar.unstageFile"),onClick:()=>{Xs({action:"unstage-file",cwd:$,paths:[_.path]},T("rightSidebar.unstageFile"),q)}}),_.canStash&&xe.push({key:"stash-file",label:T("rightSidebar.stashFile"),onClick:()=>{Xs({action:"stash-file",cwd:$,paths:[_.path]},T("rightSidebar.stashFile"),q)}}),_.canRestoreWorktree&&xe.push({key:"restore-worktree-file",label:T("rightSidebar.restoreFile"),destructive:!0,onClick:()=>ii({kind:"restore",file:_,phrase:""})}),xe},[fe,Xs,T]),Ag=w.useCallback(()=>{if(i){d?.();return}xs(0),yn.current?.slideTo(0),Gs(!1),tt(null)},[d,i]),p0=l.jsxs("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface/95 px-2.5 py-1.5 backdrop-blur",children:[l.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-x-1.5 gap-y-0.5",children:[l.jsx("button",{type:"button",onClick:Vm,disabled:!du,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":T("rightSidebar.parentFolder"),title:T("rightSidebar.parentFolder"),children:l.jsx(H4,{size:14})}),l.jsx("button",{type:"button",onClick:$d,disabled:!fe||_i===fe,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":T("rightSidebar.backToProjectRoot"),title:T("rightSidebar.backToProjectRoot"),children:l.jsx(oy,{size:14})}),l.jsx("button",{type:"button",onClick:qm,disabled:!hr,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":T("rightSidebar.refreshFiles"),title:Mo?T("rightSidebar.fileWatchUnavailable",{message:Mo}):T("rightSidebar.refreshFiles"),children:l.jsx(Kc,{size:13})}),l.jsx("button",{type:"button",onClick:Ym,disabled:!hu,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition disabled:cursor-not-allowed disabled:opacity-35 active:scale-95 ${El?"bg-primary/15 text-primary hover:bg-primary/25":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,"aria-label":T(El?"rightSidebar.unpinCurrentFolder":"rightSidebar.pinCurrentFolder"),title:T(El?"rightSidebar.unpinCurrentFolder":"rightSidebar.pinCurrentFolder"),children:El?l.jsx(wd,{size:13}):l.jsx(Yc,{size:13})}),l.jsx("button",{type:"button",onClick:Do,"aria-pressed":Ji,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition active:scale-95 ${Ji?"bg-primary/15 text-primary hover:bg-primary/25":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,"aria-label":T(Ji?"rightSidebar.hideHiddenFiles":"rightSidebar.showHiddenFiles"),title:T(Ji?"rightSidebar.hideHiddenFiles":"rightSidebar.showHiddenFiles"),children:Ji?l.jsx(XE,{size:13}):l.jsx(KE,{size:13})}),l.jsx("div",{className:"mx-1 hidden h-4 w-px shrink-0 bg-border/20 sm:block"}),l.jsxs("div",{className:"min-w-0 flex-1 basis-full pt-0.5 sm:basis-0 sm:pt-0",title:hr??void 0,children:[l.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.browsingLocation")}),l.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:Wm})]}),l.jsxs("button",{type:"button",onClick:()=>hr&&va(hr,cs??void 0),disabled:!hr,...hr&&cs?uu(Ll(hr),cs):{},className:`inline-flex h-6 shrink-0 items-center justify-center gap-1 rounded-full px-2 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-35 active:scale-95 ${cs&&(et===cs||Pe===cs)?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary hover:bg-primary/20"}`,"aria-label":T("rightSidebar.insertCurrentFolder"),title:T("rightSidebar.insertCurrentFolder"),children:[l.jsx(vd,{size:12}),l.jsx("span",{children:T(cs&&Pe===cs?"rightSidebar.copied":cs&&et===cs?"rightSidebar.inserted":"rightSidebar.insertCurrentFolderShort")})]})]}),hr&&l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground/75",children:hr})]}),Vf&&l.jsx("span",{className:"hidden shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary sm:inline-flex",title:T("rightSidebar.browsingOutsideProjectHint"),children:T("rightSidebar.browsingOutsideProject")})]}),fe&&(fu.length>0||Vf)&&l.jsxs("div",{className:"mt-1 flex items-center gap-1 overflow-x-auto pb-0.5 text-[11px]",children:[l.jsx("span",{className:"shrink-0 px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.pinnedFolders")}),l.jsxs("button",{type:"button",onClick:$d,className:`inline-flex max-w-[9rem] shrink-0 items-center gap-1 rounded-full px-2 py-0.5 font-medium transition active:scale-95 ${hr===fe?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:fe,children:[l.jsx(oy,{size:10,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:ws})]}),fu.map(_=>{const $=_.path,q=_.kind==="file",xe=q?rn===$:hr===$;return l.jsxs("span",{className:`group inline-flex max-w-[12rem] shrink-0 items-center rounded-full transition ${xe?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:$,children:[l.jsxs("button",{type:"button",onClick:()=>q?fc($):Yo($),className:"inline-flex min-w-0 items-center gap-1 px-2 py-0.5 font-medium active:scale-95",children:[q?l.jsx(Kg,{size:10,className:"shrink-0"}):l.jsx(Yc,{size:10,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:go($)})]}),l.jsx("button",{type:"button",onClick:()=>ls($),className:"mr-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":T("rightSidebar.unpinFolder",{name:go($)}),title:T("rightSidebar.unpinFolder",{name:go($)}),children:l.jsx(Rs,{size:9})})]},$)})]})]}),Iu=fe?l.jsx("button",{type:"button",onClick:()=>{mn()},disabled:Ds,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 active:scale-95","aria-label":T("rightSidebar.refreshGit"),title:T("rightSidebar.refreshGit"),children:l.jsx(Kc,{size:13,className:Ds?"animate-spin":""})}):null,Tg=W?T("rightSidebar.changeAuditScopeAll"):Ae.length===1?Ae[0].relativeRoot==="."?ws:Ae[0].relativeRoot||Ae[0].name:`${Ae.length} repos`,Mu=fe?l.jsxs("div",{className:"inline-flex h-7 shrink-0 items-center",children:[l.jsx(S6,{open:Fr,onOpenChange:Zr,showScopePicker:Ii,selectedAll:W,repos:nt,selectedRoots:P,onToggleRepo:ig,onGenerate:()=>rg(),disabled:!fe,inserted:et===pu,buttonLabel:T("rightSidebar.changeAuditShort"),insertedLabel:T("rightSidebar.inserted"),title:T("rightSidebar.insertChangeAuditPromptTitle"),ariaLabel:T("rightSidebar.insertChangeAuditPrompt"),scopeTitle:T("rightSidebar.changeAuditScopeLabel"),scopeLabel:Tg,allLabel:T("rightSidebar.changeAuditScopeAll"),generateLabel:T("rightSidebar.changeAuditShort"),loading:bt,error:!!ir,statusTitle:ir??(bt?T("rightSidebar.changeAuditLoading"):ct.length>0?`${T("rightSidebar.changeAuditLoaded",{count:ct.length})}${ch?` · ${T("rightSidebar.changeAuditLoadedAt",{time:ch})}`:""}`:void 0)}),l.jsx("button",{type:"button",onClick:()=>{ng()},disabled:bt||ct.length===0,className:`inline-flex h-7 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:pointer-events-none active:scale-95 ${ct.length>0?"":"invisible"}`,title:T("rightSidebar.clearChangeAuditTitle"),"aria-label":T("rightSidebar.clearChangeAudit"),children:l.jsx(Na,{size:12})})]}):null,Pl=cr.size>0||oe?.available||Ys?l.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] font-medium",children:[oe?.available&&oe.branch&&l.jsxs("span",{className:"inline-flex min-w-0 max-w-[8rem] items-center gap-0.5 truncate rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",title:oe.branch,children:[l.jsx(ua,{size:10,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:oe.branch})]}),js.modified>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-hunk-accent)]",children:[js.modified,"M"]}),js.added>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:["+",js.added]}),js.deleted>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-delete-strong)]",children:["-",js.deleted]}),js.renamed>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[js.renamed,"R"]}),js.copied>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[js.copied,"C"]}),js.untracked>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[js.untracked,"U"]}),js.conflicted>0&&l.jsxs("span",{className:"rounded bg-destructive/10 px-1.5 py-0.5 text-destructive",children:[js.conflicted,"!"]}),js.other>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[js.other,"?"]}),js.staged>0&&l.jsx("span",{className:"rounded bg-accent/10 px-1.5 py-0.5 text-accent",children:T("rightSidebar.stagedCountShort",{count:js.staged})}),oe?.available&&fe&&cr.size>0&&Ce.length<=1&&l.jsx("button",{type:"button",onClick:()=>{Xs({action:"stage-all",cwd:fe},T("rightSidebar.stageAll"))},disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),oe?.available&&fe&&cr.size>0&&Ce.length<=1&&l.jsx("button",{type:"button",onClick:()=>ii({kind:"stash-all",repoRoot:fe,repoLabel:ws}),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}):null;return l.jsxs(j9,{side:"right",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:s,children:[uu.popoverNode,l.jsxs("div",{className:"relative shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("div",{className:"min-w-0 flex-1 px-1",children:l.jsxs("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:[l.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",title:fe??void 0,children:ws}),(!It||Hr)&&oe?.available&&oe.branch&&l.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5 truncate text-[11px] text-muted-foreground",title:oe.branch,children:[l.jsx(ua,{size:10,className:"shrink-0"}),l.jsx("span",{className:"max-w-[7rem] truncate",children:oe.branch})]}),(!It||Hr)&&Ys&&l.jsxs("span",{className:`truncate text-[10px] ${ks?.stale?"text-[color:var(--warning)]":"text-muted-foreground/75"}`,title:[`Git data loaded ${N6(ks?.cacheAgeMs??Date.now()-Ys)}`,ks?.cached?"from server cache":"fresh",ks?.stale?"stale cache":null].filter(Boolean).join(" · "),children:["Git ",N6(ks?.cacheAgeMs??Date.now()-Ys),ks?.cached?" cached":""]})]})}),l.jsxs("button",{type:"button",onClick:()=>{vt(_=>!_),ue(!1)},className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${qe?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-pressed":qe,"aria-label":T("rightSidebar.toggleContextDraft"),title:T("rightSidebar.toggleContextDraft"),children:[l.jsx($I,{size:14}),!qe&&ie.trim()&&l.jsx("span",{className:"absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-primary","aria-hidden":"true"})]}),l.jsx("button",{type:"button",onClick:()=>z(!U),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${U?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":T("rightSidebar.toggleSearch"),title:T("common.search"),children:l.jsx(hp,{size:14})}),l.jsx("button",{type:"button",onClick:()=>tn.current?.click(),disabled:ps,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95 disabled:opacity-50","aria-label":T("rightSidebar.uploadFiles"),title:T("rightSidebar.uploadFiles"),children:ps?l.jsx(en,{size:14,className:"animate-spin"}):l.jsx(dM,{size:14})}),l.jsx("input",{ref:tn,type:"file",multiple:!0,className:"hidden",onChange:_=>{const $=_.target.files;!$||$.length===0||(kl(Array.from($)),_.target.value="")}}),l.jsx("button",{type:"button",onClick:r,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":T("rightSidebar.close"),children:l.jsx(Rs,{size:14})})]}),U&&l.jsxs("div",{className:"mt-2 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-surface-2 px-3 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[l.jsx(hp,{size:12,className:"shrink-0"}),l.jsx("input",{"data-right-search":!0,type:"search",value:I,onChange:_=>N(_.target.value),placeholder:T(V==="content"?"rightSidebar.searchPlaceholderContent":"rightSidebar.filterChanges"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",enterKeyHint:"search",spellCheck:!1}),!It&&l.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 rounded-full bg-surface/70 p-0.5 text-[10px] font-medium",children:[l.jsx("button",{type:"button",onClick:()=>oh("name"),"aria-pressed":V==="name",className:`rounded-full px-2 py-0.5 transition active:scale-95 ${V==="name"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:T("rightSidebar.searchModeName")}),l.jsx("button",{type:"button",onClick:()=>oh("content"),"aria-pressed":V==="content",className:`rounded-full px-2 py-0.5 transition active:scale-95 ${V==="content"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:T("rightSidebar.searchModeContent")})]}),I&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":T("rightSidebar.clearSearch"),children:l.jsx(Rs,{size:12})})]}),It&&l.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-surface-2 p-0.5 text-[11px] font-medium",children:[l.jsx("button",{type:"button",onClick:()=>K("name"),"aria-pressed":V==="name",className:`flex-1 rounded-full px-2 py-1 transition active:scale-95 ${V==="name"?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground"}`,children:T("rightSidebar.searchModeName")}),l.jsx("button",{type:"button",onClick:()=>K("content"),"aria-pressed":V==="content",className:`flex-1 rounded-full px-2 py-1 transition active:scale-95 ${V==="content"?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground"}`,children:T("rightSidebar.searchModeContent")})]})]}),Vi?!It&&!Wr?l.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>hn("files"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="files"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(cc,{size:12}),T("rightSidebar.tabFiles")]}),l.jsxs("button",{type:"button",onClick:()=>hn("file"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="file"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(Kg,{size:12}),T("rightSidebar.tabPreview")]})]}):null:l.jsxs("div",{className:`mt-2 grid gap-0.5 rounded-md bg-surface-2 p-0.5 ${It||Wr?"grid-cols-3":"grid-cols-4"}`,children:[l.jsxs("button",{type:"button",onClick:()=>hn("git"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="git"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(ua,{size:12}),T("rightSidebar.tabGit"),Ds&&On==="git"?l.jsx(en,{size:12,className:"animate-spin text-muted-foreground"}):null]}),l.jsxs("button",{type:"button",onClick:()=>hn("diff"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="diff"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(sf,{size:12}),T("rightSidebar.tabChanges"),Ds?l.jsx(en,{size:12,className:"animate-spin text-muted-foreground"}):cr.size>0?l.jsx("span",{className:"text-[10px] text-accent",children:cr.size}):null]}),l.jsxs("button",{type:"button",onClick:()=>hn("files"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="files"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(cc,{size:12}),T("rightSidebar.tabFiles")]}),!It&&!Wr&&l.jsxs("button",{type:"button",onClick:()=>hn("file"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="file"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(Kg,{size:12}),T("rightSidebar.tabPreview")]})]}),l.jsx("div",{className:"h-2"}),qo&&l.jsx("div",{className:"pointer-events-none absolute right-3 top-10 z-20 max-w-[72%] rounded-lg bg-destructive/95 px-3 py-2 text-[11px] font-medium text-destructive-foreground shadow-md animate-fade-in",children:qo})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden bg-surface",children:[l.jsx(sp,{active:Xr,mounted:ts,fallback:l.jsx(Yu,{slow:!1}),children:qr?l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:l.jsx(t6,{items:ag,selectedKey:Or,onSelect:on,emptyText:T("rightSidebar.noChanges"),mobile:It,backLabel:T("rightSidebar.backToChangeList"),headerTitle:T("rightSidebar.recentCommitsTitle"),headerMeta:`${qr.headRef??""}${qr.commits?.[0]?` · ${qr.commits[0]}`:""}`,onClose:()=>{ft(null),on(null)},closeLabel:T("common.back"),wrap:Lt,onToggleWrap:Wr?void 0:vc,wrapTitle:T("rightSidebar.wrapLongLines"),wrapOnLabel:T("rightSidebar.wrapOn"),wrapOffLabel:T("rightSidebar.wrapOff"),desktopLayout:Wr?"split":"stacked",onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc})}):ot?l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:l.jsx(t6,{items:t0,selectedKey:Ti,onSelect:Ui,emptyText:T(yt?"rightSidebar.branchAuditDiffEmpty":"rightSidebar.branchAuditEmpty"),mobile:It,backLabel:T("rightSidebar.backToChangeList"),headerTitle:T(yt?"rightSidebar.branchAuditViewDiff":"rightSidebar.branchAuditTitle"),headerMeta:Bl?`${Bl.repoLabel} · ${Bl.branchName??"HEAD"} → ${Bl.baseRef}`:void 0,onClose:()=>{J(!1),Te(null)},closeLabel:T("common.back"),wrap:Lt,onToggleWrap:Wr?void 0:vc,wrapTitle:T("rightSidebar.wrapLongLines"),wrapOnLabel:T("rightSidebar.wrapOn"),wrapOffLabel:T("rightSidebar.wrapOff"),desktopLayout:Wr?"split":"stacked",onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,walkthroughs:lg,onWalkthroughNavigate:cg,initialDetailScrollTop:yt&&xn?fr[xn]:void 0,onDetailScrollPositionChange:nh,externalSwiperRef:It?Ba:void 0,onMobileSlideChange:It?xa:void 0})}):l.jsx("div",{className:"h-full overflow-y-auto overscroll-contain px-2 py-2",children:Eu||(Ds?l.jsx(Yu,{slow:to}):Li?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):D6(oe)?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T(fe?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")}):oe?.available===!1?l.jsx($0,{message:oe.error??T("rightSidebar.gitChangesLoadFailed"),onRetry:()=>{mn()}}):fe?l.jsx(Yu,{slow:to}):l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T(fe?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")}))})}),l.jsx(sp,{active:Zs,children:Wr?l.jsxs("div",{className:"flex h-full min-h-0",children:[l.jsxs("div",{ref:j,onScroll:Fd,onDragOver:nl,onDragEnter:nl,onDragLeave:hc,onDrop:lu,className:"shrink-0 overflow-y-auto overscroll-contain bg-surface relative",style:{width:qs},children:[xt&&l.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:l.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:T("rightSidebar.dropToUpload")})}),p0,l.jsx(z1,{rootPath:hr??"",onFileSelect:fc,onPathReference:va,getReferenceText:Ll,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onDirectoryRoot:Hd,onDirectoryPinToggle:Ud,onFilePinToggle:zd,pinnedPaths:Aa,selectedFilePath:rn,query:ne,searchMode:V,onContentMatchSelect:Qd,onDirectoryDropFiles:(_,$)=>kl($,_),canOpenInFileBrowser:Ve,onOpenInFileBrowser:au})]}),l.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":T("rightSidebar.resizeFileTree"),title:T("rightSidebar.resizeFileTree"),className:"group relative z-10 w-2 shrink-0 cursor-col-resize touch-none border-l border-border/15 bg-surface",onPointerDown:Rn,onPointerMove:ui,onPointerUp:vo,onPointerCancel:vo,onDoubleClick:()=>{ns(Cb),Br(X0,Cb)},children:l.jsx("span",{className:"absolute left-1/2 top-0 h-full w-px -translate-x-1/2 bg-border/20 transition group-hover:bg-primary/45"})}),l.jsx("div",{className:"min-w-0 flex-1 overflow-hidden bg-surface",children:l.jsx(m2,{filePath:Zs?rn:null,onInsertReference:va,onInsertText:wa,onInsertFeature:wa,onReferenceCopied:no,isMobile:!1,lineRange:De,onLineRangeChange:tt,insertedReferenceKey:et,copiedReferenceKey:Pe,scrollToLine:Ht,onScrollToLineHandled:()=>pt(null),markdownOutlineOpen:v,markdownOutlineCloseSignal:A,onOpenMarkdownOutline:S,onCloseMarkdownOutline:k,markdownImageLightboxOpen:L,markdownImageLightboxCloseSignal:R,onOpenMarkdownImageLightbox:B,onCloseMarkdownImageLightbox:Q})})]}):It?l.jsxs(Pf,{className:"h-full min-h-0 w-full",slidesPerView:1,resistanceRatio:.45,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:".swiper-no-swiping",allowTouchMove:!1,touchAngle:75,touchStartPreventDefault:!1,onSwiper:_=>{yn.current=_,_.slideTo(es,0)},onSlideChange:_=>{xs(_.activeIndex),_.activeIndex===0&&(Gs(!1),tt(null),d?.())},children:[l.jsx(qc,{className:"h-full min-h-0",children:l.jsxs("div",{ref:j,onScroll:Fd,onDragOver:nl,onDragEnter:nl,onDragLeave:hc,onDrop:lu,className:"h-full overflow-y-auto overscroll-contain bg-surface relative",children:[xt&&l.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:l.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:T("rightSidebar.dropToUpload")})}),p0,l.jsx(z1,{rootPath:hr??"",onFileSelect:fc,onPathReference:va,getReferenceText:Ll,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onDirectoryRoot:Hd,onDirectoryPinToggle:Ud,onFilePinToggle:zd,pinnedPaths:Aa,selectedFilePath:rn,query:ne,searchMode:V,onContentMatchSelect:Qd,onDirectoryDropFiles:(_,$)=>kl($,_),canOpenInFileBrowser:Ve,onOpenInFileBrowser:au})]})}),l.jsx(qc,{className:"h-full min-h-0",children:l.jsx("div",{className:"h-full overflow-hidden bg-surface",children:l.jsx(m2,{filePath:Zs&&(Vo||es===1)?rn:null,onInsertReference:va,onInsertText:wa,onInsertFeature:wa,onReferenceCopied:no,onClose:Ag,isMobile:!0,lineRange:De,onLineRangeChange:tt,insertedReferenceKey:et,copiedReferenceKey:Pe,scrollToLine:Ht,onScrollToLineHandled:()=>pt(null),markdownOutlineOpen:v,markdownOutlineCloseSignal:A,onOpenMarkdownOutline:S,onCloseMarkdownOutline:k,markdownImageLightboxOpen:L,markdownImageLightboxCloseSignal:R,onOpenMarkdownImageLightbox:B,onCloseMarkdownImageLightbox:Q})})})]}):l.jsxs("div",{ref:j,onScroll:Fd,onDragOver:nl,onDragEnter:nl,onDragLeave:hc,onDrop:lu,className:"h-full overflow-y-auto overscroll-contain relative",children:[xt&&l.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:l.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:T("rightSidebar.dropToUpload")})}),p0,l.jsx(z1,{rootPath:hr??"",onFileSelect:fc,onPathReference:va,getReferenceText:Ll,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onDirectoryRoot:Hd,onDirectoryPinToggle:Ud,onFilePinToggle:zd,pinnedPaths:Aa,selectedFilePath:rn,query:ne,searchMode:V,onContentMatchSelect:Qd,onDirectoryDropFiles:(_,$)=>kl($,_),canOpenInFileBrowser:Ve,onOpenInFileBrowser:au})]})}),l.jsx(sp,{active:Zo,mounted:tl,children:l.jsx(m2,{filePath:Zo?rn:null,onInsertReference:va,onInsertText:wa,onInsertFeature:wa,onReferenceCopied:no,isMobile:!1,lineRange:De,onLineRangeChange:tt,insertedReferenceKey:et,copiedReferenceKey:Pe,scrollToLine:Ht,onScrollToLineHandled:()=>pt(null),markdownOutlineOpen:v,markdownOutlineCloseSignal:A,onOpenMarkdownOutline:S,onCloseMarkdownOutline:k,markdownImageLightboxOpen:L,markdownImageLightboxCloseSignal:R,onOpenMarkdownImageLightbox:B,onCloseMarkdownImageLightbox:Q})}),l.jsx(sp,{active:vs,mounted:Da||vs,children:()=>Wr?l.jsx(df,{mobile:!1,desktopLayout:"split",desktopSidePanel:null,desktopListClassName:"w-[320px] min-w-[260px] shrink-0 overflow-y-auto overscroll-contain border-r border-border/15 bg-surface",backLabel:T("rightSidebar.backToChangeList"),groups:Fs.length>0?Zd():[],mode:dr,onModeChange:Ta,selectedKey:rn,scrollToKey:Cu,scrollToKeyNonce:Ut.nonce,compact:!0,collapsedDirectoryKeys:lt,onToggleDirectory:o0,onSelectFile:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);$&&yc(Os($))},renderLeading:Jd,renderTrailing:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?wu($):null},renderSubtitle:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?vu($):null},aiContent:ol?(_=>_u(_)):void 0,emptyContent:Ds&&cr.size===0&&Ys===null?l.jsx(Yu,{slow:to}):Li&&cr.size===0?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):cr.size===0?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T("rightSidebar.noChanges")}):Fs.length===0?l.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:T("rightSidebar.noMatchingChanges")}):null,renderListHeader:_=>fe&&l.jsxs("div",{className:"px-0 py-0",children:[Pl&&l.jsx("div",{className:"mb-2",children:Pl}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")}),l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),_,Au(),Mu,Iu]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch}),l.jsx("button",{type:"button",onClick:()=>Sa("stage-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),l.jsx("button",{type:"button",onClick:()=>Sa("stash-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]}),files:Xd(),activePane:vs,wrap:Lt,showScrollHint:!Lt,diffViewType:Wr?kr:"unified",inlineMode:Ne,diffOptions:a0,reloadKey:Be,renderStreamBadge:_=>l.jsx(ud,{status:_}),onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,onDetailScroll:bc}):l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[fe&&!It&&l.jsx("div",{className:"shrink-0 border-b border-border/15",children:l.jsxs("div",{className:"px-3 py-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")}),l.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),eh(),Au(),Mu,Iu,l.jsxs("button",{type:"button",onClick:vc,"aria-pressed":Lt,title:T("rightSidebar.wrapLongLines"),className:`inline-flex h-7 items-center gap-1 rounded-full px-2.5 text-[11px] font-medium transition active:scale-95 ${Lt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[l.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),l.jsx("span",{children:T(Lt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]})]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch}),l.jsx("button",{type:"button",onClick:()=>Sa("stage-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),l.jsx("button",{type:"button",onClick:()=>Sa("stash-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]})}),It?l.jsx(df,{mobile:!0,backLabel:T("rightSidebar.backToChangeList"),externalSwiperRef:Ba,onMobileSlideChange:xa,groups:Fs.length>0?Zd():[],mode:dr,onModeChange:Ta,selectedKey:rn,scrollToKey:Cu,scrollToKeyNonce:Ut.nonce,compact:!1,collapsedDirectoryKeys:lt,onToggleDirectory:o0,onSelectFile:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);$&&yc(Os($))},renderLeading:Jd,renderTrailing:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?wu($):null},renderSubtitle:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?vu($):null},listContainerClassName:"termdock-native-select min-h-0 px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",renderListHeader:_=>fe&&l.jsxs("div",{className:"px-0 py-0",children:[Pl&&l.jsx("div",{className:"mb-2",children:Pl}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("div",{className:"min-w-0",children:l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")})}),l.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),_,Mu,Iu]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]}),aiContent:ol?(_=>_u(_)):void 0,emptyContent:Ds&&cr.size===0&&Ys===null?l.jsx(Yu,{slow:to}):Li&&cr.size===0?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):cr.size===0?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T("rightSidebar.noChanges")}):Fs.length===0?l.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:T("rightSidebar.noMatchingChanges")}):null,renderMobileDetailHeader:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("button",{type:"button",onClick:()=>Ps(0),className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-surface-2 px-3 text-xs font-semibold text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",title:T("rightSidebar.backToChangeList"),children:[l.jsx(yd,{size:14}),T("rightSidebar.backToChangeList")]}),l.jsxs("button",{type:"button",onClick:vc,"aria-pressed":Lt,title:T("rightSidebar.wrapLongLines"),className:`inline-flex h-9 shrink-0 items-center gap-1 rounded-full px-3 text-[11px] font-medium transition active:scale-95 ${Lt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[l.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),l.jsx("span",{children:T(Lt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]})]}),detailContainerClassName:"termdock-native-select termdock-diff-stream-scroller min-h-0",files:Xd(),activePane:vs,wrap:Lt,showScrollHint:!Lt,diffViewType:"unified",inlineMode:Ne,diffOptions:a0,reloadKey:Be,renderStreamBadge:_=>l.jsx(ud,{status:_}),onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,onDetailScroll:bc}):l.jsx(df,{mobile:!1,desktopLayout:"stacked",backLabel:T("rightSidebar.backToChangeList"),groups:Fs.length>0?Zd():[],mode:dr,onModeChange:Ta,selectedKey:rn,scrollToKey:Cu,scrollToKeyNonce:Ut.nonce,compact:!1,collapsedDirectoryKeys:lt,onToggleDirectory:o0,onSelectFile:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);$&&yc(Os($))},renderLeading:Jd,renderTrailing:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?wu($):null},renderSubtitle:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?vu($):null},aiContent:ol?(_=>_u(_)):void 0,emptyContent:Ds&&cr.size===0&&Ys===null?l.jsx(Yu,{slow:to}):Li&&cr.size===0?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):cr.size===0?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T("rightSidebar.noChanges")}):Fs.length===0?l.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:T("rightSidebar.noMatchingChanges")}):null,renderListHeader:_=>fe&&l.jsxs("div",{className:"px-0 py-0",children:[Pl&&l.jsx("div",{className:"mb-2",children:Pl}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")}),l.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),_,Au(),Mu,Iu,l.jsxs("button",{type:"button",onClick:vc,"aria-pressed":Lt,title:T("rightSidebar.wrapLongLines"),className:`inline-flex h-7 items-center gap-1 rounded-full px-2.5 text-[11px] font-medium transition active:scale-95 ${Lt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[l.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),l.jsx("span",{children:T(Lt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]})]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch}),l.jsx("button",{type:"button",onClick:()=>Sa("stage-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),l.jsx("button",{type:"button",onClick:()=>Sa("stash-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]}),files:Xd(),activePane:vs,wrap:Lt,showScrollHint:!Lt,diffViewType:Wr?kr:"unified",inlineMode:Ne,diffOptions:a0,reloadKey:Be,renderStreamBadge:_=>l.jsx(ud,{status:_}),onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,onDetailScroll:bc})]})})]}),qe&&l.jsx(Pq,{value:ie,collapsed:Ye,focusRequest:Xe,insertError:Re?T("rightSidebar.contextDraftInsertFailed"):null,onChange:_=>{ge(!1),He(_)},onCollapsedChange:ue,onDisable:()=>vt(!1),onClear:()=>He(""),onInsert:()=>Wf(!1),onInsertAndSend:()=>Wf(!0),labels:{title:T("rightSidebar.contextDraftTitle"),hint:T("rightSidebar.contextDraftHint"),placeholder:T("rightSidebar.contextDraftPlaceholder"),collapse:T("rightSidebar.contextDraftCollapse"),expand:T("rightSidebar.contextDraftExpand"),disable:T("rightSidebar.contextDraftDisable"),clear:T("rightSidebar.contextDraftClear"),insert:T("rightSidebar.contextDraftInsert"),insertAndSend:T("rightSidebar.contextDraftInsertAndSend"),inserted:T("rightSidebar.contextDraftInserted"),sent:T("rightSidebar.contextDraftSent"),send:T("rightSidebar.contextDraftSend"),appended:T("rightSidebar.contextDraftAppended"),resize:T("rightSidebar.contextDraftResize"),characterCount:_=>T("rightSidebar.contextDraftCharacterCount",{count:_})}}),Jf(),Fn&&l.jsx("div",{className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>ii(null),children:l.jsxs("div",{className:"fixed inset-x-3 bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] mx-auto max-w-md rounded-2xl border border-border/20 bg-surface-elevated p-4 shadow-2xl",onClick:_=>_.stopPropagation(),children:[l.jsx("div",{className:"text-sm font-semibold text-foreground",children:Fn.kind==="restore"?T("rightSidebar.confirmRestoreTitle"):T("rightSidebar.confirmStashAllTitle")}),l.jsx("div",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:Fn.kind==="restore"?T("rightSidebar.confirmRestoreDescription",{path:Hm(Fn.file.absolutePath,fe)}):T("rightSidebar.confirmStashAllDescription")}),Fn.kind==="restore"&&l.jsx("input",{value:Fn.phrase,onChange:_=>ii({...Fn,phrase:_.target.value}),placeholder:T("rightSidebar.confirmRestorePlaceholder"),className:"mt-3 w-full rounded-xl border border-border/20 bg-surface-2 px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground",autoFocus:!0}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:()=>ii(null),className:"rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:T("common.cancel")}),l.jsx("button",{type:"button",disabled:!!Mr||Fn.kind==="restore"&&Fn.phrase.trim()!==T("rightSidebar.confirmRestorePhrase"),onClick:()=>{if(Fn.kind==="restore"){const _=Lo(Fn.file,fe);if(!_)return;Xs({action:"restore-worktree-file",cwd:_,paths:[Fn.file.path],confirm:{acknowledged:!0,phrase:Fn.phrase}},T("rightSidebar.restoreFile"),f2(Fn.file))}else{const _=Fn.repoRoot??fe;if(!_)return;Xs({action:"stash-all",cwd:_},T("rightSidebar.stashAll"),`repo:${_}`)}},className:`rounded-full px-3 py-1.5 text-xs font-semibold disabled:opacity-50 ${Fn.kind==="restore"?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:T(Mr?"rightSidebar.gitActionRunning":"rightSidebar.confirmAction")})]})]})})]})}function DK(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function BK(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function PK(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const s=Math.floor(n/6e4),i=Math.floor(s/60),a=Math.floor(i/24),u=i%24,d=s%60,h=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),m=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return a>0?b=`${a}d ${u}h`:u>0?b=`${u}h ${d}m`:d>0?b=`${d}m`:b="soon",`resets in ${b} (${h} ${m})`}function jK(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function FK({result:e}){const{t}=jr(),r=e.windows.filter(u=>u.percent===0&&!u.resetAt),n=e.windows.filter(u=>u.percent>0||u.resetAt),s=r.length>0?r.map(u=>u.label).join(" · "):"",i=!!e.error;let a=null;return!i&&e.entitlement&&(e.usagePercent>=90?a=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?a=t("quota.left",{n:e.remaining}):a=`${Math.round(e.usagePercent)}%`),l.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[l.jsx("span",{className:"shrink-0",children:jK(e.slug)}),l.jsx("span",{className:"truncate",children:e.displayName}),s&&l.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:s})]}),a&&l.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:a})]}),n.length>0?l.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(u=>{const d=Math.max(0,Math.min(100,u.percent));return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[l.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:u.label}),l.jsx("div",{className:"flex-1",children:l.jsx("div",{className:"h-2 rounded-full",style:{background:BK(u.percent)},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,background:DK(u.percent)}})})}),l.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(u.percent),"%"]})]}),u.resetAt&&l.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:PK(u.resetAt)})]},u.label)})}):i?l.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function QK({isOpen:e,onClose:t}){const{t:r}=jr(),[n,s]=w.useState([]),[i,a]=w.useState(!1),u=async(m=!1)=>{a(!0);try{const b=m?await gk():await mk();s(b.providers||[])}catch{}finally{a(!1)}};if(w.useEffect(()=>{e&&u()},[e]),w.useEffect(()=>{if(!e)return;const m=b=>{const x=b.detail;Array.isArray(x)&&s(x)};return window.addEventListener("termdock:quota-update",m),()=>{window.removeEventListener("termdock:quota-update",m)}},[e]),!e)return null;const d=n.filter(m=>!m.error),h=d.length>0?new Date(Math.max(...d.map(m=>m.fetchedAt||0))):null;return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),l.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[l.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>u(!0),disabled:i,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":r("quota.refresh"),children:l.jsx(Kc,{size:15,className:i?"animate-spin":""})}),l.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":r("quota.close"),children:l.jsx(Rs,{size:17})})]})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[i&&d.length===0?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(Kc,{size:24,className:"animate-spin text-muted-foreground"})}):d.length===0?l.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[l.jsx("p",{children:r("quota.noProviders")}),l.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):l.jsx("div",{className:"space-y-2.5",children:d.map(m=>l.jsx(FK,{result:m},m.slug))}),h&&l.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:h.toLocaleTimeString()})})]})]})]})}const P6=[{label:"Esc",sequence:"\\u001b"},{label:"Tab",sequence:"\\t"},{label:"Enter",sequence:"\\r"},{label:"S-Tab",sequence:"\\u001b[Z"},{label:"C-c",sequence:"\\u0003"},{label:"C-d",sequence:"\\u0004"},{label:"C-l",sequence:"\\u000c"},{label:"C-r",sequence:"\\u0012"},{label:"C-z",sequence:"\\u001a"},{label:"C-w",sequence:"\\u0017"},{label:"Up",sequence:"\\u001b[A"},{label:"Down",sequence:"\\u001b[B"},{label:"Left",sequence:"\\u001b[D"},{label:"Right",sequence:"\\u001b[C"},{label:"PgUp",sequence:"\\u001b[5~"},{label:"PgDn",sequence:"\\u001b[6~"}],OK=2,$K=20;function HK({label:e}){return l.jsx("div",{className:"h-7 rounded-full bg-surface-2 px-3 text-[11px] leading-7 text-center text-muted-foreground truncate",children:e})}function UK({value:e,onChange:t,placeholder:r}){const{t:n}=jr(),[s,i]=D.useState(""),a=b=>{const x=[];let v="",A=!1;const S=()=>{const L=v.trim();L&&x.push(L),v=""};for(let L=0;L<b.length;L+=1){const R=b[L];if(!A&&R==="/"&&v.trim().length===0){A=!0,v+=R;continue}if(A){if(v+=R,R==="/"&&b[L-1]!=="\\"&&v.length>1){for(;L+1<b.length&&/[gimsuy]/.test(b[L+1]??"");)L+=1,v+=b[L];S(),A=!1}continue}if(R===","||/\s/.test(R)){S();continue}v+=R}if(S(),x.length===0)return;const k=[...e];for(const L of x){const R=j7(L);R&&(k.includes(R)||k.push(R))}t(k),i("")},u=b=>{t(e.filter(x=>x!==b))},d=s.trim(),h=d.length>0&&Av(d),m=h&&!Up(d);return l.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const x=Av(b),v=x&&!Up(b);return l.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${v?"bg-destructive/15 text-destructive":x?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:x?v?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[x&&l.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,l.jsx("button",{type:"button",onClick:()=>u(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:b}),children:l.jsx(Rs,{size:12})})]},b)}),l.jsx("input",{type:"text",value:s,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!h?(b.preventDefault(),a(s)):b.key==="Backspace"&&s.length===0&&e.length>0&&u(e[e.length-1])},onBlur:()=>a(s),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${h?"font-mono":""} ${m?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function zK({value:e,min:t,max:r,onChange:n}){const{t:s}=jr();return l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[l.jsx("button",{type:"button",onClick:()=>n(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":s("common.decrease"),children:l.jsx(_I,{size:14})}),l.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),l.jsx("button",{type:"button",onClick:()=>n(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":s("common.increase"),children:l.jsx(Eo,{size:14})})]})}const GK=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:s,onRemovePreset:i,onResetDefaults:a})=>{const{t:u}=jr(),d=e.find(L=>L.id===t)??e[0]??null,[h,m]=D.useState(null);if(!d)return null;const b=d.actions.length>0,x=[{id:"preview-auto",label:d.label,kind:"preset"},...d.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?d.actions.map((L,R)=>({id:L.id,label:O2(L,R)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(L=>({id:L,label:L}))],v=F7(x,d.rowLayout),A=(L,R)=>{n(d.id,B=>{const Q=B.actions.findIndex(I=>I.id===L);if(Q===-1)return B;const T=Q+R;if(T<0||T>=B.actions.length)return B;const O=[...B.actions];return[O[Q],O[T]]=[O[T],O[Q]],{...B,actions:O}})},S=d.rowLayout.reduce((L,R)=>L+R,0),k=1+(d.includeAlt?1:0);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.preview")}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[d.actions.length," button",d.actions.length===1?"":"s"," · ",S," slot",S===1?"":"s"]})]}),l.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:v.map((L,R)=>{const B=L.items[0]?.kind==="preset",Q=Math.max(2,L.columns),T=B?`${Q7}px repeat(${Math.max(1,Q-1)}, minmax(0, 1fr))`:`repeat(${Q}, minmax(0, 1fr))`;return l.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:T},children:L.items.map(O=>O.kind==="preset"?l.jsx(O7,{mode:"auto",presetLabel:O.label,title:`Auto preset · ${O.label}`,disabled:!0},O.id):l.jsx(HK,{label:O.label},O.id))},`preview-row-${R}`)})}),d.actions.length>S-k&&l.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:u("toolbarPresets.overCapacityHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.presets")}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[l.jsx(Eo,{size:14}),u("toolbarPresets.new")]}),l.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[l.jsx(Kc,{size:14}),u("toolbarPresets.reset")]})]})]}),l.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(L=>l.jsxs("button",{type:"button",onClick:()=>r(L.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${L.id===d.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[L.label,L.actions.length>0&&l.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:L.actions.length})]},L.id))})]}),l.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.label")}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:d.label,onChange:L=>n(d.id,R=>({...R,label:L.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),d.id!=="default"&&l.jsx("button",{type:"button",onClick:()=>i(d.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":u("toolbarPresets.deletePreset",{name:d.label}),children:l.jsx(Na,{size:14})})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.matchPrograms")}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:u("toolbarPresets.typeEnterHint")})]}),l.jsx(UK,{value:d.programs,onChange:L=>n(d.id,R=>({...R,programs:L})),placeholder:u("toolbarPresets.programsPlaceholder")}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("toolbarPresets.programsHelp")})]}),l.jsxs("button",{type:"button",onClick:()=>n(d.id,L=>({...L,includeAlt:!L.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[l.jsxs("span",{children:[l.jsx("span",{className:"block font-medium text-foreground",children:u("toolbarPresets.altSlot")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:u("toolbarPresets.altSlotHint")})]}),l.jsx($c,{checked:d.includeAlt})]}),l.jsxs("button",{type:"button",onClick:()=>n(d.id,L=>({...L,showOnDesktop:!L.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[l.jsxs("span",{children:[l.jsx("span",{className:"block font-medium text-foreground",children:u("toolbarPresets.desktopVisibility")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:u("toolbarPresets.desktopVisibilityHint")})]}),l.jsx($c,{checked:d.showOnDesktop===!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.rowLayout")}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("toolbarPresets.rowLayoutHint")})]}),l.jsxs("button",{type:"button",onClick:()=>n(d.id,L=>({...L,rowLayout:[...sx(L.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[l.jsx(Eo,{size:12}),u("toolbarPresets.addRow")]})]}),l.jsx("div",{className:"space-y-2",children:d.rowLayout.map((L,R)=>l.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[l.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:u("toolbarPresets.rowN",{n:R+1})}),l.jsx("div",{className:"flex-1"}),l.jsx(zK,{value:L,min:OK,max:$K,onChange:B=>n(d.id,Q=>({...Q,rowLayout:Q.rowLayout.map((T,O)=>O===R?B:T)}))}),d.rowLayout.length>1&&l.jsx("button",{type:"button",onClick:()=>n(d.id,B=>({...B,rowLayout:B.rowLayout.filter((Q,T)=>T!==R)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":u("toolbarPresets.removeRow",{n:R+1}),children:u("toolbarPresets.del")})]},`row-${R}`))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.buttons")}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("toolbarPresets.buttonsHint")})]}),l.jsxs("button",{type:"button",onClick:()=>{const L=`${d.id}-action-${Date.now()}`;n(d.id,R=>({...R,actions:[...R.actions,{id:L,label:`Key ${R.actions.length+1}`,sequence:""}]})),m(L)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[l.jsx(Eo,{size:12}),u("toolbarPresets.addButton")]})]}),d.actions.length===0&&l.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:u("toolbarPresets.noCustomButtons")}),d.actions.map((L,R)=>{const B=h===L.id;return l.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${B?"ring-1 ring-accent/40":""}`,children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("button",{type:"button",onClick:()=>A(L.id,-1),disabled:R===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":u("toolbarPresets.moveUp"),children:l.jsx(H4,{size:12})}),l.jsx("button",{type:"button",onClick:()=>A(L.id,1),disabled:R===d.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":u("toolbarPresets.moveDown"),children:l.jsx(bE,{size:12})})]}),l.jsxs("button",{type:"button",onClick:()=>m(B?null:L.id),className:"min-w-0 flex-1 text-left",children:[l.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:O2(L,R)}),l.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[L.sequence?L.sequence:u("toolbarPresets.noSequence"),L.doubleTapSequence&&l.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",L.doubleTapSequence]})]})]}),l.jsx("button",{type:"button",onClick:()=>n(d.id,Q=>({...Q,actions:Q.actions.filter(T=>T.id!==L.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":u("toolbarPresets.removeAction",{name:L.label}),children:l.jsx(Na,{size:14})})]}),B&&l.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:u("toolbarPresets.labelField")}),l.jsx("input",{type:"text",value:L.label,onChange:Q=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,label:Q.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:u("toolbarPresets.sequence")}),l.jsx("input",{type:"text",value:L.sequence,onChange:Q=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,sequence:Q.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),l.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:P6.map(Q=>l.jsx("button",{type:"button",onClick:()=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,sequence:Q.sequence}:O)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:Q.label},Q.label))})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:u("toolbarPresets.doubleTap")}),!L.doubleTapSequence&&l.jsx("button",{type:"button",onClick:()=>n(d.id,Q=>({...Q,actions:Q.actions.map(T=>T.id===L.id?{...T,doubleTapSequence:""}:T)})),className:"text-[10px] text-accent hover:text-accent/80",children:u("toolbarPresets.doubleTapAdd")})]}),L.doubleTapSequence!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:L.doubleTapSequence,onChange:Q=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,doubleTapSequence:Q.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[P6.map(Q=>l.jsx("button",{type:"button",onClick:()=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,doubleTapSequence:(O.doubleTapSequence??"")+Q.sequence}:O)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:Q.label},Q.label)),l.jsx("button",{type:"button",onClick:()=>n(d.id,Q=>({...Q,actions:Q.actions.map(T=>{if(T.id!==L.id)return T;const{doubleTapSequence:O,...I}=T;return I})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:u("toolbarPresets.remove")})]})]})]})]})]},L.id)})]})]})]})},WK={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function VK(){const{t:e}=jr(),[t,r]=D.useState(null),[n,s]=D.useState(null),[i,a]=D.useState(null),[u,d]=D.useState(null),[h,m]=D.useState(!1),[b,x]=D.useState(""),[v,A]=D.useState(null),[S,k]=D.useState([]),L=D.useCallback(async()=>{try{r(await Yk())}catch{r([])}try{const I=await Xk();k(I.plugins??[])}catch{k([])}},[]);D.useEffect(()=>{L()},[L]);const R=async(I,N)=>{s(I),a(null);try{N==="install"?(await Kk(I)).devMode&&d(I):(await Zk(I),u===I&&d(null)),await L()}catch(U){a(U instanceof Error?U.message:String(U))}finally{s(null)}},B=I=>e(I==="installed"?"settings.agentHooksInstalled":I==="outdated"?"settings.agentHooksOutdated":"settings.agentHooksNotInstalled"),Q=async()=>{A(null);let I;try{I=JSON.parse(b)}catch{A("Invalid JSON");return}try{await Jk(I),x(""),m(!1),await L()}catch(N){A(N instanceof Error?N.message:String(N))}},T=async I=>{try{await eL(I),await L()}catch(N){a(N instanceof Error?N.message:String(N))}},O=new Set(S.map(I=>I.slug));return l.jsxs("div",{className:"space-y-3",children:[t===null&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[l.jsx(en,{size:12,className:"animate-spin"})," …"]}),t?.map(I=>{const N=n===I.slug,U=I.state!=="not-installed",z=O.has(I.slug);return l.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsx(Rx,{agent:{slug:I.slug,displayName:I.displayName,accentColor:I.accentColor??"#878580",icon:I.icon,isPlugin:z,iconMode:I.iconMode,iconVersion:I.iconVersion??void 0},size:18}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:I.displayName}),z&&l.jsx("span",{className:"rounded bg-[rgb(var(--success-rgb)_/_0.12)] px-1 py-px text-[9px] font-medium text-[color:var(--success)]",children:"plugin"}),l.jsxs("span",{className:`text-[10px] ${WK[I.state]}`,children:[I.state==="installed"&&l.jsx(z4,{size:10,className:"mr-0.5 inline"}),I.state==="outdated"&&l.jsx(qb,{size:10,className:"mr-0.5 inline"}),B(I.state)]})]}),l.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:I.targetDisplay,children:[e("settings.agentHooksTarget")," ",I.targetDisplay]}),u===I.slug&&l.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[z&&l.jsx("button",{type:"button",disabled:N,onClick:()=>{T(I.slug)},className:"flex shrink-0 items-center rounded-full p-1 text-[11px] text-muted-foreground hover:bg-surface-elevated hover:text-[color:var(--warning)] transition disabled:opacity-50",title:e("settings.agentPluginDelete"),children:l.jsx(Na,{size:11})}),l.jsxs("button",{type:"button",disabled:N,onClick:()=>{R(I.slug,U?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${U?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[N?l.jsx(en,{size:11,className:"animate-spin"}):U?l.jsx(Na,{size:11}):I.state==="outdated"?l.jsx(Kc,{size:11}):l.jsx(jf,{size:11}),N?"…":U?e("settings.agentHooksUninstall"):I.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},I.slug)}),i&&l.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:i}),l.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),l.jsxs("button",{type:"button",onClick:()=>m(!h),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[l.jsx(Eo,{size:11}),e("settings.agentPluginAdd")]})]}),l.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),h&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsx("textarea",{value:b,onChange:I=>x(I.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
|
|
209
|
+
`),truncated:$.some(St=>St.truncated)},ve=Date.now(),Fe=["preview",xe.repoRoot??fe,xe.baseRef??xe.baseBranch??"",xe.currentBranch??"",xe.headRef??"",xe.diffFingerprint??ve].join("\0"),dt=Is.length===1?Is[0].label:`${Is.length} repos`;Te(xe),Xt(St=>[{key:Fe,diff:xe,repoLabel:dt,createdAt:ve},...St.filter(Pt=>Pt.key!==Fe)].slice(0,8)),Qr(St=>St[Fe]===void 0?St:{...St,[Fe]:0}),wn(Fe),Ui(xe.hunks?.[0]?`${xe.hunks[0].filePath}\0${xe.hunks[0].hunkHeader}\0${xe.hunks[0].hunkIndex}`:null),J(!0)}catch($){if(!zr(_)||hl($))return;sn($ instanceof Error?$.message:"Failed to load branch diff")}finally{zr(_)&&pr(!1)}},[qn,Is,ln,Rr,zr,fe,T]),fg=w.useCallback(_=>{Te(_.diff),sn(null),wn(_.key),Ui(_.diff.hunks?.[0]?`${_.diff.hunks[0].filePath}\0${_.diff.hunks[0].hunkHeader}\0${_.diff.hunks[0].hunkIndex}`:null),J(!0)},[]),hg=w.useCallback(_=>{Xt($=>$.filter(q=>q.key!==_)),Qr($=>{if(!(_ in $))return $;const q={...$};return delete q[_],q}),xn===_&&(wn(null),Te(null),J(!1))},[xn]),th=w.useCallback(_=>{const $=Dl.find(q=>q.key===_);$&&(Te(null),sn(null),wn(_),Ui($.records[0]?.filePath??null),J(!0))},[Dl]),rh=w.useCallback(async _=>{if(!fe||!Er)return;const[$]=_.split(/\s+/);if($){pe($),at(null),ft(null);try{const q=await TL({cwd:fe,repoRoot:Er,commit:$,requestSlotId:"right-sidebar-commit-diff"});if(!q.available){at(q.error??"Commit diff is unavailable");return}ft(q);const xe=q.hunks?.[0];on(xe?`${xe.filePath}\0${xe.hunkHeader}\0${xe.hunkIndex}`:null)}catch(q){at(q instanceof Error?q.message:"Failed to load commit diff")}finally{pe(null)}}},[Er,fe]),nh=w.useCallback(_=>{if(!yt||!xn)return;const $=Math.max(0,Math.round(_));Qr(q=>Math.abs((q[xn]??0)-$)<24?q:{...q,[xn]:$})},[yt,xn]);w.useEffect(()=>{!It||!ot||!yt||Ps(1)},[ot,yt,It,Ps]);const i0=w.useCallback(_=>{_&&Ur($=>oq($,_))},[]),Cu=Ut.key===rn?Ut.key:null,yc=w.useCallback(_=>{const $=At.getState(),q=IK();ip("select_diff_file",{interactionId:q,path:_,previousSelectedFilePath:$.selectedFilePath,rootPath:$.rootPath,activeGitRepoRoot:he,changedFiles:$.changedFiles.size,gitBundleLoading:$.gitBundleLoading,gitBundleLastLoadedAt:$.gitBundleLastLoadedAt,rightTab:$.rightTab}),An(_),hn("diff"),It&&_&&Ps(1),i0(_),queueMicrotask(()=>{const xe=At.getState();ip("select_diff_file_after",{interactionId:q,requestedPath:_,selectedFilePath:xe.selectedFilePath,rootPath:xe.rootPath,rightTab:xe.rightTab,changedFiles:xe.changedFiles.size,activeGitRepoRoot:he})})},[he,It,i0,An,hn,Ps]),sh=w.useCallback(_=>{const $=Array.from(cr.values()).find(q=>{const xe=Lo(q,fe),ve=Os(q);return q.path===_.filePath||ve===_.filePath||q.absolutePath===_.filePath||(xe?`${xe}/${q.path}`===_.filePath:!1)||_.repoRoot&&xe===_.repoRoot&&q.path===_.filePath});if($){yc(Os($)),window.setTimeout(()=>Bc(_),90),window.setTimeout(()=>Bc(_),320),window.setTimeout(()=>Bc(_),760);return}Bc(_)},[cr,fe,yc]),_u=w.useCallback(({slideToDetail:_}={})=>kt.length>0?l.jsx(cm,{walkthroughs:kt,repoRoot:he,onNavigate:$=>{It&&window.requestAnimationFrame(()=>_?.()),sh($)}}):l.jsxs("div",{className:"rounded-lg border border-border/15 bg-surface px-3 py-6 text-center text-xs text-muted-foreground",children:[l.jsx(ic,{size:18,className:"mx-auto mb-2 text-muted-foreground/80"}),T("rightSidebar.changeWalkthroughEmpty")]}),[he,kt,sh,It,T]),pg=w.useCallback(_=>{_&&Ar($=>{const q=new Set($);return q.has(_)?q.delete(_):q.add(_),i2(e2,q),q})},[]),o0=w.useCallback(_=>{qt($=>{const q=new Set($);return q.has(_)?q.delete(_):q.add(_),i2(s6,q),q})},[]),Ta=w.useCallback(_=>{it(_),Br(PA,_)},[]);w.useEffect(()=>{ol||dr!=="ai"||Ta("tree")},[dr,Ta,ol]);const vc=w.useCallback(()=>{Nt(_=>{const $=!_;return Br(jA,$),$})},[]),ih=w.useCallback(_=>{zt(_),Br(FA,_)},[]),a0=w.useMemo(()=>({algorithm:"histogram",whitespace:"default"}),[]),oh=w.useCallback(_=>{K(_),Br(QA,_)},[]),ku=w.useCallback(async(_,$,q,xe)=>{let ve=_;for(;ve.ok&&ve.status==="running";)await new Promise(dt=>window.setTimeout(dt,1500)),ve=await X5({jobId:ve.jobId,cwd:$.cwd,action:$.action});if(!ve.ok)throw new Error("Git action status is unavailable");if(ve.status==="error")throw new Error(ve.error||ve.message||"Git action failed");const Fe={action:$.action,path:xe,label:q};return rs(Fe),window.setTimeout(()=>rs(dt=>dt?.action===Fe.action&&dt.path===Fe.path?null:dt),1400),ve},[]),Xs=w.useCallback(async(_,$,q)=>{const xe=fe;fe&&We.current.delete(fe),Yn(null),rs(null),Vs({action:_.action,path:q});try{const ve=await kL(_),Fe=await ku(ve,_,$,q);if(!zr(xe))return!1;const dt=fe?await Gg(fe,void 0,{includeNested:!0,cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:H0(fe)}).catch(()=>Fe.bundle):Fe.bundle;return zr(xe)?(dt&&Tr(dt,{reloadDiff:!0,cacheOnly:!0}),ii(null),!0):!1}catch(ve){return rs(null),Yn(T("rightSidebar.gitActionFailed",{message:ve instanceof Error?ve.message:"Unknown error"})),!1}finally{zr(xe)&&Vs(null)}},[Tr,zr,fe,T,ku]),Sa=w.useCallback((_,$,q)=>{if($){if(_==="stage-all"){Xs({action:"stage-all",cwd:$},T("rightSidebar.stageAll"),`repo:${$}`);return}ii({kind:"stash-all",repoRoot:$,repoLabel:q})}},[Xs,T]),l0=w.useCallback(_=>{Ke(_),s2(fe,_),ai(""),Gi(""),Ci(""),An(Vd(_)),Xr||hn("diff")},[Vd,Xr,fe,An,hn]),mg=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=Si.trim();!_||_===mr?.branch||await Xs({action:"switch-branch",cwd:Er,branch:_},T("rightSidebar.switchBranch"))},[mr?.branch,Er,Wn,Xs,Si,T]),ah=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=fs.trim();if(!_)return;await Xs({action:"commit",cwd:Er,message:_},T("rightSidebar.commitChanges"))&&hs("")},[Er,fs,Wn,Xs,T]),gg=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=as.trim(),$=li.trim();await Xs({action:"push",cwd:Er,..._?{remote:_}:{},...$?{branch:$}:{}},T("rightSidebar.pushChanges"))},[Er,li,as,Wn,Xs,T]),bg=w.useCallback(async()=>{if(!Er||Wn){Yn(T("rightSidebar.selectRepositoryForGitActions"));return}const _=as.trim(),$=li.trim();await Xs({action:"pull",cwd:Er,..._?{remote:_}:{},...$?{branch:$}:{}},T("rightSidebar.pullChanges"))},[Er,li,as,Wn,Xs,T]);w.useEffect(()=>{if(!Xr||!Er||Mr)return;let _=!1;const $={push:T("rightSidebar.pushChanges"),pull:T("rightSidebar.pullChanges"),commit:T("rightSidebar.commitChanges"),"switch-branch":T("rightSidebar.switchBranch"),"stage-all":T("rightSidebar.stageAll"),"stash-all":T("rightSidebar.stashAll")};return(async()=>{for(const q of["push","pull","commit","switch-branch","stage-all","stash-all"]){if(_)return;const xe=await X5({cwd:Er,action:q}).catch(()=>null);if(!xe?.ok||xe.status!=="running")continue;const ve={action:q,cwd:Er},Fe=$[q]??q;Vs({action:q});try{const dt=await ku(xe,ve,Fe);if(_||!zr(fe))return;const St=fe?await Gg(fe,void 0,{includeNested:!0,cacheOnly:!0,action:"git_action_cache_sync",requestSlotId:H0(fe)}).catch(()=>dt.bundle):dt.bundle;St&&Tr(St,{reloadDiff:!0,cacheOnly:!0})}catch(dt){_||Yn(T("rightSidebar.gitActionFailed",{message:dt instanceof Error?dt.message:"Unknown error"}))}finally{_||Vs(null)}return}})(),()=>{_=!0}},[Er,Tr,Xr,zr,fe,Mr,T,ku]);const c0=In?.action==="commit",u0=In?.action==="switch-branch",d0=In?.action==="pull",f0=In?.action==="push",Lu=Xr||oi,h0=mc?T("rightSidebar.changeAuditScopeAll"):Es.length===1?Es[0].label:`${Es.length} repos`,xg=Es.length>0,lh=Is.length>0,yg=fe?l.jsx(S6,{open:Jr,onOpenChange:zn,showScopePicker:!0,selectedAll:mc,repos:wo,selectedRoots:xu,onToggleRepo:og,onGenerate:()=>ug(r0?"regenerate":"generate"),disabled:!xg,generateDisabled:!lh,inserted:et?.startsWith("context:branch-audit-scope:")??!1,buttonLabel:T(r0?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),insertedLabel:T("rightSidebar.inserted"),title:T("rightSidebar.branchAuditGenerateTitle"),ariaLabel:T("rightSidebar.branchAuditShort"),scopeTitle:T("rightSidebar.changeAuditScopeLabel"),scopeLabel:h0,allLabel:T("rightSidebar.changeAuditScopeAll"),generateLabel:T(r0?"rightSidebar.branchAuditRegenerate":"rightSidebar.branchAuditGenerate"),onSecondaryAction:()=>{dg()},secondaryDisabled:!lh||Wt,secondaryLabel:T("rightSidebar.branchAuditViewDiff"),secondaryTitle:T("rightSidebar.branchAuditViewDiffTitle"),secondaryLoading:Wt,loading:En.size>0,statusTitle:En.size>0?T("rightSidebar.branchCandidatesLoading"):void 0,extraContent:l.jsxs("div",{className:"mb-2 space-y-1.5",children:[l.jsxs("label",{className:"flex cursor-pointer items-center justify-between gap-3 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-foreground",children:[l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block font-medium",children:T("rightSidebar.includeUncommitted")}),l.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:T("rightSidebar.includeUncommittedHint")})]}),l.jsx("input",{type:"checkbox",checked:qn,onChange:_=>_n(_.target.checked),className:"h-4 w-4 shrink-0 accent-[rgb(var(--primary-rgb))]"})]}),Rl.length>0&&l.jsx("div",{className:"rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[10px] text-[color:var(--warning)]",children:T("rightSidebar.missingBaseReposSkipped",{repositories:Rl.map(_=>_.label).join(O==="zh"?"、":", ")})})]}),renderRepoExtra:_=>{const $=Ei.get(_.root),q=[],xe=new Set,ve=(Pt,Dr)=>{!Pt||xe.has(Pt)||(xe.add(Pt),q.push({value:Pt,label:Pt,meta:Dr}))};ve(Rr[_.root]||$?.context?.branch,T("rightSidebar.pushCurrentBranchBadge"));for(const Pt of $?.context?.branches??[])ve(Pt,Pt===$?.context?.branch?T("rightSidebar.pushCurrentBranchBadge"):T("rightSidebar.localBranch"));for(const Pt of $?.context?.remoteBranches??[])ve(Pt,T("rightSidebar.remoteBranch"));const Fe=[],dt=new Set,St=(Pt,Dr)=>{!Pt||dt.has(Pt)||(dt.add(Pt),Fe.push({value:Pt,label:Pt,meta:Dr}))};St(ln[_.root],ln[_.root]?T("rightSidebar.pushUpstreamBadge"):void 0),St($?.context?.upstream,$?.context?.upstream?T("rightSidebar.pushUpstreamBadge"):void 0);for(const Pt of $?.context?.remoteBranches??[])St(Pt,"remote");for(const Pt of $?.context?.branches??[])St(Pt,Pt===$?.context?.branch?T("rightSidebar.pushCurrentBranchBadge"):"local");return l.jsxs("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:[l.jsx(qu,{label:T("rightSidebar.currentBranchLabel"),value:Rr[_.root]||$?.context?.branch||"",options:q,placeholder:T("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:T("rightSidebar.switchBranchSearchPlaceholder"),emptyText:T("rightSidebar.switchNoBranches"),onChange:Pt=>{ds(Dr=>({...Dr,[_.root]:Pt}))}}),l.jsx(qu,{label:T("rightSidebar.branchAuditBaseLabel"),value:ln[_.root]||"",options:Fe,placeholder:T("rightSidebar.branchAuditBasePlaceholder"),searchPlaceholder:T("rightSidebar.branchAuditBaseSearchPlaceholder"),emptyText:T("rightSidebar.branchAuditBaseEmpty"),onChange:Pt=>{Cn(Dr=>({...Dr,[_.root]:Pt}))}})]})}}):null,ch=U0(ct.reduce((_,$)=>Math.max(_,$.injectedAt??0),0),O),vg=fe?l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("button",{type:"button",onClick:()=>Sr(_=>{const $=!_;return Br(t2,$),$}),className:"group flex w-full items-center gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":fn,children:[l.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:l.jsx(ic,{size:14})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-[12px] font-semibold text-foreground",children:T("rightSidebar.branchAuditTitle")}),l.jsx("span",{className:"block truncate text-[10px] text-muted-foreground",children:h0})]}),l.jsx("span",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${fn?"rotate-90":""}`,children:l.jsx(Xa,{size:13})})]}),fn&&l.jsxs("div",{className:"mt-2 rounded-lg border border-border/10 bg-surface/60 p-2",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0 text-[11px] text-muted-foreground",children:[T("rightSidebar.changeAuditScopeLabel"),": ",h0]}),yg]}),vr&&l.jsx("div",{className:"mb-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-destructive",children:vr}),l.jsxs("div",{className:"mt-2 space-y-1.5",children:[Zt.map(_=>l.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${xn===_.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[l.jsxs("button",{type:"button",onClick:()=>fg(_),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:_.repoLabel}),l.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-muted-foreground",children:[_.diff.hunks?.length??0," hunk"]})]}),l.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[10px] text-muted-foreground",children:[l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.diff.currentBranch??"HEAD"}),l.jsx("span",{className:"text-muted-foreground/60",children:"→"}),l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.diff.baseRef??_.diff.baseBranch}),l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:T("rightSidebar.branchAuditViewDiff")})]}),U0(_.createdAt,O)&&l.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/70",children:U0(_.createdAt,O)})]}),l.jsx("button",{type:"button",onClick:()=>hg(_.key),className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:T("common.delete"),"aria-label":T("common.delete"),children:l.jsx(Na,{size:12})})]},_.key)),Dl.length>0?Dl.slice(0,Math.max(0,8-Zt.length)).map(_=>l.jsxs("div",{className:`flex min-w-0 items-start gap-1 rounded-md transition ${xn===_.key?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:[l.jsxs("button",{type:"button",onClick:()=>th(_.key),className:"min-w-0 flex-1 px-2 py-1.5 text-left active:scale-[0.99]",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:_.repoLabel}),l.jsxs("span",{className:"shrink-0 rounded bg-surface px-1.5 py-0.5 text-[10px] text-muted-foreground",children:[_.records.length," hunk"]})]}),l.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[10px] text-muted-foreground",children:[l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.branchName??"HEAD"}),l.jsx("span",{className:"text-muted-foreground/60",children:"→"}),l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.baseRef}),_.diffFingerprint&&l.jsx("span",{className:"rounded bg-surface px-1.5 py-0.5",children:_.diffFingerprint})]}),U0(_.latestInjectedAt,O)&&l.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/70",children:T("rightSidebar.branchAuditGeneratedAt",{time:U0(_.latestInjectedAt,O)??""})})]}),l.jsx("button",{type:"button",onClick:()=>{sg(_)},className:"mr-1 mt-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface hover:text-foreground active:scale-95",title:T("rightSidebar.branchAuditClearTitle"),"aria-label":T("rightSidebar.branchAuditClearTitle"),children:l.jsx(Na,{size:12})})]},_.key)):Zt.length===0?l.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:T("rightSidebar.branchAuditEmpty")}):null]})]})]}):null,Eu=ts&&fe&&Il?l.jsxs("div",{className:Lu?"overflow-visible":"overflow-hidden",children:[vg,l.jsxs("button",{type:"button",onClick:()=>{Xr||Ns(_=>{const $=!_;return $&&Er&&!Il&&!Bn&&Tn(Er),$})},"aria-expanded":Lu,className:`group flex w-full items-center gap-2 px-1 py-1.5 text-left transition ${Xr?"cursor-default":"rounded-lg hover:bg-surface-2 active:scale-[0.99]"}`,children:[l.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-surface-2 text-muted-foreground group-hover:text-foreground",children:l.jsx(ua,{size:14})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-foreground",children:T("rightSidebar.gitQuickActions")}),l.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[l.jsxs("span",{className:`inline-flex min-w-[4.5rem] items-center justify-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${il.staged>0?"bg-accent/10 text-accent":"bg-surface-2 text-muted-foreground"}`,children:[Bn&&l.jsx(en,{size:10,className:"animate-spin"}),il.staged>0?T("rightSidebar.stagedCount",{count:il.staged}):T("rightSidebar.noStagedChangesShort")]}),!Xr&&l.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${Lu?"rotate-90":""}`,children:l.jsx(Xa,{size:13})})]})]}),Lu&&l.jsxs("div",{className:"space-y-0",children:[di.length>1&&l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsx("div",{className:"mb-2 flex items-center justify-between gap-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.gitRepositorySectionTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Zf})]})}),l.jsx(qu,{label:T("rightSidebar.gitRepositoryLabel"),value:Er??"",options:di,placeholder:T("rightSidebar.gitRepositoryPlaceholder"),searchPlaceholder:T("rightSidebar.gitRepositorySearchPlaceholder"),emptyText:T("rightSidebar.gitRepositoryEmpty"),disabled:!!Mr,onChange:_=>{l0(_||null)}}),Wn&&l.jsx("div",{className:"mt-2 rounded-md bg-[rgb(var(--warning-rgb)_/_0.12)] px-2 py-1.5 text-[11px] text-[color:var(--warning)]",children:T("rightSidebar.selectRepositoryForGitActions")})]}),l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.branchSectionTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Km})]}),l.jsxs("button",{type:"button",onClick:()=>{mg()},disabled:!tg,className:`relative inline-flex h-7 shrink-0 items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${u0?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:T("rightSidebar.switchBranch"),children:[l.jsx("span",{className:Mr?.action==="switch-branch"||u0?"opacity-0":"",children:T("rightSidebar.switchBranch")}),Mr?.action==="switch-branch"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),u0&&Mr?.action!=="switch-branch"&&l.jsx("span",{className:"absolute",children:"✓"})]})]}),l.jsx(qu,{label:T("rightSidebar.currentBranchLabel"),value:Si,options:Zm,placeholder:T("rightSidebar.switchBranchPlaceholder"),searchPlaceholder:T("rightSidebar.switchBranchSearchPlaceholder"),emptyText:T("rightSidebar.switchNoBranches"),disabled:!!Mr,onChange:ai})]}),l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.commitSectionTitle")}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:Wn?T("rightSidebar.selectRepositoryForGitActions"):il.staged>0?T("rightSidebar.commitReadyHint",{count:il.staged}):T("rightSidebar.commitNeedsStaged")})]}),l.jsxs("button",{type:"button",onClick:()=>{ah()},disabled:!!Mr||Wn||il.staged===0||!fs.trim(),className:`relative inline-flex h-7 shrink-0 items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition active:scale-95 ${c0?"bg-accent/10 text-accent disabled:bg-accent/10 disabled:text-accent":"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-surface-2 disabled:text-muted-foreground"} disabled:cursor-not-allowed`,title:Wn?T("rightSidebar.selectRepositoryForGitActions"):il.staged===0?T("rightSidebar.commitNeedsStaged"):T("rightSidebar.commitChanges"),children:[l.jsx("span",{className:Mr?.action==="commit"||c0?"opacity-0":"",children:T("rightSidebar.commitChanges")}),Mr?.action==="commit"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),c0&&Mr?.action!=="commit"&&l.jsx("span",{className:"absolute",children:"✓"})]})]}),l.jsx("input",{value:fs,onChange:_=>hs(_.target.value),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),ah())},placeholder:T("rightSidebar.commitMessagePlaceholder"),disabled:!!Mr,className:"w-full rounded-md border border-border/15 bg-surface-2 px-2.5 py-1.5 text-[12px] text-foreground outline-none transition placeholder:text-muted-foreground/70 focus:border-primary/35 focus:ring-1 focus:ring-primary/25 disabled:cursor-not-allowed disabled:opacity-60",maxLength:300})]}),l.jsxs("div",{className:"border-b border-border/10 px-1 py-3",children:[l.jsxs("button",{type:"button",onClick:()=>Vt(_=>!_),className:"group flex w-full items-center justify-between gap-2 rounded-lg px-1 py-1.5 text-left transition hover:bg-surface-2 active:scale-[0.99]","aria-expanded":wt,children:[l.jsx("span",{className:"min-w-0 text-[11px] font-semibold text-foreground",children:T("rightSidebar.recentCommitsTitle")}),l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[Ue&&l.jsx(en,{size:12,className:"animate-spin text-muted-foreground"}),l.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition group-hover:bg-surface-elevated group-hover:text-foreground ${wt?"rotate-90":""}`,children:l.jsx(Xa,{size:13})})]})]}),wt&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[l.jsx(hp,{size:12,className:"shrink-0"}),l.jsx("input",{value:or,onChange:_=>tr(_.target.value),placeholder:T("rightSidebar.recentCommitsSearchPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1}),or&&l.jsx("button",{type:"button",onClick:()=>tr(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":T("rightSidebar.clearSearch"),children:l.jsx(Rs,{size:12})})]}),l.jsxs("div",{className:"max-h-56 space-y-1 overflow-y-auto overscroll-contain pr-1",onScroll:mu,children:[$e.length>0?$e.map(_=>{const[$,...q]=_.split(/\s+/),xe=q.join(" ")||_;return l.jsxs("button",{type:"button",onClick:()=>{rh(_)},className:"flex w-full min-w-0 items-start gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-left font-mono text-[10px] transition hover:bg-surface-elevated active:scale-[0.99]",title:xe,children:[l.jsx("span",{className:"shrink-0 text-[color:var(--diff-hunk-accent)]",children:$}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",title:xe,children:xe}),te===$&&l.jsx(en,{size:11,className:"shrink-0 animate-spin text-muted-foreground"})]},_)}):Ue?l.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-2 text-center text-[11px] text-muted-foreground",children:T("common.loading")}):l.jsx("div",{className:"rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:T("rightSidebar.recentCommitsEmpty")}),Et&&l.jsx("div",{className:"flex justify-center rounded-md bg-surface-2 px-2 py-2 text-muted-foreground",children:l.jsx(en,{size:12,className:"animate-spin"})}),Jt&&!Et&&$e.length>0&&l.jsx("button",{type:"button",onClick:()=>{Ml({reset:!1})},className:"w-full rounded-md bg-surface-2 px-2 py-1.5 text-[11px] font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:T("rightSidebar.recentCommitsLoadMore")})]})]}),Me&&l.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:Me}),mt&&l.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive",children:mt})]}),l.jsxs("div",{className:"px-1 py-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[l.jsx("div",{className:"text-[11px] font-semibold text-foreground",children:T("rightSidebar.pushSectionTitle")}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[l.jsxs("button",{type:"button",onClick:()=>{bg()},disabled:!Jm,className:`relative inline-flex h-7 min-w-[3.25rem] items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${d0?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:T("rightSidebar.pullChanges"),children:[l.jsx("span",{className:Mr?.action==="pull"||d0?"opacity-0":"",children:T("rightSidebar.pullChanges")}),Mr?.action==="pull"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),d0&&Mr?.action!=="pull"&&l.jsx("span",{className:"absolute",children:"✓"})]}),l.jsxs("button",{type:"button",onClick:()=>{gg()},disabled:!eg,className:`relative inline-flex h-7 min-w-[3.25rem] items-center justify-center rounded-md px-2.5 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 active:scale-95 ${f0?"bg-accent/10 text-accent hover:bg-accent/15":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:T("rightSidebar.pushChanges"),children:[l.jsx("span",{className:Mr?.action==="push"||f0?"opacity-0":"",children:T("rightSidebar.pushChanges")}),Mr?.action==="push"&&l.jsx(en,{size:12,className:"absolute animate-spin"}),f0&&Mr?.action!=="push"&&l.jsx("span",{className:"absolute",children:"✓"})]})]})]}),l.jsxs("div",{className:`mb-2 flex min-w-0 items-center justify-between gap-2 rounded-md px-2 py-1.5 text-[11px] ${Xo.className}`,title:mr?.upstream??void 0,children:[l.jsx("span",{className:"truncate font-medium",children:Xo.text}),l.jsx("span",{className:"w-[6.5rem] shrink-0 truncate text-right text-[10px] opacity-75",children:mr?.upstream??""})]}),l.jsxs("div",{className:`grid gap-1.5 ${Xf?"grid-cols-2":"grid-cols-1"}`,children:[Xf&&l.jsx(qu,{label:T("rightSidebar.pushRemoteLabel"),value:as,options:qd,placeholder:T("rightSidebar.pushRemotePlaceholder"),searchPlaceholder:T("rightSidebar.pushRemoteSearchPlaceholder"),emptyText:T("rightSidebar.pushNoRemotes"),disabled:!!Mr,onChange:Gi}),l.jsx(qu,{label:T("rightSidebar.pushBranchLabel"),value:li,options:Xm,placeholder:T("rightSidebar.pushBranchPlaceholder",{branch:mr?.branch??"HEAD"}),searchPlaceholder:T("rightSidebar.pushBranchSearchPlaceholder"),emptyText:T("rightSidebar.pushNoBranches"),disabled:!!Mr,onChange:Ci})]})]})]})]}):null,wg=w.useCallback(_=>{const $=Lo(_,fe);if(!$)return[];const q=f2(_),xe=[];return _.canStage&&xe.push({key:"stage-file",label:T("rightSidebar.stageFile"),onClick:()=>{Xs({action:"stage-file",cwd:$,paths:[_.path]},T("rightSidebar.stageFile"),q)}}),_.canUnstage&&xe.push({key:"unstage-file",label:T("rightSidebar.unstageFile"),onClick:()=>{Xs({action:"unstage-file",cwd:$,paths:[_.path]},T("rightSidebar.unstageFile"),q)}}),_.canStash&&xe.push({key:"stash-file",label:T("rightSidebar.stashFile"),onClick:()=>{Xs({action:"stash-file",cwd:$,paths:[_.path]},T("rightSidebar.stashFile"),q)}}),_.canRestoreWorktree&&xe.push({key:"restore-worktree-file",label:T("rightSidebar.restoreFile"),destructive:!0,onClick:()=>ii({kind:"restore",file:_,phrase:""})}),xe},[fe,Xs,T]),Ag=w.useCallback(()=>{if(i){d?.();return}xs(0),yn.current?.slideTo(0),Gs(!1),tt(null)},[d,i]),p0=l.jsxs("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface/95 px-2.5 py-1.5 backdrop-blur",children:[l.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-x-1.5 gap-y-0.5",children:[l.jsx("button",{type:"button",onClick:Vm,disabled:!du,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":T("rightSidebar.parentFolder"),title:T("rightSidebar.parentFolder"),children:l.jsx(H4,{size:14})}),l.jsx("button",{type:"button",onClick:$d,disabled:!fe||_i===fe,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":T("rightSidebar.backToProjectRoot"),title:T("rightSidebar.backToProjectRoot"),children:l.jsx(oy,{size:14})}),l.jsx("button",{type:"button",onClick:qm,disabled:!hr,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35 active:scale-95","aria-label":T("rightSidebar.refreshFiles"),title:Mo?T("rightSidebar.fileWatchUnavailable",{message:Mo}):T("rightSidebar.refreshFiles"),children:l.jsx(Kc,{size:13})}),l.jsx("button",{type:"button",onClick:Ym,disabled:!hu,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition disabled:cursor-not-allowed disabled:opacity-35 active:scale-95 ${El?"bg-primary/15 text-primary hover:bg-primary/25":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,"aria-label":T(El?"rightSidebar.unpinCurrentFolder":"rightSidebar.pinCurrentFolder"),title:T(El?"rightSidebar.unpinCurrentFolder":"rightSidebar.pinCurrentFolder"),children:El?l.jsx(wd,{size:13}):l.jsx(Yc,{size:13})}),l.jsx("button",{type:"button",onClick:Do,"aria-pressed":Ji,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition active:scale-95 ${Ji?"bg-primary/15 text-primary hover:bg-primary/25":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,"aria-label":T(Ji?"rightSidebar.hideHiddenFiles":"rightSidebar.showHiddenFiles"),title:T(Ji?"rightSidebar.hideHiddenFiles":"rightSidebar.showHiddenFiles"),children:Ji?l.jsx(XE,{size:13}):l.jsx(KE,{size:13})}),l.jsx("div",{className:"mx-1 hidden h-4 w-px shrink-0 bg-border/20 sm:block"}),l.jsxs("div",{className:"min-w-0 flex-1 basis-full pt-0.5 sm:basis-0 sm:pt-0",title:hr??void 0,children:[l.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.browsingLocation")}),l.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:Wm})]}),l.jsxs("button",{type:"button",onClick:()=>hr&&va(hr,cs??void 0),disabled:!hr,...hr&&cs?uu(Ll(hr),cs):{},className:`inline-flex h-6 shrink-0 items-center justify-center gap-1 rounded-full px-2 text-[11px] font-semibold transition disabled:cursor-not-allowed disabled:opacity-35 active:scale-95 ${cs&&(et===cs||Pe===cs)?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary hover:bg-primary/20"}`,"aria-label":T("rightSidebar.insertCurrentFolder"),title:T("rightSidebar.insertCurrentFolder"),children:[l.jsx(vd,{size:12}),l.jsx("span",{children:T(cs&&Pe===cs?"rightSidebar.copied":cs&&et===cs?"rightSidebar.inserted":"rightSidebar.insertCurrentFolderShort")})]})]}),hr&&l.jsx("div",{className:"mt-0.5 truncate text-[10px] text-muted-foreground/75",children:hr})]}),Vf&&l.jsx("span",{className:"hidden shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary sm:inline-flex",title:T("rightSidebar.browsingOutsideProjectHint"),children:T("rightSidebar.browsingOutsideProject")})]}),fe&&(fu.length>0||Vf)&&l.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1 pb-0.5 text-[11px]",children:[l.jsx("span",{className:"shrink-0 px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.pinnedFolders")}),l.jsxs("button",{type:"button",onClick:$d,className:`inline-flex max-w-[9rem] shrink-0 items-center gap-1 rounded-full px-2 py-0.5 font-medium transition active:scale-95 ${hr===fe?"bg-surface-elevated text-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:fe,children:[l.jsx(oy,{size:10,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:ws})]}),fu.map(_=>{const $=_.path,q=_.kind==="file",xe=q?rn===$:hr===$;return l.jsxs("span",{className:`group inline-flex max-w-[12rem] shrink-0 items-center rounded-full transition ${xe?"bg-primary/15 text-primary":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:$,children:[l.jsxs("button",{type:"button",onClick:()=>q?fc($):Yo($),className:"inline-flex min-w-0 items-center gap-1 px-2 py-0.5 font-medium active:scale-95",children:[q?l.jsx(Kg,{size:10,className:"shrink-0"}):l.jsx(Yc,{size:10,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:go($)})]}),l.jsx("button",{type:"button",onClick:()=>ls($),className:"mr-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":T("rightSidebar.unpinFolder",{name:go($)}),title:T("rightSidebar.unpinFolder",{name:go($)}),children:l.jsx(Rs,{size:9})})]},$)})]})]}),Iu=fe?l.jsx("button",{type:"button",onClick:()=>{mn()},disabled:Ds,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 active:scale-95","aria-label":T("rightSidebar.refreshGit"),title:T("rightSidebar.refreshGit"),children:l.jsx(Kc,{size:13,className:Ds?"animate-spin":""})}):null,Tg=W?T("rightSidebar.changeAuditScopeAll"):Ae.length===1?Ae[0].relativeRoot==="."?ws:Ae[0].relativeRoot||Ae[0].name:`${Ae.length} repos`,Mu=fe?l.jsxs("div",{className:"inline-flex h-7 shrink-0 items-center",children:[l.jsx(S6,{open:Fr,onOpenChange:Zr,showScopePicker:Ii,selectedAll:W,repos:nt,selectedRoots:P,onToggleRepo:ig,onGenerate:()=>rg(),disabled:!fe,inserted:et===pu,buttonLabel:T("rightSidebar.changeAuditShort"),insertedLabel:T("rightSidebar.inserted"),title:T("rightSidebar.insertChangeAuditPromptTitle"),ariaLabel:T("rightSidebar.insertChangeAuditPrompt"),scopeTitle:T("rightSidebar.changeAuditScopeLabel"),scopeLabel:Tg,allLabel:T("rightSidebar.changeAuditScopeAll"),generateLabel:T("rightSidebar.changeAuditShort"),loading:bt,error:!!ir,statusTitle:ir??(bt?T("rightSidebar.changeAuditLoading"):ct.length>0?`${T("rightSidebar.changeAuditLoaded",{count:ct.length})}${ch?` · ${T("rightSidebar.changeAuditLoadedAt",{time:ch})}`:""}`:void 0)}),l.jsx("button",{type:"button",onClick:()=>{ng()},disabled:bt||ct.length===0,className:`inline-flex h-7 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:pointer-events-none active:scale-95 ${ct.length>0?"":"invisible"}`,title:T("rightSidebar.clearChangeAuditTitle"),"aria-label":T("rightSidebar.clearChangeAudit"),children:l.jsx(Na,{size:12})})]}):null,Pl=cr.size>0||oe?.available||Ys?l.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] font-medium",children:[oe?.available&&oe.branch&&l.jsxs("span",{className:"inline-flex min-w-0 max-w-[8rem] items-center gap-0.5 truncate rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",title:oe.branch,children:[l.jsx(ua,{size:10,className:"shrink-0"}),l.jsx("span",{className:"truncate",children:oe.branch})]}),js.modified>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-hunk-accent)]",children:[js.modified,"M"]}),js.added>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:["+",js.added]}),js.deleted>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-delete-strong)]",children:["-",js.deleted]}),js.renamed>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[js.renamed,"R"]}),js.copied>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[js.copied,"C"]}),js.untracked>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[color:var(--diff-insert-strong)]",children:[js.untracked,"U"]}),js.conflicted>0&&l.jsxs("span",{className:"rounded bg-destructive/10 px-1.5 py-0.5 text-destructive",children:[js.conflicted,"!"]}),js.other>0&&l.jsxs("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-muted-foreground",children:[js.other,"?"]}),js.staged>0&&l.jsx("span",{className:"rounded bg-accent/10 px-1.5 py-0.5 text-accent",children:T("rightSidebar.stagedCountShort",{count:js.staged})}),oe?.available&&fe&&cr.size>0&&Ce.length<=1&&l.jsx("button",{type:"button",onClick:()=>{Xs({action:"stage-all",cwd:fe},T("rightSidebar.stageAll"))},disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),oe?.available&&fe&&cr.size>0&&Ce.length<=1&&l.jsx("button",{type:"button",onClick:()=>ii({kind:"stash-all",repoRoot:fe,repoLabel:ws}),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}):null;return l.jsxs(j9,{side:"right",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:n,push:s,children:[uu.popoverNode,l.jsxs("div",{className:"relative shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("div",{className:"min-w-0 flex-1 px-1",children:l.jsxs("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:[l.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",title:fe??void 0,children:ws}),(!It||Hr)&&oe?.available&&oe.branch&&l.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5 truncate text-[11px] text-muted-foreground",title:oe.branch,children:[l.jsx(ua,{size:10,className:"shrink-0"}),l.jsx("span",{className:"max-w-[7rem] truncate",children:oe.branch})]}),(!It||Hr)&&Ys&&l.jsxs("span",{className:`truncate text-[10px] ${ks?.stale?"text-[color:var(--warning)]":"text-muted-foreground/75"}`,title:[`Git data loaded ${N6(ks?.cacheAgeMs??Date.now()-Ys)}`,ks?.cached?"from server cache":"fresh",ks?.stale?"stale cache":null].filter(Boolean).join(" · "),children:["Git ",N6(ks?.cacheAgeMs??Date.now()-Ys),ks?.cached?" cached":""]})]})}),l.jsxs("button",{type:"button",onClick:()=>{vt(_=>!_),ue(!1)},className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${qe?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-pressed":qe,"aria-label":T("rightSidebar.toggleContextDraft"),title:T("rightSidebar.toggleContextDraft"),children:[l.jsx($I,{size:14}),!qe&&ie.trim()&&l.jsx("span",{className:"absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-primary","aria-hidden":"true"})]}),l.jsx("button",{type:"button",onClick:()=>z(!U),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition active:scale-95 ${U?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-label":T("rightSidebar.toggleSearch"),title:T("common.search"),children:l.jsx(hp,{size:14})}),l.jsx("button",{type:"button",onClick:()=>tn.current?.click(),disabled:ps,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95 disabled:opacity-50","aria-label":T("rightSidebar.uploadFiles"),title:T("rightSidebar.uploadFiles"),children:ps?l.jsx(en,{size:14,className:"animate-spin"}):l.jsx(dM,{size:14})}),l.jsx("input",{ref:tn,type:"file",multiple:!0,className:"hidden",onChange:_=>{const $=_.target.files;!$||$.length===0||(kl(Array.from($)),_.target.value="")}}),l.jsx("button",{type:"button",onClick:r,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted-foreground transition hover:bg-destructive/20 hover:text-destructive active:scale-95","aria-label":T("rightSidebar.close"),children:l.jsx(Rs,{size:14})})]}),U&&l.jsxs("div",{className:"mt-2 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-surface-2 px-3 py-1.5 text-muted-foreground focus-within:bg-surface-elevated",children:[l.jsx(hp,{size:12,className:"shrink-0"}),l.jsx("input",{"data-right-search":!0,type:"search",value:I,onChange:_=>N(_.target.value),placeholder:T(V==="content"?"rightSidebar.searchPlaceholderContent":"rightSidebar.filterChanges"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground",autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",enterKeyHint:"search",spellCheck:!1}),!It&&l.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 rounded-full bg-surface/70 p-0.5 text-[10px] font-medium",children:[l.jsx("button",{type:"button",onClick:()=>oh("name"),"aria-pressed":V==="name",className:`rounded-full px-2 py-0.5 transition active:scale-95 ${V==="name"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:T("rightSidebar.searchModeName")}),l.jsx("button",{type:"button",onClick:()=>oh("content"),"aria-pressed":V==="content",className:`rounded-full px-2 py-0.5 transition active:scale-95 ${V==="content"?"bg-primary/15 text-primary":"text-muted-foreground/80 hover:text-foreground"}`,children:T("rightSidebar.searchModeContent")})]}),I&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"rounded-full p-0.5 text-muted-foreground hover:bg-surface hover:text-foreground","aria-label":T("rightSidebar.clearSearch"),children:l.jsx(Rs,{size:12})})]}),It&&l.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-surface-2 p-0.5 text-[11px] font-medium",children:[l.jsx("button",{type:"button",onClick:()=>K("name"),"aria-pressed":V==="name",className:`flex-1 rounded-full px-2 py-1 transition active:scale-95 ${V==="name"?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground"}`,children:T("rightSidebar.searchModeName")}),l.jsx("button",{type:"button",onClick:()=>K("content"),"aria-pressed":V==="content",className:`flex-1 rounded-full px-2 py-1 transition active:scale-95 ${V==="content"?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground"}`,children:T("rightSidebar.searchModeContent")})]})]}),Vi?!It&&!Wr?l.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>hn("files"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="files"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(cc,{size:12}),T("rightSidebar.tabFiles")]}),l.jsxs("button",{type:"button",onClick:()=>hn("file"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="file"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(Kg,{size:12}),T("rightSidebar.tabPreview")]})]}):null:l.jsxs("div",{className:`mt-2 grid gap-0.5 rounded-md bg-surface-2 p-0.5 ${It||Wr?"grid-cols-3":"grid-cols-4"}`,children:[l.jsxs("button",{type:"button",onClick:()=>hn("git"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="git"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(ua,{size:12}),T("rightSidebar.tabGit"),Ds&&On==="git"?l.jsx(en,{size:12,className:"animate-spin text-muted-foreground"}):null]}),l.jsxs("button",{type:"button",onClick:()=>hn("diff"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="diff"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(sf,{size:12}),T("rightSidebar.tabChanges"),Ds?l.jsx(en,{size:12,className:"animate-spin text-muted-foreground"}):cr.size>0?l.jsx("span",{className:"text-[10px] text-accent",children:cr.size}):null]}),l.jsxs("button",{type:"button",onClick:()=>hn("files"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="files"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(cc,{size:12}),T("rightSidebar.tabFiles")]}),!It&&!Wr&&l.jsxs("button",{type:"button",onClick:()=>hn("file"),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium transition active:scale-[0.98] ${On==="file"?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2"}`,children:[l.jsx(Kg,{size:12}),T("rightSidebar.tabPreview")]})]}),l.jsx("div",{className:"h-2"}),qo&&l.jsx("div",{className:"pointer-events-none absolute right-3 top-10 z-20 max-w-[72%] rounded-lg bg-destructive/95 px-3 py-2 text-[11px] font-medium text-destructive-foreground shadow-md animate-fade-in",children:qo})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden bg-surface",children:[l.jsx(sp,{active:Xr,mounted:ts,fallback:l.jsx(Yu,{slow:!1}),children:qr?l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:l.jsx(t6,{items:ag,selectedKey:Or,onSelect:on,emptyText:T("rightSidebar.noChanges"),mobile:It,backLabel:T("rightSidebar.backToChangeList"),headerTitle:T("rightSidebar.recentCommitsTitle"),headerMeta:`${qr.headRef??""}${qr.commits?.[0]?` · ${qr.commits[0]}`:""}`,onClose:()=>{ft(null),on(null)},closeLabel:T("common.back"),wrap:Lt,onToggleWrap:Wr?void 0:vc,wrapTitle:T("rightSidebar.wrapLongLines"),wrapOnLabel:T("rightSidebar.wrapOn"),wrapOffLabel:T("rightSidebar.wrapOff"),desktopLayout:Wr?"split":"stacked",onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc})}):ot?l.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:l.jsx(t6,{items:t0,selectedKey:Ti,onSelect:Ui,emptyText:T(yt?"rightSidebar.branchAuditDiffEmpty":"rightSidebar.branchAuditEmpty"),mobile:It,backLabel:T("rightSidebar.backToChangeList"),headerTitle:T(yt?"rightSidebar.branchAuditViewDiff":"rightSidebar.branchAuditTitle"),headerMeta:Bl?`${Bl.repoLabel} · ${Bl.branchName??"HEAD"} → ${Bl.baseRef}`:void 0,onClose:()=>{J(!1),Te(null)},closeLabel:T("common.back"),wrap:Lt,onToggleWrap:Wr?void 0:vc,wrapTitle:T("rightSidebar.wrapLongLines"),wrapOnLabel:T("rightSidebar.wrapOn"),wrapOffLabel:T("rightSidebar.wrapOff"),desktopLayout:Wr?"split":"stacked",onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,walkthroughs:lg,onWalkthroughNavigate:cg,initialDetailScrollTop:yt&&xn?fr[xn]:void 0,onDetailScrollPositionChange:nh,externalSwiperRef:It?Ba:void 0,onMobileSlideChange:It?xa:void 0})}):l.jsx("div",{className:"h-full overflow-y-auto overscroll-contain px-2 py-2",children:Eu||(Ds?l.jsx(Yu,{slow:to}):Li?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):D6(oe)?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T(fe?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")}):oe?.available===!1?l.jsx($0,{message:oe.error??T("rightSidebar.gitChangesLoadFailed"),onRetry:()=>{mn()}}):fe?l.jsx(Yu,{slow:to}):l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T(fe?"rightSidebar.gitUnavailable":"fileTree.noWorkingDir")}))})}),l.jsx(sp,{active:Zs,children:Wr?l.jsxs("div",{className:"flex h-full min-h-0",children:[l.jsxs("div",{ref:j,onScroll:Fd,onDragOver:nl,onDragEnter:nl,onDragLeave:hc,onDrop:lu,className:"shrink-0 overflow-y-auto overscroll-contain bg-surface relative",style:{width:qs},children:[xt&&l.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:l.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:T("rightSidebar.dropToUpload")})}),p0,l.jsx(z1,{rootPath:hr??"",onFileSelect:fc,onPathReference:va,getReferenceText:Ll,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onDirectoryRoot:Hd,onDirectoryPinToggle:Ud,onFilePinToggle:zd,pinnedPaths:Aa,selectedFilePath:rn,query:ne,searchMode:V,onContentMatchSelect:Qd,onDirectoryDropFiles:(_,$)=>kl($,_),canOpenInFileBrowser:Ve,onOpenInFileBrowser:au})]}),l.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":T("rightSidebar.resizeFileTree"),title:T("rightSidebar.resizeFileTree"),className:"group relative z-10 w-2 shrink-0 cursor-col-resize touch-none border-l border-border/15 bg-surface",onPointerDown:Rn,onPointerMove:ui,onPointerUp:vo,onPointerCancel:vo,onDoubleClick:()=>{ns(Cb),Br(X0,Cb)},children:l.jsx("span",{className:"absolute left-1/2 top-0 h-full w-px -translate-x-1/2 bg-border/20 transition group-hover:bg-primary/45"})}),l.jsx("div",{className:"min-w-0 flex-1 overflow-hidden bg-surface",children:l.jsx(m2,{filePath:Zs?rn:null,onInsertReference:va,onInsertText:wa,onInsertFeature:wa,onReferenceCopied:no,isMobile:!1,lineRange:De,onLineRangeChange:tt,insertedReferenceKey:et,copiedReferenceKey:Pe,scrollToLine:Ht,onScrollToLineHandled:()=>pt(null),markdownOutlineOpen:v,markdownOutlineCloseSignal:A,onOpenMarkdownOutline:S,onCloseMarkdownOutline:k,markdownImageLightboxOpen:L,markdownImageLightboxCloseSignal:R,onOpenMarkdownImageLightbox:B,onCloseMarkdownImageLightbox:Q})})]}):It?l.jsxs(Pf,{className:"h-full min-h-0 w-full",slidesPerView:1,resistanceRatio:.45,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:".swiper-no-swiping",allowTouchMove:!1,touchAngle:75,touchStartPreventDefault:!1,onSwiper:_=>{yn.current=_,_.slideTo(es,0)},onSlideChange:_=>{xs(_.activeIndex),_.activeIndex===0&&(Gs(!1),tt(null),d?.())},children:[l.jsx(qc,{className:"h-full min-h-0",children:l.jsxs("div",{ref:j,onScroll:Fd,onDragOver:nl,onDragEnter:nl,onDragLeave:hc,onDrop:lu,className:"h-full overflow-y-auto overscroll-contain bg-surface relative",children:[xt&&l.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:l.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:T("rightSidebar.dropToUpload")})}),p0,l.jsx(z1,{rootPath:hr??"",onFileSelect:fc,onPathReference:va,getReferenceText:Ll,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onDirectoryRoot:Hd,onDirectoryPinToggle:Ud,onFilePinToggle:zd,pinnedPaths:Aa,selectedFilePath:rn,query:ne,searchMode:V,onContentMatchSelect:Qd,onDirectoryDropFiles:(_,$)=>kl($,_),canOpenInFileBrowser:Ve,onOpenInFileBrowser:au})]})}),l.jsx(qc,{className:"h-full min-h-0",children:l.jsx("div",{className:"h-full overflow-hidden bg-surface",children:l.jsx(m2,{filePath:Zs&&(Vo||es===1)?rn:null,onInsertReference:va,onInsertText:wa,onInsertFeature:wa,onReferenceCopied:no,onClose:Ag,isMobile:!0,lineRange:De,onLineRangeChange:tt,insertedReferenceKey:et,copiedReferenceKey:Pe,scrollToLine:Ht,onScrollToLineHandled:()=>pt(null),markdownOutlineOpen:v,markdownOutlineCloseSignal:A,onOpenMarkdownOutline:S,onCloseMarkdownOutline:k,markdownImageLightboxOpen:L,markdownImageLightboxCloseSignal:R,onOpenMarkdownImageLightbox:B,onCloseMarkdownImageLightbox:Q})})})]}):l.jsxs("div",{ref:j,onScroll:Fd,onDragOver:nl,onDragEnter:nl,onDragLeave:hc,onDrop:lu,className:"h-full overflow-y-auto overscroll-contain relative",children:[xt&&l.jsx("div",{className:"pointer-events-none absolute left-3 right-3 top-3 z-10 flex justify-center",children:l.jsx("div",{className:"rounded-xl bg-surface-elevated px-4 py-2 text-sm font-semibold text-foreground shadow-lg",children:T("rightSidebar.dropToUpload")})}),p0,l.jsx(z1,{rootPath:hr??"",onFileSelect:fc,onPathReference:va,getReferenceText:Ll,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onDirectoryRoot:Hd,onDirectoryPinToggle:Ud,onFilePinToggle:zd,pinnedPaths:Aa,selectedFilePath:rn,query:ne,searchMode:V,onContentMatchSelect:Qd,onDirectoryDropFiles:(_,$)=>kl($,_),canOpenInFileBrowser:Ve,onOpenInFileBrowser:au})]})}),l.jsx(sp,{active:Zo,mounted:tl,children:l.jsx(m2,{filePath:Zo?rn:null,onInsertReference:va,onInsertText:wa,onInsertFeature:wa,onReferenceCopied:no,isMobile:!1,lineRange:De,onLineRangeChange:tt,insertedReferenceKey:et,copiedReferenceKey:Pe,scrollToLine:Ht,onScrollToLineHandled:()=>pt(null),markdownOutlineOpen:v,markdownOutlineCloseSignal:A,onOpenMarkdownOutline:S,onCloseMarkdownOutline:k,markdownImageLightboxOpen:L,markdownImageLightboxCloseSignal:R,onOpenMarkdownImageLightbox:B,onCloseMarkdownImageLightbox:Q})}),l.jsx(sp,{active:vs,mounted:Da||vs,children:()=>Wr?l.jsx(df,{mobile:!1,desktopLayout:"split",desktopSidePanel:null,desktopListClassName:"w-[320px] min-w-[260px] shrink-0 overflow-y-auto overscroll-contain border-r border-border/15 bg-surface",backLabel:T("rightSidebar.backToChangeList"),groups:Fs.length>0?Zd():[],mode:dr,onModeChange:Ta,selectedKey:rn,scrollToKey:Cu,scrollToKeyNonce:Ut.nonce,compact:!0,collapsedDirectoryKeys:lt,onToggleDirectory:o0,onSelectFile:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);$&&yc(Os($))},renderLeading:Jd,renderTrailing:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?wu($):null},renderSubtitle:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?vu($):null},aiContent:ol?(_=>_u(_)):void 0,emptyContent:Ds&&cr.size===0&&Ys===null?l.jsx(Yu,{slow:to}):Li&&cr.size===0?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):cr.size===0?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T("rightSidebar.noChanges")}):Fs.length===0?l.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:T("rightSidebar.noMatchingChanges")}):null,renderListHeader:_=>fe&&l.jsxs("div",{className:"px-0 py-0",children:[Pl&&l.jsx("div",{className:"mb-2",children:Pl}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"px-1 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")}),l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),_,Au(),Mu,Iu]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch}),l.jsx("button",{type:"button",onClick:()=>Sa("stage-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),l.jsx("button",{type:"button",onClick:()=>Sa("stash-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]}),files:Xd(),activePane:vs,wrap:Lt,showScrollHint:!Lt,diffViewType:Wr?kr:"unified",inlineMode:Ne,diffOptions:a0,reloadKey:Be,renderStreamBadge:_=>l.jsx(ud,{status:_}),onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,onDetailScroll:bc}):l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[fe&&!It&&l.jsx("div",{className:"shrink-0 border-b border-border/15",children:l.jsxs("div",{className:"px-3 py-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")}),l.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),eh(),Au(),Mu,Iu,l.jsxs("button",{type:"button",onClick:vc,"aria-pressed":Lt,title:T("rightSidebar.wrapLongLines"),className:`inline-flex h-7 items-center gap-1 rounded-full px-2.5 text-[11px] font-medium transition active:scale-95 ${Lt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[l.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),l.jsx("span",{children:T(Lt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]})]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch}),l.jsx("button",{type:"button",onClick:()=>Sa("stage-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),l.jsx("button",{type:"button",onClick:()=>Sa("stash-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]})}),It?l.jsx(df,{mobile:!0,backLabel:T("rightSidebar.backToChangeList"),externalSwiperRef:Ba,onMobileSlideChange:xa,groups:Fs.length>0?Zd():[],mode:dr,onModeChange:Ta,selectedKey:rn,scrollToKey:Cu,scrollToKeyNonce:Ut.nonce,compact:!1,collapsedDirectoryKeys:lt,onToggleDirectory:o0,onSelectFile:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);$&&yc(Os($))},renderLeading:Jd,renderTrailing:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?wu($):null},renderSubtitle:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?vu($):null},listContainerClassName:"termdock-native-select min-h-0 px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",renderListHeader:_=>fe&&l.jsxs("div",{className:"px-0 py-0",children:[Pl&&l.jsx("div",{className:"mb-2",children:Pl}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("div",{className:"min-w-0",children:l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")})}),l.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),_,Mu,Iu]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]}),aiContent:ol?(_=>_u(_)):void 0,emptyContent:Ds&&cr.size===0&&Ys===null?l.jsx(Yu,{slow:to}):Li&&cr.size===0?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):cr.size===0?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T("rightSidebar.noChanges")}):Fs.length===0?l.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:T("rightSidebar.noMatchingChanges")}):null,renderMobileDetailHeader:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("button",{type:"button",onClick:()=>Ps(0),className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-surface-2 px-3 text-xs font-semibold text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",title:T("rightSidebar.backToChangeList"),children:[l.jsx(yd,{size:14}),T("rightSidebar.backToChangeList")]}),l.jsxs("button",{type:"button",onClick:vc,"aria-pressed":Lt,title:T("rightSidebar.wrapLongLines"),className:`inline-flex h-9 shrink-0 items-center gap-1 rounded-full px-3 text-[11px] font-medium transition active:scale-95 ${Lt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[l.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),l.jsx("span",{children:T(Lt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]})]}),detailContainerClassName:"termdock-native-select termdock-diff-stream-scroller min-h-0",files:Xd(),activePane:vs,wrap:Lt,showScrollHint:!Lt,diffViewType:"unified",inlineMode:Ne,diffOptions:a0,reloadKey:Be,renderStreamBadge:_=>l.jsx(ud,{status:_}),onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,onDetailScroll:bc}):l.jsx(df,{mobile:!1,desktopLayout:"stacked",backLabel:T("rightSidebar.backToChangeList"),groups:Fs.length>0?Zd():[],mode:dr,onModeChange:Ta,selectedKey:rn,scrollToKey:Cu,scrollToKeyNonce:Ut.nonce,compact:!1,collapsedDirectoryKeys:lt,onToggleDirectory:o0,onSelectFile:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);$&&yc(Os($))},renderLeading:Jd,renderTrailing:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?wu($):null},renderSubtitle:_=>{const $=Array.from(cr.values()).find(q=>Os(q)===_.key);return $?vu($):null},aiContent:ol?(_=>_u(_)):void 0,emptyContent:Ds&&cr.size===0&&Ys===null?l.jsx(Yu,{slow:to}):Li&&cr.size===0?l.jsx($0,{message:Li,onRetry:()=>{mn()}}):cr.size===0?l.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:T("rightSidebar.noChanges")}):Fs.length===0?l.jsx("div",{className:"bg-surface-2 px-3 py-4 text-center text-xs text-muted-foreground",children:T("rightSidebar.noMatchingChanges")}):null,renderListHeader:_=>fe&&l.jsxs("div",{className:"px-0 py-0",children:[Pl&&l.jsx("div",{className:"mb-2",children:Pl}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:T("rightSidebar.allChanges")}),l.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[Fs.length,"/",cr.size]})]}),l.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[jo(),_,Au(),Mu,Iu,l.jsxs("button",{type:"button",onClick:vc,"aria-pressed":Lt,title:T("rightSidebar.wrapLongLines"),className:`inline-flex h-7 items-center gap-1 rounded-full px-2.5 text-[11px] font-medium transition active:scale-95 ${Lt?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[l.jsx("span",{className:"font-mono text-[12px] leading-none",children:"Aa"}),l.jsx("span",{children:T(Lt?"rightSidebar.wrapOn":"rightSidebar.wrapOff")})]})]}),cn&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:cn.label}),cn.branch&&l.jsx("span",{className:"max-w-[7rem] truncate rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:cn.branch}),l.jsx("button",{type:"button",onClick:()=>Sa("stage-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-accent/10 px-2 py-0.5 text-[10px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:T("rightSidebar.stageAll"),children:T("rightSidebar.stageAll")}),l.jsx("button",{type:"button",onClick:()=>Sa("stash-all",cn.root,cn.label),disabled:!!Mr,className:"rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium text-foreground hover:bg-surface-elevated disabled:opacity-50",title:T("rightSidebar.stashAll"),children:T("rightSidebar.stashAll")})]}),!cn&&Ii&&l.jsxs("div",{className:"mt-2 flex items-center gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[l.jsx(ua,{size:12,className:"shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:T("rightSidebar.selectRepositoryForDiff")})]})]}),files:Xd(),activePane:vs,wrap:Lt,showScrollHint:!Lt,diffViewType:Wr?kr:"unified",inlineMode:Ne,diffOptions:a0,reloadKey:Be,renderStreamBadge:_=>l.jsx(ud,{status:_}),onInsertDiffReference:so,onReferenceCopied:no,insertedReferenceKey:et,copiedReferenceKey:Pe,onClearAuditRecord:xc,onDetailScroll:bc})]})})]}),qe&&l.jsx(Pq,{value:ie,collapsed:Ye,focusRequest:Xe,insertError:Re?T("rightSidebar.contextDraftInsertFailed"):null,onChange:_=>{ge(!1),He(_)},onCollapsedChange:ue,onDisable:()=>vt(!1),onClear:()=>He(""),onInsert:()=>Wf(!1),onInsertAndSend:()=>Wf(!0),labels:{title:T("rightSidebar.contextDraftTitle"),hint:T("rightSidebar.contextDraftHint"),placeholder:T("rightSidebar.contextDraftPlaceholder"),collapse:T("rightSidebar.contextDraftCollapse"),expand:T("rightSidebar.contextDraftExpand"),disable:T("rightSidebar.contextDraftDisable"),clear:T("rightSidebar.contextDraftClear"),insert:T("rightSidebar.contextDraftInsert"),insertAndSend:T("rightSidebar.contextDraftInsertAndSend"),inserted:T("rightSidebar.contextDraftInserted"),sent:T("rightSidebar.contextDraftSent"),send:T("rightSidebar.contextDraftSend"),appended:T("rightSidebar.contextDraftAppended"),resize:T("rightSidebar.contextDraftResize"),characterCount:_=>T("rightSidebar.contextDraftCharacterCount",{count:_})}}),Jf(),Fn&&l.jsx("div",{className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm",onClick:()=>ii(null),children:l.jsxs("div",{className:"fixed inset-x-3 bottom-[max(1.5rem,env(safe-area-inset-bottom,0px))] mx-auto max-w-md rounded-2xl border border-border/20 bg-surface-elevated p-4 shadow-2xl",onClick:_=>_.stopPropagation(),children:[l.jsx("div",{className:"text-sm font-semibold text-foreground",children:Fn.kind==="restore"?T("rightSidebar.confirmRestoreTitle"):T("rightSidebar.confirmStashAllTitle")}),l.jsx("div",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:Fn.kind==="restore"?T("rightSidebar.confirmRestoreDescription",{path:Hm(Fn.file.absolutePath,fe)}):T("rightSidebar.confirmStashAllDescription")}),Fn.kind==="restore"&&l.jsx("input",{value:Fn.phrase,onChange:_=>ii({...Fn,phrase:_.target.value}),placeholder:T("rightSidebar.confirmRestorePlaceholder"),className:"mt-3 w-full rounded-xl border border-border/20 bg-surface-2 px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground",autoFocus:!0}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:()=>ii(null),className:"rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:T("common.cancel")}),l.jsx("button",{type:"button",disabled:!!Mr||Fn.kind==="restore"&&Fn.phrase.trim()!==T("rightSidebar.confirmRestorePhrase"),onClick:()=>{if(Fn.kind==="restore"){const _=Lo(Fn.file,fe);if(!_)return;Xs({action:"restore-worktree-file",cwd:_,paths:[Fn.file.path],confirm:{acknowledged:!0,phrase:Fn.phrase}},T("rightSidebar.restoreFile"),f2(Fn.file))}else{const _=Fn.repoRoot??fe;if(!_)return;Xs({action:"stash-all",cwd:_},T("rightSidebar.stashAll"),`repo:${_}`)}},className:`rounded-full px-3 py-1.5 text-xs font-semibold disabled:opacity-50 ${Fn.kind==="restore"?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:T(Mr?"rightSidebar.gitActionRunning":"rightSidebar.confirmAction")})]})]})})]})}function DK(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function BK(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function PK(e){if(!e)return"";const t=new Date(e),r=Date.now(),n=t.getTime()-r;if(n<=0)return"";const s=Math.floor(n/6e4),i=Math.floor(s/60),a=Math.floor(i/24),u=i%24,d=s%60,h=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),m=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return a>0?b=`${a}d ${u}h`:u>0?b=`${u}h ${d}m`:d>0?b=`${d}m`:b="soon",`resets in ${b} (${h} ${m})`}function jK(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function FK({result:e}){const{t}=jr(),r=e.windows.filter(u=>u.percent===0&&!u.resetAt),n=e.windows.filter(u=>u.percent>0||u.resetAt),s=r.length>0?r.map(u=>u.label).join(" · "):"",i=!!e.error;let a=null;return!i&&e.entitlement&&(e.usagePercent>=90?a=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?a=t("quota.left",{n:e.remaining}):a=`${Math.round(e.usagePercent)}%`),l.jsxs("div",{className:"rounded-xl border border-border/15 bg-surface-2 p-3 sm:p-4",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-foreground",children:[l.jsx("span",{className:"shrink-0",children:jK(e.slug)}),l.jsx("span",{className:"truncate",children:e.displayName}),s&&l.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:s})]}),a&&l.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:a})]}),n.length>0?l.jsx("div",{className:"mt-2.5 space-y-2",children:n.map(u=>{const d=Math.max(0,Math.min(100,u.percent));return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[l.jsx("span",{className:"w-14 shrink-0 truncate text-muted-foreground sm:w-16",children:u.label}),l.jsx("div",{className:"flex-1",children:l.jsx("div",{className:"h-2 rounded-full",style:{background:BK(u.percent)},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,background:DK(u.percent)}})})}),l.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(u.percent),"%"]})]}),u.resetAt&&l.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:PK(u.resetAt)})]},u.label)})}):i?l.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function QK({isOpen:e,onClose:t}){const{t:r}=jr(),[n,s]=w.useState([]),[i,a]=w.useState(!1),u=async(m=!1)=>{a(!0);try{const b=m?await gk():await mk();s(b.providers||[])}catch{}finally{a(!1)}};if(w.useEffect(()=>{e&&u()},[e]),w.useEffect(()=>{if(!e)return;const m=b=>{const x=b.detail;Array.isArray(x)&&s(x)};return window.addEventListener("termdock:quota-update",m),()=>{window.removeEventListener("termdock:quota-update",m)}},[e]),!e)return null;const d=n.filter(m=>!m.error),h=d.length>0?new Date(Math.max(...d.map(m=>m.fetchedAt||0))):null;return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),l.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[l.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>u(!0),disabled:i,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-label":r("quota.refresh"),children:l.jsx(Kc,{size:15,className:i?"animate-spin":""})}),l.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-full bg-surface-2 p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground","aria-label":r("quota.close"),children:l.jsx(Rs,{size:17})})]})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[i&&d.length===0?l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(Kc,{size:24,className:"animate-spin text-muted-foreground"})}):d.length===0?l.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[l.jsx("p",{children:r("quota.noProviders")}),l.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):l.jsx("div",{className:"space-y-2.5",children:d.map(m=>l.jsx(FK,{result:m},m.slug))}),h&&l.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:h.toLocaleTimeString()})})]})]})]})}const P6=[{label:"Esc",sequence:"\\u001b"},{label:"Tab",sequence:"\\t"},{label:"Enter",sequence:"\\r"},{label:"S-Tab",sequence:"\\u001b[Z"},{label:"C-c",sequence:"\\u0003"},{label:"C-d",sequence:"\\u0004"},{label:"C-l",sequence:"\\u000c"},{label:"C-r",sequence:"\\u0012"},{label:"C-z",sequence:"\\u001a"},{label:"C-w",sequence:"\\u0017"},{label:"Up",sequence:"\\u001b[A"},{label:"Down",sequence:"\\u001b[B"},{label:"Left",sequence:"\\u001b[D"},{label:"Right",sequence:"\\u001b[C"},{label:"PgUp",sequence:"\\u001b[5~"},{label:"PgDn",sequence:"\\u001b[6~"}],OK=2,$K=20;function HK({label:e}){return l.jsx("div",{className:"h-7 rounded-full bg-surface-2 px-3 text-[11px] leading-7 text-center text-muted-foreground truncate",children:e})}function UK({value:e,onChange:t,placeholder:r}){const{t:n}=jr(),[s,i]=D.useState(""),a=b=>{const x=[];let v="",A=!1;const S=()=>{const L=v.trim();L&&x.push(L),v=""};for(let L=0;L<b.length;L+=1){const R=b[L];if(!A&&R==="/"&&v.trim().length===0){A=!0,v+=R;continue}if(A){if(v+=R,R==="/"&&b[L-1]!=="\\"&&v.length>1){for(;L+1<b.length&&/[gimsuy]/.test(b[L+1]??"");)L+=1,v+=b[L];S(),A=!1}continue}if(R===","||/\s/.test(R)){S();continue}v+=R}if(S(),x.length===0)return;const k=[...e];for(const L of x){const R=j7(L);R&&(k.includes(R)||k.push(R))}t(k),i("")},u=b=>{t(e.filter(x=>x!==b))},d=s.trim(),h=d.length>0&&Av(d),m=h&&!Up(d);return l.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const x=Av(b),v=x&&!Up(b);return l.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${v?"bg-destructive/15 text-destructive":x?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:x?v?n("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[x&&l.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,l.jsx("button",{type:"button",onClick:()=>u(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":n("toolbarPresets.removeAction",{name:b}),children:l.jsx(Rs,{size:12})})]},b)}),l.jsx("input",{type:"text",value:s,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!h?(b.preventDefault(),a(s)):b.key==="Backspace"&&s.length===0&&e.length>0&&u(e[e.length-1])},onBlur:()=>a(s),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${h?"font-mono":""} ${m?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function zK({value:e,min:t,max:r,onChange:n}){const{t:s}=jr();return l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[l.jsx("button",{type:"button",onClick:()=>n(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":s("common.decrease"),children:l.jsx(_I,{size:14})}),l.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),l.jsx("button",{type:"button",onClick:()=>n(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":s("common.increase"),children:l.jsx(Eo,{size:14})})]})}const GK=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:n,onAddPreset:s,onRemovePreset:i,onResetDefaults:a})=>{const{t:u}=jr(),d=e.find(L=>L.id===t)??e[0]??null,[h,m]=D.useState(null);if(!d)return null;const b=d.actions.length>0,x=[{id:"preview-auto",label:d.label,kind:"preset"},...d.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?d.actions.map((L,R)=>({id:L.id,label:O2(L,R)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(L=>({id:L,label:L}))],v=F7(x,d.rowLayout),A=(L,R)=>{n(d.id,B=>{const Q=B.actions.findIndex(I=>I.id===L);if(Q===-1)return B;const T=Q+R;if(T<0||T>=B.actions.length)return B;const O=[...B.actions];return[O[Q],O[T]]=[O[T],O[Q]],{...B,actions:O}})},S=d.rowLayout.reduce((L,R)=>L+R,0),k=1+(d.includeAlt?1:0);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.preview")}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[d.actions.length," button",d.actions.length===1?"":"s"," · ",S," slot",S===1?"":"s"]})]}),l.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:v.map((L,R)=>{const B=L.items[0]?.kind==="preset",Q=Math.max(2,L.columns),T=B?`${Q7}px repeat(${Math.max(1,Q-1)}, minmax(0, 1fr))`:`repeat(${Q}, minmax(0, 1fr))`;return l.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:T},children:L.items.map(O=>O.kind==="preset"?l.jsx(O7,{mode:"auto",presetLabel:O.label,title:`Auto preset · ${O.label}`,disabled:!0},O.id):l.jsx(HK,{label:O.label},O.id))},`preview-row-${R}`)})}),d.actions.length>S-k&&l.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:u("toolbarPresets.overCapacityHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.presets")}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[l.jsx(Eo,{size:14}),u("toolbarPresets.new")]}),l.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[l.jsx(Kc,{size:14}),u("toolbarPresets.reset")]})]})]}),l.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(L=>l.jsxs("button",{type:"button",onClick:()=>r(L.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${L.id===d.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[L.label,L.actions.length>0&&l.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:L.actions.length})]},L.id))})]}),l.jsxs("div",{className:"space-y-4 rounded-2xl bg-surface p-4 ring-1 ring-border/10",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.label")}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:d.label,onChange:L=>n(d.id,R=>({...R,label:L.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),d.id!=="default"&&l.jsx("button",{type:"button",onClick:()=>i(d.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":u("toolbarPresets.deletePreset",{name:d.label}),children:l.jsx(Na,{size:14})})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.matchPrograms")}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:u("toolbarPresets.typeEnterHint")})]}),l.jsx(UK,{value:d.programs,onChange:L=>n(d.id,R=>({...R,programs:L})),placeholder:u("toolbarPresets.programsPlaceholder")}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:u("toolbarPresets.programsHelp")})]}),l.jsxs("button",{type:"button",onClick:()=>n(d.id,L=>({...L,includeAlt:!L.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[l.jsxs("span",{children:[l.jsx("span",{className:"block font-medium text-foreground",children:u("toolbarPresets.altSlot")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:u("toolbarPresets.altSlotHint")})]}),l.jsx($c,{checked:d.includeAlt})]}),l.jsxs("button",{type:"button",onClick:()=>n(d.id,L=>({...L,showOnDesktop:!L.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[l.jsxs("span",{children:[l.jsx("span",{className:"block font-medium text-foreground",children:u("toolbarPresets.desktopVisibility")}),l.jsx("span",{className:"block text-[11px] text-muted-foreground",children:u("toolbarPresets.desktopVisibilityHint")})]}),l.jsx($c,{checked:d.showOnDesktop===!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.rowLayout")}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("toolbarPresets.rowLayoutHint")})]}),l.jsxs("button",{type:"button",onClick:()=>n(d.id,L=>({...L,rowLayout:[...sx(L.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[l.jsx(Eo,{size:12}),u("toolbarPresets.addRow")]})]}),l.jsx("div",{className:"space-y-2",children:d.rowLayout.map((L,R)=>l.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[l.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:u("toolbarPresets.rowN",{n:R+1})}),l.jsx("div",{className:"flex-1"}),l.jsx(zK,{value:L,min:OK,max:$K,onChange:B=>n(d.id,Q=>({...Q,rowLayout:Q.rowLayout.map((T,O)=>O===R?B:T)}))}),d.rowLayout.length>1&&l.jsx("button",{type:"button",onClick:()=>n(d.id,B=>({...B,rowLayout:B.rowLayout.filter((Q,T)=>T!==R)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":u("toolbarPresets.removeRow",{n:R+1}),children:u("toolbarPresets.del")})]},`row-${R}`))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("span",{className:"ui-kicker",children:u("toolbarPresets.buttons")}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("toolbarPresets.buttonsHint")})]}),l.jsxs("button",{type:"button",onClick:()=>{const L=`${d.id}-action-${Date.now()}`;n(d.id,R=>({...R,actions:[...R.actions,{id:L,label:`Key ${R.actions.length+1}`,sequence:""}]})),m(L)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[l.jsx(Eo,{size:12}),u("toolbarPresets.addButton")]})]}),d.actions.length===0&&l.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:u("toolbarPresets.noCustomButtons")}),d.actions.map((L,R)=>{const B=h===L.id;return l.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${B?"ring-1 ring-accent/40":""}`,children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("button",{type:"button",onClick:()=>A(L.id,-1),disabled:R===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":u("toolbarPresets.moveUp"),children:l.jsx(H4,{size:12})}),l.jsx("button",{type:"button",onClick:()=>A(L.id,1),disabled:R===d.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":u("toolbarPresets.moveDown"),children:l.jsx(bE,{size:12})})]}),l.jsxs("button",{type:"button",onClick:()=>m(B?null:L.id),className:"min-w-0 flex-1 text-left",children:[l.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:O2(L,R)}),l.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[L.sequence?L.sequence:u("toolbarPresets.noSequence"),L.doubleTapSequence&&l.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",L.doubleTapSequence]})]})]}),l.jsx("button",{type:"button",onClick:()=>n(d.id,Q=>({...Q,actions:Q.actions.filter(T=>T.id!==L.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":u("toolbarPresets.removeAction",{name:L.label}),children:l.jsx(Na,{size:14})})]}),B&&l.jsxs("div",{className:"space-y-3 border-t border-border/10 px-3 py-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:u("toolbarPresets.labelField")}),l.jsx("input",{type:"text",value:L.label,onChange:Q=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,label:Q.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.labelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:u("toolbarPresets.sequence")}),l.jsx("input",{type:"text",value:L.sequence,onChange:Q=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,sequence:Q.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),l.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:P6.map(Q=>l.jsx("button",{type:"button",onClick:()=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,sequence:Q.sequence}:O)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:Q.label},Q.label))})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:u("toolbarPresets.doubleTap")}),!L.doubleTapSequence&&l.jsx("button",{type:"button",onClick:()=>n(d.id,Q=>({...Q,actions:Q.actions.map(T=>T.id===L.id?{...T,doubleTapSequence:""}:T)})),className:"text-[10px] text-accent hover:text-accent/80",children:u("toolbarPresets.doubleTapAdd")})]}),L.doubleTapSequence!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:L.doubleTapSequence,onChange:Q=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,doubleTapSequence:Q.target.value}:O)})),className:"w-full rounded-full bg-surface px-4 py-2.5 font-mono text-sm outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:u("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[P6.map(Q=>l.jsx("button",{type:"button",onClick:()=>n(d.id,T=>({...T,actions:T.actions.map(O=>O.id===L.id?{...O,doubleTapSequence:(O.doubleTapSequence??"")+Q.sequence}:O)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:Q.label},Q.label)),l.jsx("button",{type:"button",onClick:()=>n(d.id,Q=>({...Q,actions:Q.actions.map(T=>{if(T.id!==L.id)return T;const{doubleTapSequence:O,...I}=T;return I})})),className:"rounded-full bg-destructive/10 px-2.5 py-1 text-[11px] font-medium text-destructive/70 hover:bg-destructive/20 hover:text-destructive",children:u("toolbarPresets.remove")})]})]})]})]})]},L.id)})]})]})]})},WK={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function VK(){const{t:e}=jr(),[t,r]=D.useState(null),[n,s]=D.useState(null),[i,a]=D.useState(null),[u,d]=D.useState(null),[h,m]=D.useState(!1),[b,x]=D.useState(""),[v,A]=D.useState(null),[S,k]=D.useState([]),L=D.useCallback(async()=>{try{r(await Yk())}catch{r([])}try{const I=await Xk();k(I.plugins??[])}catch{k([])}},[]);D.useEffect(()=>{L()},[L]);const R=async(I,N)=>{s(I),a(null);try{N==="install"?(await Kk(I)).devMode&&d(I):(await Zk(I),u===I&&d(null)),await L()}catch(U){a(U instanceof Error?U.message:String(U))}finally{s(null)}},B=I=>e(I==="installed"?"settings.agentHooksInstalled":I==="outdated"?"settings.agentHooksOutdated":"settings.agentHooksNotInstalled"),Q=async()=>{A(null);let I;try{I=JSON.parse(b)}catch{A("Invalid JSON");return}try{await Jk(I),x(""),m(!1),await L()}catch(N){A(N instanceof Error?N.message:String(N))}},T=async I=>{try{await eL(I),await L()}catch(N){a(N instanceof Error?N.message:String(N))}},O=new Set(S.map(I=>I.slug));return l.jsxs("div",{className:"space-y-3",children:[t===null&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[l.jsx(en,{size:12,className:"animate-spin"})," …"]}),t?.map(I=>{const N=n===I.slug,U=I.state!=="not-installed",z=O.has(I.slug);return l.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsx(Rx,{agent:{slug:I.slug,displayName:I.displayName,accentColor:I.accentColor??"#878580",icon:I.icon,isPlugin:z,iconMode:I.iconMode,iconVersion:I.iconVersion??void 0},size:18}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:I.displayName}),z&&l.jsx("span",{className:"rounded bg-[rgb(var(--success-rgb)_/_0.12)] px-1 py-px text-[9px] font-medium text-[color:var(--success)]",children:"plugin"}),l.jsxs("span",{className:`text-[10px] ${WK[I.state]}`,children:[I.state==="installed"&&l.jsx(z4,{size:10,className:"mr-0.5 inline"}),I.state==="outdated"&&l.jsx(qb,{size:10,className:"mr-0.5 inline"}),B(I.state)]})]}),l.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:I.targetDisplay,children:[e("settings.agentHooksTarget")," ",I.targetDisplay]}),u===I.slug&&l.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[z&&l.jsx("button",{type:"button",disabled:N,onClick:()=>{T(I.slug)},className:"flex shrink-0 items-center rounded-full p-1 text-[11px] text-muted-foreground hover:bg-surface-elevated hover:text-[color:var(--warning)] transition disabled:opacity-50",title:e("settings.agentPluginDelete"),children:l.jsx(Na,{size:11})}),l.jsxs("button",{type:"button",disabled:N,onClick:()=>{R(I.slug,U?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${U?"bg-surface text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)]"} disabled:opacity-50`,children:[N?l.jsx(en,{size:11,className:"animate-spin"}):U?l.jsx(Na,{size:11}):I.state==="outdated"?l.jsx(Kc,{size:11}):l.jsx(jf,{size:11}),N?"…":U?e("settings.agentHooksUninstall"):I.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},I.slug)}),i&&l.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:i}),l.jsxs("div",{className:"rounded-xl bg-surface-2 px-3 py-2.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[12px] font-medium text-foreground",children:e("settings.agentPlugins")}),l.jsxs("button",{type:"button",onClick:()=>m(!h),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[l.jsx(Eo,{size:11}),e("settings.agentPluginAdd")]})]}),l.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),h&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsx("textarea",{value:b,onChange:I=>x(I.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
|
|
210
210
|
"version": 1,
|
|
211
211
|
"slug": "my-agent",
|
|
212
212
|
"displayName": "My Agent",
|
|
@@ -435,4 +435,4 @@ ${Le}
|
|
|
435
435
|
+ }
|
|
436
436
|
return context;
|
|
437
437
|
}`}};function Y6(){if(typeof window>"u")return"kotlin";const t=new URLSearchParams(window.location.search).get("fixture");return t&&t in Pb?t:"kotlin"}function K6(){return typeof window>"u"?"unified":new URLSearchParams(window.location.search).get("view")==="split"?"split":"unified"}function Z6(){if(typeof window>"u")return"words";const e=new URLSearchParams(window.location.search).get("inline");return e==="none"||e==="chars"||e==="words"?e:"words"}function X6(){return typeof window>"u"?!0:new URLSearchParams(window.location.search).get("wrap")!=="off"}function pZ(){const[e,t]=w.useState(()=>Y6()),[r,n]=w.useState(()=>K6()),[s,i]=w.useState(()=>Z6()),[a,u]=w.useState(()=>X6()),d=Pb[e],h=w.useMemo(()=>Object.entries(Pb),[]);return w.useEffect(()=>{if(typeof window>"u")return;let m=window.location.search;const b=()=>{window.location.search!==m&&(m=window.location.search,t(Y6()),n(K6()),i(Z6()),u(X6()))};window.addEventListener("popstate",b),window.addEventListener("pageshow",b),window.addEventListener("focus",b);const x=window.setInterval(b,250);return()=>{window.removeEventListener("popstate",b),window.removeEventListener("pageshow",b),window.removeEventListener("focus",b),window.clearInterval(x)}},[]),l.jsx("div",{className:"min-h-screen bg-background-subtle text-foreground","data-diff-lab":!0,"data-diff-lab-fixture":e,"data-diff-lab-view":r,"data-diff-lab-inline":s,"data-diff-lab-wrap":a?"on":"off",children:l.jsxs("div",{className:"mx-auto flex min-h-screen max-w-[1180px] flex-col px-4 py-4",children:[l.jsxs("header",{className:"mb-3 flex flex-wrap items-center justify-between gap-3 border-b border-border/20 pb-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-semibold",children:"Diff Lab"}),l.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Fixed fixtures for iterating diff rendering without app auth, PWA state, or live Git data."})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("select",{value:e,onChange:m=>t(m.target.value),className:"h-8 rounded-md border border-border/30 bg-surface px-2 text-xs text-foreground outline-none",children:h.map(([m,b])=>l.jsx("option",{value:m,children:b.label},m))}),l.jsxs("div",{className:"inline-flex h-8 overflow-hidden rounded-full bg-surface-2 p-0.5",children:[l.jsx("button",{type:"button",onClick:()=>n("unified"),className:`rounded-full px-3 text-xs font-semibold ${r==="unified"?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:"Unified"}),l.jsx("button",{type:"button",onClick:()=>n("split"),className:`rounded-full px-3 text-xs font-semibold ${r==="split"?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:"Split"})]}),l.jsx("div",{className:"inline-flex h-8 overflow-hidden rounded-full bg-surface-2 p-0.5",children:["none","words","chars"].map(m=>l.jsx("button",{type:"button",onClick:()=>i(m),className:`rounded-full px-3 text-xs font-semibold ${s===m?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:m},m))}),l.jsxs("button",{type:"button",onClick:()=>u(m=>!m),className:`h-8 rounded-full px-3 text-xs font-semibold ${a?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:["Wrap ",a?"on":"off"]})]})]}),l.jsx("main",{className:"min-h-0 flex-1 overflow-auto rounded-lg border border-border/20 bg-surface",children:l.jsx(EA,{filePath:d.path,repoRoot:"/tmp/termdock-diff-lab",changedFile:{path:d.path,absolutePath:`/tmp/termdock-diff-lab/${d.path}`,repoRoot:"/tmp/termdock-diff-lab",status:"modified",staged:!1,unstaged:!0,untracked:!1,tracked:!0,canStage:!1,canUnstage:!1,canStash:!1,canRestoreWorktree:!1},diffOverride:d.diff,oldSourceOverride:d.oldSource,active:!0,wrap:a,showScrollHint:!a,viewType:r,inlineMode:s})})]})})}const IT=40,jb="/tmp/termdock-diff-review-lab";function J6(e,t){const r=[`diff --git a/${e} b/${e}`,`--- a/${e}`,`+++ b/${e}`,`@@ -1,${t} +1,${t} @@`];for(let n=0;n<t;n+=1)n%5===0&&r.push(`-const removed_${n} = ${n};`),n%3===0&&r.push(`+const added_${n} = ${n} * 2;`),r.push(` context line ${n} in ${e}`);return r.join(`
|
|
438
|
-
`)}function mZ(e,t){return Array.from({length:IT},(r,n)=>{const s=6+n*7%60,i=`src/module${String(n).padStart(2,"0")}/File${n}.ts`,a=`${jb}/${i}`,u=J6(i,s),d=J6(i,1);return{key:a,path:i,absolutePath:a,status:"modified",repoRoot:jb,displayName:`File${n}.ts`,displayDir:`src/module${String(n).padStart(2,"0")} · ${s} lines`,diffOverride:!t||e.has(n)?u:d,auditRecords:[]}})}function gZ(){const e=w.useMemo(()=>{if(typeof window>"u")return 0;const L=new URLSearchParams(window.location.search).get("delay"),R=L===null?0:Number.parseInt(L,10);return Number.isInteger(R)&&R>0?R:0},[]),t=e>0,[r,n]=w.useState(()=>new Set);w.useEffect(()=>{if(!t)return;const L=Array.from({length:IT},(R,B)=>window.setTimeout(()=>{n(Q=>{const T=new Set(Q);return T.add(B),T})},e+B*20));return()=>L.forEach(R=>window.clearTimeout(R))},[t,e]);const s=w.useMemo(()=>mZ(r,t),[r,t]),i=w.useMemo(()=>[{key:"mock-repo",root:jb,label:"diff-review-lab",files:s.map(L=>({key:L.key,path:L.path,absolutePath:L.absolutePath,displayName:L.displayName,displayDir:L.displayDir,status:L.status}))}],[s]),a=w.useMemo(()=>{if(typeof window>"u")return null;const L=new URLSearchParams(window.location.search).get("select");if(L===null)return null;const R=Number.parseInt(L,10);return Number.isInteger(R)&&R>=0&&R<s.length?R:null},[s.length]),[u,d]=w.useState(()=>a!==null?s[a].key:null),[h,m]=w.useState(()=>({key:a!==null?s[a].key:null,nonce:a!==null?1:0})),[b,x]=w.useState("list"),[v,A]=w.useState(new Set),[S,k]=w.useState(a!==null?1:0);return l.jsxs("div",{className:"flex h-screen flex-col bg-background text-foreground","data-diff-review-lab":!0,children:[l.jsxs("div",{className:"shrink-0 border-b border-border/20 px-3 py-2 text-xs text-muted-foreground",children:["DiffReview Lab · ",s.length," mock files · selected: ",l.jsx("span",{"data-lab-selected":!0,children:u??"none"})," · slide ",S]}),l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(df,{mobile:!0,backLabel:"Back",files:s,groups:i,selectedKey:u,scrollToKey:h.key,scrollToKeyNonce:h.nonce,mode:b,onModeChange:L=>{L!=="ai"&&x(L)},collapsedDirectoryKeys:v,onToggleDirectory:L=>A(R=>{const B=new Set(R);return B.has(L)?B.delete(L):B.add(L),B}),onSelectFile:L=>{d(L.key),m(R=>({key:L.key,nonce:R.nonce+1}))},onMobileSlideChange:k,renderLeading:()=>null,renderStreamBadge:L=>l.jsx("span",{className:"text-[10px] text-muted-foreground",children:L}),wrap:!0,showScrollHint:!1,activePane:!0})})]})}const bZ=6e4,b2="termdock:build-id:v1";let e4=!1;function t4(){e4||(e4=!0,window.setTimeout(()=>{window.location.reload()},80))}function Fb(e){e.waiting?.postMessage({type:"SKIP_WAITING"})}async function xZ(){if(typeof caches>"u")return;const e=await caches.keys();await Promise.all(e.map(t=>caches.delete(t)))}function yZ(e){e.addEventListener("updatefound",()=>{const t=e.installing;t&&t.addEventListener("statechange",()=>{t.state==="installed"&&navigator.serviceWorker.controller&&Fb(e)})})}function vZ(){if(typeof window>"u"||!("serviceWorker"in navigator))return;const e="
|
|
438
|
+
`)}function mZ(e,t){return Array.from({length:IT},(r,n)=>{const s=6+n*7%60,i=`src/module${String(n).padStart(2,"0")}/File${n}.ts`,a=`${jb}/${i}`,u=J6(i,s),d=J6(i,1);return{key:a,path:i,absolutePath:a,status:"modified",repoRoot:jb,displayName:`File${n}.ts`,displayDir:`src/module${String(n).padStart(2,"0")} · ${s} lines`,diffOverride:!t||e.has(n)?u:d,auditRecords:[]}})}function gZ(){const e=w.useMemo(()=>{if(typeof window>"u")return 0;const L=new URLSearchParams(window.location.search).get("delay"),R=L===null?0:Number.parseInt(L,10);return Number.isInteger(R)&&R>0?R:0},[]),t=e>0,[r,n]=w.useState(()=>new Set);w.useEffect(()=>{if(!t)return;const L=Array.from({length:IT},(R,B)=>window.setTimeout(()=>{n(Q=>{const T=new Set(Q);return T.add(B),T})},e+B*20));return()=>L.forEach(R=>window.clearTimeout(R))},[t,e]);const s=w.useMemo(()=>mZ(r,t),[r,t]),i=w.useMemo(()=>[{key:"mock-repo",root:jb,label:"diff-review-lab",files:s.map(L=>({key:L.key,path:L.path,absolutePath:L.absolutePath,displayName:L.displayName,displayDir:L.displayDir,status:L.status}))}],[s]),a=w.useMemo(()=>{if(typeof window>"u")return null;const L=new URLSearchParams(window.location.search).get("select");if(L===null)return null;const R=Number.parseInt(L,10);return Number.isInteger(R)&&R>=0&&R<s.length?R:null},[s.length]),[u,d]=w.useState(()=>a!==null?s[a].key:null),[h,m]=w.useState(()=>({key:a!==null?s[a].key:null,nonce:a!==null?1:0})),[b,x]=w.useState("list"),[v,A]=w.useState(new Set),[S,k]=w.useState(a!==null?1:0);return l.jsxs("div",{className:"flex h-screen flex-col bg-background text-foreground","data-diff-review-lab":!0,children:[l.jsxs("div",{className:"shrink-0 border-b border-border/20 px-3 py-2 text-xs text-muted-foreground",children:["DiffReview Lab · ",s.length," mock files · selected: ",l.jsx("span",{"data-lab-selected":!0,children:u??"none"})," · slide ",S]}),l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(df,{mobile:!0,backLabel:"Back",files:s,groups:i,selectedKey:u,scrollToKey:h.key,scrollToKeyNonce:h.nonce,mode:b,onModeChange:L=>{L!=="ai"&&x(L)},collapsedDirectoryKeys:v,onToggleDirectory:L=>A(R=>{const B=new Set(R);return B.has(L)?B.delete(L):B.add(L),B}),onSelectFile:L=>{d(L.key),m(R=>({key:L.key,nonce:R.nonce+1}))},onMobileSlideChange:k,renderLeading:()=>null,renderStreamBadge:L=>l.jsx("span",{className:"text-[10px] text-muted-foreground",children:L}),wrap:!0,showScrollHint:!1,activePane:!0})})]})}const bZ=6e4,b2="termdock:build-id:v1";let e4=!1;function t4(){e4||(e4=!0,window.setTimeout(()=>{window.location.reload()},80))}function Fb(e){e.waiting?.postMessage({type:"SKIP_WAITING"})}async function xZ(){if(typeof caches>"u")return;const e=await caches.keys();await Promise.all(e.map(t=>caches.delete(t)))}function yZ(e){e.addEventListener("updatefound",()=>{const t=e.installing;t&&t.addEventListener("statechange",()=>{t.state==="installed"&&navigator.serviceWorker.controller&&Fb(e)})})}function vZ(){if(typeof window>"u"||!("serviceWorker"in navigator))return;const e="1786010725477",t=window.localStorage.getItem(b2);if(t&&t!==e){xZ().finally(()=>{window.localStorage.setItem(b2,e),t4()});return}t!==e&&window.localStorage.setItem(b2,e);let r=null;navigator.serviceWorker.addEventListener("controllerchange",t4),window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(n=>{yZ(n),Fb(n);const s=()=>{document.visibilityState==="visible"&&n.update().then(()=>Fb(n)).catch(()=>{})};s(),r=window.setInterval(s,bZ),document.addEventListener("visibilitychange",s)}).catch(()=>{})}),window.addEventListener("beforeunload",()=>{r!==null&&window.clearInterval(r)})}mH();vZ();try{const e=JSON.parse(window.localStorage.getItem("termdock-color-theme")||"null");(e==="dark"||e==="light")&&(document.documentElement.dataset.theme=e,w9(e))}catch{}function wZ(){const{t:e}=jr(),[t,r]=w.useState(null),[n,s]=w.useState(null),i=w.useCallback(async()=>{try{const a=await Wk();r(a),s(null)}catch(a){s(a instanceof Error?a.message:"Failed to query auth status")}},[]);return w.useEffect(()=>{i()},[i]),w.useEffect(()=>{const a=()=>{r(u=>u&&{...u,authenticated:!1})};return window.addEventListener(Bp,a),()=>window.removeEventListener(Bp,a)},[]),t===null?l.jsx("div",{className:"flex w-screen items-center justify-center bg-background text-muted-foreground",style:{height:"var(--app-vh, 100vh)"},children:n?`${e("common.error")}: ${n}`:e("common.loading")}):t.enabled&&!t.authenticated?l.jsx(fZ,{onLoginSuccess:i}):l.jsx(uZ,{})}wC.createRoot(document.getElementById("root")).render(l.jsx(D.StrictMode,{children:l.jsx(aE,{children:l.jsx(D7,{children:(()=>{const e=new URLSearchParams(window.location.search);return e.get("dag-playground")==="1"?l.jsx(hZ,{}):e.get("diff-review-lab")==="1"?l.jsx(gZ,{}):e.get("diff-lab")==="1"?l.jsx(pZ,{}):l.jsx(wZ,{})})()})})}));export{LI as M,Kc as R,sM as S,kd as _,Gt as c,l as j,jr as u,rk as v};
|