nomadexapp 0.1.0

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 (163) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +224 -0
  3. package/bin/nomadex.mjs +1026 -0
  4. package/dist/assets/apl-Dgw9L7wA.js +1 -0
  5. package/dist/assets/asciiarmor-B3T-Ib7X.js +1 -0
  6. package/dist/assets/asn1-C0KgO0Wt.js +1 -0
  7. package/dist/assets/asterisk-D7tOY-Ef.js +1 -0
  8. package/dist/assets/brainfuck-Dr6WXxS2.js +1 -0
  9. package/dist/assets/clike-DQfG49Bz.js +1 -0
  10. package/dist/assets/clojure-DsDsbt3V.js +1 -0
  11. package/dist/assets/cmake-CaoY67QC.js +1 -0
  12. package/dist/assets/cobol-ng5WMKOY.js +1 -0
  13. package/dist/assets/coffeescript-L66efR1O.js +1 -0
  14. package/dist/assets/commonlisp-rk__8_Ow.js +1 -0
  15. package/dist/assets/crystal-C1BeQSjD.js +1 -0
  16. package/dist/assets/css-zrdFFahf.js +1 -0
  17. package/dist/assets/cypher-DTKBhe_T.js +1 -0
  18. package/dist/assets/d-CDf89RKe.js +1 -0
  19. package/dist/assets/diff-BY4_GICG.js +1 -0
  20. package/dist/assets/dist--QplBylv.js +6 -0
  21. package/dist/assets/dist-BOz4jprC.js +1 -0
  22. package/dist/assets/dist-BSpuB3dZ.js +1 -0
  23. package/dist/assets/dist-BVTS1puf.js +1 -0
  24. package/dist/assets/dist-BvjF9csH.js +1 -0
  25. package/dist/assets/dist-ByyB_57-.js +11 -0
  26. package/dist/assets/dist-C5sjJwrm.js +1 -0
  27. package/dist/assets/dist-C6S96i9v.js +1 -0
  28. package/dist/assets/dist-CUQQ4au1.js +1 -0
  29. package/dist/assets/dist-C_ZftsU-.js +1 -0
  30. package/dist/assets/dist-Cc03jTPl.js +1 -0
  31. package/dist/assets/dist-CftiQ_Tf.js +1 -0
  32. package/dist/assets/dist-ChuUwcd4.js +2 -0
  33. package/dist/assets/dist-Cuva2wRW.js +1 -0
  34. package/dist/assets/dist-CyFWfPpu.js +9 -0
  35. package/dist/assets/dist-D6kXrcQY.js +1 -0
  36. package/dist/assets/dist-DH3Q_V27.js +23 -0
  37. package/dist/assets/dist-DIQDx3Dq.js +1 -0
  38. package/dist/assets/dist-DO7LTg3a.js +1 -0
  39. package/dist/assets/dist-DYBvJnrG.js +1 -0
  40. package/dist/assets/dist-DhhFPaYP.js +13 -0
  41. package/dist/assets/dist-elfU6IUT.js +1 -0
  42. package/dist/assets/dist-mCTXNkQ9.js +1 -0
  43. package/dist/assets/dockerfile-BBRxgo6-.js +1 -0
  44. package/dist/assets/dtd-BOpcurKR.js +1 -0
  45. package/dist/assets/dylan-DrmRAfMX.js +1 -0
  46. package/dist/assets/ebnf-DgECi_W8.js +1 -0
  47. package/dist/assets/ecl-CWDhUBvl.js +1 -0
  48. package/dist/assets/eiffel-DBpGy7gs.js +1 -0
  49. package/dist/assets/elm-Dj_ZNWRH.js +1 -0
  50. package/dist/assets/erlang-Br4TQPB7.js +1 -0
  51. package/dist/assets/factor-bi5FmZTz.js +1 -0
  52. package/dist/assets/fcl-Dh6ibuJG.js +1 -0
  53. package/dist/assets/forth-fmpuPpMA.js +1 -0
  54. package/dist/assets/fortran-CZwiXuJZ.js +1 -0
  55. package/dist/assets/gas-DotCoURX.js +1 -0
  56. package/dist/assets/gherkin-Bw4mmeRF.js +1 -0
  57. package/dist/assets/groovy-D7xek06K.js +1 -0
  58. package/dist/assets/haskell-D5bv2Ijt.js +1 -0
  59. package/dist/assets/haxe-UA0z6FgT.js +1 -0
  60. package/dist/assets/http-DAkDDIPY.js +1 -0
  61. package/dist/assets/idl-DYj57TA2.js +1 -0
  62. package/dist/assets/index-BpFNmvYv.js +214 -0
  63. package/dist/assets/index-De1iEP2f.css +1 -0
  64. package/dist/assets/javascript-B9Zm1tmO.js +1 -0
  65. package/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  66. package/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  67. package/dist/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
  68. package/dist/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
  69. package/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  70. package/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  71. package/dist/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
  72. package/dist/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
  73. package/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  74. package/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  75. package/dist/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
  76. package/dist/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  77. package/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  78. package/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  79. package/dist/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  80. package/dist/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
  81. package/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  82. package/dist/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
  83. package/dist/assets/julia-CpHdnx_N.js +1 -0
  84. package/dist/assets/livescript-DcEJKRZ4.js +1 -0
  85. package/dist/assets/lua-s-LPZohT.js +1 -0
  86. package/dist/assets/mathematica-c8TKcpav.js +1 -0
  87. package/dist/assets/mbox-CUr7-CiI.js +1 -0
  88. package/dist/assets/mirc-pTdL1Ym3.js +1 -0
  89. package/dist/assets/mllike-DsgO-njf.js +1 -0
  90. package/dist/assets/modelica-PhVkZonB.js +1 -0
  91. package/dist/assets/mscgen-ByD0zE8S.js +1 -0
  92. package/dist/assets/mumps-DhD4kjw9.js +1 -0
  93. package/dist/assets/nginx-CJc6p_yt.js +1 -0
  94. package/dist/assets/nsis-BHchP6IS.js +1 -0
  95. package/dist/assets/ntriples-D1v3iWDa.js +1 -0
  96. package/dist/assets/octave-D_WvWxqk.js +1 -0
  97. package/dist/assets/oz-CmdX4m3g.js +1 -0
  98. package/dist/assets/pascal-hNOkBp6J.js +1 -0
  99. package/dist/assets/perl-NQdG1b_r.js +1 -0
  100. package/dist/assets/pig-CXzedlZV.js +1 -0
  101. package/dist/assets/powershell-RXDVpFWf.js +1 -0
  102. package/dist/assets/properties-BTvtucqR.js +1 -0
  103. package/dist/assets/protobuf-zHRYyuba.js +1 -0
  104. package/dist/assets/pug-C39WZDG2.js +1 -0
  105. package/dist/assets/puppet-CMNLsBcD.js +1 -0
  106. package/dist/assets/python-_LoDBjEZ.js +1 -0
  107. package/dist/assets/q-SLmsw_60.js +1 -0
  108. package/dist/assets/r-CocOMjw8.js +1 -0
  109. package/dist/assets/rpm-WgkTpiCm.js +1 -0
  110. package/dist/assets/ruby-DquNeiGE.js +1 -0
  111. package/dist/assets/sas-sJxciv6G.js +1 -0
  112. package/dist/assets/scheme-DEjJDX5Z.js +1 -0
  113. package/dist/assets/shell-DhAwSAum.js +1 -0
  114. package/dist/assets/sieve-CcW8-k2R.js +1 -0
  115. package/dist/assets/simple-mode-BwNcRC8_.js +1 -0
  116. package/dist/assets/smalltalk-nXkQ5zwM.js +1 -0
  117. package/dist/assets/solr-DO54nYOg.js +1 -0
  118. package/dist/assets/sora-latin-400-normal-CRt88UEn.woff2 +0 -0
  119. package/dist/assets/sora-latin-400-normal-OW7qkl5a.woff +0 -0
  120. package/dist/assets/sora-latin-600-normal-1_7fyUAY.woff +0 -0
  121. package/dist/assets/sora-latin-600-normal-Cdg4DaK0.woff2 +0 -0
  122. package/dist/assets/sora-latin-700-normal-9waGdLWo.woff2 +0 -0
  123. package/dist/assets/sora-latin-700-normal-BKPfQAnC.woff +0 -0
  124. package/dist/assets/sora-latin-ext-400-normal-BmhJC382.woff +0 -0
  125. package/dist/assets/sora-latin-ext-400-normal-Twk1CgKs.woff2 +0 -0
  126. package/dist/assets/sora-latin-ext-600-normal-Cue1zdhl.woff2 +0 -0
  127. package/dist/assets/sora-latin-ext-600-normal-DLOJK0Ta.woff +0 -0
  128. package/dist/assets/sora-latin-ext-700-normal-DM0oy5s8.woff2 +0 -0
  129. package/dist/assets/sora-latin-ext-700-normal-Oc7uZIYt.woff +0 -0
  130. package/dist/assets/sparql-CxAS_pwk.js +1 -0
  131. package/dist/assets/spreadsheet-DWzAMKF2.js +1 -0
  132. package/dist/assets/sql-C_mHN2XB.js +1 -0
  133. package/dist/assets/stex-BmuQ0Xsx.js +1 -0
  134. package/dist/assets/stylus-CQ8h_EBd.js +1 -0
  135. package/dist/assets/swift-D0Eq5raO.js +1 -0
  136. package/dist/assets/tcl-D7utka2n.js +1 -0
  137. package/dist/assets/textile-XEeoev-k.js +1 -0
  138. package/dist/assets/tiddlywiki-CecErCuV.js +1 -0
  139. package/dist/assets/tiki-BlL-kki4.js +1 -0
  140. package/dist/assets/toml-mmtg9INI.js +1 -0
  141. package/dist/assets/troff-Crc1ZuaH.js +1 -0
  142. package/dist/assets/ttcn-Cri02b1f.js +1 -0
  143. package/dist/assets/ttcn-cfg--4YiJN4x.js +1 -0
  144. package/dist/assets/turtle-CUuoUr2N.js +1 -0
  145. package/dist/assets/vb-BrHulZxe.js +1 -0
  146. package/dist/assets/vbscript-vyHcteNE.js +1 -0
  147. package/dist/assets/velocity-DN4o8rq-.js +1 -0
  148. package/dist/assets/verilog-B0DGHLZN.js +1 -0
  149. package/dist/assets/vhdl-WeAF-qEm.js +1 -0
  150. package/dist/assets/webidl-C_bKeJT2.js +1 -0
  151. package/dist/assets/xquery-CLyH3kVm.js +1 -0
  152. package/dist/assets/yacas-Dq3LuV9B.js +1 -0
  153. package/dist/assets/z80-Br7weo_y.js +1 -0
  154. package/dist/favicon.svg +54 -0
  155. package/dist/icons.svg +24 -0
  156. package/dist/index.html +59 -0
  157. package/docs/ARCHITECTURE.md +194 -0
  158. package/docs/SETUP.md +242 -0
  159. package/docs/ui-desktop.png +0 -0
  160. package/docs/ui-desktop.svg +190 -0
  161. package/docs/ui-mobile.png +0 -0
  162. package/docs/ui-mobile.svg +113 -0
  163. package/package.json +79 -0
@@ -0,0 +1,214 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-ChuUwcd4.js","assets/dist-DhhFPaYP.js","assets/dist-C_ZftsU-.js","assets/dist-DYBvJnrG.js","assets/dist-mCTXNkQ9.js","assets/dist-ByyB_57-.js","assets/dist-DO7LTg3a.js","assets/dist-DH3Q_V27.js","assets/dist-elfU6IUT.js","assets/dist-D6kXrcQY.js","assets/dist-Cc03jTPl.js","assets/dist-BvjF9csH.js","assets/dist-Cuva2wRW.js","assets/dist--QplBylv.js","assets/dist-CUQQ4au1.js","assets/dist-CyFWfPpu.js","assets/dist-C6S96i9v.js","assets/dist-C5sjJwrm.js","assets/dist-BSpuB3dZ.js","assets/dist-DIQDx3Dq.js","assets/dist-CftiQ_Tf.js","assets/dockerfile-BBRxgo6-.js","assets/simple-mode-BwNcRC8_.js","assets/factor-bi5FmZTz.js","assets/nsis-BHchP6IS.js","assets/pug-C39WZDG2.js","assets/javascript-B9Zm1tmO.js","assets/dist-BVTS1puf.js","assets/dist-BOz4jprC.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,A as t,At as n,Ct as r,Dt as i,E as a,Et as o,Ft as s,G as c,J as l,K as u,L as d,Mt as f,Nt as p,O as m,Ot as h,P as g,Pt as _,Q as v,S as y,St as b,T as x,Tt as S,W as C,X as w,Y as T,Z as E,_t as D,a as O,at as ee,bt as te,c as ne,ct as re,dt as k,et as A,f as ie,ft as ae,g as oe,gt as se,ht as ce,it as j,j as M,jt as le,kt as ue,l as de,lt as fe,mt as pe,n as me,nt as he,o as ge,ot as _e,pt as N,q as ve,rt as ye,st as be,t as xe,tt as Se,ut as Ce,v as we,vt as P,w as Te,wt as Ee,x as De,xt as Oe,yt as ke}from"./dist-DhhFPaYP.js";var Ae=Object.create,je=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Ne=Object.getOwnPropertyNames,Pe=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty,F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ie=(e,t)=>{let n={};for(var r in e)je(n,r,{get:e[r],enumerable:!0});return t||je(n,Symbol.toStringTag,{value:`Module`}),n},Le=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Ne(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Fe.call(e,s)&&s!==n&&je(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Me(t,s))||r.enumerable});return e},Re=(e,t,n)=>(n=e==null?{}:Ae(Pe(e)),Le(t||!e||!e.__esModule?je(n,`default`,{value:e,enumerable:!0}):n,e));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ze=F((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Be=F(((e,t)=>{t.exports=ze()})),Ve=F((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function re(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function k(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,k(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ne(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),k(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ne(a,u),c+=k(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ne(a,u++),c+=k(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return k(re(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function A(e,t,n){if(e==null)return e;var r=[],i=0;return k(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ie(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ae=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},oe={map:A,forEach:function(e,t,n){A(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return A(e,function(){t++}),t},toArray:function(e){return A(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=oe,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ie}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,ae)}catch(e){ae(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),He=F(((e,t)=>{t.exports=Ve()})),Ue=F((e=>{var t=He();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),We=F(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ue()})),Ge=F((e=>{var t=Be(),n=He(),r=We();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function ne(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?ne(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}var re=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function j(e,t){oe++,ae[oe]=e.current,e.current=t}var M=se(null),le=se(null),ue=se(null),de=se(null);function fe(e,t){switch(j(ue,t),j(le,e),j(M,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qd(t),e=Jd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(M),j(M,e)}function pe(){ce(M),ce(le),ce(ue)}function me(e){e.memoizedState!==null&&j(de,e);var t=M.current,n=Jd(t,e.type);t!==n&&(j(le,e),j(M,n))}function he(e){le.current===e&&(ce(M),ce(le)),de.current===e&&(ce(de),np._currentValue=ie)}var ge,_e;function N(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+ge+e+_e}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
+ `),l=s.split(`
6
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ve=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?N(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return N(e.type);case 16:return N(`Lazy`);case 13:return e.child!==t&&t!==null?N(`Suspense Fallback`):N(`Suspense`);case 19:return N(`SuspenseList`);case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return N(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,P=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,F=null;function Ie(e){if(typeof Ne==`function`&&Pe(e),F&&typeof F.setStrictMode==`function`)try{F.setStrictMode(Fe,e)}catch{}}var Le=Math.clz32?Math.clz32:Ve,Re=Math.log,ze=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var Ue=256,Ge=262144,Ke=4194304;function qe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Je(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=qe(n))):i=qe(o):i=qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=qe(n))):i=qe(o)):i=qe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Xe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ze(){var e=Ke;return Ke<<=1,!(Ke&62914560)&&(Ke=4194304),e}function Qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $e(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function et(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Le(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Le(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Le(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function rt(e,t){var n=t&-t;return n=n&42?1:it(n),(n&(e.suspendedLanes|t))===0?n:0}function it(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function at(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ot(){var e=A.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function st(e,t){var n=A.p;try{return A.p=e,t()}finally{A.p=n}}var ct=Math.random().toString(36).slice(2),lt=`__reactFiber$`+ct,ut=`__reactProps$`+ct,dt=`__reactContainer$`+ct,ft=`__reactEvents$`+ct,pt=`__reactListeners$`+ct,mt=`__reactHandles$`+ct,ht=`__reactResources$`+ct,gt=`__reactMarker$`+ct;function _t(e){delete e[lt],delete e[ut],delete e[ft],delete e[pt],delete e[mt]}function vt(e){var t=e[lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[dt]||n[lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_f(e);e!==null;){if(n=e[lt])return n;e=_f(e)}return t}e=n,n=e.parentNode}return null}function yt(e){if(e=e[lt]||e[dt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function bt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function xt(e){var t=e[ht];return t||=e[ht]={hoistableStyles:new Map,hoistableScripts:new Map},t}function St(e){e[gt]=!0}var Ct=new Set,wt={};function Tt(e,t){Et(e,t),Et(e+`Capture`,t)}function Et(e,t){for(wt[e]=t,e=0;e<t.length;e++)Ct.add(t[e])}var Dt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Ot={},kt={};function At(e){return Se.call(kt,e)?!0:Se.call(Ot,e)?!1:Dt.test(e)?kt[e]=!0:(Ot[e]=!0,!1)}function jt(e,t,n){if(At(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Mt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Nt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Pt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ft(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function It(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lt(e){if(!e._valueTracker){var t=Ft(e)?`checked`:`value`;e._valueTracker=It(e,t,``+e[t])}}function Rt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ft(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function zt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Bt=/[\n"\\]/g;function Vt(e){return e.replace(Bt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ht(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Pt(t)):e.value!==``+Pt(t)&&(e.value=``+Pt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Wt(e,o,Pt(n)):Wt(e,o,Pt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Pt(s):e.removeAttribute(`name`)}function Ut(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Lt(e);return}n=n==null?``:``+Pt(n),t=t==null?n:``+Pt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Lt(e)}function Wt(e,t,n){t===`number`&&zt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Gt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Pt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Kt(e,t,n){if(t!=null&&(t=``+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Pt(n)}function qt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(re(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Pt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Lt(e)}function I(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var L=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Jt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||L.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Yt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Jt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Jt(e,o,t[o])}function Xt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Zt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function $t(e){return Qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function en(){}var tn=null;function nn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rn=null,an=null;function on(e){var t=yt(e);if(t&&(e=t.stateNode)){var n=e[ut]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ht(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Vt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ut]||null;if(!a)throw Error(i(90));Ht(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Rt(r)}break a;case`textarea`:Kt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Gt(e,!!n.multiple,t,!1)}}}var R=!1;function sn(e,t,n){if(R)return e(t,n);R=!0;try{return e(t)}finally{if(R=!1,(rn!==null||an!==null)&&(wu(),rn&&(t=rn,e=an,an=rn=null,on(t),e)))for(t=0;t<e.length;t++)on(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ut]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,`passive`,{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return mn=i.slice(e,1<r?1-r:void 0)}function gn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function _n(){return!0}function vn(){return!1}function yn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?_n:vn,this.isPropagationStopped=vn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=f({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=f({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(f({},Dn,{dataTransfer:0})),An=yn(f({},Sn,{relatedTarget:0})),jn=yn(f({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(f({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(f({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=yn(f({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=yn(f({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=yn(f({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),Hn=yn(f({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Un=yn(f({},Dn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Wn=yn(f({},bn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=ln&&`CompositionEvent`in window,qn=null;ln&&`documentMode`in document&&(qn=document.documentMode);var Jn=ln&&`TextEvent`in window&&!qn,Yn=ln&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){rn?an?an.push(r):an=[r]:rn=r,t=jd(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){wd(e,0)}function lr(e){if(Rt(bt(e)))return e}function ur(e,t){if(e===`change`)return t}var z=!1;if(ln){var dr;if(ln){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;z=dr&&(!document.documentMode||9<document.documentMode)}function mr(){or&&(or.detachEvent(`onpropertychange`,hr),sr=or=null)}function hr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,nn(e)),sn(cr,t)}}function gr(e,t,n){e===`focusin`?(mr(),or=t,sr=n,or.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function vr(e,t){if(e===`click`)return lr(t)}function yr(e,t){if(e===`input`||e===`change`)return lr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;function Sr(e,t){if(xr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Se.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=zt(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=ln&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==zt(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=jd(Ar,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=kr)))}function Pr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:Pr(`Animation`,`AnimationEnd`),animationiteration:Pr(`Animation`,`AnimationIteration`),animationstart:Pr(`Animation`,`AnimationStart`),transitionrun:Pr(`Transition`,`TransitionRun`),transitionstart:Pr(`Transition`,`TransitionStart`),transitioncancel:Pr(`Transition`,`TransitionCancel`),transitionend:Pr(`Transition`,`TransitionEnd`)},Ir={},Lr={};ln&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),Tt(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ri(n,i,a)}}function ei(e,t,n,r){Xr[Zr++]=e,Xr[Zr++]=t,Xr[Zr++]=n,Xr[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ti(e,t,n,r){return ei(e,t,n,r),ii(e)}function ni(e,t){return ei(e,null,null,t),ii(e)}function ri(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Le(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ii(e){if(50<hu)throw hu=0,gu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ai={};function oi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function si(e,t,n,r){return new oi(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function li(e,t){var n=e.alternate;return n===null?(n=si(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ui(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function di(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ci(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,M.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=si(31,n,t,a),e.elementType=E,e.lanes=o,e;case g:return fi(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=si(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=si(13,n,t,a),e.elementType=S,e.lanes=o,e;case C:return e=si(19,n,t,a),e.elementType=C,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case w:s=14;break a;case T:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=si(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function fi(e,t,n,r){return e=si(7,e,r,t),e.lanes=n,e}function pi(e,t,n){return e=si(6,e,null,t),e.lanes=n,e}function mi(e){var t=si(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=si(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:xe(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:xe(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-Le(r)-1;r&=~(1<<i),n+=1;var a=32-Le(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-Le(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,B=!1,Pi=null,Fi=!1,Ii=Error(i(519));function Li(e){throw Ui(_i(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ii}function Ri(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[lt]=e,t[ut]=r,n){case`dialog`:q(`cancel`,t),q(`close`,t);break;case`iframe`:case`object`:case`embed`:q(`load`,t);break;case`video`:case`audio`:for(n=0;n<Sd.length;n++)q(Sd[n],t);break;case`source`:q(`error`,t);break;case`img`:case`image`:case`link`:q(`error`,t),q(`load`,t);break;case`details`:q(`toggle`,t);break;case`input`:q(`invalid`,t),Ut(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:q(`invalid`,t);break;case`textarea`:q(`invalid`,t),qt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Ld(t.textContent,n)?(r.popover!=null&&(q(`beforetoggle`,t),q(`toggle`,t)),r.onScroll!=null&&q(`scroll`,t),r.onScrollEnd!=null&&q(`scrollend`,t),r.onClick!=null&&(t.onclick=en),t=!0):t=!1,t||Li(e,!0)}function zi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:Mi=Mi.return}}function Bi(e){if(e!==Mi)return!1;if(!B)return zi(e),B=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Yd(e.type,e.memoizedProps)),n=!n),n&&Ni&&Li(e),zi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=gf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=gf(e)}else t===27?(t=Ni,rf(e.type)?(e=hf,hf=null,Ni=e):Ni=t):Ni=Mi?mf(e.stateNode.nextSibling):null;return!0}function Vi(){Ni=Mi=null,B=!1}function Hi(){var e=Pi;return e!==null&&(nu===null?nu=e:nu.push.apply(nu,e),Pi=null),e}function Ui(e){Pi===null?Pi=[e]:Pi.push(e)}var Wi=se(null),Gi=null,Ki=null;function qi(e,t,n){j(Wi,t._currentValue),t._currentValue=n}function Ji(e){e._currentValue=Wi.current,ce(Wi)}function Yi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Yi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Yi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Zi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;xr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===de.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&Xi(t,e,n,r),t.flags|=262144}function Qi(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $i(e){Gi=e,Ki=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ea(e){return na(Gi,e)}function ta(e,t){return Gi===null&&$i(e),na(e,t)}function na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ki===null){if(e===null)throw Error(i(308));Ki=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ki=Ki.next=t;return n}var ra=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ia=t.unstable_scheduleCallback,aa=t.unstable_NormalPriority,oa={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sa(){return{controller:new ra,data:new Map,refCount:0}}function ca(e){e.refCount--,e.refCount===0&&ia(aa,function(){e.controller.abort()})}var la=null,ua=0,da=0,fa=null;function pa(e,t){if(la===null){var n=la=[];ua=0,da=gd(),fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ua++,t.then(ma,ma),t}function ma(){if(--ua===0&&la!==null){fa!==null&&(fa.status=`fulfilled`);var e=la;la=null,da=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ga=k.S;k.S=function(e,t){au=Ee(),typeof t==`object`&&t&&typeof t.then==`function`&&pa(e,t),ga!==null&&ga(e,t)};var _a=se(null);function va(){var e=_a.current;return e===null?Hl.pooledCache:e}function ya(e,t){t===null?j(_a,_a.current):j(_a,t.pool)}function ba(){var e=va();return e===null?null:{parent:oa._currentValue,pool:e}}var xa=Error(i(460)),Sa=Error(i(474)),Ca=Error(i(542)),wa={then:function(){}};function Ta(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ea(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(en,en),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e;default:if(typeof t.status==`string`)t.then(en,en);else{if(e=Hl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e}throw Oa=t,xa}}function Da(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Oa=e,xa):e}}var Oa=null;function ka(){if(Oa===null)throw Error(i(459));var e=Oa;return Oa=null,e}function Aa(e){if(e===xa||e===Ca)throw Error(i(483))}var ja=null,Ma=0;function Na(e){var t=Ma;return Ma+=1,ja===null&&(ja=[]),Ea(ja,e,t)}function Pa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Fa(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ia(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=li(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===T&&Da(i)===t.type)?(t=a(t,n.props),Pa(t,n),t.return=e,t):(t=di(n.type,n.key,n.props,null,e.mode,r),Pa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=hi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=fi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=pi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=di(t.type,t.key,t.props,null,e.mode,n),Pa(n,t),n.return=e,n;case h:return t=hi(t,e.mode,n),t.return=e,t;case T:return t=Da(t),f(e,t,n)}if(re(t)||ee(t))return t=fi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Na(t),n);if(t.$$typeof===b)return f(e,ta(e,t),n);Fa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case T:return n=Da(n),p(e,t,n,r)}if(re(n)||ee(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Na(n),r);if(n.$$typeof===b)return p(e,t,ta(e,n),r);Fa(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case T:return r=Da(r),_(e,t,n,r,i)}if(re(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Na(r),i);if(r.$$typeof===b)return _(e,t,n,ta(t,r),i);Fa(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),B&&Di(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return B&&Di(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),B&&Di(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),B&&Di(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return B&&Di(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),B&&Di(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&Da(l)===r.type){n(e,r.sibling),c=a(r,o.props),Pa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=fi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=di(o.type,o.key,o.props,null,e.mode,c),Pa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=hi(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=Da(o),x(e,r,o,c)}if(re(o))return v(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Na(o),c);if(o.$$typeof===b)return x(e,r,ta(e,o),c);Fa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=pi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ma=0;var i=x(e,t,n,r);return ja=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=si(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var La=Ia(!0),Ra=Ia(!1),za=!1;function Ba(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Va(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ha(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ua(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Vl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ii(e),ri(e,null,n),t}return ei(e,r,t,n),ii(e)}function Wa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}function Ga(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ka=!1;function qa(){if(Ka){var e=fa;if(e!==null)throw e}}function Ja(e,t,n,r){Ka=!1;var i=e.updateQueue;za=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(G&p)===p:(r&p)===p){p!==0&&p===da&&(Ka=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:za=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Xl|=o,e.lanes=o,e.memoizedState=d}}function Ya(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Xa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ya(n[e],t)}var Za=se(null),Qa=se(0);function $a(e,t){e=Jl,j(Qa,e),j(Za,t),Jl=e|t.baseLanes}function eo(){j(Qa,Jl),j(Za,Za.current)}function to(){Jl=Qa.current,ce(Za),ce(Qa)}var no=se(null),ro=null;function io(e){var t=e.alternate;j(lo,lo.current&1),j(no,e),ro===null&&(t===null||Za.current!==null||t.memoizedState!==null)&&(ro=e)}function ao(e){j(lo,lo.current),j(no,e),ro===null&&(ro=e)}function oo(e){e.tag===22?(j(lo,lo.current),j(no,e),ro===null&&(ro=e)):so(e)}function so(){j(lo,lo.current),j(no,no.current)}function co(e){ce(no),ro===e&&(ro=null),ce(lo)}var lo=se(0);function uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||df(n)||ff(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var fo=0,V=null,po=null,mo=null,ho=!1,go=!1,_o=!1,vo=0,yo=0,bo=null,xo=0;function H(){throw Error(i(321))}function So(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function Co(e,t,n,r,i,a){return fo=a,V=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Bs:Vs,_o=!1,a=n(r,i),_o=!1,go&&(a=To(t,n,r,i)),wo(e),a}function wo(e){k.H=zs;var t=po!==null&&po.next!==null;if(fo=0,mo=po=V=null,ho=!1,yo=0,bo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&Qi(e)&&(ic=!0))}function To(e,t,n,r){V=e;var a=0;do{if(go&&(bo=null),yo=0,go=!1,25<=a)throw Error(i(301));if(a+=1,mo=po=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=Hs,o=t(n,r)}while(go);return o}function Eo(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?No(t):t,e=e.useState()[0],(po===null?null:po.memoizedState)!==e&&(V.flags|=1024),t}function Do(){var e=vo!==0;return vo=0,e}function Oo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ko(e){if(ho){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ho=!1}fo=0,mo=po=V=null,go=!1,yo=vo=0,bo=null}function Ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mo===null?V.memoizedState=mo=e:mo=mo.next=e,mo}function jo(){if(po===null){var e=V.alternate;e=e===null?null:e.memoizedState}else e=po.next;var t=mo===null?V.memoizedState:mo.next;if(t!==null)mo=t,po=e;else{if(e===null)throw V.alternate===null?Error(i(467)):Error(i(310));po=e,e={memoizedState:po.memoizedState,baseState:po.baseState,baseQueue:po.baseQueue,queue:po.queue,next:null},mo===null?V.memoizedState=mo=e:mo=mo.next=e}return mo}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=yo;return yo+=1,bo===null&&(bo=[]),e=Ea(bo,e,t),t=V,(mo===null?t.memoizedState:mo.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Bs:Vs),e}function Po(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return No(e);if(e.$$typeof===b)return ea(e)}throw Error(i(438,String(e)))}function Fo(e){var t=null,n=V.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=V.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Mo(),V.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=D;return t.index++,n}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){return Ro(jo(),po,e)}function Ro(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(fo&f)===f:(G&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===da&&(d=!0);else if((fo&p)===p){u=u.next,p===da&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,V.lanes|=p,Xl|=p;f=u.action,_o&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,V.lanes|=f,Xl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!xr(o,e.memoizedState)&&(ic=!0,d&&(n=fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function zo(e){var t=jo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);xr(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Bo(e,t,n){var r=V,a=jo(),o=B;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!xr((po||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,ds(Uo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||mo!==null&&mo.memoizedState.tag&1){if(r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,a,n,t),null),Hl===null)throw Error(i(349));o||fo&127||Vo(r,t,n)}return n}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=V.updateQueue,t===null?(t=Mo(),V.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ho(e,t,n,r){t.value=n,t.getSnapshot=r,Wo(t)&&Go(e)}function Uo(e,t,n){return n(function(){Wo(t)&&Go(e)})}function Wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function Go(e){var t=ni(e,2);t!==null&&yu(t,e,2)}function Ko(e){var t=Ao();if(typeof e==`function`){var n=e;if(e=n(),_o){Ie(!0);try{n()}finally{Ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t}function qo(e,t,n,r){return e.baseState=n,Ro(e,po,typeof r==`function`?r:Io)}function Jo(e,t,n,r,a){if(Is(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Yo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Yo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Xo(e,t,s)}catch(n){Qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Xo(e,t,a)}catch(n){Qo(e,t,n)}}function Xo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Zo(e,t,n)},function(n){return Qo(e,t,n)}):Zo(e,t,n)}function Zo(e,t,n){t.status=`fulfilled`,t.value=n,$o(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Yo(e,n)))}function Qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,$o(t),t=t.next;while(t!==r)}e.action=null}function $o(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function es(e,t){return t}function ts(e,t){if(B){var n=Hl.formState;if(n!==null){a:{var r=V;if(B){if(Ni){b:{for(var i=Ni,a=Fi;i.nodeType!==8;){if(!a){i=null;break b}if(i=mf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ni=mf(i.nextSibling),r=i.data===`F!`;break a}}Li(r)}r=!1}r&&(t=n[0])}}return n=Ao(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=r,n=Ns.bind(null,V,r),r.dispatch=n,r=Ko(!1),a=Fs.bind(null,V,!1,r.queue),r=Ao(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Jo.bind(null,V,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ns(e){return rs(jo(),po,e)}function rs(e,t,n){if(t=Ro(e,t,es)[0],e=Lo(Io)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=No(t)}catch(e){throw e===xa?Ca:e}else r=t;t=jo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(V.flags|=2048,os(9,{destroy:void 0},is.bind(null,i,n),null)),[r,a,e]}function is(e,t){e.action=t}function as(e){var t=jo(),n=po;if(n!==null)return rs(t,n,e);jo(),t=t.memoizedState,n=jo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function os(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=V.updateQueue,t===null&&(t=Mo(),V.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ss(){return jo().memoizedState}function cs(e,t,n,r){var i=Ao();V.flags|=e,i.memoizedState=os(1|t,{destroy:void 0},n,r===void 0?null:r)}function ls(e,t,n,r){var i=jo();r=r===void 0?null:r;var a=i.memoizedState.inst;po!==null&&r!==null&&So(r,po.memoizedState.deps)?i.memoizedState=os(t,a,n,r):(V.flags|=e,i.memoizedState=os(1|t,a,n,r))}function us(e,t){cs(8390656,8,e,t)}function ds(e,t){ls(2048,8,e,t)}function fs(e){V.flags|=4;var t=V.updateQueue;if(t===null)t=Mo(),V.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=jo().memoizedState;return fs({ref:t,nextImpl:e}),function(){if(Vl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return ls(4,2,e,t)}function hs(e,t){return ls(4,4,e,t)}function gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _s(e,t,n){n=n==null?null:n.concat([e]),ls(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&So(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&So(t,r[1]))return r[0];if(r=e(),_o){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||fo&1073741824&&!(G&261930)?e.memoizedState=t:(e.memoizedState=n,e=vu(),V.lanes|=e,Xl|=e,n)}function Ss(e,t,n,r){return xr(n,t)?n:Za.current===null?!(fo&42)||fo&1073741824&&!(G&261930)?(ic=!0,e.memoizedState=n):(e=vu(),V.lanes|=e,Xl|=e,t):(e=xs(e,n,r),xr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=A.p;A.p=a!==0&&8>a?a:8;var o=k.T,s={};k.T=s,Fs(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ha(c,r),_u(e)):Ps(e,t,r,_u(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,ie,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},_u())}function Os(){return ea(np)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=Ha(n);var r=Ua(t,e,n);r!==null&&(yu(r,t,n),Wa(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=ti(e,t,n,r),n!==null&&(yu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,_u())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return ei(e,t,i,0),Hl===null&&$r(),!1}catch{}if(n=ti(e,t,i,r),n!==null)return yu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:gd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=ti(e,n,r,2),t!==null&&yu(t,e,2)}function Is(e){var t=e.alternate;return e===V||t!==null&&t===V}function Ls(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var zs={readContext:ea,use:Po,useCallback:H,useContext:H,useEffect:H,useImperativeHandle:H,useLayoutEffect:H,useInsertionEffect:H,useMemo:H,useReducer:H,useRef:H,useState:H,useDebugValue:H,useDeferredValue:H,useTransition:H,useSyncExternalStore:H,useId:H,useHostTransitionStatus:H,useFormState:H,useActionState:H,useOptimistic:H,useMemoCache:H,useCacheRefresh:H};zs.useEffectEvent=H;var Bs={readContext:ea,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:ea,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(_o){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(_o){Ie(!0);try{n(t)}finally{Ie(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,V,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,V,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=V,a=Ao();if(B){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Hl===null)throw Error(i(349));G&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Hl.identifierPrefix;if(B){var n=Ei,r=Ti;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:ts,useActionState:ts,useOptimistic:function(e){var t=Ao();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,V,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return Ao().memoizedState=js.bind(null,V)},useEffectEvent:function(e){var t=Ao(),n={impl:e};return t.memoizedState=n,function(){if(Vl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:ea,use:Po,useCallback:ys,useContext:ea,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Lo,useRef:ss,useState:function(){return Lo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(jo(),po.memoizedState,e,t)},useTransition:function(){var e=Lo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){return qo(jo(),po,e,t)},useMemoCache:Fo,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:ea,use:Po,useCallback:ys,useContext:ea,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:zo,useRef:ss,useState:function(){return zo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){var n=jo();return po===null?xs(n,e,t):Ss(n,po.memoizedState,e,t)},useTransition:function(){var e=zo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:as,useActionState:as,useOptimistic:function(e,t){var n=jo();return po===null?(n.baseState=e,[e,n.queue.dispatch]):qo(n,po,e,t)},useMemoCache:Fo,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=_u(),i=Ha(r);i.payload=t,n!=null&&(i.callback=n),t=Ua(e,i,r),t!==null&&(yu(t,e,r),Wa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=_u(),i=Ha(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ua(e,i,r),t!==null&&(yu(t,e,r),Wa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=_u(),r=Ha(n);r.tag=2,t!=null&&(r.callback=t),t=Ua(e,r,n),t!==null&&(yu(t,e,n),Wa(t,e,n))}};function Gs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Sr(n,r)||!Sr(i,a):!0}function Ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){Yr(e)}function Ys(e){console.error(e)}function Xs(e){Yr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=Ha(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Ha(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(K===null?K=new Set([this]):K.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Zi(t,n,a,!0),n=no.current,n!==null){switch(n.tag){case 31:case 13:return ro===null?ju():n.alternate===null&&Yl===0&&(Yl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Xu(e,r,a)),!1;case 22:return n.flags|=65536,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Xu(e,r,a)),!1}throw Error(i(435,n.tag))}return Xu(e,r,a),ju(),!1}if(B)return t=no.current,t===null?(r!==Ii&&(t=Error(i(423),{cause:r}),Ui(_i(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=_i(r,n),a=$s(e.stateNode,r,a),Ga(e,a),Yl!==4&&(Yl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ii&&(e=Error(i(422),{cause:r}),Ui(_i(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=_i(o,n),tu===null?tu=[o]:tu.push(o),Yl!==4&&(Yl=2),t===null)return!0;r=_i(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Ga(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(K===null||!K.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Ga(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?Ra(t,null,n,r):La(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return $i(t),r=Co(e,t,n,o,a,i),s=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(B&&s&&ki(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ci(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=di(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Sr:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=li(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Sr(a,r)&&e.ref===t.ref)if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ya(t,a===null?null:a.cachePool),a===null?eo():$a(t,a),oo(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ya(t,null),eo(),so(t)):(ya(t,a.cachePool),$a(t,a),so(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=va();return a=a===null?null:{parent:oa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ya(t,null),eo(),oo(t),e!==null&&Zi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return La(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,co(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(B){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(ao(t),(e=Ni)?(e=uf(e,Fi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Li(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ao(t),a)if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ic||Zi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Hl,r!==null&&(s=rt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ni(e,s),yu(r,e,s),rc;ju(),t=pc(e,t,n)}else e=o.treeContext,Ni=mf(s.nextSibling),Mi=t,B=!0,Pi=null,Fi=!1,e!==null&&ji(t,e),t=fc(t,r),t.flags|=4096;return t}return e=li(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return $i(t),n=Co(e,t,n,r,void 0,i),r=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(B&&r&&ki(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return $i(t),t.updateQueue=null,n=To(t,r,n,i),wo(e),r=Do(),e!==null&&!ic?(Oo(e,t,a),Ac(e,t,a)):(B&&r&&ki(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if($i(t),t.stateNode===null){var a=ai,o=n.contextType;typeof o==`object`&&o&&(a=ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ba(t),o=n.contextType,a.context=typeof o==`object`&&o?ea(o):ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),Ja(t,r,a,i),qa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ai,typeof u==`object`&&u&&(o=ea(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),za=!1;var f=t.memoizedState;a.state=f,Ja(t,r,a,i),qa(),l=t.memoizedState,s||f!==l||za?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=za||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Va(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ai,typeof l==`object`&&l&&(c=ea(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),za=!1,f=t.memoizedState,a.state=f,Ja(t,r,a,i),qa();var p=t.memoizedState;o!==d||f!==p||za||e!==null&&e.dependencies!==null&&Qi(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=za||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Qi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=La(t,e.child,null,i),t.child=La(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return Vi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:ba()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=$l),e}function Cc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(lo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(B){if(a?io(t):so(t),(e=Ni)?(e=uf(e,Fi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Li(t);return ff(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(so(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=fi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(io(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(io(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(so(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=fi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,La(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(so(t),t.child=e.child,t.flags|=128,t=null);else if(io(t),ff(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ui({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Zi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Hl,s!==null&&(r=rt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ni(e,r),yu(s,e,r),rc;df(c)||ju(),t=Ec(e,t,n)}else df(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ni=mf(c.nextSibling),Mi=t,B=!0,Pi=null,Fi=!1,e!==null&&ji(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(so(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=li(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=fi(c,a,n,null),c.flags|=2):c=li(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=ba():(l=oa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(io(t),n=e.child,e=n.sibling,n=li(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=si(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return La(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yi(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=lo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,j(lo,o),ac(e,t,r,n),r=B?xi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&uo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Zi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Qi(e))):!0}function Mc(e,t,n){switch(t.tag){case 3:fe(t,t.stateNode.containerInfo),qi(t,oa,e.memoizedState.cache),Vi();break;case 27:case 5:me(t);break;case 4:fe(t,t.stateNode.containerInfo);break;case 10:qi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ao(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(io(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(io(t),t.flags|=128,null);io(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Zi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),j(lo,lo.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:qi(t,oa,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}else ic=!1,B&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Da(t.elementType),t.type=e,typeof e==`function`)ci(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=oc(null,t,e,r,n);break a}else if(a===w){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=ne(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(fe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Va(e,t),Ja(t,r,null,n);var s=t.memoizedState;if(r=s.cache,qi(t,oa,r),r!==o.cache&&Xi(t,[oa],n,!0),qa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}else if(r!==a){a=_i(Error(i(424)),t),Ui(a),t=yc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ni=mf(e.firstChild),Mi=t,B=!0,Pi=null,Fi=!0,n=Ra(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Vi(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Ff(t.type,null,t.pendingProps,null))?t.memoizedState=n:B||(n=t.type,e=t.pendingProps,r=Kd(ue.current).createElement(n),r[lt]=t,r[ut]=e,Bd(r,n,e),St(r),t.stateNode=r):t.memoizedState=Ff(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return me(t),e===null&&B&&(r=t.stateNode=vf(t.type,t.pendingProps,ue.current),Mi=t,Fi=!0,a=Ni,rf(t.type)?(hf=a,Ni=mf(r.firstChild)):Ni=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&B&&((a=r=Ni)&&(r=cf(r,t.type,t.pendingProps,Fi),r===null?a=!1:(t.stateNode=r,Mi=t,Ni=mf(r.firstChild),Fi=!1,a=!0)),a||Li(t)),me(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Yd(a,o)?r=null:s!==null&&Yd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Co(e,t,Eo,null,null,n),np._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&B&&((e=n=Ni)&&(n=lf(n,t.pendingProps,Fi),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Li(t)),null;case 13:return Cc(e,t,n);case 4:return fe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=La(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,qi(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,$i(t),a=ea(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return $i(t),r=ea(oa),e===null?(a=va(),a===null&&(a=Hl,o=sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ba(t),qi(t,oa,a)):((e.lanes&n)!==0&&(Va(e,t),Ja(t,null,null,n),qa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,qi(t,oa,r),r!==a.cache&&Xi(t,[oa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),qi(t,oa,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Pc(e){e.flags|=4}function Fc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Ou())e.flags|=8192;else throw Oa=wa,Sa}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Ou())e.flags|=8192;else throw Oa=wa,Sa}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ze(),e.lanes|=t,eu|=t)}function Rc(e,t){if(!B)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Bc(e,t,n){var r=t.pendingProps;switch(Ai(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ji(oa),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Bi(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Hi())),zc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,a,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,a,e,r,n)),null;case 27:if(he(t),n=ue.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}e=M.current,Bi(t)?Ri(t,e):(e=vf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(he(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}if(o=M.current,Bi(t))Ri(t,o);else{var s=Kd(ue.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[lt]=t,o[ut]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Bd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ue.current,Bi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Mi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ld(e.nodeValue,n)),e||Li(t,!0)}else e=Kd(e).createTextNode(r),e[lt]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Bi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[lt]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(co(t),t):(co(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[lt]=t}else Vi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Hi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(co(t),t):(co(t),null)}return co(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return pe(),e===null&&Dd(t.stateNode.containerInfo),zc(t),null;case 10:return Ji(t.type),zc(t),null;case 19:if(ce(lo),r=t.memoizedState,r===null)return zc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Rc(r,!1);else{if(Yl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=uo(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ui(n,e),n=n.sibling;return j(lo,lo.current&1|2),B&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>ou&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}else{if(!a)if(e=uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!B)return zc(t),null}else 2*Ee()-r.renderingStartTime>ou&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=lo.current,j(lo,a?n&1|2:n&1),B&&Di(t,r.treeForkCount),e);case 22:case 23:return co(t),to(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ce(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ji(oa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ji(oa),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(co(t),t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(co(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(lo),null;case 4:return pe(),null;case 10:return Ji(t.type),null;case 22:case 23:return co(t),to(),e!==null&&ce(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ji(oa),null;case 25:return null;default:return null}}function Hc(e,t){switch(Ai(t),t.tag){case 3:Ji(oa),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&co(t);break;case 13:co(t);break;case 19:ce(lo);break;case 10:Ji(t.type);break;case 22:case 23:co(t),to(),e!==null&&ce(_a);break;case 24:Ji(oa)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Yu(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Yu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Yu(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Xa(t,n)}catch(t){Yu(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Yu(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Yu(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Yu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Yu(e,t,n)}else n.current=null}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Yu(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Vd(r,e.type,n,t),r[ut]=t}catch(t){Yu(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rf(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&rf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=en));else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Bd(t,r,n),t[lt]=e,t[ut]=n}catch(t){Yu(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,Wd=dp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Gd={focusedElem:e,selectionRange:n},dp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Yu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)sf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:sf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ol=e;break}ol=t.return}}function cl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Sl(e,n),r&4&&Uc(5,n);break;case 1:if(Sl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Yu(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Yu(n,n.return,e)}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(Sl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Xa(e,t)}catch(e){Yu(n,n.return,e)}}break;case 27:t===null&&r&4&&tl(n);case 26:case 5:Sl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:Sl(e,n);break;case 31:Sl(e,n),r&4&&pl(e,n);break;case 13:Sl(e,n),r&4&&ml(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=$u.bind(null,n),pf(e,n))));break;case 22:if(r=n.memoizedState!==null||nl,!r){t=t!==null&&t.memoizedState!==null||rl,i=nl;var a=rl;nl=r,(rl=t)&&!a?wl(e,n,(n.subtreeFlags&8772)!=0):Sl(e,n),nl=i,rl=a}break;case 30:break;default:Sl(e,n)}}function U(e){var t=e.alternate;t!==null&&(e.alternate=null,U(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_t(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ll=null,ul=!1;function dl(e,t,n){for(n=n.child;n!==null;)fl(e,t,n),n=n.sibling}function fl(e,t,n){if(F&&typeof F.onCommitFiberUnmount==`function`)try{F.onCommitFiberUnmount(Fe,n)}catch{}switch(n.tag){case 26:rl||Jc(n,t),dl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rl||Jc(n,t);var r=ll,i=ul;rf(n.type)&&(ll=n.stateNode,ul=!1),dl(e,t,n),yf(n.stateNode),ll=r,ul=i;break;case 5:rl||Jc(n,t);case 6:if(r=ll,i=ul,ll=null,dl(e,t,n),ll=r,ul=i,ll!==null)if(ul)try{(ll.nodeType===9?ll.body:ll.nodeName===`HTML`?ll.ownerDocument.body:ll).removeChild(n.stateNode)}catch(e){Yu(n,t,e)}else try{ll.removeChild(n.stateNode)}catch(e){Yu(n,t,e)}break;case 18:ll!==null&&(ul?(e=ll,af(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):af(ll,n.stateNode));break;case 4:r=ll,i=ul,ll=n.stateNode.containerInfo,ul=!0,dl(e,t,n),ll=r,ul=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),rl||Wc(4,n,t),dl(e,t,n);break;case 1:rl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),dl(e,t,n);break;case 21:dl(e,t,n);break;case 22:rl=(r=rl)||n.memoizedState!==null,dl(e,t,n),rl=r;break;default:dl(e,t,n)}}function pl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Yu(t,t.return,e)}}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Yu(t,t.return,e)}}function hl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new al),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new al),t;default:throw Error(i(435,e.tag))}}function gl(e,t){var n=hl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=ed.bind(null,e,t);t.then(r,r)}})}function _l(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(rf(c.type)){ll=c.stateNode,ul=!1;break a}break;case 5:ll=c.stateNode,ul=!1;break a;case 3:case 4:ll=c.stateNode.containerInfo,ul=!0;break a}c=c.return}if(ll===null)throw Error(i(160));fl(o,s,a),ll=null,ul=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)yl(t,e),t=t.sibling}var vl=null;function yl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_l(t,e),bl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:_l(t,e),bl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&64&&nl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=vl;if(_l(t,e),bl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[gt]||o[lt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Bd(o,r,n),o[lt]=e,St(o),r=o;break a;case`link`:var s=Gf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[lt]=e,St(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode);else e.stateNode=Y(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Y(a,r,e.memoizedProps))}break;case 27:_l(t,e),bl(e),r&512&&(rl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(_l(t,e),bl(e),r&512&&(rl||n===null||Jc(n,n.return)),e.flags&32){a=e.stateNode;try{I(a,``)}catch(t){Yu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Xc(e,a,n===null?a:n.memoizedProps)),r&1024&&(il=!0);break;case 6:if(_l(t,e),bl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Yu(e,e.return,t)}}break;case 3:if(Wf=null,a=vl,vl=Sf(t.containerInfo),_l(t,e),vl=a,bl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Yu(e,e.return,t)}il&&(il=!1,xl(e));break;case 4:r=vl,vl=Sf(e.stateNode.containerInfo),_l(t,e),bl(e),vl=r;break;case 12:_l(t,e),bl(e);break;case 31:_l(t,e),bl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 13:_l(t,e),bl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(iu=Ee()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=nl,d=rl;if(nl=u||a,rl=d||l,_l(t,e),rl=d,nl=u,bl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||nl||rl||Cl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Yu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Yu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?of(m,!0):of(l.stateNode,!1)}catch(e){Yu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,gl(e,n))));break;case 19:_l(t,e),bl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 30:break;case 21:break;default:_l(t,e),bl(e)}}function bl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;el(e,Qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(I(o,``),n.flags&=-33),el(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;$c(e,Qc(e),s);break;default:throw Error(i(161))}}catch(t){Yu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Sl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cl(e,t.alternate,t),t=t.sibling}function Cl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),Cl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),Cl(t);break;case 27:yf(t.stateNode);case 26:case 5:Jc(t,t.return),Cl(t);break;case 22:t.memoizedState===null&&Cl(t);break;case 30:Cl(t);break;default:Cl(t)}e=e.sibling}}function wl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:wl(i,a,n),Uc(4,a);break;case 1:if(wl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Yu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ya(c[i],s)}catch(e){Yu(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:tl(a);case 26:case 5:wl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:wl(i,a,n);break;case 31:wl(i,a,n),n&&o&4&&pl(i,a);break;case 13:wl(i,a,n),n&&o&4&&ml(i,a);break;case 22:a.memoizedState===null&&wl(i,a,n),qc(a,a.return);break;case 30:break;default:wl(i,a,n)}t=t.sibling}}function Tl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ca(n))}function El(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e))}function Dl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ol(e,t,n,r),t=t.sibling}function Ol(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Dl(e,t,n,r),i&2048&&Uc(9,t);break;case 1:Dl(e,t,n,r);break;case 3:Dl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e)));break;case 12:if(i&2048){Dl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Yu(t,t.return,e)}}else Dl(e,t,n,r);break;case 31:Dl(e,t,n,r);break;case 13:Dl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Dl(e,t,n,r):(a._visibility|=2,kl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Dl(e,t,n,r):Al(e,t),i&2048&&Tl(o,t);break;case 24:Dl(e,t,n,r),i&2048&&El(t.alternate,t);break;default:Dl(e,t,n,r)}}function kl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:kl(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,kl(a,o,s,c,i)):u._visibility&2?kl(a,o,s,c,i):Al(a,o),i&&l&2048&&Tl(o.alternate,o);break;case 24:kl(a,o,s,c,i),i&&l&2048&&El(o.alternate,o);break;default:kl(a,o,s,c,i)}t=t.sibling}}function Al(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Al(n,r),i&2048&&Tl(r.alternate,r);break;case 24:Al(n,r),i&2048&&El(r.alternate,r);break;default:Al(n,r)}t=t.sibling}}var jl=8192;function Ml(e,t,n){if(e.subtreeFlags&jl)for(e=e.child;e!==null;)Nl(e,t,n),e=e.sibling}function Nl(e,t,n){switch(e.tag){case 26:Ml(e,t,n),e.flags&jl&&e.memoizedState!==null&&Yf(n,vl,e.memoizedState,e.memoizedProps);break;case 5:Ml(e,t,n);break;case 3:case 4:var r=vl;vl=Sf(e.stateNode.containerInfo),Ml(e,t,n),vl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=jl,jl=16777216,Ml(e,t,n),jl=r):Ml(e,t,n));break;default:Ml(e,t,n)}}function Pl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,Rl(r,e)}Pl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Il(e),e=e.sibling}function Il(e){switch(e.tag){case 0:case 11:case 15:Fl(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Fl(e);break;case 12:Fl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):Fl(e);break;default:Fl(e)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,Rl(r,e)}Pl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Ll(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Rl(e,t){for(;ol!==null;){var n=ol;switch(n.tag){case 0:case 11:case 15:Wc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ol=r;else a:for(n=e;ol!==null;){r=ol;var i=r.sibling,a=r.return;if(U(r),r===n){ol=null;break a}if(i!==null){i.return=a,ol=i;break a}ol=a}}}var zl={getCacheForType:function(e){var t=ea(oa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ea(oa).controller.signal}},Bl=typeof WeakMap==`function`?WeakMap:Map,Vl=0,Hl=null,W=null,G=0,Ul=0,Wl=null,Gl=!1,Kl=!1,ql=!1,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=null,nu=null,ru=!1,iu=0,au=0,ou=1/0,su=null,K=null,cu=0,lu=null,uu=null,du=0,fu=0,pu=null,mu=null,hu=0,gu=null;function _u(){return Vl&2&&G!==0?G&-G:k.T===null?ot():gd()}function vu(){if($l===0)if(!(G&536870912)||B){var e=Ge;Ge<<=1,!(Ge&3932160)&&(Ge=262144),$l=e}else $l=536870912;return e=no.current,e!==null&&(e.flags|=32),$l}function yu(e,t,n){(e===Hl&&(Ul===2||Ul===9)||e.cancelPendingCommit!==null)&&(Eu(e,0),Cu(e,G,$l,!1)),$e(e,n),(!(Vl&2)||e!==Hl)&&(e===Hl&&(!(Vl&2)&&(Zl|=n),Yl===4&&Cu(e,G,$l,!1)),cd(e))}function bu(e,t,n){if(Vl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ye(e,t),a=r?Pu(e,t):Mu(e,t,!0),o=r;do{if(a===0){Kl&&!r&&Cu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Su(n)){a=Mu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=tu;var l=c.current.memoizedState.isDehydrated;if(l&&(Eu(c,s).flags|=256),s=Mu(c,s,!1),s!==2){if(ql&&!l){c.errorRecoveryDisabledLanes|=o,Zl|=o,a=4;break a}o=nu,nu=a,o!==null&&(nu===null?nu=o:nu.push.apply(nu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Eu(e,0),Cu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Cu(r,t,$l,!Gl);break a;case 2:nu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=iu+300-Ee(),10<a)){if(Cu(r,t,$l,!Gl),Je(r,0,!0)!==0)break a;du=t,r.timeoutHandle=Qd(xu.bind(null,r,n,nu,su,ru,t,$l,Zl,eu,Gl,o,`Throttled`,-0,0),a);break a}xu(r,n,nu,su,ru,t,$l,Zl,eu,Gl,o,null,-0,0)}}break}while(1);cd(e)}function xu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:en},Nl(t,a,d);var m=(a&62914560)===a?iu-Ee():(a&4194048)===a?au-Ee():0;if(m=Zf(d,m),m!==null){du=a,e.cancelPendingCommit=m(Vu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Cu(e,a,o,!l);return}}Vu(e,t,a,n,r,i,o,s,c)}function Su(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!xr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Cu(e,t,n,r){t&=~Ql,t&=~Zl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Le(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&tt(e,n,t)}function wu(){return Vl&6?!0:(ld(0,!1),!1)}function Tu(){if(W!==null){if(Ul===0)var e=W.return;else e=W,Ki=Gi=null,ko(e),ja=null,Ma=0,e=W;for(;e!==null;)Hc(e.alternate,e),e=e.return;W=null}}function Eu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,$d(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),du=0,Tu(),Hl=e,W=n=li(e.current,null),G=t,Ul=0,Wl=null,Gl=!1,Kl=Ye(e,t),ql=!1,eu=$l=Ql=Zl=Xl=Yl=0,nu=tu=null,ru=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Le(r),a=1<<i;t|=e[i],r&=~a}return Jl=t,$r(),n}function Du(e,t){V=null,k.H=zs,t===xa||t===Ca?(t=ka(),Ul=3):t===Sa?(t=ka(),Ul=4):Ul=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Wl=t,W===null&&(Yl=1,Zs(e,_i(t,e.current)))}function Ou(){var e=no.current;return e===null?!0:(G&4194048)===G?ro===null:(G&62914560)===G||G&536870912?e===ro:!1}function ku(){var e=k.H;return k.H=zs,e===null?zs:e}function Au(){var e=k.A;return k.A=zl,e}function ju(){Yl=4,Gl||(G&4194048)!==G&&no.current!==null||(Kl=!0),!(Xl&134217727)&&!(Zl&134217727)||Hl===null||Cu(Hl,G,$l,!1)}function Mu(e,t,n){var r=Vl;Vl|=2;var i=ku(),a=Au();(Hl!==e||G!==t)&&(su=null,Eu(e,t)),t=!1;var o=Yl;a:do try{if(Ul!==0&&W!==null){var s=W,c=Wl;switch(Ul){case 8:Tu(),o=6;break a;case 3:case 2:case 9:case 6:no.current===null&&(t=!0);var l=Ul;if(Ul=0,Wl=null,Ru(e,s,c,l),n&&Kl){o=0;break a}break;default:l=Ul,Ul=0,Wl=null,Ru(e,s,c,l)}}Nu(),o=Yl;break}catch(t){Du(e,t)}while(1);return t&&e.shellSuspendCounter++,Ki=Gi=null,Vl=r,k.H=i,k.A=a,W===null&&(Hl=null,G=0,$r()),o}function Nu(){for(;W!==null;)Iu(W)}function Pu(e,t){var n=Vl;Vl|=2;var r=ku(),a=Au();Hl!==e||G!==t?(su=null,ou=Ee()+500,Eu(e,t)):Kl=Ye(e,t);a:do try{if(Ul!==0&&W!==null){t=W;var o=Wl;b:switch(Ul){case 1:Ul=0,Wl=null,Ru(e,t,o,1);break;case 2:case 9:if(Ta(o)){Ul=0,Wl=null,Lu(t);break}t=function(){Ul!==2&&Ul!==9||Hl!==e||(Ul=7),cd(e)},o.then(t,t);break a;case 3:Ul=7;break a;case 4:Ul=5;break a;case 7:Ta(o)?(Ul=0,Wl=null,Lu(t)):(Ul=0,Wl=null,Ru(e,t,o,7));break;case 5:var s=null;switch(W.tag){case 26:s=W.memoizedState;case 5:case 27:var c=W;if(s?Jf(s):c.stateNode.complete){Ul=0,Wl=null;var l=c.sibling;if(l!==null)W=l;else{var u=c.return;u===null?W=null:(W=u,zu(u))}break b}}Ul=0,Wl=null,Ru(e,t,o,5);break;case 6:Ul=0,Wl=null,Ru(e,t,o,6);break;case 8:Tu(),Yl=6;break a;default:throw Error(i(462))}}Fu();break}catch(t){Du(e,t)}while(1);return Ki=Gi=null,k.H=r,k.A=a,Vl=n,W===null?(Hl=null,G=0,$r(),Yl):0}function Fu(){for(;W!==null&&!P();)Iu(W)}function Iu(e){var t=Nc(e.alternate,e,Jl);e.memoizedProps=e.pendingProps,t===null?zu(e):W=t}function Lu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,G);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,G);break;case 5:ko(t);default:Hc(n,t),t=W=ui(t,Jl),t=Nc(n,t,Jl)}e.memoizedProps=e.pendingProps,t===null?zu(e):W=t}function Ru(e,t,n,r){Ki=Gi=null,ko(t),ja=null,Ma=0;var i=t.return;try{if(nc(e,i,t,n,G)){Yl=1,Zs(e,_i(n,e.current)),W=null;return}}catch(t){if(i!==null)throw W=i,t;Yl=1,Zs(e,_i(n,e.current)),W=null;return}t.flags&32768?(B||r===1?e=!0:Kl||G&536870912?e=!1:(Gl=e=!0,(r===2||r===9||r===3||r===6)&&(r=no.current,r!==null&&r.tag===13&&(r.flags|=16384))),Bu(t,e)):zu(t)}function zu(e){var t=e;do{if(t.flags&32768){Bu(t,Gl);return}e=t.return;var n=Bc(t.alternate,t,Jl);if(n!==null){W=n;return}if(t=t.sibling,t!==null){W=t;return}W=t=e}while(t!==null);Yl===0&&(Yl=5)}function Bu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,W=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){W=e;return}W=e=n}while(e!==null);Yl=6,W=null}function Vu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Ku();while(cu!==0);if(Vl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Qr,et(e,n,o,s,c,l),e===Hl&&(W=Hl=null,G=0),uu=t,lu=e,du=n,fu=o,pu=a,mu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,td(Ae,function(){return qu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=k.T,k.T=null,a=A.p,A.p=2,s=Vl,Vl|=4;try{sl(e,t,n)}finally{Vl=s,A.p=a,k.T=r}}cu=1,Hu(),Uu(),Wu()}}function Hu(){if(cu===1){cu=0;var e=lu,t=uu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=Vl;Vl|=4;try{yl(t,e);var a=Gd,o=Er(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Tr(s.ownerDocument.documentElement,s)){if(c!==null&&Dr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}dp=!!Wd,Gd=Wd=null}finally{Vl=i,A.p=r,k.T=n}}e.current=t,cu=2}}function Uu(){if(cu===2){cu=0;var e=lu,t=uu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=Vl;Vl|=4;try{cl(e,t.alternate,t)}finally{Vl=i,A.p=r,k.T=n}}cu=3}}function Wu(){if(cu===4||cu===3){cu=0,Te();var e=lu,t=uu,n=du,r=mu;t.subtreeFlags&10256||t.flags&10256?cu=5:(cu=0,uu=lu=null,Gu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(K=null),at(n),t=t.stateNode,F&&typeof F.onCommitFiberRoot==`function`)try{F.onCommitFiberRoot(Fe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=k.T,i=A.p,A.p=2,k.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{k.T=t,A.p=i}}du&3&&Ku(),cd(e),i=e.pendingLanes,n&261930&&i&42?e===gu?hu++:(hu=0,gu=e):hu=0,ld(0,!1)}}function Gu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ca(t)))}function Ku(){return Hu(),Uu(),Wu(),qu()}function qu(){if(cu!==5)return!1;var e=lu,t=fu;fu=0;var n=at(du),r=k.T,a=A.p;try{A.p=32>n?32:n,k.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,Vl&6)throw Error(i(331));var c=Vl;if(Vl|=4,Il(o.current),Ol(o,o.current,s,n),Vl=c,ld(0,!1),F&&typeof F.onPostCommitFiberRoot==`function`)try{F.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{A.p=a,k.T=r,Gu(e,t)}}function Ju(e,t,n){t=_i(n,t),t=$s(e.stateNode,t,2),e=Ua(e,t,2),e!==null&&($e(e,2),cd(e))}function Yu(e,t,n){if(e.tag===3)Ju(e,e,n);else for(;t!==null;){if(t.tag===3){Ju(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(K===null||!K.has(r))){e=_i(n,e),n=ec(2),r=Ua(t,n,2),r!==null&&(tc(n,r,t,e),$e(r,2),cd(r));break}}t=t.return}}function Xu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ql=!0,i.add(n),e=Zu.bind(null,e,t,n),t.then(e,e))}function Zu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Hl===e&&(G&n)===n&&(Yl===4||Yl===3&&(G&62914560)===G&&300>Ee()-iu?!(Vl&2)&&Eu(e,0):Ql|=n,eu===G&&(eu=0)),cd(e)}function Qu(e,t){t===0&&(t=Ze()),e=ni(e,t),e!==null&&($e(e,t),cd(e))}function $u(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qu(e,n)}function ed(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Qu(e,n)}function td(e,t){return Ce(e,t)}var nd=null,rd=null,id=!1,ad=!1,od=!1,sd=0;function cd(e){e!==rd&&e.next===null&&(rd===null?nd=rd=e:rd=rd.next=e),ad=!0,id||(id=!0,hd())}function ld(e,t){if(!od&&ad){od=!0;do for(var n=!1,r=nd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,md(r,a))}else a=G,a=Je(r,r===Hl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ye(r,a)||(n=!0,md(r,a));r=r.next}while(n);od=!1}}function ud(){dd()}function dd(){ad=id=!1;var e=0;sd!==0&&Zd()&&(e=sd);for(var t=Ee(),n=null,r=nd;r!==null;){var i=r.next,a=fd(r,t);a===0?(r.next=null,n===null?nd=i:n.next=i,i===null&&(rd=n)):(n=r,(e!==0||a&3)&&(ad=!0)),r=i}cu!==0&&cu!==5||ld(e,!1),sd!==0&&(sd=0)}function fd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Le(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Xe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Hl,n=G,n=Je(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ul===2||Ul===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&we(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ye(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&we(r),at(n)){case 2:case 8:n=ke;break;case 32:n=Ae;break;case 268435456:n=Me;break;default:n=Ae}return r=pd.bind(null,e),n=Ce(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&we(r),e.callbackPriority=2,e.callbackNode=null,2}function pd(e,t){if(cu!==0&&cu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ku()&&e.callbackNode!==n)return null;var r=G;return r=Je(e,e===Hl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(bu(e,r,t),fd(e,Ee()),e.callbackNode!=null&&e.callbackNode===n?pd.bind(null,e):null)}function md(e,t){if(Ku())return null;bu(e,t,!0)}function hd(){tf(function(){Vl&6?Ce(Oe,ud):dd()})}function gd(){if(sd===0){var e=da;e===0&&(e=Ue,Ue<<=1,!(Ue&261888)&&(Ue=256)),sd=e}return sd}function _d(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:$t(``+e)}function vd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function yd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=_d((i[ut]||null).action),o=r.submitter;o&&(t=(t=o[ut]||null)?_d(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(sd!==0){var e=o?vd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?vd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var bd=0;bd<qr.length;bd++){var xd=qr[bd];Jr(xd.toLowerCase(),`on`+(xd[0].toUpperCase()+xd.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),Et(`onMouseEnter`,[`mouseout`,`mouseover`]),Et(`onMouseLeave`,[`mouseout`,`mouseover`]),Et(`onPointerEnter`,[`pointerout`,`pointerover`]),Et(`onPointerLeave`,[`pointerout`,`pointerover`]),Tt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Tt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Tt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Tt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Sd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Cd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Sd));function wd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function q(e,t){var n=t[ft];n===void 0&&(n=t[ft]=new Set);var r=e+`__bubble`;n.has(r)||(Od(t,e,2,!1),n.add(r))}function Td(e,t,n){var r=0;t&&(r|=4),Od(n,e,r,t)}var Ed=`_reactListening`+Math.random().toString(36).slice(2);function Dd(e){if(!e[Ed]){e[Ed]=!0,Ct.forEach(function(t){t!==`selectionchange`&&(Cd.has(t)||Td(t,!1,e),Td(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ed]||(t[Ed]=!0,Td(`selectionchange`,!1,t))}}function Od(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!un||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function kd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=vt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}sn(function(){var r=a,i=nn(n),s=[];a:{var c=Kr.get(e);if(c!==void 0){var l=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:l=zn;break;case`focusin`:u=`focus`,l=An;break;case`focusout`:u=`blur`,l=An;break;case`beforeblur`:case`afterblur`:l=An;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Vn;break;case zr:case Br:case Vr:l=jn;break;case Gr:l=Hn;break;case`scroll`:case`scrollend`:l=Cn;break;case`wheel`:l=Un;break;case`copy`:case`cut`:case`paste`:l=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Bn;break;case`toggle`:case`beforetoggle`:l=Wn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=cn(m,p),g!=null&&d.push(Ad(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==tn&&(u=n.relatedTarget||n.fromElement)&&(vt(u)||u[dt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?vt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:bt(l),h=u==null?c:bt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,vt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Md,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Nd(s,c,l,d,!1),u!==null&&f!==null&&Nd(s,f,u,d,!0)}}a:{if(c=r?bt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ur;else if(ir(c))if(z)v=yr;else{v=_r;var y=gr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Xt(r.elementType)&&(v=ur):v=vr;if(v&&=v(e,r)){ar(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Wt(c,`number`,c.value)}switch(y=r?bt(r):window,e){case`focusin`:(ir(y)||y.contentEditable===`true`)&&(kr=y,Ar=r,jr=null);break;case`focusout`:jr=Ar=kr=null;break;case`mousedown`:Mr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Mr=!1,Nr(s,n,i);break;case`selectionchange`:if(Or)break;case`keydown`:case`keyup`:Nr(s,n,i)}var b;if(Kn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else er?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&(er||x!==`onCompositionStart`?x===`onCompositionEnd`&&er&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,er=!0)),y=jd(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=$n(n),b!==null&&(x.data=b)))),(b=Jn?tr(e,n):nr(e,n))&&(x=jd(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),yd(s,e,r,n,i)}wd(s,t)})}function Ad(e,t,n){return{instance:e,listener:t,currentTarget:n}}function jd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=cn(e,n),i!=null&&r.unshift(Ad(e,i,a)),i=cn(e,t),i!=null&&r.push(Ad(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Md(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Nd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=cn(n,a),l!=null&&o.unshift(Ad(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(Ad(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Pd=/\r\n?/g,Fd=/\u0000|\uFFFD/g;function Id(e){return(typeof e==`string`?e:``+e).replace(Pd,`
10
+ `).replace(Fd,``)}function Ld(e,t){return t=Id(t),Id(e)===t}function Rd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||I(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&I(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:Yt(e,r,o);break;case`data`:if(t!==`object`){Mt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Rd(e,t,`name`,a.name,a,null),Rd(e,t,`formEncType`,a.formEncType,a,null),Rd(e,t,`formMethod`,a.formMethod,a,null),Rd(e,t,`formTarget`,a.formTarget,a,null)):(Rd(e,t,`encType`,a.encType,a,null),Rd(e,t,`method`,a.method,a,null),Rd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=en);break;case`onScroll`:r!=null&&q(`scroll`,e);break;case`onScrollEnd`:r!=null&&q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=$t(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:q(`beforetoggle`,e),q(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Zt.get(n)||n,jt(e,n,r))}}function zd(e,t,n,r,a,o){switch(n){case`style`:Yt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?I(e,r):(typeof r==`number`||typeof r==`bigint`)&&I(e,``+r);break;case`onScroll`:r!=null&&q(`scroll`,e);break;case`onScrollEnd`:r!=null&&q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=en);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[ut]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):jt(e,n,r)}}}function Bd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:q(`error`,e),q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,o,s,n,null)}}a&&Rd(e,t,`srcSet`,n.srcSet,n,null),r&&Rd(e,t,`src`,n.src,n,null);return;case`input`:q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Rd(e,t,r,d,n,null)}}Ut(e,o,c,l,u,s,a,!1);return;case`select`:for(a in q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Rd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Gt(e,!!r,n,!0):Gt(e,!!r,t,!1);return;case`textarea`:for(s in q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Rd(e,t,s,c,n,null)}qt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Rd(e,t,l,r,n,null)}return;case`dialog`:q(`beforetoggle`,e),q(`toggle`,e),q(`cancel`,e),q(`close`,e);break;case`iframe`:case`object`:q(`load`,e);break;case`video`:case`audio`:for(r=0;r<Sd.length;r++)q(Sd[r],e);break;case`image`:q(`error`,e),q(`load`,e);break;case`details`:q(`toggle`,e);break;case`embed`:case`source`:case`link`:q(`error`,e),q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,u,r,n,null)}return;default:if(Xt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&zd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Rd(e,t,c,r,n,null))}function Vd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Rd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Rd(e,t,p,m,r,f)}}Ht(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Rd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Rd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Gt(e,!!n,n?[]:``,!1):Gt(e,!!n,t,!0)):Gt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Rd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Rd(e,t,s,a,r,o)}Kt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Rd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Rd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Rd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Rd(e,t,u,p,r,m)}return;default:if(Xt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&zd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||zd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Rd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Rd(e,t,f,p,r,m)}function Hd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ud(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Hd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Wd=null,Gd=null;function Kd(e){return e.nodeType===9?e:e.ownerDocument}function qd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Jd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Yd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xd=null;function Zd(){var e=window.event;return e&&e.type===`popstate`?e===Xd?!1:(Xd=e,!0):(Xd=null,!1)}var Qd=typeof setTimeout==`function`?setTimeout:void 0,$d=typeof clearTimeout==`function`?clearTimeout:void 0,ef=typeof Promise==`function`?Promise:void 0,tf=typeof queueMicrotask==`function`?queueMicrotask:ef===void 0?Qd:function(e){return ef.resolve(null).then(e).catch(nf)};function nf(e){setTimeout(function(){throw e})}function rf(e){return e===`head`}function af(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)yf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,yf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&yf(e.ownerDocument.body);n=i}while(n);Lp(t)}function of(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:sf(n),_t(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function cf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[gt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=mf(e.nextSibling),e===null)break}return null}function lf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=mf(e.nextSibling),e===null))return null;return e}function uf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=mf(e.nextSibling),e===null))return null;return e}function df(e){return e.data===`$?`||e.data===`$~`}function ff(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function pf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function mf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var hf=null;function gf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return mf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function _f(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function vf(e,t,n){switch(t=Kd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function yf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_t(e)}var bf=new Map,xf=new Set;function Sf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Cf=A.d;A.d={f:wf,r:Tf,D:Of,C:kf,L:Af,m:jf,X:Nf,S:Mf,M:Pf};function wf(){var e=Cf.f(),t=wu();return e||t}function Tf(e){var t=yt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):Cf.r(e)}var Ef=typeof document>`u`?null:document;function Df(e,t,n){var r=Ef;if(r&&typeof t==`string`&&t){var i=Vt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xf.has(i)||(xf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Of(e){Cf.D(e),Df(`dns-prefetch`,e,null)}function kf(e,t){Cf.C(e,t),Df(`preconnect`,e,t)}function Af(e,t,n){Cf.L(e,t,n);var r=Ef;if(r&&e&&t){var i=`link[rel="preload"][as="`+Vt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Vt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Vt(n.imageSizes)+`"]`)):i+=`[href="`+Vt(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=zf(e)}bf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Bf(a))||(t=r.createElement(`link`),Bd(t,`link`,e),St(t),r.head.appendChild(t)))}}function jf(e,t){Cf.m(e,t);var n=Ef;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Vt(r)+`"][href="`+Vt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zf(e)}if(!bf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),bf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bf(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),St(r),n.head.appendChild(r)}}}function Mf(e,t,n){Cf.S(e,t,n);var r=Ef;if(r&&e){var i=xt(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);St(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){Cf.X(e,t);var n=Ef;if(n&&e){var r=xt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=f({src:e,async:!0},t),(t=bf.get(i))&&Uf(e,t),a=n.createElement(`script`),St(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){Cf.M(e,t);var n=Ef;if(n&&e){var r=xt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=bf.get(i))&&Uf(e,t),a=n.createElement(`script`),St(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=ue.current)?Sf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=xt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=xt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),bf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bf.set(e,n),o||J(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=zf(n),n=xt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+Vt(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function J(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),St(t),e.head.appendChild(t))}function zf(e){return`[src="`+Vt(e)+`"]`}function Bf(e){return`script[async]`+e}function Y(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Vt(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Bd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,St(o),o;r=Rf(n),(a=bf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),St(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=zf(n.src),(a=e.querySelector(Bf(o)))?(t.instance=a,St(a),a):(r=n,(a=bf.get(o))&&(r=f({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),St(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[gt]||a[lt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Rf(r),(i=bf.get(i))&&Hf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Ud());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Qf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var np={$$typeof:b,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function rp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=si(3,null,null,t),e.current=a,a.stateNode=e,t=sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ba(a),e}function ap(e){return e?(e=ai,e):ai}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ha(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ua(e,r,t),n!==null&&(yu(n,e,t),Wa(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=ni(e,67108864);t!==null&&yu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=_u();t=it(t);var n=ni(e,t);n!==null&&yu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,mp(e,t,n,r)}finally{A.p=a,k.T=i}}function pp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,mp(e,t,n,r)}finally{A.p=a,k.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)kd(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=yt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Le(o);s.entanglements[1]|=c,o&=~c}cd(a),!(Vl&6)&&(ou=Ee()+500,ld(0,!1))}}break;case 31:case 13:s=ni(a,2),s!==null&&yu(s,a,2),wu(),cp(a,2)}if(a=hp(r),a===null&&kd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else kd(e,t,r,null,n)}}function hp(e){return e=nn(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=vt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return gp=e,null}function vp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(De()){case Oe:return 2;case ke:return 8;case Ae:case je:return 32;case Me:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=yt(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=vt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,st(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,st(e.priority,function(){up(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tn=r,n.target.dispatchEvent(r),tn=null}else return t=yt(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(_p(r||n)===null)continue;break}var a=yt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ut]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,_u(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),wu(),t[dt]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.4`)throw Error(i(527,Vp,`19.2.4`));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{Fe=Up.inject(Hp),F=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,o,s,c,Rp),e[dt]=t.current,Dd(e),new zp(t)}})),Ke=F(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ge()})),qe=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Je=new class extends qe{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Xe=new class{#e=Ye;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ze(e){setTimeout(e,0)}var Qe=typeof window>`u`||`Deno`in globalThis;function $e(){}function et(e,t){return typeof e==`function`?e(t):e}function tt(e){return typeof e==`number`&&e>=0&&e!==1/0}function nt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function rt(e,t){return typeof e==`function`?e(t):e}function it(e,t){return typeof e==`function`?e(t):e}function at(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==st(o,t.options))return!1}else if(!lt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ot(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ct(t.options.mutationKey)!==ct(a))return!1}else if(!lt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function st(e,t){return(t?.queryKeyHashFn||ct)(e)}function ct(e){return JSON.stringify(e,(e,t)=>pt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function lt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>lt(e[n],t[n])):!1}var ut=Object.prototype.hasOwnProperty;function dt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ft(e)&&ft(t);if(!r&&!(pt(e)&&pt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ut.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=dt(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ft(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function pt(e){if(!mt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!mt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function mt(e){return Object.prototype.toString.call(e)===`[object Object]`}function ht(e){return new Promise(t=>{Xe.setTimeout(t,e)})}function gt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:dt(e,t)}function _t(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function vt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var yt=Symbol();function bt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===yt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function xt(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var St=(()=>{let e=()=>Qe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ct(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var wt=Ze;function Tt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=wt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Et=Tt(),Dt=new class extends qe{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ot(e){return Math.min(1e3*2**e,3e4)}function kt(e){return(e??`online`)===`online`?Dt.isOnline():!0}var At=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function jt(e){let t=!1,n=0,r,i=Ct(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new At(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Je.isFocused()&&(e.networkMode===`always`||Dt.isOnline())&&e.canRun(),u=()=>kt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(St.isServer()?0:3),o=e.retryDelay??Ot,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ht(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Mt=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tt(this.gcTime)&&(this.#e=Xe.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(St.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Xe.clearTimeout(this.#e),void 0)}},Nt=class extends Mt{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=It(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=It(this.options);e.data!==void 0&&(this.setState(Ft(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=gt(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then($e).catch($e):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>it(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>rt(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!nt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=bt(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=jt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof At&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof At){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Pt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ft(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),Et.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Pt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:kt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ft(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function It(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}function Lt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{xt(e,()=>t.signal,()=>n=!0)},u=bt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?vt:_t;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?zt:Rt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Rt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Rt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function zt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Bt=class extends Mt{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Vt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=jt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),Et.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Vt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ht=class extends qe{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Bt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ut(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ut(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ut(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ut(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Et.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ot(t,e))}findAll(e={}){return this.getAll().filter(t=>ot(e,t))}notify(e){Et.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Et.batch(()=>Promise.all(e.map(e=>e.continue().catch($e))))}};function Ut(e){return e.options.scope?.id}var Wt=class extends qe{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??st(r,t),a=this.get(i);return a||(a=new Nt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Et.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>at(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>at(e,t)):t}notify(e){Et.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Et.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Et.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Gt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Wt,this.#t=e.mutationCache||new Ht,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Je.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Dt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(rt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=et(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Et.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Et.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Et.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Et.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then($e).catch($e)}invalidateQueries(e,t={}){return Et.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Et.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch($e)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then($e)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(rt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($e).catch($e)}fetchInfiniteQuery(e){return e.behavior=Lt(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then($e).catch($e)}ensureInfiniteQueryData(e){return e.behavior=Lt(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Dt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ct(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{lt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ct(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{lt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=st(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===yt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Kt=F((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),qt=F(((e,t)=>{t.exports=Kt()})),I=Re(He(),1),L=qt(),Jt=I.createContext(void 0),Yt=({client:e,children:t})=>(I.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,L.jsx)(Jt.Provider,{value:e,children:t}));I.use;var Xt=typeof window<`u`?I.useLayoutEffect:I.useEffect;function Zt(e){let t=I.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Qt(e,t,n={},r={}){I.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function $t(e){let t=I.useRef(null);return I.useImperativeHandle(e,()=>t.current,[]),t}function en(e){return e[e.length-1]}function tn(e){return typeof e==`function`}function nn(e,t){return tn(e)?e(t):e}var rn=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable,on=()=>Object.create(null),R=(e,t)=>sn(e,t,on);function sn(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=dn(e)&&dn(i);if(!a&&!(ln(e)&&ln(i)))return i;let o=a?e:cn(e);if(!o)return i;let s=a?i:cn(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:rn.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=sn(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function cn(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!an.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!an.call(e,t))return!1;r.push(t)}return r}function ln(e){if(!un(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!un(n)||!n.hasOwnProperty(`isPrototypeOf`))}function un(e){return Object.prototype.toString.call(e)===`[object Object]`}function dn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function fn(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!fn(e[r],t[r],n))return!1;return!0}if(ln(e)&&ln(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!fn(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!fn(e[o],t[o],n)))return!1;return i===a}return!1}function pn(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function mn(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function hn(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function gn(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return hn(t)}var _n=[`http:`,`https:`,`mailto:`,`tel:`];function vn(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var yn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},bn=/[&><\u2028\u2029]/g;function xn(e){return e.replace(bn,e=>yn[e])}function Sn(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=gn(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=gn(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Cn(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function wn(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Tn=!0,En=`Invariant failed`;function Dn(e,t){if(!e){if(Tn)throw Error(En);var n=typeof t==`function`?t():t,r=n?`${En}: ${n}`:En;throw Error(r)}}var On=4,kn=5;function An(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function jn(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=An(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Mn(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;s<o;){let e=jn(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Fn(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Fn(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.skipOnParamError&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=In(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.skipOnParamError&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=In(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=In(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Fn(n.fullPath??n.from);e.kind=kn,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Fn(n.fullPath??n.from);e.kind=On,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=n.options?.params?.parse??null,i.skipOnParamError=l,i.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)Mn(e,t,r,s,i,a,o)}function Nn(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Pn(e){if(e.pathless)for(let t of e.pathless)Pn(t);if(e.static)for(let t of e.static.values())Pn(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Pn(t);if(e.dynamic?.length){e.dynamic.sort(Nn);for(let t of e.dynamic)Pn(t)}if(e.optional?.length){e.optional.sort(Nn);for(let t of e.optional)Pn(t)}if(e.wildcard?.length){e.wildcard.sort(Nn);for(let t of e.wildcard)Pn(t)}}function Fn(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function In(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:r,suffix:i}}function Ln(e,t){let n=Fn(`/`),r=new Uint16Array(6);for(let t of e)Mn(!1,r,t,1,n,0);Pn(n),t.masksTree=n,t.flatCache=wn(1e3)}function Rn(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Un(e,t.masksTree);return t.flatCache.set(e,r),r}function zn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Fn(`/`),Mn(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Un(r,o,n)}function Bn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Un(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Gn(a.route)),t.matchCache.set(r,a),a}function Vn(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Hn(e,t=!1,n){let r=Fn(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Mn(t,i,e,1,r,0,e=>{if(n?.(e,s),Dn(!(e.id in a),`Duplicate routes found with id: ${String(e.id)}`),a[e.id]=e,s!==0&&e.path){let t=Vn(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Pn(r),{processedTree:{segmentTree:r,singleCache:wn(1e3),matchCache:wn(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Un(e,t,n=!1){let r=e.split(`/`),i=qn(e,r,t,n);if(!i)return null;let[a]=Wn(e,r,i);return{route:i.node.route,rawParams:a,parsedParams:i.parsedParams}}function Wn(e,t,n){let r=Kn(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===On)break;if(u.kind===kn){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function Gn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Kn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function qn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!en(t),a=i&&e!==`/`,o=t.length-(i?1:0),s=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}],c=null,l=null,u=null;for(;s.length;){let n=s.pop(),{node:i,index:d,skipped:f,depth:p,statics:m,dynamics:h,optionals:g}=n,{extract:_,rawParams:v,parsedParams:y}=n;if(i.skipOnParamError){if(!Jn(e,t,n))continue;v=n.rawParams,_=n.extract,y=n.parsedParams}r&&i.route&&i.kind!==On&&Yn(l,n)&&(l=n);let b=d===o;if(b&&(i.route&&!a&&Yn(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let x=b?void 0:t[d],S;if(b&&i.index){let n={node:i.index,index:d,skipped:f,depth:p+1,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y},r=!0;if(i.index.skipOnParamError&&(Jn(e,t,n)||(r=!1)),r){if(m===o&&!h&&!g&&!f)return n;Yn(u,n)&&(u=n)}}if(i.wildcard&&Yn(c,n))for(let n of i.wildcard){let{prefix:r,suffix:i}=n;if(r&&(b||!(n.caseSensitive?x:S??=x.toLowerCase()).startsWith(r)))continue;if(i){if(b)continue;let e=t.slice(d).join(`/`).slice(-i.length);if((n.caseSensitive?e:e.toLowerCase())!==i)continue}let a={node:n,index:o,skipped:f,depth:p,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y};if(!(n.skipOnParamError&&!Jn(e,t,a))){c=a;break}}if(i.optional){let e=f|1<<p,t=p+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:d,skipped:e,depth:t,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(!b)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?x:S??=x.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:d+1,skipped:f,depth:t,statics:m,dynamics:h,optionals:g+1,extract:_,rawParams:v,parsedParams:y})}}if(!b&&i.dynamic&&x)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?x:S??=x.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:d+1,skipped:f,depth:p+1,statics:m,dynamics:h+1,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(!b&&i.staticInsensitive){let e=i.staticInsensitive.get(S??=x.toLowerCase());e&&s.push({node:e,index:d+1,skipped:f,depth:p+1,statics:m+1,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(!b&&i.static){let e=i.static.get(x);e&&s.push({node:e,index:d+1,skipped:f,depth:p+1,statics:m+1,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}if(i.pathless){let e=p+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:d,skipped:f,depth:e,statics:m,dynamics:h,optionals:g,extract:_,rawParams:v,parsedParams:y})}}}if(u&&c)return Yn(c,u)?u:c;if(u)return u;if(c)return c;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function Jn(e,t,n){try{let[r,i]=Wn(e,t,n);n.rawParams=r,n.extract=i;let a=n.node.parse(r);return n.parsedParams=Object.assign(Object.create(null),n.parsedParams,a),!0}catch{return null}}function Yn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===On)>(e.node.kind===On)||t.node.kind===On==(e.node.kind===On)&&t.depth>e.depth))):!0}function Xn(e){return Zn(e.filter(e=>e!==void 0).join(`/`))}function Zn(e){return e.replace(/\/{2,}/g,`/`)}function Qn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function $n(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function er(e){return $n(Qn(e))}function tr(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function nr(e,t,n){return tr(e,n)===tr(t,n)}function rr({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&en(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(en(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c,l=``;for(let e=0;e<s.length;e++){e>0&&(l+=`/`);let t=s[e];if(!t)continue;c=jn(t,0,c);let n=c[0];if(n===0){l+=t;continue}let r=c[5],i=t.substring(0,c[1]),a=t.substring(c[4],r),o=t.substring(c[2],c[3]);n===1?l+=i||a?`${i}{$${o}}${a}`:`$${o}`:n===2?l+=i||a?`${i}{$}${a}`:`$`:l+=`${i}{-$${o}}${a}`}l=Zn(l);let u=l||`/`;return o&&r&&r.set(o,u),u}function ir(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function ar(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>sr(e,n)).join(`/`):sr(r,n):r}function or({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=jn(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=ar(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=ar(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=ar(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function sr(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function cr(e){return!!e?.isNotFound}function lr(){try{if(typeof window<`u`&&typeof window.sessionStorage==`object`)return window.sessionStorage}catch{}}var ur=`tsr-scroll-restoration-v1_3`,z=(e,t)=>{let n;return(...r)=>{n||=setTimeout(()=>{e(...r),n=null},t)}};function dr(){let e=lr();if(!e)return null;let t=e.getItem(ur),n=t?JSON.parse(t):{};return{state:n,set:t=>{n=nn(t,n)||n;try{e.setItem(ur,JSON.stringify(n))}catch{console.warn(`[ts-router] Could not persist scroll restoration state to sessionStorage.`)}}}}var fr=dr(),pr=e=>e.state.__TSR_key||e.href;function mr(e){let t=[],n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(` > `)}`.toLowerCase()}var hr=!1;function gr({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:i,location:a}){let o;try{o=JSON.parse(sessionStorage.getItem(e)||`{}`)}catch(e){console.error(e);return}let s=t||window.history.state?.__TSR_key,c=o[s];hr=!0;scroll:{if(r&&c&&Object.keys(c).length>0){for(let e in c){let t=c[e];if(e===`window`)window.scrollTo({top:t.scrollY,left:t.scrollX,behavior:n});else if(e){let n=document.querySelector(e);n&&(n.scrollLeft=t.scrollX,n.scrollTop=t.scrollY)}}break scroll}let e=(a??window.location).hash.split(`#`,2)[1];if(e){let t=window.history.state?.__hashScrollIntoViewOptions??!0;if(t){let n=document.getElementById(e);n&&n.scrollIntoView(t)}break scroll}let t={top:0,left:0,behavior:n};if(window.scrollTo(t),i)for(let e of i){if(e===`window`)continue;let n=typeof e==`function`?e():document.querySelector(e);n&&n.scrollTo(t)}}hr=!1}function _r(e,t){if(!fr||((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!fr))return;e.isScrollRestorationSetup=!0,hr=!1;let n=e.options.getScrollRestorationKey||pr;window.history.scrollRestoration=`manual`,typeof document<`u`&&document.addEventListener(`scroll`,z(t=>{if(hr||!e.isScrollRestoring)return;let r=``;if(t.target===document||t.target===window)r=`window`;else{let e=t.target.getAttribute(`data-scroll-restoration-id`);r=e?`[data-scroll-restoration-id="${e}"]`:mr(t.target)}let i=n(e.state.location);fr.set(e=>{let t=e[i]||={},n=t[r]||={};if(r===`window`)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(r){let e=document.querySelector(r);e&&(n.scrollX=e.scrollLeft||0,n.scrollY=e.scrollTop||0)}return e})},100),!0),e.subscribe(`onRendered`,t=>{let r=n(t.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation})||(gr({storageKey:ur,key:r,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&fr.set(e=>(e[r]||={},e)))})}function vr(e){if(typeof document<`u`&&document.querySelector){let t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==``){let n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function yr(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function br(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function xr(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=br(r):Array.isArray(t)?t.push(br(r)):n[e]=[t,br(r)]}return n}var Sr=wr(JSON.parse),Cr=Tr(JSON.stringify,JSON.parse);function wr(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=xr(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Tr(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=yr(e,r);return t?`?${t}`:``}}var Er=`__root__`;function Dr(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Or(e){return e instanceof Response&&!!e.options}function kr(e){return{input:({url:t})=>{for(let n of e)t=jr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Mr(e[n],t);return t}}}function Ar(e){let t=er(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{let r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname=`/`:r.startsWith(a)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Xn([`/`,t,e.pathname]),e)}}function jr(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Mr(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}var Nr=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(Nr||{});function Pr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}var Fr=0,Ir=0,Lr=0,Rr=[],{link:zr,unlink:Br,propagate:Vr,checkDirty:Hr,shallowPropagate:Ur}=Pr({update(e){return e.depsTail===void 0?Jr(e):qr(e)},notify(e){let t=Lr,n=t;do if(Rr[t++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(Lr=t;n<--t;){let e=Rr[n];Rr[n++]=Rr[t],Rr[t]=e}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Qr(e)):Zr.call(e)}});function Wr(){return Fr}function Gr(){++Fr}function Kr(){--Fr||Xr()}function qr(e){e.depsTail=void 0,e.flags=5;try{let t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,Qr(e)}}function Jr(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function Yr(e){let t=e.flags;if(t&16||t&32&&Hr(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Qr(e)}}else e.flags=2}function Xr(){try{for(;Ir<Lr;){let e=Rr[Ir];Rr[Ir++]=void 0,Yr(e)}}finally{for(;Ir<Lr;){let e=Rr[Ir];Rr[Ir++]=void 0,e.flags|=10}Ir=0,Lr=0}}function Zr(){this.depsTail=void 0,this.flags=0,Qr(this);let e=this.subs;e!==void 0&&Br(e)}function Qr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Br(n,e)}function $r(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ei=[],ti=0,{link:ni,unlink:ri,propagate:ii,checkDirty:ai,shallowPropagate:oi}=Pr({update(e){return e._update()},notify(e){ei[ci++]=e,e.flags&=~Nr.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Nr.Mutable|Nr.Dirty,ui(e))}}),si=0,ci=0,li;function ui(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ri(n,e)}function di(){if(!(Wr()>0)){for(;si<ci;){let e=ei[si];ei[si++]=void 0,e.notify()}si=0,ci=0}}function fi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Nr.None:Nr.Mutable,get(){return li!==void 0&&ni(i,li,ti),i._snapshot},subscribe(e){let t=$r(e),n={current:!1},r=pi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=li,o=t?.compare??Object.is;if(n)li=i,++ti,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Nr.Mutable|Nr.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{li=a,n&&(i.flags&=~Nr.RecursedCheck),ui(i)}}};return n?(i.flags=Nr.Mutable|Nr.Dirty,i.get=function(){let e=i.flags;if(e&Nr.Dirty||e&Nr.Pending&&ai(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&oi(e)}}else e&Nr.Pending&&(i.flags=e&~Nr.Pending);return li!==void 0&&ni(i,li,ti),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ii(e),oi(e),di())}},i}function pi(e){let t=()=>{let t=li;li=n,++ti,n.depsTail=void 0,n.flags=Nr.Watching|Nr.RecursedCheck;try{return e()}finally{li=t,n.flags&=~Nr.RecursedCheck,ui(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Nr.Watching|Nr.RecursedCheck,notify(){let e=this.flags;e&Nr.Dirty||e&Nr.Pending&&ai(this.deps,this)?t():this.flags=Nr.Watching},stop(){this.flags=Nr.None,this.depsTail=void 0,ui(this)}};return t(),n}var mi=class{constructor(e){this.atom=fi(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe($r(e))}},hi=class{constructor(e){this.atom=fi(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe($r(e))}};function gi(e){return typeof e==`function`?new hi(e):new mi(e)}function _i(e){try{Gr(),e()}finally{Kr(),di()}}function vi(e){let t;return _i(()=>{t=e()}),t}var yi=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},bi=(e,t)=>!!(e.preload&&!e.router.state.matches.some(e=>e.id===t)),xi=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},Si=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},Ci=(e,t,n)=>{if(!(!Or(n)&&!cr(n)))throw Or(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Or(n)?`redirected`:r.status===`pending`?`success`:r.status,context:xi(e,t.index),isFetching:!1,error:n})),cr(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Or(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},wi=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ti=(e,t,n)=>{let r=xi(e,n);e.updateMatch(t,e=>({...e,context:r}))},Ei=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Ci(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,Ci(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Or(n)&&!cr(n)&&(e.serialError??=n)},Di=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!bi(e,t)&&(n.options.loader||n.options.beforeLoad||Li(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{yi(e)},i);r._nonReactive.pendingTimeout=t}},Oi=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Di(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&Ci(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},ki=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=pn(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&Ei(e,n,o,`PARSE_PARAMS`),s&&Ei(e,n,s,`VALIDATE_SEARCH`),Di(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){vi(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=pn();let f={...xi(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=bi(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){vi(()=>{u(),d()});return}(Or(r)||cr(r))&&(u(),Ei(e,n,r,`BEFORE_LOAD`)),vi(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),mn(y))return u(),y.catch(t=>{Ei(e,n,t,`BEFORE_LOAD`)}).then(v)}catch(t){u(),Ei(e,n,t,`BEFORE_LOAD`)}v(y)},Ai=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>ki(e,n,t,i),s=()=>{if(wi(e,n))return;let t=Oi(e,n,i);return mn(t)?t.then(o):o()};return a()},ji=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Mi=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=xi(e,r),d=bi(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},Ni=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{Ii(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(Mi(e,t,n,r,i)),l=!!s&&mn(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;Ci(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:xi(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:xi(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,cr(t)&&await i.options.notFoundComponent?.preload?.(),Ci(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,Ci(e,e.router.getMatch(n),t)}!Or(o)&&!cr(o)&&await Ii(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:xi(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),Ci(e,r,t)}},B=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(Mi(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await Ni(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Or(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await Ni(e,t,i,n,d):Ti(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(wi(e,i)){if(!e.router.getMatch(i))return e.matches[n];Ti(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.state.matches[n]?.routeId===a?e.router.state.matches[n].id:e.router.state.matches.find(e=>e.routeId===a)?.id,s=bi(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&Ci(e,n,a),n.status===`pending`&&await r(s,t,o,n,c)}else{let n=s&&!e.router.state.matches.some(e=>e.id===i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=pn(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(s,t,o,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function Pi(e){let t=e,n=[];t.router.state.matches.some(e=>e._forcePending)&&yi(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=Ai(t,e);mn(n)&&await n}catch(e){if(Or(e))throw e;if(cr(e))r=e;else if(!t.preload)throw e;break}if(t.serialError)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?Si(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(B(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Or(e))throw e;cr(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!l&&r&&t.preload)return t.matches;if(l){let e=Si(t,l);Dn(e!==void 0,`Could not find match for notFound boundary`);let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await Ii(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Ii(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=ji(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=yi(t);if(mn(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Fi(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Ii(e,t=Ri){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===Ri?(()=>{if(e._componentsPromise===void 0){let t=Fi(e,Ri);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Fi(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Li(e){for(let t of Ri)if(e.options[t]?.preload)return!0;return!1}var Ri=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],zi=`__TSR_index`,Bi=`popstate`,Vi=`beforeunload`;function Hi(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Ki(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[zi];i=Ui(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[zi];i=Ui(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[zi]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Ui(e,t){t||={};let n=qi();return{...t,key:n,__TSR_key:n,[zi]:e}}function Wi(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Ki(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=qi();t.history.replaceState({[zi]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Ki(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[zi]-l.state[zi],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=Hi({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Vi,S,{capture:!0}),t.removeEventListener(Bi,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Vi,S,{capture:!0}),t.addEventListener(Bi,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Gi(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Ki(e,t){let n=Gi(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=qi();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[zi]:0,key:a,__TSR_key:a}}}function qi(){return(Math.random()+1).toString(36).substring(7)}function Ji(e){let t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}function Yi(e){let t=e.filter(e=>e.status!==`redirected`);return t.length===e.length?e:t}var Xi=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=ir(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Wi()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=wn(1e3),e=this.buildRouteTree(),this.setRoutes(e)}!this.__store&&this.latestLocation&&(this.__store=gi($i(this.latestLocation)),_r(this));let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=er(o);t&&t!==`/`&&e.push(Ar({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:kr(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&this.__store.setState(e=>({...e,location:this.latestLocation})),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Hn(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Ln(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let o=this.options.parseSearch(n),s=this.options.stringifySearch(o);return{href:e+s+r,publicHref:i,pathname:Sn(e).path,external:!1,searchStr:s,search:R(t?.search,o),hash:Sn(r.slice(1)).path,state:sn(t?.state,a)}}let o=new URL(i,this.origin),s=jr(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Sn(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:R(t?.search,c),hash:Sn(s.hash.slice(1)).path,state:sn(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>rr({base:e,to:Zn(t),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>ta({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{let e=this.state.matches.filter(e=>e.status===`pending`),t=this.state.matches.filter(e=>e.isFetching===`loader`);new Set([...this.state.pendingMatches??[],...e,...t]).forEach(e=>{this.cancelMatch(e.id)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=this.resolvePathWithBase(i,`.`),o=r.search,s=Object.assign(Object.create(null),r.params),c=t.to?this.resolvePathWithBase(a,`${t.to}`):this.resolvePathWithBase(a,`.`),l=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,nn(t.params,s)),u=this.getMatchedRoutes(c),d=u.matchedRoutes;if((!u.foundRoute||u.foundRoute.path!==`/`&&u.routeParams[`**`])&&this.options.notFoundRoute&&(d=[...d,this.options.notFoundRoute]),Object.keys(l).length>0)for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(l,t(l))}catch{}}let f=e.leaveParams?c:Sn(or({path:c,params:l,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,p=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,ea(t.options.validateSearch,{...e,...p}))}catch{}}),p=e}p=na({search:p,dest:t,destRoutes:d,_includeValidateSearch:e._includeValidateSearch}),p=R(o,p);let m=this.options.stringifySearch(p),h=t.hash===!0?n.hash:t.hash?nn(t.hash,n.hash):void 0,g=h?`#${h}`:``,_=t.state===!0?n.state:t.state?nn(t.state,n.state):{};_=sn(n.state,_);let v=`${f}${m}${g}`,y,b,x=!1;if(this.rewrite){let e=new URL(v,this.origin),t=Mr(this.rewrite,e);y=e.href.replace(e.origin,``),t.origin===this.origin?b=t.pathname+t.search+t.hash:(b=t.href,x=!0)}else y=Cn(v),b=y;return{publicHref:b,href:y,pathname:f,search:p,searchStr:m,state:_,hash:h??``,external:x,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Rn(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,nn(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=fn(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},i=$n(this.latestLocation.href)===$n(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=pn(()=>{a?.resolve(),a=void 0}),i&&r())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.publicHref,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Ki(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=jr(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(vn(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation);this.__store.setState(t=>({...t,status:`pending`,statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:t.cachedMatches.filter(t=>!e.some(e=>e.id===t.id))}))},this.load=async e=>{let t,n,r,i=this.state.resolvedLocation??this.state.location;for(r=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();let t=this.latestLocation,n=this.state.resolvedLocation;this.state.redirect||this.emit({type:`onBeforeNavigate`,...Ji({resolvedLocation:n,location:t})}),this.emit({type:`onBeforeLoad`,...Ji({resolvedLocation:n,location:t})}),await Pi({router:this,sync:e?.sync,forceStaleReload:i.href===t.href,matches:this.state.pendingMatches,location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=[],t=[],n=[],r=[];vi(()=>{this.__store.setState(i=>{let a=i.matches,o=i.pendingMatches||i.matches;return e=a.filter(e=>!o.some(t=>t.id===e.id)),t=a.filter(e=>!o.some(t=>t.routeId===e.routeId)),n=o.filter(e=>!a.some(t=>t.routeId===e.routeId)),r=o.filter(e=>a.some(t=>t.routeId===e.routeId)),{...i,isLoading:!1,loadedAt:Date.now(),matches:o,pendingMatches:void 0,cachedMatches:[...i.cachedMatches,...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]}}),this.clearExpiredCache()}),[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]].forEach(([e,t])=>{e.forEach(e=>{this.looseRoutesById[e.routeId].options[t]?.(e)})})})})}})}catch(e){Or(e)?(t=e,this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):cr(e)&&(n=e),this.__store.setState(e=>({...e,statusCode:t?t.status:n?404:e.matches.some(e=>e.status===`error`)?500:200,redirect:t}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let a;this.hasNotFoundMatch()?a=404:this.__store.state.matches.some(e=>e.status===`error`)&&(a=500),a!==void 0&&this.__store.setState(e=>({...e,statusCode:a}))},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.state.resolvedLocation,a=typeof t.types==`function`?t.types(Ji({resolvedLocation:i,location:r})):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.state.pendingMatches?.some(t=>t.id===e)?`pendingMatches`:this.state.matches.some(t=>t.id===e)?`matches`:this.state.cachedMatches.some(t=>t.id===e)?`cachedMatches`:``;n&&(n===`cachedMatches`?this.__store.setState(n=>({...n,cachedMatches:Yi(n.cachedMatches.map(n=>n.id===e?t(n):n))})):this.__store.setState(r=>({...r,[n]:r[n]?.map(n=>n.id===e?t(n):n)})))})},this.getMatch=e=>{let t=t=>t.id===e;return this.state.cachedMatches.find(t)??this.state.pendingMatches?.find(t)??this.state.matches.find(t)},this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.__store.setState(e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&vn(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.__store.setState(e=>({...e,cachedMatches:[]})):this.__store.setState(e=>({...e,cachedMatches:e.cachedMatches.filter(e=>!t(e))}))},this.clearExpiredCache=()=>{this.clearCache({filter:e=>{let t=this.looseRoutesById[e.routeId];if(!t.options.loader)return!0;let n=(e.preload?t.options.preloadGcTime??this.options.defaultPreloadGcTime:t.options.gcTime??this.options.defaultGcTime)??300*1e3;return e.status===`error`?!0:Date.now()-e.updatedAt>=n}})},this.loadRouteChunk=Ii,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(e=>e.id)),i=new Set([...r,...this.state.cachedMatches.map(e=>e.id)]);vi(()=>{n.forEach(e=>{i.has(e.id)||this.__store.setState(t=>({...t,cachedMatches:[...t.cachedMatches,e]}))})});try{return n=await Pi({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Or(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});cr(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.state.status!==`pending`)return!1;let i=(t?.pending===void 0?!this.state.isLoading:t.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=zn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!fn(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?fn(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status===`notFound`||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Cr,parseSearch:e.parseSearch??Sr,protocolAllowlist:e.protocolAllowlist??_n}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i,parsedParams:a}=n,{matchedRoutes:o}=n,s=!1;(r?r.path!==`/`&&i[`**`]:$n(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:s=!0);let c=s?ia(this.options.notFoundMode,o):void 0,l=Array(o.length),u=new Map(this.state.matches.map(e=>[e.routeId,e]));for(let n=0;n<o.length;n++){let r=o[n],s=l[n-1],d,f,p;{let n=s?.search??e.search,i=s?._strictSearch??void 0;try{let e=ea(r.options.validateSearch,{...n})??void 0;d={...n,...e},f={...i,...e},p=void 0}catch(e){let r=e;if(e instanceof Zi||(r=new Zi(e.message,{cause:e})),t?.throwOnError)throw r;d=n,f={},p=r}}let m=r.options.loaderDeps?.({search:d})??``,h=m?JSON.stringify(m):``,{interpolatedPath:g,usedParams:_}=or({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),v=r.id+g+h,y=this.getMatch(v),b=u.get(r.id),x=y?._strictParams??_,S;if(!y)try{aa(r,_,a,x)}catch(e){if(S=cr(e)||Or(e)?e:new Qi(e.message,{cause:e}),t?.throwOnError)throw S}Object.assign(i,x);let C=b?`stay`:`enter`,w;if(y)w={...y,cause:C,params:b?.params??i,_strictParams:x,search:R(b?b.search:y.search,d),_strictSearch:f};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Li(r)?`pending`:`success`;w={id:v,ssr:r.options.ssr,index:n,routeId:r.id,params:b?.params??i,_strictParams:x,pathname:g,updatedAt:Date.now(),search:b?R(b.search,d):d,_strictSearch:f,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:pn()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:b?sn(b.loaderDeps,m):m,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(w.globalNotFound=c===r.id),w.searchError=p;let T=this.getParentContext(s);w.context={...T,...w.__routeContext,...w.__beforeLoadContext},l[n]=w}for(let t=0;t<l.length;t++){let n=l[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=u.get(n.routeId);if(n.params=o?R(o.params,i):i,!a){let i=l[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:l,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return l}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n,parsedParams:r}=this.getMatchedRoutes(e.pathname),i=en(t),a={...e.search};for(let e of t)try{Object.assign(a,ea(e.options.validateSearch,a))}catch{}let o=en(this.state.matches),s=o&&o.routeId===i.id&&e.pathname===this.state.location.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let i of t)try{aa(i,n,r??{},e)}catch{}c=e}return{matchedRoutes:t,fullPath:i.fullPath,search:a,params:c}}},Zi=class extends Error{},Qi=class extends Error{};function $i(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ea(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Zi(`Async validation not supported`);if(n.issues)throw new Zi(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function ta({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=$n(e),a,o,s=Bn(i,n,!0);return s&&(a=s.route,Object.assign(r,s.rawParams),o=Object.assign(Object.create(null),s.parsedParams)),{matchedRoutes:s?.branch||[t.__root__],routeParams:r,foundRoute:a,parsedParams:o}}function na({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return ra(n)(e,t,r??!1)}function ra(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...ea(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:nn(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function ia(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Er}function aa(e,t,n,r){let i=e.options.params?.parse??e.options.parseParams;if(i)if(e.options.skipRouteOnParseError)for(let e in t)e in n&&(r[e]=n[e]);else{let e=i(r);Object.assign(r,e)}}var oa=`Error preloading route! ☝️`,sa=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Er:this.parentRoute||Dn(!1,`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);let r=n?Er:t?.path;r&&r!==`/`&&(r=Qn(r));let i=t?.id||r,a=n?Er:Xn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Xn([`/`,a]));let o=a===`__root__`?`/`:Xn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=$n(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Dr({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},ca=class extends sa{constructor(e){super(e)}};function la(e){let t=e.errorComponent??da;return(0,L.jsx)(ua,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?I.createElement(t,{error:n,reset:r}):e.children})}var ua=class extends I.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey===this.props.getResetKey()?this.state.error:null,reset:()=>{this.reset()}})}};function da({error:e}){let[t,n]=I.useState(!1);return(0,L.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,L.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,L.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,L.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,L.jsx)(`div`,{children:(0,L.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,L.jsx)(`code`,{children:e.message}):null})}):null]})}function fa({children:e,fallback:t=null}){return pa()?(0,L.jsx)(I.Fragment,{children:e}):(0,L.jsx)(I.Fragment,{children:t})}function pa(){return I.useSyncExternalStore(ma,()=>!0,()=>!1)}function ma(){return()=>{}}var ha=I.createContext(null),ga=!0;function _a(e,t){if(!ga){if(e)return;var n=`Warning: `+t;typeof console<`u`&&console.warn(n);try{throw Error(n)}catch{}}}function va(e){let t=I.useContext(ha);return _a(!((e?.warn??!0)&&!t),`useRouter must be used inside a <RouterProvider> component!`),t}var ya=F((e=>{var t=He();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),ba=F(((e,t)=>{t.exports=ya()})),xa=F((e=>{var t=He(),n=ba();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Sa=F(((e,t)=>{t.exports=xa()}))();function Ca(e,t){return e===t}function wa(e,t,n=Ca){let r=(0,I.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,I.useCallback)(()=>e?.get(),[e]);return(0,Sa.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function Ta(e){let t=va({warn:e?.router===void 0}),n=e?.router||t,r=(0,I.useRef)(void 0);return wa(n.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=sn(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}var Ea=I.createContext(void 0),Da=I.createContext(void 0);function Oa(e){let t=I.useContext(e.from?Da:Ea);return Ta({select:n=>{let r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(Dn(!((e.shouldThrow??!0)&&!r),`Could not find ${e.from?`an active match from "${e.from}"`:`a nearest match!`}`),r!==void 0)return e.select?e.select(r):r},structuralSharing:e.structuralSharing})}function ka(e){return Oa({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Aa(e){let{select:t,...n}=e;return Oa({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function ja(e){return Oa({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Ma(e){return Oa({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Na(e){let t=va();return I.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Pa(e){return Oa({...e,select:t=>e.select?e.select(t.context):t.context})}var Fa=We();function Ia(e,t){let n=va(),r=$t(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:m,children:h,target:g,disabled:_,style:v,className:y,onClick:b,onBlur:x,onFocus:S,onMouseEnter:C,onMouseLeave:w,onTouchStart:T,ignoreBlocker:E,params:D,search:O,hash:ee,state:te,mask:ne,reloadDocument:re,unsafeRelative:k,from:A,_fromLocation:ie,...ae}=e,oe=pa(),se=Ta({select:e=>{let t=e.matches[e.matches.length-1];return{search:t?.search,hash:e.location.hash,path:t?.pathname}},structuralSharing:!0}),ce=e.from,j=I.useMemo(()=>({...e,from:ce}),[n,se,ce,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),M=I.useMemo(()=>n.buildLocation({...j}),[n,j]),le=M.maskedLocation?M.maskedLocation.publicHref:M.publicHref,ue=M.maskedLocation?M.maskedLocation.external:M.external,de=I.useMemo(()=>Ga(le,ue,n.history,_),[_,ue,le,n.history]),fe=I.useMemo(()=>{if(de?.external)return vn(de.href,n.protocolAllowlist)?void 0:de.href;if(!Ka(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),vn(s,n.protocolAllowlist)?void 0:s}catch{}},[s,de,n.protocolAllowlist]),pe=Ta({select:e=>{if(fe)return!1;if(o?.exact){if(!nr(e.location.pathname,M.pathname,n.basepath))return!1}else{let t=tr(e.location.pathname,n.basepath),r=tr(M.pathname,n.basepath);if(!(t.startsWith(r)&&(t.length===r.length||t[r.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!fn(e.location.search,M.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?oe&&e.location.hash===M.hash:!0}}),me=pe?nn(i,{})??Ra:La,he=pe?La:nn(a,{})??La,ge=[y,me.className,he.className].filter(Boolean).join(` `),_e=(v||me.style||he.style)&&{...v,...me.style,...he.style},[N,ve]=I.useState(!1),ye=I.useRef(!1),be=e.reloadDocument||fe?!1:c??n.options.defaultPreload,xe=l??n.options.defaultPreloadDelay??0,Se=I.useCallback(()=>{n.preloadRoute({...j,_builtLocation:M}).catch(e=>{console.warn(e),console.warn(oa)})},[n,j,M]);Qt(r,I.useCallback(e=>{e?.isIntersecting&&Se()},[Se]),Ua,{disabled:!!_||be!==`viewport`}),I.useEffect(()=>{ye.current||!_&&be===`render`&&(Se(),ye.current=!0)},[_,Se,be]);let Ce=e=>{let t=e.currentTarget.getAttribute(`target`),r=g===void 0?t:g;if(!_&&!Ja(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Fa.flushSync)(()=>{ve(!0)});let t=n.subscribe(`onResolved`,()=>{t(),ve(!1)});n.navigate({...j,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:m,ignoreBlocker:E})}};if(fe)return{...ae,ref:r,href:fe,...h&&{children:h},...g&&{target:g},..._&&{disabled:_},...v&&{style:v},...y&&{className:y},...b&&{onClick:b},...x&&{onBlur:x},...S&&{onFocus:S},...C&&{onMouseEnter:C},...w&&{onMouseLeave:w},...T&&{onTouchStart:T}};let we=e=>{if(_||be!==`intent`)return;if(!xe){Se();return}let t=e.currentTarget;if(Ha.has(t))return;let n=setTimeout(()=>{Ha.delete(t),Se()},xe);Ha.set(t,n)},P=e=>{_||be!==`intent`||Se()},Te=e=>{if(_||!be||!xe)return;let t=e.currentTarget,n=Ha.get(t);n&&(clearTimeout(n),Ha.delete(t))};return{...ae,...me,...he,href:de?.href,ref:r,onClick:Wa([b,Ce]),onBlur:Wa([x,Te]),onFocus:Wa([S,we]),onMouseEnter:Wa([C,we]),onMouseLeave:Wa([w,Te]),onTouchStart:Wa([T,P]),disabled:!!_,target:g,..._e&&{style:_e},...ge&&{className:ge},..._&&za,...pe&&Ba,...oe&&N&&Va}}var La={},Ra={className:`active`},za={role:`link`,"aria-disabled":!0},Ba={"data-status":`active`,"aria-current":`page`},Va={"data-transitioning":`transitioning`},Ha=new WeakMap,Ua={rootMargin:`100px`},Wa=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Ga(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Ka(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var qa=I.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Ia(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return I.createElement(`a`,t,o)}return I.createElement(n,a,o)});function Ja(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Ya=class extends sa{constructor(e){super(e),this.useMatch=e=>Oa({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Pa({...e,from:this.id}),this.useSearch=e=>Ma({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ja({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Aa({...e,from:this.id}),this.useLoaderData=e=>ka({...e,from:this.id}),this.useNavigate=()=>Na({from:this.fullPath}),this.Link=I.forwardRef((e,t)=>(0,L.jsx)(qa,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function Xa(e){return new Ya(e)}var Za=class extends ca{constructor(e){super(e),this.useMatch=e=>Oa({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Pa({...e,from:this.id}),this.useSearch=e=>Ma({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ja({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Aa({...e,from:this.id}),this.useLoaderData=e=>ka({...e,from:this.id}),this.useNavigate=()=>Na({from:this.fullPath}),this.Link=I.forwardRef((e,t)=>(0,L.jsx)(qa,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function Qa(e){return new Za(e)}function $a(e){return typeof e==`object`?new eo(e,{silent:!0}).createRoute(e):new eo(e,{silent:!0}).createRoute}var eo=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=Xa(e);return t.isRoot=!1,t},this.silent=t?.silent}},to=class{constructor(e){this.useMatch=e=>Oa({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Pa({...e,from:this.options.id}),this.useSearch=e=>Ma({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ja({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>Aa({...e,from:this.options.id}),this.useLoaderData=e=>ka({...e,from:this.options.id}),this.useNavigate=()=>Na({from:va().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for(`react.memo`)}};function no(e){return typeof e==`object`?new to(e):t=>new to({id:e,...t})}function ro(e){let t=Ta({select:e=>`not-found-${e.location.pathname}-${e.status}`});return(0,L.jsx)(la,{getResetKey:()=>t,onCatch:(t,n)=>{if(cr(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(cr(t))return e.fallback?.(t);throw t},children:e.children})}function io(){return(0,L.jsx)(`p`,{children:`Not Found`})}function ao({children:e}){return va(),null}function oo(e){return(0,L.jsx)(L.Fragment,{children:e.children})}function so(e,t,n){return t.options.notFoundComponent?(0,L.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,L.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,L.jsx)(io,{})}function co(){let e=va();if(!e.isScrollRestoring||!0)return null;let t=(e.options.getScrollRestorationKey||pr)(e.latestLocation),n=t===pr(e.latestLocation)?void 0:t,r={storageKey:ur,shouldScrollRestoration:!0};return n&&(r.key=n),(0,L.jsx)(ao,{children:`(${gr.toString()})(${xn(JSON.stringify(r))})`})}var lo=I.memo(function({matchId:e}){let t=va(),n=Ta({select:t=>{let n=t.matches.findIndex(t=>t.id===e),r=t.matches[n];return Dn(r,`Could not find match for matchId "${e}". Please file an issue!`),{routeId:r.routeId,ssr:r.ssr,_displayPending:r._displayPending,resetKey:t.loadedAt,parentRouteId:t.matches[n-1]?.routeId}},structuralSharing:!0}),r=t.routesById[n.routeId],i=r.options.pendingComponent??t.options.defaultPendingComponent,a=i?(0,L.jsx)(i,{}):null,o=r.options.errorComponent??t.options.defaultErrorComponent,s=r.options.onCatch??t.options.defaultOnCatch,c=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,l=n.ssr===!1||n.ssr===`data-only`,u=(!r.isRoot||r.options.wrapInSuspense||l)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||l))?I.Suspense:oo,d=o?la:oo,f=c?ro:oo;return(0,L.jsxs)(r.isRoot?r.options.shellComponent??oo:oo,{children:[(0,L.jsx)(Ea.Provider,{value:e,children:(0,L.jsx)(u,{fallback:a,children:(0,L.jsx)(d,{getResetKey:()=>n.resetKey,errorComponent:o||da,onCatch:(t,n)=>{if(cr(t))throw t;_a(!1,`Error in route match: ${e}`),s?.(t,n)},children:(0,L.jsx)(f,{fallback:e=>{if(!c||e.routeId&&e.routeId!==n.routeId||!e.routeId&&!r.isRoot)throw e;return I.createElement(c,e)},children:l||n._displayPending?(0,L.jsx)(fa,{fallback:a,children:(0,L.jsx)(fo,{matchId:e})}):(0,L.jsx)(fo,{matchId:e})})})})}),n.parentRouteId===`__root__`&&t.options.scrollRestoration?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(uo,{}),(0,L.jsx)(co,{})]}):null]})});function uo(){let e=va(),t=I.useRef(void 0);return(0,L.jsx)(`script`,{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:`onRendered`,...Ji(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var fo=I.memo(function({matchId:e}){let t=va(),{match:n,key:r,routeId:i}=Ta({select:n=>{let r=n.matches.find(t=>t.id===e),i=r.routeId,a=(t.routesById[i].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:i,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return{key:a?JSON.stringify(a):void 0,routeId:i,match:{id:r.id,status:r.status,error:r.error,_forcePending:r._forcePending,_displayPending:r._displayPending}}},structuralSharing:!0}),a=t.routesById[i],o=I.useMemo(()=>{let e=a.options.component??t.options.defaultComponent;return e?(0,L.jsx)(e,{},r):(0,L.jsx)(V,{})},[r,a.options.component,t.options.defaultComponent]);if(n._displayPending)throw t.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw t.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status===`pending`){let e=a.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let r=t.getMatch(n.id);if(r&&!r._nonReactive.minPendingPromise){let t=pn();r._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),r._nonReactive.minPendingPromise=void 0},e)}}throw t.getMatch(n.id)?._nonReactive.loadPromise}if(n.status===`notFound`)return Dn(cr(n.error),`Expected a notFound error`),so(t,a,n.error);if(n.status===`redirected`)throw Dn(Or(n.error),`Expected a redirect error`),t.getMatch(n.id)?._nonReactive.loadPromise;if(n.status===`error`)throw n.error;return o}),V=I.memo(function(){let e=va(),t=I.useContext(Ea),n=Ta({select:e=>e.matches.find(e=>e.id===t)?.routeId}),r=e.routesById[n],i=Ta({select:e=>{let n=e.matches.find(e=>e.id===t);return Dn(n,`Could not find parent match for matchId "${t}"`),n.globalNotFound}}),a=Ta({select:e=>{let n=e.matches;return n[n.findIndex(e=>e.id===t)+1]?.id}}),o=e.options.defaultPendingComponent?(0,L.jsx)(e.options.defaultPendingComponent,{}):null;if(i)return so(e,r,void 0);if(!a)return null;let s=(0,L.jsx)(lo,{matchId:a});return n===`__root__`?(0,L.jsx)(I.Suspense,{fallback:o,children:s}):s});function po(){let e=va(),t=I.useRef({router:e,mounted:!1}),[n,r]=I.useState(!1),{hasPendingMatches:i,isLoading:a}=Ta({select:e=>({isLoading:e.isLoading,hasPendingMatches:e.matches.some(e=>e.status===`pending`)}),structuralSharing:!0}),o=Zt(a),s=a||n||i,c=Zt(s),l=a||i,u=Zt(l);return e.startTransition=e=>{r(!0),I.startTransition(()=>{e(),r(!1)})},I.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return $n(e.latestLocation.publicHref)!==$n(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),Xt(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),Xt(()=>{o&&!a&&e.emit({type:`onLoad`,...Ji(e.state)})},[o,e,a]),Xt(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Ji(e.state)})},[l,u,e]),Xt(()=>{if(c&&!s){let t=Ji(e.state);e.emit({type:`onResolved`,...t}),e.__store.setState(e=>({...e,status:`idle`,resolvedLocation:e.location})),t.hrefChanged&&vr(e)}},[s,c,e]),null}function mo(){let e=va(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,L.jsx)(t,{}):null,r=(0,L.jsxs)(typeof document<`u`&&e.ssr?oo:I.Suspense,{fallback:n,children:[(0,L.jsx)(po,{}),(0,L.jsx)(ho,{})]});return e.options.InnerWrap?(0,L.jsx)(e.options.InnerWrap,{children:r}):r}function ho(){let e=va(),t=Ta({select:e=>e.matches[0]?.id}),n=Ta({select:e=>e.loadedAt}),r=t?(0,L.jsx)(lo,{matchId:t}):null;return(0,L.jsx)(Ea.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,L.jsx)(la,{getResetKey:()=>n,errorComponent:da,onCatch:void 0,children:r})})}var go=e=>new _o(e),_o=class extends Xi{constructor(e){super(e)}};typeof globalThis<`u`?(globalThis.createFileRoute=$a,globalThis.createLazyFileRoute=no):typeof window<`u`&&(window.createFileRoute=$a,window.createLazyFileRoute=no);function vo({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,L.jsx)(ha.Provider,{value:e,children:t});return e.options.Wrap?(0,L.jsx)(e.options.Wrap,{children:r}):r}function yo({router:e,...t}){return(0,L.jsx)(vo,{router:e,...t,children:(0,L.jsx)(mo,{})})}var bo=Ke();function xo(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=xo(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function H(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=xo(e))&&(r&&(r+=` `),r+=t);return r}var So=/(?:^|\n)\s{0,3}#{0,6}\s*my request(?:\s+for\s+[^:\n]+)?\s*:?\s*/giu,Co=e=>e.replace(/[\\/]+$/u,``),wo=(e,t)=>`${Co(e)}/${t.replace(/^\/+/u,``)}`,To=(e,t)=>wo(t,e.uploadRootDirName),Eo=(e,t)=>wo(t,e.uploadFilesDirName),Do=(e,t,n)=>`${To(e,t)}/${n}`,Oo=(e,t,n)=>`${Eo(e,t)}/${n}`,ko=(e,t)=>`${e.localImagePath}?path=${encodeURIComponent(t)}`,Ao=(e,t)=>`${e.localBrowsePath}${encodeURI(t)}`,jo=e=>e.availability===`ready`,Mo={id:`antigravity`,displayName:`Antigravity`,description:`CLI provider scaffold for Antigravity sessions.`,transportLabel:`scaffolded CLI adapter`,availability:`scaffolded`,transportKind:`cli`,defaultModel:null,wsProxyPath:`/antigravity-ws`,authCompletePath:`/antigravity-auth/complete`,localImagePath:`/antigravity-local-image`,localBrowsePath:`/antigravity-local-browse/`,uploadRootDirName:`.antigravity-web/uploads`,uploadFilesDirName:`.antigravity-web/uploads/files`,requestHeading:`# My request for Antigravity:`,requestMarkerPattern:So},No={id:`codex`,displayName:`Codex`,description:`Live Codex bridge connected to the current Nomadex workspace.`,transportLabel:`local agent bridge`,availability:`ready`,transportKind:`bridge`,defaultModel:`gpt-5.4`,wsProxyPath:`/codex-ws`,authCompletePath:`/codex-auth/complete`,localImagePath:`/codex-local-image`,localBrowsePath:`/codex-local-browse/`,uploadRootDirName:`.codex-web/uploads`,uploadFilesDirName:`.codex-web/uploads/files`,requestHeading:`# My request:`,requestMarkerPattern:So},Po={id:`gemini-cli`,displayName:`Gemini CLI`,description:`CLI provider scaffold for Gemini CLI workspaces.`,transportLabel:`scaffolded CLI adapter`,availability:`scaffolded`,transportKind:`cli`,defaultModel:null,wsProxyPath:`/gemini-cli-ws`,authCompletePath:`/gemini-cli-auth/complete`,localImagePath:`/gemini-cli-local-image`,localBrowsePath:`/gemini-cli-local-browse/`,uploadRootDirName:`.gemini-cli-web/uploads`,uploadFilesDirName:`.gemini-cli-web/uploads/files`,requestHeading:`# My request for Gemini CLI:`,requestMarkerPattern:So},Fo={id:`github-copilot`,displayName:`GitHub Copilot`,description:`CLI provider scaffold for GitHub Copilot coding sessions.`,transportLabel:`scaffolded CLI adapter`,availability:`scaffolded`,transportKind:`cli`,defaultModel:null,wsProxyPath:`/github-copilot-ws`,authCompletePath:`/github-copilot-auth/complete`,localImagePath:`/github-copilot-local-image`,localBrowsePath:`/github-copilot-local-browse/`,uploadRootDirName:`.github-copilot-web/uploads`,uploadFilesDirName:`.github-copilot-web/uploads/files`,requestHeading:`# My request for GitHub Copilot:`,requestMarkerPattern:So},Io={id:`opencode`,displayName:`OpenCode`,description:`Headless OpenCode CLI turns through the local Nomadex bridge.`,transportLabel:`local OpenCode CLI`,availability:`ready`,transportKind:`cli`,defaultModel:`opencode/big-pickle`,installCommand:`npm i -g opencode-ai@latest`,wsProxyPath:`/codex-ws`,authCompletePath:`/codex-auth/complete`,localImagePath:`/codex-local-image`,localBrowsePath:`/codex-local-browse/`,uploadRootDirName:`.opencode-web/uploads`,uploadFilesDirName:`.opencode-web/uploads/files`,requestHeading:`# My request for OpenCode:`,requestMarkerPattern:So},Lo={id:`qwen-code`,displayName:`Qwen Code`,description:`Headless Qwen Code turns through the local Nomadex bridge.`,transportLabel:`local Qwen Code CLI`,availability:`ready`,transportKind:`cli`,defaultModel:`default`,installCommand:`npm i -g @qwen-code/qwen-code@latest`,wsProxyPath:`/codex-ws`,authCompletePath:`/codex-auth/complete`,localImagePath:`/codex-local-image`,localBrowsePath:`/codex-local-browse/`,uploadRootDirName:`.qwen-code-web/uploads`,uploadFilesDirName:`.qwen-code-web/uploads/files`,requestHeading:`# My request for Qwen Code:`,requestMarkerPattern:So},Ro=`nomadex-provider`,zo={codex:No,antigravity:Mo,"gemini-cli":Po,"github-copilot":Fo,opencode:Io,"qwen-code":Lo},Bo=`codex`,Vo=()=>Object.values(zo),Ho=(e=Bo)=>zo[e],Uo=e=>!!(e&&e in zo),Wo=()=>{if(typeof window>`u`)return Bo;let e=window.localStorage.getItem(Ro);return Uo(e)?e:Bo},Go=e=>{typeof window>`u`||window.localStorage.setItem(Ro,e)},Ko=(e,t)=>({reasoningEffort:e,description:t}),qo=(...e)=>e,Jo=({id:e,displayName:t,description:n,defaultReasoningEffort:r,supportedReasoningEfforts:i,inputModalities:a,isDefault:o=!1})=>({id:e,model:e,upgrade:null,upgradeInfo:null,availabilityNux:null,displayName:t,description:n,hidden:!1,supportedReasoningEfforts:i.map(e=>Ko(e,`${t} supports ${e} reasoning.`)),defaultReasoningEffort:r,inputModalities:a,supportsPersonality:!0,isDefault:o}),Yo=[],Xo=[Jo({id:`opencode/big-pickle`,displayName:`Big Pickle`,description:`OpenCode Zen free model. Limited-time free access.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`],inputModalities:qo(`text`),isDefault:!0}),Jo({id:`opencode/minimax-m2.5-free`,displayName:`MiniMax M2.5 Free`,description:`OpenCode Zen free model. Limited-time free access.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`],inputModalities:qo(`text`)}),Jo({id:`opencode/mimo-v2-pro-free`,displayName:`MiMo V2 Pro Free`,description:`OpenCode Zen free model. Limited-time free access.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`],inputModalities:qo(`text`)}),Jo({id:`opencode/mimo-v2-omni-free`,displayName:`MiMo V2 Omni Free`,description:`OpenCode Zen free model. Limited-time free access.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`],inputModalities:qo(`text`)}),Jo({id:`opencode/nemotron-3-super-free`,displayName:`Nemotron 3 Super Free`,description:`OpenCode Zen free model. Limited-time free access.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`],inputModalities:qo(`text`)})],Zo=(e,t)=>e===`opencode`?Xo:e===`codex`?t:Yo,Qo=(e,t,n)=>Zo(e,n).find(e=>e.id===t)??null,$o=/^##\s+(.+?):\s+(.+?)\s*$/,es=/^#\s*files mentioned by the user\s*:?\s*$/i;function ts(e){return e.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||e}function ns(e){if(!e||/\s/u.test(e)||e.endsWith(`/`)||e.endsWith(`\\`)||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;let t=e.startsWith(`/`),n=/^[A-Za-z]:[\\/]/u.test(e),r=e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`~/`),i=e.includes(`/`)||e.includes(`\\`);return t||n||r||i}function rs(e){if(!e)return null;let t=e,n=null,r=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(r)t=r[1],n=Number(r[2]);else{let e=t.match(/^(.*):(\d+)(?::\d+)?$/u);e&&(t=e[1],n=Number(e[2]))}return ns(t)?{path:t,line:n}:null}var is=e=>e.startsWith(`/`)||/^[A-Za-z]:[\\/]/u.test(e);function as(e,t){let n=e.trim();if(!n)return null;let r=Ho(t),i=rs(n);return!i?.path||!is(i.path)?null:{path:i.path,line:i.line,browseUrl:Ao(r,i.path)}}function os(e,t){let n=ts(e);return t===null?n:`${n}:${String(t)}`}function ss(e){if(!e.includes(`[`)||!e.includes(`](`))return[{kind:`text`,value:e}];let t=[],n=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,r=0;for(let i of e.matchAll(n)){let n=i[0],a=i[1]?.trim()??``,o=i[2]?.trim()??``,s=i.index??-1;if(s<0)continue;s>r&&t.push({kind:`text`,value:e.slice(r,s)});let c=rs(o);c?t.push({kind:`file`,value:a||o,path:c.path,line:c.line,displayPath:os(c.path,c.line),downloadName:ts(c.path)}):t.push({kind:`text`,value:n}),r=s+n.length}return r<e.length&&t.push({kind:`text`,value:e.slice(r)}),t.length>0?t:[{kind:`text`,value:e}]}function cs(e,t){ss(t).forEach(t=>{t.kind===`text`&&t.value.length===0||e.push(t)})}function ls(e){let t=e.split(`
11
+ `).findIndex(e=>es.test(e.trim()));if(t<0)return[];let n=e.split(`
12
+ `).slice(t+1),r=[],i=new Set;for(let e of n){let t=e.trim();if(!t)continue;let n=t.match($o);if(!n)break;let a=n[1]?.trim(),o=n[2]?.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,``);if(a&&o){let e=`${a.toLowerCase()}:${o}`;if(i.has(e))continue;i.add(e),r.push({label:a,path:o})}}return r}function us(e){return e.startsWith(`blob:`)||e.startsWith(`data:`)}function ds(e,t){let n=Ho(t).requestMarkerPattern,r=Array.from(e.matchAll(n));if(r.length===0)return e.trim();let i=r.at(-1);if(!i||typeof i.index!=`number`)return e.trim();let a=i.index+i[0].length;return e.slice(a).trim()}function fs(e,t){let n=[],r=[];for(let t of e.content)t.type===`text`&&typeof t.text==`string`&&t.text.length>0&&n.push(t.text),t.type===`image`&&typeof t.url==`string`&&t.url.trim().length>0&&r.push(t.url.trim()),t.type===`localImage`&&typeof t.path==`string`&&t.path.trim().length>0&&r.push(t.path.trim());let i=r.filter(e=>!us(e)),a=[...new Set(i.length>0?i:r)],o=n.join(`
13
+ `);return{text:ds(o,t),images:a,fileAttachments:ls(o)}}function ps(e){if(!e.includes("`"))return ss(e);let t=[],n=0,r=0;for(;n<e.length;){if(e[n]!=="`"){n+=1;continue}let i=1;for(;n+i<e.length&&e[n+i]==="`";)i+=1;let a="`".repeat(i),o=n+i,s=-1;for(;o<e.length;){let t=e.indexOf(a,o);if(t<0)break;let r=t>0&&e[t-1]==="`",c=t+i<e.length&&e[t+i]==="`",l=e.slice(n+i,t).includes(`
14
+ `);if(!r&&!c&&!l){s=t;break}o=t+1}if(s<0){n+=i;continue}n>r&&cs(t,e.slice(r,n));let c=e.slice(n+i,s);if(c.length>0){let e=rs(c);if(e){let n=os(e.path,e.line);t.push({kind:`file`,value:c,path:e.path,line:e.line,displayPath:n,downloadName:ts(e.path)})}else t.push({kind:`code`,value:c})}else t.push({kind:`text`,value:`${a}${a}`});n=s+i,r=n}return r<e.length&&cs(t,e.slice(r)),t}function ms(e,t){let n=e.trim();if(!n)return``;let r=Ho(t);if(n.startsWith(`data:`)||n.startsWith(`blob:`)||n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`${r.localImagePath}?`))return n;if(n.startsWith(`file://`))return ko(r,n);let i=n.startsWith(`/`),a=/^[A-Za-z]:[\\/]/u.test(n);return i||a?ko(r,n):n}function hs(e,t){let n=e.trim();if(!n)return`#`;let r=Ho(t),i=as(n,t);return i?i.browseUrl:is(n)?Ao(r,n):`#`}function gs(e,t){if(!e.includes(`![`)||!e.includes(`](`))return[{kind:`text`,value:e}];let n=[],r=/!\[([^\]]*)\]\(([^)\n]+)\)/gu,i=0;for(let a of e.matchAll(r)){let[r,o,s]=a;if(typeof a.index!=`number`)continue;let c=a.index,l=c+r.length,u=ms(s.trim(),t);u&&(c>i&&n.push({kind:`text`,value:e.slice(i,c)}),n.push({kind:`image`,url:u,alt:o.trim(),markdown:r}),i=l)}return i<e.length&&n.push({kind:`text`,value:e.slice(i)}),n.length>0?n:[{kind:`text`,value:e}]}function _s(e){if(!e)return[];let t=new Map;for(let n of e.items)if(n.type===`fileChange`)for(let e of n.changes){let r=e.path.trim();!r||r===`Editing files`||(t.has(r)&&t.delete(r),t.set(r,{itemId:n.id,path:r,kind:e.kind.type,status:n.status}))}return[...t.values()]}function vs(e){if(!e||e.status!==`inProgress`)return null;let t=[...e.items].reverse(),n=t.find(e=>e.type===`reasoning`),r=t.find(e=>e.type===`plan`),i=`Thinking`,a=[],o=`thinking`,s=`The agent is thinking through the next step`,c=n?[...n.summary,...n.content].filter(Boolean).join(`
15
+
16
+ `).trim():``,l=``;for(let e of t){if(e.type===`commandExecution`&&e.status===`inProgress`){i=`Running command`,o=`command`,s=`The agent is running a command`,e.command.trim()&&a.push(e.command.trim());break}if(e.type===`fileChange`&&e.status===`inProgress`){i=`Editing files`,o=`editing`,s=`The agent is editing files`,a.push(...e.changes.map(e=>e.path).filter(e=>!!e&&e!==`Editing files`).slice(0,2));break}if(e.type===`mcpToolCall`&&e.status===`inProgress`){i=`Using MCP tool`,o=`tool`,s=`The agent is using an MCP tool`,a.push([e.server,e.tool].filter(Boolean).join(` · `));break}if(e.type===`dynamicToolCall`&&e.status===`inProgress`){i=`Using tool`,o=`tool`,s=`The agent is using a tool`,e.tool.trim()&&a.push(e.tool.trim());break}if(e.type===`collabAgentToolCall`&&e.status===`inProgress`){i=`Calling subagent`,o=`agent`,s=`The agent is working with a subagent`,e.tool.trim()&&a.push(e.tool.trim());break}if(e.type===`webSearch`&&e.query.trim()){i=`Searching web`,o=`search`,s=`The agent is searching the web`,a.push(e.query.trim());break}if(e.type===`imageGeneration`&&e.status!==`completed`){i=`Generating image`,o=`image`,s=`The agent is generating an image`,e.revisedPrompt?.trim()&&a.push(e.revisedPrompt.trim());break}if(e.type===`agentMessage`){i=`Writing response`,o=`writing`,s=`The agent is writing the response`;break}if(e.type===`plan`){i=`Planning`,o=`thinking`,s=`The agent is planning the next steps`,e.text.trim()&&a.push(e.text.trim().split(`
17
+ `)[0]);break}if(e.type===`reasoning`){i=`Reasoning`,o=`thinking`,s=`The agent is reasoning about the next step`,e.summary[0]?.trim()&&a.push(e.summary[0].trim());break}}return o===`thinking`&&i===`Thinking`&&r?.text.trim()&&(i=`Planning`,s=`The agent is planning the next steps`,a.push(r.text.trim().split(`
18
+ `)[0])),e.error&&typeof e.error==`object`&&`message`in e.error&&(l=typeof e.error.message==`string`?e.error.message:``,o=`error`,s=`The agent hit an error`),{activityLabel:i,activityDetails:a.filter(Boolean),activityTone:o,statusText:s,reasoningText:c,errorText:l}}var ys=new Set([`main`,`master`,`trunk`]),bs=[`var(--ac)`,`var(--ac2)`,`var(--ac3)`,`var(--gn)`,`var(--og)`],xs=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`,Ss=e=>e.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??e,Cs=(e,t=42)=>{let n=e.replace(/\\/g,`/`);return xs(n.split(`/`).filter(Boolean).slice(-2).join(`/`)||n,t)},ws=e=>{let t=e?.trim();return t&&t.length>0?t:`workspace`},Ts=e=>{let t=e.trim();return t.match(/^(?:\/bin\/)?(?:bash|sh|zsh)\s+-lc\s+['"](.+)['"]$/u)?.[1]?.trim()||t},Es=e=>e.split(`
19
+ `).map(e=>e.trim()).find(Boolean)??``,Ds=e=>new Intl.DateTimeFormat([],{day:`2-digit`,month:`short`}).format(new Date(e*1e3)),Os=e=>{let t=new Date(`${e.trim()}T00:00:00`);return Number.isNaN(t.getTime())?e.trim():new Intl.DateTimeFormat([],{day:`2-digit`,month:`short`}).format(t)},ks=e=>e===`inProgress`||e===`active`?`current`:e===`completed`||e===`idle`||e===`applied`?`normal`:`muted`,As=e=>e.startsWith(`HEAD -> `)?e.slice(8).trim():e.startsWith(`tag: `)?e.slice(5).trim():e.trim();function js(e,t){let n=e.trim().replace(/^\(|\)$/gu,``);return n?n.split(`,`).map(e=>e.trim()).filter(Boolean).map((e,n)=>{let r=As(e),i=`other`,a=!1;return e.startsWith(`HEAD -> `)?(i=`head`,a=!0):e.startsWith(`tag: `)?i=`tag`:e.startsWith(`origin/`)||e.startsWith(`remotes/`)?i=`remote`:(i=`local`,a=r===t),{id:`${r}:${n}`,label:r,kind:i,active:a}}):[]}var Ms=(e,t)=>e.slice(0,6).map((e,n)=>{let r=`peer`;return ys.has(e)?r=`base`:e===t&&(r=`active`),{id:`lane:${e}`,label:e,accent:bs[n%bs.length],emphasis:r}}),Ns=(e,t)=>{let n=new Set;return t&&n.add(t),e.forEach(e=>{e.refs.forEach(e=>{e.kind===`tag`||e.kind===`other`||n.add(e.label)})}),[...n].some(e=>ys.has(e))||n.add(`main`),[...n]};function Ps(e){let t=[...new Set(e.changes.map(e=>e.path.trim()).filter(e=>e&&e!==`Editing files`))];return t.length===1?Cs(t[0]):t.length>1?`Changed ${String(t.length)} files`:e.status===`inProgress`?`Editing files`:`Applied patch`}function Fs(e){let t=e.thread.turns??[],n=t.at(-1)??null,r=t.flatMap(e=>e.items).reverse();for(let e of r){if(e.type===`commandExecution`)return{subject:xs(Ts(e.command),84),hint:e.status===`inProgress`?`Running command`:`Last command`,emphasis:ks(e.status)};if(e.type===`fileChange`)return{subject:Ps(e),hint:e.status===`inProgress`?`Editing files`:`File changes`,emphasis:ks(e.status)};if(e.type===`plan`)return{subject:xs(Es(e.text)||`Plan updated`,84),hint:`Plan step`,emphasis:ks(n?.status??null)};if(e.type===`reasoning`)return{subject:xs(e.summary[0]||e.content[0]||`Reasoning in progress`,84),hint:`Thinking`,emphasis:ks(n?.status??`inProgress`)};if(e.type===`agentMessage`)return{subject:xs(Es(e.text)||`Response updated`,84),hint:n?.status===`inProgress`?`Writing response`:`Last reply`,emphasis:ks(n?.status??null)}}return{subject:xs(e.thread.preview||e.thread.name||`Session activity`,84),hint:e.thread.status.type===`active`?`Active session`:`Session`,emphasis:ks(e.thread.status.type)}}function Is(e,t,n){let r=[],i=[...e.plan?.steps??[]].sort((e,t)=>{let n=e=>e===`inProgress`?0:e===`pending`?1:2;return n(e.status)-n(t.status)});for(let a of i){let i=xs(a.step.trim(),84);if(!(!i||n.has(`step:${i}`))&&(n.add(`step:${i}`),r.push({id:`active-step:${i}`,graph:t,subject:i,dateLabel:Ds(e.thread.updatedAt),author:`session`,sha:e.thread.gitInfo?.sha??`live`,refs:[],emphasis:ks(a.status),threadId:null,hint:`Plan · ${a.status===`inProgress`?`in progress`:a.status}`}),r.length>=2))break}let a=[...e.thread.turns].flatMap(e=>e.items).reverse().filter(e=>e.type===`fileChange`);for(let i of a){let a=Ps(i);if(!(!a||n.has(`file:${a}`))&&(n.add(`file:${a}`),r.push({id:`active-file:${i.id}`,graph:t,subject:a,dateLabel:Ds(e.thread.updatedAt),author:`workspace`,sha:e.thread.gitInfo?.sha??`live`,refs:[],emphasis:ks(i.status),threadId:null,hint:i.status===`inProgress`?`Editing files`:`Recent file change`}),r.length>=4))break}return r}var Ls=new Set([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),Rs=[`staged`,`unstaged`,`untracked`,`conflicted`],zs={staged:`Staged`,unstaged:`Unstaged`,untracked:`Untracked`,conflicted:`Conflicted`},Bs=e=>{let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1):t},Vs=e=>{let t=e.split(/\s+->\s+/u).map(e=>Bs(e));return t.length>=2?{originalPath:t[0]||null,path:t.at(-1)??e}:{originalPath:null,path:Bs(e)}},Hs=e=>{switch(e){case`A`:case`?`:return{badge:`new`,kind:`add`};case`M`:return{badge:`mod`,kind:`update`};case`D`:return{badge:`del`,kind:`delete`};case`R`:return{badge:`ren`,kind:`rename`};case`C`:return{badge:`cpy`,kind:`copy`};case`T`:return{badge:`typ`,kind:`type`};case`U`:return{badge:`cf`,kind:`conflict`};default:return{badge:`chg`,kind:`unknown`}}},Us=(e,t,n,r,i)=>{let a=Hs(n);e[t].push({id:`${t}:${n}:${i??``}:${r}`,path:r,originalPath:i,badge:a.badge,kind:a.kind})};function Ws(e){if(!e.trim())return null;let t={staged:[],unstaged:[],untracked:[],conflicted:[]};e.split(`
20
+ `).map(e=>e.replace(/\r$/u,``)).filter(Boolean).forEach(e=>{if(e.startsWith(`## `)||e.startsWith(`!! `))return;let n=e[0]??` `,r=e[1]??` `,i=e.slice(3).trim();if(!i)return;let{originalPath:a,path:o}=Vs(i);if(o){if(n===`?`&&r===`?`){Us(t,`untracked`,`?`,o,a);return}if(Ls.has(`${n}${r}`)){Us(t,`conflicted`,`U`,o,a);return}n!==` `&&Us(t,`staged`,n,o,a),r!==` `&&Us(t,`unstaged`,r,o,a)}});let n=Rs.flatMap(e=>t[e].length>0?[{id:e,label:zs[e],entries:t[e]}]:[]),r=n.length?n.map(e=>`${String(e.entries.length)} ${e.label.toLowerCase()}`).join(` · `):`Working tree clean`;return{dirty:n.length>0,summary:r,buckets:n}}function Gs(e){let{activeThread:t,rawLog:n,rawStatus:r=``}=e;if(!t||!n.trim())return null;let i=ws(t.thread.gitInfo?.branch),a=n.split(`
21
+ `).map(e=>e.replace(/\r$/u,``)).filter(Boolean).flatMap((e,n)=>{let r=e.split(``);if(r.length<6)return[];let a=r[0]??`*`,o=r[1]?.trim()??``,s=r[2]?.trim()??``,c=r[3]?.trim()??`unknown`,l=r[4]?.trim()??``,u=r.slice(5).join(``).trim()||`(no commit message)`,d=js(l,i),f=o===t.thread.gitInfo?.sha||d.some(e=>e.active);return[{id:`git:${o||n}`,graph:a,subject:u,dateLabel:Os(s),author:c,sha:o||`unknown`,refs:d,emphasis:f?`current`:`normal`,threadId:null,hint:l?l.replace(/^\(|\)$/gu,``):null}]});if(a.length===0)return null;let o=Ms(Ns(a,i),i);return{repoLabel:Ss(t.thread.cwd),branchLabel:i,commitLabel:t.thread.gitInfo?.sha??null,graphWidth:Math.max(...a.map(e=>e.graph.length),2),source:`git`,lanes:o,rows:a,workingTree:Ws(r)}}function Ks(e){let{activeThread:t,relatedThreads:n,rawStatus:r=``}=e;if(!t)return null;let i=ws(t.thread.gitInfo?.branch),a=Ss(t.thread.cwd),o=n.filter(e=>e.thread.cwd===t.thread.cwd),s=new Map;o.forEach(e=>{let t=ws(e.thread.gitInfo?.branch);s.has(t)||s.set(t,e)}),s.has(i)||s.set(i,t);let c=e=>e.thread.agentNickname?e.thread.agentNickname:e.thread.source===`appServer`?`workspace`:typeof e.thread.source==`string`?e.thread.source:`session`,l=[...s.keys()];l.some(e=>ys.has(e))||l.unshift(`main`),l.includes(i)||l.unshift(i);let u=Ms(l,i),d=new Map(u.map((e,t)=>[e.label,t])),f=new Set,p=[],m=[t,...o.filter(e=>e.thread.id!==t.thread.id)].filter(e=>d.has(ws(e.thread.gitInfo?.branch))).filter((e,t,n)=>{let r=ws(e.thread.gitInfo?.branch);return n.findIndex(e=>ws(e.thread.gitInfo?.branch)===r)===t});for(let e of m){let n=ws(e.thread.gitInfo?.branch);if(!d.has(n))continue;let r=Fs(e),a=`thread:${n}:${r.subject}`;if(f.has(a))continue;f.add(a);let o=d.get(n)??0;if(p.push({id:`thread:${e.thread.id}`,graph:[...u].map((e,t)=>t===o?`*`:`│`).join(` `),subject:r.subject,dateLabel:Ds(e.thread.updatedAt),author:c(e),sha:e.thread.gitInfo?.sha??`thread`,refs:[{id:`session-ref:${n}`,label:n,kind:ys.has(n)?`local`:`head`,active:n===i}],emphasis:e.thread.id===t.thread.id?`current`:r.emphasis,threadId:e.thread.id,hint:r.hint}),p.length>=4)break}if(p.length<4){let e=d.get(i)??0,n=[...u].map((t,n)=>n===e?`*`:`│`).join(` `);p.push(...Is(t,n,f))}return{repoLabel:a,branchLabel:i,commitLabel:t.thread.gitInfo?.sha??null,graphWidth:Math.max(...p.map(e=>e.graph.length),2),source:`session`,lanes:u,rows:p.slice(0,7),workingTree:Ws(r)}}var qs=`/home/allan/codex-console`,Js=Math.floor(Date.now()/1e3),Ys=(e,t)=>({reasoningEffort:e,description:t}),Xs=(...e)=>e,Zs=({id:e,displayName:t,description:n,defaultReasoningEffort:r,supportedReasoningEfforts:i,inputModalities:a,isDefault:o=!1})=>({id:e,model:e,upgrade:null,upgradeInfo:null,availabilityNux:null,displayName:t,description:n,hidden:!1,supportedReasoningEfforts:i.map(e=>Ys(e,`${t} supports ${e} reasoning.`)),defaultReasoningEffort:r,inputModalities:a,supportsPersonality:!0,isDefault:o}),Qs=[Zs({id:`gpt-5.4`,displayName:`gpt-5.4`,description:`Latest frontier agentic coding model.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`,`xhigh`],inputModalities:Xs(`text`,`image`),isDefault:!0}),Zs({id:`gpt-5.4-mini`,displayName:`GPT-5.4-Mini`,description:`Fast coding model for low-latency editing and subagent work.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`,`xhigh`],inputModalities:Xs(`text`,`image`)}),Zs({id:`gpt-5.3-codex`,displayName:`gpt-5.3-codex`,description:`Frontier code-optimized model for deep coding passes.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`,`xhigh`],inputModalities:Xs(`text`,`image`)}),Zs({id:`gpt-5.2-codex`,displayName:`gpt-5.2-codex`,description:`Strong baseline coding model with broad tool reliability.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`low`,`medium`,`high`,`xhigh`],inputModalities:Xs(`text`)}),Zs({id:`gpt-5.1-codex-mini`,displayName:`gpt-5.1-codex-mini`,description:`Cheap and responsive coding mini for fanout and tight loops.`,defaultReasoningEffort:`medium`,supportedReasoningEfforts:[`medium`,`high`],inputModalities:Xs(`text`)})],$s=[{id:`mention-shell`,name:`src/app/WorkspaceShell.tsx`,path:`${qs}/src/app/WorkspaceShell.tsx`,kind:`file`},{id:`mention-data`,name:`src/app/mockData.ts`,path:`${qs}/src/app/mockData.ts`,kind:`file`},{id:`mention-router`,name:`src/router.tsx`,path:`${qs}/src/router.tsx`,kind:`file`},{id:`mention-css`,name:`src/index.css`,path:`${qs}/src/index.css`,kind:`file`},{id:`mention-config`,name:`backend-config.toml`,path:`/home/allan/.codex/config.toml`,kind:`file`},{id:`mention-skills`,name:`backend-skills`,path:`/home/allan/.codex/skills`,kind:`directory`}],ec=[{id:`skill-frontend-design`,name:`frontend-design`,description:`Create distinctive, production-grade frontend interfaces.`,path:`/home/allan/.codex/skills/frontend-design/SKILL.md`,scope:`user`,enabled:!0,source:`installed`,tags:[`ui`,`react`,`polish`]},{id:`skill-suppliers-guard`,name:`suppliers-portal-docker-guard`,description:`Enforce Docker-based validation on SuppliersPortal changes.`,path:`/home/allan/.codex/skills/suppliers-portal-docker-guard/SKILL.md`,scope:`user`,enabled:!0,source:`installed`,tags:[`docker`,`validation`,`backend`]}],tc=[{id:`remote-openai-docs`,name:`openai-docs`,description:`Use official OpenAI documentation and current product guidance.`,path:`plugin://codex-market/openai-docs`,scope:`system`,enabled:!1,source:`remote`,tags:[`docs`,`api`,`official`],repo:`codex-marketplace/openai-docs`,downloads:`19.2k`},{id:`remote-skill-installer`,name:`skill-installer`,description:`Install curated or repository-backed workspace skills.`,path:`plugin://codex-market/skill-installer`,scope:`system`,enabled:!1,source:`remote`,tags:[`skills`,`install`,`marketplace`],repo:`codex-marketplace/skill-installer`,downloads:`11.8k`},{id:`remote-skill-creator`,name:`skill-creator`,description:`Generate and refine reusable workspace skills from a workflow.`,path:`plugin://codex-market/skill-creator`,scope:`system`,enabled:!1,source:`remote`,tags:[`skills`,`authoring`,`automation`],repo:`codex-marketplace/skill-creator`,downloads:`8.4k`}],nc=(e,t)=>({name:e,title:e,description:t,inputSchema:{type:`object`,additionalProperties:!0}}),rc=[{name:`github`,tools:{"issues.list":nc(`issues.list`,`List GitHub issues for a repository.`),"pull_requests.create":nc(`pull_requests.create`,`Open a pull request from a branch.`),"repo.read_file":nc(`repo.read_file`,`Read a file from a repository.`)},resources:[{name:`openai/codex issues`,title:`Issue Tracker`,description:`Latest issues for the upstream repository.`,uri:`repo://openai/codex/issues`}],resourceTemplates:[{name:`Repository File`,title:`Repository file`,uriTemplate:`repo://{owner}/{repo}/blob/{ref}/{path}`}],authStatus:`oAuth`},{name:`filesystem`,tools:{read_file:nc(`read_file`,`Read file contents.`),read_directory:nc(`read_directory`,`List directory contents.`),write_file:nc(`write_file`,`Write a file on disk.`)},resources:[{name:`workspace`,title:`Workspace root`,description:`Primary writable project directory.`,uri:`file://${qs}`}],resourceTemplates:[],authStatus:`unsupported`},{name:`playwright`,tools:{browser_open:nc(`browser_open`,`Open a browser page.`),browser_click:nc(`browser_click`,`Click an element.`),browser_snapshot:nc(`browser_snapshot`,`Capture a viewport snapshot.`)},resources:[],resourceTemplates:[],authStatus:`unsupported`},{name:`supabase`,tools:{"sql.query":nc(`sql.query`,`Run a SQL query.`),"functions.deploy":nc(`functions.deploy`,`Deploy an edge function.`)},resources:[],resourceTemplates:[],authStatus:`notLoggedIn`}],ic=[{name:`multi_agent`,stage:`stable`,enabled:!0},{name:`shell_tool`,stage:`stable`,enabled:!0},{name:`skill_mcp_dependency_install`,stage:`stable`,enabled:!0},{name:`guardian_approval`,stage:`beta`,enabled:!1},{name:`realtime_conversation`,stage:`underDevelopment`,enabled:!1},{name:`responses_websockets_v2`,stage:`underDevelopment`,enabled:!1},{name:`image_generation`,stage:`underDevelopment`,enabled:!1}],ac=Wo(),oc={provider:ac,model:Ho(ac).defaultModel??`gpt-5.4`,reasoningEffort:`xhigh`,approvalPolicy:`on-request`,sandboxMode:`workspace-write`,collaborationMode:`default`,personality:`pragmatic`,webSearch:!0,analytics:!0,hideRateLimitNudge:!0},sc=[{name:`Default`,mode:`default`,model:`gpt-5.4`,effort:`medium`},{name:`Plan`,mode:`plan`,model:`gpt-5.4`,effort:`xhigh`}],cc={planType:`ChatGPT Pro`,workspace:`allan@local`,authMode:`chatgpt`,loggedIn:!0,requiresOpenaiAuth:!1,loginInProgress:!1,pendingLoginId:null,loginError:null,rateUsed:68,rateLimit:100,credits:`Remote metered, local tools unrestricted`,usageWindows:[{id:`five-hour`,label:`5-hour`,usedPercent:68,windowDurationMins:300,resetsAt:Js+5400},{id:`weekly`,label:`Weekly`,usedPercent:41,windowDurationMins:1440*7,resetsAt:Js+3600*24*3}]},lc=e=>({type:`text`,text:e,text_elements:[]}),uc=e=>({type:`mention`,name:e.name,path:e.path}),dc=e=>({type:`skill`,name:e.name,path:e.path}),fc=e=>({type:`image`,url:e}),pc=(e,t,n,r,i,a,o=0)=>({key:`${n}:${r}`,threadId:e,turnId:t,itemId:n,field:r,total:i.length,visible:o,speed:a});uc($s[1]),dc(ec[0]),[`added 194 packages`,`audited 195 packages in 11s`,`0 vulnerabilities`].join(`
22
+ `),[`The workspace is structured around real thread and tool concepts instead of generic chat UI.`,``,`This pass locks in the shell, stream-safe item renderers, and the operating surfaces for approvals, subagents, skills, MCP, and settings.`,``,`Next I’d tighten the live response cadence and the steer application flow so follow-up turns feel closer to the extension.`].join(`
23
+ `);var mc=[{type:`userMessage`,id:`item-user-2`,content:[lc(`Keep the shell dense like the extension. Show model switching, approvals, live terminals, code review, and steer application without hiding them behind too many clicks.`)]},{type:`reasoning`,id:`item-reason-2`,summary:[`Expose operational state inline, not in modal flows.`,`Stream the answer while terminals and approvals update beside it.`],content:[`Dedicate the right rail to stateful operational panels and keep the center stack focused on the active turn.`,`Treat steer as a first-class composer affordance instead of a buried setting.`]},{type:`plan`,id:`item-plan-2`,text:`Finish the message stream animation, pin the inspector tabs, surface review and model reroute states, then polish mobile collapse behavior.`},{type:`commandExecution`,id:`item-cmd-2`,command:`npm run build`,cwd:qs,processId:`pty-22097`,status:`inProgress`,commandActions:[{type:`unknown`,command:`npm run build`}],aggregatedOutput:[`> nomadex@0.0.0 build`,`> tsc -b && vite build`,``,`vite v8.0.1 building for production...`,`transforming modules...`,`rendering chunks...`].join(`
24
+ `),exitCode:null,durationMs:null},{type:`mcpToolCall`,id:`item-mcp-2`,server:`github`,tool:`issues.list`,status:`completed`,arguments:{owner:`openai`,repo:`codex`,label:`ui`},result:{content:[{issue_count:6,open_threads:2}],structuredContent:{issues:[{id:412,title:`Stream delta cursor feels late on long answers`},{id:408,title:`Inspector tabs should preserve selection per thread`}]}},error:null,durationMs:426},{type:`collabAgentToolCall`,id:`item-agentcall-2`,tool:`wait`,status:`inProgress`,senderThreadId:`thread-ui-shell`,receiverThreadIds:[`thread-agent-render`],prompt:`Wait for inspector polish checks.`,model:`gpt-5.4-mini`,reasoningEffort:`medium`,agentsStates:{"thread-agent-render":{status:`running`,message:`Verifying compact layout and keyboard affordances.`}}},{type:`imageGeneration`,id:`item-imagegen-1`,status:`completed`,revisedPrompt:`Generate a muted dark control-room moodboard with VS Code density and sharper hierarchy.`,result:`Moodboard ready in the design tray.`},{type:`agentMessage`,id:`item-agent-2`,phase:`commentary`,text:[`The live shell is nearly there.`,``,`I’m keeping the center column focused on the active turn while the inspector carries approvals, background terminals, subagent state, skill install flows, MCP auth, and settings mutations. The next step is smoothing the final stream so the response and steer application feel immediate instead of bolted on.`].join(`
25
+ `)}];[`Findings`,`1. High: stream completion can leave the latest turn visually active if no terminal delta is attached.`,`2. Medium: installed skill toggles do not currently annotate the next turn payload.`,`3. Low: the inspector tab focus treatment relies mostly on color contrast.`].join(`
26
+ `),Js-3600,Js-8,`${qs}`,`${qs}`,`${qs}`,`${qs}`,`${qs}`,`${qs}`,`${qs}`,Js-9800,Js-420,`${qs}`,Js-1300,Js-42,Js-24200,Js-5100,`${qs}`,Js-40200,Js-8200,`${qs}`;var hc=mc.find(e=>e.id===`item-cmd-2`&&e.type===`commandExecution`),gc=mc.find(e=>e.id===`item-agent-2`&&e.type===`agentMessage`);pc(`thread-ui-shell`,`turn-shell-2`,`item-cmd-2`,`aggregatedOutput`,hc?.aggregatedOutput??``,16),pc(`thread-ui-shell`,`turn-shell-2`,`item-agent-2`,`text`,gc?.text??``,9);var _c=e=>({providerId:e.id,status:`unknown`,summary:e.transportKind===`cli`?`Not checked yet.`:`Managed by the Nomadex bridge.`,detail:null,installed:e.transportKind===`cli`?!1:null,configured:null,authenticated:null,version:null,sourcePath:null,checkedAt:null}),vc=e=>({providerId:e.id,status:`idle`,flow:null,summary:e.transportKind===`cli`?`No sign-in in progress.`:`Managed by the Nomadex bridge.`,detail:null,authUrl:null,userCode:null,processId:null,startedAt:null,updatedAt:null}),yc=(e=Vo())=>Object.fromEntries(e.map(e=>[e.id,_c(e)])),bc=(e=Vo())=>Object.fromEntries(e.map(e=>[e.id,vc(e)])),xc={threads:[],providers:Vo(),providerSetup:yc(),providerAuth:bc(),models:Qs,collaborationModes:sc,settings:oc,installedSkills:ec,remoteSkills:tc,mcpServers:rc,featureFlags:ic,account:cc,mentionCatalog:$s,directoryCatalog:$s,directoryCatalogRoot:qs,lastSavedAt:`just now`,streams:[],remoteSkillsError:null,transport:{mode:`mock`,status:`offline`,endpoint:`ws://127.0.0.1:3901`,error:`Local agent bridge is not connected.`}},Sc=()=>structuredClone(xc),Cc=(e,t,n,r=qs)=>({thread:{id:e,preview:t,ephemeral:!1,modelProvider:n.provider,createdAt:Math.floor(Date.now()/1e3),updatedAt:Math.floor(Date.now()/1e3),status:{type:`idle`},path:null,cwd:r,cliVersion:`0.115.0`,source:`appServer`,agentNickname:null,agentRole:null,gitInfo:null,name:t,turns:[]},plan:{explanation:`New ${n.collaborationMode} thread initialized for ${t}.`,steps:[{step:`Capture the goal`,status:`completed`},{step:`Run the first turn`,status:`pending`}]},steers:[],steerSuggestions:[`Keep the first answer brief and gather context fast.`,`Prefer concrete file references over generic guidance.`],approvals:[],terminals:[],reroutes:[],review:[],tokenUsage:{input:0,output:0,cached:0}}),wc=e=>{let t=e.trim().replace(/\s+/g,` `);return t.length<=88?t:`${t.slice(0,85)}...`},Tc=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,Ec=({threadId:e,prompt:t,mode:n,settings:r,mentions:i,skills:a,images:o,steer:s})=>{let c=Tc(`turn`),l=Tc(`item-user`),u=Tc(`item-reason`),d=Tc(`item-plan`),f=Tc(`item-cmd`),p=Tc(`item-agent`),m=Tc(`item-review-enter`),h=Tc(`item-review-exit`),g=Tc(`item-collab`),_=wc(t||`Refine the active thread.`),v=[{type:`userMessage`,id:l,content:[lc(t||`Continue the active task.`),...i.map(uc),...a.map(dc),...o.map(e=>fc(e.url))]}],y={type:`reasoning`,id:u,summary:[r.collaborationMode===`plan`?`Stay explicit about the work plan and live state.`:`Keep the response concise and directly actionable.`,s?`Honor steer: ${s}`:`No extra steer applied.`],content:[`Drive the next turn around: ${_}`,`Preserve the workspace surfaces for terminals, approvals, subagents, and config mutations.`]},b={explanation:n===`review`?`Run the review pass, classify findings, and keep the summary secondary.`:`Execute the active turn while keeping the shell, inspector, and composer in sync.`,steps:n===`review`?[{step:`Scan the changed surfaces`,status:`completed`},{step:`Classify the top findings`,status:`inProgress`},{step:`Draft the review summary`,status:`pending`}]:[{step:`Interpret the new request`,status:`completed`},{step:`Update the active workspace surfaces`,status:`inProgress`},{step:`Stream the final response`,status:`pending`}]},x={type:`plan`,id:d,text:b.explanation},S=n===`review`?`agent review --json`:r.webSearch?`npm run build && agent --search`:`npm run build`,C=n===`review`?[`{`,` "summary": "3 findings, 1 high severity",`,` "focus": ["stream lifecycle", "composer attachments", "panel selection"]`,`}`].join(`
27
+ `):[`> tsc -b && vite build`,`transforming modules...`,`rendering chunks...`,`inspector panels synchronized`,`stream delta cursor stabilized`].join(`
28
+ `),w={type:`commandExecution`,id:f,command:S,cwd:qs,processId:Tc(`pty`),status:`inProgress`,commandActions:[{type:`unknown`,command:S}],aggregatedOutput:C,exitCode:null,durationMs:null},T=r.collaborationMode===`plan`?(()=>{let t=Tc(`thread-agent`);return{type:`collabAgentToolCall`,id:g,tool:`spawnAgent`,status:`inProgress`,senderThreadId:e,receiverThreadIds:[t],prompt:`Check the inspector and terminal surfaces for any layout drift.`,model:`gpt-5.4-mini`,reasoningEffort:`medium`,agentsStates:{[t]:{status:`running`,message:`Reviewing compact layout and stream timing.`}}}})():null,E=n===`review`?[s?`Steer applied: ${s}`:`Review mode active.`,``,`Primary findings`,`1. High: ${_} introduces a stream lifecycle gap when the last turn has no terminal delta.`,`2. Medium: composer skill attachments are shown in the UI but not yet fed into the next simulated turn payload.`,`3. Low: settings cards should persist section focus when you jump back into chat mode.`].join(`
29
+ `):[s?`Steer applied: ${s}`:`Turn accepted.`,``,`I’m steering the next pass around: ${_}`,``,`Active surfaces`,`- chat stream remains live while the build terminal updates`,`- approvals and subagent state stay visible in the inspector`,`- model, effort, skills, MCP, and settings continue to mutate from the same shell`,``,`If you want, the next iteration can replace the mock transport with a real local app-server websocket bridge.`].join(`
30
+ `),D={type:`agentMessage`,id:p,phase:n===`review`?`final_answer`:`commentary`,text:E},O=wc(t||`Review the current UI pass.`),ee=n===`review`?[{id:Tc(`finding`),severity:`high`,title:`Turn completion depends on stream bookkeeping`,file:`${qs}/src/app/WorkspaceShell.tsx`,line:782,summary:`The review request "${O}" exposed a path where the latest turn can remain active after the last delta renders.`,status:`open`},{id:Tc(`finding`),severity:`medium`,title:`Skill attachments are visible but not persisted`,file:`${qs}/src/app/WorkspaceShell.tsx`,line:635,summary:`Installed skills are rendered as composer chips, but the simulated next turn does not yet use them as execution context.`,status:`open`}]:[];return{turn:{id:c,items:[...v,...n===`review`?[{type:`enteredReviewMode`,id:m,review:`Generated review turn`}]:[],y,x,w,...T?[T]:[],D,...n===`review`?[{type:`exitedReviewMode`,id:h,review:`Review turn completed`}]:[]],status:`inProgress`,error:null},plan:b,streams:[pc(e,c,f,`aggregatedOutput`,C,18),pc(e,c,p,`text`,E,10)],terminals:n===`review`?[{id:Tc(`terminal-review`),title:`Review runner`,command:S,cwd:qs,processId:Tc(`pty`),status:`running`,background:!1,lastEvent:`just now`,log:[`$ agent review --json`,`reviewing changed files...`,`assembling findings...`]}]:[{id:Tc(`terminal-build`),title:`Turn build`,command:S,cwd:qs,processId:Tc(`pty`),status:`running`,background:!0,lastEvent:`just now`,log:[`$ npm run build`,`transforming modules...`,`updating live workspace shell...`]}],review:ee}},Dc=`.nomadex/project.json`,Oc=3e3,kc=16e3,Ac=(e,t)=>{let n=e.trim();return n.length<=t?n||`(empty)`:`${n.slice(0,t).trimEnd()}\n\n[truncated]`},jc=(e,t)=>{let n=e&&typeof e==`object`&&!Array.isArray(e)?e:{},r=(n.commitAssistant&&typeof n.commitAssistant==`object`&&!Array.isArray(n.commitAssistant)?n.commitAssistant:{}).provider;return{version:1,commitAssistant:{provider:r===`codex`||r===`antigravity`||r===`opencode`||r===`qwen-code`||r===`gemini-cli`||r===`github-copilot`?r:t}}},Mc=e=>`${JSON.stringify(e,null,2)}\n`,Nc=({scope:e,status:t,diffStat:n,diff:r})=>[`Generate a git commit message for the current repository state.`,``,`Follow the commit-work workflow:`,`- inspect the actual change set before writing`,`- do not invent files, behavior, or reasons that are not supported by the status or diff`,`- use Conventional Commits`,`- keep the subject line specific and concise`,`- add a short body only when it adds useful why/context`,``,e===`staged`?`Write the commit message for the staged changes only. Ignore unstaged and untracked files.`:`No files are currently staged. Write the commit message for the full working tree changes because the commit action will stage all pending files before running git commit.`,``,`Return only this envelope and nothing else:`,`<commit_message>`,`type(scope): short summary`,``,`optional body paragraph`,`</commit_message>`,``,`## Git status`,t.trim()||`(empty)`,``,`## Diff stat`,Ac(n,Oc),``,`## Diff`,Ac(r,kc)].join(`
31
+ `),Pc=e=>{let t=e.replace(/\r/g,``).trim();if(!t)return``;let n=t.match(/<commit_message>\s*([\s\S]*?)\s*<\/commit_message>/i);if(n?.[1])return n[1].trim();let r=t.match(/```(?:text|md|markdown)?\n([\s\S]*?)```/i);if(r?.[1])return r[1].trim();let i=t.split(`
32
+ `),a=i.findIndex(e=>/^[a-z]+(?:\([^)]+\))?!?:\s+\S+/u.test(e.trim()));return a>=0?i.slice(a).join(`
33
+ `).trim():t},Fc=e=>e.replace(/\r/g,``).trim().split(/\n\s*\n/u).map(e=>e.trim()).filter(Boolean),Ic=e=>typeof window>`u`?`ws://127.0.0.1:3901`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${e.wsProxyPath}`,Lc=e=>{let t=[],n=e=>{!e||t.includes(e)||t.push(e)};return typeof window>`u`?(n(void 0),n(`ws://127.0.0.1:3901`),t):(n(void 0),n(Ic(e)),t)},Rc=e=>Lc(e)[0]??`ws://127.0.0.1:3901`,zc=e=>`${e.displayName} is scaffolded in Nomadex but its transport is not wired yet.`,Bc=`nomadex-thread-steers`,Vc=24,Hc=`local-provider:`,Uc=`external-agent:`,Wc=8,Gc=12e3,Kc=e=>e.startsWith(Hc),qc=e=>`${Hc}${e}:${Date.now().toString(36)}`,Jc=e=>e===`opencode`||e===`qwen-code`,Yc=[`Keep the answer terse and operational.`,`Call out blockers before proposing polish.`,`Prefer concrete file references over abstractions.`],Xc=[`untrusted`,`on-failure`,`on-request`,`never`],Zc=[`none`,`friendly`,`pragmatic`],Qc=e=>e??[],$c=()=>`just now`,el=()=>typeof window<`u`&&window.localStorage!==void 0,tl=e=>{if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.id==`string`?t.id.trim():``,r=typeof t.turnId==`string`?t.turnId.trim():``,i=typeof t.prompt==`string`?t.prompt.trim():``,a=typeof t.createdAt==`number`&&Number.isFinite(t.createdAt)?t.createdAt:Date.now();return!n||!r||!i?null:{id:n,turnId:r,prompt:i,createdAt:a,status:`applied`}},nl=()=>{if(!el())return{};try{let e=window.localStorage.getItem(Bc);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:Object.fromEntries(Object.entries(t).flatMap(([e,t])=>{if(!Array.isArray(t))return[];let n=t.map(tl).filter(e=>!!e).slice(0,Vc);return n.length>0?[[e,n]]:[]}))}catch{return{}}},rl=e=>nl()[e]??[],il=(e,t)=>{if(el())try{let n=nl(),r=(t??[]).filter(e=>e.status===`applied`).slice(0,Vc).map(({id:e,turnId:t,prompt:n,createdAt:r})=>({id:e,turnId:t,prompt:n,createdAt:r}));r.length===0?delete n[e]:n[e]=r.map(e=>({...e,status:`applied`})),window.localStorage.setItem(Bc,JSON.stringify(n))}catch{}},al=(...e)=>{let t=new Map;for(let n of e)for(let e of n??[]){let n=t.get(e.id);if(!n){t.set(e.id,e);continue}t.set(e.id,{...n,...e,status:e.status===`applied`||n.status===`applied`?`applied`:`pending`,createdAt:Math.max(n.createdAt,e.createdAt)})}return[...t.values()].sort((e,t)=>t.createdAt-e.createdAt).slice(0,Vc)},ol=e=>{let t=e.prompt.trim().replace(/\s+/g,` `);if(t)return t;let n=[];return e.files.length>0&&n.push(`${e.files.length} file${e.files.length===1?``:`s`}`),e.images.length>0&&n.push(`${e.images.length} image${e.images.length===1?``:`s`}`),e.mentions.length>0&&n.push(`${e.mentions.length} mention${e.mentions.length===1?``:`s`}`),e.skills.length>0&&n.push(`${e.skills.length} skill${e.skills.length===1?``:`s`}`),n.length>0?`Steer with ${n.join(`, `)}`:`Steer applied`},sl=(e,t,n,r)=>({id:`steer:${e}:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,turnId:t,prompt:ol(n),createdAt:Date.now(),status:r}),cl=e=>e.charAt(0).toUpperCase()+e.slice(1),U=(e,t=``)=>typeof e==`string`?e:t,ll=`\x1B`,ul=RegExp(`${ll}\\[[0-9;]*m`,`gu`),dl=e=>e.replace(ul,``),fl=(e,t=12e3)=>e.length>t?e.slice(-t):e,pl=[`accept`,`acceptForSession`,`decline`,`cancel`],ml=e=>pl.includes(e),hl=e=>{if(typeof e==`string`)return ml(e)?e:null;if(!e||typeof e!=`object`)return null;let t=Object.keys(e)[0];return t&&ml(t)?t:null},gl=(e,t)=>{let n=Qc(e).map(e=>hl(e)).filter(e=>!!e);return[...new Set(n.length>0?n:t)]},_l=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).join(` `).trim():``,vl=e=>{let t=[];e?.network?.enabled&&t.push(`Network access`);let n=Qc(e?.fileSystem?.read).filter(e=>typeof e==`string`);n.length>0&&t.push(`Read access: ${n.join(`, `)}`);let r=Qc(e?.fileSystem?.write).filter(e=>typeof e==`string`);if(r.length>0&&t.push(`Write access: ${r.join(`, `)}`),e?.macos?.accessibility&&t.push(`macOS accessibility access`),e?.macos?.calendar&&t.push(`macOS calendar access`),e?.macos?.contacts&&e.macos.contacts!==`none`&&t.push(`macOS contacts: ${e.macos.contacts}`),e?.macos?.launchServices&&t.push(`macOS launch services`),e?.macos?.preferences&&e.macos.preferences!==`none`&&t.push(`macOS preferences: ${e.macos.preferences}`),e?.macos?.reminders&&t.push(`macOS reminders access`),e?.macos?.automations===`all`)t.push(`macOS automation: all apps`);else if(e?.macos?.automations&&typeof e.macos.automations==`object`&&`bundle_ids`in e.macos.automations){let n=Qc(e.macos.automations.bundle_ids).filter(e=>typeof e==`string`);n.length>0&&t.push(`macOS automation: ${n.join(`, `)}`)}return t},yl=e=>e===`accept`||e===`acceptForSession`?`approved`:`declined`,bl=e=>{switch(e){case`accept`:return`approved`;case`acceptForSession`:return`approved_for_session`;case`cancel`:return`abort`;default:return`denied`}},xl=e=>e.match(/https:\/\/[^\s"'<>`|│)]+/gu)?.at(-1)??null,Sl=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t}])),Cl=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t}])),wl=(e,t)=>{if(e===`opencode`){let e=t.match(/https:\/\/opencode\.ai\/auth[^\s"'<>`|│)]*/iu)?.[0]??xl(t),n=/Create an api key at/iu.test(t)||/Enter your API key/iu.test(t);return{status:e||n?`waiting`:`starting`,summary:e||n?`Open OpenCode Zen auth, then paste the API key below.`:`Preparing the OpenCode Zen sign-in…`,detail:e||n?`Keep this panel open. Nomadex will send the API key to the local OpenCode CLI and verify the Zen session automatically.`:`Waiting for the local OpenCode CLI to request its Zen API key.`,authUrl:e??null,userCode:null}}if(e===`qwen-code`){let e=t.match(/https:\/\/chat\.qwen\.ai\/authorize\?[^\s"'<>`|│)]+/iu)?.[0]??xl(t),n=t.match(/[?&]user_code=([A-Z0-9-]+)/iu)?.[1]??(()=>{if(!e)return null;try{return new URL(e).searchParams.get(`user_code`)}catch{return null}})();return{status:e?`waiting`:`starting`,summary:e?`Open the Qwen authorization page to finish sign-in.`:`Preparing the Qwen OAuth sign-in…`,detail:e?`Keep this panel open. Nomadex will verify the local session automatically when the CLI completes.`:`Waiting for the local Qwen CLI to publish its authorization URL.`,authUrl:e??null,userCode:n??null}}return{status:`starting`,summary:`Preparing provider sign-in…`,detail:`Waiting for the local CLI sign-in flow to start.`,authUrl:null,userCode:null}},Tl=e=>e instanceof Error&&e.message.trim()?e.message:e&&typeof e==`object`&&`data`in e&&e.data&&typeof e.data==`object`&&`message`in e.data&&typeof e.data.message==`string`?e.data.message:``,El=e=>{let t=Tl(e).toLowerCase();return t.includes(`enoent`)||t.includes(`not found`)},Dl=e=>new Promise(t=>{window.setTimeout(t,e)}),Ol=e=>e.replace(/[\\/]+$/u,``),kl=e=>e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`,Al=(e,...t)=>{let n=kl(e),r=Ol(e),i=t.flatMap(e=>e.split(/[\\/]+/u)).filter(Boolean).join(n);return i?`${r}${n}${i}`:r},jl=e=>{let t=Ol(e),n=kl(t),r=t.lastIndexOf(n);return r<=0?t:t.slice(0,r)},Ml=e=>{let t=Tl(e).toLowerCase();return t.includes(`no rollout found for thread id`)||t.includes(`not materialized yet`)},Nl=e=>({name:e.name,stage:e.stage,enabled:e.enabled}),Pl=(e,t)=>typeof e==`string`&&Xc.includes(e)?e:t,Fl=(e,t)=>typeof e==`string`&&Zc.includes(e)?e:t,Il=e=>{let t=Tl(e).match(/model provider\s+[`'"]?([^`'"\n]+)[`'"]?\s+not found/i);return t?.[1]&&Uo(t[1].trim())?t[1].trim():null},Ll=(e,t)=>{let n=`notice`in e&&typeof e.notice==`object`&&e.notice?e.notice:null,r=e.analytics&&typeof e.analytics==`object`&&`enabled`in e.analytics?!!e.analytics.enabled:t.analytics;return{provider:t.provider,model:e.model??t.model,reasoningEffort:e.model_reasoning_effort??t.reasoningEffort,approvalPolicy:Pl(e.approval_policy,t.approvalPolicy),sandboxMode:e.sandbox_mode??t.sandboxMode,collaborationMode:`default`,personality:Fl(e.personality,t.personality),webSearch:e.web_search?e.web_search!==`disabled`:t.webSearch,analytics:r,hideRateLimitNudge:n&&typeof n==`object`&&`hide_rate_limit_model_nudge`in n?!!n.hide_rate_limit_model_nudge:t.hideRateLimitNudge}},Rl=(e,t)=>e?.credits?e.credits.unlimited?`Unlimited credits`:e.credits.hasCredits?`${e.credits.balance} credits`:`No credits`:t,zl=(e,t)=>e===300?`5-hour`:e===1440*7?`Weekly`:e&&e%1440==0?`${e/1440}-day`:e&&e%60==0?`${e/60}-hour`:e?`${e}-minute`:t===0?`Primary`:`Secondary`,Bl=(e,t)=>{if(!e)return t;let n=[e.primary,e.secondary].filter(e=>!!e).map((t,n)=>({id:`${e.limitId??`codex`}-${t.windowDurationMins??n}-${n}`,label:zl(t.windowDurationMins,n),usedPercent:Number(t.usedPercent??0),windowDurationMins:t.windowDurationMins??null,resetsAt:t.resetsAt??null})).sort((e,t)=>(e.windowDurationMins??2**53-1)-(t.windowDurationMins??2**53-1));return n.length>0?n:t},Vl=(e,t)=>({...e,rateUsed:Number(t?.primary?.usedPercent??e.rateUsed),rateLimit:100,credits:Rl(t,e.credits),usageWindows:Bl(t,e.usageWindows)}),Hl=(e,t,n)=>{let r=t?.rateLimits??null,i=e?.account??null,a=i?.type===`chatgpt`?i.email:i?.type===`apiKey`?`API key`:n.workspace,o=i?.type===`chatgpt`?`ChatGPT ${cl(i.planType)}`:i?.type===`apiKey`?`API key`:n.loginInProgress?n.planType:`Signed out`,s=i?a:n.loginInProgress?n.workspace:`No active account`;return{...Vl(n,r),planType:o,workspace:s,authMode:i?.type??(n.loginInProgress?n.authMode:`signedOut`),loggedIn:!!i,requiresOpenaiAuth:e?.requiresOpenaiAuth??n.requiresOpenaiAuth,loginInProgress:!i&&n.loginInProgress,pendingLoginId:i?null:n.pendingLoginId,loginError:i?null:n.loginError}},W=(e,t)=>e?.data.length?e.data.filter(e=>e.mode===`default`||e.mode===`plan`).map(e=>({name:e.name,mode:e.mode,model:e.model??t[0]?.model??`gpt-5.4`,effort:e.reasoning_effort??t[0]?.effort??`medium`})):t,G=e=>e===`repo`?`workspace`:e===`system`||e===`admin`?`system`:`user`,Ul=e=>({id:e.path,name:e.name,description:e.interface?.shortDescription??e.shortDescription??e.description,path:e.path,scope:G(e.scope),enabled:e.enabled,source:`installed`,tags:[e.scope,e.enabled?`enabled`:`disabled`]}),Wl=e=>({id:e.id,name:e.name,description:e.description,path:`hazelnut://${e.id}`,scope:`system`,enabled:!1,source:`remote`,tags:[`remote`],repo:`remote marketplace`,downloads:`available`}),Gl=e=>{let t=[...e.turns].reverse().flatMap(e=>[...e.items].reverse()).find(e=>e.type===`plan`);return t?{explanation:t.text,steps:[{step:t.text,status:`inProgress`}]}:null},Kl=e=>e?e.split(`
34
+ `):[],ql=RegExp(`${ll}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,`g`),Jl=e=>e.replace(ql,``).replace(/\r\n/g,`
35
+ `).replace(/\r/g,`
36
+ `),Yl=(e,t)=>{let n=Jl(t);if(!n)return e;let r=e.length>0?[...e]:[``],i=n.split(`
37
+ `);r[r.length-1]=`${r[r.length-1]??``}${i[0]??``}`;for(let e=1;e<i.length;e+=1)r.push(i[e]??``);return r},Xl=()=>globalThis.crypto?.randomUUID?.()??`terminal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Zl=({processId:e,cwd:t,command:n,title:r})=>({id:e,title:r,command:n,cwd:t,processId:e,status:`running`,background:!1,lastEvent:$c(),log:[`$ ${n}`],source:`shell`,writable:!0}),Ql=(e,t=[])=>{let n=t.filter(e=>e.source===`shell`),r=tu(e);return[...n,...r.filter(e=>!n.some(t=>t.processId===e.processId))]},$l=(e,t,n)=>e.map(e=>e.processId===t?n(e):e),eu=e=>e.status===`inProgress`?`running`:e.exitCode&&e.exitCode!==0?`failed`:`idle`,tu=e=>[...e.turns].flatMap(e=>e.items).filter(e=>e.type===`commandExecution`).reverse().map(e=>({id:e.id,title:e.command.split(` `).slice(0,3).join(` `)||`Terminal`,command:e.command,cwd:e.cwd,processId:e.processId??e.id,status:eu(e),background:!0,lastEvent:$c(),log:e.aggregatedOutput?[`$ ${e.command}`,...Kl(e.aggregatedOutput)]:[`$ ${e.command}`],source:`thread`,writable:!1})),nu=e=>{let t=[],n=new Set;for(let r of e.turns)for(let i of r.items)if(i.type===`agentMessage`)for(let r of i.text.split(`
38
+ `)){let i=r.match(/^\s*(?:\d+[.)]\s*)?(high|medium|low)\s*[:-]\s*(.+)$/i);if(!i)continue;let a=i[1].toLowerCase(),o=i[2].trim(),s=o.match(/([A-Za-z0-9_./-]+\.[A-Za-z0-9]+):(\d+)/),c=s?.[1]??e.cwd,l=s?Number(s[2]):1,u=`${a}:${o}`;n.has(u)||(n.add(u),t.push({id:u,severity:a,title:o,file:c,line:l,summary:o,status:`open`}))}return t},ru=(e,t,n,r,i,a,o)=>{let s=`${r}:${i}`,c=e.streams.findIndex(e=>e.key===s),l={key:s,threadId:t,turnId:n,itemId:r,field:i,visible:a.length,total:o?a.length+1:a.length,speed:1};if(c===-1){e.streams=[...e.streams,l];return}e.streams=e.streams.map((e,t)=>t===c?l:e)},iu=(e,t)=>{e.streams=e.streams.map(e=>e.itemId===t?{...e,visible:e.visible,total:e.visible}:e)},au=e=>e.startsWith(Fu)?1:0,ou=e=>[...e].sort((e,t)=>{let n=au(e.id)-au(t.id);return n===0?e.id.localeCompare(t.id):n}),su=(e,t,n=`inProgress`)=>e.some(e=>e.id===t)?ou(e):ou([...e,{id:t,items:[],status:n,error:null}]),K=(e,t,n)=>{e.threads=e.threads.map(e=>e.thread.id===t?n(e):e)},cu=e=>[...e].sort((e,t)=>t.thread.updatedAt-e.thread.updatedAt),lu=(e,t)=>{let n=e.threads.findIndex(e=>e.thread.id===t.thread.id);if(n===-1){e.threads=cu([t,...e.threads]);return}e.threads=cu(e.threads.map((e,r)=>r===n?t:e))},uu=(e,t)=>{let n=t?.thread.turns??[],r=e.turns.length>0?ou([...e.turns.map(e=>ad(e,n.find(t=>t.id===e.id))),...n.filter(t=>!e.turns.some(e=>e.id===t.id))]):ou(n),i=t?{...t.thread,...e,turns:r}:{...e,turns:r};return{thread:i,plan:t?.plan??Gl(i),steers:al(t?.steers,rl(e.id)),steerSuggestions:t?.steerSuggestions??Yc,approvals:t?.approvals??[],terminals:Ql(i,t?.terminals),reroutes:t?.reroutes??[],review:nu(i),tokenUsage:t?.tokenUsage??{input:0,output:0,cached:0}}},du=e=>({id:`${e.root}:${e.path}`,name:e.path,path:`${e.root}/${e.path}`,kind:`file`}),fu=new Set([`.git`,`node_modules`]),pu=e=>[...e].sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`directory`?-1:1),mu=(e,t)=>`${e.replace(/\/+$/u,``)}/${t}`,hu=(e,t)=>{if(fu.has(t.fileName))return null;let n=t.isDirectory?`directory`:t.isFile?`file`:null;return n?{id:`${e}:${t.fileName}`,name:t.fileName,path:mu(e,t.fileName),kind:n}:null},gu=e=>e.replace(/[^a-zA-Z0-9._-]/g,`-`),_u=e=>{let t=new Uint8Array(e),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)},vu=e=>{let t=atob(e),n=Uint8Array.from(t,e=>e.charCodeAt(0));return new TextDecoder().decode(n)},yu=e=>_u(new TextEncoder().encode(e).buffer),bu=e=>{let t=[];return e.model&&t.push({keyPath:`model`,value:e.model}),e.reasoningEffort&&t.push({keyPath:`model_reasoning_effort`,value:e.reasoningEffort}),e.approvalPolicy&&t.push({keyPath:`approval_policy`,value:e.approvalPolicy}),e.sandboxMode&&t.push({keyPath:`sandbox_mode`,value:e.sandboxMode}),e.personality&&t.push({keyPath:`personality`,value:e.personality}),typeof e.webSearch==`boolean`&&t.push({keyPath:`web_search`,value:e.webSearch?`live`:`disabled`}),typeof e.analytics==`boolean`&&t.push({keyPath:`analytics.enabled`,value:e.analytics}),typeof e.hideRateLimitNudge==`boolean`&&t.push({keyPath:`notice.hide_rate_limit_model_nudge`,value:e.hideRateLimitNudge}),t},xu=(e,t,n,r)=>{let i=[],a=e.trim(),o=t.filter(e=>e.kind===`file`);if(r?.trim()&&i.push(r.trim()),o.length>0){let e=new Set,t=o.flatMap(t=>{let n=`${t.name.toLowerCase()}:${t.path}`;return e.has(n)?[]:(e.add(n),[`## ${t.name}: ${t.path}`])});t.length>0&&(i.push(`# Files mentioned by the user:`),i.push(...t))}return i.length>0||a?(i.push(n.requestHeading),a&&i.push(a),i.join(`
39
+ `)):``},Su=(e,t,n,r,i,a)=>{let o=[],s=xu(e,t,Ho(i),a);return s&&o.push({type:`text`,text:s,text_elements:[]}),o.push(...t.map(e=>({type:`mention`,name:e.name,path:e.path}))),o.push(...n.map(e=>({type:`skill`,name:e.name,path:e.path}))),o.push(...r.map(e=>({type:`localImage`,path:e}))),o},Cu=(e,t,n,r)=>xu(t,n,e,r),wu=e=>e.items.filter(e=>e.type===`agentMessage`).map(e=>e.text.trim()).filter(Boolean).join(`
40
+
41
+ `).trim(),Tu=e=>e.turns.some(e=>e.items.some(e=>e.type===`agentMessage`&&e.id.startsWith(Uc))),Eu=(e,t)=>Jc(t)||Kc(e.id)||Tu(e),Du=(e,t)=>{let n=[];for(let r of e.items){if(r.type===`userMessage`){let e=fs(r,t),i=e.text.trim(),a=[...new Set(e.fileAttachments.map(e=>e.label.trim()).filter(Boolean))];i&&n.push(`User: ${i}`),a.length>0&&n.push(`Files: ${a.join(`, `)}`),e.images.length>0&&n.push(`Images: ${e.images.length} attached`);continue}if(r.type===`agentMessage`){let e=r.text.trim();if(!e)continue;n.push(r.id.startsWith(Uc)?`Assistant (other provider): ${e}`:`Assistant: ${e}`)}}return n.join(`
42
+ `).trim()},Ou=(e,t)=>{if(!Eu(e,t))return null;let n=[],r=0,i=ou(e.turns).filter(e=>e.status!==`inProgress`&&!Hu(e));for(let e=i.length-1;e>=0;--e){let a=Du(i[e],t);if(a&&(n.length>0&&r+a.length>Gc||(n.push(a),r+=a.length,n.length>=Wc)))break}return n.length===0?null:[`# Shared thread memory:`,`Use this as the canonical Nomadex context for this thread. It may include turns from other providers or turns that do not exist in your native provider session history.`,``,`## Recent thread context:`,...n.reverse().flatMap((e,t)=>[`### Memory ${t+1}`,e,``])].join(`
43
+ `).trim()},ku=({binaryPath:e,adapter:t,prompt:n,cwd:r,model:i,filePaths:a})=>{if(t.id===`opencode`){let t=[e,`run`];i&&i!==`default`&&t.push(`--model`,i);for(let e of a)t.push(`--file`,e);return t.push(`--dir`,r,n),t}return t.id===`qwen-code`?[e,`--auth-type=qwen-oauth`,`-p`,n]:null},Au=(e,t,n)=>t.map(t=>({id:`optimistic-file:${t.id}`,name:t.name,path:Oo(Ho(n),e,t.name),kind:`file`})),ju=e=>({...e,threads:[...e.threads],providers:[...e.providers],providerSetup:Sl(e.providerSetup),providerAuth:Cl(e.providerAuth),models:[...e.models],collaborationModes:[...e.collaborationModes],settings:{...e.settings},installedSkills:[...e.installedSkills],remoteSkills:[...e.remoteSkills],mcpServers:[...e.mcpServers],featureFlags:[...e.featureFlags],account:{...e.account,usageWindows:[...e.account.usageWindows]},mentionCatalog:[...e.mentionCatalog],directoryCatalog:[...e.directoryCatalog],streams:[...e.streams],transport:{...e.transport}}),Mu=e=>({mode:e.collaborationMode,settings:{model:e.model,reasoning_effort:e.reasoningEffort,developer_instructions:null}}),Nu=(e,t,n,r)=>({mode:e,status:t,endpoint:r,error:n}),Pu=`optimistic-user:`,Fu=`optimistic-turn:`,Iu=`local-provider-turn:`,Lu=`live-filechange-preview:`,Ru=`materializedThreadId`,zu=e=>e.type===`userMessage`&&e.id.startsWith(Pu),Bu=e=>e.id.startsWith(Fu),Vu=e=>e.items.some(e=>e.type===`agentMessage`&&e.id.startsWith(Uc)),Hu=e=>Bu(e)&&!(Vu(e)&&e.status!==`inProgress`),Uu=e=>e.type===`fileChange`&&e.id.startsWith(Lu),Wu=e=>e.filter(e=>!Hu(e)),Gu=e=>e.replace(/^[ab]\//,``),Ku=e=>({path:`Editing files`,kind:{type:`update`,move_path:null},diff:e}),qu=(e,t,n=`inProgress`)=>({type:`fileChange`,id:e,changes:t,status:n}),Ju=(e,t)=>({...e,status:`inProgress`,changes:e.changes.length>0?e.changes.map((n,r)=>r===e.changes.length-1?{...n,diff:`${n.diff}${t}`}:n):[Ku(t)]}),Yu=e=>{if(!e.trim())return[];let t=e.split(`
44
+ `),n=[],r=null,i=()=>{if(!r)return;let e=r.newPath??r.path??r.oldPath??`Editing files`,t=r.lines.join(`
45
+ `).trimEnd();(t||r.kind.type!==`update`)&&n.push({path:e,kind:r.kind,diff:t}),r=null};for(let e of t){if(e.startsWith(`diff --git `)){i();let t=e.match(/^diff --git a\/(.+?) b\/(.+)$/),n=t?.[1]?Gu(t[1]):null,a=t?.[2]?Gu(t[2]):null;r={path:a??n??`Editing files`,kind:{type:`update`,move_path:null},lines:[],oldPath:n,newPath:a};continue}if(r||={path:`Editing files`,kind:{type:`update`,move_path:null},lines:[],oldPath:null,newPath:null},e.startsWith(`new file mode `)){r.kind={type:`add`};continue}if(e.startsWith(`deleted file mode `)){r.kind={type:`delete`};continue}if(e.startsWith(`rename from `)){r.oldPath=e.slice(12).trim();continue}if(e.startsWith(`rename to `)){let t=e.slice(10).trim();r.newPath=t,r.path=t,r.kind={type:`update`,move_path:t};continue}if(e.startsWith(`--- `)){let t=e.slice(4).trim();r.oldPath=t===`/dev/null`?null:Gu(t),r.oldPath&&(r.path=r.oldPath),r.lines.push(e);continue}if(e.startsWith(`+++ `)){let t=e.slice(4).trim();r.newPath=t===`/dev/null`?null:Gu(t),t===`/dev/null`?r.kind={type:`delete`}:r.oldPath===null&&(r.kind={type:`add`}),r.newPath&&(r.path=r.newPath),r.lines.push(e);continue}r.lines.push(e)}return i(),n.length>0?n:[Ku(e.trimEnd())]},Xu=e=>Gu(e).replace(/\\/g,`/`),Zu=e=>e.startsWith(`/`)||/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith(`\\\\`),Qu=e=>{let[t,n]=e.split(`,`,2),r=Number.parseInt(t,10),i=n===void 0||n===``?1:Number.parseInt(n,10);if(!Number.isFinite(r)||!Number.isFinite(i))throw Error(`Rollback is unavailable because a saved diff hunk is malformed.`);return{start:r,count:i}},$u=e=>{let t=Xu(e.path);if(!t||t===`Editing files`)throw Error(`Rollback is unavailable because the saved change does not include a concrete file path.`);let n=e.kind.type===`add`?null:t,r=e.kind.type===`delete`?null:t,i=[],a=null,o=()=>{a&&=(i.push(a),null)},s=e.diff.replace(/\r/g,``).replace(/^\n+|\n+$/g,``);if(s)for(let e of s.split(`
46
+ `)){if(e===`GIT binary patch`||e.startsWith(`Binary files `))throw Error(`Rollback is unavailable for binary file changes.`);if(e.startsWith(`diff --git `)){o();let t=e.match(/^diff --git a\/(.+?) b\/(.+)$/);t&&(n=Xu(t[1]),r=Xu(t[2]));continue}if(e.startsWith(`rename from `)){n=Xu(e.slice(12).trim());continue}if(e.startsWith(`rename to `)){r=Xu(e.slice(10).trim());continue}if(e.startsWith(`--- `)){let t=e.slice(4).trim();n=t===`/dev/null`?null:Xu(t);continue}if(e.startsWith(`+++ `)){let t=e.slice(4).trim();r=t===`/dev/null`?null:Xu(t);continue}if(e.startsWith(`@@`)){o();let t=e.match(/^@@ -(\d+(?:,\d+)?) \+(\d+(?:,\d+)?) @@/);if(!t)throw Error(`Rollback is unavailable because a saved diff hunk header is malformed.`);let n=Qu(t[1]),r=Qu(t[2]);a={oldStart:n.start,oldCount:n.count,newStart:r.start,newCount:r.count,lines:[]};continue}if(!a)continue;if(e===`\`){let e=a.lines[a.lines.length-1];e&&(e.noNewlineAfter=!0);continue}let t=e[0];t!==` `&&t!==`+`&&t!==`-`||a.lines.push({type:t===` `?`context`:t===`+`?`add`:`remove`,text:e.slice(1),noNewlineAfter:!1})}if(o(),e.kind.type===`update`&&e.kind.move_path&&(!n||!r))throw Error(`Rollback is unavailable for rename-only file changes without complete diff headers.`);return{oldPath:n,newPath:r,hunks:i}},ed=e=>{let t=e.replace(/\r\n/g,`
47
+ `).replace(/\r/g,`
48
+ `);if(!t)return{lines:[],endsWithNewline:!0};let n=t.endsWith(`
49
+ `),r=t.split(`
50
+ `);return n&&r.pop(),{lines:r,endsWithNewline:n}},td=e=>e.lines.length===0?``:`${e.lines.join(`
51
+ `)}${e.endsWithNewline?`
52
+ `:``}`,nd=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),rd=(e,t,n)=>{let r=ed(e);for(let e of t.hunks.slice().reverse()){let t=e.lines.filter(e=>e.type!==`remove`),i=e.lines.filter(e=>e.type!==`add`),a=Math.max(0,e.newStart-1);if(!nd(r.lines.slice(a,a+t.length),t.map(e=>e.text)))throw Error(`Rollback could not be applied cleanly to ${n}. The local file no longer matches the saved diff.`);let o=[...r.lines];o.splice(a,t.length,...i.map(e=>e.text));let s=r.endsWithNewline,c=a+i.length===o.length;if(o.length===0)s=!0;else if(c){let e=i[i.length-1];e&&(s=!e.noNewlineAfter)}r={lines:o,endsWithNewline:s}}return td(r)},id=(e,t,n)=>{let r=Yu(n),i=e.filter(e=>!Uu(e));return r.length===0?i:[...i,qu(`${Lu}${t}`,r)]},ad=(e,t)=>({...t,...e,items:e.items.length>0?e.items:t?.items??[]}),od=e=>{switch(e.type){case`text`:return`text:${e.text}`;case`image`:return`image:${e.url}`;case`localImage`:return`localImage:${e.path}`;case`skill`:return`skill:${e.path}:${e.name}`;case`mention`:return`mention:${e.path}:${e.name}`;default:return JSON.stringify(e)}},sd=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=[...e],r=new Set(e.map(e=>od(e)));for(let e of t){let t=od(e);r.has(t)||(r.add(t),n.push(e))}return n},cd=(e,t,n,r)=>e.map(e=>e.id===t?{...e,items:e.items.map(e=>e.id===n&&e.type===`userMessage`?{...e,content:r}:e)}:e),ld=(e,t)=>{if(!t||t.type!==e.type)return e;if(e.type===`userMessage`){let n=t;return{...n,...e,content:sd(e.content,n.content)}}if(e.type===`agentMessage`){let n=t;return{...n,...e,text:e.text.length>=n.text.length?e.text:n.text,phase:e.phase??n.phase}}if(e.type===`commandExecution`){let n=t,r=e.aggregatedOutput??``,i=n.aggregatedOutput??``;return{...n,...e,aggregatedOutput:r.length>=i.length?e.aggregatedOutput:n.aggregatedOutput,command:e.command||n.command,cwd:e.cwd||n.cwd,processId:e.processId??n.processId}}if(e.type===`reasoning`){let n=t;return{...n,...e,summary:e.summary.length>=n.summary.length?e.summary:n.summary,content:e.content.length>=n.content.length?e.content:n.content}}return e},ud=class{snapshot;listeners=new Set;socket=null;connectPromise=null;requestId=0;pending=new Map;loadingThreads=new Set;resumedThreads=new Set;approvalMap=new Map;standaloneTerminalMeta=new Map;externalProviderRuns=new Map;providerAuthRuns=new Map;standaloneTerminalDecoders=new Map;emitQueued=!1;emitFrame=null;emitTimer=null;constructor(e=Sc()){let t=Ho(e.settings.provider);this.snapshot={...e,providers:[...e.providers],providerSetup:Sl(e.providerSetup),providerAuth:Cl(e.providerAuth),transport:Nu(`mock`,`connecting`,null,Rc(t))}}getActiveProviderId(){return this.snapshot.settings.provider}getActiveProviderAdapter(){return Ho(this.getActiveProviderId())}getWsUrlCandidates(e=this.getActiveProviderAdapter()){return Lc(e)}getDefaultWsUrl(e=this.getActiveProviderAdapter()){return Rc(e)}subscribe(e){return this.listeners.add(e),e(ju(this.snapshot)),()=>{this.listeners.delete(e)}}disconnect(){this.clearScheduledEmit(),this.markStandaloneTerminalsDisconnected(`Connection closed.`),this.markExternalProviderRunsDisconnected(`Connection closed.`),this.markProviderAuthRunsDisconnected(`Connection closed.`),this.socket?.close(),this.socket=null,this.failPending(Error(`Local agent bridge connection closed.`)),this.connectPromise=null,this.loadingThreads.clear(),this.resumedThreads.clear()}handleSocketClose(e){this.socket===e&&(this.markStandaloneTerminalsDisconnected(`Connection closed.`),this.markExternalProviderRunsDisconnected(`Connection closed.`),this.markProviderAuthRunsDisconnected(`Connection closed.`),this.socket=null,this.connectPromise=null,this.failPending(Error(`Local agent bridge connection closed.`)),this.loadingThreads.clear(),this.resumedThreads.clear(),this.mutate(e=>{e.transport=Nu(e.transport.mode,`offline`,e.transport.error,this.getDefaultWsUrl())}))}async openSocket(e){return await new Promise((t,n)=>{let r=new WebSocket(e),i=!1,a=()=>{if(!i){i=!0,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{r.close()}catch{}n(Error(`Failed to connect to ${e}`))}};r.onopen=()=>{i||(i=!0,r.onmessage=this.onMessage,r.onerror=()=>void 0,r.onclose=()=>{this.handleSocketClose(r)},t(r))},r.onerror=a,r.onclose=a})}failPending(e){this.pending.forEach(t=>{t.reject(e)}),this.pending.clear()}ensureStandaloneTerminalDecoders(e){let t=this.standaloneTerminalDecoders.get(e);if(t)return t;let n={stdout:new TextDecoder,stderr:new TextDecoder};return this.standaloneTerminalDecoders.set(e,n),n}decodeStandaloneTerminalChunk(e,t,n,r=!1){let i=atob(n),a=Uint8Array.from(i,e=>e.charCodeAt(0));return this.ensureStandaloneTerminalDecoders(e)[t].decode(a,{stream:!r})}flushStandaloneTerminalDecoders(e){let t=this.standaloneTerminalDecoders.get(e);if(!t)return``;let n=`${t.stdout.decode()}${t.stderr.decode()}`;return this.standaloneTerminalDecoders.delete(e),n}updateStandaloneTerminalLog(e,t){let n=this.standaloneTerminalMeta.get(e);!n||!t||this.mutate(r=>{K(r,n.threadId,n=>({...n,terminals:$l(n.terminals,e,e=>({...e,log:Yl(e.log,t),lastEvent:$c()}))}))})}finalizeStandaloneTerminal(e,t){let n=this.standaloneTerminalMeta.get(e),r=this.flushStandaloneTerminalDecoders(e);if(!n)return;let i=`idle`,a=`Shell exited`,o=r;if(t.type===`response`){let{response:e}=t;o=`${o}${e.stdout}${e.stderr}`,e.exitCode!==0&&(i=`failed`,a=`Exit ${e.exitCode}`)}else t.type===`disconnected`?(i=`failed`,a=t.detail,o=`${o}\n${t.detail}`):(i=`failed`,a=`Shell failed`,o=`${o}\n${Tl(t.error)||`Unable to start the project shell.`}`);this.mutate(t=>{K(t,n.threadId,t=>({...t,terminals:$l(t.terminals,e,e=>({...e,status:i,writable:!1,lastEvent:a,log:o?Yl(e.log,o):e.log}))}))}),this.standaloneTerminalMeta.delete(e)}markStandaloneTerminalsDisconnected(e){let t=[...this.standaloneTerminalMeta.keys()];for(let n of t)this.finalizeStandaloneTerminal(n,{type:`disconnected`,detail:e})}appendExternalProviderDelta(e,t,n,r,i){r&&this.mutate(a=>{K(a,e,o=>{let s=su(o.thread.turns,t).map(o=>{if(o.id!==t)return o;let s=(o.items.some(e=>e.id===n&&e.type===`agentMessage`)?o.items:[...o.items,{type:`agentMessage`,id:n,text:``,phase:null}]).map(e=>e.id===n&&e.type===`agentMessage`?{...e,text:`${e.text}${r}`}:e),c=s.find(e=>e.id===n&&e.type===`agentMessage`);return c&&ru(a,e,t,c.id,`text`,c.text,i),{...o,items:s}});return{...o,thread:{...o.thread,status:i?{type:`active`,activeFlags:[]}:{type:`idle`},turns:s,updatedAt:Math.floor(Date.now()/1e3)}}})})}finalizeExternalProviderRun(e,t){let n=this.externalProviderRuns.get(e);if(!n)return;let r=[this.flushStandaloneTerminalDecoders(e),t.type===`response`?`${t.response.stdout}${t.response.stderr}`:t.type===`disconnected`?t.detail:Tl(t.error)||`Unable to run external provider.`].filter(e=>e.trim().length>0).join(``);r&&this.appendExternalProviderDelta(n.threadId,n.turnId,n.itemId,r,!1);let i=t.type!==`response`||t.response.exitCode!==0,a=t.type===`response`?[t.response.stderr,n.stderr].filter(e=>e.trim().length>0).join(`
53
+ `).trim():t.type===`disconnected`?t.detail:Tl(t.error);this.mutate(e=>{K(e,n.threadId,t=>{let o=i?`failed`:`completed`,s=i?{message:a||`${Ho(n.providerId).displayName} run failed.`,codexErrorInfo:null,additionalDetails:null}:null,c=t.thread.turns.map(t=>{if(t.id!==n.turnId)return t;let i=t.items.some(e=>e.id===n.itemId&&e.type===`agentMessage`)?t.items:[...t.items,{type:`agentMessage`,id:n.itemId,text:``,phase:null}];if(!r){let t=i.find(e=>e.id===n.itemId&&e.type===`agentMessage`);t&&ru(e,n.threadId,n.turnId,t.id,`text`,t.text,!1)}return iu(e,n.itemId),{...t,items:i,status:o,error:s}});return{...t,thread:{...t.thread,status:{type:`idle`},turns:c,updatedAt:Math.floor(Date.now()/1e3)}}})}),this.externalProviderRuns.delete(e)}markExternalProviderRunsDisconnected(e){let t=[...this.externalProviderRuns.keys()];for(let n of t)this.finalizeExternalProviderRun(n,{type:`disconnected`,detail:e})}clearScheduledEmit(){typeof window>`u`||(this.emitFrame!==null&&(window.cancelAnimationFrame(this.emitFrame),this.emitFrame=null),this.emitTimer!==null&&(window.clearTimeout(this.emitTimer),this.emitTimer=null))}flushEmit=()=>{this.clearScheduledEmit(),this.emitQueued=!1;let e=ju(this.snapshot);this.listeners.forEach(t=>t(e))};emit(){if(!this.emitQueued){if(this.emitQueued=!0,typeof window>`u`){queueMicrotask(this.flushEmit);return}if(typeof document<`u`&&document.visibilityState===`visible`){this.emitFrame=window.requestAnimationFrame(this.flushEmit);return}this.emitTimer=window.setTimeout(this.flushEmit,32)}}mutate(e){e(this.snapshot),this.emit()}onMessage=e=>{let t=JSON.parse(e.data);if(t.id!==void 0&&(t.result!==void 0||t.error!==void 0)&&!t.method){let e=this.pending.get(String(t.id));if(!e)return;this.pending.delete(String(t.id)),t.error===void 0?e.resolve(t.result):e.reject(t.error);return}if(t.method&&t.id!==void 0){this.handleServerRequest(String(t.id),t.method,t.params??{});return}t.method&&this.handleNotification(t.method,t.params??{})};async request(e,t){if(!this.socket||this.socket.readyState!==WebSocket.OPEN)throw Error(`Local agent bridge is not connected.`);let n=String(++this.requestId),r={id:n,method:e,params:t};return await new Promise((e,t)=>{this.pending.set(n,{resolve:e,reject:t}),this.socket?.send(JSON.stringify(r))})}respond(e,t){this.socket?.send(JSON.stringify({id:e,result:t}))}async connect(){if(this.socket?.readyState===WebSocket.OPEN)return await(this.connectPromise??Promise.resolve());if(this.connectPromise)return await this.connectPromise;this.connectPromise=(async()=>{let e=this.getActiveProviderAdapter();if(!jo(e)){let t=zc(e);throw this.mutate(n=>{n.transport=Nu(`mock`,`error`,t,this.getDefaultWsUrl(e))}),Error(t)}let t=this.getWsUrlCandidates(e),n=!1;for(let e of t)try{this.socket=await this.openSocket(e),n=!0;break}catch{continue}if(!n||!this.socket){let n=t.length>1?`Failed to connect to the ${e.transportLabel}. Tried: ${t.join(`, `)}`:`Failed to connect to ${this.getDefaultWsUrl(e)}`;throw this.mutate(t=>{t.transport=Nu(`mock`,`error`,n,this.getDefaultWsUrl(e))}),Error(n)}try{await this.request(`initialize`,{clientInfo:{name:`nomadex`,version:`0.0.0`},capabilities:{experimentalApi:!0}}),await this.bootstrap()}catch(t){throw this.mutate(n=>{n.transport=Nu(`mock`,`error`,t instanceof Error?t.message:String(t),this.getDefaultWsUrl(e))}),t}})();try{await this.connectPromise}finally{this.socket?.readyState!==WebSocket.CONNECTING&&(this.connectPromise=null)}}async bootstrap(){let[e,t,n,r,i,a,o,s,c,l]=await Promise.allSettled([this.request(`thread/list`,{limit:60}),this.request(`model/list`,{}),this.request(`collaborationMode/list`,{}),this.request(`experimentalFeature/list`,{}),this.request(`account/read`,{}),this.request(`account/rateLimits/read`,{}),this.request(`skills/list`,{}),this.request(`skills/remote/list`,{hazelnutScope:`personal`,productSurface:`codex`,enabled:!0}),this.request(`mcpServerStatus/list`,{}),this.readConfigWithRecovery()]),u=this.snapshot,d=e.status===`fulfilled`?e.value.data.map(e=>uu(e,u.threads.find(t=>t.thread.id===e.id))):u.threads,f=o.status===`fulfilled`?o.value.data.flatMap(e=>e.skills.map(Ul)):u.installedSkills,p=s.status===`fulfilled`?s.value.data.map(Wl):u.remoteSkills;this.mutate(e=>{e.threads=cu(d),e.providers=Vo(),e.providerSetup={...yc(e.providers),...e.providerSetup},e.models=t.status===`fulfilled`?t.value.data:e.models,e.collaborationModes=W(n.status===`fulfilled`?n.value:null,e.collaborationModes),e.featureFlags=r.status===`fulfilled`?r.value.data.map(Nl):e.featureFlags,e.account=Hl(i.status===`fulfilled`?i.value:null,a.status===`fulfilled`?a.value:null,e.account),e.installedSkills=f,e.remoteSkills=p,e.remoteSkillsError=s.status===`rejected`?s.reason instanceof Error?s.reason.message:String(s.reason):null,e.mcpServers=c.status===`fulfilled`?c.value.data:e.mcpServers,e.settings=l.status===`fulfilled`?Ll(l.value.config,e.settings):e.settings,e.transport=Nu(`live`,`connected`,null,this.getDefaultWsUrl())});let m=this.snapshot.threads[0]?.thread;m&&(await this.resumeThread(m.id),await this.loadDirectory(m.cwd))}async readConfigWithRecovery(){try{return await this.request(`config/read`,{})}catch(e){if(!Il(e))throw e;return await this.request(`config/value/write`,{keyPath:`model_provider`,value:null,mergeStrategy:`replace`}),await this.request(`config/read`,{})}}async ensureThreadLoaded(e){if(Kc(e)||this.loadingThreads.has(e))return;let t=this.snapshot.threads.find(t=>t.thread.id===e);if(!(t&&t.thread.turns.length>0)){this.loadingThreads.add(e);try{let t=await this.request(`thread/read`,{threadId:e,includeTurns:!0});this.mutate(e=>{let n=e.threads.find(e=>e.thread.id===t.thread.id);lu(e,uu(t.thread,n))})}catch(e){if(!Ml(e))throw e}finally{this.loadingThreads.delete(e)}}}async resumeThread(e,t=!1){if(!Kc(e)&&!(!e||this.loadingThreads.has(e))&&!(!t&&this.resumedThreads.has(e))){this.loadingThreads.add(e);try{let t=await this.request(`thread/resume`,{threadId:e,persistExtendedHistory:!0});this.mutate(e=>{let n=e.threads.find(e=>e.thread.id===t.thread.id);lu(e,uu(t.thread,n))}),this.resumedThreads.add(e)}catch(n){if(Ml(n))return;if(t)throw n;try{let t=await this.request(`thread/read`,{threadId:e,includeTurns:!0});this.mutate(e=>{let n=e.threads.find(e=>e.thread.id===t.thread.id);lu(e,uu(t.thread,n))})}catch(e){if(!Ml(e))throw e}}finally{this.loadingThreads.delete(e)}}}async createThread(e,t){let n=await this.resolveWorkspaceCwd(t?.cwd);if(Jc(e.provider)){let t=qc(e.provider),r=n??`.`,i=Cc(t,`New Session`,e,r);return this.mutate(t=>{lu(t,{...i,thread:{...i.thread,source:`cli`,status:{type:`idle`},modelProvider:e.provider,preview:`New Session`,name:`New Session`}})}),await this.loadDirectory(r).catch(()=>void 0),t}let r=await this.request(`thread/start`,{cwd:n,model:e.model,approvalPolicy:e.approvalPolicy,sandbox:e.sandboxMode,ephemeral:!1,experimentalRawEvents:!1,persistExtendedHistory:!0,personality:e.personality===`none`?null:e.personality});return this.mutate(e=>{lu(e,uu(r.thread,e.threads.find(e=>e.thread.id===r.thread.id)))}),await this.loadDirectory(r.thread.cwd).catch(()=>void 0),r.thread.id}async uploadImages(e,t){if(t.length===0)return[];let n=To(this.getActiveProviderAdapter(),e);await this.request(`fs/createDirectory`,{path:n,recursive:!0});let r=[];for(let e of t){let t;if(e.file)t=await e.file.arrayBuffer();else{let n=await fetch(e.url);if(!n.ok)throw Error(`Failed to read image attachment: ${e.name}`);t=await n.arrayBuffer()}let i=`${n}/${`${Date.now()}-${gu(e.name)}`}`;await this.request(`fs/writeFile`,{path:i,dataBase64:_u(t)}),r.push(i)}return r}async uploadFiles(e,t){if(t.length===0)return[];let n=Eo(this.getActiveProviderAdapter(),e);await this.request(`fs/createDirectory`,{path:n,recursive:!0});let r=[];for(let e of t){let t=`${n}/${`${Date.now()}-${gu(e.name)}`}`,i=await e.file.arrayBuffer();await this.request(`fs/writeFile`,{path:t,dataBase64:_u(i)}),r.push({id:`${t}:${e.id}`,name:e.name,path:t,kind:`file`})}return r}async runHeadlessCliTurn(e,t){let n=Ho(e.settings.provider),r=n.id===`opencode`?`opencode`:`qwen`,i=await this.resolveCliBinary(r,t.cwd);if(!i)throw Error(`${n.displayName} is not installed on the host machine.`);let a=await this.uploadFiles(t.cwd,e.files),o=await this.uploadImages(t.cwd,e.images),s=[...e.mentions,...a],c=Ou(t,e.settings.provider),l=Cu(n,e.prompt,s,c),u=ku({binaryPath:i.path,adapter:n,prompt:l,cwd:t.cwd,model:e.settings.model,filePaths:a.map(e=>e.path)});if(!u)throw Error(`${n.displayName} is not wired for headless execution.`);let d=Su(e.prompt,s,e.skills,o,e.settings.provider,c),f=`${Iu}${e.threadId}:${Date.now().toString(36)}`,p=`${Pu}${e.threadId}:${Date.now().toString(36)}`,m=`external-agent:${e.threadId}:${Date.now().toString(36)}`,h=Xl();this.mutate(t=>{K(t,e.threadId,t=>({...t,thread:{...t.thread,preview:e.prompt.trim()||t.thread.preview,modelProvider:e.settings.provider,status:{type:`active`,activeFlags:[]},turns:ou([...Wu(t.thread.turns),{id:f,status:`inProgress`,error:null,items:[{type:`userMessage`,id:p,content:d},{type:`agentMessage`,id:m,text:``,phase:null}]}]),updatedAt:Math.floor(Date.now()/1e3)}}))}),this.externalProviderRuns.set(h,{threadId:e.threadId,turnId:f,itemId:m,providerId:e.settings.provider,stderr:``}),this.request(`command/exec`,{command:u,cwd:t.cwd,processId:h,streamStdoutStderr:!0,disableTimeout:!0}).then(e=>{this.finalizeExternalProviderRun(h,{type:`response`,response:e})}).catch(e=>{this.finalizeExternalProviderRun(h,{type:`error`,error:e})})}async materializeLocalProviderThread(e,t){let n=this.snapshot.threads.find(t=>t.thread.id===e);if(!n||!Kc(e))return n?.thread??null;let r=await this.request(`thread/start`,{cwd:n.thread.cwd,model:t.model,approvalPolicy:t.approvalPolicy,sandbox:t.sandboxMode,ephemeral:!1,experimentalRawEvents:!1,persistExtendedHistory:!0,personality:t.personality===`none`?null:t.personality}),i=r.thread.id,a=uu(r.thread,{...n,thread:{...n.thread,id:i}}),o={...a,thread:{...a.thread,preview:n.thread.preview||a.thread.preview,name:n.thread.name||a.thread.name,modelProvider:t.provider}};this.loadingThreads.delete(e),this.resumedThreads.delete(e);for(let[t,n]of this.standaloneTerminalMeta.entries())n.threadId===e&&this.standaloneTerminalMeta.set(t,{...n,threadId:i});for(let[t,n]of this.externalProviderRuns.entries())n.threadId===e&&this.externalProviderRuns.set(t,{...n,threadId:i});return this.mutate(t=>{t.threads=t.threads.filter(t=>t.thread.id!==e),t.streams=t.streams.map(t=>t.threadId===e?{...t,threadId:i}:t),lu(t,o)}),o.thread}async sendComposer(e){let t=this.snapshot.threads.find(t=>t.thread.id===e.threadId)?.thread;if(t||=(await this.resumeThread(e.threadId,!0),this.snapshot.threads.find(t=>t.thread.id===e.threadId)?.thread),!t)return e.threadId;let n=e.threadId,r=t;if(!Jc(e.settings.provider)&&Kc(t.id)){let i=await this.materializeLocalProviderThread(t.id,e.settings);if(!i)throw Error(`Unable to sync this local provider conversation to the live workspace.`);r=i,n=i.id}let i=t=>{if(n===e.threadId||!t||typeof t!=`object`)return t;try{return Object.assign(t,{[Ru]:n})}catch{return t}};if(Jc(e.settings.provider))return await this.runHeadlessCliTurn(e,r),n;if(e.mode===`review`)try{let t=await this.request(`review/start`,{threadId:n,delivery:`inline`,target:e.prompt.trim()?{type:`custom`,instructions:e.prompt.trim()}:{type:`uncommittedChanges`}});return this.mutate(r=>{K(r,n,n=>({...n,thread:{...n.thread,modelProvider:e.settings.provider,status:{type:`active`,activeFlags:[]},turns:ou([...n.thread.turns,t.turn]),updatedAt:Math.floor(Date.now()/1e3)}}))}),n}catch(e){throw i(e)}let a=Su(e.prompt,[...e.mentions,...Au(r.cwd,e.files,e.settings.provider)],e.skills,e.images.map(e=>e.url),e.settings.provider,Ou(r,e.settings.provider)),o={type:`userMessage`,id:`${Pu}${n}:${Date.now().toString(36)}`,content:a},s=`${Fu}${n}:${Date.now().toString(36)}`;this.mutate(t=>{K(t,n,t=>({...t,thread:{...t.thread,preview:e.prompt.trim()||t.thread.preview,modelProvider:e.settings.provider,status:{type:`active`,activeFlags:[]},turns:ou([...Wu(t.thread.turns),{id:s,items:[o],status:`inProgress`,error:null}]),updatedAt:Math.floor(Date.now()/1e3)}}))});try{let t=await this.uploadFiles(r.cwd,e.files),i=await this.uploadImages(r.cwd,e.images),a=[...e.mentions,...t],c=Su(e.prompt,a,e.skills,i,e.settings.provider,Ou(r,e.settings.provider)),l={...o,content:c};this.mutate(e=>{K(e,n,e=>({...e,thread:{...e.thread,turns:cd(e.thread.turns,s,o.id,c),updatedAt:Math.floor(Date.now()/1e3)}}))});let u=await this.request(`turn/start`,{threadId:n,input:c,model:e.settings.model,approvalPolicy:e.settings.approvalPolicy,effort:e.settings.reasoningEffort,sandboxPolicy:e.settings.sandboxMode===`danger-full-access`?{type:`dangerFullAccess`}:e.settings.sandboxMode===`read-only`?{type:`readOnly`,access:{type:`restricted`,includePlatformDefaults:!0,readableRoots:[r.cwd]},networkAccess:!1}:{type:`workspaceWrite`,writableRoots:[r.cwd],readOnlyAccess:{type:`restricted`,includePlatformDefaults:!0,readableRoots:[r.cwd]},networkAccess:!1,excludeTmpdirEnvVar:!1,excludeSlashTmp:!1},personality:e.settings.personality===`none`?null:e.settings.personality,collaborationMode:Mu(e.settings)});return this.mutate(t=>{K(t,n,t=>{let n=Wu(t.thread.turns),r=n.find(e=>e.id===u.turn.id),i=ad(u.turn,r),a=i.items.findIndex(e=>e.type===`userMessage`),o=a===-1?[l,...i.items]:i.items.map((e,t)=>t===a?ld(e,l):e),s={...i,items:o};return{...t,thread:{...t.thread,preview:e.prompt.trim()||t.thread.preview,modelProvider:e.settings.provider,status:{type:`active`,activeFlags:[]},turns:ou([...n.filter(e=>e.id!==u.turn.id),s]),updatedAt:Math.floor(Date.now()/1e3)}}})}),n}catch(e){throw this.mutate(e=>{K(e,n,e=>({...e,thread:{...e.thread,status:{type:`idle`},turns:e.thread.turns.filter(e=>e.id!==s),updatedAt:Math.floor(Date.now()/1e3)}}))}),i(e)}}async interruptTurn(e){let t=this.snapshot.threads.find(t=>t.thread.id===e),n=[...t?.thread.turns??[]].reverse().find(e=>e.status===`inProgress`);if(!t||!n)return!1;this.mutate(t=>{n.items.forEach(e=>iu(t,e.id)),K(t,e,e=>({...e,thread:{...e.thread,status:{type:`idle`},turns:e.thread.turns.map(e=>e.id===n.id?{...e,status:`interrupted`}:e)}}))});let r=[...this.externalProviderRuns.entries()].find(([,t])=>t.threadId===e&&t.turnId===n.id);if(r){let[e]=r;try{return await this.request(`command/exec/terminate`,{processId:e}),this.externalProviderRuns.delete(e),this.flushStandaloneTerminalDecoders(e),!0}catch{return!1}}try{return await this.request(`turn/interrupt`,{threadId:e,turnId:n.id}),!0}catch{return await this.resumeThread(e,!0).catch(()=>void 0),!1}}async applySteer(e){let t=this.snapshot.threads.find(t=>t.thread.id===e.threadId),n=[...t?.thread.turns??[]].reverse().find(e=>e.status===`inProgress`);if(!t||!n||Jc(t.thread.modelProvider))return!1;let r=sl(e.threadId,n.id,e,`pending`);this.mutate(t=>{K(t,e.threadId,e=>({...e,steers:al([r],e.steers)}))});try{let i=await this.uploadFiles(t.thread.cwd,e.files),a=await this.uploadImages(t.thread.cwd,e.images),o=Su(e.prompt,[...e.mentions,...i],e.skills,a,this.getActiveProviderId());return this.mutate(e=>{n.items.forEach(t=>iu(e,t.id))}),await this.request(`turn/steer`,{threadId:e.threadId,expectedTurnId:n.id,input:o}),this.mutate(t=>{K(t,e.threadId,e=>({...e,steers:al(e.steers?.map(e=>e.id===r.id?{...e,status:`applied`}:e))}))}),il(e.threadId,this.snapshot.threads.find(t=>t.thread.id===e.threadId)?.steers),await this.resumeThread(e.threadId,!0).catch(()=>void 0),!0}catch{return this.mutate(t=>{K(t,e.threadId,e=>({...e,steers:e.steers?.filter(e=>e.id!==r.id)??[]}))}),il(e.threadId,this.snapshot.threads.find(t=>t.thread.id===e.threadId)?.steers),await this.resumeThread(e.threadId,!0).catch(()=>void 0),!1}}async searchMentions(e,t){let n=await this.request(`fuzzyFileSearch`,{query:t.trim()||`src`,roots:[e],cancellationToken:null});this.mutate(e=>{e.mentionCatalog=n.files.filter(e=>!e.path.includes(`node_modules/`)).slice(0,24).map(du)})}async loadDirectory(e){let t=await this.request(`fs/readDirectory`,{path:e});this.mutate(n=>{n.directoryCatalogRoot=e,n.directoryCatalog=pu(t.entries.map(t=>hu(e,t)).filter(e=>!!e))})}async readFile(e){return vu((await this.request(`fs/readFile`,{path:e})).dataBase64)}async writeFile(e,t){await this.request(`fs/writeFile`,{path:e,dataBase64:yu(t)})}async readRuntimeFileOrNull(e){try{return await this.readFile(e)}catch(e){if(El(e))return null;throw e}}resolveRollbackPath(e,t){return t?Zu(t)?t:Al(e,t):null}async rollbackLocalFileChange(e,t){let n=$u(t),r=this.resolveRollbackPath(e,n.newPath??n.oldPath),i=this.resolveRollbackPath(e,n.oldPath),a=r??i??t.path,o=``;if(r){let e=await this.readRuntimeFileOrNull(r);if(e===null)if(n.newPath===null)o=``;else throw Error(`Rollback could not find ${r}. The local file state no longer matches the selected prompt.`);else o=e}let s=n.hunks.length>0?rd(o,n,a):o;if(i===null){r&&await this.request(`fs/remove`,{path:r,force:!0}).catch(()=>void 0);return}if(r&&r!==i&&await this.readRuntimeFileOrNull(i)!==null)throw Error(`Rollback cannot restore ${i} because a local file already exists there.`);await this.request(`fs/createDirectory`,{path:jl(i),recursive:!0}),await this.writeFile(i,s),r&&r!==i&&await this.request(`fs/remove`,{path:r,force:!0}).catch(()=>void 0)}async readGitGraph(e,t=80){let n=await this.resolveGitWorkspaceCwd(e),r=[`%h`,`%ad`,`%an`,`%d`,`%s`].join(``),i=await this.request(`command/exec`,{command:[`git`,`log`,`--graph`,`--date=short`,`--decorate=short`,`--pretty=format:${r}`,`--all`,`-n`,String(Math.max(20,Math.min(t,120)))],cwd:n,timeoutMs:5e3});if(i.exitCode!==0){let e=[i.stderr,i.stdout].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
54
+ `).trim();throw Error(e||`Failed to read git history.`)}return i.stdout}async readGitStatus(e){let t=await this.resolveGitWorkspaceCwd(e),n=await this.request(`command/exec`,{command:[`git`,`status`,`--short`,`--branch`,`--renames`],cwd:t,timeoutMs:5e3});if(n.exitCode!==0){let e=[n.stderr,n.stdout].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
55
+ `).trim();throw Error(e||`Failed to read git working tree status.`)}return n.stdout}async runCommand(e,t,n){let r={command:e,timeoutMs:n?.timeoutMs,disableTimeout:n?.disableTimeout};return t&&t.trim()&&(r.cwd=t),await this.request(`command/exec`,r)}commandFailureDetails(e,t){return[e.stderr,e.stdout].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
56
+ `).trim()||t}hasGitStatusEntries(e){return e.split(`
57
+ `).map(e=>e.trim()).some(e=>e.length>0&&!e.startsWith(`## `))}workspacePathCandidates(...e){return[...new Set(e.map(e=>U(e).trim()).filter(Boolean))]}async directoryExists(e){try{return await this.request(`fs/readDirectory`,{path:e}),!0}catch{return!1}}async detectServerCwd(){for(let e of[[`pwd`],[`cmd`,`/d`,`/s`,`/c`,`cd`]]){let t=await this.runCommand(e,null,{timeoutMs:5e3}).catch(()=>null),n=t?.exitCode===0?t.stdout.trim():``;if(n)return n}return null}async resolveWorkspaceCwd(e){let t=this.workspacePathCandidates(e,this.snapshot.directoryCatalogRoot,...this.snapshot.threads.map(e=>e.thread.cwd));for(let e of t)if(await this.directoryExists(e))return e;let n=await this.detectServerCwd();return n&&await this.directoryExists(n)?n:n||t[0]||null}async resolveGitWorkspaceCwd(e){let t=await this.resolveWorkspaceCwd(e),n=this.workspacePathCandidates(e,t),r=!1,i=null;for(let e of n){if(!await this.directoryExists(e))continue;r=!0;let t=await this.runCommand([`git`,`rev-parse`,`--show-toplevel`],e,{timeoutMs:5e3});if(t.exitCode===0)return t.stdout.trim()||e;i=this.commandFailureDetails(t,`This directory is not a git repository.`)}throw Error(r?i||`This session is not attached to a git repository.`:`No project directory is attached to this session. Open the repository folder first.`)}async resolveWorkspaceProjectRoot(e){let t=await this.resolveWorkspaceCwd(e);if(!t)throw Error(`No project directory is attached to this session. Open the repository folder first.`);let n=await this.runCommand([`git`,`rev-parse`,`--show-toplevel`],t,{timeoutMs:5e3});return n.exitCode===0&&n.stdout.trim()||t}async resolveWorkspaceProjectSettingsPath(e){return Al(await this.resolveWorkspaceProjectRoot(e),Dc)}async readWorkspaceProjectSettings(e,t=this.snapshot.settings.provider){let n=await this.resolveWorkspaceProjectSettingsPath(e);try{let e=await this.request(`fs/readFile`,{path:n});return{filePath:n,settings:jc(JSON.parse(vu(e.dataBase64)),t)}}catch(e){let r=Tl(e).toLowerCase();if(r.includes(`enoent`)||r.includes(`not found`))return{filePath:n,settings:jc({},t)};throw e}}async readWorkspaceCommitPreferences(e){let{filePath:t,settings:n}=await this.readWorkspaceProjectSettings(e);return{provider:n.commitAssistant.provider,filePath:t}}async writeWorkspaceCommitPreferences(e,t){let{filePath:n,settings:r}=await this.readWorkspaceProjectSettings(e),i={...r,commitAssistant:{...r.commitAssistant,...t.provider?{provider:t.provider}:{}}};return await this.request(`fs/createDirectory`,{path:jl(n),recursive:!0}),await this.request(`fs/writeFile`,{path:n,dataBase64:yu(Mc(i))}),{provider:i.commitAssistant.provider,filePath:n}}async buildCommitGenerationContext(e){let t=await this.resolveGitWorkspaceCwd(e),n=await this.readGitStatus(t);if(!this.hasGitStatusEntries(n))throw Error(`No changes are available to describe.`);let r=await this.runCommand([`git`,`diff`,`--cached`,`--quiet`,`--exit-code`,`--no-ext-diff`],t,{timeoutMs:5e3});if(![0,1].includes(r.exitCode))throw Error(this.commandFailureDetails(r,`Failed to inspect staged changes.`));let i=r.exitCode===1?`staged`:`working-tree`,a=i===`staged`?[`git`,`diff`,`--cached`,`--stat`,`--no-ext-diff`]:[`git`,`diff`,`--stat`,`--no-ext-diff`],o=i===`staged`?[`git`,`diff`,`--cached`,`--no-ext-diff`,`--unified=3`]:[`git`,`diff`,`--no-ext-diff`,`--unified=3`],[s,c]=await Promise.all([this.runCommand(a,t,{timeoutMs:5e3}),this.runCommand(o,t,{timeoutMs:1e4})]);if(s.exitCode!==0)throw Error(this.commandFailureDetails(s,`Failed to read git diff statistics.`));if(c.exitCode!==0)throw Error(this.commandFailureDetails(c,`Failed to read git diff.`));return{scope:i,status:n,diffStat:s.stdout,diff:c.stdout}}async waitForTurnCompletion(e,t){let n=Date.now()+9e4;for(;Date.now()<n;){let n=(await this.request(`thread/read`,{threadId:e,includeTurns:!0})).thread.turns.find(e=>e.id===t);if(n&&n.status!==`inProgress`)return n;await Dl(400)}throw Error(`Timed out waiting for the commit message draft.`)}async commitAssistantSkill(){let e=this.snapshot.installedSkills.find(e=>e.enabled&&e.name.trim().toLowerCase()===`commit-work`)??null;if(!e)return null;try{return await this.request(`fs/readFile`,{path:e.path}),e}catch{return null}}async generateCommitMessageWithCliProvider(e,t,n){let r=Ho(t),i=t===`opencode`?`opencode`:`qwen`,a=await this.resolveCliBinary(i,e);if(!a)throw Error(`${r.displayName} is not installed on the host machine.`);let o=ku({binaryPath:a.path,adapter:r,prompt:n,cwd:e,model:t===this.snapshot.settings.provider?this.snapshot.settings.model:r.defaultModel??`default`,filePaths:[]});if(!o)throw Error(`${r.displayName} does not support commit drafting.`);let s=await this.runCommand(o,e,{disableTimeout:!0});if(s.exitCode!==0)throw Error(this.commandFailureDetails(s,`${r.displayName} failed to generate a commit message.`));return Pc([s.stdout,s.stderr].filter(e=>e.trim().length>0).join(`
58
+ `))}async generateCommitMessageWithBridgeProvider(e,t,n){let r=Ho(t),i=await this.commitAssistantSkill(),a=t===this.snapshot.settings.provider?this.snapshot.settings.model:r.defaultModel,o=await this.request(`thread/start`,{cwd:e,model:a&&a!==`default`?a:null,modelProvider:t,approvalPolicy:`never`,sandbox:`read-only`,personality:`pragmatic`,ephemeral:!0,experimentalRawEvents:!1,persistExtendedHistory:!1}),s=await this.request(`turn/start`,{threadId:o.thread.id,input:Su(n,[],i?[i]:[],[],t),model:a&&a!==`default`?a:null,approvalPolicy:`never`,effort:this.snapshot.settings.reasoningEffort,personality:`pragmatic`,sandboxPolicy:{type:`readOnly`,access:{type:`restricted`,includePlatformDefaults:!0,readableRoots:[e]},networkAccess:!1}}),c=await this.waitForTurnCompletion(o.thread.id,s.turn.id);if(c.status===`failed`)throw Error(c.error?.message||`${r.displayName} failed to generate a commit message.`);return Pc(wu(c))}async generateCommitMessage(e){let t=await this.resolveGitWorkspaceCwd(e.cwd),n=Nc(await this.buildCommitGenerationContext(t)),r=Jc(e.providerId)?await this.generateCommitMessageWithCliProvider(t,e.providerId,n):await this.generateCommitMessageWithBridgeProvider(t,e.providerId,n);if(!r.trim())throw Error(`The selected provider returned an empty commit message.`);return r.trim()}async readGitHeadInfo(e){let[t,n]=await Promise.all([this.runCommand([`git`,`rev-parse`,`HEAD`],e,{timeoutMs:5e3}),this.runCommand([`git`,`branch`,`--show-current`],e,{timeoutMs:5e3})]);return{sha:t.exitCode===0&&t.stdout.trim()||null,branch:n.exitCode===0&&n.stdout.trim()||null}}async commitWorkingTree(e){let t=await this.resolveGitWorkspaceCwd(e.cwd),n=Fc(e.message);if(n.length===0)throw Error(`Enter a commit message first.`);let r=await this.readGitStatus(t);if(!this.hasGitStatusEntries(r))throw Error(`There are no git changes to commit.`);let i=await this.runCommand([`git`,`diff`,`--cached`,`--quiet`,`--exit-code`,`--no-ext-diff`],t,{timeoutMs:5e3});if(![0,1].includes(i.exitCode))throw Error(this.commandFailureDetails(i,`Failed to inspect staged changes.`));let a=!1;if(i.exitCode===0){let e=await this.runCommand([`git`,`add`,`-A`],t,{timeoutMs:15e3});if(e.exitCode!==0)throw Error(this.commandFailureDetails(e,`Failed to stage changes.`));a=!0}let o=[`git`,`commit`,`-m`,n[0],...n.slice(1).flatMap(e=>[`-m`,e])],s=await this.runCommand(o,t,{disableTimeout:!0});if(s.exitCode!==0)throw Error(this.commandFailureDetails(s,`Failed to create commit.`));let c=await this.readGitHeadInfo(t);return this.mutate(n=>{n.threads=n.threads.map(n=>n.thread.cwd===e.cwd||n.thread.cwd===t?{...n,thread:{...n.thread,cwd:t,gitInfo:{sha:c.sha,branch:c.branch,originUrl:n.thread.gitInfo?.originUrl??null},updatedAt:Math.floor(Date.now()/1e3)}}:n)}),{summary:s.stdout.trim()||s.stderr.trim()||`Committed changes.`,sha:c.sha,stagedAll:a}}providerCheckCwd(){return this.snapshot.directoryCatalogRoot||this.snapshot.threads[0]?.thread.cwd||`.`}defaultProviderSetupState(e){return yc([Ho(e)])[e]}defaultProviderAuthState(e){return bc([Ho(e)])[e]}upsertProviderAuthState(e,t){this.mutate(n=>{n.providerAuth[e]={...n.providerAuth[e],...t}})}appendProviderAuthOutput(e,t,n){let r=this.providerAuthRuns.get(e);if(!r||this.snapshot.providerAuth[r.providerId]?.processId!==e)return;let i=Jl(this.decodeStandaloneTerminalChunk(e,t,n));if(!i)return;r.output=fl(`${r.output}${i}`),t===`stderr`&&(r.stderr=fl(`${r.stderr}${i}`));let a=wl(r.providerId,r.output);this.upsertProviderAuthState(r.providerId,{status:a.status??`starting`,flow:r.flow,summary:a.summary??`Preparing provider sign-in…`,detail:a.detail??null,authUrl:a.authUrl??null,userCode:a.userCode??null,processId:e,updatedAt:$c()})}async finalizeProviderAuthRun(e,t){let n=this.providerAuthRuns.get(e);if(!n)return;if(this.snapshot.providerAuth[n.providerId]?.processId&&this.snapshot.providerAuth[n.providerId]?.processId!==e){this.providerAuthRuns.delete(e),this.flushStandaloneTerminalDecoders(e);return}let r=Ho(n.providerId),i=Jl(this.flushStandaloneTerminalDecoders(e)),a=t.type===`response`?Jl(`${t.response.stdout}${t.response.stderr}`):t.type===`disconnected`?t.detail:Tl(t.error)||`Unable to start provider sign-in.`,o=fl(`${n.output}${i}${Jl(a)}`),s=wl(n.providerId,o);if(this.providerAuthRuns.delete(e),n.cancelled){this.upsertProviderAuthState(n.providerId,{...this.defaultProviderAuthState(n.providerId),summary:`${r.displayName} sign-in cancelled.`,updatedAt:$c()});return}if(t.type!==`response`||t.response.exitCode!==0){let e=t.type===`response`?[t.response.stderr,n.stderr].filter(e=>e.trim().length>0).join(`
59
+ `).trim():t.type===`disconnected`?t.detail:Tl(t.error);this.upsertProviderAuthState(n.providerId,{status:`error`,flow:n.flow,summary:`${r.displayName} sign-in failed.`,detail:e||s.detail||`The provider CLI ended before Nomadex could verify the account.`,authUrl:s.authUrl??null,userCode:s.userCode??null,processId:null,updatedAt:$c()});return}this.upsertProviderAuthState(n.providerId,{status:`checking`,flow:n.flow,summary:`Verifying ${r.displayName} session…`,detail:`Nomadex is checking the local CLI session now.`,authUrl:s.authUrl??null,userCode:s.userCode??null,processId:null,updatedAt:$c()});try{await this.checkProviderSetup(n.providerId);let e=this.snapshot.providerSetup[n.providerId];this.upsertProviderAuthState(n.providerId,{status:e.status===`ready`?`completed`:`error`,flow:n.flow,summary:e.status===`ready`?`${r.displayName} is ready.`:`${r.displayName} sign-in finished, but setup is still not ready.`,detail:e.detail??e.summary,authUrl:e.status===`ready`?null:s.authUrl??null,userCode:e.status===`ready`?null:s.userCode??null,processId:null,updatedAt:$c()})}catch(e){this.upsertProviderAuthState(n.providerId,{status:`error`,flow:n.flow,summary:`${r.displayName} sign-in completed, but verification failed.`,detail:e instanceof Error?e.message:`Nomadex could not verify the new provider session.`,authUrl:s.authUrl??null,userCode:s.userCode??null,processId:null,updatedAt:$c()})}}markProviderAuthRunsDisconnected(e){let t=[...this.providerAuthRuns.keys()];for(let n of t)this.finalizeProviderAuthRun(n,{type:`disconnected`,detail:e})}async resolveCliBinary(e,t){let n=`
60
+ binary="${e}"
61
+ resolved=""
62
+
63
+ if command -v "$binary" >/dev/null 2>&1; then
64
+ resolved="$(command -v "$binary")"
65
+ fi
66
+
67
+ if [ -z "$resolved" ] && command -v npm >/dev/null 2>&1; then
68
+ prefix="$(npm config get prefix 2>/dev/null || true)"
69
+ if [ -n "$prefix" ] && [ -x "$prefix/bin/$binary" ]; then
70
+ resolved="$prefix/bin/$binary"
71
+ fi
72
+ fi
73
+
74
+ if [ -z "$resolved" ]; then
75
+ shopt -s nullglob
76
+ for candidate in "$HOME"/.nvm/versions/node/*/bin/"$binary" "$HOME"/.local/bin/"$binary"; do
77
+ if [ -x "$candidate" ]; then
78
+ resolved="$candidate"
79
+ break
80
+ fi
81
+ done
82
+ fi
83
+
84
+ if [ -z "$resolved" ]; then
85
+ exit 1
86
+ fi
87
+
88
+ version="$("$resolved" --version 2>/dev/null | head -n 1 || true)"
89
+ printf '%s\\n%s\\n' "$resolved" "$version"
90
+ `.trim(),r=await this.request(`command/exec`,{command:[`/bin/bash`,`-lc`,n],cwd:t,timeoutMs:5e3});if(r.exitCode!==0)return null;let i=dl([r.stdout,r.stderr].join(`
91
+ `)).trim().split(`
92
+ `).map(e=>e.trim()).filter(e=>e.length>0);return i.length===0?null:{path:i[0],version:i[1]??null}}async inspectOpenCodeSetup(e){let t=Ho(`opencode`),n=await this.resolveCliBinary(`opencode`,e);if(!n)return{...this.defaultProviderSetupState(`opencode`),status:`needsInstall`,summary:`OpenCode is not installed on the host machine.`,detail:t.installCommand??`Install the OpenCode CLI, then check again.`,installed:!1,configured:!1,authenticated:!1,checkedAt:$c()};let r=await this.request(`command/exec`,{command:[n.path,`auth`,`list`],cwd:e,timeoutMs:8e3}),i=dl([r.stdout,r.stderr].join(`
93
+ `)).trim();if(r.exitCode!==0)return{...this.defaultProviderSetupState(`opencode`),status:`error`,summary:`OpenCode is installed, but its auth status could not be read.`,detail:i||`OpenCode auth check failed.`,installed:!0,version:n.version,checkedAt:$c()};let a=i.match(/(\d+)\s+credentials?/iu),o=a?Number(a[1]):0,s=i.match(/Credentials\s+([^\n]+)/iu)?.[1]?.trim()??null;return{...this.defaultProviderSetupState(`opencode`),status:o>0?`ready`:`needsAuth`,summary:o>0?`OpenCode credentials detected.`:`OpenCode is installed, but no provider credentials are configured.`,detail:o>0?`${o} credential${o===1?``:`s`} available for OpenCode.`:"Use the sign-in action below, or run `opencode auth login` on the host machine, then check again.",installed:!0,configured:o>0,authenticated:o>0,version:n.version,sourcePath:s,checkedAt:$c()}}async inspectQwenCodeSetup(e){let t=Ho(`qwen-code`),n=await this.resolveCliBinary(`qwen`,e);if(!n)return{...this.defaultProviderSetupState(`qwen-code`),status:`needsInstall`,summary:`Qwen Code is not installed on the host machine.`,detail:t.installCommand??`Install the Qwen Code CLI, then check again.`,installed:!1,configured:!1,authenticated:!1,checkedAt:$c()};let r=await this.request(`command/exec`,{command:[`node`,`-e`,`const fs = require("node:fs");
94
+ const os = require("node:os");
95
+ const path = require("node:path");
96
+ const projectRoot = process.argv[1] || process.cwd();
97
+ const candidates = [
98
+ path.join(projectRoot, ".qwen", "settings.json"),
99
+ path.join(os.homedir(), ".qwen", "settings.json"),
100
+ ];
101
+ const oauthPath = path.join(os.homedir(), ".qwen", "oauth_creds.json");
102
+ let settingsPath = null;
103
+ let settings = null;
104
+ let parseError = null;
105
+ for (const candidate of candidates) {
106
+ if (!fs.existsSync(candidate)) {
107
+ continue;
108
+ }
109
+ settingsPath = candidate;
110
+ try {
111
+ settings = JSON.parse(fs.readFileSync(candidate, "utf8"));
112
+ } catch (error) {
113
+ parseError = error instanceof Error ? error.message : String(error);
114
+ }
115
+ break;
116
+ }
117
+ const selectedType = settings?.security?.auth?.selectedType ?? null;
118
+ const modelProviders = settings?.modelProviders && typeof settings.modelProviders === "object"
119
+ ? Object.values(settings.modelProviders).filter(Array.isArray).flat()
120
+ : [];
121
+ const inlineEnvCount = settings?.env && typeof settings.env === "object"
122
+ ? Object.values(settings.env).filter((value) => typeof value === "string" && value.trim().length > 0).length
123
+ : 0;
124
+ const envBackedProviderCount = modelProviders.filter(
125
+ (entry) =>
126
+ entry &&
127
+ typeof entry === "object" &&
128
+ typeof entry.envKey === "string" &&
129
+ entry.envKey.length > 0 &&
130
+ typeof process.env[entry.envKey] === "string" &&
131
+ process.env[entry.envKey].trim().length > 0,
132
+ ).length;
133
+ console.log(JSON.stringify({
134
+ settingsPath,
135
+ parseError,
136
+ selectedType,
137
+ modelProviderCount: modelProviders.length,
138
+ inlineEnvCount,
139
+ envBackedProviderCount,
140
+ hasOauthCreds: fs.existsSync(oauthPath),
141
+ oauthPath,
142
+ }));`,e],cwd:e,timeoutMs:5e3}),i=dl([r.stdout,r.stderr].join(`
143
+ `)).trim();if(r.exitCode!==0)return{...this.defaultProviderSetupState(`qwen-code`),status:`error`,summary:`Qwen Code is installed, but its setup could not be inspected.`,detail:i||`Qwen Code setup check failed.`,installed:!0,version:n.version,checkedAt:$c()};let a=null;try{a=JSON.parse(r.stdout.trim())}catch{a=null}if(!a)return{...this.defaultProviderSetupState(`qwen-code`),status:`error`,summary:`Qwen Code setup output could not be parsed.`,detail:i||`Unexpected Qwen Code setup output.`,installed:!0,version:n.version,checkedAt:$c()};let o=a.selectedType,s=a.modelProviderCount>0||a.inlineEnvCount>0||a.envBackedProviderCount>0,c=a.hasOauthCreds,l=a.settingsPath??(a.hasOauthCreds?a.oauthPath:null);return a.parseError?{...this.defaultProviderSetupState(`qwen-code`),status:`error`,summary:`Qwen settings.json is invalid.`,detail:a.parseError,installed:!0,configured:!1,authenticated:!1,version:n.version,sourcePath:l,checkedAt:$c()}:!o&&c?{...this.defaultProviderSetupState(`qwen-code`),status:`ready`,summary:`Qwen OAuth credentials detected.`,detail:"Nomadex will launch Qwen Code with `--auth-type=qwen-oauth`, so a missing selected auth type in settings will not block runs.",installed:!0,configured:!0,authenticated:!0,version:n.version,sourcePath:l,checkedAt:$c()}:o?o===`qwen-oauth`?{...this.defaultProviderSetupState(`qwen-code`),status:a.hasOauthCreds?`ready`:`needsAuth`,summary:a.hasOauthCreds?`Qwen OAuth credentials detected.`:`Qwen OAuth is selected, but cached credentials are missing or expired.`,detail:a.hasOauthCreds?`Qwen Code can use the cached OAuth session on this host.`:`Use the sign-in action below, then check again.`,installed:!0,configured:!0,authenticated:a.hasOauthCreds,version:n.version,sourcePath:l,checkedAt:$c()}:{...this.defaultProviderSetupState(`qwen-code`),status:s?`ready`:`needsConfig`,summary:s?`Qwen Code is configured for ${o}.`:`Qwen Code selected ${o}, but no provider credentials were found.`,detail:s?a.settingsPath?`Headless runs will use the configured Qwen settings for this host.`:`Qwen Code is relying on environment-level configuration.`:"Add provider credentials in `~/.qwen/settings.json` or export the required API key env vars, then check again.",installed:!0,configured:s,authenticated:s,version:n.version,sourcePath:l,checkedAt:$c()}:{...this.defaultProviderSetupState(`qwen-code`),status:`needsConfig`,summary:`Qwen Code is installed, but no auth type is selected.`,detail:"Use the sign-in action below, or set `security.auth.selectedType` in `~/.qwen/settings.json` manually.",installed:!0,configured:!1,authenticated:!1,version:n.version,sourcePath:l,checkedAt:$c()}}async checkProviderSetup(e=this.snapshot.settings.provider){let t=Ho(e);this.mutate(t=>{t.providerSetup[e]={...this.defaultProviderSetupState(e),status:`checking`,summary:`Checking setup…`}});let n;n=t.transportKind===`cli`?e===`opencode`?await this.inspectOpenCodeSetup(this.providerCheckCwd()):e===`qwen-code`?await this.inspectQwenCodeSetup(this.providerCheckCwd()):{...this.defaultProviderSetupState(e),status:`error`,summary:`${t.displayName} setup checks are not wired yet.`,detail:`This provider still needs its runtime integration.`,installed:!1,configured:!1,authenticated:!1,checkedAt:$c()}:{...this.defaultProviderSetupState(e),status:`ready`,summary:`Managed by the Nomadex bridge.`,detail:`This provider does not use a local CLI binary.`,installed:null,configured:null,authenticated:null,checkedAt:$c()},this.mutate(t=>{t.providerSetup[e]=n})}async ensureQwenOAuthSelection(e){let t=await this.request(`command/exec`,{command:[`node`,`-e`,`const fs = require("node:fs");
144
+ const os = require("node:os");
145
+ const path = require("node:path");
146
+ const settingsPath = path.join(os.homedir(), ".qwen", "settings.json");
147
+ let settings = {};
148
+
149
+ if (fs.existsSync(settingsPath)) {
150
+ settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
151
+ }
152
+
153
+ if (!settings.security || typeof settings.security !== "object") {
154
+ settings.security = {};
155
+ }
156
+
157
+ if (!settings.security.auth || typeof settings.security.auth !== "object") {
158
+ settings.security.auth = {};
159
+ }
160
+
161
+ settings.security.auth.selectedType = "qwen-oauth";
162
+ fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
163
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\\n");
164
+ console.log(settingsPath);`],cwd:e,timeoutMs:5e3});if(t.exitCode!==0){let e=Jl([t.stderr,t.stdout].join(`
165
+ `)).trim();throw Error(e||`Unable to prepare Qwen Code for OAuth sign-in.`)}}async startProviderAuth(e=this.snapshot.settings.provider,t){let n=Ho(e);if(n.transportKind!==`cli`)throw Error(`${n.displayName} does not use local CLI sign-in.`);if(e!==`opencode`&&e!==`qwen-code`)throw Error(`${n.displayName} sign-in is not wired yet.`);let r=[...this.providerAuthRuns.entries()].find(([,t])=>t.providerId===e);if(r){let[e,t]=r;t.cancelled=!0;try{await this.request(`command/exec/terminate`,{processId:e})}catch{}}let i=this.providerCheckCwd(),a=e===`opencode`?`opencode`:`qwen`,o=await this.resolveCliBinary(a,i);if(!o)throw Error(`${n.displayName} is not installed on the host machine.`);let s=t??(e===`opencode`?`apiKey`:`oauth`);e===`qwen-code`&&await this.ensureQwenOAuthSelection(i);let c=e===`opencode`?[o.path,`auth`,`login`,`-p`,`opencode`]:[o.path,`--auth-type=qwen-oauth`,`-p`,`ping`],l=Xl();this.providerAuthRuns.set(l,{providerId:e,flow:s,output:``,stderr:``,cancelled:!1}),this.upsertProviderAuthState(e,{...this.defaultProviderAuthState(e),status:`starting`,flow:s,summary:`Starting ${n.displayName} sign-in…`,detail:e===`opencode`?`Preparing the OpenCode Zen API key flow.`:`Preparing the local Qwen OAuth sign-in.`,processId:l,startedAt:$c(),updatedAt:$c()}),this.request(`command/exec`,{command:c,cwd:i,processId:l,tty:!0,streamStdin:!0,streamStdoutStderr:!0,disableTimeout:!0,size:{cols:120,rows:24}}).then(e=>{this.finalizeProviderAuthRun(l,{type:`response`,response:e})}).catch(e=>{this.finalizeProviderAuthRun(l,{type:`error`,error:e})})}async submitProviderAuthSecret(e=this.snapshot.settings.provider,t){let n=t.trim();if(!n)throw Error(`Enter the provider secret first.`);let r=[...this.providerAuthRuns.entries()].find(([,t])=>t.providerId===e);if(!r)throw Error(`No provider sign-in is currently waiting for input.`);let[i]=r;await this.request(`command/exec/write`,{processId:i,deltaBase64:yu(`${n}\n`)}),this.upsertProviderAuthState(e,{status:`checking`,summary:e===`opencode`?`Submitting OpenCode Zen API key…`:`Submitting provider sign-in input…`,detail:e===`opencode`?`Nomadex sent the API key to the local OpenCode CLI. Waiting for verification.`:`Waiting for the local provider CLI to verify the submitted input.`,updatedAt:$c()})}async cancelProviderAuth(e=this.snapshot.settings.provider){let t=[...this.providerAuthRuns.entries()].find(([,t])=>t.providerId===e);if(!t){this.upsertProviderAuthState(e,{...this.defaultProviderAuthState(e),updatedAt:$c()});return}let[n,r]=t;r.cancelled=!0;try{await this.request(`command/exec/terminate`,{processId:n})}catch{}}async clearOpenCodeAuth(e){let t=await this.resolveCliBinary(`opencode`,e);if(!t)throw Error(`OpenCode is not installed on the host machine.`);let n=await this.request(`command/exec`,{command:[t.path,`auth`,`logout`],cwd:e,timeoutMs:1e4});if(n.exitCode!==0){let e=Jl([n.stderr,n.stdout].join(`
166
+ `)).trim();throw Error(e||`Unable to clear the current OpenCode account.`)}}async clearQwenOAuthSession(e){let t=await this.request(`command/exec`,{command:[`node`,`-e`,`const fs = require("node:fs");
167
+ const os = require("node:os");
168
+ const path = require("node:path");
169
+ const qwenRoot = path.join(os.homedir(), ".qwen");
170
+ for (const fileName of ["oauth_creds.json", "oauth_creds.lock"]) {
171
+ const target = path.join(qwenRoot, fileName);
172
+ try {
173
+ fs.rmSync(target, { force: true });
174
+ } catch {}
175
+ }
176
+ console.log(qwenRoot);`],cwd:e,timeoutMs:5e3});if(t.exitCode!==0){let e=Jl([t.stderr,t.stdout].join(`
177
+ `)).trim();throw Error(e||`Unable to clear the current Qwen Code account.`)}}async switchProviderAccount(e=this.snapshot.settings.provider,t){let n=Ho(e);if(n.transportKind!==`cli`)throw Error(`${n.displayName} does not use local CLI sign-in.`);let r=this.providerCheckCwd();if(await this.cancelProviderAuth(e),e===`opencode`)await this.clearOpenCodeAuth(r);else if(e===`qwen-code`)await this.clearQwenOAuthSession(r);else throw Error(`${n.displayName} account switching is not wired yet.`);this.mutate(t=>{t.providerSetup[e]={...t.providerSetup[e],status:`needsAuth`,summary:`${n.displayName} session cleared.`,detail:`Start a new sign-in to attach a different account.`,authenticated:!1,checkedAt:$c()},t.providerAuth[e]={...this.defaultProviderAuthState(e),summary:`${n.displayName} session cleared.`,updatedAt:$c()}}),await this.startProviderAuth(e,t)}async startProjectTerminal(e,t){let n=Xl(),r=`/bin/bash -l`,i=`Project shell`;return this.standaloneTerminalMeta.set(n,{threadId:e,cwd:t,command:r,title:i}),this.mutate(a=>{K(a,e,e=>({...e,terminals:[Zl({processId:n,cwd:t,command:r,title:i}),...e.terminals.filter(e=>e.processId!==n)]}))}),this.request(`command/exec`,{command:[`/bin/bash`,`-l`],processId:n,tty:!0,streamStdin:!0,streamStdoutStderr:!0,disableTimeout:!0,cwd:t,size:{cols:120,rows:32}}).then(e=>{this.finalizeStandaloneTerminal(n,{type:`response`,response:e})}).catch(e=>{this.finalizeStandaloneTerminal(n,{type:`error`,error:e})}),n}async sendTerminalInput(e,t){await this.request(`command/exec/write`,{processId:e,deltaBase64:yu(t)})}async terminateTerminal(e){await this.request(`command/exec/terminate`,{processId:e})}async updateSettings(e){e.provider&&Go(e.provider),this.mutate(t=>{if(t.settings={...t.settings,...e},e.provider){let e=Ho(t.settings.provider);t.transport={...t.transport,endpoint:this.getDefaultWsUrl(e)}}t.lastSavedAt=$c()});let t=bu(e);t.length!==0&&await this.request(`config/batchWrite`,{edits:t.map(e=>({keyPath:e.keyPath,value:e.value,mergeStrategy:`replace`})),reloadUserConfig:!0})}async toggleFeatureFlag(e){let t=this.snapshot.featureFlags.find(t=>t.name===e);t&&(await this.request(`config/value/write`,{keyPath:`features.${e}`,value:!t.enabled,mergeStrategy:`replace`}),this.mutate(t=>{t.featureFlags=t.featureFlags.map(t=>t.name===e?{...t,enabled:!t.enabled}:t),t.lastSavedAt=$c()}))}async toggleInstalledSkill(e){let t=this.snapshot.installedSkills.find(t=>t.id===e);if(!t)return;let n=await this.request(`skills/config/write`,{path:t.path,enabled:!t.enabled});this.mutate(t=>{t.installedSkills=t.installedSkills.map(t=>t.id===e?{...t,enabled:n.effectiveEnabled}:t)})}async installSkill(e){await this.request(`skills/remote/export`,{hazelnutId:e});let[t,n]=await Promise.allSettled([this.request(`skills/list`,{}),this.request(`skills/remote/list`,{hazelnutScope:`personal`,productSurface:`codex`,enabled:!0})]);this.mutate(e=>{t.status===`fulfilled`&&(e.installedSkills=t.value.data.flatMap(e=>e.skills.map(Ul))),n.status===`fulfilled`&&(e.remoteSkills=n.value.data.map(Wl),e.remoteSkillsError=null)})}async toggleMcpAuth(e){let t=this.snapshot.mcpServers.find(t=>t.name===e);if(!t)return;if(t.authStatus===`notLoggedIn`){await this.request(`mcpServer/oauth/login`,{name:e});return}let n=await this.request(`mcpServerStatus/list`,{});this.mutate(e=>{e.mcpServers=n.data})}async startChatGptLogin(){let e=await this.request(`account/login/start`,{type:`chatgpt`});return e.type===`chatgpt`?(this.mutate(t=>{t.account.loginInProgress=!0,t.account.pendingLoginId=e.loginId,t.account.loginError=null}),e.authUrl):(await this.refreshAccount(),null)}async loginWithApiKey(e){await this.request(`account/login/start`,{type:`apiKey`,apiKey:e}),this.mutate(e=>{e.account.loginInProgress=!1,e.account.pendingLoginId=null,e.account.loginError=null}),await this.refreshAccount()}async logoutAccount(){await this.request(`account/logout`,void 0),this.mutate(e=>{e.account={...e.account,planType:`Signed out`,workspace:`No active account`,authMode:`signedOut`,loggedIn:!1,loginInProgress:!1,pendingLoginId:null,loginError:null,usageWindows:[],rateUsed:0,rateLimit:100,credits:`Sign in to view rate limits`}}),await this.refreshAccount()}async cleanTerminals(e){await this.request(`thread/backgroundTerminals/clean`,{threadId:e}),this.mutate(t=>{K(t,e,e=>({...e,terminals:e.terminals.filter(e=>e.status===`running`)}))})}async rollbackToTurn(e,t){await this.ensureThreadLoaded(e);let n=this.snapshot.threads.find(t=>t.thread.id===e);if(!n)throw Error(`Thread not found.`);if(n.thread.turns.some(e=>e.status===`inProgress`))throw Error(`Wait for the current response to finish before rolling back.`);let r=Wu(n.thread.turns).filter(e=>e.status!==`inProgress`),i=r.findIndex(e=>e.id===t);if(i===-1)throw Error(`The selected turn can no longer be rolled back.`);let a=r.slice(i);if(a.length===0)throw Error(`There is no completed turn to roll back.`);let o=n.thread.cwd.trim()||this.snapshot.directoryCatalogRoot?.trim()||``,s=a.slice().reverse().flatMap(e=>e.items.filter(e=>e.type===`fileChange`&&e.status===`completed`).slice().reverse());if(s.length>0){if(!o)throw Error(`Rollback requires a local working directory for this thread.`);for(let e of s)for(let t of e.changes.slice().reverse())await this.rollbackLocalFileChange(o,t)}let c=await this.request(`thread/rollback`,{threadId:e,numTurns:a.length});this.mutate(t=>{let n=t.threads.find(t=>t.thread.id===e);if(!n)return;let r=ou(c.thread.turns.map(e=>ad(e,n.thread.turns.find(t=>t.id===e.id)))),i={...n.thread,...c.thread,cwd:o||c.thread.cwd||n.thread.cwd,turns:r};K(t,e,e=>({...e,thread:i,steers:(e.steers??[]).filter(e=>r.some(t=>t.id===e.turnId)),approvals:e.approvals.filter(e=>!e.turnId||r.some(t=>t.id===e.turnId)),review:nu(i)}))})}async resolveApproval(e,t){let n=this.approvalMap.get(e);n&&(n.method===`item/commandExecution/requestApproval`&&this.respond(n.requestId,{decision:t}),n.method===`item/fileChange/requestApproval`&&this.respond(n.requestId,{decision:t}),n.method===`item/permissions/requestApproval`&&this.respond(n.requestId,{permissions:t===`accept`||t===`acceptForSession`?n.params.permissions??{}:{},scope:t===`acceptForSession`?`session`:`turn`}),(n.method===`execCommandApproval`||n.method===`applyPatchApproval`)&&this.respond(n.requestId,{decision:bl(t)}),this.mutate(r=>{let i=U(n.params.threadId,U(n.params.conversationId)),a=r.threads.find(e=>e.thread.id===i);a&&(a.approvals=a.approvals.map(n=>n.id===e?{...n,state:yl(t)}:n))}))}async submitQuestion(e,t){let n=this.approvalMap.get(e);n&&(this.respond(n.requestId,{answers:t}),this.mutate(r=>{K(r,U(n.params.threadId),n=>({...n,approvals:n.approvals.map(n=>n.id===e?{...n,state:`submitted`,detail:`${n.detail} · ${Object.values(t).flat().filter(Boolean).join(`, `)}`}:n)}))}))}async submitMcp(e,t,n){let r=this.approvalMap.get(e);if(!r)return;let i=null;if(t===`accept`&&n.trim())try{i=JSON.parse(n)}catch{i=n}this.respond(r.requestId,{action:t,content:i,_meta:null}),this.mutate(n=>{K(n,U(r.params.threadId),n=>({...n,approvals:n.approvals.map(n=>n.id===e?{...n,state:t===`accept`?`submitted`:`declined`}:n)}))})}buildApproval(e,t,n){if(t===`item/commandExecution/requestApproval`){let r=n,i=vl(r.additionalPermissions);return{id:e,kind:`command`,title:`Approve command execution`,detail:r.reason??`The agent is requesting permission to run a command.`,risk:r.networkApprovalContext||i.length>0?`high`:`medium`,state:`pending`,threadId:r.threadId,turnId:r.turnId,itemId:r.itemId,method:t,command:r.command??void 0,cwd:r.cwd??void 0,availableDecisions:gl(r.availableDecisions,[`accept`,`decline`]),permissionsSummary:i.length>0?i:void 0}}if(t===`item/fileChange/requestApproval`){let r=n;return{id:e,kind:`patch`,title:`Approve file changes`,detail:r.reason??`The agent is requesting write access for file updates.`,risk:r.grantRoot?`high`:`medium`,state:`pending`,threadId:r.threadId,turnId:r.turnId,itemId:r.itemId,method:t,files:r.grantRoot?[r.grantRoot]:void 0,availableDecisions:r.grantRoot?[`accept`,`acceptForSession`,`decline`]:[`accept`,`decline`]}}if(t===`item/tool/requestUserInput`)return{id:e,kind:`question`,title:`User input requested`,detail:`A tool requested structured user input.`,risk:`low`,state:`pending`,threadId:U(n.threadId),turnId:n.turnId?U(n.turnId):null,itemId:n.itemId?U(n.itemId):null,method:t,questions:Array.isArray(n.questions)?n.questions.map(e=>{let t=e;return{id:U(t.id),header:U(t.header),question:U(t.question),isSecret:!!t.isSecret,isOther:!!t.isOther,options:Array.isArray(t.options)?t.options.map(e=>({label:U(e.label),description:U(e.description)})):[]}}):[]};if(t===`mcpServer/elicitation/request`)return{id:e,kind:`mcp`,title:`MCP elicitation`,detail:U(n.message,`An MCP server needs client input.`),risk:`medium`,state:`pending`,threadId:U(n.threadId),turnId:n.turnId?U(n.turnId):null,method:t,serverName:U(n.serverName),form:U(n.mode)===`url`?U(n.url):JSON.stringify(n.requestedSchema??{},null,2)};if(t===`item/permissions/requestApproval`){let r=vl(n.permissions);return{id:e,kind:`permissions`,title:`Approve additional permissions`,detail:U(n.reason,`The agent requested additional permissions.`),risk:`high`,state:`pending`,threadId:U(n.threadId),turnId:U(n.turnId),itemId:U(n.itemId),method:t,availableDecisions:[`accept`,`decline`],permissionsSummary:r.length>0?r:void 0}}if(t===`execCommandApproval`){let r=n;return{id:e,kind:`command`,title:`Approve command execution`,detail:U(r.reason)||`The agent is requesting permission to run a command.`,risk:`medium`,state:`pending`,threadId:U(r.conversationId),turnId:null,itemId:U(r.approvalId,U(r.callId))||null,method:t,command:_l(r.command),cwd:U(r.cwd)||void 0,availableDecisions:[`accept`,`acceptForSession`,`decline`]}}if(t===`applyPatchApproval`){let r=n,i=[...Object.keys(r.fileChanges??{}),...U(r.grantRoot)?[U(r.grantRoot)]:[]];return{id:e,kind:`patch`,title:`Approve file changes`,detail:U(r.reason)||`The agent is requesting write access for file updates.`,risk:r.grantRoot?`high`:`medium`,state:`pending`,threadId:U(r.conversationId),turnId:null,itemId:U(r.callId)||null,method:t,files:i.length>0?[...new Set(i)]:void 0,availableDecisions:r.grantRoot?[`accept`,`acceptForSession`,`decline`]:[`accept`,`decline`]}}return null}handleServerRequest(e,t,n){let r=this.buildApproval(e,t,n);!r||!r.threadId||(this.approvalMap.set(r.id,{requestId:e,method:t,params:n}),this.mutate(e=>{K(e,r.threadId,e=>({...e,approvals:[r,...e.approvals.filter(e=>e.id!==r.id)],thread:{...e.thread,status:{type:`active`,activeFlags:[`waitingOnApproval`]}}}))}))}handleNotification(e,t){switch(e){case`thread/started`:{let e=t.thread;this.mutate(t=>{lu(t,uu(e,t.threads.find(t=>t.thread.id===e.id)))});return}case`thread/name/updated`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,thread:{...e.thread,name:t.threadName?U(t.threadName):e.thread.name}}))});return;case`thread/status/changed`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,thread:{...e.thread,status:t.status}}))});return;case`turn/started`:{let e=t.turn;this.mutate(n=>{K(n,U(t.threadId),t=>{let n=Wu(t.thread.turns),r=ad(e,n.find(t=>t.id===e.id));return{...t,thread:{...t.thread,turns:ou([...n.filter(t=>t.id!==e.id),r]),updatedAt:Math.floor(Date.now()/1e3)}}})});return}case`turn/completed`:{let e=t.turn;this.mutate(n=>{K(n,U(t.threadId),t=>{let n=Wu(t.thread.turns).map(t=>t.id===e.id?ad(e,t):t);return{...t,thread:{...t.thread,turns:ou(n),updatedAt:Math.floor(Date.now()/1e3)},review:nu({...t.thread,turns:ou(n)})}})});return}case`error`:{let e=U(t.threadId),n=U(t.turnId),r=!!t.willRetry,i=t.error,a=i&&typeof i==`object`?{message:U(i.message),codexErrorInfo:i.codexErrorInfo??null,additionalDetails:typeof i.additionalDetails==`string`?U(i.additionalDetails):null}:null;if(!e||!n||!a?.message)return;this.mutate(t=>{K(t,e,e=>{let t=su(e.thread.turns,n).map(e=>e.id===n?{...e,status:r?e.status:`failed`,error:a}:e);return{...e,thread:{...e.thread,turns:t,updatedAt:Math.floor(Date.now()/1e3)}}})});return}case`turn/plan/updated`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,plan:{explanation:U(t.explanation,e.plan?.explanation??`Plan updated.`),steps:Array.isArray(t.plan)?t.plan.map(e=>{let t=e;return{step:U(t.step),status:t.status}}):e.plan?.steps??[]}}))});return;case`thread/tokenUsage/updated`:this.mutate(e=>{let n=t.tokenUsage;K(e,U(t.threadId),e=>({...e,tokenUsage:{input:n.total.inputTokens,output:n.total.outputTokens,cached:n.total.cachedInputTokens}}))});return;case`model/rerouted`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,reroutes:[{id:`${U(t.turnId)}:${U(t.fromModel)}:${U(t.toModel)}`,from:U(t.fromModel),to:U(t.toModel),reason:typeof t.reason==`string`?t.reason:`model rerouted`,at:$c()},...e.reroutes]}))});return;case`item/started`:case`item/completed`:{let n=t.item,r=e===`item/started`,i=U(t.threadId),a=U(t.turnId);this.mutate(e=>{K(e,i,t=>{let o=su(Wu(t.thread.turns),a,r?`inProgress`:`completed`).map(e=>{if(e.id!==a)return e;let t=[...e.items],r;if(n.type===`userMessage`)for(let e=t.length-1;e>=0;--e)zu(t[e])&&(r=t[e],t.splice(e,1));let i=n;if(n.type===`userMessage`&&r&&(i=ld(n,r)),n.type===`fileChange`){let e=t.find(e=>Uu(e));t=t.filter(e=>!Uu(e)),n.changes.length===0&&e?.changes.length&&(i={...n,changes:e.changes})}let o=t.findIndex(e=>e.id===i.id);return o===-1?t.push(i):(i=ld(i,t[o]),t[o]=i),{...e,items:t}});return n.type===`agentMessage`&&ru(e,i,a,n.id,`text`,n.text,r),n.type===`commandExecution`&&ru(e,i,a,n.id,`aggregatedOutput`,n.aggregatedOutput??``,r),r||iu(e,n.id),{...t,thread:{...t.thread,turns:o,updatedAt:Math.floor(Date.now()/1e3)},terminals:Ql({...t.thread,turns:o},t.terminals),review:nu({...t.thread,turns:o})}})});return}case`item/agentMessage/delta`:{let e=U(t.threadId),n=U(t.turnId),r=U(t.itemId);this.mutate(i=>{K(i,e,a=>{let o=su(Wu(a.thread.turns),n).map(a=>{if(a.id!==n)return a;let o=(a.items.some(e=>e.id===r&&e.type===`agentMessage`)?a.items:[...a.items,{type:`agentMessage`,id:r,text:``,phase:null}]).map(e=>e.id===r&&e.type===`agentMessage`?{...e,text:e.text+U(t.delta)}:e),s=o.find(e=>e.id===r&&e.type===`agentMessage`);return s&&ru(i,e,n,s.id,`text`,s.text,!0),{...a,items:o}});return{...a,thread:{...a.thread,turns:o,updatedAt:Math.floor(Date.now()/1e3)}}})});return}case`item/commandExecution/outputDelta`:{let e=U(t.threadId),n=U(t.turnId),r=U(t.itemId),i=typeof t.processId==`string`?t.processId:null,a=U(t.delta);this.mutate(o=>{K(o,e,s=>{let c=su(s.thread.turns,n).map(c=>{if(c.id!==n)return c;let l=(c.items.some(e=>e.id===r&&e.type===`commandExecution`)?c.items:[...c.items,{type:`commandExecution`,id:r,command:U(t.command),cwd:U(t.cwd,s.thread.cwd),processId:i,status:`inProgress`,commandActions:[],aggregatedOutput:``,exitCode:null,durationMs:null}]).map(e=>e.id===r&&e.type===`commandExecution`?{...e,processId:e.processId??i,aggregatedOutput:`${e.aggregatedOutput??``}${a}`}:e),u=l.find(e=>e.id===r&&e.type===`commandExecution`);return u&&ru(o,e,n,u.id,`aggregatedOutput`,u.aggregatedOutput??``,!0),{...c,items:l}}),l={...s.thread,turns:c,updatedAt:Math.floor(Date.now()/1e3)};return{...s,thread:l,terminals:Ql(l,s.terminals)}})});return}case`command/exec/outputDelta`:{let e=U(t.processId),n=t.stream===`stderr`?`stderr`:`stdout`,r=U(t.deltaBase64);if(!e||!r)return;if(this.providerAuthRuns.has(e)){this.appendProviderAuthOutput(e,n,r);return}if(this.externalProviderRuns.has(e)){let t=this.decodeStandaloneTerminalChunk(e,n,r),i=this.externalProviderRuns.get(e);if(!i)return;n===`stderr`?i.stderr=`${i.stderr}${t}`:this.appendExternalProviderDelta(i.threadId,i.turnId,i.itemId,t,!0);return}let i=this.decodeStandaloneTerminalChunk(e,n,r);this.updateStandaloneTerminalLog(e,i);return}case`item/fileChange/outputDelta`:{let e=U(t.threadId),n=U(t.turnId),r=U(t.itemId),i=U(t.delta);this.mutate(t=>{K(t,e,e=>{let t=su(e.thread.turns,n).map(e=>{if(e.id!==n)return e;let t=e.items.find(e=>e.id===r&&e.type===`fileChange`)?e.items.map(e=>e.id===r&&e.type===`fileChange`?Ju(e,i):e):[...e.items.filter(e=>!Uu(e)),qu(r,[Ku(i)])];return{...e,items:t}}),a={...e.thread,turns:t,updatedAt:Math.floor(Date.now()/1e3)};return{...e,thread:a,review:nu(a)}})});return}case`turn/diff/updated`:{let e=U(t.threadId),n=U(t.turnId),r=U(t.diff);this.mutate(t=>{K(t,e,e=>{let t=su(e.thread.turns,n).map(e=>{if(e.id!==n)return e;let t=e.items.some(e=>e.type===`fileChange`&&!Uu(e));return{...e,items:t?e.items:id(e.items,n,r)}}),i={...e.thread,turns:t,updatedAt:Math.floor(Date.now()/1e3)};return{...e,thread:i,review:nu(i)}})});return}case`item/plan/delta`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,plan:e.plan?{...e.plan,explanation:`${e.plan.explanation}${U(t.delta)}`}:{explanation:U(t.delta),steps:[]}}))});return;case`item/reasoning/summaryPartAdded`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,thread:{...e.thread,turns:e.thread.turns.map(e=>e.id===U(t.turnId)?{...e,items:e.items.map(e=>e.id!==U(t.itemId)||e.type!==`reasoning`?e:{...e,summary:e.summary.length>Number(t.summaryIndex)?e.summary:[...e.summary,``]})}:e)}}))});return;case`item/reasoning/summaryTextDelta`:case`item/reasoning/textDelta`:{let n=e===`item/reasoning/summaryTextDelta`?`summaryIndex`:`contentIndex`,r=e===`item/reasoning/summaryTextDelta`?`summary`:`content`;this.mutate(e=>{K(e,U(t.threadId),e=>({...e,thread:{...e.thread,turns:e.thread.turns.map(e=>e.id===U(t.turnId)?{...e,items:e.items.map(e=>{if(e.id!==U(t.itemId)||e.type!==`reasoning`)return e;let i=Number(t[n]??0),a=[...e[r]];for(;a.length<=i;)a.push(``);return a[i]=`${a[i]}${U(t.delta)}`,{...e,[r]:a}})}:e)}}))});return}case`serverRequest/resolved`:{let e=U(t.requestId);this.approvalMap.delete(e),this.mutate(n=>{K(n,U(t.threadId),t=>({...t,approvals:t.approvals.filter(t=>t.id!==e)}))});return}case`skills/changed`:this.refreshSkills();return;case`mcpServer/oauthLogin/completed`:this.refreshMcpServers();return;case`account/updated`:this.refreshAccount();return;case`account/login/completed`:{let e=!!t.success,n=typeof t.loginId==`string`?t.loginId:null,r=typeof t.error==`string`?t.error:null;this.mutate(t=>{(!t.account.pendingLoginId||!n||t.account.pendingLoginId===n)&&(t.account.loginInProgress=!1,t.account.pendingLoginId=null,t.account.loginError=e?null:r)}),e&&this.refreshAccount();return}case`account/rateLimits/updated`:this.mutate(e=>{e.account=Vl(e.account,t.rateLimits)});return;case`thread/compacted`:this.mutate(e=>{K(e,U(t.threadId),e=>({...e,thread:{...e.thread,turns:e.thread.turns.map(e=>e.id===U(t.turnId)?{...e,items:e.items.some(e=>e.type===`contextCompaction`)?e.items:[...e.items,{type:`contextCompaction`,id:`compact-${e.id}`}]}:e)}}))})}}async refreshSkills(){let e=await this.request(`skills/list`,{});this.mutate(t=>{t.installedSkills=e.data.flatMap(e=>e.skills.map(Ul))})}async refreshMcpServers(){let e=await this.request(`mcpServerStatus/list`,{});this.mutate(t=>{t.mcpServers=e.data})}async refreshAccount(){let[e,t]=await Promise.all([this.request(`account/read`,{}),this.request(`account/rateLimits/read`,{})]);this.mutate(n=>{n.account=Hl(e,t,n.account)})}},dd=(0,I.memo)(function({className:e,text:t}){let n=Array.from(t),r=n.reduce((e,t)=>e+(t.trim().length>0?1:0),0)||1,i=Math.min(2200,Math.max(1100,900+r*70)),a=0;return(0,L.jsx)(`span`,{"aria-label":t,className:H(e,`live-status-signal`),role:`text`,children:n.map((e,t)=>{let n=e.trim().length>0,o=n?a++:-1,s=n?(r-1-o)*i/r:0,c=n?{animationDelay:`-${s}ms`,animationDuration:`${i}ms`}:void 0;return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:H(`live-status-signal-glyph`,!n&&`gap`),style:c,children:e===` `?`\xA0`:e},`${e}-${t}`)})})}),fd=(0,I.memo)(function({tone:e}){return e===`command`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`rect`,{className:`live-status-icon-frame`,x:`2.5`,y:`4`,rx:`4`,ry:`4`,width:`15`,height:`12`}),(0,L.jsx)(`path`,{className:`live-status-icon-mark`,d:`m7 8-2 2 2 2`}),(0,L.jsx)(`path`,{className:`live-status-icon-line`,d:`M10.5 12.5h4`})]}):e===`editing`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`path`,{className:`live-status-icon-mark`,d:`m6 14 1.1-3.6 5.8-5.8 2.5 2.5-5.8 5.8L6 14Z`}),(0,L.jsx)(`path`,{className:`live-status-icon-line`,d:`M11.8 5.8 14.2 8.2`})]}):e===`tool`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`path`,{className:`live-status-icon-frame`,d:`M10 3.8 11.8 7l3.6 1.4-3.6 1.5-1.8 3.3-1.8-3.3-3.6-1.5L8.2 7 10 3.8Z`}),(0,L.jsx)(`circle`,{className:`live-status-icon-dot tool-core`,cx:`10`,cy:`8.4`,r:`1`})]}):e===`agent`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`circle`,{className:`live-status-icon-frame node-a`,cx:`6`,cy:`10`,r:`2.2`}),(0,L.jsx)(`circle`,{className:`live-status-icon-frame node-b`,cx:`13.8`,cy:`6.3`,r:`2`}),(0,L.jsx)(`circle`,{className:`live-status-icon-frame node-c`,cx:`13.8`,cy:`13.7`,r:`2`}),(0,L.jsx)(`path`,{className:`live-status-icon-line`,d:`M8 9 11.8 7.2m-3.8 3 3.8 2.1`})]}):e===`search`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`circle`,{className:`live-status-icon-frame`,cx:`8.6`,cy:`8.6`,r:`4.8`}),(0,L.jsx)(`path`,{className:`live-status-icon-mark`,d:`m12.1 12.1 3.2 3.2`}),(0,L.jsx)(`circle`,{className:`live-status-icon-dot search-dot`,cx:`8.6`,cy:`8.6`,r:`0.95`})]}):e===`image`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`rect`,{className:`live-status-icon-frame`,x:`3.1`,y:`4.1`,rx:`3`,ry:`3`,width:`13.8`,height:`11.8`}),(0,L.jsx)(`circle`,{className:`live-status-icon-dot image-dot`,cx:`7`,cy:`7.5`,r:`1`}),(0,L.jsx)(`path`,{className:`live-status-icon-line`,d:`M5.4 13.1 8.1 10.4l1.9 1.8 2.5-2.5 2.1 2.2`})]}):e===`approval`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`path`,{className:`live-status-icon-frame`,d:`M10 2.8 15.5 5v4.6c0 3.2-2.2 5.8-5.5 7.5-3.3-1.7-5.5-4.3-5.5-7.5V5l5.5-2.2Z`}),(0,L.jsx)(`path`,{className:`live-status-icon-mark`,d:`m7.4 10.1 1.7 1.8 3.6-3.8`})]}):e===`error`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`circle`,{className:`live-status-icon-frame`,cx:`10`,cy:`10`,r:`6.2`}),(0,L.jsx)(`path`,{className:`live-status-icon-mark`,d:`m7.2 7.2 5.6 5.6m0-5.6-5.6 5.6`})]}):e===`writing`?(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`path`,{className:`live-status-icon-frame`,d:`M4.2 6.8c0-1.4 1.1-2.6 2.6-2.6h6.4c1.4 0 2.6 1.2 2.6 2.6v4.3c0 1.5-1.2 2.7-2.7 2.7H10l-2.9 2.2v-2.2H6.8c-1.5 0-2.6-1.2-2.6-2.7V6.8Z`}),(0,L.jsx)(`path`,{className:`live-status-icon-line wave-a`,d:`M6.2 9.8c.8-.8 1.7-.8 2.5 0s1.7.8 2.5 0 1.7-.8 2.5 0`})]}):(0,L.jsxs)(`svg`,{"aria-hidden":`true`,className:H(`live-status-icon`,e),viewBox:`0 0 20 20`,children:[(0,L.jsx)(`circle`,{className:`live-status-icon-frame`,cx:`10`,cy:`10`,r:`5.8`}),(0,L.jsx)(`circle`,{className:`live-status-icon-dot dot-a`,cx:`10`,cy:`5`,r:`1`}),(0,L.jsx)(`circle`,{className:`live-status-icon-dot dot-b`,cx:`14.2`,cy:`12.4`,r:`1`}),(0,L.jsx)(`circle`,{className:`live-status-icon-dot dot-c`,cx:`5.8`,cy:`12.4`,r:`1`})]})}),pd=(0,I.memo)(function({overlay:e,pendingApprovalsCount:t,queuedCount:n}){if(!e&&t===0)return null;let r=e?.errorText?`error`:t>0?`approval`:e?.activityTone??`thinking`,i=t>0?`Waiting approval`:r===`error`?`Error`:e?.activityLabel??`Thinking`,a=t>0?null:e?.errorText??e?.activityDetails[0]??null;return(0,L.jsxs)(`div`,{"aria-live":`polite`,className:H(`live-status-inline`,r),role:`status`,title:a??i,children:[(0,L.jsxs)(`div`,{className:`live-status-inline-main`,children:[(0,L.jsx)(fd,{tone:r}),(0,L.jsx)(dd,{className:`live-status-inline-label`,text:i}),a?(0,L.jsx)(dd,{className:`live-status-inline-detail`,text:a}):null]}),t>0||n>0?(0,L.jsxs)(`div`,{className:`live-status-inline-meta`,children:[t>0?(0,L.jsxs)(`span`,{className:`live-status-inline-count`,children:[t,` pending`]}):null,n>0?(0,L.jsxs)(`span`,{className:`live-status-inline-count`,children:[n,` queued`]}):null]}):null]})}),md={chat:`chat`,editor:`editor`,ops:`ops`,agents:`agents`,review:`review`,skills:`skills`,mcp:`mcp`,settings:`@dm1n-acce$$`},hd=e=>md[e],gd=e=>typeof e==`string`?Object.entries(md).find(([,t])=>t===e)?.[0]??null:null,_d=Sc().mentionCatalog,vd=new Set([`.git`,`node_modules`]),yd=`void`,bd=`nomadex-ui-theme`,xd=[`auto`,`ro`,`fa`],Sd={auto:`Auto`,ro:`Read-only`,fa:`Full Access`},Cd={auto:`auto`,ro:`ro`,fa:`fa`},wd={files:`Files`,graph:`Branches`,diff:`Diff`,terminal:`Terminal`,agents:`Agents`,config:`Config`},q={slash:`Ask Nomadex… / for slash commands · @ mention · $ skills · ! shell · Ctrl+G editor`,mention:`Attach a file or folder to the conversation`,skill:`Attach an installed or marketplace skill`},Td=[{cmd:`/permissions`,dsc:`Switch Auto, Read-only, or Full Access approval mode`},{cmd:`/apps`,dsc:`Browse connectors and insert $app-slug into the prompt`},{cmd:`/compact`,dsc:`Summarize the conversation and free context`},{cmd:`/diff`,dsc:`Open the git diff view in the right panel`},{cmd:`/exit`,dsc:`End the current session`},{cmd:`/feedback`,dsc:`Send logs and feedback to maintainers`},{cmd:`/fork`,dsc:`Fork the current session into a new thread`},{cmd:`/init`,dsc:`Generate AGENTS.md in the workspace`},{cmd:`/logout`,dsc:`Sign out of the active account`},{cmd:`/mcp`,dsc:`Open Model Context Protocol server controls`},{cmd:`/mention`,dsc:`Attach a file or folder to the current message`},{cmd:`/model`,dsc:`Choose the active model and effort`},{cmd:`/new`,dsc:`Start a fresh conversation`},{cmd:`/plan`,dsc:`Switch to plan-first collaboration mode`},{cmd:`/personality`,dsc:`Choose the assistant communication style`},{cmd:`/ps`,dsc:`Open the terminal dock`},{cmd:`/quit`,dsc:`End the current session`},{cmd:`/resume`,dsc:`Resume a saved session`},{cmd:`/review`,dsc:`Run a review pass against the working tree`},{cmd:`/clear`,dsc:`Clear the current conversation view`},{cmd:`/copy`,dsc:`Copy the latest assistant response`},{cmd:`/skills`,dsc:`Open installed and marketplace skills`},{cmd:`/status`,dsc:`Show model, tokens, approvals, git, and MCP state`},{cmd:`/theme`,dsc:`Preview and save UI theme variants`},{cmd:`/experimental`,dsc:`Toggle experimental feature flags`}],Ed=[{id:`void`,name:`Void`,description:`Teal-black glass with a cold terminal edge.`,mode:`dark`,themeColor:`#17384b`,swatches:[`#081019`,`#3de8c8`,`#4a9eff`]},{id:`ember`,name:`Ember`,description:`Burnt amber surfaces with warm relay highlights.`,mode:`dark`,themeColor:`#4b2616`,swatches:[`#140c08`,`#ff8c42`,`#ffcc44`]},{id:`plasma`,name:`Plasma`,description:`Electric magenta-violet glow without neon overload.`,mode:`dark`,themeColor:`#4b215e`,swatches:[`#110b18`,`#c060ff`,`#ff60c0`]},{id:`arctic`,name:`Arctic`,description:`Icy cyan layers with cleaner blue signal tones.`,mode:`dark`,themeColor:`#163a4f`,swatches:[`#071523`,`#40c8ff`,`#40ffcc`]},{id:`crimson`,name:`Crimson`,description:`Red-black control room with warmer alert contrast.`,mode:`dark`,themeColor:`#4a1d28`,swatches:[`#140707`,`#ff4466`,`#ff8844`]},{id:`matrix`,name:`Matrix`,description:`Green phosphor palette for a sharper terminal feel.`,mode:`dark`,themeColor:`#183720`,swatches:[`#041007`,`#00ff46`,`#80ff40`]},{id:`solar`,name:`Solar`,description:`Warm light mode with paper-like translucent panes.`,mode:`light`,themeColor:`#e8d5bc`,swatches:[`#f8f4ec`,`#e05820`,`#d4980a`]},{id:`midnight`,name:`Midnight`,description:`Muted indigo glass for a calmer late-night shell.`,mode:`dark`,themeColor:`#2a3260`,swatches:[`#0d1020`,`#8888ff`,`#ff88cc`]}],Dd=e=>Ed.some(t=>t.id===e),Od=e=>Ed.find(t=>t.id===e)??Ed[0],kd=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`,Ad=()=>typeof window>`u`?!0:window.innerWidth>=768,jd=e=>[...e].sort((e,t)=>t.thread.updatedAt-e.thread.updatedAt),Md=e=>e.startsWith(`optimistic-turn:`)?1:0,Nd=e=>[...e].sort((e,t)=>{let n=Md(e.id)-Md(t.id);return n===0?e.id.localeCompare(t.id):n}),Pd=e=>e.approvalPolicy===`untrusted`?`ro`:e.approvalPolicy===`never`?`fa`:`auto`,Fd=e=>e===`ro`?{approvalPolicy:`untrusted`,sandboxMode:`read-only`}:e===`fa`?{approvalPolicy:`never`,sandboxMode:`danger-full-access`}:{approvalPolicy:`on-request`,sandboxMode:`workspace-write`},Id=e=>{switch(e){case`ops`:return`files`;case`agents`:return`agents`;case`review`:return`diff`;case`mcp`:case`settings`:return`config`;default:return null}},Ld=e=>{switch(e){case`files`:case`graph`:case`terminal`:return`ops`;case`agents`:return`agents`;case`diff`:return`review`;case`config`:return`settings`}},Rd=e=>e===`connected`?`gn`:e===`error`?`rd`:`yw`,zd=e=>{let t=e.split(`/`).filter(Boolean);if(t[0]===`thread`&&t[1])return{threadId:t[1],section:`chat`};if(t[0]===`threads`&&t[1]&&t[2]){let e=gd(t[2]);return{threadId:t[1],section:e??`chat`}}return t[0]===`threads`&&t[1]?{threadId:t[1],section:`chat`}:{threadId:null,section:`chat`}},Bd=e=>{let t=new Date(e*1e3),n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),a=Math.round((r.getTime()-i.getTime())/864e5);return a<=0?`Today`:a===1?`Yesterday`:`Earlier`},Vd=e=>e.name??e.preview??`Untitled Session`,Hd=(e,t=76)=>e.length<=t?e:`${e.slice(0,t-3)}...`,Ud=e=>`${Math.max(1,Math.round(e/1024))} KB`,Wd=(e,t,n)=>t.map(t=>({id:`upload-${t.id}`,name:t.name,path:Do(Ho(n),e,t.name),kind:`file`})),Gd=e=>[...e].sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`directory`?-1:1),Kd=e=>{let t=`${e.replace(/\/+$/u,``)}/`,n=new Map;return _d.forEach(r=>{if(!r.path.startsWith(t))return;let i=r.path.slice(t.length);if(!i)return;let[a,...o]=i.split(`/`);if(!(!a||vd.has(a))){if(o.length===0){n.set(a,{...r,id:`${e}:${a}`,name:a});return}n.has(a)||n.set(a,{id:`${e}:${a}`,name:a,path:`${t}${a}`,kind:`directory`})}}),Gd([...n.values()])},qd=(e,t)=>{let n=e.replace(/\/+$/u,``);return t===n||t.startsWith(`${n}/`)},Jd=(e,t)=>fs(e,t).text,Yd=e=>{if(e.thread.name?.trim())return e.thread.name.trim();let t=Nd(e.thread.turns);for(let e of[...t].reverse())for(let t of[...e.items].reverse()){if(t.type===`userMessage`){let e=Jd(t).trim();if(e)return e}if(t.type===`agentMessage`){let e=t.text.trim();if(e)return e}}return Vd(e.thread)},Xd=e=>e.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`),Zd=e=>(e.name.split(`/`).filter(Boolean).at(-1)??e.name).replace(/\s+/gu,`-`),Qd=e=>`@${Zd(e)}`,$d=(e,t)=>{let n=Qd(t);return RegExp(`(^|\\s)${Xd(n)}(?=$|\\s|[.,!?;:])`,`u`).test(e)},ef=(e,t)=>{let n=Qd(t),r=/(?:^|\s)@[^\s]*$/u,i=$d(e,t);return r.test(e)?e.replace(r,e=>`${e.startsWith(` `)?` `:``}${n} `):i?e:`${e}${e&&!/\s$/u.test(e)?` `:``}${n} `},tf=(e,t)=>{if(!e)return[];let n=new Map(t.map(e=>[Qd(e),e])),r=[],i=/@[\w./-]+/gu,a=0;for(let t of e.matchAll(i)){let i=t[0],o=n.get(i)??null,s=t.index??0;s>a&&r.push({text:e.slice(a,s),mention:null}),r.push({text:i,mention:o}),a=s+i.length}return a<e.length&&r.push({text:e.slice(a),mention:null}),r},nf=e=>e.replace(/\\/gu,`/`).split(`/`).filter(Boolean).pop()??e,rf=(e,t)=>{let n=e.trim();return n&&!n.startsWith(`/`)&&!n.includes(`\\`)?n:nf(t||n)},af=e=>{let t=nf(e).trim();if(!t||!t.includes(`.`))return``;let n=t.split(`.`).pop()?.toLowerCase()??``;return!n||n===t.toLowerCase()?``:n},of=new Set([`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]),sf=new Set([`doc`,`docx`,`md`,`mdx`,`odt`,`pages`,`pdf`,`ppt`,`pptx`,`rtf`,`txt`]),cf=new Set([`bash`,`c`,`cpp`,`css`,`go`,`html`,`java`,`js`,`json`,`jsx`,`kt`,`py`,`rb`,`rs`,`scss`,`sh`,`sql`,`toml`,`ts`,`tsx`,`xml`,`yaml`,`yml`,`zsh`]),lf=new Set([`ai`,`avif`,`gif`,`heic`,`jpeg`,`jpg`,`m4a`,`mkv`,`mov`,`mp3`,`mp4`,`png`,`psd`,`svg`,`wav`,`webm`,`webp`]),uf=new Set([`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`xz`,`zip`]),df=e=>of.has(e)?`sheet`:sf.has(e)?`document`:cf.has(e)?`code`:lf.has(e)?`media`:uf.has(e)?`archive`:`generic`,ff=e=>{switch(e){case`sheet`:return`Spreadsheet`;case`document`:return`Document`;case`code`:return`Code file`;case`media`:return`Media file`;case`archive`:return`Archive`;default:return`Attachment`}},pf=(e,t)=>t===`sheet`?e===`csv`||e===`tsv`?e.toUpperCase():`XLS`:t===`document`?e===`pdf`?`PDF`:e===`ppt`||e===`pptx`?`PPT`:e?e.slice(0,3).toUpperCase():`DOC`:t===`code`?e===`json`?`JSON`:e===`yaml`||e===`yml`?`YAML`:e?e.slice(0,4).toUpperCase():`CODE`:t===`media`?[`mp4`,`mov`,`webm`,`mkv`].includes(e)?`VID`:[`mp3`,`wav`,`m4a`].includes(e)?`AUD`:e?e.slice(0,3).toUpperCase():`IMG`:t===`archive`?e?e.slice(0,3).toUpperCase():`ZIP`:e?e.slice(0,4).toUpperCase():`FILE`,mf=(e,t)=>{let n=rf(e,t),r=af(n||t||``),i=df(r);return{badge:pf(r,i),kindLabel:ff(i),title:n,tone:i}},hf=(e,t)=>{if(!e||t.length>0)return!1;let n=e.thread.name?.trim();return n&&n!==`New Session`&&n!==`New Thread`&&n!==`Untitled Session`?!0:!!e.thread.preview?.trim()},gf=e=>{if(!e.error?.message)return``;let t=e.error.additionalDetails?.trim();return t?`${e.error.message}\n\n${t}`:e.error.message},_f=e=>e?typeof e==`string`?e:Object.keys(e)[0]??null:null,vf=(e,t,n)=>`${e}:${t}:${n}`,yf=e=>e.replace(/^\.?\//u,``).replace(/\\/gu,`/`),bf=e=>e.type===`add`?`new`:e.type===`delete`?`deleted`:e.move_path?`renamed`:`modified`,xf=e=>e.trim()?e.split(`
178
+ `).reduce((e,t)=>(t.startsWith(`@@`)?e.hunks+=1:t.startsWith(`+`)&&!t.startsWith(`+++`)?e.additions+=1:t.startsWith(`-`)&&!t.startsWith(`---`)&&(e.removals+=1),e),{additions:0,removals:0,hunks:0}):{additions:0,removals:0,hunks:0},Sf=e=>{if(!e.trim())return[];let t=[],n=0,r=0;return e.split(`
179
+ `).forEach((e,i)=>{let a=e.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/u);if(a){n=Number(a[1]),r=Number(a[2]),t.push({id:`hunk-${i}`,kind:`hunk`,text:e,oldLine:null,newLine:null});return}if(e.startsWith(`diff --git `)||e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`new file mode `)||e.startsWith(`deleted file mode `)||e.startsWith(`rename from `)||e.startsWith(`rename to `)){t.push({id:`meta-${i}`,kind:`meta`,text:e,oldLine:null,newLine:null});return}if(e.startsWith(`+`)&&!e.startsWith(`+++`)){t.push({id:`add-${i}`,kind:`add`,text:e,oldLine:null,newLine:r}),r+=1;return}if(e.startsWith(`-`)&&!e.startsWith(`---`)){t.push({id:`rem-${i}`,kind:`rem`,text:e,oldLine:n,newLine:null}),n+=1;return}t.push({id:`ctx-${i}`,kind:`ctx`,text:e,oldLine:n,newLine:r}),n+=1,r+=1}),t},Cf=e=>e.visible===0?e.total:e.visible,wf=(e,t,n)=>{e.streams=e.streams.map(e=>e.threadId===t&&e.turnId===n?{...e,total:e.visible}:e)};function Tf(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ef=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Df=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Of={};function kf(e,t){return((t||Of).jsx?Df:Ef).test(e)}var Af=/[ \t\n\f\r]/g;function jf(e){return typeof e==`object`?e.type===`text`?Mf(e.value):!1:Mf(e)}function Mf(e){return e.replace(Af,``)===``}var Nf=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Nf.prototype.normal={},Nf.prototype.property={},Nf.prototype.space=void 0;function Pf(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Nf(n,r,t)}function Ff(e){return e.toLowerCase()}var If=class{constructor(e,t){this.attribute=t,this.property=e}};If.prototype.attribute=``,If.prototype.booleanish=!1,If.prototype.boolean=!1,If.prototype.commaOrSpaceSeparated=!1,If.prototype.commaSeparated=!1,If.prototype.defined=!1,If.prototype.mustUseProperty=!1,If.prototype.number=!1,If.prototype.overloadedBoolean=!1,If.prototype.property=``,If.prototype.spaceSeparated=!1,If.prototype.space=void 0;var Lf=Ie({boolean:()=>J,booleanish:()=>zf,commaOrSpaceSeparated:()=>Uf,commaSeparated:()=>Hf,number:()=>Y,overloadedBoolean:()=>Bf,spaceSeparated:()=>Vf}),Rf=0,J=Wf(),zf=Wf(),Bf=Wf(),Y=Wf(),Vf=Wf(),Hf=Wf(),Uf=Wf();function Wf(){return 2**++Rf}var Gf=Object.keys(Lf),Kf=class extends If{constructor(e,t,n,r){let i=-1;if(super(e,t),qf(this,`space`,r),typeof n==`number`)for(;++i<Gf.length;){let e=Gf[i];qf(this,Gf[i],(n&Lf[e])===Lf[e])}}};Kf.prototype.defined=!0;function qf(e,t,n){n&&(e[t]=n)}function Jf(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Kf(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ff(r)]=r,n[Ff(a.attribute)]=r}return new Nf(t,n,e.space)}var Yf=Jf({properties:{ariaActiveDescendant:null,ariaAtomic:zf,ariaAutoComplete:null,ariaBusy:zf,ariaChecked:zf,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:Vf,ariaCurrent:null,ariaDescribedBy:Vf,ariaDetails:null,ariaDisabled:zf,ariaDropEffect:Vf,ariaErrorMessage:null,ariaExpanded:zf,ariaFlowTo:Vf,ariaGrabbed:zf,ariaHasPopup:null,ariaHidden:zf,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vf,ariaLevel:Y,ariaLive:null,ariaModal:zf,ariaMultiLine:zf,ariaMultiSelectable:zf,ariaOrientation:null,ariaOwns:Vf,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:zf,ariaReadOnly:zf,ariaRelevant:null,ariaRequired:zf,ariaRoleDescription:Vf,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:zf,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Xf(e,t){return t in e?e[t]:t}function Zf(e,t){return Xf(e,t.toLowerCase())}var Qf=Jf({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Hf,acceptCharset:Vf,accessKey:Vf,action:null,allow:null,allowFullScreen:J,allowPaymentRequest:J,allowUserMedia:J,alt:null,as:null,async:J,autoCapitalize:null,autoComplete:Vf,autoFocus:J,autoPlay:J,blocking:Vf,capture:null,charSet:null,checked:J,cite:null,className:Vf,cols:Y,colSpan:null,content:null,contentEditable:zf,controls:J,controlsList:Vf,coords:Y|Hf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:J,defer:J,dir:null,dirName:null,disabled:J,download:Bf,draggable:zf,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:J,formTarget:null,headers:Vf,height:Y,hidden:Bf,high:Y,href:null,hrefLang:null,htmlFor:Vf,httpEquiv:Vf,id:null,imageSizes:null,imageSrcSet:null,inert:J,inputMode:null,integrity:null,is:null,isMap:J,itemId:null,itemProp:Vf,itemRef:Vf,itemScope:J,itemType:Vf,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:J,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:J,muted:J,name:null,nonce:null,noModule:J,noValidate:J,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:J,optimum:Y,pattern:null,ping:Vf,placeholder:null,playsInline:J,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:J,referrerPolicy:null,rel:Vf,required:J,reversed:J,rows:Y,rowSpan:Y,sandbox:Vf,scope:null,scoped:J,seamless:J,selected:J,shadowRootClonable:J,shadowRootDelegatesFocus:J,shadowRootMode:null,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:zf,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:J,useMap:null,value:zf,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vf,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:J,declare:J,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:J,noHref:J,noShade:J,noWrap:J,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:zf,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:J,disableRemotePlayback:J,prefix:null,property:null,results:Y,security:null,unselectable:null},space:`html`,transform:Zf}),$f=Jf({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Uf,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:Vf,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:J,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Hf,g2:Hf,glyphName:Hf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:Uf,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Y,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vf,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Uf,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Uf,rev:Uf,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Uf,requiredFeatures:Uf,requiredFonts:Uf,requiredFormats:Uf,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:Uf,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Uf,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Uf,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Xf}),ep=Jf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),tp=Jf({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Zf}),np=Jf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),rp={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},ip=/[A-Z]/g,ap=/-[a-z]/g,op=/^data[-\w.:]+$/i;function sp(e,t){let n=Ff(t),r=t,i=If;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&op.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ap,lp);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ap.test(e)){let n=e.replace(ip,cp);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Kf}return new i(r,t)}function cp(e){return`-`+e.toLowerCase()}function lp(e){return e.charAt(1).toUpperCase()}var up=Pf([Yf,Qf,ep,tp,np],`html`),dp=Pf([Yf,$f,ep,tp,np],`svg`);function fp(e){return e.join(` `).trim()}var pp=F(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
180
+ `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),mp=F((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(pp());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),hp=F((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gp=F(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mp()),r=hp();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_p=yp(`end`),vp=yp(`start`);function yp(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bp(e){let t=vp(e),n=_p(e);if(t&&n)return{start:t,end:n}}function xp(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Cp(e.position):`start`in e||`end`in e?Cp(e):`line`in e||`column`in e?Sp(e):``}function Sp(e){return wp(e&&e.line)+`:`+wp(e&&e.column)}function Cp(e){return Sp(e&&e.start)+`-`+Sp(e&&e.end)}function wp(e){return e&&typeof e==`number`?e:1}var Tp=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xp(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Tp.prototype.file=``,Tp.prototype.name=``,Tp.prototype.reason=``,Tp.prototype.message=``,Tp.prototype.stack=``,Tp.prototype.column=void 0,Tp.prototype.line=void 0,Tp.prototype.ancestors=void 0,Tp.prototype.cause=void 0,Tp.prototype.fatal=void 0,Tp.prototype.place=void 0,Tp.prototype.ruleId=void 0,Tp.prototype.source=void 0;var Ep=Re(gp(),1),Dp={}.hasOwnProperty,Op=new Map,kp=/[A-Z]/g,Ap=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),jp=new Set([`td`,`th`]),Mp=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Np(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Wp(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Up(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dp:up,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Pp(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Pp(e,t,n){if(t.type===`element`)return Fp(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ip(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Rp(e,t,n);if(t.type===`mdxjsEsm`)return Lp(e,t);if(t.type===`root`)return zp(e,t,n);if(t.type===`text`)return Bp(e,t)}function Fp(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dp,e.schema=i),e.ancestors.push(t);let a=Xp(e,t.tagName,!1),o=Gp(e,t),s=qp(e,t);return Ap.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!jf(e):!0})),Vp(e,o,a,t),Hp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ip(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Zp(e,t.position)}function Lp(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zp(e,t.position)}function Rp(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dp,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Xp(e,t.name,!0),o=Kp(e,t),s=qp(e,t);return Vp(e,o,a,t),Hp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zp(e,t,n){let r={};return Hp(r,qp(e,t)),e.create(t,e.Fragment,r,n)}function Bp(e,t){return t.value}function Vp(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Hp(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Up(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Wp(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vp(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Gp(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Dp.call(t.properties,i)){let a=Jp(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&jp.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Kp(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Zp(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Zp(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function qp(e,t){let n=[],r=-1,i=e.passKeys?new Map:Op;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Pp(e,a,o);s!==void 0&&n.push(s)}return n}function Jp(e,t,n){let r=sp(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Tf(n):fp(n)),r.property===`style`){let t=typeof n==`object`?n:Yp(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Qp(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rp[r.property]||r.property:r.attribute,n]}}function Yp(e,t){try{return(0,Ep.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Tp("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Mp+`#cannot-parse-style-attribute`,r}}function Xp(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=kf(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=kf(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Dp.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zp(e)}function Zp(e,t){let n=new Tp("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Mp+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Qp(e){let t={},n;for(n in e)Dp.call(e,n)&&(t[$p(n)]=e[n]);return t}function $p(e){let t=e.replace(kp,em);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function em(e){return`-`+e.toLowerCase()}var tm={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},nm={};function rm(e,t){let n=t||nm;return im(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function im(e,t,n){if(om(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return am(e.children,t,n)}return Array.isArray(e)?am(e,t,n):``}function am(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=im(e[i],t,n);return r.join(``)}function om(e){return!!(e&&typeof e==`object`)}var sm=document.createElement(`i`);function cm(e){let t=`&`+e+`;`;sm.innerHTML=t;let n=sm.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function lm(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function um(e,t){return e.length>0?(lm(e,e.length,0,t),e):t}var dm={}.hasOwnProperty;function fm(e){let t={},n=-1;for(;++n<e.length;)pm(t,e[n]);return t}function pm(e,t){let n;for(n in t){let r=(dm.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){dm.call(r,a)||(r[a]=[]);let e=i[a];mm(r[a],Array.isArray(e)?e:e?[e]:[])}}}function mm(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);lm(e,0,0,r)}function hm(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function gm(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var _m=Dm(/[A-Za-z]/),vm=Dm(/[\dA-Za-z]/),ym=Dm(/[#-'*+\--9=?A-Z^-~]/);function bm(e){return e!==null&&(e<32||e===127)}var xm=Dm(/\d/),Sm=Dm(/[\dA-Fa-f]/),Cm=Dm(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function wm(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}var Tm=Dm(/\p{P}|\p{S}/u),Em=Dm(/\s/);function Dm(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Om(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&vm(e.charCodeAt(n+1))&&vm(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function km(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Am={tokenize:jm};function jm(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),km(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return X(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Mm={tokenize:Pm},Nm={tokenize:Fm};function Pm(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return lm(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nm,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Nm,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return X(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;lm(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Fm(e,t,n){return km(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Im(e){if(e===null||wm(e)||Em(e))return 1;if(Tm(e))return 2}function Lm(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Rm={name:`attention`,resolveAll:zm,tokenize:Bm};function zm(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Vm(d,-c),Vm(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=um(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=um(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=um(l,Lm(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=um(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=um(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,lm(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Bm(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Im(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Im(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Vm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Hm={name:`autolink`,tokenize:Um};function Um(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return _m(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||vm(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||vm(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||bm(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):ym(t)?(e.consume(t),l):n(t)}function u(e){return vm(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||vm(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Wm={partial:!0,tokenize:Gm};function Gm(e,t,n){return r;function r(t){return Z(t)?km(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||X(e)?t(e):n(e)}}var Km={continuation:{tokenize:Jm},exit:Ym,name:`blockQuote`,tokenize:qm};function qm(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Jm(e,t,n){let r=this;return i;function i(t){return Z(t)?km(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Km,t,n)(r)}}function Ym(e){e.exit(`blockQuote`)}var Xm={name:`characterEscape`,tokenize:Zm};function Zm(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Cm(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Qm={name:`characterReference`,tokenize:$m};function $m(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=vm,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Sm,u):(e.enter(`characterReferenceValue`),a=7,o=xm,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===vm&&!cm(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var eh={partial:!0,tokenize:rh},th={concrete:!0,name:`codeFenced`,tokenize:nh};function nh(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?km(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||X(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(eh,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),km(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||X(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||X(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?km(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||X(t)?e.check(eh,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||X(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?km(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?km(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||X(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function rh(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ih={name:`codeIndented`,tokenize:oh},ah={partial:!0,tokenize:sh};function oh(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),km(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):X(t)?e.attempt(ah,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||X(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function sh(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):km(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):X(e)?i(e):n(e)}}var ch={name:`codeText`,previous:uh,resolve:lh,tokenize:dh};function lh(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function uh(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function dh(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||X(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var fh=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&ph(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),ph(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ph(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);ph(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);ph(this.left,t.reverse())}}};function ph(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mh(e){let t={},n=-1,r,i,a,o,s,c,l,u=new fh(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,hh(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return lm(e,0,1/0,u.slice(0)),!l}function hh(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var gh={resolve:vh,tokenize:yh},_h={partial:!0,tokenize:bh};function vh(e){return mh(e),e}function yh(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):X(t)?e.check(_h,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function bh(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),km(e,a,`linePrefix`)}function a(i){if(i===null||X(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function xh(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||bm(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||X(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||wm(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||bm(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Sh(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):X(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||X(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Ch(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),km(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||X(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function wh(e,t){let n;return r;function r(i){return X(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?km(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Th={name:`definition`,tokenize:Dh},Eh={partial:!0,tokenize:Oh};function Dh(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Sh.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=gm(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return wm(t)?wh(e,l)(t):l(t)}function l(t){return xh(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Eh,d,d)(t)}function d(t){return Z(t)?km(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||X(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Oh(e,t,n){return r;function r(t){return wm(t)?wh(e,i)(t):n(t)}function i(t){return Ch(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?km(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||X(e)?t(e):n(e)}}var kh={name:`hardBreakEscape`,tokenize:Ah};function Ah(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return X(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var jh={name:`headingAtx`,resolve:Mh,tokenize:Nh};function Mh(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},lm(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Nh(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||wm(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||X(n)?(e.exit(`atxHeading`),t(n)):Z(n)?km(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||wm(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ph=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Fh=[`pre`,`script`,`style`,`textarea`],Ih={concrete:!0,name:`htmlFlow`,resolveTo:zh,tokenize:Bh},Lh={partial:!0,tokenize:Hh},Rh={partial:!0,tokenize:Vh};function zh(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Bh(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ae):_m(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):_m(a)?(e.consume(a),i=4,r.interrupt?t:ae):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ae):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return _m(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||wm(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Fh.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ph.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||vm(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||_m(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||vm(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||X(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||wm(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||X(t)?O(t):Z(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),re):t===60&&i===1?(e.consume(t),k):t===62&&i===4?(e.consume(t),oe):t===63&&i===3?(e.consume(t),ae):t===93&&i===5?(e.consume(t),ie):X(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Lh,se,ee)(t)):t===null||X(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(Rh,te,se)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||X(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function re(t){return t===45?(e.consume(t),ae):O(t)}function k(t){return t===47?(e.consume(t),o=``,A):O(t)}function A(t){if(t===62){let n=o.toLowerCase();return Fh.includes(n)?(e.consume(t),oe):O(t)}return _m(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),A):O(t)}function ie(t){return t===93?(e.consume(t),ae):O(t)}function ae(t){return t===62?(e.consume(t),oe):t===45&&i===2?(e.consume(t),ae):O(t)}function oe(t){return t===null||X(t)?(e.exit(`htmlFlowData`),se(t)):(e.consume(t),oe)}function se(n){return e.exit(`htmlFlow`),t(n)}}function Vh(e,t,n){let r=this;return i;function i(t){return X(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Hh(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Wm,t,n)}}var Uh={name:`htmlText`,tokenize:Wh};function Wh(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):_m(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):_m(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):X(t)?(o=d,k(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?re(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):X(t)?(o=h,k(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?re(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?re(t):X(t)?(o=v,k(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):X(t)?(o=y,k(t)):(e.consume(t),y)}function b(e){return e===62?re(e):y(e)}function x(t){return _m(t)?(e.consume(t),S):n(t)}function S(t){return t===45||vm(t)?(e.consume(t),S):C(t)}function C(t){return X(t)?(o=C,k(t)):Z(t)?(e.consume(t),C):re(t)}function w(t){return t===45||vm(t)?(e.consume(t),w):t===47||t===62||wm(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),re):t===58||t===95||_m(t)?(e.consume(t),E):X(t)?(o=T,k(t)):Z(t)?(e.consume(t),T):re(t)}function E(t){return t===45||t===46||t===58||t===95||vm(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):X(t)?(o=D,k(t)):Z(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):X(t)?(o=O,k(t)):Z(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):X(t)?(o=ee,k(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||wm(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||wm(e)?T(e):n(e)}function re(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function k(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),A}function A(t){return Z(t)?km(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var Gh={name:`labelEnd`,resolveAll:Yh,resolveTo:Xh,tokenize:Zh},Kh={tokenize:Qh},qh={tokenize:$h},Jh={tokenize:eg};function Yh(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&lm(e,0,e.length,n),e}function Xh(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=um(s,e.slice(a+1,a+r+3)),s=um(s,[[`enter`,u,t]]),s=um(s,Lm(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=um(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=um(s,e.slice(o+1)),s=um(s,[[`exit`,c,t]]),lm(e,a,e.length,s),e}function Zh(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(gm(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Kh,u,o?u:d)(t):t===91?e.attempt(qh,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Jh,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Qh(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return wm(t)?wh(e,a)(t):a(t)}function a(t){return t===41?u(t):xh(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return wm(t)?wh(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Ch(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return wm(t)?wh(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function $h(e,t,n){let r=this;return i;function i(t){return Sh.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(gm(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function eg(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var tg={name:`labelStartImage`,resolveAll:Gh.resolveAll,tokenize:ng};function ng(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var rg={name:`labelStartLink`,resolveAll:Gh.resolveAll,tokenize:ig};function ig(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ag={name:`lineEnding`,tokenize:og};function og(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),km(e,t,`linePrefix`)}}var sg={name:`thematicBreak`,tokenize:cg};function cg(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||X(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?km(e,s,`whitespace`)(t):s(t))}}var lg={continuation:{tokenize:pg},exit:hg,name:`list`,tokenize:fg},ug={partial:!0,tokenize:gg},dg={partial:!0,tokenize:mg};function fg(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:xm(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(sg,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return xm(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Wm,r.interrupt?n:u,e.attempt(ug,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function pg(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Wm,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,km(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dg,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,km(e,e.attempt(lg,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function mg(e,t,n){let r=this;return km(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function hg(e){e.exit(this.containerState.type)}function gg(e,t,n){let r=this;return km(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var _g={name:`setextUnderline`,resolveTo:vg,tokenize:yg};function vg(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function yg(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?km(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||X(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var bg={tokenize:xg};function xg(e){let t=this,n=e.attempt(Wm,r,e.attempt(this.parser.constructs.flowInitial,i,km(e,e.attempt(this.parser.constructs.flow,i,e.attempt(gh,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Sg={resolveAll:Eg()},Cg=Tg(`string`),wg=Tg(`text`);function Tg(e){return{resolveAll:Eg(e===`text`?Dg:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Eg(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Dg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Og=Ie({attentionMarkers:()=>Ig,contentInitial:()=>Ag,disable:()=>Lg,document:()=>kg,flow:()=>Mg,flowInitial:()=>jg,insideSpan:()=>Fg,string:()=>Ng,text:()=>Pg}),kg={42:lg,43:lg,45:lg,48:lg,49:lg,50:lg,51:lg,52:lg,53:lg,54:lg,55:lg,56:lg,57:lg,62:Km},Ag={91:Th},jg={[-2]:ih,[-1]:ih,32:ih},Mg={35:jh,42:sg,45:[_g,sg],60:Ih,61:_g,95:sg,96:th,126:th},Ng={38:Qm,92:Xm},Pg={[-5]:ag,[-4]:ag,[-3]:ag,33:tg,38:Qm,42:Rm,60:[Hm,Uh],91:rg,92:[kh,Xm],93:Gh,95:Rm,96:ch},Fg={null:[Rm,Sg]},Ig={null:[42,95]},Lg={null:[]};function Rg(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=um(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Lm(a,l.events,l),l.events):[]}function f(e,t){return Bg(p(e),t)}function p(e){return zg(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){X(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&lm(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function zg(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Bg(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
181
+ `;break;case-3:o=`\r
182
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Vg(e){let t={constructs:fm([Og,...(e||{}).extensions||[]]),content:n(Am),defined:[],document:n(Mm),flow:n(bg),lazy:{},string:n(Cg),text:n(wg)};return t;function n(e){return n;function n(n){return Rg(t,e,n)}}}function Hg(e){for(;!mh(e););return e}var Ug=/[\0\t\n\r]/g;function Wg(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Ug.lastIndex=u,c=Ug.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Gg=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Kg(e){return e.replace(Gg,qg)}function qg(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return hm(n.slice(t?2:1),t?16:10)}return cm(n)||e}var Jg={}.hasOwnProperty;function Yg(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Xg(n)(Hg(Vg(n).document().write(Wg()(e,t,!0))))}function Xg(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(xe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(N),blockQuote:a(pe),characterEscape:T,characterReference:T,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ve),hardBreakTrailing:a(ve),htmlFlow:a(ye,o),htmlFlowData:T,htmlText:a(ye,o),htmlTextData:T,image:a(be),label:o,link:a(xe),listItem:a(Ce),listItemValue:f,listOrdered:a(Se,d),listUnordered:a(Se),paragraph:a(we),reference:ce,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(N),strong:a(P),thematicBreak:a(Ee)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:M,characterReferenceMarkerNumeric:M,characterReferenceValue:le,characterReference:ue,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ne),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(ee),htmlFlowData:E,htmlText:c(te),htmlTextData:E,image:c(k),label:ie,labelText:A,lineEnding:D,link:c(re),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:j,resourceDestinationString:ae,resourceTitleString:oe,resource:se,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Qg(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Jg.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||e_).call(a,void 0,e[0])}for(r.position={start:Zg(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Zg(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Zg(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||e_).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+xp({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Zg(e.end)}function u(){return rm(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gm(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Te(),n.position={start:Zg(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Zg(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Zg(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function k(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function A(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Kg(t),n.identifier=gm(t).toLowerCase()}function ie(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ae(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function oe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function se(){this.data.inReference=void 0}function ce(){this.data.referenceType=`collapsed`}function j(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gm(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function M(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=hm(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=cm(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=Zg(e.end)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function N(){return{type:`heading`,depth:0,children:[]}}function ve(){return{type:`break`}}function ye(){return{type:`html`,value:``}}function be(){return{type:`image`,title:null,url:``,alt:null}}function xe(){return{type:`link`,title:null,url:``,children:[]}}function Se(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ce(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function we(){return{type:`paragraph`,children:[]}}function P(){return{type:`strong`,children:[]}}function Te(){return{type:`text`,value:``}}function Ee(){return{type:`thematicBreak`}}}function Zg(e){return{line:e.line,column:e.column,offset:e.offset}}function Qg(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Qg(e,r):$g(e,r)}}function $g(e,t){let n;for(n in t)if(Jg.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function e_(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+xp({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xp({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+xp({start:t.start,end:t.end})+`) is still open`)}function t_(e){let t=this;t.parser=n;function n(n){return Yg(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function n_(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function r_(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
183
+ `}]}function i_(e,t){let n=t.value?t.value+`
184
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function a_(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o_(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s_(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Om(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function c_(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function l_(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function u_(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function d_(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return u_(e,t);let i={src:Om(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function f_(e,t){let n={src:Om(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function p_(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function m_(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return u_(e,t);let i={href:Om(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function h_(e,t){let n={href:Om(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function g_(e,t,n){let r=e.all(t),i=n?__(n):v_(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
185
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
186
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function __(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=v_(n[r])}return t}function v_(e){return e.spread??e.children.length>1}function y_(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function b_(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x_(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function S_(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function C_(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=vp(t.children[1]),o=_p(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function w_(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function T_(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var E_=9,D_=32;function O_(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(k_(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(k_(t.slice(i),i>0,!1)),a.join(``)}function k_(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===E_||t===D_;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===E_||t===D_;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function A_(e,t){let n={type:`text`,value:O_(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function j_(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var M_={blockquote:n_,break:r_,code:i_,delete:a_,emphasis:o_,footnoteReference:s_,heading:c_,html:l_,imageReference:d_,image:f_,inlineCode:p_,linkReference:m_,link:h_,listItem:g_,list:y_,paragraph:b_,root:x_,strong:S_,table:C_,tableCell:T_,tableRow:w_,text:A_,thematicBreak:j_,toml:N_,yaml:N_,definition:N_,footnoteDefinition:N_};function N_(){}var P_=typeof self==`object`?self:globalThis,F_=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new P_[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new P_[a](o),i)};return r},I_=e=>F_(new Map,e)(0),L_=``,{toString:R_}={},{keys:z_}=Object,B_=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=R_.call(e).slice(8,-1);switch(n){case`Array`:return[1,L_];case`Object`:return[2,L_];case`Date`:return[3,L_];case`RegExp`:return[4,L_];case`Map`:return[5,L_];case`Set`:return[6,L_];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},V_=([e,t])=>e===0&&(t===`function`||t===`symbol`),H_=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=B_(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of z_(r))(e||!V_(B_(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(V_(B_(n))||V_(B_(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!V_(B_(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},U_=(e,{json:t,lossy:n}={})=>{let r=[];return H_(!(t||n),!!t,new Map,r)(e),r},W_=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?I_(U_(e,t)):structuredClone(e):(e,t)=>I_(U_(e,t));function G_(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function K_(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function q_(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||G_,r=e.options.footnoteBackLabel||K_,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Om(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...W_(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
187
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
188
+ `}]}}var J_=(function(e){if(e==null)return $_;if(typeof e==`function`)return Q_(e);if(typeof e==`object`)return Array.isArray(e)?Y_(e):X_(e);if(typeof e==`string`)return Z_(e);throw Error(`Expected function, string, or object as test`)});function Y_(e){let t=[],n=-1;for(;++n<e.length;)t[n]=J_(e[n]);return Q_(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function X_(e){let t=e;return Q_(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Z_(e){return Q_(t);function t(t){return t&&t.type===e}}function Q_(e){return t;function t(t,n,r){return!!(ev(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function $_(){return!0}function ev(e){return typeof e==`object`&&!!e&&`type`in e}function tv(e){return e}var nv=[];function rv(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=J_(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+tv(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=nv,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=iv(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function iv(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?nv:[e]}function av(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),rv(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var ov={}.hasOwnProperty,sv={};function cv(e,t){let n=t||sv,r=new Map,i=new Map,a={all:s,applyData:uv,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...M_,...n.handlers},one:o,options:n,patch:lv,wrap:fv};return av(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(ov.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=W_(n);return r.children=a.all(e),r}return W_(e)}return(a.options.unknownHandler||dv)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=pv(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=pv(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function lv(e,t){e.position&&(t.position=bp(e))}function uv(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,W_(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function dv(e,t){let n=t.data||{},r=`value`in t&&!(ov.call(n,`hProperties`)||ov.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function fv(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
189
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
190
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
191
+ `}),n}function pv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function mv(e,t){let n=cv(e,t),r=n.one(e,void 0),i=q_(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
192
+ `},i)),a}function hv(e,t){return e&&`run`in e?async function(n,r){let i=mv(n,{file:r,...t});await e.run(i,r)}:function(n,r){return mv(n,{file:r,...e||t})}}function gv(e){if(e)throw e}var _v=F(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function vv(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function yv(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?bv(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function bv(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var xv={basename:Sv,dirname:Cv,extname:wv,join:Tv,sep:`/`};function Sv(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Ov(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Cv(e){if(Ov(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function wv(e){Ov(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Tv(...e){let t=-1,n;for(;++t<e.length;)Ov(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Ev(n)}function Ev(e){Ov(e);let t=e.codePointAt(0)===47,n=Dv(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Dv(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ov(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var kv={cwd:Av};function Av(){return`/`}function jv(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Mv(e){if(typeof e==`string`)e=new URL(e);else if(!jv(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Nv(e)}function Nv(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Pv=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Fv=class{constructor(e){let t;t=e?jv(e)?{path:e}:typeof e==`string`||zv(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:kv.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Pv.length;){let e=Pv[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Pv.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?xv.basename(this.path):void 0}set basename(e){Lv(e,`basename`),Iv(e,`basename`),this.path=xv.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?xv.dirname(this.path):void 0}set dirname(e){Rv(this.basename,`dirname`),this.path=xv.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?xv.extname(this.path):void 0}set extname(e){if(Iv(e,`extname`),Rv(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=xv.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){jv(e)&&(e=Mv(e)),Lv(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?xv.basename(this.path,this.extname):void 0}set stem(e){Lv(e,`stem`),Iv(e,`stem`),this.path=xv.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Tp(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Iv(e,t){if(e&&e.includes(xv.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+xv.sep+"`")}function Lv(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Rv(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function zv(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Bv=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Vv=Re(_v(),1),Hv={}.hasOwnProperty,Uv=new class e extends Bv{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=yv()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Vv.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Kv(`data`,this.frozen),this.namespace[e]=t,this):Hv.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Kv(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Yv(e),n=this.parser||this.Parser;return Wv(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Wv(`process`,this.parser||this.Parser),Gv(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Yv(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Zv(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Wv(`processSync`,this.parser||this.Parser),Gv(`processSync`,this.compiler||this.Compiler),this.process(e,r),Jv(`processSync`,`process`,t),n;function r(e,r){t=!0,gv(e),n=r}}run(e,t,n){qv(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Yv(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Jv(`runSync`,`run`,n),r;function i(e,t){gv(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Yv(t),r=this.compiler||this.Compiler;return Gv(`stringify`,r),qv(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Kv(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Vv.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];vv(o)&&vv(r)&&(r=(0,Vv.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Wv(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Gv(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Kv(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function qv(e){if(!vv(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Jv(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yv(e){return Xv(e)?e:new Fv(e)}function Xv(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Zv(e){return typeof e==`string`||Qv(e)}function Qv(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var $v=[],ey={allowDangerousHtml:!0},ty=/^(https?|ircs?|mailto|xmpp)$/i,ny=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function ry(e){let t=iy(e),n=ay(e);return oy(t.runSync(t.parse(n),n),e)}function iy(e){let t=e.rehypePlugins||$v,n=e.remarkPlugins||$v,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ey}:ey;return Uv().use(t_).use(n).use(hv,r).use(t)}function ay(e){let t=e.children||``,n=new Fv;return typeof t==`string`?n.value=t:``+t,n}function oy(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||sy;for(let e of ny)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return av(e,l),Np(e,{Fragment:L.Fragment,components:i,ignoreInvalidStyle:!0,jsx:L.jsx,jsxs:L.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in tm)if(Object.hasOwn(tm,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=tm[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function sy(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ty.test(e.slice(0,t))?e:``}function cy(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function ly(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function uy(e,t,n){let r=J_((n||{}).ignore||[]),i=dy(t),a=-1;for(;++a<i.length;)rv(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function dy(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([fy(e[0]),py(e[1])])}return t}function fy(e){return typeof e==`string`?new RegExp(ly(e),`g`):e}function py(e){return typeof e==`function`?e:function(){return e}}var my=`phrasing`,hy=[`autolink`,`link`,`image`,`label`];function gy(){return{transforms:[wy],enter:{literalAutolink:vy,literalAutolinkEmail:yy,literalAutolinkHttp:yy,literalAutolinkWww:yy},exit:{literalAutolink:Cy,literalAutolinkEmail:Sy,literalAutolinkHttp:by,literalAutolinkWww:xy}}}function _y(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:my,notInConstruct:hy},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:my,notInConstruct:hy},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:my,notInConstruct:hy}]}}function vy(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function yy(e){this.config.enter.autolinkProtocol.call(this,e)}function by(e){this.config.exit.autolinkProtocol.call(this,e)}function xy(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Sy(e){this.config.exit.autolinkEmail.call(this,e)}function Cy(e){this.exit(e)}function wy(e){uy(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ty],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Ey]],{ignore:[`link`,`linkReference`]})}function Ty(e,t,n,r,i){let a=``;if(!ky(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Dy(n)))return!1;let o=Oy(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Ey(e,t,n,r){return!ky(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Dy(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Oy(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=cy(e,`(`),a=cy(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function ky(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Em(n)||Tm(n))&&(!t||n!==47)}zy.peek=Ry;function Ay(){this.buffer()}function jy(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function My(){this.buffer()}function Ny(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Py(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gm(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Fy(e){this.exit(e)}function Iy(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gm(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ly(e){this.exit(e)}function Ry(){return`[`}function zy(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function By(){return{enter:{gfmFootnoteCallString:Ay,gfmFootnoteCall:jy,gfmFootnoteDefinitionLabelString:My,gfmFootnoteDefinition:Ny},exit:{gfmFootnoteCallString:Py,gfmFootnoteCall:Fy,gfmFootnoteDefinitionLabelString:Iy,gfmFootnoteDefinition:Ly}}}function Vy(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:zy},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
193
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Uy:Hy))),s(),o}}function Hy(e,t,n){return t===0?e:Uy(e,t,n)}function Uy(e,t,n){return(n?``:` `)+e}var Wy=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Yy.peek=Xy;function Gy(){return{canContainEols:[`delete`],enter:{strikethrough:qy},exit:{strikethrough:Jy}}}function Ky(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Wy}],handlers:{delete:Yy}}}function qy(e){this.enter({type:`delete`,children:[]},e)}function Jy(e){this.exit(e)}function Yy(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Xy(){return`~`}function Zy(e){return e.length}function Qy(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Zy,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=$y(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=eb(r[d]);else{let e=eb(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
194
+ `)}function $y(e){return e==null?``:String(e)}function eb(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function tb(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),nb);return i(),o}function nb(e,t,n){return`>`+(n?``:` `)+e}function rb(e,t){return ib(e,t.inConstruct,!0)&&!ib(e,t.notInConstruct,!1)}function ib(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ab(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
195
+ `&&rb(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
196
+ `}function ob(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function sb(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cb(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function lb(e,t,n,r){let i=cb(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(sb(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,ub);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(ob(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
197
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
198
+ `),a&&(u+=s.move(a+`
199
+ `)),u+=s.move(c),l(),u}function ub(e,t,n){return(n?``:` `)+e}function db(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fb(e,t,n,r){let i=db(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
200
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function pb(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function mb(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function hb(e,t,n){let r=Im(e),i=Im(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}gb.peek=_b;function gb(e,t,n,r){let i=pb(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=hb(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=mb(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=hb(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+mb(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function _b(e,t,n){return n.options.emphasis||`*`}function vb(e,t){let n=!1;return av(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&rm(e)&&(t.options.setext||n))}function yb(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(vb(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
201
+ `,after:`
202
+ `});return r(),t(),o+`
203
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
204
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
205
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=mb(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}bb.peek=xb;function bb(e){return e.value||``}function xb(){return`<`}Sb.peek=Cb;function Sb(e,t,n,r){let i=db(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Cb(){return`!`}wb.peek=Tb;function wb(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Tb(){return`!`}Eb.peek=Db;function Eb(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Db(){return"`"}function Ob(e,t){let n=rm(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}kb.peek=Ab;function kb(e,t,n,r){let i=db(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Ob(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Ab(e,t,n){return Ob(e,n)?`<`:`[`}jb.peek=Mb;function jb(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Mb(){return`[`}function Nb(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Pb(e){let t=Nb(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Fb(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ib(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Lb(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Fb(n):Nb(n),s=e.ordered?o===`.`?`)`:`.`:Pb(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Ib(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Rb(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function zb(e,t,n,r){let i=Rb(n),a=n.bulletCurrent||Nb(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Bb(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Vb=J_([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Hb(e,t,n,r){return(e.children.some(function(e){return Vb(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Ub(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Wb.peek=Gb;function Wb(e,t,n,r){let i=Ub(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=hb(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=mb(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=hb(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+mb(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Gb(e,t,n){return n.options.strong||`*`}function Kb(e,t,n,r){return n.safe(e.value,r)}function qb(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Jb(e,t,n){let r=(Ib(n)+(n.options.ruleSpaces?` `:``)).repeat(qb(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Yb={blockquote:tb,break:ab,code:lb,definition:fb,emphasis:gb,hardBreak:ab,heading:yb,html:bb,image:Sb,imageReference:wb,inlineCode:Eb,link:kb,linkReference:jb,list:Lb,listItem:zb,paragraph:Bb,root:Hb,strong:Wb,text:Kb,thematicBreak:Jb};function Xb(){return{enter:{table:Zb,tableData:tx,tableHeader:tx,tableRow:$b},exit:{codeText:nx,table:Qb,tableData:ex,tableHeader:ex,tableRow:ex}}}function Zb(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Qb(e){this.exit(e),this.data.inTable=void 0}function $b(e){this.enter({type:`tableRow`,children:[]},e)}function ex(e){this.exit(e)}function tx(e){this.enter({type:`tableCell`,children:[]},e)}function nx(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,rx));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function rx(e,t){return t===`|`?t:e}function ix(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
206
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
207
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Qy(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Yb.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function ax(){return{exit:{taskListCheckValueChecked:sx,taskListCheckValueUnchecked:sx,paragraph:cx}}}function ox(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:lx}}}function sx(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function cx(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function lx(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Yb.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function ux(){return[gy(),By(),Gy(),Xb(),ax()]}function dx(e){return{extensions:[_y(),Vy(e),Ky(),ix(e),ox()]}}var fx={tokenize:Ex,partial:!0},px={tokenize:Dx,partial:!0},mx={tokenize:Ox,partial:!0},hx={tokenize:kx,partial:!0},gx={tokenize:Ax,partial:!0},_x={name:`wwwAutolink`,tokenize:wx,previous:jx},vx={name:`protocolAutolink`,tokenize:Tx,previous:Mx},yx={name:`emailAutolink`,tokenize:Cx,previous:Nx},bx={};function xx(){return{text:bx}}for(var Sx=48;Sx<123;)bx[Sx]=yx,Sx++,Sx===58?Sx=65:Sx===91&&(Sx=97);bx[43]=yx,bx[45]=yx,bx[46]=yx,bx[95]=yx,bx[72]=[yx,vx],bx[104]=[yx,vx],bx[87]=[yx,_x],bx[119]=[yx,_x];function Cx(e,t,n){let r=this,i,a;return o;function o(t){return!Px(t)||!Nx.call(r,r.previous)||Fx(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Px(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(gx,u,l)(t):t===45||t===95||vm(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&_m(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function wx(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!jx.call(r,r.previous)||Fx(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(fx,e.attempt(px,e.attempt(mx,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Tx(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Mx.call(r,r.previous)&&!Fx(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(_m(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||bm(t)||wm(t)||Em(t)||Tm(t)?n(t):e.attempt(px,e.attempt(mx,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Ex(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Dx(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(hx,c,s)(t):t===null||wm(t)||Em(t)||t!==45&&Tm(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Ox(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(hx,t,a)(o):o===null||wm(o)||Em(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function kx(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||wm(o)||Em(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||wm(e)||Em(e)?t(e):r(e)}function a(e){return _m(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):_m(t)?(e.consume(t),o):n(t)}}function Ax(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return vm(e)?n(e):t(e)}}function jx(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||wm(e)}function Mx(e){return!_m(e)}function Nx(e){return!(e===47||Px(e))}function Px(e){return e===43||e===45||e===46||e===95||vm(e)}function Fx(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Ix={tokenize:Wx,partial:!0};function Lx(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Vx,continuation:{tokenize:Hx},exit:Ux}},text:{91:{name:`gfmFootnoteCall`,tokenize:Bx},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Rx,resolveTo:zx}}}}function Rx(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=gm(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function zx(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Bx(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||wm(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(gm(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return wm(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Vx(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||wm(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=gm(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return wm(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),km(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Hx(e,t,n){return e.check(Wm,t,e.attempt(Ix,t,n))}function Ux(e){e.exit(`gfmFootnoteDefinition`)}function Wx(e,t,n){let r=this;return km(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Gx(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&lm(o,o.length,0,Lm(s,e.slice(r+1,n),t)),lm(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),lm(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Im(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Im(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Kx=class{constructor(){this.map=[]}add(e,t,n){qx(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function qx(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Jx(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Yx(){return{flow:{null:{name:`table`,tokenize:Xx,resolveAll:Zx}}}}function Xx(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):X(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?km(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||wm(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?km(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?km(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||X(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?km(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||X(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||X(n)?(e.exit(`tableRow`),t(n)):Z(n)?km(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||wm(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Zx(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Kx;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&($x(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=Qx(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=Qx(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=Qx(f,t,o,i,n,d)):(o[0]=o[1],d=Qx(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&$x(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Jx(t.events,n))}return e}function Qx(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},eS(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=eS(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=eS(t.events,n[2]),a=eS(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},eS(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function $x(e,t,n,r,i){let a=[],o=eS(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function eS(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var tS={name:`tasklistCheck`,tokenize:rS};function nS(){return{text:{91:tS}}}function rS(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return wm(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return X(r)?t(r):Z(r)?e.check({tokenize:iS},t,n)(r):n(r)}}function iS(e,t,n){return km(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function aS(e){return fm([xx(),Lx(),Gx(e),Yx(),nS()])}var oS={};function sS(e){let t=this,n=e||oS,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(aS(n)),a.push(ux()),o.push(dx(n))}function cS({alt:e=`Nomadex logo`,className:t}){return(0,L.jsx)(`img`,{alt:e,className:[`brand-mark`,t].filter(Boolean).join(` `),decoding:`async`,draggable:!1,src:`/favicon.svg`})}var lS=[`Opening workspace`,`Setting environment`,`Initializing modules`,`Starting services`],uS=1600,dS=380;function fS({messages:e=lS,metaText:t=`Connecting to workspace backend`,variant:n=`screen`,visibleRangeStart:r=0,visibleRangeEnd:i}){let a=e.length>0?e:lS,o=a.length-1,s=Math.max(0,Math.min(r,o)),c=Math.max(s,Math.min(i??o,o)),[l,u]=(0,I.useState)(s),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(!1);(0,I.useEffect)(()=>{if(c-s<1)return;let e=window.setInterval(()=>{u(e=>{let t=e<s||e>c?s:e;return f(t),m(!1),t>=c?s:t+1})},uS);return()=>{window.clearInterval(e)}},[c,s]),(0,I.useEffect)(()=>{if(d===null)return;let e=window.requestAnimationFrame(()=>{m(!0)}),t=window.setTimeout(()=>{f(null),m(!1)},dS);return()=>{window.cancelAnimationFrame(e),window.clearTimeout(t)}},[l,d]);let h=l<s||l>c?s:l,g=d!==null&&d>=s&&d<=c?d:null,_=a[h]??a[s],v=g===null?null:a[g]??null;return(0,L.jsxs)(`div`,{"aria-live":`polite`,className:H(`connection-loading-screen`,n===`inline`&&`inline`),role:`status`,children:[(0,L.jsx)(cS,{alt:``,className:`connection-loading-mark`}),(0,L.jsxs)(`div`,{className:`connection-loading-row`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`connection-loading-spinner`}),(0,L.jsxs)(`div`,{className:`connection-loading-slot`,children:[v?(0,L.jsx)(`span`,{className:H(`connection-loading-message`,`leaving`,p&&`animate`),children:v}):null,(0,L.jsx)(`span`,{className:H(`connection-loading-message`,v?`entering`:`resting`,p&&`animate`),children:_})]}),(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`connection-loading-dots`,children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{})]})]}),(0,L.jsx)(`div`,{className:`connection-loading-meta`,children:t})]})}var pS={add:`new`,update:`mod`,delete:`del`},mS=e=>e.replace(/\\/g,`/`).split(`/`).filter(Boolean).at(-1)??e;function hS({entries:e,onOpenFile:t,title:n,variant:r=`turn`}){if(e.length===0)return null;let i=`${e.length}`;return(0,L.jsxs)(`div`,{className:H(`file-change-summary`,`file-change-summary-${r}`),children:[(0,L.jsxs)(`div`,{className:`file-change-summary-head`,children:[(0,L.jsx)(`div`,{className:`file-change-summary-title`,children:n}),(0,L.jsx)(`div`,{className:`file-change-summary-count`,children:i})]}),(0,L.jsx)(`div`,{className:`file-change-summary-list`,children:e.map(e=>{let n=mS(e.path);return(0,L.jsxs)(`button`,{className:H(`file-change-summary-item`,`file-change-kind-${e.kind}`),onClick:()=>t(e.path),title:e.path,type:`button`,children:[(0,L.jsx)(`span`,{className:`file-change-summary-kind`,children:pS[e.kind]}),(0,L.jsx)(`span`,{className:`file-change-summary-path`,children:n})]},`${e.itemId}:${e.path}`)})})]})}var gS=`Agent`;function _S({onFill:e,onSlash:t}){return(0,L.jsxs)(`div`,{className:`ww`,children:[(0,L.jsx)(cS,{className:`wico`}),(0,L.jsx)(`h1`,{children:`Nomadex`}),(0,L.jsx)(`p`,{children:`Agentic coding workspace for live threads, repo edits, command runs, and multi-provider orchestration.`}),(0,L.jsxs)(`div`,{className:`wbadges`,children:[(0,L.jsx)(`div`,{className:`wbadge`,children:`⚡ Live stream`}),(0,L.jsx)(`div`,{className:`wbadge`,children:`🔍 Web search`}),(0,L.jsx)(`div`,{className:`wbadge`,children:`⑂ Multi-agent`}),(0,L.jsx)(`div`,{className:`wbadge`,children:`🔧 MCP tools`}),(0,L.jsx)(`div`,{className:`wbadge`,children:`📋 Skills ($)`}),(0,L.jsx)(`div`,{className:`wbadge`,children:`apply_patch`}),(0,L.jsx)(`div`,{className:`wbadge`,children:`/ 25 slash cmds`})]}),(0,L.jsxs)(`div`,{className:`wsug`,children:[(0,L.jsxs)(`button`,{className:`sug`,type:`button`,onClick:()=>e(`Refactor the auth middleware to use JWT properly with full TypeScript types`),children:[(0,L.jsx)(`div`,{className:`sug-i`,children:`⚡`}),(0,L.jsx)(`div`,{className:`sug-t`,children:`Refactor code`}),(0,L.jsx)(`div`,{className:`sug-d`,children:`apply_patch + diffs`})]}),(0,L.jsxs)(`button`,{className:`sug`,type:`button`,onClick:()=>t(`/review`),children:[(0,L.jsx)(`div`,{className:`sug-i`,children:`🔍`}),(0,L.jsx)(`div`,{className:`sug-t`,children:`/review`}),(0,L.jsx)(`div`,{className:`sug-d`,children:`Audit working tree`})]}),(0,L.jsxs)(`button`,{className:`sug`,type:`button`,onClick:()=>e(`Write Jest unit tests for the auth service with 80%+ coverage`),children:[(0,L.jsx)(`div`,{className:`sug-i`,children:`🧪`}),(0,L.jsx)(`div`,{className:`sug-t`,children:`Write tests`}),(0,L.jsx)(`div`,{className:`sug-d`,children:`Jest + coverage`})]}),(0,L.jsxs)(`button`,{className:`sug`,type:`button`,onClick:()=>t(`/init`),children:[(0,L.jsx)(`div`,{className:`sug-i`,children:`📋`}),(0,L.jsx)(`div`,{className:`sug-t`,children:`/init`}),(0,L.jsx)(`div`,{className:`sug-d`,children:`Generate AGENTS.md`})]})]}),(0,L.jsx)(`p`,{className:`welcome-foot`,children:`/slash cmds · $skills · @file or /mention · !shell · ⌘K palette · Ctrl+G editor`})]})}function vS({threadLabelText:e}){return(0,L.jsx)(fS,{messages:[`Opening conversation`,`Reattaching thread`,`Loading recent history`,`Syncing transcript`],metaText:`Restoring ${Hd(e,42)}`,variant:`inline`})}var yS=(0,I.memo)(function({activeThread:e,activeThreadLabel:t,activeTurns:n,existingThreadHistoryPending:r,streamVisible:i,onReview:a,onRollback:o,onFill:s,onSlash:c,onCopy:l,onFork:u,onPlan:d,onEdit:f,onContext:p,onOpenFile:m,providerId:h}){if(!e)return(0,L.jsx)(_S,{onFill:s,onSlash:c});if(r)return(0,L.jsx)(vS,{threadLabelText:t});if(n.length===0)return(0,L.jsx)(_S,{onFill:s,onSlash:c});let g=n[n.length-1]?.id??null,_=n.some(e=>e.status===`inProgress`);return(0,L.jsx)(L.Fragment,{children:n.map(t=>{let n=gf(t),r=_s(t),s=(e.steers??[]).filter(e=>e.turnId===t.id),c=t.status===`inProgress`?[...t.items].reverse().find(e=>e.type===`agentMessage`)?.id??null:null;return(0,L.jsxs)(`div`,{className:`turn-block`,children:[t.items.map(n=>(0,L.jsx)(RS,{item:n,onContext:p,onCopy:l,onEdit:f,onFork:u,onOpenFile:m,onPlan:d,onRollback:o,providerId:h,onReview:a,rollbackDisabled:_,showRollback:n.type===`userMessage`,turnId:t.id,outputVisible:n.type===`commandExecution`?i[`${n.id}:aggregatedOutput`]:void 0,streaming:n.type===`agentMessage`&&n.id===c,textVisible:n.type===`agentMessage`?i[`${n.id}:text`]:void 0,plan:t.id===g?e.plan:null,turnStatus:t.status},n.id)),s.map(e=>(0,L.jsx)(xS,{entry:e,onOpenFile:m,providerId:h},e.id)),n?(0,L.jsx)(AS,{code:_f(t.error?.codexErrorInfo??null),onOpenFile:m,providerId:h,status:t.status,text:n}):null,t.status===`inProgress`?null:(0,L.jsx)(hS,{entries:r,onOpenFile:m,title:`Changed`,variant:`turn`})]},t.id)})})}),bS=new Intl.DateTimeFormat([],{hour:`numeric`,minute:`2-digit`}),xS=(0,I.memo)(function({entry:e,onOpenFile:t,providerId:n}){return(0,L.jsxs)(`div`,{className:H(`steer-card`,e.status===`pending`&&`pending`),children:[(0,L.jsxs)(`div`,{className:`steer-card-head`,children:[(0,L.jsx)(`span`,{className:`steer-card-label`,children:`Steer`}),(0,L.jsx)(`span`,{className:`steer-card-meta`,children:e.status===`pending`?`Applying`:bS.format(new Date(e.createdAt))})]}),(0,L.jsx)(`div`,{className:`steer-card-body`,children:(0,L.jsx)(jS,{onOpenFile:t,providerId:n,text:e.prompt})})]})}),SS=e=>{switch(e.status){case`inProgress`:return`Running`;case`completed`:return e.exitCode===0?`Completed`:`Exit ${e.exitCode??`?`}`;case`failed`:return`Failed`;case`declined`:return`Declined`;default:return e.status}},CS=e=>e.status===`inProgress`?`run`:e.status===`completed`&&e.exitCode===0?`ok`:`err`,wS=e=>e.replace(/\\/gu,`/`).split(`/`).filter(Boolean).pop()??e,TS=e=>{if(e==null)return null;if(e<1e3)return`${e}ms`;if(e<6e4){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/u,``)}s`}return`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`},ES=e=>{let t=e.replace(/\\/gu,`/`).trim();if(!t)return`(cwd)`;let n=t.split(`/`).filter(Boolean);return n.length===0?`/`:t.startsWith(`/home/`)&&n.length>=3?`~/${n.slice(2).join(`/`)}`:n.length>3?`.../${n.slice(-3).join(`/`)}`:t},DS=/^(?:\/usr\/bin\/env\s+)?((?:\/[^ "'`]+|[A-Za-z0-9_.-]+))(?:\s+(?:--?[A-Za-z0-9_-]+))*\s+(?:-lc|-c|\/c|-Command|-command)\s+(['"])([\s\S]*)\2$/u,OS=e=>{let t=e.commandActions.find(e=>e.command?.trim())?.command.trim()??e.command.trim(),n=t.match(DS),r=wS(n?.[1]??t).replace(/\.(?:bat|cmd|exe)$/iu,``)||`terminal`;return{commandText:n?.[3]?.trim()||t||`(command)`,cwdText:ES(e.cwd),durationText:TS(e.durationMs),processText:e.processId??`pty`,shellLabel:r}},kS=(e,t)=>`${e.trim().toLowerCase()}:${t.trim()}`,AS=(0,I.memo)(function({status:e,text:t,code:n,onOpenFile:r,providerId:i}){return(0,L.jsxs)(`div`,{className:`msg`,children:[(0,L.jsxs)(`div`,{className:`mh`,children:[(0,L.jsx)(`div`,{className:`mav a`,children:`⬡`}),(0,L.jsx)(`span`,{className:`mn`,children:gS}),(0,L.jsx)(`span`,{className:`mt`,children:e})]}),(0,L.jsx)(`div`,{className:`mb`,children:(0,L.jsxs)(`div`,{className:`turn-error-card`,children:[(0,L.jsx)(IS,{onOpenFile:r,providerId:i,text:t}),n?(0,L.jsx)(`div`,{className:`turn-error-code`,children:n}):null]})})]})}),jS=(0,I.memo)(function({text:e,onOpenFile:t,providerId:n}){return(0,L.jsx)(L.Fragment,{children:(0,I.useMemo)(()=>ps(e),[e]).map((e,r)=>e.kind===`text`?(0,L.jsx)(`span`,{children:e.value},`text-${r}`):e.kind===`code`?(0,L.jsx)(`code`,{className:`message-inline-code`,children:e.value},`code-${r}`):hs(e.path,n)===`#`?t?(0,L.jsx)(`button`,{className:`message-file-link file-link-button`,onClick:()=>t(e.path,e.line),title:e.path,type:`button`,children:e.displayPath},`file-${r}`):(0,L.jsx)(`code`,{className:`message-inline-code`,children:e.displayPath},`file-${r}`):(0,L.jsx)(`button`,{className:`message-file-link file-link-button`,onClick:()=>t(e.path,e.line),title:e.path,type:`button`,children:e.displayPath},`file-${r}`))})});function MS({url:e,alt:t,markdown:n,className:r}){let[i,a]=(0,I.useState)(!1);return i&&n?(0,L.jsx)(`p`,{className:`message-text`,children:n}):(0,L.jsx)(`a`,{className:`message-image-link`,href:e,rel:`noreferrer noopener`,target:`_blank`,children:(0,L.jsx)(`img`,{alt:t,className:H(`message-image-preview`,r),loading:`lazy`,onError:()=>a(!0),src:e})})}var NS=e=>{for(let t of I.Children.toArray(e)){if(!(0,I.isValidElement)(t))continue;let e=t.props.className;if(typeof e!=`string`)continue;let n=e.match(/language-([A-Za-z0-9_-]+)/u);if(n?.[1])return n[1]}return null},PS=e=>{let t=e;return(t.match(/```/gu)??[]).length%2==1&&(t=`${t}\n\`\`\``),(t.match(/~~~/gu)??[]).length%2==1&&(t=`${t}\n~~~`),t},FS=(0,I.memo)(function({text:e,onOpenFile:t,streaming:n=!1,showCursor:r=!1,providerId:i}){let a=(0,I.useDeferredValue)(e),o=n?a:e,s=(0,I.useMemo)(()=>n?PS(o):o,[o,n]),c=(0,I.useMemo)(()=>({a({href:e,children:n}){let r=typeof e==`string`?as(e,i):null;return r?(0,L.jsx)(`button`,{className:`message-file-link file-link-button message-markdown-link`,onClick:()=>t(r.path,r.line),title:r.path,type:`button`,children:n}):e?(0,L.jsx)(`a`,{className:`message-markdown-anchor`,href:e,rel:`noreferrer noopener`,target:`_blank`,children:n}):(0,L.jsx)(`span`,{className:`message-markdown-anchor`,children:n})},img({src:e,alt:t}){let n=typeof e==`string`?ms(e,i):``;return n?(0,L.jsx)(MS,{alt:t||`Embedded message image`,className:`message-markdown-image`,url:n}):t?(0,L.jsx)(`span`,{className:`message-inline-code`,children:t}):null},pre({children:e}){return(0,L.jsxs)(`div`,{className:`message-code-shell`,children:[(0,L.jsx)(`div`,{className:`message-code-head`,children:(0,L.jsx)(`span`,{children:NS(e)??`text`})}),(0,L.jsx)(`pre`,{className:`message-code-block`,children:e})]})},code({className:e,children:t}){return(0,L.jsx)(`code`,{className:H(`message-markdown-code`,e),children:t})}}),[t,i]);return(0,L.jsxs)(`div`,{className:H(`message-text-flow`,`message-markdown`,n&&`message-text-flow-streaming message-markdown-streaming`),children:[(0,L.jsx)(ry,{components:c,remarkPlugins:[sS],children:s}),r?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`live-cursor message-stream-cursor`}):null]})}),IS=(0,I.memo)(function({text:e,onOpenFile:t,textFx:n,streaming:r=!1,showCursor:i=!1,providerId:a}){let o=(0,I.useMemo)(()=>r?[]:gs(e,a),[a,r,e]).reduce((e,t)=>({entries:[...e.entries,{block:t,start:e.nextStart}],nextStart:e.nextStart+(t.kind===`image`?t.markdown.length:t.value.length)}),{entries:[],nextStart:0}).entries;if(r){let t=n??null,r=t?Math.max(0,Math.min(e.length,t.from)):0,a=t?Math.max(r,Math.min(e.length,t.to)):0;return(0,L.jsx)(`div`,{className:`message-text-flow message-text-flow-streaming`,children:(0,L.jsxs)(`p`,{className:`message-text message-text-streaming`,children:[e.slice(0,r),a>r?(0,L.jsx)(`span`,{className:`message-text-tail`,children:e.slice(r,a)}):null,e.slice(a),i?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`live-cursor live-cursor-inline`}):null]})})}return(0,L.jsx)(`div`,{className:`message-text-flow`,children:o.map(({block:e,start:r},i)=>{if(e.kind===`image`)return(0,L.jsx)(MS,{alt:e.alt||`Embedded message image`,className:`message-markdown-image`,markdown:e.markdown,url:e.url},`image-${i}`);if(!e.value)return null;let o=r+e.value.length,s=n??null,c=s?Math.max(0,s.from-r):0,l=s?Math.max(0,Math.min(e.value.length,s.to-r)):0,u=!1;if(s&&(u=s.to>s.from&&l>c&&o>s.from&&r<s.to),!u)return(0,L.jsx)(`p`,{className:`message-text`,children:(0,L.jsx)(jS,{onOpenFile:t,providerId:a,text:e.value})},`text-${i}`);let d=e.value.slice(0,c),f=e.value.slice(c,l),p=e.value.slice(l);return(0,L.jsxs)(`p`,{className:`message-text`,children:[d?(0,L.jsx)(jS,{onOpenFile:t,providerId:a,text:d}):null,f?(0,L.jsx)(`span`,{className:`message-text-tail`,children:(0,L.jsx)(jS,{onOpenFile:t,providerId:a,text:f})},`tail-${i}-${s?.to??e.value.length}`):null,p?(0,L.jsx)(jS,{onOpenFile:t,providerId:a,text:p}):null]},`text-${i}`)})})}),LS=(0,I.memo)(function({itemText:e,plan:t}){let n=t?.steps??[],r=t?.explanation?.trim()||e.trim();if(n.length===0)return(0,L.jsxs)(`div`,{className:`compact-bar`,children:[(0,L.jsx)(`span`,{className:`compact-ico`,children:`Plan`}),(0,L.jsx)(`span`,{className:`meta-glint`,children:r||e})]});let i=n.filter(e=>e.status===`completed`).length;return(0,L.jsxs)(`div`,{className:`turn-plan-card`,children:[(0,L.jsx)(`div`,{className:`turn-plan-card-head`,children:(0,L.jsxs)(`span`,{className:`turn-plan-card-progress`,children:[i,` of `,n.length,` tasks completed`]})}),r?(0,L.jsx)(`div`,{className:`turn-plan-card-summary`,children:r}):null,(0,L.jsx)(`ol`,{className:`turn-plan-card-list`,children:n.map((e,t)=>(0,L.jsxs)(`li`,{className:H(`turn-plan-card-step`,`is-${e.status}`),children:[(0,L.jsx)(`span`,{className:`turn-plan-card-step-marker`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{className:`turn-plan-card-step-index`,children:[t+1,`.`]}),(0,L.jsx)(`span`,{className:`turn-plan-card-step-text`,children:e.step})]},`${t}-${e.step}`))})]})}),RS=(0,I.memo)(function({item:e,plan:t,turnStatus:n,streaming:r=!1,textVisible:i,outputVisible:a,onCopy:o,onFork:s,onPlan:c,onRollback:l,onReview:u,onEdit:d,onContext:f,onOpenFile:p,providerId:m,turnId:h,showRollback:g=!1,rollbackDisabled:_=!1}){let[v,y]=(0,I.useState)(e.type===`commandExecution`?e.status===`inProgress`:!1),[b]=(0,I.useState)(()=>e.type===`userMessage`?new Intl.DateTimeFormat([],{hour:`numeric`,minute:`2-digit`}).format(new Date):``),x=(0,I.useRef)(e.type===`commandExecution`?e.status:null),S=e.type===`commandExecution`?e.status:null;if((0,I.useEffect)(()=>{if(e.type!==`commandExecution`||!S){x.current=null;return}let t=null,n=null;return S===`inProgress`?t=window.requestAnimationFrame(()=>{y(!0)}):x.current===`inProgress`&&(n=window.setTimeout(()=>y(!1),1e3)),x.current=S,()=>{t!==null&&window.cancelAnimationFrame(t),n!==null&&window.clearTimeout(n)}},[S,e.type]),e.type===`userMessage`){let t=fs(e,m),n=new Set(t.fileAttachments.map(e=>kS(e.label,e.path))),r=e.content.filter(e=>e.type===`skill`?!0:e.type===`mention`?!n.has(kS(e.name,e.path)):!1);return(0,L.jsxs)(`div`,{className:`msg user`,onContextMenu:t=>f(t,e),children:[(0,L.jsxs)(`div`,{className:`mb`,children:[t.images.length>0?(0,L.jsx)(`div`,{className:`message-image-list`,children:t.images.map((t,n)=>{let r=ms(t,m);return r?(0,L.jsx)(MS,{alt:`Message image preview`,url:r},`${e.id}-image-${n}`):null})}):null,t.fileAttachments.length>0||r.length>0?(0,L.jsxs)(`div`,{className:`attachment-row`,children:[t.fileAttachments.map(t=>{let n=mf(t.label,t.path);return(0,L.jsxs)(`button`,{className:H(`attachment-chip attachment-chip-file file-link-button`,`file-tone-${n.tone}`),onClick:()=>p(t.path),title:t.path,type:`button`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`file-chip-preview`,children:(0,L.jsx)(`span`,{className:`file-chip-ext`,children:n.badge})}),(0,L.jsxs)(`span`,{className:`file-chip-copy`,children:[(0,L.jsx)(`span`,{className:`file-chip-title`,children:n.title}),(0,L.jsx)(`span`,{className:`file-chip-meta`,children:n.kindLabel})]})]},`${e.id}-file-${t.path}`)}),r.map(t=>{if(t.type===`mention`){let n=mf(t.name,t.path);return(0,L.jsxs)(`button`,{className:H(`attachment-chip attachment-chip-file file-link-button`,`file-tone-${n.tone}`),onClick:()=>p(t.path),title:t.path,type:`button`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`file-chip-preview`,children:(0,L.jsx)(`span`,{className:`file-chip-ext`,children:n.badge})}),(0,L.jsxs)(`span`,{className:`file-chip-copy`,children:[(0,L.jsx)(`span`,{className:`file-chip-title`,children:n.title}),(0,L.jsx)(`span`,{className:`file-chip-meta`,children:n.kindLabel})]})]},`${e.id}-${t.type}-${t.name}`)}return(0,L.jsxs)(`span`,{className:`attachment-chip`,children:[(0,L.jsx)(`span`,{children:`📋`}),(0,L.jsx)(`span`,{children:t.name})]},`${e.id}-${t.type}-${t.name}`)})]}):null,t.text?(0,L.jsx)(IS,{onOpenFile:p,providerId:m,text:t.text}):null,(0,L.jsx)(`div`,{className:`msg-time`,children:b})]}),(0,L.jsxs)(`div`,{className:`macts`,children:[g?(0,L.jsx)(`button`,{className:`mact rollback`,disabled:_,title:_?`Wait for the current response to finish before rolling back.`:`Remove this prompt and everything after it.`,type:`button`,onClick:()=>l(h),children:`↶ Rollback`}):null,(0,L.jsx)(`button`,{className:`mact`,type:`button`,onClick:()=>o(t.text),children:`📋 Copy`}),(0,L.jsx)(`button`,{className:`mact`,type:`button`,onClick:()=>d(t.text),children:`✏ Edit`})]})]})}if(e.type===`agentMessage`){let t=typeof i==`number`?e.text.slice(0,i):e.text;return(0,L.jsxs)(`div`,{className:H(`msg assistant`,r&&`streaming`),onContextMenu:t=>f(t,e),children:[(0,L.jsxs)(`div`,{className:`mh`,children:[(0,L.jsx)(`div`,{className:`mav a`,children:`⬡`}),(0,L.jsx)(`span`,{className:`mn`,children:gS}),(0,L.jsx)(`span`,{className:`mt`,children:n===`inProgress`?`live`:n})]}),(0,L.jsx)(`div`,{className:`mb`,children:t?r?(0,L.jsx)(FS,{onOpenFile:p,providerId:m,showCursor:r,streaming:r,text:t}):(0,L.jsx)(FS,{onOpenFile:p,providerId:m,text:t}):null}),(0,L.jsxs)(`div`,{className:`macts`,children:[(0,L.jsx)(`button`,{className:`mact`,type:`button`,onClick:()=>s(),children:`⑂ /fork`}),(0,L.jsx)(`button`,{className:`mact`,type:`button`,onClick:()=>c(),children:`📋 /plan`}),(0,L.jsx)(`button`,{className:`mact`,type:`button`,onClick:()=>o(e.text),children:`📋`})]})]})}if(e.type===`reasoning`)return null;if(e.type===`plan`)return(0,L.jsx)(LS,{itemText:e.text,plan:t});if(e.type===`commandExecution`){let t=typeof a==`number`&&e.aggregatedOutput?e.aggregatedOutput.slice(0,a):e.aggregatedOutput??``,n=CS(e),r=OS(e);return(0,L.jsxs)(`div`,{className:H(`cmd-inline`,n,v&&`open`),children:[(0,L.jsxs)(`button`,{className:H(`cmd-inline-row`,n,v&&`open`),type:`button`,onClick:()=>y(e=>!e),children:[(0,L.jsxs)(`div`,{className:`cmd-inline-window-bar`,children:[(0,L.jsxs)(`div`,{className:`cmd-inline-traffic`,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{className:`cmd-inline-dot close`}),(0,L.jsx)(`span`,{className:`cmd-inline-dot minimize`}),(0,L.jsx)(`span`,{className:`cmd-inline-dot zoom`})]}),(0,L.jsx)(`span`,{className:`cmd-inline-shell meta-glint`,children:r.shellLabel}),(0,L.jsx)(`span`,{className:H(`cmd-inline-status-chip`,`meta-glint`,n),children:SS(e)})]}),(0,L.jsxs)(`div`,{className:`cmd-inline-main`,children:[(0,L.jsx)(`span`,{className:H(`cmd-inline-chevron`,v&&`open`),children:`▶`}),(0,L.jsxs)(`div`,{className:`cmd-inline-copy`,children:[(0,L.jsx)(`code`,{className:`cmd-inline-label`,children:r.commandText}),(0,L.jsxs)(`div`,{className:`cmd-inline-meta-line`,children:[(0,L.jsx)(`span`,{className:`cmd-inline-meta-pill`,children:r.cwdText}),(0,L.jsx)(`span`,{className:`cmd-inline-meta-pill`,children:r.processText}),r.durationText?(0,L.jsx)(`span`,{className:`cmd-inline-meta-pill`,children:r.durationText}):null]})]})]})]}),v?(0,L.jsxs)(`div`,{className:`cmd-inline-output`,children:[(0,L.jsxs)(`div`,{className:`cmd-inline-output-head`,children:[(0,L.jsx)(`span`,{children:`Output`}),(0,L.jsx)(`span`,{children:e.cwd})]}),(0,L.jsx)(`pre`,{children:t||`(no output)`})]}):null]})}if(e.type===`fileChange`)return(0,L.jsx)(zS,{item:e,onReview:u});if(e.type===`mcpToolCall`){let t=e.result?JSON.stringify(e.result.structuredContent??e.result.content??{},null,2):e.error?.message??`No output`;return(0,L.jsxs)(`div`,{className:H(`tool`,e.error?`err`:`ok`),children:[(0,L.jsxs)(`div`,{className:`tool-h`,children:[(0,L.jsxs)(`span`,{className:`meta-glint`,children:[e.error?`✗`:`✓`,` MCP · `,e.server,`/`,e.tool]}),(0,L.jsx)(`span`,{className:`tbadge meta-glint`,children:e.status})]}),(0,L.jsx)(`div`,{className:`tool-b`,children:(0,L.jsx)(`pre`,{className:`tool-pre`,children:t})})]})}return e.type===`dynamicToolCall`?(0,L.jsxs)(`div`,{className:H(`tool`,e.success?`ok`:`run`),children:[(0,L.jsxs)(`div`,{className:`tool-h`,children:[(0,L.jsxs)(`span`,{className:`meta-glint`,children:[e.success?`✓`:`↻`,` Tool · `,e.tool]}),(0,L.jsx)(`span`,{className:`tbadge meta-glint`,children:e.status})]}),(0,L.jsx)(`div`,{className:`tool-b`,children:e.contentItems?.map((t,n)=>(0,L.jsx)(`div`,{children:JSON.stringify(t)},`${e.id}-${n}`))??`No tool payload.`})]}):e.type===`collabAgentToolCall`?(0,L.jsxs)(`div`,{className:`agc`,children:[(0,L.jsxs)(`div`,{className:`agh`,children:[(0,L.jsx)(`div`,{className:`agdot`}),(0,L.jsxs)(`span`,{className:`agn meta-glint`,children:[`⑂ `,e.tool]}),(0,L.jsx)(`span`,{className:`ags meta-glint`,children:e.status})]}),(0,L.jsx)(`div`,{className:`agt`,children:e.prompt??`Subagent activity`}),(0,L.jsx)(`div`,{className:`agprog`,children:(0,L.jsx)(`div`,{className:`agbar`,style:{width:e.status===`completed`?`100%`:`58%`}})})]}):e.type===`webSearch`?(0,L.jsxs)(`div`,{className:`tool ok`,children:[(0,L.jsxs)(`div`,{className:`tool-h`,children:[(0,L.jsx)(`span`,{className:`meta-glint`,children:`✓ Web search`}),(0,L.jsx)(`span`,{className:`tbadge meta-glint`,children:`search`})]}),(0,L.jsx)(`div`,{className:`tool-b`,children:e.query})]}):e.type===`imageView`?(0,L.jsxs)(`div`,{className:`image-card`,children:[(0,L.jsxs)(`div`,{className:`tool-h`,children:[(0,L.jsx)(`span`,{className:`meta-glint`,children:`🖼 Image`}),(0,L.jsx)(`span`,{className:`tbadge meta-glint`,children:`view`})]}),(0,L.jsx)(`div`,{className:`tool-b`,children:e.path})]}):e.type===`imageGeneration`?(0,L.jsxs)(`div`,{className:`tool ok`,children:[(0,L.jsxs)(`div`,{className:`tool-h`,children:[(0,L.jsx)(`span`,{className:`meta-glint`,children:`✓ Image generation`}),(0,L.jsx)(`span`,{className:`tbadge meta-glint`,children:e.status})]}),(0,L.jsxs)(`div`,{className:`tool-b`,children:[(0,L.jsx)(`div`,{children:e.revisedPrompt}),(0,L.jsx)(`div`,{children:e.result})]})]}):e.type===`enteredReviewMode`||e.type===`exitedReviewMode`?(0,L.jsxs)(`div`,{className:`compact-bar`,children:[(0,L.jsx)(`span`,{className:`compact-ico`,children:e.type===`enteredReviewMode`?`🔍`:`✓`}),(0,L.jsx)(`span`,{className:`meta-glint`,children:e.review})]}):e.type===`contextCompaction`?(0,L.jsxs)(`div`,{className:`compact-bar`,children:[(0,L.jsx)(`span`,{className:`compact-ico`,children:`🗜`}),(0,L.jsx)(`span`,{className:`meta-glint`,children:`Conversation compacted to free context tokens.`})]}):null});function zS({item:e,onReview:t}){let n=e.status===`inProgress`?`editing`:e.status===`completed`?`applied`:e.status===`failed`?`failed`:e.status;return(0,L.jsx)(L.Fragment,{children:(e.changes.length>0?e.changes:[{path:`Editing files`,kind:{type:`update`,move_path:null},diff:``}]).map((r,i)=>(0,L.jsxs)(`div`,{className:H(`dw`,e.status===`inProgress`&&`live`,r.kind.type===`add`&&`new-file`),"data-change-kind":r.kind.type,children:[(0,L.jsxs)(`div`,{className:`dh`,children:[(0,L.jsxs)(`span`,{className:`meta-glint`,children:[`📄 `,r.path]}),(0,L.jsxs)(`div`,{className:`diff-head-actions`,children:[(0,L.jsx)(`button`,{className:`diff-review`,type:`button`,onClick:()=>t(vf(e.id,i,r.path)),children:`Review diff`}),(0,L.jsxs)(`span`,{className:`dstats`,children:[r.kind.type===`add`?(0,L.jsx)(`span`,{className:`diff-new`,children:`new`}):null,r.kind.type===`update`?(0,L.jsx)(`span`,{className:`diff-mod`,children:`mod`}):null,r.kind.type===`delete`?(0,L.jsx)(`span`,{className:`diff-del`,children:`del`}):null,(0,L.jsx)(`span`,{className:H(`diff-status`,e.status===`inProgress`&&`live`,e.status===`failed`&&`err`),children:n})]})]})]}),r.diff?r.diff.split(`
208
+ `).map((e,t)=>(0,L.jsx)(`div`,{className:H(`dl`,e.startsWith(`+`)&&`add`,e.startsWith(`-`)&&`rem`,!e.startsWith(`+`)&&!e.startsWith(`-`)&&`ctx`),children:e},`${r.path}-${t}`)):(0,L.jsx)(`div`,{className:`dl ctx`,children:`Waiting for diff…`})]},`${e.id}-${r.path}-${i}`))})}var BS=(e,t)=>{switch(t){case`accept`:switch(e.kind){case`command`:return`Run command`;case`patch`:return`Apply changes`;case`permissions`:return`Grant access`;default:return`Approve`}case`acceptForSession`:switch(e.kind){case`command`:return`Allow for session`;case`patch`:return`Allow writes for session`;case`permissions`:return`Grant for session`;default:return`Allow for session`}case`cancel`:return`Cancel`;default:return`Decline`}},VS=e=>{switch(e){case`accept`:case`acceptForSession`:return`approve`;case`cancel`:return`neutral`;default:return`danger`}};function HS({approval:e,mcpContentText:t,onMcpContentChange:n,onResolve:r,onSubmitMcp:i}){let a=e.availableDecisions&&e.availableDecisions.length>0?e.availableDecisions:[`accept`,`decline`],o=e.state===`pending`;return(0,L.jsxs)(`div`,{className:`approval-request-card`,children:[(0,L.jsxs)(`div`,{className:`approval-request-head`,children:[(0,L.jsxs)(`div`,{className:`approval-request-copy`,children:[(0,L.jsx)(`strong`,{children:e.title}),(0,L.jsx)(`span`,{children:e.detail})]}),(0,L.jsxs)(`div`,{className:`approval-request-badges`,children:[(0,L.jsx)(`span`,{className:H(`approval-request-risk`,e.risk),children:e.risk}),(0,L.jsx)(`span`,{className:`approval-request-state`,children:e.state})]})]}),e.kind===`question`?null:(0,L.jsxs)(`div`,{className:`approval-request-body`,children:[e.command?(0,L.jsxs)(`div`,{className:`approval-request-block`,children:[(0,L.jsx)(`div`,{className:`approval-request-label`,children:`Command`}),(0,L.jsx)(`code`,{className:`approval-request-command`,children:e.command})]}):null,e.cwd?(0,L.jsxs)(`div`,{className:`approval-request-meta`,children:[(0,L.jsx)(`span`,{className:`approval-request-label`,children:`Working directory`}),(0,L.jsx)(`span`,{className:`approval-request-value`,children:e.cwd})]}):null,e.files&&e.files.length>0?(0,L.jsxs)(`div`,{className:`approval-request-block`,children:[(0,L.jsx)(`div`,{className:`approval-request-label`,children:e.kind===`patch`?`Paths`:`Files`}),(0,L.jsx)(`div`,{className:`approval-request-list`,children:e.files.map(e=>(0,L.jsx)(`span`,{className:`approval-request-item`,children:e},e))})]}):null,e.permissionsSummary&&e.permissionsSummary.length>0?(0,L.jsxs)(`div`,{className:`approval-request-block`,children:[(0,L.jsx)(`div`,{className:`approval-request-label`,children:`Requested access`}),(0,L.jsx)(`div`,{className:`approval-request-list`,children:e.permissionsSummary.map(e=>(0,L.jsx)(`span`,{className:`approval-request-item`,children:e},e))})]}):null,e.kind===`mcp`?(0,L.jsxs)(L.Fragment,{children:[e.serverName?(0,L.jsxs)(`div`,{className:`approval-request-meta`,children:[(0,L.jsx)(`span`,{className:`approval-request-label`,children:`Server`}),(0,L.jsx)(`span`,{className:`approval-request-value`,children:e.serverName})]}):null,e.form?(0,L.jsxs)(`div`,{className:`approval-request-block`,children:[(0,L.jsx)(`div`,{className:`approval-request-label`,children:`Prompt details`}),(0,L.jsx)(`pre`,{className:`approval-request-pre`,children:e.form})]}):null,(0,L.jsxs)(`div`,{className:`approval-request-block`,children:[(0,L.jsx)(`label`,{className:`approval-request-label`,htmlFor:`approval-mcp-${e.id}`,children:`Response`}),(0,L.jsx)(`textarea`,{className:`approval-request-textarea`,id:`approval-mcp-${e.id}`,onChange:e=>n(e.target.value),placeholder:`Provide the response to send back to the MCP server.`,rows:5,value:t})]})]}):null]}),(0,L.jsx)(`div`,{className:`approval-request-actions`,children:e.kind===`mcp`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{className:`approval-request-button approve`,disabled:!o,onClick:()=>i(`accept`,t),type:`button`,children:`Send response`}),(0,L.jsx)(`button`,{className:`approval-request-button danger`,disabled:!o,onClick:()=>i(`decline`,t),type:`button`,children:`Decline`}),(0,L.jsx)(`button`,{className:`approval-request-button neutral`,disabled:!o,onClick:()=>i(`cancel`,t),type:`button`,children:`Cancel`})]}):a.map(t=>(0,L.jsx)(`button`,{className:H(`approval-request-button`,VS(t)),disabled:!o,onClick:()=>r(t),type:`button`,children:BS(e,t)},`${e.id}:${t}`))})]})}var US=(0,I.memo)(function({branchLabel:e,dirty:t,hasStagedChanges:n,message:r,preferencesPath:i,providers:a,selectedProviderId:o,summary:s,generating:c,committing:l,onCommit:u,onGenerate:d,onMessageChange:f,onProviderChange:p}){let m=a.find(e=>e.id===o)??a[0]??null,h=c||l;return(0,L.jsxs)(`section`,{className:`commit-composer-card`,children:[(0,L.jsxs)(`div`,{className:`commit-composer-head`,children:[(0,L.jsxs)(`div`,{className:`commit-composer-copy`,children:[(0,L.jsx)(`div`,{className:`commit-composer-title`,children:`Commit changes`}),(0,L.jsxs)(`div`,{className:`commit-composer-meta`,children:[(0,L.jsx)(`span`,{children:e}),(0,L.jsx)(`span`,{children:s||(t?`Working tree ready`:`Working tree clean`)})]})]}),(0,L.jsx)(`button`,{className:`commit-generate-button`,disabled:!t||h,onClick:d,type:`button`,children:c?`Generating…`:`Generate`})]}),(0,L.jsxs)(`div`,{className:`commit-composer-toolbar`,children:[(0,L.jsxs)(`label`,{className:`commit-provider-field`,children:[(0,L.jsx)(`span`,{children:`Provider`}),(0,L.jsx)(`select`,{className:`commit-provider-select`,disabled:h,onChange:e=>p(e.target.value),value:o,children:a.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),(0,L.jsxs)(`div`,{className:`commit-provider-note`,children:[(0,L.jsx)(`strong`,{children:m?.displayName??`Provider`}),(0,L.jsx)(`span`,{children:i?`Saved per project in .nomadex/project.json`:`Using the current workspace provider`})]})]}),(0,L.jsx)(`textarea`,{className:`commit-message-input`,disabled:l,onChange:e=>f(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),!l&&r.trim()&&u())},placeholder:`feat(scope): short summary`,rows:4,value:r}),(0,L.jsxs)(`div`,{className:`commit-composer-footer`,children:[(0,L.jsx)(`div`,{className:`commit-composer-hint`,children:n?`Commits the staged files.`:t?`Stages all current files first, then commits.`:`No pending files to commit.`}),(0,L.jsx)(`button`,{className:`commit-submit-button`,disabled:!t||!r.trim()||h,onClick:u,type:`button`,children:l?`Committing…`:`Commit`})]})]})}),WS=[`var(--ac)`,`var(--ac2)`,`var(--ac3)`,`var(--gn)`,`var(--og)`],GS=e=>e.kind===`head`||e.active?`current`:e.kind===`remote`?`remote`:e.kind===`tag`?`tag`:`local`,KS=(e,t,n)=>{let r=e.padEnd(t,` `);return(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`git-activity-graph-text`,children:Array.from(r).map((e,t)=>{if(e===` `)return(0,L.jsx)(`span`,{className:`git-activity-graph-char`,children:` `},`blank:${t}`);let r=n[t%n.length]??`var(--ac)`;return(0,L.jsx)(`span`,{className:H(`git-activity-graph-char`,`on`,e===`*`&&`node`),style:{"--graph-accent":r},children:e},`${e}:${t}`)})})},qS=(0,I.memo)(function({model:e,onOpenThread:t}){let n=e.lanes.length>0?e.lanes.map(e=>e.accent):WS;return(0,L.jsxs)(`section`,{className:`git-activity-card`,children:[(0,L.jsxs)(`div`,{className:`git-activity-toolbar`,children:[(0,L.jsxs)(`div`,{className:`git-activity-copy`,children:[(0,L.jsx)(`div`,{className:`git-activity-title`,children:`Git Graph`}),(0,L.jsx)(`div`,{className:`git-activity-meta`,children:e.repoLabel})]}),(0,L.jsxs)(`div`,{className:`git-activity-summary`,children:[(0,L.jsx)(`span`,{className:`git-activity-summary-label`,children:e.branchLabel}),e.commitLabel?(0,L.jsx)(`code`,{className:`git-activity-summary-code`,children:e.commitLabel}):null]})]}),e.lanes.length>0?(0,L.jsx)(`div`,{className:`git-activity-legend`,role:`list`,"aria-label":`Branch legend`,children:e.lanes.map(e=>(0,L.jsxs)(`div`,{className:H(`git-activity-legend-item`,e.emphasis),role:`listitem`,style:{"--lane-accent":e.accent},children:[(0,L.jsx)(`span`,{className:`git-activity-legend-swatch`}),(0,L.jsx)(`span`,{className:`git-activity-legend-label`,children:e.label})]},e.id))}):null,e.workingTree?(0,L.jsxs)(`div`,{className:`git-working-tree-card`,children:[(0,L.jsxs)(`div`,{className:`git-working-tree-toolbar`,children:[(0,L.jsx)(`div`,{className:`git-working-tree-title`,children:`Working tree`}),(0,L.jsx)(`div`,{className:H(`git-working-tree-summary`,e.workingTree.dirty&&`dirty`),children:e.workingTree.summary})]}),e.workingTree.buckets.length>0?(0,L.jsx)(`div`,{className:`git-working-tree-grid`,children:e.workingTree.buckets.map(e=>(0,L.jsxs)(`div`,{className:`git-working-tree-group`,children:[(0,L.jsxs)(`div`,{className:`git-working-tree-group-head`,children:[(0,L.jsx)(`span`,{children:e.label}),(0,L.jsx)(`span`,{children:e.entries.length})]}),(0,L.jsxs)(`div`,{className:`git-working-tree-list`,children:[e.entries.slice(0,6).map(e=>(0,L.jsxs)(`div`,{className:`git-working-tree-item`,children:[(0,L.jsx)(`span`,{className:H(`git-working-tree-badge`,e.kind),children:e.badge}),(0,L.jsx)(`span`,{className:`git-working-tree-path`,title:e.originalPath?`${e.originalPath} -> ${e.path}`:e.path,children:e.path})]},e.id)),e.entries.length>6?(0,L.jsxs)(`div`,{className:`git-working-tree-more`,children:[`+`,e.entries.length-6,` more`]}):null]})]},e.id))}):(0,L.jsx)(`div`,{className:`git-working-tree-clean`,children:`No uncommitted files in this repo.`})]}):null,(0,L.jsxs)(`div`,{className:`git-activity-table`,children:[(0,L.jsxs)(`div`,{className:`git-activity-table-head`,children:[(0,L.jsx)(`div`,{className:`git-activity-graph-head`,style:{width:`${Math.max(e.graphWidth,4)+1}ch`}}),(0,L.jsx)(`div`,{className:`git-activity-head-message`,children:`Message`}),(0,L.jsx)(`div`,{className:`git-activity-head-date`,children:`Date`}),(0,L.jsx)(`div`,{className:`git-activity-head-author`,children:`Author`}),(0,L.jsx)(`div`,{className:`git-activity-head-sha`,children:`Commit`})]}),(0,L.jsx)(`div`,{className:`git-activity-table-body`,children:e.rows.map(r=>{let i=!!(r.threadId&&t),a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`git-activity-graph-cell`,style:{width:`${Math.max(e.graphWidth,4)+1}ch`},children:KS(r.graph,Math.max(e.graphWidth,4),n)}),(0,L.jsxs)(`div`,{className:`git-activity-message-cell`,title:r.hint??r.subject,children:[r.refs.length>0?(0,L.jsx)(`div`,{className:`git-activity-ref-row`,children:r.refs.slice(0,3).map(e=>(0,L.jsx)(`span`,{className:H(`git-activity-ref`,GS(e)),children:e.label},e.id))}):null,(0,L.jsx)(`div`,{className:`git-activity-message-text`,children:r.subject})]}),(0,L.jsx)(`div`,{className:`git-activity-cell git-activity-date-cell`,children:r.dateLabel}),(0,L.jsx)(`div`,{className:`git-activity-cell git-activity-author-cell`,children:r.author}),(0,L.jsx)(`code`,{className:`git-activity-cell git-activity-sha-cell`,children:r.sha})]});return i&&r.threadId&&t?(0,L.jsx)(`button`,{className:H(`git-activity-table-row`,r.emphasis,`interactive`),onClick:()=>t(r.threadId),type:`button`,children:a},r.id):(0,L.jsx)(`div`,{className:H(`git-activity-table-row`,r.emphasis),children:a},r.id)})})]})]})});function JS({approval:e,answers:t,onAnswerChange:n,onSubmit:r}){let i=e.questions??[],a=i.length>0&&i.every(e=>(t[e.id]??``).trim().length>0);return(0,L.jsxs)(`div`,{className:`question-request-card`,children:[(0,L.jsxs)(`div`,{className:`question-request-head`,children:[(0,L.jsxs)(`div`,{className:`question-request-copy`,children:[(0,L.jsx)(`strong`,{children:e.title}),(0,L.jsx)(`span`,{children:e.detail})]}),(0,L.jsx)(`span`,{className:`question-request-state`,children:e.state})]}),(0,L.jsx)(`div`,{className:`question-request-body`,children:i.map((e,r)=>{let i=t[e.id]??``,a=e.isOther||(e.options?.length??0)===0;return(0,L.jsxs)(`div`,{className:`question-request-item`,children:[(0,L.jsxs)(`div`,{className:`question-request-item-head`,children:[(0,L.jsxs)(`span`,{className:`question-request-index`,children:[r+1,`.`]}),(0,L.jsxs)(`div`,{className:`question-request-item-copy`,children:[(0,L.jsx)(`span`,{className:`question-request-header`,children:e.header}),(0,L.jsx)(`div`,{className:`question-request-text`,children:e.question})]})]}),e.options&&e.options.length>0?(0,L.jsx)(`div`,{className:`question-request-options`,children:e.options.map(t=>(0,L.jsxs)(`button`,{className:H(`question-request-option`,i===t.label&&`active`),onClick:()=>n(e.id,t.label),type:`button`,children:[(0,L.jsx)(`span`,{className:`question-request-option-label`,children:t.label}),t.description?(0,L.jsx)(`span`,{className:`question-request-option-description`,children:t.description}):null]},`${e.id}:${t.label}`))}):null,a?(0,L.jsx)(`input`,{className:`question-request-input`,onChange:t=>n(e.id,t.target.value),placeholder:e.isSecret?`Enter value`:`Type your answer`,type:e.isSecret?`password`:`text`,value:i}):null]},e.id)})}),(0,L.jsx)(`div`,{className:`question-request-actions`,children:(0,L.jsx)(`button`,{className:`question-request-submit`,disabled:!a||e.state!==`pending`,onClick:r,type:`button`,children:`Submit answers`})})]})}var YS=e=>{if(!e)return`Reset time unavailable`;let t=new Date(e*1e3),n=Date.now();return t.getTime()-n<=1e3*60*60*24?`Resets ${t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}`:`Resets ${t.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}`},XS=(e,t)=>t?[e.name,e.description,e.scope??``,e.repo??``,e.downloads??``,...e.tags??[]].join(` `).toLowerCase().includes(t):!0,ZS=(0,I.memo)(function({snapshot:e,actions:t,onClose:n,pushToast:r}){let[i,a]=(0,I.useState)(``),o=i.trim().toLowerCase(),s=(0,I.useMemo)(()=>e.installedSkills.filter(e=>e.enabled).length,[e.installedSkills]),c=(0,I.useMemo)(()=>e.installedSkills.filter(e=>XS(e,o)),[o,e.installedSkills]),l=(0,I.useMemo)(()=>e.remoteSkills.filter(e=>XS(e,o)),[o,e.remoteSkills]);return(0,I.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n]),(0,L.jsx)(`div`,{className:`skills-library-overlay`,onClick:e=>{e.target===e.currentTarget&&n()},children:(0,L.jsxs)(`div`,{className:`skills-library-modal`,children:[(0,L.jsxs)(`div`,{className:`skills-library-hero`,children:[(0,L.jsxs)(`div`,{className:`skills-library-copy`,children:[(0,L.jsx)(`div`,{className:`skills-library-kicker`,children:`Nomadex Skill Library`}),(0,L.jsx)(`div`,{className:`skills-library-title`,children:`Manage installed and remote skills in one place`}),(0,L.jsx)(`div`,{className:`skills-library-subtitle`,children:`Toggle what stays active globally, browse marketplace packs, and keep the composer focused on actual prompts instead of setup.`})]}),(0,L.jsx)(`button`,{"aria-label":`Close skill library`,className:`skills-library-close`,onClick:n,type:`button`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`skills-library-toolbar`,children:[(0,L.jsxs)(`div`,{className:`skills-library-stats`,children:[(0,L.jsxs)(`div`,{className:`skills-library-stat`,children:[(0,L.jsx)(`strong`,{children:e.installedSkills.length}),(0,L.jsx)(`span`,{children:`Installed`})]}),(0,L.jsxs)(`div`,{className:`skills-library-stat`,children:[(0,L.jsx)(`strong`,{children:s}),(0,L.jsx)(`span`,{children:`Enabled`})]}),(0,L.jsxs)(`div`,{className:`skills-library-stat`,children:[(0,L.jsx)(`strong`,{children:e.remoteSkills.length}),(0,L.jsx)(`span`,{children:`Marketplace`})]})]}),(0,L.jsx)(`input`,{autoFocus:!0,className:`skills-library-search`,onChange:e=>a(e.target.value),placeholder:`Search skills, tags, repo, or description…`,value:i})]}),(0,L.jsxs)(`div`,{className:`skills-library-grid`,children:[(0,L.jsxs)(`section`,{className:`skills-library-pane`,children:[(0,L.jsxs)(`div`,{className:`skills-library-pane-head`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`skills-library-pane-title`,children:`Installed`}),(0,L.jsx)(`div`,{className:`skills-library-pane-copy`,children:`Toggle globally available skills and inspect their local path.`})]}),(0,L.jsx)(`span`,{className:`skills-library-pane-count`,children:c.length})]}),(0,L.jsx)(`div`,{className:`skills-library-list`,children:c.length===0?(0,L.jsx)(`div`,{className:`skills-library-empty`,children:`No installed skills matched this search.`}):c.map(e=>(0,L.jsxs)(`article`,{className:H(`skills-library-card installed`,e.enabled&&`enabled`),children:[(0,L.jsxs)(`div`,{className:`skills-library-card-head`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`skills-library-card-title`,children:e.name}),(0,L.jsxs)(`div`,{className:`skills-library-card-meta`,children:[(0,L.jsx)(`span`,{className:`skills-library-chip`,children:e.scope}),(0,L.jsx)(`span`,{className:H(`skills-library-chip`,e.enabled&&`live`),children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,L.jsx)(`button`,{className:H(`skills-library-action`,e.enabled&&`active`),onClick:()=>void t.toggleInstalledSkill(e.id),type:`button`,children:e.enabled?`Disable`:`Enable`})]}),(0,L.jsx)(`div`,{className:`skills-library-card-description`,children:e.description}),e.tags.length>0?(0,L.jsx)(`div`,{className:`skills-library-tag-row`,children:e.tags.map(e=>(0,L.jsx)(`span`,{className:`skills-library-tag`,children:e},e))}):null,(0,L.jsx)(`code`,{className:`skills-library-path`,children:e.path})]},e.id))})]}),(0,L.jsxs)(`section`,{className:`skills-library-pane marketplace`,children:[(0,L.jsxs)(`div`,{className:`skills-library-pane-head`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`skills-library-pane-title`,children:`Marketplace`}),(0,L.jsx)(`div`,{className:`skills-library-pane-copy`,children:`Install remote skills into your local workspace catalog.`})]}),(0,L.jsx)(`span`,{className:`skills-library-pane-count`,children:l.length})]}),(0,L.jsx)(`div`,{className:`skills-library-list`,children:l.length===0?(0,L.jsx)(`div`,{className:`skills-library-empty`,children:`No marketplace skills matched this search.`}):l.map(e=>(0,L.jsxs)(`article`,{className:`skills-library-card remote`,children:[(0,L.jsxs)(`div`,{className:`skills-library-card-head`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`skills-library-card-title`,children:e.name}),(0,L.jsxs)(`div`,{className:`skills-library-card-meta`,children:[(0,L.jsxs)(`span`,{className:`skills-library-chip`,children:[e.downloads,` downloads`]}),(0,L.jsx)(`span`,{className:`skills-library-chip`,children:e.repo})]})]}),(0,L.jsx)(`button`,{className:`skills-library-action install`,onClick:()=>{t.installSkill(e.id),r(`Installing ${e.name}`,`ok`)},type:`button`,children:`Install`})]}),(0,L.jsx)(`div`,{className:`skills-library-card-description`,children:e.description}),e.tags.length>0?(0,L.jsx)(`div`,{className:`skills-library-tag-row`,children:e.tags.map(e=>(0,L.jsx)(`span`,{className:`skills-library-tag`,children:e},e))}):null]},e.id))})]})]})]})})}),QS=(0,I.memo)(function({activeTheme:e,onClose:t,onSelect:n,themes:r}){return(0,L.jsx)(`div`,{className:`theme-picker-overlay`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,L.jsxs)(`div`,{id:`tpicker`,children:[(0,L.jsxs)(`div`,{className:`tpicker-head`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`tpicker-title`,children:`Theme`}),(0,L.jsx)(`div`,{className:`tpicker-subtitle`,children:`Shell palettes for Nomadex.`})]}),(0,L.jsx)(`button`,{className:`tpicker-close`,onClick:t,type:`button`,"aria-label":`Close theme picker`,children:`×`})]}),(0,L.jsx)(`div`,{className:`tpicker-grid`,children:r.map(t=>(0,L.jsxs)(`button`,{className:H(`theme-card`,e===t.id&&`active`),onClick:()=>n(t.id),type:`button`,children:[(0,L.jsxs)(`div`,{className:`theme-card-preview`,children:[(0,L.jsx)(`span`,{className:`theme-card-surface`,style:{background:t.swatches[0]}}),(0,L.jsx)(`span`,{className:`theme-card-accent`,style:{background:t.swatches[1]}}),(0,L.jsx)(`span`,{className:`theme-card-accent`,style:{background:t.swatches[2]}})]}),(0,L.jsxs)(`div`,{className:`theme-card-copy`,children:[(0,L.jsxs)(`div`,{className:`theme-card-name`,children:[t.name,(0,L.jsx)(`span`,{className:`theme-card-mode`,children:t.mode})]}),(0,L.jsx)(`div`,{className:`theme-card-description`,children:t.description})]})]},t.id))})]})})}),$S=(0,I.memo)(function({snapshot:e,activeThreadLabel:t,actions:n,pushToast:r,selectModel:i,activeTheme:a,onOpenSkills:o,onOpenTheme:s}){let[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)({key:``,value:``}),f=a.charAt(0).toUpperCase()+a.slice(1),p=e.providers.find(t=>t.id===e.settings.provider)??e.providers[0],m=p?Zo(p.id,e.models):e.models,h=p?.transportKind===`cli`,g=p?e.providerSetup[p.id]:null,_=p?e.providerAuth[p.id]:null,v=_?.status===`starting`||_?.status===`waiting`||_?.status===`checking`,y=h?p?.id===`opencode`&&_?.status===`waiting`?`Paste the OpenCode Zen API key below`:_?.status===`waiting`?`Finish sign-in below`:g?.status===`ready`?`Local CLI session ready`:`Sign in or configure this local CLI`:`${e.account.planType} · ${e.account.authMode}`,b=h?v?_?.status===`checking`?`Checking`:`Signing in…`:g?.status===`ready`?`Ready`:`External`:e.account.loginInProgress?`Signing in…`:e.account.loggedIn?`Active`:`Signed out`,x=p?.id===`opencode`?`Use OpenCode Zen`:p?.id===`qwen-code`?`Use Qwen Code`:`Use ${p?.displayName??`provider`}`,S=h&&(g?.authenticated===!0||g?.status===`ready`||_?.status===`completed`),C=g?g.status===`ready`?`Ready`:g.status===`checking`?`Checking`:g.status===`needsInstall`?`Install`:g.status===`needsAuth`?`Sign in`:g.status===`needsConfig`?`Config`:g.status===`error`?`Error`:`Unknown`:`Unknown`,w=h&&_!==null&&_.status!==`idle`&&_.status!==`completed`,T=p?.id===`opencode`&&_?.status===`waiting`,E=`${p?.id??`none`}:${_?.status??`idle`}`,D=u.key===E?u.value:``,O=_?.authUrl??null,ee=_?.userCode??null;(0,I.useEffect)(()=>{!h||!p||!g||g.status!==`unknown`||n.checkProviderSetup(p.id)},[n,p,g,h]);let te=(0,I.useCallback)(async()=>{try{let t=await n.startChatGptLogin();t&&window.open(t,`_blank`,`noopener,noreferrer`),r(e.account.loggedIn?`Opened ChatGPT account switch`:`Opened ChatGPT sign-in`,`ok`),r(`If mobile redirects to localhost:1455, paste that callback URL below.`,``)}catch(e){r(e instanceof Error?e.message:`Failed to start ChatGPT login`,`err`)}},[n,r,e.account.loggedIn]),ne=(0,I.useCallback)(async()=>{if(!c.trim()){r(`Paste the full callback URL first`,`warn`);return}try{await n.completeChatGptLogin(c.trim()),l(``),r(`Mobile sign-in completed`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to complete mobile sign-in`,`err`)}},[n,c,r]),re=(0,I.useCallback)(async()=>{let t=window.prompt(e.account.authMode===`apiKey`?`Enter the replacement API key`:`Enter your OpenAI API key`,``);if(t?.trim())try{await n.loginWithApiKey(t.trim()),r(`API key account connected`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to connect API key`,`err`)}},[n,r,e.account.authMode]),k=(0,I.useCallback)(async()=>{try{await n.logoutAccount(),r(`Signed out of account`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to sign out`,`err`)}},[n,r]),A=(0,I.useCallback)(async()=>{try{await n.refreshAccount(),r(`Account status refreshed`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to refresh account`,`err`)}},[n,r]),ie=(0,I.useCallback)(async()=>{if(!(!p||!h))try{await n.startProviderAuth(p.id,p.id===`opencode`?`apiKey`:`oauth`),r(`${p.displayName} sign-in started`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to start provider sign-in`,`err`)}},[n,p,h,r]),ae=(0,I.useCallback)(async()=>{if(!(!p||!h))try{await n.switchProviderAccount(p.id,p.id===`opencode`?`apiKey`:`oauth`),r(`${p.displayName} is ready for a new sign-in`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to switch provider account`,`err`)}},[n,p,h,r]),oe=(0,I.useCallback)(async()=>{if(!(!p||!h))try{await n.cancelProviderAuth(p.id),r(`${p.displayName} sign-in cancelled`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to cancel provider sign-in`,`err`)}},[n,p,h,r]),se=(0,I.useCallback)(()=>{O&&window.open(O,`_blank`,`noopener,noreferrer`)},[O]),ce=(0,I.useCallback)(async()=>{if(ee)try{await navigator.clipboard.writeText(ee),r(`Copied sign-in code`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to copy sign-in code`,`err`)}},[ee,r]),j=(0,I.useCallback)(async()=>{if(!(!p||!T)){if(!D.trim()){r(`Paste the API key first`,`warn`);return}try{await n.submitProviderAuthSecret(p.id,D.trim()),d({key:E,value:``}),r(`API key submitted to OpenCode`,`ok`)}catch(e){r(e instanceof Error?e.message:`Failed to submit the provider secret`,`err`)}}},[n,p,E,D,r,T]);return(0,L.jsxs)(`div`,{className:`config-stack`,children:[(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsx)(`div`,{className:`sg-t`,children:`Account`}),(0,L.jsxs)(`div`,{className:`account-card`,children:[(0,L.jsxs)(`div`,{className:`account-head`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{children:h?`${p.displayName} local session`:e.account.loggedIn?e.account.workspace:`No active account`}),(0,L.jsx)(`div`,{className:`account-copy`,children:y})]}),(0,L.jsx)(`span`,{className:H(`account-badge`,h&&(v||g?.status===`ready`)||e.account.loggedIn?`ok`:`off`),children:b})]}),(0,L.jsxs)(`div`,{className:`account-meta`,children:[h?(0,L.jsx)(`span`,{children:p.transportLabel}):(0,L.jsx)(`span`,{children:e.account.credits}),!h&&e.account.requiresOpenaiAuth?(0,L.jsx)(`span`,{children:`OpenAI auth required`}):null]}),h?(0,L.jsxs)(L.Fragment,{children:[g?(0,L.jsxs)(`div`,{className:`usage-limit-list`,children:[(0,L.jsxs)(`div`,{className:`usage-limit-card provider-detail-card`,children:[(0,L.jsxs)(`div`,{className:`usage-limit-head`,children:[(0,L.jsx)(`strong`,{children:`Session`}),(0,L.jsx)(`span`,{children:C})]}),(0,L.jsx)(`div`,{className:`provider-detail-copy`,children:g.summary}),g.detail?(0,L.jsx)(`div`,{className:`usage-limit-copy`,children:g.detail}):null]}),(0,L.jsxs)(`div`,{className:`usage-limit-card provider-detail-card`,children:[(0,L.jsxs)(`div`,{className:`usage-limit-head`,children:[(0,L.jsx)(`strong`,{children:`Transport`}),(0,L.jsx)(`span`,{children:p.transportLabel})]}),(0,L.jsx)(`div`,{className:`provider-detail-copy`,children:g.sourcePath??`Local CLI session on this host.`}),(0,L.jsx)(`div`,{className:`usage-limit-copy`,children:g.checkedAt?`Checked ${g.checkedAt}`:`Not checked yet.`})]}),(0,L.jsxs)(`div`,{className:`usage-limit-card provider-detail-card`,children:[(0,L.jsxs)(`div`,{className:`usage-limit-head`,children:[(0,L.jsx)(`strong`,{children:`CLI`}),(0,L.jsx)(`span`,{children:g.version?`Detected`:`Unknown`})]}),(0,L.jsx)(`div`,{className:`provider-detail-copy`,children:g.version?`Version ${g.version}`:`Version unavailable`}),(0,L.jsx)(`div`,{className:`usage-limit-copy`,children:S?`Ready for new turns.`:`Sign in or configure the provider to use it in Nomadex.`})]})]}):null,w?(0,L.jsxs)(`div`,{className:`account-helper`,children:[(0,L.jsxs)(`div`,{className:`account-helper-copy`,children:[_?.summary,_?.detail?` ${_.detail}`:``]}),_?.userCode||_?.authUrl?(0,L.jsxs)(`div`,{className:`account-callback-form`,children:[_.userCode?(0,L.jsxs)(`div`,{className:`provider-auth-value`,children:[(0,L.jsx)(`span`,{children:`Code`}),(0,L.jsx)(`code`,{children:_.userCode})]}):null,_.authUrl?(0,L.jsxs)(`div`,{className:`provider-auth-value`,children:[(0,L.jsx)(`span`,{children:`URL`}),(0,L.jsx)(`code`,{children:_.authUrl})]}):null]}):null,T?(0,L.jsx)(`div`,{className:`account-callback-form`,children:(0,L.jsx)(`input`,{className:`account-callback-input`,type:`password`,value:D,onChange:e=>d({key:E,value:e.target.value}),placeholder:`Paste OpenCode Zen API key`,autoComplete:`off`,spellCheck:!1})}):null,(0,L.jsxs)(`div`,{className:`provider-auth-actions`,children:[_?.authUrl?(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:se,children:`Open auth page`}):null,_?.userCode?(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void ce(),children:`Copy code`}):null,T?(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,disabled:!D.trim(),onClick:()=>void j(),children:`Submit key`}):null,v?(0,L.jsx)(`button`,{className:`mini-action danger`,type:`button`,onClick:()=>void oe(),children:`Cancel`}):null]})]}):(0,L.jsx)(`div`,{className:`usage-limit-empty`,children:p.id===`opencode`?(0,L.jsxs)(L.Fragment,{children:[`OpenCode Zen uses an API key from`,` `,(0,L.jsx)(`code`,{children:`opencode.ai/auth`}),`. Start the sign-in below, open the auth page, then paste the Zen API key back into Nomadex.`]}):p.id===`qwen-code`?(0,L.jsxs)(L.Fragment,{children:[`Use the provider action below to connect`,` `,p.displayName,`. Nomadex will verify the local session automatically after the provider flow completes.`]}):p.installCommand?(0,L.jsxs)(L.Fragment,{children:[`Install with `,(0,L.jsx)(`code`,{children:p.installCommand}),`, then sign in or configure that CLI on the host machine. Nomadex will use the existing local session for new turns.`]}):(0,L.jsxs)(L.Fragment,{children:[`Sign in or configure `,p.displayName,` on the host machine first. Nomadex will use the existing local CLI session.`]})})]}):(0,L.jsxs)(`div`,{className:`usage-limit-list`,children:[e.account.usageWindows.map(e=>(0,L.jsxs)(`div`,{className:`usage-limit-card`,children:[(0,L.jsxs)(`div`,{className:`usage-limit-head`,children:[(0,L.jsx)(`strong`,{children:e.label}),(0,L.jsxs)(`span`,{children:[Math.round(e.usedPercent),`% used`]})]}),(0,L.jsx)(`div`,{className:`usage-limit-bar`,children:(0,L.jsx)(`span`,{className:`usage-limit-fill`,style:{width:`${Math.max(0,Math.min(100,e.usedPercent))}%`}})}),(0,L.jsx)(`div`,{className:`usage-limit-copy`,children:YS(e.resetsAt)})]},e.id)),e.account.usageWindows.length===0?(0,L.jsx)(`div`,{className:`usage-limit-empty`,children:`Sign in to view your account usage windows.`}):null]}),(0,L.jsx)(`div`,{className:`account-actions`,children:h?(0,L.jsxs)(L.Fragment,{children:[p.id===`opencode`||p.id===`qwen-code`?(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,disabled:v,onClick:()=>void(S?ae():ie()),children:v?`Starting…`:S?`Switch account`:x}):null,(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,disabled:g?.status===`checking`,onClick:()=>void n.checkProviderSetup(p.id),children:g?.status===`checking`?`Checking…`:`Check setup`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void A(),children:`Refresh`}),(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void te(),children:e.account.authMode===`chatgpt`?`Switch ChatGPT`:`Use ChatGPT`}),(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void re(),children:e.account.authMode===`apiKey`?`Replace API key`:`Use API key`}),e.account.loggedIn?(0,L.jsx)(`button`,{className:`mini-action danger`,type:`button`,onClick:()=>void k(),children:`Log out`}):null]})}),!h&&e.account.loginInProgress?(0,L.jsxs)(`div`,{className:`account-helper`,children:[(0,L.jsxs)(`div`,{className:`account-helper-copy`,children:[`On mobile, if ChatGPT returns to `,(0,L.jsx)(`code`,{children:`localhost:1455`}),`, copy that full URL and paste it here. You can also replace the failed callback host with`,` `,(0,L.jsx)(`code`,{children:typeof window<`u`?window.location.origin:``}),` `,`and keep the same path/query.`]}),(0,L.jsxs)(`div`,{className:`account-callback-form`,children:[(0,L.jsx)(`input`,{className:`account-callback-input`,placeholder:`http://localhost:1455/auth/callback?code=…&state=…`,value:c,onChange:e=>l(e.target.value)}),(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void ne(),children:`Finish mobile login`})]})]}):null,!h&&e.account.loginError?(0,L.jsx)(`div`,{className:`account-error`,children:e.account.loginError}):null]})]}),(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsx)(`div`,{className:`sg-t`,children:`Model`}),(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsx)(`span`,{className:`sl`,children:`provider`}),(0,L.jsx)(`select`,{className:`ssel`,value:e.settings.provider,onChange:t=>{let r=e.providers.find(e=>e.id===t.target.value);n.updateSettings({provider:t.target.value,model:r?.defaultModel??e.settings.model})},children:e.providers.map(e=>(0,L.jsxs)(`option`,{disabled:e.availability!==`ready`,value:e.id,children:[e.displayName,e.availability===`ready`?``:` (scaffolded)`]},e.id))})]}),(0,L.jsxs)(`div`,{className:`config-provider-note`,children:[(0,L.jsx)(`strong`,{children:p?.displayName??`Provider`}),(0,L.jsx)(`span`,{children:p?.availability===`ready`?p.installCommand?`${p.transportLabel} · ${p.installCommand}`:p.transportLabel:`Scaffolded on this branch. Transport wiring comes next.`})]}),(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsx)(`span`,{className:`sl`,children:`model`}),m.length===0?(0,L.jsx)(`span`,{className:`sl`,children:`provider default`}):(0,L.jsx)(`select`,{className:`ssel`,value:e.settings.model,onChange:e=>void i(e.target.value),children:m.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsx)(`span`,{className:`sl`,children:`reasoning_effort`}),(0,L.jsxs)(`select`,{className:`ssel`,value:e.settings.reasoningEffort,onChange:e=>void n.updateSettings({reasoningEffort:e.target.value}),children:[(0,L.jsx)(`option`,{value:`low`,children:`low`}),(0,L.jsx)(`option`,{value:`medium`,children:`medium`}),(0,L.jsx)(`option`,{value:`high`,children:`high`}),(0,L.jsx)(`option`,{value:`xhigh`,children:`xhigh`})]})]})]}),(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsx)(`div`,{className:`sg-t`,children:`Approval & Sandbox`}),(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsx)(`span`,{className:`sl`,children:`approval_policy`}),(0,L.jsxs)(`select`,{className:`ssel`,value:Pd(e.settings),onChange:e=>void n.updateSettings(Fd(e.target.value)),children:[(0,L.jsx)(`option`,{value:`auto`,children:`auto`}),(0,L.jsx)(`option`,{value:`ro`,children:`read-only`}),(0,L.jsx)(`option`,{value:`fa`,children:`full-access`})]})]}),(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsx)(`span`,{className:`sl`,children:`sandbox`}),(0,L.jsxs)(`select`,{className:`ssel`,value:e.settings.sandboxMode,onChange:e=>void n.updateSettings({sandboxMode:e.target.value}),children:[(0,L.jsx)(`option`,{value:`workspace-write`,children:`workspace-write`}),(0,L.jsx)(`option`,{value:`read-only`,children:`read-only`}),(0,L.jsx)(`option`,{value:`danger-full-access`,children:`danger-full-access`})]})]}),(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsx)(`span`,{className:`sl`,children:`web_search`}),(0,L.jsx)(`div`,{className:H(`tog`,e.settings.webSearch&&`on`),onClick:()=>void n.updateSettings({webSearch:!e.settings.webSearch}),role:`button`,tabIndex:0,onKeyDown:()=>void 0})]})]}),(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsx)(`div`,{className:`sg-t`,children:`Appearance`}),(0,L.jsxs)(`div`,{className:`config-shortcut-card appearance-shortcut-card`,children:[(0,L.jsxs)(`div`,{className:`config-shortcut-copy`,children:[(0,L.jsxs)(`strong`,{children:[f,` theme active`]}),(0,L.jsx)(`span`,{children:`Ambient background, shell surfaces, and persistent palette selection.`})]}),(0,L.jsx)(`button`,{className:`mini-action`,onClick:s,type:`button`,children:`Open Theme Picker`})]})]}),(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsx)(`div`,{className:`sg-t`,children:`Skills`}),(0,L.jsxs)(`div`,{className:`config-shortcut-card skill-shortcut-card`,children:[(0,L.jsxs)(`div`,{className:`config-shortcut-copy`,children:[(0,L.jsx)(`strong`,{children:`Skills moved into a dedicated library`}),(0,L.jsxs)(`span`,{children:[e.installedSkills.length,` installed ·`,` `,e.installedSkills.filter(e=>e.enabled).length,` `,`enabled · `,e.remoteSkills.length,` available to install`]})]}),(0,L.jsx)(`button`,{className:`mini-action`,onClick:o,type:`button`,children:`Open Skills Library`})]})]}),(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsx)(`div`,{className:`sg-t`,children:`MCP`}),e.mcpServers.map(e=>(0,L.jsxs)(`div`,{className:`mcp-card`,children:[(0,L.jsxs)(`div`,{className:`mcp-head`,children:[(0,L.jsx)(`strong`,{children:e.name}),(0,L.jsx)(`span`,{children:e.authStatus})]}),(0,L.jsx)(`div`,{className:`mcp-tools`,children:Object.keys(e.tools).slice(0,4).join(` · `)}),(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void n.toggleMcpAuth(e.name),children:e.authStatus===`notLoggedIn`?`Connect`:`Refresh`})]},e.name))]}),(0,L.jsxs)(`div`,{className:`sg`,children:[(0,L.jsxs)(`div`,{className:`sg-t`,children:[`Feature Flags`,` `,(0,L.jsx)(`button`,{className:`feature-refresh`,type:`button`,onClick:()=>r(`Feature flags refreshed`,`ok`),children:`⟳`})]}),e.featureFlags.map(e=>(0,L.jsxs)(`div`,{className:`sr`,children:[(0,L.jsxs)(`span`,{className:`sl`,children:[e.name,` `,(0,L.jsxs)(`small`,{children:[`(`,e.stage,`)`]})]}),(0,L.jsx)(`div`,{className:H(`tog`,e.enabled&&`on`),onClick:()=>void n.toggleFeatureFlag(e.name),role:`button`,tabIndex:0,onKeyDown:()=>void 0})]},e.name))]}),(0,L.jsxs)(`div`,{className:`config-preview`,children:[(0,L.jsx)(`div`,{className:`config-title`,children:`Session config snapshot`}),(0,L.jsx)(`div`,{children:`# Nomadex workspace config`}),(0,L.jsxs)(`div`,{children:[`provider = "`,e.settings.provider,`"`]}),(0,L.jsxs)(`div`,{children:[`model = "`,e.settings.model,`"`]}),(0,L.jsxs)(`div`,{children:[`approval_policy = "`,e.settings.approvalPolicy,`"`]}),(0,L.jsxs)(`div`,{children:[`model_reasoning_effort = "`,e.settings.reasoningEffort,`"`]}),(0,L.jsxs)(`div`,{children:[`web_search = "`,e.settings.webSearch?`live`:`disabled`,`"`]}),(0,L.jsx)(`br`,{}),(0,L.jsx)(`div`,{children:`[features]`}),e.featureFlags.slice(0,4).map(e=>(0,L.jsxs)(`div`,{children:[e.name,` = `,e.enabled?`true`:`false`]},e.name)),(0,L.jsx)(`br`,{}),(0,L.jsx)(`div`,{children:`# active thread`}),(0,L.jsxs)(`div`,{children:[`thread = "`,t,`"`]})]})]})}),eC=1200,tC=e=>e.find(e=>e.status===`running`)?.id??e[0]?.id??null;function nC({cwd:e,terminals:t,onStartShell:n,onSendInput:r,onTerminate:i}){let[a,o]=(0,I.useState)(()=>tC(t)),[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(null),p=(0,I.useRef)(null),m=(0,I.useRef)(null),h=(0,I.useRef)(a),g=(0,I.useRef)(!0);(0,I.useEffect)(()=>{let e=t.some(e=>e.id===a)?a:tC(t);e!==a&&o(e)},[a,t]);let _=(0,I.useMemo)(()=>t.find(e=>e.id===a)??t.find(e=>e.status===`running`)??t[0]??null,[a,t]),v=(0,I.useMemo)(()=>_?_.log.slice(-eC):[],[_]),y=_?Math.max(0,_.log.length-v.length):0,b=Math.max(t.length-1,0),x=!!(_?.writable&&_.status===`running`),S=(0,I.useCallback)(()=>{let e=m.current;if(!e)return;e.focus();let t=e.value.length;try{e.setSelectionRange(t,t)}catch{}},[]);(0,I.useEffect)(()=>{let e=p.current,t=_?.id??null;if(!e){h.current=t;return}let n=h.current!==t;if(h.current=t,!n&&!g.current)return;let r=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight});return()=>{window.cancelAnimationFrame(r)}},[_?.id,v.length]),(0,I.useEffect)(()=>{if(!x)return;let e=window.requestAnimationFrame(()=>{S()});return()=>{window.cancelAnimationFrame(e)}},[_?.id,x,S]);let C=()=>{let e=p.current;e&&(g.current=e.scrollHeight-e.scrollTop-e.clientHeight<40)},w=async()=>{u(null),f(`start`);try{o(await n()),c(``)}catch(e){u(e instanceof Error?e.message:`Unable to start the project shell.`)}finally{f(null)}},T=async()=>{if(!_||!x||!s.trim())return;let e=s;u(null),f(`send`);try{c(``),await r(_.id,`${e}\n`)}catch(t){c(e),u(t instanceof Error?t.message:`Unable to send terminal input.`)}finally{f(null),typeof window<`u`&&window.requestAnimationFrame(()=>{S()})}},E=async()=>{if(!(!_||!x)){u(null),f(`send`);try{await r(_.id,``)}catch(e){u(e instanceof Error?e.message:`Unable to send interrupt.`)}finally{f(null),typeof window<`u`&&window.requestAnimationFrame(()=>{S()})}}},D=async()=>{if(!(!_||_.status!==`running`)){u(null),f(`stop`);try{await i(_.id)}catch(e){u(e instanceof Error?e.message:`Unable to stop the terminal.`)}finally{f(null)}}};return(0,L.jsxs)(`div`,{className:`terminal-panel`,children:[(0,L.jsxs)(`div`,{className:`terminal-plain-bar`,children:[(0,L.jsxs)(`div`,{className:`terminal-plain-meta`,children:[(0,L.jsx)(`span`,{className:`terminal-plain-title`,children:`Terminal`}),_?(0,L.jsx)(`span`,{className:H(`status-chip`,`terminal-status-chip`,_.status),children:_.status}):null,b>0?(0,L.jsxs)(`span`,{className:`terminal-plain-count`,children:[t.length,` shells`]}):null]}),(0,L.jsxs)(`div`,{className:`terminal-toolbar-actions`,children:[(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void w(),children:d===`start`?`Starting…`:`New shell`}),_?(0,L.jsx)(`button`,{className:`mini-action`,disabled:!x||d===`send`,onClick:()=>void E(),type:`button`,children:`Ctrl+C`}):null,_?(0,L.jsx)(`button`,{className:`mini-action danger`,disabled:_.status!==`running`||d===`stop`,onClick:()=>void D(),type:`button`,children:d===`stop`?`Stopping…`:`Stop`}):null]})]}),(0,L.jsx)(`div`,{className:`terminal-project-path`,children:e}),l?(0,L.jsx)(`div`,{className:`terminal-inline-error`,children:l}):null,t.length===0?(0,L.jsxs)(`div`,{className:`terminal-empty-state`,children:[(0,L.jsx)(`div`,{className:`empty-panel`,children:`No project shell yet.`}),(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>void w(),children:`Open project shell`})]}):null,t.length>0&&_?(0,L.jsxs)(L.Fragment,{children:[y>0?(0,L.jsxs)(`div`,{className:`terminal-log-cap`,children:[`Showing the latest `,v.length,` lines of `,_.log.length]}):null,(0,L.jsxs)(`div`,{className:H(`term`,`terminal-log-plain`,x&&`terminal-log-plain-interactive`),onClick:()=>{x&&S()},onScroll:C,ref:p,children:[v.map((e,t)=>(0,L.jsx)(`div`,{className:H(`terminal-log-row`,t===0&&`t-p`),children:e||` `},`${_.id}:log:${y+t}`)),x?(0,L.jsxs)(`form`,{className:`terminal-log-prompt t-p`,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),T()},children:[(0,L.jsx)(`span`,{className:`terminal-inline-editor-shell`,children:`$`}),(0,L.jsx)(`input`,{"aria-label":`Terminal input`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,className:`terminal-inline-editor`,enterKeyHint:`send`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.stopPropagation(),(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`c`&&s.length===0&&(e.preventDefault(),E())},ref:m,spellCheck:!1,type:`text`,value:s}),(0,L.jsx)(`button`,{"aria-hidden":`true`,className:`terminal-submit-proxy`,tabIndex:-1,type:`submit`})]}):null]})]}):null]})}function rC(){return rC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rC.apply(null,arguments)}function iC(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var aC=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=uC(e.state,n.from);return r.line?sC(e):r.block?lC(e):!1};function oC(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var sC=oC(hC,0),cC=oC(mC,0),lC=oC((e,t)=>mC(e,t,pC(t)),0);function uC(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var dC=50;function fC(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-dC,r),o=e.sliceDoc(i,i+dC),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*dC?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+dC),d=e.sliceDoc(i-dC,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(u.charAt(f+t.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(d.charAt(m-1))?1:0}}:null}function pC(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function mC(e,t,n=t.selection.ranges){let r=n.map(e=>uC(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>fC(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function hC(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=uC(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var gC=pe.define(),_C=pe.define(),vC=te.define(),yC=te.define({combine(e){return f(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),bC=i.define({create(){return zC.empty},update(e,t){let n=t.state.facet(yC),r=t.annotation(gC);if(r){let i=DC.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?OC(o,o.length,n.minDepth,i):PC(o,t.startState.selection),new zC(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(_C);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(ue.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=DC.fromTransaction(t),o=t.annotation(ue.time),s=t.annotation(ue.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new zC(e.done.map(DC.fromJSON),e.undone.map(DC.fromJSON))}});function xC(e={}){return[bC,yC.of(e),u.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?CC:e.inputType==`historyRedo`?wC:null;return n?(e.preventDefault(),n(t)):!1}})]}function SC(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(bC,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var CC=SC(0,!1),wC=SC(1,!1),TC=SC(0,!0),EC=SC(1,!0),DC=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&se.fromJSON(t.changes),[],t.mapped&&ce.fromJSON(t.mapped),t.startSelection&&P.fromJSON(t.startSelection),t.selectionsAfter.map(P.fromJSON))}static fromTransaction(t,n){let r=MC;for(let e of t.startState.facet(vC)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,MC)}static selection(t){return new e(void 0,MC,void 0,void 0,t)}};function OC(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function kC(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function AC(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function jC(e,t){return e.length?t.length?e.concat(t):e:t}var MC=[],NC=200;function PC(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-NC));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),OC(e,e.length-1,1e9,n.setSelAfter(r)))}else return[DC.selection([t])]}function FC(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function IC(e,t){if(!e.length)return e;let n=e.length,r=MC;for(;n;){let i=LC(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[DC.selection(r)]:MC}function LC(e,t,n){let r=jC(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):MC,n);if(!e.changes)return DC.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(a):a;return new DC(i,o.mapEffects(e.effects,t),s,e.startSelection.map(a),r)}var RC=/^(input\.type|delete)($|\.)/,zC=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let s=this.done,c=s[s.length-1];return s=c&&c.changes&&!c.changes.empty&&t.changes&&(!r||RC.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,kC(c.changes,t.changes))||r==`input.type.compose`)?OC(s,s.length-1,i.minDepth,new DC(t.changes.compose(c.changes),jC(o.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,MC)):OC(s,s.length,i.minDepth,t),new e(s,MC,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:MC;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&AC(a[a.length-1],t)?this:new e(PC(this.done,t),this.undone,n,r)}addMapping(t){return new e(IC(this.done,t),IC(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:gC.of({side:e,rest:FC(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?MC:r.slice(0,r.length-1);return i.mapped&&(n=IC(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:gC.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};zC.empty=new zC(MC,MC);var BC=[{key:`Mod-z`,run:CC,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:wC,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:wC,preventDefault:!0},{key:`Mod-u`,run:TC,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:EC,preventDefault:!0}];function VC(e,t){return P.create(e.ranges.map(t),e.mainIndex)}function HC(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function UC({state:e,dispatch:t},n){let r=VC(e.selection,n);return r.eq(e.selection,!0)?!1:(t(HC(e,r)),!0)}function WC(e,t){return P.cursor(t?e.to:e.from)}function GC(e,t){return UC(e,n=>n.empty?e.moveByChar(n,t):WC(n,t))}function KC(e){return e.textDirectionAt(e.state.selection.main.head)==c.LTR}var qC=e=>GC(e,!KC(e)),JC=e=>GC(e,KC(e));function YC(e,t){return UC(e,n=>n.empty?e.moveByGroup(n,t):WC(n,t))}var XC=e=>YC(e,!KC(e)),ZC=e=>YC(e,KC(e));typeof Intl<`u`&&Intl.Segmenter;function QC(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function $C(e,t,n){let r=M(e).resolveInner(t.head),i=n?d.closedBy:d.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;QC(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?m(e,r.from,1):m(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,P.cursor(s,n?-1:1)}var ew=e=>UC(e,t=>$C(e.state,t,!KC(e))),tw=e=>UC(e,t=>$C(e.state,t,KC(e)));function nw(e,t){return UC(e,n=>{if(!n.empty)return WC(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var rw=e=>nw(e,!1),iw=e=>nw(e,!0);function aw(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(u.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ow(e,t){let n=aw(e),{state:r}=e,i=VC(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):WC(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=u.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(HC(r,i),{effects:a}),!0}var sw=e=>ow(e,!1),cw=e=>ow(e,!0);function lw(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=P.cursor(r.from+n))}return i}var uw=e=>UC(e,t=>lw(e,t,!0)),dw=e=>UC(e,t=>lw(e,t,!1)),fw=e=>UC(e,t=>lw(e,t,!KC(e))),pw=e=>UC(e,t=>lw(e,t,KC(e))),mw=e=>UC(e,t=>P.cursor(e.lineBlockAt(t.head).from,1)),hw=e=>UC(e,t=>P.cursor(e.lineBlockAt(t.head).to,-1));function gw(e,t,n){let r=!1,i=VC(e.selection,t=>{let i=m(e,t.head,-1)||m(e,t.head,1)||t.head>0&&m(e,t.head-1,1)||t.head<e.doc.length&&m(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?P.range(t.anchor,a):P.cursor(a)});return r?(t(HC(e,i)),!0):!1}var _w=({state:e,dispatch:t})=>gw(e,t,!1);function vw(e,t){let n=VC(e.state.selection,e=>{let n=t(e);return P.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(HC(e.state,n)),!0)}function yw(e,t){return vw(e,n=>e.moveByChar(n,t))}var bw=e=>yw(e,!KC(e)),xw=e=>yw(e,KC(e));function Sw(e,t){return vw(e,n=>e.moveByGroup(n,t))}var Cw=e=>Sw(e,!KC(e)),ww=e=>Sw(e,KC(e)),Tw=e=>vw(e,t=>$C(e.state,t,!KC(e))),Ew=e=>vw(e,t=>$C(e.state,t,KC(e)));function Dw(e,t){return vw(e,n=>e.moveVertically(n,t))}var Ow=e=>Dw(e,!1),kw=e=>Dw(e,!0);function Aw(e,t){return vw(e,n=>e.moveVertically(n,t,aw(e).height))}var jw=e=>Aw(e,!1),Mw=e=>Aw(e,!0),Nw=e=>vw(e,t=>lw(e,t,!0)),Pw=e=>vw(e,t=>lw(e,t,!1)),Fw=e=>vw(e,t=>lw(e,t,!KC(e))),Iw=e=>vw(e,t=>lw(e,t,KC(e))),Lw=e=>vw(e,t=>P.cursor(e.lineBlockAt(t.head).from)),Rw=e=>vw(e,t=>P.cursor(e.lineBlockAt(t.head).to)),zw=({state:e,dispatch:t})=>(t(HC(e,{anchor:0})),!0),Bw=({state:e,dispatch:t})=>(t(HC(e,{anchor:e.doc.length})),!0),Vw=({state:e,dispatch:t})=>(t(HC(e,{anchor:e.selection.main.anchor,head:0})),!0),Hw=({state:e,dispatch:t})=>(t(HC(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Uw=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Ww=({state:e,dispatch:t})=>{let n=lT(e).map(({from:t,to:n})=>P.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:P.create(n),userEvent:`select`})),!0},Gw=({state:e,dispatch:t})=>{let n=VC(e.selection,t=>{let n=M(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return P.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(HC(e,n)),!0)};function Kw(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(HC(n,P.create(i,i.length-1))),!0)}var qw=e=>Kw(e,!1),Jw=e=>Kw(e,!0),Yw=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=P.create([n.main]):n.main.empty||(r=P.create([P.cursor(n.main.head)])),r?(t(HC(e,r)),!0):!1};function Xw(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Zw(e,o,!1)):o>i&&(n=`delete.forward`,o=Zw(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Zw(e,i,!1),a=Zw(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:P.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?u.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Zw(e,t,n){if(e instanceof u)for(let r of e.state.facet(u.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Qw=(e,t,n)=>Xw(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=p(s,a.tabSize)%De(a)||De(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=_(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=_(o.text,c-o.from,!1,!1)+o.from);return c}),$w=e=>Qw(e,!1,!0),eT=e=>Qw(e,!0,!1),tT=(e,t)=>Xw(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=_(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),nT=e=>tT(e,!1),rT=e=>tT(e,!0),iT=e=>Xw(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),aT=e=>Xw(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),oT=e=>Xw(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),sT=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:h.of([``,``])},range:P.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},cT=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:_(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:_(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:P.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function lT(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function uT(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of lT(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(P.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(P.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:P.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var dT=({state:e,dispatch:t})=>uT(e,t,!1),fT=({state:e,dispatch:t})=>uT(e,t,!0);function pT(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of lT(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var mT=({state:e,dispatch:t})=>pT(e,t,!1),hT=({state:e,dispatch:t})=>pT(e,t,!0),gT=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(lT(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=VC(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function _T(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=M(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(d.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var vT=bT(!1),yT=bT(!0);function bT(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&_T(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new me(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=y(s,r);for(c??=p(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,x(t,c)];return o&&l.push(x(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:h.of(l)},range:P.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function xT(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:P.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var ST=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new me(e,{overrideIndentation:e=>n[e]??-1}),i=xT(e,(t,i,a)=>{let o=y(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=x(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},CT=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(xT(e,(t,n)=>{n.push({from:t.from,insert:e.facet(a)})}),{userEvent:`input.indent`})),!0),wT=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(xT(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=p(r,e.tabSize),a=0,o=x(e,Math.max(0,i-De(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),TT=e=>(e.setTabFocusMode(),!0),ET=[{key:`Ctrl-b`,run:qC,shift:bw,preventDefault:!0},{key:`Ctrl-f`,run:JC,shift:xw},{key:`Ctrl-p`,run:rw,shift:Ow},{key:`Ctrl-n`,run:iw,shift:kw},{key:`Ctrl-a`,run:mw,shift:Lw},{key:`Ctrl-e`,run:hw,shift:Rw},{key:`Ctrl-d`,run:eT},{key:`Ctrl-h`,run:$w},{key:`Ctrl-k`,run:iT},{key:`Ctrl-Alt-h`,run:nT},{key:`Ctrl-o`,run:sT},{key:`Ctrl-t`,run:cT},{key:`Ctrl-v`,run:cw}],DT=[{key:`ArrowLeft`,run:qC,shift:bw,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:XC,shift:Cw,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:fw,shift:Fw,preventDefault:!0},{key:`ArrowRight`,run:JC,shift:xw,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:ZC,shift:ww,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:pw,shift:Iw,preventDefault:!0},{key:`ArrowUp`,run:rw,shift:Ow,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:zw,shift:Vw},{mac:`Ctrl-ArrowUp`,run:sw,shift:jw},{key:`ArrowDown`,run:iw,shift:kw,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Bw,shift:Hw},{mac:`Ctrl-ArrowDown`,run:cw,shift:Mw},{key:`PageUp`,run:sw,shift:jw},{key:`PageDown`,run:cw,shift:Mw},{key:`Home`,run:dw,shift:Pw,preventDefault:!0},{key:`Mod-Home`,run:zw,shift:Vw},{key:`End`,run:uw,shift:Nw,preventDefault:!0},{key:`Mod-End`,run:Bw,shift:Hw},{key:`Enter`,run:vT,shift:vT},{key:`Mod-a`,run:Uw},{key:`Backspace`,run:$w,shift:$w,preventDefault:!0},{key:`Delete`,run:eT,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:nT,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:rT,preventDefault:!0},{mac:`Mod-Backspace`,run:aT,preventDefault:!0},{mac:`Mod-Delete`,run:oT,preventDefault:!0}].concat(ET.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),OT=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:ew,shift:Tw},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:tw,shift:Ew},{key:`Alt-ArrowUp`,run:dT},{key:`Shift-Alt-ArrowUp`,run:mT},{key:`Alt-ArrowDown`,run:fT},{key:`Shift-Alt-ArrowDown`,run:hT},{key:`Mod-Alt-ArrowUp`,run:qw},{key:`Mod-Alt-ArrowDown`,run:Jw},{key:`Escape`,run:Yw},{key:`Mod-Enter`,run:yT},{key:`Alt-l`,mac:`Ctrl-l`,run:Ww},{key:`Mod-i`,run:Gw,preventDefault:!0},{key:`Mod-[`,run:wT},{key:`Mod-]`,run:CT},{key:`Mod-Alt-\\`,run:ST},{key:`Shift-Mod-k`,run:gT},{key:`Shift-Mod-\\`,run:_w},{key:`Mod-/`,run:aC},{key:`Alt-A`,run:cC},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:TT}].concat(DT),kT={key:`Tab`,run:CT,shift:wT},AT=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,jT=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(AT(e)):AT,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return n(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=s(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=le(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(jT.prototype[Symbol.iterator]=function(){return this});var MT={from:-1,to:-1,match:/.*/.exec(``)},NT=`gm`+(/x/.unicode==null?``:`u`),PT=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=MT,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new LT(e,t,n,r,i);this.re=new RegExp(t,NT+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=zT(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=zT(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},FT=new WeakMap,IT=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=FT.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return FT.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),FT.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},LT=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=MT,this.matchPos=zT(e,r),this.re=new RegExp(t,NT+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=IT.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=zT(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=IT.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(PT.prototype[Symbol.iterator]=LT.prototype[Symbol.iterator]=function(){return this});function RT(e){try{return new RegExp(e,NT),!0}catch{return!1}}function zT(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var BT=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Ce(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&l){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),m=P.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[r,u.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},VT={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},HT=te.define({combine(e){return f(e,VT,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function UT(e){let t=[YT,JT];return e&&t.push(HT.of(e)),t}var WT=C.mark({class:`cm-selectionMatch`}),GT=C.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function KT(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=D.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=D.Word)}function qT(e,t,n,r){return e(t.sliceDoc(n,n+1))==D.Word&&e(t.sliceDoc(r-1,r))==D.Word}var JT=ve.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(HT),{state:n}=e,r=n.selection;if(r.ranges.length>1)return C.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return C.none;let e=n.wordAt(i.head);if(!e)return C.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return C.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(KT(o,n,i.from,i.to)&&qT(o,n,i.from,i.to)))return C.none}else if(a=n.sliceDoc(i.from,i.to),!a)return C.none}let s=[];for(let r of e.visibleRanges){let e=new jT(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||KT(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(GT.range(r,a)):(r>=i.to||a<=i.from)&&s.push(WT.range(r,a)),s.length>t.maxMatches))return C.none}}return C.set(s)}},{decorations:e=>e.decorations}),YT=u.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),XT=({state:e,dispatch:t})=>{let{selection:n}=e,r=P.create(n.ranges.map(t=>e.wordAt(t.head)||P.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function ZT(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new jT(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new jT(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var QT=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return XT({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=ZT(e,r);return i?(t(e.update({selection:e.selection.addRange(P.range(i.from,i.to),!1),effects:u.scrollIntoView(i.to)})),!0):!1},$T=te.define({combine(e){return f(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new NE(e),scrollToMatch:e=>u.scrollIntoView(e)})}}),eE=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||RT(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
209
+ `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new dE(this):new aE(this)}getCursor(e,t=0,n){let r=e.doc?e:ke.create({doc:e});return n??=r.doc.length,this.regexp?sE(this,r,t,n):rE(this,r,t,n)}},tE=class{constructor(e){this.spec=e}};function nE(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function rE(e,t,n,r){let i;return e.wholeWord&&(i=iE(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=nE(e.test,t,i)),new jT(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function iE(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(cE(i,n-a))!=D.Word||t(lE(i,n-a))!=D.Word)&&(t(lE(i,r-a))!=D.Word||t(cE(i,r-a))!=D.Word))}var aE=class extends tE{constructor(e){super(e)}nextMatch(e,t,n){let r=rE(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=rE(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=rE(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=rE(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=rE(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function oE(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function sE(e,t,n,r){let i;return e.wholeWord&&(i=uE(t.charCategorizer(t.selection.main.head))),e.test&&(i=oE(e.test,t,i)),new PT(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function cE(e,t){return e.slice(_(e,t,!1),t)}function lE(e,t){return e.slice(t,_(e,t))}function uE(e){return(t,n,r)=>!r[0].length||(e(cE(r.input,r.index))!=D.Word||e(lE(r.input,r.index))!=D.Word)&&(e(lE(r.input,r.index+r[0].length))!=D.Word||e(cE(r.input,r.index+r[0].length))!=D.Word)}var dE=class extends tE{nextMatch(e,t,n){let r=sE(this.spec,e,n,e.doc.length).next();return r.done&&(r=sE(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=sE(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=sE(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=sE(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},fE=o.define(),pE=o.define(),mE=i.define({create(e){return new hE(DE(e).create(),null)},update(e,t){for(let n of t.effects)n.is(fE)?e=new hE(n.value.create(),e.panel):n.is(pE)&&(e=new hE(e.query,n.value?EE:null));return e},provide:e=>k.from(e,e=>e.panel)}),hE=class{constructor(e,t){this.query=e,this.panel=t}},gE=C.mark({class:`cm-searchMatch`}),_E=C.mark({class:`cm-searchMatch cm-searchMatch-selected`}),vE=ve.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(mE))}update(e){let t=e.state.field(mE);(t!=e.startState.field(mE)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return C.none;let{view:n}=this,r=new Ee;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?_E:gE)})}return r.finish()}},{decorations:e=>e.decorations});function yE(e){return t=>{let n=t.state.field(mE,!1);return n&&n.query.spec.valid?e(t,n):AE(t)}}var bE=yE((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=P.single(r.from,r.to),a=e.state.facet($T);return e.dispatch({selection:i,effects:[LE(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),kE(e),!0}),xE=yE((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=P.single(i.from,i.to),o=e.state.facet($T);return e.dispatch({selection:a,effects:[LE(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),kE(e),!0}),SE=yE((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:P.create(n.map(e=>P.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),CE=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new jT(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(P.range(t.value.from,t.value.to))}return t(e.update({selection:P.create(a,o),userEvent:`select.search.matches`})),!0},wE=yE((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,d=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),d.push(u.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let f=e.state.changes(s);return o&&(c=P.single(o.from,o.to).map(f),d.push(LE(e,o)),d.push(n.facet($T).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:`input.replace`}),!0}),TE=yE((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:u.announce.of(r),userEvent:`input.replace.all`}),!0});function EE(e){return e.state.facet($T).createPanel(e)}function DE(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet($T);return new eE({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function OE(e){let t=v(e,EE);return t&&t.dom.querySelector(`[main-field]`)}function kE(e){let t=OE(e);t&&t==e.root.activeElement&&t.select()}var AE=e=>{let t=e.state.field(mE,!1);if(t&&t.panel){let n=OE(e);if(n&&n!=e.root.activeElement){let r=DE(e.state,t.query.spec);r.valid&&e.dispatch({effects:fE.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[pE.of(!0),t?fE.of(DE(e.state,t.query.spec)):o.appendConfig.of(zE)]});return!0},jE=e=>{let t=e.state.field(mE,!1);if(!t||!t.panel)return!1;let n=v(e,EE);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:pE.of(!1)}),!0},ME=[{key:`Mod-f`,run:AE,scope:`editor search-panel`},{key:`F3`,run:bE,shift:xE,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:bE,shift:xE,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:jE,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:CE},{key:`Mod-Alt-g`,run:BT},{key:`Mod-d`,run:QT,preventDefault:!0}],NE=class{constructor(e){this.view=e;let t=this.query=e.state.field(mE).query.spec;this.commit=this.commit.bind(this),this.searchField=N(`input`,{value:t.search,placeholder:PE(e,`Find`),"aria-label":PE(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=N(`input`,{value:t.replace,placeholder:PE(e,`Replace`),"aria-label":PE(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=N(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=N(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=N(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return N(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=N(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>bE(e),[PE(e,`next`)]),n(`prev`,()=>xE(e),[PE(e,`previous`)]),n(`select`,()=>SE(e),[PE(e,`all`)]),N(`label`,null,[this.caseField,PE(e,`match case`)]),N(`label`,null,[this.reField,PE(e,`regexp`)]),N(`label`,null,[this.wordField,PE(e,`by word`)]),...e.state.readOnly?[]:[N(`br`),this.replaceField,n(`replace`,()=>wE(e),[PE(e,`replace`)]),n(`replaceAll`,()=>TE(e),[PE(e,`replace all`)])],N(`button`,{name:`close`,onclick:()=>jE(e),"aria-label":PE(e,`close`),type:`button`},[`×`])])}commit(){let e=new eE({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:fE.of(e)}))}keydown(e){fe(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?xE:bE)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),wE(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(fE)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet($T).top}};function PE(e,t){return e.state.phrase(t)}var FE=30,IE=/[\s\.,:;?!]/;function LE(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-FE),o=Math.min(i,n+FE),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<FE;e++)if(!IE.test(s[e+1])&&IE.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-FE;e--)if(!IE.test(s[e-1])&&IE.test(s[e])){s=s.slice(0,e);break}}return u.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var RE=u.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),zE=[mE,b.low(vE),RE],BE=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=M(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(qE(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function VE(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function HE(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=VE(t)+VE(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function UE(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:HE(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function WE(e,t){return n=>{for(let t=M(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var GE=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function KE(e){return e.selection.main.from}function qE(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var JE=pe.define();function YE(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:P.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var XE=new WeakMap;function ZE(e){if(!Array.isArray(e))return e;let t=XE.get(e);return t||XE.set(e,t=UE(e)),t}var QE=o.define(),$E=o.define(),eD=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=n(e,t),i=le(r);this.chars.push(r);let a=e.slice(t,t+i),o=a.toUpperCase();this.folded.push(n(o==a?a.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:a,byWord:o}=this;if(t.length==1){let i=n(e,0),a=le(i),o=a==e.length?0:-100;if(i!=t[0])if(i==r[0])o+=-200;else return null;return this.ret(o,[0,a])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,u=0;if(c<0){for(let a=0,o=Math.min(e.length,200);a<o&&u<l;){let o=n(e,a);(o==t[u]||o==r[u])&&(i[u++]=a),a+=le(o)}if(u<l)return null}let d=0,f=0,p=!1,m=0,h=-1,g=-1,_=/[a-z]/.test(e),v=!0;for(let i=0,u=Math.min(e.length,200),y=0;i<u&&f<l;){let u=n(e,i);c<0&&(d<l&&u==t[d]&&(a[d++]=i),m<l&&(u==t[m]||u==r[m]?(m==0&&(h=i),g=i+1,m++):m=0));let b,x=u<255?u>=48&&u<=57||u>=97&&u<=122?2:u>=65&&u<=90?1:0:(b=s(u))==b.toLowerCase()?b==b.toUpperCase()?0:2:1;(!i||x==1&&_||y==0&&x!=0)&&(t[f]==u||r[f]==u&&(p=!0)?o[f++]=i:o.length&&(v=!1)),y=x,i+=le(u)}return f==l&&o[0]==0&&v?this.result(-100+(p?-200:0),o,e):m==l&&h==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):m==l?this.ret(-900-e.length,[h,g]):f==l?this.result(-100+(p?-200:0)+-700+(v?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],a=0;for(let e of t){let t=e+(this.astral?le(n(r,e)):1);a&&i[a-1]==e?i[a-1]=t:(i[a++]=e,i[a++]=t)}return this.ret(e-r.length,i)}},tD=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},nD=te.define({combine(e){return f(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:iD,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>rD(e(n),t(n)),optionClass:(e,t)=>n=>rD(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function rD(e,t){return e?t?e+` `+t:e:t}function iD(e,t,n,r,i,a){let o=e.textDirection==c.RTL,s=o,l=!1,u=`top`,d,f,p=t.left-i.left,m=i.right-t.right,h=r.right-r.left,g=r.bottom-r.top;if(s&&p<Math.min(h,m)?s=!1:!s&&m<Math.min(h,p)&&(s=!0),h<=(s?p:m))d=Math.max(i.top,Math.min(n.top,i.bottom-g))-t.top,f=Math.min(400,s?p:m);else{l=!0,f=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=g||e>t.top?d=n.bottom-t.top:(u=`bottom`,d=t.bottom-n.top)}let _=(t.bottom-t.top)/a.offsetHeight,v=(t.right-t.left)/a.offsetWidth;return{style:`${u}: ${d/_}px; max-width: ${f/v}px`,class:`cm-completionInfo-`+(l?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var aD=o.define();function oD(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function sD(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}var cD=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(nD);this.optionContent=oD(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=sD(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:aD.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(nD).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:$E.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=sD(r.length,i,e.state.facet(nD).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=sD(t.options.length,t.selected,this.view.state.facet(nD).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>_e(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&uD(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(nD).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function lD(e,t){return n=>new cD(n,e,t)}function uD(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function dD(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function fD(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(nD);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new GE(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new tD(n):new eD(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new GE(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):dD(e.completion)>dD(c)&&(s[s.length-1]=e),c=e.completion}return s}var pD=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,vD(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=fD(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(nD).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,vD(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:DD,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},mD=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(yD,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(nD),i=(r.override||n.languageDataAt(`autocomplete`,KE(n)).map(ZE)).map(e=>(this.active.find(t=>t.source==e)||new xD(e,this.active.some(e=>e.state!=0)?1:0)).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(wD));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!hD(i,this.active)||o?a=pD.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new xD(e.source,0):e));for(let e of t.effects)e.is(aD)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?gD:_D}};function hD(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var gD={"aria-autocomplete":`list`},_D={};function vD(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var yD=[];function bD(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(JE);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var xD=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=bD(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(QE))i=new e(i.source,1,n.value);else if(n.is($E))i=new e(i.source,0);else if(n.is(wD))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(KE(e.state))}},SD=class e extends xD{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=KE(t.state);if(o>a||!r||n&2&&(KE(t.startState)==this.from||o<this.limit))return new xD(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return CD(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new BE(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??KE(t.state)):new xD(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new e(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new xD(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function CD(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):qE(e,!0).test(i)}var wD=o.define({map(e,t){return e.map(e=>e.map(t))}}),TD=i.define({create(){return mD.start()},update(e,t){return e.update(t)},provide:e=>[ae.from(e,e=>e.tooltip),u.contentAttributes.from(e,e=>e.attrs)]});function ED(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(TD).active.find(e=>e.source==t.source);return r instanceof SD?(typeof n==`string`?e.dispatch({...YE(e.state,n,r.from,r.to),annotations:JE.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var DD=lD(TD,ED);function OD(t,n=`option`){return r=>{let i=r.state.field(TD,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<r.state.facet(nD).interactionDelay)return!1;let a=1,o;n==`page`&&(o=e(r,i.open.tooltip))&&(a=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector(`li`).offsetHeight)-1));let{length:s}=i.open.options,c=i.open.selected>-1?i.open.selected+a*(t?1:-1):t?0:s-1;return c<0?c=n==`page`?0:s-1:c>=s&&(c=n==`page`?s-1:0),r.dispatch({effects:aD.of(c)}),!0}}var kD=e=>{let t=e.state.field(TD,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(nD).interactionDelay?!1:ED(e,t.open.options[t.open.selected])},AD=e=>e.state.field(TD,!1)?(e.dispatch({effects:QE.of(!0)}),!0):!1,jD=e=>{let t=e.state.field(TD,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:$E.of(null)}),!0)},MD=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},ND=50,PD=1e3,FD=ve.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(TD).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(TD),n=e.state.facet(nD);if(!e.selectionSet&&!e.docChanged&&e.startState.field(TD)==t)return;let r=e.transactions.some(e=>{let t=bD(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>ND&&Date.now()-n.time>PD){for(let e of n.context.abortListeners)try{e()}catch(e){_e(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(QE)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(TD);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(nD).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new BE(t,KE(t),e.explicit,this.view),r=new MD(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:$E.of(null)}),_e(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(nD).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(nD),n=this.view.state.field(TD);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=KE(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+(i.active.explicit?0:1)),a=new SD(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new xD(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:wD.of(e)})}},{eventHandlers:{blur(t){let n=this.view.state.field(TD,!1);if(n&&n.tooltip&&this.view.state.facet(nD).closeOnBlur){let r=n.open&&e(this.view,n.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:$E.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:QE.of(!1)}),20),this.composing=0}}}),ID=typeof navigator==`object`&&/Win/.test(navigator.platform),LD=b.highest(u.domEventHandlers({keydown(e,t){let n=t.state.field(TD,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(ID&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&ED(t,r),!1}})),RD=u.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),zD=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},BD=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,Oe.TrackDel),r=t.mapPos(this.to,1,Oe.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},VD=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),o=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=o,s=/^\t*/.exec(i)[0].length;for(let t=0;t<s;t++)n+=e.facet(a);r.push(t+n.length-s),i=n+i.slice(s)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new BD(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1,c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new zD(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},HD=C.widget({widget:new class extends l{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),UD=C.mark({class:`cm-snippetField`}),WD=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=C.set(e.map(e=>(e.from==e.to?HD:UD).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},GD=o.define({map(e,t){return e&&e.map(t)}}),KD=o.define(),qD=i.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(GD))return n.value;if(n.is(KD)&&e)return new WD(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>u.decorations.from(e,e=>e?e.deco:C.none)});function JD(e,t){return P.create(e.filter(e=>e.field==t).map(e=>P.range(e.from,e.to)))}function YD(e){let t=VD.parse(e);return(e,n,r,i)=>{let{text:a,ranges:s}=t.instantiate(e.state,r),{main:c}=e.state.selection,l={changes:{from:r,to:i==c.from?c.to:i,insert:h.of(a)},scrollIntoView:!0,annotations:n?[JE.of(n),ue.userEvent.of(`input.complete`)]:void 0};if(s.length&&(l.selection=JD(s,0)),s.some(e=>e.field>0)){let t=new WD(s,0),n=l.effects=[GD.of(t)];e.state.field(qD,!1)===void 0&&n.push(o.appendConfig.of([qD,$D,tO,RD]))}e.dispatch(e.state.update(l))}}function XD(e){return({state:t,dispatch:n})=>{let r=t.field(qD,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:JD(r.ranges,i),effects:GD.of(a?null:new WD(r.ranges,i)),scrollIntoView:!0})),!0}}var ZD=[{key:`Tab`,run:XD(1),shift:XD(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(qD,!1)?(t(e.update({effects:GD.of(null)})),!0):!1}],QD=te.define({combine(e){return e.length?e[0]:ZD}}),$D=b.highest(j.compute([QD],e=>e.facet(QD)));function eO(e,t){return{...t,apply:YD(e)}}var tO=u.domEventHandlers({mousedown(e,t){let n=t.state.field(qD,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:JD(n.ranges,i.field),effects:GD.of(n.ranges.some(e=>e.field>i.field)?new WD(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),nO={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},rO=o.define({map(e,t){return t.mapPos(e,-1,Oe.TrackAfter)??void 0}}),iO=new class extends S{};iO.startSide=1,iO.endSide=-1;var aO=i.define({create(){return r.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(rO)&&(e=e.update({add:[iO.range(n.value,n.value+1)]}));return e}});function oO(){return[dO,aO]}var sO=`()[]{}<>«»»«[]{}`;function cO(e){for(let t=0;t<16;t+=2)if(sO.charCodeAt(t)==e)return sO.charAt(t+1);return s(e<128?e:e+1)}function lO(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||nO}var uO=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),dO=u.inputHandler.of((e,t,r,i)=>{if((uO?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(i.length>2||i.length==2&&le(n(i,0))==1||t!=a.from||r!=a.to)return!1;let o=pO(e.state,i);return o?(e.dispatch(o),!0):!1}),fO=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=lO(e,e.selection.main.head).brackets||nO.brackets,i=null,a=e.changeByRange(t=>{if(t.empty){let i=gO(e.doc,t.head);for(let a of r)if(a==i&&hO(e.doc,t.head)==cO(n(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:P.cursor(t.head-a.length)}}return{range:i=t}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!i}}];function pO(e,t){let r=lO(e,e.selection.main.head),i=r.brackets||nO.brackets;for(let a of i){let o=cO(n(a,0));if(t==a)return o==a?yO(e,a,i.indexOf(a+a+a)>-1,r):_O(e,a,o,r.before||nO.before);if(t==o&&mO(e,e.selection.main.from))return vO(e,a,o)}return null}function mO(e,t){let n=!1;return e.field(aO).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function hO(e,t){let r=e.sliceString(t,t+2);return r.slice(0,le(n(r,0)))}function gO(e,t){let r=e.sliceString(t-2,t);return le(n(r,0))==r.length?r:r.slice(1)}function _O(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:rO.of(a.to+t.length),range:P.range(a.anchor+t.length,a.head+t.length)};let o=hO(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:rO.of(a.head+t.length),range:P.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function vO(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&hO(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:P.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function yO(e,t,n,r){let i=r.stringPrefixes||nO.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:rO.of(r.to+t.length),range:P.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=hO(e.doc,o),c;if(s==t){if(bO(e,o))return{changes:{insert:t+t,from:o},effects:rO.of(o+t.length),range:P.cursor(o+t.length)};if(mO(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:P.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=SO(e,o-2*t.length,i))>-1&&bO(e,c))return{changes:{insert:t+t+t+t,from:o},effects:rO.of(o+t.length),range:P.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=D.Word&&SO(e,o,i)>-1&&!xO(e,o,t,i))return{changes:{insert:t+t,from:o},effects:rO.of(o+t.length),range:P.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function bO(e,t){let n=M(e).resolveInner(t+1);return n.parent&&n.from==t}function xO(e,t,n,r){let i=M(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function SO(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=D.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=D.Word)return n}return-1}function CO(e={}){return[LD,TD,nD.of(e),FD,TO,RD]}var wO=[{key:`Ctrl-Space`,run:AD},{mac:"Alt-`",run:AD},{mac:`Alt-i`,run:AD},{key:`Escape`,run:jD},{key:`ArrowDown`,run:OD(!0)},{key:`ArrowUp`,run:OD(!1)},{key:`PageDown`,run:OD(!0,`page`)},{key:`PageUp`,run:OD(!1,`page`)},{key:`Enter`,run:kD}],TO=b.highest(j.computeN([nD],e=>e.facet(nD).defaultKeymap?[wO]:[])),EO=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},DO=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(VO).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new Ee,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=QO(s);if(i)o.add(n,n,C.widget({widget:new GO(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,C.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,OO(f))}};function OO(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new EO(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new EO(r.from,n,r.diagnostic)}),r}function kO(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(VO).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(jO))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function AO(e,t){return e.field(PO,!1)?t:t.concat(o.appendConfig.of($O))}var jO=o.define(),MO=o.define(),NO=o.define(),PO=i.define({create(){return new DO(C.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=OO(n,e.selected.diagnostic,i)||OO(n,null,i)}!n.size&&i&&t.state.facet(VO).autoPanel&&(i=null),e=new DO(n,i,r)}for(let n of t.effects)if(n.is(jO)){let r=t.state.facet(VO).autoPanel?n.value.length?qO.open:null:e.panel;e=DO.init(n.value,r,t.state)}else n.is(MO)?e=new DO(e.diagnostics,n.value?qO.open:null,e.selected):n.is(NO)&&(e=new DO(e.diagnostics,e.panel,n.value));return e},provide:e=>[k.from(e,e=>e.panel),u.decorations.from(e,e=>e.diagnostics)]}),FO=C.mark({class:`cm-lintRange cm-lintRange-active`});function IO(e,t,n){let{diagnostics:r}=e.state.field(PO),i,a=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(VO).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:LO(e,i)}}}:null}function LO(e,t){return N(`ul`,{class:`cm-tooltip-lint`},t.map(t=>WO(e,t,!1)))}var RO=e=>{let t=e.state.field(PO,!1);(!t||!t.panel)&&e.dispatch({effects:AO(e.state,[MO.of(!0)])});let n=v(e,qO.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},zO=e=>{let t=e.state.field(PO,!1);return!t||!t.panel?!1:(e.dispatch({effects:MO.of(!1)}),!0)},BO=[{key:`Mod-Shift-m`,run:RO,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(PO,!1);if(!t)return!1;let n=e.state.selection.main,r=OO(t.diagnostics,null,n.to+1);return!r&&(r=OO(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],VO=te.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...f(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:HO,tooltipFilter:HO,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function HO(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function UO(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function WO(e,t,n){let r=n?UO(t.actions):[];return N(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},N(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=OO(e.state.field(PO).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),N(`u`,s.slice(c,c+1)),s.slice(c+1)];return N(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&N(`div`,{class:`cm-diagnosticSource`},t.source))}var GO=class extends l{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return N(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},KO=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=WO(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},qO=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)zO(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=UO(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=OO(this.view.state.field(PO).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=N(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=N(`div`,{class:`cm-panel-lint`},this.list,N(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>zO(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(PO).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(PO),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new KO(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new KO(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=OO(this.view.state.field(PO).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:NO.of(t)})}static open(t){return new e(t)}};function JO(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function YO(e){return JO(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var XO=u.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:YO(`#d11`)},".cm-lintRange-warning":{backgroundImage:YO(`orange`)},".cm-lintRange-info":{backgroundImage:YO(`#999`)},".cm-lintRange-hint":{backgroundImage:YO(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function ZO(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function QO(e){let t=`hint`,n=1;for(let r of e){let e=ZO(r.severity);e>n&&(n=e,t=r.severity)}return t}var $O=[PO,u.decorations.compute([PO],e=>{let{selected:t,panel:n}=e.field(PO);return!t||!n||t.from==t.to?C.none:C.set([FO.range(t.from,t.to)])}),ye(IO,{hideOn:kO}),XO],ek=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(fO)),e.defaultKeymap!==!1&&(r=r.concat(OT)),e.searchKeymap!==!1&&(r=r.concat(ME)),e.historyKeymap!==!1&&(r=r.concat(BC)),e.foldKeymap!==!1&&(r=r.concat(we)),e.completionKeymap!==!1&&(r=r.concat(wO)),e.lintKeymap!==!1&&(r=r.concat(BO));var i=[];return e.lineNumbers!==!1&&i.push(ee()),e.highlightActiveLineGutter!==!1&&i.push(Se()),e.highlightSpecialChars!==!1&&i.push(he()),e.history!==!1&&i.push(xC()),e.foldGutter!==!1&&i.push(oe()),e.drawSelection!==!1&&i.push(w()),e.dropCursor!==!1&&i.push(E()),e.allowMultipleSelections!==!1&&i.push(ke.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(Te()),e.syntaxHighlighting!==!1&&i.push(t(ie,{fallback:!0})),e.bracketMatching!==!1&&i.push(de()),e.closeBrackets!==!1&&i.push(oO()),e.autocompletion!==!1&&i.push(CO()),e.rectangularSelection!==!1&&i.push(re()),n!==!1&&i.push(T()),e.highlightActiveLine!==!1&&i.push(A()),e.highlightSelectionMatches!==!1&&i.push(UT()),e.tabSize&&typeof e.tabSize==`number`&&i.push(a.of(` `.repeat(e.tabSize))),i.concat([j.of(r.flat())]).filter(Boolean)},tk=`#e5c07b`,nk=`#e06c75`,rk=`#56b6c2`,ik=`#ffffff`,ak=`#abb2bf`,ok=`#7d8799`,sk=`#61afef`,ck=`#98c379`,lk=`#d19a66`,uk=`#c678dd`,dk=`#21252b`,fk=`#2c313a`,pk=`#282c34`,mk=`#353a42`,hk=`#3E4451`,gk=`#528bff`,_k=[u.theme({"&":{color:ak,backgroundColor:pk},".cm-content":{caretColor:gk},".cm-cursor, .cm-dropCursor":{borderLeftColor:gk},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:hk},".cm-panels":{backgroundColor:dk,color:ak},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:pk,color:ok,border:`none`},".cm-activeLineGutter":{backgroundColor:fk},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:mk},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:mk,borderBottomColor:mk},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:fk,color:ak}}},{dark:!0}),t(xe.define([{tag:g.keyword,color:uk},{tag:[g.name,g.deleted,g.character,g.propertyName,g.macroName],color:nk},{tag:[g.function(g.variableName),g.labelName],color:sk},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:lk},{tag:[g.definition(g.name),g.separator],color:ak},{tag:[g.typeName,g.className,g.number,g.changed,g.annotation,g.modifier,g.self,g.namespace],color:tk},{tag:[g.operator,g.operatorKeyword,g.url,g.escape,g.regexp,g.link,g.special(g.string)],color:rk},{tag:[g.meta,g.comment],color:ok},{tag:g.strong,fontWeight:`bold`},{tag:g.emphasis,fontStyle:`italic`},{tag:g.strikethrough,textDecoration:`line-through`},{tag:g.link,color:ok,textDecoration:`underline`},{tag:g.heading,fontWeight:`bold`,color:nk},{tag:[g.atom,g.bool,g.special(g.variableName)],color:lk},{tag:[g.processingInstruction,g.string,g.inserted],color:ck},{tag:g.invalid,color:ik}]))],vk=u.theme({"&":{backgroundColor:`#fff`}},{dark:!1}),yk=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i=`light`,placeholder:a=``,basicSetup:o=!0}=e,s=[];switch(t&&s.unshift(j.of([kT])),o&&(typeof o==`boolean`?s.unshift(ek()):s.unshift(ek(o))),a&&s.unshift(be(a)),i){case`light`:s.push(vk);break;case`dark`:s.push(_k);break;case`none`:break;default:s.push(i);break}return n===!1&&s.push(u.editable.of(!1)),r&&s.push(ke.readOnly.of(!0)),[...s]},bk=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),xk=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},Sk=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},Ck=null,wk=()=>typeof window>`u`?new Sk:(Ck||=new Sk,Ck),Tk=pe.define(),Ek=200,Dk=[];function Ok(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:a,onUpdate:s,extensions:c=Dk,autoFocus:l,theme:d=`light`,height:f=null,minHeight:p=null,maxHeight:m=null,width:h=null,minWidth:g=null,maxWidth:_=null,placeholder:v=``,editable:y=!0,readOnly:b=!1,indentWithTab:x=!0,basicSetup:S=!0,root:C,initialState:w}=e,[T,E]=(0,I.useState)(),[D,O]=(0,I.useState)(),[ee,te]=(0,I.useState)(),ne=(0,I.useState)(()=>({current:null}))[0],re=(0,I.useState)(()=>({current:null}))[0],k=u.theme({"&":{height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_},"& .cm-scroller":{height:`100% !important`}}),A=[u.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(Tk))&&(ne.current?ne.current.reset():(ne.current=new xk(()=>{if(re.current){var e=re.current;re.current=null,e()}ne.current=null},Ek),wk().add(ne.current)),r(e.state.doc.toString(),e)),i&&i(bk(e))}),k,...yk({theme:d,editable:y,readOnly:b,placeholder:v,indentWithTab:x,basicSetup:S})];return s&&typeof s==`function`&&A.push(u.updateListener.of(s)),A=A.concat(c),(0,I.useLayoutEffect)(()=>{if(T&&!ee){var e={doc:t,selection:n,extensions:A},r=w?ke.fromJSON(w.json,e,w.fields):ke.create(e);if(te(r),!D){var i=new u({state:r,parent:T,root:C});O(i),a&&a(i,r)}}return()=>{D&&(te(void 0),O(void 0))}},[T,ee]),(0,I.useEffect)(()=>{e.container&&E(e.container)},[e.container]),(0,I.useEffect)(()=>()=>{D&&(D.destroy(),O(void 0)),ne.current&&=(ne.current.cancel(),null)},[D]),(0,I.useEffect)(()=>{l&&D&&D.focus()},[l,D]),(0,I.useEffect)(()=>{D&&D.dispatch({effects:o.reconfigure.of(A)})},[d,c,f,p,m,h,g,_,v,y,b,x,S,r,s]),(0,I.useEffect)(()=>{if(t!==void 0){var e=D?D.state.doc.toString():``;if(D&&t!==e){var n=ne.current&&!ne.current.isDone,r=()=>{D&&t!==D.state.doc.toString()&&D.dispatch({changes:{from:0,to:D.state.doc.toString().length,insert:t||``},annotations:[Tk.of(!0)]})};n?re.current=r:r()}}},[t,D]),{state:ee,setState:te,view:D,setView:O,container:T,setContainer:E}}var kk=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],Ak=(0,I.forwardRef)((e,t)=>{var{className:n,value:r=``,selection:i,extensions:a=[],onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,autoFocus:u,theme:d=`light`,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:v,placeholder:y,indentWithTab:b,editable:x,readOnly:S,root:C,initialState:w}=e,T=iC(e,kk),E=(0,I.useRef)(null),{state:D,view:O,container:ee,setContainer:te}=Ok({root:C,value:r,autoFocus:u,theme:d,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:v,placeholder:y,indentWithTab:b,editable:x,readOnly:S,selection:i,onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,extensions:a,initialState:w});(0,I.useImperativeHandle)(t,()=>({editor:E.current,state:D,view:O}),[E,ee,D,O]);var ne=(0,I.useCallback)(e=>{E.current=e,te(e)},[te]);if(typeof r!=`string`)throw Error(`value must be typeof string but got `+typeof r);return(0,L.jsx)(`div`,rC({ref:ne,className:(typeof d==`string`?`cm-theme-`+d:`cm-theme`)+(n?` `+n:``)},T))});Ak.displayName=`CodeMirror`;var jk=`modulepreload`,Mk=function(e){return`/`+e},Nk={},Q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Mk(t,n),t in Nk)return;Nk[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:jk,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function $(e){return new ge(ne.define(e))}function Pk(e){return Q(()=>import(`./dist-ChuUwcd4.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var Fk=[O.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return Q(()=>import(`./dist-DYBvJnrG.js`).then(e=>e.cpp()),__vite__mapDeps([3,1,2]))}}),O.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return Q(()=>import(`./dist-DYBvJnrG.js`).then(e=>e.cpp()),__vite__mapDeps([3,1,2]))}}),O.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return Pk(`Cassandra`)}}),O.of({name:`CSS`,extensions:[`css`],load(){return Q(()=>import(`./dist-mCTXNkQ9.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,1,2]))}}),O.of({name:`Go`,extensions:[`go`],load(){return Q(()=>import(`./dist-ByyB_57-.js`).then(e=>e.go()),__vite__mapDeps([5,1,2]))}}),O.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return Q(()=>import(`./dist-DO7LTg3a.js`).then(e=>e.html()),__vite__mapDeps([6,4,1,2,7]))}}),O.of({name:`Java`,extensions:[`java`],load(){return Q(()=>import(`./dist-elfU6IUT.js`).then(e=>e.java()),__vite__mapDeps([8,1,2]))}}),O.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return Q(()=>import(`./dist-DH3Q_V27.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,2]))}}),O.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return Q(()=>import(`./dist-D6kXrcQY.js`).then(e=>e.jinja()),__vite__mapDeps([9,4,1,2,6,7]))}}),O.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return Q(()=>import(`./dist-Cc03jTPl.js`).then(e=>e.json()),__vite__mapDeps([10,1,2]))}}),O.of({name:`JSX`,extensions:[`jsx`],load(){return Q(()=>import(`./dist-DH3Q_V27.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,1,2]))}}),O.of({name:`LESS`,extensions:[`less`],load(){return Q(()=>import(`./dist-BvjF9csH.js`).then(e=>e.less()),__vite__mapDeps([11,4,1,2]))}}),O.of({name:`Liquid`,extensions:[`liquid`],load(){return Q(()=>import(`./dist-Cuva2wRW.js`).then(e=>e.liquid()),__vite__mapDeps([12,4,1,2,6,7]))}}),O.of({name:`MariaDB SQL`,load(){return Pk(`MariaSQL`)}}),O.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return Q(()=>import(`./dist--QplBylv.js`).then(e=>e.markdown()),__vite__mapDeps([13,4,1,2,6,7]))}}),O.of({name:`MS SQL`,load(){return Pk(`MSSQL`)}}),O.of({name:`MySQL`,load(){return Pk(`MySQL`)}}),O.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return Q(()=>import(`./dist-CUQQ4au1.js`).then(e=>e.php()),__vite__mapDeps([14,4,1,2,6,7]))}}),O.of({name:`PLSQL`,extensions:[`pls`],load(){return Pk(`PLSQL`)}}),O.of({name:`PostgreSQL`,load(){return Pk(`PostgreSQL`)}}),O.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return Q(()=>import(`./dist-CyFWfPpu.js`).then(e=>e.python()),__vite__mapDeps([15,1,2]))}}),O.of({name:`Rust`,extensions:[`rs`],load(){return Q(()=>import(`./dist-C6S96i9v.js`).then(e=>e.rust()),__vite__mapDeps([16,1,2]))}}),O.of({name:`Sass`,extensions:[`sass`],load(){return Q(()=>import(`./dist-C5sjJwrm.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([17,4,1,2]))}}),O.of({name:`SCSS`,extensions:[`scss`],load(){return Q(()=>import(`./dist-C5sjJwrm.js`).then(e=>e.sass()),__vite__mapDeps([17,4,1,2]))}}),O.of({name:`SQL`,extensions:[`sql`],load(){return Pk(`StandardSQL`)}}),O.of({name:`SQLite`,load(){return Pk(`SQLite`)}}),O.of({name:`TSX`,extensions:[`tsx`],load(){return Q(()=>import(`./dist-DH3Q_V27.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([7,1,2]))}}),O.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return Q(()=>import(`./dist-DH3Q_V27.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,2]))}}),O.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return Q(()=>import(`./dist-BSpuB3dZ.js`).then(e=>e.wast()),__vite__mapDeps([18,1,2]))}}),O.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return Q(()=>import(`./dist-DIQDx3Dq.js`).then(e=>e.xml()),__vite__mapDeps([19,1,2]))}}),O.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return Q(()=>import(`./dist-CftiQ_Tf.js`).then(e=>e.yaml()),__vite__mapDeps([20,1,2]))}}),O.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return Q(()=>import(`./apl-Dgw9L7wA.js`).then(e=>$(e.apl)),[])}}),O.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return Q(()=>import(`./asciiarmor-B3T-Ib7X.js`).then(e=>$(e.asciiArmor)),[])}}),O.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return Q(()=>import(`./asn1-C0KgO0Wt.js`).then(e=>$(e.asn1({}))),[])}}),O.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return Q(()=>import(`./asterisk-D7tOY-Ef.js`).then(e=>$(e.asterisk)),[])}}),O.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return Q(()=>import(`./brainfuck-Dr6WXxS2.js`).then(e=>$(e.brainfuck)),[])}}),O.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return Q(()=>import(`./cobol-ng5WMKOY.js`).then(e=>$(e.cobol)),[])}}),O.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.csharp)),[])}}),O.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return Q(()=>import(`./clojure-DsDsbt3V.js`).then(e=>$(e.clojure)),[])}}),O.of({name:`ClojureScript`,extensions:[`cljs`],load(){return Q(()=>import(`./clojure-DsDsbt3V.js`).then(e=>$(e.clojure)),[])}}),O.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return Q(()=>import(`./css-zrdFFahf.js`).then(e=>$(e.gss)),[])}}),O.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return Q(()=>import(`./cmake-CaoY67QC.js`).then(e=>$(e.cmake)),[])}}),O.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return Q(()=>import(`./coffeescript-L66efR1O.js`).then(e=>$(e.coffeeScript)),[])}}),O.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return Q(()=>import(`./commonlisp-rk__8_Ow.js`).then(e=>$(e.commonLisp)),[])}}),O.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return Q(()=>import(`./cypher-DTKBhe_T.js`).then(e=>$(e.cypher)),[])}}),O.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return Q(()=>import(`./python-_LoDBjEZ.js`).then(e=>$(e.cython)),[])}}),O.of({name:`Crystal`,extensions:[`cr`],load(){return Q(()=>import(`./crystal-C1BeQSjD.js`).then(e=>$(e.crystal)),[])}}),O.of({name:`D`,extensions:[`d`],load(){return Q(()=>import(`./d-CDf89RKe.js`).then(e=>$(e.d)),[])}}),O.of({name:`Dart`,extensions:[`dart`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.dart)),[])}}),O.of({name:`diff`,extensions:[`diff`,`patch`],load(){return Q(()=>import(`./diff-BY4_GICG.js`).then(e=>$(e.diff)),[])}}),O.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return Q(()=>import(`./dockerfile-BBRxgo6-.js`).then(e=>$(e.dockerFile)),__vite__mapDeps([21,22]))}}),O.of({name:`DTD`,extensions:[`dtd`],load(){return Q(()=>import(`./dtd-BOpcurKR.js`).then(e=>$(e.dtd)),[])}}),O.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return Q(()=>import(`./dylan-DrmRAfMX.js`).then(e=>$(e.dylan)),[])}}),O.of({name:`EBNF`,load(){return Q(()=>import(`./ebnf-DgECi_W8.js`).then(e=>$(e.ebnf)),[])}}),O.of({name:`ECL`,extensions:[`ecl`],load(){return Q(()=>import(`./ecl-CWDhUBvl.js`).then(e=>$(e.ecl)),[])}}),O.of({name:`edn`,extensions:[`edn`],load(){return Q(()=>import(`./clojure-DsDsbt3V.js`).then(e=>$(e.clojure)),[])}}),O.of({name:`Eiffel`,extensions:[`e`],load(){return Q(()=>import(`./eiffel-DBpGy7gs.js`).then(e=>$(e.eiffel)),[])}}),O.of({name:`Elm`,extensions:[`elm`],load(){return Q(()=>import(`./elm-Dj_ZNWRH.js`).then(e=>$(e.elm)),[])}}),O.of({name:`Erlang`,extensions:[`erl`],load(){return Q(()=>import(`./erlang-Br4TQPB7.js`).then(e=>$(e.erlang)),[])}}),O.of({name:`Esper`,load(){return Q(()=>import(`./sql-C_mHN2XB.js`).then(e=>$(e.esper)),[])}}),O.of({name:`Factor`,extensions:[`factor`],load(){return Q(()=>import(`./factor-bi5FmZTz.js`).then(e=>$(e.factor)),__vite__mapDeps([23,22]))}}),O.of({name:`FCL`,load(){return Q(()=>import(`./fcl-Dh6ibuJG.js`).then(e=>$(e.fcl)),[])}}),O.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return Q(()=>import(`./forth-fmpuPpMA.js`).then(e=>$(e.forth)),[])}}),O.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return Q(()=>import(`./fortran-CZwiXuJZ.js`).then(e=>$(e.fortran)),[])}}),O.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return Q(()=>import(`./mllike-DsgO-njf.js`).then(e=>$(e.fSharp)),[])}}),O.of({name:`Gas`,extensions:[`s`],load(){return Q(()=>import(`./gas-DotCoURX.js`).then(e=>$(e.gas)),[])}}),O.of({name:`Gherkin`,extensions:[`feature`],load(){return Q(()=>import(`./gherkin-Bw4mmeRF.js`).then(e=>$(e.gherkin)),[])}}),O.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return Q(()=>import(`./groovy-D7xek06K.js`).then(e=>$(e.groovy)),[])}}),O.of({name:`Haskell`,extensions:[`hs`],load(){return Q(()=>import(`./haskell-D5bv2Ijt.js`).then(e=>$(e.haskell)),[])}}),O.of({name:`Haxe`,extensions:[`hx`],load(){return Q(()=>import(`./haxe-UA0z6FgT.js`).then(e=>$(e.haxe)),[])}}),O.of({name:`HXML`,extensions:[`hxml`],load(){return Q(()=>import(`./haxe-UA0z6FgT.js`).then(e=>$(e.hxml)),[])}}),O.of({name:`HTTP`,load(){return Q(()=>import(`./http-DAkDDIPY.js`).then(e=>$(e.http)),[])}}),O.of({name:`IDL`,extensions:[`pro`],load(){return Q(()=>import(`./idl-DYj57TA2.js`).then(e=>$(e.idl)),[])}}),O.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return Q(()=>import(`./javascript-B9Zm1tmO.js`).then(e=>$(e.jsonld)),[])}}),O.of({name:`Julia`,extensions:[`jl`],load(){return Q(()=>import(`./julia-CpHdnx_N.js`).then(e=>$(e.julia)),[])}}),O.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.kotlin)),[])}}),O.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return Q(()=>import(`./livescript-DcEJKRZ4.js`).then(e=>$(e.liveScript)),[])}}),O.of({name:`Lua`,extensions:[`lua`],load(){return Q(()=>import(`./lua-s-LPZohT.js`).then(e=>$(e.lua)),[])}}),O.of({name:`mIRC`,extensions:[`mrc`],load(){return Q(()=>import(`./mirc-pTdL1Ym3.js`).then(e=>$(e.mirc)),[])}}),O.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return Q(()=>import(`./mathematica-c8TKcpav.js`).then(e=>$(e.mathematica)),[])}}),O.of({name:`Modelica`,extensions:[`mo`],load(){return Q(()=>import(`./modelica-PhVkZonB.js`).then(e=>$(e.modelica)),[])}}),O.of({name:`MUMPS`,extensions:[`mps`],load(){return Q(()=>import(`./mumps-DhD4kjw9.js`).then(e=>$(e.mumps)),[])}}),O.of({name:`Mbox`,extensions:[`mbox`],load(){return Q(()=>import(`./mbox-CUr7-CiI.js`).then(e=>$(e.mbox)),[])}}),O.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return Q(()=>import(`./nginx-CJc6p_yt.js`).then(e=>$(e.nginx)),[])}}),O.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return Q(()=>import(`./nsis-BHchP6IS.js`).then(e=>$(e.nsis)),__vite__mapDeps([24,22]))}}),O.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return Q(()=>import(`./ntriples-D1v3iWDa.js`).then(e=>$(e.ntriples)),[])}}),O.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.objectiveC)),[])}}),O.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.objectiveCpp)),[])}}),O.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return Q(()=>import(`./mllike-DsgO-njf.js`).then(e=>$(e.oCaml)),[])}}),O.of({name:`Octave`,extensions:[`m`],load(){return Q(()=>import(`./octave-D_WvWxqk.js`).then(e=>$(e.octave)),[])}}),O.of({name:`Oz`,extensions:[`oz`],load(){return Q(()=>import(`./oz-CmdX4m3g.js`).then(e=>$(e.oz)),[])}}),O.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return Q(()=>import(`./pascal-hNOkBp6J.js`).then(e=>$(e.pascal)),[])}}),O.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return Q(()=>import(`./perl-NQdG1b_r.js`).then(e=>$(e.perl)),[])}}),O.of({name:`Pig`,extensions:[`pig`],load(){return Q(()=>import(`./pig-CXzedlZV.js`).then(e=>$(e.pig)),[])}}),O.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return Q(()=>import(`./powershell-RXDVpFWf.js`).then(e=>$(e.powerShell)),[])}}),O.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return Q(()=>import(`./properties-BTvtucqR.js`).then(e=>$(e.properties)),[])}}),O.of({name:`ProtoBuf`,extensions:[`proto`],load(){return Q(()=>import(`./protobuf-zHRYyuba.js`).then(e=>$(e.protobuf)),[])}}),O.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return Q(()=>import(`./pug-C39WZDG2.js`).then(e=>$(e.pug)),__vite__mapDeps([25,26]))}}),O.of({name:`Puppet`,extensions:[`pp`],load(){return Q(()=>import(`./puppet-CMNLsBcD.js`).then(e=>$(e.puppet)),[])}}),O.of({name:`Q`,extensions:[`q`],load(){return Q(()=>import(`./q-SLmsw_60.js`).then(e=>$(e.q)),[])}}),O.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return Q(()=>import(`./r-CocOMjw8.js`).then(e=>$(e.r)),[])}}),O.of({name:`RPM Changes`,load(){return Q(()=>import(`./rpm-WgkTpiCm.js`).then(e=>$(e.rpmChanges)),[])}}),O.of({name:`RPM Spec`,extensions:[`spec`],load(){return Q(()=>import(`./rpm-WgkTpiCm.js`).then(e=>$(e.rpmSpec)),[])}}),O.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return Q(()=>import(`./ruby-DquNeiGE.js`).then(e=>$(e.ruby)),[])}}),O.of({name:`SAS`,extensions:[`sas`],load(){return Q(()=>import(`./sas-sJxciv6G.js`).then(e=>$(e.sas)),[])}}),O.of({name:`Scala`,extensions:[`scala`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.scala)),[])}}),O.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return Q(()=>import(`./scheme-DEjJDX5Z.js`).then(e=>$(e.scheme)),[])}}),O.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return Q(()=>import(`./shell-DhAwSAum.js`).then(e=>$(e.shell)),[])}}),O.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return Q(()=>import(`./sieve-CcW8-k2R.js`).then(e=>$(e.sieve)),[])}}),O.of({name:`Smalltalk`,extensions:[`st`],load(){return Q(()=>import(`./smalltalk-nXkQ5zwM.js`).then(e=>$(e.smalltalk)),[])}}),O.of({name:`Solr`,load(){return Q(()=>import(`./solr-DO54nYOg.js`).then(e=>$(e.solr)),[])}}),O.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return Q(()=>import(`./mllike-DsgO-njf.js`).then(e=>$(e.sml)),[])}}),O.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return Q(()=>import(`./sparql-CxAS_pwk.js`).then(e=>$(e.sparql)),[])}}),O.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return Q(()=>import(`./spreadsheet-DWzAMKF2.js`).then(e=>$(e.spreadsheet)),[])}}),O.of({name:`Squirrel`,extensions:[`nut`],load(){return Q(()=>import(`./clike-DQfG49Bz.js`).then(e=>$(e.squirrel)),[])}}),O.of({name:`Stylus`,extensions:[`styl`],load(){return Q(()=>import(`./stylus-CQ8h_EBd.js`).then(e=>$(e.stylus)),[])}}),O.of({name:`Swift`,extensions:[`swift`],load(){return Q(()=>import(`./swift-D0Eq5raO.js`).then(e=>$(e.swift)),[])}}),O.of({name:`sTeX`,load(){return Q(()=>import(`./stex-BmuQ0Xsx.js`).then(e=>$(e.stex)),[])}}),O.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return Q(()=>import(`./stex-BmuQ0Xsx.js`).then(e=>$(e.stex)),[])}}),O.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return Q(()=>import(`./verilog-B0DGHLZN.js`).then(e=>$(e.verilog)),[])}}),O.of({name:`Tcl`,extensions:[`tcl`],load(){return Q(()=>import(`./tcl-D7utka2n.js`).then(e=>$(e.tcl)),[])}}),O.of({name:`Textile`,extensions:[`textile`],load(){return Q(()=>import(`./textile-XEeoev-k.js`).then(e=>$(e.textile)),[])}}),O.of({name:`TiddlyWiki`,load(){return Q(()=>import(`./tiddlywiki-CecErCuV.js`).then(e=>$(e.tiddlyWiki)),[])}}),O.of({name:`Tiki wiki`,load(){return Q(()=>import(`./tiki-BlL-kki4.js`).then(e=>$(e.tiki)),[])}}),O.of({name:`TOML`,extensions:[`toml`],load(){return Q(()=>import(`./toml-mmtg9INI.js`).then(e=>$(e.toml)),[])}}),O.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return Q(()=>import(`./troff-Crc1ZuaH.js`).then(e=>$(e.troff)),[])}}),O.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return Q(()=>import(`./ttcn-Cri02b1f.js`).then(e=>$(e.ttcn)),[])}}),O.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return Q(()=>import(`./ttcn-cfg--4YiJN4x.js`).then(e=>$(e.ttcnCfg)),[])}}),O.of({name:`Turtle`,extensions:[`ttl`],load(){return Q(()=>import(`./turtle-CUuoUr2N.js`).then(e=>$(e.turtle)),[])}}),O.of({name:`Web IDL`,extensions:[`webidl`],load(){return Q(()=>import(`./webidl-C_bKeJT2.js`).then(e=>$(e.webIDL)),[])}}),O.of({name:`VB.NET`,extensions:[`vb`],load(){return Q(()=>import(`./vb-BrHulZxe.js`).then(e=>$(e.vb)),[])}}),O.of({name:`VBScript`,extensions:[`vbs`],load(){return Q(()=>import(`./vbscript-vyHcteNE.js`).then(e=>$(e.vbScript)),[])}}),O.of({name:`Velocity`,extensions:[`vtl`],load(){return Q(()=>import(`./velocity-DN4o8rq-.js`).then(e=>$(e.velocity)),[])}}),O.of({name:`Verilog`,extensions:[`v`],load(){return Q(()=>import(`./verilog-B0DGHLZN.js`).then(e=>$(e.verilog)),[])}}),O.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return Q(()=>import(`./vhdl-WeAF-qEm.js`).then(e=>$(e.vhdl)),[])}}),O.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return Q(()=>import(`./xquery-CLyH3kVm.js`).then(e=>$(e.xQuery)),[])}}),O.of({name:`Yacas`,extensions:[`ys`],load(){return Q(()=>import(`./yacas-Dq3LuV9B.js`).then(e=>$(e.yacas)),[])}}),O.of({name:`Z80`,extensions:[`z80`],load(){return Q(()=>import(`./z80-Br7weo_y.js`).then(e=>$(e.z80)),[])}}),O.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return Q(()=>import(`./mscgen-ByD0zE8S.js`).then(e=>$(e.mscgen)),[])}}),O.of({name:`Xù`,extensions:[`xu`],load(){return Q(()=>import(`./mscgen-ByD0zE8S.js`).then(e=>$(e.xu)),[])}}),O.of({name:`MsGenny`,extensions:[`msgenny`],load(){return Q(()=>import(`./mscgen-ByD0zE8S.js`).then(e=>$(e.msgenny)),[])}}),O.of({name:`Vue`,extensions:[`vue`],load(){return Q(()=>import(`./dist-BVTS1puf.js`).then(e=>e.vue()),__vite__mapDeps([27,4,1,2,6,7]))}}),O.of({name:`Angular Template`,load(){return Q(()=>import(`./dist-BOz4jprC.js`).then(e=>e.angular()),__vite__mapDeps([28,4,1,2,6,7]))}})];function Ik(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
210
+ font-size: .6rem;
211
+ font-weight: bold;
212
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function Lk(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var Rk=(e,t)=>Math.abs(e-t)<1.01,zk=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Bk=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Vk=e=>e,Hk=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},Uk=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(Bk(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(Bk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},Wk={passive:!0},Gk=typeof window>`u`?!0:`onscrollend`in window,Kk=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&Gk?()=>void 0:zk(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,Wk);let l=e.options.useScrollendEvent&&Gk;return l&&n.addEventListener(`scrollend`,c,Wk),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},qk=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},Jk=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},Yk=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Vk,rangeExtractor:Hk,onChange:()=>{},measureElement:qk,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=Ik(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=Ik(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,t,n,r,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=Ik(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a},o)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let s=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let c=this.measurementsCache.slice(0,s),l=Array(a).fill(void 0);for(let e=0;e<s;e++){let t=c[e];t&&(l[t.lane]=e)}for(let i=s;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,u;if(a!==void 0&&this.options.lanes>1){s=a;let e=l[s],r=e===void 0?void 0:c[e];u=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?c[i-1]:this.getFurthestMeasurement(c,i);u=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(i,s)}let d=o.get(e),f=typeof d==`number`?d:this.options.estimateSize(i),p=u+f;c[i]={index:i,start:u,size:f,end:p,key:e,lane:s},l[s]=i}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ik(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?Zk({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ik(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=Ik(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return Lk(t[Xk(0,t.length-1,e=>Lk(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&Rk(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},Xk=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Zk({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=Xk(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Qk=typeof document<`u`?I.useLayoutEffect:I.useEffect;function $k({useFlushSync:e=!0,...t}){let n=I.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,Fa.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=I.useState(()=>new Yk(r));return i.setOptions(r),Qk(()=>i._didMount(),[]),Qk(()=>i._willUpdate()),i}function eA(e){return $k({observeElementRect:Uk,observeElementOffset:Kk,scrollToFn:Jk,...e})}var tA=u.theme({"&":{height:`100%`,color:`var(--file-editor-ink)`,backgroundColor:`var(--file-editor-surface)`},"&.cm-focused":{outline:`none`},".cm-scroller":{overflow:`auto`,fontFamily:`var(--mono)`,lineHeight:`1.72`},".cm-content":{minHeight:`100%`,padding:`14px 0 24px`,caretColor:`var(--file-editor-caret)`},".cm-line":{padding:`0 20px 0 16px`},".cm-gutters":{backgroundColor:`var(--file-editor-gutter)`,color:`var(--file-editor-muted)`,borderRight:`1px solid var(--file-editor-rule)`},".cm-lineNumbers .cm-gutterElement":{padding:`0 12px 0 16px`,minWidth:`42px`},".cm-activeLine":{backgroundColor:`var(--file-editor-active)`},".cm-activeLineGutter":{color:`var(--file-editor-ink)`,backgroundColor:`transparent`},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`var(--file-editor-selection)`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--file-editor-caret)`},".cm-searchMatch":{backgroundColor:`rgb(255 214 102 / 16%)`,outline:`1px solid rgb(255 214 102 / 18%)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`rgb(255 214 102 / 26%)`},".cm-tooltip":{border:`1px solid var(--file-editor-rule)`,borderRadius:`10px`,backgroundColor:`rgb(11 15 27 / 98%)`,boxShadow:`0 20px 48px rgb(0 0 0 / 38%)`},".cm-panels":{backgroundColor:`rgb(11 15 27 / 96%)`,borderBottom:`1px solid var(--file-editor-rule)`}},{dark:!0}),nA=xe.define([{tag:g.keyword,color:`#c792ea`},{tag:[g.name,g.deleted,g.character,g.propertyName,g.macroName],color:`#82aaff`},{tag:[g.function(g.variableName),g.labelName],color:`#82aaff`},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:`#f78c6c`},{tag:[g.definition(g.name),g.separator],color:`#eeffff`},{tag:[g.className,g.typeName],color:`#ffcb6b`},{tag:[g.number,g.changed,g.annotation,g.modifier,g.self,g.namespace],color:`#f78c6c`},{tag:[g.operator,g.operatorKeyword],color:`#89ddff`},{tag:[g.url,g.escape,g.regexp,g.link],color:`#80cbc4`},{tag:[g.meta,g.comment],color:`#637777`,fontStyle:`italic`},{tag:[g.string,g.inserted],color:`#c3e88d`},{tag:[g.invalid],color:`#ff5370`},{tag:[g.bool,g.null],color:`#f78c6c`},{tag:g.heading,color:`#82aaff`,fontWeight:`700`},{tag:g.emphasis,fontStyle:`italic`},{tag:g.strong,fontWeight:`700`},{tag:g.strikethrough,textDecoration:`line-through`}]),rA=(0,I.memo)(function({breadcrumbs:e,currentPath:t,directoryEntries:n,editorPath:r,loading:i,mentionedPaths:a,modifiedByPath:o,onNavigate:s,onOpenEntry:c,parentPath:l,rootPath:u}){let d=(0,I.useRef)(null),f=eA({count:n.length,getScrollElement:()=>d.current,estimateSize:()=>38,overscan:10});return(0,I.useEffect)(()=>{let e=d.current;e&&(e.scrollTop=0)},[t]),(0,L.jsxs)(`div`,{className:`file-explorer-panel`,children:[(0,L.jsxs)(`div`,{className:`panel-head-row`,children:[l?(0,L.jsx)(`button`,{className:`mini-action`,type:`button`,onClick:()=>s(l),children:`← Back`}):null,(0,L.jsxs)(`div`,{className:`panel-hint`,children:[`📁 `,t,` · `,o.size,` modified`]})]}),(0,L.jsx)(`div`,{className:`file-breadcrumbs`,children:e.map(e=>(0,L.jsx)(`button`,{className:H(`file-crumb`,e.path===t&&`active`),type:`button`,onClick:()=>s(e.path),children:e.label},e.path))}),i?(0,L.jsx)(`div`,{className:`empty-panel`,children:`Loading files for this directory…`}):null,!i&&n.length===0?(0,L.jsx)(`div`,{className:`empty-panel`,children:`No direct files or folders found in this directory.`}):null,!i&&n.length>0?(0,L.jsx)(`div`,{className:`file-explorer-scroll`,ref:d,children:(0,L.jsx)(`div`,{className:`file-explorer-list`,role:`presentation`,style:{height:`${f.getTotalSize()}px`},children:f.getVirtualItems().map(e=>{let t=n[e.index];if(!t)return null;let i=t.path.startsWith(`${u}/`)?t.path.slice(u.length+1):t.name,s=o.get(t.name)??o.get(i),l=a.has(t.path);return(0,L.jsxs)(`button`,{className:H(`fi file-explorer-row`,t.kind===`directory`&&`dir`,s===`mod`&&`active`,l&&`mentioned`,r===t.path&&`open`),type:`button`,onClick:()=>void c(t),style:{transform:`translateY(${e.start}px)`},children:[(0,L.jsx)(`span`,{children:t.kind===`directory`?`📁`:`📄`}),(0,L.jsx)(`span`,{className:`fi-n`,children:t.name}),l?(0,L.jsx)(`span`,{className:`fbdg mention`,children:`@`}):null,s?(0,L.jsx)(`span`,{className:H(`fbdg`,s),children:s}):null]},t.id)})})}):null,(0,L.jsxs)(`div`,{className:`panel-meta`,children:[(0,L.jsx)(`div`,{children:`Tap a file to open the full editor. Tap folders to drill in.`}),(0,L.jsxs)(`div`,{children:[`Use `,(0,L.jsx)(`code`,{children:`/mention filename`}),` or type `,(0,L.jsx)(`code`,{children:`@filename`}),` in the composer.`]})]})]})});function iA({activePath:e,breadcrumbs:t,busy:n,entries:r,loading:i,onClose:a,onNavigate:o,onPick:s,parentPath:c}){return(0,L.jsx)(`div`,{className:`project-picker-overlay`,onClick:e=>{e.target===e.currentTarget&&a()},children:(0,L.jsxs)(`div`,{className:`project-picker-modal`,children:[(0,L.jsxs)(`div`,{className:`project-picker-head`,children:[(0,L.jsxs)(`div`,{className:`project-picker-copy`,children:[(0,L.jsx)(`div`,{className:`project-picker-title`,children:`Start New Session`}),(0,L.jsx)(`div`,{className:`project-picker-subtitle`,children:`Pick the project folder to use as this session's working directory.`})]}),(0,L.jsx)(`button`,{"aria-label":`Close project picker`,className:`project-picker-close`,disabled:n,onClick:a,type:`button`,children:`×`})]}),(0,L.jsx)(`div`,{className:`project-picker-breadcrumbs`,children:t.map(t=>(0,L.jsx)(`button`,{className:H(`project-picker-crumb`,t.path===e&&`active`),disabled:n,onClick:()=>o(t.path),type:`button`,children:t.label},t.path))}),(0,L.jsxs)(`div`,{className:`project-picker-toolbar`,children:[c?(0,L.jsx)(`button`,{className:`project-picker-action`,disabled:n,onClick:()=>o(c),type:`button`,children:`← Up`}):(0,L.jsx)(`span`,{className:`project-picker-root`,children:`Root`}),(0,L.jsx)(`button`,{className:`project-picker-start`,disabled:n||i,onClick:()=>s(e),type:`button`,children:n?`Starting…`:`Use This Folder`})]}),(0,L.jsx)(`div`,{className:`project-picker-current`,children:e}),(0,L.jsx)(`div`,{className:`project-picker-list`,children:i?(0,L.jsx)(`div`,{className:`project-picker-empty`,children:`Loading folders…`}):r.length===0?(0,L.jsx)(`div`,{className:`project-picker-empty`,children:`No folders found here.`}):r.map(e=>(0,L.jsxs)(`button`,{className:`project-picker-entry`,disabled:n,onClick:()=>o(e.path),type:`button`,children:[(0,L.jsx)(`span`,{className:`project-picker-entry-icon`,children:`📁`}),(0,L.jsxs)(`span`,{className:`project-picker-entry-copy`,children:[(0,L.jsx)(`span`,{className:`project-picker-entry-name`,children:e.name}),(0,L.jsx)(`span`,{className:`project-picker-entry-path`,children:e.path})]}),(0,L.jsx)(`span`,{className:`project-picker-entry-arrow`,children:`→`})]},e.id))})]})})}function aA({messages:e,onSteer:t,onDelete:n}){return e.length===0?null:(0,L.jsx)(`div`,{className:`queued-messages`,children:(0,L.jsx)(`div`,{className:`queued-messages-inner`,children:e.map(e=>{let r=e.prompt.trim()||[e.images.length>0?`${e.images.length} image`:``,e.files.length>0?`${e.files.length} upload`:``,e.mentions.length>0?`${e.mentions.length} file`:``,e.skills.length>0?`${e.skills.length} skill`:``].filter(Boolean).join(` · `);return(0,L.jsxs)(`div`,{className:`queued-row`,children:[(0,L.jsx)(`span`,{className:`queued-row-icon`,children:`💬`}),(0,L.jsx)(`span`,{className:`queued-row-text`,children:Hd(r||`Queued follow-up`,96)}),(0,L.jsxs)(`div`,{className:`queued-row-actions`,children:[(0,L.jsx)(`button`,{className:`queued-row-steer`,type:`button`,onClick:()=>t(e.id),children:`Steer`}),(0,L.jsx)(`button`,{"aria-label":`Delete queued message`,className:`queued-row-delete`,type:`button`,onClick:()=>n(e.id),children:`×`})]})]},e.id)})})})}var oA=(0,I.memo)(function({value:e,mentions:t,placeholder:n,textareaRef:r,composerMirrorRef:i,onPaste:a,onValueChange:o,onKeyDown:s}){let[c,l]=(0,I.useState)(e),u=(0,I.useMemo)(()=>t.filter(e=>$d(c,e)),[c,t]),d=(0,I.useMemo)(()=>u.length>0?tf(c,u):[],[u,c]),f=(0,I.useCallback)(()=>{if(u.length===0)return;let e=r.current,t=i.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)},[u.length,i,r]);(0,I.useEffect)(()=>{let e=r.current;e&&(e.style.height=`auto`,e.style.height=`${Math.max(60,Math.min(e.scrollHeight,140))}px`,f())},[60,c,f,r]);let p=(0,I.useCallback)(e=>{let t=e.target.value;l(t),o(t)},[o]);return(0,L.jsxs)(`div`,{className:`composer-text-shell`,children:[u.length>0?(0,L.jsx)(`div`,{className:`composer-mirror`,ref:i,"aria-hidden":`true`,children:c?d.map((e,t)=>(0,L.jsx)(`span`,{className:H(`composer-segment`,e.mention&&`file`),children:e.text},`${e.text}-${t}`)):null}):null,c?null:(0,L.jsx)(`span`,{className:`composer-placeholder`,children:n}),(0,L.jsx)(`textarea`,{id:`ta`,ref:r,rows:3,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,placeholder:``,spellCheck:!1,value:c,onChange:p,onKeyDown:s,onPaste:a,onScroll:f})]})});function sA({entry:e}){let t=Sf(e.diff);return t.length===0?(0,L.jsx)(`div`,{className:`diff-patch-empty`,children:`Waiting for diff…`}):(0,L.jsx)(`div`,{className:`diff-patch-viewer`,children:t.map(e=>(0,L.jsxs)(`div`,{className:H(`diff-patch-row`,e.kind),children:[(0,L.jsx)(`span`,{className:`diff-patch-num`,children:e.oldLine??``}),(0,L.jsx)(`span`,{className:`diff-patch-num`,children:e.newLine??``}),(0,L.jsx)(`pre`,{className:`diff-patch-text`,children:e.text||` `})]},e.id))})}function cA({backLabel:e=`Back to Chat`,diffEntries:t,findings:n,onBack:r,onSelectEntry:i,selectedEntryId:a}){let o=(0,I.useMemo)(()=>t.find(e=>e.id===a)??t[0]??null,[t,a]),s=(0,I.useMemo)(()=>t.reduce((e,t)=>e+t.additions,0),[t]),c=(0,I.useMemo)(()=>t.reduce((e,t)=>e+t.removals,0),[t]);return(0,L.jsx)(`div`,{id:`review-page`,children:(0,L.jsxs)(`div`,{className:`diff-review-shell page`,children:[(0,L.jsxs)(`div`,{className:`diff-review-page-head`,children:[(0,L.jsxs)(`button`,{className:`file-editor-back`,onClick:r,type:`button`,children:[`← `,e]}),(0,L.jsxs)(`div`,{className:`diff-review-page-copy`,children:[(0,L.jsx)(`div`,{className:`diff-review-page-title`,children:`Patch review`}),(0,L.jsxs)(`div`,{className:`diff-review-page-subtitle`,children:[t.length,` changed file`,t.length===1?``:`s`,` · +`,s,` / -`,c]})]})]}),t.length===0?(0,L.jsx)(`div`,{className:`empty-panel`,children:`No diff items in this thread yet.`}):(0,L.jsxs)(`div`,{className:`diff-review-layout page`,children:[(0,L.jsx)(`div`,{className:`diff-review-sidebar`,children:t.map(e=>(0,L.jsxs)(`button`,{className:H(`diff-review-entry`,o?.id===e.id&&`active`),type:`button`,onClick:()=>i(e.id),children:[(0,L.jsxs)(`div`,{className:`diff-review-entry-top`,children:[(0,L.jsx)(`span`,{className:H(`diff-kind-pill`,e.kind.type===`add`&&`new`,e.kind.type===`delete`&&`del`),children:bf(e.kind)}),(0,L.jsx)(`span`,{className:H(`diff-status`,e.status===`inProgress`&&`live`,e.status===`failed`&&`err`),children:e.status===`inProgress`?`editing`:e.status})]}),(0,L.jsx)(`div`,{className:`diff-review-entry-path`,children:e.path}),(0,L.jsxs)(`div`,{className:`diff-review-entry-meta`,children:[(0,L.jsxs)(`span`,{children:[`+`,e.additions]}),(0,L.jsxs)(`span`,{children:[`-`,e.removals]}),(0,L.jsxs)(`span`,{children:[e.hunks,` hunk`,e.hunks===1?``:`s`]})]})]},e.id))}),o?(0,L.jsxs)(`div`,{className:`diff-review-main`,children:[(0,L.jsxs)(`div`,{className:`diff-focus-head`,children:[(0,L.jsx)(`div`,{className:`diff-focus-title`,children:o.path}),(0,L.jsxs)(`div`,{className:`diff-focus-meta`,children:[(0,L.jsx)(`span`,{className:H(`diff-kind-pill`,o.kind.type===`add`&&`new`,o.kind.type===`delete`&&`del`),children:bf(o.kind)}),(0,L.jsx)(`span`,{className:H(`diff-status`,o.status===`inProgress`&&`live`,o.status===`failed`&&`err`),children:o.status===`inProgress`?`editing`:o.status}),(0,L.jsxs)(`span`,{className:`diff-stat-chip`,children:[`+`,o.additions]}),(0,L.jsxs)(`span`,{className:`diff-stat-chip`,children:[`-`,o.removals]}),(0,L.jsxs)(`span`,{className:`diff-stat-chip`,children:[o.hunks,` hunk`,o.hunks===1?``:`s`]})]})]}),(0,L.jsx)(sA,{entry:o})]}):null]}),n.length>0?(0,L.jsx)(`div`,{className:`review-list`,children:n.map(e=>(0,L.jsxs)(`div`,{className:H(`review-item`,e.severity),children:[(0,L.jsxs)(`div`,{className:`review-header`,children:[(0,L.jsx)(`span`,{children:e.severity}),(0,L.jsx)(`span`,{children:e.file.split(`/`).slice(-2).join(`/`)}),(0,L.jsxs)(`span`,{children:[`:`,e.line]})]}),(0,L.jsx)(`div`,{className:`review-title`,children:e.title}),(0,L.jsx)(`div`,{className:`review-summary`,children:e.summary})]},e.id))}):null]})})}function lA({preview:e,variant:n=`panel`,onBack:r,backLabel:i=`Back`,onSave:a,providerId:o}){let s=hs(e.path,o),c=(0,I.useRef)(null),[l,d]=(0,I.useState)(e.content),[f,p]=(0,I.useState)(e.content),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(`Plain text`),[b,x]=(0,I.useState)(null),S=l!==f;(0,I.useEffect)(()=>{d(e.content),p(e.content),h(null),_(!1)},[e.content,e.error,e.loading,e.path]),(0,I.useEffect)(()=>{let t=e.path||e.name,n=O.matchFilename(Fk,t),r=!1;if(x(null),y(n?.name??`Plain text`),n)return n.load().then(e=>{r||x(e.extension)}).catch(()=>{r||x(null)}),()=>{r=!0}},[e.name,e.path]);let C=(0,I.useCallback)(async()=>{if(!(!a||e.loading||e.error||g||!S)){_(!0),h(null);try{await a(e.path,l),p(l)}catch(e){h(e instanceof Error?e.message:`Unable to save this file.`)}finally{_(!1)}}},[l,S,g,a,e.error,e.loading,e.path]),w=(0,I.useMemo)(()=>{let e=[tA,t(nA),j.of([{key:`Mod-s`,preventDefault:!0,run:()=>(C(),!0)}])];return b&&e.push(b),e},[b,C]);(0,I.useEffect)(()=>{let t=c.current;if(!(!t||e.loading||e.error)){if(typeof e.line==`number`&&e.line>0){let n=t.state.doc.line(Math.min(e.line,t.state.doc.lines));t.dispatch({selection:{anchor:n.from},effects:u.scrollIntoView(n.from,{y:`center`})});return}t.scrollDOM.scrollTo({left:0,top:0})}},[e.error,e.line,e.loading,e.path]);let T=(0,I.useCallback)(()=>{r&&(S&&typeof window<`u`&&!window.confirm(`Discard unsaved changes to ${e.name}?`)||r())},[S,r,e.name]),E=g?`Saving…`:S?`Save`:`Saved`,D=m?`Save failed`:g?`Saving`:S?`Unsaved`:`Saved`;return(0,L.jsxs)(`div`,{className:H(`file-editor`,n===`page`&&`page`),children:[(0,L.jsxs)(`div`,{className:`file-editor-head`,children:[n===`page`?(0,L.jsxs)(`button`,{className:`file-editor-back`,onClick:T,type:`button`,children:[`← `,i]}):null,(0,L.jsxs)(`div`,{className:`file-editor-copy`,children:[(0,L.jsx)(`div`,{className:`file-editor-title`,children:e.name}),(0,L.jsx)(`div`,{className:`file-editor-path`,children:e.path})]}),(0,L.jsxs)(`div`,{className:`file-editor-actions`,children:[(0,L.jsxs)(`div`,{className:`file-editor-meta`,children:[(0,L.jsx)(`span`,{className:`file-editor-chip`,children:v}),typeof e.line==`number`&&e.line>0?(0,L.jsxs)(`span`,{className:`file-editor-chip`,children:[`Line `,e.line]}):null,(0,L.jsx)(`span`,{className:H(`file-editor-status`,S&&`dirty`,m&&`error`),children:D})]}),s===`#`?null:(0,L.jsx)(`a`,{className:`file-editor-link`,href:s,rel:`noreferrer noopener`,target:`_blank`,children:`Raw`}),(0,L.jsx)(`button`,{className:`file-editor-save`,disabled:!a||e.loading||!!e.error||g||!S,onClick:()=>void C(),type:`button`,children:E})]})]}),(0,L.jsxs)(`div`,{className:`file-editor-body`,children:[e.loading?(0,L.jsx)(`div`,{className:`file-editor-empty`,children:`Opening file…`}):null,!e.loading&&e.error?(0,L.jsx)(`div`,{className:`file-editor-empty`,children:e.error}):null,!e.loading&&!e.error?(0,L.jsx)(Ak,{className:`file-editor-surface`,editable:!!a,extensions:w,height:`100%`,onChange:e=>{d(e),m&&h(null)},onCreateEditor:e=>{c.current=e},value:l}):null]})]})}var uA=`materializedThreadId`,dA=e=>{if(!e||typeof e!=`object`)return null;let t=e[uA];return typeof t==`string`?t:null},fA=(e,t)=>Object.fromEntries((e.questions??[]).map(e=>[e.id,[(t[e.id]??``).trim()].filter(Boolean)])),pA=(0,I.createContext)(null),mA=Sc(),hA=mA.mentionCatalog,gA=mA.directoryCatalogRoot||`.`,_A=18,vA=14,yA=[`Opening workspace`,`Setting environment`,`Initializing modules`,`Starting services`],bA=[`Opening conversation`,`Reattaching thread`,`Loading recent history`,`Syncing transcript`],xA=[...yA,...bA];function SA({name:e,className:t}){let n=H(`chrome-icon`,t);switch(e){case`auto`:return(0,L.jsx)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m8.1 1.4-1.7 4 2.3.3-1 4.9 3.9-6-2.4-.3 1.5-3Z`})});case`plan`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M4 3.5v9`}),(0,L.jsx)(`path`,{d:`M4 5h5`}),(0,L.jsx)(`path`,{d:`M4 8h7`}),(0,L.jsx)(`path`,{d:`M4 11h4`}),(0,L.jsx)(`circle`,{cx:`11.5`,cy:`8`,r:`1.5`})]});case`mention`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.3`}),(0,L.jsx)(`path`,{d:`M10.8 10.1a2.3 2.3 0 1 1 .4-4.6v3.6c0 .7.4 1 1 1 .9 0 1.4-.8 1.4-2.1A5.4 5.4 0 1 0 8 13.4`})]});case`attach`:return(0,L.jsx)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m6 8.5 3.8-3.8a2 2 0 1 1 2.8 2.8L7.9 12.2A3 3 0 0 1 3.6 8l4.3-4.3`})});case`image`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`2.5`,y:`3`,width:`11`,height:`10`,rx:`2`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`6.5`,r:`1`}),(0,L.jsx)(`path`,{d:`m4.5 11 2.4-2.4 1.9 1.9 1.4-1.4 1.3 1.9`})]});case`terminal`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`2.5`,y:`3`,width:`11`,height:`10`,rx:`2`}),(0,L.jsx)(`path`,{d:`m5.3 6 1.8 1.8-1.8 1.8`}),(0,L.jsx)(`path`,{d:`M8.7 9.8h2.2`})]});case`web`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.2`}),(0,L.jsx)(`path`,{d:`m10.2 10.2 2.6 2.6`})]});case`review`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M4.5 2.8h5l2 2v7.4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1V3.8a1 1 0 0 1 1-1Z`}),(0,L.jsx)(`path`,{d:`M9.5 2.8v2h2`}),(0,L.jsx)(`path`,{d:`M5.7 8h4.6`}),(0,L.jsx)(`path`,{d:`M5.7 10.3h3.2`})]});case`agents`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`4.2`,cy:`8`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`11.8`,cy:`5.2`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`11.8`,cy:`10.8`,r:`1.5`}),(0,L.jsx)(`path`,{d:`M5.5 7.3 10.4 5.8`}),(0,L.jsx)(`path`,{d:`M5.5 8.7 10.4 10.2`})]});case`compact`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M3.5 5h9`}),(0,L.jsx)(`path`,{d:`M3.5 8h6`}),(0,L.jsx)(`path`,{d:`M3.5 11h9`}),(0,L.jsx)(`path`,{d:`m11 6.3 1.8 1.7L11 9.7`})]});case`editor`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M4.4 11.6 11.6 4.4`}),(0,L.jsx)(`path`,{d:`m10.4 3.6 2 2`}),(0,L.jsx)(`path`,{d:`M4 12.2 3.6 13l.8-.4 1.4-.3-.8-.8Z`}),(0,L.jsx)(`path`,{d:`M3.5 3.4h5.2`})]});case`send`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`m8 12.7-.1-8.8`}),(0,L.jsx)(`path`,{d:`m5.3 6.1 2.6-2.8 2.8 2.8`})]});case`stop`:return(0,L.jsx)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`rect`,{x:`4.6`,y:`4.6`,width:`6.8`,height:`6.8`,rx:`1.2`})});case`branch`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`5`,cy:`4`,r:`1.4`}),(0,L.jsx)(`circle`,{cx:`11`,cy:`12`,r:`1.4`}),(0,L.jsx)(`circle`,{cx:`11`,cy:`4`,r:`1.4`}),(0,L.jsx)(`path`,{d:`M5 5.4v4.1c0 1.4 1.1 2.5 2.5 2.5H9.6`}),(0,L.jsx)(`path`,{d:`M5 5.4c0 1.4 1.1 2.5 2.5 2.5H9.6`})]});case`model`:return(0,L.jsxs)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`m8 2.6 4.4 2.5v5L8 12.6l-4.4-2.5v-5Z`}),(0,L.jsx)(`path`,{d:`m8 2.6 4.4 2.5L8 7.6 3.6 5.1Z`}),(0,L.jsx)(`path`,{d:`M8 7.6v5`})]});case`shield`:return(0,L.jsx)(`svg`,{className:n,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M8 2.5 12 4v3.6c0 2.4-1.4 4.2-4 5.9-2.6-1.7-4-3.5-4-5.9V4Z`})})}}var CA=e=>new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:e>=1e5?0:1}).format(e),wA=e=>{if(!e)return`workspace`;let t=e.replace(/\/+$/u,``);return t?t.split(`/`).filter(Boolean).at(-1)??t:`workspace`},TA=(e,t)=>{if(t!==null){if(t<=300)return`5h`;if(t>=1440*7)return`Week`}let n=e.trim().toLowerCase();return n.includes(`week`)?`Week`:n.includes(`5`)?`5h`:e},EA=(e,t)=>{let n=0;for(let r of e)for(let e of r.items)switch(e.type){case`userMessage`:n+=Jd(e,t).length;break;case`agentMessage`:case`plan`:n+=e.text.length;break;case`reasoning`:n+=e.summary.join(`
213
+ `).length,n+=e.content.join(`
214
+ `).length;break;case`webSearch`:n+=e.query.length;break;case`collabAgentToolCall`:n+=(e.prompt??``).length;break;default:break}return Math.max(0,Math.round(n/3.7))},DA=async e=>{if(typeof navigator<`u`&&navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()},OA=e=>new Promise(t=>{window.setTimeout(t,e)}),kA=()=>new Promise(e=>{window.requestAnimationFrame(()=>{e()})}),AA=(e,t)=>e instanceof Error&&e.message.trim()?e.message:typeof e==`string`&&e.trim()?e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&e.message.trim()?e.message:t,jA=()=>{let e=(0,I.useContext)(pA);if(!e)throw Error(`Workspace context is missing.`);return e};function MA({children:e}){let[t,n]=(0,I.useState)(Sc()),r=(0,I.useRef)(t),i=(0,I.useRef)(null),a=(0,I.useRef)([]);(0,I.useEffect)(()=>{r.current=t},[t]);let o=(0,I.useCallback)(e=>{n(t=>{let n=structuredClone(t);return e(n),n})},[]);(0,I.useEffect)(()=>{let e=new ud(Sc());i.current=e;let t=e.subscribe(e=>{(0,I.startTransition)(()=>{n(e)})}),o=()=>{let t=r.current.transport;t.mode===`live`&&t.status===`connected`||e.connect().catch(()=>void 0)};o();let s=window.setInterval(()=>{o()},5e3),c=()=>{document.visibilityState===`visible`&&o()};return window.addEventListener(`focus`,o),document.addEventListener(`visibilitychange`,c),()=>{t(),window.clearInterval(s),window.removeEventListener(`focus`,o),document.removeEventListener(`visibilitychange`,c),e.disconnect(),a.current.forEach(e=>window.clearTimeout(e)),a.current=[]}},[]);let s=(0,I.useCallback)(async(e,t,n)=>{let a=r.current,o=i.current,s=!!o&&(n?.preferLive||a.transport.mode===`live`&&a.transport.status===`connected`);if(!o&&n?.preferLive)throw Error(`The workspace runtime is still starting. Try again.`);if(o&&s){let i=n?.preferLive?3:1,a=null;for(let s=0;s<i;s+=1)try{let t=r.current;return(t.transport.mode!==`live`||t.transport.status!==`connected`)&&await o.connect(),await e()}catch(e){if(a=e,s<i-1){await OA(320*(s+1));continue}if(n?.fallbackOnLiveError??!0)return await t();throw e}throw a}return await t()},[]),c=(0,I.useCallback)(async(e,t)=>{let n=kd(`thread`),r=Cc(n,t?.title??`New Session`,e,t?.cwd);return o(e=>{e.threads=jd([r,...e.threads.filter(e=>e.thread.id!==n)])}),n},[o]),l=(0,I.useCallback)(async({threadId:e,mode:t,prompt:n,mentions:i,skills:s,images:c,files:l,settings:u})=>{let d=r.current.threads.find(t=>t.thread.id===e)?.thread.cwd??r.current.directoryCatalogRoot??`.`,f=Ec({threadId:e,prompt:n,mode:t,settings:u,mentions:[...i,...Wd(d,l,u.provider)],skills:s,images:c,steer:null});o(r=>{r.threads=jd(r.threads.map(r=>r.thread.id===e?{...r,thread:{...r.thread,preview:n||r.thread.preview,updatedAt:Math.floor(Date.now()/1e3),status:{type:`active`,activeFlags:[]},turns:[...r.thread.turns,f.turn]},plan:f.plan,review:t===`review`?f.review:r.review,terminals:[...f.terminals,...r.terminals].slice(0,6),tokenUsage:{input:r.tokenUsage.input+Math.max(n.length*2,128),output:r.tokenUsage.output,cached:r.tokenUsage.cached}}:r)),r.streams=[...r.streams.filter(t=>t.threadId!==e),...f.streams]});let p=window.setTimeout(()=>{o(n=>{n.threads=jd(n.threads.map(n=>n.thread.id===e?{...n,thread:{...n.thread,updatedAt:Math.floor(Date.now()/1e3),status:{type:`idle`},turns:n.thread.turns.map(e=>e.id===f.turn.id?{...e,status:`completed`,items:e.items.map(e=>{if(e.type===`commandExecution`)return{...e,status:`completed`,exitCode:0,durationMs:1840};if(e.type===`collabAgentToolCall`){let t=Object.fromEntries(Object.entries(e.agentsStates).map(([e,t])=>[e,{...t,status:`completed`,message:t?.message??`Completed.`}]));return{...e,status:`completed`,agentsStates:t}}return e})}:e)},review:t===`review`?f.review:n.review,terminals:n.terminals.map(e=>f.terminals.some(t=>t.id===e.id)?{...e,status:`idle`,lastEvent:`just now`}:e),tokenUsage:{input:n.tokenUsage.input,output:n.tokenUsage.output+512,cached:n.tokenUsage.cached+96}}:n)),n.streams=n.streams.map(t=>t.threadId===e&&t.turnId===f.turn.id?{...t,visible:t.total}:t)})},2800);return a.current.push(p),e},[o]),u=(0,I.useMemo)(()=>({createThread:async(e,t)=>await s(async()=>await i.current.createThread(e,{cwd:t?.cwd}),async()=>await c(e,t),{preferLive:!0,fallbackOnLiveError:!1}),resumeThread:async e=>await s(async()=>{let t=i.current;await t.resumeThread(e).catch(()=>void 0),await t.ensureThreadLoaded(e).catch(()=>void 0)},async()=>void 0,{preferLive:!0,fallbackOnLiveError:!1}),interruptTurn:async e=>await s(async()=>await i.current.interruptTurn(e),async()=>{let t=!1;return o(n=>{n.threads=jd(n.threads.map(r=>{if(r.thread.id!==e)return r;let i=[...r.thread.turns].reverse().find(e=>e.status===`inProgress`);return i?(t=!0,wf(n,e,i.id),{...r,thread:{...r.thread,status:{type:`idle`},turns:r.thread.turns.map(e=>e.id===i.id?{...e,status:`interrupted`}:e)}}):r}))}),t}),sendComposer:async e=>await s(async()=>await i.current.sendComposer(e),async()=>await l(e),{preferLive:!0,fallbackOnLiveError:!1}),applySteer:async e=>await s(async()=>await i.current.applySteer(e),async()=>{let t=!1,n={id:`steer:${e.threadId}:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,turnId:``,prompt:e.prompt.trim()||`Steer applied`,createdAt:Date.now(),status:`applied`};return o(r=>{r.threads=r.threads.map(r=>{if(r.thread.id!==e.threadId)return r;let i=[...r.thread.turns].reverse().find(e=>e.status===`inProgress`);return i?(t=!0,n.turnId=i.id,{...r,steers:[n,...(r.steers??[]).filter(e=>e.id!==n.id)]}):r})}),t},{preferLive:!0,fallbackOnLiveError:!1}),searchMentions:async(e,t)=>await s(async()=>{await i.current.searchMentions(e,t)},async()=>{o(n=>{let r=t.trim().toLowerCase(),i=`${e.replace(/\/+$/u,``)}/`;n.mentionCatalog=hA.filter(e=>e.path.startsWith(i)).filter(e=>r?`${e.name} ${e.path}`.toLowerCase().includes(r):!0).slice(0,18)})}),loadDirectory:async e=>await s(async()=>{await i.current.loadDirectory(e)},async()=>{o(t=>{t.directoryCatalogRoot=e,t.directoryCatalog=Kd(e)})}),readFile:async e=>await s(async()=>await i.current.readFile(e),async()=>{let t=hs(e,r.current.settings.provider);if(t===`#`)throw Error(`File preview is unavailable for this path.`);let n=await fetch(t);if(!n.ok)throw Error(`Failed to read ${e}`);return await n.text()}),saveFile:async(e,t)=>await s(async()=>{await i.current.writeFile(e,t)},async()=>{throw Error(`Saving files requires a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),readGitGraph:async(e,t=80)=>await s(async()=>await i.current.readGitGraph(e,t),async()=>``),readGitStatus:async e=>await s(async()=>await i.current.readGitStatus(e),async()=>``),readWorkspaceCommitPreferences:async e=>await s(async()=>await i.current.readWorkspaceCommitPreferences(e),async()=>{throw Error(`Commit preferences require a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),writeWorkspaceCommitPreferences:async(e,t)=>await s(async()=>await i.current.writeWorkspaceCommitPreferences(e,t),async()=>{throw Error(`Commit preferences require a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),generateCommitMessage:async({cwd:e,providerId:t})=>await s(async()=>await i.current.generateCommitMessage({cwd:e,providerId:t}),async()=>{throw Error(`Commit drafting requires a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),commitWorkingTree:async({cwd:e,message:t})=>await s(async()=>await i.current.commitWorkingTree({cwd:e,message:t}),async()=>{throw Error(`Git commit requires a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),checkProviderSetup:async e=>await s(async()=>{await i.current.checkProviderSetup(e)},async()=>{o(t=>{let n=e??t.settings.provider;t.providerSetup[n]={...t.providerSetup[n],status:`error`,summary:`Setup checks require a live workspace connection.`,detail:`Reconnect Nomadex to the host bridge, then check again.`,checkedAt:`just now`}})},{preferLive:!0}),startProviderAuth:async(e,t)=>await s(async()=>{await i.current.startProviderAuth(e,t)},async()=>{o(n=>{let r=e??n.settings.provider;n.providerAuth[r]={...n.providerAuth[r],status:`error`,flow:t??n.providerAuth[r].flow,summary:`Provider sign-in requires a live workspace connection.`,detail:`Reconnect Nomadex to the host bridge, then try again.`,processId:null,updatedAt:`just now`}})},{preferLive:!0}),submitProviderAuthSecret:async(e,t)=>await s(async()=>{await i.current.submitProviderAuthSecret(e,t)},async()=>{o(t=>{let n=e??t.settings.provider;t.providerAuth[n]={...t.providerAuth[n],status:`error`,summary:`Provider sign-in requires a live workspace connection.`,detail:`Reconnect Nomadex to the host bridge, then try again.`,processId:null,updatedAt:`just now`}})},{preferLive:!0}),cancelProviderAuth:async e=>await s(async()=>{await i.current.cancelProviderAuth(e)},async()=>{o(t=>{let n=e??t.settings.provider;t.providerAuth[n]={...t.providerAuth[n],status:`idle`,summary:`No sign-in in progress.`,detail:null,authUrl:null,userCode:null,processId:null,updatedAt:`just now`}})},{preferLive:!0}),switchProviderAccount:async(e,t)=>await s(async()=>{await i.current.switchProviderAccount(e,t)},async()=>{o(n=>{let r=e??n.settings.provider;n.providerAuth[r]={...n.providerAuth[r],status:`error`,flow:t??n.providerAuth[r].flow,summary:`Provider account switching requires a live workspace connection.`,detail:`Reconnect Nomadex to the host bridge, then try again.`,processId:null,updatedAt:`just now`}})},{preferLive:!0}),updateSettings:async e=>await s(async()=>{await i.current.updateSettings(e)},async()=>{e.provider&&Go(e.provider),o(t=>{t.settings={...t.settings,...e},t.lastSavedAt=`just now`})}),toggleFeatureFlag:async e=>await s(async()=>{await i.current.toggleFeatureFlag(e)},async()=>{o(t=>{t.featureFlags=t.featureFlags.map(t=>t.name===e?{...t,enabled:!t.enabled}:t),t.lastSavedAt=`just now`})}),toggleInstalledSkill:async e=>await s(async()=>{await i.current.toggleInstalledSkill(e)},async()=>{o(t=>{t.installedSkills=t.installedSkills.map(t=>t.id===e?{...t,enabled:!t.enabled}:t)})}),installSkill:async e=>await s(async()=>{await i.current.installSkill(e)},async()=>{o(t=>{let n=t.remoteSkills.find(t=>t.id===e);n&&(t.installedSkills=[{...n,path:`/home/allan/.codex/skills/${n.name}/SKILL.md`,enabled:!0,source:`installed`},...t.installedSkills],t.remoteSkills=t.remoteSkills.filter(t=>t.id!==e))})}),toggleMcpAuth:async e=>await s(async()=>{await i.current.toggleMcpAuth(e)},async()=>{o(t=>{t.mcpServers=t.mcpServers.map(t=>t.name===e?{...t,authStatus:t.authStatus===`notLoggedIn`?`oAuth`:t.authStatus}:t)})}),startChatGptLogin:async()=>await s(async()=>await i.current.startChatGptLogin(),async()=>(o(e=>{e.account.loginInProgress=!0,e.account.pendingLoginId=kd(`login`),e.account.loginError=null}),`https://chatgpt.com/`)),completeChatGptLogin:async e=>await s(async()=>{let t=await fetch(Ho(r.current.settings.provider).authCompletePath,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({callbackUrl:e})}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error??n?.message??`Failed to complete mobile login`);await i.current.refreshAccount()},async()=>{o(e=>{e.account={...e.account,planType:`ChatGPT Pro`,workspace:`mobile relay account`,authMode:`chatgpt`,loggedIn:!0,requiresOpenaiAuth:!1,loginInProgress:!1,pendingLoginId:null,loginError:null}})}),loginWithApiKey:async e=>await s(async()=>{await i.current.loginWithApiKey(e)},async()=>{o(e=>{e.account={...e.account,planType:`API key`,workspace:`API key session`,authMode:`apiKey`,loggedIn:!0,requiresOpenaiAuth:!1,loginInProgress:!1,pendingLoginId:null,loginError:null}})}),logoutAccount:async()=>await s(async()=>{await i.current.logoutAccount()},async()=>{o(e=>{e.account={...e.account,planType:`Signed out`,workspace:`No active account`,authMode:`signedOut`,loggedIn:!1,loginInProgress:!1,pendingLoginId:null,loginError:null,usageWindows:[],rateUsed:0,rateLimit:100,credits:`Sign in to view rate limits`}})}),refreshAccount:async()=>await s(async()=>{await i.current.refreshAccount()},async()=>void 0),cleanTerminals:async e=>await s(async()=>{await i.current.cleanTerminals(e)},async()=>{o(t=>{t.threads=t.threads.map(t=>t.thread.id===e?{...t,terminals:t.terminals.filter(e=>e.status===`running`)}:t)})}),startProjectTerminal:async(e,t)=>await s(async()=>await i.current.startProjectTerminal(e,t),async()=>{throw Error(`Interactive terminals require a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),sendTerminalInput:async(e,t,n)=>await s(async()=>{await i.current.sendTerminalInput(t,n)},async()=>{throw Error(`Interactive terminals require a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),terminateTerminal:async(e,t)=>await s(async()=>{await i.current.terminateTerminal(t)},async()=>{throw Error(`Interactive terminals require a live workspace connection.`)},{preferLive:!0,fallbackOnLiveError:!1}),resolveApproval:async(e,t)=>await s(async()=>{await i.current.resolveApproval(e,t)},async()=>{o(n=>{n.threads=n.threads.map(n=>({...n,approvals:n.approvals.map(n=>n.id===e?{...n,state:t===`accept`||t===`acceptForSession`?`approved`:`declined`}:n)}))})}),submitQuestion:async(e,t)=>await s(async()=>{await i.current.submitQuestion(e,t)},async()=>{o(n=>{n.threads=n.threads.map(n=>({...n,approvals:n.approvals.map(n=>n.id===e?{...n,state:`submitted`,detail:`${n.detail} · ${Object.values(t).flat().filter(Boolean).join(`, `)}`}:n)}))})}),submitMcp:async(e,t,n)=>await s(async()=>{await i.current.submitMcp(e,t,n)},async()=>{o(n=>{n.threads=n.threads.map(n=>({...n,approvals:n.approvals.map(n=>n.id===e?{...n,state:t===`accept`?`submitted`:`declined`}:n)}))})}),rollbackToTurn:async(e,t)=>await s(async()=>{await i.current.rollbackToTurn(e,t)},async()=>{o(n=>{n.threads=n.threads.map(n=>{if(n.thread.id!==e)return n;let r=n.thread.turns.filter(e=>e.status!==`inProgress`),i=r.findIndex(e=>e.id===t);if(i===-1)return n;let a=new Set(r.slice(i).map(e=>e.id));if(a.size===0)return n;let o=n.thread.turns.filter(e=>!a.has(e.id));return{...n,thread:{...n.thread,turns:o,updatedAt:Math.floor(Date.now()/1e3)},steers:(n.steers??[]).filter(e=>!a.has(e.turnId)),approvals:n.approvals.filter(e=>!e.turnId||!a.has(e.turnId))}})})},{preferLive:!0,fallbackOnLiveError:!1}),forkThread:async e=>{let t=r.current.threads.find(t=>t.thread.id===e),n=kd(`thread`);return o(e=>{let r=t?structuredClone(t):Cc(n,`Forked Session`,e.settings);r.thread.id=n,r.thread.name=t?`Fork of ${Yd(t)}`:`Forked Session`,r.thread.preview=t?.thread.preview??`Forked session`,r.thread.createdAt=Math.floor(Date.now()/1e3),r.thread.updatedAt=Math.floor(Date.now()/1e3),r.thread.status={type:`idle`},r.approvals=[],r.terminals=[],e.threads=jd([r,...e.threads.filter(e=>e.thread.id!==n)])}),n},compactThread:async e=>{o(t=>{t.threads=t.threads.map(t=>{if(t.thread.id!==e)return t;let n=[...t.thread.turns];if(n.length===0)return t;let r=n[n.length-1];return r.items.some(e=>e.type===`contextCompaction`)||(r.items=[...r.items,{type:`contextCompaction`,id:kd(`compact`)}]),{...t,plan:t.plan?{...t.plan,explanation:`Conversation compacted to free context.`}:t.plan,thread:{...t.thread,turns:n}}})})}}),[c,o,l,s]);return(0,L.jsx)(pA.Provider,{value:{snapshot:t,actions:u},children:e})}function NA(){return(0,L.jsx)(PA,{})}function PA(){let{snapshot:e,actions:t}=jA(),n=Na(),r=Ta({select:e=>e.location}),i=zd(r.pathname),a=(0,I.useMemo)(()=>{let e=r.pathname.split(`/`).filter(Boolean);return e[0]!==`threads`||!e[1]||!e[2]||gd(e[2])?null:e[2]},[r.pathname]),o=(0,I.useMemo)(()=>new URLSearchParams(r.search),[r.search]),s=(0,I.useMemo)(()=>{let t=new Map;return e.threads.forEach(e=>{let n=t.get(e.thread.id);(!n||e.thread.updatedAt>=n.thread.updatedAt)&&t.set(e.thread.id,e)}),jd([...t.values()])},[e.threads]),c=(0,I.useMemo)(()=>{let e={};return s.forEach(t=>{e[t.thread.id]=Yd(t)}),e},[s]),l=i.threadId??s[0]?.thread.id??null,u=l?s.find(e=>e.thread.id===l)??null:null,d=u?c[u.thread.id]??Vd(u.thread):`New Session`,f=Id(i.section),[p,m]=(0,I.useState)(()=>Ad()),h=i.section===`editor`?o.get(`path`):null,g=(0,I.useMemo)(()=>{let e=i.section===`editor`?o.get(`line`):null;if(!e)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null},[i.section,o]),_=(0,I.useMemo)(()=>{let e=i.section===`editor`?o.get(`from`):null;switch(e){case`ops`:case`review`:case`agents`:case`skills`:case`mcp`:case`settings`:case`chat`:return e;default:return`chat`}},[i.section,o]),v=i.section===`review`?o.get(`diff`):null,y=(0,I.useMemo)(()=>{let e=i.section===`review`?o.get(`from`):null;switch(e){case`ops`:case`agents`:case`skills`:case`mcp`:case`settings`:case`chat`:return e;default:return`chat`}},[i.section,o]),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(()=>Ad()),[w,T]=(0,I.useState)(!1),[E,D]=(0,I.useState)(f??`files`),[O,ee]=(0,I.useState)(!1),[te,ne]=(0,I.useState)(!1),[re,k]=(0,I.useState)(!1),[A,ie]=(0,I.useState)(!1),[ae,oe]=(0,I.useState)(!1),[se,ce]=(0,I.useState)(!1),[j,M]=(0,I.useState)(gA),[le,ue]=(0,I.useState)(``),[de,fe]=(0,I.useState)(`chat`),[pe,me]=(0,I.useState)(!1),[he,ge]=(0,I.useState)(!1),[_e,N]=(0,I.useState)(!1),[ve,ye]=(0,I.useState)(!1),[be,xe]=(0,I.useState)(!1),[Se,Ce]=(0,I.useState)([]),[we,P]=(0,I.useState)([]),[Te,Ee]=(0,I.useState)([]),[De,Oe]=(0,I.useState)([]),[ke,Ae]=(0,I.useState)(l?[l,...e.threads.slice(1,2).map(e=>e.thread.id)]:[]),[je,Me]=(0,I.useState)(``),[Ne,Pe]=(0,I.useState)(null),[Fe,F]=(0,I.useState)(``),[Ie,Le]=(0,I.useState)(0),[Re,ze]=(0,I.useState)({}),[Be,Ve]=(0,I.useState)([]),[He,Ue]=(0,I.useState)(null),[We,Ge]=(0,I.useState)(null),[Ke,qe]=(0,I.useState)(null),[Je,Ye]=(0,I.useState)(null),[Xe,Ze]=(0,I.useState)({}),[Qe,$e]=(0,I.useState)({}),[et,tt]=(0,I.useState)({}),nt=(0,I.useRef)(null),rt=(0,I.useRef)(null),[it,at]=(0,I.useState)(!1),[ot,st]=(0,I.useState)(null),[ct,lt]=(0,I.useState)(!1),[ut,dt]=(0,I.useState)(null),[ft,pt]=(0,I.useState)(0),[mt,ht]=(0,I.useState)(e.settings.provider),[gt,_t]=(0,I.useState)(null),[vt,yt]=(0,I.useState)(``),[bt,xt]=(0,I.useState)(!1),[St,Ct]=(0,I.useState)(!1),[wt,Tt]=(0,I.useState)({top:52,right:12}),[Et,Dt]=(0,I.useState)(0);(0,I.useEffect)(()=>{!a||!i.threadId||n({to:`/threads/$threadId`,params:{threadId:i.threadId},replace:!0})},[a,n,i.threadId]);let[Ot,kt]=(0,I.useState)(()=>{if(typeof window>`u`)return yd;let e=window.localStorage.getItem(bd);return Dd(e)?e:yd}),At=(0,I.useRef)(null),jt=(0,I.useRef)(null),Mt=(0,I.useRef)(null),Nt=(0,I.useRef)(null),Pt=(0,I.useRef)(null),Ft=(0,I.useRef)(null),It=(0,I.useRef)(null),Lt=(0,I.useRef)({}),Rt=(0,I.useRef)({}),zt=(0,I.useRef)({}),Bt=(0,I.useRef)(null),Vt=(0,I.useRef)(le),Ht=(0,I.useRef)({}),Ut=(0,I.useRef)(!1),Wt=(0,I.useRef)(null),Gt=(0,I.useRef)(null),Kt=(0,I.useRef)(null),qt=(0,I.useRef)(!0),Jt=(0,I.useRef)({}),Yt=(0,I.useRef)({}),[Xt,Zt]=(0,I.useState)({}),[Qt,$t]=(0,I.useState)(0),en=(0,I.useDeferredValue)(le),tn=(0,I.useDeferredValue)(Fe);(0,I.useEffect)(()=>{Vt.current=le},[le]);let[nn,rn]=(0,I.useState)(!0);(0,I.useEffect)(()=>()=>{Bt.current!==null&&window.cancelAnimationFrame(Bt.current)},[]),(0,I.useEffect)(()=>{let e=()=>{m(e=>{let t=Ad();return e===t?e:t})};return e(),window.addEventListener(`resize`,e,{passive:!0}),()=>{window.removeEventListener(`resize`,e)}},[]);let an=(0,I.useCallback)(()=>{let e=Pt.current?.getBoundingClientRect();Tt({top:(e?.bottom??48)+4,right:Math.max(12,window.innerWidth-(e?.right??window.innerWidth-12))})},[]);(0,I.useEffect)(()=>{if(typeof document>`u`)return;let e=Od(Ot),t=document.documentElement;t.dataset.uiTheme=e.id,t.style.setProperty(`color-scheme`,e.mode),window.localStorage.setItem(bd,Ot),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e.themeColor),document.querySelector(`meta[name="color-scheme"]`)?.setAttribute(`content`,e.mode),document.querySelector(`meta[name="apple-mobile-web-app-status-bar-style"]`)?.setAttribute(`content`,e.mode===`light`?`default`:`black-translucent`)},[Ot]),(0,I.useLayoutEffect)(()=>{if(!te)return;let e=()=>{an()};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[te,an]);let on=(0,I.useMemo)(()=>{let e=new Set(s.map(e=>e.thread.id));return[...new Set(ke.filter(t=>e.has(t)))].slice(0,6)},[ke,s]),R=(0,I.useMemo)(()=>Nd(u?.thread.turns??[]),[u?.thread.turns]),sn=(0,I.useMemo)(()=>Math.max(0,R.length-_A),[R.length]),cn=(0,I.useMemo)(()=>{if(!l)return sn;let e=Xe[l];if(e==null)return sn;let t=R.length===0?0:Math.max(0,R.length-1);return Math.max(0,Math.min(e,t))},[sn,l,R.length,Xe]),ln=(0,I.useMemo)(()=>R.slice(cn),[R,cn]),un=(0,I.useMemo)(()=>R.map(e=>`${e.id}:${e.status}:${e.items.length}:${e.error?.message??``}`).join(`|`),[R]),dn=[...R].reverse().find(e=>e.status===`inProgress`)??null,fn=l?Re[l]??[]:[],pn=(0,I.useMemo)(()=>vs(dn),[dn]),mn=(0,I.useMemo)(()=>_s(dn),[dn]),hn=!w&&S&&i.section!==`editor`&&i.section!==`review`,gn=hn&&!p,_n=p||b,vn=!p&&gn,yn=O||re||A||ae,bn=(0,I.useMemo)(()=>u?.approvals.filter(e=>e.state===`pending`).length??0,[u?.approvals]),xn=(0,I.useMemo)(()=>u?.approvals.filter(e=>e.state===`pending`)??[],[u?.approvals]),Sn=Pd(e.settings),Cn=(0,I.useMemo)(()=>{let e=u?.thread.cwd??null;return e?!We||!qd(e,We)?e:We:null},[u?.thread.cwd,We]),wn=(0,I.useMemo)(()=>({...e.settings,collaborationMode:he?`plan`:`default`}),[e.settings,he]);(0,I.useEffect)(()=>{let t=new Set(e.threads.flatMap(e=>e.approvals.filter(e=>e.kind===`question`&&e.state===`pending`).map(e=>e.id)));$e(e=>{let n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[e.threads]),(0,I.useEffect)(()=>{let t=new Set(e.threads.flatMap(e=>e.approvals.filter(e=>e.kind===`mcp`&&e.state===`pending`).map(e=>e.id)));tt(e=>{let n=Object.entries(e).filter(([e])=>t.has(e));return n.length===Object.keys(e).length?e:Object.fromEntries(n)})},[e.threads]);let Tn=(0,I.useMemo)(()=>{let e={Today:[],Yesterday:[],Earlier:[]};return s.forEach(t=>{e[Bd(t.thread.updatedAt)].push(t)}),e},[s]),En=(0,I.useMemo)(()=>e.providers.find(t=>t.id===e.settings.provider)??Ho(e.settings.provider),[e.providers,e.settings.provider]),Dn=(0,I.useMemo)(()=>Zo(En.id,e.models.length>0?e.models:mA.models),[En.id,e.models]),On=(0,I.useMemo)(()=>Qo(En.id,e.settings.model,e.models.length>0?e.models:mA.models),[En.id,e.settings.model,e.models]),kn=`${En.displayName} · ${On?.displayName??(e.settings.model===`default`?`provider default`:e.settings.model)}`,An=(0,I.useMemo)(()=>Od(Ot),[Ot]),jn=(0,I.useMemo)(()=>R.flatMap(e=>e.items.filter(e=>e.type===`fileChange`)),[R]),Mn=(0,I.useMemo)(()=>R.flatMap(e=>e.items.flatMap(e=>e.type===`fileChange`?(e.changes.length>0?e.changes:[{path:`Editing files`,kind:{type:`update`,move_path:null},diff:``}]).map((t,n)=>{let r=xf(t.diff);return{id:vf(e.id,n,t.path),itemId:e.id,path:t.path,diff:t.diff,kind:t.kind,status:e.status,additions:r.additions,removals:r.removals,hunks:r.hunks}}):[])).reverse(),[R]),Nn=(0,I.useMemo)(()=>s.filter(e=>e.thread.cwd===u?.thread.cwd),[u?.thread.cwd,s]),Pn=(0,I.useMemo)(()=>u?.thread.cwd?.trim()||e.directoryCatalogRoot||null,[u?.thread.cwd,e.directoryCatalogRoot]),Fn=(0,I.useMemo)(()=>Mn.find(e=>e.id===Je)??Mn[0]??null,[Mn,Je]);(0,I.useEffect)(()=>{if(!u){ht(e.settings.provider),_t(null),yt(``);return}if(!Pn){ht(e.settings.provider),_t(null);return}let n=!1;return yt(``),t.readWorkspaceCommitPreferences(Pn).then(e=>{n||(ht(e.provider),_t(e.filePath))}).catch(()=>{n||(ht(e.settings.provider),_t(null))}),()=>{n=!0}},[t,u,Pn,e.settings.provider]),(0,I.useEffect)(()=>{if(!u){st(null),lt(!1),dt(null);return}let e=Ks({activeThread:u,relatedThreads:Nn});if(st(e),dt(null),E!==`graph`){lt(!1);return}let n=`${u.thread.cwd}:${u.thread.gitInfo?.sha??`workspace`}`,r=Ht.current[n]??``,i=!1;return lt(!0),Promise.allSettled([r?Promise.resolve(r):t.readGitGraph(u.thread.cwd,80),t.readGitStatus(u.thread.cwd)]).then(([t,r])=>{if(i)return;let a=t.status===`fulfilled`?t.value:``,o=r.status===`fulfilled`?r.value:``,s=Ks({activeThread:u,relatedThreads:Nn,rawStatus:o}),c=(a.trim().length>0?Gs({activeThread:u,rawLog:a,rawStatus:o}):null)??s??e;a.trim().length>0&&(Ht.current[n]=a),dt(t.status===`rejected`?AA(t.reason,`Unable to read git history.`):null),st(c)}).finally(()=>{i||lt(!1)}),()=>{i=!0}},[t,u,ft,E,Nn]);let In=ot?.workingTree??null,Ln=!!In?.dirty||jn.some(e=>e.status!==`failed`),Rn=!!In?.buckets.some(e=>e.id===`staged`&&e.entries.length>0),zn=ot?.branchLabel||u?.thread.gitInfo?.branch||`current branch`,Bn=(0,I.useMemo)(()=>{if(!u)return[];if(!Fn)return u.review;let e=yf(Fn.path);return u.review.filter(t=>{let n=yf(t.file);return n===e||n.endsWith(`/${e}`)})},[u,Fn]),Vn=(0,I.useMemo)(()=>e.directoryCatalogRoot===j?e.directoryCatalog.filter(e=>e.kind===`directory`):[],[j,e.directoryCatalog,e.directoryCatalogRoot]),Hn=(0,I.useMemo)(()=>{if(j===gA)return null;let e=j.lastIndexOf(`/`);return e<=0?gA:j.slice(0,e)||gA},[j]),Un=(0,I.useMemo)(()=>{let e=gA.replace(/\/+$/u,``),t=j.replace(/\/+$/u,``),n=t===e?``:t.slice(e.length).replace(/^\/+/u,``);return[{label:e.split(`/`).filter(Boolean).pop()??e,path:e},...n.split(`/`).filter(Boolean).reduce((t,n)=>{let r=t.at(-1)?.path??e;return t.push({label:n,path:`${r.replace(/\/+$/u,``)}/${n}`}),t},[])]},[j]),Wn=(0,I.useMemo)(()=>R.flatMap(e=>e.items.filter(e=>e.type===`collabAgentToolCall`)),[R]),Gn=(0,I.useMemo)(()=>{for(let e of[...R].reverse())for(let t of[...e.items].reverse())if(t.type===`agentMessage`)return t;return null},[R]),Kn=(0,I.useMemo)(()=>{if(Ne===`mention`){let t=Fe.replace(/^@/u,``).trim().toLowerCase(),n=u&&e.directoryCatalogRoot===u.thread.cwd?e.directoryCatalog.filter(e=>t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0):[],r=new Map;return[...n,...e.mentionCatalog].forEach(e=>{r.has(e.path)||r.set(e.path,e)}),[...r.values()].slice(0,24).map(e=>({id:e.id,label:e.name,description:Hd(e.path,92),mode:`mention`,value:e.path}))}return Ne===`skill`?[...e.installedSkills,...e.remoteSkills].map(e=>({id:e.id,label:`$${e.name}`,description:e.description,mode:`skill`,value:e.name})):Td.map(e=>({id:e.cmd,label:e.cmd,description:e.dsc,mode:`slash`,value:e.cmd}))},[u,Ne,Fe,e.directoryCatalog,e.directoryCatalogRoot,e.installedSkills,e.mentionCatalog,e.remoteSkills]),qn=(0,I.useMemo)(()=>{let e=tn.trim().toLowerCase();return e?Kn.filter(t=>`${t.label} ${t.description}`.toLowerCase().includes(e)).slice(0,12):Kn.slice(0,12)},[tn,Kn]);(0,I.useEffect)(()=>{if(!l)return;let e=window.requestAnimationFrame(()=>{Ae(e=>e.includes(l)?e:[l,...e.filter(e=>e!==l)].slice(0,6))});return()=>{window.cancelAnimationFrame(e)}},[l]),(0,I.useLayoutEffect)(()=>{l&&Wt.current!==l&&(delete Jt.current[l],Ze(e=>{if(!(l in e))return e;let t={...e};return delete t[l],t}),qt.current=!0,Gt.current=null,Kt.current=null)},[l]);let Jn=(0,I.useMemo)(()=>e.transport.mode===`live`&&e.transport.status===`connected`&&!!u&&hf(u,R),[u,R,e.transport.mode,e.transport.status]),Yn=(0,I.useMemo)(()=>i.threadId===u?.thread.id&&Jn,[Jn,u?.thread.id,i.threadId]);(0,I.useEffect)(()=>{if(nn){if(e.transport.status===`connecting`){Ut.current=!0;return}Ut.current&&(Jn||rn(!1))}},[Jn,nn,e.transport.status]);let Xn=(0,I.useCallback)(()=>{$t(e=>e+1)},[]),Zn=(0,I.useCallback)((e,t,r=`chat`)=>{!e||!t||e===t||(Ae(n=>{let r=n.map(n=>n===e?t:n);return r.includes(t)||r.unshift(t),[...new Set(r)].slice(0,6)}),ze(n=>{let r=n[e]??[];if(r.length===0)return n;let i={...n};return delete i[e],i[t]=[...r,...i[t]??[]],i}),Lt.current[e]&&(Lt.current[t]=Lt.current[e],delete Lt.current[e]),Rt.current[e]&&(Rt.current[t]=Rt.current[e],delete Rt.current[e]),Jt.current[e]&&(Jt.current[t]=Jt.current[e],delete Jt.current[e]),Wt.current===e&&(Wt.current=t),Gt.current?.threadId===e&&(Gt.current={...Gt.current,threadId:t}),Ze(n=>{if(!(e in n))return n;let r={...n};return r[t]=r[e]??r[t]??0,delete r[e],r}),i.threadId===e&&n(r===`chat`?{to:`/threads/$threadId`,params:{threadId:t}}:{to:`/threads/$threadId/$section`,params:{threadId:t,section:hd(r)}}),Xn())},[n,Xn,i.threadId]),Qn=(0,I.useCallback)(async(e,n=`chat`)=>{try{let r=await t.sendComposer(e);return Zn(e.threadId,r,n),r}catch(t){let r=dA(t);throw r&&Zn(e.threadId,r,n),t}},[t,Zn]),$n=(0,I.useCallback)((e,t,n)=>{$e(r=>({...r,[e]:{...r[e]??{},[t]:n}}))},[]),er=(0,I.useCallback)(async e=>{let n=fA(e,Qe[e.id]??{});await t.submitQuestion(e.id,n),$e(t=>{if(!(e.id in t))return t;let n={...t};return delete n[e.id],n})},[t,Qe]),tr=(0,I.useCallback)((e,t)=>{tt(n=>({...n,[e]:t}))},[]),nr=(0,I.useCallback)(async(e,n)=>{await t.resolveApproval(e.id,n)},[t]),rr=(0,I.useCallback)(async(e,n)=>{await t.submitMcp(e.id,n,et[e.id]??``),tt(t=>{if(!(e.id in t))return t;let n={...t};return delete n[e.id],n})},[t,et]),ir=(0,I.useCallback)(e=>e.kind===`question`?(0,L.jsx)(JS,{answers:Qe[e.id]??{},approval:e,onAnswerChange:(t,n)=>$n(e.id,t,n),onSubmit:()=>void er(e)},e.id):(0,L.jsx)(HS,{approval:e,mcpContentText:et[e.id]??``,onMcpContentChange:t=>tr(e.id,t),onResolve:t=>void nr(e,t),onSubmitMcp:t=>void rr(e,t)},e.id),[et,Qe,nr,rr,er,tr,$n]);(0,I.useEffect)(()=>{if(!i.threadId||e.transport.mode!==`live`||e.transport.status!==`connected`||!u||!hf(u,R))return;let n=i.threadId,r=0,a=()=>{r+=1,t.resumeThread(n)};a();let o=window.setInterval(()=>{if(r>=5){window.clearInterval(o);return}a()},1200);return()=>{window.clearInterval(o)}},[t,u,R,i.threadId,e.transport.mode,e.transport.status]),(0,I.useEffect)(()=>{if(i.section!==`review`)return;let e=v&&Mn.some(e=>e.id===v)?v:Mn[0]?.id??null;Ye(t=>t===e?t:e)},[Mn,v,i.section]),(0,I.useEffect)(()=>{if(!Je||!Mn.some(e=>e.id===Je)){let e=window.requestAnimationFrame(()=>{Ye(Mn[0]?.id??null)});return()=>{window.cancelAnimationFrame(e)}}},[Mn,Je]),(0,I.useEffect)(()=>{e.transport.mode===`live`&&e.transport.status!==`connected`||Object.entries(Re).forEach(([t,n])=>{if(n.length===0||Lt.current[t])return;let r=e.threads.find(e=>e.thread.id===t)?.thread.turns.some(e=>e.status===`inProgress`)??!1;if(Rt.current[t]){if(r)return;delete Rt.current[t]}if(r)return;let[i]=n;i&&(Lt.current[t]=!0,ze(e=>{let n=e[t]??[];if(n[0]?.id!==i.id)return e;let r=n.slice(1);if(r.length===0){let n={...e};return delete n[t],n}return{...e,[t]:r}}),Qn({threadId:t,mode:i.mode,prompt:i.prompt,mentions:i.mentions,skills:i.skills,images:i.images,files:i.files,settings:wn}).then(e=>{Rt.current[e]=!0}).catch(e=>{let n=dA(e)??t;ze(e=>({...e,[n]:[i,...e[n]??[]]})),Xn()}).finally(()=>{delete Lt.current[t]}))})},[wn,Re,Qt,Xn,Qn,e.threads,e.transport.mode,e.transport.status]),(0,I.useEffect)(()=>{let e=()=>{typeof document<`u`&&document.visibilityState!==`visible`||Xn()},t=()=>{document.visibilityState===`visible`&&Xn()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[Xn]),(0,I.useLayoutEffect)(()=>{if(i.section===`editor`||i.section===`review`){C(!1);return}if(!p&&w){C(!1);return}if(!f){p||C(!1);return}D(e=>e===f||f===`files`&&e===`graph`?e:f),C(e=>e||!0)},[p,w,i.section,f]),(0,I.useEffect)(()=>{w&&(p||!f)&&T(!1)},[p,w,f]),(0,I.useEffect)(()=>{if(!u||Ne!==`mention`)return;e.directoryCatalogRoot!==u.thread.cwd&&t.loadDirectory(u.thread.cwd);let n=tn.replace(/^@/,``).trim();n&&t.searchMentions(u.thread.cwd,n)},[t,u,tn,Ne,e.directoryCatalogRoot]),(0,I.useEffect)(()=>{let e=u?.thread.cwd;if(!e)return;let t=window.requestAnimationFrame(()=>{Ge(t=>t&&qd(e,t)?t:e),qe(t=>t&&qd(e,t.path)?t:null)});return()=>{window.cancelAnimationFrame(t)}},[u?.thread.cwd]),(0,I.useEffect)(()=>{Cn&&t.loadDirectory(Cn)},[t,Cn]),(0,I.useEffect)(()=>{A&&t.loadDirectory(j)},[t,A,j]),(0,I.useEffect)(()=>{if(i.section!==`editor`||!h||Ke?.path===h&&!Ke.loading&&Ke.error===null)return;let e=h.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??h,n=!1;return t.readFile(h).then(t=>{n||(0,I.startTransition)(()=>{qe({path:h,name:e,content:t,loading:!1,error:null,line:g})})}).catch(t=>{n||qe({path:h,name:e,content:``,loading:!1,error:t instanceof Error?t.message:`Unable to open this file.`,line:g})}),()=>{n=!0}},[t,g,h,Ke,i.section]),(0,I.useEffect)(()=>{let t=e.transport.mode===`live`,n=e.streams;if(t){let e=window.requestAnimationFrame(()=>{let e={};for(let t of n){let n=Cf(t);e[t.key]=n}Yt.current=e,(0,I.startTransition)(()=>{Zt(e)})});return()=>{window.cancelAnimationFrame(e)}}let r=window.requestAnimationFrame(()=>{let e=Yt.current,t=Object.keys(e).length!==n.length,r={};for(let i of n){let n=Cf(i),a=Math.min(e[i.key]??0,n);r[i.key]=a,(e[i.key]??void 0)!==a&&(t=!0)}t&&(Yt.current=r,(0,I.startTransition)(()=>{Zt(r)}))}),i=window.setInterval(()=>{let e=Yt.current,t={},r=Object.keys(e).length!==n.length;for(let i of n){let n=Cf(i),a=Math.min(e[i.key]??0,n),o=n-a,s=Math.max(1,i.speed,Math.ceil(o/5)),c=a<n?Math.min(n,a+s):a;t[i.key]=c,c!==a&&(r=!0)}r&&(Yt.current=t,(0,I.startTransition)(()=>{Zt(t)}))},24);return()=>{window.cancelAnimationFrame(r),window.clearInterval(i)}},[e.streams,e.transport.mode]);let ar=(0,I.useCallback)(e=>e.scrollHeight-e.scrollTop-e.clientHeight<=72,[]),or=(0,I.useCallback)((e=l)=>{let t=At.current;if(!t||!e)return;let n=ar(t);qt.current=n,at(e=>e===!n?e:!n),Jt.current[e]={pinned:n,top:t.scrollTop}},[l,ar]),sr=(0,I.useCallback)(()=>{if(!l||cn<=0||Yn)return;let e=At.current;e&&Gt.current?.threadId!==l&&(Gt.current={threadId:l,previousHeight:e.scrollHeight,previousTop:e.scrollTop},Ze(e=>{let t=e[l]??sn,n=Math.max(0,t-vA);return n===t?(Gt.current=null,e):{...e,[l]:n}}))},[sn,l,cn,Yn]),cr=(0,I.useCallback)((e=!1)=>{let t=At.current;t&&(!e&&!qt.current||(t.scrollTop=t.scrollHeight,qt.current=!0,at(!1),l&&(Jt.current[l]={pinned:!0,top:t.scrollTop})))},[l]);(0,I.useEffect)(()=>{let e=At.current;if(!e||!l||i.section===`editor`||i.section===`review`)return;let t=()=>{let t=ar(e);qt.current=t,at(e=>e===!t?e:!t),Jt.current[l]={pinned:t,top:e.scrollTop}};t();let n=()=>{t(),e.scrollTop<=48&&sr()};return e.addEventListener(`scroll`,n,{passive:!0}),()=>{t(),e.removeEventListener(`scroll`,n)}},[l,ar,sr,i.section]);let lr=(0,I.useCallback)(e=>{let t=null,n=null,r=0,i=()=>{cr(e?.force??!1);let n=At.current;if(!n)return;let a=n.scrollHeight-n.scrollTop-n.clientHeight;r+=1,a>2&&r<8&&(t=window.requestAnimationFrame(i))};return t=window.requestAnimationFrame(i),n=e?.extraDelay?window.setTimeout(i,90):null,()=>{t!==null&&window.cancelAnimationFrame(t),n!==null&&window.clearTimeout(n)}},[cr]);(0,I.useLayoutEffect)(()=>{At.current&&cr()},[cr,Xt,un]),(0,I.useLayoutEffect)(()=>{if(!l||i.section===`editor`||i.section===`review`)return;let e=Wt.current===l?Jt.current[l]:void 0;qt.current=e?.pinned??!0,at(!(e?.pinned??!0))},[l,i.section]),(0,I.useLayoutEffect)(()=>{if(!l||i.section===`editor`||i.section===`review`)return;let e=()=>{let e=At.current;if(!e)return;let t=Wt.current===l,n=t?Jt.current[l]:void 0;if(!t){cr(!0);return}if(!n){Wt.current=null,cr(!0);return}if(n.pinned){Wt.current=null,cr(!0);return}let r=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=Math.min(n.top,r),Wt.current=null,or(l)};e();let t=window.requestAnimationFrame(e),n=window.setTimeout(e,90);return()=>{window.cancelAnimationFrame(t),window.clearTimeout(n)}},[l,cr,i.section,or]),(0,I.useLayoutEffect)(()=>{let e=Gt.current;if(!e||e.threadId!==l)return;let t=At.current;if(!t)return;let n=t.scrollHeight-e.previousHeight;t.scrollTop=e.previousTop+n,Gt.current=null,or(l)},[l,ln.length,or]),(0,I.useEffect)(()=>()=>{i.section===`editor`||i.section===`review`||or(l)},[l,i.section,or]),(0,I.useEffect)(()=>{if(!l){at(!1),Kt.current=null;return}if(Yn||R.length===0){Kt.current=null;return}let e=`${l}:${R.at(-1)?.id??`empty`}:${R.length}`;if(Kt.current!==e)return Kt.current=e,lr({extraDelay:!0,force:!0})},[l,R,Yn,lr]);let ur=(0,I.useCallback)(()=>{lr({extraDelay:!0,force:!0})},[lr]);(0,I.useEffect)(()=>()=>Te.forEach(e=>e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url)),[Te]);let z=(0,I.useCallback)((e,t)=>{let n=kd(`toast`);Ve(r=>[...r,{id:n,message:e,tone:t}]);let r=window.setTimeout(()=>{Ve(e=>e.filter(e=>e.id!==n)),delete zt.current[n]},2600);zt.current[n]=r},[]),dr=(0,I.useCallback)(()=>{Ht.current={},pt(e=>e+1)},[]),fr=(0,I.useCallback)(async()=>{dr(),Ye(null);let e=Cn??Pn;if(e)try{await t.loadDirectory(e)}catch{Pn&&Pn!==e&&(Ge(Pn),await t.loadDirectory(Pn).catch(()=>void 0))}h&&qe({path:h,name:h.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??h,content:``,loading:!0,error:null,line:g})},[t,Cn,Pn,g,h,dr]),pr=(0,I.useCallback)(async e=>{let n=mt;if(ht(e),u){if(!Pn){ht(n),z(`Open the repository folder first.`,`warn`);return}try{_t((await t.writeWorkspaceCommitPreferences(Pn??u.thread.cwd,{provider:e})).filePath),dr()}catch(e){ht(n),z(AA(e,`Failed to save the commit provider for this project.`),`err`)}}},[t,u,Pn,mt,z,dr]),mr=(0,I.useCallback)(async()=>{if(!(!u||bt||St)){if(!Pn){z(`Open the repository folder first.`,`warn`);return}xt(!0);try{yt(await t.generateCommitMessage({cwd:Pn,providerId:mt})),z(`Drafted a commit message.`,`ok`)}catch(e){z(AA(e,`Failed to draft a commit message.`),`err`)}finally{xt(!1)}}},[t,u,Pn,St,bt,mt,z]),hr=(0,I.useCallback)(async()=>{if(!(!u||bt||St)){if(!Pn){z(`Open the repository folder first.`,`warn`);return}if(!vt.trim()){z(`Enter a commit message first.`,`warn`);return}Ct(!0);try{let e=await t.commitWorkingTree({cwd:Pn,message:vt});yt(``),dr(),z(e.stagedAll?`Staged all files and created the commit.`:`Created the commit.`,`ok`)}catch(e){z(AA(e,`Failed to create the commit.`),`err`)}finally{Ct(!1)}}},[t,u,Pn,St,bt,vt,z,dr]),gr=(0,I.useCallback)(e=>{let t=e;window.requestAnimationFrame(()=>{let e=Mt.current;if(!e)return;e.focus();let n=t?.length??e.value.length;try{e.setSelectionRange(n,n)}catch{}})},[]),_r=(0,I.useCallback)(()=>Mt.current?.value??le,[le]),vr=(0,I.useCallback)(e=>{let t=_r(),n=typeof e==`function`?e(t):e;return ue(n),Dt(e=>e+1),n},[_r]),yr=(0,I.useCallback)(()=>{ue(``),Dt(e=>e+1),Ce([]),P([]),Oe([]),Ee(e=>(e.forEach(e=>e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url)),[])),Pe(null),F(``),Le(0)},[]),br=(0,I.useCallback)((e,t)=>{let n={...t,id:kd(`queue`),mentions:[...t.mentions],skills:[...t.skills],files:[...t.files],images:[...t.images]};ze(t=>({...t,[e]:[...t[e]??[],n]}))},[]),xr=(0,I.useCallback)((e,t)=>{ze(n=>{let r=n[e]??[],i=r.filter(e=>e.id!==t);if(i.length===r.length)return n;if(i.length===0){let t={...n};return delete t[e],t}return{...n,[e]:i}})},[]),Sr=(0,I.useCallback)((e,t)=>{ze(n=>({...n,[e]:[t,...n[e]??[]]}))},[]),Cr=(0,I.useCallback)((e,t=`chat`,r)=>{e!==l&&(Wt.current=null,Gt.current=null,qt.current=!0);let i=()=>{if(t===`chat`){n({to:`/threads/$threadId`,params:{threadId:e}});return}n({to:`/threads/$threadId/$section`,params:{threadId:e,section:hd(t)}})};if(r?.immediate||l===e){i();return}(0,I.startTransition)(i)},[l,n]),wr=(0,I.useCallback)(e=>{Wt.current=null,Gt.current=null,Kt.current=null,qt.current=!0,at(!1),delete Jt.current[e],Ze(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),x(!1),Cr(e,`chat`,{immediate:!0}),e===l&&window.requestAnimationFrame(()=>{lr({extraDelay:!0,force:!0})})},[l,Cr,lr]),Tr=(0,I.useCallback)((e,t)=>{if(!l)return;let r=typeof t?.line==`number`&&t.line>0?t.line:null,i=t?.source??`chat`,a=e.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??e;or(),i===`chat`&&(Wt.current=l),qe(t=>t?.path===e&&!t.loading?{...t,line:r}:{path:e,name:a,content:t?.path===e?t.content:``,loading:t?.path===e?t.loading:!0,error:null,line:r}),n({to:`/threads/$threadId/$section`,params:{threadId:l,section:hd(`editor`)},search:{path:e,line:r?String(r):void 0,from:i}})},[l,n,or]),Er=(0,I.useCallback)(e=>{if(e===`terminal`){ye(!0),N(!0);return}T(!1),D(e),C(!0),x(!1),l&&Cr(l,Ld(e))},[l,Cr]),Dr=(0,I.useCallback)(()=>{p||(T(!1),C(!1),x(e=>!e))},[p]),Or=(0,I.useCallback)((e,t=`chat`)=>{if(!l)return;let r=e??Fn?.id??Mn[0]?.id??null;r&&Ye(r),or(),t===`chat`&&(Wt.current=l),n({to:`/threads/$threadId/$section`,params:{threadId:l,section:hd(`review`)},search:{diff:r??void 0,from:t}})},[l,Mn,n,or,Fn]),kr=(0,I.useCallback)(()=>{if(C(!1),l){if(!p){T(!0),window.requestAnimationFrame(()=>{Cr(l,`chat`,{immediate:!0})});return}Cr(l,`chat`,{immediate:!0})}},[l,p,Cr]);(0,I.useEffect)(()=>{i.section===`skills`&&oe(!0)},[i.section]);let Ar=(0,I.useCallback)(()=>{oe(!0),x(!1)},[]),jr=(0,I.useCallback)(()=>{oe(!1),i.section===`skills`&&l&&Cr(l,`chat`)},[l,Cr,i.section]),Mr=(0,I.useCallback)(()=>{k(!0),x(!1),ne(!1),ee(!1)},[]),Nr=(0,I.useCallback)(()=>{k(!1)},[]),Pr=(0,I.useCallback)(async n=>{if(se)return null;ce(!0);try{let e=await t.createThread(wn,{title:`New Session`,cwd:n});return M(n),Ae(t=>[e,...t.filter(t=>t!==e)].slice(0,6)),Cr(e,`chat`),x(!1),C(p),yr(),z(`New session — ${n}`,`ok`),e}catch(t){return z(AA(t,e.transport.error??`Failed to start session`),`err`),null}finally{ce(!1)}},[t,p,wn,Cr,se,z,yr,e.transport.error]),Fr=(0,I.useCallback)(()=>{M(e=>e&&e.trim().length>0?e:u?.thread.cwd??gA),ie(!0),x(!1),ee(!1)},[u]),Ir=(0,I.useCallback)(async e=>{await Pr(e??j)&&ie(!1)},[Pr,j]),Lr=(0,I.useCallback)(async()=>{Fr()},[Fr]),Rr=(0,I.useCallback)(async()=>{if(!l){await Lr();return}let e=await t.forkThread(l);Ae(t=>[e,...t.filter(t=>t!==e)].slice(0,6)),Cr(e,`chat`),z(`/fork — session forked`,`ok`)},[t,l,Lr,Cr,z]),zr=(0,I.useCallback)(async()=>{l&&(await t.compactThread(l),z(`/compact — transcript summarized`,`ok`))},[t,l,z]),Br=(0,I.useCallback)(async e=>{if(l){if(dn){z(`Wait for the current response to finish before rolling back.`,`err`);return}if(window.confirm(`Roll back from this prompt? This will remove this prompt and every later message, then undo the file changes from those turns.`))try{await t.rollbackToTurn(l,e),await fr(),z(`/rollback — reverted to selected prompt`,`ok`)}catch(e){z(AA(e,`Failed to roll back from the selected prompt.`),`err`)}}},[t,l,dn,z,fr]),Vr=(0,I.useCallback)(async e=>{await t.updateSettings({model:e}),ne(!1),z(`Model: ${e}`,``)},[t,z]),Hr=(0,I.useCallback)(e=>{kt(e),k(!1),z(`Theme: ${e}`,``)},[z]),Ur=(0,I.useCallback)(async()=>{let e=xd[(xd.indexOf(Sn)+1)%xd.length];await t.updateSettings(Fd(e)),z(`Approval: ${Sd[e]}`,``)},[t,Sn,z]),Wr=(0,I.useCallback)(()=>{Pe(null),F(``),Le(0)},[]);(0,I.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){e.preventDefault(),ee(!0),x(!1);return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`n`){e.preventDefault(),Lr();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`g`){e.preventDefault(),z(`Ctrl+G — opening editor bridge`,``);return}e.key===`Escape`&&(ee(!1),ne(!1),k(!1),ie(!1),Ue(null),Wr())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Wr,Lr,z]),(0,I.useEffect)(()=>{let e=e=>{let t=e.target;t&&(t.closest(`#ctxmenu`)||Ue(null),!t.closest(`#hmodel`)&&!t.closest(`#mpicker`)&&ne(!1),!t.closest(`#htheme`)&&!t.closest(`#tpicker`)&&k(!1),!t.closest(`#ta`)&&!t.closest(`#slashpop`)&&Wr())};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[Wr]);let Gr=(0,I.useCallback)(e=>{gr(vr(t=>t.replace(/(?:^|\s)([@$/][^\s]*)$/,t=>t.replace(/[@$/][^\s]*$/,e))))},[gr,vr]),Kr=(0,I.useCallback)(e=>{Ce(t=>t.some(t=>t.id===e.id||t.path===e.path)?t:[...t,e]),Wr(),gr(vr(t=>ef(t,e))),z(`/mention — ${Qd(e)} linked`,`ok`)},[Wr,gr,z,vr]),qr=(0,I.useCallback)(n=>{let r=[...e.installedSkills,...e.remoteSkills].find(e=>e.name===n);r&&(r.source===`remote`?(t.installSkill(r.id),z(`Installing $${r.name}`,`ok`)):(P(e=>e.some(e=>e.id===r.id)?e:[...e,{...r,source:`installed`}]),z(`$${r.name} attached`,`ok`)),Wr(),gr(vr(e=>e.replace(/(?:^|\s)\$[^\s]*$/,``))))},[t,Wr,gr,z,vr,e.installedSkills,e.remoteSkills]),Jr=(0,I.useMemo)(()=>Se.filter(e=>$d(en,e)),[en,Se]),Yr=(0,I.useCallback)(async(e,n=!1)=>{let[r,...i]=e.trim().split(/\s+/),a=i.join(` `);switch(r){case`/new`:await Lr();break;case`/fork`:await Rr();break;case`/compact`:await zr();break;case`/mention`:Pe(`mention`),F(a);break;case`/model`:ne(e=>!e);break;case`/permissions`:await Ur();break;case`/plan`:ge(!0),z(`Plan mode enabled`,`ok`);break;case`/review`:fe(`review`),Er(`diff`),n&&l?(await Qn({threadId:l,mode:`review`,prompt:a,mentions:Jr,skills:we,files:De,images:Te,settings:wn},`review`),yr()):z(`/review ready`,`ok`);break;case`/ps`:Er(`terminal`);break;case`/diff`:Er(`diff`);break;case`/skills`:Ar();break;case`/mcp`:Er(`config`),l&&Cr(l,`mcp`);break;case`/theme`:Mr(),z(`Theme picker opened`,`ok`);break;case`/status`:Er(`config`),z(`Session diagnostics opened`,`ok`);break;case`/copy`:Gn&&(await DA(Gn.text),z(`Copied latest response`,`ok`));break;case`/clear`:yr(),z(`/clear — composer reset`,``);break;case`/experimental`:Er(`config`);break;case`/init`:vr(`/init Generate AGENTS.md for this repo`),gr(`/init Generate AGENTS.md for this repo`);break;case`/resume`:case`/feedback`:case`/apps`:case`/exit`:case`/quit`:case`/personality`:z(`${r} queued`,``);break;case`/logout`:await t.logoutAccount(),z(`Signed out of account`,`ok`);break;default:n&&l&&(await Qn({threadId:l,mode:de,prompt:e,mentions:Jr,skills:we,files:De,images:Te,settings:wn}),yr())}},[t,l,zr,de,Ur,Lr,Rr,Gn,Cr,Er,Mr,Ar,z,yr,Qn,gr,Te,De,Jr,we,vr,wn]),Xr=(0,I.useMemo)(()=>{let e=[{label:`Session`,items:[{icon:`💬`,name:`New Session (/new)`,key:`⌘N`,command:{type:`createSession`}},{icon:`⑂`,name:`Fork Session (/fork)`,key:``,command:{type:`forkSession`}},{icon:`🗜`,name:`Compact Transcript (/compact)`,key:``,command:{type:`compactSession`}},{icon:`🗑`,name:`Clear Composer`,key:``,command:{type:`resetComposer`}}]},{label:`Navigate`,items:[{icon:`📁`,name:`Files Panel`,key:``,command:{type:`openPanel`,tab:`files`}},{icon:`⎇`,name:`Branches Panel`,key:``,command:{type:`openPanel`,tab:`graph`}},{icon:`⬛`,name:`Terminal Dock (/ps)`,key:``,command:{type:`openPanel`,tab:`terminal`}},{icon:`⑂`,name:`Multi-agent Panel`,key:``,command:{type:`openPanel`,tab:`agents`}},{icon:`📋`,name:`Skills Library (/skills)`,key:``,command:{type:`openSkills`}},{icon:`⚙`,name:`Config & Feature Flags`,key:`⌘,`,command:{type:`openPanel`,tab:`config`}}]},{label:`Slash`,items:Td.map(e=>({icon:`/`,name:`${e.cmd} — ${e.dsc}`,key:``,command:{type:`runSlash`,slash:e.cmd}}))},...Dn.length>0?[{label:`Model`,items:Dn.map(e=>({icon:`🤖`,name:e.displayName,key:``,command:{type:`selectModel`,modelId:e.id}}))}]:[]],t=je.trim().toLowerCase();return t?e.map(e=>({...e,items:e.items.filter(n=>`${n.name} ${e.label}`.toLowerCase().includes(t))})).filter(e=>e.items.length>0):e},[je,Dn]),Zr=(0,I.useCallback)(e=>{switch(e.type){case`createSession`:Lr();break;case`forkSession`:Rr();break;case`compactSession`:zr();break;case`openSkills`:Ar();break;case`resetComposer`:yr();break;case`openPanel`:Er(e.tab);break;case`runSlash`:Yr(e.slash);break;case`selectModel`:Vr(e.modelId);break}},[zr,Lr,Rr,Er,Ar,yr,Yr,Vr]),Qr=(0,I.useCallback)(e=>{Ee(t=>{let n=t.find(t=>t.id===e);return n?.url.startsWith(`blob:`)&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},[]),$r=(0,I.useCallback)(e=>{Vt.current=e,Bt.current===null&&(Bt.current=window.requestAnimationFrame(()=>{Bt.current=null;let e=Vt.current;(0,I.startTransition)(()=>{ue(e)});let t=e.match(/(?:^|\s)([@$/])([^\s]*)$/);if(!t){Wr();return}let n=t[1],r=t[2]??``;if(n===`/`){Pe(`slash`),F(`/${r}`),Le(0);return}if(n===`@`){Pe(`mention`),F(r),Le(0);return}if(n===`$`){Pe(`skill`),F(r),Le(0);return}Wr()}))},[Wr]),ei=(0,I.useCallback)(t=>{if(t.mode===`slash`){Gr(`${t.value} `),Wr();return}if(t.mode===`mention`){let n=e.mentionCatalog.find(e=>e.id===t.id);n&&Kr(n);return}qr(t.value)},[Kr,qr,Wr,Gr,e.mentionCatalog]),ti=(0,I.useCallback)(async n=>{let r=n??Mt.current?.value??le,a=r.trim(),o=Se.filter(e=>$d(r,e)),s={composerValue:r,mentions:[...Se],skills:[...we],files:[...De],images:[...Te]};if(!(!a&&o.length===0&&we.length===0&&De.length===0&&Te.length===0))try{let n=l,r=n?e.threads.some(e=>e.thread.id===n):!1;if((!n||!r)&&(n=await t.createThread(wn,{title:`New Session`,cwd:j}),Ae(e=>[n,...e.filter(e=>e!==n)].slice(0,6)),Cr(n,`chat`)),a.startsWith(`/`)){await Yr(a,!0);return}let s=de===`review`||i.section===`review`?`review`:`chat`,c=a,u=Te.length===0;if(dn){br(n,{mode:s,prompt:c,mentions:o,skills:we,files:De,images:Te}),yr(),z(`Message queued`,`ok`);return}u&&(yr(),await kA()),n=await Qn({threadId:n,mode:s,prompt:c,mentions:o,skills:we,files:De,images:Te,settings:wn}),u||yr()}catch(t){s.images.length===0&&!_r().trim()&&(ue(s.composerValue),Dt(e=>e+1),Ce(s.mentions),P(s.skills),Oe(s.files),Pe(null),F(``),Le(0)),z(AA(t,e.transport.error??`Failed to send message`),`err`)}},[t,l,dn,le,de,br,_r,Cr,z,yr,i.section,Yr,Qn,e.transport.error,e.threads,Se,Te,De,we,wn,j]),ni=(0,I.useCallback)(async e=>{if(Ne&&qn.length>0){if(e.key===`ArrowDown`){e.preventDefault(),Le(e=>Math.min(qn.length-1,e+1));return}if(e.key===`ArrowUp`){e.preventDefault(),Le(e=>Math.max(0,e-1));return}if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey){e.preventDefault(),ei(qn[Ie]);return}if(e.key===`Escape`){Wr();return}}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`g`){e.preventDefault(),z(`Ctrl+G — opening editor bridge`,``);return}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),await ti(e.currentTarget.value))},[Wr,qn,ei,z,Ie,Ne,ti]),ri=(0,I.useCallback)((e,t)=>{let n=e.filter(e=>e.type.startsWith(`image/`));if(n.length===0)return 0;let r=Date.now();return Ee(e=>[...e,...n.map((e,t)=>{let n=e.type.split(`/`)[1]?.replace(/[^a-z0-9]/gi,``).toLowerCase()||`png`;return{id:kd(`image`),name:e.name||`pasted-image-${r}-${t+1}.${n}`,url:URL.createObjectURL(e),size:Ud(e.size),file:e}})]),z(n.length===1?t===`paste`?`Image pasted`:`Image attached`:t===`paste`?`${n.length} images pasted`:`${n.length} images attached`,`ok`),n.length},[z]),ii=(0,I.useCallback)(e=>{let t=Array.from(e.clipboardData.files??[]);ri(t.length>0?t:Array.from(e.clipboardData.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e),`paste`)!==0&&e.preventDefault()},[ri]),ai=(0,I.useCallback)(e=>{let t=Array.from(e.target.files??[]);t.length!==0&&(ri(t,`attach`),e.target.value=``)},[ri]),oi=(0,I.useCallback)(e=>{let t=Array.from(e.target.files??[]);t.length!==0&&(Oe(e=>[...e,...t.map(e=>({id:kd(`file`),name:e.name,size:Ud(e.size),file:e}))]),e.target.value=``,z(`File attached`,`ok`))},[z]),si=(0,I.useCallback)(async()=>{if(!l)return;let e=await t.interruptTurn(l);z(e?`Stop requested`:`No active turn to stop`,e?`warn`:``)},[t,l,z]),ci=(0,I.useCallback)(e=>{P(t=>t.filter(t=>t.id!==e))},[]),li=(0,I.useCallback)(e=>{Oe(t=>t.filter(t=>t.id!==e))},[]),ui=(0,I.useCallback)(async e=>{if(!l)return;let n=(Re[l]??[]).find(t=>t.id===e);if(n){if(xr(l,e),dn){if(await t.applySteer({threadId:l,prompt:n.prompt,mentions:n.mentions,skills:n.skills,files:n.files,images:n.images})){z(`Queued message sent as steer`,`ok`);return}Sr(l,n),z(`No active turn to steer`,`warn`);return}try{await Qn({threadId:l,mode:n.mode,prompt:n.prompt,mentions:n.mentions,skills:n.skills,files:n.files,images:n.images,settings:wn})}catch(e){Sr(dA(e)??l,n)}}},[t,l,dn,wn,Sr,z,Re,xr,Qn]),di=(0,I.useCallback)(e=>{if(on.length<=1){z(`Cannot close last tab`,``);return}let t=on.filter(t=>t!==e);Ae(t),e===l&&t[0]&&Cr(t[0],`chat`)},[l,Cr,z,on]),fi=Ne?q[Ne]:dn?`Queue a follow-up while the agent is still running…`:q.slash,pi=`${CA((0,I.useMemo)(()=>EA(R,e.settings.provider),[R,e.settings.provider]))} / 200k`,mi=(0,I.useMemo)(()=>[...e.account.usageWindows].sort((e,t)=>(e.windowDurationMins??2**53-1)-(t.windowDurationMins??2**53-1)).slice(0,2),[e.account.usageWindows]),hi=e.transport.status===`connected`?`Connected`:e.transport.status,gi=wA(u?.thread.cwd),_i=u?.thread.gitInfo?.branch??`workspace`,vi=Sd[Sn].toLowerCase(),yi=dn?`Streaming`:`Idle`,bi=(0,I.useMemo)(()=>u?.terminals.filter(e=>e.source===`shell`)??[],[u?.terminals]),xi=bi.length>0,Si=(0,I.useCallback)(()=>{!l||!u?.thread.cwd||xi||t.startProjectTerminal(l,u.thread.cwd).catch(e=>{z(e instanceof Error?e.message:`Unable to start the project shell.`,`err`)})},[t,u?.thread.cwd,l,xi,z]);(0,I.useEffect)(()=>{if(!(!_e||!ve||be)){if(typeof window>`u`){xe(!0);return}return nt.current=window.requestAnimationFrame(()=>{nt.current=null,xe(!0)}),()=>{nt.current!==null&&(window.cancelAnimationFrame(nt.current),nt.current=null)}}},[ve,be,_e]),(0,I.useEffect)(()=>{if(!(!_e||!be||!l||!u?.thread.cwd||xi)){if(typeof window>`u`){Si();return}return rt.current=window.requestAnimationFrame(()=>{rt.current=null,Si()}),()=>{rt.current!==null&&(window.cancelAnimationFrame(rt.current),rt.current=null)}}},[u?.thread.cwd,l,xi,Si,be,_e]);let Ci=(0,I.useCallback)(()=>{_e||(ye(!0),N(!0))},[_e]),wi=(0,I.useCallback)(()=>{typeof window<`u`&&(nt.current!==null&&(window.cancelAnimationFrame(nt.current),nt.current=null),rt.current!==null&&(window.cancelAnimationFrame(rt.current),rt.current=null)),N(!1)},[]),Ti=(0,I.useCallback)(e=>{DA(e).then(()=>z(`Copied!`,`ok`))},[z]),Ei=(0,I.useCallback)((e,t)=>{Tr(e,{line:t,source:`chat`})},[Tr]),Di=(0,I.useCallback)(e=>{Or(e)},[Or]),Oi=(0,I.useCallback)(e=>{Tr(e,{source:`chat`})},[Tr]),ki=(0,I.useCallback)(()=>{Yr(`/plan`)},[Yr]),Ai=(0,I.useCallback)(e=>{vr(e),gr(e)},[gr,vr]),ji=(0,I.useCallback)(e=>{Yr(e)},[Yr]),Mi=(0,I.useCallback)((e,t)=>{e.preventDefault(),Ue({x:Math.min(e.clientX,window.innerWidth-172),y:Math.min(e.clientY,window.innerHeight-212),item:t})},[]),Ni=(0,I.useCallback)(()=>{if(l){if(_===`ops`){D(`files`),C(!0),Cr(l,`ops`);return}Cr(l,_)}},[l,_,Cr]),B=(0,I.useCallback)(()=>{if(l){if(y===`ops`){D(`files`),C(!0),Cr(l,`ops`);return}Cr(l,y)}},[l,Cr,y]),Pi=(0,I.useMemo)(()=>i.section!==`editor`||!h?null:Ke?.path===h?{...Ke,line:g}:{path:h,name:h.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??h,content:``,loading:!0,error:null,line:g},[g,h,Ke,i.section]),Fi=(0,I.useCallback)(async(e,n)=>{await t.saveFile(e,n),qe(t=>t?.path===e?{...t,content:n,loading:!1,error:null}:t),z(`Saved ${e.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??e}`,`ok`)},[t,z]),Ii=_===`ops`?`Back to Files`:`Back to Chat`,Li=(0,I.useCallback)(async e=>{if(e.kind===`directory`){Ge(e.path),qe(null);return}Tr(e.path,{source:`ops`})},[Tr]),Ri=()=>{if(!u)return(0,L.jsx)(`div`,{className:`empty-panel`,children:`No active thread.`});if(E===`graph`)return ot?(0,L.jsxs)(`div`,{className:`graph-panel-stack`,children:[(0,L.jsx)(US,{branchLabel:zn,committing:St,dirty:Ln,generating:bt,hasStagedChanges:Rn,message:vt,onCommit:()=>void hr(),onGenerate:()=>void mr(),onMessageChange:yt,onProviderChange:e=>{pr(e)},preferencesPath:gt,providers:e.providers,selectedProviderId:mt,summary:In?.summary??`Working tree clean`}),ot.source===`session`?(0,L.jsx)(`div`,{className:`panel-hint`,children:ut?`Showing session-derived history because local git output is unavailable.`:`Showing session-derived history.`}):ct?(0,L.jsx)(`div`,{className:`panel-hint`,children:`Refreshing git history…`}):null,(0,L.jsx)(qS,{model:ot,onOpenThread:wr})]}):(0,L.jsx)(`div`,{className:`empty-panel`,children:ct?`Loading git history…`:`No repository graph available for this session yet.`});if(E===`files`){let t=new Map,n=u.thread.cwd,r=Cn??n,a=e.directoryCatalogRoot===r?e.directoryCatalog:[],o=new Set(Jr.map(e=>e.path)),s=r===n?``:r.slice(n.length).replace(/^\/+/u,``),c=[{label:n.split(`/`).filter(Boolean).pop()??n,path:n},...s.split(`/`).filter(Boolean).reduce((e,t)=>{let r=e.at(-1)?.path??n;return e.push({label:t,path:`${r.replace(/\/+$/u,``)}/${t}`}),e},[])],l=r===n?null:r.slice(0,r.lastIndexOf(`/`))||n;return jn.forEach(e=>{e.changes.forEach(e=>{t.set(e.path,e.kind.type===`add`?`new`:e.kind.type===`delete`?`del`:`mod`)})}),(0,L.jsx)(rA,{breadcrumbs:c,currentPath:r,directoryEntries:a,editorPath:i.section===`editor`?h:null,loading:e.directoryCatalogRoot!==r,mentionedPaths:o,modifiedByPath:t,onNavigate:e=>{Ge(e),qe(t=>t&&qd(e,t.path)?t:null)},onOpenEntry:Li,parentPath:l,rootPath:n})}if(E===`diff`){let e=Mn.reduce((e,t)=>e+t.additions,0),t=Mn.reduce((e,t)=>e+t.removals,0);return(0,L.jsxs)(`div`,{className:`diff-review-shell`,children:[(0,L.jsxs)(`div`,{className:`panel-hint`,children:[`Patch review · `,Mn.length,` changed file`,Mn.length===1?``:`s`,` · +`,e,` / -`,t]}),Mn.length===0?(0,L.jsx)(`div`,{className:`empty-panel`,children:`No diff items in this thread yet.`}):null,Mn.length>0?(0,L.jsxs)(`div`,{className:`diff-review-layout`,children:[(0,L.jsx)(`div`,{className:`diff-review-sidebar`,children:Mn.map(e=>(0,L.jsxs)(`button`,{className:H(`diff-review-entry`,Fn?.id===e.id&&`active`),type:`button`,onClick:()=>Ye(e.id),children:[(0,L.jsxs)(`div`,{className:`diff-review-entry-top`,children:[(0,L.jsx)(`span`,{className:H(`diff-kind-pill`,e.kind.type===`add`&&`new`,e.kind.type===`delete`&&`del`),children:bf(e.kind)}),(0,L.jsx)(`span`,{className:H(`diff-status`,e.status===`inProgress`&&`live`,e.status===`failed`&&`err`),children:e.status===`inProgress`?`editing`:e.status})]}),(0,L.jsx)(`div`,{className:`diff-review-entry-path`,children:e.path}),(0,L.jsxs)(`div`,{className:`diff-review-entry-meta`,children:[(0,L.jsxs)(`span`,{children:[`+`,e.additions]}),(0,L.jsxs)(`span`,{children:[`-`,e.removals]}),(0,L.jsxs)(`span`,{children:[e.hunks,` hunk`,e.hunks===1?``:`s`]})]})]},e.id))}),Fn?(0,L.jsxs)(`div`,{className:`diff-review-main`,children:[(0,L.jsxs)(`div`,{className:`diff-focus-head`,children:[(0,L.jsx)(`div`,{className:`diff-focus-title`,children:Fn.path}),(0,L.jsxs)(`div`,{className:`diff-focus-meta`,children:[(0,L.jsx)(`span`,{className:H(`diff-kind-pill`,Fn.kind.type===`add`&&`new`,Fn.kind.type===`delete`&&`del`),children:bf(Fn.kind)}),(0,L.jsx)(`span`,{className:H(`diff-status`,Fn.status===`inProgress`&&`live`,Fn.status===`failed`&&`err`),children:Fn.status===`inProgress`?`editing`:Fn.status}),(0,L.jsxs)(`span`,{className:`diff-stat-chip`,children:[`+`,Fn.additions]}),(0,L.jsxs)(`span`,{className:`diff-stat-chip`,children:[`-`,Fn.removals]}),(0,L.jsxs)(`span`,{className:`diff-stat-chip`,children:[Fn.hunks,` hunk`,Fn.hunks===1?``:`s`]})]})]}),(0,L.jsx)(sA,{entry:Fn})]}):null]}):null,Bn.length>0?(0,L.jsx)(`div`,{className:`review-list`,children:Bn.map(e=>(0,L.jsxs)(`div`,{className:H(`review-item`,e.severity),children:[(0,L.jsxs)(`div`,{className:`review-header`,children:[(0,L.jsx)(`span`,{children:e.severity}),(0,L.jsx)(`span`,{children:e.file.split(`/`).slice(-2).join(`/`)}),(0,L.jsxs)(`span`,{children:[`:`,e.line]})]}),(0,L.jsx)(`div`,{className:`review-title`,children:e.title}),(0,L.jsx)(`div`,{className:`review-summary`,children:e.summary})]},e.id))}):u.review.length>0?(0,L.jsx)(`div`,{className:`empty-panel`,children:`No review findings mapped to the selected file.`}):null,xn.length>0?(0,L.jsx)(`div`,{className:`panel-actions`,children:xn.map(e=>ir(e))}):null]})}if(E===`terminal`)return(0,L.jsx)(`div`,{className:`empty-panel`,children:`Terminal moved to the bottom dock. Use the Shell toggle above the prompt.`});if(E===`agents`){let t=e.threads.filter(e=>e.thread.agentNickname||e.thread.agentRole);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`panel-head-row`,children:[(0,L.jsx)(`div`,{className:`panel-hint`,children:`⑂ Multi-agent session`}),(0,L.jsx)(`button`,{className:`abtn yes small`,type:`button`,onClick:()=>z(`spawn_agent("alpha") → started`,`ok`),children:`+ Spawn`})]}),Wn.length===0&&t.length===0?(0,L.jsx)(`div`,{className:`empty-panel`,children:`No subagent activity in this thread yet.`}):null,Wn.map(e=>(0,L.jsxs)(`div`,{className:`agc`,children:[(0,L.jsxs)(`div`,{className:`agh`,children:[(0,L.jsx)(`div`,{className:`agdot`}),(0,L.jsxs)(`span`,{className:`agn`,children:[`⑂ `,e.tool]}),(0,L.jsx)(`span`,{className:`ags`,children:e.status})]}),(0,L.jsx)(`div`,{className:`agt`,children:e.prompt??`Subagent activity`}),e.receiverThreadIds.map(t=>{let n=e.agentsStates[t],r=n?.status===`completed`?100:n?.status===`running`?58:18;return(0,L.jsxs)(`div`,{className:`agent-progress`,children:[(0,L.jsxs)(`div`,{className:`agent-progress-header`,children:[(0,L.jsx)(`span`,{children:t.slice(0,12)}),(0,L.jsx)(`span`,{children:n?.status??`pending`})]}),(0,L.jsx)(`div`,{className:`agprog`,children:(0,L.jsx)(`div`,{className:`agbar`,style:{width:`${r}%`}})}),(0,L.jsx)(`div`,{className:`agent-progress-copy`,children:n?.message??`No update yet.`})]},t)})]},e.id)),t.map(e=>(0,L.jsxs)(`div`,{className:`agc`,children:[(0,L.jsxs)(`div`,{className:`agh`,children:[(0,L.jsx)(`div`,{className:`agdot`}),(0,L.jsxs)(`span`,{className:`agn`,children:[`⑂ `,e.thread.agentNickname??c[e.thread.id]??Vd(e.thread)]}),(0,L.jsx)(`span`,{className:`ags`,children:e.thread.status.type})]}),(0,L.jsx)(`div`,{className:`agt`,children:e.thread.agentRole??`Subagent thread`})]},e.thread.id))]})}return(0,L.jsx)(`div`,{children:(0,L.jsx)($S,{snapshot:e,activeThreadLabel:d,actions:t,activeTheme:Ot,onOpenSkills:Ar,onOpenTheme:Mr,pushToast:z,selectModel:Vr})})},zi=()=>{if(!Ne)return null;let t=Ne===`mention`&&!!u&&e.directoryCatalogRoot!==(u?.thread.cwd??null),n=Ne===`mention`?t?`Loading files from the current directory…`:`No files found for this query.`:Ne===`skill`?`No skills matched.`:`No commands matched.`;return(0,L.jsx)(`div`,{id:`slashpop`,style:{display:`block`},children:qn.length>0?qn.map((e,t)=>(0,L.jsxs)(`button`,{className:H(`spi`,t===Ie&&`sel`),type:`button`,onMouseDown:t=>{t.preventDefault(),ei(e)},children:[(0,L.jsx)(`span`,{className:`sp-cmd`,children:e.label}),(0,L.jsx)(`span`,{className:`sp-dsc`,children:e.description})]},e.id)):(0,L.jsx)(`div`,{className:`sp-empty`,children:n})})},Bi=nn&&Jn;return nn?(0,L.jsx)(`main`,{className:`workspace-shell connection-loading-shell`,children:(0,L.jsx)(fS,{messages:xA,metaText:Bi?`Restoring ${Hd(d,42)}`:`Connecting to workspace backend`,visibleRangeEnd:Bi?xA.length-1:yA.length-1,visibleRangeStart:Bi?yA.length:0})}):(0,L.jsxs)(`main`,{className:H(`workspace-shell`,yn&&`overlay-open`),children:[(0,L.jsxs)(`header`,{id:`hdr`,children:[(0,L.jsx)(`button`,{className:`hb mbtn`,type:`button`,onClick:Dr,title:`Menu`,children:`☰`}),(0,L.jsxs)(`div`,{className:`logo`,children:[(0,L.jsx)(cS,{alt:``,className:`logo-ico`}),(0,L.jsx)(`span`,{children:`Nomadex`})]}),(0,L.jsx)(`div`,{className:`hsep`}),(0,L.jsx)(`button`,{className:H(`hbadge`,Cd[Sn]),id:`aprbadge`,type:`button`,onClick:()=>void Ur(),title:`Cycle approval mode`,children:Sd[Sn]}),(0,L.jsx)(`button`,{className:`hb`,type:`button`,onClick:()=>ee(!0),title:`Command palette`,children:`⌘`}),(0,L.jsx)(`button`,{className:`hb`,type:`button`,onClick:()=>Er(`agents`),title:`Multi-agent panel`,children:`⑂`}),(0,L.jsx)(`button`,{className:`hb`,type:`button`,onClick:()=>Er(`files`),title:`Files and diff`,children:`📁`}),(0,L.jsx)(`button`,{className:`hb`,type:`button`,onClick:Ar,title:`Skills library`,children:`📋`}),(0,L.jsx)(`button`,{className:`hb`,type:`button`,onClick:()=>Er(`config`),title:`Config and settings`,children:`⚙`}),(0,L.jsxs)(`button`,{className:`htheme`,id:`htheme`,type:`button`,onClick:()=>{ne(!1),k(e=>!e)},title:`Theme picker`,children:[(0,L.jsx)(`span`,{className:`theme-dot`}),(0,L.jsx)(`span`,{className:`theme-label`,children:An.name}),(0,L.jsx)(`span`,{className:`hmodel-arrow`,children:`▾`})]}),(0,L.jsxs)(`button`,{className:`hmodel`,id:`hmodel`,type:`button`,disabled:Dn.length===0,ref:Pt,onClick:()=>{Dn.length!==0&&(k(!1),ne(e=>!e))},title:Dn.length===0?`${En.displayName} uses its own CLI model configuration`:void 0,children:[(0,L.jsx)(`div`,{className:`mdot`}),(0,L.jsx)(`span`,{id:`mlabel`,children:kn}),(0,L.jsx)(`span`,{className:`hmodel-arrow`,children:`▾`})]})]}),(0,L.jsxs)(`div`,{id:`layout`,children:[!p&&b?(0,L.jsx)(`button`,{id:`sbo`,className:`show`,type:`button`,"aria-label":`Close sidebar`,onClick:()=>x(!1)}):null,_n?(0,L.jsxs)(`aside`,{id:`sb`,className:H(!p&&b&&`open`),children:[(0,L.jsx)(`button`,{className:`snew`,type:`button`,onClick:()=>void Lr(),children:`+ New Session`}),(0,L.jsx)(`div`,{className:`shist`,children:[`Today`,`Yesterday`,`Earlier`].map(e=>Tn[e].length>0?(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`sgl`,children:e}),Tn[e].map(e=>(0,L.jsxs)(`button`,{className:H(`si`,e.thread.id===l&&`active`),type:`button`,onClick:()=>wr(e.thread.id),children:[(0,L.jsx)(`span`,{children:e.thread.agentNickname?`⑂`:`💬`}),(0,L.jsx)(`span`,{className:`si-t`,children:c[e.thread.id]??Vd(e.thread)})]},e.thread.id))]},e):null)}),(0,L.jsxs)(`div`,{className:`sbot`,children:[(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:()=>ee(!0),children:[(0,L.jsx)(`span`,{children:`⌘`}),(0,L.jsx)(`span`,{children:`Command palette`}),(0,L.jsx)(`span`,{className:`skbd`,children:`⌘K`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:()=>void Yr(`/review`),children:[(0,L.jsx)(`span`,{children:`🔍`}),(0,L.jsx)(`span`,{children:`/review working tree`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:()=>void Yr(`/fork`),children:[(0,L.jsx)(`span`,{children:`⑂`}),(0,L.jsx)(`span`,{children:`/fork session`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:()=>void Yr(`/compact`),children:[(0,L.jsx)(`span`,{children:`🗜`}),(0,L.jsx)(`span`,{children:`/compact transcript`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:Ar,children:[(0,L.jsx)(`span`,{children:`📋`}),(0,L.jsx)(`span`,{children:`Skills library`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:Mr,children:[(0,L.jsx)(`span`,{children:`◐`}),(0,L.jsx)(`span`,{children:`Theme picker`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:()=>Ai(`/init Generate AGENTS.md scaffold`),children:[(0,L.jsx)(`span`,{children:`📋`}),(0,L.jsx)(`span`,{children:`/init AGENTS.md`})]}),(0,L.jsxs)(`button`,{className:`slink`,type:`button`,onClick:()=>Er(`config`),children:[(0,L.jsx)(`span`,{children:`⚙`}),(0,L.jsx)(`span`,{children:`config.toml`})]})]})]}):null,(0,L.jsxs)(`section`,{id:`main`,className:H(vn&&`covered`),children:[(0,L.jsxs)(`div`,{id:`tabs`,children:[on.map(e=>{let t=s.find(t=>t.thread.id===e),n=t?.thread;return!t||!n?null:(0,L.jsxs)(`button`,{className:H(`tab`,e===l&&`active`),"data-i":e,type:`button`,onClick:()=>Cr(e,`chat`),children:[(0,L.jsx)(`span`,{children:n.agentNickname?`⑂`:`💬`}),(0,L.jsx)(`span`,{children:Hd(c[t.thread.id]??Vd(t.thread),18)}),(0,L.jsx)(`span`,{className:`tab-x`,onClick:t=>{t.stopPropagation(),di(e)},children:`×`})]},e)}),(0,L.jsx)(`button`,{className:`tabadd`,type:`button`,onClick:()=>void Lr(),title:`New session`,children:`+`})]}),i.section===`editor`?(0,L.jsx)(`div`,{id:`editor-page`,children:Pi?(0,L.jsx)(lA,{backLabel:Ii,onBack:Ni,onSave:Fi,preview:Pi,providerId:e.settings.provider,variant:`page`}):(0,L.jsx)(`div`,{className:`empty-panel`,children:`No file selected.`})}):i.section===`review`?(0,L.jsx)(cA,{backLabel:y===`ops`?`Back to Files`:`Back to Chat`,diffEntries:Mn,findings:Bn,onBack:B,onSelectEntry:e=>Or(e,y),selectedEntryId:Je}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{id:`chat`,ref:At,children:[(0,L.jsx)(yS,{activeThread:u,activeThreadLabel:d,activeTurns:ln,existingThreadHistoryPending:Yn,onContext:Mi,onCopy:Ti,onEdit:Ai,onFill:Ai,onFork:Rr,onOpenFile:Ei,onPlan:ki,onRollback:Br,onReview:Di,onSlash:ji,providerId:e.settings.provider,streamVisible:Xt}),(0,L.jsx)(pd,{overlay:pn,pendingApprovalsCount:bn,queuedCount:fn.length}),(0,L.jsx)(`div`,{"aria-hidden":`true`,ref:jt})]}),(0,L.jsxs)(`div`,{id:`ia`,children:[it?(0,L.jsx)(`div`,{className:`chat-jump-row`,children:(0,L.jsx)(`button`,{className:`chat-jump-button`,type:`button`,onClick:ur,children:`↓ Latest`})}):null,we.length>0||De.length>0||Te.length>0?(0,L.jsxs)(`div`,{id:`ctx-row`,children:[we.map(e=>(0,L.jsxs)(`div`,{className:`ctag`,children:[(0,L.jsx)(`span`,{children:`📋`}),(0,L.jsxs)(`span`,{children:[`$`,e.name]}),(0,L.jsx)(`button`,{className:`ctx-x`,type:`button`,onClick:()=>ci(e.id),children:`×`})]},e.id)),De.map(e=>{let t=mf(e.name);return(0,L.jsxs)(`div`,{className:H(`ctag ctag-file`,`file-tone-${t.tone}`),children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`file-chip-preview`,children:(0,L.jsx)(`span`,{className:`file-chip-ext`,children:t.badge})}),(0,L.jsxs)(`span`,{className:`file-chip-copy`,children:[(0,L.jsx)(`span`,{className:`file-chip-title`,children:t.title}),(0,L.jsx)(`span`,{className:`file-chip-meta`,children:e.size})]}),(0,L.jsx)(`button`,{className:`ctx-x`,type:`button`,onClick:()=>li(e.id),children:`×`})]},e.id)}),Te.map(e=>(0,L.jsxs)(`div`,{className:`ctag ctag-image`,children:[(0,L.jsx)(`img`,{alt:e.name,className:`ctag-thumb`,loading:`lazy`,src:e.url}),(0,L.jsx)(`span`,{className:`ctag-label`,children:e.name}),(0,L.jsx)(`button`,{className:`ctx-x`,type:`button`,onClick:()=>Qr(e.id),children:`×`})]},e.id))]}):null,fn.length>0?(0,L.jsx)(aA,{messages:fn,onDelete:e=>l&&xr(l,e),onSteer:ui}):null,mn.length>0?(0,L.jsx)(hS,{entries:mn,onOpenFile:Oi,title:`Changing`,variant:`live`}):null,xn.length>0?(0,L.jsx)(`div`,{className:`question-request-stack`,children:xn.map(e=>ir(e))}):null,(ve||_e)&&u?(0,L.jsxs)(`div`,{className:H(`workspace-terminal-dock`,!_e&&`hidden`),children:[(0,L.jsxs)(`div`,{className:`workspace-terminal-dock-bar`,children:[(0,L.jsx)(`button`,{className:`workspace-terminal-dock-tab active`,type:`button`,children:`Terminal`}),(0,L.jsx)(`button`,{className:`workspace-terminal-dock-close`,onClick:wi,type:`button`,children:`Hide`})]}),(0,L.jsx)(`div`,{className:`workspace-terminal-dock-body`,children:be?(0,L.jsx)(nC,{cwd:u.thread.cwd,onSendInput:(e,n)=>t.sendTerminalInput(u.thread.id,e,n),onStartShell:()=>t.startProjectTerminal(u.thread.id,u.thread.cwd),onTerminate:e=>t.terminateTerminal(u.thread.id,e),terminals:bi}):(0,L.jsx)(`div`,{className:`workspace-terminal-dock-loading`,children:`Opening terminal`})})]}):null,(0,L.jsxs)(`div`,{id:`ib`,className:H(fn.length>0&&`queue-open`),children:[(0,L.jsxs)(`div`,{id:`toolbar`,children:[(0,L.jsxs)(`button`,{className:H(`tbtn`,pe&&`on`),type:`button`,onClick:()=>me(e=>!e),children:[(0,L.jsx)(SA,{name:`auto`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Auto`})]}),(0,L.jsxs)(`button`,{className:H(`tbtn`,he&&`on`),type:`button`,onClick:async()=>{ge(!he)},children:[(0,L.jsx)(SA,{name:`plan`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Plan`})]}),(0,L.jsx)(`div`,{className:`tsep2`}),(0,L.jsxs)(`button`,{className:`tbtn`,type:`button`,onClick:()=>{Pe(`mention`),F(``),Le(0),Mt.current?.focus()},children:[(0,L.jsx)(SA,{name:`mention`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Mention`})]}),(0,L.jsxs)(`button`,{className:`tbtn`,type:`button`,onClick:()=>It.current?.click(),children:[(0,L.jsx)(SA,{name:`attach`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Files`})]}),(0,L.jsxs)(`button`,{className:`tbtn`,type:`button`,onClick:()=>Ft.current?.click(),children:[(0,L.jsx)(SA,{name:`image`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Image`})]}),(0,L.jsxs)(`button`,{className:H(`tbtn`,_e&&`on`),type:`button`,onClick:()=>void(_e?wi():Ci()),children:[(0,L.jsx)(SA,{name:`terminal`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Shell`})]}),(0,L.jsxs)(`button`,{className:H(`tbtn`,e.settings.webSearch&&`on`),type:`button`,onClick:()=>void t.updateSettings({webSearch:!e.settings.webSearch}),children:[(0,L.jsx)(SA,{name:`web`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Web`})]}),(0,L.jsx)(`div`,{className:`tsep2`}),(0,L.jsxs)(`button`,{className:H(`tbtn`,de===`review`&&`on`),type:`button`,onClick:()=>fe(e=>e===`review`?`chat`:`review`),children:[(0,L.jsx)(SA,{name:`review`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Review`})]}),(0,L.jsxs)(`button`,{className:`tbtn`,type:`button`,onClick:()=>Er(`agents`),children:[(0,L.jsx)(SA,{name:`agents`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Agents`})]}),(0,L.jsxs)(`button`,{className:`tbtn`,type:`button`,onClick:()=>void zr(),children:[(0,L.jsx)(SA,{name:`compact`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Trim`})]}),(0,L.jsxs)(`button`,{className:`tbtn`,type:`button`,onClick:()=>z(`Ctrl+G — opening editor bridge`,``),children:[(0,L.jsx)(SA,{name:`editor`}),(0,L.jsx)(`span`,{className:`tbtn-label`,children:`Editor`})]})]}),(0,L.jsxs)(`div`,{id:`irow`,children:[(0,L.jsx)(oA,{composerMirrorRef:Nt,mentions:Se,onKeyDown:ni,onPaste:ii,onValueChange:$r,placeholder:fi,textareaRef:Mt,value:le},Et),(0,L.jsx)(`button`,{id:`sendbtn`,type:`button`,"aria-label":dn?`Queue message`:`Send message`,onClick:()=>void ti(Mt.current?.value),children:(0,L.jsx)(SA,{name:`send`})}),(0,L.jsx)(`button`,{id:`stopbtn`,style:{display:dn?`flex`:`none`},type:`button`,"aria-label":`Stop current turn`,onClick:()=>void si(),children:(0,L.jsx)(SA,{name:`stop`})})]}),zi(),(0,L.jsx)(`div`,{id:`ifooter`,children:(0,L.jsxs)(`div`,{className:`composer-footer-meta`,children:[(0,L.jsx)(`div`,{className:`composer-shortcuts`,children:(0,L.jsx)(`span`,{className:`composer-hint`,children:`Shift+Enter`})}),(0,L.jsxs)(`div`,{className:`composer-usage-metric`,children:[(0,L.jsx)(`span`,{className:`composer-usage-label`,children:`Context`}),(0,L.jsx)(`span`,{id:`tokcount`,children:pi})]}),(0,L.jsx)(`div`,{className:`composer-limit-list`,children:mi.map(e=>(0,L.jsxs)(`div`,{className:`composer-limit-chip`,children:[(0,L.jsx)(`span`,{className:`composer-limit-name`,children:TA(e.label,e.windowDurationMins)}),(0,L.jsxs)(`span`,{className:`composer-limit-value`,children:[Math.round(e.usedPercent),`%`]})]},e.id))})]})})]})]})]})]}),p||hn?(0,L.jsxs)(`aside`,{id:`rp`,className:H(hn&&`open`),children:[(0,L.jsxs)(`div`,{className:`rph`,children:[(0,L.jsx)(`span`,{className:`rpt`,id:`rp-title`,children:wd[E]}),(0,L.jsx)(`button`,{className:`rpclose`,type:`button`,onClick:kr,children:`×`})]}),(0,L.jsx)(`div`,{className:`rptabs`,id:`rptabs`,children:[`files`,`graph`,`diff`,`agents`,`config`].map(e=>(0,L.jsx)(`button`,{className:H(`rptab`,E===e&&`active`),type:`button`,onClick:()=>{if(e===`diff`){Or(Fn?.id??Mn[0]?.id,i.section===`ops`?`ops`:`chat`);return}D(e)},children:wd[e]},e))}),(0,L.jsx)(`div`,{className:`rpbody`,id:`rpbody`,children:hn?Ri():null})]}):null]}),(0,L.jsxs)(`div`,{id:`statusbar`,children:[(0,L.jsxs)(`div`,{className:`sbi sbi-transport`,children:[(0,L.jsx)(`div`,{className:H(`sbd`,Rd(e.transport.status))}),(0,L.jsx)(`span`,{children:hi})]}),(0,L.jsxs)(`div`,{className:`sbi sbi-branch`,children:[(0,L.jsx)(SA,{name:`branch`}),(0,L.jsx)(`span`,{className:`sb-project sb-fulltext`,children:gi}),(0,L.jsx)(`span`,{className:`sb-divider`,children:`/`}),(0,L.jsx)(`span`,{className:`sb-fulltext`,children:_i})]}),(0,L.jsxs)(`div`,{className:`sbi sbi-model`,id:`sb-model`,children:[(0,L.jsx)(SA,{name:`model`}),(0,L.jsx)(`span`,{children:kn})]}),(0,L.jsxs)(`div`,{className:`sbi sbi-access`,children:[(0,L.jsx)(SA,{name:`shield`}),(0,L.jsx)(`span`,{children:vi})]}),(0,L.jsx)(`div`,{className:`sbi`,id:`sb-st`,children:yi})]}),te&&Dn.length>0?(0,L.jsx)(`div`,{id:`mpicker`,style:{display:`block`,top:`${wt.top}px`,right:`${wt.right}px`,left:`auto`},children:Dn.map((t,n)=>(0,L.jsxs)(`div`,{className:`mpi`,onClick:()=>void Vr(t.id),onKeyDown:()=>void 0,role:`button`,tabIndex:0,children:[(0,L.jsxs)(`div`,{className:`mpi-n`,children:[t.displayName,t.id===e.settings.model?(0,L.jsxs)(L.Fragment,{children:[` `,`✓ `,(0,L.jsx)(`span`,{className:`model-rec`,children:`active`})]}):null]}),(0,L.jsx)(`div`,{className:`mpi-d`,children:t.description}),n<Dn.length-1?(0,L.jsx)(`div`,{className:`mpsep`}):null]},t.id))}):null,re?(0,L.jsx)(QS,{activeTheme:Ot,onClose:Nr,onSelect:Hr,themes:Ed}):null,A?(0,L.jsx)(iA,{activePath:j,breadcrumbs:Un,busy:se,entries:Vn,loading:e.directoryCatalogRoot!==j,onClose:()=>ie(!1),onNavigate:M,onPick:e=>{M(e),Ir(e)},parentPath:Hn}):null,ae?(0,L.jsx)(ZS,{actions:t,onClose:jr,pushToast:z,snapshot:e}):null,O?(0,L.jsx)(`div`,{id:`cmo`,className:`show`,onClick:e=>e.target===e.currentTarget&&ee(!1),children:(0,L.jsxs)(`div`,{id:`cmp`,children:[(0,L.jsxs)(`div`,{className:`cmr`,children:[(0,L.jsx)(`span`,{className:`cm-ico`,children:`⌘`}),(0,L.jsx)(`input`,{id:`cminput`,autoFocus:!0,placeholder:`Search commands, slash commands, models…`,value:je,onChange:e=>Me(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&ee(!1),e.key===`Enter`){e.preventDefault();let t=Xr[0]?.items[0];t&&(ee(!1),Zr(t.command))}}})]}),(0,L.jsx)(`div`,{className:`cmlist`,id:`cmlist`,children:Xr.length===0?(0,L.jsx)(`div`,{className:`empty-command`,children:`No results`}):Xr.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`cmgl`,children:e.label}),e.items.map(t=>(0,L.jsxs)(`button`,{className:`cmi`,type:`button`,onClick:()=>{ee(!1),Zr(t.command)},children:[(0,L.jsx)(`span`,{children:t.icon}),(0,L.jsx)(`span`,{className:`cmi-nm`,children:t.name}),t.key?(0,L.jsx)(`span`,{className:`cmkbd`,children:t.key}):null]},`${e.label}-${t.name}`))]},e.label))})]})}):null,He?(0,L.jsxs)(`div`,{id:`ctxmenu`,className:`show`,style:{left:`${He.x}px`,top:`${He.y}px`},children:[(0,L.jsx)(`button`,{className:`ctxi`,type:`button`,onClick:()=>{let t=He.item;t?.type===`agentMessage`&&DA(t.text).then(()=>z(`Copied`,`ok`)),t?.type===`userMessage`&&DA(Jd(t,e.settings.provider)).then(()=>z(`Copied`,`ok`)),Ue(null)},children:`📋 Copy message`}),(0,L.jsx)(`button`,{className:`ctxi`,type:`button`,onClick:()=>{let t=He.item;t?.type===`agentMessage`&&Ai(t.text),t?.type===`userMessage`&&Ai(Jd(t,e.settings.provider)),Ue(null)},children:`✏ Edit & resend`}),(0,L.jsx)(`button`,{className:`ctxi`,type:`button`,onClick:()=>{Gn&&Ai(Gn.text),Ue(null)},children:`🔄 Regenerate`}),(0,L.jsx)(`div`,{className:`ctxs`}),(0,L.jsx)(`button`,{className:`ctxi`,type:`button`,onClick:()=>{Rr(),Ue(null)},children:`⑂ /fork from here`}),(0,L.jsx)(`button`,{className:`ctxi`,type:`button`,onClick:()=>{Yr(`/plan`),Ue(null)},children:`📋 /plan from here`}),(0,L.jsx)(`button`,{className:`ctxi`,type:`button`,onClick:()=>{Pe(`mention`),F(``),Ue(null)},children:`📎 /mention file`}),(0,L.jsx)(`div`,{className:`ctxs`}),(0,L.jsx)(`button`,{className:`ctxi danger`,type:`button`,onClick:()=>{z(`Deleted`,``),Ue(null)},children:`🗑 Delete`})]}):null,(0,L.jsx)(`div`,{id:`toasts`,children:Be.map(e=>(0,L.jsx)(`div`,{className:H(`toast`,e.tone),children:e.message},e.id))}),(0,L.jsx)(`input`,{ref:It,className:`hidden-input`,type:`file`,multiple:!0,onChange:oi}),(0,L.jsx)(`input`,{ref:Ft,className:`hidden-input`,type:`file`,accept:`image/*`,multiple:!0,onChange:ai})]})}function FA(){return(0,L.jsx)(MA,{children:(0,L.jsx)(V,{})})}var IA=Qa({component:FA}),LA=Xa({getParentRoute:()=>IA,path:`/`,component:NA}),RA=Xa({getParentRoute:()=>IA,path:`/threads`,component:NA}),zA=Xa({getParentRoute:()=>IA,path:`/thread/$threadId`,component:NA}),BA=Xa({getParentRoute:()=>IA,path:`/threads/$threadId`,component:NA}),VA=Xa({getParentRoute:()=>IA,path:`/threads/$threadId/$section`,component:NA}),HA=go({routeTree:IA.addChildren([LA,RA,zA,BA,VA])}),UA=new Gt({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),WA=document.getElementById(`root`);if(!WA)throw Error(`Root element not found.`);(0,bo.createRoot)(WA).render((0,L.jsx)(Yt,{client:UA,children:(0,L.jsx)(yo,{router:HA})}));export{Ie as a,eO as i,UE as n,WE as r,BE as t};