termdock 1.4.119 → 1.4.120

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.
Files changed (67) hide show
  1. package/dist/client/assets/{ModelPreview-6FgWt8IX.js → ModelPreview-DcSDnALR.js} +1 -1
  2. package/dist/client/assets/{abnfDiagram-VRR7QNED-C2QyQJ9F.js → abnfDiagram-VRR7QNED-PNYbIBUE.js} +1 -1
  3. package/dist/client/assets/{arc-iJl6Z0rl.js → arc-Cb6ffVAn.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-ZJ3FMSHR-B4CIf1XF.js → architectureDiagram-ZJ3FMSHR-BuCggaDf.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-677ZJIJ3-DWWPStAh.js → blockDiagram-677ZJIJ3-BXTvo8Tq.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-LMCZKHZV-B5tpwNht.js → c4Diagram-LMCZKHZV-CenjnHBb.js} +1 -1
  7. package/dist/client/assets/channel-CufcHStp.js +1 -0
  8. package/dist/client/assets/{chunk-2Q5K7J3B-DObcmwOX.js → chunk-2Q5K7J3B-vjBBDuQw.js} +1 -1
  9. package/dist/client/assets/{chunk-32BRIVSS-Bw06pI_4.js → chunk-32BRIVSS-CvpcGKYk.js} +1 -1
  10. package/dist/client/assets/{chunk-5VM5RSS4-JEgkxONV.js → chunk-5VM5RSS4-Bz1aigTj.js} +1 -1
  11. package/dist/client/assets/{chunk-EX3LRPZG-B69eFkKW.js → chunk-EX3LRPZG-Cyymy-P3.js} +1 -1
  12. package/dist/client/assets/{chunk-JWPE2WC7-DYpho4KG.js → chunk-JWPE2WC7-CEW8M6BA.js} +1 -1
  13. package/dist/client/assets/{chunk-MOJQB5TN-BbghBTgh.js → chunk-MOJQB5TN-06Ny18_L.js} +1 -1
  14. package/dist/client/assets/{chunk-RYQCIY6F-P6Wodw29.js → chunk-RYQCIY6F-BwAAEso2.js} +1 -1
  15. package/dist/client/assets/{chunk-V7JOEXUC-BG6B5RQU.js → chunk-V7JOEXUC-By8hSnY4.js} +1 -1
  16. package/dist/client/assets/{chunk-VR4S4FIN-CmBwOywp.js → chunk-VR4S4FIN-B3ZN6kXu.js} +1 -1
  17. package/dist/client/assets/{chunk-XXDRQBXY-ejYnTSZf.js → chunk-XXDRQBXY-DsuR9CEK.js} +1 -1
  18. package/dist/client/assets/classDiagram-OUVF2IWQ-SXpr92QC.js +1 -0
  19. package/dist/client/assets/classDiagram-v2-EOCWNBFH-SXpr92QC.js +1 -0
  20. package/dist/client/assets/{cose-bilkent-JH36ORCC-Cxpor7NH.js → cose-bilkent-JH36ORCC-COuKk6pn.js} +1 -1
  21. package/dist/client/assets/{cynefin-VYW2F7L2-BsE69dfO.js → cynefin-VYW2F7L2-BuYXJrT6.js} +1 -1
  22. package/dist/client/assets/{cynefinDiagram-TSTJHNR4-DIQr4U6B.js → cynefinDiagram-TSTJHNR4-1pkiBXO4.js} +1 -1
  23. package/dist/client/assets/{dagre-VKFMJZFB-sr8aazoR.js → dagre-VKFMJZFB-3Le3CNVr.js} +1 -1
  24. package/dist/client/assets/{diagram-FQU43EPY-xj-gNfbi.js → diagram-FQU43EPY-gDh7W40m.js} +1 -1
  25. package/dist/client/assets/{diagram-G47NLZAW-CW4ZP_gS.js → diagram-G47NLZAW-C1NDtz-3.js} +1 -1
  26. package/dist/client/assets/{diagram-NH7WQ7WH-BHNnRWoH.js → diagram-NH7WQ7WH-J197_nE4.js} +1 -1
  27. package/dist/client/assets/{diagram-OA4YK3LP-BwrIj-Al.js → diagram-OA4YK3LP-COczsFwB.js} +1 -1
  28. package/dist/client/assets/{diagram-WEI45ONY-BUWxEtEa.js → diagram-WEI45ONY-D3s7fhDT.js} +1 -1
  29. package/dist/client/assets/{ebnfDiagram-CCIWWBDH-ByqWwTZ3.js → ebnfDiagram-CCIWWBDH-BYcHgH68.js} +1 -1
  30. package/dist/client/assets/{erDiagram-Q63AITRT-CHzYiy1H.js → erDiagram-Q63AITRT-BT0mCnNu.js} +1 -1
  31. package/dist/client/assets/{flowDiagram-23GEKE2U-CRS9Yclw.js → flowDiagram-23GEKE2U-BGCyt1QD.js} +1 -1
  32. package/dist/client/assets/{ganttDiagram-NO4QXBWP-CJhX6Y5z.js → ganttDiagram-NO4QXBWP-BJoSLOQY.js} +1 -1
  33. package/dist/client/assets/{gitGraphDiagram-IHSO6WYX-B-iKd6O5.js → gitGraphDiagram-IHSO6WYX-Bbc_LYow.js} +1 -1
  34. package/dist/client/assets/{index-CNzYLEOc.js → index-d0ki726G.js} +4 -4
  35. package/dist/client/assets/{infoDiagram-FWYZ7A6U-Cwfv2g5L.js → infoDiagram-FWYZ7A6U-FoBEige-.js} +1 -1
  36. package/dist/client/assets/{ishikawaDiagram-FXEZZL3T-D0wqu-TN.js → ishikawaDiagram-FXEZZL3T-Clxkfkz-.js} +1 -1
  37. package/dist/client/assets/{journeyDiagram-5HDEW3XC-DnB32Wtt.js → journeyDiagram-5HDEW3XC-DhexQo7h.js} +1 -1
  38. package/dist/client/assets/{kanban-definition-HUTT4EX6-CgmqFP3L.js → kanban-definition-HUTT4EX6-GLP4sJWW.js} +1 -1
  39. package/dist/client/assets/{linear-BsHsyXou.js → linear-Dlda_SCB.js} +1 -1
  40. package/dist/client/assets/{mermaid.core-Cd5etby6.js → mermaid.core-B4h2_dRl.js} +4 -4
  41. package/dist/client/assets/{mindmap-definition-LN4V7U3C-C49mJuNO.js → mindmap-definition-LN4V7U3C-D4o6waJy.js} +1 -1
  42. package/dist/client/assets/{pegDiagram-2B236MQR-DC3hpFeg.js → pegDiagram-2B236MQR-DZV20kLS.js} +1 -1
  43. package/dist/client/assets/{pieDiagram-ENE6RG2P-CuCHUeEN.js → pieDiagram-ENE6RG2P-CGFO4pP5.js} +1 -1
  44. package/dist/client/assets/{quadrantDiagram-ABIIQ3AL-BFbvIq3M.js → quadrantDiagram-ABIIQ3AL-dv1dZcbh.js} +1 -1
  45. package/dist/client/assets/{railroadDiagram-RFXS5EU6-5UH2vO71.js → railroadDiagram-RFXS5EU6-CJ38cYpg.js} +1 -1
  46. package/dist/client/assets/{requirementDiagram-TGXJPOKE-i7w0tnzq.js → requirementDiagram-TGXJPOKE-DXdUMQnv.js} +1 -1
  47. package/dist/client/assets/{sankeyDiagram-HTMAVEWB-CdJHakqP.js → sankeyDiagram-HTMAVEWB-7QCot2bn.js} +1 -1
  48. package/dist/client/assets/{sequenceDiagram-DBY2YBRQ-DXZL-d3R.js → sequenceDiagram-DBY2YBRQ-BpJz-V_E.js} +1 -1
  49. package/dist/client/assets/{sizeCapture-X5ZJPWSS-CebVoLf1.js → sizeCapture-X5ZJPWSS-DHwJcEYQ.js} +1 -1
  50. package/dist/client/assets/{stateDiagram-2N3HPSRC-C_W_t_jG.js → stateDiagram-2N3HPSRC-CSDqorlK.js} +1 -1
  51. package/dist/client/assets/stateDiagram-v2-6OUMAXLB-CQmcUyVf.js +1 -0
  52. package/dist/client/assets/{swimlanes-5IMT3BWC-Bh92iW-e.js → swimlanes-5IMT3BWC-CaeEliCu.js} +2 -2
  53. package/dist/client/assets/swimlanesDiagram-G3AALYLV-DOpEsNRP.js +8 -0
  54. package/dist/client/assets/{timeline-definition-FHXFAJF6-B73cyhmT.js → timeline-definition-FHXFAJF6-Dqaren6d.js} +1 -1
  55. package/dist/client/assets/{vennDiagram-L72KCM5P-BTcXiYmJ.js → vennDiagram-L72KCM5P-9DyeBVoe.js} +1 -1
  56. package/dist/client/assets/{wardleyDiagram-EHGQE667-D3gKXQ8G.js → wardleyDiagram-EHGQE667-PadtA4TY.js} +1 -1
  57. package/dist/client/assets/{xychartDiagram-FW5EYKEG-CVt025qS.js → xychartDiagram-FW5EYKEG-C5OTsP_B.js} +1 -1
  58. package/dist/client/index.html +1 -1
  59. package/dist/client/sw.js +1 -1
  60. package/dist/server/agent/collaborationPrompt.js +23 -15
  61. package/package.json +1 -1
  62. package/runtime-manifest.json +2 -2
  63. package/dist/client/assets/channel-uJbcbxEo.js +0 -1
  64. package/dist/client/assets/classDiagram-OUVF2IWQ-By0eEdpV.js +0 -1
  65. package/dist/client/assets/classDiagram-v2-EOCWNBFH-By0eEdpV.js +0 -1
  66. package/dist/client/assets/stateDiagram-v2-6OUMAXLB-DYldoJoy.js +0 -1
  67. package/dist/client/assets/swimlanesDiagram-G3AALYLV-BBQoxysd.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-6FgWt8IX.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/katex-55ZPZeOF.css","assets/mermaid.core-Cd5etby6.js","assets/purify.es-CC4Brkr_.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ca-rq7yX.js","assets/react-XDCjal2T.js","assets/ModelPreview-DcSDnALR.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/katex-55ZPZeOF.css","assets/mermaid.core-B4h2_dRl.js","assets/purify.es-CC4Brkr_.js"])))=>i.map(i=>d[i]);
2
2
  import{r as cg,a as Gk,g as x7}from"./react-XDCjal2T.js";import{b,R as D,r as aa,a as Wk}from"./dnd-BCFAPC0L.js";import{L as Vk,l as qk}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"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(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 r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var x1={exports:{}},B0={};var Tv;function Yk(){if(Tv)return B0;Tv=1;var e=cg(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=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 l(c,u,f){var p,g={},y=null,v=null;f!==void 0&&(y=""+f),u.key!==void 0&&(y=""+u.key),u.ref!==void 0&&(v=u.ref);for(p in u)r.call(u,p)&&!i.hasOwnProperty(p)&&(g[p]=u[p]);if(c&&c.defaultProps)for(p in u=c.defaultProps,u)g[p]===void 0&&(g[p]=u[p]);return{$$typeof:t,type:c,key:y,ref:v,props:g,_owner:s.current}}return B0.Fragment=n,B0.jsx=l,B0.jsxs=l,B0}var Cv;function Kk(){return Cv||(Cv=1,x1.exports=Yk()),x1.exports}var o=Kk(),rp={},kv;function Xk(){if(kv)return rp;kv=1;var e=Gk();return rp.createRoot=e.createRoot,rp.hydrateRoot=e.hydrateRoot,rp}var Zk=Xk();const Jk=x7(Zk);function _v(e){return e!==null&&typeof e=="object"&&"constructor"in e&&e.constructor===Object}function U2(e={},t={}){const n=["__proto__","constructor","prototype"];Object.keys(t).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof e[r]>"u"?e[r]=t[r]:_v(t[r])&&_v(e[r])&&Object.keys(t[r]).length>0&&U2(e[r],t[r])})}const b7={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 zu(){const e=typeof document<"u"?document:{};return U2(e,b7),e}const e_={document:b7,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 $o(){const e=typeof window<"u"?window:{};return U2(e,e_),e}function t_(e=""){return e.trim().split(" ").filter(t=>!!t.trim())}function n_(e){const t=e;Object.keys(t).forEach(n=>{try{t[n]=null}catch{}try{delete t[n]}catch{}})}function y7(e,t=0){return setTimeout(e,t)}function vm(){return Date.now()}function r_(e){const t=$o();let n;return t.getComputedStyle&&(n=t.getComputedStyle(e,null)),!n&&e.currentStyle&&(n=e.currentStyle),n||(n=e.style),n}function s_(e,t="x"){const n=$o();let r,s,i;const l=r_(e);return n.WebKitCSSMatrix?(s=l.transform||l.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(c=>c.replace(",",".")).join(", ")),i=new n.WebKitCSSMatrix(s==="none"?"":s)):(i=l.MozTransform||l.OTransform||l.MsTransform||l.msTransform||l.transform||l.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=i.toString().split(",")),t==="x"&&(n.WebKitCSSMatrix?s=i.m41:r.length===16?s=parseFloat(r[12]):s=parseFloat(r[4])),t==="y"&&(n.WebKitCSSMatrix?s=i.m42:r.length===16?s=parseFloat(r[13]):s=parseFloat(r[5])),s||0}function sp(e){return typeof e=="object"&&e!==null&&e.constructor&&Object.prototype.toString.call(e).slice(8,-1)==="Object"}function i_(e){return typeof window<"u"&&typeof window.HTMLElement<"u"?e instanceof HTMLElement:e&&(e.nodeType===1||e.nodeType===11)}function Sa(...e){const t=Object(e[0]);for(let n=1;n<e.length;n+=1){const r=e[n];if(r!=null&&!i_(r)){const s=Object.keys(Object(r)).filter(i=>i!=="__proto__"&&i!=="constructor"&&i!=="prototype");for(let i=0,l=s.length;i<l;i+=1){const c=s[i],u=Object.getOwnPropertyDescriptor(r,c);u!==void 0&&u.enumerable&&(sp(t[c])&&sp(r[c])?r[c].__swiper__?t[c]=r[c]:Sa(t[c],r[c]):!sp(t[c])&&sp(r[c])?(t[c]={},r[c].__swiper__?t[c]=r[c]:Sa(t[c],r[c])):t[c]=r[c])}}}return t}function fd(e,t,n){e.style.setProperty(t,n)}function v7({swiper:e,targetPosition:t,side:n}){const r=$o(),s=-e.translate;let i=null,l;const c=e.params.speed;e.wrapperEl.style.scrollSnapType="none",r.cancelAnimationFrame(e.cssModeFrameID);const u=t>s?"next":"prev",f=(g,y)=>u==="next"&&g>=y||u==="prev"&&g<=y,p=()=>{l=new Date().getTime(),i===null&&(i=l);const g=Math.max(Math.min((l-i)/c,1),0),y=.5-Math.cos(g*Math.PI)/2;let v=s+y*(t-s);if(f(v,t)&&(v=t),e.wrapperEl.scrollTo({[n]:v}),f(v,t)){e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout(()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[n]:v})}),r.cancelAnimationFrame(e.cssModeFrameID);return}e.cssModeFrameID=r.requestAnimationFrame(p)};p()}function mc(e,t=""){const n=$o(),r=[...e.children];return n.HTMLSlotElement&&e instanceof HTMLSlotElement&&r.push(...e.assignedElements()),t?r.filter(s=>s.matches(t)):r}function o_(e,t){const n=[t];for(;n.length>0;){const r=n.shift();if(e===r)return!0;n.push(...r.children,...r.shadowRoot?r.shadowRoot.children:[],...r.assignedElements?r.assignedElements():[])}}function a_(e,t){const n=$o();let r=t.contains(e);return!r&&n.HTMLSlotElement&&t instanceof HTMLSlotElement&&(r=[...t.assignedElements()].includes(e),r||(r=o_(e,t))),r}function wm(e){try{console.warn(e);return}catch{}}function ub(e,t=[]){const n=document.createElement(e);return n.classList.add(...Array.isArray(t)?t:t_(t)),n}function l_(e,t){const n=[];for(;e.previousElementSibling;){const r=e.previousElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function c_(e,t){const n=[];for(;e.nextElementSibling;){const r=e.nextElementSibling;t?r.matches(t)&&n.push(r):n.push(r),e=r}return n}function Uc(e,t){return $o().getComputedStyle(e,null).getPropertyValue(t)}function Lv(e){let t=e,n;if(t){for(n=0;(t=t.previousSibling)!==null;)t.nodeType===1&&(n+=1);return n}}function u_(e,t){const n=[];let r=e.parentElement;for(;r;)n.push(r),r=r.parentElement;return n}function Ev(e,t,n){const r=$o();return e[t==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(e,null).getPropertyValue(t==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(e,null).getPropertyValue(t==="width"?"margin-left":"margin-bottom"))}function Iv(e,t=""){typeof trustedTypes<"u"?e.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(t):e.innerHTML=t}let b1;function d_(){const e=$o(),t=zu();return{smoothScroll:t.documentElement&&t.documentElement.style&&"scrollBehavior"in t.documentElement.style,touch:!!("ontouchstart"in e||e.DocumentTouch&&t instanceof e.DocumentTouch)}}function w7(){return b1||(b1=d_()),b1}let y1;function f_({userAgent:e}={}){const t=w7(),n=$o(),r=n.navigator.platform,s=e||n.navigator.userAgent,i={ios:!1,android:!1},l=n.screen.width,c=n.screen.height,u=s.match(/(Android);?[\s\/]+([\d.]+)?/);let f=s.match(/(iPad)(?!\1).*OS\s([\d_]+)/);const p=s.match(/(iPod)(.*OS\s([\d_]+))?/),g=!f&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),y=r==="Win32";let v=r==="MacIntel";const S=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!f&&v&&t.touch&&S.indexOf(`${l}x${c}`)>=0&&(f=s.match(/(Version)\/([\d.]+)/),f||(f=[0,1,"13_0_0"]),v=!1),u&&!y&&(i.os="android",i.android=!0),(f||g||p)&&(i.os="ios",i.ios=!0),i}function S7(e={}){return y1||(y1=f_(e)),y1}let v1;function h_(){const e=$o(),t=S7();let n=!1;function r(){const c=e.navigator.userAgent.toLowerCase();return c.indexOf("safari")>=0&&c.indexOf("chrome")<0&&c.indexOf("android")<0}if(r()){const c=String(e.navigator.userAgent);if(c.includes("Version/")){const[u,f]=c.split("Version/")[1].split(" ")[0].split(".").map(p=>Number(p));n=u<16||u===16&&f<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent),i=r(),l=i||s&&t.ios;return{isSafari:n||i,needPerspectiveFix:n,need3dFix:l,isWebView:s}}function A7(){return v1||(v1=h_()),v1}function p_({swiper:e,on:t,emit:n}){const r=$o();let s=null,i=null;const l=()=>{!e||e.destroyed||!e.initialized||(n("beforeResize"),n("resize"))},c=()=>{!e||e.destroyed||!e.initialized||(s=new ResizeObserver(p=>{i=r.requestAnimationFrame(()=>{const{width:g,height:y}=e;let v=g,S=y;p.forEach(({contentBoxSize:A,contentRect:T,target:L})=>{L&&L!==e.el||(v=T?T.width:(A[0]||A).inlineSize,S=T?T.height:(A[0]||A).blockSize)}),(v!==g||S!==y)&&l()})}),s.observe(e.el))},u=()=>{i&&r.cancelAnimationFrame(i),s&&s.unobserve&&e.el&&(s.unobserve(e.el),s=null)},f=()=>{!e||e.destroyed||!e.initialized||n("orientationchange")};t("init",()=>{if(e.params.resizeObserver&&typeof r.ResizeObserver<"u"){c();return}r.addEventListener("resize",l),r.addEventListener("orientationchange",f)}),t("destroy",()=>{u(),r.removeEventListener("resize",l),r.removeEventListener("orientationchange",f)})}function m_({swiper:e,extendParams:t,on:n,emit:r}){const s=[],i=$o(),l=(f,p={})=>{const g=i.MutationObserver||i.WebkitMutationObserver,y=new g(v=>{if(e.__preventObserver__)return;if(v.length===1){r("observerUpdate",v[0]);return}const S=function(){r("observerUpdate",v[0])};i.requestAnimationFrame?i.requestAnimationFrame(S):i.setTimeout(S,0)});y.observe(f,{attributes:typeof p.attributes>"u"?!0:p.attributes,childList:e.isElement||(typeof p.childList>"u"?!0:p).childList,characterData:typeof p.characterData>"u"?!0:p.characterData}),s.push(y)},c=()=>{if(e.params.observer){if(e.params.observeParents){const f=u_(e.hostEl);for(let p=0;p<f.length;p+=1)l(f[p])}l(e.hostEl,{childList:e.params.observeSlideChildren}),l(e.wrapperEl,{attributes:!1})}},u=()=>{s.forEach(f=>{f.disconnect()}),s.splice(0,s.length)};t({observer:!1,observeParents:!1,observeSlideChildren:!1}),n("init",c),n("destroy",u)}var g_={on(e,t,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof t!="function")return r;const s=n?"unshift":"push";return e.split(" ").forEach(i=>{r.eventsListeners[i]||(r.eventsListeners[i]=[]),r.eventsListeners[i][s](t)}),r},once(e,t,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof t!="function")return r;function s(...i){r.off(e,s),s.__emitterProxy&&delete s.__emitterProxy,t.apply(r,i)}return s.__emitterProxy=t,r.on(e,s,n)},onAny(e,t){const n=this;if(!n.eventsListeners||n.destroyed||typeof e!="function")return n;const r=t?"unshift":"push";return n.eventsAnyListeners.indexOf(e)<0&&n.eventsAnyListeners[r](e),n},offAny(e){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsAnyListeners)return t;const n=t.eventsAnyListeners.indexOf(e);return n>=0&&t.eventsAnyListeners.splice(n,1),t},off(e,t){const n=this;return!n.eventsListeners||n.destroyed||!n.eventsListeners||e.split(" ").forEach(r=>{typeof t>"u"?n.eventsListeners[r]=[]:n.eventsListeners[r]&&n.eventsListeners[r].forEach((s,i)=>{(s===t||s.__emitterProxy&&s.__emitterProxy===t)&&n.eventsListeners[r].splice(i,1)})}),n},emit(...e){const t=this;if(!t.eventsListeners||t.destroyed||!t.eventsListeners)return t;let n,r,s;return typeof e[0]=="string"||Array.isArray(e[0])?(n=e[0],r=e.slice(1,e.length),s=t):(n=e[0].events,r=e[0].data,s=e[0].context||t),r.unshift(s),(Array.isArray(n)?n:n.split(" ")).forEach(l=>{t.eventsAnyListeners&&t.eventsAnyListeners.length&&t.eventsAnyListeners.forEach(c=>{c.apply(s,[l,...r])}),t.eventsListeners&&t.eventsListeners[l]&&t.eventsListeners[l].forEach(c=>{c.apply(s,r)})}),t}};function x_(){const e=this;let t,n;const r=e.el;typeof e.params.width<"u"&&e.params.width!==null?t=e.params.width:t=r.clientWidth,typeof e.params.height<"u"&&e.params.height!==null?n=e.params.height:n=r.clientHeight,!(t===0&&e.isHorizontal()||n===0&&e.isVertical())&&(t=t-parseInt(Uc(r,"padding-left")||0,10)-parseInt(Uc(r,"padding-right")||0,10),n=n-parseInt(Uc(r,"padding-top")||0,10)-parseInt(Uc(r,"padding-bottom")||0,10),Number.isNaN(t)&&(t=0),Number.isNaN(n)&&(n=0),Object.assign(e,{width:t,height:n,size:e.isHorizontal()?t:n}))}function b_(){const e=this;function t(K,V){return parseFloat(K.getPropertyValue(e.getDirectionLabel(V))||0)}const n=e.params,{wrapperEl:r,slidesEl:s,rtlTranslate:i,wrongRTL:l}=e,c=e.virtual&&n.virtual.enabled,u=c?e.virtual.slides.length:e.slides.length,f=mc(s,`.${e.params.slideClass}, swiper-slide`),p=c?e.virtual.slides.length:f.length;let g=[];const y=[],v=[];let S=n.slidesOffsetBefore;typeof S=="function"&&(S=n.slidesOffsetBefore.call(e));let A=n.slidesOffsetAfter;typeof A=="function"&&(A=n.slidesOffsetAfter.call(e));const T=e.snapGrid.length,L=e.slidesGrid.length,I=e.size-S-A;let j=n.spaceBetween,P=-S,F=0,R=0;if(typeof I>"u")return;typeof j=="string"&&j.indexOf("%")>=0?j=parseFloat(j.replace("%",""))/100*I:typeof j=="string"&&(j=parseFloat(j)),e.virtualSize=-j-S-A,f.forEach(K=>{i?K.style.marginLeft="":K.style.marginRight="",K.style.marginBottom="",K.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(fd(r,"--swiper-centered-offset-before",""),fd(r,"--swiper-centered-offset-after","")),n.cssMode&&(fd(r,"--swiper-slides-offset-before",`${S}px`),fd(r,"--swiper-slides-offset-after",`${A}px`));const C=n.grid&&n.grid.rows>1&&e.grid;C?e.grid.initSlides(f):e.grid&&e.grid.unsetSlides();let H;const Q=n.slidesPerView==="auto"&&n.breakpoints&&Object.keys(n.breakpoints).filter(K=>typeof n.breakpoints[K].slidesPerView<"u").length>0;for(let K=0;K<p;K+=1){H=0;const V=f[K];if(!(V&&(C&&e.grid.updateSlide(K,V,f),Uc(V,"display")==="none"))){if(c&&n.slidesPerView==="auto")n.virtual.slidesPerViewAutoSlideSize&&(H=n.virtual.slidesPerViewAutoSlideSize),H&&V&&(n.roundLengths&&(H=Math.floor(H)),V.style[e.getDirectionLabel("width")]=`${H}px`);else if(n.slidesPerView==="auto"){Q&&(V.style[e.getDirectionLabel("width")]="");const he=getComputedStyle(V),X=V.style.transform,pe=V.style.webkitTransform;if(X&&(V.style.transform="none"),pe&&(V.style.webkitTransform="none"),n.roundLengths)H=e.isHorizontal()?Ev(V,"width"):Ev(V,"height");else{const ge=t(he,"width"),de=t(he,"padding-left"),oe=t(he,"padding-right"),W=t(he,"margin-left"),z=t(he,"margin-right"),te=he.getPropertyValue("box-sizing");if(te&&te==="border-box")H=ge+W+z;else{const{clientWidth:ae,offsetWidth:be}=V;H=ge+de+oe+W+z+(be-ae)}}X&&(V.style.transform=X),pe&&(V.style.webkitTransform=pe),n.roundLengths&&(H=Math.floor(H))}else H=(I-(n.slidesPerView-1)*j)/n.slidesPerView,n.roundLengths&&(H=Math.floor(H)),V&&(V.style[e.getDirectionLabel("width")]=`${H}px`);V&&(V.swiperSlideSize=H),v.push(H),n.centeredSlides?(P=P+H/2+F/2+j,F===0&&K!==0&&(P=P-I/2-j),K===0&&(P=P-I/2-j),Math.abs(P)<1/1e3&&(P=0),n.roundLengths&&(P=Math.floor(P)),R%n.slidesPerGroup===0&&g.push(P),y.push(P)):(n.roundLengths&&(P=Math.floor(P)),(R-Math.min(e.params.slidesPerGroupSkip,R))%e.params.slidesPerGroup===0&&g.push(P),y.push(P),P=P+H+j),e.virtualSize+=H+j,F=H,R+=1}}if(e.virtualSize=Math.max(e.virtualSize,I)+A,i&&l&&(n.effect==="slide"||n.effect==="coverflow")&&(r.style.width=`${e.virtualSize+j}px`),n.setWrapperSize&&(r.style[e.getDirectionLabel("width")]=`${e.virtualSize+j}px`),C&&e.grid.updateWrapperSize(H,g),!n.centeredSlides){const K=n.slidesPerView!=="auto"&&n.slidesPerView%1!==0,V=n.snapToSlideEdge&&!n.loop&&(n.slidesPerView==="auto"||K);let he=g.length;if(V){let pe;if(n.slidesPerView==="auto"){pe=1;let ge=0;for(let de=v.length-1;de>=0&&(ge+=v[de]+(de<v.length-1?j:0),ge<=I);de-=1)pe=v.length-de}else pe=Math.floor(n.slidesPerView);he=Math.max(p-pe,0)}const X=[];for(let pe=0;pe<g.length;pe+=1){let ge=g[pe];n.roundLengths&&(ge=Math.floor(ge)),V?pe<=he&&X.push(ge):g[pe]<=e.virtualSize-I&&X.push(ge)}g=X,Math.floor(e.virtualSize-I)-Math.floor(g[g.length-1])>1&&(V||g.push(e.virtualSize-I))}if(c&&n.loop){const K=v[0]+j;if(n.slidesPerGroup>1){const V=Math.ceil((e.virtual.slidesBefore+e.virtual.slidesAfter)/n.slidesPerGroup),he=K*n.slidesPerGroup;for(let X=0;X<V;X+=1)g.push(g[g.length-1]+he)}for(let V=0;V<e.virtual.slidesBefore+e.virtual.slidesAfter;V+=1)n.slidesPerGroup===1&&g.push(g[g.length-1]+K),y.push(y[y.length-1]+K),e.virtualSize+=K}if(g.length===0&&(g=[0]),j!==0){const K=e.isHorizontal()&&i?"marginLeft":e.getDirectionLabel("marginRight");f.filter((V,he)=>!n.cssMode||n.loop?!0:he!==f.length-1).forEach(V=>{V.style[K]=`${j}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let K=0;v.forEach(he=>{K+=he+(j||0)}),K-=j;const V=K>I?K-I:0;g=g.map(he=>he<=0?-S:he>V?V+A:he)}if(n.centerInsufficientSlides){let K=0;if(v.forEach(V=>{K+=V+(j||0)}),K-=j,K<I){const V=(I-K)/2;g.forEach((he,X)=>{g[X]=he-V}),y.forEach((he,X)=>{y[X]=he+V})}}if(Object.assign(e,{slides:f,snapGrid:g,slidesGrid:y,slidesSizesGrid:v}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){fd(r,"--swiper-centered-offset-before",`${-g[0]}px`),fd(r,"--swiper-centered-offset-after",`${e.size/2-v[v.length-1]/2}px`);const K=-e.snapGrid[0],V=-e.slidesGrid[0];e.snapGrid=e.snapGrid.map(he=>he+K),e.slidesGrid=e.slidesGrid.map(he=>he+V)}if(p!==u&&e.emit("slidesLengthChange"),g.length!==T&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),y.length!==L&&e.emit("slidesGridLengthChange"),n.watchSlidesProgress&&e.updateSlidesOffset(),e.emit("slidesUpdated"),!c&&!n.cssMode&&(n.effect==="slide"||n.effect==="fade")){const K=`${n.containerModifierClass}backface-hidden`,V=e.el.classList.contains(K);p<=n.maxBackfaceHiddenSlides?V||e.el.classList.add(K):V&&e.el.classList.remove(K)}}function y_(e){const t=this,n=[],r=t.virtual&&t.params.virtual.enabled;let s=0,i;typeof e=="number"?t.setTransition(e):e===!0&&t.setTransition(t.params.speed);const l=c=>r?t.slides[t.getSlideIndexByData(c)]:t.slides[c];if(t.params.slidesPerView!=="auto"&&t.params.slidesPerView>1)if(t.params.centeredSlides)(t.visibleSlides||[]).forEach(c=>{n.push(c)});else for(i=0;i<Math.ceil(t.params.slidesPerView);i+=1){const c=t.activeIndex+i;if(c>t.slides.length&&!r)break;n.push(l(c))}else n.push(l(t.activeIndex));for(i=0;i<n.length;i+=1)if(typeof n[i]<"u"){const c=n[i].offsetHeight;s=c>s?c:s}(s||s===0)&&(t.wrapperEl.style.height=`${s}px`)}function v_(){const e=this,t=e.slides,n=e.isElement?e.isHorizontal()?e.wrapperEl.offsetLeft:e.wrapperEl.offsetTop:0;for(let r=0;r<t.length;r+=1)t[r].swiperSlideOffset=(e.isHorizontal()?t[r].offsetLeft:t[r].offsetTop)-n-e.cssOverflowAdjustment()}const Rv=(e,t,n)=>{t&&!e.classList.contains(n)?e.classList.add(n):!t&&e.classList.contains(n)&&e.classList.remove(n)};function w_(e=this&&this.translate||0){const t=this,n=t.params,{slides:r,rtlTranslate:s,snapGrid:i}=t;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&t.updateSlidesOffset();let l=-e;s&&(l=e),t.visibleSlidesIndexes=[],t.visibleSlides=[];let c=n.spaceBetween;typeof c=="string"&&c.indexOf("%")>=0?c=parseFloat(c.replace("%",""))/100*t.size:typeof c=="string"&&(c=parseFloat(c));for(let u=0;u<r.length;u+=1){const f=r[u];let p=f.swiperSlideOffset;n.cssMode&&n.centeredSlides&&(p-=r[0].swiperSlideOffset);const g=(l+(n.centeredSlides?t.minTranslate():0)-p)/(f.swiperSlideSize+c),y=(l-i[0]+(n.centeredSlides?t.minTranslate():0)-p)/(f.swiperSlideSize+c),v=-(l-p),S=v+t.slidesSizesGrid[u],A=v>=0&&v<=t.size-t.slidesSizesGrid[u],T=v>=0&&v<t.size-1||S>1&&S<=t.size||v<=0&&S>=t.size;T&&(t.visibleSlides.push(f),t.visibleSlidesIndexes.push(u)),Rv(f,T,n.slideVisibleClass),Rv(f,A,n.slideFullyVisibleClass),f.progress=s?-g:g,f.originalProgress=s?-y:y}}function S_(e){const t=this;if(typeof e>"u"){const p=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*p||0}const n=t.params,r=t.maxTranslate()-t.minTranslate();let{progress:s,isBeginning:i,isEnd:l,progressLoop:c}=t;const u=i,f=l;if(r===0)s=0,i=!0,l=!0;else{s=(e-t.minTranslate())/r;const p=Math.abs(e-t.minTranslate())<1,g=Math.abs(e-t.maxTranslate())<1;i=p||s<=0,l=g||s>=1,p&&(s=0),g&&(s=1)}if(n.loop){const p=t.getSlideIndexByData(0),g=t.getSlideIndexByData(t.slides.length-1),y=t.slidesGrid[p],v=t.slidesGrid[g],S=t.slidesGrid[t.slidesGrid.length-1],A=Math.abs(e);A>=y?c=(A-y)/S:c=(A+S-v)/S,c>1&&(c-=1)}Object.assign(t,{progress:s,progressLoop:c,isBeginning:i,isEnd:l}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&t.updateSlidesProgress(e),i&&!u&&t.emit("reachBeginning toEdge"),l&&!f&&t.emit("reachEnd toEdge"),(u&&!i||f&&!l)&&t.emit("fromEdge"),t.emit("progress",s)}const w1=(e,t,n)=>{t&&!e.classList.contains(n)?e.classList.add(n):!t&&e.classList.contains(n)&&e.classList.remove(n)};function A_(){const e=this,{slides:t,params:n,slidesEl:r,activeIndex:s}=e,i=e.virtual&&n.virtual.enabled,l=e.grid&&n.grid&&n.grid.rows>1,c=g=>mc(r,`.${n.slideClass}${g}, swiper-slide${g}`)[0];let u,f,p;if(i)if(n.loop){let g=s-e.virtual.slidesBefore;g<0&&(g=e.virtual.slides.length+g),g>=e.virtual.slides.length&&(g-=e.virtual.slides.length),u=c(`[data-swiper-slide-index="${g}"]`)}else u=c(`[data-swiper-slide-index="${s}"]`);else l?(u=t.find(g=>g.column===s),p=t.find(g=>g.column===s+1),f=t.find(g=>g.column===s-1)):u=t[s];u&&(l||(p=c_(u,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!p&&(p=t[0]),f=l_(u,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!f===0&&(f=t[t.length-1]))),t.forEach(g=>{w1(g,g===u,n.slideActiveClass),w1(g,g===p,n.slideNextClass),w1(g,g===f,n.slidePrevClass)}),e.emitSlidesClasses()}const Yp=(e,t)=>{if(!e||e.destroyed||!e.params)return;const n=()=>e.isElement?"swiper-slide":`.${e.params.slideClass}`,r=t.closest(n());if(r){let s=r.querySelector(`.${e.params.lazyPreloaderClass}`);!s&&e.isElement&&(r.shadowRoot?s=r.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(s=r.shadowRoot.querySelector(`.${e.params.lazyPreloaderClass}`),s&&!s.lazyPreloaderManaged&&s.remove())})),s&&!s.lazyPreloaderManaged&&s.remove()}},S1=(e,t)=>{if(!e.slides[t])return;const n=e.slides[t].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},db=e=>{if(!e||e.destroyed||!e.params)return;let t=e.params.lazyPreloadPrevNext;const n=e.slides.length;if(!n||!t||t<0)return;t=Math.min(t,n);const r=e.params.slidesPerView==="auto"?e.slidesPerViewDynamic():Math.ceil(e.params.slidesPerView),s=e.activeIndex;if(e.params.grid&&e.params.grid.rows>1){const l=s,c=[l-t];c.push(...Array.from({length:t}).map((u,f)=>l+r+f)),e.slides.forEach((u,f)=>{c.includes(u.column)&&S1(e,f)});return}const i=s+r-1;if(e.params.rewind||e.params.loop)for(let l=s-t;l<=i+t;l+=1){const c=(l%n+n)%n;(c<s||c>i)&&S1(e,c)}else for(let l=Math.max(s-t,0);l<=Math.min(i+t,n-1);l+=1)l!==s&&(l>i||l<s)&&S1(e,l)};function T_(e){const{slidesGrid:t,params:n}=e,r=e.rtlTranslate?e.translate:-e.translate;let s;for(let i=0;i<t.length;i+=1)typeof t[i+1]<"u"?r>=t[i]&&r<t[i+1]-(t[i+1]-t[i])/2?s=i:r>=t[i]&&r<t[i+1]&&(s=i+1):r>=t[i]&&(s=i);return n.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function C_(e){const t=this,n=t.rtlTranslate?t.translate:-t.translate,{snapGrid:r,params:s,activeIndex:i,realIndex:l,snapIndex:c}=t;let u=e,f;const p=v=>{let S=v-t.virtual.slidesBefore;return S<0&&(S=t.virtual.slides.length+S),S>=t.virtual.slides.length&&(S-=t.virtual.slides.length),S};if(typeof u>"u"&&(u=T_(t)),r.indexOf(n)>=0)f=r.indexOf(n);else{const v=Math.min(s.slidesPerGroupSkip,u);f=v+Math.floor((u-v)/s.slidesPerGroup)}if(f>=r.length&&(f=r.length-1),u===i&&!t.params.loop){f!==c&&(t.snapIndex=f,t.emit("snapIndexChange"));return}if(u===i&&t.params.loop&&t.virtual&&t.params.virtual.enabled){t.realIndex=p(u);return}const g=t.grid&&s.grid&&s.grid.rows>1;let y;if(t.virtual&&s.virtual.enabled)s.loop?y=p(u):y=u;else if(g){const v=t.slides.find(A=>A.column===u);let S=parseInt(v.getAttribute("data-swiper-slide-index"),10);Number.isNaN(S)&&(S=Math.max(t.slides.indexOf(v),0)),y=Math.floor(S/s.grid.rows)}else if(t.slides[u]){const v=t.slides[u].getAttribute("data-swiper-slide-index");v?y=parseInt(v,10):y=u}else y=u;Object.assign(t,{previousSnapIndex:c,snapIndex:f,previousRealIndex:l,realIndex:y,previousIndex:i,activeIndex:u}),t.initialized&&db(t),t.emit("activeIndexChange"),t.emit("snapIndexChange"),(t.initialized||t.params.runCallbacksOnInit)&&(l!==y&&t.emit("realIndexChange"),t.emit("slideChange"))}function k_(e,t){const n=this,r=n.params;let s=e.closest(`.${r.slideClass}, swiper-slide`);!s&&n.isElement&&t&&t.length>1&&t.includes(e)&&[...t.slice(t.indexOf(e)+1,t.length)].forEach(c=>{!s&&c.matches&&c.matches(`.${r.slideClass}, swiper-slide`)&&(s=c)});let i=!1,l;if(s){for(let c=0;c<n.slides.length;c+=1)if(n.slides[c]===s){i=!0,l=c;break}}if(s&&i)n.clickedSlide=s,n.virtual&&n.params.virtual.enabled?n.clickedIndex=parseInt(s.getAttribute("data-swiper-slide-index"),10):n.clickedIndex=l;else{n.clickedSlide=void 0,n.clickedIndex=void 0;return}r.slideToClickedSlide&&n.clickedIndex!==void 0&&n.clickedIndex!==n.activeIndex&&n.slideToClickedSlide()}var __={updateSize:x_,updateSlides:b_,updateAutoHeight:y_,updateSlidesOffset:v_,updateSlidesProgress:w_,updateProgress:S_,updateSlidesClasses:A_,updateActiveIndex:C_,updateClickedSlide:k_};function L_(e=this.isHorizontal()?"x":"y"){const t=this,{params:n,rtlTranslate:r,translate:s,wrapperEl:i}=t;if(n.virtualTranslate)return r?-s:s;if(n.cssMode)return s;let l=s_(i,e);return l+=t.cssOverflowAdjustment(),r&&(l=-l),l||0}function E_(e,t){const n=this,{rtlTranslate:r,params:s,wrapperEl:i,progress:l}=n;let c=0,u=0;const f=0;n.isHorizontal()?c=r?-e:e:u=e,s.roundLengths&&(c=Math.floor(c),u=Math.floor(u)),n.previousTranslate=n.translate,n.translate=n.isHorizontal()?c:u,s.cssMode?i[n.isHorizontal()?"scrollLeft":"scrollTop"]=n.isHorizontal()?-c:-u:s.virtualTranslate||(n.isHorizontal()?c-=n.cssOverflowAdjustment():u-=n.cssOverflowAdjustment(),i.style.transform=`translate3d(${c}px, ${u}px, ${f}px)`);let p;const g=n.maxTranslate()-n.minTranslate();g===0?p=0:p=(e-n.minTranslate())/g,p!==l&&n.updateProgress(e),n.emit("setTranslate",n.translate,t)}function I_(){return-this.snapGrid[0]}function R_(){return-this.snapGrid[this.snapGrid.length-1]}function N_(e=0,t=this.params.speed,n=!0,r=!0,s){const i=this,{params:l,wrapperEl:c}=i;if(i.animating&&l.preventInteractionOnTransition)return!1;const u=i.minTranslate(),f=i.maxTranslate();let p;if(r&&e>u?p=u:r&&e<f?p=f:p=e,i.updateProgress(p),l.cssMode){const g=i.isHorizontal();if(t===0)c[g?"scrollLeft":"scrollTop"]=-p;else{if(!i.support.smoothScroll)return v7({swiper:i,targetPosition:-p,side:g?"left":"top"}),!0;c.scrollTo({[g?"left":"top"]:-p,behavior:"smooth"})}return!0}return t===0?(i.setTransition(0),i.setTranslate(p),n&&(i.emit("beforeTransitionStart",t,s),i.emit("transitionEnd"))):(i.setTransition(t),i.setTranslate(p),n&&(i.emit("beforeTransitionStart",t,s),i.emit("transitionStart")),i.animating||(i.animating=!0,i.onTranslateToWrapperTransitionEnd||(i.onTranslateToWrapperTransitionEnd=function(y){!i||i.destroyed||y.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onTranslateToWrapperTransitionEnd),i.onTranslateToWrapperTransitionEnd=null,delete i.onTranslateToWrapperTransitionEnd,i.animating=!1,n&&i.emit("transitionEnd"))}),i.wrapperEl.addEventListener("transitionend",i.onTranslateToWrapperTransitionEnd))),!0}var M_={getTranslate:L_,setTranslate:E_,minTranslate:I_,maxTranslate:R_,translateTo:N_};function D_(e,t){const n=this;n.params.cssMode||(n.wrapperEl.style.transitionDuration=`${e}ms`,n.wrapperEl.style.transitionDelay=e===0?"0ms":""),n.emit("setTransition",e,t)}function T7({swiper:e,runCallbacks:t,direction:n,step:r}){const{activeIndex:s,previousIndex:i}=e;let l=n;l||(s>i?l="next":s<i?l="prev":l="reset"),e.emit(`transition${r}`),t&&l==="reset"?e.emit(`slideResetTransition${r}`):t&&s!==i&&(e.emit(`slideChangeTransition${r}`),l==="next"?e.emit(`slideNextTransition${r}`):e.emit(`slidePrevTransition${r}`))}function j_(e=!0,t){const n=this,{params:r}=n;r.cssMode||(r.autoHeight&&n.updateAutoHeight(),T7({swiper:n,runCallbacks:e,direction:t,step:"Start"}))}function P_(e=!0,t){const n=this,{params:r}=n;n.animating=!1,!r.cssMode&&(n.setTransition(0),T7({swiper:n,runCallbacks:e,direction:t,step:"End"}))}var B_={setTransition:D_,transitionStart:j_,transitionEnd:P_};function F_(e=0,t,n=!0,r,s){typeof e=="string"&&(e=parseInt(e,10));const i=this;let l=e;l<0&&(l=0);const{params:c,snapGrid:u,slidesGrid:f,previousIndex:p,activeIndex:g,rtlTranslate:y,wrapperEl:v,enabled:S}=i;if(!S&&!r&&!s||i.destroyed||i.animating&&c.preventInteractionOnTransition)return!1;typeof t>"u"&&(t=i.params.speed);const A=Math.min(i.params.slidesPerGroupSkip,l);let T=A+Math.floor((l-A)/i.params.slidesPerGroup);T>=u.length&&(T=u.length-1);const L=-u[T];if(c.normalizeSlideIndex)for(let C=0;C<f.length;C+=1){const H=-Math.floor(L*100),Q=Math.floor(f[C]*100),K=Math.floor(f[C+1]*100);typeof f[C+1]<"u"?H>=Q&&H<K-(K-Q)/2?l=C:H>=Q&&H<K&&(l=C+1):H>=Q&&(l=C)}if(i.initialized&&l!==g&&(!i.allowSlideNext&&(y?L>i.translate&&L>i.minTranslate():L<i.translate&&L<i.minTranslate())||!i.allowSlidePrev&&L>i.translate&&L>i.maxTranslate()&&(g||0)!==l))return!1;l!==(p||0)&&n&&i.emit("beforeSlideChangeStart"),i.updateProgress(L);let I;l>g?I="next":l<g?I="prev":I="reset";const j=i.virtual&&i.params.virtual.enabled;if(!(j&&s)&&(y&&-L===i.translate||!y&&L===i.translate))return i.updateActiveIndex(l),c.autoHeight&&i.updateAutoHeight(),i.updateSlidesClasses(),c.effect!=="slide"&&i.setTranslate(L),I!=="reset"&&(i.transitionStart(n,I),i.transitionEnd(n,I)),!1;if(c.cssMode){const C=i.isHorizontal(),H=y?L:-L;if(t===0)j&&(i.wrapperEl.style.scrollSnapType="none",i._immediateVirtual=!0),j&&!i._cssModeVirtualInitialSet&&i.params.initialSlide>0?(i._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{v[C?"scrollLeft":"scrollTop"]=H})):v[C?"scrollLeft":"scrollTop"]=H,j&&requestAnimationFrame(()=>{i.wrapperEl.style.scrollSnapType="",i._immediateVirtual=!1});else{if(!i.support.smoothScroll)return v7({swiper:i,targetPosition:H,side:C?"left":"top"}),!0;v.scrollTo({[C?"left":"top"]:H,behavior:"smooth"})}return!0}const R=A7().isSafari;return j&&!s&&R&&i.isElement&&i.virtual.update(!1,!1,l),i.setTransition(t),i.setTranslate(L),i.updateActiveIndex(l),i.updateSlidesClasses(),i.emit("beforeTransitionStart",t,r),i.transitionStart(n,I),t===0?i.transitionEnd(n,I):i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(H){!i||i.destroyed||H.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(n,I))}),i.wrapperEl.addEventListener("transitionend",i.onSlideToWrapperTransitionEnd)),!0}function O_(e=0,t,n=!0,r){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 l=e;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)l=l+s.virtual.slidesBefore;else{let c;if(i){const A=l*s.params.grid.rows;c=s.slides.find(T=>T.getAttribute("data-swiper-slide-index")*1===A).column}else c=s.getSlideIndexByData(l);const u=i?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:f,slidesOffsetBefore:p,slidesOffsetAfter:g}=s.params,y=f||!!p||!!g;let v=s.params.slidesPerView;v==="auto"?v=s.slidesPerViewDynamic():(v=Math.ceil(parseFloat(s.params.slidesPerView,10)),y&&v%2===0&&(v=v+1));let S=u-c<v;if(y&&(S=S||c<Math.ceil(v/2)),r&&y&&s.params.slidesPerView!=="auto"&&!i&&(S=!1),S){const A=y?c<s.activeIndex?"prev":"next":c-s.activeIndex-1<s.params.slidesPerView?"next":"prev";s.loopFix({direction:A,slideTo:!0,activeSlideIndex:A==="next"?c+1:c-u+1,slideRealIndex:A==="next"?s.realIndex:void 0})}if(i){const A=l*s.params.grid.rows;l=s.slides.find(T=>T.getAttribute("data-swiper-slide-index")*1===A).column}else l=s.getSlideIndexByData(l)}return requestAnimationFrame(()=>{s.slideTo(l,t,n,r)}),s}function Q_(e,t=!0,n){const r=this,{enabled:s,params:i,animating:l}=r;if(!s||r.destroyed)return r;typeof e>"u"&&(e=r.params.speed);let c=i.slidesPerGroup;i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(c=Math.max(r.slidesPerViewDynamic("current",!0),1));const u=r.activeIndex<i.slidesPerGroupSkip?1:c,f=r.virtual&&i.virtual.enabled;if(i.loop){if(l&&!f&&i.loopPreventsSliding)return!1;if(r.loopFix({direction:"next"}),r._clientLeft=r.wrapperEl.clientLeft,r.activeIndex===r.slides.length-1&&i.cssMode)return requestAnimationFrame(()=>{r.slideTo(r.activeIndex+u,e,t,n)}),!0}return i.rewind&&r.isEnd?r.slideTo(0,e,t,n):r.slideTo(r.activeIndex+u,e,t,n)}function $_(e,t=!0,n){const r=this,{params:s,snapGrid:i,slidesGrid:l,rtlTranslate:c,enabled:u,animating:f}=r;if(!u||r.destroyed)return r;typeof e>"u"&&(e=r.params.speed);const p=r.virtual&&s.virtual.enabled;if(s.loop){if(f&&!p&&s.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const g=c?r.translate:-r.translate;function y(I){return I<0?-Math.floor(Math.abs(I)):Math.floor(I)}const v=y(g),S=i.map(I=>y(I)),A=s.freeMode&&s.freeMode.enabled;let T=i[S.indexOf(v)-1];if(typeof T>"u"&&(s.cssMode||A)){let I;i.forEach((j,P)=>{v>=j&&(I=P)}),typeof I<"u"&&(T=A?i[I]:i[I>0?I-1:I])}let L=0;if(typeof T<"u"&&(L=l.indexOf(T),L<0&&(L=r.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(L=L-r.slidesPerViewDynamic("previous",!0)+1,L=Math.max(L,0))),s.rewind&&r.isBeginning){const I=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(I,e,t,n)}else if(s.loop&&r.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{r.slideTo(L,e,t,n)}),!0;return r.slideTo(L,e,t,n)}function H_(e,t=!0,n){const r=this;if(!r.destroyed)return typeof e>"u"&&(e=r.params.speed),r.slideTo(r.activeIndex,e,t,n)}function U_(e,t=!0,n,r=.5){const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);let i=s.activeIndex;const l=Math.min(s.params.slidesPerGroupSkip,i),c=l+Math.floor((i-l)/s.params.slidesPerGroup),u=s.rtlTranslate?s.translate:-s.translate;if(u>=s.snapGrid[c]){const f=s.snapGrid[c],p=s.snapGrid[c+1];u-f>(p-f)*r&&(i+=s.params.slidesPerGroup)}else{const f=s.snapGrid[c-1],p=s.snapGrid[c];u-f<=(p-f)*r&&(i-=s.params.slidesPerGroup)}return i=Math.max(i,0),i=Math.min(i,s.slidesGrid.length-1),s.slideTo(i,e,t,n)}function z_(){const e=this;if(e.destroyed)return;const{params:t,slidesEl:n}=e,r=t.slidesPerView==="auto"?e.slidesPerViewDynamic():t.slidesPerView;let s=e.getSlideIndexWhenGrid(e.clickedIndex),i;const l=e.isElement?"swiper-slide":`.${t.slideClass}`,c=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>(c?(e.slides.length-r)/2-(e.params.grid.rows-1):e.slides.length-r)?(e.loopFix(),s=e.getSlideIndex(mc(n,`${l}[data-swiper-slide-index="${i}"]`)[0]),y7(()=>{e.slideTo(s)})):e.slideTo(s)}else e.slideTo(s)}var G_={slideTo:F_,slideToLoop:O_,slideNext:Q_,slidePrev:$_,slideReset:H_,slideToClosest:U_,slideToClickedSlide:z_};function W_(e,t){const n=this,{params:r,slidesEl:s}=n;if(!r.loop||n.virtual&&n.params.virtual.enabled)return;const i=()=>{mc(s,`.${r.slideClass}, swiper-slide`).forEach((S,A)=>{S.setAttribute("data-swiper-slide-index",A)})},l=()=>{const v=mc(s,`.${r.slideBlankClass}`);v.forEach(S=>{S.remove()}),v.length>0&&(n.recalcSlides(),n.updateSlides())},c=n.grid&&r.grid&&r.grid.rows>1;r.loopAddBlankSlides&&(r.slidesPerGroup>1||c)&&l();const u=r.slidesPerGroup*(c?r.grid.rows:1),f=n.slides.length%u!==0,p=c&&n.slides.length%r.grid.rows!==0,g=v=>{for(let S=0;S<v;S+=1){const A=n.isElement?ub("swiper-slide",[r.slideBlankClass]):ub("div",[r.slideClass,r.slideBlankClass]);n.slidesEl.append(A)}};if(f){if(r.loopAddBlankSlides){const v=u-n.slides.length%u;g(v),n.recalcSlides(),n.updateSlides()}else wm("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(p){if(r.loopAddBlankSlides){const v=r.grid.rows-n.slides.length%r.grid.rows;g(v),n.recalcSlides(),n.updateSlides()}else wm("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 y=r.centeredSlides||!!r.slidesOffsetBefore||!!r.slidesOffsetAfter;n.loopFix({slideRealIndex:e,direction:y?void 0:"next",initial:t})}function V_({slideRealIndex:e,slideTo:t=!0,direction:n,setTranslate:r,activeSlideIndex:s,initial:i,byController:l,byMousewheel:c}={}){const u=this;if(!u.params.loop)return;u.emit("beforeLoopFix");const{slides:f,allowSlidePrev:p,allowSlideNext:g,slidesEl:y,params:v}=u,{centeredSlides:S,slidesOffsetBefore:A,slidesOffsetAfter:T,initialSlide:L}=v,I=S||!!A||!!T;if(u.allowSlidePrev=!0,u.allowSlideNext=!0,u.virtual&&v.virtual.enabled){t&&(!I&&u.snapIndex===0?u.slideTo(u.virtual.slides.length,0,!1,!0):I&&u.snapIndex<v.slidesPerView?u.slideTo(u.virtual.slides.length+u.snapIndex,0,!1,!0):u.snapIndex===u.snapGrid.length-1&&u.slideTo(u.virtual.slidesBefore,0,!1,!0)),u.allowSlidePrev=p,u.allowSlideNext=g,u.emit("loopFix");return}let j=v.slidesPerView;j==="auto"?j=u.slidesPerViewDynamic():(j=Math.ceil(parseFloat(v.slidesPerView,10)),I&&j%2===0&&(j=j+1));const P=v.slidesPerGroupAuto?j:v.slidesPerGroup;let F=I?Math.max(P,Math.ceil(j/2)):P;F%P!==0&&(F+=P-F%P),F+=v.loopAdditionalSlides,u.loopedSlides=F;const R=u.grid&&v.grid&&v.grid.rows>1;f.length<j+F||u.params.effect==="cards"&&f.length<j+F*2?wm("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"):R&&v.grid.fill==="row"&&wm("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const C=[],H=[],Q=R?Math.ceil(f.length/v.grid.rows):f.length,K=i&&Q-L<j&&!I;let V=K?L:u.activeIndex;typeof s>"u"?s=u.getSlideIndex(f.find(W=>W.classList.contains(v.slideActiveClass))):V=s;const he=n==="next"||!n,X=n==="prev"||!n;let pe=0,ge=0;const oe=(R?f[s].column:s)+(I&&typeof r>"u"?-j/2+.5:0);if(oe<F){pe=Math.max(F-oe,P);for(let W=0;W<F-oe;W+=1){const z=W-Math.floor(W/Q)*Q;if(R){const te=Q-z-1;for(let ae=f.length-1;ae>=0;ae-=1)f[ae].column===te&&C.push(ae)}else C.push(Q-z-1)}}else if(oe+j>Q-F){ge=Math.max(oe-(Q-F*2),P),K&&(ge=Math.max(ge,j-Q+L+1));for(let W=0;W<ge;W+=1){const z=W-Math.floor(W/Q)*Q;R?f.forEach((te,ae)=>{te.column===z&&H.push(ae)}):H.push(z)}}if(u.__preventObserver__=!0,requestAnimationFrame(()=>{u.__preventObserver__=!1}),u.params.effect==="cards"&&f.length<j+F*2&&(H.includes(s)&&H.splice(H.indexOf(s),1),C.includes(s)&&C.splice(C.indexOf(s),1)),X&&C.forEach(W=>{f[W].swiperLoopMoveDOM=!0,y.prepend(f[W]),f[W].swiperLoopMoveDOM=!1}),he&&H.forEach(W=>{f[W].swiperLoopMoveDOM=!0,y.append(f[W]),f[W].swiperLoopMoveDOM=!1}),u.recalcSlides(),v.slidesPerView==="auto"?u.updateSlides():R&&(C.length>0&&X||H.length>0&&he)&&u.slides.forEach((W,z)=>{u.grid.updateSlide(z,W,u.slides)}),v.watchSlidesProgress&&u.updateSlidesOffset(),t){if(C.length>0&&X){if(typeof e>"u"){const W=u.slidesGrid[V],te=u.slidesGrid[V+pe]-W;c?u.setTranslate(u.translate-te):(u.slideTo(V+Math.ceil(pe),0,!1,!0),r&&(u.touchEventsData.startTranslate=u.touchEventsData.startTranslate-te,u.touchEventsData.currentTranslate=u.touchEventsData.currentTranslate-te))}else if(r){const W=R?C.length/v.grid.rows:C.length;u.slideTo(u.activeIndex+W,0,!1,!0),u.touchEventsData.currentTranslate=u.translate}}else if(H.length>0&&he)if(typeof e>"u"){const W=u.slidesGrid[V],te=u.slidesGrid[V-ge]-W;c?u.setTranslate(u.translate-te):(u.slideTo(V-ge,0,!1,!0),r&&(u.touchEventsData.startTranslate=u.touchEventsData.startTranslate-te,u.touchEventsData.currentTranslate=u.touchEventsData.currentTranslate-te))}else{const W=R?H.length/v.grid.rows:H.length;u.slideTo(u.activeIndex-W,0,!1,!0)}}if(u.allowSlidePrev=p,u.allowSlideNext=g,u.controller&&u.controller.control&&!l){const W={slideRealIndex:e,direction:n,setTranslate:r,activeSlideIndex:s,byController:!0};Array.isArray(u.controller.control)?u.controller.control.forEach(z=>{!z.destroyed&&z.params.loop&&z.loopFix({...W,slideTo:z.params.slidesPerView===v.slidesPerView?t:!1})}):u.controller.control instanceof u.constructor&&u.controller.control.params.loop&&u.controller.control.loopFix({...W,slideTo:u.controller.control.params.slidesPerView===v.slidesPerView?t:!1})}u.emit("loopFix")}function q_(){const e=this,{params:t,slidesEl:n}=e;if(!t.loop||!n||e.virtual&&e.params.virtual.enabled)return;e.recalcSlides();const r=[];e.slides.forEach(s=>{const i=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;r[i]=s}),e.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),r.forEach(s=>{n.append(s)}),e.recalcSlides(),e.slideTo(e.realIndex,0)}var Y_={loopCreate:W_,loopFix:V_,loopDestroy:q_};function K_(e){const t=this;if(!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)return;const n=t.params.touchEventsTarget==="container"?t.el:t.wrapperEl;t.isElement&&(t.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=e?"grabbing":"grab",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1})}function X_(){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 Z_={setGrabCursor:K_,unsetGrabCursor:X_};function J_(e,t=this){function n(r){if(!r||r===zu()||r===$o())return null;r.assignedSlot&&(r=r.assignedSlot);const s=r.closest(e);return!s&&!r.getRootNode?null:s||n(r.getRootNode().host)}return n(t)}function Nv(e,t,n){const r=$o(),{params:s}=e,i=s.edgeSwipeDetection,l=s.edgeSwipeThreshold;return i&&(n<=l||n>=r.innerWidth-l)?i==="prevent"?(t.preventDefault(),!0):!1:!0}function eL(e){const t=this;if(t.destroyed)return;const n=zu();let r=e;r.originalEvent&&(r=r.originalEvent);const s=t.touchEventsData;if(r.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==r.pointerId)return;s.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(s.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){Nv(t,r,r.targetTouches[0].pageX);return}const{params:i,touches:l,enabled:c}=t;if(!c||!i.simulateTouch&&r.pointerType==="mouse"||t.animating&&i.preventInteractionOnTransition)return;!t.animating&&i.cssMode&&i.loop&&t.loopFix();let u=r.target;if(i.touchEventsTarget==="wrapper"&&!a_(u,t.wrapperEl)||"which"in r&&r.which===3||"button"in r&&r.button>0||s.isTouched&&s.isMoved)return;const f=!!i.noSwipingClass&&i.noSwipingClass!=="",p=r.composedPath?r.composedPath():r.path;f&&r.target&&r.target.shadowRoot&&p&&(u=p[0]);const g=i.noSwipingSelector?i.noSwipingSelector:`.${i.noSwipingClass}`,y=!!(r.target&&r.target.shadowRoot);if(i.noSwiping&&(y?J_(g,u):u.closest(g))){t.allowClick=!0;return}if(i.swipeHandler&&!u.closest(i.swipeHandler))return;l.currentX=r.pageX,l.currentY=r.pageY;const v=l.currentX,S=l.currentY;if(!Nv(t,r,v))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),l.startX=v,l.startY=S,s.touchStartTime=vm(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,i.threshold>0&&(s.allowThresholdMove=!1);let A=!0;u.matches(s.focusableElements)&&(A=!1,u.nodeName==="SELECT"&&(s.isTouched=!1)),n.activeElement&&n.activeElement.matches(s.focusableElements)&&n.activeElement!==u&&(r.pointerType==="mouse"||r.pointerType!=="mouse"&&!u.matches(s.focusableElements))&&n.activeElement.blur();const T=A&&t.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||T)&&!u.isContentEditable&&r.preventDefault(),i.freeMode&&i.freeMode.enabled&&t.freeMode&&t.animating&&!i.cssMode&&t.freeMode.onTouchStart(),t.emit("touchStart",r)}function tL(e){const t=zu(),n=this;if(n.destroyed)return;const r=n.touchEventsData,{params:s,touches:i,rtlTranslate:l,enabled:c}=n;if(!c||!s.simulateTouch&&e.pointerType==="mouse")return;let u=e;if(u.originalEvent&&(u=u.originalEvent),u.type==="pointermove"&&(r.touchId!==null||u.pointerId!==r.pointerId))return;let f;if(u.type==="touchmove"){if(f=[...u.changedTouches].find(F=>F.identifier===r.touchId),!f||f.identifier!==r.touchId)return}else f=u;if(!r.isTouched){r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",u);return}const p=f.pageX,g=f.pageY;if(u.preventedByNestedSwiper){i.startX=p,i.startY=g;return}if(!n.allowTouchMove){u.target.matches(r.focusableElements)||(n.allowClick=!1),r.isTouched&&(Object.assign(i,{startX:p,startY:g,currentX:p,currentY:g}),r.touchStartTime=vm());return}if(s.touchReleaseOnEdges&&!s.loop)if(n.isVertical()){if(g<i.startY&&n.translate<=n.maxTranslate()||g>i.startY&&n.translate>=n.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else{if(l&&(p>i.startX&&-n.translate<=n.maxTranslate()||p<i.startX&&-n.translate>=n.minTranslate()))return;if(!l&&(p<i.startX&&n.translate<=n.maxTranslate()||p>i.startX&&n.translate>=n.minTranslate()))return}if(t.activeElement&&t.activeElement.matches(r.focusableElements)&&t.activeElement!==u.target&&u.pointerType!=="mouse"&&t.activeElement.blur(),t.activeElement&&u.target===t.activeElement&&u.target.matches(r.focusableElements)){r.isMoved=!0,n.allowClick=!1;return}r.allowTouchCallbacks&&n.emit("touchMove",u),i.previousX=i.currentX,i.previousY=i.currentY,i.currentX=p,i.currentY=g;const y=i.currentX-i.startX,v=i.currentY-i.startY;if(n.params.threshold&&Math.sqrt(y**2+v**2)<n.params.threshold)return;if(typeof r.isScrolling>"u"){let F;n.isHorizontal()&&i.currentY===i.startY||n.isVertical()&&i.currentX===i.startX?r.isScrolling=!1:y*y+v*v>=25&&(F=Math.atan2(Math.abs(v),Math.abs(y))*180/Math.PI,r.isScrolling=n.isHorizontal()?F>s.touchAngle:90-F>s.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",u),typeof r.startMoving>"u"&&(i.currentX!==i.startX||i.currentY!==i.startY)&&(r.startMoving=!0),r.isScrolling||u.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;n.allowClick=!1,!s.cssMode&&u.cancelable&&u.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&u.stopPropagation();let S=n.isHorizontal()?y:v,A=n.isHorizontal()?i.currentX-i.previousX:i.currentY-i.previousY;s.oneWayMovement&&(S=Math.abs(S)*(l?1:-1),A=Math.abs(A)*(l?1:-1)),i.diff=S,S*=s.touchRatio,l&&(S=-S,A=-A);const T=n.touchesDirection;n.swipeDirection=S>0?"prev":"next",n.touchesDirection=A>0?"prev":"next";const L=n.params.loop&&!s.cssMode,I=n.touchesDirection==="next"&&n.allowSlideNext||n.touchesDirection==="prev"&&n.allowSlidePrev;if(!r.isMoved){if(L&&I&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const F=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(F)}r.allowMomentumBounce=!1,s.grabCursor&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!0),n.emit("sliderFirstMove",u)}if(new Date().getTime(),s._loopSwapReset!==!1&&r.isMoved&&r.allowThresholdMove&&T!==n.touchesDirection&&L&&I&&Math.abs(S)>=1){Object.assign(i,{startX:p,startY:g,currentX:p,currentY:g,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}n.emit("sliderMove",u),r.isMoved=!0,r.currentTranslate=S+r.startTranslate;let j=!0,P=s.resistanceRatio;if(s.touchReleaseOnEdges&&(P=0),S>0?(L&&I&&r.allowThresholdMove&&r.currentTranslate>(s.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(j=!1,s.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+S)**P))):S<0&&(L&&I&&r.allowThresholdMove&&r.currentTranslate<(s.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-(s.slidesPerView==="auto"?n.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),r.currentTranslate<n.maxTranslate()&&(j=!1,s.resistance&&(r.currentTranslate=n.maxTranslate()+1-(n.maxTranslate()-r.startTranslate-S)**P))),j&&(u.preventedByNestedSwiper=!0),!n.allowSlideNext&&n.swipeDirection==="next"&&r.currentTranslate<r.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&n.swipeDirection==="prev"&&r.currentTranslate>r.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&!n.allowSlideNext&&(r.currentTranslate=r.startTranslate),s.threshold>0)if(Math.abs(S)>s.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,r.currentTranslate=r.startTranslate,i.diff=n.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY;return}}else{r.currentTranslate=r.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&n.freeMode||s.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function nL(e){const t=this;if(t.destroyed)return;const n=t.touchEventsData;let r=e;r.originalEvent&&(r=r.originalEvent);let s;if(r.type==="touchend"||r.type==="touchcancel"){if(s=[...r.changedTouches].find(F=>F.identifier===n.touchId),!s||s.identifier!==n.touchId)return}else{if(n.touchId!==null||r.pointerId!==n.pointerId)return;s=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(t.browser.isSafari||t.browser.isWebView)))return;n.pointerId=null,n.touchId=null;const{params:l,touches:c,rtlTranslate:u,slidesGrid:f,enabled:p}=t;if(!p||!l.simulateTouch&&r.pointerType==="mouse")return;if(n.allowTouchCallbacks&&t.emit("touchEnd",r),n.allowTouchCallbacks=!1,!n.isTouched){n.isMoved&&l.grabCursor&&t.setGrabCursor(!1),n.isMoved=!1,n.startMoving=!1;return}l.grabCursor&&n.isMoved&&n.isTouched&&(t.allowSlideNext===!0||t.allowSlidePrev===!0)&&t.setGrabCursor(!1);const g=vm(),y=g-n.touchStartTime;if(t.allowClick){const F=r.path||r.composedPath&&r.composedPath();t.updateClickedSlide(F&&F[0]||r.target,F),t.emit("tap click",r),y<300&&g-n.lastClickTime<300&&t.emit("doubleTap doubleClick",r)}if(n.lastClickTime=vm(),y7(()=>{t.destroyed||(t.allowClick=!0)}),!n.isTouched||!n.isMoved||!t.swipeDirection||c.diff===0&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset){n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;return}n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;let v;if(l.followFinger?v=u?t.translate:-t.translate:v=-n.currentTranslate,l.cssMode)return;if(l.freeMode&&l.freeMode.enabled){t.freeMode.onTouchEnd({currentPos:v});return}const S=v>=-t.maxTranslate()&&!t.params.loop;let A=0,T=t.slidesSizesGrid[0];for(let F=0;F<f.length;F+=F<l.slidesPerGroupSkip?1:l.slidesPerGroup){const R=F<l.slidesPerGroupSkip-1?1:l.slidesPerGroup;typeof f[F+R]<"u"?(S||v>=f[F]&&v<f[F+R])&&(A=F,T=f[F+R]-f[F]):(S||v>=f[F])&&(A=F,T=f[f.length-1]-f[f.length-2])}let L=null,I=null;l.rewind&&(t.isBeginning?I=l.virtual&&l.virtual.enabled&&t.virtual?t.virtual.slides.length-1:t.slides.length-1:t.isEnd&&(L=0));const j=(v-f[A])/T,P=A<l.slidesPerGroupSkip-1?1:l.slidesPerGroup;if(y>l.longSwipesMs){if(!l.longSwipes){t.slideTo(t.activeIndex);return}t.swipeDirection==="next"&&(j>=l.longSwipesRatio?t.slideTo(l.rewind&&t.isEnd?L:A+P):t.slideTo(A)),t.swipeDirection==="prev"&&(j>1-l.longSwipesRatio?t.slideTo(A+P):I!==null&&j<0&&Math.abs(j)>l.longSwipesRatio?t.slideTo(I):t.slideTo(A))}else{if(!l.shortSwipes){t.slideTo(t.activeIndex);return}t.navigation&&(r.target===t.navigation.nextEl||r.target===t.navigation.prevEl)?r.target===t.navigation.nextEl?t.slideTo(A+P):t.slideTo(A):(t.swipeDirection==="next"&&t.slideTo(L!==null?L:A+P),t.swipeDirection==="prev"&&t.slideTo(I!==null?I:A))}}function Mv(){const e=this,{params:t,el:n}=e;if(n&&n.offsetWidth===0)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:s,snapGrid:i}=e,l=e.virtual&&e.params.virtual.enabled;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses();const c=l&&t.loop;if((t.slidesPerView==="auto"||t.slidesPerView>1)&&e.isEnd&&!e.isBeginning&&!e.params.centeredSlides&&!c){const u=l?e.virtual.slides:e.slides;e.slideTo(u.length-1,0,!1,!0)}else e.params.loop&&!l?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=r,e.params.watchOverflow&&i!==e.snapGrid&&e.checkOverflow()}function rL(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 sL(){const e=this;if(e.destroyed)return;const{wrapperEl:t,rtlTranslate:n,enabled:r}=e;if(!r)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(n?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}function iL(e){const t=this;t.destroyed||(Yp(t,e.target),!(t.params.cssMode||t.params.slidesPerView!=="auto"&&!t.params.autoHeight)&&t.update())}function oL(){const e=this;e.destroyed||e.documentTouchHandlerProceeded||(e.documentTouchHandlerProceeded=!0,e.params.touchReleaseOnEdges&&(e.el.style.touchAction="auto"))}const C7=(e,t)=>{const n=zu(),{params:r,el:s,wrapperEl:i,device:l}=e,c=!!r.nested,u=t==="on"?"addEventListener":"removeEventListener",f=t;!s||typeof s=="string"||(n[u]("touchstart",e.onDocumentTouchStart,{passive:!1,capture:c}),s[u]("touchstart",e.onTouchStart,{passive:!1}),s[u]("pointerdown",e.onTouchStart,{passive:!1}),n[u]("touchmove",e.onTouchMove,{passive:!1,capture:c}),n[u]("pointermove",e.onTouchMove,{passive:!1,capture:c}),n[u]("touchend",e.onTouchEnd,{passive:!0}),n[u]("pointerup",e.onTouchEnd,{passive:!0}),n[u]("pointercancel",e.onTouchEnd,{passive:!0}),n[u]("touchcancel",e.onTouchEnd,{passive:!0}),n[u]("pointerout",e.onTouchEnd,{passive:!0}),n[u]("pointerleave",e.onTouchEnd,{passive:!0}),n[u]("contextmenu",e.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&s[u]("click",e.onClick,!0),r.cssMode&&i[u]("scroll",e.onScroll),r.updateOnWindowResize?e[f](l.ios||l.android?"resize orientationchange observerUpdate":"resize observerUpdate",Mv,!0):e[f]("observerUpdate",Mv,!0),s[u]("load",e.onLoad,{capture:!0}))};function aL(){const e=this,{params:t}=e;e.onTouchStart=eL.bind(e),e.onTouchMove=tL.bind(e),e.onTouchEnd=nL.bind(e),e.onDocumentTouchStart=oL.bind(e),t.cssMode&&(e.onScroll=sL.bind(e)),e.onClick=rL.bind(e),e.onLoad=iL.bind(e),C7(e,"on")}function lL(){C7(this,"off")}var cL={attachEvents:aL,detachEvents:lL};const Dv=(e,t)=>e.grid&&t.grid&&t.grid.rows>1;function uL(){const e=this,{realIndex:t,initialized:n,params:r,el:s}=e,i=r.breakpoints;if(!i||i&&Object.keys(i).length===0)return;const l=zu(),c=r.breakpointsBase==="window"||!r.breakpointsBase?r.breakpointsBase:"container",u=["window","container"].includes(r.breakpointsBase)||!r.breakpointsBase?e.el:l.querySelector(r.breakpointsBase),f=e.getBreakpoint(i,c,u);if(!f||e.currentBreakpoint===f)return;const g=(f in i?i[f]:void 0)||e.originalParams,y=Dv(e,r),v=Dv(e,g),S=e.params.grabCursor,A=g.grabCursor,T=r.enabled;y&&!v?(s.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),e.emitContainerClasses()):!y&&v&&(s.classList.add(`${r.containerModifierClass}grid`),(g.grid.fill&&g.grid.fill==="column"||!g.grid.fill&&r.grid.fill==="column")&&s.classList.add(`${r.containerModifierClass}grid-column`),e.emitContainerClasses()),S&&!A?e.unsetGrabCursor():!S&&A&&e.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(R=>{if(typeof g[R]>"u")return;const C=r[R]&&r[R].enabled,H=g[R]&&g[R].enabled;C&&!H&&e[R].disable(),!C&&H&&e[R].enable()});const L=g.direction&&g.direction!==r.direction,I=r.loop&&(g.slidesPerView!==r.slidesPerView||L),j=r.loop;L&&n&&e.changeDirection(),Sa(e.params,g);const P=e.params.enabled,F=e.params.loop;Object.assign(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),T&&!P?e.disable():!T&&P&&e.enable(),e.currentBreakpoint=f,e.emit("_beforeBreakpoint",g),n&&(I?(e.loopDestroy(),e.loopCreate(t),e.updateSlides()):!j&&F?(e.loopCreate(t),e.updateSlides()):j&&!F&&e.loopDestroy()),e.emit("breakpoint",g)}function dL(e,t="window",n){if(!e||t==="container"&&!n)return;let r=!1;const s=$o(),i=t==="window"?s.innerHeight:n.clientHeight,l=Object.keys(e).map(c=>{if(typeof c=="string"&&c.indexOf("@")===0){const u=parseFloat(c.substr(1));return{value:i*u,point:c}}return{value:c,point:c}});l.sort((c,u)=>parseInt(c.value,10)-parseInt(u.value,10));for(let c=0;c<l.length;c+=1){const{point:u,value:f}=l[c];t==="window"?s.matchMedia(`(min-width: ${f}px)`).matches&&(r=u):f<=n.clientWidth&&(r=u)}return r||"max"}var fL={setBreakpoint:uL,getBreakpoint:dL};function hL(e,t){const n=[];return e.forEach(r=>{typeof r=="object"?Object.keys(r).forEach(s=>{r[s]&&n.push(t+s)}):typeof r=="string"&&n.push(t+r)}),n}function pL(){const e=this,{classNames:t,params:n,rtl:r,el:s,device:i}=e,l=hL(["initialized",n.direction,{"free-mode":e.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&n.grid.fill==="column"},{android:i.android},{ios:i.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);t.push(...l),s.classList.add(...t),e.emitContainerClasses()}function mL(){const e=this,{el:t,classNames:n}=e;!t||typeof t=="string"||(t.classList.remove(...n),e.emitContainerClasses())}var gL={addClasses:pL,removeClasses:mL};function xL(){const e=this,{isLocked:t,params:n}=e,{slidesOffsetBefore:r}=n;if(r){const s=e.slides.length-1,i=e.slidesGrid[s]+e.slidesSizesGrid[s]+r*2;e.isLocked=e.size>i}else e.isLocked=e.snapGrid.length===1;n.allowSlideNext===!0&&(e.allowSlideNext=!e.isLocked),n.allowSlidePrev===!0&&(e.allowSlidePrev=!e.isLocked),t&&t!==e.isLocked&&(e.isEnd=!1),t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock")}var bL={checkOverflow:xL},fb={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 yL(e,t){return function(r={}){const s=Object.keys(r)[0],i=r[s];if(typeof i!="object"||i===null){Sa(t,r);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)){Sa(t,r);return}typeof e[s]=="object"&&!("enabled"in e[s])&&(e[s].enabled=!0),e[s]||(e[s]={enabled:!1}),Sa(t,r)}}const A1={eventsEmitter:g_,update:__,translate:M_,transition:B_,slide:G_,loop:Y_,grabCursor:Z_,events:cL,breakpoints:fL,checkOverflow:bL,classes:gL},T1={};let z2=class fc{constructor(...t){let n,r;t.length===1&&t[0].constructor&&Object.prototype.toString.call(t[0]).slice(8,-1)==="Object"?r=t[0]:[n,r]=t,r||(r={}),r=Sa({},r),n&&!r.el&&(r.el=n);const s=zu();if(r.el&&typeof r.el=="string"&&s.querySelectorAll(r.el).length>1){const u=[];return s.querySelectorAll(r.el).forEach(f=>{const p=Sa({},r,{el:f});u.push(new fc(p))}),u}const i=this;i.__swiper__=!0,i.support=w7(),i.device=S7({userAgent:r.userAgent}),i.browser=A7(),i.eventsListeners={},i.eventsAnyListeners=[],i.modules=[...i.__modules__],r.modules&&Array.isArray(r.modules)&&r.modules.forEach(u=>{typeof u=="function"&&i.modules.indexOf(u)<0&&i.modules.push(u)});const l={};i.modules.forEach(u=>{u({params:r,swiper:i,extendParams:yL(r,l),on:i.on.bind(i),once:i.once.bind(i),off:i.off.bind(i),emit:i.emit.bind(i)})});const c=Sa({},fb,l);return i.params=Sa({},c,T1,r),i.originalParams=Sa({},i.params),i.passedParams=Sa({},r),i.params&&i.params.on&&Object.keys(i.params.on).forEach(u=>{i.on(u,i.params.on[u])}),i.params&&i.params.onAny&&i.onAny(i.params.onAny),Object.assign(i,{enabled:i.params.enabled,el:n,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:n,params:r}=this,s=mc(n,`.${r.slideClass}, swiper-slide`),i=Lv(s[0]);return Lv(t)-i}getSlideIndexByData(t){return this.getSlideIndex(this.slides.find(n=>n.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:n,params:r}=t;t.slides=mc(n,`.${r.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,n){const r=this;t=Math.min(Math.max(t,0),1);const s=r.minTranslate(),l=(r.maxTranslate()-s)*t+s;r.translateTo(l,typeof n>"u"?0:n),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const n=t.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(t.params.containerModifierClass)===0);t.emit("_containerClasses",n.join(" "))}getSlideClasses(t){const n=this;return n.destroyed?"":t.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(n.params.slideClass)===0).join(" ")}emitSlidesClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const n=[];t.slides.forEach(r=>{const s=t.getSlideClasses(r);n.push({slideEl:r,classNames:s}),t.emit("_slideClass",r,s)}),t.emit("_slideClasses",n)}slidesPerViewDynamic(t="current",n=!1){const r=this,{params:s,slides:i,slidesGrid:l,slidesSizesGrid:c,size:u,activeIndex:f}=r;let p=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let g=i[f]?Math.ceil(i[f].swiperSlideSize):0,y;for(let v=f+1;v<i.length;v+=1)i[v]&&!y&&(g+=Math.ceil(i[v].swiperSlideSize),p+=1,g>u&&(y=!0));for(let v=f-1;v>=0;v-=1)i[v]&&!y&&(g+=i[v].swiperSlideSize,p+=1,g>u&&(y=!0))}else if(t==="current")for(let g=f+1;g<i.length;g+=1)(n?l[g]+c[g]-l[f]<u:l[g]-l[f]<u)&&(p+=1);else for(let g=f-1;g>=0;g-=1)l[f]-l[g]<u&&(p+=1);return p}update(){const t=this;if(!t||t.destroyed)return;const{snapGrid:n,params:r}=t;r.breakpoints&&t.setBreakpoint(),[...t.el.querySelectorAll('[loading="lazy"]')].forEach(l=>{l.complete&&Yp(t,l)}),t.updateSize(),t.updateSlides(),t.updateProgress(),t.updateSlidesClasses();function s(){const l=t.rtlTranslate?t.translate*-1:t.translate,c=Math.min(Math.max(l,t.maxTranslate()),t.minTranslate());t.setTranslate(c),t.updateActiveIndex(),t.updateSlidesClasses()}let i;if(r.freeMode&&r.freeMode.enabled&&!r.cssMode)s(),r.autoHeight&&t.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&t.isEnd&&!r.centeredSlides){const l=t.virtual&&r.virtual.enabled?t.virtual.slides:t.slides;i=t.slideTo(l.length-1,0,!1,!0)}else i=t.slideTo(t.activeIndex,0,!1,!0);i||s()}r.watchOverflow&&n!==t.snapGrid&&t.checkOverflow(),t.emit("update")}changeDirection(t,n=!0){const r=this,s=r.params.direction;return t||(t=s==="horizontal"?"vertical":"horizontal"),t===s||t!=="horizontal"&&t!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${s}`),r.el.classList.add(`${r.params.containerModifierClass}${t}`),r.emitContainerClasses(),r.params.direction=t,r.slides.forEach(i=>{t==="vertical"?i.style.width="":i.style.height=""}),r.emit("changeDirection"),n&&r.update()),r}changeLanguageDirection(t){const n=this;n.rtl&&t==="rtl"||!n.rtl&&t==="ltr"||(n.rtl=t==="rtl",n.rtlTranslate=n.params.direction==="horizontal"&&n.rtl,n.rtl?(n.el.classList.add(`${n.params.containerModifierClass}rtl`),n.el.dir="rtl"):(n.el.classList.remove(`${n.params.containerModifierClass}rtl`),n.el.dir="ltr"),n.update())}mount(t){const n=this;if(n.mounted)return!0;let r=t||n.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=n,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===n.params.swiperElementNodeName.toUpperCase()&&(n.isElement=!0);const s=()=>`.${(n.params.wrapperClass||"").trim().split(" ").join(".")}`;let l=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(s()):mc(r,s())[0];return!l&&n.params.createElements&&(l=ub("div",n.params.wrapperClass),r.append(l),mc(r,`.${n.params.slideClass}`).forEach(c=>{l.append(c)})),Object.assign(n,{el:r,wrapperEl:l,slidesEl:n.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:l,hostEl:n.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||Uc(r,"direction")==="rtl",rtlTranslate:n.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||Uc(r,"direction")==="rtl"),wrongRTL:Uc(l,"display")==="-webkit-box"}),!0}init(t){const n=this;if(n.initialized||n.mount(t)===!1)return n;n.emit("beforeInit"),n.params.breakpoints&&n.setBreakpoint(),n.addClasses(),n.updateSize(),n.updateSlides(),n.params.watchOverflow&&n.checkOverflow(),n.params.grabCursor&&n.enabled&&n.setGrabCursor(),n.params.loop&&n.virtual&&n.params.virtual.enabled?n.slideTo(n.params.initialSlide+n.virtual.slidesBefore,0,n.params.runCallbacksOnInit,!1,!0):n.slideTo(n.params.initialSlide,0,n.params.runCallbacksOnInit,!1,!0),n.params.loop&&n.loopCreate(void 0,!0),n.attachEvents();const s=[...n.el.querySelectorAll('[loading="lazy"]')];return n.isElement&&s.push(...n.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(i=>{i.complete?Yp(n,i):i.addEventListener("load",l=>{Yp(n,l.target)})}),db(n),n.initialized=!0,db(n),n.emit("init"),n.emit("afterInit"),n}destroy(t=!0,n=!0){const r=this,{params:s,el:i,wrapperEl:l,slides:c}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),s.loop&&r.loopDestroy(),n&&(r.removeClasses(),i&&typeof i!="string"&&i.removeAttribute("style"),l&&l.removeAttribute("style"),c&&c.length&&c.forEach(u=>{u.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),u.removeAttribute("style"),u.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(u=>{r.off(u)}),t!==!1&&(r.el&&typeof r.el!="string"&&(r.el.swiper=null),n_(r)),r.destroyed=!0),null}static extendDefaults(t){Sa(T1,t)}static get extendedDefaults(){return T1}static get defaults(){return fb}static installModule(t){fc.prototype.__modules__||(fc.prototype.__modules__=[]);const n=fc.prototype.__modules__;typeof t=="function"&&n.indexOf(t)<0&&n.push(t)}static use(t){return Array.isArray(t)?(t.forEach(n=>fc.installModule(n)),fc):(fc.installModule(t),fc)}};Object.keys(A1).forEach(e=>{Object.keys(A1[e]).forEach(t=>{z2.prototype[t]=A1[e][t]})});z2.use([p_,m_]);const k7=["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 Ou(e){return typeof e=="object"&&e!==null&&e.constructor&&Object.prototype.toString.call(e).slice(8,-1)==="Object"&&!e.__swiper__}function Hd(e,t){const n=["__proto__","constructor","prototype"];Object.keys(t).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof e[r]>"u"?e[r]=t[r]:Ou(t[r])&&Ou(e[r])&&Object.keys(t[r]).length>0?t[r].__swiper__?e[r]=t[r]:Hd(e[r],t[r]):e[r]=t[r]})}function _7(e={}){return e.navigation&&typeof e.navigation.nextEl>"u"&&typeof e.navigation.prevEl>"u"}function L7(e={}){return e.pagination&&typeof e.pagination.el>"u"}function E7(e={}){return e.scrollbar&&typeof e.scrollbar.el>"u"}function I7(e=""){const t=e.split(" ").map(r=>r.trim()).filter(r=>!!r),n=[];return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n.join(" ")}function vL(e=""){return e?e.includes("swiper-wrapper")?e:`swiper-wrapper ${e}`:"swiper-wrapper"}function wL({swiper:e,slides:t,passedParams:n,changedParams:r,nextEl:s,prevEl:i,scrollbarEl:l,paginationEl:c}){const u=r.filter(H=>H!=="children"&&H!=="direction"&&H!=="wrapperClass"),{params:f,pagination:p,navigation:g,scrollbar:y,virtual:v,thumbs:S}=e;let A,T,L,I,j,P,F,R;r.includes("thumbs")&&n.thumbs&&n.thumbs.swiper&&!n.thumbs.swiper.destroyed&&f.thumbs&&(!f.thumbs.swiper||f.thumbs.swiper.destroyed)&&(A=!0),r.includes("controller")&&n.controller&&n.controller.control&&f.controller&&!f.controller.control&&(T=!0),r.includes("pagination")&&n.pagination&&(n.pagination.el||c)&&(f.pagination||f.pagination===!1)&&p&&!p.el&&(L=!0),r.includes("scrollbar")&&n.scrollbar&&(n.scrollbar.el||l)&&(f.scrollbar||f.scrollbar===!1)&&y&&!y.el&&(I=!0),r.includes("navigation")&&n.navigation&&(n.navigation.prevEl||i)&&(n.navigation.nextEl||s)&&(f.navigation||f.navigation===!1)&&g&&!g.prevEl&&!g.nextEl&&(j=!0);const C=H=>{e[H]&&(e[H].destroy(),H==="navigation"?(e.isElement&&(e[H].prevEl.remove(),e[H].nextEl.remove()),f[H].prevEl=void 0,f[H].nextEl=void 0,e[H].prevEl=void 0,e[H].nextEl=void 0):(e.isElement&&e[H].el.remove(),f[H].el=void 0,e[H].el=void 0))};r.includes("loop")&&e.isElement&&(f.loop&&!n.loop?P=!0:!f.loop&&n.loop?F=!0:R=!0),u.forEach(H=>{if(Ou(f[H])&&Ou(n[H]))Object.assign(f[H],n[H]),(H==="navigation"||H==="pagination"||H==="scrollbar")&&"enabled"in n[H]&&!n[H].enabled&&C(H);else{const Q=n[H];(Q===!0||Q===!1)&&(H==="navigation"||H==="pagination"||H==="scrollbar")?Q===!1&&C(H):f[H]=n[H]}}),u.includes("controller")&&!T&&e.controller&&e.controller.control&&f.controller&&f.controller.control&&(e.controller.control=f.controller.control),r.includes("children")&&t&&v&&f.virtual.enabled?(v.slides=t,v.update(!0)):r.includes("virtual")&&v&&f.virtual.enabled&&(t&&(v.slides=t),v.update(!0)),r.includes("children")&&t&&f.loop&&(R=!0),A&&S.init()&&S.update(!0),T&&(e.controller.control=f.controller.control),L&&(e.isElement&&(!c||typeof c=="string")&&(c=document.createElement("div"),c.classList.add("swiper-pagination"),c.part.add("pagination"),e.el.appendChild(c)),c&&(f.pagination.el=c),p.init(),p.render(),p.update()),I&&(e.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-scrollbar"),l.part.add("scrollbar"),e.el.appendChild(l)),l&&(f.scrollbar.el=l),y.init(),y.updateSize(),y.setTranslate()),j&&(e.isElement&&((!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-next"),Iv(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"),Iv(i,e.navigation.arrowSvg),i.part.add("button-prev"),e.el.appendChild(i))),s&&(f.navigation.nextEl=s),i&&(f.navigation.prevEl=i),g.init(),g.update()),r.includes("allowSlideNext")&&(e.allowSlideNext=n.allowSlideNext),r.includes("allowSlidePrev")&&(e.allowSlidePrev=n.allowSlidePrev),r.includes("direction")&&e.changeDirection(n.direction,!1),(P||R)&&e.loopDestroy(),(F||R)&&e.loopCreate(),e.update()}function SL(e={},t=!0){const n={on:{}},r={},s={};Hd(n,fb),n._emitClasses=!0,n.init=!1;const i={},l=k7.map(u=>u.replace(/_/,"")),c=Object.assign({},e);return Object.keys(c).forEach(u=>{typeof e[u]>"u"||(l.indexOf(u)>=0?Ou(e[u])?(n[u]={},s[u]={},Hd(n[u],e[u]),Hd(s[u],e[u])):(n[u]=e[u],s[u]=e[u]):u.search(/on[A-Z]/)===0&&typeof e[u]=="function"?t?r[`${u[2].toLowerCase()}${u.substr(3)}`]=e[u]:n.on[`${u[2].toLowerCase()}${u.substr(3)}`]=e[u]:i[u]=e[u])}),["navigation","pagination","scrollbar"].forEach(u=>{n[u]===!0&&(n[u]={}),n[u]===!1&&delete n[u]}),{params:n,passedParams:s,rest:i,events:r}}function AL({el:e,nextEl:t,prevEl:n,paginationEl:r,scrollbarEl:s,swiper:i},l){_7(l)&&t&&n&&(i.params.navigation.nextEl=t,i.originalParams.navigation.nextEl=t,i.params.navigation.prevEl=n,i.originalParams.navigation.prevEl=n),L7(l)&&r&&(i.params.pagination.el=r,i.originalParams.pagination.el=r),E7(l)&&s&&(i.params.scrollbar.el=s,i.originalParams.scrollbar.el=s),i.init(e)}function TL(e,t,n,r,s){const i=[];if(!t)return i;const l=u=>{i.indexOf(u)<0&&i.push(u)};if(n&&r){const u=r.map(s),f=n.map(s);u.join("")!==f.join("")&&l("children"),r.length!==n.length&&l("children")}return k7.filter(u=>u[0]==="_").map(u=>u.replace(/_/,"")).forEach(u=>{if(u in e&&u in t)if(Ou(e[u])&&Ou(t[u])){const f=Object.keys(e[u]),p=Object.keys(t[u]);f.length!==p.length?l(u):(f.forEach(g=>{e[u][g]!==t[u][g]&&l(u)}),p.forEach(g=>{e[u][g]!==t[u][g]&&l(u)}))}else e[u]!==t[u]&&l(u)}),i}const CL=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 Sm(){return Sm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sm.apply(this,arguments)}function R7(e){return e.type&&e.type.displayName&&e.type.displayName.includes("SwiperSlide")}function N7(e){const t=[];return D.Children.toArray(e).forEach(n=>{R7(n)?t.push(n):n.props&&n.props.children&&N7(n.props.children).forEach(r=>t.push(r))}),t}function kL(e){const t=[],n={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return D.Children.toArray(e).forEach(r=>{if(R7(r))t.push(r);else if(r.props&&r.props.slot&&n[r.props.slot])n[r.props.slot].push(r);else if(r.props&&r.props.children){const s=N7(r.props.children);s.length>0?s.forEach(i=>t.push(i)):n["container-end"].push(r)}else n["container-end"].push(r)}),{slides:t,slots:n}}function _L(e,t,n){if(!n)return null;const r=p=>{let g=p;return p<0?g=t.length+p:g>=t.length&&(g=g-t.length),g},s=e.isHorizontal()?{[e.rtlTranslate?"right":"left"]:`${n.offset}px`}:{top:`${n.offset}px`},{from:i,to:l}=n,c=e.params.loop?-t.length:0,u=e.params.loop?t.length*2:t.length,f=[];for(let p=c;p<u;p+=1)p>=i&&p<=l&&f.push(t[r(p)]);return f.map((p,g)=>D.cloneElement(p,{swiper:e,style:s,key:p.props.virtualIndex||p.key||`slide-${g}`}))}function kf(e,t){return typeof window>"u"?b.useEffect(e,t):b.useLayoutEffect(e,t)}const jv=b.createContext(null),LL=b.createContext(null),sh=b.forwardRef(({className:e,tag:t="div",wrapperTag:n="div",children:r,onSwiper:s,...i}={},l)=>{let c=!1;const[u,f]=b.useState("swiper"),[p,g]=b.useState(null),[y,v]=b.useState(!1),S=b.useRef(!1),A=b.useRef(null),T=b.useRef(null),L=b.useRef(null),I=b.useRef(null),j=b.useRef(null),P=b.useRef(null),F=b.useRef(null),R=b.useRef(null),{params:C,passedParams:H,rest:Q,events:K}=SL(i),{slides:V,slots:he}=kL(r),X=()=>{v(!y)};Object.assign(C.on,{_containerClasses(W,z){f(z)}});const pe=()=>{Object.assign(C.on,K),c=!0;const W={...C};if(delete W.wrapperClass,T.current=new z2(W),T.current.virtual&&T.current.params.virtual.enabled){T.current.virtual.slides=V;const z={cache:!1,slides:V,renderExternal:g,renderExternalUpdate:!1};Hd(T.current.params.virtual,z),Hd(T.current.originalParams.virtual,z)}};A.current||pe(),T.current&&T.current.on("_beforeBreakpoint",X);const ge=()=>{c||!K||!T.current||Object.keys(K).forEach(W=>{T.current.on(W,K[W])})},de=()=>{!K||!T.current||Object.keys(K).forEach(W=>{T.current.off(W,K[W])})};b.useEffect(()=>()=>{T.current&&T.current.off("_beforeBreakpoint",X)}),b.useEffect(()=>{!S.current&&T.current&&(T.current.emitSlidesClasses(),S.current=!0)}),kf(()=>{if(l&&(l.current=A.current),!!A.current)return T.current.destroyed&&pe(),AL({el:A.current,nextEl:j.current,prevEl:P.current,paginationEl:F.current,scrollbarEl:R.current,swiper:T.current},C),s&&!T.current.destroyed&&s(T.current),()=>{T.current&&!T.current.destroyed&&T.current.destroy(!0,!1)}},[]),kf(()=>{ge();const W=TL(H,L.current,V,I.current,z=>z.key);return L.current=H,I.current=V,W.length&&T.current&&!T.current.destroyed&&wL({swiper:T.current,slides:V,passedParams:H,changedParams:W,nextEl:j.current,prevEl:P.current,scrollbarEl:R.current,paginationEl:F.current}),()=>{de()}}),kf(()=>{CL(T.current)},[p]);function oe(){return C.virtual?_L(T.current,V,p):V.map((W,z)=>D.cloneElement(W,{swiper:T.current,swiperSlideIndex:z}))}return D.createElement(t,Sm({ref:A,className:I7(`${u}${e?` ${e}`:""}`)},Q),D.createElement(LL.Provider,{value:T.current},he["container-start"],D.createElement(n,{className:vL(C.wrapperClass)},he["wrapper-start"],oe(),he["wrapper-end"]),_7(C)&&D.createElement(D.Fragment,null,D.createElement("div",{ref:P,className:"swiper-button-prev"}),D.createElement("div",{ref:j,className:"swiper-button-next"})),E7(C)&&D.createElement("div",{ref:R,className:"swiper-scrollbar"}),L7(C)&&D.createElement("div",{ref:F,className:"swiper-pagination"}),he["container-end"]))});sh.displayName="Swiper";const Qu=b.forwardRef(({tag:e="div",children:t,className:n="",swiper:r,zoom:s,lazy:i,virtualIndex:l,swiperSlideIndex:c,...u}={},f)=>{const p=b.useRef(null),[g,y]=b.useState("swiper-slide"),[v,S]=b.useState(!1);function A(j,P,F){P===p.current&&y(F)}kf(()=>{if(typeof c<"u"&&(p.current.swiperSlideIndex=c),f&&(f.current=p.current),!(!p.current||!r)){if(r.destroyed){g!=="swiper-slide"&&y("swiper-slide");return}return r.on("_slideClass",A),()=>{r&&r.off("_slideClass",A)}}}),kf(()=>{r&&p.current&&!r.destroyed&&y(r.getSlideClasses(p.current))},[r]);const T={isActive:g.indexOf("swiper-slide-active")>=0,isVisible:g.indexOf("swiper-slide-visible")>=0,isFullyVisible:g.indexOf("swiper-slide-fully-visible")>=0,isPrev:g.indexOf("swiper-slide-prev")>=0,isNext:g.indexOf("swiper-slide-next")>=0},L=()=>typeof t=="function"?t(T):t,I=()=>{S(!0)};return D.createElement(e,Sm({ref:p,className:I7(`${g}${n?` ${n}`:""}`),"data-swiper-slide-index":l,onLoad:I},u),s&&D.createElement(jv.Provider,{value:T},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:j=>{j&&(j.lazyPreloaderManaged=!0)}}))),!s&&D.createElement(jv.Provider,{value:T},L(),i&&!v&&D.createElement("div",{className:"swiper-lazy-preloader",ref:j=>{j&&(j.lazyPreloaderManaged=!0)}})))});Qu.displayName="SwiperSlide";const Ki=[];for(let e=0;e<256;++e)Ki.push((e+256).toString(16).slice(1));function EL(e,t=0){return(Ki[e[t+0]]+Ki[e[t+1]]+Ki[e[t+2]]+Ki[e[t+3]]+"-"+Ki[e[t+4]]+Ki[e[t+5]]+"-"+Ki[e[t+6]]+Ki[e[t+7]]+"-"+Ki[e[t+8]]+Ki[e[t+9]]+"-"+Ki[e[t+10]]+Ki[e[t+11]]+Ki[e[t+12]]+Ki[e[t+13]]+Ki[e[t+14]]+Ki[e[t+15]]).toLowerCase()}let C1;const IL=new Uint8Array(16);function RL(){if(!C1){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");C1=crypto.getRandomValues.bind(crypto)}return C1(IL)}const NL=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Pv={randomUUID:NL};function ML(e,t,n){e=e||{};const r=e.random??e.rng?.()??RL();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,EL(r)}function DL(e,t,n){return Pv.randomUUID&&!e?Pv.randomUUID():ML(e)}const jL={},Bv=e=>{let t;const n=new Set,r=(p,g)=>{const y=typeof p=="function"?p(t):p;if(!Object.is(y,t)){const v=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(S=>S(t,v))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(jL?"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."),n.clear()}},f=t=e(r,s,u);return u},PL=e=>e?Bv(e):Bv;var k1={exports:{}},_1={},L1={exports:{}},E1={};var Fv;function BL(){if(Fv)return E1;Fv=1;var e=cg();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function c(g,y){var v=y(),S=r({inst:{value:v,getSnapshot:y}}),A=S[0].inst,T=S[1];return i(function(){A.value=v,A.getSnapshot=y,u(A)&&T({inst:A})},[g,v,y]),s(function(){return u(A)&&T({inst:A}),g(function(){u(A)&&T({inst:A})})},[g]),l(v),v}function u(g){var y=g.getSnapshot;g=g.value;try{var v=y();return!n(g,v)}catch{return!0}}function f(g,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return E1.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,E1}var Ov;function FL(){return Ov||(Ov=1,L1.exports=BL()),L1.exports}var Qv;function OL(){if(Qv)return _1;Qv=1;var e=cg(),t=FL();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,c=e.useMemo,u=e.useDebugValue;return _1.useSyncExternalStoreWithSelector=function(f,p,g,y,v){var S=i(null);if(S.current===null){var A={hasValue:!1,value:null};S.current=A}else A=S.current;S=c(function(){function L(R){if(!I){if(I=!0,j=R,R=y(R),v!==void 0&&A.hasValue){var C=A.value;if(v(C,R))return P=C}return P=R}if(C=P,r(j,R))return C;var H=y(R);return v!==void 0&&v(C,H)?(j=R,C):(j=R,P=H)}var I=!1,j,P,F=g===void 0?null:g;return[function(){return L(p())},F===null?void 0:function(){return L(F())}]},[p,g,y,v]);var T=s(f,S[0],S[1]);return l(function(){A.hasValue=!0,A.value=T},[T]),u(T),T},_1}var $v;function QL(){return $v||($v=1,k1.exports=OL()),k1.exports}var $L=QL();const HL=x7($L),M7={},{useDebugValue:UL}=D,{useSyncExternalStoreWithSelector:zL}=HL;let Hv=!1;const GL=e=>e;function WL(e,t=GL,n){(M7?"production":void 0)!=="production"&&n&&!Hv&&(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"),Hv=!0);const r=zL(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return UL(r),r}const Uv=e=>{(M7?"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"?PL(e):e,n=(r,s)=>WL(t,r,s);return Object.assign(n,t),n},D7=e=>e?Uv(e):Uv,Am="auth:unauthorized";let Fd=null;class Ia extends Error{constructor(t,n,r){super(t),this.status=n,this.code=r,this.name="TerminalApiError"}status;code}async function VL(){const e=await fetch("/api/terminal/update");if(!e.ok)throw new Ia("Failed to load update state",e.status);return e.json()}async function qL(){const e=await hr(),t=await fetch("/api/terminal/update/check",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Ia("Failed to check for updates",t.status);return t.json()}async function YL(){const e=await hr(),t=await fetch("/api/terminal/update/restart",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok){const n=await t.json().catch(()=>({error:"Failed to restart Termdock"}));throw new Ia(n.error||"Failed to restart Termdock",t.status)}return t.json()}async function KL(){const e=await fetch("/api/terminal/quota");if(!e.ok)throw new Ia("Failed to fetch quota",e.status);return e.json()}async function XL(){const e=await hr(),t=await fetch("/api/terminal/quota/refresh",{method:"POST",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Ia("Failed to refresh quota",t.status);return t.json()}const eu=8e3,ZL=32e3,Vl=1e4,Ud=45e3,JL=8e3,eE=8e3,tE=15e3,nE=1e4,Xd=5e3;let rE=0;const Kp=[];let I1=!1;function Dc(e,t={}){if(typeof window>"u")return;const n=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:++rE,ts:Date.now(),...t}});Kp.push(n),sE()}async function sE(){if(!I1){I1=!0;try{for(;Kp.length>0;){const e=Kp[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Kp.shift()}catch{break}}}finally{I1=!1}}}function iE(e,t,n){const r=new AbortController;let s=setTimeout(()=>{r.abort(new DOMException(n,"TimeoutError"))},t);const i=()=>r.abort(e?.reason);return e&&(e.aborted?i():e.addEventListener("abort",i,{once:!0})),{signal:r.signal,cleanup:()=>{s&&(clearTimeout(s),s=null),e?.removeEventListener("abort",i)}}}async function Ns(e,t,n,r){const{signal:s,cleanup:i}=iE(t?.signal??void 0,n,r);try{return await fetch(e,{...t,signal:s})}catch(l){throw l instanceof DOMException&&l.name==="TimeoutError"?new Error(r):l}finally{i()}}async function j7(e,t,n){let r=null;const s=new Promise((i,l)=>{r=setTimeout(()=>l(new Error(n)),t)});try{return await Promise.race([e.text(),s])}finally{r&&clearTimeout(r)}}async function Zd(e,t,n){const r=await j7(e,t,n);return JSON.parse(r)}if(typeof window<"u"&&!window.__termdockFetchPatched){window.__termdockFetchPatched=!0;const e=window.fetch.bind(window);window.fetch=async(...t)=>{const n=await e(...t);if(n.status===401){Fd=null;try{window.dispatchEvent(new CustomEvent(Am))}catch{}}return n}}async function hr(){if(Fd)return Fd;const e=await Ns("/api/csrf-token",void 0,JL,"CSRF token request timed out");if(!e.ok)throw new Error("Failed to get CSRF token");const t=await Zd(e,Xd,"CSRF token response timed out");if(!t.csrfToken)throw new Error("Invalid CSRF token response");return Fd=t.csrfToken,Fd}function P7(){Fd=null}const oE=2e4,zv=8e3,aE=1500,so=new Map,lE=24,cE=40,uE=40;function dE(e){return e.retryState.retryCount>=2||e.pendingInputs.length>=uE?"congested":e.retryState.retryCount>=1||e.pendingInputs.length>=8?"degraded":"good"}function Gv(e){if(e.pendingInputs.length===0||e.ws.readyState!==WebSocket.OPEN)return;const t=e.pendingInputs.splice(0);for(const n of t)try{e.ws.send(JSON.stringify({type:"input",data:n}))}catch{}}function B7(e){if(e.ws.readyState!==WebSocket.OPEN)return;const t=dE(e);if(t==="good"){Gv(e);return}if(e.inputFlushTimer)return;const n=t==="congested"?cE:lE;e.inputFlushTimer=setTimeout(()=>{e.inputFlushTimer=null,Gv(e)},n)}const _f=new Map;function fE(e,t,n,r){const s=_f.get(e);s&&(_f.delete(e),t?s.resolve({success:!0,layout:n}):s.reject(new Error(r||"Tmux action failed")))}function hE(e,t){const r=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/terminal/${e}/ws`;return t>0?`${r}?since=${t}`:r}const Wv=new Map;async function pE(e){const t=await hr(),n=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(!n.ok){const r=await n.json().catch(()=>({error:"Failed to create terminal"}));throw new Error(r.error||"Failed to create terminal session")}return n.json()}function mE(e,t,n,r={}){const{maxRetries:s=10,initialRetryDelay:i=1e3,maxRetryDelay:l=2e4,connectionTimeout:c=15e3}=r,u={maxRetries:s,initialDelayMs:i,maxDelayMs:l,connectionTimeoutMs:c,retryCount:0,retryTimeout:null,connectionTimeoutId:null,isClosed:!1,isSuspended:!1};let f=null,p=Wv.get(e)??0;Wv.delete(e);const g=[];let y=!1,v=null;const S=new WeakSet,A=()=>{u.retryTimeout&&(clearTimeout(u.retryTimeout),u.retryTimeout=null),u.connectionTimeoutId&&(clearTimeout(u.connectionTimeoutId),u.connectionTimeoutId=null),v&&(clearTimeout(v),v=null)},T=F=>{F.heartbeatTimer&&(clearInterval(F.heartbeatTimer),F.heartbeatTimer=null),F.pongTimer&&(clearTimeout(F.pongTimer),F.pongTimer=null),F.inputFlushTimer&&(clearTimeout(F.inputFlushTimer),F.inputFlushTimer=null)},L=F=>{T(F),F.heartbeatTimer=setInterval(()=>{if(F.ws.readyState===WebSocket.OPEN){try{F.ws.send(JSON.stringify({type:"ping"}))}catch{}F.pongTimer&&clearTimeout(F.pongTimer),F.pongTimer=setTimeout(()=>{if(Date.now()-F.lastInboundAt>=zv)try{F.ws.close()}catch{}},zv)}},oE)},I=()=>{if(u.isClosed=!0,A(),f){T(f),so.delete(e);try{f.ws.close()}catch{}f=null}},j=()=>{if(u.isClosed)return;if(f){S.add(f.ws),T(f);try{f.ws.close()}catch{}}const F=hE(e,p),R=new WebSocket(F);y=!1,u.connectionTimeoutId=setTimeout(()=>{R.readyState!==WebSocket.OPEN&&(y=!0,R.close(),P(new Error("WebSocket connection timeout"),!1))},c);const C={ws:R,onEvent:t,onError:n,reconnectNow:()=>{if(!u.isClosed&&(u.isSuspended=!1,!v)){if(A(),f){S.add(f.ws),T(f);try{f.ws.close()}catch{}}t({type:"reconnecting",attempt:Math.min(u.retryCount+1,s),maxAttempts:s}),u.retryCount=Math.min(u.retryCount+1,s),y=!0,v=setTimeout(()=>{v=null,y=!1,j()},0)}},suspendReconnect:()=>{u.isClosed||(u.isSuspended=!0,u.retryTimeout&&(clearTimeout(u.retryTimeout),u.retryTimeout=null))},retryState:u,lastSeq:p,pendingInputs:g,inputFlushTimer:null,heartbeatTimer:null,pongTimer:null,lastInboundAt:Date.now(),inboundSequence:0};R.onopen=()=>{A(),u.retryCount=0,C.lastInboundAt=Date.now(),C.inboundSequence+=1,L(C),B7(C)},R.onmessage=H=>{C.lastInboundAt=Date.now(),C.inboundSequence+=1;try{const Q=JSON.parse(H.data);if(Q.type==="pong"){C.pongTimer&&(clearTimeout(C.pongTimer),C.pongTimer=null);return}if(Q.type==="tmux-result"&&Q.reqId){fE(Q.reqId,Q.success!==!1,Q.layout,Q.error);return}if(Q.type==="tmux-layout"&&Q.layout){t({type:"tmux-layout",layout:Q.layout});return}if(Q.type==="tmux-screen-sync"&&Array.isArray(Q.chunks)){t({type:"tmux-screen-sync",chunks:Q.chunks.filter(V=>typeof V=="string"),cols:typeof Q.cols=="number"?Q.cols:void 0,rows:typeof Q.rows=="number"?Q.rows:void 0,generation:typeof Q.generation=="number"?Q.generation:void 0});return}if(Q.type==="active-program"){t({type:"active-program",activeProgram:Q.activeProgram,activeProgramRaw:Q.activeProgramRaw,activeProgramSource:Q.activeProgramSource});return}if(Q.type==="cwd"){t({type:"cwd",cwd:Q.cwd});return}if(Q.type==="agent-status"){t({type:"agent-status",agentStatus:Q.agentStatus??null,agentIndicator:Q.agentIndicator??null,agentStatusDetail:Q.agentStatusDetail??null,agent:Q.agent??null,agentMessage:Q.agentMessage??null,agentNativeSessionId:Q.agentNativeSessionId??null,agentResumeRecovered:Q.agentResumeRecovered===!0,agentRich:Q.agentRich===!0,agentActivity:typeof Q.agentActivity=="number"?Q.agentActivity:0,agentCwd:Q.agentCwd??null,reviewed:typeof Q.reviewed=="boolean"?Q.reviewed:null});return}if(Q.type==="git-status"){t({type:"git-status",gitStatus:Q.gitStatus??null});return}if(Q.type==="quota-status"&&Array.isArray(Q.providers)){window.dispatchEvent(new CustomEvent("termdock:quota-update",{detail:Q.providers}));return}if(Q.type==="focus-mode"){t({type:"focus-mode",focusTrackingRequested:Q.focusTrackingRequested===!0});return}if(Q.type==="resize-ack"){t({type:"resize-ack",seq:typeof Q.seq=="number"?Q.seq:void 0,cols:typeof Q.cols=="number"?Q.cols:void 0,rows:typeof Q.rows=="number"?Q.rows:void 0,ok:Q.ok!==!1,error:typeof Q.error=="string"?Q.error:void 0});return}if(Q.type==="pty-size"){t({type:"pty-size",cols:typeof Q.cols=="number"?Q.cols:void 0,rows:typeof Q.rows=="number"?Q.rows:void 0,source:typeof Q.source=="string"?Q.source:void 0});return}if(Q.type==="shell-title"){t({type:"shell-title",title:typeof Q.title=="string"?Q.title:""});return}if(Q.type==="prompt-state"){t({type:"prompt-state",state:Q.state==="running"?"running":"idle",exitCode:typeof Q.exitCode=="number"?Q.exitCode:void 0});return}const K=Q;if(K.type==="connected"){typeof K.replayLastSeq=="number"&&K.replayLastSeq>0&&(p=K.replayLastSeq,C.lastSeq=p),t(K);return}if(K.type==="exit"){I(),t(K);return}t(K),K.type==="data"&&typeof K.seq=="number"&&Number.isFinite(K.seq)&&K.seq>p&&(p=K.seq,C.lastSeq=p)}catch(Q){n?.(Q,!1)}},R.onerror=()=>{S.has(R)||(A(),T(C),y||(y=!0,P(new Error("WebSocket connection error"),!1)))},R.onclose=H=>{if(!S.has(R)&&(A(),T(C),!u.isClosed&&!y)){if(y=!0,H.code===4001){console.warn("[Terminal] WS 4001: Session not found on server",{code:H.code,reason:H.reason,stack:new Error().stack}),P(new Error("Session not found on server"),!0);return}if(H.code===4003||H.code===4401){try{window.dispatchEvent(new CustomEvent(Am))}catch{}P(new Error("Authentication required"),!0);return}P(new Error("WebSocket connection closed"),!1)}},f=C,so.set(e,f)},P=(F,R)=>{if(!u.isClosed)if(R)n?.(F,!0),I();else{u.retryCount=Math.min(u.retryCount+1,Math.max(1,s));const C=Math.min(i*Math.pow(2,u.retryCount-1),l);if(t({type:"reconnecting",attempt:u.retryCount,maxAttempts:s}),u.isSuspended)return;u.retryTimeout=setTimeout(()=>{u.isClosed||j()},C)}};return j(),I}async function F7(e,t){const n=so.get(e);if(n){if(n.ws.readyState===WebSocket.OPEN){n.pendingInputs.push(t),B7(n);return}if(n.ws.readyState===WebSocket.CONNECTING){n.pendingInputs.push(t);return}}const r=await hr(),s=await fetch(`/api/terminal/${e}/input`,{method:"POST",headers:{"Content-Type":"text/plain","X-XSRF-TOKEN":r},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 gE(e,t){const n=so.get(e);if(!n)return!1;if(n.retryState.isSuspended=!1,n.ws.readyState!==WebSocket.OPEN)return n.reconnectNow(),!0;const r=n.inboundSequence;try{n.ws.send(JSON.stringify({type:"ping"}))}catch{}return setTimeout(()=>{so.get(e)!==n||n.retryState.isClosed||(n.inboundSequence<=r?n.reconnectNow():t?.())},aE),!0}function xE(e){const t=so.get(e);return t?(t.reconnectNow(),!0):!1}function Vv(){for(const e of so.values())e.suspendReconnect()}function qv(e,t,n){const r=so.get(e);if(!(!r||r.ws.readyState!==WebSocket.OPEN))try{r.ws.send(JSON.stringify({type:"focus",focused:t,reason:n}))}catch{}}function Yv(e,t,n){const r=so.get(e);if(!(!r||r.ws.readyState!==WebSocket.OPEN))try{r.ws.send(JSON.stringify({type:"viewing",viewing:t,reason:n}))}catch{}}function Kv(e){const t=so.get(e);if(!(!t||t.ws.readyState!==WebSocket.OPEN))try{t.ws.send(JSON.stringify({type:"agent-review-ack"}))}catch{}}function Xv(e,t,n){const r=so.get(e);if(!(!r||r.ws.readyState!==WebSocket.OPEN))try{r.ws.send(JSON.stringify({type:"flow-control",paused:t,reason:n}))}catch{}}async function bE(e,t,n,r){const s=so.get(e);if(s&&s.ws.readyState===WebSocket.OPEN)try{s.ws.send(JSON.stringify({type:"resize",cols:t,rows:n,seq:r}));return}catch{}const i=await hr(),l=await fetch(`/api/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":i},body:JSON.stringify({cols:t,rows:n,seq:r})});if(!l.ok){const u=await l.json().catch(()=>({error:"Failed to resize terminal"}));throw new Error(u.error||"Failed to resize terminal")}const c=await l.json().catch(()=>({success:!0}));if(c?.success===!1||c?.ok===!1)throw new Error(c?.error||"Failed to resize terminal")}async function yE(e,t){const n=so.get(e);if(n&&n.ws.readyState===WebSocket.OPEN)return t.action==="scroll"?(n.ws.send(JSON.stringify({type:"tmux",...t})),{success:!0}):new Promise((i,l)=>{const c=Math.random().toString(36).substring(7);_f.set(c,{resolve:i,reject:l}),n.ws.send(JSON.stringify({type:"tmux",reqId:c,...t})),setTimeout(()=>{_f.has(c)&&(_f.delete(c),l(new Error("Tmux action timed out")))},3e4)});const r=await hr(),s=await fetch(`/api/terminal/${e}/tmux`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},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 O7(e){const t=so.get(e);if(t){t.retryState.isClosed=!0;try{t.ws.close()}catch{}so.delete(e)}const n=await hr(),r=await fetch(`/api/terminal/${e}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":n}});if(r.status!==404&&!r.ok){const s=await r.json().catch(()=>({error:"Failed to close terminal"}));throw new Error(s.error||"Failed to close terminal")}}async function vE(e,t){const n=so.get(e);if(n){n.retryState.isClosed=!0;try{n.ws.close()}catch{}so.delete(e)}const r=await hr(),s=await fetch(`/api/terminal/${e}/restart`,{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},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 wE(e){const t=await Ns(`/api/terminal/${e}/health`,{method:"GET"},eE,"Terminal health check timed out");if(!t.ok){if(t.status===404)return{healthy:!1,sessionId:e};const n=await Zd(t,Xd,"Terminal health error response timed out").catch(()=>({error:"Failed to check terminal health"}));throw new Error(n.error||"Failed to check terminal health")}return Zd(t,Xd,"Terminal health response timed out")}async function SE(e){const t=await hr(),n=await Ns("/api/terminal/force-kill",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)},nE,"Terminal force-kill request timed out");if(!n.ok){const r=await Zd(n,Xd,"Terminal force-kill error response timed out").catch(()=>({error:"Failed to force kill terminal"}));throw new Error(r.error||"Failed to force kill terminal")}}async function hb(){const e=await fetch("/api/terminal/tmux/sessions",{method:"GET"});if(!e.ok){const n=await e.json().catch(()=>({error:"Failed to list tmux sessions"}));throw new Error(n.error||"Failed to list tmux sessions")}const t=await e.json();return Array.isArray(t.sessions)?t.sessions:[]}async function pb(){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 Q7(e){const t=e.trim();if(!t)throw new Error("tmux session name is required");const n=await hr(),r=await fetch(`/api/terminal/tmux/sessions/${encodeURIComponent(t)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":n}});if(!r.ok){const i=await r.json().catch(()=>({error:"Failed to kill tmux session"}));throw new Error(i.error||"Failed to kill tmux session")}const s=await r.json();return{cleanedSessions:Array.isArray(s.cleanedSessions)?s.cleanedSessions:[],alreadyGone:!!s.alreadyGone}}async function AE(){const e=await hr(),t=await fetch("/api/terminal/tmux/recovery/restore-all",{method:"POST",headers:{"X-XSRF-TOKEN":e}}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Ia(n.error||"Failed to restore tmux Agent sessions",t.status);return n}async function TE(){const e=await hr(),t=await fetch("/api/terminal/tmux/recovery",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok)throw new Ia("Failed to dismiss tmux recovery",t.status)}const ip=new Map;function CE(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 kE(){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 $7(e){const t=CE(e),n=ip.get(t);if(n)return n;const r=await hr(),s=Ns("/api/terminal/session-inventory/open",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":r},body:JSON.stringify(e)},tE,"Terminal session open request timed out").then(async i=>{if(!i.ok){const l=await Zd(i,Xd,"Terminal session open error response timed out").catch(()=>({error:"Failed to open session"}));throw new Ia(l.error||"Failed to open session",i.status,typeof l.code=="string"?l.code:void 0)}return Zd(i,Xd,"Terminal session open response timed out")}).finally(()=>{ip.get(t)===s&&ip.delete(t)});return ip.set(t,s),s}async function Xp(e,t){const n=await hr(),r=await fetch(`/api/terminal/session-inventory/sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify(t)});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to update session"}));throw new Error(s.error||"Failed to update session")}return r.json()}async function _E(e){const t=await hr(),n=await fetch("/api/terminal/session-inventory/reorder",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({sessionIds:e})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to reorder sessions"}));throw new Error(r.error||"Failed to reorder sessions")}return n.json()}async function LE(e){const t=await hr(),n=await fetch(`/api/terminal/session-inventory/sessions/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to remove session"}));throw new Error(r.error||"Failed to remove session")}}async function EE(){const e=await hr(),t=await fetch("/api/terminal/session-inventory/sessions",{method:"DELETE",headers:{"X-XSRF-TOKEN":e}});if(!t.ok){const n=await t.json().catch(()=>({error:"Failed to clear sessions"}));throw new Error(n.error||"Failed to clear sessions")}}async function Zv(){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 IE(e){const t=await hr(),n=await fetch("/api/terminal/toolbar-presets",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save toolbar presets"})),s=new Error(r.error||"Failed to save toolbar presets");throw s.current=r.current,s.code=r.code,s}return n.json()}async function ug(){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 qa(e){const t=await hr(),n=await fetch("/api/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to update settings"}));throw new Error(r.error||"Failed to update settings")}return n.json()}async function F0(e=!1){const t=await fetch(`/api/terminal/auto-title/catalog${e?"?refresh=1":""}`);if(!t.ok)throw new Error("Failed to discover title models");const n=await t.json();return Array.isArray(n?.namers)?n.namers:[]}async function RE(){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 NE(e,t){const n=await hr(),r=await fetch("/api/terminal/context-draft",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":n},body:JSON.stringify({text:e,origin:t})});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to update context draft"}));throw new Error(s.error||"Failed to update context draft")}return r.json()}async function ME(){const e=await fetch("/api/auth/status");if(!e.ok)throw new Error("Failed to query auth status");return e.json()}async function DE(e){const t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(t.ok)return P7(),{ok:!0};const n=await t.json().catch(()=>null);return t.status===429?{ok:!1,rateLimited:!0,retryAfterMs:typeof n?.retryAfterMs=="number"?n.retryAfterMs:void 0,error:n?.error||"Too many failed attempts. Please wait and try again."}:{ok:!1,error:n?.error||"Login failed"}}async function jE(){const e=await hr();await fetch("/api/auth/logout",{method:"POST",headers:{"X-XSRF-TOKEN":e}}),P7()}async function H7(){const e=await fetch("/api/terminal/agent-launchers");if(!e.ok)throw new Error("Failed to detect agent launchers");const t=await e.json();return Array.isArray(t?.agents)?t.agents:[]}async function PE(){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 BE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-hooks/${encodeURIComponent(e)}/install`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to install agent hooks");return{summary:r.summary??"Installed",devMode:r.devMode===!0}}async function FE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-hooks/${encodeURIComponent(e)}/uninstall`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to uninstall agent hooks");return r.summary??"Removed"}class G2 extends Error{constructor(t,n,r){super(t),this.code=n,this.migration=r,this.name="AgentPluginManifestError"}code;migration}async function OE(){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 QE(e){const t=await hr(),n=await fetch("/api/terminal/agent-plugins",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok)throw new G2(r.error||"Failed to create agent plugin",r.code,r.migration);return r}async function $E(e){const t=await hr(),n=await fetch("/api/terminal/agent-plugins/install",{method:"POST",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify({source:e})}),r=await n.json().catch(()=>({}));if(!n.ok)throw new G2(r.error||"Failed to install agent plugin",r.code,r.migration);return r}async function HE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}/check-update`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to check plugin updates");return r}async function UE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}/update`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to update plugin");return r}async function zE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}/doctor`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error||"Failed to diagnose plugin");return r}async function GE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-plugins/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to delete agent plugin")}}async function WE(e){const t=await hr(),n=await fetch(`/api/terminal/${encodeURIComponent(e)}/agent-resume`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Ia(r.error||"Failed to resume agent session",n.status,typeof r.code=="string"?r.code:void 0);return{command:r.command??""}}async function Jv(){const e=await fetch("/api/terminal/agent-resume-history",{method:"GET"});if(!e.ok)throw new Error("Failed to load Agent resume history");const t=await e.json().catch(()=>({entries:[]}));return Array.isArray(t.entries)?t.entries:[]}async function U7(e){const t=await hr(),n=await fetch(`/api/terminal/agent-resume-history/${encodeURIComponent(e)}/prepare`,{method:"POST",headers:{"X-XSRF-TOKEN":t}}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Ia(r.error||"Failed to prepare Agent session resume",n.status,typeof r.code=="string"?r.code:void 0);return r}async function VE(e){const t=await hr(),n=await fetch(`/api/terminal/agent-resume-history/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"X-XSRF-TOKEN":t}});if(!n.ok&&n.status!==404)throw new Error("Failed to remove Agent resume history")}async function hd(e){const t=await hr(),n=await fetch("/api/terminal/program-rules",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to update program rules"}));throw new Error(r.error||"Failed to update program rules")}return n.json()}async function qE(){const e=await hr(),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 YE(){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 e5(e){const t=await hr(),n=await fetch("/api/terminal/program-detection",{method:"PUT",headers:{"Content-Type":"application/json","X-XSRF-TOKEN":t},body:JSON.stringify(e)});if(!n.ok)throw new Error("Failed to save program detection config");return n.json()}async function KE(){const e=await hr(),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 XE={".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",".heic":"image/heic",".heif":"image/heif"};function W2(e){const t=e.lastIndexOf(".");return t<0?null:XE[e.slice(t).toLowerCase()]??null}function V2(e){return W2(e)!==null}function z7(e){const t=W2(e);return t==="image/heic"||t==="image/heif"}const ZE={".mp4":"video/mp4",".m4v":"video/x-m4v",".webm":"video/webm",".mov":"video/quicktime",".ogv":"video/ogg",".mpeg":"video/mpeg",".mpg":"video/mpeg"};function G7(e){const t=e.lastIndexOf(".");return t<0?null:ZE[e.slice(t).toLowerCase()]??null}function W7(e){return G7(e)!==null}function JE(e){return`/api/terminal/fs/video?path=${encodeURIComponent(e)}&action=view_file`}const eI=[".stl",".glb",".gltf"];function V7(e){const t=e.lastIndexOf(".");if(t<0)return null;const n=e.slice(t).toLowerCase();return eI.includes(n)?n:null}function q7(e){return V7(e)!==null}function Y7(e){const t=e.toLowerCase();return t.endsWith(".kicad_sch")?".kicad_sch":t.endsWith(".kicad_pcb")?".kicad_pcb":null}function tI(e){return Y7(e)!==null}function nI(e){return Y7(e)===".kicad_pcb"?"pcb-front":"schematic"}const rI=[".html",".htm"];function O0(e){const t=e.lastIndexOf(".");if(t<0)return!1;const n=e.slice(t).toLowerCase();return rI.includes(n)}function sI(e){return`/api/terminal/fs/preview/${e.split(/[\\/]+/).filter(Boolean).map(n=>encodeURIComponent(n)).join("/")}`}const iI={".stl":"model/stl",".glb":"model/gltf-binary",".gltf":"model/gltf+json"};async function K7(e,t,n,r="list_directory",s){const i=new URLSearchParams({path:e});n&&i.set("showHidden","true"),i.set("action",r),s&&i.set("requestSlotId",s);const l=await Ns(`/api/terminal/fs/list?${i}`,{signal:t},eu,"Directory listing took too long. The folder may be on slow storage or blocked by another process.");if(!l.ok){const c=await l.json().catch(()=>({error:"Failed to list directory"}));throw new Error(c.error||"Failed to list directory")}return l.json()}async function oI(e,t,n,r,s,i="name",l){const c=new URLSearchParams({path:e,query:t,stream:"true"});s&&c.set("showHidden","true"),i==="content"&&c.set("mode","content"),l&&c.set("requestSlotId",l);const u=await fetch(`/api/terminal/fs/search?${c}`,{signal:r});if(!u.ok||!u.body){const v=await u.json().catch(()=>({error:"Failed to search files"}));throw new Error(v.error||"Failed to search files")}const f=u.body.getReader(),p=new TextDecoder;let g="";const y=v=>{if(!v.trim())return;const S=JSON.parse(v);if(S.type==="meta")n({path:S.path,query:S.query,engine:S.engine,mode:S.mode,limited:S.limited});else if(S.type==="batch")n({entries:S.entries??[]});else if(S.type==="content-batch")n({contentEntries:S.contentEntries??[]});else{if(S.type==="error")throw new Error(S.message||"Search failed");S.type==="done"&&n({total:S.total,truncated:S.truncated,limited:S.limited,engine:S.engine,mode:S.mode,done:!0})}};for(;;){const{value:v,done:S}=await f.read();if(S)break;g+=p.decode(v,{stream:!0});let A=g.indexOf(`
3
3
  `);for(;A>=0;)y(g.slice(0,A)),g=g.slice(A+1),A=g.indexOf(`
4
4
  `)}g+=p.decode(),y(g)}async function aI(e,t,n){const r=new URLSearchParams;r.set("roots",e.join("|"));const s=await fetch(`/api/terminal/fs/watch?${r}`,{signal:n});if(!s.ok||!s.body){const f=await s.json().catch(()=>({error:"Failed to watch files"}));throw new Error(f.error||"Failed to watch files")}const i=s.body.getReader(),l=new TextDecoder;let c="";const u=f=>{if(!f.trim())return;const p=JSON.parse(f);p.type==="events"&&p.events?.length&&t(p.events)};for(;;){const{value:f,done:p}=await i.read();if(p)break;c+=l.decode(f,{stream:!0});let g=c.indexOf(`
@@ -176,12 +176,12 @@ ${z.desc}`:""}`,"aria-pressed":T===z.key,onPointerEnter:()=>A(z.key),onPointerLe
176
176
 
177
177
  `;return`${e}${r}${n}`}function VZ(e,t){const n=e.trim();return n?t?`${n}\r`:/\s$/.test(e)?e:`${n} `:""}const _2="termdock:right-sidebar:html-view-mode-by-file:v1";function qZ(e){return e==="preview"||e==="source"}function gT(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.values(e).every(qZ)}function xT(e,t){if(!t)return null;const n=e&&!t.startsWith("/")?`${e}/${t}`:t;return e?`${e}::${n}`:n}function b4(e,t){const n=xT(e,t);return n?Or(_2,gT)?.[n]??"source":"source"}function YZ(e,t,n){const r=xT(e,t);if(!r)return;const s=Or(_2,gT)??{};Gn(_2,{...s,[r]:n})}function zx(e){const t=Number.isFinite(e)&&e>0?Math.floor(e):0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,i=String(r).padStart(2,"0"),l=String(s).padStart(2,"0");return n>0?`${n}:${i}:${l}`:`${i}:${l}`}function KZ(e,t,n){return!Number.isFinite(n)||n<=0||!t.width?0:Math.min(1,Math.max(0,(e-t.left)/t.width))*n}const XZ=350,ZZ=12,JZ=90;function eJ({url:e,onLoadError:t}){const{t:n}=qn(),r=b.useRef(null),s=b.useRef(null),i=b.useRef(null),l=b.useRef(null),c=b.useRef(!1),u=b.useRef(null),f=b.useRef(null),p=b.useRef(0),g=b.useRef(!1),y=b.useRef(!1),v=b.useRef(!1),S=b.useRef(null),A=b.useRef(null),T=b.useRef(!1),L=b.useRef(1),I=b.useRef(!1),[j,P]=b.useState(0),[F,R]=b.useState(0),[C,H]=b.useState(!1),[Q,K]=b.useState(!1),[V,he]=b.useState(null),[X,pe]=b.useState(!1),[ge,de]=b.useState(0),[oe,W]=b.useState(!1),[z,te]=b.useState({width:0,height:0}),ae=b.useCallback(()=>{S.current!==null&&(clearTimeout(S.current),S.current=null)},[]),be=b.useCallback(()=>{if(ae(),A.current=null,!T.current)return!1;const Re=i.current;return Re&&(Re.playbackRate=L.current),T.current=!1,pe(!1),!0},[ae]);b.useEffect(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current),f.current!==null&&clearTimeout(f.current),ae();const Re=i.current;Re&&T.current&&(Re.playbackRate=L.current)},[ae]),b.useEffect(()=>{const Re=s.current;if(!Re||typeof ResizeObserver>"u")return;const Ue=new ResizeObserver(([gt])=>{gt&&te({width:gt.contentRect.width,height:gt.contentRect.height})});return Ue.observe(Re),()=>Ue.disconnect()},[]),b.useEffect(()=>{const Re=()=>W(document.fullscreenElement===r.current);return document.addEventListener("fullscreenchange",Re),()=>document.removeEventListener("fullscreenchange",Re)},[]);const Le=b.useCallback((Re,Ue=!1)=>{const gt=i.current;if(!gt)return!1;const bt=Number.isFinite(gt.duration)?gt.duration:Re,vt=Math.min(Math.max(Re,0),bt);if(R(vt),Math.abs(gt.currentTime-vt)<1/120)return!1;const rn=gt.fastSeek;return Ue&&typeof rn=="function"?rn.call(gt,vt):gt.currentTime=vt,!0},[]),me=b.useCallback(()=>{u.current===null&&(u.current=requestAnimationFrame(()=>{u.current=null;const Re=i.current;if(!Re||!g.current||y.current||Re.seeking)return;const Ue=v.current;v.current=!1,y.current=Le(p.current,!Ue)}))},[Le]),ce=b.useCallback(Re=>{const Ue=l.current,gt=i.current;if(!Ue||!gt)return;const bt=Ue.getBoundingClientRect(),vt=KZ(Re,bt,gt.duration);p.current=vt,he(vt),v.current=!1,me(),f.current!==null&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,v.current=!0,me()},JZ)},[me]),xe=b.useCallback(()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),f.current!==null&&(clearTimeout(f.current),f.current=null),v.current=!1,y.current=!1,Le(p.current)},[Le]),Z=b.useCallback(Re=>{const Ue=i.current;if(!(!Ue||!Number.isFinite(Ue.duration)||Ue.duration<=0)){c.current=!Ue.paused,Ue.pause(),g.current=!0,K(!0);try{Re.currentTarget.setPointerCapture(Re.pointerId)}catch{}ce(Re.clientX)}},[ce]),Ke=b.useCallback(()=>{g.current=!1,xe(),K(!1),he(null);const Re=i.current;Re&&c.current&&!Re.ended&&Re.play().catch(()=>{}),c.current=!1},[xe]),Xe=b.useCallback(()=>{const Re=i.current;if(Re){if(I.current){I.current=!1;return}Re.paused?Re.play().catch(()=>{}):Re.pause()}},[]),nt=b.useCallback(Re=>{const Ue=i.current;!Ue||Ue.paused||Re.button!==0||(ae(),A.current={id:Re.pointerId,x:Re.clientX,y:Re.clientY},S.current=setTimeout(()=>{S.current=null,L.current=Ue.playbackRate,Ue.playbackRate=2,T.current=!0,pe(!0)},XZ))},[ae]),Ae=b.useCallback(Re=>{const Ue=A.current;!Ue||Ue.id!==Re.pointerId||T.current||Math.hypot(Re.clientX-Ue.x,Re.clientY-Ue.y)>ZZ&&(ae(),A.current=null)},[ae]),Fe=b.useCallback(()=>{be()&&(I.current=!0)},[be]);b.useEffect(()=>(window.addEventListener("pointerup",Fe),window.addEventListener("pointercancel",Fe),window.addEventListener("blur",Fe),()=>{window.removeEventListener("pointerup",Fe),window.removeEventListener("pointercancel",Fe),window.removeEventListener("blur",Fe)}),[Fe]);const fe=b.useCallback(async()=>{const Re=r.current,Ue=i.current;if(!(!Re||!Ue))try{document.fullscreenElement===Re?await document.exitFullscreen():Re.requestFullscreen?await Re.requestFullscreen():Ue.webkitEnterFullscreen?.()}catch{Ue.webkitEnterFullscreen?.()}},[]),Be=b.useCallback(()=>de(Re=>(Re+90)%360),[]),He=b.useCallback(Re=>{const Ue=i.current;if(!Ue||!Number.isFinite(Ue.duration))return;const gt=Re.shiftKey?10:5;let bt=null;Re.key==="ArrowLeft"?bt=Ue.currentTime-gt:Re.key==="ArrowRight"?bt=Ue.currentTime+gt:Re.key==="Home"?bt=0:Re.key==="End"&&(bt=Ue.duration),bt!==null&&(Re.preventDefault(),Le(bt))},[Le]),Ze=Q&&V!==null?V:F,q=j>0?Math.min(1,Math.max(0,Ze/j)):0,Qe=(ge===90||ge===270)&&z.width>0&&z.height>0?{width:`${z.height}px`,height:`${z.width}px`}:{width:"100%",height:"100%"};return o.jsxs("div",{ref:r,className:"flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-background fullscreen:h-screen fullscreen:w-screen fullscreen:rounded-none","data-testid":"file-preview-video-player","data-rotation":ge,children:[o.jsxs("div",{ref:s,className:"relative min-h-0 flex-1 overflow-hidden bg-background",children:[o.jsx("video",{ref:i,"data-testid":"file-preview-video",className:"absolute left-1/2 top-1/2 max-w-none object-contain transition-transform duration-200",style:{...Qe,transform:`translate(-50%, -50%) rotate(${ge}deg)`},src:e,preload:"auto",playsInline:!0,onClick:Xe,onPointerDown:nt,onPointerMove:Ae,onPointerUp:Fe,onPointerCancel:Fe,onContextMenu:Re=>{T.current&&Re.preventDefault()},onPlay:()=>H(!0),onPause:()=>H(!1),onTimeUpdate:Re=>R(Re.currentTarget.currentTime),onSeeked:Re=>{const Ue=Re.currentTarget;if(R(Ue.currentTime),y.current=!1,!g.current)return;const gt=Ue.requestVideoFrameCallback;typeof gt=="function"?gt.call(Ue,()=>{g.current&&me()}):requestAnimationFrame(()=>{g.current&&me()})},onLoadedMetadata:Re=>P(Number.isFinite(Re.currentTarget.duration)?Re.currentTarget.duration:0),onDurationChange:Re=>P(Number.isFinite(Re.currentTarget.duration)?Re.currentTarget.duration:0),onError:t,children:n("rightSidebar.videoUnsupported")}),X&&o.jsx("div",{className:"pointer-events-none absolute left-1/2 top-3 z-10 -translate-x-1/2 rounded-full bg-surface-elevated px-3 py-1 text-xs font-semibold tabular-nums text-foreground shadow-md",children:n("rightSidebar.videoLongPressSpeed")}),Q&&V!==null&&o.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:`${q*100}%`},"data-testid":"file-preview-video-scrub-time",children:zx(V)})]}),o.jsx("div",{"data-testid":"file-preview-video-controls",className:`shrink-0 border-t border-border/60 bg-background px-2 py-1.5 ${f9}`,[h9]:"",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:Xe,"aria-label":n(C?"rightSidebar.videoPause":"rightSidebar.videoPlay"),title:n(C?"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:C?o.jsx(p8,{size:14}):o.jsx(Tb,{size:14})}),o.jsxs("div",{ref:l,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(j),"aria-valuenow":Math.floor(Ze),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:Z,onPointerMove:Re=>{Q&&ce(Re.clientX)},onPointerUp:Ke,onPointerCancel:Ke,onKeyDown:He,children:[o.jsx("div",{className:"h-1 w-full rounded-full bg-surface-elevated"}),o.jsx("div",{className:"absolute inset-y-0 left-0 my-auto h-1 rounded-full bg-primary",style:{width:`${q*100}%`}}),o.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:`${q*100}%`}})]}),o.jsxs("div",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground","data-testid":"file-preview-video-time",children:[zx(Ze)," / ",zx(j)]}),o.jsx("button",{type:"button",onClick:Be,"aria-label":n("rightSidebar.videoRotate"),title:n("rightSidebar.videoRotate"),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-rotate",children:o.jsx(vM,{size:14})}),o.jsx("button",{type:"button",onClick:()=>{fe()},"aria-label":n(oe?"rightSidebar.videoFullscreenExit":"rightSidebar.videoFullscreenEnter"),title:n(oe?"rightSidebar.videoFullscreenExit":"rightSidebar.videoFullscreenEnter"),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-fullscreen",children:oe?o.jsx(XN,{size:14}):o.jsx(WN,{size:14})})]})})]})}function tJ(e){const t=Math.max(0,Math.min(100,e.xPercent)),n=Math.max(0,Math.min(100,e.yPercent));return{...t<=50?{left:`calc(${t}% + 8px)`}:{right:`calc(${100-t}% + 8px)`},...n<=50?{top:`calc(${n}% + 8px)`}:{bottom:`calc(${100-n}% + 8px)`}}}function Og({anchor:e,children:t,disabled:n=!1,onClick:r,title:s}){return o.jsxs("button",{type:"button","data-floating-annotation-button":!0,disabled:n,onClick:i=>{i.stopPropagation(),r()},title:s,style:tJ(e),className:"absolute z-30 inline-flex h-7 items-center gap-1 rounded-full bg-primary px-3 text-[11px] font-semibold text-primary-foreground shadow-lg ring-1 ring-primary/30 transition hover:bg-primary/90 active:scale-95 disabled:cursor-wait disabled:opacity-50",children:[o.jsx(Tl,{size:11}),t]})}function nJ(e,t,n,r){if(n.width<=0||n.height<=0||r.width<=0||r.height<=0)return null;const s=Math.min(n.width/r.width,n.height/r.height);if(!Number.isFinite(s)||s<=0)return null;const i=r.width*s,l=r.height*s,c=n.left+(n.width-i)/2,u=n.top+(n.height-l)/2,f=e-c,p=t-u;if(f<0||p<0||f>i||p>l)return null;const g=f/i*100,y=p/l*100;return{x:r.x+r.width*g/100,y:r.y+r.height*y/100,xPercent:g,yPercent:y}}function rJ(e,t,n){const r=[`SVG标注: ${e}`,`视图: ${t}`,`SVG坐标: (${n.x.toFixed(2)},${n.y.toFixed(2)}) [viewBox坐标]`,`图片位置: (${n.xPercent.toFixed(1)}%,${n.yPercent.toFixed(1)}%) [相对内容边界左上角]`];return n.nearestText&&r.push(`最近文字: ${n.nearestText}`),`"${r.join(" / ")}"`}function sJ(e){const t=new DOMParser().parseFromString(e,"image/svg+xml"),n=t.documentElement;if(n.nodeName.toLowerCase()!=="svg"||t.querySelector("parsererror"))throw new Error("Invalid SVG document");return t.querySelectorAll("script,foreignObject,iframe,object,embed").forEach(r=>r.remove()),t.querySelectorAll("*").forEach(r=>{for(const s of Array.from(r.attributes)){const i=s.name.toLowerCase(),l=s.value.trim();(i.startsWith("on")||(i==="href"||i.endsWith(":href"))&&l&&!l.startsWith("#"))&&r.removeAttribute(s.name)}}),n.removeAttribute("width"),n.removeAttribute("height"),n.setAttribute("preserveAspectRatio","xMidYMid meet"),new XMLSerializer().serializeToString(n)}function iJ(e,t,n){let r=null;for(const s of Array.from(e.querySelectorAll("text"))){const i=(s.textContent??"").replace(/\s+/g," ").trim();if(!i)continue;const l=Number(s.getAttribute("x")),c=Number(s.getAttribute("y"));if(!Number.isFinite(l)||!Number.isFinite(c))continue;const u=Math.hypot(l-t,c-n);(!r||u<r.distance)&&(r={text:i,distance:u})}return r?.text.slice(0,120)}function bT({blobUrl:e,filePath:t,viewLabel:n,onInsertAnnotation:r}){const s=b.useRef(null),i=b.useRef(null),[l,c]=b.useState(null),[u,f]=b.useState(null),[p,g]=b.useState(1),[y,v]=b.useState(!1),[S,A]=b.useState(null),T=b.useRef(new Map),L=b.useRef(null),I=b.useRef(!1),j=b.useRef(null),P=b.useRef(p);P.current=p,b.useEffect(()=>{const oe=new AbortController;return c(null),f(null),A(null),g(1),fetch(e,{signal:oe.signal}).then(W=>W.text()).then(W=>c(sJ(W))).catch(W=>{oe.signal.aborted||f(W instanceof Error?W.message:"SVG preview failed")}),()=>oe.abort()},[e]),b.useEffect(()=>{if(!y)return;const oe=W=>{W.key==="Escape"&&v(!1)};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[y]),b.useLayoutEffect(()=>{const oe=i.current,W=oe?.querySelector("[data-svg-document] > svg");if(!oe||!W)return;let z;try{z=W.getBBox()}catch{return}if(!z.width||!z.height)return;const te=Math.max(2,Math.min(z.width,z.height)*.025);W.setAttribute("viewBox",`${z.x-te} ${z.y-te} ${z.width+2*te} ${z.height+2*te}`),W.style.width=`${p*100}%`,W.style.height=`${p*100}%`,W.style.minWidth=`${p*100}%`,W.style.minHeight=`${p*100}%`,W.style.display="block"},[l,p]);const F=b.useMemo(()=>S?rJ(t,n,S):null,[t,S,n]),R=oe=>{if(I.current){I.current=!1;return}const W=i.current,z=W?.querySelector("[data-svg-document] > svg"),te=s.current;if(!W||!z||!te)return;const ae=z.viewBox.baseVal,be=nJ(oe.clientX,oe.clientY,z.getBoundingClientRect(),ae);if(!be)return;const Le=te.getBoundingClientRect();A({...be,nearestText:iJ(z,be.x,be.y),stageX:oe.clientX-Le.left,stageY:oe.clientY-Le.top,stageXPercent:(oe.clientX-Le.left)/Le.width*100,stageYPercent:(oe.clientY-Le.top)/Le.height*100})},C=oe=>Math.max(1,Math.min(12,oe)),H=(oe,W)=>{const z=C(W),te=oe.querySelector("[data-svg-document] > svg");if(!te)return z;const ae=`${z*100}%`;return te.style.width=ae,te.style.height=ae,te.style.minWidth=ae,te.style.minHeight=ae,P.current=z,z},Q=(oe,W,z,te)=>{const ae=P.current,be=oe.getBoundingClientRect(),Le=z-be.left,me=te-be.top,ce=(oe.scrollLeft+Le)/ae,xe=(oe.scrollTop+me)/ae,Z=H(oe,W);return oe.scrollLeft=ce*Z-Le,oe.scrollTop=xe*Z-me,Z},K=()=>{const oe=Array.from(T.current.values());return oe.length>=2?Math.hypot(oe[0].x-oe[1].x,oe[0].y-oe[1].y):0},V=oe=>{if(oe.pointerType==="mouse"&&oe.button!==0)return;const W=i.current;W&&(T.current.set(oe.pointerId,{x:oe.clientX,y:oe.clientY}),W.setPointerCapture?.(oe.pointerId),T.current.size>=2?(L.current={kind:"pinch",startX:oe.clientX,startY:oe.clientY,startScrollLeft:W.scrollLeft,startScrollTop:W.scrollTop,startDistance:K(),startZoom:P.current,moved:!1},I.current=!0):P.current>1&&(L.current={kind:"pan",startX:oe.clientX,startY:oe.clientY,startScrollLeft:W.scrollLeft,startScrollTop:W.scrollTop,startZoom:P.current,moved:!1}))},he=oe=>{if(!T.current.has(oe.pointerId))return;T.current.set(oe.pointerId,{x:oe.clientX,y:oe.clientY});const W=i.current,z=L.current;if(!(!W||!z)){if(T.current.size>=2&&z.kind==="pinch"){const te=K();if(!z.startDistance||!te)return;const ae=C(z.startZoom*te/z.startDistance);if(Math.abs(ae-P.current)<.01)return;const be=Array.from(T.current.values()),Le=(be[0].x+be[1].x)/2,me=(be[0].y+be[1].y)/2;z.moved=!0,I.current=!0,Q(W,ae,Le,me),oe.preventDefault();return}if(z.kind==="pan"&&T.current.size===1){const te=oe.clientX-z.startX,ae=oe.clientY-z.startY;if(!z.moved&&Math.hypot(te,ae)<6)return;z.moved=!0,I.current=!0,W.scrollLeft=z.startScrollLeft-te,W.scrollTop=z.startScrollTop-ae,oe.preventDefault()}}},X=oe=>{const W=i.current,z=L.current,te=T.current.size===1&&!z?.moved;T.current.delete(oe.pointerId);try{W?.releasePointerCapture?.(oe.pointerId)}catch{}if(T.current.size===1&&z?.kind==="pinch"){const Le=Array.from(T.current.values())[0];L.current=W?{kind:"pan",startX:Le.x,startY:Le.y,startScrollLeft:W.scrollLeft,startScrollTop:W.scrollTop,startZoom:P.current,moved:!1}:null;return}if(T.current.size>0||(L.current=null,z?.kind==="pinch"&&g(P.current),!te||I.current))return;const ae=Date.now(),be=j.current;be&&ae-be.time<350&&Math.hypot(oe.clientX-be.x,oe.clientY-be.y)<24?(j.current=null,I.current=!0,g(Le=>Le>1?1:2.5)):j.current={time:ae,x:oe.clientX,y:oe.clientY}},pe=oe=>{if(!oe.ctrlKey&&!oe.metaKey)return;const W=i.current;if(!W)return;oe.preventDefault();const z=Q(W,P.current*Math.exp(-oe.deltaY*.01),oe.clientX,oe.clientY);g(z)},ge=()=>{g(1),P.current=1,i.current&&(i.current.scrollLeft=0,i.current.scrollTop=0)},de=o.jsxs("div",{className:y?"fixed inset-0 z-modal-panel flex min-h-0 flex-col bg-surface pt-[env(safe-area-inset-top,0px)]":"flex h-full min-h-0 flex-col bg-surface",children:[o.jsxs("div",{ref:s,className:"relative min-h-0 flex-1",children:[o.jsx("div",{ref:i,role:"button",tabIndex:0,onClick:R,onDoubleClick:oe=>{oe.preventDefault(),g(W=>W>1?1:2.5)},onPointerDown:V,onPointerMove:he,onPointerUp:X,onPointerCancel:X,onWheel:pe,onScroll:()=>A(null),className:"h-full touch-none cursor-crosshair overflow-auto bg-white p-3 text-slate-900",children:u?o.jsx("div",{className:"p-4 text-sm text-destructive",children:u}):l?o.jsx("div",{"data-svg-document":!0,className:"h-full min-h-[240px] w-full",dangerouslySetInnerHTML:{__html:l}}):o.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading SVG…"})}),S&&o.jsx("span",{"data-svg-pick-marker":!0,className:"pointer-events-none absolute z-10 h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-primary bg-white shadow-sm",style:{left:S.stageX,top:S.stageY}}),S&&F&&o.jsx(Og,{anchor:{xPercent:S.stageXPercent,yPercent:S.stageYPercent},title:"引用 SVG 标注",onClick:()=>{r?.(F,`svg:${S.x.toFixed(2)}:${S.y.toFixed(2)}`),A(null)},children:"引用 SVG 标注"}),o.jsxs("div",{"data-svg-toolbar":!0,className:"absolute right-2 top-2 z-20 flex gap-1",children:[p>1.001&&o.jsx("button",{type:"button","aria-label":"适合窗口",title:"适合窗口",onClick:oe=>{oe.stopPropagation(),ge()},className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-slate-200 bg-white/95 text-slate-600 shadow-sm backdrop-blur transition active:scale-95",children:o.jsx(AM,{size:14})}),o.jsx("button",{type:"button","aria-label":y?"退出全屏 SVG":"全屏 SVG",title:y?"退出全屏 SVG":"全屏 SVG",onClick:oe=>{oe.stopPropagation(),v(W=>!W)},className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-slate-200 bg-white/95 text-slate-600 shadow-sm backdrop-blur transition active:scale-95",children:y?o.jsx(ny,{size:14}):o.jsx(ty,{size:14})})]})]}),o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border/15 px-3 py-2",children:o.jsx("span",{className:"min-w-0 truncate text-[11px] text-muted-foreground",children:S?`SVG (${S.x.toFixed(2)}, ${S.y.toFixed(2)}) · ${S.nearestText??"附近无文字"}`:"点击 SVG 的问题位置生成精确引用"})})]});return y?aa.createPortal(de,document.body):de}function xm(e){switch(e){case"schematic":return"原理图第1页";case"pcb-front":return"PCB正面";case"pcb-back":return"PCB背面(镜像)";case"pcb-3d":return"PCB 3D正面"}}function oJ(e,t,n,r){const s=[`电子标注: ${e}`,`视图: ${xm(t)}`,`图片位置: (${n.xPercent.toFixed(1)}%,${n.yPercent.toFixed(1)}%) [相对渲染图左上角]`];if(r?.available&&r.xMm!==void 0&&r.yMm!==void 0&&(s.push(`PCB坐标: (${r.xMm.toFixed(2)},${r.yMm.toFixed(2)})mm [KiCad板坐标]`),r.layer&&s.push(`显示层: ${r.layer}`),r.nearest)){const i=[r.nearest.net?`网络 ${r.nearest.net}`:null,`对象层 ${r.nearest.layer}`,`距离 ${r.nearest.distanceMm.toFixed(2)}mm`].filter(Boolean).join(",");s.push(`最近对象: ${r.nearest.label}${i?`(${i})`:""}`)}return`"${s.join(" / ")}"`}function aJ({blobUrl:e,filePath:t,view:n,board:r,onViewChange:s,onInsertAnnotation:i,onRefresh:l,interactive3d:c}){const{t:u}=qn(),f=b.useRef(null),p=b.useRef(null),g=b.useRef(null),[y,v]=b.useState(null),[S,A]=b.useState(!1);b.useEffect(()=>(g.current?.abort(),v(null),A(!1),()=>g.current?.abort()),[e,n]);const T=b.useMemo(()=>y?oJ(t,n,y,y.inspection):null,[t,y,n]),L=j=>{const P=f.current,F=p.current;if(!P||!F||!F.naturalWidth||!F.naturalHeight)return;const R=P.getBoundingClientRect(),C=Math.min(R.width/F.naturalWidth,R.height/F.naturalHeight),H=F.naturalWidth*C,Q=F.naturalHeight*C,K=R.left+(R.width-H)/2,V=R.top+(R.height-Q)/2,he=j.clientX-K,X=j.clientY-V;if(he<0||X<0||he>H||X>Q)return;const pe={xPercent:Math.max(0,Math.min(100,he/H*100)),yPercent:Math.max(0,Math.min(100,X/Q*100)),stageXPercent:(j.clientX-R.left)/R.width*100,stageYPercent:(j.clientY-R.top)/R.height*100,inspecting:r&&n!=="pcb-3d"};if(v(pe),g.current?.abort(),!pe.inspecting)return;const ge=new AbortController;g.current=ge,uI(t,n,pe.xPercent,pe.yPercent,ge.signal).then(de=>v(oe=>oe===pe?{...oe,inspection:de,inspecting:!1}:oe)).catch(()=>{ge.signal.aborted||v(de=>de===pe?{...de,inspection:{available:!1},inspecting:!1}:de)})},I=r?["pcb-front","pcb-back","pcb-3d"]:["schematic"];return o.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border/15 px-3 py-2",children:[o.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:I.map(j=>o.jsx("button",{type:"button",onClick:()=>s(j),className:`h-8 shrink-0 rounded-full px-3 text-xs font-semibold transition active:scale-95 ${j===n?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,children:xm(j)},j))}),o.jsx("button",{type:"button",onClick:l,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",title:u("rightSidebar.edaRefresh"),"aria-label":u("rightSidebar.edaRefresh"),children:o.jsx(Xs,{size:13})})]}),r&&c?o.jsx("div",{className:n==="pcb-3d"?"flex min-h-0 flex-1 flex-col overflow-hidden":"hidden",children:c}):null,r?n==="pcb-3d"?c?null:o.jsx("div",{className:"min-h-0 flex-1"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:f,role:"button",tabIndex:0,onClick:L,onKeyDown:j=>{j.key!=="Enter"&&j.key!==" "||(j.preventDefault(),v({xPercent:50,yPercent:50,stageXPercent:50,stageYPercent:50}))},className:"relative min-h-0 flex-1 cursor-crosshair overflow-hidden bg-surface p-3 outline-none",title:u("rightSidebar.edaPickHint"),children:[o.jsx("img",{ref:p,src:e,alt:`${t} ${xm(n)}`,onLoad:()=>A(!0),className:`pointer-events-none h-full w-full object-contain transition-opacity ${S?"opacity-100":"opacity-0"}`}),y&&o.jsx("span",{className:"pointer-events-none absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-primary bg-surface shadow-sm",style:{left:`${y.stageXPercent}%`,top:`${y.stageYPercent}%`}}),y&&T&&o.jsx(Og,{anchor:{xPercent:y.stageXPercent,yPercent:y.stageYPercent},disabled:y.inspecting,title:u("rightSidebar.edaInsertAnnotation"),onClick:()=>{i?.(T,`eda:${n}:${y.xPercent.toFixed(1)}:${y.yPercent.toFixed(1)}`),v(null)},children:u("rightSidebar.edaInsertAnnotation")})]}),o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border/15 px-3 py-2",children:o.jsx("span",{className:"min-w-0 truncate text-[11px] text-muted-foreground",children:y?y.inspecting?u("rightSidebar.edaInspecting"):y.inspection?.available?u("rightSidebar.edaPickedBoardPosition",{x:y.inspection.xMm?.toFixed(2)??"—",y:y.inspection.yMm?.toFixed(2)??"—",object:y.inspection.nearest?.label??u("rightSidebar.edaNoNearbyObject")}):u("rightSidebar.edaPickedPosition",{x:y.xPercent.toFixed(1),y:y.yPercent.toFixed(1)}):u("rightSidebar.edaPickHint")})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(bT,{blobUrl:e,filePath:t,viewLabel:xm(n),onInsertAnnotation:i})})]})}function lJ(e){const t=[];let n=[],r="",s=!1;for(let i=0;i<e.length;i+=1){const l=e[i];s?l==='"'&&e[i+1]==='"'?(r+='"',i+=1):l==='"'?s=!1:r+=l:l==='"'?s=!0:l===","?(n.push(r),r=""):l===`
178
178
  `?(n.push(r.replace(/\r$/,"")),t.push(n),n=[],r=""):r+=l}return(r||n.length>0)&&(n.push(r.replace(/\r$/,"")),t.push(n)),t}function cJ(e,t,n,r,s){const i=t[s]||`第${s+1}列`,l=n[s]??"",c=t.map((u,f)=>`${u||`第${f+1}列`}=${n[f]??""}`).join(";");return`"表格标注: ${e} / 数据行: ${r+1} / 列: ${i} / 值: ${l} / 记录: ${c}"`}function uJ({content:e,filePath:t,onInsertAnnotation:n}){const{t:r}=qn(),s=b.useMemo(()=>lJ(e),[e]),i=s[0]??[],l=s.slice(1),c=b.useRef(null),[u,f]=b.useState(null),p=u?l[u.row]:null,g=u&&p?cJ(t,i,p,u.row+1,u.column):null;return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-surface",children:[o.jsxs("div",{ref:c,className:"relative min-h-0 flex-1",children:[o.jsx("div",{className:"h-full overflow-auto",children:o.jsxs("table",{className:"min-w-full border-separate border-spacing-0 text-left text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{className:"sticky left-0 top-0 z-20 border-b border-r border-border/20 bg-surface-elevated px-2 py-2 text-[10px] font-semibold text-muted-foreground",children:"#"}),i.map((y,v)=>o.jsx("th",{className:"sticky top-0 z-10 min-w-28 border-b border-r border-border/20 bg-surface-elevated px-3 py-2 font-semibold text-foreground",children:y||r("rightSidebar.csvUnnamedColumn",{index:v+1})},`${y}:${v}`))]})}),o.jsx("tbody",{children:l.map((y,v)=>o.jsxs("tr",{className:"hover:bg-surface-2",children:[o.jsx("th",{className:"sticky left-0 z-10 border-b border-r border-border/15 bg-surface px-2 py-2 text-right text-[10px] font-normal text-muted-foreground",children:v+1}),i.map((S,A)=>{const T=u?.row===v&&u.column===A;return o.jsx("td",{className:`border-b border-r border-border/15 p-0 ${T?"bg-primary/15":""}`,children:o.jsx("button",{type:"button",onClick:L=>{const I=c.current?.getBoundingClientRect(),j=L.currentTarget.getBoundingClientRect();if(!I?.width||!I.height)return;const P=L.clientX||j.left+j.width/2,F=L.clientY||j.top+j.height/2;f({row:v,column:A,xPercent:(P-I.left)/I.width*100,yPercent:(F-I.top)/I.height*100})},className:"block h-full min-h-9 w-full whitespace-pre-wrap px-3 py-2 text-left text-foreground outline-none hover:bg-primary/10 focus-visible:bg-primary/10",children:y[A]||" "})},`cell:${v}:${A}`)})]},`row:${v}`))})]})}),u&&g&&o.jsx(Og,{anchor:{xPercent:u.xPercent,yPercent:u.yPercent},title:r("rightSidebar.csvInsertAnnotation"),onClick:()=>{n?.(g,`csv:${t}:${u.row+1}:${u.column+1}`),f(null)},children:r("rightSidebar.csvInsertAnnotation")})]}),o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border/15 px-3 py-2",children:o.jsx("span",{className:"min-w-0 truncate text-[11px] text-muted-foreground",children:u&&p?r("rightSidebar.csvSelectedCell",{row:u.row+1,column:i[u.column]||u.column+1}):r("rightSidebar.csvPickHint",{rows:l.length,columns:i.length})})})]})}function Cd(e,t){let n=e;for(const r of t){if(!n||typeof n!="object")return;n=n[r]}return n}function dJ(e,t){const n=JSON.parse(e),r=Cd(n,["meta","version"]);if(t)return[{label:"文件性质",value:"KiCad 本机界面状态,不属于电气设计源文件"},{label:"格式版本",value:String(r??"未知")},{label:"活动层编号",value:String(Cd(n,["board","active_layer"])??"未知")},{label:"可见层掩码",value:String(Cd(n,["board","visible_layers"])??"未知")},{label:"Git 集成",value:Cd(n,["git","integration_disabled"])===!0?"已禁用":"未禁用"}];const s=Cd(n,["net_settings","classes"]),i=Array.isArray(s)?s.find(c=>c&&typeof c=="object"&&c.name==="Default"):void 0,l=Cd(n,["board","design_settings","drc_exclusions"]);return[{label:"文件性质",value:"KiCad 工程配置"},{label:"格式版本",value:String(r??"未知")},{label:"网络类数量",value:String(Array.isArray(s)?s.length:0)},{label:"默认间距",value:i?.clearance!==void 0?`${i.clearance} mm`:"未设置"},{label:"默认线宽",value:i?.track_width!==void 0?`${i.track_width} mm`:"未设置"},{label:"默认过孔",value:i?.via_diameter!==void 0?`${i.via_diameter} / ${i.via_drill??"—"} mm(外径/钻孔)`:"未设置"},{label:"DRC 排除项",value:String(Array.isArray(l)?l.length:0)}]}function fJ(e,t){return`"KiCad项目标注: ${e} / 项: ${t.label} / 值: ${t.value}"`}function hJ({content:e,filePath:t,localState:n,onInsertAnnotation:r}){const{t:s}=qn(),i=b.useRef(null),[l,c]=b.useState(null),u=b.useMemo(()=>{try{return{items:dJ(e,n),error:null}}catch(p){return{items:[],error:p instanceof Error?p.message:String(p)}}},[e,n]),f=l===null?null:u.items[l.index];return u.error?o.jsx("pre",{className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-3 font-mono text-xs text-foreground",children:e}):o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-surface",children:[n&&o.jsx("div",{className:"border-b border-[color:var(--warning)]/20 bg-[color:var(--warning)]/5 px-3 py-2 text-xs text-[color:var(--warning)]",children:s("rightSidebar.kicadLocalStateNotice")}),o.jsxs("div",{ref:i,className:"relative min-h-0 flex-1",children:[o.jsxs("div",{className:"h-full overflow-auto px-3 py-2",children:[o.jsx("div",{className:"divide-y divide-border/15",children:u.items.map((p,g)=>o.jsxs("button",{type:"button",onClick:y=>{const v=i.current?.getBoundingClientRect(),S=y.currentTarget.getBoundingClientRect();if(!v?.width||!v.height)return;const A=y.clientX||S.left+S.width/2,T=y.clientY||S.top+S.height/2;c({index:g,xPercent:(A-v.left)/v.width*100,yPercent:(T-v.top)/v.height*100})},className:`grid w-full grid-cols-[minmax(7rem,0.8fr)_minmax(0,1.4fr)] gap-3 px-2 py-3 text-left transition hover:bg-surface-2 ${l?.index===g?"bg-primary/10":""}`,children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:p.label}),o.jsx("span",{className:"break-words text-xs text-foreground",children:p.value})]},p.label))}),o.jsxs("details",{className:"mt-3 border-t border-border/15 pt-3",children:[o.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:s("rightSidebar.kicadShowRawJson")}),o.jsx("pre",{className:"mt-2 overflow-auto whitespace-pre p-2 font-mono text-[10px] leading-relaxed text-foreground",children:e})]})]}),f&&l&&o.jsx(Og,{anchor:{xPercent:l.xPercent,yPercent:l.yPercent},title:s("rightSidebar.kicadInsertSetting"),onClick:()=>{r?.(fJ(t,f),`kicad-project:${t}:${f.label}`),c(null)},children:s("rightSidebar.kicadInsertSetting")})]}),o.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border/15 px-3 py-2",children:o.jsx("span",{className:"min-w-0 truncate text-[11px] text-muted-foreground",children:f?`${f.label}: ${f.value}`:s("rightSidebar.kicadProjectPickHint")})})]})}const pJ=b.forwardRef(function({src:t,title:n,exitFullscreenLabel:r,onFullscreenChange:s},i){const l=b.useRef(null),[c,u]=b.useState(!1),[f,p]=b.useState(!1),g=c||f;b.useEffect(()=>{s?.(g)},[g,s]),b.useEffect(()=>{const S=()=>{u(document.fullscreenElement===l.current)};return document.addEventListener("fullscreenchange",S),()=>document.removeEventListener("fullscreenchange",S)},[]),b.useEffect(()=>{if(!f)return;const S=A=>{A.key==="Escape"&&p(!1)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[f]);const y=b.useCallback(async()=>{const S=l.current;if(S){if(f){p(!1);return}if(document.fullscreenElement===S){await document.exitFullscreen();return}if(S.requestFullscreen&&document.fullscreenEnabled!==!1)try{await S.requestFullscreen();return}catch{}p(!0)}},[f]);b.useImperativeHandle(i,()=>({toggleFullscreen:y}),[y]);const v=o.jsxs("div",{ref:l,"data-html-preview-frame":!0,className:g?"fixed inset-0 z-modal-panel flex min-h-0 flex-col overflow-hidden bg-surface pt-[env(safe-area-inset-top,0px)] text-foreground":"flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[g&&o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between gap-3 border-b border-border/15 bg-[var(--chrome-bg)] px-3",children:[o.jsx("span",{className:"min-w-0 truncate text-[12px] font-semibold",children:n}),o.jsx("button",{type:"button",onClick:()=>{y()},"aria-label":r,title:`${r} (Esc)`,className:"inline-flex h-9 w-9 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",children:o.jsx(ny,{size:15})})]}),o.jsx("iframe",{src:t,title:n,sandbox:"allow-scripts",className:"block min-h-0 w-full flex-1 border-0 bg-white"})]});return f?aa.createPortal(v,document.body):v}),yT="termdock-file-search-match",L2="termdock-file-search-current";function mJ(e){const t=e.metaKey||e.ctrlKey,n=e.key.toLocaleLowerCase();return t&&n==="f"?"open":t&&n==="g"||e.key==="F3"?e.shiftKey?"previous":"next":e.key==="Escape"?"close":null}function gJ(e){return e.parentElement?.closest("[data-markdown-preview-block-start], [data-file-preview-line]")??null}function xJ(e,t){const n=t.trim().toLocaleLowerCase();if(!n)return[];const r=[];let s="",i=null;const l=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let p=l.nextNode();p;p=l.nextNode()){if(!(p instanceof Text)||!p.data)continue;const g=gJ(p);if(!g)continue;i&&i!==g&&(s+=`
179
- `);const y=s.length;s+=p.data,r.push({node:p,start:y,end:s.length,group:g}),i=g}const c=s.toLocaleLowerCase(),u=[];let f=0;for(;f<=c.length-n.length;){const p=c.indexOf(n,f);if(p<0)break;const g=p+n.length,y=r.find(S=>S.start<=p&&S.end>p),v=r.find(S=>S.start<g&&S.end>=g);if(y&&v&&y.group===v.group){const S=document.createRange();S.setStart(y.node,p-y.start),S.setEnd(v.node,g-v.start),u.push(S)}f=p+Math.max(n.length,1)}return u}function vT(){return typeof CSS<"u"&&CSS.highlights?CSS.highlights:null}function Qp(){const e=vT();e?.delete(yT),e?.delete(L2)}function y4(e,t){const n=vT();if(!n||typeof Highlight>"u")return;n.set(yT,new Highlight(...e));const r=e[t];r?n.set(L2,new Highlight(r)):n.delete(L2)}function v4(e){e?.startContainer.parentElement?.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})}const tv="termdock:right-sidebar:file-tree-scroll:v1",nv="termdock:right-sidebar:file-preview-reading-state:v1",Tf="termdock:right-sidebar:file-tree-width:v1",wT="termdock:right-sidebar:markdown-view-mode:v1",ST="termdock:right-sidebar:diff-change-list-mode:v1",AT="termdock:right-sidebar:diff-wrap:v1",TT="termdock:diff-viewer:view-type:v1",CT="termdock:right-sidebar:file-search-mode:v1",Gx="termdock:right-sidebar:collapsed-git-repo-groups:v1",w4="termdock:right-sidebar:collapsed-diff-directories:v1",Wx="termdock:right-sidebar:branch-audit-module-open:v1",kT="termdock:right-sidebar:branch-audit-module:v1",bJ=150,_T="termdock:right-sidebar:active-git-repo:v1",S4="termdock:right-sidebar:context-draft-enabled:v1",A4="termdock:right-sidebar:context-draft-collapsed:v1",T4="termdock:right-sidebar:context-draft-auto-collapse:v1",Vx="termdock:right-sidebar:context-draft-text:v1",yJ=300,vJ=20,wJ=120,SJ=250,AJ=250,TJ=120,CJ=700,qx=600,C4=[2e3,5e3,15e3,3e4],kJ=320,_J=500,LJ=20,EJ=12e3,E2=300,k4=240,IJ=560,LT="border-r px-2 py-1.5 sm:px-3 sm:py-2",ng="max-w-[18rem] whitespace-normal break-words sm:max-w-[27rem]",ET=`${LT} border-b border-border/15 font-semibold last:border-r-0`,IT=`${LT} border-border/10 align-top text-muted-foreground last:border-r-0`,rv="termdock-file-preview-horizontal-scroll",_4=b.lazy(()=>l0(()=>import("./ModelPreview-6FgWt8IX.js"),__vite__mapDeps([2,3,1,4]))),RT=`${rv} termdock-md-table-scroll max-w-full overflow-x-auto overflow-y-hidden rounded-lg border border-border/20 bg-surface`;function RJ(e,t,n){return e&&!t?"unified":n}const NJ=new Set([".md",".markdown",".mdown",".mkdn",".mkd"]);function MJ(e){return e==="preview"||e==="source"}function DJ(e){return e==="list"||e==="tree"||e==="ai"}function L4(){return Or(wT,MJ)??"preview"}function jJ(){return Or(ST,DJ)??"tree"}function Cf(e){return typeof e=="boolean"}function PJ(e){return typeof e=="string"}function BJ(){return Or(AT,Cf)??!0}function FJ(e){return e==="unified"||e==="split"}function OJ(){return Or(TT,FJ)??"unified"}function QJ(e){return e==="name"||e==="content"||e==="regex"}function $J(){return Or(CT,QJ)??"name"}function NT(e){return e.repositories??(e.context?.root?[{id:e.context.root,root:e.context.root,relativeRoot:".",name:bo(e.context.root)||e.context.root,depth:0,nested:!1,available:e.available,files:e.files,context:e.context,error:e.error}]:[])}function HJ(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string")}function MT(){return Or(_T,HJ)??{}}function E4(e){if(!e)return;const t=MT();return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function Yx(e,t){e&&Gn(_T,{...MT(),[e]:t})}function UJ(e,t){if(!t)return null;const n=new Set((e.repoFilters??[]).map(r=>r.root));return n.has(t)?t:n.size>0?null:(e.repositories??[]).some(r=>r.root===t)?t:null}function I2(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function I4(e){const t=Or(e,I2);return t?new Set(t):new Set}function Kx(e,t){Gn(e,[...t])}function zJ(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 GJ(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||I2(t.files))&&(t.hunks===void 0||Array.isArray(t.hunks)&&t.hunks.every(zJ))&&(t.commits===void 0||I2(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 WJ(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.key=="string"&&GJ(t.diff)&&typeof t.repoLabel=="string"&&typeof t.createdAt=="number"}function VJ(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 n=t;return Array.isArray(n.selectedRepoRoots)&&n.selectedRepoRoots.every(r=>typeof r=="string")&&!!n.repoTargetBranches&&typeof n.repoTargetBranches=="object"&&!Array.isArray(n.repoTargetBranches)&&Object.values(n.repoTargetBranches).every(r=>typeof r=="string")&&(n.repoBaseBranches===void 0||!!n.repoBaseBranches&&typeof n.repoBaseBranches=="object"&&!Array.isArray(n.repoBaseBranches)&&Object.values(n.repoBaseBranches).every(r=>typeof r=="string"))&&(n.previewEntries===void 0||Array.isArray(n.previewEntries)&&n.previewEntries.every(WJ))&&(n.selectedPreviewKey===void 0||n.selectedPreviewKey===null||typeof n.selectedPreviewKey=="string")&&(n.selectedPreviewFileKey===void 0||n.selectedPreviewFileKey===null||typeof n.selectedPreviewFileKey=="string")&&(n.previewDetailOpen===void 0||typeof n.previewDetailOpen=="boolean")&&(n.previewScrollTops===void 0||!!n.previewScrollTops&&typeof n.previewScrollTops=="object"&&!Array.isArray(n.previewScrollTops)&&Object.values(n.previewScrollTops).every(r=>typeof r=="number"))&&(n.previewMobileSlideIndex===void 0||typeof n.previewMobileSlideIndex=="number")&&(n.includeUncommitted===void 0||typeof n.includeUncommitted=="boolean")&&typeof n.updatedAt=="number"})}function R4(){return Or(kT,VJ)??{}}function N4(e){return[e.repoRoot,e.baseRef,e.branchName??"",e.headRef??"",e.diffFingerprint??""].join("\0")}function M4(e){const t=e?.trim()??"",n=t.indexOf("/");return n>=0?t.slice(n+1):t}function DT(e,t){const n=e?.trim(),r=t?.trim();return!n||!r?!1:n===r||M4(n)===M4(r)}function D4(e){const t=e?.branch??null;return[e?.upstream,...e?.remoteBranches??[],...e?.branches??[]].find(r=>r&&!DT(r,t))??""}function R2(e,t){const n=Math.max(k4,t-320),r=Math.min(IJ,n);return Math.min(r,Math.max(k4,e))}function qJ(e){return typeof e=="number"&&Number.isFinite(e)}function YJ(e){return R2(Or(Tf,qJ)??E2,e)}function jT(e){const t=e.split(/[\\/]/).pop()??e,n=t.lastIndexOf(".");return n>=0?t.slice(n).toLowerCase():""}function uf(e){return NJ.has(jT(e))}function PT(e){const t=e.trim().replace(/\s+/g,"");return/^-{3,}$/.test(t)||/^\*{3,}$/.test(t)||/^_{3,}$/.test(t)}function N2(e){const t=e.trim();return/^#{1,6}\s+/.test(t)||PT(e)||/^>\s?/.test(t)||/^(```|~~~)/.test(t)||/^(?:[-+*]|\d+[.)])\s+/.test(t)}function KJ(e){const t=e.trim();return/^(https?:|mailto:|#|\/|\.\/|\.\.\/)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/[<>]/.test(t)?t:null}const BT=b.createContext(null);function bm(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function FT(e){return e.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/[`*_~]/g,"").replace(/<[^>]+>/g,"").trim()}function OT(e){return e.replace(/\s+#+\s*$/,"").trim()}function M2(e,t){const r=FT(e).toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section",s=t.headingSlugCounts.get(r)??0;return t.headingSlugCounts.set(r,s+1),s===0?r:`${r}-${s}`}function j4(e){return FT(e)||e.trim()}function rg(e){const t=e.match(/^\s{0,3}\[([^\]]+)\]:\s+(.+?)\s*$/);if(!t)return null;const n=j2(t[2]);return n?{id:bm(t[1]),definition:{href:n.href,title:n.title}}:null}function XJ(e){const t=new Map;for(const n of e){const r=rg(n);r&&t.set(r.id,r.definition)}return t}function QT(e){return e.trim().toLowerCase()}function $T(e){const t=e.match(/^\s{0,3}\[\^([^\]]+)\]:\s+(.+)\s*$/);return t?{id:QT(t[1]),text:t[2]}:null}function ZJ(e){const t=new Map;let n=null;for(const r of e){const s=$T(r);if(s){n=s.id,t.set(s.id,{id:s.id,text:s.text,index:t.size+1});continue}if(n&&/^\s{4,}\S/.test(r)){const i=t.get(n);i&&(i.text=`${i.text} ${r.trim()}`);continue}r.trim()&&(n=null)}return t}function JJ(e){const t=new Set;let n=!1;return e.forEach((r,s)=>{if($T(r)){t.add(s),n=!0;return}if(n&&/^\s{4,}\S/.test(r)){t.add(s);return}r.trim()&&(n=!1)}),t}function eee(e){const t=[...e];let n=0;const r=e[0]?.trim();if(r==="---"||r==="+++"){for(t[0]="",n=1;n<e.length&&e[n].trim()!==r;)t[n]="",n+=1;n<e.length&&(t[n]="",n+=1)}for(;n<e.length;){const s=e[n].trim();if(s.startsWith("<!--")){if(t[n]="",!s.includes("-->")){for(n+=1;n<e.length&&!e[n].includes("-->");)t[n]="",n+=1;n<e.length&&(t[n]="")}n+=1;continue}n+=1}return t}function HT(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n<=0?n===0?"/":"":t.slice(0,n)}function Ff(e){const t=e.split(/[?#]/,1)[0],n=t.startsWith("/"),r=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){r.length>0&&r.pop();continue}r.push(i)}return`${n?"/":""}${r.join("/")}`||(n?"/":".")}function tee(e,t,n){const r=e.trim();if(!r||/^(?:https?:|mailto:|javascript:|data:|#)/i.test(r)||/^[a-z][a-z0-9+.-]*:/i.test(r))return null;const s=r.indexOf("#"),i=s>=0?r.slice(0,s):r,l=s>=0?r.slice(s+1):"",c=i.split("?",1)[0];if(!c)return null;let u,f=null;try{u=decodeURIComponent(c),f=l?decodeURIComponent(l):null}catch{return null}const p=n?Ff(n):null;let g;if(u.startsWith("/")){const y=p&&(u===p||u.startsWith(`${p}/`));g=Ff(p&&!y?`${p}/${u.slice(1)}`:u)}else{if(!t)return null;g=Ff(`${HT(t)}/${u}`)}return p&&g!==p&&!g.startsWith(`${p}/`)?null:{path:g,fragment:f,directory:/\/$/.test(c)}}function nee(e,t,n){const r=e.trim();if(!r||/^(?:javascript|data):/i.test(r))return null;if(/^https?:\/\//i.test(r))return r;if(!V2(r.split(/[?#]/,1)[0]))return null;let s;if(r.startsWith("/")){const i=n&&(r===n||r.startsWith(`${n}/`));s=Ff(n&&!i?`${n}/${r.slice(1)}`:r)}else{if(!t)return null;s=Ff(`${HT(t)}/${r}`)}return`/api/terminal/fs/blob?path=${encodeURIComponent(s)}`}const D2=128,ree=360,Xx=480;function sv(e){try{return/\.svg(?=$|[?#&])/i.test(decodeURIComponent(e))}catch{return!1}}function see(e,t,n,r){if(!t||!n)return null;let s,i;return sv(e)?(i=Math.min(Math.max(n,D2),ree),s=t*i/n):(s=t,i=n),r>0&&s>r&&(i=i*r/s,s=r),i>Xx&&(s=s*Xx/i,i=Xx),{width:Math.max(1,Math.round(s)),height:Math.max(1,Math.round(i))}}function iee(e){if(!e.startsWith("/api/terminal/fs/blob?"))return null;try{return new URLSearchParams(e.slice(e.indexOf("?"))).get("path")}catch{return null}}function UT(e){const t=iee(e),n=xt(r=>t?(r.fileChangeVersions.get(t)??0)+r.fileWatchEpoch:0);return t&&n>0?`${e}&v=${n}`:e}function oee({src:e,alt:t,title:n}){const r=sv(e),s=UT(e),i=b.useRef(null),[l,c]=b.useState(!1),[u,f]=b.useState(0),[p,g]=b.useState({status:"loading"}),[y,v]=b.useState(null);b.useLayoutEffect(()=>{const T=i.current,L=T?.parentElement?.parentElement??T?.parentElement;if(!L)return;const I=()=>f(L.clientWidth);if(I(),typeof ResizeObserver>"u")return;const j=new ResizeObserver(I);return j.observe(L),()=>j.disconnect()},[]),b.useEffect(()=>{if(l)return;const T=i.current;if(!T||typeof IntersectionObserver>"u"){c(!0);return}const L=new IntersectionObserver(I=>{I.some(j=>j.isIntersecting)&&(c(!0),L.disconnect())},{rootMargin:"400px"});return L.observe(T),()=>L.disconnect()},[l]),b.useEffect(()=>{if(!l)return;const T=new AbortController;let L=null;g({status:"loading"});const I=window.setTimeout(()=>{T.abort(new DOMException("Image fetch timed out","TimeoutError"))},15e3);return fetch(s,{signal:T.signal}).then(async j=>{if(!j.ok)throw new Error(`HTTP ${j.status}`);const P=Number(j.headers.get("X-Image-Width"))||0,F=Number(j.headers.get("X-Image-Height"))||0;return{blob:await j.blob(),width:P,height:F}}).then(({blob:j,width:P,height:F})=>{T.signal.aborted||(L=URL.createObjectURL(j),P>0&&F>0&&v({width:P,height:F}),g({status:"ready",objectUrl:L}))}).catch(()=>{const j=T.signal.reason;T.signal.aborted&&!(j instanceof DOMException&&j.name==="TimeoutError")||g({status:"fallback"})}).finally(()=>{window.clearTimeout(I)}),()=>{window.clearTimeout(I),T.abort(),L&&URL.revokeObjectURL(L)}},[l,s]);const S=see(e,y?.width??0,y?.height??0,u),A=S??{width:D2*2,height:D2};return o.jsx("div",{ref:i,className:"block max-w-full",style:S?{width:S.width,height:S.height}:void 0,children:p.status==="ready"?o.jsx("img",{src:p.objectUrl,alt:t,title:n,decoding:"async",className:`${r?"":"termdock-fade-in "}block max-h-[480px] max-w-full object-contain`,style:S?{width:S.width,height:S.height}:void 0,onLoad:T=>{if(y)return;const L=T.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):p.status==="fallback"?o.jsx("img",{src:s,alt:t,title:n,loading:"lazy",decoding:"async",className:"block max-h-[480px] max-w-full object-contain",style:S?{width:S.width,height:S.height}:void 0,onLoad:T=>{if(y)return;const L=T.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):o.jsx("div",{"aria-hidden":!0,className:"flex max-w-full animate-pulse items-center justify-center rounded bg-surface-elevated/60",style:{width:A.width,height:A.height},children:o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:t||"…"})})})}function Zx(e,t,n,r,s){const i=nee(n,s.markdownFilePath,s.rootPath);if(!i)return`![${t}](${n})`;const l=s.images.length;s.images.push({kind:"image",src:i,alt:t,title:r});const c=o.jsx(oee,{src:i,alt:t,title:r});return s.onImageOpen?o.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:r||t||"Open image",onClick:u=>{u.stopPropagation(),s.onImageOpen?.(l)},children:c},e):o.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:c},e)}function Jx(e){let t=e,n="";for(;/[.,;:!?)]$/.test(t);)n=`${t.slice(-1)}${n}`,t=t.slice(0,-1);return{linkText:t,suffix:n}}function P4(e){return/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(e)}function j2(e){const t=e.trim(),n=t.match(/^<([^>]+)>(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(n)return{href:n[1],title:n[2]??n[3]??n[4]};const r=t.match(/^(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);return r?{href:r[1],title:r[2]??r[3]??r[4]}:null}const zT="",aee=/\\([\\`*{}\[\]#+\-.!_|~>$])/g;function lee(e){return e.replace(aee,(t,n)=>`${zT}${n.charCodeAt(0).toString(16).padStart(4,"0")}`)}function B4(e){return e.replace(new RegExp(`${zT}([0-9a-f]{4})`,"g"),(t,n)=>String.fromCharCode(Number.parseInt(n,16))).replace(/\\([()])/g,"$1")}function cee(e){const t=e.replace(/[\r\n]+/g," ");return/^ .+ $/.test(t)&&/[^ ]/.test(t.slice(1,-1))?t.slice(1,-1):t}const GT={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 $p=null;function WT(){return $p||($p=l0(()=>import("./purify.es-CC4Brkr_.js"),[]).then(e=>e.default??e).catch(e=>{throw $p=null,e})),$p}function VT({html:e}){const{t}=qn(),[n,r]=b.useState(null);return b.useEffect(()=>{let s=!1;return r(null),WT().then(i=>{s||r(i.sanitize(e,GT))}).catch(()=>{s||r("")}),()=>{s=!0}},[e]),n===null?o.jsx("div",{className:"py-2 text-xs text-muted-foreground",children:t("rightSidebar.renderingHtml")}):n?o.jsx("div",{className:"text-muted-foreground",dangerouslySetInnerHTML:{__html:n}}):null}function uee({html:e}){const[t,n]=b.useState(null);return b.useEffect(()=>{let r=!1;return n(null),WT().then(s=>{r||n(s.sanitize(e,GT))}).catch(()=>{r||n("")}),()=>{r=!0}},[e]),t===null?null:t?o.jsx("span",{dangerouslySetInnerHTML:{__html:t}}):e}function qT(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 n=t[1].toLowerCase();return{tag:n,selfContained:new RegExp(`</${n}>`,"i").test(e)}}let Hp=null;function dee(){return Hp||(Hp=Promise.all([l0(()=>import("./katex-DnlPpQZa.js"),[]),l0(()=>Promise.resolve({}),__vite__mapDeps([5]))]).then(([e])=>e.default??e).catch(e=>{throw Hp=null,e})),Hp}function nh({tex:e,display:t=!1}){const[n,r]=b.useState(null),[s,i]=b.useState(!1);if(b.useEffect(()=>{let c=!1;return r(null),i(!1),dee().then(u=>{c||r(u.renderToString(e,{displayMode:t,throwOnError:!1,trust:!1,strict:"ignore"}))}).catch(()=>{c||i(!0)}),()=>{c=!0}},[t,e]),s)return o.jsx("code",{className:"rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground",children:t?`$$${e}$$`:`$${e}$`});if(!n)return o.jsx("span",{className:"text-muted-foreground/70",children:t?"Rendering formula...":e});const l=t?"my-2 overflow-auto rounded-md bg-surface-2 px-3 py-2 text-center":"inline-block align-middle";return o.jsx("span",{className:l,dangerouslySetInnerHTML:{__html:n}})}function fee(e,t,n){if(/^<br\s*\/?>$/i.test(e))return o.jsx("br",{},t);const r=e.match(/^<(kbd|mark|sub|sup)>(.*?)<\/\1>$/i);if(!r)return/^<(a|abbr|span|b|strong|em|i|u|s|del|code)\b[\s\S]*<\/\1>$/i.test(e)?o.jsx(uee,{html:e},t):null;const s=r[1].toLowerCase(),i=wi(r[2],`${t}-${s}`,!0,n);return s==="kbd"?o.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"?o.jsx("mark",{className:"rounded bg-warning/25 px-0.5 text-foreground",children:i},t):s==="sub"?o.jsx("sub",{children:i},t):o.jsx("sup",{children:i},t)}function wi(e,t,n=!0,r){const s=lee(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,l=[];let c=0,u;for(;(u=i.exec(s))!==null;){u.index>c&&l.push(B4(s.slice(c,u.index)));const f=u[0],p=`${t}-${u.index}`,g=f.startsWith("<")?fee(f,p,r):null;if(g)l.push(g);else if(f.startsWith("\\(")&&f.endsWith("\\)"))l.push(o.jsx(nh,{tex:f.slice(2,-2)},p));else if(f.startsWith("$")&&f.endsWith("$"))l.push(o.jsx(nh,{tex:f.slice(1,-1)},p));else if(f.startsWith("`")){const y=f.match(/^`+/)?.[0].length??1;l.push(o.jsx("code",{className:`${n?"break-all":"whitespace-nowrap"} rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground`,children:cee(f.slice(y,-y))},p))}else if(f.startsWith("~~"))l.push(o.jsx("del",{className:"text-muted-foreground decoration-border-strong",children:wi(f.slice(2,-2),`${p}-del`,n,r)},p));else if(f.startsWith("**")||f.startsWith("__"))l.push(o.jsx("strong",{className:"font-semibold text-foreground",children:wi(f.slice(2,-2),`${p}-strong`,n,r)},p));else if(f.startsWith("*")||f.startsWith("_"))l.push(o.jsx("em",{className:"italic",children:wi(f.slice(1,-1),`${p}-em`,n,r)},p));else if(f.startsWith("![")){const y=f.match(/^!\[([^\]]*)\]\((.*)\)$/),v=f.match(/^!\[([^\]]+)\]\[([^\]]*)\]$/),S=f.match(/^!\[([^\]]+)\]$/);if(y){const A=j2(y[2]);l.push(A?Zx(p,y[1],A.href,A.title,r):f)}else if(v){const A=v[2]||v[1],T=r.referenceDefinitions.get(bm(A));l.push(T?Zx(p,v[1],T.href,T.title,r):f)}else if(S){const A=r.referenceDefinitions.get(bm(S[1]));l.push(A?Zx(p,S[1],A.href,A.title,r):f)}else l.push(f)}else if(f.startsWith("[^")){const y=QT(f.slice(2,-1)),v=r.footnoteDefinitions.get(y);l.push(v?o.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:o.jsx("a",{href:`#fn-${v.id}`,className:"text-primary no-underline",children:v.index})},p):f)}else if(f.startsWith("<http")){const y=f.slice(1,-1);l.push(o.jsx("a",{href:y,target:"_blank",rel:"noreferrer",className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p))}else if(f.startsWith("<")&&f.endsWith(">")&&P4(f.slice(1,-1))){const y=f.slice(1,-1);l.push(o.jsx("a",{href:`mailto:${y}`,className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p))}else if(P4(Jx(f).linkText)){const{linkText:y,suffix:v}=Jx(f);l.push(o.jsx("a",{href:`mailto:${y}`,className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p)),v&&l.push(v)}else if(f.startsWith("http")||f.startsWith("www.")){const{linkText:y,suffix:v}=Jx(f),S=y.startsWith("www.")?`https://${y}`:y;l.push(o.jsx("a",{href:S,target:"_blank",rel:"noreferrer",className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p)),v&&l.push(v)}else{const y=f.match(/^\[([^\]]+)\]\((.*)\)$/),v=f.match(/^\[([^\]]+)\]\[([^\]]*)\]$/),S=f.match(/^\[([^\]]+)\]$/),A=v?v[2]||v[1]:S?.[1]??null,T=A?r.referenceDefinitions.get(bm(A)):null,L=y?j2(y[2]):null,I=L?.href??T?.href??null,j=I?KJ(I):null,P=y?.[1]??v?.[1]??S?.[1]??"";l.push(j?o.jsx("a",{href:j,title:L?.title??T?.title,target:"_blank",rel:"noreferrer",className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:wi(P,`${p}-link`,n,r)},p):f)}c=i.lastIndex}return c<s.length&&l.push(B4(s.slice(c))),l.length>0?l:[e]}function YT(e){return/(?: {2,}|\\)$/.test(e)}function KT(e){return e.replace(/(?: {2,}|\\)$/,"")}function sg(e){return/^(?: {4}|\t)/.test(e)}function XT(e){return e.startsWith(" ")?e.slice(1):e.replace(/^ {4}/,"")}function ZT(e,t,n){const r=[];return e.forEach((s,i)=>{const l=YT(s);r.push(...wi(KT(s),`${t}-${i}`,!0,n)),i<e.length-1&&r.push(l?o.jsx("br",{},`${t}-${i}-br`):" ")}),r}function P2(e,t,n){const r=[],s=[];return e.forEach((i,l)=>{s.push(YT(i)),r.push(wi(KT(i),`${t}-${l}`,!0,n))}),{perLine:r,hardBreaks:s}}function B2(e,t,n,r,s){const i=[];return e.forEach((l,c)=>{const u=n[c]??0,f=!!(s&&u>=s.start&&u<=s.end);i.push(o.jsx("span",{"data-md-ref-start":u,"data-md-ref-end":u,"data-selected":f?"true":void 0,children:l},`${r}-ref-${c}`)),c<e.length-1&&i.push(t[c]?o.jsx("br",{},`${r}-${c}-br`):" ")}),i}function rh(e){const t=e.trim().replace(/^\|/,"").replace(/\|$/,""),n=[];let r="",s=!1,i=0,l=0;for(let c=0;c<t.length;c+=1){const u=t[c];if(s){r+=u,s=!1;continue}if(u==="\\"){s=!0;continue}if(u==="`"){const f=c;for(;c+1<t.length&&t[c+1]==="`";)c+=1;const p=c-f+1;r+="`".repeat(p),i===0?i=p:i===p&&(i=0);continue}if(i===0&&u==="["?l+=1:i===0&&u==="]"&&l>0&&(l-=1),u==="|"&&i===0&&l===0){n.push(r.trim()),r="";continue}r+=u}return s&&(r+="\\"),n.push(r.trim()),n}function JT(e){return rh(e).map(t=>/^:-+:$/.test(t)?"center":/^-+:$/.test(t)?"right":/^:-+$/.test(t)?"left":null)}function ig(e){return e==="center"?"text-center":e==="right"?"text-right":"text-left"}function og(e){return/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/.test(e.trim())}function hee(e,t){return e>96||e>44&&t>.35}function iv(e){return(e.match(/^\s*/)?.[0]??"").replace(/\t/g," ").length}function ov(e){const t=e.trim().match(/^([-+*]|\d+[.)])\s+(.+)$/);if(!t)return null;const n=/^\d+[.)]$/.test(t[1]);return{ordered:n,start:n?Number.parseInt(t[1],10):void 0,content:t[2]}}function eC(e,t,n,r,s,i=new Set){const l=[],c=[];let u=t;for(;u<e.length;){const f=e[u];if(s&&(rg(f)||i.has(u))){u+=1;continue}const p=ov(f),g=iv(f);if(!p){if(g>n&&c.length>0){([...c].reverse().find(A=>A.indent<g)?.item??c[c.length-1].item).paragraphs.push(f.trim());for(const A of c)A.item.lineEnd=u+1;u+=1;continue}break}if(g<n||g===n&&p.ordered!==r)break;const y={content:p.content,ordered:p.ordered,start:p.start,children:[],paragraphs:[],lineStart:u+1,lineEnd:u+1};for(;c.length>0&&c[c.length-1].indent>=g;)c.pop();const v=c[c.length-1]?.item??null;v?v.children.push(y):l.push(y),c.push({indent:g,item:y});for(const S of c)S.item.lineEnd=u+1;u+=1}return{items:l,nextIndex:u}}function av(e,t,n,r=0){return e.map((s,i)=>{const l=s.content.match(/^\[([ xX])\]\s+(.+)$/);return{key:`item-${i}`,taskItem:!!l,refStart:s.lineStart+r,refEnd:s.lineEnd+r,content:o.jsxs(o.Fragment,{children:[l?o.jsx("input",{type:"checkbox",checked:l[1].toLowerCase()==="x",readOnly:!0,className:"mr-2 align-[-2px] accent-primary"}):null,wi(l?.[2]??s.content,`li-${t}-${i}`,!0,n),s.paragraphs.length>0&&o.jsx("div",{className:"mt-1 space-y-1 text-muted-foreground",children:s.paragraphs.map((c,u)=>o.jsx("p",{children:wi(c,`li-${t}-${i}-p-${u}`,!0,n)},`paragraph-${u}`))})]}),groups:pee(s.children,`${t}-${i}`,n,r)}})}function pee(e,t,n,r=0){const s=[];for(const i of e){const l=s[s.length-1];l&&l.ordered===i.ordered?l.items.push(i):s.push({ordered:i.ordered,items:[i]})}return s.map((i,l)=>({ordered:i.ordered,start:i.ordered?i.items[0]?.start:void 0,items:av(i.items,`${t}-g${l}`,n,r)}))}function lv(e,t){return e.map(n=>{const r=!!(t&&n.refStart<=t.end&&n.refEnd>=t.start);return o.jsxs("li",{className:n.taskItem?"list-none":void 0,"data-md-ref-start":n.refStart,"data-md-ref-end":n.refEnd,"data-selected":r?"true":void 0,children:[n.content,n.groups.length>0&&mee(n.groups,t)]},n.key)})}function mee(e,t){return e.map((n,r)=>{const s=n.ordered?"ol":"ul";return o.jsx(s,{start:n.start,className:`${n.ordered?"list-decimal":"list-disc"} mt-1 space-y-0.5 pl-4 marker:text-muted-foreground/60`,children:lv(n.items,t)},`nested-${r}`)})}function gee(e){const t=Array.from(e.footnoteDefinitions.values()).sort((n,r)=>n.index-r.index);return t.length===0?null:o.jsxs("section",{className:"mt-3 border-t border-border/20 pt-2 text-[12px] leading-5 text-muted-foreground",children:[o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:e.footnotesLabel}),o.jsx("ol",{className:"list-decimal space-y-1 pl-5",children:t.map(n=>o.jsxs("li",{id:`fn-${n.id}`,children:[wi(n.text,`footnote-${n.id}`,!0,e)," ",o.jsx("a",{href:`#fnref-${n.id}`,className:"text-primary no-underline","aria-label":e.backToFootnoteLabel(n.index),children:"↩"})]},n.id))})]})}function xee(e,t,n,r){const s=[];let i=0;const l=c=>r?.[c]??c+1;for(;i<e.length;){const c=e[i],u=c.trim();if(!u){i+=1;continue}if(/^<details>\s*$/i.test(u)){const L=i;let I="Details";const j=[];for(i+=1;i<e.length&&!/^<\/details>\s*$/i.test(e[i].trim());){const P=e[i].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);P?I=P[1].trim()||I:j.push(e[i].trimStart()),i+=1}i<e.length&&(i+=1),s.push({kind:"static",node:o.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[o.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:wi(I,`${t}-details-${L}-summary`,!0,n)}),j.length>0&&o.jsx("div",{className:"mt-2 text-sm leading-6",children:ZT(j,`${t}-details-${L}`,n)})]},`${t}-details-${L}`)});continue}const f=qT(c);if(f){const L=[c],I=i;for(i+=1;i<e.length&&!f.selfContained&&!new RegExp(`</${f.tag}>`,"i").test(e[i]);)L.push(e[i]),i+=1;i<e.length&&!f.selfContained&&(L.push(e[i]),i+=1),s.push({kind:"static",node:o.jsx(VT,{html:L.join(`
179
+ `);const y=s.length;s+=p.data,r.push({node:p,start:y,end:s.length,group:g}),i=g}const c=s.toLocaleLowerCase(),u=[];let f=0;for(;f<=c.length-n.length;){const p=c.indexOf(n,f);if(p<0)break;const g=p+n.length,y=r.find(S=>S.start<=p&&S.end>p),v=r.find(S=>S.start<g&&S.end>=g);if(y&&v&&y.group===v.group){const S=document.createRange();S.setStart(y.node,p-y.start),S.setEnd(v.node,g-v.start),u.push(S)}f=p+Math.max(n.length,1)}return u}function vT(){return typeof CSS<"u"&&CSS.highlights?CSS.highlights:null}function Qp(){const e=vT();e?.delete(yT),e?.delete(L2)}function y4(e,t){const n=vT();if(!n||typeof Highlight>"u")return;n.set(yT,new Highlight(...e));const r=e[t];r?n.set(L2,new Highlight(r)):n.delete(L2)}function v4(e){e?.startContainer.parentElement?.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})}const tv="termdock:right-sidebar:file-tree-scroll:v1",nv="termdock:right-sidebar:file-preview-reading-state:v1",Tf="termdock:right-sidebar:file-tree-width:v1",wT="termdock:right-sidebar:markdown-view-mode:v1",ST="termdock:right-sidebar:diff-change-list-mode:v1",AT="termdock:right-sidebar:diff-wrap:v1",TT="termdock:diff-viewer:view-type:v1",CT="termdock:right-sidebar:file-search-mode:v1",Gx="termdock:right-sidebar:collapsed-git-repo-groups:v1",w4="termdock:right-sidebar:collapsed-diff-directories:v1",Wx="termdock:right-sidebar:branch-audit-module-open:v1",kT="termdock:right-sidebar:branch-audit-module:v1",bJ=150,_T="termdock:right-sidebar:active-git-repo:v1",S4="termdock:right-sidebar:context-draft-enabled:v1",A4="termdock:right-sidebar:context-draft-collapsed:v1",T4="termdock:right-sidebar:context-draft-auto-collapse:v1",Vx="termdock:right-sidebar:context-draft-text:v1",yJ=300,vJ=20,wJ=120,SJ=250,AJ=250,TJ=120,CJ=700,qx=600,C4=[2e3,5e3,15e3,3e4],kJ=320,_J=500,LJ=20,EJ=12e3,E2=300,k4=240,IJ=560,LT="border-r px-2 py-1.5 sm:px-3 sm:py-2",ng="max-w-[18rem] whitespace-normal break-words sm:max-w-[27rem]",ET=`${LT} border-b border-border/15 font-semibold last:border-r-0`,IT=`${LT} border-border/10 align-top text-muted-foreground last:border-r-0`,rv="termdock-file-preview-horizontal-scroll",_4=b.lazy(()=>l0(()=>import("./ModelPreview-DcSDnALR.js"),__vite__mapDeps([2,3,1,4]))),RT=`${rv} termdock-md-table-scroll max-w-full overflow-x-auto overflow-y-hidden rounded-lg border border-border/20 bg-surface`;function RJ(e,t,n){return e&&!t?"unified":n}const NJ=new Set([".md",".markdown",".mdown",".mkdn",".mkd"]);function MJ(e){return e==="preview"||e==="source"}function DJ(e){return e==="list"||e==="tree"||e==="ai"}function L4(){return Or(wT,MJ)??"preview"}function jJ(){return Or(ST,DJ)??"tree"}function Cf(e){return typeof e=="boolean"}function PJ(e){return typeof e=="string"}function BJ(){return Or(AT,Cf)??!0}function FJ(e){return e==="unified"||e==="split"}function OJ(){return Or(TT,FJ)??"unified"}function QJ(e){return e==="name"||e==="content"||e==="regex"}function $J(){return Or(CT,QJ)??"name"}function NT(e){return e.repositories??(e.context?.root?[{id:e.context.root,root:e.context.root,relativeRoot:".",name:bo(e.context.root)||e.context.root,depth:0,nested:!1,available:e.available,files:e.files,context:e.context,error:e.error}]:[])}function HJ(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string")}function MT(){return Or(_T,HJ)??{}}function E4(e){if(!e)return;const t=MT();return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function Yx(e,t){e&&Gn(_T,{...MT(),[e]:t})}function UJ(e,t){if(!t)return null;const n=new Set((e.repoFilters??[]).map(r=>r.root));return n.has(t)?t:n.size>0?null:(e.repositories??[]).some(r=>r.root===t)?t:null}function I2(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function I4(e){const t=Or(e,I2);return t?new Set(t):new Set}function Kx(e,t){Gn(e,[...t])}function zJ(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 GJ(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||I2(t.files))&&(t.hunks===void 0||Array.isArray(t.hunks)&&t.hunks.every(zJ))&&(t.commits===void 0||I2(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 WJ(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.key=="string"&&GJ(t.diff)&&typeof t.repoLabel=="string"&&typeof t.createdAt=="number"}function VJ(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 n=t;return Array.isArray(n.selectedRepoRoots)&&n.selectedRepoRoots.every(r=>typeof r=="string")&&!!n.repoTargetBranches&&typeof n.repoTargetBranches=="object"&&!Array.isArray(n.repoTargetBranches)&&Object.values(n.repoTargetBranches).every(r=>typeof r=="string")&&(n.repoBaseBranches===void 0||!!n.repoBaseBranches&&typeof n.repoBaseBranches=="object"&&!Array.isArray(n.repoBaseBranches)&&Object.values(n.repoBaseBranches).every(r=>typeof r=="string"))&&(n.previewEntries===void 0||Array.isArray(n.previewEntries)&&n.previewEntries.every(WJ))&&(n.selectedPreviewKey===void 0||n.selectedPreviewKey===null||typeof n.selectedPreviewKey=="string")&&(n.selectedPreviewFileKey===void 0||n.selectedPreviewFileKey===null||typeof n.selectedPreviewFileKey=="string")&&(n.previewDetailOpen===void 0||typeof n.previewDetailOpen=="boolean")&&(n.previewScrollTops===void 0||!!n.previewScrollTops&&typeof n.previewScrollTops=="object"&&!Array.isArray(n.previewScrollTops)&&Object.values(n.previewScrollTops).every(r=>typeof r=="number"))&&(n.previewMobileSlideIndex===void 0||typeof n.previewMobileSlideIndex=="number")&&(n.includeUncommitted===void 0||typeof n.includeUncommitted=="boolean")&&typeof n.updatedAt=="number"})}function R4(){return Or(kT,VJ)??{}}function N4(e){return[e.repoRoot,e.baseRef,e.branchName??"",e.headRef??"",e.diffFingerprint??""].join("\0")}function M4(e){const t=e?.trim()??"",n=t.indexOf("/");return n>=0?t.slice(n+1):t}function DT(e,t){const n=e?.trim(),r=t?.trim();return!n||!r?!1:n===r||M4(n)===M4(r)}function D4(e){const t=e?.branch??null;return[e?.upstream,...e?.remoteBranches??[],...e?.branches??[]].find(r=>r&&!DT(r,t))??""}function R2(e,t){const n=Math.max(k4,t-320),r=Math.min(IJ,n);return Math.min(r,Math.max(k4,e))}function qJ(e){return typeof e=="number"&&Number.isFinite(e)}function YJ(e){return R2(Or(Tf,qJ)??E2,e)}function jT(e){const t=e.split(/[\\/]/).pop()??e,n=t.lastIndexOf(".");return n>=0?t.slice(n).toLowerCase():""}function uf(e){return NJ.has(jT(e))}function PT(e){const t=e.trim().replace(/\s+/g,"");return/^-{3,}$/.test(t)||/^\*{3,}$/.test(t)||/^_{3,}$/.test(t)}function N2(e){const t=e.trim();return/^#{1,6}\s+/.test(t)||PT(e)||/^>\s?/.test(t)||/^(```|~~~)/.test(t)||/^(?:[-+*]|\d+[.)])\s+/.test(t)}function KJ(e){const t=e.trim();return/^(https?:|mailto:|#|\/|\.\/|\.\.\/)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/[<>]/.test(t)?t:null}const BT=b.createContext(null);function bm(e){return e.trim().replace(/\s+/g," ").toLowerCase()}function FT(e){return e.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g,"$1").replace(/[`*_~]/g,"").replace(/<[^>]+>/g,"").trim()}function OT(e){return e.replace(/\s+#+\s*$/,"").trim()}function M2(e,t){const r=FT(e).toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").trim().replace(/\s+/g,"-")||"section",s=t.headingSlugCounts.get(r)??0;return t.headingSlugCounts.set(r,s+1),s===0?r:`${r}-${s}`}function j4(e){return FT(e)||e.trim()}function rg(e){const t=e.match(/^\s{0,3}\[([^\]]+)\]:\s+(.+?)\s*$/);if(!t)return null;const n=j2(t[2]);return n?{id:bm(t[1]),definition:{href:n.href,title:n.title}}:null}function XJ(e){const t=new Map;for(const n of e){const r=rg(n);r&&t.set(r.id,r.definition)}return t}function QT(e){return e.trim().toLowerCase()}function $T(e){const t=e.match(/^\s{0,3}\[\^([^\]]+)\]:\s+(.+)\s*$/);return t?{id:QT(t[1]),text:t[2]}:null}function ZJ(e){const t=new Map;let n=null;for(const r of e){const s=$T(r);if(s){n=s.id,t.set(s.id,{id:s.id,text:s.text,index:t.size+1});continue}if(n&&/^\s{4,}\S/.test(r)){const i=t.get(n);i&&(i.text=`${i.text} ${r.trim()}`);continue}r.trim()&&(n=null)}return t}function JJ(e){const t=new Set;let n=!1;return e.forEach((r,s)=>{if($T(r)){t.add(s),n=!0;return}if(n&&/^\s{4,}\S/.test(r)){t.add(s);return}r.trim()&&(n=!1)}),t}function eee(e){const t=[...e];let n=0;const r=e[0]?.trim();if(r==="---"||r==="+++"){for(t[0]="",n=1;n<e.length&&e[n].trim()!==r;)t[n]="",n+=1;n<e.length&&(t[n]="",n+=1)}for(;n<e.length;){const s=e[n].trim();if(s.startsWith("<!--")){if(t[n]="",!s.includes("-->")){for(n+=1;n<e.length&&!e[n].includes("-->");)t[n]="",n+=1;n<e.length&&(t[n]="")}n+=1;continue}n+=1}return t}function HT(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n<=0?n===0?"/":"":t.slice(0,n)}function Ff(e){const t=e.split(/[?#]/,1)[0],n=t.startsWith("/"),r=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){r.length>0&&r.pop();continue}r.push(i)}return`${n?"/":""}${r.join("/")}`||(n?"/":".")}function tee(e,t,n){const r=e.trim();if(!r||/^(?:https?:|mailto:|javascript:|data:|#)/i.test(r)||/^[a-z][a-z0-9+.-]*:/i.test(r))return null;const s=r.indexOf("#"),i=s>=0?r.slice(0,s):r,l=s>=0?r.slice(s+1):"",c=i.split("?",1)[0];if(!c)return null;let u,f=null;try{u=decodeURIComponent(c),f=l?decodeURIComponent(l):null}catch{return null}const p=n?Ff(n):null;let g;if(u.startsWith("/")){const y=p&&(u===p||u.startsWith(`${p}/`));g=Ff(p&&!y?`${p}/${u.slice(1)}`:u)}else{if(!t)return null;g=Ff(`${HT(t)}/${u}`)}return p&&g!==p&&!g.startsWith(`${p}/`)?null:{path:g,fragment:f,directory:/\/$/.test(c)}}function nee(e,t,n){const r=e.trim();if(!r||/^(?:javascript|data):/i.test(r))return null;if(/^https?:\/\//i.test(r))return r;if(!V2(r.split(/[?#]/,1)[0]))return null;let s;if(r.startsWith("/")){const i=n&&(r===n||r.startsWith(`${n}/`));s=Ff(n&&!i?`${n}/${r.slice(1)}`:r)}else{if(!t)return null;s=Ff(`${HT(t)}/${r}`)}return`/api/terminal/fs/blob?path=${encodeURIComponent(s)}`}const D2=128,ree=360,Xx=480;function sv(e){try{return/\.svg(?=$|[?#&])/i.test(decodeURIComponent(e))}catch{return!1}}function see(e,t,n,r){if(!t||!n)return null;let s,i;return sv(e)?(i=Math.min(Math.max(n,D2),ree),s=t*i/n):(s=t,i=n),r>0&&s>r&&(i=i*r/s,s=r),i>Xx&&(s=s*Xx/i,i=Xx),{width:Math.max(1,Math.round(s)),height:Math.max(1,Math.round(i))}}function iee(e){if(!e.startsWith("/api/terminal/fs/blob?"))return null;try{return new URLSearchParams(e.slice(e.indexOf("?"))).get("path")}catch{return null}}function UT(e){const t=iee(e),n=xt(r=>t?(r.fileChangeVersions.get(t)??0)+r.fileWatchEpoch:0);return t&&n>0?`${e}&v=${n}`:e}function oee({src:e,alt:t,title:n}){const r=sv(e),s=UT(e),i=b.useRef(null),[l,c]=b.useState(!1),[u,f]=b.useState(0),[p,g]=b.useState({status:"loading"}),[y,v]=b.useState(null);b.useLayoutEffect(()=>{const T=i.current,L=T?.parentElement?.parentElement??T?.parentElement;if(!L)return;const I=()=>f(L.clientWidth);if(I(),typeof ResizeObserver>"u")return;const j=new ResizeObserver(I);return j.observe(L),()=>j.disconnect()},[]),b.useEffect(()=>{if(l)return;const T=i.current;if(!T||typeof IntersectionObserver>"u"){c(!0);return}const L=new IntersectionObserver(I=>{I.some(j=>j.isIntersecting)&&(c(!0),L.disconnect())},{rootMargin:"400px"});return L.observe(T),()=>L.disconnect()},[l]),b.useEffect(()=>{if(!l)return;const T=new AbortController;let L=null;g({status:"loading"});const I=window.setTimeout(()=>{T.abort(new DOMException("Image fetch timed out","TimeoutError"))},15e3);return fetch(s,{signal:T.signal}).then(async j=>{if(!j.ok)throw new Error(`HTTP ${j.status}`);const P=Number(j.headers.get("X-Image-Width"))||0,F=Number(j.headers.get("X-Image-Height"))||0;return{blob:await j.blob(),width:P,height:F}}).then(({blob:j,width:P,height:F})=>{T.signal.aborted||(L=URL.createObjectURL(j),P>0&&F>0&&v({width:P,height:F}),g({status:"ready",objectUrl:L}))}).catch(()=>{const j=T.signal.reason;T.signal.aborted&&!(j instanceof DOMException&&j.name==="TimeoutError")||g({status:"fallback"})}).finally(()=>{window.clearTimeout(I)}),()=>{window.clearTimeout(I),T.abort(),L&&URL.revokeObjectURL(L)}},[l,s]);const S=see(e,y?.width??0,y?.height??0,u),A=S??{width:D2*2,height:D2};return o.jsx("div",{ref:i,className:"block max-w-full",style:S?{width:S.width,height:S.height}:void 0,children:p.status==="ready"?o.jsx("img",{src:p.objectUrl,alt:t,title:n,decoding:"async",className:`${r?"":"termdock-fade-in "}block max-h-[480px] max-w-full object-contain`,style:S?{width:S.width,height:S.height}:void 0,onLoad:T=>{if(y)return;const L=T.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):p.status==="fallback"?o.jsx("img",{src:s,alt:t,title:n,loading:"lazy",decoding:"async",className:"block max-h-[480px] max-w-full object-contain",style:S?{width:S.width,height:S.height}:void 0,onLoad:T=>{if(y)return;const L=T.currentTarget;L.naturalWidth>0&&L.naturalHeight>0&&v({width:L.naturalWidth,height:L.naturalHeight})}}):o.jsx("div",{"aria-hidden":!0,className:"flex max-w-full animate-pulse items-center justify-center rounded bg-surface-elevated/60",style:{width:A.width,height:A.height},children:o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:t||"…"})})})}function Zx(e,t,n,r,s){const i=nee(n,s.markdownFilePath,s.rootPath);if(!i)return`![${t}](${n})`;const l=s.images.length;s.images.push({kind:"image",src:i,alt:t,title:r});const c=o.jsx(oee,{src:i,alt:t,title:r});return s.onImageOpen?o.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:r||t||"Open image",onClick:u=>{u.stopPropagation(),s.onImageOpen?.(l)},children:c},e):o.jsx("span",{className:"my-2 block max-w-full overflow-hidden rounded-md border border-border/20 bg-surface-2",children:c},e)}function Jx(e){let t=e,n="";for(;/[.,;:!?)]$/.test(t);)n=`${t.slice(-1)}${n}`,t=t.slice(0,-1);return{linkText:t,suffix:n}}function P4(e){return/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/.test(e)}function j2(e){const t=e.trim(),n=t.match(/^<([^>]+)>(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(n)return{href:n[1],title:n[2]??n[3]??n[4]};const r=t.match(/^(\S+)(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);return r?{href:r[1],title:r[2]??r[3]??r[4]}:null}const zT="",aee=/\\([\\`*{}\[\]#+\-.!_|~>$])/g;function lee(e){return e.replace(aee,(t,n)=>`${zT}${n.charCodeAt(0).toString(16).padStart(4,"0")}`)}function B4(e){return e.replace(new RegExp(`${zT}([0-9a-f]{4})`,"g"),(t,n)=>String.fromCharCode(Number.parseInt(n,16))).replace(/\\([()])/g,"$1")}function cee(e){const t=e.replace(/[\r\n]+/g," ");return/^ .+ $/.test(t)&&/[^ ]/.test(t.slice(1,-1))?t.slice(1,-1):t}const GT={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 $p=null;function WT(){return $p||($p=l0(()=>import("./purify.es-CC4Brkr_.js"),[]).then(e=>e.default??e).catch(e=>{throw $p=null,e})),$p}function VT({html:e}){const{t}=qn(),[n,r]=b.useState(null);return b.useEffect(()=>{let s=!1;return r(null),WT().then(i=>{s||r(i.sanitize(e,GT))}).catch(()=>{s||r("")}),()=>{s=!0}},[e]),n===null?o.jsx("div",{className:"py-2 text-xs text-muted-foreground",children:t("rightSidebar.renderingHtml")}):n?o.jsx("div",{className:"text-muted-foreground",dangerouslySetInnerHTML:{__html:n}}):null}function uee({html:e}){const[t,n]=b.useState(null);return b.useEffect(()=>{let r=!1;return n(null),WT().then(s=>{r||n(s.sanitize(e,GT))}).catch(()=>{r||n("")}),()=>{r=!0}},[e]),t===null?null:t?o.jsx("span",{dangerouslySetInnerHTML:{__html:t}}):e}function qT(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 n=t[1].toLowerCase();return{tag:n,selfContained:new RegExp(`</${n}>`,"i").test(e)}}let Hp=null;function dee(){return Hp||(Hp=Promise.all([l0(()=>import("./katex-DnlPpQZa.js"),[]),l0(()=>Promise.resolve({}),__vite__mapDeps([5]))]).then(([e])=>e.default??e).catch(e=>{throw Hp=null,e})),Hp}function nh({tex:e,display:t=!1}){const[n,r]=b.useState(null),[s,i]=b.useState(!1);if(b.useEffect(()=>{let c=!1;return r(null),i(!1),dee().then(u=>{c||r(u.renderToString(e,{displayMode:t,throwOnError:!1,trust:!1,strict:"ignore"}))}).catch(()=>{c||i(!0)}),()=>{c=!0}},[t,e]),s)return o.jsx("code",{className:"rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground",children:t?`$$${e}$$`:`$${e}$`});if(!n)return o.jsx("span",{className:"text-muted-foreground/70",children:t?"Rendering formula...":e});const l=t?"my-2 overflow-auto rounded-md bg-surface-2 px-3 py-2 text-center":"inline-block align-middle";return o.jsx("span",{className:l,dangerouslySetInnerHTML:{__html:n}})}function fee(e,t,n){if(/^<br\s*\/?>$/i.test(e))return o.jsx("br",{},t);const r=e.match(/^<(kbd|mark|sub|sup)>(.*?)<\/\1>$/i);if(!r)return/^<(a|abbr|span|b|strong|em|i|u|s|del|code)\b[\s\S]*<\/\1>$/i.test(e)?o.jsx(uee,{html:e},t):null;const s=r[1].toLowerCase(),i=wi(r[2],`${t}-${s}`,!0,n);return s==="kbd"?o.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"?o.jsx("mark",{className:"rounded bg-warning/25 px-0.5 text-foreground",children:i},t):s==="sub"?o.jsx("sub",{children:i},t):o.jsx("sup",{children:i},t)}function wi(e,t,n=!0,r){const s=lee(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,l=[];let c=0,u;for(;(u=i.exec(s))!==null;){u.index>c&&l.push(B4(s.slice(c,u.index)));const f=u[0],p=`${t}-${u.index}`,g=f.startsWith("<")?fee(f,p,r):null;if(g)l.push(g);else if(f.startsWith("\\(")&&f.endsWith("\\)"))l.push(o.jsx(nh,{tex:f.slice(2,-2)},p));else if(f.startsWith("$")&&f.endsWith("$"))l.push(o.jsx(nh,{tex:f.slice(1,-1)},p));else if(f.startsWith("`")){const y=f.match(/^`+/)?.[0].length??1;l.push(o.jsx("code",{className:`${n?"break-all":"whitespace-nowrap"} rounded bg-surface-2 px-1 py-0.5 font-mono text-[0.92em] text-foreground`,children:cee(f.slice(y,-y))},p))}else if(f.startsWith("~~"))l.push(o.jsx("del",{className:"text-muted-foreground decoration-border-strong",children:wi(f.slice(2,-2),`${p}-del`,n,r)},p));else if(f.startsWith("**")||f.startsWith("__"))l.push(o.jsx("strong",{className:"font-semibold text-foreground",children:wi(f.slice(2,-2),`${p}-strong`,n,r)},p));else if(f.startsWith("*")||f.startsWith("_"))l.push(o.jsx("em",{className:"italic",children:wi(f.slice(1,-1),`${p}-em`,n,r)},p));else if(f.startsWith("![")){const y=f.match(/^!\[([^\]]*)\]\((.*)\)$/),v=f.match(/^!\[([^\]]+)\]\[([^\]]*)\]$/),S=f.match(/^!\[([^\]]+)\]$/);if(y){const A=j2(y[2]);l.push(A?Zx(p,y[1],A.href,A.title,r):f)}else if(v){const A=v[2]||v[1],T=r.referenceDefinitions.get(bm(A));l.push(T?Zx(p,v[1],T.href,T.title,r):f)}else if(S){const A=r.referenceDefinitions.get(bm(S[1]));l.push(A?Zx(p,S[1],A.href,A.title,r):f)}else l.push(f)}else if(f.startsWith("[^")){const y=QT(f.slice(2,-1)),v=r.footnoteDefinitions.get(y);l.push(v?o.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:o.jsx("a",{href:`#fn-${v.id}`,className:"text-primary no-underline",children:v.index})},p):f)}else if(f.startsWith("<http")){const y=f.slice(1,-1);l.push(o.jsx("a",{href:y,target:"_blank",rel:"noreferrer",className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p))}else if(f.startsWith("<")&&f.endsWith(">")&&P4(f.slice(1,-1))){const y=f.slice(1,-1);l.push(o.jsx("a",{href:`mailto:${y}`,className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p))}else if(P4(Jx(f).linkText)){const{linkText:y,suffix:v}=Jx(f);l.push(o.jsx("a",{href:`mailto:${y}`,className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p)),v&&l.push(v)}else if(f.startsWith("http")||f.startsWith("www.")){const{linkText:y,suffix:v}=Jx(f),S=y.startsWith("www.")?`https://${y}`:y;l.push(o.jsx("a",{href:S,target:"_blank",rel:"noreferrer",className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:y},p)),v&&l.push(v)}else{const y=f.match(/^\[([^\]]+)\]\((.*)\)$/),v=f.match(/^\[([^\]]+)\]\[([^\]]*)\]$/),S=f.match(/^\[([^\]]+)\]$/),A=v?v[2]||v[1]:S?.[1]??null,T=A?r.referenceDefinitions.get(bm(A)):null,L=y?j2(y[2]):null,I=L?.href??T?.href??null,j=I?KJ(I):null,P=y?.[1]??v?.[1]??S?.[1]??"";l.push(j?o.jsx("a",{href:j,title:L?.title??T?.title,target:"_blank",rel:"noreferrer",className:`${n?"break-all":"whitespace-nowrap"} text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary`,children:wi(P,`${p}-link`,n,r)},p):f)}c=i.lastIndex}return c<s.length&&l.push(B4(s.slice(c))),l.length>0?l:[e]}function YT(e){return/(?: {2,}|\\)$/.test(e)}function KT(e){return e.replace(/(?: {2,}|\\)$/,"")}function sg(e){return/^(?: {4}|\t)/.test(e)}function XT(e){return e.startsWith(" ")?e.slice(1):e.replace(/^ {4}/,"")}function ZT(e,t,n){const r=[];return e.forEach((s,i)=>{const l=YT(s);r.push(...wi(KT(s),`${t}-${i}`,!0,n)),i<e.length-1&&r.push(l?o.jsx("br",{},`${t}-${i}-br`):" ")}),r}function P2(e,t,n){const r=[],s=[];return e.forEach((i,l)=>{s.push(YT(i)),r.push(wi(KT(i),`${t}-${l}`,!0,n))}),{perLine:r,hardBreaks:s}}function B2(e,t,n,r,s){const i=[];return e.forEach((l,c)=>{const u=n[c]??0,f=!!(s&&u>=s.start&&u<=s.end);i.push(o.jsx("span",{"data-md-ref-start":u,"data-md-ref-end":u,"data-selected":f?"true":void 0,children:l},`${r}-ref-${c}`)),c<e.length-1&&i.push(t[c]?o.jsx("br",{},`${r}-${c}-br`):" ")}),i}function rh(e){const t=e.trim().replace(/^\|/,"").replace(/\|$/,""),n=[];let r="",s=!1,i=0,l=0;for(let c=0;c<t.length;c+=1){const u=t[c];if(s){r+=u,s=!1;continue}if(u==="\\"){s=!0;continue}if(u==="`"){const f=c;for(;c+1<t.length&&t[c+1]==="`";)c+=1;const p=c-f+1;r+="`".repeat(p),i===0?i=p:i===p&&(i=0);continue}if(i===0&&u==="["?l+=1:i===0&&u==="]"&&l>0&&(l-=1),u==="|"&&i===0&&l===0){n.push(r.trim()),r="";continue}r+=u}return s&&(r+="\\"),n.push(r.trim()),n}function JT(e){return rh(e).map(t=>/^:-+:$/.test(t)?"center":/^-+:$/.test(t)?"right":/^:-+$/.test(t)?"left":null)}function ig(e){return e==="center"?"text-center":e==="right"?"text-right":"text-left"}function og(e){return/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/.test(e.trim())}function hee(e,t){return e>96||e>44&&t>.35}function iv(e){return(e.match(/^\s*/)?.[0]??"").replace(/\t/g," ").length}function ov(e){const t=e.trim().match(/^([-+*]|\d+[.)])\s+(.+)$/);if(!t)return null;const n=/^\d+[.)]$/.test(t[1]);return{ordered:n,start:n?Number.parseInt(t[1],10):void 0,content:t[2]}}function eC(e,t,n,r,s,i=new Set){const l=[],c=[];let u=t;for(;u<e.length;){const f=e[u];if(s&&(rg(f)||i.has(u))){u+=1;continue}const p=ov(f),g=iv(f);if(!p){if(g>n&&c.length>0){([...c].reverse().find(A=>A.indent<g)?.item??c[c.length-1].item).paragraphs.push(f.trim());for(const A of c)A.item.lineEnd=u+1;u+=1;continue}break}if(g<n||g===n&&p.ordered!==r)break;const y={content:p.content,ordered:p.ordered,start:p.start,children:[],paragraphs:[],lineStart:u+1,lineEnd:u+1};for(;c.length>0&&c[c.length-1].indent>=g;)c.pop();const v=c[c.length-1]?.item??null;v?v.children.push(y):l.push(y),c.push({indent:g,item:y});for(const S of c)S.item.lineEnd=u+1;u+=1}return{items:l,nextIndex:u}}function av(e,t,n,r=0){return e.map((s,i)=>{const l=s.content.match(/^\[([ xX])\]\s+(.+)$/);return{key:`item-${i}`,taskItem:!!l,refStart:s.lineStart+r,refEnd:s.lineEnd+r,content:o.jsxs(o.Fragment,{children:[l?o.jsx("input",{type:"checkbox",checked:l[1].toLowerCase()==="x",readOnly:!0,className:"mr-2 align-[-2px] accent-primary"}):null,wi(l?.[2]??s.content,`li-${t}-${i}`,!0,n),s.paragraphs.length>0&&o.jsx("div",{className:"mt-1 space-y-1 text-muted-foreground",children:s.paragraphs.map((c,u)=>o.jsx("p",{children:wi(c,`li-${t}-${i}-p-${u}`,!0,n)},`paragraph-${u}`))})]}),groups:pee(s.children,`${t}-${i}`,n,r)}})}function pee(e,t,n,r=0){const s=[];for(const i of e){const l=s[s.length-1];l&&l.ordered===i.ordered?l.items.push(i):s.push({ordered:i.ordered,items:[i]})}return s.map((i,l)=>({ordered:i.ordered,start:i.ordered?i.items[0]?.start:void 0,items:av(i.items,`${t}-g${l}`,n,r)}))}function lv(e,t){return e.map(n=>{const r=!!(t&&n.refStart<=t.end&&n.refEnd>=t.start);return o.jsxs("li",{className:n.taskItem?"list-none":void 0,"data-md-ref-start":n.refStart,"data-md-ref-end":n.refEnd,"data-selected":r?"true":void 0,children:[n.content,n.groups.length>0&&mee(n.groups,t)]},n.key)})}function mee(e,t){return e.map((n,r)=>{const s=n.ordered?"ol":"ul";return o.jsx(s,{start:n.start,className:`${n.ordered?"list-decimal":"list-disc"} mt-1 space-y-0.5 pl-4 marker:text-muted-foreground/60`,children:lv(n.items,t)},`nested-${r}`)})}function gee(e){const t=Array.from(e.footnoteDefinitions.values()).sort((n,r)=>n.index-r.index);return t.length===0?null:o.jsxs("section",{className:"mt-3 border-t border-border/20 pt-2 text-[12px] leading-5 text-muted-foreground",children:[o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/80",children:e.footnotesLabel}),o.jsx("ol",{className:"list-decimal space-y-1 pl-5",children:t.map(n=>o.jsxs("li",{id:`fn-${n.id}`,children:[wi(n.text,`footnote-${n.id}`,!0,e)," ",o.jsx("a",{href:`#fnref-${n.id}`,className:"text-primary no-underline","aria-label":e.backToFootnoteLabel(n.index),children:"↩"})]},n.id))})]})}function xee(e,t,n,r){const s=[];let i=0;const l=c=>r?.[c]??c+1;for(;i<e.length;){const c=e[i],u=c.trim();if(!u){i+=1;continue}if(/^<details>\s*$/i.test(u)){const L=i;let I="Details";const j=[];for(i+=1;i<e.length&&!/^<\/details>\s*$/i.test(e[i].trim());){const P=e[i].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);P?I=P[1].trim()||I:j.push(e[i].trimStart()),i+=1}i<e.length&&(i+=1),s.push({kind:"static",node:o.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[o.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:wi(I,`${t}-details-${L}-summary`,!0,n)}),j.length>0&&o.jsx("div",{className:"mt-2 text-sm leading-6",children:ZT(j,`${t}-details-${L}`,n)})]},`${t}-details-${L}`)});continue}const f=qT(c);if(f){const L=[c],I=i;for(i+=1;i<e.length&&!f.selfContained&&!new RegExp(`</${f.tag}>`,"i").test(e[i]);)L.push(e[i]),i+=1;i<e.length&&!f.selfContained&&(L.push(e[i]),i+=1),s.push({kind:"static",node:o.jsx(VT,{html:L.join(`
180
180
  `)},`${t}-html-${I}`)});continue}const p=u.match(/^(```|~~~)\s*(.*)$/);if(p){const L=[],I=p[1],j=p[2]?.trim(),P=i;for(i+=1;i<e.length&&!e[i].trim().startsWith(I);)L.push(e[i]),i+=1;i<e.length&&(i+=1),j.toLowerCase()==="mermaid"?s.push({kind:"static",node:o.jsx(nC,{code:L.join(`
181
181
  `),blockKey:`${t}-code-${P}`},`${t}-code-${P}`)}):["math","latex","tex"].includes(j.toLowerCase())?s.push({kind:"static",node:o.jsx(nh,{tex:L.join(`
182
182
  `),display:!0},`${t}-code-${P}`)}):s.push({kind:"code",key:`${t}-code-${P}`,code:L.join(`
183
183
  `),lang:j,blockKey:`${t}-code-${P}`,codeStartLine:l(P)+1});continue}if(sg(c)){const L=[],I=i;for(;i<e.length&&(sg(e[i])||!e[i].trim());)L.push(e[i].trim()?XT(e[i]):""),i+=1;s.push({kind:"code",key:`${t}-indented-code-${I}`,code:L.join(`
184
- `).replace(/\n+$/,""),lang:"",blockKey:`${t}-indented-code-${I}`,codeStartLine:l(I)});continue}const g=u.match(/^(#{1,6})\s+(.+)$/);if(g){const I=`h${Math.min(6,g[1].length+1)}`,j=OT(g[2]),P=M2(j,n);s.push({kind:"static",node:o.jsx(I,{id:P,className:"scroll-mt-16 font-semibold text-foreground",children:wi(j,`${t}-heading-${i}`,!0,n)},`${t}-heading-${i}`)}),i+=1;continue}if(i+1<e.length&&c.includes("|")&&og(e[i+1])){const L=rh(c),I=JT(e[i+1]),j=[],P=i;for(i+=2;i<e.length&&e[i].includes("|")&&e[i].trim();)j.push(rh(e[i])),i+=1;s.push({kind:"static",node:o.jsx("div",{className:RT,"data-markdown-table-scroll":!0,children:o.jsxs("table",{className:"w-max min-w-full max-w-none table-auto border-collapse text-left text-[11px] sm:text-xs",children:[o.jsx("thead",{className:"bg-surface-2 text-foreground",children:o.jsx("tr",{children:L.map((F,R)=>o.jsx("th",{className:`${ET} ${ig(I[R]??null)}`,children:o.jsx("div",{className:ng,children:wi(F,`${t}-th-${P}-${R}`,!0,n)})},`h-${R}`))})}),o.jsx("tbody",{children:j.map((F,R)=>o.jsx("tr",{className:"border-t border-border/10",children:L.map((C,H)=>o.jsx("td",{className:`${IT} ${ig(I[H]??null)}`,children:o.jsx("div",{className:ng,children:wi(F[H]??"",`${t}-td-${P}-${R}-${H}`,!0,n)})},`c-${H}`))},`r-${R}`))})]})},`${t}-table-${P}`)});continue}const y=ov(c);if(y){const L=y.ordered,I=iv(c),j=y.start,P=i,F=eC(e,i,I,L,!1);i=F.nextIndex,s.push({kind:"list",keyPrefix:`${t}-list-${P}`,ordered:L,start:L?j:void 0,renders:av(F.items,`${t}-list-${P}`,n,l(0)-1)});continue}const v=[c.trimStart()],S=[l(i)],A=i;for(i+=1;i<e.length&&e[i].trim()&&!N2(e[i])&&!(i+1<e.length&&e[i].includes("|")&&og(e[i+1]));)v.push(e[i].trimStart()),S.push(l(i)),i+=1;const T=P2(v,`${t}-p-${A}`,n);s.push({kind:"paragraph",keyPrefix:`${t}-p-${A}`,perLine:T.perLine,hardBreaks:T.hardBreaks,lineNums:S})}return s}function bee(e,t){return e.map(n=>{switch(n.kind){case"static":return n.node;case"paragraph":return o.jsx("p",{children:B2(n.perLine,n.hardBreaks,n.lineNums,n.keyPrefix,t)},n.keyPrefix);case"list":{const r=n.ordered?"ol":"ul";return o.jsx(r,{start:n.start,className:`${n.ordered?"list-decimal":"list-disc"} space-y-0.5 pl-4 marker:text-muted-foreground/70`,children:lv(n.renders,t)},n.keyPrefix)}case"code":return o.jsx(ag,{code:n.code,lang:n.lang,blockKey:n.blockKey,codeStartLine:n.codeStartLine,lineRange:t},n.key)}})}let Up=null,F4=!1;const zp=16,tC=192;function yee(){return Up||(Up=l0(()=>import("./mermaid.core-Cd5etby6.js").then(e=>e.aJ),__vite__mapDeps([6,1,7])).then(e=>e.default??e).catch(e=>{throw Up=null,e})),Up}function vee(e){F4||(e.initialize({startOnLoad:!1,securityLevel:"strict",theme:"neutral"}),F4=!0)}function wee(e){const t=e.match(/\sviewBox=(["'])([^"']+)\1/i);if(!t)return e;const[,,n]=t,r=n.trim().split(/[\s,]+/).map(Number),[,,s,i]=r;if(!Number.isFinite(s)||!Number.isFinite(i)||s<=0||i<=0)return e;const l=Math.max(tC,Math.ceil(s)),c=Math.ceil(l/s*i);return e.replace(/<svg\b([^>]*)>/i,(u,f)=>`<svg${f.replace(/\s(?:width|height)=(["']).*?\1/gi,"").replace(/\sstyle=(["']).*?\1/gi,"")} width="${l}" height="${c}">`)}function See(e){const t=e?.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}if(!Number.isFinite(n.width)||!Number.isFinite(n.height)||n.width<=0||n.height<=0)return;const r=n.x-zp,s=n.y-zp,i=n.width+zp*2,l=n.height+zp*2,c=Math.max(tC,Math.ceil(i)),u=Math.ceil(c/i*l);t.setAttribute("viewBox",`${r} ${s} ${i} ${l}`),t.setAttribute("width",String(c)),t.setAttribute("height",String(u)),t.removeAttribute("style")}function Aee(e){const t=e.trim().split(/\s+/,1)[0]?.toLowerCase();if(!t)return null;const n=t.replace(/^language-/,"");return Yd(`code.${n}`)??n}function nC({code:e,blockKey:t}){const{t:n}=qn(),[r,s]=b.useState(null),[i,l]=b.useState(!1),c=b.useRef(null),u=b.useContext(BT);b.useEffect(()=>{let p=!1;return s(null),l(!1),yee().then(async g=>{vee(g);const y=`termdock-md-mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`,{svg:v}=await g.render(y,e);p||s(wee(v))}).catch(()=>{p||l(!0)}),()=>{p=!0}},[t,e]),b.useLayoutEffect(()=>{r&&See(c.current)},[r]);const f=b.useCallback(()=>{const p=c.current?.querySelector("svg")?.outerHTML??r;p&&u?.(p)},[u,r]);return i?o.jsx(ag,{code:e,lang:"mermaid",blockKey:`${t}-fallback`}):o.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[o.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"}),o.jsx("div",{className:"bg-surface p-3",children:r?o.jsx("button",{type:"button",className:"block max-w-full rounded text-left focus:outline-none focus:ring-2 focus:ring-ring/45",title:n("rightSidebar.openMermaidDiagram"),onClick:p=>{p.stopPropagation(),f()},children:o.jsx("span",{ref:c,role:"img","aria-label":n("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:r}})}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:n("rightSidebar.renderingDiagram")})})]})}function ag({code:e,lang:t,blockKey:n,codeStartLine:r,lineRange:s}){const i=Aee(t),[l,c]=b.useState(null);b.useEffect(()=>{if(!i||!X9(e)){c(null);return}let f=!1;return Z9().then(p=>{if(f||!p.registered(i)){f||c(null);return}try{c(J9(p,e,i))}catch{f||c(null)}}).catch(()=>{f||c(null)}),()=>{f=!0}},[n,e,i]);const u=l??(e||" ").split(`
184
+ `).replace(/\n+$/,""),lang:"",blockKey:`${t}-indented-code-${I}`,codeStartLine:l(I)});continue}const g=u.match(/^(#{1,6})\s+(.+)$/);if(g){const I=`h${Math.min(6,g[1].length+1)}`,j=OT(g[2]),P=M2(j,n);s.push({kind:"static",node:o.jsx(I,{id:P,className:"scroll-mt-16 font-semibold text-foreground",children:wi(j,`${t}-heading-${i}`,!0,n)},`${t}-heading-${i}`)}),i+=1;continue}if(i+1<e.length&&c.includes("|")&&og(e[i+1])){const L=rh(c),I=JT(e[i+1]),j=[],P=i;for(i+=2;i<e.length&&e[i].includes("|")&&e[i].trim();)j.push(rh(e[i])),i+=1;s.push({kind:"static",node:o.jsx("div",{className:RT,"data-markdown-table-scroll":!0,children:o.jsxs("table",{className:"w-max min-w-full max-w-none table-auto border-collapse text-left text-[11px] sm:text-xs",children:[o.jsx("thead",{className:"bg-surface-2 text-foreground",children:o.jsx("tr",{children:L.map((F,R)=>o.jsx("th",{className:`${ET} ${ig(I[R]??null)}`,children:o.jsx("div",{className:ng,children:wi(F,`${t}-th-${P}-${R}`,!0,n)})},`h-${R}`))})}),o.jsx("tbody",{children:j.map((F,R)=>o.jsx("tr",{className:"border-t border-border/10",children:L.map((C,H)=>o.jsx("td",{className:`${IT} ${ig(I[H]??null)}`,children:o.jsx("div",{className:ng,children:wi(F[H]??"",`${t}-td-${P}-${R}-${H}`,!0,n)})},`c-${H}`))},`r-${R}`))})]})},`${t}-table-${P}`)});continue}const y=ov(c);if(y){const L=y.ordered,I=iv(c),j=y.start,P=i,F=eC(e,i,I,L,!1);i=F.nextIndex,s.push({kind:"list",keyPrefix:`${t}-list-${P}`,ordered:L,start:L?j:void 0,renders:av(F.items,`${t}-list-${P}`,n,l(0)-1)});continue}const v=[c.trimStart()],S=[l(i)],A=i;for(i+=1;i<e.length&&e[i].trim()&&!N2(e[i])&&!(i+1<e.length&&e[i].includes("|")&&og(e[i+1]));)v.push(e[i].trimStart()),S.push(l(i)),i+=1;const T=P2(v,`${t}-p-${A}`,n);s.push({kind:"paragraph",keyPrefix:`${t}-p-${A}`,perLine:T.perLine,hardBreaks:T.hardBreaks,lineNums:S})}return s}function bee(e,t){return e.map(n=>{switch(n.kind){case"static":return n.node;case"paragraph":return o.jsx("p",{children:B2(n.perLine,n.hardBreaks,n.lineNums,n.keyPrefix,t)},n.keyPrefix);case"list":{const r=n.ordered?"ol":"ul";return o.jsx(r,{start:n.start,className:`${n.ordered?"list-decimal":"list-disc"} space-y-0.5 pl-4 marker:text-muted-foreground/70`,children:lv(n.renders,t)},n.keyPrefix)}case"code":return o.jsx(ag,{code:n.code,lang:n.lang,blockKey:n.blockKey,codeStartLine:n.codeStartLine,lineRange:t},n.key)}})}let Up=null,F4=!1;const zp=16,tC=192;function yee(){return Up||(Up=l0(()=>import("./mermaid.core-B4h2_dRl.js").then(e=>e.aJ),__vite__mapDeps([6,1,7])).then(e=>e.default??e).catch(e=>{throw Up=null,e})),Up}function vee(e){F4||(e.initialize({startOnLoad:!1,securityLevel:"strict",theme:"neutral"}),F4=!0)}function wee(e){const t=e.match(/\sviewBox=(["'])([^"']+)\1/i);if(!t)return e;const[,,n]=t,r=n.trim().split(/[\s,]+/).map(Number),[,,s,i]=r;if(!Number.isFinite(s)||!Number.isFinite(i)||s<=0||i<=0)return e;const l=Math.max(tC,Math.ceil(s)),c=Math.ceil(l/s*i);return e.replace(/<svg\b([^>]*)>/i,(u,f)=>`<svg${f.replace(/\s(?:width|height)=(["']).*?\1/gi,"").replace(/\sstyle=(["']).*?\1/gi,"")} width="${l}" height="${c}">`)}function See(e){const t=e?.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}if(!Number.isFinite(n.width)||!Number.isFinite(n.height)||n.width<=0||n.height<=0)return;const r=n.x-zp,s=n.y-zp,i=n.width+zp*2,l=n.height+zp*2,c=Math.max(tC,Math.ceil(i)),u=Math.ceil(c/i*l);t.setAttribute("viewBox",`${r} ${s} ${i} ${l}`),t.setAttribute("width",String(c)),t.setAttribute("height",String(u)),t.removeAttribute("style")}function Aee(e){const t=e.trim().split(/\s+/,1)[0]?.toLowerCase();if(!t)return null;const n=t.replace(/^language-/,"");return Yd(`code.${n}`)??n}function nC({code:e,blockKey:t}){const{t:n}=qn(),[r,s]=b.useState(null),[i,l]=b.useState(!1),c=b.useRef(null),u=b.useContext(BT);b.useEffect(()=>{let p=!1;return s(null),l(!1),yee().then(async g=>{vee(g);const y=`termdock-md-mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`,{svg:v}=await g.render(y,e);p||s(wee(v))}).catch(()=>{p||l(!0)}),()=>{p=!0}},[t,e]),b.useLayoutEffect(()=>{r&&See(c.current)},[r]);const f=b.useCallback(()=>{const p=c.current?.querySelector("svg")?.outerHTML??r;p&&u?.(p)},[u,r]);return i?o.jsx(ag,{code:e,lang:"mermaid",blockKey:`${t}-fallback`}):o.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[o.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"}),o.jsx("div",{className:"bg-surface p-3",children:r?o.jsx("button",{type:"button",className:"block max-w-full rounded text-left focus:outline-none focus:ring-2 focus:ring-ring/45",title:n("rightSidebar.openMermaidDiagram"),onClick:p=>{p.stopPropagation(),f()},children:o.jsx("span",{ref:c,role:"img","aria-label":n("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:r}})}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:n("rightSidebar.renderingDiagram")})})]})}function ag({code:e,lang:t,blockKey:n,codeStartLine:r,lineRange:s}){const i=Aee(t),[l,c]=b.useState(null);b.useEffect(()=>{if(!i||!X9(e)){c(null);return}let f=!1;return Z9().then(p=>{if(f||!p.registered(i)){f||c(null);return}try{c(J9(p,e,i))}catch{f||c(null)}}).catch(()=>{f||c(null)}),()=>{f=!0}},[n,e,i]);const u=l??(e||" ").split(`
185
185
  `).map(f=>[f||" "]);return o.jsxs("div",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface shadow-sm",children:[t&&o.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}),o.jsx("pre",{className:`${rv} termdock-code overflow-auto p-3 text-[11px] leading-relaxed text-foreground`,children:o.jsx("code",{children:u.map((f,p)=>{const g=r!=null?r+p:null,y=!!(s&&g!=null&&g>=s.start&&g<=s.end);return o.jsxs("span",{"data-md-ref-start":g??void 0,"data-md-ref-end":g??void 0,"data-selected":y?"true":void 0,children:[f,p<u.length-1?`
186
186
  `:null]},`${n}-line-${p}`)})})})]})}function Tee(e,t,n,r,s){e=eee(e);const i=XJ(e),l=JJ(e),c=[],u={markdownFilePath:t,rootPath:n,referenceDefinitions:i,footnoteDefinitions:ZJ(e),headingSlugCounts:new Map,images:c,onImageOpen:r,footnotesLabel:s?.footnotes??"Footnotes",backToFootnoteLabel:s?.backToFootnote??(y=>`Back to footnote ${y}`)},f=[];let p=0;for(;p<e.length;){const y=e[p],v=y.trim();if(rg(y)||l.has(p)){p+=1;continue}if(!v){p+=1;continue}if(/^<details>\s*$/i.test(v)){const R=p;let C="Details";const H=[];for(p+=1;p<e.length&&!/^<\/details>\s*$/i.test(e[p].trim());){const Q=e[p].trim().match(/^<summary>(.*?)<\/summary>\s*$/i);Q?C=Q[1].trim()||C:H.push(e[p].trimStart()),p+=1}p<e.length&&(p+=1),f.push({key:`details-${R}`,startLine:R+1,endLine:p,content:o.jsxs("details",{className:"overflow-hidden rounded-lg border border-border/20 bg-surface px-3 py-2 text-muted-foreground",children:[o.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-foreground",children:wi(C,`details-${R}-summary`,!0,u)}),H.length>0&&o.jsx("div",{className:"mt-2 text-sm leading-6",children:ZT(H,`details-${R}`,u)})]})});continue}const S=qT(y);if(S){const R=[y],C=p;for(p+=1;p<e.length&&!S.selfContained&&!new RegExp(`</${S.tag}>`,"i").test(e[p]);)R.push(e[p]),p+=1;p<e.length&&!S.selfContained&&(R.push(e[p]),p+=1),f.push({key:`html-${C}`,startLine:C+1,endLine:p,content:o.jsx(VT,{html:R.join(`
187
187
  `)})});continue}const A=v.match(/^(```|~~~)\s*(.*)$/);if(A){const R=[],C=A[1],H=A[2]?.trim(),Q=p;for(p+=1;p<e.length&&!e[p].trim().startsWith(C);)R.push(e[p]),p+=1;p<e.length&&(p+=1),f.push({key:`code-${Q}`,startLine:Q+1,endLine:p,fineGrained:H.toLowerCase()!=="mermaid"&&!["math","latex","tex"].includes(H.toLowerCase()),content:H.toLowerCase()==="mermaid"?o.jsx(nC,{code:R.join(`
@@ -454,4 +454,4 @@ ${Lt}
454
454
  + }
455
455
  return context;
456
456
  }`}};function u7(){if(typeof window>"u")return"kotlin";const t=new URLSearchParams(window.location.search).get("fixture");return t&&t in Q2?t:"kotlin"}function d7(){return typeof window>"u"?"unified":new URLSearchParams(window.location.search).get("view")==="split"?"split":"unified"}function f7(){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 h7(){return typeof window>"u"?!0:new URLSearchParams(window.location.search).get("wrap")!=="off"}function Pte(){const[e,t]=b.useState(()=>u7()),[n,r]=b.useState(()=>d7()),[s,i]=b.useState(()=>f7()),[l,c]=b.useState(()=>h7()),u=Q2[e],f=b.useMemo(()=>Object.entries(Q2),[]);return b.useEffect(()=>{if(typeof window>"u")return;let p=window.location.search;const g=()=>{window.location.search!==p&&(p=window.location.search,t(u7()),r(d7()),i(f7()),c(h7()))};window.addEventListener("popstate",g),window.addEventListener("pageshow",g),window.addEventListener("focus",g);const y=window.setInterval(g,250);return()=>{window.removeEventListener("popstate",g),window.removeEventListener("pageshow",g),window.removeEventListener("focus",g),window.clearInterval(y)}},[]),o.jsx("div",{className:"min-h-screen bg-background-subtle text-foreground","data-diff-lab":!0,"data-diff-lab-fixture":e,"data-diff-lab-view":n,"data-diff-lab-inline":s,"data-diff-lab-wrap":l?"on":"off",children:o.jsxs("div",{className:"mx-auto flex min-h-screen max-w-[1180px] flex-col px-4 py-4",children:[o.jsxs("header",{className:"mb-3 flex flex-wrap items-center justify-between gap-3 border-b border-border/20 pb-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-semibold",children:"Diff Lab"}),o.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."})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("select",{value:e,onChange:p=>t(p.target.value),"aria-label":"Fixture",className:"h-8 rounded-md border border-border/30 bg-surface px-2 text-xs text-foreground outline-none",children:f.map(([p,g])=>o.jsx("option",{value:p,children:g.label},p))}),o.jsxs("div",{className:"inline-flex h-8 overflow-hidden rounded-full bg-surface-2 p-0.5",children:[o.jsx("button",{type:"button",onClick:()=>r("unified"),className:`rounded-full px-3 text-xs font-semibold ${n==="unified"?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:"Unified"}),o.jsx("button",{type:"button",onClick:()=>r("split"),className:`rounded-full px-3 text-xs font-semibold ${n==="split"?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:"Split"})]}),o.jsx("div",{className:"inline-flex h-8 overflow-hidden rounded-full bg-surface-2 p-0.5",children:["none","words","chars"].map(p=>o.jsx("button",{type:"button",onClick:()=>i(p),className:`rounded-full px-3 text-xs font-semibold ${s===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:p},p))}),o.jsxs("button",{type:"button",onClick:()=>c(p=>!p),className:`h-8 rounded-full px-3 text-xs font-semibold ${l?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:["Wrap ",l?"on":"off"]})]})]}),o.jsx("main",{className:"min-h-0 flex-1 overflow-auto rounded-lg border border-border/20 bg-surface",children:o.jsx(fT,{filePath:u.path,repoRoot:"/tmp/termdock-diff-lab",changedFile:{path:u.path,absolutePath:`/tmp/termdock-diff-lab/${u.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:u.diff,oldSourceOverride:u.oldSource,active:!0,wrap:l,showScrollHint:!l,viewType:n,inlineMode:s})})]})})}const gC=40,$2="/tmp/termdock-diff-review-lab";function p7(e,t){const n=[`diff --git a/${e} b/${e}`,`--- a/${e}`,`+++ b/${e}`,`@@ -1,${t} +1,${t} @@`];for(let r=0;r<t;r+=1)r%5===0&&n.push(`-const removed_${r} = ${r};`),r%3===0&&n.push(`+const added_${r} = ${r} * 2;`),n.push(` context line ${r} in ${e}`);return n.join(`
457
- `)}function Bte(e,t){return Array.from({length:gC},(n,r)=>{const s=6+r*7%60,i=`src/module${String(r).padStart(2,"0")}/File${r}.ts`,l=`${$2}/${i}`,c=p7(i,s),u=p7(i,1);return{key:l,path:i,absolutePath:l,status:"modified",repoRoot:$2,displayName:`File${r}.ts`,displayDir:`src/module${String(r).padStart(2,"0")} · ${s} lines`,diffOverride:!t||e.has(r)?c:u,auditRecords:[]}})}function Fte(){const e=b.useMemo(()=>{if(typeof window>"u")return 0;const L=new URLSearchParams(window.location.search).get("delay"),I=L===null?0:Number.parseInt(L,10);return Number.isInteger(I)&&I>0?I:0},[]),t=e>0,[n,r]=b.useState(()=>new Set);b.useEffect(()=>{if(!t)return;const L=Array.from({length:gC},(I,j)=>window.setTimeout(()=>{r(P=>{const F=new Set(P);return F.add(j),F})},e+j*20));return()=>L.forEach(I=>window.clearTimeout(I))},[t,e]);const s=b.useMemo(()=>Bte(n,t),[n,t]),i=b.useMemo(()=>[{key:"mock-repo",root:$2,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]),l=b.useMemo(()=>{if(typeof window>"u")return null;const L=new URLSearchParams(window.location.search).get("select");if(L===null)return null;const I=Number.parseInt(L,10);return Number.isInteger(I)&&I>=0&&I<s.length?I:null},[s.length]),[c,u]=b.useState(()=>l!==null?s[l].key:null),[f,p]=b.useState(()=>({key:l!==null?s[l].key:null,nonce:l!==null?1:0})),[g,y]=b.useState("list"),[v,S]=b.useState(new Set),[A,T]=b.useState(l!==null?1:0);return o.jsxs("div",{className:"flex h-screen flex-col bg-background text-foreground","data-diff-review-lab":!0,children:[o.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: ",o.jsx("span",{"data-lab-selected":!0,children:c??"none"})," · slide ",A]}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(Jm,{mobile:!0,backLabel:"Back",files:s,groups:i,selectedKey:c,scrollToKey:f.key,scrollToKeyNonce:f.nonce,mode:g,onModeChange:L=>{L!=="ai"&&y(L)},collapsedDirectoryKeys:v,onToggleDirectory:L=>S(I=>{const j=new Set(I);return j.has(L)?j.delete(L):j.add(L),j}),onSelectFile:L=>{u(L.key),p(I=>({key:L.key,nonce:I.nonce+1}))},onMobileSlideChange:T,renderLeading:()=>null,renderStreamBadge:L=>o.jsx("span",{className:"text-[10px] text-muted-foreground",children:L}),wrap:!0,showScrollHint:!1,activePane:!0})})]})}const Ote=6e4,cb="termdock:build-id:v1";let m7=!1;function g7(){m7||(m7=!0,window.setTimeout(()=>{window.location.reload()},80))}function H2(e){e.waiting?.postMessage({type:"SKIP_WAITING"})}async function Qte(){if(typeof caches>"u")return;const e=await caches.keys();await Promise.all(e.map(t=>caches.delete(t)))}function $te(e){e.addEventListener("updatefound",()=>{const t=e.installing;t&&t.addEventListener("statechange",()=>{t.state==="installed"&&navigator.serviceWorker.controller&&H2(e)})})}function Hte(){if(typeof window>"u"||!("serviceWorker"in navigator))return;const e="1788153805692",t=window.localStorage.getItem(cb);if(t&&t!==e){Qte().finally(()=>{window.localStorage.setItem(cb,e),g7()});return}t!==e&&window.localStorage.setItem(cb,e);let n=null;navigator.serviceWorker.addEventListener("controllerchange",g7),window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(r=>{$te(r),H2(r);const s=()=>{document.visibilityState==="visible"&&r.update().then(()=>H2(r)).catch(()=>{})};s(),n=window.setInterval(s,Ote),document.addEventListener("visibilitychange",s)}).catch(()=>{})}),window.addEventListener("beforeunload",()=>{n!==null&&window.clearInterval(n)})}qF();Hte();try{const e=JSON.parse(window.localStorage.getItem("termdock-color-theme")||"null");(e==="dark"||e==="light")&&(document.documentElement.dataset.theme=e,ZA(e))}catch{}function Ute(){const{t:e}=qn(),[t,n]=b.useState(null),[r,s]=b.useState(null),i=b.useCallback(async()=>{try{const l=await ME();n(l),s(null)}catch(l){s(l instanceof Error?l.message:"Failed to query auth status")}},[]);return b.useEffect(()=>{i()},[i]),b.useEffect(()=>{const l=()=>{n(c=>c&&{...c,authenticated:!1})};return window.addEventListener(Am,l),()=>window.removeEventListener(Am,l)},[]),t===null?o.jsx("div",{className:"flex w-screen items-center justify-center bg-background text-muted-foreground",style:{height:"var(--app-vh, 100vh)"},children:r?`${e("common.error")}: ${r}`:e("common.loading")}):t.enabled&&!t.authenticated?o.jsx(Dte,{onLoginSuccess:i}):o.jsx(Nte,{})}Jk.createRoot(document.getElementById("root")).render(o.jsx(D.StrictMode,{children:o.jsx(yR,{children:o.jsx(sS,{children:(()=>{const e=new URLSearchParams(window.location.search);return e.get("dag-playground")==="1"?o.jsx(jte,{}):e.get("diff-review-lab")==="1"?o.jsx(Fte,{}):e.get("diff-lab")==="1"?o.jsx(Pte,{}):o.jsx(Ute,{})})()})})}));export{WN as M,Xs as R,BM as S,l0 as _,XN as a,JN as b,Rt as c,o as j,qn as u,DL as v};
457
+ `)}function Bte(e,t){return Array.from({length:gC},(n,r)=>{const s=6+r*7%60,i=`src/module${String(r).padStart(2,"0")}/File${r}.ts`,l=`${$2}/${i}`,c=p7(i,s),u=p7(i,1);return{key:l,path:i,absolutePath:l,status:"modified",repoRoot:$2,displayName:`File${r}.ts`,displayDir:`src/module${String(r).padStart(2,"0")} · ${s} lines`,diffOverride:!t||e.has(r)?c:u,auditRecords:[]}})}function Fte(){const e=b.useMemo(()=>{if(typeof window>"u")return 0;const L=new URLSearchParams(window.location.search).get("delay"),I=L===null?0:Number.parseInt(L,10);return Number.isInteger(I)&&I>0?I:0},[]),t=e>0,[n,r]=b.useState(()=>new Set);b.useEffect(()=>{if(!t)return;const L=Array.from({length:gC},(I,j)=>window.setTimeout(()=>{r(P=>{const F=new Set(P);return F.add(j),F})},e+j*20));return()=>L.forEach(I=>window.clearTimeout(I))},[t,e]);const s=b.useMemo(()=>Bte(n,t),[n,t]),i=b.useMemo(()=>[{key:"mock-repo",root:$2,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]),l=b.useMemo(()=>{if(typeof window>"u")return null;const L=new URLSearchParams(window.location.search).get("select");if(L===null)return null;const I=Number.parseInt(L,10);return Number.isInteger(I)&&I>=0&&I<s.length?I:null},[s.length]),[c,u]=b.useState(()=>l!==null?s[l].key:null),[f,p]=b.useState(()=>({key:l!==null?s[l].key:null,nonce:l!==null?1:0})),[g,y]=b.useState("list"),[v,S]=b.useState(new Set),[A,T]=b.useState(l!==null?1:0);return o.jsxs("div",{className:"flex h-screen flex-col bg-background text-foreground","data-diff-review-lab":!0,children:[o.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: ",o.jsx("span",{"data-lab-selected":!0,children:c??"none"})," · slide ",A]}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(Jm,{mobile:!0,backLabel:"Back",files:s,groups:i,selectedKey:c,scrollToKey:f.key,scrollToKeyNonce:f.nonce,mode:g,onModeChange:L=>{L!=="ai"&&y(L)},collapsedDirectoryKeys:v,onToggleDirectory:L=>S(I=>{const j=new Set(I);return j.has(L)?j.delete(L):j.add(L),j}),onSelectFile:L=>{u(L.key),p(I=>({key:L.key,nonce:I.nonce+1}))},onMobileSlideChange:T,renderLeading:()=>null,renderStreamBadge:L=>o.jsx("span",{className:"text-[10px] text-muted-foreground",children:L}),wrap:!0,showScrollHint:!1,activePane:!0})})]})}const Ote=6e4,cb="termdock:build-id:v1";let m7=!1;function g7(){m7||(m7=!0,window.setTimeout(()=>{window.location.reload()},80))}function H2(e){e.waiting?.postMessage({type:"SKIP_WAITING"})}async function Qte(){if(typeof caches>"u")return;const e=await caches.keys();await Promise.all(e.map(t=>caches.delete(t)))}function $te(e){e.addEventListener("updatefound",()=>{const t=e.installing;t&&t.addEventListener("statechange",()=>{t.state==="installed"&&navigator.serviceWorker.controller&&H2(e)})})}function Hte(){if(typeof window>"u"||!("serviceWorker"in navigator))return;const e="1788155067769",t=window.localStorage.getItem(cb);if(t&&t!==e){Qte().finally(()=>{window.localStorage.setItem(cb,e),g7()});return}t!==e&&window.localStorage.setItem(cb,e);let n=null;navigator.serviceWorker.addEventListener("controllerchange",g7),window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(r=>{$te(r),H2(r);const s=()=>{document.visibilityState==="visible"&&r.update().then(()=>H2(r)).catch(()=>{})};s(),n=window.setInterval(s,Ote),document.addEventListener("visibilitychange",s)}).catch(()=>{})}),window.addEventListener("beforeunload",()=>{n!==null&&window.clearInterval(n)})}qF();Hte();try{const e=JSON.parse(window.localStorage.getItem("termdock-color-theme")||"null");(e==="dark"||e==="light")&&(document.documentElement.dataset.theme=e,ZA(e))}catch{}function Ute(){const{t:e}=qn(),[t,n]=b.useState(null),[r,s]=b.useState(null),i=b.useCallback(async()=>{try{const l=await ME();n(l),s(null)}catch(l){s(l instanceof Error?l.message:"Failed to query auth status")}},[]);return b.useEffect(()=>{i()},[i]),b.useEffect(()=>{const l=()=>{n(c=>c&&{...c,authenticated:!1})};return window.addEventListener(Am,l),()=>window.removeEventListener(Am,l)},[]),t===null?o.jsx("div",{className:"flex w-screen items-center justify-center bg-background text-muted-foreground",style:{height:"var(--app-vh, 100vh)"},children:r?`${e("common.error")}: ${r}`:e("common.loading")}):t.enabled&&!t.authenticated?o.jsx(Dte,{onLoginSuccess:i}):o.jsx(Nte,{})}Jk.createRoot(document.getElementById("root")).render(o.jsx(D.StrictMode,{children:o.jsx(yR,{children:o.jsx(sS,{children:(()=>{const e=new URLSearchParams(window.location.search);return e.get("dag-playground")==="1"?o.jsx(jte,{}):e.get("diff-review-lab")==="1"?o.jsx(Fte,{}):e.get("diff-lab")==="1"?o.jsx(Pte,{}):o.jsx(Ute,{})})()})})}));export{WN as M,Xs as R,BM as S,l0 as _,XN as a,JN as b,Rt as c,o as j,qn as u,DL as v};