@c4a/server-cli 0.4.15-alpha.4 → 0.4.15-alpha.6

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 (46) hide show
  1. package/README.md +10 -5
  2. package/index.js +965 -90
  3. package/package.json +1 -1
  4. package/serve.js +2027 -221
  5. package/web/assets/ContentDetail--oZBzWh0.js +1 -0
  6. package/web/assets/ContentDetail-B5s8bbFo.js +1 -0
  7. package/web/assets/ContentDetail-C0zfArPg.js +1 -0
  8. package/web/assets/ContentDetail-C3kXsx-i.js +1 -0
  9. package/web/assets/ContentDetail-CcLGF_Yi.js +1 -0
  10. package/web/assets/ContentDetail-D-2xyerw.js +1 -0
  11. package/web/assets/ContentDetail-DlQ8URkx.js +1 -0
  12. package/web/assets/ContentDetail-TPc0m0eM.js +1 -0
  13. package/web/assets/ContentDetail-y0yi2qln.js +1 -0
  14. package/web/assets/EntityDetail-3CFtMmgQ.js +1 -0
  15. package/web/assets/EntityDetail-BI3etmj4.js +1 -0
  16. package/web/assets/EntityDetail-C9k4cMVL.js +1 -0
  17. package/web/assets/EntityDetail-CoFb-qZW.js +1 -0
  18. package/web/assets/EntityDetail-D_WP7tD4.js +1 -0
  19. package/web/assets/EntityDetail-DiJPemDY.js +1 -0
  20. package/web/assets/EntityDetail-DihnDvhA.js +1 -0
  21. package/web/assets/EntityDetail-DyDH4GAw.js +1 -0
  22. package/web/assets/EntityDetail-dIZiNN2t.js +1 -0
  23. package/web/assets/RelationDetail-B2gHrceI.js +1 -0
  24. package/web/assets/RelationDetail-BK8C5waL.js +1 -0
  25. package/web/assets/RelationDetail-CEq9vopD.js +1 -0
  26. package/web/assets/RelationDetail-CaYrspaS.js +1 -0
  27. package/web/assets/RelationDetail-CpoGdy25.js +1 -0
  28. package/web/assets/RelationDetail-DU9ECyHi.js +1 -0
  29. package/web/assets/RelationDetail-Dz7HAlU5.js +1 -0
  30. package/web/assets/RelationDetail-Wh3IgNaF.js +1 -0
  31. package/web/assets/RelationDetail-zZ_ZfkYX.js +1 -0
  32. package/web/assets/index-BKETuM1m.js +111 -0
  33. package/web/assets/index-BPMqeFze.js +111 -0
  34. package/web/assets/index-BgRuvBL5.js +111 -0
  35. package/web/assets/index-C96WspeJ.css +1 -0
  36. package/web/assets/index-CcrkBEZl.js +111 -0
  37. package/web/assets/index-DGDx8sCs.js +111 -0
  38. package/web/assets/index-DIyAwnqE.js +111 -0
  39. package/web/assets/index-DW1cCA8v.js +111 -0
  40. package/web/assets/index-DiAYi5t8.css +1 -0
  41. package/web/assets/index-FOCWvgW_.css +1 -0
  42. package/web/assets/index-daOjyLzy.css +1 -0
  43. package/web/assets/index-moF8uSEi.js +111 -0
  44. package/web/assets/index-sPNyENFN.js +111 -0
  45. package/web/assets/index-uGqDxUnx.css +1 -0
  46. package/web/index.html +2 -2
@@ -0,0 +1,111 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/astro-HNnZUWAn.js","assets/json-Cp-IABpG.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-BjGOyj-B.js","assets/html-derivative-DlHx6ybY.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/sql-BLtJtn59.js","assets/coffee-Ch7k5sss.js","assets/cpp-CofmeUqb.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/haml-D5jkg6IW.js","assets/handlebars-BpdQsYii.js","assets/yaml-Buea-lGh.js","assets/http-jrhK8wxY.js","assets/shellscript-Yzrsuije.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-CxzCAyBv.js","assets/python-B6aJPvgy.js","assets/r-Dspwwk_N.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-DTYItulj.js","assets/markdown-Cvjx9yec.js","assets/php-R6g_5hLQ.js","assets/pug-DKIMFp6K.js","assets/svelte-Cy7k_4gC.js","assets/ts-tags-DQrlYJgV.js","assets/vue-D2xRrEX4.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js"])))=>i.map(i=>d[i]);
2
+ function Qj(e,t){for(var r=0;r<t.length;r++){const a=t[r];if(typeof a!="string"&&!Array.isArray(a)){for(const o in a)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(a,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>a[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(o){if(o.ep)return;o.ep=!0;const i=r(o);fetch(o.href,i)}})();function I_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ap={exports:{}},$i={};var Db;function Zj(){if(Db)return $i;Db=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,o,i){var u=null;if(i!==void 0&&(u=""+i),o.key!==void 0&&(u=""+o.key),"key"in o){i={};for(var f in o)f!=="key"&&(i[f]=o[f])}else i=o;return o=i.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:i}}return $i.Fragment=t,$i.jsx=r,$i.jsxs=r,$i}var Ob;function Jj(){return Ob||(Ob=1,Ap.exports=Zj()),Ap.exports}var c=Jj();const Ke=e=>typeof e=="string",Bi=()=>{let e,t;const r=new Promise((a,o)=>{e=a,t=o});return r.resolve=e,r.reject=t,r},Mb=e=>e==null?"":""+e,Wj=(e,t,r)=>{e.forEach(a=>{t[a]&&(r[a]=t[a])})},e2=/###/g,zb=e=>e&&e.indexOf("###")>-1?e.replace(e2,"."):e,$b=e=>!e||Ke(e),ll=(e,t,r)=>{const a=Ke(t)?t.split("."):t;let o=0;for(;o<a.length-1;){if($b(e))return{};const i=zb(a[o]);!e[i]&&r&&(e[i]=new r),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++o}return $b(e)?{}:{obj:e,k:zb(a[o])}},Bb=(e,t,r)=>{const{obj:a,k:o}=ll(e,t,Object);if(a!==void 0||t.length===1){a[o]=r;return}let i=t[t.length-1],u=t.slice(0,t.length-1),f=ll(e,u,Object);for(;f.obj===void 0&&u.length;)i=`${u[u.length-1]}.${i}`,u=u.slice(0,u.length-1),f=ll(e,u,Object),f?.obj&&typeof f.obj[`${f.k}.${i}`]<"u"&&(f.obj=void 0);f.obj[`${f.k}.${i}`]=r},t2=(e,t,r,a)=>{const{obj:o,k:i}=ll(e,t,Object);o[i]=o[i]||[],o[i].push(r)},Mu=(e,t)=>{const{obj:r,k:a}=ll(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,a))return r[a]},n2=(e,t,r)=>{const a=Mu(e,r);return a!==void 0?a:Mu(t,r)},U_=(e,t,r)=>{for(const a in t)a!=="__proto__"&&a!=="constructor"&&(a in e?Ke(e[a])||e[a]instanceof String||Ke(t[a])||t[a]instanceof String?r&&(e[a]=t[a]):U_(e[a],t[a],r):e[a]=t[a]);return e},Rs=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var r2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const a2=e=>Ke(e)?e.replace(/[&<>"'\/]/g,t=>r2[t]):e;class s2{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const r=this.regExpMap.get(t);if(r!==void 0)return r;const a=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,a),this.regExpQueue.push(t),a}}const o2=[" ",",","?","!",";"],i2=new s2(20),l2=(e,t,r)=>{t=t||"",r=r||"";const a=o2.filter(u=>t.indexOf(u)<0&&r.indexOf(u)<0);if(a.length===0)return!0;const o=i2.getRegExp(`(${a.map(u=>u==="?"?"\\?":u).join("|")})`);let i=!o.test(e);if(!i){const u=e.indexOf(r);u>0&&!o.test(e.substring(0,u))&&(i=!0)}return i},xh=(e,t,r=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const a=t.split(r);let o=e;for(let i=0;i<a.length;){if(!o||typeof o!="object")return;let u,f="";for(let h=i;h<a.length;++h)if(h!==i&&(f+=r),f+=a[h],u=o[f],u!==void 0){if(["string","number","boolean"].indexOf(typeof u)>-1&&h<a.length-1)continue;i+=h-i+1;break}o=u}return o},pl=e=>e?.replace("_","-"),c2={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class zu{constructor(t,r={}){this.init(t,r)}init(t,r={}){this.prefix=r.prefix||"i18next:",this.logger=t||c2,this.options=r,this.debug=r.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,a,o){return o&&!this.debug?null:(Ke(t[0])&&(t[0]=`${a}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new zu(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new zu(this.logger,t)}}var Kr=new zu;class rd{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(a=>{this.observers[a]||(this.observers[a]=new Map);const o=this.observers[a].get(r)||0;this.observers[a].set(r,o+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(r)}}emit(t,...r){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,i])=>{for(let u=0;u<i;u++)o(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,i])=>{for(let u=0;u<i;u++)o.apply(o,[t,...r])})}}class Ib extends rd{constructor(t,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,a,o={}){const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,u=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let f;t.indexOf(".")>-1?f=t.split("."):(f=[t,r],a&&(Array.isArray(a)?f.push(...a):Ke(a)&&i?f.push(...a.split(i)):f.push(a)));const h=Mu(this.data,f);return!h&&!r&&!a&&t.indexOf(".")>-1&&(t=f[0],r=f[1],a=f.slice(2).join(".")),h||!u||!Ke(a)?h:xh(this.data?.[t]?.[r],a,i)}addResource(t,r,a,o,i={silent:!1}){const u=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let f=[t,r];a&&(f=f.concat(u?a.split(u):a)),t.indexOf(".")>-1&&(f=t.split("."),o=r,r=f[1]),this.addNamespaces(r),Bb(this.data,f,o),i.silent||this.emit("added",t,r,a,o)}addResources(t,r,a,o={silent:!1}){for(const i in a)(Ke(a[i])||Array.isArray(a[i]))&&this.addResource(t,r,i,a[i],{silent:!0});o.silent||this.emit("added",t,r,a)}addResourceBundle(t,r,a,o,i,u={silent:!1,skipCopy:!1}){let f=[t,r];t.indexOf(".")>-1&&(f=t.split("."),o=a,a=r,r=f[1]),this.addNamespaces(r);let h=Mu(this.data,f)||{};u.skipCopy||(a=JSON.parse(JSON.stringify(a))),o?U_(h,a,i):h={...h,...a},Bb(this.data,f,h),u.silent||this.emit("added",t,r,a)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(o=>r[o]&&Object.keys(r[o]).length>0)}toJSON(){return this.data}}var P_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,a,o){return e.forEach(i=>{t=this.processors[i]?.process(t,r,a,o)??t}),t}};const H_=Symbol("i18next/PATH_KEY");function u2(){const e=[],t=Object.create(null);let r;return t.get=(a,o)=>(r?.revoke?.(),o===H_?e:(e.push(o),r=Proxy.revocable(a,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}function yh(e,t){const{[H_]:r}=e(u2());return r.join(t?.keySeparator??".")}const Ub={},Rp=e=>!Ke(e)&&typeof e!="boolean"&&typeof e!="number";class $u extends rd{constructor(t,r={}){super(),Wj(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Kr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,r={interpolation:{}}){const a={...r};if(t==null)return!1;const o=this.resolve(t,a);if(o?.res===void 0)return!1;const i=Rp(o.res);return!(a.returnObjects===!1&&i)}extractFromKey(t,r){let a=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;a===void 0&&(a=":");const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let i=r.ns||this.options.defaultNS||[];const u=a&&t.indexOf(a)>-1,f=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!l2(t,a,o);if(u&&!f){const h=t.match(this.interpolator.nestingRegexp);if(h&&h.length>0)return{key:t,namespaces:Ke(i)?[i]:i};const p=t.split(a);(a!==o||a===o&&this.options.ns.indexOf(p[0])>-1)&&(i=p.shift()),t=p.join(o)}return{key:t,namespaces:Ke(i)?[i]:i}}translate(t,r,a){let o=typeof r=="object"?{...r}:r;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),t==null)return"";typeof t=="function"&&(t=yh(t,{...this.options,...o})),Array.isArray(t)||(t=[String(t)]);const i=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:f,namespaces:h}=this.extractFromKey(t[t.length-1],o),p=h[h.length-1];let m=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;m===void 0&&(m=":");const x=o.lng||this.language,v=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(x?.toLowerCase()==="cimode")return v?i?{res:`${p}${m}${f}`,usedKey:f,exactUsedKey:f,usedLng:x,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${m}${f}`:i?{res:f,usedKey:f,exactUsedKey:f,usedLng:x,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:f;const _=this.resolve(t,o);let w=_?.res;const S=_?.usedKey||f,k=_?.exactUsedKey||f,N=["[object Number]","[object Function]","[object RegExp]"],A=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,D=o.count!==void 0&&!Ke(o.count),L=$u.hasDefaultValue(o),z=D?this.pluralResolver.getSuffix(x,o.count,o):"",$=o.ordinal&&D?this.pluralResolver.getSuffix(x,o.count,{ordinal:!1}):"",R=D&&!o.ordinal&&o.count===0,B=R&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${z}`]||o[`defaultValue${$}`]||o.defaultValue;let H=w;E&&!w&&L&&(H=B);const J=Rp(H),oe=Object.prototype.toString.apply(H);if(E&&H&&J&&N.indexOf(oe)<0&&!(Ke(A)&&Array.isArray(H))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ce=this.options.returnedObjectHandler?this.options.returnedObjectHandler(S,H,{...o,ns:h}):`key '${f} (${this.language})' returned an object instead of string.`;return i?(_.res=ce,_.usedParams=this.getUsedParamsDetails(o),_):ce}if(u){const ce=Array.isArray(H),M=ce?[]:{},P=ce?k:S;for(const T in H)if(Object.prototype.hasOwnProperty.call(H,T)){const F=`${P}${u}${T}`;L&&!w?M[T]=this.translate(F,{...o,defaultValue:Rp(B)?B[T]:void 0,joinArrays:!1,ns:h}):M[T]=this.translate(F,{...o,joinArrays:!1,ns:h}),M[T]===F&&(M[T]=H[T])}w=M}}else if(E&&Ke(A)&&Array.isArray(w))w=w.join(A),w&&(w=this.extendTranslation(w,t,o,a));else{let ce=!1,M=!1;!this.isValidLookup(w)&&L&&(ce=!0,w=B),this.isValidLookup(w)||(M=!0,w=f);const T=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&M?void 0:w,F=L&&B!==w&&this.options.updateMissing;if(M||ce||F){if(this.logger.log(F?"updateKey":"missingKey",x,p,f,F?B:w),u){const O=this.resolve(f,{...o,keySeparator:!1});O&&O.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ee=[];const ae=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ae&&ae[0])for(let O=0;O<ae.length;O++)ee.push(ae[O]);else this.options.saveMissingTo==="all"?ee=this.languageUtils.toResolveHierarchy(o.lng||this.language):ee.push(o.lng||this.language);const W=(O,V,re)=>{const se=L&&re!==w?re:T;this.options.missingKeyHandler?this.options.missingKeyHandler(O,p,V,se,F,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(O,p,V,se,F,o),this.emit("missingKey",O,p,V,w)};this.options.saveMissing&&(this.options.saveMissingPlurals&&D?ee.forEach(O=>{const V=this.pluralResolver.getSuffixes(O,o);R&&o[`defaultValue${this.options.pluralSeparator}zero`]&&V.indexOf(`${this.options.pluralSeparator}zero`)<0&&V.push(`${this.options.pluralSeparator}zero`),V.forEach(re=>{W([O],f+re,o[`defaultValue${re}`]||B)})}):W(ee,f,B))}w=this.extendTranslation(w,t,o,_,a),M&&w===f&&this.options.appendNamespaceToMissingKey&&(w=`${p}${m}${f}`),(M||ce)&&this.options.parseMissingKeyHandler&&(w=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${m}${f}`:f,ce?w:void 0,o))}return i?(_.res=w,_.usedParams=this.getUsedParamsDetails(o),_):w}extendTranslation(t,r,a,o,i){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...a},a.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!a.skipInterpolation){a.interpolation&&this.interpolator.init({...a,interpolation:{...this.options.interpolation,...a.interpolation}});const h=Ke(t)&&(a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(h){const x=t.match(this.interpolator.nestingRegexp);p=x&&x.length}let m=a.replace&&!Ke(a.replace)?a.replace:a;if(this.options.interpolation.defaultVariables&&(m={...this.options.interpolation.defaultVariables,...m}),t=this.interpolator.interpolate(t,m,a.lng||this.language||o.usedLng,a),h){const x=t.match(this.interpolator.nestingRegexp),v=x&&x.length;p<v&&(a.nest=!1)}!a.lng&&o&&o.res&&(a.lng=this.language||o.usedLng),a.nest!==!1&&(t=this.interpolator.nest(t,(...x)=>i?.[0]===x[0]&&!a.context?(this.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${r[0]}`),null):this.translate(...x,r),a)),a.interpolation&&this.interpolator.reset()}const u=a.postProcess||this.options.postProcess,f=Ke(u)?[u]:u;return t!=null&&f?.length&&a.applyPostProcessor!==!1&&(t=P_.handle(f,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(a)},...a}:a,this)),t}resolve(t,r={}){let a,o,i,u,f;return Ke(t)&&(t=[t]),t.forEach(h=>{if(this.isValidLookup(a))return;const p=this.extractFromKey(h,r),m=p.key;o=m;let x=p.namespaces;this.options.fallbackNS&&(x=x.concat(this.options.fallbackNS));const v=r.count!==void 0&&!Ke(r.count),_=v&&!r.ordinal&&r.count===0,w=r.context!==void 0&&(Ke(r.context)||typeof r.context=="number")&&r.context!=="",S=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);x.forEach(k=>{this.isValidLookup(a)||(f=k,!Ub[`${S[0]}-${k}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(f)&&(Ub[`${S[0]}-${k}`]=!0,this.logger.warn(`key "${o}" for languages "${S.join(", ")}" won't get resolved as namespace "${f}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),S.forEach(N=>{if(this.isValidLookup(a))return;u=N;const A=[m];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(A,m,N,k,r);else{let D;v&&(D=this.pluralResolver.getSuffix(N,r.count,r));const L=`${this.options.pluralSeparator}zero`,z=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(r.ordinal&&D.indexOf(z)===0&&A.push(m+D.replace(z,this.options.pluralSeparator)),A.push(m+D),_&&A.push(m+L)),w){const $=`${m}${this.options.contextSeparator||"_"}${r.context}`;A.push($),v&&(r.ordinal&&D.indexOf(z)===0&&A.push($+D.replace(z,this.options.pluralSeparator)),A.push($+D),_&&A.push($+L))}}let E;for(;E=A.pop();)this.isValidLookup(a)||(i=E,a=this.getResource(N,k,E,r))}))})}),{res:a,usedKey:o,exactUsedKey:i,usedLng:u,usedNS:f}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,a,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,r,a,o):this.resourceStore.getResource(t,r,a,o)}getUsedParamsDetails(t={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],a=t.replace&&!Ke(t.replace);let o=a?t.replace:t;if(a&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!a){o={...o};for(const i of r)delete o[i]}return o}static hasDefaultValue(t){const r="defaultValue";for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r===a.substring(0,r.length)&&t[a]!==void 0)return!0;return!1}}class Pb{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Kr.create("languageUtils")}getScriptPartFromCode(t){if(t=pl(t),!t||t.indexOf("-")<0)return null;const r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=pl(t),!t||t.indexOf("-")<0)return t;const r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(Ke(t)&&t.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(t)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(a=>{if(r)return;const o=this.formatLanguageCode(a);(!this.options.supportedLngs||this.isSupportedCode(o))&&(r=o)}),!r&&this.options.supportedLngs&&t.forEach(a=>{if(r)return;const o=this.getScriptPartFromCode(a);if(this.isSupportedCode(o))return r=o;const i=this.getLanguagePartFromCode(a);if(this.isSupportedCode(i))return r=i;r=this.options.supportedLngs.find(u=>{if(u===i)return u;if(!(u.indexOf("-")<0&&i.indexOf("-")<0)&&(u.indexOf("-")>0&&i.indexOf("-")<0&&u.substring(0,u.indexOf("-"))===i||u.indexOf(i)===0&&i.length>1))return u})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),Ke(t)&&(t=[t]),Array.isArray(t))return t;if(!r)return t.default||[];let a=t[r];return a||(a=t[this.getScriptPartFromCode(r)]),a||(a=t[this.formatLanguageCode(r)]),a||(a=t[this.getLanguagePartFromCode(r)]),a||(a=t.default),a||[]}toResolveHierarchy(t,r){const a=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],t),o=[],i=u=>{u&&(this.isSupportedCode(u)?o.push(u):this.logger.warn(`rejecting language code not found in supportedLngs: ${u}`))};return Ke(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):Ke(t)&&i(this.formatLanguageCode(t)),a.forEach(u=>{o.indexOf(u)<0&&i(this.formatLanguageCode(u))}),o}}const Hb={zero:0,one:1,two:2,few:3,many:4,other:5},qb={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class d2{constructor(t,r={}){this.languageUtils=t,this.options=r,this.logger=Kr.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,r={}){const a=pl(t==="dev"?"en":t),o=r.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:a,type:o});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let u;try{u=new Intl.PluralRules(a,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),qb;if(!t.match(/-|_/))return qb;const h=this.languageUtils.getLanguagePartFromCode(t);u=this.getRule(h,r)}return this.pluralRulesCache[i]=u,u}needsPlural(t,r={}){let a=this.getRule(t,r);return a||(a=this.getRule("dev",r)),a?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,r,a={}){return this.getSuffixes(t,a).map(o=>`${r}${o}`)}getSuffixes(t,r={}){let a=this.getRule(t,r);return a||(a=this.getRule("dev",r)),a?a.resolvedOptions().pluralCategories.sort((o,i)=>Hb[o]-Hb[i]).map(o=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,r,a={}){const o=this.getRule(t,a);return o?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o.select(r)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",r,a))}}const Fb=(e,t,r,a=".",o=!0)=>{let i=n2(e,t,r);return!i&&o&&Ke(r)&&(i=xh(e,r,a),i===void 0&&(i=xh(t,r,a))),i},Tp=e=>e.replace(/\$/g,"$$$$");class Gb{constructor(t={}){this.logger=Kr.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:r,escapeValue:a,useRawValueToEscape:o,prefix:i,prefixEscaped:u,suffix:f,suffixEscaped:h,formatSeparator:p,unescapeSuffix:m,unescapePrefix:x,nestingPrefix:v,nestingPrefixEscaped:_,nestingSuffix:w,nestingSuffixEscaped:S,nestingOptionsSeparator:k,maxReplaces:N,alwaysFormat:A}=t.interpolation;this.escape=r!==void 0?r:a2,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=i?Rs(i):u||"{{",this.suffix=f?Rs(f):h||"}}",this.formatSeparator=p||",",this.unescapePrefix=m?"":x||"-",this.unescapeSuffix=this.unescapePrefix?"":m||"",this.nestingPrefix=v?Rs(v):_||Rs("$t("),this.nestingSuffix=w?Rs(w):S||Rs(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=N||1e3,this.alwaysFormat=A!==void 0?A:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(r,a)=>r?.source===a?(r.lastIndex=0,r):new RegExp(a,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,r,a,o){let i,u,f;const h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=_=>{if(_.indexOf(this.formatSeparator)<0){const N=Fb(r,h,_,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(N,void 0,a,{...o,...r,interpolationkey:_}):N}const w=_.split(this.formatSeparator),S=w.shift().trim(),k=w.join(this.formatSeparator).trim();return this.format(Fb(r,h,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,a,{...o,...r,interpolationkey:S})};this.resetRegExp();const m=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,x=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:_=>Tp(_)},{regex:this.regexp,safeValue:_=>this.escapeValue?Tp(this.escape(_)):Tp(_)}].forEach(_=>{for(f=0;i=_.regex.exec(t);){const w=i[1].trim();if(u=p(w),u===void 0)if(typeof m=="function"){const k=m(t,i,o);u=Ke(k)?k:""}else if(o&&Object.prototype.hasOwnProperty.call(o,w))u="";else if(x){u=i[0];continue}else this.logger.warn(`missed to pass in variable ${w} for interpolating ${t}`),u="";else!Ke(u)&&!this.useRawValueToEscape&&(u=Mb(u));const S=_.safeValue(u);if(t=t.replace(i[0],S),x?(_.regex.lastIndex+=u.length,_.regex.lastIndex-=i[0].length):_.regex.lastIndex=0,f++,f>=this.maxReplaces)break}}),t}nest(t,r,a={}){let o,i,u;const f=(h,p)=>{const m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;const x=h.split(new RegExp(`${Rs(m)}[ ]*{`));let v=`{${x[1]}`;h=x[0],v=this.interpolate(v,u);const _=v.match(/'/g),w=v.match(/"/g);((_?.length??0)%2===0&&!w||(w?.length??0)%2!==0)&&(v=v.replace(/'/g,'"'));try{u=JSON.parse(v),p&&(u={...p,...u})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${h}`,S),`${h}${m}${v}`}return u.defaultValue&&u.defaultValue.indexOf(this.prefix)>-1&&delete u.defaultValue,h};for(;o=this.nestingRegexp.exec(t);){let h=[];u={...a},u=u.replace&&!Ke(u.replace)?u.replace:u,u.applyPostProcessor=!1,delete u.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(h=o[1].slice(p).split(this.formatSeparator).map(m=>m.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),i=r(f.call(this,o[1].trim(),u),u),i&&o[0]===t&&!Ke(i))return i;Ke(i)||(i=Mb(i)),i||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),i=""),h.length&&(i=h.reduce((m,x)=>this.format(m,x,a.lng,{...a,interpolationkey:o[1].trim()}),i.trim())),t=t.replace(o[0],i),this.regexp.lastIndex=0}return t}}const f2=e=>{let t=e.toLowerCase().trim();const r={};if(e.indexOf("(")>-1){const a=e.split("(");t=a[0].toLowerCase().trim();const o=a[1].substring(0,a[1].length-1);t==="currency"&&o.indexOf(":")<0?r.currency||(r.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?r.range||(r.range=o.trim()):o.split(";").forEach(u=>{if(u){const[f,...h]=u.split(":"),p=h.join(":").trim().replace(/^'+|'+$/g,""),m=f.trim();r[m]||(r[m]=p),p==="false"&&(r[m]=!1),p==="true"&&(r[m]=!0),isNaN(p)||(r[m]=parseInt(p,10))}})}return{formatName:t,formatOptions:r}},Vb=e=>{const t={};return(r,a,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const u=a+JSON.stringify(i);let f=t[u];return f||(f=e(pl(a),o),t[u]=f),f(r)}},p2=e=>(t,r,a)=>e(pl(r),a)(t);class h2{constructor(t={}){this.logger=Kr.create("formatter"),this.options=t,this.init(t)}init(t,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const a=r.cacheInBuiltFormats?Vb:p2;this.formats={number:a((o,i)=>{const u=new Intl.NumberFormat(o,{...i});return f=>u.format(f)}),currency:a((o,i)=>{const u=new Intl.NumberFormat(o,{...i,style:"currency"});return f=>u.format(f)}),datetime:a((o,i)=>{const u=new Intl.DateTimeFormat(o,{...i});return f=>u.format(f)}),relativetime:a((o,i)=>{const u=new Intl.RelativeTimeFormat(o,{...i});return f=>u.format(f,i.range||"day")}),list:a((o,i)=>{const u=new Intl.ListFormat(o,{...i});return f=>u.format(f)})}}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=Vb(r)}format(t,r,a,o={}){const i=r.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(f=>f.indexOf(")")>-1)){const f=i.findIndex(h=>h.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,f)].join(this.formatSeparator)}return i.reduce((f,h)=>{const{formatName:p,formatOptions:m}=f2(h);if(this.formats[p]){let x=f;try{const v=o?.formatParams?.[o.interpolationkey]||{},_=v.locale||v.lng||o.locale||o.lng||a;x=this.formats[p](f,_,{...m,...o,...v})}catch(v){this.logger.warn(v)}return x}else this.logger.warn(`there was no format function for ${p}`);return f},t)}}const m2=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class g2 extends rd{constructor(t,r,a,o={}){super(),this.backend=t,this.store=r,this.services=a,this.languageUtils=a.languageUtils,this.options=o,this.logger=Kr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(a,o.backend,o)}queueLoad(t,r,a,o){const i={},u={},f={},h={};return t.forEach(p=>{let m=!0;r.forEach(x=>{const v=`${p}|${x}`;!a.reload&&this.store.hasResourceBundle(p,x)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?u[v]===void 0&&(u[v]=!0):(this.state[v]=1,m=!1,u[v]===void 0&&(u[v]=!0),i[v]===void 0&&(i[v]=!0),h[x]===void 0&&(h[x]=!0)))}),m||(f[p]=!0)}),(Object.keys(i).length||Object.keys(u).length)&&this.queue.push({pending:u,pendingCount:Object.keys(u).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(i),pending:Object.keys(u),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(h)}}loaded(t,r,a){const o=t.split("|"),i=o[0],u=o[1];r&&this.emit("failedLoading",i,u,r),!r&&a&&this.store.addResourceBundle(i,u,a,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&a&&(this.state[t]=0);const f={};this.queue.forEach(h=>{t2(h.loaded,[i],u),m2(h,t),r&&h.errors.push(r),h.pendingCount===0&&!h.done&&(Object.keys(h.loaded).forEach(p=>{f[p]||(f[p]={});const m=h.loaded[p];m.length&&m.forEach(x=>{f[p][x]===void 0&&(f[p][x]=!0)})}),h.done=!0,h.errors.length?h.callback(h.errors):h.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(h=>!h.done)}read(t,r,a,o=0,i=this.retryTimeout,u){if(!t.length)return u(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:a,tried:o,wait:i,callback:u});return}this.readingCalls++;const f=(p,m)=>{if(this.readingCalls--,this.waitingReads.length>0){const x=this.waitingReads.shift();this.read(x.lng,x.ns,x.fcName,x.tried,x.wait,x.callback)}if(p&&m&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,a,o+1,i*2,u)},i);return}u(p,m)},h=this.backend[a].bind(this.backend);if(h.length===2){try{const p=h(t,r);p&&typeof p.then=="function"?p.then(m=>f(null,m)).catch(f):f(null,p)}catch(p){f(p)}return}return h(t,r,f)}prepareLoading(t,r,a={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();Ke(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Ke(r)&&(r=[r]);const i=this.queueLoad(t,r,a,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach(u=>{this.loadOne(u)})}load(t,r,a){this.prepareLoading(t,r,{},a)}reload(t,r,a){this.prepareLoading(t,r,{reload:!0},a)}loadOne(t,r=""){const a=t.split("|"),o=a[0],i=a[1];this.read(o,i,"read",void 0,void 0,(u,f)=>{u&&this.logger.warn(`${r}loading namespace ${i} for language ${o} failed`,u),!u&&f&&this.logger.log(`${r}loaded namespace ${i} for language ${o}`,f),this.loaded(t,u,f)})}saveMissing(t,r,a,o,i,u={},f=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${a}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(a==null||a==="")){if(this.backend?.create){const h={...u,isUpdate:i},p=this.backend.create.bind(this.backend);if(p.length<6)try{let m;p.length===5?m=p(t,r,a,o,h):m=p(t,r,a,o),m&&typeof m.then=="function"?m.then(x=>f(null,x)).catch(f):f(null,m)}catch(m){f(m)}else p(t,r,a,o,f,h)}!t||!t[0]||this.store.addResource(t[0],r,a,o)}}}const Lp=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Ke(e[1])&&(t.defaultValue=e[1]),Ke(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(a=>{t[a]=r[a]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Yb=e=>(Ke(e.ns)&&(e.ns=[e.ns]),Ke(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ke(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),ru=()=>{},x2=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})},q_="__i18next_supportNoticeShown",y2=()=>typeof globalThis<"u"&&!!globalThis[q_],b2=()=>{typeof globalThis<"u"&&(globalThis[q_]=!0)},v2=e=>!!(e?.modules?.backend?.name?.indexOf("Locize")>0||e?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||e?.options?.backend?.backends&&e.options.backend.backends.some(t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(t=>t?.projectId));class cl extends rd{constructor(t={},r){if(super(),this.options=Yb(t),this.services={},this.logger=Kr,this.modules={external:[]},x2(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(t={},r){this.isInitializing=!0,typeof t=="function"&&(r=t,t={}),t.defaultNS==null&&t.ns&&(Ke(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const a=Lp();this.options={...a,...this.options,...Yb(t)},this.options.interpolation={...a.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=a.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!v2(this)&&!y2()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),b2());const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?Kr.init(o(this.modules.logger),this.options):Kr.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=h2;const m=new Pb(this.options);this.store=new Ib(this.options.resources,this.options);const x=this.services;x.logger=Kr,x.resourceStore=this.store,x.languageUtils=m,x.pluralResolver=new d2(m,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==a.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(x.formatter=o(p),x.formatter.init&&x.formatter.init(x,this.options),this.options.interpolation.format=x.formatter.format.bind(x.formatter)),x.interpolator=new Gb(this.options),x.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},x.backendConnector=new g2(o(this.modules.backend),x.resourceStore,x,this.options),x.backendConnector.on("*",(_,...w)=>{this.emit(_,...w)}),this.modules.languageDetector&&(x.languageDetector=o(this.modules.languageDetector),x.languageDetector.init&&x.languageDetector.init(x,this.options.detection,this.options)),this.modules.i18nFormat&&(x.i18nFormat=o(this.modules.i18nFormat),x.i18nFormat.init&&x.i18nFormat.init(this)),this.translator=new $u(this.services,this.options),this.translator.on("*",(_,...w)=>{this.emit(_,...w)}),this.modules.external.forEach(_=>{_.init&&_.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ru),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...m)=>this.store[p](...m)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...m)=>(this.store[p](...m),this)});const f=Bi(),h=()=>{const p=(m,x)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),f.resolve(x),r(m,x)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?h():setTimeout(h,0),f}loadResources(t,r=ru){let a=r;const o=Ke(t)?t:this.language;if(typeof t=="function"&&(a=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return a();const i=[],u=f=>{if(!f||f==="cimode")return;this.services.languageUtils.toResolveHierarchy(f).forEach(p=>{p!=="cimode"&&i.indexOf(p)<0&&i.push(p)})};o?u(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>u(h)),this.options.preload?.forEach?.(f=>u(f)),this.services.backendConnector.load(i,this.options.ns,f=>{!f&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),a(f)})}else a(null)}reloadResources(t,r,a){const o=Bi();return typeof t=="function"&&(a=t,t=void 0),typeof r=="function"&&(a=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),a||(a=ru),this.services.backendConnector.reload(t,r,i=>{o.resolve(),a(i)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&P_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let r=0;r<this.languages.length;r++){const a=this.languages[r];if(!(["cimode","dev"].indexOf(a)>-1)&&this.store.hasLanguageSomeTranslations(a)){this.resolvedLanguage=a;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,r){this.isLanguageChangingTo=t;const a=Bi();this.emit("languageChanging",t);const o=f=>{this.language=f,this.languages=this.services.languageUtils.toResolveHierarchy(f),this.resolvedLanguage=void 0,this.setResolvedLanguage(f)},i=(f,h)=>{h?this.isLanguageChangingTo===t&&(o(h),this.translator.changeLanguage(h),this.isLanguageChangingTo=void 0,this.emit("languageChanged",h),this.logger.log("languageChanged",h)):this.isLanguageChangingTo=void 0,a.resolve((...p)=>this.t(...p)),r&&r(f,(...p)=>this.t(...p))},u=f=>{!t&&!f&&this.services.languageDetector&&(f=[]);const h=Ke(f)?f:f&&f[0],p=this.store.hasLanguageSomeTranslations(h)?h:this.services.languageUtils.getBestMatchFromCodes(Ke(f)?[f]:f);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,m=>{i(m,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),a}getFixedT(t,r,a){const o=(i,u,...f)=>{let h;typeof u!="object"?h=this.options.overloadTranslationOptionHandler([i,u].concat(f)):h={...u},h.lng=h.lng||o.lng,h.lngs=h.lngs||o.lngs,h.ns=h.ns||o.ns,h.keyPrefix!==""&&(h.keyPrefix=h.keyPrefix||a||o.keyPrefix);const p=this.options.keySeparator||".";let m;return h.keyPrefix&&Array.isArray(i)?m=i.map(x=>(typeof x=="function"&&(x=yh(x,{...this.options,...u})),`${h.keyPrefix}${p}${x}`)):(typeof i=="function"&&(i=yh(i,{...this.options,...u})),m=h.keyPrefix?`${h.keyPrefix}${p}${i}`:i),this.t(m,h)};return Ke(t)?o.lng=t:o.lngs=t,o.ns=r,o.keyPrefix=a,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=r.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;const u=(f,h)=>{const p=this.services.backendConnector.state[`${f}|${h}`];return p===-1||p===0||p===2};if(r.precheck){const f=r.precheck(this,u);if(f!==void 0)return f}return!!(this.hasResourceBundle(a,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||u(a,t)&&(!o||u(i,t)))}loadNamespaces(t,r){const a=Bi();return this.options.ns?(Ke(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{a.resolve(),r&&r(o)}),a):(r&&r(),Promise.resolve())}loadLanguages(t,r){const a=Bi();Ke(t)&&(t=[t]);const o=this.options.preload||[],i=t.filter(u=>o.indexOf(u)<0&&this.services.languageUtils.isSupportedCode(u));return i.length?(this.options.preload=o.concat(i),this.loadResources(u=>{a.resolve(),r&&r(u)}),a):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const i=o.getTextInfo();if(i&&i.direction)return i.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],a=this.services?.languageUtils||new Pb(Lp());return t.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(a.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},r){const a=new cl(t,r);return a.createInstance=cl.createInstance,a}cloneInstance(t={},r=ru){const a=t.forkResourceStore;a&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},i=new cl(o);if((t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(f=>{i[f]=this[f]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},a){const f=Object.keys(this.store.data).reduce((h,p)=>(h[p]={...this.store.data[p]},h[p]=Object.keys(h[p]).reduce((m,x)=>(m[x]={...h[p][x]},m),h[p]),h),{});i.store=new Ib(f,o),i.services.resourceStore=i.store}if(t.interpolation){const h={...Lp().interpolation,...this.options.interpolation,...t.interpolation},p={...o,interpolation:h};i.services.interpolator=new Gb(p)}return i.translator=new $u(i.services,o),i.translator.on("*",(f,...h)=>{i.emit(f,...h)}),i.init(o,r),i.translator.options=o,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Cn=cl.createInstance();Cn.createInstance;Cn.dir;Cn.init;Cn.loadResources;Cn.reloadResources;Cn.use;Cn.changeLanguage;Cn.getFixedT;Cn.t;Cn.exists;Cn.setDefaultNamespace;Cn.hasLoadedNamespace;Cn.loadNamespaces;Cn.loadLanguages;var Dp={exports:{}},Qe={};var Kb;function _2(){if(Kb)return Qe;Kb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),v=Symbol.iterator;function _(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,k={};function N(O,V,re){this.props=O,this.context=V,this.refs=k,this.updater=re||w}N.prototype.isReactComponent={},N.prototype.setState=function(O,V){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,V,"setState")},N.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function A(){}A.prototype=N.prototype;function E(O,V,re){this.props=O,this.context=V,this.refs=k,this.updater=re||w}var D=E.prototype=new A;D.constructor=E,S(D,N.prototype),D.isPureReactComponent=!0;var L=Array.isArray;function z(){}var $={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function B(O,V,re){var se=re.ref;return{$$typeof:e,type:O,key:V,ref:se!==void 0?se:null,props:re}}function H(O,V){return B(O.type,V,O.props)}function J(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function oe(O){var V={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(re){return V[re]})}var ce=/\/+/g;function M(O,V){return typeof O=="object"&&O!==null&&O.key!=null?oe(""+O.key):V.toString(36)}function P(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(z,z):(O.status="pending",O.then(function(V){O.status==="pending"&&(O.status="fulfilled",O.value=V)},function(V){O.status==="pending"&&(O.status="rejected",O.reason=V)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function T(O,V,re,se,ne){var ge=typeof O;(ge==="undefined"||ge==="boolean")&&(O=null);var Ne=!1;if(O===null)Ne=!0;else switch(ge){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(O.$$typeof){case e:case t:Ne=!0;break;case m:return Ne=O._init,T(Ne(O._payload),V,re,se,ne)}}if(Ne)return ne=ne(O),Ne=se===""?"."+M(O,0):se,L(ne)?(re="",Ne!=null&&(re=Ne.replace(ce,"$&/")+"/"),T(ne,V,re,"",function(be){return be})):ne!=null&&(J(ne)&&(ne=H(ne,re+(ne.key==null||O&&O.key===ne.key?"":(""+ne.key).replace(ce,"$&/")+"/")+Ne)),V.push(ne)),1;Ne=0;var Fe=se===""?".":se+":";if(L(O))for(var qe=0;qe<O.length;qe++)se=O[qe],ge=Fe+M(se,qe),Ne+=T(se,V,re,ge,ne);else if(qe=_(O),typeof qe=="function")for(O=qe.call(O),qe=0;!(se=O.next()).done;)se=se.value,ge=Fe+M(se,qe++),Ne+=T(se,V,re,ge,ne);else if(ge==="object"){if(typeof O.then=="function")return T(P(O),V,re,se,ne);throw V=String(O),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function F(O,V,re){if(O==null)return O;var se=[],ne=0;return T(O,se,"","",function(ge){return V.call(re,ge,ne++)}),se}function ee(O){if(O._status===-1){var V=O._result;V=V(),V.then(function(re){(O._status===0||O._status===-1)&&(O._status=1,O._result=re)},function(re){(O._status===0||O._status===-1)&&(O._status=2,O._result=re)}),O._status===-1&&(O._status=0,O._result=V)}if(O._status===1)return O._result.default;throw O._result}var ae=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},W={map:F,forEach:function(O,V,re){F(O,function(){V.apply(this,arguments)},re)},count:function(O){var V=0;return F(O,function(){V++}),V},toArray:function(O){return F(O,function(V){return V})||[]},only:function(O){if(!J(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Qe.Activity=x,Qe.Children=W,Qe.Component=N,Qe.Fragment=r,Qe.Profiler=o,Qe.PureComponent=E,Qe.StrictMode=a,Qe.Suspense=h,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(O){return $.H.useMemoCache(O)}},Qe.cache=function(O){return function(){return O.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(O,V,re){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var se=S({},O.props),ne=O.key;if(V!=null)for(ge in V.key!==void 0&&(ne=""+V.key),V)!R.call(V,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&V.ref===void 0||(se[ge]=V[ge]);var ge=arguments.length-2;if(ge===1)se.children=re;else if(1<ge){for(var Ne=Array(ge),Fe=0;Fe<ge;Fe++)Ne[Fe]=arguments[Fe+2];se.children=Ne}return B(O.type,ne,se)},Qe.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:i,_context:O},O},Qe.createElement=function(O,V,re){var se,ne={},ge=null;if(V!=null)for(se in V.key!==void 0&&(ge=""+V.key),V)R.call(V,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(ne[se]=V[se]);var Ne=arguments.length-2;if(Ne===1)ne.children=re;else if(1<Ne){for(var Fe=Array(Ne),qe=0;qe<Ne;qe++)Fe[qe]=arguments[qe+2];ne.children=Fe}if(O&&O.defaultProps)for(se in Ne=O.defaultProps,Ne)ne[se]===void 0&&(ne[se]=Ne[se]);return B(O,ge,ne)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(O){return{$$typeof:f,render:O}},Qe.isValidElement=J,Qe.lazy=function(O){return{$$typeof:m,_payload:{_status:-1,_result:O},_init:ee}},Qe.memo=function(O,V){return{$$typeof:p,type:O,compare:V===void 0?null:V}},Qe.startTransition=function(O){var V=$.T,re={};$.T=re;try{var se=O(),ne=$.S;ne!==null&&ne(re,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(z,ae)}catch(ge){ae(ge)}finally{V!==null&&re.types!==null&&(V.types=re.types),$.T=V}},Qe.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Qe.use=function(O){return $.H.use(O)},Qe.useActionState=function(O,V,re){return $.H.useActionState(O,V,re)},Qe.useCallback=function(O,V){return $.H.useCallback(O,V)},Qe.useContext=function(O){return $.H.useContext(O)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(O,V){return $.H.useDeferredValue(O,V)},Qe.useEffect=function(O,V){return $.H.useEffect(O,V)},Qe.useEffectEvent=function(O){return $.H.useEffectEvent(O)},Qe.useId=function(){return $.H.useId()},Qe.useImperativeHandle=function(O,V,re){return $.H.useImperativeHandle(O,V,re)},Qe.useInsertionEffect=function(O,V){return $.H.useInsertionEffect(O,V)},Qe.useLayoutEffect=function(O,V){return $.H.useLayoutEffect(O,V)},Qe.useMemo=function(O,V){return $.H.useMemo(O,V)},Qe.useOptimistic=function(O,V){return $.H.useOptimistic(O,V)},Qe.useReducer=function(O,V,re){return $.H.useReducer(O,V,re)},Qe.useRef=function(O){return $.H.useRef(O)},Qe.useState=function(O){return $.H.useState(O)},Qe.useSyncExternalStore=function(O,V,re){return $.H.useSyncExternalStore(O,V,re)},Qe.useTransition=function(){return $.H.useTransition()},Qe.version="19.2.4",Qe}var Xb;function ad(){return Xb||(Xb=1,Dp.exports=_2()),Dp.exports}var b=ad();const Do=I_(b),w2=Qj({__proto__:null,default:Do},[b]),S2=(e,t,r,a)=>{const o=[r,{code:t,...a||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Us(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},Qb={},F_=(e,t,r,a)=>{Us(r)&&Qb[r]||(Us(r)&&(Qb[r]=new Date),S2(e,t,r,a))},G_=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},bh=(e,t,r)=>{e.loadNamespaces(t,G_(e,r))},Zb=(e,t,r,a)=>{if(Us(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return bh(e,r,a);r.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,G_(e,a))},j2=(e,t,r={})=>!t.languages||!t.languages.length?(F_(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(a,o)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!o(a.isLanguageChangingTo,e))return!1}}),Us=e=>typeof e=="string",k2=e=>typeof e=="object"&&e!==null,N2=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,E2={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},C2=e=>E2[e],A2=e=>e.replace(N2,C2);let vh={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:A2,transDefaultProps:void 0};const R2=(e={})=>{vh={...vh,...e}},T2=()=>vh;let V_;const L2=e=>{V_=e},D2=()=>V_,O2={type:"3rdParty",init(e){R2(e.options.react),L2(e)}},M2=b.createContext();class z2{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Op={exports:{}},Mp={};var Jb;function $2(){if(Jb)return Mp;Jb=1;var e=ad();function t(x,v){return x===v&&(x!==0||1/x===1/v)||x!==x&&v!==v}var r=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,i=e.useLayoutEffect,u=e.useDebugValue;function f(x,v){var _=v(),w=a({inst:{value:_,getSnapshot:v}}),S=w[0].inst,k=w[1];return i(function(){S.value=_,S.getSnapshot=v,h(S)&&k({inst:S})},[x,_,v]),o(function(){return h(S)&&k({inst:S}),x(function(){h(S)&&k({inst:S})})},[x]),u(_),_}function h(x){var v=x.getSnapshot;x=x.value;try{var _=v();return!r(x,_)}catch{return!0}}function p(x,v){return v()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:f;return Mp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Mp}var Wb;function B2(){return Wb||(Wb=1,Op.exports=$2()),Op.exports}var I2=B2();const U2=(e,t)=>Us(t)?t:k2(t)&&Us(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,P2={t:U2,ready:!1},H2=()=>()=>{},ye=(e,t={})=>{const{i18n:r}=t,{i18n:a,defaultNS:o}=b.useContext(M2)||{},i=r||a||D2();i&&!i.reportNamespaces&&(i.reportNamespaces=new z2),i||F_(i,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const u=b.useMemo(()=>({...T2(),...i?.options?.react,...t}),[i,t]),{useSuspense:f,keyPrefix:h}=u,p=o||i?.options?.defaultNS,m=Us(p)?[p]:p||["translation"],x=b.useMemo(()=>m,m);i?.reportNamespaces?.addUsedNamespaces?.(x);const v=b.useRef(0),_=b.useCallback(B=>{if(!i)return H2;const{bindI18n:H,bindI18nStore:J}=u,oe=()=>{v.current+=1,B()};return H&&i.on(H,oe),J&&i.store.on(J,oe),()=>{H&&H.split(" ").forEach(ce=>i.off(ce,oe)),J&&J.split(" ").forEach(ce=>i.store.off(ce,oe))}},[i,u]),w=b.useRef(),S=b.useCallback(()=>{if(!i)return P2;const B=!!(i.isInitialized||i.initializedStoreOnce)&&x.every(P=>j2(P,i,u)),H=t.lng||i.language,J=v.current,oe=w.current;if(oe&&oe.ready===B&&oe.lng===H&&oe.keyPrefix===h&&oe.revision===J)return oe;const M={t:i.getFixedT(H,u.nsMode==="fallback"?x:x[0],h),ready:B,lng:H,keyPrefix:h,revision:J};return w.current=M,M},[i,x,h,u,t.lng]),[k,N]=b.useState(0),{t:A,ready:E}=I2.useSyncExternalStore(_,S,S);b.useEffect(()=>{if(i&&!E&&!f){const B=()=>N(H=>H+1);t.lng?Zb(i,t.lng,x,B):bh(i,x,B)}},[i,t.lng,x,E,f,k]);const D=i||{},L=b.useRef(null),z=b.useRef(),$=B=>{const H=Object.getOwnPropertyDescriptors(B);H.__original&&delete H.__original;const J=Object.create(Object.getPrototypeOf(B),H);if(!Object.prototype.hasOwnProperty.call(J,"__original"))try{Object.defineProperty(J,"__original",{value:B,writable:!1,enumerable:!1,configurable:!1})}catch{}return J},R=b.useMemo(()=>{const B=D,H=B?.language;let J=B;B&&(L.current&&L.current.__original===B?z.current!==H?(J=$(B),L.current=J,z.current=H):J=L.current:(J=$(B),L.current=J,z.current=H));const oe=[A,J,E];return oe.t=A,oe.i18n=J,oe.ready=E,oe},[A,D,E,D.resolvedLanguage,D.language,D.languages]);if(i&&f&&!E)throw new Promise(B=>{const H=()=>B();t.lng?Zb(i,t.lng,x,H):bh(i,x,H)});return R},{slice:q2,forEach:F2}=[];function G2(e){return F2.call(q2.call(arguments,1),t=>{if(t)for(const r in t)e[r]===void 0&&(e[r]=t[r])}),e}function V2(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(e))}const e0=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Y2=function(e,t){const a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},o=encodeURIComponent(t);let i=`${e}=${o}`;if(a.maxAge>0){const u=a.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(u)}`}if(a.domain){if(!e0.test(a.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${a.domain}`}if(a.path){if(!e0.test(a.path))throw new TypeError("option path is invalid");i+=`; Path=${a.path}`}if(a.expires){if(typeof a.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${a.expires.toUTCString()}`}if(a.httpOnly&&(i+="; HttpOnly"),a.secure&&(i+="; Secure"),a.sameSite)switch(typeof a.sameSite=="string"?a.sameSite.toLowerCase():a.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return a.partitioned&&(i+="; Partitioned"),i},t0={create(e,t,r,a){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),a&&(o.domain=a),document.cookie=Y2(e,t,o)},read(e){const t=`${e}=`,r=document.cookie.split(";");for(let a=0;a<r.length;a++){let o=r[a];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var K2={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return t0.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:r,cookieMinutes:a,cookieDomain:o,cookieOptions:i}=t;r&&typeof document<"u"&&t0.create(r,e,a,o,i)}},X2={name:"querystring",lookup(e){let{lookupQuerystring:t}=e,r;if(typeof window<"u"){let{search:a}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(a=window.location.hash.substring(window.location.hash.indexOf("?")));const i=a.substring(1).split("&");for(let u=0;u<i.length;u++){const f=i[u].indexOf("=");f>0&&i[u].substring(0,f)===t&&(r=i[u].substring(f+1))}}return r}},Q2={name:"hash",lookup(e){let{lookupHash:t,lookupFromHashIndex:r}=e,a;if(typeof window<"u"){const{hash:o}=window.location;if(o&&o.length>2){const i=o.substring(1);if(t){const u=i.split("&");for(let f=0;f<u.length;f++){const h=u[f].indexOf("=");h>0&&u[f].substring(0,h)===t&&(a=u[f].substring(h+1))}}if(a)return a;if(!a&&r>-1){const u=o.match(/\/([a-zA-Z-]*)/g);return Array.isArray(u)?u[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return a}};let Co=null;const n0=()=>{if(Co!==null)return Co;try{if(Co=typeof window<"u"&&window.localStorage!==null,!Co)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Co=!1}return Co};var Z2={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&n0())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:r}=t;r&&n0()&&window.localStorage.setItem(r,e)}};let Ao=null;const r0=()=>{if(Ao!==null)return Ao;try{if(Ao=typeof window<"u"&&window.sessionStorage!==null,!Ao)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Ao=!1}return Ao};var J2={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&r0())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:r}=t;r&&r0()&&window.sessionStorage.setItem(r,e)}},W2={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:r,userLanguage:a,language:o}=navigator;if(r)for(let i=0;i<r.length;i++)t.push(r[i]);a&&t.push(a),o&&t.push(o)}return t.length>0?t:void 0}},ek={name:"htmlTag",lookup(e){let{htmlTag:t}=e,r;const a=t||(typeof document<"u"?document.documentElement:null);return a&&typeof a.getAttribute=="function"&&(r=a.getAttribute("lang")),r}},tk={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof t=="number"?t:0]?.replace("/",""):void 0}},nk={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const r=typeof t=="number"?t+1:1,a=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(a)return a[r]}};let Y_=!1;try{document.cookie,Y_=!0}catch{}const K_=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Y_||K_.splice(1,1);const rk=()=>({order:K_,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class X_{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,r)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=G2(r,this.options||{},rk()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=a,this.addDetector(K2),this.addDetector(X2),this.addDetector(Z2),this.addDetector(J2),this.addDetector(W2),this.addDetector(ek),this.addDetector(tk),this.addDetector(nk),this.addDetector(Q2)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return t.forEach(a=>{if(this.detectors[a]){let o=this.detectors[a].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(r=r.concat(o))}}),r=r.filter(a=>a!=null&&!V2(a)).map(a=>this.options.convertDetectedLanguage(a)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(a=>{this.detectors[a]&&this.detectors[a].cacheUserLanguage(t,this.options)}))}}X_.type="languageDetector";const ak={"nav.home":"Home","nav.studio":"Studio","nav.docs":"Docs","nav.login":"Login","nav.logout":"Logout","header.status.connected":"Connected","header.status.disconnected":"Disconnected","header.status.reconnecting":"Reconnecting","footer.copyright":"GitHub · @Context4AI {{year}}. All rights reserved.","footer.copyright_compact":"@Context4AI {{year}}. All rights reserved.","footer.tagline":"Knowledge Factory","footer.theme.dark":"Dark","footer.theme.light":"Light","footer.theme.system":"System","studio.sidebar.sources":"Sources","studio.sidebar.modeling":"Modeling","studio.sidebar.brain":"Brain","studio.sidebar.discovery":"Discovery","studio.sidebar.sharing":"Sharing","studio.sidebar.collaboration":"Collaboration","studio.sidebar.settings":"Settings","placeholder.coming":"Coming in {{version}}","page.login.title":"Login","page.login.description":"Authentication and user management","login.title":"SIGN IN","login.provider_cta":"Sign in with {{name}}","login.loading":"LOADING...","login.authenticating":"AUTHENTICATING...","login.or":"OR","login.test_account":"Test Account","login.error":"Failed to load login options","login.retry":"Retry","user.menu.connect_source":"Connect Source","user.menu.sign_out":"Sign out","api_keys.title":"API Keys","api_keys.description":"API Keys for programmatic access to C4A API (AI Agent, CLI, CI/CD)","api_keys.create":"Create API Key","api_keys.created":"API Key Created","api_keys.copy_warning":"Copy now, this key won't be shown again.","api_keys.copy":"Copy","api_keys.copied":"Copied!","api_keys.done":"Done","api_keys.empty.title":"No API Keys","api_keys.empty.description":"API Keys for programmatic access to C4A API","api_keys.created_at":"Created {{date}}","api_keys.never_used":"Never used","api_keys.expires.never":"Never expires","api_keys.expires.30d":"30 days","api_keys.expires.90d":"90 days","api_keys.expires.1y":"1 year","api_keys.form.name":"Name","api_keys.form.name_placeholder":"My CLI key","api_keys.form.expiry":"Expiration (optional)","api_keys.delete.confirm":"Delete this API key? This action cannot be undone.","workspace.default_name":"My Brain","settings.tab.general":"General","settings.tab.api_keys":"API Keys","page.docs.title":"Docs","page.docs.description":"Public documentation portal","page.sources.title":"Sources","page.sources.description":"Add code repositories, documents, and other input materials for your brain to index","page.modeling.title":"Modeling","page.modeling.description":"Model indexed content with AI — only what stands up to scrutiny gets written to the knowledge graph","page.brain.title":"Brain","page.brain.description":"All modeled knowledge lives here — browse, search, analyze, and use it anytime","page.discovery.title":"Discovery","page.discovery.description":"Explore knowledge curated by others and add what's useful to your own brain","page.sharing.title":"Sharing","page.sharing.description":"Package and export knowledge from your brain for others and AI to use directly","page.collaboration.title":"Collaboration","page.collaboration.description":"Stay in sync with other brains — get notified on updates, no manual transfer needed","page.settings.title":"Settings","page.settings.description":"Manage workspace members and configuration","page.code_setup.title":"Code Setup","page.code_setup.description":"Repository selection and configuration for code modeling","page.code_compile.title":"Code Compile","page.code_compile.description":"Compilation progress tracking for code modeling","page.code_review.title":"Code Review","page.code_review.description":"Review and approve modeling results","page.code_result.title":"Code Result","page.code_result.description":"View final modeling results and generated knowledge graph","home.hero.title":"Context For AI","home.hero.description":"Transform code repositories and business documents into structured knowledge graphs.","home.hero.cta.studio":"Enter Studio","home.hero.cta.github":"GitHub","notfound.title":"404","notfound.description":"The page you're looking for doesn't exist.","notfound.back":"Back to Home","error.description":"Something went wrong. Please try again.","error.reload":"Reload","sources.menu.add_client":"Add Client","sources.menu.online":"online","sources.menu.offline":"offline","sources.menu.status_online":"{{machine}} connected","sources.menu.status_offline":"{{machine}} not connected, click for setup guide","sources.library.default_cloud_name":"My Drive","sources.library.rename":"Rename","sources.library.rename_placeholder":"Enter library name","sources.header.daemon_status":"{{online}}/{{total}} online","sources.header.all_offline":"All offline","sources.actions.new_folder":"New Folder","sources.folder.name_placeholder":"Enter folder name","sources.actions.import_repo":"Import Repository","sources.actions.rename":"Rename","sources.actions.move_to":"Move to...","sources.actions.delete":"Delete","sources.filter.all":"All","sources.filter.indexed":"Indexed","sources.filter.not_indexed":"Not Indexed","sources.status.none":"None","sources.status.indexed":"Indexed","sources.status.stale":"Index outdated","sources.type.code":"Code","sources.type.doc":"Document","sources.empty.cloud.title":"Your personal knowledge input zone","sources.empty.cloud.description":"Create folders to organize your documents and materials. These are visible only to you and will serve as the foundation for building your digital brain","sources.empty.daemon.title":"Connect your local code assets","sources.empty.daemon.description":"Import local code repositories. The system will automatically extract code structures and technical documents, transforming them into structured knowledge","sources.empty.indexed.title":"Knowledge not yet indexed","sources.empty.indexed.description":"Select sources and complete indexing. They will be transformed into structured summaries, providing material for your future speculations.","sources.empty.folder.title":"This folder is empty","sources.empty.folder.daemon_description":"You can add or edit documents locally, and they will appear here after the next sync.","sources.safety.notice.repo":"In local mode, your code has absolute privacy. Source code never leaves your computer. The system only extracts structured summaries for knowledge modeling (function signatures, dependencies, etc.).","sources.safety.notice.dir":"The system extracts document content and summaries for knowledge modeling. Although unsafe text is filtered, please ensure sensitive data is not included in indexing or modeling.","sources.import.title":"Import Repository","sources.import.step.select":"Select Repository","sources.import.step.version":"Select Version","sources.import.step.confirm":"Import Complete","sources.import.daemon_offline":"Client {{name}} is not connected. Please start the local Daemon and connect to the server before importing.","sources.import.view_guide":"View Connection Guide","sources.import.select_root":"Select repository root directory","sources.import.current_path":"Current path","sources.import.not_git":"This directory is not a Git repository. Please select a directory containing .git.","sources.import.branch":"Branch","sources.import.commit":"Commit","sources.import.branch_warning":"Currently based on {{branch}} branch HEAD","sources.import.uncommitted_warning":"Uncommitted changes will not be collected","sources.import.recognized":"Recognized {{packages}} packages and {{docs}} documents","sources.import.no_packages":"No package structure detected. Will be imported as a single-package repository.","sources.import.confirm_heading":"About to import the following repository to {{name}}:","sources.import.packages":"Packages","sources.import.documents":"Documents","sources.import.loading_repo":"Loading repository info...","sources.import.loading_repo_slow":"Large repositories (>10 GB) may take 5–10 seconds...","sources.import.importing":"Importing...","sources.import.error_title":"Import Failed","sources.import.success":"Import complete","sources.import.stage.prepare":"Preparing environment","sources.import.stage.clone":"Cloning repository","sources.import.stage.clone_polling":"","sources.import.stage.scan":"Scanning project","sources.import.stage.save":"Saving sources","sources.import.stage.done_suffix":"done","sources.import.stage.complete":"Import complete","sources.import.stage.fetch_tree":"Fetching file tree","sources.import.stage.read_packages":"Reading package descriptors","sources.import.step.loading":"Data Import","sources.import.done":"Done","sources.import.back":"Back","sources.import.retry":"Retry","sources.add_client.title":"Connect Local Knowledge Source","sources.add_client.description":"Start a client (Daemon) on your local computer to mount local code repositories as input material into your digital brain.","sources.add_client.step1":"Install Daemon","sources.add_client.step2":"Start Daemon","sources.add_client.step2_allow":"Restrict access to specific directories (does not affect existing imports)","sources.add_client.step3":"Wait for connection","sources.add_client.step3_desc":"This page will update automatically once connected.","sources.add_client.waiting":"Waiting for new client connection...","sources.add_client.detected":"New client detected","sources.add_client.machine_name":"Machine ID","sources.add_client.os":"Operating system","sources.add_client.daemon_version":"Daemon version","sources.add_client.client_name":"Client name","sources.add_client.confirm":"Confirm Add","sources.add_client.reconnected":"Client {{name}} has reconnected","sources.add_client.go_to":"Go to {{name}}","sources.detail.tab.original":"Original","sources.detail.tab.overview":"Overview","sources.detail.tab.digest":"Digest","sources.detail.tab.modeling":"Modeling Result","sources.detail.not_found_title":"Source Not Found","sources.detail.not_found_desc":"This source could not be found. It may have been deleted or the ID is invalid.","sources.detail.digest_placeholder":"Structured summary will be available here after indexing is complete.","sources.detail.modeling_placeholder":"Knowledge entities derived from this source will appear here after modeling in the speculation zone.","sources.detail.type":"Type","sources.detail.origin":"Origin","sources.detail.origin.upload":"Upload","sources.detail.origin.local":"Local file","sources.detail.path":"Path","sources.detail.status":"Status","sources.detail.repo":"Repository","sources.detail.branch":"Branch","sources.detail.commit":"Commit","sources.detail.tech_stack":"Tech stack","sources.detail.original_code_placeholder":"Package overview will be available after indexing.","sources.detail.original_doc_placeholder":"Document content will be available after upload.","sources.detail.dependencies":"Dependencies","sources.delete.confirm_title":"Confirm Delete","sources.delete.resource":"Are you sure you want to delete {{name}}?","sources.delete.resource_impact":"The following data will be permanently deleted: original content, structured digest (if any).","sources.delete.session_warning":"If your personal speculation zone is using this source, related candidate speculations will be affected.","sources.delete.entity_safe":"Formal knowledge already merged into the brain will not be affected.","sources.delete.folder":"Are you sure you want to delete folder {{name}}?","sources.delete.folder_impact":"All resources inside will be recursively deleted: {{folders}} sub-folders, {{sources}} sources.","sources.delete.folder_contents":"Contains {{folders}} sub-folders, {{sources}} sources.","sources.delete.folder_impact_generic":"All sub-folders and resources inside will be recursively deleted.","sources.delete.irreversible":"This action cannot be undone.","sources.delete.repo":"Are you sure you want to remove repository {{name}} from {{library}}?","sources.delete.repo_impact":"Will delete: {{packages}} package index records, {{docs}} document index records.","sources.delete.repo_contents":"Contains {{packages}} packages, {{docs}} documents.","sources.delete.indexed_hint":"{{indexed}}/{{total}} have been indexed; their index data will be deleted.","sources.delete.repo_impact_generic":"All package and document index records will be deleted.","sources.delete.local_safe":"Local files will not be affected.","sources.delete.client":"Are you sure you want to delete client {{name}}?","sources.delete.client_impact":"All imported repository records and related index data under this client will be deleted.","sources.delete.client_reregister":"This client will need to re-register on next connection.","sources.error.name_conflict":'An item named "{{name}}" already exists in this directory.',"sources.move.current":"Current","sources.move.target":"Move to","sources.breadcrumb.sources":"Sources","common.cancel":"Cancel","common.confirm":"Confirm","common.back":"Back","common.next":"Next","common.previous":"Previous","common.items":"{{count}} items","common.loading":"Loading...","sources.import.no_entries":"No entries found","sources.import.allowed_dirs":"Client authorized directories","sources.import.allowed_dirs_tooltip_restrict":"Restrict to specific directories:","sources.import.allowed_dirs_tooltip_all":"Or allow all directories (default):","sources.import.wildcard_home":"Home","sources.import.wildcard_path_placeholder":"Enter a directory path…","sources.import.wildcard_go":"Go","sources.import.wildcard_goto":"Go to","sources.import.wildcard_go_title":"Go to Directory","sources.import.wildcard_path_not_found":"Path does not exist on the remote machine","sources.import.already_imported":"Imported","sources.import.dir_title":"Import Directory","sources.import.dir_step.select":"Select Directory","sources.import.dir_step.scan":"Scan","sources.import.dir_step.confirm":"Confirm Import","sources.import.dir_confirm_heading":"About to import the following directory to {{name}}:","sources.import.dir_name":"Directory Name","sources.import.dir_name_hint":"Display name in the source tree after import. Leave empty to use the default repository name.","sources.import.dir_name_duplicate":"This name already exists. Please use a different name.","sources.import.dir_path":"Directory Path","sources.import.dir_files":"Files","sources.import.dir_subdirs":"Subdirectories","sources.import.dir_git_repos":"Repositories (skipped)","sources.import.dir_git_hint":"Git repositories inside the directory will not be expanded for indexing. Import them separately if needed.","sources.import.dir_scanning":"Scanning directory contents...","sources.import.dir_scan_complete":"Scan complete","sources.import.dir_scan_error":"Failed to scan directory","sources.import.dir_scan_retry":"Retry","sources.import.dir_code_packages":"Code Packages","sources.import.dir_code_packages_tip":"Supported: package.json, pyproject.toml, setup.py, go.mod, Cargo.toml, pom.xml, build.gradle","sources.import.dir_doc_files":"Documents","sources.import.dir_doc_files_tip":"Supported: Markdown (.md)","sources.import.dir_total_files":"Total Files","sources.import.dir_total_dirs":"Directories","sources.import.dir_git_skip_hint":"Git repos are skipped. Use 'Import Repository' instead.","sources.actions.upload":"Upload","sources.actions.upload_md":"Markdown Document","sources.actions.upload_doc":"Document","sources.actions.upload_document":"Upload Document","sources.actions.add":"Add","sources.actions.add_folder":"Folder","sources.actions.add_web":"Web Page","sources.actions.add_feishu":"Feishu Document","sources.actions.import_dir":"Import Directory","sources.actions.import_repo_url":"Import Repository","sources.upgrade.title":"Feature Upgrading","sources.upgrade.description":"This feature will be available in version 0.5.x. Stay tuned.","sources.upload.title":"Upload Documents","sources.upload.drop_hint":"Click to select or drag files here","sources.upload.supported_formats":"Supported: .md, .doc, .docx, .pdf, .ppt, .pptx, .txt (max 5MB each, up to 10 files)","sources.upload.file_too_large":'"{{name}}" exceeds 5MB limit',"sources.upload.too_many_files":"Maximum 10 files allowed, please re-select","sources.upload.unsupported_type":'"{{name}}" is not a supported file type',"sources.upload.uploading":"Uploading...","sources.upload.success":"Uploaded {{count}} documents","sources.upload.selected":"{{count}} files selected","sources.upload.remove":"Remove","sources.import_remote.title":"Import Remote Repository","sources.import_remote.step.loading":"Data Import","sources.import_remote.url_label":"Repository URL","sources.import_remote.url_placeholder":"https://github.com/org/repo.git","sources.import_remote.url_hint_format":"Only HTTPS URLs are accepted. SSH support is planned for a future release","sources.import_remote.url_hint_public":"Supports public Git repositories without authentication, and Git services with OAuth configured: ","sources.import_remote.url_hint_no_auth":"Supports public Git repositories and Git services with OAuth configured","sources.import_remote.url_invalid":"Only HTTPS Git URLs are supported","sources.import_remote.ref_label":"Branch / Tag","sources.import_remote.ref_branches":"Branches","sources.import_remote.ref_tags":"Tags","sources.import_remote.ref_search":"Search branches or tags…","sources.import_remote.commit_label":"Commit","sources.import_remote.commit_hint":"Auto-filled with the latest commit of selected branch. You can also type or search","sources.import_remote.commit_search":"Search commit…","sources.import_remote.loading_refs":"Querying repository branches...","sources.import_remote.loading_refs_slow":"Large projects may take 10–30s, please wait...","sources.import_remote.summary_repo":"Repository","sources.import_remote.summary_branch":"Branch","sources.import_remote.summary_commit":"Commit","sources.import_remote.commit_latest":"(latest)","sources.import_remote.stage.prepare":"Preparing environment","sources.import_remote.stage.clone":"Cloning repository","sources.import_remote.stage.scan":"Scanning project","sources.import_remote.stage.save":"Saving sources","sources.import_remote.complete":"Import complete","sources.import_remote.back_to_library":"Done","sources.import_remote.retry":"Retry","sources.import_remote.back":"Back","sources.import_remote.error.auth_required":"This repository requires authentication. Please configure an access token for {{host}} in Server Settings → Git Tokens.","sources.import_remote.error.auth_failed":"Authentication failed. Please check your Git token configuration.","sources.import_remote.error.not_found":"Repository not found or no access. Please check the URL.","sources.import_remote.error.network":"Cannot connect to the remote repository. Please check your network or try again later.","sources.import_remote.error.capacity":"Import queue is full. Please try again later.","sources.import_remote.error.clone_failed":"Clone failed","sources.import_remote.error.scan_failed":"Scan failed","sources.import_remote.error.save_failed":"Save failed","sources.import_remote.api.detected":"Detected {{platform}} repo, fetch via API with partial indexing support","sources.import_remote.api.fast_available":"Fast import available","sources.import_remote.api.will_use_clone":"Fetch repo data via Clone, full indexing","sources.import_remote.api.use_clone":"Fetch repo data via Clone, full indexing","sources.import_remote.api.sub_path":"Sub path (optional)","sources.import_remote.api.sub_path_hint":"For monorepos: import only a subdirectory","sources.import_remote.api.sub_path_placeholder":"Multiple paths separated by ;","sources.import_remote.api.select_sub_paths":"Select subdirectories","sources.import_remote.api.panel_selected":"Selected","sources.import_remote.api.selected_count":"{{count}} directories selected","sources.import_remote.api.confirm_full":"Confirm (full import)","sources.import_remote.api.back_to_ref":"Back to branch select","sources.import_remote.api.method":"Import method","sources.import_remote.api.method_api":"API (fast)","sources.import_remote.api.method_clone":"Clone","sources.import_remote.api.truncated_warning":"File tree exceeds 100,000 entries, API results may be incomplete","sources.import_remote.api.truncated_suggest":"Recommend using traditional clone for complete results","sources.import_remote.api.truncated_continue":"Continue import","sources.import_remote.api.truncated_use_clone":"Use clone","sources.import_remote.api.suggest_clone":"Recommend traditional clone","sources.import_remote.api.fallback_msg":"API import failed, switching to traditional clone","sources.import_remote.api.git_host_not_configured":"Git host {{host}} is not configured. Please add it to server.yaml git_hosts section with an access token.","sources.safety.notice.remote":"The remote repository will be cloned to the server for analysis. Code will not be uploaded to any third-party services.","content.detail.tab.raw":"Raw Content","content.detail.tab.digest":"Digest","content.detail.tab.extraction":"LLM Extraction","content.detail.tab.entities":"Entities","content.card.lines":"Lines {{start}}-{{end}}","content.detail.size":"Size","content.detail.created_at":"Created","content.detail.sources":"Sources","content.detail.language":"Language","content.detail.model":"Model","entity.detail.tab.overview":"Overview","entity.detail.tab.relations":"Relations","entity.detail.tab.contents":"Contents","entity.detail.tab.referrers":"Referrers","entity.detail.tab.neighbors":"Neighbors","entity.detail.type":"Type","entity.detail.kind":"Kind","entity.detail.perspective":"Perspective","entity.detail.scope":"Scope","relation.detail.tab.overview":"Overview","relation.detail.weight":"Weight","relation.detail.confidence":"Confidence","relation.detail.from":"From","relation.detail.to":"To","relation.detail.description":"Description","relation.detail.data":"Additional Data","relation.detail.source_refs":"Content Sources","relation.detail.meta":"Metadata","relation.detail.source_label":"Source","relation.detail.source_field_sync":"System-derived","relation.detail.source_explicit":"Explicitly declared","relation.filter.direction.all":"All Directions","relation.filter.direction.outgoing":"Outgoing →","relation.filter.direction.incoming":"← Incoming","relation.filter.type.all":"All Types","ref.stale":"Stale ref","ref.unknown":"Unknown entity","ref.retry":"Resolve failed, click to retry","confidence.high":"High confidence","confidence.high.tip":"Confidence ≥ 0.9, cross-validated by multiple signals","confidence.ai":"AI suggestion","confidence.ai.tip":"Confidence 0.7–0.9, AI-inferred but not fully verified","confidence.low":"Low confidence","confidence.low.tip":"Confidence < 0.7, insufficient info or conflicting signals","source.field_sync":"System-derived","source.explicit":"Explicitly declared","common.empty.content_raw.title":"Not yet indexed","common.empty.content_raw.description":"Content will be available after indexing.","common.empty.content_raw.cta":"Start indexing","common.empty.content_digest.title":"Not yet indexed","common.empty.content_digest.description":"This content has not been through structured indexing yet.","common.empty.content_extraction.title":"Not yet extracted","common.empty.content_extraction.description":"AI has not yet performed entity extraction and analysis on this content.","common.empty.content_entities.title":"No associated entities","common.empty.content_entities.description":"No entities have been extracted from this content yet.","common.empty.entity_relations.title":"No relations","common.empty.entity_relations.description":"This entity is currently an island with no connections to other entities.","common.empty.entity_contents.title":"No content sources","common.empty.entity_contents.description":"This entity is not linked to any source code or document content.","common.empty.entity_referrers.title":"No referrers","common.empty.entity_referrers.description":"No other entities currently reference this entity in their data fields.","common.empty.entity_neighbors.title":"No neighbors","common.empty.entity_neighbors.description":"This entity has no directly connected neighbor nodes in the graph.","common.error.not_found":"Resource not found","common.error.not_found_description":"The requested resource does not exist or has been removed.","common.error.load_failed":"Failed to load","common.error.load_failed_description":"An error occurred while loading data. Please try again.","explorer.mode.append":"Append","explorer.mode.replace":"Replace","explorer.mode.append_tooltip":"Open links in new tabs","explorer.mode.replace_tooltip":"Replace current tab","explorer.close_all":"Close All Tabs","explorer.type.content":"Content","explorer.type.entity":"Entity","explorer.type.relation":"Relation","explorer.type.call_graph":"Call Graph","explorer.type.import_deps":"Import Deps","explorer.type.inheritance":"Inheritance","version.selector_label":"Version","version.current":"Current","upload.no_change":"File content unchanged, upload ignored","upload.partial_no_change":"{{count}} file(s) unchanged, ignored","upload.new_version_title":"New Version","upload.new_version_desc":"File content has changed. Enter a new version number:","upload.version_label":"Version","upload.current_version":"Current version: {{version}}","upload.version_must_increase":"Version must be greater than {{version}}","upload.confirm":"Upload","package.last_commit":"Last Commit","package.dependencies":"Dependencies","package.files":"Files","package.no_dependencies":"No dependencies","package.unknown":"Unknown","index.code.go_index":"Index","index.code.reindex":"Re-index","index.code.indexing":"Indexing...","index.stage.daemon_starting":"Daemon","index.stage.cloning":"Cloning","index.stage.preparing":"Preparing","index.stage.scanning":"Scanning","index.stage.parsing":"Parsing","index.stage.analyzing":"Analyzing","index.stage.uploading":"Uploading","index.stage.skipping":"Skipping","index.code.complete":"Index complete","index.code.unchanged_count":"{{count}} module(s) unchanged, skipped","index.code.error":"Index failed","index.code.timeout":"Index timed out","index.code.dismiss":"Dismiss","index.code.skipped":"Already up to date","index.code.delete":"Delete index","index.code.delete_confirm":"Delete index for this resource? Original content, digest and extraction data will be removed.","index.code.delete_success":"Index deleted","index.code.delete_failed":"Delete index failed","index.code.auto_continue":"Auto-continue on complete","index.code.auto_continue_pending":"Auto-continuing shortly..","index.code.done_continue":"Done","index.log.daemon_starting":"Starting cloud Daemon...","index.log.daemon_ready":"Daemon ready","index.log.cloning":"Cloning repository...","index.log.clone_done":"Clone complete","index.log.preparing":"Preparing index version...","index.log.prepare_done":"Version ready","index.log.done_suffix":"done","index.log.scan_done":"Scan complete","index.log.parse_done":"Parse complete, {{count}} files","index.log.analyze_done":"Analysis complete","index.log.upload_done":"Data saved {{name}}","index.log.restored":"(Progress restored from server, previous logs unavailable)","index.error.commit_not_available":"Target commit unavailable, check remote","index.error.daemon_start_failed":"Cloud Daemon failed to start","index.error.git_archive_failed":"Version export failed","index.doc.error.llm_unavailable":"LLM service unavailable, check configuration","index.doc.error.embedding_unavailable":"Embedding service unavailable, check configuration","index.doc.error.content_missing":"Document content missing","index.doc.error.parse_failed":"Document parsing failed","index.doc.error.llm_exhausted":"LLM call failed: {{message}}","index.stage.chunking":"Chunking","index.stage.annotating":"Annotating","index.stage.post_processing":"Post-processing","index.stage.embedding":"Embedding","index.stage.storing":"Storing","index.doc.log.chunking":"Analyzing document structure...","index.doc.log.chunking_done":"Chunking complete ({{n}} chunks)","index.doc.log.annotating_start":"LLM annotation starting...","index.doc.log.annotating":"LLM annotating ({{n}}/{{m}})","index.doc.log.post_processing":"Entity resolution & quality checks...","index.doc.log.embedding":"Generating embeddings...","index.doc.log.storing":"Saving to storage...","index.doc.msg.chunking_result":"{{chunks}} chunks, {{sections}} sections","index.doc.msg.annotating_start":"{{n}} chunks","index.doc.msg.annotating_start_model":"{{n}} chunks, LLM {{model}}","index.doc.msg.annotating_chunk":"Chunk {{current}}/{{total}} {{step}} ({{calls}} calls, {{tokens}} tokens)","index.doc.msg.annotating_chunk_done":"Chunk {{current}}/{{total}} done, total {{calls}} calls {{tokens}} tokens","index.doc.msg.post_process_start":"Entity auto-complete & normalization","index.doc.msg.extraction_stats":"{{entities}} entities, {{relations}} relations, {{withAtoms}}/{{totalParas}} paragraphs with atoms","index.doc.msg.no_resolution":"No resolution candidates","index.doc.msg.resolving":"Resolving {{duplicates}} duplicates + {{noise}} noise candidates via LLM","index.doc.msg.resolution_parse_failed":"Entity resolution parse failed","index.doc.msg.resolution_result":"Resolution: {{merges}} merges ({{mergeRefs}} refs), {{removed}} removed ({{removeRefs}} instances), {{ambiguous}} ambiguous","index.doc.msg.resolution_failed":"Entity resolution failed (non-blocking)","index.doc.msg.embedding_model":"Embedding {{model}}","index.doc.msg.file_start":"[{{idx}}/{{total}}] {{file}} indexing started","index.doc.msg.file_done":"[{{idx}}/{{total}}] {{file}} indexing complete","index.doc.msg.file_error":"[{{idx}}/{{total}}] {{file}} indexing failed: {{error}}","index.doc.confirm_title":"Document indexing","index.doc.confirm_desc":"The following documents will be indexed using LLM, which will consume tokens:","index.doc.confirm_btn":"Confirm indexing","index.doc.estimating":"Estimating consumption...","index.doc.estimate_tokens":"Tokens","index.doc.estimate_calls":"LLM calls","index.doc.estimate_chunks":"Chunks","index.doc.estimate_summary":"Estimated ~{{tokens}} tokens, ~{{calls}} LLM calls","index.doc.cancel":"Cancel","digest.empty.title":"No code digest","digest.empty.description":"This content has not been code-indexed. Index to view structured code digest.","digest.empty.cta":"Start indexing","digest.doc.empty.title":"Document not yet indexed","digest.doc.empty.description":"Index to view the original text alongside structured annotations","digest.doc.empty.cta":"Index document","digest.doc.no_atoms":"No annotations or extracted in other paragraphs","digest.doc.atom.entities":"Entities","digest.doc.atom.relations":"Relations","digest.doc.atom.behaviors":"Behaviors","digest.doc.atom.attributes":"Attributes","digest.doc.atom.states":"States","digest.doc.atom.rules":"Rules","digest.doc.atom.transitions":"Transitions","digest.doc.atom.events":"Events","digest.doc.atom.decisions":"Decisions","digest.doc.atom.metrics":"Metrics","digest.doc.atom.roles":"Roles","digest.doc.atom.constraints":"Constraints","digest.doc.atom.comparisons":"Comparisons","digest.doc.atom.boundaries":"Boundaries","digest.stats.files":"Files","digest.stats.classes":"Classes","digest.stats.functions":"Functions","digest.stats.relations":"Relations","digest.tech_stack":"Tech stack","digest.modules":"Modules","daemon.offline_tooltip":"Please start the client","sources.detail.repo_url":"Repo URL","raw.basic_info":"Basic info","raw.field.name":"Name","raw.field.version":"Version","raw.field.license":"License","raw.field.description":"Description","raw.dependencies":"Dependencies","raw.dev_dependencies":"Dev dependencies","raw.no_dependencies":"No dependencies","raw.readme":"Readme","raw.code_files":"Code files","raw.doc_files":"Doc files","raw.total_files":"Total files","index.batch.title":"Select items to index","index.batch.panel_a_title":"Indexable content","index.batch.panel_b_title":"Selected","index.batch.selected_count":"Selected {{n}} / {{total}} available","index.batch.already_indexed":"Indexed","index.batch.reindex_tag":"Re-index","index.batch.skipped_unsupported":"Skipped (not yet supported)","index.batch.empty_selection":"Select items from the tree on the left","index.batch.warning_over_50":"Large number of items (>50), may take a while","index.batch.confirm":"Start indexing","index.batch.back":"Back","index.batch.tooltip":"Batch index","index.batch.tooltip_indexing":"Indexing...","index.batch.toast_skipped":"All selected items are up to date. No re-indexing needed.","index.batch.toast_partial_fail":"Some index tasks failed. Check console for details.","index.batch.error":"Batch index failed","error.dialog.console_hint":"Full error details have been printed to the browser console.","error.dialog.copy":"Copy","error.dialog.copied":"Copied","error.dialog.confirm":"OK","query.tab.label":"Query","query.indexing.title":"Indexing in progress","query.indexing.desc":"Query will be available once indexing completes.","query.symbol.search_placeholder":"Search symbols...","query.symbol.exported_only":"Exported only","query.symbol.load_more":"Load more ({{count}} remaining)","query.symbol.loading":"Loading symbols...","query.symbol.empty":"No symbols found","query.symbol.empty_desc":"This source has no code symbols to display.","query.symbol.methods":"Methods","query.symbol.properties":"Properties","query.symbol.extends":"Extends","query.symbol.implements":"Implements","query.symbol.signature":"Signature","query.symbol.parameters":"Parameters","query.symbol.returns":"Returns","query.symbol.async":"Async","query.call_graph.title":"Call Graph","query.call_graph.callers":"Callers","query.call_graph.callees":"Callees","query.call_graph.empty":"No call relations found","query.call_graph.empty_desc":"No {{direction}} found for this function.","query.call_graph.depth":"Depth","query.call_graph.open":"View call graph","query.import_deps.title":"Import Dependencies","query.import_deps.forward":"Imports","query.import_deps.reverse":"Imported by","query.import_deps.external":"External dependencies","query.import_deps.internal":"Internal dependencies","query.import_deps.empty":"No import relations found","query.import_deps.open":"View dependencies","query.inheritance.title":"Inheritance","query.inheritance.descendants":"Descendants","query.inheritance.ancestors":"Ancestors","query.inheritance.empty":"No inheritance relations found","query.inheritance.cross_source":"Searching {{count}} indexed code sources","query.inheritance.open":"View inheritance","query.doc.search_placeholder":"Search documents with natural language...","query.doc.search_button":"Search","query.doc.searching":"Searching...","query.doc.relevance.high":"High relevance","query.doc.relevance.medium":"Medium relevance","query.doc.relevance.low":"Low relevance","query.doc.empty.title":"No matching paragraphs","query.doc.empty.desc":"Try different keywords, or check if the document has been imported and indexed.","query.doc.error.title":"Document search failed","query.warning.more":"+{{count}} more"},sk={"nav.home":"首页","nav.studio":"工作台","nav.docs":"文档","nav.login":"登录","nav.logout":"退出登录","header.status.connected":"已连接","header.status.disconnected":"已断开","header.status.reconnecting":"重连中","footer.copyright":"GitHub · @Context4AI {{year}}. 版权所有","footer.copyright_compact":"@Context4AI {{year}}. 版权所有","footer.tagline":"知识工厂","footer.theme.dark":"暗色","footer.theme.light":"亮色","footer.theme.system":"跟随系统","studio.sidebar.sources":"知识索引","studio.sidebar.modeling":"知识建模","studio.sidebar.brain":"知识大脑","studio.sidebar.discovery":"发现知识","studio.sidebar.sharing":"分享知识","studio.sidebar.collaboration":"知识协同","studio.sidebar.settings":"设置","placeholder.coming":"计划在 {{version}} 版本实现","page.login.title":"登录","page.login.description":"身份验证与用户管理","login.title":"登录","login.provider_cta":"使用 {{name}} 登录","login.loading":"加载中...","login.authenticating":"认证中...","login.or":"或","login.test_account":"测试账户","login.error":"加载登录选项失败","login.retry":"重试","user.menu.connect_source":"接入知识源","user.menu.sign_out":"退出登录","api_keys.title":"API 密钥","api_keys.description":"API Key 用于程序化访问 C4A API(AI Agent、CLI、CI/CD)","api_keys.create":"创建 API Key","api_keys.created":"API Key 已创建","api_keys.copy_warning":"请立即复制,此 Key 不会再次显示。","api_keys.copy":"复制","api_keys.copied":"已复制!","api_keys.done":"完成","api_keys.empty.title":"尚无 API Key","api_keys.empty.description":"API Key 用于程序化访问 C4A API","api_keys.created_at":"创建于 {{date}}","api_keys.never_used":"从未使用","api_keys.expires.never":"永不过期","api_keys.expires.30d":"30 天","api_keys.expires.90d":"90 天","api_keys.expires.1y":"1 年","api_keys.form.name":"名称","api_keys.form.name_placeholder":"My CLI key","api_keys.form.expiry":"过期时间(可选)","api_keys.delete.confirm":"删除此 API Key?此操作不可撤销。","workspace.default_name":"我的大脑","settings.tab.general":"常规","settings.tab.api_keys":"API 密钥","page.docs.title":"文档","page.docs.description":"公开文档门户","page.sources.title":"知识索引","page.sources.description":"添加代码仓库、文档等输入材料,让大脑完成初步索引","page.modeling.title":"知识建模","page.modeling.description":"和 AI 一起对索引内容建模,只有经得起推敲的才写入知识图谱","page.brain.title":"知识大脑","page.brain.description":"建模完成的全部知识都在这里——浏览、搜索、分析,随时调用","page.discovery.title":"发现知识","page.discovery.description":"看看别人整理好的知识,发现有用的一键补充到自己的大脑","page.sharing.title":"分享知识","page.sharing.description":"把大脑中的知识打包输出,让别人和 AI 都能直接使用","page.collaboration.title":"知识协同","page.collaboration.description":"和其他大脑保持同步,知识更新时自动通知,不用手动搬运","page.settings.title":"设置","page.settings.description":"管理大脑的成员和配置","page.code_setup.title":"代码设置","page.code_setup.description":"代码建模的仓库选择与配置","page.code_compile.title":"代码编译","page.code_compile.description":"代码建模的编译进度追踪","page.code_review.title":"代码审查","page.code_review.description":"审查并确认建模结果","page.code_result.title":"代码结果","page.code_result.description":"查看最终建模结果与生成的知识图谱","home.hero.title":"Context For AI","home.hero.description":"将代码仓库和业务文档转化为结构化知识图谱。","home.hero.cta.studio":"进入工作台","home.hero.cta.github":"GitHub","notfound.title":"404","notfound.description":"您访问的页面不存在。","notfound.back":"返回首页","error.description":"页面出现了问题,请重试。","error.reload":"重新加载","sources.menu.add_client":"添加客户端","sources.menu.online":"在线","sources.menu.offline":"离线","sources.menu.status_online":"{{machine}} 已连接","sources.menu.status_offline":"{{machine}} 未连接,点击前往教程","sources.library.default_cloud_name":"我的云盘","sources.library.rename":"重命名","sources.library.rename_placeholder":"输入名称","sources.header.daemon_status":"{{online}}/{{total}} 在线","sources.header.all_offline":"全部离线","sources.actions.new_folder":"新文件夹","sources.folder.name_placeholder":"输入文件夹名称","sources.actions.import_repo":"导入仓库","sources.actions.rename":"重命名","sources.actions.move_to":"移动到...","sources.actions.delete":"删除","sources.filter.all":"全部","sources.filter.indexed":"已索引","sources.filter.not_indexed":"未索引","sources.status.none":"未索引","sources.status.indexed":"已索引","sources.status.stale":"有新变更未更新索引","sources.type.code":"代码","sources.type.doc":"文档","sources.empty.cloud.title":"这里是你专属的知识输入区","sources.empty.cloud.description":"创建文件夹来整理你的文档和材料。这些内容仅你个人可见,将成为后续推演、构建数字大脑的基础","sources.empty.daemon.title":"连接你的本地代码资产","sources.empty.daemon.description":"导入本地代码仓库,系统会自动提取代码结构与技术文档,将其转化为结构化知识","sources.empty.indexed.title":"这些知识尚未被索引","sources.empty.indexed.description":"选择资源并完成索引后,它们将转化为结构化摘要,为你后续的推演提供素材。","sources.empty.folder.title":"当前文件夹还没有内容","sources.empty.folder.daemon_description":"你可以在本地进行文档新增、编辑后查看。","sources.safety.notice.repo":"在本地模式下,你的代码保有绝对隐私,源代码永远不会离开你的电脑,系统仅提取用于知识建模的结构化摘要(函数签名、依赖关系等)。","sources.safety.notice.dir":"系统会提取用于知识建模的文档内容及摘要,尽管会过滤不安全的文本内容,但请确保敏感数据不要参与索引及建模。","sources.import.title":"导入代码仓库","sources.import.step.select":"选择仓库","sources.import.step.version":"选择版本","sources.import.step.confirm":"导入完成","sources.import.daemon_offline":"客户端 {{name}} 未连接,请先启动本地 Daemon 并连接到服务器后再导入仓库。","sources.import.view_guide":"查看连接指引","sources.import.select_root":"选择仓库根目录","sources.import.current_path":"当前路径","sources.import.not_git":"该目录不是 Git 仓库,请选择包含 .git 的目录。","sources.import.branch":"分支","sources.import.commit":"提交","sources.import.branch_warning":"当前基于 {{branch}} 分支的 HEAD","sources.import.uncommitted_warning":"未提交的修改不会被采集","sources.import.recognized":"已识别 {{packages}} 个包和 {{docs}} 篇文档","sources.import.no_packages":"未识别到包结构,将作为单包仓库导入。","sources.import.confirm_heading":"即将导入以下仓库到 {{name}}:","sources.import.packages":"包数","sources.import.documents":"文档","sources.import.loading_repo":"正在加载仓库信息...","sources.import.loading_repo_slow":"大型仓库(>10 GB)可能需要 5~10 秒...","sources.import.importing":"导入中...","sources.import.error_title":"导入失败","sources.import.success":"导入完成","sources.import.stage.prepare":"准备执行环境","sources.import.stage.clone":"克隆仓库","sources.import.stage.clone_polling":"","sources.import.stage.scan":"扫描项目","sources.import.stage.save":"保存数据源","sources.import.stage.done_suffix":"✓","sources.import.stage.complete":"导入完成","sources.import.stage.fetch_tree":"获取文件树","sources.import.stage.read_packages":"读取包描述文件","sources.import.step.loading":"数据导入","sources.import.done":"完成","sources.import.back":"返回","sources.import.retry":"重试","sources.add_client.title":"接入本地知识源","sources.add_client.description":"在本地计算机上启动客户端 (Daemon),即可将本地代码仓库作为输入材料,挂载到你的数字大脑中。","sources.add_client.step1":"安装 Daemon","sources.add_client.step2":"启动 Daemon","sources.add_client.step2_allow":"限制访问目录(不影响已有导入)","sources.add_client.step3":"等待连接","sources.add_client.step3_desc":"连接成功后,本页面将自动更新。","sources.add_client.waiting":"等待新的客户端连接...","sources.add_client.detected":"检测到新的本地客户端","sources.add_client.machine_name":"机器标识","sources.add_client.os":"操作系统","sources.add_client.daemon_version":"Daemon 版本","sources.add_client.client_name":"客户端名称","sources.add_client.confirm":"确认添加","sources.add_client.reconnected":"客户端 {{name}} 已重新连接","sources.add_client.go_to":"前往 {{name}}","sources.detail.tab.original":"原文","sources.detail.tab.overview":"概览","sources.detail.tab.digest":"摘要","sources.detail.tab.modeling":"建模结果","sources.detail.not_found_title":"来源不存在","sources.detail.not_found_desc":"未找到此来源,可能已被删除或 ID 无效。","sources.detail.digest_placeholder":"完成索引后,即可在此查看结构化摘要。","sources.detail.modeling_placeholder":"在推演区完成建模后,此处将展示由该源产生的知识实体。","sources.detail.type":"类型","sources.detail.origin":"来源","sources.detail.origin.upload":"直接上传","sources.detail.origin.local":"本地文件","sources.detail.path":"路径","sources.detail.status":"状态","sources.detail.repo":"仓库","sources.detail.branch":"分支","sources.detail.commit":"提交","sources.detail.tech_stack":"技术栈","sources.detail.original_code_placeholder":"完成索引后即可查看包概览。","sources.detail.original_doc_placeholder":"文档内容将在上传后展示。","sources.detail.dependencies":"依赖","sources.delete.confirm_title":"确认删除","sources.delete.resource":"确定要删除 {{name}}?","sources.delete.resource_impact":"以下数据将被永久删除:原文内容、结构化摘要(如有)。","sources.delete.session_warning":"如果你的个人推演区正在使用此知识源,相关的候选推演将受到影响。","sources.delete.entity_safe":"已汇入大脑的正式知识不受影响。","sources.delete.folder":"确定要删除文件夹 {{name}}?","sources.delete.folder_impact":"文件夹内的所有资源将被递归删除:{{folders}} 个子文件夹、{{sources}} 个知识源。","sources.delete.folder_contents":"包含 {{folders}} 个子文件夹、{{sources}} 个知识源。","sources.delete.folder_impact_generic":"文件夹内的所有子文件夹和知识源将被递归删除。","sources.delete.irreversible":"此操作不可撤销。","sources.delete.repo":"确定要从 {{library}} 中移除仓库 {{name}}?","sources.delete.repo_impact":"将删除:{{packages}} 个包的索引记录、{{docs}} 篇文档的索引记录。","sources.delete.repo_contents":"包含 {{packages}} 个包、{{docs}} 个文档。","sources.delete.indexed_hint":"其中 {{indexed}}/{{total}} 个已建立索引,索引数据将被删除。","sources.delete.repo_impact_generic":"所有包和文档的索引记录将被删除。","sources.delete.local_safe":"本地文件不受影响。","sources.delete.client":"确定要删除客户端 {{name}}?","sources.delete.client_impact":"该客户端下的所有已导入仓库记录和相关索引数据将被删除。","sources.delete.client_reregister":"该客户端下次连接时将触发重新注册。","sources.error.name_conflict":'该目录下已存在同名项"{{name}}"。',"sources.move.current":"当前位置","sources.move.target":"移动到","sources.breadcrumb.sources":"知识索引","common.cancel":"取消","common.confirm":"确认","common.back":"返回","common.next":"下一步","common.previous":"上一步","common.items":"{{count}} 项","common.loading":"加载中...","sources.import.no_entries":"未找到任何条目","sources.import.allowed_dirs":"客户端授权目录","sources.import.allowed_dirs_tooltip_restrict":"通过参数设定有权限的目录:","sources.import.allowed_dirs_tooltip_all":"或默认允许全部目录:","sources.import.wildcard_home":"主目录","sources.import.wildcard_path_placeholder":"输入目录路径…","sources.import.wildcard_go":"前往","sources.import.wildcard_goto":"前往","sources.import.wildcard_go_title":"前往目录","sources.import.wildcard_path_not_found":"该路径在远程机器上不存在","sources.import.already_imported":"已导入","sources.import.dir_title":"导入目录","sources.import.dir_step.select":"选择目录","sources.import.dir_step.scan":"扫描","sources.import.dir_step.confirm":"确认导入","sources.import.dir_confirm_heading":"即将导入以下目录到 {{name}}:","sources.import.dir_name":"目录名","sources.import.dir_name_hint":"导入后在目录树中的显示名称,留空使用默认仓库名。","sources.import.dir_name_duplicate":"该名称已存在,请使用其他名称。","sources.import.dir_path":"目录路径","sources.import.dir_files":"文件数","sources.import.dir_subdirs":"子目录数","sources.import.dir_git_repos":"仓库(已跳过)","sources.import.dir_git_hint":"目录内的 Git 仓库不会被展开索引,如需索引请单独导入仓库。","sources.import.dir_scanning":"正在扫描目录内容...","sources.import.dir_scan_complete":"扫描完成","sources.import.dir_scan_error":"目录扫描失败","sources.import.dir_scan_retry":"重试","sources.import.dir_code_packages":"代码包","sources.import.dir_code_packages_tip":"支持:package.json、pyproject.toml、setup.py、go.mod、Cargo.toml、pom.xml、build.gradle","sources.import.dir_doc_files":"文档","sources.import.dir_doc_files_tip":"支持:Markdown (.md)","sources.import.dir_total_files":"文件总数","sources.import.dir_total_dirs":"目录","sources.import.dir_git_skip_hint":"Git 仓库将被跳过,建议单独使用「导入仓库」。","sources.actions.upload":"上传","sources.actions.upload_md":"Markdown 文档","sources.actions.upload_doc":"文档","sources.actions.upload_document":"上传文档","sources.actions.add":"新增","sources.actions.add_folder":"文件夹","sources.actions.add_web":"网页","sources.actions.add_feishu":"飞书文档","sources.actions.import_dir":"导入目录","sources.actions.import_repo_url":"导入仓库","sources.upgrade.title":"功能升级中","sources.upgrade.description":"此功能将在 0.5.x 版本中推出,敬请期待。","sources.upload.title":"上传文档","sources.upload.drop_hint":"点击选择文件或拖拽至此","sources.upload.supported_formats":"支持格式:.md, .doc, .docx, .pdf, .ppt, .pptx, .txt(每个最大 5MB,最多 10 个)","sources.upload.file_too_large":'"{{name}}" 超过 5MB 限制',"sources.upload.too_many_files":"最多上传 10 个文件,请重新选择","sources.upload.unsupported_type":'"{{name}}" 不是支持的文件类型',"sources.upload.uploading":"上传中...","sources.upload.success":"已上传 {{count}} 个文档","sources.upload.selected":"已选择 {{count}} 个文件","sources.upload.remove":"移除","sources.import_remote.title":"导入远程仓库","sources.import_remote.step.loading":"数据导入","sources.import_remote.url_label":"仓库地址","sources.import_remote.url_placeholder":"https://github.com/org/repo.git","sources.import_remote.url_hint_format":"仅接受 HTTPS 地址,SSH 地址未来版本支持","sources.import_remote.url_hint_public":"除了支持无需鉴权的公开 Git 仓库,也支持已配置 OAuth 的 Git 服务:","sources.import_remote.url_hint_no_auth":"除了支持无需鉴权的公开 Git 仓库,也支持已配置 OAuth 的 Git 服务","sources.import_remote.url_invalid":"仅支持 HTTPS 格式的 Git URL","sources.import_remote.ref_label":"分支 / Tag","sources.import_remote.ref_branches":"分支","sources.import_remote.ref_tags":"Tag","sources.import_remote.ref_search":"搜索分支或 Tag…","sources.import_remote.commit_label":"Commit","sources.import_remote.commit_hint":"已自动填入所选分支最新 commit,也可手动输入或搜索","sources.import_remote.commit_search":"搜索 commit…","sources.import_remote.loading_refs":"正在查询仓库分支...","sources.import_remote.loading_refs_slow":"大型项目可能需要 10~30s,请耐心等待...","sources.import_remote.summary_repo":"仓库","sources.import_remote.summary_branch":"分支","sources.import_remote.summary_commit":"Commit","sources.import_remote.commit_latest":"(latest)","sources.import_remote.stage.prepare":"准备执行环境","sources.import_remote.stage.clone":"克隆仓库","sources.import_remote.stage.scan":"识别项目结构","sources.import_remote.stage.save":"写入知识源","sources.import_remote.complete":"导入完成","sources.import_remote.back_to_library":"完成","sources.import_remote.retry":"重试","sources.import_remote.back":"返回","sources.import_remote.error.auth_required":"该仓库需要认证。请在 服务设置 → Git 令牌 中配置 {{host}} 的访问令牌。","sources.import_remote.error.auth_failed":"认证失败,请检查 Git 令牌配置。","sources.import_remote.error.not_found":"仓库不存在或无权访问。请检查 URL 是否正确。","sources.import_remote.error.network":"无法连接到远程仓库。请检查网络或稍后重试。","sources.import_remote.error.capacity":"当前导入任务已满,请稍后再试。","sources.import_remote.error.clone_failed":"克隆失败","sources.import_remote.error.scan_failed":"识别失败","sources.import_remote.error.save_failed":"写入失败","sources.import_remote.api.detected":"已识别 {{platform}} 仓库,使用 API 获取仓库数据,支持局部索引","sources.import_remote.api.fast_available":"快速导入可用","sources.import_remote.api.will_use_clone":"使用 Clone 方式获取仓库数据,全量索引","sources.import_remote.api.use_clone":"使用 Clone 方式获取仓库数据,全量索引","sources.import_remote.api.sub_path":"子路径(可选)","sources.import_remote.api.sub_path_hint":"大仓场景:仅导入指定子目录","sources.import_remote.api.sub_path_placeholder":"多个路径用 ; 分隔,留空表示全量导入","sources.import_remote.api.select_sub_paths":"选择子目录","sources.import_remote.api.panel_selected":"已选内容","sources.import_remote.api.selected_count":"已选 {{count}} 个目录","sources.import_remote.api.confirm_full":"确认(全量导入)","sources.import_remote.api.back_to_ref":"返回分支选择","sources.import_remote.api.method":"导入方式","sources.import_remote.api.method_api":"API(快速)","sources.import_remote.api.method_clone":"Clone","sources.import_remote.api.truncated_warning":"文件树超过 100,000 个条目,API 返回结果可能不完整","sources.import_remote.api.truncated_suggest":"建议使用传统克隆方式以获取完整结果","sources.import_remote.api.truncated_continue":"继续导入","sources.import_remote.api.truncated_use_clone":"传统导入","sources.import_remote.api.suggest_clone":"建议使用传统克隆方式","sources.import_remote.api.fallback_msg":"API 导入失败,切换到传统方式","sources.import_remote.api.git_host_not_configured":"Git 主机 {{host}} 未配置。请在 server.yaml 的 git_hosts 中添加该主机及访问令牌。","sources.safety.notice.remote":"远程仓库将被克隆到服务器本地进行分析,代码不会上传到任何第三方服务。","content.detail.tab.raw":"原始内容","content.detail.tab.digest":"索引摘要","content.detail.tab.extraction":"LLM 提取","content.detail.tab.entities":"关联实体","content.detail.size":"大小","content.detail.created_at":"创建时间","content.detail.sources":"来源","content.detail.language":"语言","content.detail.model":"模型","entity.detail.tab.overview":"概览","entity.detail.tab.relations":"关系","entity.detail.tab.contents":"内容来源","entity.detail.tab.referrers":"被引用","entity.detail.tab.neighbors":"邻居","entity.detail.type":"类型","entity.detail.kind":"种类","entity.detail.perspective":"视角","entity.detail.scope":"作用域","relation.detail.tab.overview":"概览","relation.detail.weight":"权重","relation.detail.confidence":"置信度","relation.detail.from":"起点","relation.detail.to":"终点","relation.detail.description":"描述","relation.detail.data":"附加数据","relation.detail.source_refs":"内容来源","relation.detail.meta":"元信息","relation.detail.source_label":"生成方式","relation.detail.source_field_sync":"系统推导","relation.detail.source_explicit":"显式声明","relation.filter.direction.all":"全部方向","relation.filter.direction.outgoing":"出边 →","relation.filter.direction.incoming":"← 入边","relation.filter.type.all":"全部类型","ref.stale":"已失效引用","ref.unknown":"未知实体","ref.retry":"解析失败,点击重试","confidence.high":"高确信","confidence.high.tip":"置信度 ≥ 0.9,多个信号交叉验证","confidence.ai":"AI 建议","confidence.ai.tip":"置信度 0.7–0.9,由 AI 推断但未充分验证","confidence.low":"低确信","confidence.low.tip":"置信度 < 0.7,信息不足或存在矛盾","source.field_sync":"系统推导","source.explicit":"显式声明","common.empty.content_raw.title":"尚未索引","common.empty.content_raw.description":"索引后可查看结构化内容。","common.empty.content_raw.cta":"开始索引","common.empty.content_digest.title":"尚未索引","common.empty.content_digest.description":"此内容尚未经过结构化索引处理。","common.empty.content_extraction.title":"尚未提取","common.empty.content_extraction.description":"AI 尚未对此内容进行实体提取和分析。","common.empty.content_entities.title":"暂无关联实体","common.empty.content_entities.description":"尚未从此内容中提取出任何实体。","common.empty.entity_relations.title":"暂无关系","common.empty.entity_relations.description":"该实体目前是一个孤岛,尚未与其他实体建立关联。","common.empty.entity_contents.title":"暂无内容来源","common.empty.entity_contents.description":"该实体未关联任何源代码或文档内容。","common.empty.entity_referrers.title":"暂无被引用","common.empty.entity_referrers.description":"目前没有其他实体在 data 字段中引用此实体。","common.empty.entity_neighbors.title":"暂无邻居","common.empty.entity_neighbors.description":"该实体在图谱中没有直接关联的邻居节点。","common.error.not_found":"资源不存在","common.error.not_found_description":"请求的资源不存在或已被移除。","common.error.load_failed":"加载失败","common.error.load_failed_description":"加载数据时发生错误,请重试。","explorer.mode.append":"追加","explorer.mode.replace":"替换","explorer.mode.append_tooltip":"在新标签中打开链接","explorer.mode.replace_tooltip":"替换当前标签","explorer.close_all":"关闭所有标签","explorer.type.content":"内容","explorer.type.entity":"实体","explorer.type.relation":"关系","explorer.type.call_graph":"调用图","explorer.type.import_deps":"依赖导入","explorer.type.inheritance":"继承关系","version.selector_label":"版本","version.current":"当前","upload.no_change":"文件内容无变化,已忽略上传","upload.partial_no_change":"{{count}} 个文件内容无变化,已忽略","upload.new_version_title":"新版本","upload.new_version_desc":"文件内容已变化,请输入新版本号:","upload.version_label":"版本号","upload.current_version":"当前版本:{{version}}","upload.version_must_increase":"版本号必须大于 {{version}}","upload.confirm":"上传","package.last_commit":"最后提交","package.dependencies":"依赖","package.files":"文件","package.no_dependencies":"无依赖","package.unknown":"未知","content.card.lines":"第 {{start}}-{{end}} 行","index.code.go_index":"索引","index.code.reindex":"重新索引","index.code.indexing":"索引中...","index.stage.daemon_starting":"启动 Daemon","index.stage.cloning":"克隆仓库","index.stage.preparing":"版本准备","index.stage.scanning":"扫描中","index.stage.parsing":"解析中","index.stage.analyzing":"分析中","index.stage.uploading":"上传中","index.stage.skipping":"跳过","index.code.complete":"索引完成","index.code.unchanged_count":"{{count}} 个模块无变化,已跳过","index.code.error":"索引失败","index.code.timeout":"索引超时","index.code.dismiss":"关闭","index.code.skipped":"已是最新","index.code.delete":"删除索引","index.code.delete_confirm":"确定要删除该资源的索引?原始内容、摘要和提取数据将被清除。","index.code.delete_success":"索引已删除","index.code.delete_failed":"删除索引失败","index.code.auto_continue":"完成后自动继续","index.code.auto_continue_pending":"即将自动继续..","index.code.done_continue":"完成","index.log.daemon_starting":"正在启动云端 Daemon...","index.log.daemon_ready":"Daemon 就绪","index.log.cloning":"正在克隆仓库...","index.log.clone_done":"克隆完成","index.log.preparing":"正在准备索引版本...","index.log.prepare_done":"版本准备完成","index.log.done_suffix":"完成","index.log.scan_done":"扫描完成","index.log.parse_done":"解析完成 {{count}}个","index.log.analyze_done":"分析完成","index.log.upload_done":"数据已保存 {{name}}","index.log.restored":"(已从服务器恢复进度,之前的日志不可用)","index.error.commit_not_available":"目标版本不可用,请检查远程仓库","index.error.daemon_start_failed":"云端 Daemon 启动失败","index.error.git_archive_failed":"版本导出失败","index.doc.error.llm_unavailable":"LLM 服务不可用,请检查配置","index.doc.error.embedding_unavailable":"Embedding 服务不可用,请检查配置","index.doc.error.content_missing":"文档内容缺失","index.doc.error.parse_failed":"文档解析失败","index.doc.error.llm_exhausted":"LLM 调用失败:{{message}}","index.stage.chunking":"分片中","index.stage.annotating":"标注中","index.stage.post_processing":"后处理","index.stage.embedding":"向量化","index.stage.storing":"存储中","index.doc.log.chunking":"分析文档结构...","index.doc.log.chunking_done":"分片完成({{n}} 个分片)","index.doc.log.annotating_start":"LLM 标注开始...","index.doc.log.annotating":"LLM 标注中 ({{n}}/{{m}})","index.doc.log.post_processing":"实体归一化 & 质量检查...","index.doc.log.embedding":"生成向量...","index.doc.log.storing":"正在保存...","index.doc.msg.chunking_result":"{{chunks}} 个分片,{{sections}} 个章节","index.doc.msg.annotating_start":"{{n}} 个分片","index.doc.msg.annotating_start_model":"{{n}} 个分片,LLM {{model}}","index.doc.msg.annotating_chunk":"分片 {{current}}/{{total}} {{step}}({{calls}} 次调用,{{tokens}} tokens)","index.doc.msg.annotating_chunk_done":"分片 {{current}}/{{total}} 完成,累计 {{calls}} 次调用 {{tokens}} tokens","index.doc.msg.post_process_start":"实体自动补全 & 归一化","index.doc.msg.extraction_stats":"{{entities}} 个实体,{{relations}} 个关系,{{withAtoms}}/{{totalParas}} 段落含标注","index.doc.msg.no_resolution":"无需实体归一化","index.doc.msg.resolving":"归一化中:{{duplicates}} 对重复 + {{noise}} 个噪声候选","index.doc.msg.resolution_parse_failed":"实体归一化解析失败","index.doc.msg.resolution_result":"归一化完成:{{merges}} 次合并({{mergeRefs}} 处引用),移除 {{removed}} 个({{removeRefs}} 处),{{ambiguous}} 个待定","index.doc.msg.resolution_failed":"实体归一化失败(非阻塞)","index.doc.msg.embedding_model":"向量化 {{model}}","index.doc.msg.file_start":"[{{idx}}/{{total}}] {{file}} 开始索引","index.doc.msg.file_done":"[{{idx}}/{{total}}] {{file}} 索引完成","index.doc.msg.file_error":"[{{idx}}/{{total}}] {{file}} 索引失败: {{error}}","index.doc.confirm_title":"文档索引确认","index.doc.confirm_desc":"以下文档将使用 LLM 进行结构化索引,会产生 token 消耗:","index.doc.confirm_btn":"确认索引","index.doc.estimating":"正在估算消耗...","index.doc.estimate_tokens":"预估 Token","index.doc.estimate_calls":"LLM 调用","index.doc.estimate_chunks":"分片数","index.doc.estimate_summary":"预计消耗约 ~{{tokens}} tokens,~{{calls}} 次 LLM 调用","index.doc.cancel":"取消","digest.empty.title":"暂无代码摘要","digest.empty.description":"该内容尚未进行代码索引,索引后可查看结构化代码摘要。","digest.empty.cta":"开始索引","digest.doc.empty.title":"文档尚未完成 LLM 索引","digest.doc.empty.description":"索引后可查看原文与结构化标注的对照视图","digest.doc.empty.cta":"索引文档","digest.doc.no_atoms":"无标注或已提取到其他段落","digest.doc.atom.entities":"实体","digest.doc.atom.relations":"关系","digest.doc.atom.behaviors":"行为","digest.doc.atom.attributes":"属性","digest.doc.atom.states":"状态","digest.doc.atom.rules":"规则","digest.doc.atom.transitions":"转换","digest.doc.atom.events":"事件","digest.doc.atom.decisions":"决策","digest.doc.atom.metrics":"指标","digest.doc.atom.roles":"角色","digest.doc.atom.constraints":"约束","digest.doc.atom.comparisons":"对比","digest.doc.atom.boundaries":"边界","digest.stats.files":"文件","digest.stats.classes":"类","digest.stats.functions":"函数","digest.stats.relations":"关系","digest.tech_stack":"技术栈","digest.modules":"模块","daemon.offline_tooltip":"请启动客户端","sources.detail.repo_url":"仓库地址","raw.basic_info":"基本信息","raw.field.name":"名称","raw.field.version":"版本","raw.field.license":"许可证","raw.field.description":"描述","raw.dependencies":"依赖","raw.dev_dependencies":"开发依赖","raw.no_dependencies":"无依赖","raw.readme":"说明文档","raw.code_files":"代码文件","raw.doc_files":"文档文件","raw.total_files":"总文件数","index.batch.title":"选择待索引内容","index.batch.panel_a_title":"可索引内容","index.batch.panel_b_title":"已选内容","index.batch.selected_count":"已选 {{n}} / 可选 {{total}}","index.batch.already_indexed":"已索引","index.batch.reindex_tag":"重索引","index.batch.skipped_unsupported":"已跳过(暂不支持)","index.batch.empty_selection":"请在左侧勾选要索引的内容","index.batch.warning_over_50":"待索引数量较多(>50),可能需要较长时间","index.batch.confirm":"开始索引","index.batch.back":"返回","index.batch.tooltip":"批量索引","index.batch.tooltip_indexing":"索引中...","index.batch.toast_skipped":"选中的内容均已是最新状态,无需重新索引。","index.batch.toast_partial_fail":"部分索引任务失败,详情请查看控制台。","index.batch.error":"批量索引失败","error.dialog.console_hint":"完整错误信息已打印到浏览器控制台。","error.dialog.copy":"复制","error.dialog.copied":"已复制","error.dialog.confirm":"确定","query.tab.label":"查询","query.indexing.title":"索引进行中","query.indexing.desc":"索引完成后即可使用查询功能。","query.symbol.search_placeholder":"搜索符号...","query.symbol.exported_only":"仅导出","query.symbol.load_more":"加载更多(剩余 {{count}} 个)","query.symbol.loading":"加载符号中...","query.symbol.empty":"未找到符号","query.symbol.empty_desc":"该源没有可展示的代码符号。","query.symbol.methods":"方法","query.symbol.properties":"属性","query.symbol.extends":"继承","query.symbol.implements":"实现","query.symbol.signature":"签名","query.symbol.parameters":"参数","query.symbol.returns":"返回值","query.symbol.async":"异步","query.call_graph.title":"调用图","query.call_graph.callers":"调用者","query.call_graph.callees":"被调用","query.call_graph.empty":"未找到调用关系","query.call_graph.empty_desc":"未找到该函数的{{direction}}。","query.call_graph.depth":"深度","query.call_graph.open":"查看调用图","query.import_deps.title":"导入依赖","query.import_deps.forward":"导入","query.import_deps.reverse":"被导入","query.import_deps.external":"外部依赖","query.import_deps.internal":"内部依赖","query.import_deps.empty":"未找到导入关系","query.import_deps.open":"查看依赖","query.inheritance.title":"继承关系","query.inheritance.descendants":"子类","query.inheritance.ancestors":"父类","query.inheritance.empty":"未找到继承关系","query.inheritance.cross_source":"正在搜索 {{count}} 个已索引代码源","query.inheritance.open":"查看继承","query.doc.search_placeholder":"用自然语言搜索文档...","query.doc.search_button":"搜索","query.doc.searching":"搜索中...","query.doc.relevance.high":"高相关度","query.doc.relevance.medium":"中相关度","query.doc.relevance.low":"低相关度","query.doc.empty.title":"未找到匹配段落","query.doc.empty.desc":"请尝试更换关键词,或检查相关文档是否已导入并完成索引。","query.doc.error.title":"文档搜索失败","query.warning.more":"还有 {{count}} 条"};Cn.use(X_).use(O2).init({resources:{en:{translation:ak},zh:{translation:sk}},fallbackLng:"en",interpolation:{escapeValue:!1},detection:{order:["localStorage"],caches:["localStorage"],lookupLocalStorage:"lang"}});var zp={exports:{}},Ii={},$p={exports:{}},Bp={};var a0;function ok(){return a0||(a0=1,(function(e){function t(T,F){var ee=T.length;T.push(F);e:for(;0<ee;){var ae=ee-1>>>1,W=T[ae];if(0<o(W,F))T[ae]=F,T[ee]=W,ee=ae;else break e}}function r(T){return T.length===0?null:T[0]}function a(T){if(T.length===0)return null;var F=T[0],ee=T.pop();if(ee!==F){T[0]=ee;e:for(var ae=0,W=T.length,O=W>>>1;ae<O;){var V=2*(ae+1)-1,re=T[V],se=V+1,ne=T[se];if(0>o(re,ee))se<W&&0>o(ne,re)?(T[ae]=ne,T[se]=ee,ae=se):(T[ae]=re,T[V]=ee,ae=V);else if(se<W&&0>o(ne,ee))T[ae]=ne,T[se]=ee,ae=se;else break e}}return F}function o(T,F){var ee=T.sortIndex-F.sortIndex;return ee!==0?ee:T.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],m=1,x=null,v=3,_=!1,w=!1,S=!1,k=!1,N=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function D(T){for(var F=r(p);F!==null;){if(F.callback===null)a(p);else if(F.startTime<=T)a(p),F.sortIndex=F.expirationTime,t(h,F);else break;F=r(p)}}function L(T){if(S=!1,D(T),!w)if(r(h)!==null)w=!0,z||(z=!0,oe());else{var F=r(p);F!==null&&P(L,F.startTime-T)}}var z=!1,$=-1,R=5,B=-1;function H(){return k?!0:!(e.unstable_now()-B<R)}function J(){if(k=!1,z){var T=e.unstable_now();B=T;var F=!0;try{e:{w=!1,S&&(S=!1,A($),$=-1),_=!0;var ee=v;try{t:{for(D(T),x=r(h);x!==null&&!(x.expirationTime>T&&H());){var ae=x.callback;if(typeof ae=="function"){x.callback=null,v=x.priorityLevel;var W=ae(x.expirationTime<=T);if(T=e.unstable_now(),typeof W=="function"){x.callback=W,D(T),F=!0;break t}x===r(h)&&a(h),D(T)}else a(h);x=r(h)}if(x!==null)F=!0;else{var O=r(p);O!==null&&P(L,O.startTime-T),F=!1}}break e}finally{x=null,v=ee,_=!1}F=void 0}}finally{F?oe():z=!1}}}var oe;if(typeof E=="function")oe=function(){E(J)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,M=ce.port2;ce.port1.onmessage=J,oe=function(){M.postMessage(null)}}else oe=function(){N(J,0)};function P(T,F){$=N(function(){T(e.unstable_now())},F)}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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(T){switch(v){case 1:case 2:case 3:var F=3;break;default:F=v}var ee=v;v=F;try{return T()}finally{v=ee}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(T,F){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var ee=v;v=T;try{return F()}finally{v=ee}},e.unstable_scheduleCallback=function(T,F,ee){var ae=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ae+ee:ae):ee=ae,T){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=ee+W,T={id:m++,callback:F,priorityLevel:T,startTime:ee,expirationTime:W,sortIndex:-1},ee>ae?(T.sortIndex=ee,t(p,T),r(h)===null&&T===r(p)&&(S?(A($),$=-1):S=!0,P(L,ee-ae))):(T.sortIndex=W,t(h,T),w||_||(w=!0,z||(z=!0,oe()))),T},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(T){var F=v;return function(){var ee=v;v=F;try{return T.apply(this,arguments)}finally{v=ee}}}})(Bp)),Bp}var s0;function ik(){return s0||(s0=1,$p.exports=ok()),$p.exports}var Ip={exports:{}},Sn={};var o0;function lk(){if(o0)return Sn;o0=1;var e=ad();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function i(h,p,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:x==null?null:""+x,children:h,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Sn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Sn.createPortal=function(h,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return i(h,p,null,m)},Sn.flushSync=function(h){var p=u.T,m=a.p;try{if(u.T=null,a.p=2,h)return h()}finally{u.T=p,a.p=m,a.d.f()}},Sn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(h,p))},Sn.prefetchDNS=function(h){typeof h=="string"&&a.d.D(h)},Sn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var m=p.as,x=f(m,p.crossOrigin),v=typeof p.integrity=="string"?p.integrity:void 0,_=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?a.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:v,fetchPriority:_}):m==="script"&&a.d.X(h,{crossOrigin:x,integrity:v,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Sn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=f(p.as,p.crossOrigin);a.d.M(h,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(h)},Sn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,x=f(m,p.crossOrigin);a.d.L(h,m,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Sn.preloadModule=function(h,p){if(typeof h=="string")if(p){var m=f(p.as,p.crossOrigin);a.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(h)},Sn.requestFormReset=function(h){a.d.r(h)},Sn.unstable_batchedUpdates=function(h,p){return h(p)},Sn.useFormState=function(h,p,m){return u.H.useFormState(h,p,m)},Sn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Sn.version="19.2.4",Sn}var i0;function ck(){if(i0)return Ip.exports;i0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ip.exports=lk(),Ip.exports}var l0;function uk(){if(l0)return Ii;l0=1;var e=ik(),t=ad(),r=ck();function a(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function i(n){var s=n,l=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(l=s.return),n=s.return;while(n)}return s.tag===3?l:null}function u(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function f(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function h(n){if(i(n)!==n)throw Error(a(188))}function p(n){var s=n.alternate;if(!s){if(s=i(n),s===null)throw Error(a(188));return s!==n?null:n}for(var l=n,d=s;;){var g=l.return;if(g===null)break;var y=g.alternate;if(y===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===y.child){for(y=g.child;y;){if(y===l)return h(g),n;if(y===d)return h(g),s;y=y.sibling}throw Error(a(188))}if(l.return!==d.return)l=g,d=y;else{for(var j=!1,C=g.child;C;){if(C===l){j=!0,l=g,d=y;break}if(C===d){j=!0,d=g,l=y;break}C=C.sibling}if(!j){for(C=y.child;C;){if(C===l){j=!0,l=y,d=g;break}if(C===d){j=!0,d=y,l=g;break}C=C.sibling}if(!j)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?n:s}function m(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=m(n),s!==null)return s;n=n.sibling}return null}var x=Object.assign,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function oe(n){return n===null||typeof n!="object"?null:(n=J&&n[J]||n["@@iterator"],typeof n=="function"?n:null)}var ce=Symbol.for("react.client.reference");function M(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ce?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case S:return"Fragment";case N:return"Profiler";case k:return"StrictMode";case L:return"Suspense";case z:return"SuspenseList";case B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case w:return"Portal";case E:return n.displayName||"Context";case A:return(n._context.displayName||"Context")+".Consumer";case D:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case $:return s=n.displayName||null,s!==null?s:M(n.type)||"Memo";case R:s=n._payload,n=n._init;try{return M(n(s))}catch{}}return null}var P=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},ae=[],W=-1;function O(n){return{current:n}}function V(n){0>W||(n.current=ae[W],ae[W]=null,W--)}function re(n,s){W++,ae[W]=n.current,n.current=s}var se=O(null),ne=O(null),ge=O(null),Ne=O(null);function Fe(n,s){switch(re(ge,s),re(ne,n),re(se,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?nb(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=nb(s),n=rb(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}V(se),re(se,n)}function qe(){V(se),V(ne),V(ge)}function be(n){n.memoizedState!==null&&re(Ne,n);var s=se.current,l=rb(s,n.type);s!==l&&(re(ne,n),re(se,l))}function fe(n){ne.current===n&&(V(se),V(ne)),Ne.current===n&&(V(Ne),Di._currentValue=ee)}var _e,he;function ve(n){if(_e===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);_e=s&&s[1]||"",he=-1<l.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+_e+n+he}var Ve=!1;function De(n,s){if(!n||Ve)return"";Ve=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(te){var Q=te}Reflect.construct(n,[],pe)}else{try{pe.call()}catch(te){Q=te}n.call(pe.prototype)}}else{try{throw Error()}catch(te){Q=te}(pe=n())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(te){if(te&&Q&&typeof te.stack=="string")return[te.stack,Q.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),j=y[0],C=y[1];if(j&&C){var U=j.split(`
5
+ `),X=C.split(`
6
+ `);for(g=d=0;d<U.length&&!U[d].includes("DetermineComponentFrameRoot");)d++;for(;g<X.length&&!X[g].includes("DetermineComponentFrameRoot");)g++;if(d===U.length||g===X.length)for(d=U.length-1,g=X.length-1;1<=d&&0<=g&&U[d]!==X[g];)g--;for(;1<=d&&0<=g;d--,g--)if(U[d]!==X[g]){if(d!==1||g!==1)do if(d--,g--,0>g||U[d]!==X[g]){var ie=`
7
+ `+U[d].replace(" at new "," at ");return n.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",n.displayName)),ie}while(1<=d&&0<=g);break}}}finally{Ve=!1,Error.prepareStackTrace=l}return(l=n?n.displayName||n.name:"")?ve(l):""}function Xe(n,s){switch(n.tag){case 26:case 27:case 5:return ve(n.type);case 16:return ve("Lazy");case 13:return n.child!==s&&s!==null?ve("Suspense Fallback"):ve("Suspense");case 19:return ve("SuspenseList");case 0:case 15:return De(n.type,!1);case 11:return De(n.type.render,!1);case 1:return De(n.type,!0);case 31:return ve("Activity");default:return""}}function It(n){try{var s="",l=null;do s+=Xe(n,l),l=n,n=n.return;while(n);return s}catch(d){return`
8
+ Error generating stack: `+d.message+`
9
+ `+d.stack}}var un=Object.prototype.hasOwnProperty,Vt=e.unstable_scheduleCallback,Bn=e.unstable_cancelCallback,cr=e.unstable_shouldYield,Xn=e.unstable_requestPaint,Ht=e.unstable_now,An=e.unstable_getCurrentPriorityLevel,Le=e.unstable_ImmediatePriority,Ze=e.unstable_UserBlockingPriority,We=e.unstable_NormalPriority,Nt=e.unstable_LowPriority,ft=e.unstable_IdlePriority,Rn=e.log,mn=e.unstable_setDisableYieldValue,gn=null,Lt=null;function Et(n){if(typeof Rn=="function"&&mn(n),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(gn,n)}catch{}}var Pt=Math.clz32?Math.clz32:sa,Er=Math.log,zr=Math.LN2;function sa(n){return n>>>=0,n===0?32:31-(Er(n)/zr|0)|0}var me=256,Ue=262144,St=4194304;function nt(n){var s=n&42;if(s!==0)return s;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ct(n,s,l){var d=n.pendingLanes;if(d===0)return 0;var g=0,y=n.suspendedLanes,j=n.pingedLanes;n=n.warmLanes;var C=d&134217727;return C!==0?(d=C&~y,d!==0?g=nt(d):(j&=C,j!==0?g=nt(j):l||(l=C&~n,l!==0&&(g=nt(l))))):(C=d&~y,C!==0?g=nt(C):j!==0?g=nt(j):l||(l=d&~n,l!==0&&(g=nt(l)))),g===0?0:s!==0&&s!==g&&(s&y)===0&&(y=g&-g,l=s&-s,y>=l||y===32&&(l&4194048)!==0)?s:g}function Dt(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function Oa(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 oa(){var n=St;return St<<=1,(St&62914560)===0&&(St=4194304),n}function ur(n){for(var s=[],l=0;31>l;l++)s.push(n);return s}function Tn(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function $r(n,s,l,d,g,y){var j=n.pendingLanes;n.pendingLanes=l,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=l,n.entangledLanes&=l,n.errorRecoveryDisabledLanes&=l,n.shellSuspendCounter=0;var C=n.entanglements,U=n.expirationTimes,X=n.hiddenUpdates;for(l=j&~l;0<l;){var ie=31-Pt(l),pe=1<<ie;C[ie]=0,U[ie]=-1;var Q=X[ie];if(Q!==null)for(X[ie]=null,ie=0;ie<Q.length;ie++){var te=Q[ie];te!==null&&(te.lane&=-536870913)}l&=~pe}d!==0&&ia(n,d,0),y!==0&&g===0&&n.tag!==0&&(n.suspendedLanes|=y&~(j&~s))}function ia(n,s,l){n.pendingLanes|=s,n.suspendedLanes&=~s;var d=31-Pt(s);n.entangledLanes|=s,n.entanglements[d]=n.entanglements[d]|1073741824|l&261930}function Ma(n,s){var l=n.entangledLanes|=s;for(n=n.entanglements;l;){var d=31-Pt(l),g=1<<d;g&s|n[d]&s&&(n[d]|=s),l&=~g}}function I(n,s){var l=s&-s;return l=(l&42)!==0?1:G(l),(l&(n.suspendedLanes|s))!==0?0:l}function G(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Z(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function xe(){var n=F.p;return n!==0?n:(n=window.event,n===void 0?32:Nb(n.type))}function we(n,s){var l=F.p;try{return F.p=n,s()}finally{F.p=l}}var Ae=Math.random().toString(36).slice(2),je="__reactFiber$"+Ae,ke="__reactProps$"+Ae,Ce="__reactContainer$"+Ae,Ie="__reactEvents$"+Ae,Pe="__reactListeners$"+Ae,Be="__reactHandles$"+Ae,dt="__reactResources$"+Ae,ue="__reactMarker$"+Ae;function Ee(n){delete n[je],delete n[ke],delete n[Ie],delete n[Pe],delete n[Be]}function Re(n){var s=n[je];if(s)return s;for(var l=n.parentNode;l;){if(s=l[Ce]||l[je]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(n=ub(n);n!==null;){if(l=n[je])return l;n=ub(n)}return s}n=l,l=n.parentNode}return null}function Ge(n){if(n=n[je]||n[Ce]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function Oe(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(a(33))}function gt(n){var s=n[dt];return s||(s=n[dt]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function it(n){n[ue]=!0}var an=new Set,_n={};function dn(n,s){Br(n,s),Br(n+"Capture",s)}function Br(n,s){for(_n[n]=s,n=0;n<s.length;n++)an.add(s[n])}var fs=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]*$"),Ir={},ps={};function Gs(n){return un.call(ps,n)?!0:un.call(Ir,n)?!1:fs.test(n)?ps[n]=!0:(Ir[n]=!0,!1)}function at(n,s,l){if(Gs(s))if(l===null)n.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+l)}}function Yt(n,s,l){if(l===null)n.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+l)}}function wn(n,s,l,d){if(d===null)n.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttributeNS(s,l,""+d)}}function Jt(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Ot(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Vs(n,s,l){var d=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,y=d.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return g.call(this)},set:function(j){l=""+j,y.call(this,j)}}),Object.defineProperty(n,s,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(j){l=""+j},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Ys(n){if(!n._valueTracker){var s=Ot(n)?"checked":"value";n._valueTracker=Vs(n,s,""+n[s])}}function Vl(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var l=s.getValue(),d="";return n&&(d=Ot(n)?n.checked?"true":"false":n.value),n=d,n!==l?(s.setValue(n),!0):!1}function Yl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Fw=/[\n"\\]/g;function dr(n){return n.replace(Fw,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function wd(n,s,l,d,g,y,j,C){n.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?n.type=j:n.removeAttribute("type"),s!=null?j==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+Jt(s)):n.value!==""+Jt(s)&&(n.value=""+Jt(s)):j!=="submit"&&j!=="reset"||n.removeAttribute("value"),s!=null?Sd(n,j,Jt(s)):l!=null?Sd(n,j,Jt(l)):d!=null&&n.removeAttribute("value"),g==null&&y!=null&&(n.defaultChecked=!!y),g!=null&&(n.checked=g&&typeof g!="function"&&typeof g!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.name=""+Jt(C):n.removeAttribute("name")}function Qm(n,s,l,d,g,y,j,C){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.type=y),s!=null||l!=null){if(!(y!=="submit"&&y!=="reset"||s!=null)){Ys(n);return}l=l!=null?""+Jt(l):"",s=s!=null?""+Jt(s):l,C||s===n.value||(n.value=s),n.defaultValue=s}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,n.checked=C?n.checked:!!d,n.defaultChecked=!!d,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(n.name=j),Ys(n)}function Sd(n,s,l){s==="number"&&Yl(n.ownerDocument)===n||n.defaultValue===""+l||(n.defaultValue=""+l)}function Ks(n,s,l,d){if(n=n.options,s){s={};for(var g=0;g<l.length;g++)s["$"+l[g]]=!0;for(l=0;l<n.length;l++)g=s.hasOwnProperty("$"+n[l].value),n[l].selected!==g&&(n[l].selected=g),g&&d&&(n[l].defaultSelected=!0)}else{for(l=""+Jt(l),s=null,g=0;g<n.length;g++){if(n[g].value===l){n[g].selected=!0,d&&(n[g].defaultSelected=!0);return}s!==null||n[g].disabled||(s=n[g])}s!==null&&(s.selected=!0)}}function Zm(n,s,l){if(s!=null&&(s=""+Jt(s),s!==n.value&&(n.value=s),l==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=l!=null?""+Jt(l):""}function Jm(n,s,l,d){if(s==null){if(d!=null){if(l!=null)throw Error(a(92));if(P(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),s=l}l=Jt(s),n.defaultValue=l,d=n.textContent,d===l&&d!==""&&d!==null&&(n.value=d),Ys(n)}function Xs(n,s){if(s){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=s;return}}n.textContent=s}var Gw=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 Wm(n,s,l){var d=s.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":d?n.setProperty(s,l):typeof l!="number"||l===0||Gw.has(s)?s==="float"?n.cssFloat=l:n[s]=(""+l).trim():n[s]=l+"px"}function eg(n,s,l){if(s!=null&&typeof s!="object")throw Error(a(62));if(n=n.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?n.setProperty(d,""):d==="float"?n.cssFloat="":n[d]="");for(var g in s)d=s[g],s.hasOwnProperty(g)&&l[g]!==d&&Wm(n,g,d)}else for(var y in s)s.hasOwnProperty(y)&&Wm(n,y,s[y])}function jd(n){if(n.indexOf("-")===-1)return!1;switch(n){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 Vw=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"]]),Yw=/^[\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 Kl(n){return Yw.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function la(){}var kd=null;function Nd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Qs=null,Zs=null;function tg(n){var s=Ge(n);if(s&&(n=s.stateNode)){var l=n[ke]||null;e:switch(n=s.stateNode,s.type){case"input":if(wd(n,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),s=l.name,l.type==="radio"&&s!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+dr(""+s)+'"][type="radio"]'),s=0;s<l.length;s++){var d=l[s];if(d!==n&&d.form===n.form){var g=d[ke]||null;if(!g)throw Error(a(90));wd(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(s=0;s<l.length;s++)d=l[s],d.form===n.form&&Vl(d)}break e;case"textarea":Zm(n,l.value,l.defaultValue);break e;case"select":s=l.value,s!=null&&Ks(n,!!l.multiple,s,!1)}}}var Ed=!1;function ng(n,s,l){if(Ed)return n(s,l);Ed=!0;try{var d=n(s);return d}finally{if(Ed=!1,(Qs!==null||Zs!==null)&&(Mc(),Qs&&(s=Qs,n=Zs,Zs=Qs=null,tg(s),n)))for(s=0;s<n.length;s++)tg(n[s])}}function Qo(n,s){var l=n.stateNode;if(l===null)return null;var d=l[ke]||null;if(d===null)return null;l=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(a(231,s,typeof l));return l}var ca=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cd=!1;if(ca)try{var Zo={};Object.defineProperty(Zo,"passive",{get:function(){Cd=!0}}),window.addEventListener("test",Zo,Zo),window.removeEventListener("test",Zo,Zo)}catch{Cd=!1}var za=null,Ad=null,Xl=null;function rg(){if(Xl)return Xl;var n,s=Ad,l=s.length,d,g="value"in za?za.value:za.textContent,y=g.length;for(n=0;n<l&&s[n]===g[n];n++);var j=l-n;for(d=1;d<=j&&s[l-d]===g[y-d];d++);return Xl=g.slice(n,1<d?1-d:void 0)}function Ql(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Zl(){return!0}function ag(){return!1}function In(n){function s(l,d,g,y,j){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=y,this.target=j,this.currentTarget=null;for(var C in n)n.hasOwnProperty(C)&&(l=n[C],this[C]=l?l(y):y[C]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Zl:ag,this.isPropagationStopped=ag,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Zl)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Zl)},persist:function(){},isPersistent:Zl}),s}var hs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jl=In(hs),Jo=x({},hs,{view:0,detail:0}),Kw=In(Jo),Rd,Td,Wo,Wl=x({},Jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Wo&&(Wo&&n.type==="mousemove"?(Rd=n.screenX-Wo.screenX,Td=n.screenY-Wo.screenY):Td=Rd=0,Wo=n),Rd)},movementY:function(n){return"movementY"in n?n.movementY:Td}}),sg=In(Wl),Xw=x({},Wl,{dataTransfer:0}),Qw=In(Xw),Zw=x({},Jo,{relatedTarget:0}),Ld=In(Zw),Jw=x({},hs,{animationName:0,elapsedTime:0,pseudoElement:0}),Ww=In(Jw),eS=x({},hs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),tS=In(eS),nS=x({},hs,{data:0}),og=In(nS),rS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aS={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"},sS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oS(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=sS[n])?!!s[n]:!1}function Dd(){return oS}var iS=x({},Jo,{key:function(n){if(n.key){var s=rS[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Ql(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?aS[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dd,charCode:function(n){return n.type==="keypress"?Ql(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ql(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),lS=In(iS),cS=x({},Wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ig=In(cS),uS=x({},Jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dd}),dS=In(uS),fS=x({},hs,{propertyName:0,elapsedTime:0,pseudoElement:0}),pS=In(fS),hS=x({},Wl,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),mS=In(hS),gS=x({},hs,{newState:0,oldState:0}),xS=In(gS),yS=[9,13,27,32],Od=ca&&"CompositionEvent"in window,ei=null;ca&&"documentMode"in document&&(ei=document.documentMode);var bS=ca&&"TextEvent"in window&&!ei,lg=ca&&(!Od||ei&&8<ei&&11>=ei),cg=" ",ug=!1;function dg(n,s){switch(n){case"keyup":return yS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Js=!1;function vS(n,s){switch(n){case"compositionend":return fg(s);case"keypress":return s.which!==32?null:(ug=!0,cg);case"textInput":return n=s.data,n===cg&&ug?null:n;default:return null}}function _S(n,s){if(Js)return n==="compositionend"||!Od&&dg(n,s)?(n=rg(),Xl=Ad=za=null,Js=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return lg&&s.locale!=="ko"?null:s.data;default:return null}}var wS={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 pg(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!wS[n.type]:s==="textarea"}function hg(n,s,l,d){Qs?Zs?Zs.push(d):Zs=[d]:Qs=d,s=Hc(s,"onChange"),0<s.length&&(l=new Jl("onChange","change",null,l,d),n.push({event:l,listeners:s}))}var ti=null,ni=null;function SS(n){Qy(n,0)}function ec(n){var s=Oe(n);if(Vl(s))return n}function mg(n,s){if(n==="change")return s}var gg=!1;if(ca){var Md;if(ca){var zd="oninput"in document;if(!zd){var xg=document.createElement("div");xg.setAttribute("oninput","return;"),zd=typeof xg.oninput=="function"}Md=zd}else Md=!1;gg=Md&&(!document.documentMode||9<document.documentMode)}function yg(){ti&&(ti.detachEvent("onpropertychange",bg),ni=ti=null)}function bg(n){if(n.propertyName==="value"&&ec(ni)){var s=[];hg(s,ni,n,Nd(n)),ng(SS,s)}}function jS(n,s,l){n==="focusin"?(yg(),ti=s,ni=l,ti.attachEvent("onpropertychange",bg)):n==="focusout"&&yg()}function kS(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ec(ni)}function NS(n,s){if(n==="click")return ec(s)}function ES(n,s){if(n==="input"||n==="change")return ec(s)}function CS(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Qn=typeof Object.is=="function"?Object.is:CS;function ri(n,s){if(Qn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var l=Object.keys(n),d=Object.keys(s);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var g=l[d];if(!un.call(s,g)||!Qn(n[g],s[g]))return!1}return!0}function vg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function _g(n,s){var l=vg(n);n=0;for(var d;l;){if(l.nodeType===3){if(d=n+l.textContent.length,n<=s&&d>=s)return{node:l,offset:s-n};n=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=vg(l)}}function wg(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?wg(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Sg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=Yl(n.document);s instanceof n.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)n=s.contentWindow;else break;s=Yl(n.document)}return s}function $d(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var AS=ca&&"documentMode"in document&&11>=document.documentMode,Ws=null,Bd=null,ai=null,Id=!1;function jg(n,s,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Id||Ws==null||Ws!==Yl(d)||(d=Ws,"selectionStart"in d&&$d(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),ai&&ri(ai,d)||(ai=d,d=Hc(Bd,"onSelect"),0<d.length&&(s=new Jl("onSelect","select",null,s,l),n.push({event:s,listeners:d}),s.target=Ws)))}function ms(n,s){var l={};return l[n.toLowerCase()]=s.toLowerCase(),l["Webkit"+n]="webkit"+s,l["Moz"+n]="moz"+s,l}var eo={animationend:ms("Animation","AnimationEnd"),animationiteration:ms("Animation","AnimationIteration"),animationstart:ms("Animation","AnimationStart"),transitionrun:ms("Transition","TransitionRun"),transitionstart:ms("Transition","TransitionStart"),transitioncancel:ms("Transition","TransitionCancel"),transitionend:ms("Transition","TransitionEnd")},Ud={},kg={};ca&&(kg=document.createElement("div").style,"AnimationEvent"in window||(delete eo.animationend.animation,delete eo.animationiteration.animation,delete eo.animationstart.animation),"TransitionEvent"in window||delete eo.transitionend.transition);function gs(n){if(Ud[n])return Ud[n];if(!eo[n])return n;var s=eo[n],l;for(l in s)if(s.hasOwnProperty(l)&&l in kg)return Ud[n]=s[l];return n}var Ng=gs("animationend"),Eg=gs("animationiteration"),Cg=gs("animationstart"),RS=gs("transitionrun"),TS=gs("transitionstart"),LS=gs("transitioncancel"),Ag=gs("transitionend"),Rg=new Map,Pd="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(" ");Pd.push("scrollEnd");function Cr(n,s){Rg.set(n,s),dn(s,[n])}var tc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},fr=[],to=0,Hd=0;function nc(){for(var n=to,s=Hd=to=0;s<n;){var l=fr[s];fr[s++]=null;var d=fr[s];fr[s++]=null;var g=fr[s];fr[s++]=null;var y=fr[s];if(fr[s++]=null,d!==null&&g!==null){var j=d.pending;j===null?g.next=g:(g.next=j.next,j.next=g),d.pending=g}y!==0&&Tg(l,g,y)}}function rc(n,s,l,d){fr[to++]=n,fr[to++]=s,fr[to++]=l,fr[to++]=d,Hd|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function qd(n,s,l,d){return rc(n,s,l,d),ac(n)}function xs(n,s){return rc(n,null,null,s),ac(n)}function Tg(n,s,l){n.lanes|=l;var d=n.alternate;d!==null&&(d.lanes|=l);for(var g=!1,y=n.return;y!==null;)y.childLanes|=l,d=y.alternate,d!==null&&(d.childLanes|=l),y.tag===22&&(n=y.stateNode,n===null||n._visibility&1||(g=!0)),n=y,y=y.return;return n.tag===3?(y=n.stateNode,g&&s!==null&&(g=31-Pt(l),n=y.hiddenUpdates,d=n[g],d===null?n[g]=[s]:d.push(s),s.lane=l|536870912),y):null}function ac(n){if(50<Ni)throw Ni=0,Wf=null,Error(a(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var no={};function DS(n,s,l,d){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(n,s,l,d){return new DS(n,s,l,d)}function Fd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ua(n,s){var l=n.alternate;return l===null?(l=Zn(n.tag,s,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=s,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&65011712,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,s=n.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l.refCleanup=n.refCleanup,l}function Lg(n,s){n.flags&=65011714;var l=n.alternate;return l===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=l.childLanes,n.lanes=l.lanes,n.child=l.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=l.memoizedProps,n.memoizedState=l.memoizedState,n.updateQueue=l.updateQueue,n.type=l.type,s=l.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function sc(n,s,l,d,g,y){var j=0;if(d=n,typeof n=="function")Fd(n)&&(j=1);else if(typeof n=="string")j=Bj(n,l,se.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=Zn(31,l,s,g),n.elementType=B,n.lanes=y,n;case S:return ys(l.children,g,y,s);case k:j=8,g|=24;break;case N:return n=Zn(12,l,s,g|2),n.elementType=N,n.lanes=y,n;case L:return n=Zn(13,l,s,g),n.elementType=L,n.lanes=y,n;case z:return n=Zn(19,l,s,g),n.elementType=z,n.lanes=y,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case E:j=10;break e;case A:j=9;break e;case D:j=11;break e;case $:j=14;break e;case R:j=16,d=null;break e}j=29,l=Error(a(130,n===null?"null":typeof n,"")),d=null}return s=Zn(j,l,s,g),s.elementType=n,s.type=d,s.lanes=y,s}function ys(n,s,l,d){return n=Zn(7,n,d,s),n.lanes=l,n}function Gd(n,s,l){return n=Zn(6,n,null,s),n.lanes=l,n}function Dg(n){var s=Zn(18,null,null,0);return s.stateNode=n,s}function Vd(n,s,l){return s=Zn(4,n.children!==null?n.children:[],n.key,s),s.lanes=l,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var Og=new WeakMap;function pr(n,s){if(typeof n=="object"&&n!==null){var l=Og.get(n);return l!==void 0?l:(s={value:n,source:s,stack:It(s)},Og.set(n,s),s)}return{value:n,source:s,stack:It(s)}}var ro=[],ao=0,oc=null,si=0,hr=[],mr=0,$a=null,Ur=1,Pr="";function da(n,s){ro[ao++]=si,ro[ao++]=oc,oc=n,si=s}function Mg(n,s,l){hr[mr++]=Ur,hr[mr++]=Pr,hr[mr++]=$a,$a=n;var d=Ur;n=Pr;var g=32-Pt(d)-1;d&=~(1<<g),l+=1;var y=32-Pt(s)+g;if(30<y){var j=g-g%5;y=(d&(1<<j)-1).toString(32),d>>=j,g-=j,Ur=1<<32-Pt(s)+g|l<<g|d,Pr=y+n}else Ur=1<<y|l<<g|d,Pr=n}function Yd(n){n.return!==null&&(da(n,1),Mg(n,1,0))}function Kd(n){for(;n===oc;)oc=ro[--ao],ro[ao]=null,si=ro[--ao],ro[ao]=null;for(;n===$a;)$a=hr[--mr],hr[mr]=null,Pr=hr[--mr],hr[mr]=null,Ur=hr[--mr],hr[mr]=null}function zg(n,s){hr[mr++]=Ur,hr[mr++]=Pr,hr[mr++]=$a,Ur=s.id,Pr=s.overflow,$a=n}var xn=null,Mt=null,ut=!1,Ba=null,gr=!1,Xd=Error(a(519));function Ia(n){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw oi(pr(s,n)),Xd}function $g(n){var s=n.stateNode,l=n.type,d=n.memoizedProps;switch(s[je]=n,s[ke]=d,l){case"dialog":ot("cancel",s),ot("close",s);break;case"iframe":case"object":case"embed":ot("load",s);break;case"video":case"audio":for(l=0;l<Ci.length;l++)ot(Ci[l],s);break;case"source":ot("error",s);break;case"img":case"image":case"link":ot("error",s),ot("load",s);break;case"details":ot("toggle",s);break;case"input":ot("invalid",s),Qm(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ot("invalid",s);break;case"textarea":ot("invalid",s),Jm(s,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||s.textContent===""+l||d.suppressHydrationWarning===!0||eb(s.textContent,l)?(d.popover!=null&&(ot("beforetoggle",s),ot("toggle",s)),d.onScroll!=null&&ot("scroll",s),d.onScrollEnd!=null&&ot("scrollend",s),d.onClick!=null&&(s.onclick=la),s=!0):s=!1,s||Ia(n,!0)}function Bg(n){for(xn=n.return;xn;)switch(xn.tag){case 5:case 31:case 13:gr=!1;return;case 27:case 3:gr=!0;return;default:xn=xn.return}}function so(n){if(n!==xn)return!1;if(!ut)return Bg(n),ut=!0,!1;var s=n.tag,l;if((l=s!==3&&s!==27)&&((l=s===5)&&(l=n.type,l=!(l!=="form"&&l!=="button")||hp(n.type,n.memoizedProps)),l=!l),l&&Mt&&Ia(n),Bg(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));Mt=cb(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));Mt=cb(n)}else s===27?(s=Mt,Wa(n.type)?(n=bp,bp=null,Mt=n):Mt=s):Mt=xn?yr(n.stateNode.nextSibling):null;return!0}function bs(){Mt=xn=null,ut=!1}function Qd(){var n=Ba;return n!==null&&(qn===null?qn=n:qn.push.apply(qn,n),Ba=null),n}function oi(n){Ba===null?Ba=[n]:Ba.push(n)}var Zd=O(null),vs=null,fa=null;function Ua(n,s,l){re(Zd,s._currentValue),s._currentValue=l}function pa(n){n._currentValue=Zd.current,V(Zd)}function Jd(n,s,l){for(;n!==null;){var d=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),n===l)break;n=n.return}}function Wd(n,s,l,d){var g=n.child;for(g!==null&&(g.return=n);g!==null;){var y=g.dependencies;if(y!==null){var j=g.child;y=y.firstContext;e:for(;y!==null;){var C=y;y=g;for(var U=0;U<s.length;U++)if(C.context===s[U]){y.lanes|=l,C=y.alternate,C!==null&&(C.lanes|=l),Jd(y.return,l,n),d||(j=null);break e}y=C.next}}else if(g.tag===18){if(j=g.return,j===null)throw Error(a(341));j.lanes|=l,y=j.alternate,y!==null&&(y.lanes|=l),Jd(j,l,n),j=null}else j=g.child;if(j!==null)j.return=g;else for(j=g;j!==null;){if(j===n){j=null;break}if(g=j.sibling,g!==null){g.return=j.return,j=g;break}j=j.return}g=j}}function oo(n,s,l,d){n=null;for(var g=s,y=!1;g!==null;){if(!y){if((g.flags&524288)!==0)y=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var j=g.alternate;if(j===null)throw Error(a(387));if(j=j.memoizedProps,j!==null){var C=g.type;Qn(g.pendingProps.value,j.value)||(n!==null?n.push(C):n=[C])}}else if(g===Ne.current){if(j=g.alternate,j===null)throw Error(a(387));j.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(n!==null?n.push(Di):n=[Di])}g=g.return}n!==null&&Wd(s,n,l,d),s.flags|=262144}function ic(n){for(n=n.firstContext;n!==null;){if(!Qn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function _s(n){vs=n,fa=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function yn(n){return Ig(vs,n)}function lc(n,s){return vs===null&&_s(n),Ig(n,s)}function Ig(n,s){var l=s._currentValue;if(s={context:s,memoizedValue:l,next:null},fa===null){if(n===null)throw Error(a(308));fa=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else fa=fa.next=s;return l}var OS=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(l,d){n.push(d)}};this.abort=function(){s.aborted=!0,n.forEach(function(l){return l()})}},MS=e.unstable_scheduleCallback,zS=e.unstable_NormalPriority,Wt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ef(){return{controller:new OS,data:new Map,refCount:0}}function ii(n){n.refCount--,n.refCount===0&&MS(zS,function(){n.controller.abort()})}var li=null,tf=0,io=0,lo=null;function $S(n,s){if(li===null){var l=li=[];tf=0,io=sp(),lo={status:"pending",value:void 0,then:function(d){l.push(d)}}}return tf++,s.then(Ug,Ug),s}function Ug(){if(--tf===0&&li!==null){lo!==null&&(lo.status="fulfilled");var n=li;li=null,io=0,lo=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function BS(n,s){var l=[],d={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return n.then(function(){d.status="fulfilled",d.value=s;for(var g=0;g<l.length;g++)(0,l[g])(s)},function(g){for(d.status="rejected",d.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),d}var Pg=T.S;T.S=function(n,s){jy=Ht(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&$S(n,s),Pg!==null&&Pg(n,s)};var ws=O(null);function nf(){var n=ws.current;return n!==null?n:jt.pooledCache}function cc(n,s){s===null?re(ws,ws.current):re(ws,s.pool)}function Hg(){var n=nf();return n===null?null:{parent:Wt._currentValue,pool:n}}var co=Error(a(460)),rf=Error(a(474)),uc=Error(a(542)),dc={then:function(){}};function qg(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Fg(n,s,l){switch(l=n[l],l===void 0?n.push(s):l!==s&&(s.then(la,la),s=l),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,Vg(n),n;default:if(typeof s.status=="string")s.then(la,la);else{if(n=jt,n!==null&&100<n.shellSuspendCounter)throw Error(a(482));n=s,n.status="pending",n.then(function(d){if(s.status==="pending"){var g=s;g.status="fulfilled",g.value=d}},function(d){if(s.status==="pending"){var g=s;g.status="rejected",g.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,Vg(n),n}throw js=s,co}}function Ss(n){try{var s=n._init;return s(n._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(js=l,co):l}}var js=null;function Gg(){if(js===null)throw Error(a(459));var n=js;return js=null,n}function Vg(n){if(n===co||n===uc)throw Error(a(483))}var uo=null,ci=0;function fc(n){var s=ci;return ci+=1,uo===null&&(uo=[]),Fg(uo,n,s)}function ui(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function pc(n,s){throw s.$$typeof===v?Error(a(525)):(n=Object.prototype.toString.call(s),Error(a(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function Yg(n){function s(Y,q){if(n){var K=Y.deletions;K===null?(Y.deletions=[q],Y.flags|=16):K.push(q)}}function l(Y,q){if(!n)return null;for(;q!==null;)s(Y,q),q=q.sibling;return null}function d(Y){for(var q=new Map;Y!==null;)Y.key!==null?q.set(Y.key,Y):q.set(Y.index,Y),Y=Y.sibling;return q}function g(Y,q){return Y=ua(Y,q),Y.index=0,Y.sibling=null,Y}function y(Y,q,K){return Y.index=K,n?(K=Y.alternate,K!==null?(K=K.index,K<q?(Y.flags|=67108866,q):K):(Y.flags|=67108866,q)):(Y.flags|=1048576,q)}function j(Y){return n&&Y.alternate===null&&(Y.flags|=67108866),Y}function C(Y,q,K,de){return q===null||q.tag!==6?(q=Gd(K,Y.mode,de),q.return=Y,q):(q=g(q,K),q.return=Y,q)}function U(Y,q,K,de){var He=K.type;return He===S?ie(Y,q,K.props.children,de,K.key):q!==null&&(q.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===R&&Ss(He)===q.type)?(q=g(q,K.props),ui(q,K),q.return=Y,q):(q=sc(K.type,K.key,K.props,null,Y.mode,de),ui(q,K),q.return=Y,q)}function X(Y,q,K,de){return q===null||q.tag!==4||q.stateNode.containerInfo!==K.containerInfo||q.stateNode.implementation!==K.implementation?(q=Vd(K,Y.mode,de),q.return=Y,q):(q=g(q,K.children||[]),q.return=Y,q)}function ie(Y,q,K,de,He){return q===null||q.tag!==7?(q=ys(K,Y.mode,de,He),q.return=Y,q):(q=g(q,K),q.return=Y,q)}function pe(Y,q,K){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Gd(""+q,Y.mode,K),q.return=Y,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return K=sc(q.type,q.key,q.props,null,Y.mode,K),ui(K,q),K.return=Y,K;case w:return q=Vd(q,Y.mode,K),q.return=Y,q;case R:return q=Ss(q),pe(Y,q,K)}if(P(q)||oe(q))return q=ys(q,Y.mode,K,null),q.return=Y,q;if(typeof q.then=="function")return pe(Y,fc(q),K);if(q.$$typeof===E)return pe(Y,lc(Y,q),K);pc(Y,q)}return null}function Q(Y,q,K,de){var He=q!==null?q.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return He!==null?null:C(Y,q,""+K,de);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case _:return K.key===He?U(Y,q,K,de):null;case w:return K.key===He?X(Y,q,K,de):null;case R:return K=Ss(K),Q(Y,q,K,de)}if(P(K)||oe(K))return He!==null?null:ie(Y,q,K,de,null);if(typeof K.then=="function")return Q(Y,q,fc(K),de);if(K.$$typeof===E)return Q(Y,q,lc(Y,K),de);pc(Y,K)}return null}function te(Y,q,K,de,He){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return Y=Y.get(K)||null,C(q,Y,""+de,He);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case _:return Y=Y.get(de.key===null?K:de.key)||null,U(q,Y,de,He);case w:return Y=Y.get(de.key===null?K:de.key)||null,X(q,Y,de,He);case R:return de=Ss(de),te(Y,q,K,de,He)}if(P(de)||oe(de))return Y=Y.get(K)||null,ie(q,Y,de,He,null);if(typeof de.then=="function")return te(Y,q,K,fc(de),He);if(de.$$typeof===E)return te(Y,q,K,lc(q,de),He);pc(q,de)}return null}function Te(Y,q,K,de){for(var He=null,pt=null,Me=q,et=q=0,ct=null;Me!==null&&et<K.length;et++){Me.index>et?(ct=Me,Me=null):ct=Me.sibling;var ht=Q(Y,Me,K[et],de);if(ht===null){Me===null&&(Me=ct);break}n&&Me&&ht.alternate===null&&s(Y,Me),q=y(ht,q,et),pt===null?He=ht:pt.sibling=ht,pt=ht,Me=ct}if(et===K.length)return l(Y,Me),ut&&da(Y,et),He;if(Me===null){for(;et<K.length;et++)Me=pe(Y,K[et],de),Me!==null&&(q=y(Me,q,et),pt===null?He=Me:pt.sibling=Me,pt=Me);return ut&&da(Y,et),He}for(Me=d(Me);et<K.length;et++)ct=te(Me,Y,et,K[et],de),ct!==null&&(n&&ct.alternate!==null&&Me.delete(ct.key===null?et:ct.key),q=y(ct,q,et),pt===null?He=ct:pt.sibling=ct,pt=ct);return n&&Me.forEach(function(as){return s(Y,as)}),ut&&da(Y,et),He}function Ye(Y,q,K,de){if(K==null)throw Error(a(151));for(var He=null,pt=null,Me=q,et=q=0,ct=null,ht=K.next();Me!==null&&!ht.done;et++,ht=K.next()){Me.index>et?(ct=Me,Me=null):ct=Me.sibling;var as=Q(Y,Me,ht.value,de);if(as===null){Me===null&&(Me=ct);break}n&&Me&&as.alternate===null&&s(Y,Me),q=y(as,q,et),pt===null?He=as:pt.sibling=as,pt=as,Me=ct}if(ht.done)return l(Y,Me),ut&&da(Y,et),He;if(Me===null){for(;!ht.done;et++,ht=K.next())ht=pe(Y,ht.value,de),ht!==null&&(q=y(ht,q,et),pt===null?He=ht:pt.sibling=ht,pt=ht);return ut&&da(Y,et),He}for(Me=d(Me);!ht.done;et++,ht=K.next())ht=te(Me,Y,et,ht.value,de),ht!==null&&(n&&ht.alternate!==null&&Me.delete(ht.key===null?et:ht.key),q=y(ht,q,et),pt===null?He=ht:pt.sibling=ht,pt=ht);return n&&Me.forEach(function(Xj){return s(Y,Xj)}),ut&&da(Y,et),He}function _t(Y,q,K,de){if(typeof K=="object"&&K!==null&&K.type===S&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case _:e:{for(var He=K.key;q!==null;){if(q.key===He){if(He=K.type,He===S){if(q.tag===7){l(Y,q.sibling),de=g(q,K.props.children),de.return=Y,Y=de;break e}}else if(q.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===R&&Ss(He)===q.type){l(Y,q.sibling),de=g(q,K.props),ui(de,K),de.return=Y,Y=de;break e}l(Y,q);break}else s(Y,q);q=q.sibling}K.type===S?(de=ys(K.props.children,Y.mode,de,K.key),de.return=Y,Y=de):(de=sc(K.type,K.key,K.props,null,Y.mode,de),ui(de,K),de.return=Y,Y=de)}return j(Y);case w:e:{for(He=K.key;q!==null;){if(q.key===He)if(q.tag===4&&q.stateNode.containerInfo===K.containerInfo&&q.stateNode.implementation===K.implementation){l(Y,q.sibling),de=g(q,K.children||[]),de.return=Y,Y=de;break e}else{l(Y,q);break}else s(Y,q);q=q.sibling}de=Vd(K,Y.mode,de),de.return=Y,Y=de}return j(Y);case R:return K=Ss(K),_t(Y,q,K,de)}if(P(K))return Te(Y,q,K,de);if(oe(K)){if(He=oe(K),typeof He!="function")throw Error(a(150));return K=He.call(K),Ye(Y,q,K,de)}if(typeof K.then=="function")return _t(Y,q,fc(K),de);if(K.$$typeof===E)return _t(Y,q,lc(Y,K),de);pc(Y,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,q!==null&&q.tag===6?(l(Y,q.sibling),de=g(q,K),de.return=Y,Y=de):(l(Y,q),de=Gd(K,Y.mode,de),de.return=Y,Y=de),j(Y)):l(Y,q)}return function(Y,q,K,de){try{ci=0;var He=_t(Y,q,K,de);return uo=null,He}catch(Me){if(Me===co||Me===uc)throw Me;var pt=Zn(29,Me,null,Y.mode);return pt.lanes=de,pt.return=Y,pt}}}var ks=Yg(!0),Kg=Yg(!1),Pa=!1;function af(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sf(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Ha(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function qa(n,s,l){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(mt&2)!==0){var g=d.pending;return g===null?s.next=s:(s.next=g.next,g.next=s),d.pending=s,s=ac(n),Tg(n,null,l),s}return rc(n,d,s,l),ac(n)}function di(n,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194048)!==0)){var d=s.lanes;d&=n.pendingLanes,l|=d,s.lanes=l,Ma(n,l)}}function of(n,s){var l=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var j={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};y===null?g=y=j:y=y.next=j,l=l.next}while(l!==null);y===null?g=y=s:y=y.next=s}else g=y=s;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=s:n.next=s,l.lastBaseUpdate=s}var lf=!1;function fi(){if(lf){var n=lo;if(n!==null)throw n}}function pi(n,s,l,d){lf=!1;var g=n.updateQueue;Pa=!1;var y=g.firstBaseUpdate,j=g.lastBaseUpdate,C=g.shared.pending;if(C!==null){g.shared.pending=null;var U=C,X=U.next;U.next=null,j===null?y=X:j.next=X,j=U;var ie=n.alternate;ie!==null&&(ie=ie.updateQueue,C=ie.lastBaseUpdate,C!==j&&(C===null?ie.firstBaseUpdate=X:C.next=X,ie.lastBaseUpdate=U))}if(y!==null){var pe=g.baseState;j=0,ie=X=U=null,C=y;do{var Q=C.lane&-536870913,te=Q!==C.lane;if(te?(lt&Q)===Q:(d&Q)===Q){Q!==0&&Q===io&&(lf=!0),ie!==null&&(ie=ie.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Te=n,Ye=C;Q=s;var _t=l;switch(Ye.tag){case 1:if(Te=Ye.payload,typeof Te=="function"){pe=Te.call(_t,pe,Q);break e}pe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ye.payload,Q=typeof Te=="function"?Te.call(_t,pe,Q):Te,Q==null)break e;pe=x({},pe,Q);break e;case 2:Pa=!0}}Q=C.callback,Q!==null&&(n.flags|=64,te&&(n.flags|=8192),te=g.callbacks,te===null?g.callbacks=[Q]:te.push(Q))}else te={lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ie===null?(X=ie=te,U=pe):ie=ie.next=te,j|=Q;if(C=C.next,C===null){if(C=g.shared.pending,C===null)break;te=C,C=te.next,te.next=null,g.lastBaseUpdate=te,g.shared.pending=null}}while(!0);ie===null&&(U=pe),g.baseState=U,g.firstBaseUpdate=X,g.lastBaseUpdate=ie,y===null&&(g.shared.lanes=0),Ka|=j,n.lanes=j,n.memoizedState=pe}}function Xg(n,s){if(typeof n!="function")throw Error(a(191,n));n.call(s)}function Qg(n,s){var l=n.callbacks;if(l!==null)for(n.callbacks=null,n=0;n<l.length;n++)Xg(l[n],s)}var fo=O(null),hc=O(0);function Zg(n,s){n=wa,re(hc,n),re(fo,s),wa=n|s.baseLanes}function cf(){re(hc,wa),re(fo,fo.current)}function uf(){wa=hc.current,V(fo),V(hc)}var Jn=O(null),xr=null;function Fa(n){var s=n.alternate;re(Kt,Kt.current&1),re(Jn,n),xr===null&&(s===null||fo.current!==null||s.memoizedState!==null)&&(xr=n)}function df(n){re(Kt,Kt.current),re(Jn,n),xr===null&&(xr=n)}function Jg(n){n.tag===22?(re(Kt,Kt.current),re(Jn,n),xr===null&&(xr=n)):Ga()}function Ga(){re(Kt,Kt.current),re(Jn,Jn.current)}function Wn(n){V(Jn),xr===n&&(xr=null),V(Kt)}var Kt=O(0);function mc(n){for(var s=n;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||xp(l)||yp(l)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ha=0,Je=null,bt=null,en=null,gc=!1,po=!1,Ns=!1,xc=0,hi=0,ho=null,IS=0;function qt(){throw Error(a(321))}function ff(n,s){if(s===null)return!1;for(var l=0;l<s.length&&l<n.length;l++)if(!Qn(n[l],s[l]))return!1;return!0}function pf(n,s,l,d,g,y){return ha=y,Je=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,T.H=n===null||n.memoizedState===null?Mx:Cf,Ns=!1,y=l(d,g),Ns=!1,po&&(y=ex(s,l,d,g)),Wg(n),y}function Wg(n){T.H=xi;var s=bt!==null&&bt.next!==null;if(ha=0,en=bt=Je=null,gc=!1,hi=0,ho=null,s)throw Error(a(300));n===null||tn||(n=n.dependencies,n!==null&&ic(n)&&(tn=!0))}function ex(n,s,l,d){Je=n;var g=0;do{if(po&&(ho=null),hi=0,po=!1,25<=g)throw Error(a(301));if(g+=1,en=bt=null,n.updateQueue!=null){var y=n.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}T.H=zx,y=s(l,d)}while(po);return y}function US(){var n=T.H,s=n.useState()[0];return s=typeof s.then=="function"?mi(s):s,n=n.useState()[0],(bt!==null?bt.memoizedState:null)!==n&&(Je.flags|=1024),s}function hf(){var n=xc!==0;return xc=0,n}function mf(n,s,l){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~l}function gf(n){if(gc){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}gc=!1}ha=0,en=bt=Je=null,po=!1,hi=xc=0,ho=null}function Ln(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Je.memoizedState=en=n:en=en.next=n,en}function Xt(){if(bt===null){var n=Je.alternate;n=n!==null?n.memoizedState:null}else n=bt.next;var s=en===null?Je.memoizedState:en.next;if(s!==null)en=s,bt=n;else{if(n===null)throw Je.alternate===null?Error(a(467)):Error(a(310));bt=n,n={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},en===null?Je.memoizedState=en=n:en=en.next=n}return en}function yc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function mi(n){var s=hi;return hi+=1,ho===null&&(ho=[]),n=Fg(ho,n,s),s=Je,(en===null?s.memoizedState:en.next)===null&&(s=s.alternate,T.H=s===null||s.memoizedState===null?Mx:Cf),n}function bc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return mi(n);if(n.$$typeof===E)return yn(n)}throw Error(a(438,String(n)))}function xf(n){var s=null,l=Je.updateQueue;if(l!==null&&(s=l.memoCache),s==null){var d=Je.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(g){return g.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),l===null&&(l=yc(),Je.updateQueue=l),l.memoCache=s,l=s.data[s.index],l===void 0)for(l=s.data[s.index]=Array(n),d=0;d<n;d++)l[d]=H;return s.index++,l}function ma(n,s){return typeof s=="function"?s(n):s}function vc(n){var s=Xt();return yf(s,bt,n)}function yf(n,s,l){var d=n.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var g=n.baseQueue,y=d.pending;if(y!==null){if(g!==null){var j=g.next;g.next=y.next,y.next=j}s.baseQueue=g=y,d.pending=null}if(y=n.baseState,g===null)n.memoizedState=y;else{s=g.next;var C=j=null,U=null,X=s,ie=!1;do{var pe=X.lane&-536870913;if(pe!==X.lane?(lt&pe)===pe:(ha&pe)===pe){var Q=X.revertLane;if(Q===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),pe===io&&(ie=!0);else if((ha&Q)===Q){X=X.next,Q===io&&(ie=!0);continue}else pe={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},U===null?(C=U=pe,j=y):U=U.next=pe,Je.lanes|=Q,Ka|=Q;pe=X.action,Ns&&l(y,pe),y=X.hasEagerState?X.eagerState:l(y,pe)}else Q={lane:pe,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},U===null?(C=U=Q,j=y):U=U.next=Q,Je.lanes|=pe,Ka|=pe;X=X.next}while(X!==null&&X!==s);if(U===null?j=y:U.next=C,!Qn(y,n.memoizedState)&&(tn=!0,ie&&(l=lo,l!==null)))throw l;n.memoizedState=y,n.baseState=j,n.baseQueue=U,d.lastRenderedState=y}return g===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function bf(n){var s=Xt(),l=s.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=n;var d=l.dispatch,g=l.pending,y=s.memoizedState;if(g!==null){l.pending=null;var j=g=g.next;do y=n(y,j.action),j=j.next;while(j!==g);Qn(y,s.memoizedState)||(tn=!0),s.memoizedState=y,s.baseQueue===null&&(s.baseState=y),l.lastRenderedState=y}return[y,d]}function tx(n,s,l){var d=Je,g=Xt(),y=ut;if(y){if(l===void 0)throw Error(a(407));l=l()}else l=s();var j=!Qn((bt||g).memoizedState,l);if(j&&(g.memoizedState=l,tn=!0),g=g.queue,wf(ax.bind(null,d,g,n),[n]),g.getSnapshot!==s||j||en!==null&&en.memoizedState.tag&1){if(d.flags|=2048,mo(9,{destroy:void 0},rx.bind(null,d,g,l,s),null),jt===null)throw Error(a(349));y||(ha&127)!==0||nx(d,s,l)}return l}function nx(n,s,l){n.flags|=16384,n={getSnapshot:s,value:l},s=Je.updateQueue,s===null?(s=yc(),Je.updateQueue=s,s.stores=[n]):(l=s.stores,l===null?s.stores=[n]:l.push(n))}function rx(n,s,l,d){s.value=l,s.getSnapshot=d,sx(s)&&ox(n)}function ax(n,s,l){return l(function(){sx(s)&&ox(n)})}function sx(n){var s=n.getSnapshot;n=n.value;try{var l=s();return!Qn(n,l)}catch{return!0}}function ox(n){var s=xs(n,2);s!==null&&Fn(s,n,2)}function vf(n){var s=Ln();if(typeof n=="function"){var l=n;if(n=l(),Ns){Et(!0);try{l()}finally{Et(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ma,lastRenderedState:n},s}function ix(n,s,l,d){return n.baseState=l,yf(n,bt,typeof d=="function"?d:ma)}function PS(n,s,l,d,g){if(Sc(n))throw Error(a(485));if(n=s.action,n!==null){var y={payload:g,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){y.listeners.push(j)}};T.T!==null?l(!0):y.isTransition=!1,d(y),l=s.pending,l===null?(y.next=s.pending=y,lx(s,y)):(y.next=l.next,s.pending=l.next=y)}}function lx(n,s){var l=s.action,d=s.payload,g=n.state;if(s.isTransition){var y=T.T,j={};T.T=j;try{var C=l(g,d),U=T.S;U!==null&&U(j,C),cx(n,s,C)}catch(X){_f(n,s,X)}finally{y!==null&&j.types!==null&&(y.types=j.types),T.T=y}}else try{y=l(g,d),cx(n,s,y)}catch(X){_f(n,s,X)}}function cx(n,s,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){ux(n,s,d)},function(d){return _f(n,s,d)}):ux(n,s,l)}function ux(n,s,l){s.status="fulfilled",s.value=l,dx(s),n.state=l,s=n.pending,s!==null&&(l=s.next,l===s?n.pending=null:(l=l.next,s.next=l,lx(n,l)))}function _f(n,s,l){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=l,dx(s),s=s.next;while(s!==d)}n.action=null}function dx(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function fx(n,s){return s}function px(n,s){if(ut){var l=jt.formState;if(l!==null){e:{var d=Je;if(ut){if(Mt){t:{for(var g=Mt,y=gr;g.nodeType!==8;){if(!y){g=null;break t}if(g=yr(g.nextSibling),g===null){g=null;break t}}y=g.data,g=y==="F!"||y==="F"?g:null}if(g){Mt=yr(g.nextSibling),d=g.data==="F!";break e}}Ia(d)}d=!1}d&&(s=l[0])}}return l=Ln(),l.memoizedState=l.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fx,lastRenderedState:s},l.queue=d,l=Lx.bind(null,Je,d),d.dispatch=l,d=vf(!1),y=Ef.bind(null,Je,!1,d.queue),d=Ln(),g={state:s,dispatch:null,action:n,pending:null},d.queue=g,l=PS.bind(null,Je,g,y,l),g.dispatch=l,d.memoizedState=n,[s,l,!1]}function hx(n){var s=Xt();return mx(s,bt,n)}function mx(n,s,l){if(s=yf(n,s,fx)[0],n=vc(ma)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=mi(s)}catch(j){throw j===co?uc:j}else d=s;s=Xt();var g=s.queue,y=g.dispatch;return l!==s.memoizedState&&(Je.flags|=2048,mo(9,{destroy:void 0},HS.bind(null,g,l),null)),[d,y,n]}function HS(n,s){n.action=s}function gx(n){var s=Xt(),l=bt;if(l!==null)return mx(s,l,n);Xt(),s=s.memoizedState,l=Xt();var d=l.queue.dispatch;return l.memoizedState=n,[s,d,!1]}function mo(n,s,l,d){return n={tag:n,create:l,deps:d,inst:s,next:null},s=Je.updateQueue,s===null&&(s=yc(),Je.updateQueue=s),l=s.lastEffect,l===null?s.lastEffect=n.next=n:(d=l.next,l.next=n,n.next=d,s.lastEffect=n),n}function xx(){return Xt().memoizedState}function _c(n,s,l,d){var g=Ln();Je.flags|=n,g.memoizedState=mo(1|s,{destroy:void 0},l,d===void 0?null:d)}function wc(n,s,l,d){var g=Xt();d=d===void 0?null:d;var y=g.memoizedState.inst;bt!==null&&d!==null&&ff(d,bt.memoizedState.deps)?g.memoizedState=mo(s,y,l,d):(Je.flags|=n,g.memoizedState=mo(1|s,y,l,d))}function yx(n,s){_c(8390656,8,n,s)}function wf(n,s){wc(2048,8,n,s)}function qS(n){Je.flags|=4;var s=Je.updateQueue;if(s===null)s=yc(),Je.updateQueue=s,s.events=[n];else{var l=s.events;l===null?s.events=[n]:l.push(n)}}function bx(n){var s=Xt().memoizedState;return qS({ref:s,nextImpl:n}),function(){if((mt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function vx(n,s){return wc(4,2,n,s)}function _x(n,s){return wc(4,4,n,s)}function wx(n,s){if(typeof s=="function"){n=n();var l=s(n);return function(){typeof l=="function"?l():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function Sx(n,s,l){l=l!=null?l.concat([n]):null,wc(4,4,wx.bind(null,s,n),l)}function Sf(){}function jx(n,s){var l=Xt();s=s===void 0?null:s;var d=l.memoizedState;return s!==null&&ff(s,d[1])?d[0]:(l.memoizedState=[n,s],n)}function kx(n,s){var l=Xt();s=s===void 0?null:s;var d=l.memoizedState;if(s!==null&&ff(s,d[1]))return d[0];if(d=n(),Ns){Et(!0);try{n()}finally{Et(!1)}}return l.memoizedState=[d,s],d}function jf(n,s,l){return l===void 0||(ha&1073741824)!==0&&(lt&261930)===0?n.memoizedState=s:(n.memoizedState=l,n=Ny(),Je.lanes|=n,Ka|=n,l)}function Nx(n,s,l,d){return Qn(l,s)?l:fo.current!==null?(n=jf(n,l,d),Qn(n,s)||(tn=!0),n):(ha&42)===0||(ha&1073741824)!==0&&(lt&261930)===0?(tn=!0,n.memoizedState=l):(n=Ny(),Je.lanes|=n,Ka|=n,s)}function Ex(n,s,l,d,g){var y=F.p;F.p=y!==0&&8>y?y:8;var j=T.T,C={};T.T=C,Ef(n,!1,s,l);try{var U=g(),X=T.S;if(X!==null&&X(C,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ie=BS(U,d);gi(n,s,ie,nr(n))}else gi(n,s,d,nr(n))}catch(pe){gi(n,s,{then:function(){},status:"rejected",reason:pe},nr())}finally{F.p=y,j!==null&&C.types!==null&&(j.types=C.types),T.T=j}}function FS(){}function kf(n,s,l,d){if(n.tag!==5)throw Error(a(476));var g=Cx(n).queue;Ex(n,g,s,ee,l===null?FS:function(){return Ax(n),l(d)})}function Cx(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ma,lastRenderedState:ee},next:null};var l={};return s.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ma,lastRenderedState:l},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function Ax(n){var s=Cx(n);s.next===null&&(s=n.alternate.memoizedState),gi(n,s.next.queue,{},nr())}function Nf(){return yn(Di)}function Rx(){return Xt().memoizedState}function Tx(){return Xt().memoizedState}function GS(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var l=nr();n=Ha(l);var d=qa(s,n,l);d!==null&&(Fn(d,s,l),di(d,s,l)),s={cache:ef()},n.payload=s;return}s=s.return}}function VS(n,s,l){var d=nr();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Sc(n)?Dx(s,l):(l=qd(n,s,l,d),l!==null&&(Fn(l,n,d),Ox(l,s,d)))}function Lx(n,s,l){var d=nr();gi(n,s,l,d)}function gi(n,s,l,d){var g={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Sc(n))Dx(s,g);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=s.lastRenderedReducer,y!==null))try{var j=s.lastRenderedState,C=y(j,l);if(g.hasEagerState=!0,g.eagerState=C,Qn(C,j))return rc(n,s,g,0),jt===null&&nc(),!1}catch{}if(l=qd(n,s,g,d),l!==null)return Fn(l,n,d),Ox(l,s,d),!0}return!1}function Ef(n,s,l,d){if(d={lane:2,revertLane:sp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Sc(n)){if(s)throw Error(a(479))}else s=qd(n,l,d,2),s!==null&&Fn(s,n,2)}function Sc(n){var s=n.alternate;return n===Je||s!==null&&s===Je}function Dx(n,s){po=gc=!0;var l=n.pending;l===null?s.next=s:(s.next=l.next,l.next=s),n.pending=s}function Ox(n,s,l){if((l&4194048)!==0){var d=s.lanes;d&=n.pendingLanes,l|=d,s.lanes=l,Ma(n,l)}}var xi={readContext:yn,use:bc,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};xi.useEffectEvent=qt;var Mx={readContext:yn,use:bc,useCallback:function(n,s){return Ln().memoizedState=[n,s===void 0?null:s],n},useContext:yn,useEffect:yx,useImperativeHandle:function(n,s,l){l=l!=null?l.concat([n]):null,_c(4194308,4,wx.bind(null,s,n),l)},useLayoutEffect:function(n,s){return _c(4194308,4,n,s)},useInsertionEffect:function(n,s){_c(4,2,n,s)},useMemo:function(n,s){var l=Ln();s=s===void 0?null:s;var d=n();if(Ns){Et(!0);try{n()}finally{Et(!1)}}return l.memoizedState=[d,s],d},useReducer:function(n,s,l){var d=Ln();if(l!==void 0){var g=l(s);if(Ns){Et(!0);try{l(s)}finally{Et(!1)}}}else g=s;return d.memoizedState=d.baseState=g,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:g},d.queue=n,n=n.dispatch=VS.bind(null,Je,n),[d.memoizedState,n]},useRef:function(n){var s=Ln();return n={current:n},s.memoizedState=n},useState:function(n){n=vf(n);var s=n.queue,l=Lx.bind(null,Je,s);return s.dispatch=l,[n.memoizedState,l]},useDebugValue:Sf,useDeferredValue:function(n,s){var l=Ln();return jf(l,n,s)},useTransition:function(){var n=vf(!1);return n=Ex.bind(null,Je,n.queue,!0,!1),Ln().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,l){var d=Je,g=Ln();if(ut){if(l===void 0)throw Error(a(407));l=l()}else{if(l=s(),jt===null)throw Error(a(349));(lt&127)!==0||nx(d,s,l)}g.memoizedState=l;var y={value:l,getSnapshot:s};return g.queue=y,yx(ax.bind(null,d,y,n),[n]),d.flags|=2048,mo(9,{destroy:void 0},rx.bind(null,d,y,l,s),null),l},useId:function(){var n=Ln(),s=jt.identifierPrefix;if(ut){var l=Pr,d=Ur;l=(d&~(1<<32-Pt(d)-1)).toString(32)+l,s="_"+s+"R_"+l,l=xc++,0<l&&(s+="H"+l.toString(32)),s+="_"}else l=IS++,s="_"+s+"r_"+l.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:Nf,useFormState:px,useActionState:px,useOptimistic:function(n){var s=Ln();s.memoizedState=s.baseState=n;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=l,s=Ef.bind(null,Je,!0,l),l.dispatch=s,[n,s]},useMemoCache:xf,useCacheRefresh:function(){return Ln().memoizedState=GS.bind(null,Je)},useEffectEvent:function(n){var s=Ln(),l={impl:n};return s.memoizedState=l,function(){if((mt&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},Cf={readContext:yn,use:bc,useCallback:jx,useContext:yn,useEffect:wf,useImperativeHandle:Sx,useInsertionEffect:vx,useLayoutEffect:_x,useMemo:kx,useReducer:vc,useRef:xx,useState:function(){return vc(ma)},useDebugValue:Sf,useDeferredValue:function(n,s){var l=Xt();return Nx(l,bt.memoizedState,n,s)},useTransition:function(){var n=vc(ma)[0],s=Xt().memoizedState;return[typeof n=="boolean"?n:mi(n),s]},useSyncExternalStore:tx,useId:Rx,useHostTransitionStatus:Nf,useFormState:hx,useActionState:hx,useOptimistic:function(n,s){var l=Xt();return ix(l,bt,n,s)},useMemoCache:xf,useCacheRefresh:Tx};Cf.useEffectEvent=bx;var zx={readContext:yn,use:bc,useCallback:jx,useContext:yn,useEffect:wf,useImperativeHandle:Sx,useInsertionEffect:vx,useLayoutEffect:_x,useMemo:kx,useReducer:bf,useRef:xx,useState:function(){return bf(ma)},useDebugValue:Sf,useDeferredValue:function(n,s){var l=Xt();return bt===null?jf(l,n,s):Nx(l,bt.memoizedState,n,s)},useTransition:function(){var n=bf(ma)[0],s=Xt().memoizedState;return[typeof n=="boolean"?n:mi(n),s]},useSyncExternalStore:tx,useId:Rx,useHostTransitionStatus:Nf,useFormState:gx,useActionState:gx,useOptimistic:function(n,s){var l=Xt();return bt!==null?ix(l,bt,n,s):(l.baseState=n,[n,l.queue.dispatch])},useMemoCache:xf,useCacheRefresh:Tx};zx.useEffectEvent=bx;function Af(n,s,l,d){s=n.memoizedState,l=l(d,s),l=l==null?s:x({},s,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var Rf={enqueueSetState:function(n,s,l){n=n._reactInternals;var d=nr(),g=Ha(d);g.payload=s,l!=null&&(g.callback=l),s=qa(n,g,d),s!==null&&(Fn(s,n,d),di(s,n,d))},enqueueReplaceState:function(n,s,l){n=n._reactInternals;var d=nr(),g=Ha(d);g.tag=1,g.payload=s,l!=null&&(g.callback=l),s=qa(n,g,d),s!==null&&(Fn(s,n,d),di(s,n,d))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var l=nr(),d=Ha(l);d.tag=2,s!=null&&(d.callback=s),s=qa(n,d,l),s!==null&&(Fn(s,n,l),di(s,n,l))}};function $x(n,s,l,d,g,y,j){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,y,j):s.prototype&&s.prototype.isPureReactComponent?!ri(l,d)||!ri(g,y):!0}function Bx(n,s,l,d){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,d),s.state!==n&&Rf.enqueueReplaceState(s,s.state,null)}function Es(n,s){var l=s;if("ref"in s){l={};for(var d in s)d!=="ref"&&(l[d]=s[d])}if(n=n.defaultProps){l===s&&(l=x({},l));for(var g in n)l[g]===void 0&&(l[g]=n[g])}return l}function Ix(n){tc(n)}function Ux(n){console.error(n)}function Px(n){tc(n)}function jc(n,s){try{var l=n.onUncaughtError;l(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function Hx(n,s,l){try{var d=n.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Tf(n,s,l){return l=Ha(l),l.tag=3,l.payload={element:null},l.callback=function(){jc(n,s)},l}function qx(n){return n=Ha(n),n.tag=3,n}function Fx(n,s,l,d){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var y=d.value;n.payload=function(){return g(y)},n.callback=function(){Hx(s,l,d)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(n.callback=function(){Hx(s,l,d),typeof g!="function"&&(Xa===null?Xa=new Set([this]):Xa.add(this));var C=d.stack;this.componentDidCatch(d.value,{componentStack:C!==null?C:""})})}function YS(n,s,l,d,g){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=l.alternate,s!==null&&oo(s,l,g,!0),l=Jn.current,l!==null){switch(l.tag){case 31:case 13:return xr===null?zc():l.alternate===null&&Ft===0&&(Ft=3),l.flags&=-257,l.flags|=65536,l.lanes=g,d===dc?l.flags|=16384:(s=l.updateQueue,s===null?l.updateQueue=new Set([d]):s.add(d),np(n,d,g)),!1;case 22:return l.flags|=65536,d===dc?l.flags|=16384:(s=l.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=s):(l=s.retryQueue,l===null?s.retryQueue=new Set([d]):l.add(d)),np(n,d,g)),!1}throw Error(a(435,l.tag))}return np(n,d,g),zc(),!1}if(ut)return s=Jn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=g,d!==Xd&&(n=Error(a(422),{cause:d}),oi(pr(n,l)))):(d!==Xd&&(s=Error(a(423),{cause:d}),oi(pr(s,l))),n=n.current.alternate,n.flags|=65536,g&=-g,n.lanes|=g,d=pr(d,l),g=Tf(n.stateNode,d,g),of(n,g),Ft!==4&&(Ft=2)),!1;var y=Error(a(520),{cause:d});if(y=pr(y,l),ki===null?ki=[y]:ki.push(y),Ft!==4&&(Ft=2),s===null)return!0;d=pr(d,l),l=s;do{switch(l.tag){case 3:return l.flags|=65536,n=g&-g,l.lanes|=n,n=Tf(l.stateNode,d,n),of(l,n),!1;case 1:if(s=l.type,y=l.stateNode,(l.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Xa===null||!Xa.has(y))))return l.flags|=65536,g&=-g,l.lanes|=g,g=qx(g),Fx(g,n,l,d),of(l,g),!1}l=l.return}while(l!==null);return!1}var Lf=Error(a(461)),tn=!1;function bn(n,s,l,d){s.child=n===null?Kg(s,null,l,d):ks(s,n.child,l,d)}function Gx(n,s,l,d,g){l=l.render;var y=s.ref;if("ref"in d){var j={};for(var C in d)C!=="ref"&&(j[C]=d[C])}else j=d;return _s(s),d=pf(n,s,l,j,y,g),C=hf(),n!==null&&!tn?(mf(n,s,g),ga(n,s,g)):(ut&&C&&Yd(s),s.flags|=1,bn(n,s,d,g),s.child)}function Vx(n,s,l,d,g){if(n===null){var y=l.type;return typeof y=="function"&&!Fd(y)&&y.defaultProps===void 0&&l.compare===null?(s.tag=15,s.type=y,Yx(n,s,y,d,g)):(n=sc(l.type,null,d,s,s.mode,g),n.ref=s.ref,n.return=s,s.child=n)}if(y=n.child,!Uf(n,g)){var j=y.memoizedProps;if(l=l.compare,l=l!==null?l:ri,l(j,d)&&n.ref===s.ref)return ga(n,s,g)}return s.flags|=1,n=ua(y,d),n.ref=s.ref,n.return=s,s.child=n}function Yx(n,s,l,d,g){if(n!==null){var y=n.memoizedProps;if(ri(y,d)&&n.ref===s.ref)if(tn=!1,s.pendingProps=d=y,Uf(n,g))(n.flags&131072)!==0&&(tn=!0);else return s.lanes=n.lanes,ga(n,s,g)}return Df(n,s,l,d,g)}function Kx(n,s,l,d){var g=d.children,y=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(y=y!==null?y.baseLanes|l:l,n!==null){for(d=s.child=n.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~y}else d=0,s.child=null;return Xx(n,s,y,l,d)}if((l&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&cc(s,y!==null?y.cachePool:null),y!==null?Zg(s,y):cf(),Jg(s);else return d=s.lanes=536870912,Xx(n,s,y!==null?y.baseLanes|l:l,l,d)}else y!==null?(cc(s,y.cachePool),Zg(s,y),Ga(),s.memoizedState=null):(n!==null&&cc(s,null),cf(),Ga());return bn(n,s,g,l),s.child}function yi(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Xx(n,s,l,d,g){var y=nf();return y=y===null?null:{parent:Wt._currentValue,pool:y},s.memoizedState={baseLanes:l,cachePool:y},n!==null&&cc(s,null),cf(),Jg(s),n!==null&&oo(n,s,d,!0),s.childLanes=g,null}function kc(n,s){return s=Ec({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function Qx(n,s,l){return ks(s,n.child,null,l),n=kc(s,s.pendingProps),n.flags|=2,Wn(s),s.memoizedState=null,n}function KS(n,s,l){var d=s.pendingProps,g=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(ut){if(d.mode==="hidden")return n=kc(s,d),s.lanes=536870912,yi(null,n);if(df(s),(n=Mt)?(n=lb(n,gr),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:$a!==null?{id:Ur,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},l=Dg(n),l.return=s,s.child=l,xn=s,Mt=null)):n=null,n===null)throw Ia(s);return s.lanes=536870912,null}return kc(s,d)}var y=n.memoizedState;if(y!==null){var j=y.dehydrated;if(df(s),g)if(s.flags&256)s.flags&=-257,s=Qx(n,s,l);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(a(558));else if(tn||oo(n,s,l,!1),g=(l&n.childLanes)!==0,tn||g){if(d=jt,d!==null&&(j=I(d,l),j!==0&&j!==y.retryLane))throw y.retryLane=j,xs(n,j),Fn(d,n,j),Lf;zc(),s=Qx(n,s,l)}else n=y.treeContext,Mt=yr(j.nextSibling),xn=s,ut=!0,Ba=null,gr=!1,n!==null&&zg(s,n),s=kc(s,d),s.flags|=4096;return s}return n=ua(n.child,{mode:d.mode,children:d.children}),n.ref=s.ref,s.child=n,n.return=s,n}function Nc(n,s){var l=s.ref;if(l===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(n===null||n.ref!==l)&&(s.flags|=4194816)}}function Df(n,s,l,d,g){return _s(s),l=pf(n,s,l,d,void 0,g),d=hf(),n!==null&&!tn?(mf(n,s,g),ga(n,s,g)):(ut&&d&&Yd(s),s.flags|=1,bn(n,s,l,g),s.child)}function Zx(n,s,l,d,g,y){return _s(s),s.updateQueue=null,l=ex(s,d,l,g),Wg(n),d=hf(),n!==null&&!tn?(mf(n,s,y),ga(n,s,y)):(ut&&d&&Yd(s),s.flags|=1,bn(n,s,l,y),s.child)}function Jx(n,s,l,d,g){if(_s(s),s.stateNode===null){var y=no,j=l.contextType;typeof j=="object"&&j!==null&&(y=yn(j)),y=new l(d,y),s.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Rf,s.stateNode=y,y._reactInternals=s,y=s.stateNode,y.props=d,y.state=s.memoizedState,y.refs={},af(s),j=l.contextType,y.context=typeof j=="object"&&j!==null?yn(j):no,y.state=s.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(Af(s,l,j,d),y.state=s.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(j=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),j!==y.state&&Rf.enqueueReplaceState(y,y.state,null),pi(s,d,y,g),fi(),y.state=s.memoizedState),typeof y.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(n===null){y=s.stateNode;var C=s.memoizedProps,U=Es(l,C);y.props=U;var X=y.context,ie=l.contextType;j=no,typeof ie=="object"&&ie!==null&&(j=yn(ie));var pe=l.getDerivedStateFromProps;ie=typeof pe=="function"||typeof y.getSnapshotBeforeUpdate=="function",C=s.pendingProps!==C,ie||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C||X!==j)&&Bx(s,y,d,j),Pa=!1;var Q=s.memoizedState;y.state=Q,pi(s,d,y,g),fi(),X=s.memoizedState,C||Q!==X||Pa?(typeof pe=="function"&&(Af(s,l,pe,d),X=s.memoizedState),(U=Pa||$x(s,l,U,d,Q,X,j))?(ie||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(s.flags|=4194308)):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=X),y.props=d,y.state=X,y.context=j,d=U):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{y=s.stateNode,sf(n,s),j=s.memoizedProps,ie=Es(l,j),y.props=ie,pe=s.pendingProps,Q=y.context,X=l.contextType,U=no,typeof X=="object"&&X!==null&&(U=yn(X)),C=l.getDerivedStateFromProps,(X=typeof C=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(j!==pe||Q!==U)&&Bx(s,y,d,U),Pa=!1,Q=s.memoizedState,y.state=Q,pi(s,d,y,g),fi();var te=s.memoizedState;j!==pe||Q!==te||Pa||n!==null&&n.dependencies!==null&&ic(n.dependencies)?(typeof C=="function"&&(Af(s,l,C,d),te=s.memoizedState),(ie=Pa||$x(s,l,ie,d,Q,te,U)||n!==null&&n.dependencies!==null&&ic(n.dependencies))?(X||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,te,U),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,te,U)),typeof y.componentDidUpdate=="function"&&(s.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof y.componentDidUpdate!="function"||j===n.memoizedProps&&Q===n.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||j===n.memoizedProps&&Q===n.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=te),y.props=d,y.state=te,y.context=U,d=ie):(typeof y.componentDidUpdate!="function"||j===n.memoizedProps&&Q===n.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||j===n.memoizedProps&&Q===n.memoizedState||(s.flags|=1024),d=!1)}return y=d,Nc(n,s),d=(s.flags&128)!==0,y||d?(y=s.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:y.render(),s.flags|=1,n!==null&&d?(s.child=ks(s,n.child,null,g),s.child=ks(s,null,l,g)):bn(n,s,l,g),s.memoizedState=y.state,n=s.child):n=ga(n,s,g),n}function Wx(n,s,l,d){return bs(),s.flags|=256,bn(n,s,l,d),s.child}var Of={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mf(n){return{baseLanes:n,cachePool:Hg()}}function zf(n,s,l){return n=n!==null?n.childLanes&~l:0,s&&(n|=tr),n}function ey(n,s,l){var d=s.pendingProps,g=!1,y=(s.flags&128)!==0,j;if((j=y)||(j=n!==null&&n.memoizedState===null?!1:(Kt.current&2)!==0),j&&(g=!0,s.flags&=-129),j=(s.flags&32)!==0,s.flags&=-33,n===null){if(ut){if(g?Fa(s):Ga(),(n=Mt)?(n=lb(n,gr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:$a!==null?{id:Ur,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},l=Dg(n),l.return=s,s.child=l,xn=s,Mt=null)):n=null,n===null)throw Ia(s);return yp(n)?s.lanes=32:s.lanes=536870912,null}var C=d.children;return d=d.fallback,g?(Ga(),g=s.mode,C=Ec({mode:"hidden",children:C},g),d=ys(d,g,l,null),C.return=s,d.return=s,C.sibling=d,s.child=C,d=s.child,d.memoizedState=Mf(l),d.childLanes=zf(n,j,l),s.memoizedState=Of,yi(null,d)):(Fa(s),$f(s,C))}var U=n.memoizedState;if(U!==null&&(C=U.dehydrated,C!==null)){if(y)s.flags&256?(Fa(s),s.flags&=-257,s=Bf(n,s,l)):s.memoizedState!==null?(Ga(),s.child=n.child,s.flags|=128,s=null):(Ga(),C=d.fallback,g=s.mode,d=Ec({mode:"visible",children:d.children},g),C=ys(C,g,l,null),C.flags|=2,d.return=s,C.return=s,d.sibling=C,s.child=d,ks(s,n.child,null,l),d=s.child,d.memoizedState=Mf(l),d.childLanes=zf(n,j,l),s.memoizedState=Of,s=yi(null,d));else if(Fa(s),yp(C)){if(j=C.nextSibling&&C.nextSibling.dataset,j)var X=j.dgst;j=X,d=Error(a(419)),d.stack="",d.digest=j,oi({value:d,source:null,stack:null}),s=Bf(n,s,l)}else if(tn||oo(n,s,l,!1),j=(l&n.childLanes)!==0,tn||j){if(j=jt,j!==null&&(d=I(j,l),d!==0&&d!==U.retryLane))throw U.retryLane=d,xs(n,d),Fn(j,n,d),Lf;xp(C)||zc(),s=Bf(n,s,l)}else xp(C)?(s.flags|=192,s.child=n.child,s=null):(n=U.treeContext,Mt=yr(C.nextSibling),xn=s,ut=!0,Ba=null,gr=!1,n!==null&&zg(s,n),s=$f(s,d.children),s.flags|=4096);return s}return g?(Ga(),C=d.fallback,g=s.mode,U=n.child,X=U.sibling,d=ua(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,X!==null?C=ua(X,C):(C=ys(C,g,l,null),C.flags|=2),C.return=s,d.return=s,d.sibling=C,s.child=d,yi(null,d),d=s.child,C=n.child.memoizedState,C===null?C=Mf(l):(g=C.cachePool,g!==null?(U=Wt._currentValue,g=g.parent!==U?{parent:U,pool:U}:g):g=Hg(),C={baseLanes:C.baseLanes|l,cachePool:g}),d.memoizedState=C,d.childLanes=zf(n,j,l),s.memoizedState=Of,yi(n.child,d)):(Fa(s),l=n.child,n=l.sibling,l=ua(l,{mode:"visible",children:d.children}),l.return=s,l.sibling=null,n!==null&&(j=s.deletions,j===null?(s.deletions=[n],s.flags|=16):j.push(n)),s.child=l,s.memoizedState=null,l)}function $f(n,s){return s=Ec({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Ec(n,s){return n=Zn(22,n,null,s),n.lanes=0,n}function Bf(n,s,l){return ks(s,n.child,null,l),n=$f(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function ty(n,s,l){n.lanes|=s;var d=n.alternate;d!==null&&(d.lanes|=s),Jd(n.return,s,l)}function If(n,s,l,d,g,y){var j=n.memoizedState;j===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g,treeForkCount:y}:(j.isBackwards=s,j.rendering=null,j.renderingStartTime=0,j.last=d,j.tail=l,j.tailMode=g,j.treeForkCount=y)}function ny(n,s,l){var d=s.pendingProps,g=d.revealOrder,y=d.tail;d=d.children;var j=Kt.current,C=(j&2)!==0;if(C?(j=j&1|2,s.flags|=128):j&=1,re(Kt,j),bn(n,s,d,l),d=ut?si:0,!C&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&ty(n,l,s);else if(n.tag===19)ty(n,l,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(g){case"forwards":for(l=s.child,g=null;l!==null;)n=l.alternate,n!==null&&mc(n)===null&&(g=l),l=l.sibling;l=g,l===null?(g=s.child,s.child=null):(g=l.sibling,l.sibling=null),If(s,!1,g,l,y,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=s.child,s.child=null;g!==null;){if(n=g.alternate,n!==null&&mc(n)===null){s.child=g;break}n=g.sibling,g.sibling=l,l=g,g=n}If(s,!0,l,null,y,d);break;case"together":If(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function ga(n,s,l){if(n!==null&&(s.dependencies=n.dependencies),Ka|=s.lanes,(l&s.childLanes)===0)if(n!==null){if(oo(n,s,l,!1),(l&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(a(153));if(s.child!==null){for(n=s.child,l=ua(n,n.pendingProps),s.child=l,l.return=s;n.sibling!==null;)n=n.sibling,l=l.sibling=ua(n,n.pendingProps),l.return=s;l.sibling=null}return s.child}function Uf(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&ic(n)))}function XS(n,s,l){switch(s.tag){case 3:Fe(s,s.stateNode.containerInfo),Ua(s,Wt,n.memoizedState.cache),bs();break;case 27:case 5:be(s);break;case 4:Fe(s,s.stateNode.containerInfo);break;case 10:Ua(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,df(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(Fa(s),s.flags|=128,null):(l&s.child.childLanes)!==0?ey(n,s,l):(Fa(s),n=ga(n,s,l),n!==null?n.sibling:null);Fa(s);break;case 19:var g=(n.flags&128)!==0;if(d=(l&s.childLanes)!==0,d||(oo(n,s,l,!1),d=(l&s.childLanes)!==0),g){if(d)return ny(n,s,l);s.flags|=128}if(g=s.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),re(Kt,Kt.current),d)break;return null;case 22:return s.lanes=0,Kx(n,s,l,s.pendingProps);case 24:Ua(s,Wt,n.memoizedState.cache)}return ga(n,s,l)}function ry(n,s,l){if(n!==null)if(n.memoizedProps!==s.pendingProps)tn=!0;else{if(!Uf(n,l)&&(s.flags&128)===0)return tn=!1,XS(n,s,l);tn=(n.flags&131072)!==0}else tn=!1,ut&&(s.flags&1048576)!==0&&Mg(s,si,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(n=Ss(s.elementType),s.type=n,typeof n=="function")Fd(n)?(d=Es(n,d),s.tag=1,s=Jx(null,s,n,d,l)):(s.tag=0,s=Df(null,s,n,d,l));else{if(n!=null){var g=n.$$typeof;if(g===D){s.tag=11,s=Gx(null,s,n,d,l);break e}else if(g===$){s.tag=14,s=Vx(null,s,n,d,l);break e}}throw s=M(n)||n,Error(a(306,s,""))}}return s;case 0:return Df(n,s,s.type,s.pendingProps,l);case 1:return d=s.type,g=Es(d,s.pendingProps),Jx(n,s,d,g,l);case 3:e:{if(Fe(s,s.stateNode.containerInfo),n===null)throw Error(a(387));d=s.pendingProps;var y=s.memoizedState;g=y.element,sf(n,s),pi(s,d,null,l);var j=s.memoizedState;if(d=j.cache,Ua(s,Wt,d),d!==y.cache&&Wd(s,[Wt],l,!0),fi(),d=j.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:j.cache},s.updateQueue.baseState=y,s.memoizedState=y,s.flags&256){s=Wx(n,s,d,l);break e}else if(d!==g){g=pr(Error(a(424)),s),oi(g),s=Wx(n,s,d,l);break e}else for(n=s.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Mt=yr(n.firstChild),xn=s,ut=!0,Ba=null,gr=!0,l=Kg(s,null,d,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(bs(),d===g){s=ga(n,s,l);break e}bn(n,s,d,l)}s=s.child}return s;case 26:return Nc(n,s),n===null?(l=hb(s.type,null,s.pendingProps,null))?s.memoizedState=l:ut||(l=s.type,n=s.pendingProps,d=qc(ge.current).createElement(l),d[je]=s,d[ke]=n,vn(d,l,n),it(d),s.stateNode=d):s.memoizedState=hb(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return be(s),n===null&&ut&&(d=s.stateNode=db(s.type,s.pendingProps,ge.current),xn=s,gr=!0,g=Mt,Wa(s.type)?(bp=g,Mt=yr(d.firstChild)):Mt=g),bn(n,s,s.pendingProps.children,l),Nc(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&ut&&((g=d=Mt)&&(d=kj(d,s.type,s.pendingProps,gr),d!==null?(s.stateNode=d,xn=s,Mt=yr(d.firstChild),gr=!1,g=!0):g=!1),g||Ia(s)),be(s),g=s.type,y=s.pendingProps,j=n!==null?n.memoizedProps:null,d=y.children,hp(g,y)?d=null:j!==null&&hp(g,j)&&(s.flags|=32),s.memoizedState!==null&&(g=pf(n,s,US,null,null,l),Di._currentValue=g),Nc(n,s),bn(n,s,d,l),s.child;case 6:return n===null&&ut&&((n=l=Mt)&&(l=Nj(l,s.pendingProps,gr),l!==null?(s.stateNode=l,xn=s,Mt=null,n=!0):n=!1),n||Ia(s)),null;case 13:return ey(n,s,l);case 4:return Fe(s,s.stateNode.containerInfo),d=s.pendingProps,n===null?s.child=ks(s,null,d,l):bn(n,s,d,l),s.child;case 11:return Gx(n,s,s.type,s.pendingProps,l);case 7:return bn(n,s,s.pendingProps,l),s.child;case 8:return bn(n,s,s.pendingProps.children,l),s.child;case 12:return bn(n,s,s.pendingProps.children,l),s.child;case 10:return d=s.pendingProps,Ua(s,s.type,d.value),bn(n,s,d.children,l),s.child;case 9:return g=s.type._context,d=s.pendingProps.children,_s(s),g=yn(g),d=d(g),s.flags|=1,bn(n,s,d,l),s.child;case 14:return Vx(n,s,s.type,s.pendingProps,l);case 15:return Yx(n,s,s.type,s.pendingProps,l);case 19:return ny(n,s,l);case 31:return KS(n,s,l);case 22:return Kx(n,s,l,s.pendingProps);case 24:return _s(s),d=yn(Wt),n===null?(g=nf(),g===null&&(g=jt,y=ef(),g.pooledCache=y,y.refCount++,y!==null&&(g.pooledCacheLanes|=l),g=y),s.memoizedState={parent:d,cache:g},af(s),Ua(s,Wt,g)):((n.lanes&l)!==0&&(sf(n,s),pi(s,null,null,l),fi()),g=n.memoizedState,y=s.memoizedState,g.parent!==d?(g={parent:d,cache:d},s.memoizedState=g,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=g),Ua(s,Wt,d)):(d=y.cache,Ua(s,Wt,d),d!==g.cache&&Wd(s,[Wt],l,!0))),bn(n,s,s.pendingProps.children,l),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function xa(n){n.flags|=4}function Pf(n,s,l,d,g){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(g&335544128)===g)if(n.stateNode.complete)n.flags|=8192;else if(Ry())n.flags|=8192;else throw js=dc,rf}else n.flags&=-16777217}function ay(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!bb(s))if(Ry())n.flags|=8192;else throw js=dc,rf}function Cc(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?oa():536870912,n.lanes|=s,bo|=s)}function bi(n,s){if(!ut)switch(n.tailMode){case"hidden":s=n.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null}}function zt(n){var s=n.alternate!==null&&n.alternate.child===n.child,l=0,d=0;if(s)for(var g=n.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=n,g=g.sibling;else for(g=n.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=n,g=g.sibling;return n.subtreeFlags|=d,n.childLanes=l,s}function QS(n,s,l){var d=s.pendingProps;switch(Kd(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(s),null;case 1:return zt(s),null;case 3:return l=s.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),pa(Wt),qe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(n===null||n.child===null)&&(so(s)?xa(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Qd())),zt(s),null;case 26:var g=s.type,y=s.memoizedState;return n===null?(xa(s),y!==null?(zt(s),ay(s,y)):(zt(s),Pf(s,g,null,d,l))):y?y!==n.memoizedState?(xa(s),zt(s),ay(s,y)):(zt(s),s.flags&=-16777217):(n=n.memoizedProps,n!==d&&xa(s),zt(s),Pf(s,g,n,d,l)),null;case 27:if(fe(s),l=ge.current,g=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==d&&xa(s);else{if(!d){if(s.stateNode===null)throw Error(a(166));return zt(s),null}n=se.current,so(s)?$g(s):(n=db(g,d,l),s.stateNode=n,xa(s))}return zt(s),null;case 5:if(fe(s),g=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==d&&xa(s);else{if(!d){if(s.stateNode===null)throw Error(a(166));return zt(s),null}if(y=se.current,so(s))$g(s);else{var j=qc(ge.current);switch(y){case 1:y=j.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:y=j.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":y=j.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":y=j.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":y=j.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?j.createElement("select",{is:d.is}):j.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?j.createElement(g,{is:d.is}):j.createElement(g)}}y[je]=s,y[ke]=d;e:for(j=s.child;j!==null;){if(j.tag===5||j.tag===6)y.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===s)break e;for(;j.sibling===null;){if(j.return===null||j.return===s)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}s.stateNode=y;e:switch(vn(y,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&xa(s)}}return zt(s),Pf(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,l),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==d&&xa(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(a(166));if(n=ge.current,so(s)){if(n=s.stateNode,l=s.memoizedProps,d=null,g=xn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}n[je]=s,n=!!(n.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||eb(n.nodeValue,l)),n||Ia(s,!0)}else n=qc(n).createTextNode(d),n[je]=s,s.stateNode=n}return zt(s),null;case 31:if(l=s.memoizedState,n===null||n.memoizedState!==null){if(d=so(s),l!==null){if(n===null){if(!d)throw Error(a(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[je]=s}else bs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;zt(s),n=!1}else l=Qd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=l),n=!0;if(!n)return s.flags&256?(Wn(s),s):(Wn(s),null);if((s.flags&128)!==0)throw Error(a(558))}return zt(s),null;case 13:if(d=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(g=so(s),d!==null&&d.dehydrated!==null){if(n===null){if(!g)throw Error(a(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[je]=s}else bs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;zt(s),g=!1}else g=Qd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=g),g=!0;if(!g)return s.flags&256?(Wn(s),s):(Wn(s),null)}return Wn(s),(s.flags&128)!==0?(s.lanes=l,s):(l=d!==null,n=n!==null&&n.memoizedState!==null,l&&(d=s.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==g&&(d.flags|=2048)),l!==n&&l&&(s.child.flags|=8192),Cc(s,s.updateQueue),zt(s),null);case 4:return qe(),n===null&&cp(s.stateNode.containerInfo),zt(s),null;case 10:return pa(s.type),zt(s),null;case 19:if(V(Kt),d=s.memoizedState,d===null)return zt(s),null;if(g=(s.flags&128)!==0,y=d.rendering,y===null)if(g)bi(d,!1);else{if(Ft!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(y=mc(n),y!==null){for(s.flags|=128,bi(d,!1),n=y.updateQueue,s.updateQueue=n,Cc(s,n),s.subtreeFlags=0,n=l,l=s.child;l!==null;)Lg(l,n),l=l.sibling;return re(Kt,Kt.current&1|2),ut&&da(s,d.treeForkCount),s.child}n=n.sibling}d.tail!==null&&Ht()>Dc&&(s.flags|=128,g=!0,bi(d,!1),s.lanes=4194304)}else{if(!g)if(n=mc(y),n!==null){if(s.flags|=128,g=!0,n=n.updateQueue,s.updateQueue=n,Cc(s,n),bi(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!ut)return zt(s),null}else 2*Ht()-d.renderingStartTime>Dc&&l!==536870912&&(s.flags|=128,g=!0,bi(d,!1),s.lanes=4194304);d.isBackwards?(y.sibling=s.child,s.child=y):(n=d.last,n!==null?n.sibling=y:s.child=y,d.last=y)}return d.tail!==null?(n=d.tail,d.rendering=n,d.tail=n.sibling,d.renderingStartTime=Ht(),n.sibling=null,l=Kt.current,re(Kt,g?l&1|2:l&1),ut&&da(s,d.treeForkCount),n):(zt(s),null);case 22:case 23:return Wn(s),uf(),d=s.memoizedState!==null,n!==null?n.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(l&536870912)!==0&&(s.flags&128)===0&&(zt(s),s.subtreeFlags&6&&(s.flags|=8192)):zt(s),l=s.updateQueue,l!==null&&Cc(s,l.retryQueue),l=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==l&&(s.flags|=2048),n!==null&&V(ws),null;case 24:return l=null,n!==null&&(l=n.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),pa(Wt),zt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function ZS(n,s){switch(Kd(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return pa(Wt),qe(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return fe(s),null;case 31:if(s.memoizedState!==null){if(Wn(s),s.alternate===null)throw Error(a(340));bs()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(Wn(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(a(340));bs()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return V(Kt),null;case 4:return qe(),null;case 10:return pa(s.type),null;case 22:case 23:return Wn(s),uf(),n!==null&&V(ws),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return pa(Wt),null;case 25:return null;default:return null}}function sy(n,s){switch(Kd(s),s.tag){case 3:pa(Wt),qe();break;case 26:case 27:case 5:fe(s);break;case 4:qe();break;case 31:s.memoizedState!==null&&Wn(s);break;case 13:Wn(s);break;case 19:V(Kt);break;case 10:pa(s.type);break;case 22:case 23:Wn(s),uf(),n!==null&&V(ws);break;case 24:pa(Wt)}}function vi(n,s){try{var l=s.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var g=d.next;l=g;do{if((l.tag&n)===n){d=void 0;var y=l.create,j=l.inst;d=y(),j.destroy=d}l=l.next}while(l!==g)}}catch(C){yt(s,s.return,C)}}function Va(n,s,l){try{var d=s.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var y=g.next;d=y;do{if((d.tag&n)===n){var j=d.inst,C=j.destroy;if(C!==void 0){j.destroy=void 0,g=s;var U=l,X=C;try{X()}catch(ie){yt(g,U,ie)}}}d=d.next}while(d!==y)}}catch(ie){yt(s,s.return,ie)}}function oy(n){var s=n.updateQueue;if(s!==null){var l=n.stateNode;try{Qg(s,l)}catch(d){yt(n,n.return,d)}}}function iy(n,s,l){l.props=Es(n.type,n.memoizedProps),l.state=n.memoizedState;try{l.componentWillUnmount()}catch(d){yt(n,s,d)}}function _i(n,s){try{var l=n.ref;if(l!==null){switch(n.tag){case 26:case 27:case 5:var d=n.stateNode;break;case 30:d=n.stateNode;break;default:d=n.stateNode}typeof l=="function"?n.refCleanup=l(d):l.current=d}}catch(g){yt(n,s,g)}}function Hr(n,s){var l=n.ref,d=n.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(g){yt(n,s,g)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){yt(n,s,g)}else l.current=null}function ly(n){var s=n.type,l=n.memoizedProps,d=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(g){yt(n,n.return,g)}}function Hf(n,s,l){try{var d=n.stateNode;bj(d,n.type,l,s),d[ke]=s}catch(g){yt(n,n.return,g)}}function cy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Wa(n.type)||n.tag===4}function qf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||cy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Wa(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Ff(n,s,l){var d=n.tag;if(d===5||d===6)n=n.stateNode,s?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(n,s):(s=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,s.appendChild(n),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=la));else if(d!==4&&(d===27&&Wa(n.type)&&(l=n.stateNode,s=null),n=n.child,n!==null))for(Ff(n,s,l),n=n.sibling;n!==null;)Ff(n,s,l),n=n.sibling}function Ac(n,s,l){var d=n.tag;if(d===5||d===6)n=n.stateNode,s?l.insertBefore(n,s):l.appendChild(n);else if(d!==4&&(d===27&&Wa(n.type)&&(l=n.stateNode),n=n.child,n!==null))for(Ac(n,s,l),n=n.sibling;n!==null;)Ac(n,s,l),n=n.sibling}function uy(n){var s=n.stateNode,l=n.memoizedProps;try{for(var d=n.type,g=s.attributes;g.length;)s.removeAttributeNode(g[0]);vn(s,d,l),s[je]=n,s[ke]=l}catch(y){yt(n,n.return,y)}}var ya=!1,nn=!1,Gf=!1,dy=typeof WeakSet=="function"?WeakSet:Set,fn=null;function JS(n,s){if(n=n.containerInfo,fp=Qc,n=Sg(n),$d(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var j=0,C=-1,U=-1,X=0,ie=0,pe=n,Q=null;t:for(;;){for(var te;pe!==l||g!==0&&pe.nodeType!==3||(C=j+g),pe!==y||d!==0&&pe.nodeType!==3||(U=j+d),pe.nodeType===3&&(j+=pe.nodeValue.length),(te=pe.firstChild)!==null;)Q=pe,pe=te;for(;;){if(pe===n)break t;if(Q===l&&++X===g&&(C=j),Q===y&&++ie===d&&(U=j),(te=pe.nextSibling)!==null)break;pe=Q,Q=pe.parentNode}pe=te}l=C===-1||U===-1?null:{start:C,end:U}}else l=null}l=l||{start:0,end:0}}else l=null;for(pp={focusedElem:n,selectionRange:l},Qc=!1,fn=s;fn!==null;)if(s=fn,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,fn=n;else for(;fn!==null;){switch(s=fn,y=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(l=0;l<n.length;l++)g=n[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&y!==null){n=void 0,l=s,g=y.memoizedProps,y=y.memoizedState,d=l.stateNode;try{var Te=Es(l.type,g);n=d.getSnapshotBeforeUpdate(Te,y),d.__reactInternalSnapshotBeforeUpdate=n}catch(Ye){yt(l,l.return,Ye)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,l=n.nodeType,l===9)gp(n);else if(l===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":gp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(a(163))}if(n=s.sibling,n!==null){n.return=s.return,fn=n;break}fn=s.return}}function fy(n,s,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:va(n,l),d&4&&vi(5,l);break;case 1:if(va(n,l),d&4)if(n=l.stateNode,s===null)try{n.componentDidMount()}catch(j){yt(l,l.return,j)}else{var g=Es(l.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(g,s,n.__reactInternalSnapshotBeforeUpdate)}catch(j){yt(l,l.return,j)}}d&64&&oy(l),d&512&&_i(l,l.return);break;case 3:if(va(n,l),d&64&&(n=l.updateQueue,n!==null)){if(s=null,l.child!==null)switch(l.child.tag){case 27:case 5:s=l.child.stateNode;break;case 1:s=l.child.stateNode}try{Qg(n,s)}catch(j){yt(l,l.return,j)}}break;case 27:s===null&&d&4&&uy(l);case 26:case 5:va(n,l),s===null&&d&4&&ly(l),d&512&&_i(l,l.return);break;case 12:va(n,l);break;case 31:va(n,l),d&4&&my(n,l);break;case 13:va(n,l),d&4&&gy(n,l),d&64&&(n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(l=ij.bind(null,l),Ej(n,l))));break;case 22:if(d=l.memoizedState!==null||ya,!d){s=s!==null&&s.memoizedState!==null||nn,g=ya;var y=nn;ya=d,(nn=s)&&!y?_a(n,l,(l.subtreeFlags&8772)!==0):va(n,l),ya=g,nn=y}break;case 30:break;default:va(n,l)}}function py(n){var s=n.alternate;s!==null&&(n.alternate=null,py(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&Ee(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Ut=null,Un=!1;function ba(n,s,l){for(l=l.child;l!==null;)hy(n,s,l),l=l.sibling}function hy(n,s,l){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(gn,l)}catch{}switch(l.tag){case 26:nn||Hr(l,s),ba(n,s,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:nn||Hr(l,s);var d=Ut,g=Un;Wa(l.type)&&(Ut=l.stateNode,Un=!1),ba(n,s,l),Ri(l.stateNode),Ut=d,Un=g;break;case 5:nn||Hr(l,s);case 6:if(d=Ut,g=Un,Ut=null,ba(n,s,l),Ut=d,Un=g,Ut!==null)if(Un)try{(Ut.nodeType===9?Ut.body:Ut.nodeName==="HTML"?Ut.ownerDocument.body:Ut).removeChild(l.stateNode)}catch(y){yt(l,s,y)}else try{Ut.removeChild(l.stateNode)}catch(y){yt(l,s,y)}break;case 18:Ut!==null&&(Un?(n=Ut,ob(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,l.stateNode),Eo(n)):ob(Ut,l.stateNode));break;case 4:d=Ut,g=Un,Ut=l.stateNode.containerInfo,Un=!0,ba(n,s,l),Ut=d,Un=g;break;case 0:case 11:case 14:case 15:Va(2,l,s),nn||Va(4,l,s),ba(n,s,l);break;case 1:nn||(Hr(l,s),d=l.stateNode,typeof d.componentWillUnmount=="function"&&iy(l,s,d)),ba(n,s,l);break;case 21:ba(n,s,l);break;case 22:nn=(d=nn)||l.memoizedState!==null,ba(n,s,l),nn=d;break;default:ba(n,s,l)}}function my(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Eo(n)}catch(l){yt(s,s.return,l)}}}function gy(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Eo(n)}catch(l){yt(s,s.return,l)}}function WS(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new dy),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new dy),s;default:throw Error(a(435,n.tag))}}function Rc(n,s){var l=WS(n);s.forEach(function(d){if(!l.has(d)){l.add(d);var g=lj.bind(null,n,d);d.then(g,g)}})}function Pn(n,s){var l=s.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d],y=n,j=s,C=j;e:for(;C!==null;){switch(C.tag){case 27:if(Wa(C.type)){Ut=C.stateNode,Un=!1;break e}break;case 5:Ut=C.stateNode,Un=!1;break e;case 3:case 4:Ut=C.stateNode.containerInfo,Un=!0;break e}C=C.return}if(Ut===null)throw Error(a(160));hy(y,j,g),Ut=null,Un=!1,y=g.alternate,y!==null&&(y.return=null),g.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)xy(s,n),s=s.sibling}var Ar=null;function xy(n,s){var l=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Pn(s,n),Hn(n),d&4&&(Va(3,n,n.return),vi(3,n),Va(5,n,n.return));break;case 1:Pn(s,n),Hn(n),d&512&&(nn||l===null||Hr(l,l.return)),d&64&&ya&&(n=n.updateQueue,n!==null&&(d=n.callbacks,d!==null&&(l=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var g=Ar;if(Pn(s,n),Hn(n),d&512&&(nn||l===null||Hr(l,l.return)),d&4){var y=l!==null?l.memoizedState:null;if(d=n.memoizedState,l===null)if(d===null)if(n.stateNode===null){e:{d=n.type,l=n.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":y=g.getElementsByTagName("title")[0],(!y||y[ue]||y[je]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=g.createElement(d),g.head.insertBefore(y,g.querySelector("head > title"))),vn(y,d,l),y[je]=n,it(y),d=y;break e;case"link":var j=xb("link","href",g).get(d+(l.href||""));if(j){for(var C=0;C<j.length;C++)if(y=j[C],y.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&y.getAttribute("rel")===(l.rel==null?null:l.rel)&&y.getAttribute("title")===(l.title==null?null:l.title)&&y.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(C,1);break t}}y=g.createElement(d),vn(y,d,l),g.head.appendChild(y);break;case"meta":if(j=xb("meta","content",g).get(d+(l.content||""))){for(C=0;C<j.length;C++)if(y=j[C],y.getAttribute("content")===(l.content==null?null:""+l.content)&&y.getAttribute("name")===(l.name==null?null:l.name)&&y.getAttribute("property")===(l.property==null?null:l.property)&&y.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&y.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(C,1);break t}}y=g.createElement(d),vn(y,d,l),g.head.appendChild(y);break;default:throw Error(a(468,d))}y[je]=n,it(y),d=y}n.stateNode=d}else yb(g,n.type,n.stateNode);else n.stateNode=gb(g,d,n.memoizedProps);else y!==d?(y===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):y.count--,d===null?yb(g,n.type,n.stateNode):gb(g,d,n.memoizedProps)):d===null&&n.stateNode!==null&&Hf(n,n.memoizedProps,l.memoizedProps)}break;case 27:Pn(s,n),Hn(n),d&512&&(nn||l===null||Hr(l,l.return)),l!==null&&d&4&&Hf(n,n.memoizedProps,l.memoizedProps);break;case 5:if(Pn(s,n),Hn(n),d&512&&(nn||l===null||Hr(l,l.return)),n.flags&32){g=n.stateNode;try{Xs(g,"")}catch(Te){yt(n,n.return,Te)}}d&4&&n.stateNode!=null&&(g=n.memoizedProps,Hf(n,g,l!==null?l.memoizedProps:g)),d&1024&&(Gf=!0);break;case 6:if(Pn(s,n),Hn(n),d&4){if(n.stateNode===null)throw Error(a(162));d=n.memoizedProps,l=n.stateNode;try{l.nodeValue=d}catch(Te){yt(n,n.return,Te)}}break;case 3:if(Vc=null,g=Ar,Ar=Fc(s.containerInfo),Pn(s,n),Ar=g,Hn(n),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Eo(s.containerInfo)}catch(Te){yt(n,n.return,Te)}Gf&&(Gf=!1,yy(n));break;case 4:d=Ar,Ar=Fc(n.stateNode.containerInfo),Pn(s,n),Hn(n),Ar=d;break;case 12:Pn(s,n),Hn(n);break;case 31:Pn(s,n),Hn(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Rc(n,d)));break;case 13:Pn(s,n),Hn(n),n.child.flags&8192&&n.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Lc=Ht()),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Rc(n,d)));break;case 22:g=n.memoizedState!==null;var U=l!==null&&l.memoizedState!==null,X=ya,ie=nn;if(ya=X||g,nn=ie||U,Pn(s,n),nn=ie,ya=X,Hn(n),d&8192)e:for(s=n.stateNode,s._visibility=g?s._visibility&-2:s._visibility|1,g&&(l===null||U||ya||nn||Cs(n)),l=null,s=n;;){if(s.tag===5||s.tag===26){if(l===null){U=l=s;try{if(y=U.stateNode,g)j=y.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{C=U.stateNode;var pe=U.memoizedProps.style,Q=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;C.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Te){yt(U,U.return,Te)}}}else if(s.tag===6){if(l===null){U=s;try{U.stateNode.nodeValue=g?"":U.memoizedProps}catch(Te){yt(U,U.return,Te)}}}else if(s.tag===18){if(l===null){U=s;try{var te=U.stateNode;g?ib(te,!0):ib(U.stateNode,!1)}catch(Te){yt(U,U.return,Te)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;l===s&&(l=null),s=s.return}l===s&&(l=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=n.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,Rc(n,l))));break;case 19:Pn(s,n),Hn(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Rc(n,d)));break;case 30:break;case 21:break;default:Pn(s,n),Hn(n)}}function Hn(n){var s=n.flags;if(s&2){try{for(var l,d=n.return;d!==null;){if(cy(d)){l=d;break}d=d.return}if(l==null)throw Error(a(160));switch(l.tag){case 27:var g=l.stateNode,y=qf(n);Ac(n,y,g);break;case 5:var j=l.stateNode;l.flags&32&&(Xs(j,""),l.flags&=-33);var C=qf(n);Ac(n,C,j);break;case 3:case 4:var U=l.stateNode.containerInfo,X=qf(n);Ff(n,X,U);break;default:throw Error(a(161))}}catch(ie){yt(n,n.return,ie)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function yy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;yy(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function va(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)fy(n,s.alternate,s),s=s.sibling}function Cs(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:Va(4,s,s.return),Cs(s);break;case 1:Hr(s,s.return);var l=s.stateNode;typeof l.componentWillUnmount=="function"&&iy(s,s.return,l),Cs(s);break;case 27:Ri(s.stateNode);case 26:case 5:Hr(s,s.return),Cs(s);break;case 22:s.memoizedState===null&&Cs(s);break;case 30:Cs(s);break;default:Cs(s)}n=n.sibling}}function _a(n,s,l){for(l=l&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,g=n,y=s,j=y.flags;switch(y.tag){case 0:case 11:case 15:_a(g,y,l),vi(4,y);break;case 1:if(_a(g,y,l),d=y,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(X){yt(d,d.return,X)}if(d=y,g=d.updateQueue,g!==null){var C=d.stateNode;try{var U=g.shared.hiddenCallbacks;if(U!==null)for(g.shared.hiddenCallbacks=null,g=0;g<U.length;g++)Xg(U[g],C)}catch(X){yt(d,d.return,X)}}l&&j&64&&oy(y),_i(y,y.return);break;case 27:uy(y);case 26:case 5:_a(g,y,l),l&&d===null&&j&4&&ly(y),_i(y,y.return);break;case 12:_a(g,y,l);break;case 31:_a(g,y,l),l&&j&4&&my(g,y);break;case 13:_a(g,y,l),l&&j&4&&gy(g,y);break;case 22:y.memoizedState===null&&_a(g,y,l),_i(y,y.return);break;case 30:break;default:_a(g,y,l)}s=s.sibling}}function Vf(n,s){var l=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==l&&(n!=null&&n.refCount++,l!=null&&ii(l))}function Yf(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&ii(n))}function Rr(n,s,l,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)by(n,s,l,d),s=s.sibling}function by(n,s,l,d){var g=s.flags;switch(s.tag){case 0:case 11:case 15:Rr(n,s,l,d),g&2048&&vi(9,s);break;case 1:Rr(n,s,l,d);break;case 3:Rr(n,s,l,d),g&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&ii(n)));break;case 12:if(g&2048){Rr(n,s,l,d),n=s.stateNode;try{var y=s.memoizedProps,j=y.id,C=y.onPostCommit;typeof C=="function"&&C(j,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(U){yt(s,s.return,U)}}else Rr(n,s,l,d);break;case 31:Rr(n,s,l,d);break;case 13:Rr(n,s,l,d);break;case 23:break;case 22:y=s.stateNode,j=s.alternate,s.memoizedState!==null?y._visibility&2?Rr(n,s,l,d):wi(n,s):y._visibility&2?Rr(n,s,l,d):(y._visibility|=2,go(n,s,l,d,(s.subtreeFlags&10256)!==0||!1)),g&2048&&Vf(j,s);break;case 24:Rr(n,s,l,d),g&2048&&Yf(s.alternate,s);break;default:Rr(n,s,l,d)}}function go(n,s,l,d,g){for(g=g&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var y=n,j=s,C=l,U=d,X=j.flags;switch(j.tag){case 0:case 11:case 15:go(y,j,C,U,g),vi(8,j);break;case 23:break;case 22:var ie=j.stateNode;j.memoizedState!==null?ie._visibility&2?go(y,j,C,U,g):wi(y,j):(ie._visibility|=2,go(y,j,C,U,g)),g&&X&2048&&Vf(j.alternate,j);break;case 24:go(y,j,C,U,g),g&&X&2048&&Yf(j.alternate,j);break;default:go(y,j,C,U,g)}s=s.sibling}}function wi(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var l=n,d=s,g=d.flags;switch(d.tag){case 22:wi(l,d),g&2048&&Vf(d.alternate,d);break;case 24:wi(l,d),g&2048&&Yf(d.alternate,d);break;default:wi(l,d)}s=s.sibling}}var Si=8192;function xo(n,s,l){if(n.subtreeFlags&Si)for(n=n.child;n!==null;)vy(n,s,l),n=n.sibling}function vy(n,s,l){switch(n.tag){case 26:xo(n,s,l),n.flags&Si&&n.memoizedState!==null&&Ij(l,Ar,n.memoizedState,n.memoizedProps);break;case 5:xo(n,s,l);break;case 3:case 4:var d=Ar;Ar=Fc(n.stateNode.containerInfo),xo(n,s,l),Ar=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=Si,Si=16777216,xo(n,s,l),Si=d):xo(n,s,l));break;default:xo(n,s,l)}}function _y(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function ji(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var l=0;l<s.length;l++){var d=s[l];fn=d,Sy(d,n)}_y(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)wy(n),n=n.sibling}function wy(n){switch(n.tag){case 0:case 11:case 15:ji(n),n.flags&2048&&Va(9,n,n.return);break;case 3:ji(n);break;case 12:ji(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,Tc(n)):ji(n);break;default:ji(n)}}function Tc(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var l=0;l<s.length;l++){var d=s[l];fn=d,Sy(d,n)}_y(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:Va(8,s,s.return),Tc(s);break;case 22:l=s.stateNode,l._visibility&2&&(l._visibility&=-3,Tc(s));break;default:Tc(s)}n=n.sibling}}function Sy(n,s){for(;fn!==null;){var l=fn;switch(l.tag){case 0:case 11:case 15:Va(8,l,s);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ii(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,fn=d;else e:for(l=n;fn!==null;){d=fn;var g=d.sibling,y=d.return;if(py(d),d===l){fn=null;break e}if(g!==null){g.return=y,fn=g;break e}fn=y}}}var ej={getCacheForType:function(n){var s=yn(Wt),l=s.data.get(n);return l===void 0&&(l=n(),s.data.set(n,l)),l},cacheSignal:function(){return yn(Wt).controller.signal}},tj=typeof WeakMap=="function"?WeakMap:Map,mt=0,jt=null,st=null,lt=0,xt=0,er=null,Ya=!1,yo=!1,Kf=!1,wa=0,Ft=0,Ka=0,As=0,Xf=0,tr=0,bo=0,ki=null,qn=null,Qf=!1,Lc=0,jy=0,Dc=1/0,Oc=null,Xa=null,sn=0,Qa=null,vo=null,Sa=0,Zf=0,Jf=null,ky=null,Ni=0,Wf=null;function nr(){return(mt&2)!==0&&lt!==0?lt&-lt:T.T!==null?sp():xe()}function Ny(){if(tr===0)if((lt&536870912)===0||ut){var n=Ue;Ue<<=1,(Ue&3932160)===0&&(Ue=262144),tr=n}else tr=536870912;return n=Jn.current,n!==null&&(n.flags|=32),tr}function Fn(n,s,l){(n===jt&&(xt===2||xt===9)||n.cancelPendingCommit!==null)&&(_o(n,0),Za(n,lt,tr,!1)),Tn(n,l),((mt&2)===0||n!==jt)&&(n===jt&&((mt&2)===0&&(As|=l),Ft===4&&Za(n,lt,tr,!1)),qr(n))}function Ey(n,s,l){if((mt&6)!==0)throw Error(a(327));var d=!l&&(s&127)===0&&(s&n.expiredLanes)===0||Dt(n,s),g=d?aj(n,s):tp(n,s,!0),y=d;do{if(g===0){yo&&!d&&Za(n,s,0,!1);break}else{if(l=n.current.alternate,y&&!nj(l)){g=tp(n,s,!1),y=!1;continue}if(g===2){if(y=s,n.errorRecoveryDisabledLanes&y)var j=0;else j=n.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){s=j;e:{var C=n;g=ki;var U=C.current.memoizedState.isDehydrated;if(U&&(_o(C,j).flags|=256),j=tp(C,j,!1),j!==2){if(Kf&&!U){C.errorRecoveryDisabledLanes|=y,As|=y,g=4;break e}y=qn,qn=g,y!==null&&(qn===null?qn=y:qn.push.apply(qn,y))}g=j}if(y=!1,g!==2)continue}}if(g===1){_o(n,0),Za(n,s,0,!0);break}e:{switch(d=n,y=g,y){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Za(d,s,tr,!Ya);break e;case 2:qn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(g=Lc+300-Ht(),10<g)){if(Za(d,s,tr,!Ya),Ct(d,0,!0)!==0)break e;Sa=s,d.timeoutHandle=ab(Cy.bind(null,d,l,qn,Oc,Qf,s,tr,As,bo,Ya,y,"Throttled",-0,0),g);break e}Cy(d,l,qn,Oc,Qf,s,tr,As,bo,Ya,y,null,-0,0)}}break}while(!0);qr(n)}function Cy(n,s,l,d,g,y,j,C,U,X,ie,pe,Q,te){if(n.timeoutHandle=-1,pe=s.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:la},vy(s,y,pe);var Te=(y&62914560)===y?Lc-Ht():(y&4194048)===y?jy-Ht():0;if(Te=Uj(pe,Te),Te!==null){Sa=y,n.cancelPendingCommit=Te(zy.bind(null,n,s,y,l,d,g,j,C,U,ie,pe,null,Q,te)),Za(n,y,j,!X);return}}zy(n,s,y,l,d,g,j,C,U)}function nj(n){for(var s=n;;){var l=s.tag;if((l===0||l===11||l===15)&&s.flags&16384&&(l=s.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var g=l[d],y=g.getSnapshot;g=g.value;try{if(!Qn(y(),g))return!1}catch{return!1}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Za(n,s,l,d){s&=~Xf,s&=~As,n.suspendedLanes|=s,n.pingedLanes&=~s,d&&(n.warmLanes|=s),d=n.expirationTimes;for(var g=s;0<g;){var y=31-Pt(g),j=1<<y;d[y]=-1,g&=~j}l!==0&&ia(n,l,s)}function Mc(){return(mt&6)===0?(Ei(0),!1):!0}function ep(){if(st!==null){if(xt===0)var n=st.return;else n=st,fa=vs=null,gf(n),uo=null,ci=0,n=st;for(;n!==null;)sy(n.alternate,n),n=n.return;st=null}}function _o(n,s){var l=n.timeoutHandle;l!==-1&&(n.timeoutHandle=-1,wj(l)),l=n.cancelPendingCommit,l!==null&&(n.cancelPendingCommit=null,l()),Sa=0,ep(),jt=n,st=l=ua(n.current,null),lt=s,xt=0,er=null,Ya=!1,yo=Dt(n,s),Kf=!1,bo=tr=Xf=As=Ka=Ft=0,qn=ki=null,Qf=!1,(s&8)!==0&&(s|=s&32);var d=n.entangledLanes;if(d!==0)for(n=n.entanglements,d&=s;0<d;){var g=31-Pt(d),y=1<<g;s|=n[g],d&=~y}return wa=s,nc(),l}function Ay(n,s){Je=null,T.H=xi,s===co||s===uc?(s=Gg(),xt=3):s===rf?(s=Gg(),xt=4):xt=s===Lf?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,er=s,st===null&&(Ft=1,jc(n,pr(s,n.current)))}function Ry(){var n=Jn.current;return n===null?!0:(lt&4194048)===lt?xr===null:(lt&62914560)===lt||(lt&536870912)!==0?n===xr:!1}function Ty(){var n=T.H;return T.H=xi,n===null?xi:n}function Ly(){var n=T.A;return T.A=ej,n}function zc(){Ft=4,Ya||(lt&4194048)!==lt&&Jn.current!==null||(yo=!0),(Ka&134217727)===0&&(As&134217727)===0||jt===null||Za(jt,lt,tr,!1)}function tp(n,s,l){var d=mt;mt|=2;var g=Ty(),y=Ly();(jt!==n||lt!==s)&&(Oc=null,_o(n,s)),s=!1;var j=Ft;e:do try{if(xt!==0&&st!==null){var C=st,U=er;switch(xt){case 8:ep(),j=6;break e;case 3:case 2:case 9:case 6:Jn.current===null&&(s=!0);var X=xt;if(xt=0,er=null,wo(n,C,U,X),l&&yo){j=0;break e}break;default:X=xt,xt=0,er=null,wo(n,C,U,X)}}rj(),j=Ft;break}catch(ie){Ay(n,ie)}while(!0);return s&&n.shellSuspendCounter++,fa=vs=null,mt=d,T.H=g,T.A=y,st===null&&(jt=null,lt=0,nc()),j}function rj(){for(;st!==null;)Dy(st)}function aj(n,s){var l=mt;mt|=2;var d=Ty(),g=Ly();jt!==n||lt!==s?(Oc=null,Dc=Ht()+500,_o(n,s)):yo=Dt(n,s);e:do try{if(xt!==0&&st!==null){s=st;var y=er;t:switch(xt){case 1:xt=0,er=null,wo(n,s,y,1);break;case 2:case 9:if(qg(y)){xt=0,er=null,Oy(s);break}s=function(){xt!==2&&xt!==9||jt!==n||(xt=7),qr(n)},y.then(s,s);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:qg(y)?(xt=0,er=null,Oy(s)):(xt=0,er=null,wo(n,s,y,7));break;case 5:var j=null;switch(st.tag){case 26:j=st.memoizedState;case 5:case 27:var C=st;if(j?bb(j):C.stateNode.complete){xt=0,er=null;var U=C.sibling;if(U!==null)st=U;else{var X=C.return;X!==null?(st=X,$c(X)):st=null}break t}}xt=0,er=null,wo(n,s,y,5);break;case 6:xt=0,er=null,wo(n,s,y,6);break;case 8:ep(),Ft=6;break e;default:throw Error(a(462))}}sj();break}catch(ie){Ay(n,ie)}while(!0);return fa=vs=null,T.H=d,T.A=g,mt=l,st!==null?0:(jt=null,lt=0,nc(),Ft)}function sj(){for(;st!==null&&!cr();)Dy(st)}function Dy(n){var s=ry(n.alternate,n,wa);n.memoizedProps=n.pendingProps,s===null?$c(n):st=s}function Oy(n){var s=n,l=s.alternate;switch(s.tag){case 15:case 0:s=Zx(l,s,s.pendingProps,s.type,void 0,lt);break;case 11:s=Zx(l,s,s.pendingProps,s.type.render,s.ref,lt);break;case 5:gf(s);default:sy(l,s),s=st=Lg(s,wa),s=ry(l,s,wa)}n.memoizedProps=n.pendingProps,s===null?$c(n):st=s}function wo(n,s,l,d){fa=vs=null,gf(s),uo=null,ci=0;var g=s.return;try{if(YS(n,g,s,l,lt)){Ft=1,jc(n,pr(l,n.current)),st=null;return}}catch(y){if(g!==null)throw st=g,y;Ft=1,jc(n,pr(l,n.current)),st=null;return}s.flags&32768?(ut||d===1?n=!0:yo||(lt&536870912)!==0?n=!1:(Ya=n=!0,(d===2||d===9||d===3||d===6)&&(d=Jn.current,d!==null&&d.tag===13&&(d.flags|=16384))),My(s,n)):$c(s)}function $c(n){var s=n;do{if((s.flags&32768)!==0){My(s,Ya);return}n=s.return;var l=QS(s.alternate,s,wa);if(l!==null){st=l;return}if(s=s.sibling,s!==null){st=s;return}st=s=n}while(s!==null);Ft===0&&(Ft=5)}function My(n,s){do{var l=ZS(n.alternate,n);if(l!==null){l.flags&=32767,st=l;return}if(l=n.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!s&&(n=n.sibling,n!==null)){st=n;return}st=n=l}while(n!==null);Ft=6,st=null}function zy(n,s,l,d,g,y,j,C,U){n.cancelPendingCommit=null;do Bc();while(sn!==0);if((mt&6)!==0)throw Error(a(327));if(s!==null){if(s===n.current)throw Error(a(177));if(y=s.lanes|s.childLanes,y|=Hd,$r(n,l,y,j,C,U),n===jt&&(st=jt=null,lt=0),vo=s,Qa=n,Sa=l,Zf=y,Jf=g,ky=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,cj(We,function(){return Py(),null})):(n.callbackNode=null,n.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=T.T,T.T=null,g=F.p,F.p=2,j=mt,mt|=4;try{JS(n,s,l)}finally{mt=j,F.p=g,T.T=d}}sn=1,$y(),By(),Iy()}}function $y(){if(sn===1){sn=0;var n=Qa,s=vo,l=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var d=F.p;F.p=2;var g=mt;mt|=4;try{xy(s,n);var y=pp,j=Sg(n.containerInfo),C=y.focusedElem,U=y.selectionRange;if(j!==C&&C&&C.ownerDocument&&wg(C.ownerDocument.documentElement,C)){if(U!==null&&$d(C)){var X=U.start,ie=U.end;if(ie===void 0&&(ie=X),"selectionStart"in C)C.selectionStart=X,C.selectionEnd=Math.min(ie,C.value.length);else{var pe=C.ownerDocument||document,Q=pe&&pe.defaultView||window;if(Q.getSelection){var te=Q.getSelection(),Te=C.textContent.length,Ye=Math.min(U.start,Te),_t=U.end===void 0?Ye:Math.min(U.end,Te);!te.extend&&Ye>_t&&(j=_t,_t=Ye,Ye=j);var Y=_g(C,Ye),q=_g(C,_t);if(Y&&q&&(te.rangeCount!==1||te.anchorNode!==Y.node||te.anchorOffset!==Y.offset||te.focusNode!==q.node||te.focusOffset!==q.offset)){var K=pe.createRange();K.setStart(Y.node,Y.offset),te.removeAllRanges(),Ye>_t?(te.addRange(K),te.extend(q.node,q.offset)):(K.setEnd(q.node,q.offset),te.addRange(K))}}}}for(pe=[],te=C;te=te.parentNode;)te.nodeType===1&&pe.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<pe.length;C++){var de=pe[C];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Qc=!!fp,pp=fp=null}finally{mt=g,F.p=d,T.T=l}}n.current=s,sn=2}}function By(){if(sn===2){sn=0;var n=Qa,s=vo,l=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var d=F.p;F.p=2;var g=mt;mt|=4;try{fy(n,s.alternate,s)}finally{mt=g,F.p=d,T.T=l}}sn=3}}function Iy(){if(sn===4||sn===3){sn=0,Xn();var n=Qa,s=vo,l=Sa,d=ky;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?sn=5:(sn=0,vo=Qa=null,Uy(n,n.pendingLanes));var g=n.pendingLanes;if(g===0&&(Xa=null),Z(l),s=s.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(gn,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=T.T,g=F.p,F.p=2,T.T=null;try{for(var y=n.onRecoverableError,j=0;j<d.length;j++){var C=d[j];y(C.value,{componentStack:C.stack})}}finally{T.T=s,F.p=g}}(Sa&3)!==0&&Bc(),qr(n),g=n.pendingLanes,(l&261930)!==0&&(g&42)!==0?n===Wf?Ni++:(Ni=0,Wf=n):Ni=0,Ei(0)}}function Uy(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,ii(s)))}function Bc(){return $y(),By(),Iy(),Py()}function Py(){if(sn!==5)return!1;var n=Qa,s=Zf;Zf=0;var l=Z(Sa),d=T.T,g=F.p;try{F.p=32>l?32:l,T.T=null,l=Jf,Jf=null;var y=Qa,j=Sa;if(sn=0,vo=Qa=null,Sa=0,(mt&6)!==0)throw Error(a(331));var C=mt;if(mt|=4,wy(y.current),by(y,y.current,j,l),mt=C,Ei(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(gn,y)}catch{}return!0}finally{F.p=g,T.T=d,Uy(n,s)}}function Hy(n,s,l){s=pr(l,s),s=Tf(n.stateNode,s,2),n=qa(n,s,2),n!==null&&(Tn(n,2),qr(n))}function yt(n,s,l){if(n.tag===3)Hy(n,n,l);else for(;s!==null;){if(s.tag===3){Hy(s,n,l);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Xa===null||!Xa.has(d))){n=pr(l,n),l=qx(2),d=qa(s,l,2),d!==null&&(Fx(l,d,s,n),Tn(d,2),qr(d));break}}s=s.return}}function np(n,s,l){var d=n.pingCache;if(d===null){d=n.pingCache=new tj;var g=new Set;d.set(s,g)}else g=d.get(s),g===void 0&&(g=new Set,d.set(s,g));g.has(l)||(Kf=!0,g.add(l),n=oj.bind(null,n,s,l),s.then(n,n))}function oj(n,s,l){var d=n.pingCache;d!==null&&d.delete(s),n.pingedLanes|=n.suspendedLanes&l,n.warmLanes&=~l,jt===n&&(lt&l)===l&&(Ft===4||Ft===3&&(lt&62914560)===lt&&300>Ht()-Lc?(mt&2)===0&&_o(n,0):Xf|=l,bo===lt&&(bo=0)),qr(n)}function qy(n,s){s===0&&(s=oa()),n=xs(n,s),n!==null&&(Tn(n,s),qr(n))}function ij(n){var s=n.memoizedState,l=0;s!==null&&(l=s.retryLane),qy(n,l)}function lj(n,s){var l=0;switch(n.tag){case 31:case 13:var d=n.stateNode,g=n.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=n.stateNode;break;case 22:d=n.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(s),qy(n,l)}function cj(n,s){return Vt(n,s)}var Ic=null,So=null,rp=!1,Uc=!1,ap=!1,Ja=0;function qr(n){n!==So&&n.next===null&&(So===null?Ic=So=n:So=So.next=n),Uc=!0,rp||(rp=!0,dj())}function Ei(n,s){if(!ap&&Uc){ap=!0;do for(var l=!1,d=Ic;d!==null;){if(n!==0){var g=d.pendingLanes;if(g===0)var y=0;else{var j=d.suspendedLanes,C=d.pingedLanes;y=(1<<31-Pt(42|n)+1)-1,y&=g&~(j&~C),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(l=!0,Yy(d,y))}else y=lt,y=Ct(d,d===jt?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||Dt(d,y)||(l=!0,Yy(d,y));d=d.next}while(l);ap=!1}}function uj(){Fy()}function Fy(){Uc=rp=!1;var n=0;Ja!==0&&_j()&&(n=Ja);for(var s=Ht(),l=null,d=Ic;d!==null;){var g=d.next,y=Gy(d,s);y===0?(d.next=null,l===null?Ic=g:l.next=g,g===null&&(So=l)):(l=d,(n!==0||(y&3)!==0)&&(Uc=!0)),d=g}sn!==0&&sn!==5||Ei(n),Ja!==0&&(Ja=0)}function Gy(n,s){for(var l=n.suspendedLanes,d=n.pingedLanes,g=n.expirationTimes,y=n.pendingLanes&-62914561;0<y;){var j=31-Pt(y),C=1<<j,U=g[j];U===-1?((C&l)===0||(C&d)!==0)&&(g[j]=Oa(C,s)):U<=s&&(n.expiredLanes|=C),y&=~C}if(s=jt,l=lt,l=Ct(n,n===s?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d=n.callbackNode,l===0||n===s&&(xt===2||xt===9)||n.cancelPendingCommit!==null)return d!==null&&d!==null&&Bn(d),n.callbackNode=null,n.callbackPriority=0;if((l&3)===0||Dt(n,l)){if(s=l&-l,s===n.callbackPriority)return s;switch(d!==null&&Bn(d),Z(l)){case 2:case 8:l=Ze;break;case 32:l=We;break;case 268435456:l=ft;break;default:l=We}return d=Vy.bind(null,n),l=Vt(l,d),n.callbackPriority=s,n.callbackNode=l,s}return d!==null&&d!==null&&Bn(d),n.callbackPriority=2,n.callbackNode=null,2}function Vy(n,s){if(sn!==0&&sn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var l=n.callbackNode;if(Bc()&&n.callbackNode!==l)return null;var d=lt;return d=Ct(n,n===jt?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(Ey(n,d,s),Gy(n,Ht()),n.callbackNode!=null&&n.callbackNode===l?Vy.bind(null,n):null)}function Yy(n,s){if(Bc())return null;Ey(n,s,!0)}function dj(){Sj(function(){(mt&6)!==0?Vt(Le,uj):Fy()})}function sp(){if(Ja===0){var n=io;n===0&&(n=me,me<<=1,(me&261888)===0&&(me=256)),Ja=n}return Ja}function Ky(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Kl(""+n)}function Xy(n,s){var l=s.ownerDocument.createElement("input");return l.name=s.name,l.value=s.value,n.id&&l.setAttribute("form",n.id),s.parentNode.insertBefore(l,s),n=new FormData(n),l.parentNode.removeChild(l),n}function fj(n,s,l,d,g){if(s==="submit"&&l&&l.stateNode===g){var y=Ky((g[ke]||null).action),j=d.submitter;j&&(s=(s=j[ke]||null)?Ky(s.formAction):j.getAttribute("formAction"),s!==null&&(y=s,j=null));var C=new Jl("action","action",null,d,g);n.push({event:C,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ja!==0){var U=j?Xy(g,j):new FormData(g);kf(l,{pending:!0,data:U,method:g.method,action:y},null,U)}}else typeof y=="function"&&(C.preventDefault(),U=j?Xy(g,j):new FormData(g),kf(l,{pending:!0,data:U,method:g.method,action:y},y,U))},currentTarget:g}]})}}for(var op=0;op<Pd.length;op++){var ip=Pd[op],pj=ip.toLowerCase(),hj=ip[0].toUpperCase()+ip.slice(1);Cr(pj,"on"+hj)}Cr(Ng,"onAnimationEnd"),Cr(Eg,"onAnimationIteration"),Cr(Cg,"onAnimationStart"),Cr("dblclick","onDoubleClick"),Cr("focusin","onFocus"),Cr("focusout","onBlur"),Cr(RS,"onTransitionRun"),Cr(TS,"onTransitionStart"),Cr(LS,"onTransitionCancel"),Cr(Ag,"onTransitionEnd"),Br("onMouseEnter",["mouseout","mouseover"]),Br("onMouseLeave",["mouseout","mouseover"]),Br("onPointerEnter",["pointerout","pointerover"]),Br("onPointerLeave",["pointerout","pointerover"]),dn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),dn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),dn("onBeforeInput",["compositionend","keypress","textInput","paste"]),dn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),dn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),dn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ci="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(" "),mj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ci));function Qy(n,s){s=(s&4)!==0;for(var l=0;l<n.length;l++){var d=n[l],g=d.event;d=d.listeners;e:{var y=void 0;if(s)for(var j=d.length-1;0<=j;j--){var C=d[j],U=C.instance,X=C.currentTarget;if(C=C.listener,U!==y&&g.isPropagationStopped())break e;y=C,g.currentTarget=X;try{y(g)}catch(ie){tc(ie)}g.currentTarget=null,y=U}else for(j=0;j<d.length;j++){if(C=d[j],U=C.instance,X=C.currentTarget,C=C.listener,U!==y&&g.isPropagationStopped())break e;y=C,g.currentTarget=X;try{y(g)}catch(ie){tc(ie)}g.currentTarget=null,y=U}}}}function ot(n,s){var l=s[Ie];l===void 0&&(l=s[Ie]=new Set);var d=n+"__bubble";l.has(d)||(Zy(s,n,2,!1),l.add(d))}function lp(n,s,l){var d=0;s&&(d|=4),Zy(l,n,d,s)}var Pc="_reactListening"+Math.random().toString(36).slice(2);function cp(n){if(!n[Pc]){n[Pc]=!0,an.forEach(function(l){l!=="selectionchange"&&(mj.has(l)||lp(l,!1,n),lp(l,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Pc]||(s[Pc]=!0,lp("selectionchange",!1,s))}}function Zy(n,s,l,d){switch(Nb(s)){case 2:var g=qj;break;case 8:g=Fj;break;default:g=jp}l=g.bind(null,s,l,n),g=void 0,!Cd||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(g=!0),d?g!==void 0?n.addEventListener(s,l,{capture:!0,passive:g}):n.addEventListener(s,l,!0):g!==void 0?n.addEventListener(s,l,{passive:g}):n.addEventListener(s,l,!1)}function up(n,s,l,d,g){var y=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var C=d.stateNode.containerInfo;if(C===g)break;if(j===4)for(j=d.return;j!==null;){var U=j.tag;if((U===3||U===4)&&j.stateNode.containerInfo===g)return;j=j.return}for(;C!==null;){if(j=Re(C),j===null)return;if(U=j.tag,U===5||U===6||U===26||U===27){d=y=j;continue e}C=C.parentNode}}d=d.return}ng(function(){var X=y,ie=Nd(l),pe=[];e:{var Q=Rg.get(n);if(Q!==void 0){var te=Jl,Te=n;switch(n){case"keypress":if(Ql(l)===0)break e;case"keydown":case"keyup":te=lS;break;case"focusin":Te="focus",te=Ld;break;case"focusout":Te="blur",te=Ld;break;case"beforeblur":case"afterblur":te=Ld;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=sg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=Qw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=dS;break;case Ng:case Eg:case Cg:te=Ww;break;case Ag:te=pS;break;case"scroll":case"scrollend":te=Kw;break;case"wheel":te=mS;break;case"copy":case"cut":case"paste":te=tS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=ig;break;case"toggle":case"beforetoggle":te=xS}var Ye=(s&4)!==0,_t=!Ye&&(n==="scroll"||n==="scrollend"),Y=Ye?Q!==null?Q+"Capture":null:Q;Ye=[];for(var q=X,K;q!==null;){var de=q;if(K=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||K===null||Y===null||(de=Qo(q,Y),de!=null&&Ye.push(Ai(q,de,K))),_t)break;q=q.return}0<Ye.length&&(Q=new te(Q,Te,null,l,ie),pe.push({event:Q,listeners:Ye}))}}if((s&7)===0){e:{if(Q=n==="mouseover"||n==="pointerover",te=n==="mouseout"||n==="pointerout",Q&&l!==kd&&(Te=l.relatedTarget||l.fromElement)&&(Re(Te)||Te[Ce]))break e;if((te||Q)&&(Q=ie.window===ie?ie:(Q=ie.ownerDocument)?Q.defaultView||Q.parentWindow:window,te?(Te=l.relatedTarget||l.toElement,te=X,Te=Te?Re(Te):null,Te!==null&&(_t=i(Te),Ye=Te.tag,Te!==_t||Ye!==5&&Ye!==27&&Ye!==6)&&(Te=null)):(te=null,Te=X),te!==Te)){if(Ye=sg,de="onMouseLeave",Y="onMouseEnter",q="mouse",(n==="pointerout"||n==="pointerover")&&(Ye=ig,de="onPointerLeave",Y="onPointerEnter",q="pointer"),_t=te==null?Q:Oe(te),K=Te==null?Q:Oe(Te),Q=new Ye(de,q+"leave",te,l,ie),Q.target=_t,Q.relatedTarget=K,de=null,Re(ie)===X&&(Ye=new Ye(Y,q+"enter",Te,l,ie),Ye.target=K,Ye.relatedTarget=_t,de=Ye),_t=de,te&&Te)t:{for(Ye=gj,Y=te,q=Te,K=0,de=Y;de;de=Ye(de))K++;de=0;for(var He=q;He;He=Ye(He))de++;for(;0<K-de;)Y=Ye(Y),K--;for(;0<de-K;)q=Ye(q),de--;for(;K--;){if(Y===q||q!==null&&Y===q.alternate){Ye=Y;break t}Y=Ye(Y),q=Ye(q)}Ye=null}else Ye=null;te!==null&&Jy(pe,Q,te,Ye,!1),Te!==null&&_t!==null&&Jy(pe,_t,Te,Ye,!0)}}e:{if(Q=X?Oe(X):window,te=Q.nodeName&&Q.nodeName.toLowerCase(),te==="select"||te==="input"&&Q.type==="file")var pt=mg;else if(pg(Q))if(gg)pt=ES;else{pt=kS;var Me=jS}else te=Q.nodeName,!te||te.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?X&&jd(X.elementType)&&(pt=mg):pt=NS;if(pt&&(pt=pt(n,X))){hg(pe,pt,l,ie);break e}Me&&Me(n,Q,X),n==="focusout"&&X&&Q.type==="number"&&X.memoizedProps.value!=null&&Sd(Q,"number",Q.value)}switch(Me=X?Oe(X):window,n){case"focusin":(pg(Me)||Me.contentEditable==="true")&&(Ws=Me,Bd=X,ai=null);break;case"focusout":ai=Bd=Ws=null;break;case"mousedown":Id=!0;break;case"contextmenu":case"mouseup":case"dragend":Id=!1,jg(pe,l,ie);break;case"selectionchange":if(AS)break;case"keydown":case"keyup":jg(pe,l,ie)}var et;if(Od)e:{switch(n){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else Js?dg(n,l)&&(ct="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(ct="onCompositionStart");ct&&(lg&&l.locale!=="ko"&&(Js||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&Js&&(et=rg()):(za=ie,Ad="value"in za?za.value:za.textContent,Js=!0)),Me=Hc(X,ct),0<Me.length&&(ct=new og(ct,n,null,l,ie),pe.push({event:ct,listeners:Me}),et?ct.data=et:(et=fg(l),et!==null&&(ct.data=et)))),(et=bS?vS(n,l):_S(n,l))&&(ct=Hc(X,"onBeforeInput"),0<ct.length&&(Me=new og("onBeforeInput","beforeinput",null,l,ie),pe.push({event:Me,listeners:ct}),Me.data=et)),fj(pe,n,X,l,ie)}Qy(pe,s)})}function Ai(n,s,l){return{instance:n,listener:s,currentTarget:l}}function Hc(n,s){for(var l=s+"Capture",d=[];n!==null;){var g=n,y=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||y===null||(g=Qo(n,l),g!=null&&d.unshift(Ai(n,g,y)),g=Qo(n,s),g!=null&&d.push(Ai(n,g,y))),n.tag===3)return d;n=n.return}return[]}function gj(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Jy(n,s,l,d,g){for(var y=s._reactName,j=[];l!==null&&l!==d;){var C=l,U=C.alternate,X=C.stateNode;if(C=C.tag,U!==null&&U===d)break;C!==5&&C!==26&&C!==27||X===null||(U=X,g?(X=Qo(l,y),X!=null&&j.unshift(Ai(l,X,U))):g||(X=Qo(l,y),X!=null&&j.push(Ai(l,X,U)))),l=l.return}j.length!==0&&n.push({event:s,listeners:j})}var xj=/\r\n?/g,yj=/\u0000|\uFFFD/g;function Wy(n){return(typeof n=="string"?n:""+n).replace(xj,`
10
+ `).replace(yj,"")}function eb(n,s){return s=Wy(s),Wy(n)===s}function vt(n,s,l,d,g,y){switch(l){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Xs(n,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Xs(n,""+d);break;case"className":Yt(n,"class",d);break;case"tabIndex":Yt(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Yt(n,l,d);break;case"style":eg(n,d,y);break;case"data":if(s!=="object"){Yt(n,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||l!=="href")){n.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(l);break}d=Kl(""+d),n.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){n.setAttribute(l,"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 y=="function"&&(l==="formAction"?(s!=="input"&&vt(n,s,"name",g.name,g,null),vt(n,s,"formEncType",g.formEncType,g,null),vt(n,s,"formMethod",g.formMethod,g,null),vt(n,s,"formTarget",g.formTarget,g,null)):(vt(n,s,"encType",g.encType,g,null),vt(n,s,"method",g.method,g,null),vt(n,s,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(l);break}d=Kl(""+d),n.setAttribute(l,d);break;case"onClick":d!=null&&(n.onclick=la);break;case"onScroll":d!=null&&ot("scroll",n);break;case"onScrollEnd":d!=null&&ot("scrollend",n);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(a(60));n.innerHTML=l}}break;case"multiple":n.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":n.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){n.removeAttribute("xlink:href");break}l=Kl(""+d),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(l,""+d):n.removeAttribute(l);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":d&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(l,""):n.removeAttribute(l);break;case"capture":case"download":d===!0?n.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(l,d):n.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?n.setAttribute(l,d):n.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?n.removeAttribute(l):n.setAttribute(l,d);break;case"popover":ot("beforetoggle",n),ot("toggle",n),at(n,"popover",d);break;case"xlinkActuate":wn(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":wn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":wn(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":wn(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":wn(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":wn(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":wn(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":wn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":wn(n,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":at(n,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Vw.get(l)||l,at(n,l,d))}}function dp(n,s,l,d,g,y){switch(l){case"style":eg(n,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(a(60));n.innerHTML=l}}break;case"children":typeof d=="string"?Xs(n,d):(typeof d=="number"||typeof d=="bigint")&&Xs(n,""+d);break;case"onScroll":d!=null&&ot("scroll",n);break;case"onScrollEnd":d!=null&&ot("scrollend",n);break;case"onClick":d!=null&&(n.onclick=la);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_n.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),s=l.slice(2,g?l.length-7:void 0),y=n[ke]||null,y=y!=null?y[l]:null,typeof y=="function"&&n.removeEventListener(s,y,g),typeof d=="function")){typeof y!="function"&&y!==null&&(l in n?n[l]=null:n.hasAttribute(l)&&n.removeAttribute(l)),n.addEventListener(s,d,g);break e}l in n?n[l]=d:d===!0?n.setAttribute(l,""):at(n,l,d)}}}function vn(n,s,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",n),ot("load",n);var d=!1,g=!1,y;for(y in l)if(l.hasOwnProperty(y)){var j=l[y];if(j!=null)switch(y){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:vt(n,s,y,j,l,null)}}g&&vt(n,s,"srcSet",l.srcSet,l,null),d&&vt(n,s,"src",l.src,l,null);return;case"input":ot("invalid",n);var C=y=j=g=null,U=null,X=null;for(d in l)if(l.hasOwnProperty(d)){var ie=l[d];if(ie!=null)switch(d){case"name":g=ie;break;case"type":j=ie;break;case"checked":U=ie;break;case"defaultChecked":X=ie;break;case"value":y=ie;break;case"defaultValue":C=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,s));break;default:vt(n,s,d,ie,l,null)}}Qm(n,y,C,U,X,j,g,!1);return;case"select":ot("invalid",n),d=j=y=null;for(g in l)if(l.hasOwnProperty(g)&&(C=l[g],C!=null))switch(g){case"value":y=C;break;case"defaultValue":j=C;break;case"multiple":d=C;default:vt(n,s,g,C,l,null)}s=y,l=j,n.multiple=!!d,s!=null?Ks(n,!!d,s,!1):l!=null&&Ks(n,!!d,l,!0);return;case"textarea":ot("invalid",n),y=g=d=null;for(j in l)if(l.hasOwnProperty(j)&&(C=l[j],C!=null))switch(j){case"value":d=C;break;case"defaultValue":g=C;break;case"children":y=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(a(91));break;default:vt(n,s,j,C,l,null)}Jm(n,d,g,y);return;case"option":for(U in l)l.hasOwnProperty(U)&&(d=l[U],d!=null)&&(U==="selected"?n.selected=d&&typeof d!="function"&&typeof d!="symbol":vt(n,s,U,d,l,null));return;case"dialog":ot("beforetoggle",n),ot("toggle",n),ot("cancel",n),ot("close",n);break;case"iframe":case"object":ot("load",n);break;case"video":case"audio":for(d=0;d<Ci.length;d++)ot(Ci[d],n);break;case"image":ot("error",n),ot("load",n);break;case"details":ot("toggle",n);break;case"embed":case"source":case"link":ot("error",n),ot("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(X in l)if(l.hasOwnProperty(X)&&(d=l[X],d!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:vt(n,s,X,d,l,null)}return;default:if(jd(s)){for(ie in l)l.hasOwnProperty(ie)&&(d=l[ie],d!==void 0&&dp(n,s,ie,d,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(d=l[C],d!=null&&vt(n,s,C,d,l,null))}function bj(n,s,l,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,y=null,j=null,C=null,U=null,X=null,ie=null;for(te in l){var pe=l[te];if(l.hasOwnProperty(te)&&pe!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":U=pe;default:d.hasOwnProperty(te)||vt(n,s,te,null,d,pe)}}for(var Q in d){var te=d[Q];if(pe=l[Q],d.hasOwnProperty(Q)&&(te!=null||pe!=null))switch(Q){case"type":y=te;break;case"name":g=te;break;case"checked":X=te;break;case"defaultChecked":ie=te;break;case"value":j=te;break;case"defaultValue":C=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,s));break;default:te!==pe&&vt(n,s,Q,te,d,pe)}}wd(n,j,C,U,X,ie,y,g);return;case"select":te=j=C=Q=null;for(y in l)if(U=l[y],l.hasOwnProperty(y)&&U!=null)switch(y){case"value":break;case"multiple":te=U;default:d.hasOwnProperty(y)||vt(n,s,y,null,d,U)}for(g in d)if(y=d[g],U=l[g],d.hasOwnProperty(g)&&(y!=null||U!=null))switch(g){case"value":Q=y;break;case"defaultValue":C=y;break;case"multiple":j=y;default:y!==U&&vt(n,s,g,y,d,U)}s=C,l=j,d=te,Q!=null?Ks(n,!!l,Q,!1):!!d!=!!l&&(s!=null?Ks(n,!!l,s,!0):Ks(n,!!l,l?[]:"",!1));return;case"textarea":te=Q=null;for(C in l)if(g=l[C],l.hasOwnProperty(C)&&g!=null&&!d.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:vt(n,s,C,null,d,g)}for(j in d)if(g=d[j],y=l[j],d.hasOwnProperty(j)&&(g!=null||y!=null))switch(j){case"value":Q=g;break;case"defaultValue":te=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==y&&vt(n,s,j,g,d,y)}Zm(n,Q,te);return;case"option":for(var Te in l)Q=l[Te],l.hasOwnProperty(Te)&&Q!=null&&!d.hasOwnProperty(Te)&&(Te==="selected"?n.selected=!1:vt(n,s,Te,null,d,Q));for(U in d)Q=d[U],te=l[U],d.hasOwnProperty(U)&&Q!==te&&(Q!=null||te!=null)&&(U==="selected"?n.selected=Q&&typeof Q!="function"&&typeof Q!="symbol":vt(n,s,U,Q,d,te));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 Ye in l)Q=l[Ye],l.hasOwnProperty(Ye)&&Q!=null&&!d.hasOwnProperty(Ye)&&vt(n,s,Ye,null,d,Q);for(X in d)if(Q=d[X],te=l[X],d.hasOwnProperty(X)&&Q!==te&&(Q!=null||te!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(a(137,s));break;default:vt(n,s,X,Q,d,te)}return;default:if(jd(s)){for(var _t in l)Q=l[_t],l.hasOwnProperty(_t)&&Q!==void 0&&!d.hasOwnProperty(_t)&&dp(n,s,_t,void 0,d,Q);for(ie in d)Q=d[ie],te=l[ie],!d.hasOwnProperty(ie)||Q===te||Q===void 0&&te===void 0||dp(n,s,ie,Q,d,te);return}}for(var Y in l)Q=l[Y],l.hasOwnProperty(Y)&&Q!=null&&!d.hasOwnProperty(Y)&&vt(n,s,Y,null,d,Q);for(pe in d)Q=d[pe],te=l[pe],!d.hasOwnProperty(pe)||Q===te||Q==null&&te==null||vt(n,s,pe,Q,d,te)}function tb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function vj(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var g=l[d],y=g.transferSize,j=g.initiatorType,C=g.duration;if(y&&C&&tb(j)){for(j=0,C=g.responseEnd,d+=1;d<l.length;d++){var U=l[d],X=U.startTime;if(X>C)break;var ie=U.transferSize,pe=U.initiatorType;ie&&tb(pe)&&(U=U.responseEnd,j+=ie*(U<C?1:(C-X)/(U-X)))}if(--d,s+=8*(y+j)/(g.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var fp=null,pp=null;function qc(n){return n.nodeType===9?n:n.ownerDocument}function nb(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function rb(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function hp(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var mp=null;function _j(){var n=window.event;return n&&n.type==="popstate"?n===mp?!1:(mp=n,!0):(mp=null,!1)}var ab=typeof setTimeout=="function"?setTimeout:void 0,wj=typeof clearTimeout=="function"?clearTimeout:void 0,sb=typeof Promise=="function"?Promise:void 0,Sj=typeof queueMicrotask=="function"?queueMicrotask:typeof sb<"u"?function(n){return sb.resolve(null).then(n).catch(jj)}:ab;function jj(n){setTimeout(function(){throw n})}function Wa(n){return n==="head"}function ob(n,s){var l=s,d=0;do{var g=l.nextSibling;if(n.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(d===0){n.removeChild(g),Eo(s);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")Ri(n.ownerDocument.documentElement);else if(l==="head"){l=n.ownerDocument.head,Ri(l);for(var y=l.firstChild;y;){var j=y.nextSibling,C=y.nodeName;y[ue]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&y.rel.toLowerCase()==="stylesheet"||l.removeChild(y),y=j}}else l==="body"&&Ri(n.ownerDocument.body);l=g}while(l);Eo(s)}function ib(n,s){var l=n;n=0;do{var d=l.nextSibling;if(l.nodeType===1?s?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(s?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(n===0)break;n--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||n++;l=d}while(l)}function gp(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var l=s;switch(s=s.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":gp(l),Ee(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}n.removeChild(l)}}function kj(n,s,l,d){for(;n.nodeType===1;){var g=l;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(d){if(!n[ue])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(y=n.getAttribute("rel"),y==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(y!==g.rel||n.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||n.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||n.getAttribute("title")!==(g.title==null?null:g.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(y=n.getAttribute("src"),(y!==(g.src==null?null:g.src)||n.getAttribute("type")!==(g.type==null?null:g.type)||n.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&y&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var y=g.name==null?null:""+g.name;if(g.type==="hidden"&&n.getAttribute("name")===y)return n}else return n;if(n=yr(n.nextSibling),n===null)break}return null}function Nj(n,s,l){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=yr(n.nextSibling),n===null))return null;return n}function lb(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=yr(n.nextSibling),n===null))return null;return n}function xp(n){return n.data==="$?"||n.data==="$~"}function yp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Ej(n,s){var l=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||l.readyState!=="loading")s();else{var d=function(){s(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),n._reactRetry=d}}function yr(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var bp=null;function cb(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"||l==="/&"){if(s===0)return yr(n.nextSibling);s--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||s++}n=n.nextSibling}return null}function ub(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(s===0)return n;s--}else l!=="/$"&&l!=="/&"||s++}n=n.previousSibling}return null}function db(n,s,l){switch(s=qc(l),n){case"html":if(n=s.documentElement,!n)throw Error(a(452));return n;case"head":if(n=s.head,!n)throw Error(a(453));return n;case"body":if(n=s.body,!n)throw Error(a(454));return n;default:throw Error(a(451))}}function Ri(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);Ee(n)}var br=new Map,fb=new Set;function Fc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ja=F.d;F.d={f:Cj,r:Aj,D:Rj,C:Tj,L:Lj,m:Dj,X:Mj,S:Oj,M:zj};function Cj(){var n=ja.f(),s=Mc();return n||s}function Aj(n){var s=Ge(n);s!==null&&s.tag===5&&s.type==="form"?Ax(s):ja.r(n)}var jo=typeof document>"u"?null:document;function pb(n,s,l){var d=jo;if(d&&typeof s=="string"&&s){var g=dr(s);g='link[rel="'+n+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),fb.has(g)||(fb.add(g),n={rel:n,crossOrigin:l,href:s},d.querySelector(g)===null&&(s=d.createElement("link"),vn(s,"link",n),it(s),d.head.appendChild(s)))}}function Rj(n){ja.D(n),pb("dns-prefetch",n,null)}function Tj(n,s){ja.C(n,s),pb("preconnect",n,s)}function Lj(n,s,l){ja.L(n,s,l);var d=jo;if(d&&n&&s){var g='link[rel="preload"][as="'+dr(s)+'"]';s==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+dr(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+dr(l.imageSizes)+'"]')):g+='[href="'+dr(n)+'"]';var y=g;switch(s){case"style":y=ko(n);break;case"script":y=No(n)}br.has(y)||(n=x({rel:"preload",href:s==="image"&&l&&l.imageSrcSet?void 0:n,as:s},l),br.set(y,n),d.querySelector(g)!==null||s==="style"&&d.querySelector(Ti(y))||s==="script"&&d.querySelector(Li(y))||(s=d.createElement("link"),vn(s,"link",n),it(s),d.head.appendChild(s)))}}function Dj(n,s){ja.m(n,s);var l=jo;if(l&&n){var d=s&&typeof s.as=="string"?s.as:"script",g='link[rel="modulepreload"][as="'+dr(d)+'"][href="'+dr(n)+'"]',y=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=No(n)}if(!br.has(y)&&(n=x({rel:"modulepreload",href:n},s),br.set(y,n),l.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Li(y)))return}d=l.createElement("link"),vn(d,"link",n),it(d),l.head.appendChild(d)}}}function Oj(n,s,l){ja.S(n,s,l);var d=jo;if(d&&n){var g=gt(d).hoistableStyles,y=ko(n);s=s||"default";var j=g.get(y);if(!j){var C={loading:0,preload:null};if(j=d.querySelector(Ti(y)))C.loading=5;else{n=x({rel:"stylesheet",href:n,"data-precedence":s},l),(l=br.get(y))&&vp(n,l);var U=j=d.createElement("link");it(U),vn(U,"link",n),U._p=new Promise(function(X,ie){U.onload=X,U.onerror=ie}),U.addEventListener("load",function(){C.loading|=1}),U.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Gc(j,s,d)}j={type:"stylesheet",instance:j,count:1,state:C},g.set(y,j)}}}function Mj(n,s){ja.X(n,s);var l=jo;if(l&&n){var d=gt(l).hoistableScripts,g=No(n),y=d.get(g);y||(y=l.querySelector(Li(g)),y||(n=x({src:n,async:!0},s),(s=br.get(g))&&_p(n,s),y=l.createElement("script"),it(y),vn(y,"link",n),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function zj(n,s){ja.M(n,s);var l=jo;if(l&&n){var d=gt(l).hoistableScripts,g=No(n),y=d.get(g);y||(y=l.querySelector(Li(g)),y||(n=x({src:n,async:!0,type:"module"},s),(s=br.get(g))&&_p(n,s),y=l.createElement("script"),it(y),vn(y,"link",n),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function hb(n,s,l,d){var g=(g=ge.current)?Fc(g):null;if(!g)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(s=ko(l.href),l=gt(g).hoistableStyles,d=l.get(s),d||(d={type:"style",instance:null,count:0,state:null},l.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){n=ko(l.href);var y=gt(g).hoistableStyles,j=y.get(n);if(j||(g=g.ownerDocument||g,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(n,j),(y=g.querySelector(Ti(n)))&&!y._p&&(j.instance=y,j.state.loading=5),br.has(n)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},br.set(n,l),y||$j(g,n,l,j.state))),s&&d===null)throw Error(a(528,""));return j}if(s&&d!==null)throw Error(a(529,""));return null;case"script":return s=l.async,l=l.src,typeof l=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=No(l),l=gt(g).hoistableScripts,d=l.get(s),d||(d={type:"script",instance:null,count:0,state:null},l.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function ko(n){return'href="'+dr(n)+'"'}function Ti(n){return'link[rel="stylesheet"]['+n+"]"}function mb(n){return x({},n,{"data-precedence":n.precedence,precedence:null})}function $j(n,s,l,d){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=n.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),vn(s,"link",l),it(s),n.head.appendChild(s))}function No(n){return'[src="'+dr(n)+'"]'}function Li(n){return"script[async]"+n}function gb(n,s,l){if(s.count++,s.instance===null)switch(s.type){case"style":var d=n.querySelector('style[data-href~="'+dr(l.href)+'"]');if(d)return s.instance=d,it(d),d;var g=x({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),it(d),vn(d,"style",g),Gc(d,l.precedence,n),s.instance=d;case"stylesheet":g=ko(l.href);var y=n.querySelector(Ti(g));if(y)return s.state.loading|=4,s.instance=y,it(y),y;d=mb(l),(g=br.get(g))&&vp(d,g),y=(n.ownerDocument||n).createElement("link"),it(y);var j=y;return j._p=new Promise(function(C,U){j.onload=C,j.onerror=U}),vn(y,"link",d),s.state.loading|=4,Gc(y,l.precedence,n),s.instance=y;case"script":return y=No(l.src),(g=n.querySelector(Li(y)))?(s.instance=g,it(g),g):(d=l,(g=br.get(y))&&(d=x({},l),_p(d,g)),n=n.ownerDocument||n,g=n.createElement("script"),it(g),vn(g,"link",d),n.head.appendChild(g),s.instance=g);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Gc(d,l.precedence,n));return s.instance}function Gc(n,s,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,y=g,j=0;j<d.length;j++){var C=d[j];if(C.dataset.precedence===s)y=C;else if(y!==g)break}y?y.parentNode.insertBefore(n,y.nextSibling):(s=l.nodeType===9?l.head:l,s.insertBefore(n,s.firstChild))}function vp(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function _p(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Vc=null;function xb(n,s,l){if(Vc===null){var d=new Map,g=Vc=new Map;g.set(l,d)}else g=Vc,d=g.get(l),d||(d=new Map,g.set(l,d));if(d.has(n))return d;for(d.set(n,null),l=l.getElementsByTagName(n),g=0;g<l.length;g++){var y=l[g];if(!(y[ue]||y[je]||n==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var j=y.getAttribute(s)||"";j=n+j;var C=d.get(j);C?C.push(y):d.set(j,[y])}}return d}function yb(n,s,l){n=n.ownerDocument||n,n.head.insertBefore(l,s==="title"?n.querySelector("head > title"):null)}function Bj(n,s,l){if(l===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(n=s.disabled,typeof s.precedence=="string"&&n==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function bb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Ij(n,s,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=ko(d.href),y=s.querySelector(Ti(g));if(y){s=y._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Yc.bind(n),s.then(n,n)),l.state.loading|=4,l.instance=y,it(y);return}y=s.ownerDocument||s,d=mb(d),(g=br.get(g))&&vp(d,g),y=y.createElement("link"),it(y);var j=y;j._p=new Promise(function(C,U){j.onload=C,j.onerror=U}),vn(y,"link",d),l.instance=y}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,s),(s=l.state.preload)&&(l.state.loading&3)===0&&(n.count++,l=Yc.bind(n),s.addEventListener("load",l),s.addEventListener("error",l))}}var wp=0;function Uj(n,s){return n.stylesheets&&n.count===0&&Xc(n,n.stylesheets),0<n.count||0<n.imgCount?function(l){var d=setTimeout(function(){if(n.stylesheets&&Xc(n,n.stylesheets),n.unsuspend){var y=n.unsuspend;n.unsuspend=null,y()}},6e4+s);0<n.imgBytes&&wp===0&&(wp=62500*vj());var g=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Xc(n,n.stylesheets),n.unsuspend)){var y=n.unsuspend;n.unsuspend=null,y()}},(n.imgBytes>wp?50:800)+s);return n.unsuspend=l,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function Yc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Kc=null;function Xc(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Kc=new Map,s.forEach(Pj,n),Kc=null,Yc.call(n))}function Pj(n,s){if(!(s.state.loading&4)){var l=Kc.get(n);if(l)var d=l.get(null);else{l=new Map,Kc.set(n,l);for(var g=n.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<g.length;y++){var j=g[y];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(l.set(j.dataset.precedence,j),d=j)}d&&l.set(null,d)}g=s.instance,j=g.getAttribute("data-precedence"),y=l.get(j)||d,y===d&&l.set(null,g),l.set(j,g),this.count++,d=Yc.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),y?y.parentNode.insertBefore(g,y.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(g,n.firstChild)),s.state.loading|=4}}var Di={$$typeof:E,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Hj(n,s,l,d,g,y,j,C,U){this.tag=1,this.containerInfo=n,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=ur(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ur(0),this.hiddenUpdates=ur(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=y,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function vb(n,s,l,d,g,y,j,C,U,X,ie,pe){return n=new Hj(n,s,l,j,U,X,ie,pe,C),s=1,y===!0&&(s|=24),y=Zn(3,null,null,s),n.current=y,y.stateNode=n,s=ef(),s.refCount++,n.pooledCache=s,s.refCount++,y.memoizedState={element:d,isDehydrated:l,cache:s},af(y),n}function _b(n){return n?(n=no,n):no}function wb(n,s,l,d,g,y){g=_b(g),d.context===null?d.context=g:d.pendingContext=g,d=Ha(s),d.payload={element:l},y=y===void 0?null:y,y!==null&&(d.callback=y),l=qa(n,d,s),l!==null&&(Fn(l,n,s),di(l,n,s))}function Sb(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<s?l:s}}function Sp(n,s){Sb(n,s),(n=n.alternate)&&Sb(n,s)}function jb(n){if(n.tag===13||n.tag===31){var s=xs(n,67108864);s!==null&&Fn(s,n,67108864),Sp(n,67108864)}}function kb(n){if(n.tag===13||n.tag===31){var s=nr();s=G(s);var l=xs(n,s);l!==null&&Fn(l,n,s),Sp(n,s)}}var Qc=!0;function qj(n,s,l,d){var g=T.T;T.T=null;var y=F.p;try{F.p=2,jp(n,s,l,d)}finally{F.p=y,T.T=g}}function Fj(n,s,l,d){var g=T.T;T.T=null;var y=F.p;try{F.p=8,jp(n,s,l,d)}finally{F.p=y,T.T=g}}function jp(n,s,l,d){if(Qc){var g=kp(d);if(g===null)up(n,s,d,Zc,l),Eb(n,d);else if(Vj(g,n,s,l,d))d.stopPropagation();else if(Eb(n,d),s&4&&-1<Gj.indexOf(n)){for(;g!==null;){var y=Ge(g);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var j=nt(y.pendingLanes);if(j!==0){var C=y;for(C.pendingLanes|=2,C.entangledLanes|=2;j;){var U=1<<31-Pt(j);C.entanglements[1]|=U,j&=~U}qr(y),(mt&6)===0&&(Dc=Ht()+500,Ei(0))}}break;case 31:case 13:C=xs(y,2),C!==null&&Fn(C,y,2),Mc(),Sp(y,2)}if(y=kp(d),y===null&&up(n,s,d,Zc,l),y===g)break;g=y}g!==null&&d.stopPropagation()}else up(n,s,d,null,l)}}function kp(n){return n=Nd(n),Np(n)}var Zc=null;function Np(n){if(Zc=null,n=Re(n),n!==null){var s=i(n);if(s===null)n=null;else{var l=s.tag;if(l===13){if(n=u(s),n!==null)return n;n=null}else if(l===31){if(n=f(s),n!==null)return n;n=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return Zc=n,null}function Nb(n){switch(n){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(An()){case Le:return 2;case Ze:return 8;case We:case Nt:return 32;case ft:return 268435456;default:return 32}default:return 32}}var Ep=!1,es=null,ts=null,ns=null,Oi=new Map,Mi=new Map,rs=[],Gj="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 Eb(n,s){switch(n){case"focusin":case"focusout":es=null;break;case"dragenter":case"dragleave":ts=null;break;case"mouseover":case"mouseout":ns=null;break;case"pointerover":case"pointerout":Oi.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mi.delete(s.pointerId)}}function zi(n,s,l,d,g,y){return n===null||n.nativeEvent!==y?(n={blockedOn:s,domEventName:l,eventSystemFlags:d,nativeEvent:y,targetContainers:[g]},s!==null&&(s=Ge(s),s!==null&&jb(s)),n):(n.eventSystemFlags|=d,s=n.targetContainers,g!==null&&s.indexOf(g)===-1&&s.push(g),n)}function Vj(n,s,l,d,g){switch(s){case"focusin":return es=zi(es,n,s,l,d,g),!0;case"dragenter":return ts=zi(ts,n,s,l,d,g),!0;case"mouseover":return ns=zi(ns,n,s,l,d,g),!0;case"pointerover":var y=g.pointerId;return Oi.set(y,zi(Oi.get(y)||null,n,s,l,d,g)),!0;case"gotpointercapture":return y=g.pointerId,Mi.set(y,zi(Mi.get(y)||null,n,s,l,d,g)),!0}return!1}function Cb(n){var s=Re(n.target);if(s!==null){var l=i(s);if(l!==null){if(s=l.tag,s===13){if(s=u(l),s!==null){n.blockedOn=s,we(n.priority,function(){kb(l)});return}}else if(s===31){if(s=f(l),s!==null){n.blockedOn=s,we(n.priority,function(){kb(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Jc(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var l=kp(n.nativeEvent);if(l===null){l=n.nativeEvent;var d=new l.constructor(l.type,l);kd=d,l.target.dispatchEvent(d),kd=null}else return s=Ge(l),s!==null&&jb(s),n.blockedOn=l,!1;s.shift()}return!0}function Ab(n,s,l){Jc(n)&&l.delete(s)}function Yj(){Ep=!1,es!==null&&Jc(es)&&(es=null),ts!==null&&Jc(ts)&&(ts=null),ns!==null&&Jc(ns)&&(ns=null),Oi.forEach(Ab),Mi.forEach(Ab)}function Wc(n,s){n.blockedOn===s&&(n.blockedOn=null,Ep||(Ep=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Yj)))}var eu=null;function Rb(n){eu!==n&&(eu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){eu===n&&(eu=null);for(var s=0;s<n.length;s+=3){var l=n[s],d=n[s+1],g=n[s+2];if(typeof d!="function"){if(Np(d||l)===null)continue;break}var y=Ge(l);y!==null&&(n.splice(s,3),s-=3,kf(y,{pending:!0,data:g,method:l.method,action:d},d,g))}}))}function Eo(n){function s(U){return Wc(U,n)}es!==null&&Wc(es,n),ts!==null&&Wc(ts,n),ns!==null&&Wc(ns,n),Oi.forEach(s),Mi.forEach(s);for(var l=0;l<rs.length;l++){var d=rs[l];d.blockedOn===n&&(d.blockedOn=null)}for(;0<rs.length&&(l=rs[0],l.blockedOn===null);)Cb(l),l.blockedOn===null&&rs.shift();if(l=(n.ownerDocument||n).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var g=l[d],y=l[d+1],j=g[ke]||null;if(typeof y=="function")j||Rb(l);else if(j){var C=null;if(y&&y.hasAttribute("formAction")){if(g=y,j=y[ke]||null)C=j.formAction;else if(Np(g)!==null)continue}else C=j.action;typeof C=="function"?l[d+1]=C:(l.splice(d,3),d-=3),Rb(l)}}}function Tb(){function n(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(j){return g=j})},focusReset:"manual",scroll:"manual"})}function s(){g!==null&&(g(),g=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),g!==null&&(g(),g=null)}}}function Cp(n){this._internalRoot=n}tu.prototype.render=Cp.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(a(409));var l=s.current,d=nr();wb(l,d,n,s,null,null)},tu.prototype.unmount=Cp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;wb(n.current,2,null,n,null,null),Mc(),s[Ce]=null}};function tu(n){this._internalRoot=n}tu.prototype.unstable_scheduleHydration=function(n){if(n){var s=xe();n={blockedOn:null,target:n,priority:s};for(var l=0;l<rs.length&&s!==0&&s<rs[l].priority;l++);rs.splice(l,0,n),l===0&&Cb(n)}};var Lb=t.version;if(Lb!=="19.2.4")throw Error(a(527,Lb,"19.2.4"));F.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(a(188)):(n=Object.keys(n).join(","),Error(a(268,n)));return n=p(s),n=n!==null?m(n):null,n=n===null?null:n.stateNode,n};var Kj={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nu.isDisabled&&nu.supportsFiber)try{gn=nu.inject(Kj),Lt=nu}catch{}}return Ii.createRoot=function(n,s){if(!o(n))throw Error(a(299));var l=!1,d="",g=Ix,y=Ux,j=Px;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(g=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(j=s.onRecoverableError)),s=vb(n,1,!1,null,null,l,d,null,g,y,j,Tb),n[Ce]=s.current,cp(n),new Cp(s)},Ii.hydrateRoot=function(n,s,l){if(!o(n))throw Error(a(299));var d=!1,g="",y=Ix,j=Ux,C=Px,U=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(U=l.formState)),s=vb(n,1,!0,s,l??null,d,g,U,y,j,C,Tb),s.context=_b(null),l=s.current,d=nr(),d=G(d),g=Ha(d),g.callback=null,qa(l,g,d),l=d,s.current.lanes=l,Tn(s,l),qr(s),n[Ce]=s.current,cp(n),new tu(s)},Ii.version="19.2.4",Ii}var c0;function dk(){if(c0)return zp.exports;c0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),zp.exports=uk(),zp.exports}var fk=dk();var Q_=e=>{throw TypeError(e)},pk=(e,t,r)=>t.has(e)||Q_("Cannot "+r),Up=(e,t,r)=>(pk(e,t,"read from private field"),r?r.call(e):t.get(e)),hk=(e,t,r)=>t.has(e)?Q_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),u0="popstate";function d0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function mk(e={}){function t(a,o){let i=o.state?.masked,{pathname:u,search:f,hash:h}=i||a.location;return hl("",{pathname:u,search:f,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,o){return typeof o=="string"?o:Jr(o)}return xk(t,r,null,e)}function rt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Gt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function gk(){return Math.random().toString(36).substring(2,10)}function f0(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function hl(e,t,r=null,a,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Da(t):t,state:r,key:t&&t.key||a||gk(),unstable_mask:o}}function Jr({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Da(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function xk(e,t,r,a={}){let{window:o=document.defaultView,v5Compat:i=!1}=a,u=o.history,f="POP",h=null,p=m();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function m(){return(u.state||{idx:null}).idx}function x(){f="POP";let k=m(),N=k==null?null:k-p;p=k,h&&h({action:f,location:S.location,delta:N})}function v(k,N){f="PUSH";let A=d0(k)?k:hl(S.location,k,N);p=m()+1;let E=f0(A,p),D=S.createHref(A.unstable_mask||A);try{u.pushState(E,"",D)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;o.location.assign(D)}i&&h&&h({action:f,location:S.location,delta:1})}function _(k,N){f="REPLACE";let A=d0(k)?k:hl(S.location,k,N);p=m();let E=f0(A,p),D=S.createHref(A.unstable_mask||A);u.replaceState(E,"",D),i&&h&&h({action:f,location:S.location,delta:0})}function w(k){return Z_(k)}let S={get action(){return f},get location(){return e(o,u)},listen(k){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(u0,x),h=k,()=>{o.removeEventListener(u0,x),h=null}},createHref(k){return t(o,k)},createURL:w,encodeLocation(k){let N=w(k);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:v,replace:_,go(k){return u.go(k)}};return S}function Z_(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),rt(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Jr(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=r+a),new URL(a,r)}var nl,p0=class{constructor(e){if(hk(this,nl,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Up(this,nl).has(e))return Up(this,nl).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Up(this,nl).set(e,t)}};nl=new WeakMap;var yk=new Set(["lazy","caseSensitive","path","id","index","children"]);function bk(e){return yk.has(e)}var vk=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function _k(e){return vk.has(e)}function wk(e){return e.index===!0}function ml(e,t,r=[],a={},o=!1){return e.map((i,u)=>{let f=[...r,String(u)],h=typeof i.id=="string"?i.id:f.join("-");if(rt(i.index!==!0||!i.children,"Cannot specify children on an index route"),rt(o||!a[h],`Found a route id collision on id "${h}". Route id's must be globally unique within Data Router usages`),wk(i)){let p={...i,id:h};return a[h]=h0(p,t(p)),p}else{let p={...i,id:h,children:void 0};return a[h]=h0(p,t(p)),i.children&&(p.children=ml(i.children,t,f,a,o)),p}})}function h0(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function os(e,t,r="/"){return rl(e,t,r,!1)}function rl(e,t,r,a){let o=typeof t=="string"?Da(t):t,i=Sr(o.pathname||"/",r);if(i==null)return null;let u=J_(e);jk(u);let f=null;for(let h=0;f==null&&h<u.length;++h){let p=Mk(i);f=Dk(u[h],p,a)}return f}function Sk(e,t){let{route:r,pathname:a,params:o}=e;return{id:r.id,pathname:a,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function J_(e,t=[],r=[],a="",o=!1){let i=(u,f,h=o,p)=>{let m={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(a)&&h)return;rt(m.relativePath.startsWith(a),`Absolute route path "${m.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(a.length)}let x=Lr([a,m.relativePath]),v=r.concat(m);u.children&&u.children.length>0&&(rt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),J_(u.children,t,v,x,h)),!(u.path==null&&!u.index)&&t.push({path:x,score:Tk(x,u.index),routesMeta:v})};return e.forEach((u,f)=>{if(u.path===""||!u.path?.includes("?"))i(u,f);else for(let h of W_(u.path))i(u,f,!0,h)}),t}function W_(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,o=r.endsWith("?"),i=r.replace(/\?$/,"");if(a.length===0)return o?[i,""]:[i];let u=W_(a.join("/")),f=[];return f.push(...u.map(h=>h===""?i:[i,h].join("/"))),o&&f.push(...u),f.map(h=>e.startsWith("/")&&h===""?"/":h)}function jk(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Lk(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var kk=/^:[\w-]+$/,Nk=3,Ek=2,Ck=1,Ak=10,Rk=-2,m0=e=>e==="*";function Tk(e,t){let r=e.split("/"),a=r.length;return r.some(m0)&&(a+=Rk),t&&(a+=Ek),r.filter(o=>!m0(o)).reduce((o,i)=>o+(kk.test(i)?Nk:i===""?Ck:Ak),a)}function Lk(e,t){return e.length===t.length&&e.slice(0,-1).every((a,o)=>a===t[o])?e[e.length-1]-t[t.length-1]:0}function Dk(e,t,r=!1){let{routesMeta:a}=e,o={},i="/",u=[];for(let f=0;f<a.length;++f){let h=a[f],p=f===a.length-1,m=i==="/"?t:t.slice(i.length)||"/",x=Bu({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},m),v=h.route;if(!x&&p&&r&&!a[a.length-1].route.index&&(x=Bu({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},m)),!x)return null;Object.assign(o,x.params),u.push({params:o,pathname:Lr([i,x.pathname]),pathnameBase:Bk(Lr([i,x.pathnameBase])),route:v}),x.pathnameBase!=="/"&&(i=Lr([i,x.pathnameBase]))}return u}function Bu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Ok(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let i=o[0],u=i.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:a.reduce((p,{paramName:m,isOptional:x},v)=>{if(m==="*"){let w=f[v]||"";u=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const _=f[v];return x&&!_?p[m]=void 0:p[m]=(_||"").replace(/%2F/g,"/"),p},{}),pathname:i,pathnameBase:u,pattern:e}}function Ok(e,t=!1,r=!0){Gt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,f,h,p,m)=>{if(a.push({paramName:f,isOptional:h!=null}),h){let x=m.charAt(p+u.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),a]}function Mk(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Gt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Sr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function zk({basename:e,pathname:t}){return t==="/"?e:Lr([e,t])}var e1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,um=e=>e1.test(e);function $k(e,t="/"){let{pathname:r,search:a="",hash:o=""}=typeof e=="string"?Da(e):e,i;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?i=g0(r.substring(1),"/"):i=g0(r,t)):i=t,{pathname:i,search:Ik(a),hash:Uk(o)}}function g0(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Pp(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function t1(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function sd(e){let t=t1(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function Al(e,t,r,a=!1){let o;typeof e=="string"?o=Da(e):(o={...e},rt(!o.pathname||!o.pathname.includes("?"),Pp("?","pathname","search",o)),rt(!o.pathname||!o.pathname.includes("#"),Pp("#","pathname","hash",o)),rt(!o.search||!o.search.includes("#"),Pp("#","search","hash",o)));let i=e===""||o.pathname==="",u=i?"/":o.pathname,f;if(u==null)f=r;else{let x=t.length-1;if(!a&&u.startsWith("..")){let v=u.split("/");for(;v[0]==="..";)v.shift(),x-=1;o.pathname=v.join("/")}f=x>=0?t[x]:"/"}let h=$k(o,f),p=u&&u!=="/"&&u.endsWith("/"),m=(i||u===".")&&r.endsWith("/");return!h.pathname.endsWith("/")&&(p||m)&&(h.pathname+="/"),h}var Lr=e=>e.join("/").replace(/\/\/+/g,"/"),Bk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ik=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Uk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Rl=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Uo(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Tl(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var n1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function r1(e,t){let r=e;if(typeof r!="string"||!e1.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,o=!1;if(n1)try{let i=new URL(window.location.href),u=r.startsWith("//")?new URL(i.protocol+r):new URL(r),f=Sr(u.pathname,t);u.origin===i.origin&&f!=null?r=f+u.search+u.hash:o=!0}catch{Gt(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:o,to:r}}var ls=Symbol("Uninstrumented");function Pk(e,t){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(i){let u=Object.keys(r);for(let f of u)i[f]&&r[f].push(i[f])}}));let a={};if(typeof t.lazy=="function"&&r.lazy.length>0){let o=Oo(r.lazy,t.lazy,()=>{});o&&(a.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(i=>{let u=o[i],f=r[`lazy.${i}`];if(typeof u=="function"&&f.length>0){let h=Oo(f,u,()=>{});h&&(a.lazy=Object.assign(a.lazy||{},{[i]:h}))}})}return["loader","action"].forEach(o=>{let i=t[o];if(typeof i=="function"&&r[o].length>0){let u=i[ls]??i,f=Oo(r[o],u,(...h)=>x0(h[0]));f&&(o==="loader"&&u.hydrate===!0&&(f.hydrate=!0),f[ls]=u,a[o]=f)}}),t.middleware&&t.middleware.length>0&&r.middleware.length>0&&(a.middleware=t.middleware.map(o=>{let i=o[ls]??o,u=Oo(r.middleware,i,(...f)=>x0(f[0]));return u?(u[ls]=i,u):o})),a}function Hk(e,t){let r={navigate:[],fetch:[]};if(t.forEach(a=>a({instrument(o){let i=Object.keys(o);for(let u of i)o[u]&&r[u].push(o[u])}})),r.navigate.length>0){let a=e.navigate[ls]??e.navigate,o=Oo(r.navigate,a,(...i)=>{let[u,f]=i;return{to:typeof u=="number"||typeof u=="string"?u:u?Jr(u):".",...y0(e,f??{})}});o&&(o[ls]=a,e.navigate=o)}if(r.fetch.length>0){let a=e.fetch[ls]??e.fetch,o=Oo(r.fetch,a,(...i)=>{let[u,,f,h]=i;return{href:f??".",fetcherKey:u,...y0(e,h??{})}});o&&(o[ls]=a,e.fetch=o)}return e}function Oo(e,t,r){return e.length===0?null:async(...a)=>{let o=await a1(e,r(...a),()=>t(...a),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function a1(e,t,r,a){let o=e[a],i;if(o){let u,f=async()=>(u?console.error("You cannot call instrumented handlers more than once"):u=a1(e,t,r,a-1),i=await u,rt(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await o(f,t)}catch(h){console.error("An instrumentation function threw an error:",h)}u||await f(),await u}else try{i={type:"success",value:await r()}}catch(u){i={type:"error",value:u}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function x0(e){let{request:t,context:r,params:a,unstable_pattern:o}=e;return{request:qk(t),params:{...a},unstable_pattern:o,context:Fk(r)}}function y0(e,t){return{currentUrl:Jr(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function qk(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function Fk(e){if(Vk(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Gk=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vk(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===Gk}var s1=["POST","PUT","PATCH","DELETE"],Yk=new Set(s1),Kk=["GET",...s1],Xk=new Set(Kk),o1=new Set([301,302,303,307,308]),Qk=new Set([307,308]),Hp={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zk={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ui={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Jk=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),i1="remix-router-transitions",l1=Symbol("ResetLoaderData");function Wk(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";rt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=e.hydrationRouteProperties||[],o=e.mapRouteProperties||Jk,i=o;if(e.unstable_instrumentations){let I=e.unstable_instrumentations;i=G=>({...o(G),...Pk(I.map(Z=>Z.route).filter(Boolean),G)})}let u={},f=ml(e.routes,i,void 0,u),h,p=e.basename||"/";p.startsWith("/")||(p=`/${p}`);let m=e.dataStrategy||aN,x={...e.future},v=null,_=new Set,w=null,S=null,k=null,N=e.hydrationData!=null,A=os(f,e.history.location,p),E=!1,D=null,L,z;if(A==null&&!e.patchRoutesOnNavigation){let I=_r(404,{pathname:e.history.location.pathname}),{matches:G,route:Z}=au(f);L=!0,z=!L,A=G,D={[Z.id]:I}}else if(A&&!e.hydrationData&&ur(A,f,e.history.location.pathname).active&&(A=null),A)if(A.some(I=>I.route.lazy))L=!1,z=!L;else if(!A.some(I=>dm(I.route)))L=!0,z=!L;else{let I=e.hydrationData?e.hydrationData.loaderData:null,G=e.hydrationData?e.hydrationData.errors:null,Z=A;if(G){let xe=A.findIndex(we=>G[we.route.id]!==void 0);Z=Z.slice(0,xe+1)}z=!1,L=Z.every(xe=>{let we=c1(xe.route,I,G);return z=z||we.renderFallback,!we.shouldLoad})}else{L=!1,z=!L,A=[];let I=ur(null,f,e.history.location.pathname);I.active&&I.matches&&(E=!0,A=I.matches)}let $,R={historyAction:e.history.action,location:e.history.location,matches:A,initialized:L,renderFallback:z,navigation:Hp,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||D,fetchers:new Map,blockers:new Map},B="POP",H=null,J=!1,oe,ce=!1,M=new Map,P=null,T=!1,F=!1,ee=new Set,ae=new Map,W=0,O=-1,V=new Map,re=new Set,se=new Map,ne=new Map,ge=new Set,Ne=new Map,Fe,qe=null;function be(){if(v=e.history.listen(({action:I,location:G,delta:Z})=>{if(Fe){Fe(),Fe=void 0;return}Gt(Ne.size===0||Z!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let xe=St({currentLocation:R.location,nextLocation:G,historyAction:I});if(xe&&Z!=null){let we=new Promise(Ae=>{Fe=Ae});e.history.go(Z*-1),Ue(xe,{state:"blocked",location:G,proceed(){Ue(xe,{state:"proceeding",proceed:void 0,reset:void 0,location:G}),we.then(()=>e.history.go(Z))},reset(){let Ae=new Map(R.blockers);Ae.set(xe,Ui),he({blockers:Ae})}}),H?.resolve(),H=null;return}return Xe(I,G)}),r){wN(t,M);let I=()=>SN(t,M);t.addEventListener("pagehide",I),P=()=>t.removeEventListener("pagehide",I)}return R.initialized||Xe("POP",R.location,{initialHydration:!0}),$}function fe(){v&&v(),P&&P(),_.clear(),oe&&oe.abort(),R.fetchers.forEach((I,G)=>gn(G)),R.blockers.forEach((I,G)=>me(G))}function _e(I){return _.add(I),()=>_.delete(I)}function he(I,G={}){I.matches&&(I.matches=I.matches.map(we=>{let Ae=u[we.route.id],je=we.route;return je.element!==Ae.element||je.errorElement!==Ae.errorElement||je.hydrateFallbackElement!==Ae.hydrateFallbackElement?{...we,route:Ae}:we})),R={...R,...I};let Z=[],xe=[];R.fetchers.forEach((we,Ae)=>{we.state==="idle"&&(ge.has(Ae)?Z.push(Ae):xe.push(Ae))}),ge.forEach(we=>{!R.fetchers.has(we)&&!ae.has(we)&&Z.push(we)}),[..._].forEach(we=>we(R,{deletedFetchers:Z,newErrors:I.errors??null,viewTransitionOpts:G.viewTransitionOpts,flushSync:G.flushSync===!0})),Z.forEach(we=>gn(we)),xe.forEach(we=>R.fetchers.delete(we))}function ve(I,G,{flushSync:Z}={}){let xe=R.actionData!=null&&R.navigation.formMethod!=null&&kn(R.navigation.formMethod)&&R.navigation.state==="loading"&&I.state?._isRedirect!==!0,we;G.actionData?Object.keys(G.actionData).length>0?we=G.actionData:we=null:xe?we=R.actionData:we=null;let Ae=G.loaderData?C0(R.loaderData,G.loaderData,G.matches||[],G.errors):R.loaderData,je=R.blockers;je.size>0&&(je=new Map(je),je.forEach((Pe,Be)=>je.set(Be,Ui)));let ke=T?!1:oa(I,G.matches||R.matches),Ce=J===!0||R.navigation.formMethod!=null&&kn(R.navigation.formMethod)&&I.state?._isRedirect!==!0;h&&(f=h,h=void 0),T||B==="POP"||(B==="PUSH"?e.history.push(I,I.state):B==="REPLACE"&&e.history.replace(I,I.state));let Ie;if(B==="POP"){let Pe=M.get(R.location.pathname);Pe&&Pe.has(I.pathname)?Ie={currentLocation:R.location,nextLocation:I}:M.has(I.pathname)&&(Ie={currentLocation:I,nextLocation:R.location})}else if(ce){let Pe=M.get(R.location.pathname);Pe?Pe.add(I.pathname):(Pe=new Set([I.pathname]),M.set(R.location.pathname,Pe)),Ie={currentLocation:R.location,nextLocation:I}}he({...G,actionData:we,loaderData:Ae,historyAction:B,location:I,initialized:!0,renderFallback:!1,navigation:Hp,revalidation:"idle",restoreScrollPosition:ke,preventScrollReset:Ce,blockers:je},{viewTransitionOpts:Ie,flushSync:Z===!0}),B="POP",J=!1,ce=!1,T=!1,F=!1,H?.resolve(),H=null,qe?.resolve(),qe=null}async function Ve(I,G){if(H?.resolve(),H=null,typeof I=="number"){H||(H=L0());let Ee=H.promise;return e.history.go(I),Ee}let Z=_h(R.location,R.matches,p,I,G?.fromRouteId,G?.relative),{path:xe,submission:we,error:Ae}=b0(!1,Z,G),je;G?.unstable_mask&&(je={pathname:"",search:"",hash:"",...typeof G.unstable_mask=="string"?Da(G.unstable_mask):{...R.location.unstable_mask,...G.unstable_mask}});let ke=R.location,Ce=hl(ke,xe,G&&G.state,void 0,je);Ce={...Ce,...e.history.encodeLocation(Ce)};let Ie=G&&G.replace!=null?G.replace:void 0,Pe="PUSH";Ie===!0?Pe="REPLACE":Ie===!1||we!=null&&kn(we.formMethod)&&we.formAction===R.location.pathname+R.location.search&&(Pe="REPLACE");let Be=G&&"preventScrollReset"in G?G.preventScrollReset===!0:void 0,dt=(G&&G.flushSync)===!0,ue=St({currentLocation:ke,nextLocation:Ce,historyAction:Pe});if(ue){Ue(ue,{state:"blocked",location:Ce,proceed(){Ue(ue,{state:"proceeding",proceed:void 0,reset:void 0,location:Ce}),Ve(I,G)},reset(){let Ee=new Map(R.blockers);Ee.set(ue,Ui),he({blockers:Ee})}});return}await Xe(Pe,Ce,{submission:we,pendingError:Ae,preventScrollReset:Be,replace:G&&G.replace,enableViewTransition:G&&G.viewTransition,flushSync:dt,callSiteDefaultShouldRevalidate:G&&G.unstable_defaultShouldRevalidate})}function De(){qe||(qe=L0()),We(),he({revalidation:"loading"});let I=qe.promise;return R.navigation.state==="submitting"?I:R.navigation.state==="idle"?(Xe(R.historyAction,R.location,{startUninterruptedRevalidation:!0}),I):(Xe(B||R.historyAction,R.navigation.location,{overrideNavigation:R.navigation,enableViewTransition:ce===!0}),I)}async function Xe(I,G,Z){oe&&oe.abort(),oe=null,B=I,T=(Z&&Z.startUninterruptedRevalidation)===!0,Oa(R.location,R.matches),J=(Z&&Z.preventScrollReset)===!0,ce=(Z&&Z.enableViewTransition)===!0;let xe=h||f,we=Z&&Z.overrideNavigation,Ae=Z?.initialHydration&&R.matches&&R.matches.length>0&&!E?R.matches:os(xe,G,p),je=(Z&&Z.flushSync)===!0;if(Ae&&R.initialized&&!F&&fN(R.location,G)&&!(Z&&Z.submission&&kn(Z.submission.formMethod))){ve(G,{matches:Ae},{flushSync:je});return}let ke=ur(Ae,xe,G.pathname);if(ke.active&&ke.matches&&(Ae=ke.matches),!Ae){let{error:Re,notFoundMatches:Ge,route:Oe}=nt(G.pathname);ve(G,{matches:Ge,loaderData:{},errors:{[Oe.id]:Re}},{flushSync:je});return}oe=new AbortController;let Ce=Lo(e.history,G,oe.signal,Z&&Z.submission),Ie=e.getContext?await e.getContext():new p0,Pe;if(Z&&Z.pendingError)Pe=[is(Ae).route.id,{type:"error",error:Z.pendingError}];else if(Z&&Z.submission&&kn(Z.submission.formMethod)){let Re=await It(Ce,G,Z.submission,Ae,Ie,ke.active,Z&&Z.initialHydration===!0,{replace:Z.replace,flushSync:je});if(Re.shortCircuited)return;if(Re.pendingActionResult){let[Ge,Oe]=Re.pendingActionResult;if(ar(Oe)&&Uo(Oe.error)&&Oe.error.status===404){oe=null,ve(G,{matches:Re.matches,loaderData:{},errors:{[Ge]:Oe.error}});return}}Ae=Re.matches||Ae,Pe=Re.pendingActionResult,we=qp(G,Z.submission),je=!1,ke.active=!1,Ce=Lo(e.history,Ce.url,Ce.signal)}let{shortCircuited:Be,matches:dt,loaderData:ue,errors:Ee}=await un(Ce,G,Ae,Ie,ke.active,we,Z&&Z.submission,Z&&Z.fetcherSubmission,Z&&Z.replace,Z&&Z.initialHydration===!0,je,Pe,Z&&Z.callSiteDefaultShouldRevalidate);Be||(oe=null,ve(G,{matches:dt||Ae,...A0(Pe),loaderData:ue,errors:Ee}))}async function It(I,G,Z,xe,we,Ae,je,ke={}){We();let Ce=vN(G,Z);if(he({navigation:Ce},{flushSync:ke.flushSync===!0}),Ae){let Be=await Tn(xe,G.pathname,I.signal);if(Be.type==="aborted")return{shortCircuited:!0};if(Be.type==="error"){if(Be.partialMatches.length===0){let{matches:ue,route:Ee}=au(f);return{matches:ue,pendingActionResult:[Ee.id,{type:"error",error:Be.error}]}}let dt=is(Be.partialMatches).route.id;return{matches:Be.partialMatches,pendingActionResult:[dt,{type:"error",error:Be.error}]}}else if(Be.matches)xe=Be.matches;else{let{notFoundMatches:dt,error:ue,route:Ee}=nt(G.pathname);return{matches:dt,pendingActionResult:[Ee.id,{type:"error",error:ue}]}}}let Ie,Pe=ku(xe,G);if(!Pe.route.action&&!Pe.route.lazy)Ie={type:"error",error:_r(405,{method:I.method,pathname:G.pathname,routeId:Pe.route.id})};else{let Be=Mo(i,u,I,xe,Pe,je?[]:a,we),dt=await Le(I,Be,we,null);if(Ie=dt[Pe.route.id],!Ie){for(let ue of xe)if(dt[ue.route.id]){Ie=dt[ue.route.id];break}}if(I.signal.aborted)return{shortCircuited:!0}}if(Ds(Ie)){let Be;return ke&&ke.replace!=null?Be=ke.replace:Be=k0(Ie.response.headers.get("Location"),new URL(I.url),p,e.history)===R.location.pathname+R.location.search,await An(I,Ie,!0,{submission:Z,replace:Be}),{shortCircuited:!0}}if(ar(Ie)){let Be=is(xe,Pe.route.id);return(ke&&ke.replace)!==!0&&(B="PUSH"),{matches:xe,pendingActionResult:[Be.route.id,Ie,Pe.route.id]}}return{matches:xe,pendingActionResult:[Pe.route.id,Ie]}}async function un(I,G,Z,xe,we,Ae,je,ke,Ce,Ie,Pe,Be,dt){let ue=Ae||qp(G,je),Ee=je||ke||T0(ue),Re=!T&&!Ie;if(we){if(Re){let Yt=Vt(Be);he({navigation:ue,...Yt!==void 0?{actionData:Yt}:{}},{flushSync:Pe})}let at=await Tn(Z,G.pathname,I.signal);if(at.type==="aborted")return{shortCircuited:!0};if(at.type==="error"){if(at.partialMatches.length===0){let{matches:wn,route:Jt}=au(f);return{matches:wn,loaderData:{},errors:{[Jt.id]:at.error}}}let Yt=is(at.partialMatches).route.id;return{matches:at.partialMatches,loaderData:{},errors:{[Yt]:at.error}}}else if(at.matches)Z=at.matches;else{let{error:Yt,notFoundMatches:wn,route:Jt}=nt(G.pathname);return{matches:wn,loaderData:{},errors:{[Jt.id]:Yt}}}}let Ge=h||f,{dsMatches:Oe,revalidatingFetchers:gt}=v0(I,xe,i,u,e.history,R,Z,Ee,G,Ie?[]:a,Ie===!0,F,ee,ge,se,re,Ge,p,e.patchRoutesOnNavigation!=null,Be,dt);if(O=++W,!e.dataStrategy&&!Oe.some(at=>at.shouldLoad)&&!Oe.some(at=>at.route.middleware&&at.route.middleware.length>0)&&gt.length===0){let at=Er();return ve(G,{matches:Z,loaderData:{},errors:Be&&ar(Be[1])?{[Be[0]]:Be[1].error}:null,...A0(Be),...at?{fetchers:new Map(R.fetchers)}:{}},{flushSync:Pe}),{shortCircuited:!0}}if(Re){let at={};if(!we){at.navigation=ue;let Yt=Vt(Be);Yt!==void 0&&(at.actionData=Yt)}gt.length>0&&(at.fetchers=Bn(gt)),he(at,{flushSync:Pe})}gt.forEach(at=>{Et(at.key),at.controller&&ae.set(at.key,at.controller)});let it=()=>gt.forEach(at=>Et(at.key));oe&&oe.signal.addEventListener("abort",it);let{loaderResults:an,fetcherResults:_n}=await Ze(Oe,gt,I,xe);if(I.signal.aborted)return{shortCircuited:!0};oe&&oe.signal.removeEventListener("abort",it),gt.forEach(at=>ae.delete(at.key));let dn=su(an);if(dn)return await An(I,dn.result,!0,{replace:Ce}),{shortCircuited:!0};if(dn=su(_n),dn)return re.add(dn.key),await An(I,dn.result,!0,{replace:Ce}),{shortCircuited:!0};let{loaderData:Br,errors:fs}=E0(R,Z,an,Be,gt,_n);Ie&&R.errors&&(fs={...R.errors,...fs});let Ir=Er(),ps=zr(O),Gs=Ir||ps||gt.length>0;return{matches:Z,loaderData:Br,errors:fs,...Gs?{fetchers:new Map(R.fetchers)}:{}}}function Vt(I){if(I&&!ar(I[1]))return{[I[0]]:I[1].data};if(R.actionData)return Object.keys(R.actionData).length===0?null:R.actionData}function Bn(I){return I.forEach(G=>{let Z=R.fetchers.get(G.key),xe=Pi(void 0,Z?Z.data:void 0);R.fetchers.set(G.key,xe)}),new Map(R.fetchers)}async function cr(I,G,Z,xe){Et(I);let we=(xe&&xe.flushSync)===!0,Ae=h||f,je=_h(R.location,R.matches,p,Z,G,xe?.relative),ke=os(Ae,je,p),Ce=ur(ke,Ae,je);if(Ce.active&&Ce.matches&&(ke=Ce.matches),!ke){ft(I,G,_r(404,{pathname:je}),{flushSync:we});return}let{path:Ie,submission:Pe,error:Be}=b0(!0,je,xe);if(Be){ft(I,G,Be,{flushSync:we});return}let dt=e.getContext?await e.getContext():new p0,ue=(xe&&xe.preventScrollReset)===!0;if(Pe&&kn(Pe.formMethod)){await Xn(I,G,Ie,ke,dt,Ce.active,we,ue,Pe,xe&&xe.unstable_defaultShouldRevalidate);return}se.set(I,{routeId:G,path:Ie}),await Ht(I,G,Ie,ke,dt,Ce.active,we,ue,Pe)}async function Xn(I,G,Z,xe,we,Ae,je,ke,Ce,Ie){We(),se.delete(I);let Pe=R.fetchers.get(I);Nt(I,_N(Ce,Pe),{flushSync:je});let Be=new AbortController,dt=Lo(e.history,Z,Be.signal,Ce);if(Ae){let Ot=await Tn(xe,new URL(dt.url).pathname,dt.signal,I);if(Ot.type==="aborted")return;if(Ot.type==="error"){ft(I,G,Ot.error,{flushSync:je});return}else if(Ot.matches)xe=Ot.matches;else{ft(I,G,_r(404,{pathname:Z}),{flushSync:je});return}}let ue=ku(xe,Z);if(!ue.route.action&&!ue.route.lazy){let Ot=_r(405,{method:Ce.formMethod,pathname:Z,routeId:G});ft(I,G,Ot,{flushSync:je});return}ae.set(I,Be);let Ee=W,Re=Mo(i,u,dt,xe,ue,a,we),Ge=await Le(dt,Re,we,I),Oe=Ge[ue.route.id];if(!Oe){for(let Ot of Re)if(Ge[Ot.route.id]){Oe=Ge[Ot.route.id];break}}if(dt.signal.aborted){ae.get(I)===Be&&ae.delete(I);return}if(ge.has(I)){if(Ds(Oe)||ar(Oe)){Nt(I,Ea(void 0));return}}else{if(Ds(Oe))if(ae.delete(I),O>Ee){Nt(I,Ea(void 0));return}else return re.add(I),Nt(I,Pi(Ce)),An(dt,Oe,!1,{fetcherSubmission:Ce,preventScrollReset:ke});if(ar(Oe)){ft(I,G,Oe.error);return}}let gt=R.navigation.location||R.location,it=Lo(e.history,gt,Be.signal),an=h||f,_n=R.navigation.state!=="idle"?os(an,R.navigation.location,p):R.matches;rt(_n,"Didn't find any matches after fetcher action");let dn=++W;V.set(I,dn);let Br=Pi(Ce,Oe.data);R.fetchers.set(I,Br);let{dsMatches:fs,revalidatingFetchers:Ir}=v0(it,we,i,u,e.history,R,_n,Ce,gt,a,!1,F,ee,ge,se,re,an,p,e.patchRoutesOnNavigation!=null,[ue.route.id,Oe],Ie);Ir.filter(Ot=>Ot.key!==I).forEach(Ot=>{let Vs=Ot.key,Ys=R.fetchers.get(Vs),Vl=Pi(void 0,Ys?Ys.data:void 0);R.fetchers.set(Vs,Vl),Et(Vs),Ot.controller&&ae.set(Vs,Ot.controller)}),he({fetchers:new Map(R.fetchers)});let ps=()=>Ir.forEach(Ot=>Et(Ot.key));Be.signal.addEventListener("abort",ps);let{loaderResults:Gs,fetcherResults:at}=await Ze(fs,Ir,it,we);if(Be.signal.aborted)return;if(Be.signal.removeEventListener("abort",ps),V.delete(I),ae.delete(I),Ir.forEach(Ot=>ae.delete(Ot.key)),R.fetchers.has(I)){let Ot=Ea(Oe.data);R.fetchers.set(I,Ot)}let Yt=su(Gs);if(Yt)return An(it,Yt.result,!1,{preventScrollReset:ke});if(Yt=su(at),Yt)return re.add(Yt.key),An(it,Yt.result,!1,{preventScrollReset:ke});let{loaderData:wn,errors:Jt}=E0(R,_n,Gs,void 0,Ir,at);zr(dn),R.navigation.state==="loading"&&dn>O?(rt(B,"Expected pending action"),oe&&oe.abort(),ve(R.navigation.location,{matches:_n,loaderData:wn,errors:Jt,fetchers:new Map(R.fetchers)})):(he({errors:Jt,loaderData:C0(R.loaderData,wn,_n,Jt),fetchers:new Map(R.fetchers)}),F=!1)}async function Ht(I,G,Z,xe,we,Ae,je,ke,Ce){let Ie=R.fetchers.get(I);Nt(I,Pi(Ce,Ie?Ie.data:void 0),{flushSync:je});let Pe=new AbortController,Be=Lo(e.history,Z,Pe.signal);if(Ae){let Oe=await Tn(xe,new URL(Be.url).pathname,Be.signal,I);if(Oe.type==="aborted")return;if(Oe.type==="error"){ft(I,G,Oe.error,{flushSync:je});return}else if(Oe.matches)xe=Oe.matches;else{ft(I,G,_r(404,{pathname:Z}),{flushSync:je});return}}let dt=ku(xe,Z);ae.set(I,Pe);let ue=W,Ee=Mo(i,u,Be,xe,dt,a,we),Ge=(await Le(Be,Ee,we,I))[dt.route.id];if(ae.get(I)===Pe&&ae.delete(I),!Be.signal.aborted){if(ge.has(I)){Nt(I,Ea(void 0));return}if(Ds(Ge))if(O>ue){Nt(I,Ea(void 0));return}else{re.add(I),await An(Be,Ge,!1,{preventScrollReset:ke});return}if(ar(Ge)){ft(I,G,Ge.error);return}Nt(I,Ea(Ge.data))}}async function An(I,G,Z,{submission:xe,fetcherSubmission:we,preventScrollReset:Ae,replace:je}={}){Z||(H?.resolve(),H=null),G.response.headers.has("X-Remix-Revalidate")&&(F=!0);let ke=G.response.headers.get("Location");rt(ke,"Expected a Location header on the redirect Response"),ke=k0(ke,new URL(I.url),p,e.history);let Ce=hl(R.location,ke,{_isRedirect:!0});if(r){let Ee=!1;if(G.response.headers.has("X-Remix-Reload-Document"))Ee=!0;else if(um(ke)){const Re=Z_(ke,!0);Ee=Re.origin!==t.location.origin||Sr(Re.pathname,p)==null}if(Ee){je?t.location.replace(ke):t.location.assign(ke);return}}oe=null;let Ie=je===!0||G.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Pe,formAction:Be,formEncType:dt}=R.navigation;!xe&&!we&&Pe&&Be&&dt&&(xe=T0(R.navigation));let ue=xe||we;if(Qk.has(G.response.status)&&ue&&kn(ue.formMethod))await Xe(Ie,Ce,{submission:{...ue,formAction:ke},preventScrollReset:Ae||J,enableViewTransition:Z?ce:void 0});else{let Ee=qp(Ce,xe);await Xe(Ie,Ce,{overrideNavigation:Ee,fetcherSubmission:we,preventScrollReset:Ae||J,enableViewTransition:Z?ce:void 0})}}async function Le(I,G,Z,xe){let we,Ae={};try{we=await oN(m,I,G,xe,Z,!1)}catch(je){return G.filter(ke=>ke.shouldLoad).forEach(ke=>{Ae[ke.route.id]={type:"error",error:je}}),Ae}if(I.signal.aborted)return Ae;if(!kn(I.method))for(let je of G){if(we[je.route.id]?.type==="error")break;!we.hasOwnProperty(je.route.id)&&!R.loaderData.hasOwnProperty(je.route.id)&&(!R.errors||!R.errors.hasOwnProperty(je.route.id))&&je.shouldCallHandler()&&(we[je.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${je.route.id}`)})}for(let[je,ke]of Object.entries(we))if(gN(ke)){let Ce=ke.result;Ae[je]={type:"redirect",response:uN(Ce,I,je,G,p)}}else Ae[je]=await cN(ke);return Ae}async function Ze(I,G,Z,xe){let we=Le(Z,I,xe,null),Ae=Promise.all(G.map(async Ce=>{if(Ce.matches&&Ce.match&&Ce.request&&Ce.controller){let Pe=(await Le(Ce.request,Ce.matches,xe,Ce.key))[Ce.match.route.id];return{[Ce.key]:Pe}}else return Promise.resolve({[Ce.key]:{type:"error",error:_r(404,{pathname:Ce.path})}})})),je=await we,ke=(await Ae).reduce((Ce,Ie)=>Object.assign(Ce,Ie),{});return{loaderResults:je,fetcherResults:ke}}function We(){F=!0,se.forEach((I,G)=>{ae.has(G)&&ee.add(G),Et(G)})}function Nt(I,G,Z={}){R.fetchers.set(I,G),he({fetchers:new Map(R.fetchers)},{flushSync:(Z&&Z.flushSync)===!0})}function ft(I,G,Z,xe={}){let we=is(R.matches,G);gn(I),he({errors:{[we.route.id]:Z},fetchers:new Map(R.fetchers)},{flushSync:(xe&&xe.flushSync)===!0})}function Rn(I){return ne.set(I,(ne.get(I)||0)+1),ge.has(I)&&ge.delete(I),R.fetchers.get(I)||Zk}function mn(I,G){Et(I,G?.reason),Nt(I,Ea(null))}function gn(I){let G=R.fetchers.get(I);ae.has(I)&&!(G&&G.state==="loading"&&V.has(I))&&Et(I),se.delete(I),V.delete(I),re.delete(I),ge.delete(I),ee.delete(I),R.fetchers.delete(I)}function Lt(I){let G=(ne.get(I)||0)-1;G<=0?(ne.delete(I),ge.add(I)):ne.set(I,G),he({fetchers:new Map(R.fetchers)})}function Et(I,G){let Z=ae.get(I);Z&&(Z.abort(G),ae.delete(I))}function Pt(I){for(let G of I){let Z=Rn(G),xe=Ea(Z.data);R.fetchers.set(G,xe)}}function Er(){let I=[],G=!1;for(let Z of re){let xe=R.fetchers.get(Z);rt(xe,`Expected fetcher: ${Z}`),xe.state==="loading"&&(re.delete(Z),I.push(Z),G=!0)}return Pt(I),G}function zr(I){let G=[];for(let[Z,xe]of V)if(xe<I){let we=R.fetchers.get(Z);rt(we,`Expected fetcher: ${Z}`),we.state==="loading"&&(Et(Z),V.delete(Z),G.push(Z))}return Pt(G),G.length>0}function sa(I,G){let Z=R.blockers.get(I)||Ui;return Ne.get(I)!==G&&Ne.set(I,G),Z}function me(I){R.blockers.delete(I),Ne.delete(I)}function Ue(I,G){let Z=R.blockers.get(I)||Ui;rt(Z.state==="unblocked"&&G.state==="blocked"||Z.state==="blocked"&&G.state==="blocked"||Z.state==="blocked"&&G.state==="proceeding"||Z.state==="blocked"&&G.state==="unblocked"||Z.state==="proceeding"&&G.state==="unblocked",`Invalid blocker state transition: ${Z.state} -> ${G.state}`);let xe=new Map(R.blockers);xe.set(I,G),he({blockers:xe})}function St({currentLocation:I,nextLocation:G,historyAction:Z}){if(Ne.size===0)return;Ne.size>1&&Gt(!1,"A router only supports one blocker at a time");let xe=Array.from(Ne.entries()),[we,Ae]=xe[xe.length-1],je=R.blockers.get(we);if(!(je&&je.state==="proceeding")&&Ae({currentLocation:I,nextLocation:G,historyAction:Z}))return we}function nt(I){let G=_r(404,{pathname:I}),Z=h||f,{matches:xe,route:we}=au(Z);return{notFoundMatches:xe,route:we,error:G}}function Ct(I,G,Z){if(w=I,k=G,S=Z||null,!N&&R.navigation===Hp){N=!0;let xe=oa(R.location,R.matches);xe!=null&&he({restoreScrollPosition:xe})}return()=>{w=null,k=null,S=null}}function Dt(I,G){return S&&S(I,G.map(xe=>Sk(xe,R.loaderData)))||I.key}function Oa(I,G){if(w&&k){let Z=Dt(I,G);w[Z]=k()}}function oa(I,G){if(w){let Z=Dt(I,G),xe=w[Z];if(typeof xe=="number")return xe}return null}function ur(I,G,Z){if(e.patchRoutesOnNavigation)if(I){if(Object.keys(I[0].params).length>0)return{active:!0,matches:rl(G,Z,p,!0)}}else return{active:!0,matches:rl(G,Z,p,!0)||[]};return{active:!1,matches:null}}async function Tn(I,G,Z,xe){if(!e.patchRoutesOnNavigation)return{type:"success",matches:I};let we=I;for(;;){let Ae=h==null,je=h||f,ke=u;try{await e.patchRoutesOnNavigation({signal:Z,path:G,matches:we,fetcherKey:xe,patch:(Pe,Be)=>{Z.aborted||_0(Pe,Be,je,ke,i,!1)}})}catch(Pe){return{type:"error",error:Pe,partialMatches:we}}finally{Ae&&!Z.aborted&&(f=[...f])}if(Z.aborted)return{type:"aborted"};let Ce=os(je,G,p),Ie=null;if(Ce){if(Object.keys(Ce[0].params).length===0)return{type:"success",matches:Ce};if(Ie=rl(je,G,p,!0),!(Ie&&we.length<Ie.length&&$r(we,Ie.slice(0,we.length))))return{type:"success",matches:Ce}}if(Ie||(Ie=rl(je,G,p,!0)),!Ie||$r(we,Ie))return{type:"success",matches:null};we=Ie}}function $r(I,G){return I.length===G.length&&I.every((Z,xe)=>Z.route.id===G[xe].route.id)}function ia(I){u={},h=ml(I,i,void 0,u)}function Ma(I,G,Z=!1){let xe=h==null;_0(I,G,h||f,u,i,Z),xe&&(f=[...f],he({}))}return $={get basename(){return p},get future(){return x},get state(){return R},get routes(){return f},get window(){return t},initialize:be,subscribe:_e,enableScrollRestoration:Ct,navigate:Ve,fetch:cr,revalidate:De,createHref:I=>e.history.createHref(I),encodeLocation:I=>e.history.encodeLocation(I),getFetcher:Rn,resetFetcher:mn,deleteFetcher:Lt,dispose:fe,getBlocker:sa,deleteBlocker:me,patchRoutes:Ma,_internalFetchControllers:ae,_internalSetRoutes:ia,_internalSetStateDoNotUseOrYouWillBreakYourApp(I){he(I)}},e.unstable_instrumentations&&($=Hk($,e.unstable_instrumentations.map(I=>I.router).filter(Boolean))),$}function eN(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function _h(e,t,r,a,o,i){let u,f;if(o){u=[];for(let p of t)if(u.push(p),p.route.id===o){f=p;break}}else u=t,f=t[t.length-1];let h=Al(a||".",sd(u),Sr(e.pathname,r)||e.pathname,i==="path");if(a==null&&(h.search=e.search,h.hash=e.hash),(a==null||a===""||a===".")&&f){let p=pm(h.search);if(f.route.index&&!p)h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&p){let m=new URLSearchParams(h.search),x=m.getAll("index");m.delete("index"),x.filter(_=>_).forEach(_=>m.append("index",_));let v=m.toString();h.search=v?`?${v}`:""}}return r!=="/"&&(h.pathname=zk({basename:r,pathname:h.pathname})),Jr(h)}function b0(e,t,r){if(!r||!eN(r))return{path:t};if(r.formMethod&&!bN(r.formMethod))return{path:t,error:_r(405,{method:r.formMethod})};let a=()=>({path:t,error:_r(400,{type:"invalid-body"})}),i=(r.formMethod||"get").toUpperCase(),u=m1(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!kn(i))return a();let x=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((v,[_,w])=>`${v}${_}=${w}
11
+ `,""):String(r.body);return{path:t,submission:{formMethod:i,formAction:u,formEncType:r.formEncType,formData:void 0,json:void 0,text:x}}}else if(r.formEncType==="application/json"){if(!kn(i))return a();try{let x=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:i,formAction:u,formEncType:r.formEncType,formData:void 0,json:x,text:void 0}}}catch{return a()}}}rt(typeof FormData=="function","FormData is not available in this environment");let f,h;if(r.formData)f=Sh(r.formData),h=r.formData;else if(r.body instanceof FormData)f=Sh(r.body),h=r.body;else if(r.body instanceof URLSearchParams)f=r.body,h=N0(f);else if(r.body==null)f=new URLSearchParams,h=new FormData;else try{f=new URLSearchParams(r.body),h=N0(f)}catch{return a()}let p={formMethod:i,formAction:u,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:h,json:void 0,text:void 0};if(kn(p.formMethod))return{path:t,submission:p};let m=Da(t);return e&&m.search&&pm(m.search)&&f.append("index",""),m.search=`?${f}`,{path:Jr(m),submission:p}}function v0(e,t,r,a,o,i,u,f,h,p,m,x,v,_,w,S,k,N,A,E,D){let L=E?ar(E[1])?E[1].error:E[1].data:void 0,z=o.createURL(i.location),$=o.createURL(h),R;if(m&&i.errors){let P=Object.keys(i.errors)[0];R=u.findIndex(T=>T.route.id===P)}else if(E&&ar(E[1])){let P=E[0];R=u.findIndex(T=>T.route.id===P)-1}let B=E?E[1].statusCode:void 0,H=B&&B>=400,J={currentUrl:z,currentParams:i.matches[0]?.params||{},nextUrl:$,nextParams:u[0].params,...f,actionResult:L,actionStatus:B},oe=Tl(u),ce=u.map((P,T)=>{let{route:F}=P,ee=null;if(R!=null&&T>R)ee=!1;else if(F.lazy)ee=!0;else if(!dm(F))ee=!1;else if(m){let{shouldLoad:V}=c1(F,i.loaderData,i.errors);ee=V}else tN(i.loaderData,i.matches[T],P)&&(ee=!0);if(ee!==null)return wh(r,a,e,oe,P,p,t,ee);let ae=!1;typeof D=="boolean"?ae=D:H?ae=!1:(x||z.pathname+z.search===$.pathname+$.search||z.search!==$.search||nN(i.matches[T],P))&&(ae=!0);let W={...J,defaultShouldRevalidate:ae},O=ul(P,W);return wh(r,a,e,oe,P,p,t,O,W,D)}),M=[];return w.forEach((P,T)=>{if(m||!u.some(se=>se.route.id===P.routeId)||_.has(T))return;let F=i.fetchers.get(T),ee=F&&F.state!=="idle"&&F.data===void 0,ae=os(k,P.path,N);if(!ae){if(A&&ee)return;M.push({key:T,routeId:P.routeId,path:P.path,matches:null,match:null,request:null,controller:null});return}if(S.has(T))return;let W=ku(ae,P.path),O=new AbortController,V=Lo(o,P.path,O.signal),re=null;if(v.has(T))v.delete(T),re=Mo(r,a,V,ae,W,p,t);else if(ee)x&&(re=Mo(r,a,V,ae,W,p,t));else{let se;typeof D=="boolean"?se=D:H?se=!1:se=x;let ne={...J,defaultShouldRevalidate:se};ul(W,ne)&&(re=Mo(r,a,V,ae,W,p,t,ne))}re&&M.push({key:T,routeId:P.routeId,path:P.path,matches:re,match:W,request:V,controller:O})}),{dsMatches:ce,revalidatingFetchers:M}}function dm(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function c1(e,t,r){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!dm(e))return{shouldLoad:!1,renderFallback:!1};let a=t!=null&&e.id in t,o=r!=null&&r[e.id]!==void 0;if(!a&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!a};let i=!a&&!o;return{shouldLoad:i,renderFallback:i}}function tN(e,t,r){let a=!t||r.route.id!==t.route.id,o=!e.hasOwnProperty(r.route.id);return a||o}function nN(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function ul(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function _0(e,t,r,a,o,i){let u;if(e){let p=a[e];rt(p,`No route found to patch children into: routeId = ${e}`),p.children||(p.children=[]),u=p.children}else u=r;let f=[],h=[];if(t.forEach(p=>{let m=u.find(x=>u1(p,x));m?h.push({existingRoute:m,newRoute:p}):f.push(p)}),f.length>0){let p=ml(f,o,[e||"_","patch",String(u?.length||"0")],a);u.push(...p)}if(i&&h.length>0)for(let p=0;p<h.length;p++){let{existingRoute:m,newRoute:x}=h[p],v=m,[_]=ml([x],o,[],{},!0);Object.assign(v,{element:_.element?_.element:v.element,errorElement:_.errorElement?_.errorElement:v.errorElement,hydrateFallbackElement:_.hydrateFallbackElement?_.hydrateFallbackElement:v.hydrateFallbackElement})}}function u1(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((r,a)=>t.children?.some(o=>u1(r,o)))??!1:!1}var w0=new WeakMap,d1=({key:e,route:t,manifest:r,mapRouteProperties:a})=>{let o=r[t.id];if(rt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let i=o.lazy[e];if(!i)return;let u=w0.get(o);u||(u={},w0.set(o,u));let f=u[e];if(f)return f;let h=(async()=>{let p=bk(e),x=o[e]!==void 0&&e!=="hasErrorBoundary";if(p)Gt(!p,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),u[e]=Promise.resolve();else if(x)Gt(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let v=await i();v!=null&&(Object.assign(o,{[e]:v}),Object.assign(o,a(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(v=>v===void 0)&&(o.lazy=void 0))})();return u[e]=h,h},S0=new WeakMap;function rN(e,t,r,a,o){let i=r[e.id];if(rt(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let m=S0.get(i);if(m)return{lazyRoutePromise:m,lazyHandlerPromise:m};let x=(async()=>{rt(typeof e.lazy=="function","No lazy route function found");let v=await e.lazy(),_={};for(let w in v){let S=v[w];if(S===void 0)continue;let k=_k(w),A=i[w]!==void 0&&w!=="hasErrorBoundary";k?Gt(!k,"Route property "+w+" is not a supported property to be returned from a lazy route function. This property will be ignored."):A?Gt(!A,`Route "${i.id}" has a static property "${w}" defined but its lazy function is also returning a value for this property. The lazy route property "${w}" will be ignored.`):_[w]=S}Object.assign(i,_),Object.assign(i,{...a(i),lazy:void 0})})();return S0.set(i,x),x.catch(()=>{}),{lazyRoutePromise:x,lazyHandlerPromise:x}}let u=Object.keys(e.lazy),f=[],h;for(let m of u){if(o&&o.includes(m))continue;let x=d1({key:m,route:e,manifest:r,mapRouteProperties:a});x&&(f.push(x),m===t&&(h=x))}let p=f.length>0?Promise.all(f).then(()=>{}):void 0;return p?.catch(()=>{}),h?.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:h}}async function j0(e){let t=e.matches.filter(o=>o.shouldLoad),r={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,i)=>{r[t[i].route.id]=o}),r}async function aN(e){return e.matches.some(t=>t.route.middleware)?f1(e,()=>j0(e)):j0(e)}function f1(e,t){return sN(e,t,a=>{if(yN(a))throw a;return a},hN,r);function r(a,o,i){if(i)return Promise.resolve(Object.assign(i.value,{[o]:{type:"error",result:a}}));{let{matches:u}=e,f=Math.min(Math.max(u.findIndex(p=>p.route.id===o),0),Math.max(u.findIndex(p=>p.shouldCallHandler()),0)),h=is(u,u[f].route.id).route.id;return Promise.resolve({[h]:{type:"error",result:a}})}}}async function sN(e,t,r,a,o){let{matches:i,request:u,params:f,context:h,unstable_pattern:p}=e,m=i.flatMap(v=>v.route.middleware?v.route.middleware.map(_=>[v.route.id,_]):[]);return await p1({request:u,params:f,context:h,unstable_pattern:p},m,t,r,a,o)}async function p1(e,t,r,a,o,i,u=0){let{request:f}=e;if(f.signal.aborted)throw f.signal.reason??new Error(`Request aborted: ${f.method} ${f.url}`);let h=t[u];if(!h)return await r();let[p,m]=h,x,v=async()=>{if(x)throw new Error("You may only call `next()` once per middleware");try{return x={value:await p1(e,t,r,a,o,i,u+1)},x.value}catch(_){return x={value:await i(_,p,x)},x.value}};try{let _=await m(e,v),w=_!=null?a(_):void 0;return o(w)?w:x?w??x.value:(x={value:await v()},x.value)}catch(_){return await i(_,p,x)}}function h1(e,t,r,a,o){let i=d1({key:"middleware",route:a.route,manifest:t,mapRouteProperties:e}),u=rN(a.route,kn(r.method)?"action":"loader",t,e,o);return{middleware:i,route:u.lazyRoutePromise,handler:u.lazyHandlerPromise}}function wh(e,t,r,a,o,i,u,f,h=null,p){let m=!1,x=h1(e,t,r,o,i);return{...o,_lazyPromises:x,shouldLoad:f,shouldRevalidateArgs:h,shouldCallHandler(v){return m=!0,h?typeof p=="boolean"?ul(o,{...h,defaultShouldRevalidate:p}):typeof v=="boolean"?ul(o,{...h,defaultShouldRevalidate:v}):ul(o,h):f},resolve(v){let{lazy:_,loader:w,middleware:S}=o.route,k=m||f||v&&!kn(r.method)&&(_||w),N=S&&S.length>0&&!w&&!_;return k&&(kn(r.method)||!N)?iN({request:r,unstable_pattern:a,match:o,lazyHandlerPromise:x?.handler,lazyRoutePromise:x?.route,handlerOverride:v,scopedContext:u}):Promise.resolve({type:"data",result:void 0})}}}function Mo(e,t,r,a,o,i,u,f=null){return a.map(h=>h.route.id!==o.route.id?{...h,shouldLoad:!1,shouldRevalidateArgs:f,shouldCallHandler:()=>!1,_lazyPromises:h1(e,t,r,h,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:wh(e,t,r,Tl(a),h,i,u,!0,f))}async function oN(e,t,r,a,o,i){r.some(p=>p._lazyPromises?.middleware)&&await Promise.all(r.map(p=>p._lazyPromises?.middleware));let u={request:t,unstable_pattern:Tl(r),params:r[0].params,context:o,matches:r},h=await e({...u,fetcherKey:a,runClientMiddleware:p=>{let m=u;return f1(m,()=>p({...m,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(p=>[p._lazyPromises?.handler,p._lazyPromises?.route]))}catch{}return h}async function iN({request:e,unstable_pattern:t,match:r,lazyHandlerPromise:a,lazyRoutePromise:o,handlerOverride:i,scopedContext:u}){let f,h,p=kn(e.method),m=p?"action":"loader",x=v=>{let _,w=new Promise((N,A)=>_=A);h=()=>_(),e.signal.addEventListener("abort",h);let S=N=>typeof v!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${r.route.id}]`)):v({request:e,unstable_pattern:t,params:r.params,context:u},...N!==void 0?[N]:[]),k=(async()=>{try{return{type:"data",result:await(i?i(A=>S(A)):S())}}catch(N){return{type:"error",result:N}}})();return Promise.race([k,w])};try{let v=p?r.route.action:r.route.loader;if(a||o)if(v){let _,[w]=await Promise.all([x(v).catch(S=>{_=S}),a,o]);if(_!==void 0)throw _;f=w}else{await a;let _=p?r.route.action:r.route.loader;if(_)[f]=await Promise.all([x(_),o]);else if(m==="action"){let w=new URL(e.url),S=w.pathname+w.search;throw _r(405,{method:e.method,pathname:S,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(v)f=await x(v);else{let _=new URL(e.url),w=_.pathname+_.search;throw _r(404,{pathname:w})}}catch(v){return{type:"error",result:v}}finally{h&&e.signal.removeEventListener("abort",h)}return f}async function lN(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function cN(e){let{result:t,type:r}=e;if(fm(t)){let a;try{a=await lN(t)}catch(o){return{type:"error",error:o}}return r==="error"?{type:"error",error:new Rl(t.status,t.statusText,a),statusCode:t.status,headers:t.headers}:{type:"data",data:a,statusCode:t.status,headers:t.headers}}return r==="error"?R0(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:pN(t),statusCode:Uo(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Uo(t)?t.status:void 0}:R0(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function uN(e,t,r,a,o){let i=e.headers.get("Location");if(rt(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!um(i)){let u=a.slice(0,a.findIndex(f=>f.route.id===r)+1);i=_h(new URL(t.url),u,o,i),e.headers.set("Location",i)}return e}function k0(e,t,r,a){let o=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(um(e)){let i=e,u=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(o.includes(u.protocol))throw new Error("Invalid redirect location");let f=Sr(u.pathname,r)!=null;if(u.origin===t.origin&&f)return u.pathname+u.search+u.hash}try{let i=a.createURL(e);if(o.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Lo(e,t,r,a){let o=e.createURL(m1(t)).toString(),i={signal:r};if(a&&kn(a.formMethod)){let{formMethod:u,formEncType:f}=a;i.method=u.toUpperCase(),f==="application/json"?(i.headers=new Headers({"Content-Type":f}),i.body=JSON.stringify(a.json)):f==="text/plain"?i.body=a.text:f==="application/x-www-form-urlencoded"&&a.formData?i.body=Sh(a.formData):i.body=a.formData}return new Request(o,i)}function Sh(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,typeof a=="string"?a:a.name);return t}function N0(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function dN(e,t,r,a=!1,o=!1){let i={},u=null,f,h=!1,p={},m=r&&ar(r[1])?r[1].error:void 0;return e.forEach(x=>{if(!(x.route.id in t))return;let v=x.route.id,_=t[v];if(rt(!Ds(_),"Cannot handle redirect results in processLoaderData"),ar(_)){let w=_.error;if(m!==void 0&&(w=m,m=void 0),u=u||{},o)u[v]=w;else{let S=is(e,v);u[S.route.id]==null&&(u[S.route.id]=w)}a||(i[v]=l1),h||(h=!0,f=Uo(_.error)?_.error.status:500),_.headers&&(p[v]=_.headers)}else i[v]=_.data,_.statusCode&&_.statusCode!==200&&!h&&(f=_.statusCode),_.headers&&(p[v]=_.headers)}),m!==void 0&&r&&(u={[r[0]]:m},r[2]&&(i[r[2]]=void 0)),{loaderData:i,errors:u,statusCode:f||200,loaderHeaders:p}}function E0(e,t,r,a,o,i){let{loaderData:u,errors:f}=dN(t,r,a);return o.filter(h=>!h.matches||h.matches.some(p=>p.shouldLoad)).forEach(h=>{let{key:p,match:m,controller:x}=h;if(x&&x.signal.aborted)return;let v=i[p];if(rt(v,"Did not find corresponding fetcher result"),ar(v)){let _=is(e.matches,m?.route.id);f&&f[_.route.id]||(f={...f,[_.route.id]:v.error}),e.fetchers.delete(p)}else if(Ds(v))rt(!1,"Unhandled fetcher revalidation redirect");else{let _=Ea(v.data);e.fetchers.set(p,_)}}),{loaderData:u,errors:f}}function C0(e,t,r,a){let o=Object.entries(t).filter(([,i])=>i!==l1).reduce((i,[u,f])=>(i[u]=f,i),{});for(let i of r){let u=i.route.id;if(!t.hasOwnProperty(u)&&e.hasOwnProperty(u)&&i.route.loader&&(o[u]=e[u]),a&&a.hasOwnProperty(u))break}return o}function A0(e){return e?ar(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function is(e,t){return(t?e.slice(0,e.findIndex(a=>a.route.id===t)+1):[...e]).reverse().find(a=>a.route.hasErrorBoundary===!0)||e[0]}function au(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function _r(e,{pathname:t,routeId:r,method:a,type:o,message:i}={}){let u="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(u="Bad Request",a&&t&&r?f=`You made a ${a} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:o==="invalid-body"&&(f="Unable to encode submission body")):e===403?(u="Forbidden",f=`Route "${r}" does not match URL "${t}"`):e===404?(u="Not Found",f=`No route matches URL "${t}"`):e===405&&(u="Method Not Allowed",a&&t&&r?f=`You made a ${a.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:a&&(f=`Invalid request method "${a.toUpperCase()}"`)),new Rl(e||500,u,new Error(f),!0)}function su(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[a,o]=t[r];if(Ds(o))return{key:a,result:o}}}function m1(e){let t=typeof e=="string"?Da(e):e;return Jr({...t,hash:""})}function fN(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function pN(e){return new Rl(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function hN(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,r])=>typeof t=="string"&&mN(r))}function mN(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function gN(e){return fm(e.result)&&o1.has(e.result.status)}function ar(e){return e.type==="error"}function Ds(e){return(e&&e.type)==="redirect"}function R0(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function fm(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function xN(e){return o1.has(e)}function yN(e){return fm(e)&&xN(e.status)&&e.headers.has("Location")}function bN(e){return Xk.has(e.toUpperCase())}function kn(e){return Yk.has(e.toUpperCase())}function pm(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function ku(e,t){let r=typeof t=="string"?Da(t).search:t.search;if(e[e.length-1].route.index&&pm(r||""))return e[e.length-1];let a=t1(e);return a[a.length-1]}function T0(e){let{formMethod:t,formAction:r,formEncType:a,text:o,formData:i,json:u}=e;if(!(!t||!r||!a)){if(o!=null)return{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:r,formEncType:a,formData:i,json:void 0,text:void 0};if(u!==void 0)return{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:u,text:void 0}}}function qp(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function vN(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Pi(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function _N(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Ea(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function wN(e,t){try{let r=e.sessionStorage.getItem(i1);if(r){let a=JSON.parse(r);for(let[o,i]of Object.entries(a||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function SN(e,t){if(t.size>0){let r={};for(let[a,o]of t)r[a]=[...o];try{e.sessionStorage.setItem(i1,JSON.stringify(r))}catch(a){Gt(!1,`Failed to save applied view transitions in sessionStorage (${a}).`)}}}function L0(){let e,t,r=new Promise((a,o)=>{e=async i=>{a(i);try{await r}catch{}},t=async i=>{o(i);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}var Hs=b.createContext(null);Hs.displayName="DataRouter";var Ll=b.createContext(null);Ll.displayName="DataRouterState";var g1=b.createContext(!1);function jN(){return b.useContext(g1)}var hm=b.createContext({isTransitioning:!1});hm.displayName="ViewTransition";var x1=b.createContext(new Map);x1.displayName="Fetchers";var kN=b.createContext(null);kN.displayName="Await";var ir=b.createContext(null);ir.displayName="Navigation";var od=b.createContext(null);od.displayName="Location";var kr=b.createContext({outlet:null,matches:[],isDataRoute:!1});kr.displayName="Route";var mm=b.createContext(null);mm.displayName="RouteError";var y1="REACT_ROUTER_ERROR",NN="REDIRECT",EN="ROUTE_ERROR_RESPONSE";function CN(e){if(e.startsWith(`${y1}:${NN}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function AN(e){if(e.startsWith(`${y1}:${EN}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Rl(t.status,t.statusText,t.data)}catch{}}function RN(e,{relative:t}={}){rt(Go(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=b.useContext(ir),{hash:o,pathname:i,search:u}=Dl(e,{relative:t}),f=i;return r!=="/"&&(f=i==="/"?r:Lr([r,i])),a.createHref({pathname:f,search:u,hash:o})}function Go(){return b.useContext(od)!=null}function Nr(){return rt(Go(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(od).location}var b1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function v1(e){b.useContext(ir).static||b.useLayoutEffect(e)}function Tt(){let{isDataRoute:e}=b.useContext(kr);return e?FN():TN()}function TN(){rt(Go(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Hs),{basename:t,navigator:r}=b.useContext(ir),{matches:a}=b.useContext(kr),{pathname:o}=Nr(),i=JSON.stringify(sd(a)),u=b.useRef(!1);return v1(()=>{u.current=!0}),b.useCallback((h,p={})=>{if(Gt(u.current,b1),!u.current)return;if(typeof h=="number"){r.go(h);return}let m=Al(h,JSON.parse(i),o,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Lr([t,m.pathname])),(p.replace?r.replace:r.push)(m,p.state,p)},[t,r,i,o,e])}var LN=b.createContext(null);function DN(e){let t=b.useContext(kr).outlet;return b.useMemo(()=>t&&b.createElement(LN.Provider,{value:e},t),[t,e])}function Vo(){let{matches:e}=b.useContext(kr),t=e[e.length-1];return t?t.params:{}}function Dl(e,{relative:t}={}){let{matches:r}=b.useContext(kr),{pathname:a}=Nr(),o=JSON.stringify(sd(r));return b.useMemo(()=>Al(e,JSON.parse(o),a,t==="path"),[e,o,a,t])}function ON(e,t,r){rt(Go(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(ir),{matches:o}=b.useContext(kr),i=o[o.length-1],u=i?i.params:{},f=i?i.pathname:"/",h=i?i.pathnameBase:"/",p=i&&i.route;{let k=p&&p.path||"";S1(f,!p||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
12
+
13
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let m=Nr(),x;x=m;let v=x.pathname||"/",_=v;if(h!=="/"){let k=h.replace(/^\//,"").split("/");_="/"+v.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=os(e,{pathname:_});return Gt(p||w!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Gt(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),IN(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},u,k.params),pathname:Lr([h,a.encodeLocation?a.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Lr([h,a.encodeLocation?a.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,r)}function MN(){let e=w1(),t=Uo(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:a},i={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:i},"ErrorBoundary")," or"," ",b.createElement("code",{style:i},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),r?b.createElement("pre",{style:o},r):null,u)}var zN=b.createElement(MN,null),_1=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=AN(e.digest);r&&(e=r)}let t=e!==void 0?b.createElement(kr.Provider,{value:this.props.routeContext},b.createElement(mm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement($N,{error:e},t):t}};_1.contextType=g1;var Fp=new WeakMap;function $N({children:e,error:t}){let{basename:r}=b.useContext(ir);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=CN(t.digest);if(a){let o=Fp.get(t);if(o)throw o;let i=r1(a.location,r);if(n1&&!Fp.get(t))if(i.isExternal||a.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:a.replace}));throw Fp.set(t,u),u}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function BN({routeContext:e,match:t,children:r}){let a=b.useContext(Hs);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(kr.Provider,{value:e},r)}function IN(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let o=e,i=a?.errors;if(i!=null){let m=o.findIndex(x=>x.route.id&&i?.[x.route.id]!==void 0);rt(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,m+1))}let u=!1,f=-1;if(r&&a){u=a.renderFallback;for(let m=0;m<o.length;m++){let x=o[m];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(f=m),x.route.id){let{loaderData:v,errors:_}=a,w=x.route.loader&&!v.hasOwnProperty(x.route.id)&&(!_||_[x.route.id]===void 0);if(x.route.lazy||w){r.isStatic&&(u=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let h=r?.onError,p=a&&h?(m,x)=>{h(m,{location:a.location,params:a.matches?.[0]?.params??{},unstable_pattern:Tl(a.matches),errorInfo:x})}:void 0;return o.reduceRight((m,x,v)=>{let _,w=!1,S=null,k=null;a&&(_=i&&x.route.id?i[x.route.id]:void 0,S=x.route.errorElement||zN,u&&(f<0&&v===0?(S1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):f===v&&(w=!0,k=x.route.hydrateFallbackElement||null)));let N=t.concat(o.slice(0,v+1)),A=()=>{let E;return _?E=S:w?E=k:x.route.Component?E=b.createElement(x.route.Component,null):x.route.element?E=x.route.element:E=m,b.createElement(BN,{match:x,routeContext:{outlet:m,matches:N,isDataRoute:a!=null},children:E})};return a&&(x.route.ErrorBoundary||x.route.errorElement||v===0)?b.createElement(_1,{location:a.location,revalidation:a.revalidation,component:S,error:_,children:A(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:p}):A()},null)}function gm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function UN(e){let t=b.useContext(Hs);return rt(t,gm(e)),t}function PN(e){let t=b.useContext(Ll);return rt(t,gm(e)),t}function HN(e){let t=b.useContext(kr);return rt(t,gm(e)),t}function xm(e){let t=HN(e),r=t.matches[t.matches.length-1];return rt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function qN(){return xm("useRouteId")}function w1(){let e=b.useContext(mm),t=PN("useRouteError"),r=xm("useRouteError");return e!==void 0?e:t.errors?.[r]}function FN(){let{router:e}=UN("useNavigate"),t=xm("useNavigate"),r=b.useRef(!1);return v1(()=>{r.current=!0}),b.useCallback(async(o,i={})=>{Gt(r.current,b1),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var D0={};function S1(e,t,r){!t&&!D0[e]&&(D0[e]=!0,Gt(!1,r))}var O0={};function M0(e,t){!e&&!O0[t]&&(O0[t]=!0,console.warn(t))}var GN="useOptimistic",z0=w2[GN],VN=()=>{};function YN(e){return z0?z0(e):[e,VN]}function KN(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Gt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:b.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Gt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Gt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:b.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var XN=["HydrateFallback","hydrateFallbackElement"],QN=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}};function ZN({router:e,flushSync:t,onError:r,unstable_useTransitions:a}){a=jN()||a;let[i,u]=b.useState(e.state),[f,h]=YN(i),[p,m]=b.useState(),[x,v]=b.useState({isTransitioning:!1}),[_,w]=b.useState(),[S,k]=b.useState(),[N,A]=b.useState(),E=b.useRef(new Map),D=b.useCallback((R,{deletedFetchers:B,newErrors:H,flushSync:J,viewTransitionOpts:oe})=>{H&&r&&Object.values(H).forEach(M=>r(M,{location:R.location,params:R.matches[0]?.params??{},unstable_pattern:Tl(R.matches)})),R.fetchers.forEach((M,P)=>{M.data!==void 0&&E.current.set(P,M.data)}),B.forEach(M=>E.current.delete(M)),M0(J===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let ce=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(M0(oe==null||ce,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!oe||!ce){t&&J?t(()=>u(R)):a===!1?u(R):b.startTransition(()=>{a===!0&&h(M=>$0(M,R)),u(R)});return}if(t&&J){t(()=>{S&&(_?.resolve(),S.skipTransition()),v({isTransitioning:!0,flushSync:!0,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})});let M=e.window.document.startViewTransition(()=>{t(()=>u(R))});M.finished.finally(()=>{t(()=>{w(void 0),k(void 0),m(void 0),v({isTransitioning:!1})})}),t(()=>k(M));return}S?(_?.resolve(),S.skipTransition(),A({state:R,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})):(m(R),v({isTransitioning:!0,flushSync:!1,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation}))},[e.window,t,S,_,a,h,r]);b.useLayoutEffect(()=>e.subscribe(D),[e,D]),b.useEffect(()=>{x.isTransitioning&&!x.flushSync&&w(new QN)},[x]),b.useEffect(()=>{if(_&&p&&e.window){let R=p,B=_.promise,H=e.window.document.startViewTransition(async()=>{a===!1?u(R):b.startTransition(()=>{a===!0&&h(J=>$0(J,R)),u(R)}),await B});H.finished.finally(()=>{w(void 0),k(void 0),m(void 0),v({isTransitioning:!1})}),k(H)}},[p,_,e.window,a,h]),b.useEffect(()=>{_&&p&&f.location.key===p.location.key&&_.resolve()},[_,S,f.location,p]),b.useEffect(()=>{!x.isTransitioning&&N&&(m(N.state),v({isTransitioning:!0,flushSync:!1,currentLocation:N.currentLocation,nextLocation:N.nextLocation}),A(void 0))},[x.isTransitioning,N]);let L=b.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:R=>e.navigate(R),push:(R,B,H)=>e.navigate(R,{state:B,preventScrollReset:H?.preventScrollReset}),replace:(R,B,H)=>e.navigate(R,{replace:!0,state:B,preventScrollReset:H?.preventScrollReset})}),[e]),z=e.basename||"/",$=b.useMemo(()=>({router:e,navigator:L,static:!1,basename:z,onError:r}),[e,L,z,r]);return b.createElement(b.Fragment,null,b.createElement(Hs.Provider,{value:$},b.createElement(Ll.Provider,{value:f},b.createElement(x1.Provider,{value:E.current},b.createElement(hm.Provider,{value:x},b.createElement(tE,{basename:z,location:f.location,navigationType:f.historyAction,navigator:L,unstable_useTransitions:a},b.createElement(JN,{routes:e.routes,future:e.future,state:f,isStatic:!1,onError:r})))))),null)}function $0(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var JN=b.memo(WN);function WN({routes:e,future:t,state:r,isStatic:a,onError:o}){return ON(e,void 0,{state:r,isStatic:a,onError:o})}function eE({to:e,replace:t,state:r,relative:a}){rt(Go(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=b.useContext(ir);Gt(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=b.useContext(kr),{pathname:u}=Nr(),f=Tt(),h=Al(e,sd(i),u,a==="path"),p=JSON.stringify(h);return b.useEffect(()=>{f(JSON.parse(p),{replace:t,state:r,relative:a})},[f,p,a,t,r]),null}function j1(e){return DN(e.context)}function tE({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:o,static:i=!1,unstable_useTransitions:u}){rt(!Go(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:f,navigator:o,static:i,unstable_useTransitions:u,future:{}}),[f,o,i,u]);typeof r=="string"&&(r=Da(r));let{pathname:p="/",search:m="",hash:x="",state:v=null,key:_="default",unstable_mask:w}=r,S=b.useMemo(()=>{let k=Sr(p,f);return k==null?null:{location:{pathname:k,search:m,hash:x,state:v,key:_,unstable_mask:w},navigationType:a}},[f,p,m,x,v,_,a,w]);return Gt(S!=null,`<Router basename="${f}"> is not able to match the URL "${p}${m}${x}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:b.createElement(ir.Provider,{value:h},b.createElement(od.Provider,{children:t,value:S}))}var Nu="get",Eu="application/x-www-form-urlencoded";function id(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function nE(e){return id(e)&&e.tagName.toLowerCase()==="button"}function rE(e){return id(e)&&e.tagName.toLowerCase()==="form"}function aE(e){return id(e)&&e.tagName.toLowerCase()==="input"}function sE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function oE(e,t){return e.button===0&&(!t||t==="_self")&&!sE(e)}function jh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(o=>[r,o]):[[r,a]])},[]))}function iE(e,t){let r=jh(e);return t&&t.forEach((a,o)=>{r.has(o)||t.getAll(o).forEach(i=>{r.append(o,i)})}),r}var ou=null;function lE(){if(ou===null)try{new FormData(document.createElement("form"),0),ou=!1}catch{ou=!0}return ou}var cE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Gp(e){return e!=null&&!cE.has(e)?(Gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Eu}"`),null):e}function uE(e,t){let r,a,o,i,u;if(rE(e)){let f=e.getAttribute("action");a=f?Sr(f,t):null,r=e.getAttribute("method")||Nu,o=Gp(e.getAttribute("enctype"))||Eu,i=new FormData(e)}else if(nE(e)||aE(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||f.getAttribute("action");if(a=h?Sr(h,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Nu,o=Gp(e.getAttribute("formenctype"))||Gp(f.getAttribute("enctype"))||Eu,i=new FormData(f,e),!lE()){let{name:p,type:m,value:x}=e;if(m==="image"){let v=p?`${p}.`:"";i.append(`${v}x`,"0"),i.append(`${v}y`,"0")}else p&&i.append(p,x)}}else{if(id(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Nu,a=null,o=Eu,u=e}return i&&o==="text/plain"&&(u=i,i=void 0),{action:a,method:r.toLowerCase(),encType:o,formData:i,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ym(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function dE(e,t,r,a){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${a}`:o.pathname=`${o.pathname}.${a}`:o.pathname==="/"?o.pathname=`_root.${a}`:t&&Sr(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${a}`,o}async function fE(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pE(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function hE(e,t,r){let a=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let u=await fE(i,r);return u.links?u.links():[]}return[]}));return yE(a.flat(1).filter(pE).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function B0(e,t,r,a,o,i){let u=(h,p)=>r[p]?h.route.id!==r[p].route.id:!0,f=(h,p)=>r[p].pathname!==h.pathname||r[p].route.path?.endsWith("*")&&r[p].params["*"]!==h.params["*"];return i==="assets"?t.filter((h,p)=>u(h,p)||f(h,p)):i==="data"?t.filter((h,p)=>{let m=a.routes[h.route.id];if(!m||!m.hasLoader)return!1;if(u(h,p)||f(h,p))return!0;if(h.route.shouldRevalidate){let x=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function mE(e,t,{includeHydrateFallback:r}={}){return gE(e.map(a=>{let o=t.routes[a.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function gE(e){return[...new Set(e)]}function xE(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function yE(e,t){let r=new Set;return new Set(t),e.reduce((a,o)=>{let i=JSON.stringify(xE(o));return r.has(i)||(r.add(i),a.push({key:i,link:o})),a},[])}function k1(){let e=b.useContext(Hs);return ym(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function bE(){let e=b.useContext(Ll);return ym(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bm=b.createContext(void 0);bm.displayName="FrameworkContext";function N1(){let e=b.useContext(bm);return ym(e,"You must render this element inside a <HydratedRouter> element"),e}function vE(e,t){let r=b.useContext(bm),[a,o]=b.useState(!1),[i,u]=b.useState(!1),{onFocus:f,onBlur:h,onMouseEnter:p,onMouseLeave:m,onTouchStart:x}=t,v=b.useRef(null);b.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let S=N=>{N.forEach(A=>{u(A.isIntersecting)})},k=new IntersectionObserver(S,{threshold:.5});return v.current&&k.observe(v.current),()=>{k.disconnect()}}},[e]),b.useEffect(()=>{if(a){let S=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(S)}}},[a]);let _=()=>{o(!0)},w=()=>{o(!1),u(!1)};return r?e!=="intent"?[i,v,{}]:[i,v,{onFocus:Hi(f,_),onBlur:Hi(h,w),onMouseEnter:Hi(p,_),onMouseLeave:Hi(m,w),onTouchStart:Hi(x,_)}]:[!1,v,{}]}function Hi(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function _E({page:e,...t}){let{router:r}=k1(),a=b.useMemo(()=>os(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?b.createElement(SE,{page:e,matches:a,...t}):null}function wE(e){let{manifest:t,routeModules:r}=N1(),[a,o]=b.useState([]);return b.useEffect(()=>{let i=!1;return hE(e,t,r).then(u=>{i||o(u)}),()=>{i=!0}},[e,t,r]),a}function SE({page:e,matches:t,...r}){let a=Nr(),{future:o,manifest:i,routeModules:u}=N1(),{basename:f}=k1(),{loaderData:h,matches:p}=bE(),m=b.useMemo(()=>B0(e,t,p,i,a,"data"),[e,t,p,i,a]),x=b.useMemo(()=>B0(e,t,p,i,a,"assets"),[e,t,p,i,a]),v=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let S=new Set,k=!1;if(t.forEach(A=>{let E=i.routes[A.route.id];!E||!E.hasLoader||(!m.some(D=>D.route.id===A.route.id)&&A.route.id in h&&u[A.route.id]?.shouldRevalidate||E.hasClientLoader?k=!0:S.add(A.route.id))}),S.size===0)return[];let N=dE(e,f,o.unstable_trailingSlashAwareDataRequests,"data");return k&&S.size>0&&N.searchParams.set("_routes",t.filter(A=>S.has(A.route.id)).map(A=>A.route.id).join(",")),[N.pathname+N.search]},[f,o.unstable_trailingSlashAwareDataRequests,h,a,i,m,t,e,u]),_=b.useMemo(()=>mE(x,i),[x,i]),w=wE(x);return b.createElement(b.Fragment,null,v.map(S=>b.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),_.map(S=>b.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),w.map(({key:S,link:k})=>b.createElement("link",{key:S,nonce:r.nonce,...k,crossOrigin:k.crossOrigin??r.crossOrigin})))}function jE(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var kE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{kE&&(window.__reactRouterVersion="7.13.1")}catch{}function NE(e,t){return Wk({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:mk({window:t?.window}),hydrationData:EE(),routes:e,mapRouteProperties:KN,hydrationRouteProperties:XN,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function EE(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:CE(e.errors)}),e}function CE(e){if(!e)return null;let t=Object.entries(e),r={};for(let[a,o]of t)if(o&&o.__type==="RouteErrorResponse")r[a]=new Rl(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let u=new i(o.message);u.stack="",r[a]=u}catch{}}if(r[a]==null){let i=new Error(o.message);i.stack="",r[a]=i}}else r[a]=o;return r}var E1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jr=b.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:o,reloadDocument:i,replace:u,unstable_mask:f,state:h,target:p,to:m,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:_,...w},S){let{basename:k,navigator:N,unstable_useTransitions:A}=b.useContext(ir),E=typeof m=="string"&&E1.test(m),D=r1(m,k);m=D.to;let L=RN(m,{relative:o}),z=Nr(),$=null;if(f){let P=Al(f,[],z.unstable_mask?z.unstable_mask.pathname:"/",!0);k!=="/"&&(P.pathname=P.pathname==="/"?k:Lr([k,P.pathname])),$=N.createHref(P)}let[R,B,H]=vE(a,w),J=TE(m,{replace:u,unstable_mask:f,state:h,target:p,preventScrollReset:x,relative:o,viewTransition:v,unstable_defaultShouldRevalidate:_,unstable_useTransitions:A});function oe(P){t&&t(P),P.defaultPrevented||J(P)}let ce=!(D.isExternal||i),M=b.createElement("a",{...w,...H,href:(ce?$:void 0)||D.absoluteURL||L,onClick:ce?oe:t,ref:jE(S,B),target:p,"data-discover":!E&&r==="render"?"true":void 0});return R&&!E?b.createElement(b.Fragment,null,M,b.createElement(_E,{page:L})):M});jr.displayName="Link";var Po=b.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:o=!1,style:i,to:u,viewTransition:f,children:h,...p},m){let x=Dl(u,{relative:p.relative}),v=Nr(),_=b.useContext(Ll),{navigator:w,basename:S}=b.useContext(ir),k=_!=null&&zE(x)&&f===!0,N=w.encodeLocation?w.encodeLocation(x).pathname:x.pathname,A=v.pathname,E=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(A=A.toLowerCase(),E=E?E.toLowerCase():null,N=N.toLowerCase()),E&&S&&(E=Sr(E,S)||E);const D=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let L=A===N||!o&&A.startsWith(N)&&A.charAt(D)==="/",z=E!=null&&(E===N||!o&&E.startsWith(N)&&E.charAt(N.length)==="/"),$={isActive:L,isPending:z,isTransitioning:k},R=L?t:void 0,B;typeof a=="function"?B=a($):B=[a,L?"active":null,z?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let H=typeof i=="function"?i($):i;return b.createElement(jr,{...p,"aria-current":R,className:B,ref:m,style:H,to:u,viewTransition:f},typeof h=="function"?h($):h)});Po.displayName="NavLink";var AE=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:o,state:i,method:u=Nu,action:f,onSubmit:h,relative:p,preventScrollReset:m,viewTransition:x,unstable_defaultShouldRevalidate:v,..._},w)=>{let{unstable_useTransitions:S}=b.useContext(ir),k=OE(),N=ME(f,{relative:p}),A=u.toLowerCase()==="get"?"get":"post",E=typeof f=="string"&&E1.test(f),D=L=>{if(h&&h(L),L.defaultPrevented)return;L.preventDefault();let z=L.nativeEvent.submitter,$=z?.getAttribute("formmethod")||u,R=()=>k(z||L.currentTarget,{fetcherKey:t,method:$,navigate:r,replace:o,state:i,relative:p,preventScrollReset:m,viewTransition:x,unstable_defaultShouldRevalidate:v});S&&r!==!1?b.startTransition(()=>R()):R()};return b.createElement("form",{ref:w,method:A,action:N,onSubmit:a?h:D,..._,"data-discover":!E&&e==="render"?"true":void 0})});AE.displayName="Form";function RE(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C1(e){let t=b.useContext(Hs);return rt(t,RE(e)),t}function TE(e,{target:t,replace:r,unstable_mask:a,state:o,preventScrollReset:i,relative:u,viewTransition:f,unstable_defaultShouldRevalidate:h,unstable_useTransitions:p}={}){let m=Tt(),x=Nr(),v=Dl(e,{relative:u});return b.useCallback(_=>{if(oE(_,t)){_.preventDefault();let w=r!==void 0?r:Jr(x)===Jr(v),S=()=>m(e,{replace:w,unstable_mask:a,state:o,preventScrollReset:i,relative:u,viewTransition:f,unstable_defaultShouldRevalidate:h});p?b.startTransition(()=>S()):S()}},[x,m,v,r,a,o,t,e,i,u,f,h,p])}function Ol(e){Gt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(jh(e)),r=b.useRef(!1),a=Nr(),o=b.useMemo(()=>iE(a.search,r.current?null:t.current),[a.search]),i=Tt(),u=b.useCallback((f,h)=>{const p=jh(typeof f=="function"?f(new URLSearchParams(o)):f);r.current=!0,i("?"+p,h)},[i,o]);return[o,u]}var LE=0,DE=()=>`__${String(++LE)}__`;function OE(){let{router:e}=C1("useSubmit"),{basename:t}=b.useContext(ir),r=qN(),a=e.fetch,o=e.navigate;return b.useCallback(async(i,u={})=>{let{action:f,method:h,encType:p,formData:m,body:x}=uE(i,t);if(u.navigate===!1){let v=u.fetcherKey||DE();await a(v,r,u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:x,formMethod:u.method||h,formEncType:u.encType||p,flushSync:u.flushSync})}else await o(u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:x,formMethod:u.method||h,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,o,t,r])}function ME(e,{relative:t}={}){let{basename:r}=b.useContext(ir),a=b.useContext(kr);rt(a,"useFormAction must be used inside a RouteContext");let[o]=a.matches.slice(-1),i={...Dl(e||".",{relative:t})},u=Nr();if(e==null){i.search=u.search;let f=new URLSearchParams(i.search),h=f.getAll("index");if(h.some(m=>m==="")){f.delete("index"),h.filter(x=>x).forEach(x=>f.append("index",x));let m=f.toString();i.search=m?`?${m}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:Lr([r,i.pathname])),Jr(i)}function zE(e,{relative:t}={}){let r=b.useContext(hm);rt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=C1("useViewTransitionState"),o=Dl(e,{relative:t});if(!r.isTransitioning)return!1;let i=Sr(r.currentLocation.pathname,a)||r.currentLocation.pathname,u=Sr(r.nextLocation.pathname,a)||r.nextLocation.pathname;return Bu(o.pathname,u)!=null||Bu(o.pathname,i)!=null}const $E="modulepreload",BE=function(e){return"/"+e},I0={},le=function(t,r,a){let o=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");o=h(r.map(p=>{if(p=BE(p),p in I0)return;I0[p]=!0;const m=p.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":$E,m||(v.as="script"),v.crossOrigin="",v.href=p,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((_,w)=>{v.addEventListener("load",_),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${p}`)))})}))}function i(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return o.then(u=>{for(const f of u||[])f.status==="rejected"&&i(f.reason);return t().catch(i)})};const A1=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();const IE=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const UE=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());const U0=e=>{const t=UE(e);return t.charAt(0).toUpperCase()+t.slice(1)};var PE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const HE=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const qE=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:o="",children:i,iconNode:u,...f},h)=>b.createElement("svg",{ref:h,...PE,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:A1("lucide",o),...!i&&!HE(f)&&{"aria-hidden":"true"},...f},[...u.map(([p,m])=>b.createElement(p,m)),...Array.isArray(i)?i:[i]]));const $e=(e,t)=>{const r=b.forwardRef(({className:a,...o},i)=>b.createElement(qE,{ref:i,iconNode:t,className:A1(`lucide-${IE(U0(e))}`,`lucide-${e}`,a),...o}));return r.displayName=U0(e),r};const FE=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],GE=$e("arrow-right-left",FE);const VE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],R1=$e("arrow-right",VE);const YE=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],P0=$e("arrow-up-right",YE);const KE=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],T1=$e("boxes",KE);const XE=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],QE=$e("brain",XE);const ZE=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],JE=$e("chart-column",ZE);const WE=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Wr=$e("check",WE);const eC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$t=$e("chevron-right",eC);const tC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],L1=$e("circle-alert",tC);const nC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],rC=$e("circle",nC);const aC=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],sC=$e("cloud",aC);const oC=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Iu=$e("copy",oC);const iC=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],vm=$e("corner-left-up",iC);const lC=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]],cC=$e("database-zap",lC);const uC=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],D1=$e("database",uC);const dC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],_m=$e("file-code",dC);const fC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],pC=$e("file-spreadsheet",fC);const hC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],On=$e("file-text",hC);const mC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],wm=$e("file",mC);const gC=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]],xC=$e("files",gC);const yC=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],Ml=$e("folder-git-2",yC);const bC=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],vC=$e("folder-input",bC);const _C=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],wC=$e("folder-open",_C);const SC=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],O1=$e("folder-plus",SC);const jC=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Gn=$e("folder",jC);const kC=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Uu=$e("git-branch",kC);const NC=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],EC=$e("git-commit-horizontal",NC);const CC=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],AC=$e("git-fork",CC);const RC=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],H0=$e("github",RC);const TC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],LC=$e("globe",TC);const DC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],OC=$e("grid-3x3",DC);const MC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],zC=$e("info",MC);const $C=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],BC=$e("key",$C);const IC=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],UC=$e("laptop",IC);const PC=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],HC=$e("layers",PC);const qC=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],FC=$e("link-2",qC);const GC=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],VC=$e("list-filter",GC);const YC=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Zt=$e("loader-circle",YC);const KC=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],XC=$e("log-out",KC);const QC=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ZC=$e("menu",QC);const JC=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],WC=$e("monitor",JC);const eA=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],tA=$e("moon",eA);const nA=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],rA=$e("network",nA);const aA=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Dr=$e("package",aA);const sA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],oA=$e("panel-left",sA);const iA=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],kh=$e("pencil",iA);const lA=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],cA=$e("phone",lA);const uA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sm=$e("plus",uA);const dA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],fA=$e("refresh-cw",dA);const pA=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],hA=$e("rotate-cw",pA);const mA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],gl=$e("search",mA);const gA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xA=$e("settings",gA);const yA=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],bA=$e("share-2",yA);const vA=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],_A=$e("sparkles",vA);const wA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],SA=$e("sun",wA);const jA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ld=$e("trash-2",jA);const kA=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],NA=$e("triangle-alert",kA);const EA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Nh=$e("upload",EA);const CA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],AA=$e("users",CA);const RA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Or=$e("x",RA);const TA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],LA=$e("zap",TA),q0=e=>Symbol.iterator in e,F0=e=>"entries"in e,G0=(e,t)=>{const r=e instanceof Map?e:new Map(e.entries()),a=t instanceof Map?t:new Map(t.entries());if(r.size!==a.size)return!1;for(const[o,i]of r)if(!a.has(o)||!Object.is(i,a.get(o)))return!1;return!0},DA=(e,t)=>{const r=e[Symbol.iterator](),a=t[Symbol.iterator]();let o=r.next(),i=a.next();for(;!o.done&&!i.done;){if(!Object.is(o.value,i.value))return!1;o=r.next(),i=a.next()}return!!o.done&&!!i.done};function OA(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:q0(e)&&q0(t)?F0(e)&&F0(t)?G0(e,t):DA(e,t):G0({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function ds(e){const t=Do.useRef(void 0);return r=>{const a=e(r);return OA(t.current,a)?t.current:t.current=a}}const V0=e=>{let t;const r=new Set,a=(p,m)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const v=t;t=m??(typeof x!="object"||x===null)?x:Object.assign({},t,x),r.forEach(_=>_(t,v))}},o=()=>t,f={setState:a,getState:o,getInitialState:()=>h,subscribe:p=>(r.add(p),()=>r.delete(p))},h=t=e(a,o,f);return f},MA=(e=>e?V0(e):V0),zA=e=>e;function $A(e,t=zA){const r=Do.useSyncExternalStore(e.subscribe,Do.useCallback(()=>t(e.getState()),[e,t]),Do.useCallback(()=>t(e.getInitialState()),[e,t]));return Do.useDebugValue(r),r}const Y0=e=>{const t=MA(e),r=a=>$A(t,a);return Object.assign(r,t),r},ea=(e=>e?Y0(e):Y0),qi="c4a_token";function K0(e){try{const t=e.split(".");if(t.length!==3)return null;const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),a=atob(r),o=Uint8Array.from(a,u=>u.charCodeAt(0));return JSON.parse(new TextDecoder().decode(o))}catch{return null}}function X0(e){const t=e.userId,r=e.name,a=e.email,o=e.avatar_url,i=e.workspaceId;if(!t||!a||!i)return null;const u={id:t,name:r??a,email:a,personal_workspace_id:i};return o&&(u.avatar_url=o),u}function Q0(e){const t=e.exp;return t?Date.now()>=t*1e3:!1}const Yn=ea(e=>({token:null,user:null,isAuthenticated:!1,init:()=>{const t=localStorage.getItem(qi);if(!t){e({token:null,user:null,isAuthenticated:!1});return}const r=K0(t);if(!r||Q0(r)){localStorage.removeItem(qi),e({token:null,user:null,isAuthenticated:!1});return}const a=X0(r);if(!a){localStorage.removeItem(qi),e({token:null,user:null,isAuthenticated:!1});return}e({token:t,user:a,isAuthenticated:!0})},login:t=>{const r=K0(t);if(!r||Q0(r))return;const a=X0(r);a&&(localStorage.setItem(qi,t),e({token:t,user:a,isAuthenticated:!0}))},logout:()=>{localStorage.removeItem(qi),e({token:null,user:null,isAuthenticated:!1})}})),xl=ea(e=>({activeWorkspaceId:null,init:()=>{const t=Yn.getState().user;t?.personal_workspace_id&&e({activeWorkspaceId:t.personal_workspace_id})},setActiveWorkspace:t=>{e({activeWorkspaceId:t})}}));Yn.subscribe((e,t)=>{e.user!==t.user&&(e.user?.personal_workspace_id?xl.getState().setActiveWorkspace(e.user.personal_workspace_id):xl.getState().setActiveWorkspace(null))});const M1="/api/v1";class hn extends Error{constructor(t,r,a){super(a),this.status=t,this.code=r,this.name="ApiError"}}async function Fi(e,t,r,a,o){let i=`${M1}${t}`;if(a){const x=new URLSearchParams(a).toString();x&&(i+=`?${x}`)}const u={"Content-Type":"application/json"},f=Yn.getState().token;f&&(u.Authorization=`Bearer ${f}`);const h=xl.getState().activeWorkspaceId;h&&(u["X-Workspace-Id"]=h);const p={method:e,headers:u};r!==void 0&&(p.body=JSON.stringify(r)),o?.signal&&(p.signal=o.signal);const m=await fetch(i,p);if(!m.ok){let x="UNKNOWN",v=m.statusText;try{const _=await m.json();_.code&&(x=_.code),_.message&&(v=_.message)}catch{}throw m.status===401&&Yn.getState().logout(),new hn(m.status,x,v)}return m.json()}const Vp=new Map;function BA(e,t){let r=`${M1}${e}`;if(t){const a=new URLSearchParams(t).toString();a&&(r+=`?${a}`)}return r}const ze={get(e,t,r){if(r?.skipDedup)return Fi("GET",e,void 0,t,r);const o=`${xl.getState().activeWorkspaceId??""}::${BA(e,t)}`,i=Vp.get(o);if(i)return i;const u=Fi("GET",e,void 0,t,r).finally(()=>{Vp.delete(o)});return Vp.set(o,u),u},post(e,t,r){return Fi("POST",e,t,void 0,r)},put(e,t){return Fi("PUT",e,t)},delete(e){return Fi("DELETE",e)}},IA=3e4,UA=1e3,PA=3e4;class HA{ws=null;url="";handlers=new Map;statusHandlers=new Set;heartbeatTimer=null;reconnectTimer=null;reconnectAttempt=0;intentionalClose=!1;disconnectTimer=null;_status="disconnected";get status(){return this._status}setStatus(t){this._status=t;for(const r of this.statusHandlers)r(t)}onStatusChange(t){return this.statusHandlers.add(t),()=>{this.statusHandlers.delete(t)}}connect(t){this.disconnectTimer&&(clearTimeout(this.disconnectTimer),this.disconnectTimer=null),!(this.url===t&&this.ws&&this.ws.readyState<=WebSocket.OPEN)&&(this.url=t,this.intentionalClose=!1,this.reconnectAttempt=0,this.open())}disconnect(){this.disconnectTimer||(this.disconnectTimer=setTimeout(()=>{this.disconnectTimer=null,this.intentionalClose=!0,this.clearTimers(),this.ws&&(this.ws.close(),this.ws=null),this.setStatus("disconnected")},50))}on(t,r){let a=this.handlers.get(t);return a||(a=new Set,this.handlers.set(t,a)),a.add(r),()=>{a.delete(r),a.size===0&&this.handlers.delete(t)}}send(t,r){if(this.ws?.readyState!==WebSocket.OPEN)return;const a={event:t,payload:r,timestamp:Date.now()};this.ws.send(JSON.stringify(a))}open(){this.setStatus("connecting");const t=new WebSocket(this.url);t.onopen=()=>{this.reconnectAttempt=0,this.setStatus("connected"),this.startHeartbeat()},t.onmessage=r=>{try{const a=JSON.parse(String(r.data));if(a.event==="pong")return;const o=this.handlers.get(a.event);if(o)for(const i of o)i(a.payload)}catch{}},t.onclose=()=>{this.stopHeartbeat(),this.intentionalClose||(this.setStatus("reconnecting"),this.scheduleReconnect())},t.onerror=()=>{},this.ws=t}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({event:"ping",payload:null,timestamp:Date.now()}))},IA)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(UA*2**this.reconnectAttempt,PA);this.reconnectAttempt++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},t)}clearTimers(){this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.disconnectTimer&&(clearTimeout(this.disconnectTimer),this.disconnectTimer=null)}}const En=new HA,Qt=ea((e,t)=>({libraries:[],loading:!1,error:null,fetchLibraries:async()=>{e({loading:!0,error:null});try{const r=await ze.get("/libraries");e({libraries:r,loading:!1})}catch(r){e({error:r instanceof Error?r.message:"Failed to load libraries",loading:!1})}},createLibrary:async r=>{const a=await ze.post("/libraries",r);return e(o=>({libraries:[...o.libraries,a]})),a},deleteLibrary:async r=>{await ze.delete(`/libraries/${r}`),e(a=>({libraries:a.libraries.filter(o=>o.id!==r)}))},updateLibraryName:async(r,a)=>{const o=await ze.put(`/libraries/${r}`,{name:a});e(i=>({libraries:i.libraries.map(u=>u.id===r?o:u)}))},_updateLibraryOnline:(r,a)=>{e(o=>({libraries:o.libraries.map(i=>i.id===r?{...i,is_online:a}:i)}))},_refreshLibrary:async r=>{try{const a=await ze.get(`/libraries/${r}`);e(o=>({libraries:o.libraries.map(i=>i.id===r?a:i)}))}catch{t().fetchLibraries()}}})),qs=e=>{const t=e.libraries.filter(a=>a.type==="cloud").sort((a,o)=>a.created_at.localeCompare(o.created_at)),r=e.libraries.filter(a=>a.type==="daemon").sort((a,o)=>a.name.localeCompare(o.name));return[...t,...r]},qA=e=>e.libraries.filter(t=>t.type==="daemon");En.on("ws:daemon:status",e=>{const t=e;t.lib_id&&Qt.getState()._updateLibraryOnline(t.lib_id,t.is_online),Qt.getState().fetchLibraries()});En.on("ws:daemon:connected",e=>{const t=e;t.lib_id&&Qt.getState()._updateLibraryOnline(t.lib_id,!0),Qt.getState().fetchLibraries()});En.on("ws:library:updated",e=>{const t=e;Qt.getState()._refreshLibrary(t.library_id)});function FA({name:e,avatarUrl:t,size:r=24}){const[a,o]=b.useState(!1),i=e.charAt(0).toUpperCase();return t&&!a?c.jsx("img",{src:t,alt:"",className:"rounded-full object-cover",style:{width:r,height:r},onError:()=>o(!0)}):c.jsx("span",{className:"inline-flex items-center justify-center rounded-full bg-c4a-accent font-mono font-bold text-white",style:{width:r,height:r,fontSize:r*.48},children:i})}function GA(){const{t:e}=ye(),t=Tt(),r=Yn(v=>v.user),a=Yn(v=>v.logout),[o,i]=b.useState(!1),u=b.useRef(null),f=Qt(ds(qA)),h=f.some(v=>v.is_online),p=b.useCallback(()=>{a(),i(!1),t("/login",{replace:!0})},[a,t]),m=()=>{u.current&&clearTimeout(u.current),i(!0)},x=()=>{u.current=setTimeout(()=>i(!1),150)};return r?c.jsxs("div",{className:"relative",onMouseEnter:m,onMouseLeave:x,children:[c.jsxs("button",{className:"relative flex cursor-pointer items-center gap-1",children:[c.jsx(FA,{name:r.name,avatarUrl:r.avatar_url,size:30}),c.jsx("span",{className:`absolute right-0 top-0 h-2 w-2 rounded-full ${h?"bg-c4a-success":"bg-c4a-text-muted"}`})]}),o&&c.jsxs("div",{className:"absolute right-0 top-full z-50 mt-2 min-w-[180px] rounded border border-c4a-border-default bg-c4a-bg-elevated shadow-c4a-md",children:[c.jsxs("div",{className:"px-4 py-3",children:[c.jsx("p",{className:"text-sm text-c4a-text-primary",children:r.name}),c.jsx("p",{className:"text-xs text-c4a-text-muted",children:r.email})]}),c.jsx("div",{className:"border-t border-c4a-border-subtle",children:f.length===0?c.jsxs("button",{onClick:()=>{i(!1),t("/studio/sources/add-client")},className:"flex w-full cursor-pointer items-center gap-2 px-4 py-2.5 text-left text-xs font-medium text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-c4a-text-muted"})}),e("user.menu.connect_source")]}):f.map(v=>c.jsxs("button",{onClick:()=>{i(!1),t(`/studio/sources/${v.id}`)},className:"flex w-full cursor-pointer items-center gap-2 px-4 py-2.5 text-left text-xs font-medium text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx("span",{className:"flex h-3 w-3 shrink-0 items-center justify-center",children:c.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${v.is_online?"bg-c4a-success":"bg-c4a-error"}`})}),v.name]},v.id))}),c.jsx("div",{className:"border-t border-c4a-border-subtle",children:c.jsxs("button",{onClick:p,className:"flex w-full cursor-pointer items-center gap-2 px-4 py-2.5 text-left text-xs font-medium text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(XC,{size:12,className:"shrink-0"}),e("user.menu.sign_out")]})})]})]}):null}function Eh({onLoginClick:e}){const{t}=ye();return Yn(a=>a.isAuthenticated)?c.jsx(GA,{}):c.jsx(jr,{to:"/login",onClick:e,className:"font-mono text-xs uppercase tracking-tight text-c4a-text-muted transition-colors duration-150 hover:text-c4a-text-primary",children:t("nav.login")})}const Z0=[{to:"/",labelKey:"nav.home"},{to:"/studio",labelKey:"nav.studio"},{to:"/docs",labelKey:"nav.docs"}];function VA(){const{t:e}=ye(),[t,r]=b.useState(!1);return c.jsxs("header",{className:"sticky top-0 z-40 border-b border-c4a-border-subtle bg-c4a-bg-base/95 backdrop-blur-sm",children:[c.jsxs("div",{className:"flex h-14 items-center justify-between px-4",children:[c.jsxs(jr,{to:"/",className:"flex items-center gap-2 text-c4a-text-primary",children:[c.jsx("span",{className:"font-mono text-lg font-bold text-c4a-accent",children:"C4A"}),c.jsx("span",{className:"hidden font-mono text-sm font-semibold uppercase tracking-tight md:inline",children:"Context4AI"})]}),c.jsxs("div",{className:"hidden items-center gap-6 md:flex",children:[c.jsx("nav",{className:"flex items-center gap-4",children:Z0.map(({to:a,labelKey:o})=>c.jsx(Po,{to:a,end:a==="/",className:({isActive:i})=>`font-mono text-xs uppercase tracking-tight transition-colors duration-150 ${i?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:e(o)},a))}),c.jsx(Eh,{})]}),c.jsx("button",{onClick:()=>r(!t),className:"text-c4a-text-secondary md:hidden",children:t?c.jsx(Or,{size:20}):c.jsx(ZC,{size:20})})]}),t&&c.jsxs("div",{className:"border-t border-c4a-border-subtle bg-c4a-bg-surface px-4 pb-4 pt-2 md:hidden",children:[c.jsx("nav",{className:"flex flex-col gap-2",children:Z0.map(({to:a,labelKey:o})=>c.jsx(Po,{to:a,end:a==="/",onClick:()=>r(!1),className:({isActive:i})=>`block py-2 font-mono text-xs uppercase tracking-tight transition-colors duration-150 ${i?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:e(o)},a))}),c.jsx("div",{className:"mt-2 border-t border-c4a-border-subtle pt-2",children:c.jsx(Eh,{onLoginClick:()=>r(!1)})})]})]})}function YA(e){return e==="system"&&typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e==="system"?"dark":e}function z1(e){if(typeof window>"u")return;const t=YA(e);document.documentElement.setAttribute("data-theme",t),localStorage.setItem("theme",e)}function KA(){try{return localStorage.getItem("theme")||"system"}catch{return"system"}}const jm=ea(e=>({theme:KA(),setTheme:t=>{z1(t),e({theme:t})}}));let J0=!1;function XA(){if(J0||typeof window>"u")return;J0=!0;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{const{theme:r}=jm.getState();r==="system"&&z1("system")};e.addEventListener("change",t)}XA();const QA=[{mode:"light",icon:SA,labelKey:"footer.theme.light"},{mode:"dark",icon:tA,labelKey:"footer.theme.dark"},{mode:"system",icon:WC,labelKey:"footer.theme.system"}];function $1(){const{t:e}=ye(),{theme:t,setTheme:r}=jm();return c.jsx("div",{className:"flex items-center gap-1",children:QA.map(({mode:a,icon:o,labelKey:i})=>c.jsx("button",{onClick:()=>r(a),title:e(i),className:`cursor-pointer rounded p-1.5 transition-colors duration-150 ${t===a?"bg-c4a-bg-active text-c4a-accent":"text-c4a-text-muted hover:text-c4a-text-secondary hover:bg-c4a-bg-hover"}`,children:c.jsx(o,{size:14})},a))})}function B1(){const{i18n:e}=ye(),t=()=>{const r=e.language==="en"?"zh":"en";e.changeLanguage(r)};return c.jsx("button",{onClick:t,className:"cursor-pointer rounded px-2 py-1 font-mono text-xs uppercase tracking-tight text-c4a-text-muted transition-colors duration-150 hover:text-c4a-text-secondary hover:bg-c4a-bg-hover",children:e.language==="en"?"CN":"EN"})}function I1({compact:e}){const{t}=ye(),r=new Date().getFullYear(),a=e?"footer.copyright_compact":"footer.copyright";return c.jsx("p",{className:"font-mono text-[11px] text-c4a-text-muted",children:t(a,{year:r})})}const ZA="_brandIcon_1c7st_1",JA="_iconPulse_1c7st_35",W0={brandIcon:ZA,iconPulse:JA};function WA({variant:e}){const{t}=ye(),r=e==="studio"?"bg-c4a-bg-surface":"bg-c4a-bg-base";return c.jsx("footer",{className:`border-t border-c4a-border-subtle ${r} px-4 py-4`,children:c.jsxs("div",{className:"flex items-end justify-between gap-4",children:[c.jsxs("div",{className:"hidden items-center gap-3 md:flex",children:[c.jsx("div",{className:W0.brandIcon,children:c.jsx("span",{className:W0.iconPulse,children:"C4A"})}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-primary",children:"Context4AI"}),c.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-c4a-text-muted",children:t("footer.tagline")})]})]}),c.jsxs("div",{className:"ml-auto flex flex-col items-end gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx($1,{}),c.jsx(B1,{})]}),c.jsx(I1,{})]})]})})}let eR=1;const Ch=ea(e=>({items:[],show:(t,r=6e3)=>{const a=eR++;e(o=>({items:[...o.items,{id:a,message:t,duration:r}]})),setTimeout(()=>{e(o=>({items:o.items.filter(i=>i.id!==a)}))},r)},dismiss:t=>{e(r=>({items:r.items.filter(a=>a.id!==t)}))}})),Qr=(e,t)=>Ch.getState().show(e,t);function U1(){const e=Ch(r=>r.items),t=Ch(r=>r.dismiss);return e.length===0?null:c.jsx("div",{className:"fixed top-4 left-1/2 z-50 flex -translate-x-1/2 flex-col items-center gap-2",children:e.map(r=>c.jsx("div",{role:"status",onClick:()=>t(r.id),className:"flex cursor-pointer items-center gap-2 rounded border border-c4a-accent/30 bg-c4a-bg-elevated px-5 py-3 font-mono text-xs uppercase tracking-tight text-c4a-accent shadow-c4a-lg transition-opacity",children:r.message},r.id))})}function tR(){return c.jsxs("div",{className:"flex min-h-screen flex-col",children:[c.jsx(VA,{}),c.jsx("main",{className:"mx-auto flex w-full max-w-[1200px] flex-1 flex-col px-4",children:c.jsx(j1,{})}),c.jsx(WA,{}),c.jsx(U1,{})]})}function nR({onToggleSidebar:e}){return c.jsx("header",{className:"sticky top-0 z-40 border-b border-c4a-border-subtle bg-c4a-bg-surface/95 backdrop-blur-sm",children:c.jsxs("div",{className:"relative flex h-14 items-center justify-between px-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[e&&c.jsx("button",{onClick:e,className:"text-c4a-text-secondary transition-colors duration-150 hover:text-c4a-text-primary md:hidden",children:c.jsx(oA,{size:20})}),c.jsxs(jr,{to:"/",className:"hidden items-center gap-2 text-c4a-text-primary md:flex",children:[c.jsx("span",{className:"font-mono text-lg font-bold text-c4a-accent",children:"C4A"}),c.jsx("span",{className:"font-mono text-sm font-semibold uppercase tracking-tight",children:"Context4AI"})]})]}),c.jsx(jr,{to:"/",className:"absolute left-1/2 flex -translate-x-1/2 items-center gap-2 text-c4a-text-primary md:hidden",children:c.jsx("span",{className:"font-mono text-lg font-bold text-c4a-accent",children:"C4A"})}),c.jsx(Eh,{})]})})}const rR=e=>`flex items-center gap-2 rounded px-3 py-2 font-mono text-xs uppercase tracking-tight transition-colors duration-150 ${e?"c4a-sidebar-active text-c4a-accent":"c4a-sidebar-item text-c4a-text-secondary hover:text-c4a-text-primary"}`,aR=[{to:"/studio/modeling",icon:T1,i18nKey:"studio.sidebar.modeling"},{to:"/studio/brain",icon:QE,i18nKey:"studio.sidebar.brain"},{to:"/studio/discovery",icon:gl,i18nKey:"studio.sidebar.discovery"},{to:"/studio/sharing",icon:bA,i18nKey:"studio.sidebar.sharing"},{to:"/studio/collaboration",icon:AA,i18nKey:"studio.sidebar.collaboration"}],sR=[{to:"/studio/settings/api-keys",i18nKey:"settings.tab.api_keys",icon:BC}],oR=["My Drive","个人云","我的云盘"];function iR({onNavigate:e}){const{t}=ye(),a=Nr().pathname.startsWith("/studio/settings"),[o,i]=b.useState(a);return b.useEffect(()=>{a&&i(!0)},[a]),c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>i(u=>!u),className:`flex w-full cursor-pointer items-center gap-2 rounded px-3 py-2 font-mono text-xs uppercase tracking-tight transition-colors duration-150 ${a?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:[c.jsx(xA,{size:14}),t("studio.sidebar.settings"),c.jsx($t,{size:12,className:`ml-auto shrink-0 transition-transform duration-200 ${o?"rotate-90":""}`})]}),o&&c.jsx("div",{className:"mt-0.5 flex flex-col gap-0.5",children:sR.map(({to:u,i18nKey:f,icon:h})=>c.jsxs(Po,{to:u,onClick:e,className:({isActive:p})=>`flex items-center gap-2 rounded py-1.5 pl-8 pr-3 font-mono text-xs tracking-tight transition-colors duration-150 ${p?"c4a-sidebar-active text-c4a-accent":"c4a-sidebar-item text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:[c.jsx(h,{size:13,className:"shrink-0 opacity-60"}),t(f)]},u))})]})}function ev({onNavigate:e}){const{t}=ye(),r=Nr(),a=Tt(),o=Qt(ds(qs)),i=r.pathname.startsWith("/studio/sources")||r.pathname.startsWith("/studio/source/"),[u,f]=b.useState(i);b.useEffect(()=>{i&&f(!0)},[i]);const h=p=>p.is_default&&oR.includes(p.name)?t("sources.library.default_cloud_name"):p.name;return c.jsxs("aside",{className:"flex h-full w-[220px] shrink-0 flex-col border-r border-c4a-border-subtle bg-c4a-bg-base p-4",children:[c.jsxs("nav",{className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"group/sources",children:[c.jsxs("button",{onClick:()=>f(p=>!p),className:`flex w-full cursor-pointer items-center gap-2 rounded px-3 py-2 font-mono text-xs uppercase tracking-tight transition-colors duration-150 ${i?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:[c.jsx(D1,{size:14}),t("studio.sidebar.sources"),c.jsx("span",{role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),a("/studio/sources/add-client"),e?.()},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),a("/studio/sources/add-client"),e?.())},className:"rounded p-0.5 text-c4a-text-muted opacity-0 transition-all hover:bg-c4a-bg-hover max-md:opacity-100 group-hover/sources:opacity-100 group-hover/sources:text-c4a-accent",title:t("sources.menu.add_client"),children:c.jsx(Sm,{size:12})}),c.jsx($t,{size:12,className:`ml-auto shrink-0 transition-transform duration-200 ${u?"rotate-90":""}`})]}),u&&c.jsx("div",{className:"mt-0.5 flex flex-col gap-0.5",children:o.map(p=>{const m=h(p);return c.jsxs(Po,{to:`/studio/sources/${p.id}`,onClick:e,className:({isActive:x})=>`flex items-center gap-2 rounded py-1.5 pl-8 pr-3 font-mono text-xs tracking-tight transition-colors duration-150 ${x?"c4a-sidebar-active text-c4a-accent":"c4a-sidebar-item text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:[p.type==="cloud"?c.jsx(sC,{size:13,className:"shrink-0 opacity-60"}):c.jsx(UC,{size:13,className:"shrink-0 opacity-60"}),c.jsx("span",{className:"truncate",children:m}),p.type==="daemon"&&(()=>{const x=p.config?.machine_id;return c.jsxs("span",{role:"button",tabIndex:0,onClick:v=>{v.preventDefault(),v.stopPropagation(),a("/studio/sources/add-client"),e?.()},onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),v.stopPropagation(),a("/studio/sources/add-client"),e?.())},className:"group/dot relative ml-auto shrink-0 cursor-pointer rounded-full p-1",children:[c.jsx("span",{className:`block h-[7px] w-[7px] rounded-full ${p.is_online?"bg-c4a-success":"bg-c4a-error"}`}),c.jsx("span",{className:"pointer-events-none absolute left-full top-1/2 z-50 ml-2 hidden -translate-y-1/2 whitespace-nowrap rounded border border-c4a-border-default bg-c4a-bg-elevated px-2.5 py-1.5 text-[11px] leading-relaxed text-c4a-text-secondary shadow-c4a-lg group-hover/dot:block",children:p.is_online?t("sources.menu.status_online",{machine:x??""}):t("sources.menu.status_offline",{machine:x??""})})]})})()]},p.id)})})]}),aR.map(({to:p,icon:m,i18nKey:x})=>c.jsxs(Po,{to:p,onClick:e,className:({isActive:v})=>rR(v),children:[c.jsx(m,{size:14}),t(x)]},p)),c.jsx(iR,{...e?{onNavigate:e}:{}})]}),c.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-3",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx($1,{}),c.jsx(B1,{})]}),c.jsx(I1,{compact:!0})]})]})}const yl=ea(e=>({status:"disconnected",onlineCount:0,connections:[],setStatus:t=>e({status:t}),fetchDaemonStatus:async()=>{try{const t=await ze.get("/daemons/status");e({onlineCount:t.online_count,connections:t.connections})}catch{}}})),lR=e=>e==="connecting"?"disconnected":e;En.onStatusChange(e=>{yl.getState().setStatus(lR(e))});En.on("ws:daemon:connected",e=>{const t=e;yl.setState(r=>{if(r.connections.some(u=>u.machine_id===t.machine_id))return r;const o={machine_id:t.machine_id};t.lib_id&&(o.lib_id=t.lib_id);const i=[...r.connections,o];return{connections:i,onlineCount:i.length}})});En.on("ws:daemon:status",e=>{const t=e;yl.setState(r=>{if(t.is_online){if(r.connections.some(f=>f.machine_id===t.machine_id))return r;const i={machine_id:t.machine_id};t.lib_id&&(i.lib_id=t.lib_id);const u=[...r.connections,i];return{connections:u,onlineCount:u.length}}const a=r.connections.filter(o=>o.machine_id!==t.machine_id);return{connections:a,onlineCount:a.length}})});function cR(){const e=Tt(),[t,r]=b.useState(!1),a=Yn(u=>u.isAuthenticated),[o,i]=b.useState(!1);return b.useEffect(()=>{const u=Yn.getState();u.isAuthenticated||u.init(),i(!0)},[]),b.useEffect(()=>{o&&!a&&e("/login",{replace:!0})},[o,a,e]),b.useEffect(()=>{!o||!a||(Qt.getState().fetchLibraries(),yl.getState().fetchDaemonStatus())},[o,a]),b.useEffect(()=>{if(!(!o||!a))return En.onStatusChange(u=>{u==="connected"&&(Qt.getState().fetchLibraries(),yl.getState().fetchDaemonStatus())})},[o,a]),!o||!a?null:c.jsxs("div",{className:"flex h-screen flex-col overflow-hidden",children:[c.jsx(nR,{onToggleSidebar:()=>r(!t)}),c.jsxs("div",{className:"flex min-h-0 flex-1",children:[c.jsx("div",{className:"hidden md:block",children:c.jsx(ev,{})}),t&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 top-14 z-30 bg-black/40 md:hidden",onClick:()=>r(!1)}),c.jsx("div",{className:"fixed bottom-0 left-0 top-14 z-30 md:hidden",children:c.jsx(ev,{onNavigate:()=>r(!1)})})]}),c.jsx("main",{className:"flex min-h-0 flex-1 flex-col overflow-x-hidden",children:c.jsx(j1,{})})]}),c.jsx(U1,{})]})}function uR(){const{t:e}=ye();return c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center py-20 text-center",children:[c.jsx("h1",{className:"font-mono text-4xl font-bold uppercase tracking-wide text-c4a-text-primary md:text-5xl",children:e("home.hero.title")}),c.jsx("p",{className:"mt-6 max-w-lg text-base text-c4a-text-secondary",children:e("home.hero.description")}),c.jsxs("div",{className:"mt-10 flex items-center gap-4",children:[c.jsxs(jr,{to:"/studio",className:"flex items-center gap-2 rounded bg-c4a-accent px-5 py-2.5 font-mono text-xs font-semibold uppercase tracking-tight text-white transition-colors duration-150 hover:bg-c4a-accent-hover",children:[e("home.hero.cta.studio"),c.jsx(R1,{size:14})]}),c.jsx("a",{href:"https://github.com/context4ai/c4a",target:"_blank",rel:"noopener noreferrer",className:"rounded border border-c4a-border-default px-5 py-2.5 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary transition-colors duration-150 hover:border-c4a-border-strong hover:text-c4a-text-primary",children:e("home.hero.cta.github")})]})]})}const dR=new Set(["github","google","feishu"]),fR=new Set(["oidc","oauth2"]);function pR(){const{t:e}=ye(),t=Tt(),r=Yn(D=>D.login),a=Yn(D=>D.isAuthenticated),[o,i]=b.useState([]),[u,f]=b.useState(!0),[h,p]=b.useState(null),[m,x]=b.useState(!1);b.useEffect(()=>{a&&t("/studio",{replace:!0})},[a,t]);const v=b.useCallback(async()=>{f(!0),p(null);try{const D=await ze.get("/auth/providers");i(D)}catch{p(e("login.error"))}finally{f(!1)}},[e]);b.useEffect(()=>{v()},[v]);const _=D=>{x(!0),window.location.href=`/api/v1/auth/${D}/login`},w=async()=>{x(!0);try{const D=await ze.post("/auth/test-account/login");r(D.token),t("/studio",{replace:!0})}catch{x(!1),p(e("login.error"))}},S=o.filter(D=>dR.has(D.type)),k=o.filter(D=>fR.has(D.type)),N=o.find(D=>D.type==="test_account"),A=S.length>0||k.length>0,E=(S.length>0?1:0)+(k.length>0?1:0)+(N?1:0)>1;return c.jsx("div",{className:"flex flex-1 items-center justify-center px-4 py-12",children:c.jsxs("div",{className:`relative w-full max-w-sm bg-c4a-bg-surface px-8 pt-8 pb-10 transition-all duration-300 border-t-2 border-x border-b ${m?"border-transparent":"border-c4a-border-subtle border-t-c4a-accent"}`,children:[m&&c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
14
+ .login-animated-border {
15
+ stroke-dasharray: 92 8;
16
+ animation:
17
+ border-accel 2s cubic-bezier(0.33, 0, 0.67, 0.33) forwards,
18
+ border-fast 0.75s linear 2s infinite,
19
+ border-grow 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
20
+ }
21
+ @keyframes border-accel {
22
+ 0% { stroke-dashoffset: 0; }
23
+ 100% { stroke-dashoffset: -200; }
24
+ }
25
+ @keyframes border-fast {
26
+ 0% { stroke-dashoffset: 0; }
27
+ 100% { stroke-dashoffset: -100; }
28
+ }
29
+ @keyframes border-grow {
30
+ 0% { stroke-dasharray: 25 75; }
31
+ 100% { stroke-dasharray: 92 8; }
32
+ }
33
+ `}),c.jsx("svg",{className:"pointer-events-none absolute -inset-x-[1px] -bottom-[1px] -top-[2px] h-[calc(100%+3px)] w-[calc(100%+2px)] overflow-visible",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("rect",{x:"1",y:"1",width:"calc(100% - 2px)",height:"calc(100% - 2px)",fill:"none",stroke:"var(--c4a-accent)",strokeWidth:"2",pathLength:"100",className:"login-animated-border"})})]}),u&&!m&&c.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:c.jsx(Zt,{size:24,className:"animate-spin text-c4a-text-muted"})}),!u&&!m&&h&&c.jsxs("div",{className:"flex min-h-[160px] flex-col items-center justify-center gap-4",children:[c.jsx("p",{className:"text-center font-mono text-xs text-c4a-text-muted",children:h}),c.jsx("button",{onClick:v,className:"border border-c4a-border-default bg-transparent px-4 py-2 font-mono text-xs uppercase tracking-tight text-c4a-text-secondary transition-colors hover:border-c4a-border-strong hover:text-c4a-text-primary",children:e("login.retry")})]}),!u&&!h&&c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsx("h2",{className:"text-center font-mono text-sm uppercase tracking-tight text-c4a-text-primary",children:e("login.title")}),c.jsxs("div",{className:"flex flex-col gap-2",children:[S.map(D=>c.jsx(tv,{provider:D,onClick:()=>_(D.id),label:e("login.provider_cta",{name:D.display_name}),disabled:m},D.id)),S.length>0&&k.length>0&&c.jsx(nv,{label:e("login.or")}),k.map(D=>c.jsx(tv,{provider:D,onClick:()=>_(D.id),label:e("login.provider_cta",{name:D.display_name}),disabled:m},D.id)),A&&N&&E&&c.jsx(nv,{label:e("login.or")}),N&&c.jsxs("button",{disabled:m,onClick:w,className:"c4a-flash-accent flex h-11 w-full cursor-pointer items-center justify-center gap-3 bg-c4a-accent font-mono text-xs font-bold uppercase tracking-widest text-white transition-all duration-300 disabled:cursor-not-allowed",children:[N.icon&&c.jsx("img",{src:N.icon,alt:"",className:"relative z-10 h-5 w-5 shrink-0 opacity-90"}),c.jsx("span",{className:`relative z-10 ${m?"opacity-50":""}`,children:e("login.provider_cta",{name:e("login.test_account")})})]})]})]})]})})}function tv({provider:e,onClick:t,label:r,disabled:a}){return c.jsxs("button",{onClick:t,disabled:a,className:"group c4a-flash-outline flex h-11 w-full cursor-pointer items-center justify-center gap-3 border border-c4a-border-default bg-transparent font-mono text-xs font-bold uppercase tracking-tight text-c4a-text-primary transition-opacity duration-150 ease-out disabled:cursor-not-allowed",children:[e.icon&&c.jsx("img",{src:e.icon,alt:"",className:"login-provider-btn-icon relative z-10 h-5 w-5 shrink-0 opacity-70 grayscale transition-all duration-[250ms] ease-out group-hover:opacity-100 group-hover:grayscale-0 group-disabled:opacity-100 group-disabled:grayscale-0"}),c.jsx("span",{className:`relative z-10 ${a?"opacity-50":""}`,children:r})]})}function nv({label:e}){return c.jsxs("div",{className:"flex items-center gap-3 py-1",children:[c.jsx("div",{className:"h-px flex-1 border-t border-dashed border-c4a-border-default"}),c.jsx("span",{className:"font-mono text-xs uppercase text-c4a-text-muted",children:e}),c.jsx("div",{className:"h-px flex-1 border-t border-dashed border-c4a-border-default"})]})}const hR="animate-pulse font-mono text-xs uppercase tracking-tight text-c4a-text-muted";function ta({labelKey:e="login.loading",className:t}){const{t:r}=ye();return c.jsx("span",{className:t??hR,children:r(e)})}function mR(){const e=Tt(),t=Yn(r=>r.login);return b.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("token");if(a){t(a);const o=Yn.getState().isAuthenticated;e(o?"/studio":"/login",{replace:!0})}else e("/login",{replace:!0})},[t,e]),c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ta,{labelKey:"login.authenticating",className:"animate-pulse font-mono text-sm uppercase tracking-tight text-c4a-text-muted"})})}function wt({icon:e,title:t,description:r,action:a,fullPage:o}){const i=c.jsxs("div",{className:o?"w-full max-w-[800px] text-center":"flex flex-col items-center text-center",children:[e&&c.jsx("div",{className:"mb-3 text-c4a-text-muted",children:e}),o?c.jsx("h3",{className:"font-mono text-lg font-bold uppercase text-c4a-text-primary",children:t}):c.jsx("p",{className:"font-mono text-sm text-c4a-text-secondary",children:t}),c.jsx("p",{className:`mt-2 ${o?"mt-3 text-sm text-c4a-text-secondary":"max-w-md text-xs text-c4a-text-muted"}`,children:r}),a&&c.jsx("div",{className:o?"mt-6 flex justify-center":"mt-4",children:a})]});return c.jsx("div",{className:`flex flex-1 items-center justify-center ${o?"p-8 pb-24":"p-8 pb-23"}`,children:i})}function na({title:e,version:t,description:r}){const{t:a}=ye();return c.jsx(wt,{fullPage:!0,title:e,description:r,action:t?c.jsx("span",{className:"inline-block rounded border border-c4a-border-default bg-c4a-bg-surface px-3 py-1 font-mono text-xs uppercase text-c4a-accent",children:a("placeholder.coming",{version:t})}):void 0})}function gR(){const{t:e}=ye();return c.jsx(na,{title:e("page.docs.title"),version:"0.4.13",description:e("page.docs.description")})}function xR(){const{t:e}=ye();return c.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center bg-c4a-bg-base p-8 text-center",children:[c.jsx("h1",{className:"font-mono text-6xl font-bold text-c4a-accent",children:e("notfound.title")}),c.jsx("p",{className:"mt-4 text-base text-c4a-text-secondary",children:e("notfound.description")}),c.jsx(jr,{to:"/",className:"mt-8 rounded border border-c4a-border-default px-5 py-2.5 font-mono text-xs uppercase tracking-tight text-c4a-text-secondary transition-colors duration-150 hover:border-c4a-border-strong hover:text-c4a-text-primary",children:e("notfound.back")})]})}function rv(){const{t:e}=ye(),t=w1();let r="500",a=e("error.description");return Uo(t)?(r=String(t.status),t.status===404?a=e("notfound.description"):t.statusText&&(a=t.statusText)):t instanceof Error&&(a=t.message),console.error(`[ErrorPage] ${r}:`,t),c.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center bg-c4a-bg-base p-8 text-center",children:[c.jsx("h1",{className:"font-mono text-6xl font-bold text-c4a-accent",children:r}),c.jsx("p",{className:"mt-4 max-w-md text-base text-c4a-text-secondary",children:a}),c.jsxs("div",{className:"mt-8 flex items-center gap-3",children:[c.jsxs("button",{onClick:()=>window.location.reload(),className:"flex items-center gap-2 rounded bg-c4a-accent px-5 py-2.5 font-mono text-xs uppercase tracking-tight text-white transition-colors duration-150 hover:bg-c4a-accent-hover",children:[c.jsx(hA,{size:14}),e("error.reload")]}),c.jsx(jr,{to:"/",className:"rounded border border-c4a-border-default px-5 py-2.5 font-mono text-xs uppercase tracking-tight text-c4a-text-secondary transition-colors duration-150 hover:border-c4a-border-strong hover:text-c4a-text-primary",children:e("notfound.back")})]})]})}function yR(){const{t:e}=ye();return c.jsx(na,{title:e("page.modeling.title"),version:"0.4.16",description:e("page.modeling.description")})}function bR(){const{t:e}=ye();return c.jsx(na,{title:e("page.brain.title"),version:"0.4.18",description:e("page.brain.description")})}function vR(){const{t:e}=ye();return c.jsx(na,{title:e("page.discovery.title"),version:"0.6.x",description:e("page.discovery.description")})}function _R(){const{t:e}=ye();return c.jsx(na,{title:e("page.sharing.title"),version:"0.4.39",description:e("page.sharing.description")})}function wR(){const{t:e}=ye();return c.jsx(na,{title:e("page.collaboration.title"),version:"0.5.x",description:e("page.collaboration.description")})}function lr({children:e,onClose:t,className:r="",overlayClass:a="bg-black/50",closeOnOverlay:o=!0,closeOnEsc:i=!0,disableClose:u=!1}){const f=b.useRef(null);b.useEffect(()=>{if(!i)return;const p=m=>{m.key==="Escape"&&!u&&t()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,i,u]);const h=b.useCallback(p=>{o&&!u&&f.current&&!f.current.contains(p.target)&&t()},[t,o,u]);return c.jsx("div",{className:`fixed inset-0 z-50 flex items-center justify-center ${a}`,onClick:h,children:c.jsx("div",{ref:f,className:r,children:e})})}function SR(){const{t:e}=ye(),[t,r]=b.useState([]),[a,o]=b.useState(!0),[i,u]=b.useState(!1),[f,h]=b.useState(null),p=[{label:e("page.settings.title")},{label:e("settings.tab.api_keys")}],m=b.useCallback(async()=>{o(!0);try{const _=await ze.get("/auth/api-keys");r(_)}catch{}finally{o(!1)}},[]);b.useEffect(()=>{m()},[m]);const x=_=>{u(!1),h(_),m()},v=async _=>{if(confirm(e("api_keys.delete.confirm")))try{await ze.delete(`/auth/api-keys/${_}`),m()}catch{}};return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-4 md:p-6",children:[c.jsx("nav",{className:"flex min-h-8 items-center gap-1 font-mono text-xs uppercase tracking-tight text-c4a-text-muted",children:p.map((_,w)=>{const S=w===p.length-1;return c.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[w>0&&c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:S?"text-c4a-text-primary":"",children:_.label})]},w)})}),a&&c.jsx("div",{className:"flex flex-1 items-center justify-center pb-24",children:c.jsx(ta,{})}),!a&&t.length===0&&c.jsx(wt,{fullPage:!0,title:e("api_keys.empty.title"),description:e("api_keys.empty.description"),action:c.jsx("button",{onClick:()=>u(!0),className:"cursor-pointer rounded bg-c4a-accent/75 px-4 py-2 font-mono text-xs uppercase text-white transition-colors hover:bg-c4a-accent",children:e("api_keys.create")})}),!a&&t.length>0&&c.jsxs("div",{className:"mt-4",children:[c.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[c.jsx("p",{className:"text-xs text-c4a-text-muted",children:e("api_keys.description")}),c.jsxs("button",{onClick:()=>u(!0),className:"flex shrink-0 cursor-pointer items-center gap-1.5 rounded border border-c4a-border-default bg-c4a-bg-surface px-2 py-1 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:[c.jsx(Sm,{size:14}),e("api_keys.create")]})]}),c.jsx("div",{className:"flex flex-col gap-3",children:t.map(_=>c.jsx(jR,{apiKey:_,onDelete:()=>v(_.id)},_.id))})]}),i&&c.jsx(kR,{onClose:()=>u(!1),onCreated:x}),f&&c.jsx(NR,{apiKey:f,onClose:()=>h(null)})]})}function jR({apiKey:e,onDelete:t}){const{t:r}=ye(),a=e.last_used_at?new Date(e.last_used_at).toLocaleDateString():r("api_keys.never_used"),o=new Date(e.created_at).toLocaleDateString();return c.jsx("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-mono text-sm text-c4a-text-primary",children:e.name}),c.jsxs("p",{className:"mt-1 text-xs text-c4a-text-muted",children:[c.jsxs("span",{className:"font-mono",children:[e.key_prefix,"****"]}),c.jsx("span",{className:"mx-2",children:"·"}),a]}),c.jsx("p",{className:"mt-0.5 text-xs text-c4a-text-muted",children:r("api_keys.created_at",{date:o})})]}),c.jsx("button",{onClick:t,className:"cursor-pointer p-1 text-c4a-text-muted transition-colors hover:text-c4a-error",title:"Delete",children:c.jsx(ld,{size:14})})]})})}function kR({onClose:e,onCreated:t}){const{t:r}=ye(),[a,o]=b.useState(""),[i,u]=b.useState("never"),[f,h]=b.useState(!1),p=b.useRef(null),[m,x]=b.useState(!1),v=[{value:"never",label:r("api_keys.expires.never")},{value:"30d",label:r("api_keys.expires.30d")},{value:"90d",label:r("api_keys.expires.90d")},{value:"1y",label:r("api_keys.expires.1y")}],_=v.find(S=>S.value===i);b.useEffect(()=>{if(!f)return;const S=k=>{p.current&&!p.current.contains(k.target)&&h(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[f]);const w=async()=>{if(a.trim()){x(!0);try{const S=ER(i),k=await ze.post("/auth/api-keys",{name:a.trim(),scope:["read"],expires_at:S});t(k)}catch{x(!1)}}};return c.jsxs(lr,{onClose:e,className:"w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-8 shadow-c4a-lg",children:[c.jsx("h2",{className:"mb-6 font-mono text-sm uppercase tracking-tight text-c4a-text-primary",children:r("api_keys.create")}),c.jsx("label",{className:"mb-1 block text-sm text-c4a-text-secondary",children:r("api_keys.form.name")}),c.jsx("input",{value:a,onChange:S=>o(S.target.value),placeholder:r("api_keys.form.name_placeholder"),className:"mb-4 w-full rounded border border-c4a-border-default bg-c4a-bg-base px-3 py-2 text-sm text-c4a-text-primary placeholder:text-c4a-text-muted focus:border-c4a-accent focus:outline-none"}),c.jsx("label",{className:"mb-1 block text-sm text-c4a-text-secondary",children:r("api_keys.form.expiry")}),c.jsxs("div",{ref:p,className:"relative mb-6",children:[c.jsxs("button",{type:"button",onClick:()=>h(S=>!S),className:"flex w-full cursor-pointer items-center justify-between rounded border border-c4a-border-default bg-c4a-bg-base px-3 py-2 text-sm text-c4a-text-primary transition-colors hover:border-c4a-border-strong",children:[c.jsx("span",{children:_?.label}),c.jsx($t,{size:14,className:`shrink-0 text-c4a-text-muted transition-transform duration-200 ${f?"rotate-90":""}`})]}),f&&c.jsx("div",{className:"absolute left-0 top-full z-20 mt-1 w-full rounded border border-c4a-border-default bg-c4a-bg-elevated py-1 shadow-c4a-lg",children:v.map(S=>c.jsxs("button",{type:"button",onClick:()=>{u(S.value),h(!1)},className:`flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors hover:bg-c4a-bg-hover ${S.value===i?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,children:[c.jsx(Wr,{size:12,className:`shrink-0 ${S.value===i?"opacity-100":"opacity-0"}`}),S.label]},S.value))})]}),c.jsxs("div",{className:"flex justify-end gap-3",children:[c.jsx("button",{onClick:e,disabled:m,className:"cursor-pointer rounded border border-c4a-border-default px-4 py-2 font-mono text-xs uppercase tracking-tight text-c4a-text-secondary transition-colors hover:border-c4a-border-strong hover:text-c4a-text-primary",children:r("common.cancel")}),c.jsx("button",{onClick:w,disabled:!a.trim()||m,className:"cursor-pointer rounded bg-c4a-accent/75 px-4 py-2 font-mono text-xs uppercase tracking-tight text-white transition-colors hover:bg-c4a-accent disabled:opacity-50",children:r("api_keys.create")})]})]})}function NR({apiKey:e,onClose:t}){const{t:r}=ye(),[a,o]=b.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e.key),o(!0),setTimeout(()=>o(!1),2e3)}catch{const u=document.querySelector("[data-api-key-value]");if(u){const f=document.createRange();f.selectNodeContents(u);const h=window.getSelection();h?.removeAllRanges(),h?.addRange(f)}}};return c.jsxs(lr,{onClose:t,className:"w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-8 shadow-c4a-lg",closeOnOverlay:!1,closeOnEsc:!1,children:[c.jsx("h2",{className:"mb-4 font-mono text-sm uppercase tracking-tight text-c4a-accent",children:r("api_keys.created")}),c.jsx("p",{className:"mb-4 text-sm text-c4a-text-secondary",children:r("api_keys.copy_warning")}),c.jsxs("div",{className:"mb-6 flex items-center gap-2 rounded border border-c4a-accent/30 bg-c4a-bg-base px-3 py-2",children:[c.jsx("code",{"data-api-key-value":!0,className:"flex-1 truncate font-mono text-xs text-c4a-text-primary",children:e.key}),c.jsx("button",{onClick:i,className:"cursor-pointer shrink-0 font-mono text-xs uppercase text-c4a-accent transition-colors hover:text-c4a-accent/80",children:r(a?"api_keys.copied":"api_keys.copy")})]}),c.jsx("div",{className:"flex justify-end",children:c.jsx("button",{onClick:t,className:"cursor-pointer rounded bg-c4a-accent/75 px-4 py-2 font-mono text-xs uppercase tracking-tight text-white transition-colors hover:bg-c4a-accent",children:r("api_keys.done")})})]})}function ER(e){if(e==="never")return null;const t=new Date;switch(e){case"30d":t.setDate(t.getDate()+30);break;case"90d":t.setDate(t.getDate()+90);break;case"1y":t.setFullYear(t.getFullYear()+1);break;default:return null}return t.toISOString()}function CR(){const{t:e}=ye();return c.jsx(na,{title:e("page.code_setup.title"),version:"0.4.13",description:e("page.code_setup.description")})}function AR(){const{t:e}=ye();return c.jsx(na,{title:e("page.code_compile.title"),version:"0.4.13",description:e("page.code_compile.description")})}function RR(){const{t:e}=ye();return c.jsx(na,{title:e("page.code_review.title"),version:"0.4.14",description:e("page.code_review.description")})}function TR(){const{t:e}=ye();return c.jsx(na,{title:e("page.code_result.title"),version:"0.4.14",description:e("page.code_result.description")})}const zo=new Map;let Ca=null;const Ah=()=>{if(Ca=null,zo.size===0)return;const e=[...zo.entries()];zo.clear();const t=kt.getState(),r=new Map(t.indexingTasks);let a=!1;for(const[o,i]of e){const u=r.get(o);u?.terminalState||(r.set(o,{...u,...i,pendingSkips:u?.pendingSkips,unchangedCount:u?.unchangedCount,modules:i.modules??u?.modules}),a=!0)}a&&kt.setState({indexingTasks:r})},LR=e=>{const t=zo.get(e.sourceId);t&&t.stage!==e.stage&&(Ca!==null&&(cancelAnimationFrame(Ca),Ca=null),Ah()),zo.set(e.sourceId,e),Ca===null&&(Ca=requestAnimationFrame(Ah))},zl=(e,t)=>{for(const r of e){if(r.path===t)return r;if(r.children){const a=zl(r.children,t);if(a)return a}}return null},DR=(e,t)=>t===""?e:zl(e,t)?.children??[],al=(e,t)=>{if(!t)return[];const r=t.split("/"),a=[];let o="";for(const i of r){o=o?`${o}/${i}`:i;const u=zl(e,o);u&&a.push(u)}return a},kt=ea((e,t)=>({rootSources:[],currentRoot:null,loading:!1,error:null,total:0,limit:100,offset:0,filter:"all",indexingTasks:new Map,fetchRootSources:async({library_id:r,limit:a,offset:o})=>{e({loading:!0,error:null});try{const i={library_id:r};a!==void 0&&(i.limit=String(a)),o!==void 0&&(i.offset=String(o));const u=await ze.get("/sources",i);e({rootSources:u.items,total:u.total,limit:u.limit,offset:u.offset,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Failed to load sources",loading:!1})}},fetchRootSource:async r=>{e({loading:!0,error:null,currentRoot:null});try{const a=await ze.get(`/sources/${r}`);return e({currentRoot:a,loading:!1}),a}catch(a){throw e({currentRoot:null,loading:!1,error:a instanceof Error?a.message:"Source not found"}),a}},createSource:async r=>await ze.post("/sources",r),addTreeNode:async(r,a)=>{const o=await ze.post(`/sources/${r}/tree`,a);return e(i=>({rootSources:i.rootSources.map(u=>u.id===r?o:u),currentRoot:i.currentRoot?.id===r?o:i.currentRoot})),o},updateSource:async(r,a)=>{const o=await ze.put(`/sources/${r}`,a);e(i=>({rootSources:i.rootSources.map(u=>u.id===r?o:u),currentRoot:i.currentRoot?.id===r?o:i.currentRoot}))},deleteSource:async r=>{await ze.delete(`/sources/${r}`),e(a=>({rootSources:a.rootSources.filter(o=>o.id!==r),currentRoot:a.currentRoot?.id===r?null:a.currentRoot}))},deleteTreeNode:async(r,a)=>{const o=await ze.delete(`/sources/${r}/tree?path=${encodeURIComponent(a)}`);return e(i=>({rootSources:i.rootSources.map(u=>u.id===r?o:u),currentRoot:i.currentRoot?.id===r?o:i.currentRoot})),o},uploadDoc:async r=>await ze.post("/sources/upload",r),triggerIndex:async(r,a)=>{const o=new Map(t().indexingTasks);o.set(r,{sourceId:r,stage:"pending",progress:0,modules:a?.map(u=>u.path)}),e({indexingTasks:o});const i={};a&&(i.modules=a);try{const u=await ze.post(`/sources/${r}/index`,i);if(u.status!=="started")t().clearIndexTask(r);else if(u.dirty_skipped&&u.dirty_skipped.length>0){const f=new Map(t().indexingTasks),h=f.get(r);h&&(f.set(r,{...h,unchangedCount:u.dirty_skipped.length}),e({indexingTasks:f}))}return u}catch(u){throw t().clearIndexTask(r),u}},updateIndexProgress:r=>{if(!t().indexingTasks.get(r.sourceId)?.terminalState){if(r.stage==="skipping"&&r.message){const o=new Map(t().indexingTasks),i=o.get(r.sourceId),u=typeof r.message=="string"?r.message:JSON.stringify(r.message),f=[...i?.pendingSkips??[],u];o.set(r.sourceId,{...i??r,pendingSkips:f}),e({indexingTasks:o});return}LR(r)}},markIndexTerminal:(r,a,o)=>{zo.has(r)&&Ca!==null&&(cancelAnimationFrame(Ca),Ca=null,Ah());const i=new Map(t().indexingTasks),u=i.get(r);u&&i.set(r,{...u,terminalState:a,errorMessage:o}),e({indexingTasks:i})},clearIndexTask:r=>{const a=new Map(t().indexingTasks);a.delete(r),e({indexingTasks:a})},deleteIndex:async(r,a)=>{const o=a?`?modules=${a.map(u=>encodeURIComponent(u.path)).join(",")}`:"";return{deleted:(await ze.delete(`/sources/${r}/index${o}`)).deleted}},setFilter:r=>e({filter:r}),clearSources:()=>e({rootSources:[],currentRoot:null,total:0,offset:0})})),Rh="__c4a_indexWsSubs",Th=globalThis;if(Th[Rh])for(const e of Th[Rh])e();const $l=[];Th[Rh]=$l;$l.push(En.on("index/progress",e=>{const t=e;kt.getState().updateIndexProgress({sourceId:t.source_id,stage:t.stage,progress:t.progress,moduleName:t.module_name,currentFile:t.current_file,totalFiles:t.total_files,processedFiles:t.processed_files,message:t.message,modules:t.modules})}));$l.push(En.on("index/done",e=>{const t=e;kt.getState().markIndexTerminal(t.source_id,"done")}));$l.push(En.on("index/error",e=>{const t=e;if(kt.getState().markIndexTerminal(t.source_id,"error",t.error),t.errorCode){const a={DOC_INDEX_LLM_UNAVAILABLE:"index.doc.error.llm_unavailable",DOC_INDEX_EMBEDDING_UNAVAILABLE:"index.doc.error.embedding_unavailable",DOC_INDEX_CONTENT_MISSING:"index.doc.error.content_missing",DOC_INDEX_PARSE_FAILED:"index.doc.error.parse_failed",DOC_INDEX_LLM_EXHAUSTED:"index.doc.error.llm_exhausted"}[t.errorCode];a?Qr(Cn.t(a,{message:t.error??""}),5e3):t.error&&Qr(t.error,5e3)}else t.error&&Qr(t.error,5e3)}));$l.push(En.on("index/timeout",e=>{const t=e;kt.getState().markIndexTerminal(t.source_id,"timeout")}));function Ta({segments:e}){const{t}=ye(),r=b.useRef(null),a=b.useRef(null),[o,i]=b.useState(0),u=[{label:t("sources.breadcrumb.sources")},...e],f=Math.max(0,u.length-3);b.useEffect(()=>{const p=r.current,m=a.current;if(!p||!m)return;const x=()=>{const _=p.clientWidth,w=Array.from(m.children);if(w.length===0)return;const S=w.map($=>$.offsetWidth),k=4;if(S.reduce(($,R)=>$+R,0)+k*(S.length-1)<=_){i(0);return}const A=20,E=(S[0]??0)+(S[1]??0)+k,D=S[S.length-1]??0,L=E+k+A+k+D;let z=f;for(let $=1;$<=f;$++){let R=0;for(let B=2+$;B<S.length-1;B++)R+=S[B]+k;if(L+R<=_){z=$;break}}i(z)};x();const v=new ResizeObserver(x);return v.observe(p),()=>v.disconnect()},[f,e,t]);const h=(()=>{if(o===0||u.length<=3)return u;const p=u.slice(0,2),m=u[u.length-1],x=u.slice(2+o,u.length-1);return[...p,{label:"…"},...x,m]})();return c.jsxs("div",{ref:r,className:"relative min-w-0 overflow-hidden",children:[c.jsx("nav",{className:"flex min-h-8 items-center gap-1 font-mono text-xs tracking-tight text-c4a-text-muted",children:h.map((p,m)=>{const x=m===h.length-1;return c.jsxs("span",{className:`flex shrink-0 items-center gap-1 ${m===0?"uppercase":""}`,children:[m>0&&c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"}),p.to&&!x?c.jsx(jr,{to:p.to,className:"cursor-pointer whitespace-nowrap transition-colors hover:text-c4a-text-primary",children:p.label}):c.jsx("span",{className:`whitespace-nowrap ${x?"text-c4a-text-primary":""}`,children:p.label})]},m)})}),c.jsx("div",{ref:a,"aria-hidden":!0,className:"pointer-events-none invisible absolute left-0 top-0 flex h-0 items-center gap-1 overflow-visible whitespace-nowrap font-mono text-xs tracking-tight",children:u.map((p,m)=>c.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[m>0&&c.jsx($t,{size:12}),c.jsx("span",{className:"whitespace-nowrap",children:p.label})]},m))})]})}const OR=["all","indexed","not_indexed"];function MR({value:e,onChange:t}){const{t:r}=ye(),[a,o]=b.useState(!1),i=b.useRef(null),u=b.useRef(null),f={all:r("sources.filter.all"),indexed:r("sources.filter.indexed"),not_indexed:r("sources.filter.not_indexed")},h=b.useCallback(x=>{i.current&&!i.current.contains(x.target)&&o(!1)},[]);b.useEffect(()=>{if(a)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a,h]);const p=b.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),o(!0)},[]),m=b.useCallback(()=>{u.current=setTimeout(()=>o(!1),150)},[]);return c.jsxs("div",{ref:i,className:"relative",onMouseEnter:p,onMouseLeave:m,children:[c.jsxs("button",{className:"flex items-center gap-1.5 rounded border border-c4a-border-default bg-c4a-bg-surface p-1 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary sm:px-2 sm:py-1",children:[c.jsx(VC,{size:12}),c.jsx("span",{className:"hidden sm:inline",children:f[e]}),c.jsx($t,{size:12,className:`hidden transition-transform duration-200 sm:block ${a?"rotate-90":""}`})]}),a&&c.jsx("div",{className:"absolute right-0 top-full z-20 mt-1 min-w-[120px] rounded border border-c4a-border-default bg-c4a-bg-elevated py-1 shadow-c4a-lg",children:OR.map(x=>c.jsxs("button",{onClick:()=>{t(x),o(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left font-mono text-xs transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary ${x===e?"text-c4a-accent":"text-c4a-text-secondary"}`,children:[c.jsx(Wr,{size:12,className:x===e?"opacity-100":"opacity-0"}),f[x]]},x))})]})}function av({target:e,onConfirm:t,onCancel:r}){const{t:a}=ye();return c.jsxs(lr,{onClose:r,className:"mx-4 w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-text-primary",children:a("sources.delete.confirm_title")}),c.jsxs("div",{className:"mt-4 space-y-3 text-sm text-c4a-text-secondary",children:[e.type==="resource"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{children:a("sources.delete.resource",{name:e.name})}),c.jsx("p",{children:a("sources.delete.resource_impact")}),c.jsx("p",{className:"text-c4a-warning",children:a("sources.delete.session_warning")}),c.jsx("p",{children:a("sources.delete.entity_safe")})]}),e.type==="folder"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{children:a("sources.delete.folder",{name:e.name})}),e.folderCount!==void 0&&e.sourceCount!==void 0?c.jsxs(c.Fragment,{children:[c.jsx("p",{children:a("sources.delete.folder_contents",{folders:e.folderCount,sources:e.sourceCount})}),e.indexedCount!==void 0&&e.indexedCount>0&&c.jsx("p",{children:a("sources.delete.indexed_hint",{indexed:e.indexedCount,total:e.sourceCount})})]}):c.jsx("p",{children:a("sources.delete.folder_impact_generic")}),c.jsx("p",{className:"text-c4a-warning",children:a("sources.delete.irreversible")})]}),e.type==="repo"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{children:a("sources.delete.repo",{name:e.name,library:e.libraryName})}),e.packageCount!==void 0&&e.docCount!==void 0?c.jsxs(c.Fragment,{children:[c.jsx("p",{children:a("sources.delete.repo_contents",{packages:e.packageCount,docs:e.docCount})}),e.indexedCount!==void 0&&e.indexedCount>0&&c.jsx("p",{children:a("sources.delete.indexed_hint",{indexed:e.indexedCount,total:e.packageCount+e.docCount})})]}):c.jsx("p",{children:a("sources.delete.repo_impact_generic")}),c.jsx("p",{children:a("sources.delete.local_safe")}),c.jsx("p",{children:a("sources.delete.entity_safe")})]}),e.type==="client"&&c.jsxs(c.Fragment,{children:[c.jsx("p",{children:a("sources.delete.client",{name:e.name})}),c.jsx("p",{children:a("sources.delete.client_impact")}),c.jsx("p",{children:a("sources.delete.local_safe")}),c.jsx("p",{children:a("sources.delete.entity_safe")}),c.jsx("p",{className:"text-c4a-warning",children:a("sources.delete.irreversible")}),c.jsx("p",{className:"text-c4a-text-muted",children:a("sources.delete.client_reregister")})]})]}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx("button",{onClick:r,className:"rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:a("common.cancel")}),c.jsx("button",{onClick:t,className:"rounded bg-c4a-error px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-error/80",children:a("common.confirm")})]})]})}function zR({onConfirm:e,onCancel:t,error:r}){const{t:a}=ye(),[o,i]=b.useState(""),u=b.useRef(null);b.useEffect(()=>{u.current?.focus()},[]);const f=b.useCallback(()=>{const p=o.trim();p&&e(p)},[o,e]),h=b.useCallback(p=>{p.key==="Enter"&&(p.preventDefault(),f())},[f]);return c.jsxs(lr,{onClose:t,className:"mx-4 w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(O1,{size:16,className:"shrink-0 text-c4a-accent"}),c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-text-primary",children:a("sources.actions.new_folder")})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("input",{ref:u,value:o,onChange:p=>i(p.target.value),onKeyDown:h,placeholder:a("sources.folder.name_placeholder"),className:"w-full rounded border border-c4a-border-default bg-c4a-bg-surface px-3 py-2 text-sm text-c4a-text-primary outline-none transition-colors focus:border-c4a-accent",autoFocus:!0}),r&&c.jsx("p",{className:"mt-2 text-xs text-c4a-error",children:r})]}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx("button",{onClick:t,className:"rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:a("common.cancel")}),c.jsx("button",{onClick:f,disabled:!o.trim(),className:"rounded bg-c4a-accent px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:a("common.confirm")})]})]})}function Yp({label:e,icon:t,items:r,alignRight:a}){const[o,i]=b.useState(!1),u=b.useRef(null),f=b.useRef(null),h=b.useCallback(x=>{u.current&&!u.current.contains(x.target)&&i(!1)},[]);b.useEffect(()=>{if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o,h]);const p=b.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),i(!0)},[]),m=b.useCallback(()=>{f.current=setTimeout(()=>i(!1),150)},[]);return c.jsxs("div",{ref:u,className:"relative",onMouseEnter:p,onMouseLeave:m,children:[c.jsxs("button",{className:`flex items-center gap-1.5 rounded border border-c4a-border-default bg-c4a-bg-surface font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary ${e?"p-1 sm:px-2 sm:py-1":"p-1"}`,children:[t,e&&c.jsx("span",{className:"hidden sm:inline",children:e}),e&&c.jsx($t,{size:12,className:`hidden transition-transform duration-200 sm:block ${o?"rotate-90":""}`})]}),o&&c.jsx("div",{className:`absolute top-full z-20 mt-1 min-w-[160px] rounded border border-c4a-border-default bg-c4a-bg-elevated py-1 shadow-c4a-lg ${a?"right-0":"left-0"}`,children:r.map(x=>c.jsxs("button",{onClick:()=>{x.onClick(),i(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:[x.icon,x.label]},x.label))})]})}function $R({onClose:e}){const{t}=ye();return c.jsxs(lr,{onClose:e,closeOnEsc:!1,className:"w-full max-w-sm rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(_A,{size:18,className:"text-c4a-accent"}),c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-text-primary",children:t("sources.upgrade.title")})]}),c.jsx("p",{className:"mt-3 text-sm text-c4a-text-secondary",children:t("sources.upgrade.description")}),c.jsx("div",{className:"mt-6 flex justify-end",children:c.jsx("button",{onClick:e,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:t("common.confirm")})})]})}const BR=new Set(["package.json","pyproject.toml","setup.py","go.mod","cargo.toml","pom.xml","build.gradle"]),IR=new Set([".ts",".tsx",".md"]),UR=new Set([".md",".txt",".ts",".tsx",".doc",".docx",".pdf",".ppt",".pptx"]),PR=new Set([".md",".txt"]),HR=5*1024*1024,qR=10;function Lh(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function FR(e){const t=e.includes("/")?e.split("/").pop():e;if(BR.has(t.toLowerCase()))return!0;const r=Lh(t);return IR.has(r)}function GR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function VR({onConfirm:e,onCancel:t,error:r,uploading:a}){const{t:o}=ye(),[i,u]=b.useState([]),[f,h]=b.useState(null),[p,m]=b.useState(!1),[x,v]=b.useState(!1),_=b.useRef(null),w=b.useCallback(z=>{h(null);for(const $ of z){const R=Lh($.name);if(!UR.has(R)){h(o("sources.upload.unsupported_type",{name:$.name}));return}if($.size>HR){h(o("sources.upload.file_too_large",{name:$.name}));return}}u($=>{const R=new Map($.map(H=>[H.name,H]));for(const H of z)R.set(H.name,{name:H.name,size:H.size,file:H});const B=Array.from(R.values());return B.length>qR?(h(o("sources.upload.too_many_files")),$):B})},[o]),S=b.useCallback(z=>{const $=z.target.files;!$||$.length===0||(w(Array.from($)),z.target.value="")},[w]),k=b.useCallback(z=>{u($=>$.filter((R,B)=>B!==z)),h(null)},[]),N=b.useCallback(z=>{z.preventDefault(),m(!1);const $=z.dataTransfer?.files;!$||$.length===0||w(Array.from($))},[w]),A=b.useCallback(z=>{z.preventDefault(),m(!0)},[]),E=b.useCallback(z=>{z.preventDefault(),m(!1)},[]),D=b.useCallback(async()=>{if(!(i.length===0||x)){v(!0);try{const z=await Promise.all(i.map($=>new Promise((R,B)=>{const H=Lh($.name),J=PR.has(H),oe=new FileReader;oe.onerror=()=>B(oe.error),J?(oe.onload=()=>R({name:$.name,content:oe.result,encoding:"utf-8"}),oe.readAsText($.file)):(oe.onload=()=>{const ce=oe.result,M=ce.slice(ce.indexOf(",")+1);R({name:$.name,content:M,encoding:"base64"})},oe.readAsDataURL($.file))})));e(z)}catch{v(!1)}}},[i,x,e]),L=r||f;return c.jsxs(lr,{onClose:t,disableClose:x||(a??!1),className:"mx-4 w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Nh,{size:16,className:"shrink-0 text-c4a-accent"}),c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-text-primary",children:o("sources.upload.title")})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("input",{ref:_,type:"file",accept:".md,.doc,.docx,.pdf,.ppt,.pptx,.txt",multiple:!0,onChange:S,className:"hidden"}),c.jsxs("button",{type:"button",onClick:()=>_.current?.click(),onDrop:N,onDragOver:A,onDragLeave:E,disabled:x||a,className:`flex w-full flex-col items-center justify-center rounded border-2 border-dashed px-4 py-8 transition-colors ${p?"border-c4a-accent bg-c4a-accent/5":"border-c4a-border-default hover:border-c4a-accent/50"} ${x||a?"cursor-not-allowed opacity-40":"cursor-pointer"}`,children:[c.jsx(Nh,{size:24,className:"text-c4a-text-muted"}),c.jsx("p",{className:"mt-2 text-sm text-c4a-text-secondary",children:o("sources.upload.drop_hint")}),c.jsx("p",{className:"mt-1 text-[10px] text-c4a-text-muted",children:o("sources.upload.supported_formats")})]})]}),i.length>0&&c.jsxs("div",{className:"mt-3",children:[c.jsx("p",{className:"text-xs text-c4a-text-muted",children:o("sources.upload.selected",{count:i.length})}),c.jsx("div",{className:"mt-1 max-h-40 space-y-1 overflow-y-auto c4a-scrollbar",children:i.map((z,$)=>c.jsxs("div",{className:"flex items-center gap-2 rounded bg-c4a-bg-surface px-2 py-1",children:[c.jsx(On,{size:12,className:"shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-c4a-text-primary",children:z.name}),c.jsx("span",{className:"shrink-0 text-[10px] text-c4a-text-muted",children:GR(z.size)}),!x&&!a&&c.jsx("button",{type:"button",onClick:()=>k($),className:"shrink-0 text-c4a-text-muted transition-colors hover:text-c4a-text-primary",title:o("sources.upload.remove"),children:c.jsx(Or,{size:12})})]},`${z.name}-${$}`))})]}),L&&c.jsx("p",{className:"mt-2 text-xs text-c4a-error",children:L}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx("button",{onClick:t,disabled:x||a,className:"rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary disabled:opacity-40",children:o("common.cancel")}),c.jsxs("button",{onClick:D,disabled:i.length===0||x||a,className:"flex items-center gap-1.5 rounded bg-c4a-accent px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:[(x||a)&&c.jsx(Zt,{size:12,className:"animate-spin"}),o(x||a?"sources.upload.uploading":"common.confirm")]})]})]})}const YR=/^v\d+\.\d+\.\d+$/;function Dh(e){const t=/^v(\d+)\.(\d+)\.(\d+)$/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function KR(e,t){const r=Dh(e),a=Dh(t);return!r||!a?!1:r[0]!==a[0]?r[0]>a[0]:r[1]!==a[1]?r[1]>a[1]:r[2]>a[2]}function XR(e){const t=Dh(e);return t?`v${t[0]}.${t[1]}.${t[2]+1}`:"v0.0.1"}function QR({currentVersion:e,onConfirm:t,onCancel:r,uploading:a,serverError:o}){const{t:i}=ye(),[u,f]=b.useState(()=>XR(e)),h=b.useMemo(()=>YR.test(u)?KR(u,e)?null:i("upload.version_must_increase",{version:e}):i("upload.version_must_increase",{version:e}),[u,e,i]),p=b.useCallback(()=>{h||a||t(u)},[h,a,t,u]);return c.jsxs(lr,{onClose:r,disableClose:a??!1,className:"mx-4 w-full max-w-sm rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-text-primary",children:i("upload.new_version_title")}),c.jsx("p",{className:"mt-3 text-sm text-c4a-text-secondary",children:i("upload.new_version_desc")}),c.jsxs("div",{className:"mt-4",children:[c.jsx("label",{className:"block text-xs text-c4a-text-muted uppercase",children:i("upload.version_label")}),c.jsx("input",{type:"text",value:u,onChange:m=>f(m.target.value),disabled:a,className:"mt-1 w-full rounded border border-c4a-border-default bg-c4a-bg-base px-3 py-1.5 font-mono text-sm text-c4a-text-primary focus:border-c4a-accent focus:outline-none disabled:opacity-40"}),c.jsx("p",{className:"mt-1 text-xs text-c4a-text-muted",children:i("upload.current_version",{version:e})}),h&&c.jsx("p",{className:"mt-1 text-xs text-c4a-error",children:h}),o&&!h&&c.jsx("p",{className:"mt-1 text-xs text-c4a-error",children:o})]}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:r,disabled:a,className:"rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary disabled:opacity-40",children:i("common.cancel")}),c.jsxs("button",{type:"button",onClick:p,disabled:!!h||a,className:"flex items-center gap-1.5 rounded bg-c4a-accent px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:[a&&c.jsx(Zt,{size:12,className:"animate-spin"}),i("upload.confirm")]})]})]})}function ZR({pathLabel:e,loading:t,badge:r,onNavigateUp:a,children:o}){return c.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface px-4 pb-4 pt-2.5",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1",children:[c.jsx("p",{className:"min-w-0 shrink truncate font-mono text-xs text-c4a-text-muted",children:e}),r]}),c.jsx("hr",{className:"my-2 border-c4a-border-subtle"}),c.jsx("div",{className:"c4a-scrollbar flex min-h-0 flex-1 flex-col overflow-y-auto",children:t?c.jsx("div",{className:"flex flex-1 items-center justify-center py-8",children:c.jsx(Zt,{size:14,className:"animate-spin text-c4a-text-muted"})}):c.jsxs(c.Fragment,{children:[a&&c.jsxs("button",{onClick:a,className:"flex w-full cursor-pointer items-center gap-3 rounded pl-3 pr-5 py-2 text-left text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(vm,{size:14,className:"shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:"leading-none pb-1",children:".."})]}),o]})})]})}function JR(e){const t=e.match(/^[\w.-]+@([\w.-]+):([\w./-]+?)(?:\.git)?$/);if(t){const r=t[1],a=t[2];return{slug:a,repoUrl:`https://${r}/${a}`,host:r}}try{const r=new URL(e),a=r.hostname,o=r.pathname.replace(/^\//,"").replace(/\.git$/,"");return o?{slug:o,repoUrl:`https://${a}/${o}`,host:a}:null}catch{return null}}function WR(e,t){return`${e}/tree/${encodeURIComponent(t)}`}function eT(e,t){return`${e}/commit/${t}`}function P1({remoteUrl:e,fallbackName:t,branch:r,commit:a}){const o=e?JR(e):null,i=a.slice(0,7);return c.jsxs("div",{className:"flex min-w-0 shrink flex-wrap items-center gap-1.5 font-mono text-xs leading-none text-c4a-accent",children:[o?c.jsxs("a",{href:o.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 truncate hover:underline",title:o.repoUrl,children:[c.jsx(H0,{size:12,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:o.slug})]}):c.jsxs("span",{className:"flex items-center gap-1 truncate",children:[c.jsx(H0,{size:12,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:t||"repo"})]}),c.jsx("span",{className:"text-c4a-text-muted",children:"/"}),o?c.jsxs("a",{href:WR(o.repoUrl,r),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 hover:underline",children:[c.jsx(Uu,{size:10,className:"shrink-0"}),c.jsx("span",{children:r})]}):c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Uu,{size:10,className:"shrink-0"}),c.jsx("span",{children:r})]}),c.jsx("span",{className:"text-c4a-text-muted",children:"/"}),o?c.jsx("a",{href:eT(o.repoUrl,a),target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:i}):c.jsx("span",{children:i})]})}function H1({currentName:e,onConfirm:t,onCancel:r,error:a}){const[o,i]=b.useState(e),u=b.useRef(null);b.useEffect(()=>{u.current?.select()},[]);const f=b.useCallback(()=>{const p=o.trim();p&&p!==e?t(p):r()},[o,e,t,r]),h=b.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),f()):p.key==="Escape"&&r()},[f,r]);return c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{ref:u,value:o,onChange:p=>i(p.target.value),onKeyDown:h,onBlur:f,className:"min-w-0 flex-1 rounded border border-c4a-accent bg-c4a-bg-surface px-2 py-1 text-sm text-c4a-text-primary outline-none",autoFocus:!0}),c.jsx("button",{onClick:p=>{p.stopPropagation(),f()},className:"rounded p-0.5 text-c4a-success hover:bg-c4a-bg-hover",children:c.jsx(Wr,{size:14})}),c.jsx("button",{onClick:p=>{p.stopPropagation(),r()},className:"rounded p-0.5 text-c4a-error hover:bg-c4a-bg-hover",children:c.jsx(Or,{size:14})}),a&&c.jsx("span",{className:"ml-1 text-xs text-c4a-error",children:a})]})}const tT=e=>{const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const r=o=>String(o).padStart(2,"0"),a=`${r(t.getMonth()+1)}-${r(t.getDate())} ${r(t.getHours())}:${r(t.getMinutes())}`;return t.getFullYear()===new Date().getFullYear()?a:`${t.getFullYear()}-${a}`},sv={none:"bg-c4a-text-muted/40",indexed:"bg-c4a-success",stale:"bg-c4a-warning"};function nT({source:e,isDaemonLibrary:t,isRepoRoot:r}){const{t:a}=ye(),o=e.kind==="source",i=o&&(e.source_type==="code"||FR(e.name)),f=i&&e.index_status!=="none"?"text-c4a-accent":"text-c4a-text-secondary",h=e.metadata?.origin==="remote";let p;if(e.kind==="folder"?p=r||h?c.jsx(Ml,{size:14,className:`shrink-0 ${f}`}):t?c.jsx(wC,{size:14,className:`shrink-0 ${f}`}):c.jsx(Gn,{size:14,className:`shrink-0 ${f}`}):e.source_type==="code"?p=c.jsx(Dr,{size:14,className:`shrink-0 ${f}`}):p=c.jsx(On,{size:14,className:`shrink-0 ${f}`}),!o||!i)return c.jsx(c.Fragment,{children:p});const m=sv[e.index_status]??sv.none,x=a(`sources.status.${e.index_status}`);return c.jsxs("span",{className:"group/dot relative shrink-0",children:[p,c.jsx("span",{className:`absolute -right-[2px] -top-[2px] block h-[5px] w-[5px] rounded-full ${m}`}),c.jsx("span",{className:"pointer-events-none absolute bottom-full left-1/2 z-50 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded bg-c4a-bg-elevated px-2 py-1 font-mono text-[10px] text-c4a-text-secondary opacity-0 shadow-lg transition-opacity group-hover/dot:opacity-100",children:x})]})}function ov({source:e,displayName:t,childCount:r,isDaemonLibrary:a,isRepoRoot:o,onClick:i,onRename:u,onDelete:f}){const{t:h}=ye(),[p,m]=b.useState(!1),[x,v]=b.useState(null),_=b.useCallback(async A=>{if(!u)return;const E=await u(A);E?v(E):(m(!1),v(null))},[u]),w=b.useCallback(()=>{m(!1),v(null)},[]),S=!o&&u,k=f,N=e.updated_at||e.created_at;return c.jsxs("div",{className:"group flex cursor-pointer items-center gap-3 rounded py-2 pl-3 pr-5 transition-colors hover:bg-c4a-bg-hover",onClick:p?void 0:i,children:[c.jsx(nT,{source:e,isDaemonLibrary:a??!1,isRepoRoot:o??!1}),p?c.jsx("div",{className:"min-w-0 flex-1",onClick:A=>A.stopPropagation(),children:c.jsx(H1,{currentName:e.name,onConfirm:_,onCancel:w,error:x})}):c.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-c4a-text-secondary",children:t??e.name}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.kind==="folder"&&r!==void 0&&c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:h("common.items",{count:r})}),N&&c.jsx("span",{className:"hidden font-mono text-[11px] text-c4a-text-muted lg:inline",children:tT(N)})]}),(S||k)&&c.jsxs("div",{className:"flex items-center gap-1 md:opacity-0 md:transition-opacity md:group-hover:opacity-100",children:[S?c.jsx("button",{title:h("sources.actions.rename"),onClick:A=>{A.stopPropagation(),m(!0)},className:"-my-0.5 rounded p-0.5 text-c4a-text-muted transition-colors hover:text-c4a-accent",children:c.jsx(kh,{size:14})}):k?c.jsx("span",{className:"inline-block h-[14px] w-[14px]"}):null,k&&c.jsx("button",{title:h("sources.actions.delete"),onClick:A=>{A.stopPropagation(),f()},className:"-my-0.5 rounded p-0.5 text-c4a-text-muted transition-colors hover:text-c4a-accent",children:c.jsx(ld,{size:14})})]})]})}function rT({library:e,onNewFolder:t,onUploadDoc:r,onImportRepo:a,onImportDir:o,onUpgrade:i}){const{t:u}=ye(),f=e.type==="daemon",h="rounded border border-c4a-border-default bg-c4a-bg-surface px-4 py-2 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary disabled:opacity-40",p=f?c.jsxs("div",{className:"flex gap-3",children:[o&&c.jsx("button",{onClick:o,disabled:!e.is_online,className:h,children:u("sources.actions.import_dir")}),a&&c.jsx("button",{onClick:a,disabled:!e.is_online,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs uppercase text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:u("sources.actions.import_repo")})]}):c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:t,className:h,children:u("sources.actions.new_folder")}),r&&c.jsx("button",{onClick:r,className:h,children:u("sources.actions.upload_document")}),i&&c.jsx("button",{onClick:i,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs uppercase text-white transition-colors hover:bg-c4a-accent-hover",children:u("sources.actions.import_repo_url")})]});return c.jsx(wt,{fullPage:!0,title:u(f?"sources.empty.daemon.title":"sources.empty.cloud.title"),description:u(f?"sources.empty.daemon.description":"sources.empty.cloud.description"),action:p})}function aT(){const{t:e}=ye();return c.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-6 text-center",children:[c.jsx("h4",{className:"font-mono text-sm font-bold text-c4a-text-primary",children:e("sources.empty.indexed.title")}),c.jsx("p",{className:"mt-2 text-xs text-c4a-text-secondary",children:e("sources.empty.indexed.description")})]})}const Oh=e=>{let t=0,r=0,a=0,o=0,i=0;const u=f=>{for(const h of f.children??[])h.kind==="folder"?(t++,u(h)):h.kind==="source"&&(r++,h.source_type==="code"?a++:o++,(h.index_status==="indexed"||h.index_status==="stale")&&i++)};return u(e),{folders:t,sources:r,codeSources:a,docSources:o,indexedSources:i}};function sT({items:e,isDaemon:t,isCloud:r,onItemClick:a,onRename:o,onDelete:i}){return c.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(u=>{if(u.type==="root"){const m=u.root,x=t,v=x?m.metadata?.local_path:void 0,_=m.tree.length>0?Oh({children:m.tree}):void 0,w=_?_.folders+_.sources:0,S=m.metadata,k=S?.origin==="remote",N=S?.import_type==="directory",A=k||x&&!N;return c.jsx(ov,{source:{id:m.id,library_id:m.library_id,owner_id:m.owner_id,path:"",kind:m.kind,source_type:m.source_type,name:m.name,content_hash:m.content_hash,metadata:m.metadata,index_status:m.index_status,created_at:m.created_at,updated_at:m.updated_at},...typeof v=="string"?{displayName:v}:{},...m.kind==="folder"?{childCount:w}:{},isDaemonLibrary:t??!1,isRepoRoot:A,onClick:()=>a(u),...k?{}:{onRename:E=>o(m.id,E)},onDelete:()=>i(u)},m.id)}const f=u.node,h=`${u.root.id}:${f.path}`,p=f.kind==="folder"?f.children?.length??0:void 0;return c.jsx(ov,{source:{id:u.root.id,library_id:u.root.library_id,owner_id:u.root.owner_id,path:f.path,kind:f.kind,source_type:f.source_type??null,name:f.name,content_hash:null,metadata:f.metadata??null,index_status:f.index_status??"none",created_at:u.root.created_at,updated_at:u.root.updated_at},...p!==void 0?{childCount:p}:{},isDaemonLibrary:t??!1,onClick:()=>a(u),...r&&u.root.metadata?.origin!=="remote"?{onDelete:()=>i(u)}:{}},h)})})}function oT({libId:e,isBrowsingTree:t,rootSourceId:r,treePath:a}){const{t:o}=ye(),{uploadDoc:i,fetchRootSources:u,fetchRootSource:f}=kt(),[h,p]=b.useState(!1),[m,x]=b.useState(null),[v,_]=b.useState(!1),[w,S]=b.useState(null),k=b.useCallback(async(A,E)=>{if(e){_(!0),x(null);try{const D={library_id:e,files:A.map(H=>{const J={file_name:H.name,content:H.content};return H.encoding&&(J.encoding=H.encoding),E&&(J.version_label=E),J})};t&&r&&(D.root_source_id=r,D.parent_path=a);const L=await i(D),z=L.results??[],$=z.some(H=>H.status==="created")||(L.created?.length??0)>0,R=z.some(H=>H.status==="hash_changed"),B=z.filter(H=>H.status==="no_change").length;if(R&&!E){const H=z.find(J=>J.status==="hash_changed");S({files:A,currentVersion:H?.current_version_label??"v0.0.0"}),p(!1)}else if($&&(t&&r?f(r):u({library_id:e})),p(!1),S(null),B>0){const H=B===z.length?o("upload.no_change"):o("upload.partial_no_change",{count:B});Qr(H,4e3)}}catch(D){D instanceof hn&&D.status===409?x(o("sources.error.name_conflict",{name:A[0]?.name??""})):D instanceof hn&&x(D.message)}finally{_(!1)}}},[e,t,r,a,i,u,f,o]),N=b.useCallback(async A=>{w&&await k(w.files,A)},[w,k]);return{showUploadDoc:h,setShowUploadDoc:p,uploadError:m,setUploadError:x,uploading:v,versionDialogData:w,setVersionDialogData:S,handleUploadDoc:k,handleVersionConfirm:N}}function iT(e){const t=Tt(),r=Qt(w=>w.updateLibraryName),a=Qt(w=>w.deleteLibrary),[o,i]=b.useState(!1),[u,f]=b.useState(null),[h,p]=b.useState(!1),m=b.useCallback(async w=>{if(e)try{await r(e,w),i(!1),f(null)}catch(S){const k=S instanceof Error?S.message:String(S);f(k)}},[e,r]),x=b.useCallback(()=>{i(!1),f(null)},[]),v=b.useCallback(async()=>{if(e){try{await a(e),t("/studio/sources/add-client")}catch{}p(!1)}},[e,a,t]),_=b.useCallback(()=>{p(!1)},[]);return{renamingLib:o,setRenamingLib:i,renameLibError:u,deletingLib:h,setDeletingLib:p,handleLibRenameConfirm:m,handleLibRenameCancel:x,handleLibDeleteConfirm:v,handleLibDeleteCancel:_}}function lT(){const{t:e}=ye(),t=Tt(),{libId:r}=Vo(),[a,o]=Ol(),i=a.get("rootId")||null,u=a.get("path")||"",h=Qt(ds(qs)).find(me=>me.id===r),{rootSources:p,currentRoot:m,loading:x,filter:v,fetchRootSources:_,fetchRootSource:w,createSource:S,addTreeNode:k,updateSource:N,deleteSource:A,deleteTreeNode:E,setFilter:D}=kt(),L=i!==null,{showUploadDoc:z,setShowUploadDoc:$,uploadError:R,setUploadError:B,uploading:H,versionDialogData:J,setVersionDialogData:oe,handleUploadDoc:ce,handleVersionConfirm:M}=oT({libId:r,isBrowsingTree:L,rootSourceId:i,treePath:u}),[P,T]=b.useState(!1),[F,ee]=b.useState(null),[ae,W]=b.useState(null),[O,V]=b.useState(null),[re,se]=b.useState(null),[ne,ge]=b.useState(!1),{renamingLib:Ne,setRenamingLib:Fe,renameLibError:qe,deletingLib:be,setDeletingLib:fe,handleLibRenameConfirm:_e,handleLibRenameCancel:he,handleLibDeleteConfirm:ve,handleLibDeleteCancel:Ve}=iT(r);b.useEffect(()=>{r&&_({library_id:r})},[r,_]),b.useEffect(()=>{i&&w(i)},[i,w]),b.useEffect(()=>{const me=sessionStorage.getItem("c4a_batch_toast");me&&(sessionStorage.removeItem("c4a_batch_toast"),Qr(me,4e3))},[a]);const De=b.useMemo(()=>L?m?[...DR(m.tree,u)].sort((St,nt)=>St.kind!==nt.kind?St.kind==="folder"?-1:1:St.name.localeCompare(nt.name)).map(St=>({type:"node",root:m,node:St})):[]:[...p].sort((nt,Ct)=>nt.kind!==Ct.kind?nt.kind==="folder"?-1:1:new Date(Ct.created_at).getTime()-new Date(nt.created_at).getTime()).map(nt=>({type:"root",root:nt,node:null})),[L,p,m,u]),Xe=b.useMemo(()=>v==="all"?De:De.filter(me=>me.type==="root"||!me.node||me.node.kind==="folder"?!0:v==="indexed"?me.node.index_status==="indexed":me.node.index_status==="none"||!me.node.index_status),[De,v]),It=h?.type==="daemon",un=h?.type==="cloud",Vt=It&&!L,Bn=h?.type==="cloud"?!0:h?.is_online??!1,cr=kt(me=>me.indexingTasks),Xn=b.useMemo(()=>{if(L&&i){const me=cr.get(i);return!!me&&!me.terminalState}return p.some(me=>{const Ue=cr.get(me.id);return!!Ue&&!Ue.terminalState})},[L,i,cr,p]),Ht=b.useMemo(()=>{if(!h)return[];const me=[{label:h.is_default?e("sources.library.default_cloud_name"):h.name,to:`/studio/sources/${h.id}`}];return L&&m&&(me.push({label:m.name,to:`/studio/sources/${h.id}?rootId=${m.id}`}),u&&al(m.tree,u).forEach(St=>{me.push({label:St.name,to:`/studio/sources/${h.id}?rootId=${m.id}&path=${encodeURIComponent(St.path)}`})})),me},[h,L,m,u,e]),An=b.useCallback(async me=>{if(r)try{L&&i?await k(i,{parent_path:u,kind:"folder",name:me}):(await S({library_id:r,kind:"folder",name:me}),_({library_id:r})),T(!1),ee(null)}catch(Ue){Ue instanceof hn&&Ue.status===409&&ee(e("sources.error.name_conflict",{name:me}))}},[r,L,i,u,S,k,_,e]),Le=b.useCallback(me=>{r&&(me.type==="root"?me.root.kind==="source"?t(`/studio/source/${me.root.id}`):o({rootId:me.root.id}):me.node&&(me.node.kind==="folder"?o({rootId:me.root.id,path:me.node.path}):t(`/studio/source/${me.root.id}?path=${encodeURIComponent(me.node.path)}`)))},[r,t,o]),Ze=b.useCallback(()=>{if(!(!i||!r))if(u){const me=u.split("/");me.pop();const Ue=me.join("/");o(Ue?{rootId:i,path:Ue}:{rootId:i})}else o({})},[i,r,u,o]),We=b.useCallback(async(me,Ue)=>{try{return await N(me,{name:Ue}),_({library_id:r}),null}catch(St){return St instanceof hn&&St.status===409?e("sources.error.name_conflict",{name:Ue}):null}},[r,N,_,e]),Nt=b.useCallback(me=>{if(me.type==="root"){V(me.root.id),se(null);const Ue=me.root.tree.length>0?Oh({children:me.root.tree}):void 0;W(It?{type:"repo",name:me.root.name,libraryName:h.name,...Ue?{packageCount:Ue.codeSources,docCount:Ue.docSources,indexedCount:Ue.indexedSources}:{}}:{type:me.root.kind==="folder"?"folder":"resource",name:me.root.name,...me.root.kind==="folder"&&Ue?{folderCount:Ue.folders,sourceCount:Ue.sources,indexedCount:Ue.indexedSources}:{}})}else if(me.node)if(V(me.root.id),se(me.node.path),me.node.kind==="folder"){const Ue=Oh(me.node);W({type:"folder",name:me.node.name,folderCount:Ue.folders,sourceCount:Ue.sources,indexedCount:Ue.indexedSources})}else W({type:"resource",name:me.node.name})},[It,h]),ft=b.useCallback(async()=>{if(!(!O||!r)){try{re?await E(O,re):(await A(O),_({library_id:r}))}catch{}W(null),V(null),se(null)}},[O,re,r,A,E,_]),Rn=b.useCallback(()=>{if(!r)return;const me=new URLSearchParams;i&&(me.set("parentId",i),m&&me.set("parentName",m.name)),u&&me.set("parentPath",u);const Ue=me.toString();t(`/studio/sources/import/${r}${Ue?`?${Ue}`:""}`)},[r,t,i,u,m]),mn=b.useCallback(()=>{r&&t(`/studio/sources/import-dir/${r}`)},[r,t]),gn=h?.is_default===!0;if(!h)return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8 pb-24",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})});const Lt=p.length===0&&v==="all"&&!x&&!L,Et=Xe.filter(me=>me.type==="node"&&me.node?.kind==="source").length===0&&v==="indexed"&&!x,Pt=!L||!m?!1:m.metadata?.origin==="remote"?!0:u?al(m.tree,u).some(Ue=>Ue.metadata?.origin==="remote"):!1,Er=!Vt,zr=un&&!Pt,sa=Vt;return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-4 md:p-6",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("div",{className:"min-w-0 flex-1",children:Ne?c.jsx(H1,{currentName:h.name,onConfirm:_e,onCancel:he,error:qe}):c.jsx(Ta,{segments:Ht})}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[zr&&c.jsxs(c.Fragment,{children:[c.jsx(Yp,{label:e("sources.actions.upload"),icon:c.jsx(Nh,{size:14}),items:[{label:e("sources.actions.upload_doc"),icon:c.jsx(On,{size:14}),onClick:()=>$(!0)}]}),c.jsx(Yp,{label:e("sources.actions.add"),icon:c.jsx(Sm,{size:14}),items:[{label:e("sources.actions.add_folder"),icon:c.jsx(O1,{size:14}),onClick:()=>T(!0)},{label:e("sources.actions.add_web"),icon:c.jsx(LC,{size:14}),onClick:()=>ge(!0)},{label:e("sources.actions.add_feishu"),icon:c.jsx(pC,{size:14}),onClick:()=>ge(!0)}]}),c.jsxs("button",{onClick:()=>{const me=new URLSearchParams;i&&(me.set("parentId",i),m&&me.set("parentName",m.name)),u&&me.set("parentPath",u);const Ue=me.toString();t(`/studio/sources/import-remote/${r}${Ue?`?${Ue}`:""}`)},className:"flex items-center gap-1.5 rounded border border-c4a-border-default bg-c4a-bg-surface p-1 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary sm:px-2 sm:py-1",children:[c.jsx(P0,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:e("sources.actions.import_repo_url")})]})]}),sa&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{onClick:mn,disabled:!h.is_online,title:h.is_online?void 0:e("sources.import.daemon_offline",{name:h.name}),className:"flex items-center gap-1.5 rounded border border-c4a-border-default bg-c4a-bg-surface p-1 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary disabled:cursor-not-allowed disabled:opacity-40 sm:px-2 sm:py-1",children:[c.jsx(vC,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:e("sources.actions.import_dir")})]}),c.jsxs("button",{onClick:Rn,disabled:!h.is_online,title:h.is_online?void 0:e("sources.import.daemon_offline",{name:h.name}),className:"flex items-center gap-1.5 rounded border border-c4a-border-default bg-c4a-bg-surface p-1 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary disabled:cursor-not-allowed disabled:opacity-40 sm:px-2 sm:py-1",children:[c.jsx(P0,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:e("sources.actions.import_repo")})]}),c.jsx(Yp,{label:"",icon:c.jsx(kh,{size:14}),alignRight:!0,items:[{label:e("sources.library.rename"),icon:c.jsx(kh,{size:14}),onClick:()=>Fe(!0)},...gn?[]:[{label:e("sources.actions.delete"),icon:c.jsx(ld,{size:14}),onClick:()=>fe(!0)}]]})]}),(L||un)&&c.jsxs("button",{onClick:()=>{const me=new URLSearchParams;i&&me.set("rootId",i),u&&me.set("path",u),t(`/studio/sources/${r}/batch-index?${me.toString()}`)},disabled:!Bn||Xn,title:e(Bn?Xn?"index.batch.tooltip_indexing":"index.batch.tooltip":"daemon.offline_tooltip"),className:`flex items-center gap-1.5 rounded border p-1 font-mono text-xs uppercase transition-colors sm:px-2 sm:py-1 ${Xn?"border-c4a-accent/30 bg-c4a-bg-surface text-c4a-accent":Bn?"border-c4a-border-default bg-c4a-bg-surface text-c4a-text-secondary hover:bg-c4a-bg-hover hover:text-c4a-text-primary":"border-c4a-border-default bg-c4a-bg-surface text-c4a-text-secondary opacity-40"}`,children:[Xn?c.jsx(Zt,{size:14,className:"animate-spin"}):c.jsx(cC,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:e("index.batch.tooltip")})]}),Er&&c.jsx(MR,{value:v,onChange:D})]})]}),Lt?c.jsx(rT,{library:h,onNewFolder:()=>T(!0),...It?{onImportRepo:Rn,onImportDir:mn}:{},...un?{onUploadDoc:()=>$(!0),onUpgrade:()=>{const me=new URLSearchParams;i&&(me.set("parentId",i),m&&me.set("parentName",m.name)),u&&me.set("parentPath",u);const Ue=me.toString();t(`/studio/sources/import-remote/${r}${Ue?`?${Ue}`:""}`)}}:{}}):c.jsx(ZR,{pathLabel:(()=>{if(!L||!m)return"/";const me=m.metadata,Ue=It?typeof me?.local_path=="string"?me.local_path:m.name:"/"+m.name;if(!u)return Ue;const St=al(m.tree,u);return Ue+"/"+St.map(nt=>nt.name).join("/")})(),loading:x,badge:(()=>{if(!L||!m)return;let me=m.metadata,Ue=m.name;if(!me?.origin&&u){const Ct=al(m.tree,u);for(const Dt of Ct){const Oa=Dt.metadata;if(Oa?.origin==="remote"){me=Oa,Ue=Dt.name;break}}}const St=me?.pinned_branch??me?.remote_ref,nt=me?.pinned_hash??me?.remote_commit;if(!(!St||!nt))return c.jsx(P1,{remoteUrl:me?.remote_url,fallbackName:Ue,branch:St,commit:nt})})(),onNavigateUp:L?Ze:void 0,children:Xe.length===0?Et?c.jsx(aT,{}):L?null:c.jsx("p",{className:"py-8 text-center text-xs text-c4a-text-muted",children:e("common.items",{count:0})}):c.jsx(sT,{items:Xe,isDaemon:It??!1,isCloud:un??!1,onItemClick:Le,onRename:We,onDelete:Nt})}),P&&c.jsx(zR,{onConfirm:An,onCancel:()=>{T(!1),ee(null)},error:F}),z&&c.jsx(VR,{onConfirm:ce,onCancel:()=>{$(!1),B(null)},error:R,uploading:H}),J&&c.jsx(QR,{currentVersion:J.currentVersion,onConfirm:M,onCancel:()=>{oe(null),B(null)},uploading:H,serverError:R}),ne&&c.jsx($R,{onClose:()=>ge(!1)}),ae&&c.jsx(av,{target:ae,onConfirm:ft,onCancel:()=>{W(null),V(null),se(null)}}),be&&h&&c.jsx(av,{target:{type:"client",name:h.name},onConfirm:ve,onCancel:Ve})]})}function cT(){const{t:e}=ye(),t=Tt(),r=Qt(u=>u.libraries),a=Qt(u=>u.loading),[o,i]=b.useState(!1);return b.useEffect(()=>{if(a)return;if(r.length===0&&!o){i(!0),Qt.getState().fetchLibraries();return}const u=r.find(f=>f.is_default);u?t(`/studio/sources/${u.id}`,{replace:!0}):r.length>0&&t(`/studio/sources/${r[0].id}`,{replace:!0})},[r,a,t,o]),o&&!a&&r.length===0?c.jsx(wt,{fullPage:!0,icon:c.jsx(D1,{size:32}),title:e("sources.empty.cloud.title"),description:e("sources.empty.cloud.description")}):c.jsx("div",{className:"flex flex-1 items-center justify-center p-8 pb-24",children:c.jsx(ta,{})})}function Xr({active:e,current:t}){return c.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full border-2 ${t?"border-c4a-accent bg-c4a-accent":e?"border-c4a-accent bg-transparent":"border-c4a-border-default bg-transparent"}`})}function $s(){return c.jsx("span",{className:"h-px flex-1 bg-c4a-border-default"})}function q1({libraryName:e}){const{t}=ye();return c.jsxs("div",{className:"rounded border border-c4a-warning/30 bg-c4a-bg-surface p-6 text-center",children:[c.jsx("p",{className:"text-sm text-c4a-warning",children:t("sources.import.daemon_offline",{name:e})}),c.jsx(jr,{to:"/studio/sources/add-client",className:"mt-4 inline-block rounded bg-c4a-accent px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:t("sources.import.view_guide")})]})}function km({step:e,totalSteps:t,importing:r,stepBusy:a,canProceed:o,safetyNoticeKey:i,confirmLabelKey:u,onPrev:f,onNext:h,onImport:p}){const{t:m}=ye();return c.jsxs("div",{className:"mt-3 flex shrink-0 items-center gap-4 sm:mt-6",children:[c.jsx("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-c4a-text-muted line-clamp-1 sm:line-clamp-none",title:m(i),onClick:x=>x.currentTarget.classList.toggle("line-clamp-1"),children:m(i)}),c.jsxs("div",{className:"flex shrink-0 gap-2",children:[e>1&&c.jsx("button",{onClick:f,disabled:r||a,className:"rounded border border-c4a-border-default px-4 py-2 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover disabled:opacity-40",children:m("common.previous")}),e<t?c.jsx("button",{onClick:h,disabled:!o||a,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:m("common.next")}):c.jsxs("button",{onClick:p,disabled:r||a||!o,className:"flex items-center gap-1.5 rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:[r&&c.jsx(Zt,{size:12,className:"animate-spin"}),m(r?"sources.import.importing":u)]})]})]})}function F1(e,t){const r=b.useCallback(async(u,f)=>{if(!e)throw new Error("No library");const h=await ze.post(`/libraries/${e}/rpc`,{method:u,params:f});if(h.error){const p=h.error;throw new Error(p.message??JSON.stringify(h.error))}return h.result??h},[e]),[a,o]=b.useState([]);b.useEffect(()=>{if(!e)return;let u=!1;return(async()=>{try{const f=await ze.get("/sources",{library_id:e,limit:"500"});if(u)return;const h=f.items.map(p=>{const m=p.metadata;return typeof m?.local_path=="string"?m.local_path:null}).filter(p=>p!==null);o(h)}catch{}})(),()=>{u=!0}},[e]);const i=b.useMemo(()=>{const u=t?.config;return!u||!Array.isArray(u.allowed_paths)?[]:u.allowed_paths},[t]);return{rpc:r,importedPaths:a,allowedPaths:i}}function uT(e,t){const r=e.toLowerCase();try{if(r.endsWith("package.json")){const a=JSON.parse(t);if(typeof a.name=="string"&&a.name.trim())return a.name.trim()}if(r.endsWith("pyproject.toml"))return t.match(/^\s*name\s*=\s*["']([^"']+)["']/m)?.[1]??null;if(r.endsWith("go.mod"))return t.match(/^\s*module\s+([^\s]+)\s*$/m)?.[1]??null;if(r.endsWith("cargo.toml"))return t.match(/^\s*name\s*=\s*["']([^"']+)["']/m)?.[1]??null;if(r.endsWith("pom.xml"))return t.match(/<artifactId>([^<]+)<\/artifactId>/)?.[1]?.trim()??null;if(r.endsWith("build.gradle"))return t.match(/rootProject\.name\s*=\s*["']([^"']+)["']/)?.[1]??null}catch{return null}return null}function Mh(e,t,r="repo"){const a=[];for(const i of e){const u=i.path.split("/"),f=u.slice(0,-1).join("/")||".",h=u.length===1||i.path==="package.json",p=f==="."?r:u[u.length-2]||f,m=uT(i.path,i.content);a.push({name:m||p,path:f,isRoot:h})}const o=t.filter(i=>/\.md$/i.test(i.path)).map(i=>i.path);return{packages:a,mdFiles:o}}const iv=new Set(["tree","blob","commit","commits","raw","src"]),dT=new Set(["commit","commits"]);function fT(e){let t;try{t=new URL(e.trim())}catch{return{repoUrl:e.trim()}}const r=t.pathname.split("/").filter(Boolean);let a=-1;for(let p=2;p<r.length;p++){const m=r[p];if(m==="-"&&p+1<r.length&&iv.has(r[p+1])){a=p;break}if(iv.has(m)){a=p;break}}if(a===-1)return{repoUrl:`${t.protocol}//${t.host}${t.pathname}`.replace(/\/+$/,"")};const o=r.slice(0,a).join("/"),i=`${t.protocol}//${t.host}/${o}`;let u,f;if(r[a]==="-"?(u=r[a+1],f=a+2):(u=r[a],f=a+1),f>=r.length)return{repoUrl:i};const h=r[f];return dT.has(u)?{repoUrl:i,commit:h}:{repoUrl:i,ref:h}}function Os(e){try{return(new URL(e).pathname.split("/").pop()??"repo").replace(/\.git$/i,"")||"repo"}catch{return e.split("/").pop()||e}}function zh(){const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}const pT=1500;async function G1(e){const t=pT-(Date.now()-e);t>0&&await new Promise(r=>setTimeout(r,t))}function V1(){const{t:e}=ye(),[t,r]=b.useState(!1),[a,o]=b.useState(null),i=b.useRef(),u=b.useRef(),f=window.location.host,h=`c4a-daemon --server ${f} --allow <dir1> <dir2>`,p=`c4a-daemon --server ${f}`,m=b.useCallback((_,w)=>{navigator.clipboard.writeText(_),o(w),clearTimeout(i.current),i.current=setTimeout(()=>o(null),1500)},[]),x=b.useCallback(()=>{clearTimeout(u.current),r(!0)},[]),v=b.useCallback(()=>{u.current=setTimeout(()=>r(!1),150)},[]);return c.jsxs("span",{className:"relative",onMouseEnter:x,onMouseLeave:v,children:[c.jsx(L1,{size:12,className:"text-c4a-warning"}),t&&c.jsxs("span",{className:"absolute left-full top-1/2 z-10 ml-2 -translate-y-1/2 rounded border border-c4a-border-default bg-c4a-bg-elevated px-2.5 py-2 shadow-lg",onMouseEnter:x,onMouseLeave:v,children:[c.jsx("span",{className:"block whitespace-nowrap font-mono text-xs text-c4a-text-secondary",children:e("sources.import.allowed_dirs_tooltip_restrict")}),c.jsxs("span",{className:"mt-1 flex items-center gap-1.5 whitespace-nowrap",children:[c.jsx("span",{className:"font-mono text-xs text-c4a-accent",children:h}),c.jsx("button",{onClick:()=>m(h,0),className:"shrink-0 rounded p-0.5 text-c4a-accent transition-colors hover:bg-c4a-bg-hover",title:"Copy",children:a===0?c.jsx(Wr,{size:10}):c.jsx(Iu,{size:10})})]}),c.jsx("span",{className:"mt-2 block whitespace-nowrap font-mono text-xs text-c4a-text-secondary",children:e("sources.import.allowed_dirs_tooltip_all")}),c.jsxs("span",{className:"mt-1 flex items-center gap-1.5 whitespace-nowrap",children:[c.jsx("span",{className:"font-mono text-xs text-c4a-accent",children:p}),c.jsx("button",{onClick:()=>m(p,1),className:"shrink-0 rounded p-0.5 text-c4a-accent transition-colors hover:bg-c4a-bg-hover",title:"Copy",children:a===1?c.jsx(Wr,{size:10}):c.jsx(Iu,{size:10})})]})]})]})}function Y1({open:e,onClose:t,rpc:r,onNavigate:a,defaultPath:o}){const{t:i}=ye(),[u,f]=b.useState(o??""),[h,p]=b.useState(null),[m,x]=b.useState(!1),v=b.useRef(null);b.useEffect(()=>{o&&!u&&f(o)},[o]);const _=b.useCallback(async()=>{const S=u.trim();if(S){x(!0),p(null);try{(await r("fs/exists",{path:S})).exists?(a(S),f(o??""),p(null),t()):p(i("sources.import.wildcard_path_not_found"))}catch(k){p(k instanceof Error?k.message:String(k))}finally{x(!1)}}},[u,r,i,a,t]),w=b.useCallback(()=>{f(o??""),p(null),t()},[t,o]);return e?c.jsxs(lr,{onClose:w,closeOnOverlay:!1,closeOnEsc:!1,overlayClass:"bg-black/40",className:"w-full max-w-md rounded-lg border border-c4a-border-default bg-c4a-bg-surface p-5 shadow-xl",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"font-mono text-sm font-medium text-c4a-text-primary",children:i("sources.import.wildcard_go_title")}),c.jsx("button",{onClick:w,className:"rounded p-1 text-c4a-text-muted transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-secondary",children:c.jsx(Or,{size:14})})]}),c.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[c.jsx("input",{ref:v,type:"text",value:u,onChange:S=>{f(S.target.value),p(null)},onKeyDown:S=>{S.key==="Enter"&&_()},placeholder:i("sources.import.wildcard_path_placeholder"),autoFocus:!0,className:"flex-1 rounded border border-c4a-border-default bg-c4a-bg-base px-3 py-2 font-mono text-xs text-c4a-text-primary outline-none transition-colors focus:border-c4a-accent"}),c.jsxs("button",{onClick:_,disabled:m||!u.trim(),className:"flex shrink-0 items-center gap-1.5 rounded bg-c4a-accent px-3 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40",children:[m?c.jsx(Zt,{size:12,className:"animate-spin"}):c.jsx(R1,{size:12}),i("sources.import.wildcard_go")]})]}),h&&c.jsx("p",{className:"mt-2 text-xs text-c4a-error",children:h})]}):null}function K1({rpc:e,allowedPaths:t,importedPaths:r,onNavigateUpExtra:a}){const o=!!t&&t.length>0,i=o&&t.length===1&&t[0]==="*",[u,f]=b.useState(o),[h,p]=b.useState(o&&!i?"":"/"),[m,x]=b.useState([]),[v,_]=b.useState(!1),[w,S]=b.useState(null),[k,N]=b.useState(null);b.useEffect(()=>{if(o&&!i)return;let B=!1;return(async()=>{try{const H=await e("fs/homeDir",{});B||N(H.home_dir)}catch{B||N("/")}})(),()=>{B=!0}},[o,i,e]);const[A,E]=b.useState(!1),D=b.useCallback(async B=>{_(!0),S(null);try{const H=await e("fs/listTree",{path:B,depth:1});x(H.entries||[]),p(B),f(!1)}catch(H){const J=H instanceof Error?H.message:String(H);S(J)}finally{_(!1)}},[e]);b.useEffect(()=>{o&&!i||k!==null&&D(k)},[k,o,i,D]);const L=b.useMemo(()=>new Set(r??[]),[r]),z=b.useCallback(()=>{if(o&&!i&&t.some(J=>J===h)){f(!0),p(""),x([]),S(null),a?.();return}const B=h.split("/").slice(0,-1).join("/")||"/";a?.(),D(B)},[o,i,t,h,D,a]),$=b.useMemo(()=>m.filter(B=>B.type==="directory"),[m]),R=b.useMemo(()=>m.filter(B=>B.type==="file"),[m]);return{atRoot:u,currentPath:h,entries:m,loading:v,error:w,homeDir:k,goToOpen:A,hasAllowedPaths:o,isWildcard:i,importedSet:L,dirs:$,files:R,loadTree:D,handleNavigateUp:z,setGoToOpen:E}}function hT({rpc:e,selectedPath:t,onSelect:r,allowedPaths:a,importedPaths:o}){const{t:i}=ye(),[u,f]=b.useState(null),{atRoot:h,currentPath:p,entries:m,loading:x,error:v,homeDir:_,goToOpen:w,isWildcard:S,importedSet:k,dirs:N,files:A,loadTree:E,handleNavigateUp:D,setGoToOpen:L}=K1({rpc:e,allowedPaths:a??[],importedPaths:o??[],onNavigateUpExtra:()=>f(null)}),[z,$]=b.useState(null),[R,B]=b.useState(!1);b.useEffect(()=>{if(!t){$(null),B(!1);return}$(null),B(!0);let ce=!1;return(async()=>{try{const M=await e("fs/repoStatus",{path:t});ce||($({branch:M.branch,hash:M.head_hash,remoteUrl:M.remote_url}),B(!1))}catch{ce||($(null),B(!1))}})(),()=>{ce=!0}},[t,e]);const H=b.useCallback(ce=>{if(ce.type==="directory")if(ce.is_git_repo){if(k.has(ce.path))return;f(null),r(ce.path,ce.name)}else f(ce.path),E(ce.path)},[r,E,k]),J=b.useMemo(()=>N.sort((ce,M)=>ce.is_git_repo&&!M.is_git_repo?-1:!ce.is_git_repo&&M.is_git_repo?1:ce.name.localeCompare(M.name)),[N]),oe=b.useMemo(()=>A.sort((ce,M)=>ce.name.localeCompare(M.name)),[A]);return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-surface px-4 pb-4 pt-2.5",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1",children:[h?c.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-xs text-c4a-text-muted",children:[c.jsx("span",{children:i("sources.import.allowed_dirs")}),c.jsx(V1,{})]}):c.jsx("p",{className:"min-w-0 shrink truncate font-mono text-xs text-c4a-text-muted",children:p}),t&&R?c.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 font-mono text-xs text-c4a-accent",children:[c.jsx(Zt,{size:12,className:"animate-spin"}),c.jsx("span",{children:i("common.loading")})]}):t&&z?c.jsx(P1,{remoteUrl:z.remoteUrl,fallbackName:t.split("/").pop()||t,branch:z.branch,commit:z.hash}):!t&&S&&h?c.jsx("button",{onClick:()=>L(!0),className:"flex shrink-0 items-center gap-1.5 rounded border border-c4a-accent/40 bg-c4a-accent/10 px-2.5 py-1 text-xs text-c4a-accent transition-colors hover:bg-c4a-accent/20",children:i("sources.import.wildcard_goto")}):null]}),c.jsx("hr",{className:"my-2 border-c4a-border-subtle"}),h?S?c.jsx("div",{className:"min-h-0 flex-1 c4a-scrollbar overflow-y-auto",children:_&&c.jsxs("button",{onClick:()=>E(_),className:"flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(Gn,{size:14,className:"shrink-0"}),c.jsxs("span",{className:"truncate",children:[_,c.jsxs("span",{className:"ml-1.5 text-c4a-text-muted",children:["(",i("sources.import.wildcard_home"),")"]})]}),c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"})]})}):c.jsx("div",{className:"min-h-0 flex-1 c4a-scrollbar overflow-y-auto",children:a.map(ce=>c.jsxs("button",{onClick:()=>E(ce),className:"flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(Gn,{size:14,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:ce}),c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"})]},ce))}):v&&!x?c.jsx("p",{className:"py-4 text-xs text-c4a-error",children:v}):c.jsxs("div",{className:"relative min-h-[5rem] min-h-0 flex-1 c4a-scrollbar overflow-y-auto",children:[x&&c.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-c4a-bg-surface/60",children:c.jsx(Zt,{size:14,className:"animate-spin text-c4a-text-muted"})}),p!=="/"&&c.jsxs("button",{onClick:D,disabled:x,className:"flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs text-c4a-text-secondary hover:bg-c4a-bg-hover disabled:pointer-events-none",children:[c.jsx(vm,{size:14,className:"text-c4a-text-muted"}),c.jsx("span",{className:"leading-none pb-1",children:".."})]}),J.map(ce=>{const M=ce.is_git_repo&&k.has(ce.path),P=ce.is_git_repo?Ml:Gn;return c.jsxs("div",{className:`flex w-full items-center rounded pl-2 pr-4 text-left text-xs transition-colors ${M?"cursor-not-allowed text-c4a-accent/60":t===ce.path?"bg-c4a-bg-hover":"text-c4a-text-secondary hover:bg-c4a-bg-hover"}`,children:[c.jsxs("button",{onClick:()=>H(ce),disabled:M||x,className:"flex flex-1 items-center gap-2 py-1.5",children:[c.jsx(P,{size:14,className:"shrink-0"}),c.jsx("span",{className:"flex-1 truncate text-left",children:ce.name}),M&&c.jsx("span",{className:"rounded bg-c4a-accent/10 px-1.5 py-0.5 font-mono text-[10px] text-c4a-accent/60",children:i("sources.import.already_imported")})]}),!M&&c.jsx("button",{onClick:T=>{T.stopPropagation(),E(ce.path)},disabled:x,className:"shrink-0 rounded p-1 text-c4a-text-muted transition-colors hover:text-c4a-accent disabled:pointer-events-none",title:ce.path,children:c.jsx($t,{size:12})})]},ce.path)}),oe.map(ce=>c.jsxs("div",{className:"flex w-full items-center gap-2 pl-2 pr-4 py-1.5 text-xs text-c4a-text-muted",children:[c.jsx(wm,{size:14,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:ce.name})]},ce.path)),m.length===0&&!x&&c.jsx("p",{className:"py-4 text-center text-xs text-c4a-text-muted",children:i("sources.import.no_entries")})]}),u&&!t&&c.jsx("p",{className:"mt-3 text-xs text-c4a-warning",children:i("sources.import.not_git")}),c.jsx(Y1,{open:w,onClose:()=>L(!1),rpc:e,onNavigate:E,defaultPath:_??void 0})]})}const Ro=50,Kp=["main","master"];function mT(e){const t=[],r=[];for(const a of e)Kp.includes(a.name)?t.push(a):r.push(a);return t.sort((a,o)=>Kp.indexOf(a.name)-Kp.indexOf(o.name)),[...t,...r]}function lv(e,t,r){b.useEffect(()=>{if(!r)return;const a=o=>{e.current&&!e.current.contains(o.target)&&t()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t,r])}function X1({refs:e,loading:t,error:r,selectedRef:a,commit:o,onRefChange:i,onCommitChange:u,onValidChange:f,onBranchSwitch:h}){const{t:p}=ye(),[m,x]=b.useState(!1),[v,_]=b.useState(""),[w,S]=b.useState(!0),[k,N]=b.useState(!0),A=b.useRef(null),E=b.useRef(null),[D,L]=b.useState(!1),[z,$]=b.useState(""),R=b.useRef(null),B=b.useRef(null);lv(A,()=>{x(!1),_("")},m),lv(R,()=>{L(!1),$("")},D),b.useEffect(()=>{m&&setTimeout(()=>E.current?.focus(),0)},[m]),b.useEffect(()=>{D&&setTimeout(()=>B.current?.focus(),0)},[D]),b.useEffect(()=>{f(!!a)},[a,f]);const H=b.useCallback(W=>{i(W.name),u(W.commit),x(!1),_(""),h?.(W.name)},[i,u,h]),J=b.useCallback((W,O)=>{u(W),i(O),L(!1),$("")},[u,i]),oe=b.useMemo(()=>e?mT(e.branches):[],[e]),ce=b.useMemo(()=>{const W=v.toLowerCase();return(W?oe.filter(V=>V.name.toLowerCase().includes(W)):oe).slice(0,Ro)},[oe,v]),M=b.useMemo(()=>{if(!e)return[];const W=v.toLowerCase();return(W?e.tags.filter(V=>V.name.toLowerCase().includes(W)):e.tags).slice(0,Ro)},[e,v]),P=b.useMemo(()=>{if(!e)return[];if(e.commits&&e.commits.length>0){const se=z.toLowerCase(),ne=e.commits.map(ge=>({hash:ge.hash,refName:a||"",label:`${ge.hash.slice(0,8)} ${ge.message?`— ${ge.message.slice(0,50)}`:""}`.trim()}));return se?ne.filter(ge=>ge.hash.toLowerCase().includes(se)||ge.label.toLowerCase().includes(se)).slice(0,Ro):ne.slice(0,Ro)}const W=new Set,O=[],V=[...e.branches??[],...e.tags??[]];for(const se of V){const ne=se.commit.slice(0,8);W.has(se.commit)||(W.add(se.commit),O.push({hash:se.commit,refName:se.name,label:`${ne} (${se.name})`}))}if(!z)return O.slice(0,Ro);const re=z.toLowerCase();return O.filter(se=>se.hash.toLowerCase().includes(re)||se.label.toLowerCase().includes(re)).slice(0,Ro)},[e,z,a]),[T,F]=b.useState(!1);if(b.useEffect(()=>{if(!t){F(!1);return}const W=setTimeout(()=>F(!0),5e3);return()=>clearTimeout(W)},[t]),t)return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsx(Zt,{size:20,className:"animate-spin text-c4a-accent"}),c.jsx("span",{className:"mt-2 text-sm text-c4a-accent",children:p("sources.import_remote.loading_refs")}),T&&c.jsx("span",{className:"mt-1.5 text-xs text-c4a-text-muted",children:p("sources.import_remote.loading_refs_slow")})]});if(r)return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-sm font-medium text-red-400",children:[c.jsx(Or,{size:14,className:"shrink-0"}),p("sources.import.error_title")]}),c.jsx("p",{className:"mt-2 max-h-40 overflow-y-auto break-all font-mono text-xs leading-relaxed text-red-400/70",children:r})]});if(!e)return null;const ee=e.branches.find(W=>W.name===a)?.name??e.tags.find(W=>W.name===a)?.name??a,ae=o?o.slice(0,8):"";return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col space-y-4 rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block font-mono text-xs uppercase tracking-tight text-c4a-text-secondary",children:p("sources.import_remote.ref_label")}),c.jsxs("div",{ref:A,className:"relative mt-2",children:[c.jsxs("button",{onClick:()=>x(!m),className:"flex w-full items-center justify-between rounded border border-c4a-border-default bg-c4a-bg-surface px-3 py-2 font-mono text-sm font-semibold text-c4a-accent transition-colors hover:bg-c4a-bg-hover",children:[c.jsx("span",{children:ee||"—"}),c.jsx($t,{size:14,className:`text-c4a-text-muted transition-transform duration-200 ${m?"rotate-90":""}`})]}),m&&c.jsxs("div",{className:"absolute z-20 mt-1 w-full rounded border border-c4a-border-default bg-c4a-bg-elevated shadow-lg",children:[c.jsx("div",{className:"border-b border-c4a-border-default px-3 py-2.5",children:c.jsxs("div",{className:"flex items-center gap-2 rounded border border-c4a-border-default bg-c4a-bg-surface px-3 py-1.5",children:[c.jsx(gl,{size:14,className:"shrink-0 text-c4a-text-muted"}),c.jsx("input",{ref:E,type:"text",value:v,onChange:W=>_(W.target.value),placeholder:p("sources.import_remote.ref_search"),className:"w-full bg-transparent font-mono text-sm text-c4a-text-primary placeholder:text-c4a-text-muted focus:outline-none"})]})}),c.jsxs("div",{className:"flex max-h-80 flex-col md:flex-row",children:[ce.length>0&&c.jsxs("div",{className:"c4a-scrollbar min-w-0 flex-1 overflow-y-auto md:border-r md:border-c4a-border-default",children:[c.jsxs("button",{onClick:()=>S(!w),className:"flex w-full items-center gap-1.5 px-3 py-2 font-mono text-xs uppercase tracking-tight text-c4a-text-muted",children:[c.jsx($t,{size:12,className:`transition-transform duration-200 ${w?"rotate-90":""}`}),p("sources.import_remote.ref_branches")," (",e.branches.length,")"]}),w&&ce.map(W=>c.jsxs("button",{onClick:()=>H(W),className:`flex w-full items-center justify-between px-3 py-1.5 font-mono text-sm transition-colors hover:bg-c4a-bg-hover ${W.name===a?"font-semibold text-c4a-accent":"text-c4a-text-secondary"}`,children:[c.jsx("span",{className:"truncate",children:W.name}),W.name===a&&c.jsx("span",{children:"✓"})]},`b-${W.name}`))]}),M.length>0&&c.jsxs("div",{className:"c4a-scrollbar min-w-0 flex-1 overflow-y-auto border-t border-c4a-border-default md:border-t-0",children:[c.jsxs("button",{onClick:()=>N(!k),className:"flex w-full items-center gap-1.5 px-3 py-2 font-mono text-xs uppercase tracking-tight text-c4a-text-muted",children:[c.jsx($t,{size:12,className:`transition-transform duration-200 ${k?"rotate-90":""}`}),p("sources.import_remote.ref_tags")," (",e.tags.length,")"]}),k&&M.map(W=>c.jsxs("button",{onClick:()=>H(W),className:`flex w-full items-center justify-between px-3 py-1.5 font-mono text-sm transition-colors hover:bg-c4a-bg-hover ${W.name===a?"font-semibold text-c4a-accent":"text-c4a-text-secondary"}`,children:[c.jsx("span",{className:"truncate",children:W.name}),W.name===a&&c.jsx("span",{children:"✓"})]},`t-${W.name}`))]})]}),ce.length===0&&M.length===0&&c.jsx("div",{className:"px-3 py-4 text-center font-mono text-sm text-c4a-text-muted",children:"No matches"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block font-mono text-xs uppercase tracking-tight text-c4a-text-secondary",children:p("sources.import_remote.commit_label")}),c.jsxs("div",{ref:R,className:"relative mt-2",children:[c.jsxs("button",{onClick:()=>L(!D),className:"flex w-full items-center justify-between rounded border border-c4a-border-default bg-c4a-bg-surface px-3 py-2 font-mono text-sm font-semibold text-c4a-accent transition-colors hover:bg-c4a-bg-hover",children:[c.jsx("span",{className:o?"":"font-normal text-c4a-text-muted",children:ae||"—"}),c.jsx($t,{size:14,className:`text-c4a-text-muted transition-transform duration-200 ${D?"rotate-90":""}`})]}),D&&c.jsxs("div",{className:"c4a-scrollbar absolute z-20 mt-1 max-h-64 w-full overflow-y-auto rounded border border-c4a-border-default bg-c4a-bg-elevated shadow-lg",children:[c.jsx("div",{className:"sticky top-0 z-10 border-b border-c4a-border-default bg-c4a-bg-elevated px-3 py-2",children:c.jsxs("div",{className:"flex items-center gap-2 rounded border border-c4a-border-default bg-c4a-bg-surface px-2 py-1",children:[c.jsx(gl,{size:12,className:"shrink-0 text-c4a-text-muted"}),c.jsx("input",{ref:B,type:"text",value:z,onChange:W=>$(W.target.value),placeholder:p("sources.import_remote.commit_search"),className:"w-full bg-transparent font-mono text-xs text-c4a-text-primary placeholder:text-c4a-text-muted focus:outline-none"})]})}),P.map(W=>c.jsxs("button",{onClick:()=>J(W.hash,W.refName),className:"flex w-full items-center justify-between px-3 py-1.5 font-mono text-sm text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx("span",{className:"truncate",children:W.label}),W.hash===o&&c.jsx("span",{className:"text-c4a-accent",children:"✓"})]},W.hash)),P.length===0&&c.jsx("div",{className:"px-3 py-4 text-center font-mono text-xs text-c4a-text-muted",children:"No matches"})]})]}),c.jsxs("p",{className:"mt-3 flex items-center gap-1.5 text-xs text-c4a-text-muted",children:[c.jsx(zC,{size:12,className:"shrink-0"}),p("sources.import_remote.commit_hint")]})]})]})}const gT="_progressTrack_1cl9k_1",xT="_progressFill_1cl9k_9",yT="_progressFillComplete_1cl9k_45",bT="_progressFillFailed_1cl9k_49",iu={progressTrack:gT,progressFill:xT,progressFillComplete:yT,progressFillFailed:bT};function vT(e){const t={},r=100/e.length;return e.forEach((a,o)=>{t[a.key]=Math.round(r*(o+1))}),t}function _T(e,t,r,a,o,i){const u=m=>m>0?t[e[m-1].key]??0:0;if(o){const m=e.findIndex(_=>_.key===o),x=u(m),v=t[o]??100;return x+i/100*(v-x)}if(!r)return a.length===e.length?100:0;const f=e.findIndex(m=>m.key===r);if(f<0)return 0;const h=u(f),p=t[r]??100;return i>=0?h+i/100*(p-h):h}function Q1({stages:e,currentStage:t,completedStages:r,failedStage:a,progress:o,breakpoints:i,headerRight:u}){const f=i??vT(e),h=o?.percent??-1,p=b.useRef(0),[m,x]=b.useState(0),v=b.useRef(null),_=_T(e,f,t,r,a,h>=0?h:-1);p.current=_,b.useEffect(()=>{_>m&&x(_)},[_]),b.useEffect(()=>{if(!t||a){v.current&&(clearInterval(v.current),v.current=null);return}const E=e.findIndex(R=>R.key===t),D=f[t]??100,L=E===e.length-1?D-1:D-2,z=500,$=.025;return v.current=setInterval(()=>{x(R=>{const B=p.current;if(R>=B&&R<L){const H=Math.max(.1,(L-R)*$);return Math.min(R+H,L)}return R})},z),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[t,a,e,f]);const w=b.useRef(null);b.useEffect(()=>{if(r.length===e.length&&!a)return v.current&&(clearInterval(v.current),v.current=null),w.current=setInterval(()=>{x(E=>E>=100?(w.current&&clearInterval(w.current),w.current=null,100):Math.min(100,E+4))},32),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[r.length,e.length,a]);const S=Math.min(100,Math.max(0,m)),k=!!t&&!a,N=!!a,A=r.length===e.length&&!a;return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2 flex-wrap",children:e.map(E=>{const D=r.includes(E.key),L=a===E.key,z=t===E.key;let $="inline-flex items-center gap-1.5 rounded-sm px-2 py-0.5 font-mono text-[11px] uppercase tracking-tight transition-colors";return L?$+=" bg-red-500/10 text-red-400":D?$+=" bg-c4a-accent/10 text-c4a-accent":z?$+=" bg-c4a-accent/15 text-c4a-accent":$+=" bg-c4a-bg-elevated text-c4a-text-muted",c.jsxs("span",{className:$,children:[L?c.jsx(Or,{size:10,className:"shrink-0"}):D?c.jsx(Wr,{size:10,className:"shrink-0"}):z?c.jsx(Zt,{size:10,className:"shrink-0 animate-spin"}):c.jsx(rC,{size:8,className:"shrink-0 opacity-40"}),E.label]},E.key)})}),u&&c.jsx("div",{className:"shrink-0",children:u})]}),c.jsx("div",{className:iu.progressTrack,children:S>0?c.jsx("div",{className:`${iu.progressFill} ${N?iu.progressFillFailed:A?iu.progressFillComplete:""}`,style:{width:`${S}%`}},"fill"):null}),c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"font-mono text-[11px] text-c4a-text-muted tabular-nums",children:A?"100%":k||N?`${Math.round(S)}%`:""}),o?.label&&k&&c.jsx("span",{className:"hidden truncate font-mono text-[11px] text-c4a-text-muted sm:block",children:o.label})]})]})}function Z1({stages:e,currentStage:t,completedStages:r,failedStage:a,progress:o,breakpoints:i,failedError:u,logs:f}){const h=b.useRef(null);return b.useEffect(()=>{h.current?.scrollIntoView({behavior:"smooth"})},[f.length]),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsx(Q1,{stages:e,currentStage:t,completedStages:r,failedStage:a,progress:o,...i?{breakpoints:i}:{}}),c.jsxs("div",{className:"mt-4 min-h-0 flex-1 rounded bg-c4a-bg-base p-3 c4a-scrollbar overflow-y-auto",children:[f.map((p,m)=>c.jsx("p",{className:"font-mono text-xs text-c4a-text-muted leading-relaxed",children:p},m)),c.jsx("div",{ref:h})]}),a&&u&&c.jsx("div",{className:"mt-3 max-h-32 overflow-y-auto rounded-sm bg-red-500/5 px-4 py-3",children:c.jsx("p",{className:"break-all font-mono text-xs leading-relaxed text-red-400/80",children:u})})]})}function ln({icon:e,label:t,value:r,tooltip:a,size:o="sm"}){const i=o==="sm";return c.jsxs("div",{className:"group/stat relative rounded-lg border border-c4a-border-subtle bg-c4a-bg-base p-3",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-c4a-text-muted [&>svg]:size-4",children:[e,c.jsx("span",{className:"font-mono text-xs uppercase",children:t})]}),c.jsx("p",{className:`mt-1 font-mono font-bold text-c4a-text-secondary ${i?"text-sm truncate":"text-lg"}`,title:i?String(r):void 0,children:r}),a&&c.jsx("div",{className:"pointer-events-none absolute bottom-full left-0 z-30 mb-1.5 hidden w-max max-w-[260px] rounded border border-c4a-border-default bg-c4a-bg-elevated px-2.5 py-1.5 text-[11px] leading-relaxed text-c4a-text-secondary shadow-c4a-lg group-hover/stat:block",children:a})]})}const Xp=100;function J1({repoName:e,repoIdentifier:t,branch:r,commit:a,packages:o,mdFiles:i,importing:u,completed:f,importMethod:h}){const{t:p}=ye(),m=a?a.slice(0,7):"",[x,v]=b.useState("packages"),[_,w]=b.useState(Xp),S=b.useRef(null),k=b.useRef(null);b.useEffect(()=>{w(Xp),k.current?.scrollTo(0,0)},[x]),b.useEffect(()=>{const L=S.current;if(!L)return;const z=x==="packages"?o.length:i.length;if(_>=z)return;const $=new IntersectionObserver(R=>{R[0]?.isIntersecting&&w(B=>Math.min(B+Xp,z))},{root:k.current,threshold:.1});return $.observe(L),()=>$.disconnect()},[x,_,o.length,i.length]);const N=x==="packages"?o:i,A=N.slice(0,_),E=_<N.length,D=b.useMemo(()=>f?p("sources.import_remote.complete"):u?p("sources.import.importing"):p("sources.import.confirm_heading",{name:e}),[f,u,e,p]);return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-surface p-6",children:[c.jsx("p",{className:"text-sm text-c4a-text-secondary",children:D}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3 gap-y-1",children:[c.jsx("span",{className:"font-mono text-sm font-bold text-c4a-accent",children:e}),c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:t})]}),c.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-4",children:[c.jsx(ln,{icon:c.jsx(Uu,{size:14}),label:p("sources.import.branch"),value:r}),c.jsx(ln,{icon:c.jsx(EC,{size:14}),label:p("sources.import.commit"),value:m}),c.jsx(ln,{icon:c.jsx(Dr,{size:14}),label:p("sources.import.packages"),value:String(o.length),tooltip:p("sources.import.dir_code_packages_tip")}),c.jsx(ln,{icon:c.jsx(On,{size:14}),label:p("sources.import.documents"),value:String(i.length),tooltip:p("sources.import.dir_doc_files_tip")})]}),h&&c.jsxs("p",{className:"mt-3 font-mono text-xs text-c4a-text-muted",children:[p("sources.import_remote.api.method"),":"," ",c.jsx("span",{className:"text-c4a-accent",children:p(h==="api"?"sources.import_remote.api.method_api":"sources.import_remote.api.method_clone")})]}),u&&c.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2 rounded bg-c4a-bg-base p-3",children:[c.jsx(Zt,{size:14,className:"animate-spin text-c4a-accent"}),c.jsx("p",{className:"font-mono text-xs text-c4a-accent",children:p("sources.import.importing")})]}),(o.length>0||i.length>0)&&c.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-base",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-3",children:[c.jsx("p",{className:"hidden font-mono text-xs text-c4a-text-secondary sm:block",children:p("sources.import.recognized",{packages:o.length,docs:i.length})}),c.jsxs("div",{className:"flex rounded border border-c4a-border-subtle",children:[c.jsxs("button",{onClick:()=>v("packages"),className:`flex items-center gap-1 px-2.5 py-1 text-xs transition-colors ${x==="packages"?"bg-c4a-accent/10 text-c4a-accent":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,children:[c.jsx(Dr,{size:13}),c.jsx("span",{className:"font-mono",children:o.length})]}),c.jsxs("button",{onClick:()=>v("docs"),className:`flex items-center gap-1 border-l border-c4a-border-subtle px-2.5 py-1 text-xs transition-colors ${x==="docs"?"bg-c4a-accent/10 text-c4a-accent":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,children:[c.jsx(On,{size:13}),c.jsx("span",{className:"font-mono",children:i.length})]})]})]}),c.jsx("hr",{className:"border-c4a-border-subtle"}),c.jsx("div",{ref:k,className:"min-h-0 flex-1 c4a-scrollbar overflow-y-auto px-2 py-1",children:N.length===0?c.jsx("p",{className:"py-8 text-center text-xs text-c4a-text-muted",children:x==="packages"?p("sources.import.no_packages"):"—"}):c.jsxs(c.Fragment,{children:[x==="packages"?A.map(L=>c.jsxs("div",{className:"flex items-center gap-2 rounded pl-2 pr-4 py-1 text-xs",children:[c.jsx(Dr,{size:14,className:"shrink-0 text-c4a-accent"}),c.jsx("span",{className:"text-c4a-text-secondary",children:L.name}),c.jsx("span",{className:"hidden truncate text-c4a-text-muted sm:inline",children:L.path}),L.isRoot&&c.jsx("span",{className:"rounded bg-c4a-bg-active px-1 py-0.5 font-mono text-[10px] text-c4a-text-muted",children:"root"})]},L.path)):A.map(L=>c.jsxs("div",{className:"flex items-center gap-2 rounded pl-2 pr-4 py-1 text-xs",children:[c.jsx(On,{size:14,className:"shrink-0 text-c4a-text-secondary"}),c.jsx("span",{className:"truncate text-c4a-text-secondary",children:L})]},L)),E&&c.jsx("div",{ref:S,className:"h-4"})]})})]})]})}const wT=["scan","save"],lu={scan:"sources.import.stage.scan",save:"sources.import.stage.save"},ST={scan:20,save:90};function jT(){const{t:e}=ye(),t=Tt(),{libId:r}=Vo(),[a]=Ol(),i=Qt(ds(qs)).find(Le=>Le.id===r),u=kt(Le=>Le.createSource),f=a.get("parentId")||"",h=a.get("parentName")||"",p=a.get("parentPath")||"",[m,x]=b.useState(1),[v,_]=b.useState(null),[w,S]=b.useState({repoPath:"",repoName:"",branch:"",branches:[],commit:"",commits:[],isDirty:!1,repoFiles:[],packages:[],mdFiles:[],repoFileContents:[]}),[k,N]=b.useState(null),[A,E]=b.useState(!1),[D,L]=b.useState(null),[z,$]=b.useState(""),[R,B]=b.useState(""),[H,J]=b.useState(!1),[oe,ce]=b.useState(!1),[M,P]=b.useState(!1),[T,F]=b.useState(null),[ee,ae]=b.useState([]),[W,O]=b.useState(null),[V,re]=b.useState(null),[se,ne]=b.useState([]),ge=b.useRef(null),Ne=i?.is_online??!1,{rpc:Fe,importedPaths:qe,allowedPaths:be}=F1(r,i),fe=b.useMemo(()=>wT.map(Le=>({key:Le,label:lu[Le]?e(lu[Le]):Le})),[e]),_e=b.useCallback(Le=>{ne(Ze=>[...Ze,`[${zh()}] ${Le}`])},[]),he=b.useRef(null),ve=b.useCallback(Le=>{const Ze=he.current;Ze&&Ze!==Le&&(ae(We=>We.includes(Ze)?We:[...We,Ze]),_e(`${e(lu[Ze]??Ze)} ${e("sources.import.stage.done_suffix")}`)),_e(`${e(lu[Le]??Le)}...`),he.current=Le,F(Le),re(null)},[_e,e]),Ve=b.useCallback((Le,Ze)=>{S(We=>({...We,repoPath:Le,repoName:Ze}))},[]),De=b.useCallback(async()=>{E(!0),L(null);try{const Le=await Fe("fs/repoStatus",{path:w.repoPath}),Ze={branches:Le.branches??[{name:Le.branch,commit:Le.head_hash}],tags:Le.tags??[],default:Le.branch,commits:Le.commits??[{hash:Le.head_hash,message:"HEAD"}]};N(Ze),S(We=>({...We,isDirty:Le.is_dirty})),$(We=>{if(We)return We;const Nt=Ze.branches.find(mn=>mn.name===Ze.default),ft=Ze.branches[0],Rn=Nt??ft;return Rn?(B(Rn.commit),Rn.name):We})}catch(Le){const Ze=Le instanceof Error?Le.message:"Failed to load repository info";L(Ze)}finally{E(!1)}},[Fe,w.repoPath]);b.useEffect(()=>{m===2&&w.repoPath&&!k&&De()},[m,w.repoPath,k,De]);const Xe=b.useCallback(async Le=>{try{const Ze=await Fe("fs/repoStatus",{path:w.repoPath,branch:Le});N(We=>We&&{...We,commits:Ze.commits??[]})}catch{}},[Fe,w.repoPath]),It=b.useCallback(async()=>{if(!r)return;const Le=Date.now();ce(!0),P(!1),_(null),O(null),ae([]),he.current=null,F(null),re(null),ne([]),x(3);try{ve("scan");const Ze=await Fe("fs/repoScan",{path:w.repoPath,hash:R}),We=Ze.files||[],Nt=Ze.manifests||[],ft=Os(w.repoPath),{packages:Rn,mdFiles:mn}=Mh(Nt,We,ft);S(Et=>({...Et,branch:z,commit:R,repoFiles:We,packages:Rn,mdFiles:mn,repoFileContents:Nt})),ve("save");const gn=await u({library_id:r,repo_name:w.repoName||ft,repo_root_path:w.repoPath,repo_branch:z,repo_commit:R,repo_files:We.map(Et=>Et.path),repo_file_contents:Nt,...f?{parent_source_id:f,parent_path:p}:{}});ae(["scan","save"]),he.current=null,F(null),_e(`${e("sources.import.stage.save")} ${e("sources.import.stage.done_suffix")}`),_e(e("sources.import.stage.complete"));const Lt=Array.isArray(gn)?gn[0]:gn;ge.current=Lt?.id??null,await G1(Le),P(!0),ce(!1),x(4)}catch(Ze){const We=he.current??"scan";O(We),he.current=null,F(null);const Nt=Ze instanceof Error?Ze.message:String(Ze);_e(`ERROR: ${Nt}`),_(Nt),ce(!1)}},[r,w,z,R,f,p,Fe,u,ve,_e]),un=b.useCallback(()=>{O(null),_(null),It()},[It]),Vt=b.useCallback(()=>{if(r)if(f){const Le=w.repoName||Os(w.repoPath),Ze=p?`${p}/${Le}`:Le;t(`/studio/sources/${r}?rootId=${f}&path=${encodeURIComponent(Ze)}`)}else ge.current?t(`/studio/sources/${r}?rootId=${ge.current}`):t(`/studio/sources/${r}`)},[r,t,f,p,w.repoPath,w.repoName]),Bn=b.useMemo(()=>m===1?!!w.repoPath:m===2?H:m===3?M:!1,[m,w.repoPath,H,M]),cr=b.useMemo(()=>{if(!i)return[];const Le=[{label:i.is_default?e("sources.library.default_cloud_name"):i.name,to:`/studio/sources/${i.id}`}];if(f&&(Le.push({label:h||f,to:`/studio/sources/${i.id}?rootId=${f}`}),p)){const Ze=p.split("/").filter(Boolean);for(const[We,Nt]of Ze.entries()){const ft=Ze.slice(0,We+1).join("/");Le.push({label:Nt,to:`/studio/sources/${i.id}?rootId=${f}&path=${encodeURIComponent(ft)}`})}}return Le.push({label:e("sources.import.title")}),Le},[i,f,h,p,e]);if(!i)return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})});const Xn=m===4,Ht=m===3&&!!W&&!oe,An=m<=2;return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-4 md:p-6",children:[c.jsx("div",{className:"shrink-0",children:c.jsx(Ta,{segments:cr})}),c.jsxs("div",{className:"mt-3 flex shrink-0 items-center gap-2 font-mono text-sm sm:mt-6 md:gap-3",children:[c.jsx(Xr,{active:m>=1,current:m===1}),c.jsx("span",{className:m===1?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.select")}),c.jsx($s,{}),c.jsx(Xr,{active:m>=2,current:m===2}),c.jsx("span",{className:m===2?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.version")}),c.jsx($s,{}),c.jsx(Xr,{active:m>=3,current:m===3}),c.jsx("span",{className:m===3?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.loading")}),c.jsx($s,{}),c.jsx(Xr,{active:m>=4,current:m===4}),c.jsx("span",{className:m===4?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.confirm")})]}),c.jsx("div",{className:"mt-3 flex min-h-0 flex-1 flex-col sm:mt-6",children:Ne?c.jsxs(c.Fragment,{children:[m===1&&c.jsx(hT,{rpc:Fe,selectedPath:w.repoPath,onSelect:Ve,allowedPaths:be,importedPaths:qe}),m===2&&c.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:c.jsx(X1,{refs:k,loading:A,error:D,selectedRef:z,commit:R,onRefChange:$,onCommitChange:B,onValidChange:J,onRetry:De,onBranchSwitch:Xe})}),m===3&&c.jsx(Z1,{stages:fe,currentStage:T,completedStages:ee,failedStage:W,progress:V,breakpoints:ST,failedError:v,logs:se}),m===4&&c.jsx(J1,{repoName:w.repoName||Os(w.repoPath),repoIdentifier:w.repoPath,branch:z,commit:R,packages:w.packages,mdFiles:w.mdFiles,importing:!1,completed:M})]}):c.jsx(q1,{libraryName:i.name})}),Ne&&c.jsx(c.Fragment,{children:Xn?c.jsx("div",{className:"mt-3 flex shrink-0 justify-end sm:mt-6",children:c.jsx("button",{onClick:Vt,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("sources.import.done")})}):Ht?c.jsxs("div",{className:"mt-3 flex shrink-0 justify-end gap-2 sm:mt-6",children:[c.jsx("button",{onClick:()=>{x(2),O(null),_(null),ae([]),he.current=null,F(null),ne([])},className:"rounded border border-c4a-border-default px-4 py-2 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:e("sources.import.back")}),c.jsx("button",{onClick:un,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("sources.import.retry")})]}):An?c.jsx(km,{step:m,totalSteps:4,importing:oe,stepBusy:A||m===3&&oe,canProceed:Bn,safetyNoticeKey:"sources.safety.notice.repo",confirmLabelKey:"sources.import.step.confirm",onPrev:()=>x(Le=>Le-1),onNext:()=>{m===2?It():x(Le=>Le+1)},onImport:It}):null}),v&&m!==3&&c.jsxs(lr,{onClose:()=>_(null),className:"mx-4 w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-error",children:e("sources.import.error_title")}),c.jsx("p",{className:"mt-3 whitespace-pre-wrap break-all text-sm text-c4a-text-secondary",children:v}),c.jsx("div",{className:"mt-6 flex justify-end",children:c.jsx("button",{onClick:()=>_(null),className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("common.confirm")})})]})]})}const cv=(e,t)=>{let r=0,a=0,o=0;const i=[],u=f=>{for(const h of f)if(h.type==="directory")a++,h.is_git_repo&&o++,h.children&&u(h.children);else if(r++,/\.md$/i.test(h.name)){const p=h.path.startsWith(t)?h.path.slice(t.length).replace(/^\//,""):h.name;i.push(p)}};return u(e),{files:r,dirs:a,gitRepos:o,mdFiles:i}};function kT({rpc:e,selectedPath:t,onSelect:r,allowedPaths:a,importedPaths:o}){const{t:i}=ye(),{atRoot:u,currentPath:f,entries:h,loading:p,error:m,homeDir:x,goToOpen:v,isWildcard:_,importedSet:w,dirs:S,files:k,loadTree:N,handleNavigateUp:A,setGoToOpen:E}=K1({rpc:e,allowedPaths:a??[],importedPaths:o??[]}),D=b.useCallback(R=>{if(R.type!=="directory"||w.has(R.path))return;const B=cv(R.children||[],R.path);r(R.path,R.name,B),N(R.path)},[r,N,w]);b.useEffect(()=>{if(f&&!u&&h.length>=0&&!p){const R=f.split("/").pop()||f,B=cv(h,f);r(f,R,B)}},[f,u,h,p,r]);const L=b.useMemo(()=>t?t.split("/").pop()||t:"",[t]),z=b.useMemo(()=>S.sort((R,B)=>R.is_git_repo&&!B.is_git_repo?-1:!R.is_git_repo&&B.is_git_repo?1:R.name.localeCompare(B.name)),[S]),$=b.useMemo(()=>k.sort((R,B)=>R.name.localeCompare(B.name)),[k]);return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-surface px-4 pb-4 pt-2.5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[u?c.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-xs text-c4a-text-muted",children:[c.jsx("span",{children:i("sources.import.allowed_dirs")}),c.jsx(V1,{})]}):c.jsx("p",{className:"min-w-0 truncate font-mono text-xs text-c4a-text-muted",children:f}),t?c.jsxs("p",{className:"flex shrink-0 items-center gap-2 font-mono text-xs text-c4a-accent",children:[c.jsx(Gn,{size:12}),c.jsx("span",{children:L})]}):_&&u?c.jsx("button",{onClick:()=>E(!0),className:"flex shrink-0 items-center gap-1.5 rounded border border-c4a-accent/40 bg-c4a-accent/10 px-2.5 py-1 text-xs text-c4a-accent transition-colors hover:bg-c4a-accent/20",children:i("sources.import.wildcard_goto")}):null]}),c.jsx("hr",{className:"my-2 border-c4a-border-subtle"}),u?_?c.jsx("div",{className:"min-h-0 flex-1 c4a-scrollbar overflow-y-auto",children:x&&c.jsxs("button",{onClick:()=>N(x),className:"flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(Gn,{size:14,className:"shrink-0"}),c.jsxs("span",{className:"truncate",children:[x,c.jsxs("span",{className:"ml-1.5 text-c4a-text-muted",children:["(",i("sources.import.wildcard_home"),")"]})]}),c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"})]})}):c.jsx("div",{className:"min-h-0 flex-1 c4a-scrollbar overflow-y-auto",children:a.map(R=>c.jsxs("button",{onClick:()=>N(R),className:"flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(Gn,{size:14,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:R}),c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"})]},R))}):m&&!p?c.jsx("p",{className:"py-4 text-xs text-c4a-error",children:m}):c.jsxs("div",{className:"relative min-h-[5rem] min-h-0 flex-1 c4a-scrollbar overflow-y-auto",children:[p&&c.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-c4a-bg-surface/60",children:c.jsx(Zt,{size:14,className:"animate-spin text-c4a-text-muted"})}),f!=="/"&&c.jsxs("button",{onClick:A,disabled:p,className:"flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs text-c4a-text-secondary hover:bg-c4a-bg-hover disabled:pointer-events-none",children:[c.jsx(vm,{size:14,className:"text-c4a-text-muted"}),c.jsx("span",{className:"leading-none pb-1",children:".."})]}),z.map(R=>{const B=w.has(R.path),H=R.is_git_repo?Ml:Gn;return c.jsxs("button",{onClick:()=>D(R),disabled:B||p,className:`flex w-full items-center gap-2 rounded pl-2 pr-4 py-1.5 text-left text-xs transition-colors ${B?"cursor-not-allowed text-c4a-accent/60":t===R.path?"bg-c4a-accent/10 text-c4a-accent":"text-c4a-text-secondary hover:bg-c4a-bg-hover"}`,children:[c.jsx(H,{size:14,className:"shrink-0"}),c.jsx("span",{className:"flex-1 truncate",children:R.name}),B&&c.jsx("span",{className:"rounded bg-c4a-accent/10 px-1.5 py-0.5 font-mono text-[10px] text-c4a-accent/60",children:i("sources.import.already_imported")}),c.jsx($t,{size:12,className:"shrink-0 text-c4a-text-muted"})]},R.path)}),$.map(R=>c.jsxs("div",{className:"flex w-full items-center gap-2 pl-2 pr-4 py-1.5 text-xs text-c4a-text-muted",children:[c.jsx(wm,{size:14,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:R.name})]},R.path)),h.length===0&&!p&&c.jsx("p",{className:"py-4 text-center text-xs text-c4a-text-muted",children:i("sources.import.no_entries")})]}),c.jsx(Y1,{open:v,onClose:()=>E(!1),rpc:e,onNavigate:N,defaultPath:x??void 0})]})}const NT=new Set(["package.json","pyproject.toml","setup.py","go.mod","cargo.toml","pom.xml","build.gradle"]),ET=e=>{let t=0,r=0,a=0,o=0,i=0;const u=new Set;for(const f of e)if(f.type==="directory")r++,f.is_git_repo&&i++;else{t++,f.path.toLowerCase().endsWith(".md")&&o++;const p=f.path.split("/").pop();if(p&&NT.has(p.toLowerCase())){const m=f.path.split("/").slice(0,-1).join("/");e.some(v=>v.type==="directory"&&v.is_git_repo&&(m===v.path||m.startsWith(`${v.path}/`)))||u.add(m)}}return a=u.size,{totalFiles:t,totalDirs:r,codePackages:a,docFiles:o,gitRepos:i}};function CT({dirPath:e,rpc:t,importing:r,onScanComplete:a,onBusyChange:o}){const{t:i}=ye(),[u,f]=b.useState(!1),[h,p]=b.useState(null),[m,x]=b.useState(null),v=b.useCallback(async()=>{f(!0),o?.(!0),p(null),x(null);try{const _=await t("fs/dirScan",{path:e}),w=_.entries||[],S=_.manifests||[],k=ET(w);x(k),a(w,k,S)}catch(_){const w=_ instanceof Error?_.message:String(_);p(w)}finally{f(!1),o?.(!1)}},[e,t,a,o]);return b.useEffect(()=>{v()},[v]),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded border border-c4a-border-subtle bg-c4a-bg-surface p-6",children:[c.jsx("p",{className:"shrink-0 font-mono text-xs text-c4a-text-muted",children:e}),c.jsx("div",{className:"mt-3 shrink-0 border-t border-c4a-border-subtle"}),c.jsxs("div",{className:"c4a-scrollbar min-h-0 flex-1 overflow-y-auto",children:[u&&c.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 rounded bg-c4a-bg-base p-4",children:[c.jsx(Zt,{size:14,className:"animate-spin text-c4a-accent"}),c.jsx("p",{className:"font-mono text-xs text-c4a-accent",children:i("sources.import.dir_scanning")})]}),h&&c.jsxs("div",{className:"mt-6",children:[c.jsxs("p",{className:"flex items-start gap-2 text-xs text-c4a-error",children:[c.jsx(L1,{size:14,className:"mt-0.5 shrink-0"}),i("sources.import.dir_scan_error")]}),c.jsx("p",{className:"mt-1 text-xs text-c4a-text-muted",children:h}),c.jsxs("button",{onClick:v,className:"mt-3 flex items-center gap-1.5 rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:[c.jsx(fA,{size:12}),i("sources.import.dir_scan_retry")]})]}),m&&!u&&!h&&c.jsxs("div",{className:"mt-6 space-y-3",children:[c.jsxs("p",{className:"font-mono text-sm uppercase text-c4a-accent",children:[i("sources.import.dir_scan_complete"),"!"]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3 lg:grid-cols-5",children:[c.jsx(ln,{icon:c.jsx(On,{size:14}),label:i("sources.import.dir_doc_files"),value:m.docFiles,tooltip:i("sources.import.dir_doc_files_tip"),size:"lg"}),c.jsx(ln,{icon:c.jsx(Dr,{size:14}),label:i("sources.import.dir_code_packages"),value:m.codePackages,tooltip:i("sources.import.dir_code_packages_tip"),size:"lg"}),m.gitRepos>0&&c.jsx(ln,{icon:c.jsx(Ml,{size:14}),label:i("sources.import.dir_git_repos"),value:m.gitRepos,size:"lg"}),c.jsx(ln,{icon:c.jsx(Gn,{size:14}),label:i("sources.import.dir_total_dirs"),value:m.totalDirs,size:"lg"}),c.jsx(ln,{icon:c.jsx(xC,{size:14}),label:i("sources.import.dir_total_files"),value:m.totalFiles,size:"lg"})]}),m.gitRepos>0&&c.jsx("p",{className:"text-xs text-c4a-warning",children:i("sources.import.dir_git_skip_hint",{count:m.gitRepos})})]}),r&&c.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2 rounded bg-c4a-bg-base p-3",children:[c.jsx(Zt,{size:14,className:"animate-spin text-c4a-accent"}),c.jsx("p",{className:"font-mono text-xs text-c4a-accent",children:i("sources.import.importing")})]})]})]})}function AT(){const{t:e}=ye(),t=Tt(),{libId:r}=Vo(),o=Qt(ds(qs)).find(B=>B.id===r),i=kt(B=>B.createSource),[u,f]=b.useState(1),[h,p]=b.useState(!1),[m,x]=b.useState(null),[v,_]=b.useState(!1),[w,S]=b.useState({dirPath:"",dirName:"",fileCount:0,subDirCount:0,gitRepoCount:0,mdFiles:[],scanEntries:[],scanStats:null,manifests:[]}),k=o?.is_online??!1,{rpc:N,importedPaths:A,allowedPaths:E}=F1(r,o),D=b.useCallback((B,H,J)=>{S(oe=>({...oe,dirPath:B,dirName:H,fileCount:J.files,subDirCount:J.dirs,gitRepoCount:J.gitRepos,mdFiles:J.mdFiles}))},[]),L=b.useCallback((B,H,J)=>{S(oe=>({...oe,scanEntries:B,scanStats:H,manifests:J}))},[]),z=b.useCallback(async()=>{if(r){p(!0);try{const B=await i({library_id:r,dir_files:w.scanEntries,dir_name:w.dirName,dir_path:w.dirPath,dir_file_contents:w.manifests}),H=Array.isArray(B)?B[0]:B;H?.id?t(`/studio/sources/${r}?rootId=${H.id}`):t(`/studio/sources/${r}`)}catch(B){const H=B instanceof Error?B.message:String(B);x(H),p(!1)}}},[r,w,i,t]),$=b.useMemo(()=>u===1?!!w.dirPath:u===2?w.scanEntries.length>0:!0,[u,w]),R=b.useMemo(()=>o?[{label:o.is_default?e("sources.library.default_cloud_name"):o.name,to:`/studio/sources/${o.id}`},{label:e("sources.import.dir_title")}]:[],[o,e]);return o?c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-4 md:p-6",children:[c.jsx("div",{className:"shrink-0",children:c.jsx(Ta,{segments:R})}),c.jsxs("div",{className:"mt-3 flex shrink-0 items-center gap-2 font-mono text-sm sm:mt-6 md:gap-3",children:[c.jsx(Xr,{active:u>=1,current:u===1}),c.jsx("span",{className:u===1?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.dir_step.select")}),c.jsx($s,{}),c.jsx(Xr,{active:u>=2,current:u===2}),c.jsx("span",{className:u===2?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.dir_step.confirm")})]}),c.jsx("div",{className:"mt-3 flex min-h-0 flex-1 flex-col sm:mt-6",children:k?c.jsxs(c.Fragment,{children:[u===1&&c.jsx(kT,{rpc:N,selectedPath:w.dirPath,onSelect:D,allowedPaths:E,importedPaths:A}),u===2&&c.jsx(CT,{dirPath:w.dirPath,rpc:N,importing:h,onScanComplete:L,onBusyChange:_})]}):c.jsx(q1,{libraryName:o.name})}),k&&c.jsx(km,{step:u,totalSteps:2,importing:h,stepBusy:v,canProceed:$,safetyNoticeKey:"sources.safety.notice.dir",confirmLabelKey:"sources.import.dir_step.confirm",onPrev:()=>f(B=>B-1),onNext:()=>f(B=>B+1),onImport:z}),m&&c.jsxs(lr,{onClose:()=>x(null),className:"mx-4 w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsx("h3",{className:"font-mono text-sm font-bold uppercase text-c4a-error",children:e("sources.import.error_title")}),c.jsx("p",{className:"mt-3 whitespace-pre-wrap break-all text-sm text-c4a-text-secondary",children:m}),c.jsx("div",{className:"mt-6 flex justify-end",children:c.jsx("button",{onClick:()=>x(null),className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("common.confirm")})})]})]}):c.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})})}function RT(e){return new Promise((t,r)=>{let a=!1,o=null,i=null;const u=()=>{a=!0,o&&(clearInterval(o),o=null),i&&(i(),i=null)},f=(p,m,x)=>{a||(u(),p==="done"&&m?t(m):r(new Error(x??"Clone failed")))};i=En.on("task/complete",p=>{const m=p;m.task_id===e&&f(m.status??"error",m.result,m.error)}),o=setInterval(async()=>{if(!a)try{const p=await ze.get(`/import/remote/tasks/${e}`);p.status!=="running"&&f(p.status,p.result,p.error)}catch{}},5e3)})}async function TT(e){const{task_id:t}=await ze.post("/import/remote/clone",{library_id:e.libraryId,url:e.url,ref:e.ref,...e.commit?{commit:e.commit}:{},repo_name:e.repoName});return RT(t)}async function LT(e,t,r){const{libraryId:a,url:o,ref:i,commitHash:u,scanResult:f,sourceUuid:h,parentSourceId:p,parentPath:m}=e,x={library_id:a,url:o,ref:i,commit:u,repo_files:f.files,repo_file_contents:f.manifests,...h?{source_uuid:h}:{},...p?{parent_source_id:p,parent_path:m}:{}},v=m?`${m}/${t}`:t;if(r.length>0){const k=[],N=[],A=new Set;for(const E of r){const D=E.split("/").pop()??E,L=E.endsWith("/")?E:`${E}/`,z=f.files.filter(J=>J.path.startsWith(L)||J.path===E).map(J=>({...J,path:J.path.startsWith(L)?J.path.slice(L.length):J.path})),$=f.manifests.filter(J=>J.path.startsWith(L)||J.path===E).map(J=>({...J,path:J.path.startsWith(L)?J.path.slice(L.length):J.path})),R=await ze.post("/import/remote/import",{...x,repo_files:z,repo_file_contents:$,repo_name:v,dir_name:D,sub_path:E});k.push(R.id);const{packages:B,mdFiles:H}=Mh($,z,D);for(const J of B)N.push(J);for(const J of H)A.add(J)}return{importIds:k,packages:N,mdFiles:Array.from(A)}}const _=await ze.post("/import/remote/import",{...x,repo_name:v,dir_name:t}),{packages:w,mdFiles:S}=Mh(f.manifests,f.files,t);return{importIds:[_.id],packages:w,mdFiles:S}}function DT(e,t,r){if(e instanceof hn){const a=e.message.toLowerCase();if(e.status===503)return r("sources.import_remote.error.capacity");if(a.includes("connect")||a.includes("connectionrefused")||a.includes("unavailable")||a.includes("econnrefused"))return r("sources.import_remote.error.network");if(a.includes("authentication")||a.includes("token")||a.includes("credential")||a.includes("401")||a.includes("403"))try{return r("sources.import_remote.error.auth_required",{host:new URL(t).hostname})}catch{return r("sources.import_remote.error.auth_required",{host:t})}return a.includes("not found")||a.includes("404")||a.includes("does not exist")?r("sources.import_remote.error.not_found"):e.message||r("sources.import_remote.error.network")}return e instanceof TypeError&&e.message.includes("fetch")?r("sources.import_remote.error.network"):e instanceof Error?e.message:r("sources.import_remote.error.network")}function OT(e){return e==="cloning"?"clone":e==="detecting"||e==="extracting"?"scan":e==="saving"?"save":e}const cu=/^https:\/\/[^/]+\/.+/,uv=e=>e.toLowerCase().replace(/:\d+$/,""),MT={"github.com":"github"};function Qp(e,t){try{const r=uv(new URL(e.trim()).hostname),a=t.find(o=>uv(o.host)===r&&o.api_import);return a?a.platform:MT[r]??null}catch{}return null}function zT({url:e,onUrlChange:t,onValidChange:r,onRefHint:a,onImportModeChange:o,forceClone:i}){const{t:u}=ye(),[f,h]=b.useState(null),[p,m]=b.useState([]),[x,v]=b.useState(null),[_,w]=b.useState("clone"),S=b.useRef(null);b.useEffect(()=>{ze.get("/import/remote/git-hosts").then(B=>m(B.hosts),()=>{})},[]);const k=i?"clone":x&&_==="api"?"api":"clone",N=b.useRef(k);b.useEffect(()=>{k!==N.current&&(N.current=k,o?.(k))},[k,o]);const A=b.useCallback(B=>{if(!B){h(null),r(!1),v(null);return}cu.test(B.trim())?(h(null),r(!0),v(Qp(B,p))):(h(u("sources.import_remote.url_invalid")),r(!1),v(null))},[r,u,p]),E=b.useCallback(B=>{if(!B){h(null),r(!1),v(null);return}const H=fT(B),J=H.repoUrl!==B.trim(),oe=J?H.repoUrl:B;J&&(t(oe),a?.(H.ref,H.commit)),cu.test(oe)?(h(null),r(!0),v(Qp(oe,p))):(h(u("sources.import_remote.url_invalid")),r(!1),v(null))},[t,r,a,u,p]),D=b.useCallback(B=>{const H=B.target.value;t(H),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>A(H),500)},[t,A]),L=b.useCallback(()=>{S.current&&clearTimeout(S.current),e&&E(e)},[e,E]),z=b.useCallback(B=>{B.preventDefault();const H=B.clipboardData.getData("text").trim();t(H),S.current&&clearTimeout(S.current),E(H)},[t,E]);b.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]),b.useEffect(()=>{e&&E(e)},[]),b.useEffect(()=>{e&&cu.test(e.trim())&&p.length>0&&v(Qp(e,p))},[p]),b.useEffect(()=>{o?.(i?"clone":x&&_==="api"?"api":"clone")},[x,i]);const $=B=>{w(B),o?.(i?"clone":B==="api"&&x?"api":"clone")},R=e&&cu.test(e.trim());return c.jsx("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center rounded border border-c4a-border-subtle bg-c4a-bg-surface px-6 py-10",children:c.jsxs("div",{className:"w-full max-w-2xl space-y-5",children:[c.jsx("input",{type:"text",value:e,onChange:D,onBlur:L,onPaste:z,placeholder:u("sources.import_remote.url_placeholder"),className:"w-full rounded-md border border-c4a-border-default bg-c4a-bg-surface px-4 py-3 text-center font-mono text-base font-semibold text-c4a-accent placeholder:font-normal placeholder:text-c4a-text-muted focus:border-c4a-accent focus:outline-none",autoFocus:!0}),c.jsx("div",{className:"min-h-14 text-center text-sm leading-relaxed text-c4a-text-muted",children:f?c.jsx("p",{className:"text-red-400",children:f}):R?c.jsx("div",{className:"flex flex-col items-center gap-2",children:x&&!i?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[c.jsx("input",{type:"checkbox",className:"c4a-check",checked:_==="clone",onChange:()=>$("clone")}),c.jsx("span",{className:_==="clone"?"text-c4a-accent":"text-c4a-text-muted",children:u("sources.import_remote.api.use_clone")})]}),c.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[c.jsx("input",{type:"checkbox",className:"c4a-check",checked:_==="api",onChange:()=>$("api")}),c.jsx("span",{className:_==="api"?"text-c4a-accent":"text-c4a-text-muted",children:u("sources.import_remote.api.detected",{platform:x})})]})]}):c.jsx("p",{className:"text-c4a-text-muted",children:u("sources.import_remote.api.will_use_clone")})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:p.length>0?c.jsxs(c.Fragment,{children:[u("sources.import_remote.url_hint_public"),p.map((B,H)=>c.jsxs("span",{children:[H>0&&"、",c.jsx("span",{className:"font-mono font-medium text-c4a-accent",children:B.host})]},B.host))]}):u("sources.import_remote.url_hint_no_auth")}),c.jsx("p",{className:"mt-1 text-c4a-text-muted/60",children:u("sources.import_remote.url_hint_format")})]})})]})})}function $T({repoUrl:e,ref:t,selected:r,fetchTree:a,onConfirm:o,onCancel:i}){const{t:u}=ye(),[f,h]=b.useState([]),[p,m]=b.useState(!0),[x,v]=b.useState(new Set),[_,w]=b.useState(new Set(r));b.useEffect(()=>{(async()=>{m(!0);try{const L=await a(e,t,"");h(L.map(z=>({entry:z,children:null,loading:!1})))}catch{h([])}finally{m(!1)}})()},[]);const S=b.useCallback((L,z,$)=>L.map(R=>R.entry.path===z?$(R):R.children?{...R,children:S(R.children,z,$)}:R),[]),k=b.useCallback(async L=>{const z=L.entry.path;if(x.has(z)){v(R=>{const B=new Set(R);return B.delete(z),B});return}if(v(R=>new Set(R).add(z)),L.children===null&&!L.loading){h(R=>S(R,z,B=>({...B,loading:!0})));try{const B=(await a(e,t,z)).map(H=>({entry:H,children:null,loading:!1}));h(H=>S(H,z,J=>({...J,children:B,loading:!1})))}catch{h(R=>S(R,z,B=>({...B,children:[],loading:!1})))}}},[x,e,t,a,S]),N=b.useCallback(L=>{w(z=>{const $=new Set(z);return $.has(L)?$.delete(L):$.add(L),$})},[]),A=b.useCallback(L=>{w(z=>{const $=new Set(z);return $.delete(L),$})},[]),E=b.useCallback(()=>{o(Array.from(_))},[o,_]),D=Array.from(_);return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 lg:flex-row",children:[c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-lg border border-c4a-border-default lg:w-1/2",children:[c.jsx("div",{className:"border-b border-c4a-border-subtle px-3 py-2",children:c.jsx("span",{className:"font-mono text-xs uppercase tracking-tight text-c4a-text-muted",children:u("sources.import_remote.api.sub_path")})}),c.jsx("div",{className:"c4a-scrollbar flex-1 overflow-y-auto",children:p?c.jsx("div",{className:"flex flex-1 items-center justify-center py-8",children:c.jsx(ta,{labelKey:"common.loading"})}):c.jsx(W1,{nodes:f,depth:0,expandedPaths:x,selectedPaths:_,onToggleExpand:k,onToggleSelect:N})})]}),c.jsxs("div",{className:"flex min-h-0 flex-col rounded-lg border border-c4a-border-default lg:w-1/2",children:[c.jsx("div",{className:"border-b border-c4a-border-subtle px-3 py-2 font-mono text-xs uppercase tracking-tight text-c4a-text-muted",children:u("sources.import_remote.api.panel_selected")}),c.jsx("div",{className:"px-3 py-2",children:c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:u("sources.import_remote.api.selected_count",{count:D.length}).split(/(\d+)/).map((L,z)=>/^\d+$/.test(L)?c.jsx("span",{className:"font-extrabold text-c4a-accent",children:L},z):c.jsx("span",{children:L},z))})}),c.jsx("div",{className:"c4a-scrollbar flex-1 overflow-y-auto px-3",children:D.length===0?null:c.jsx("div",{className:"flex flex-col gap-0.5",children:D.map(L=>c.jsxs("div",{className:"flex items-center gap-2 rounded-sm px-2 py-1 text-xs text-c4a-text-secondary hover:bg-c4a-bg-hover",children:[c.jsx(Gn,{size:12,className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:L}),c.jsx("button",{onClick:()=>A(L),className:"shrink-0 text-c4a-text-muted hover:text-c4a-accent",children:c.jsx(Or,{size:12})})]},L))})})]})]}),c.jsxs("div",{className:"mt-4 flex items-center justify-end gap-3",children:[c.jsx("button",{onClick:i,className:"rounded border border-c4a-border-default bg-c4a-bg-surface px-4 py-2 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:u("sources.import.back")}),c.jsx("button",{onClick:E,disabled:D.length===0,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs uppercase text-white transition-colors hover:bg-c4a-accent-hover disabled:cursor-not-allowed disabled:opacity-40",children:D.length>0?`${u("sources.import.step.confirm")} (${D.length})`:u("sources.import.step.confirm")})]})]})}function W1({nodes:e,depth:t,expandedPaths:r,selectedPaths:a,onToggleExpand:o,onToggleSelect:i}){const u=e.filter(h=>h.entry.type==="tree"),f=e.filter(h=>h.entry.type==="blob");return c.jsxs(c.Fragment,{children:[u.map(h=>{const p=h.entry.path,m=r.has(p);return c.jsxs("div",{children:[c.jsxs("div",{className:"flex h-8 items-center font-mono text-[12px] transition-colors hover:bg-c4a-bg-hover",style:{paddingLeft:`${t*16+8}px`},children:[c.jsx("button",{onClick:()=>o(h),className:"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center text-c4a-text-muted",children:h.loading?c.jsx(Zt,{size:12,className:"animate-spin"}):c.jsx($t,{size:12,className:`transition-transform duration-200 ${m?"rotate-90":""}`})}),c.jsx("input",{type:"checkbox",checked:a.has(p),onChange:()=>i(p),className:"c4a-check mx-1.5 h-3 w-3 cursor-pointer"}),c.jsx(Gn,{size:14,className:"mr-1.5 shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:"truncate text-c4a-text-secondary",children:h.entry.name})]}),m&&h.children&&c.jsx(W1,{nodes:h.children,depth:t+1,expandedPaths:r,selectedPaths:a,onToggleExpand:o,onToggleSelect:i})]},p)}),f.map(h=>c.jsxs("div",{className:"flex h-8 items-center font-mono text-[12px]",style:{paddingLeft:`${t*16+8+20+6+12+6}px`},children:[c.jsx(wm,{size:14,className:"mr-1.5 shrink-0 text-c4a-text-muted opacity-50"}),c.jsx("span",{className:"truncate text-c4a-text-muted",children:h.entry.name})]},h.entry.path)),u.length===0&&f.length===0&&c.jsx("p",{className:"py-4 text-center text-xs text-c4a-text-muted",style:{paddingLeft:`${t*16+8}px`},children:"—"})]})}function BT(){const e=b.useRef(new Map),t=b.useCallback(async(i,u)=>{const f=await ze.post("/import/remote/branches",{repo_url:i,...u?{search:u}:{}});if(!f.provider_matched)return{refs:{branches:[],tags:[],default:""},providerMatched:!1,platform:null};const h=f.branches.find(m=>m.isDefault)?.name??"";return{refs:{branches:f.branches.map(m=>({name:m.name,commit:m.commitSha})),tags:[],default:h},providerMatched:!0,platform:f.platform}},[]),r=b.useCallback(async(i,u,f)=>{const h=`${i}::${u}::${f}`,p=e.current.get(h);if(p)return p;const m=await ze.post("/import/remote/tree",{repo_url:i,ref:u,path:f});return e.current.set(h,m.entries),m.entries},[]),a=b.useCallback(async i=>{const u=await ze.post("/import/remote/import",{library_id:i.libraryId,url:i.url,import_method:"api",branch:i.branch,commit_sha:i.commitSha,...i.subPaths&&i.subPaths.length>0?{sub_paths:i.subPaths}:{},...i.forceTruncated?{force_truncated:!0}:{},...i.sourceUuid?{source_uuid:i.sourceUuid}:{},...i.parentSourceId?{parent_source_id:i.parentSourceId,parent_path:i.parentPath}:{}}),f=u.results?.flatMap(p=>p.packages)??[],h=new Set;for(const p of u.results??[])for(const m of p.md_files)h.add(m);return{response:u,packages:f,mdFiles:Array.from(h)}},[]),o=b.useCallback(()=>{e.current.clear()},[]);return{fetchApiBranches:t,fetchRemoteTree:r,importViaApi:a,clearTreeCache:o}}function Bl({error:e,onClose:t}){const{t:r}=ye(),[a,o]=b.useState(!1),i=b.useCallback(async()=>{try{await navigator.clipboard.writeText(e.detail),o(!0),setTimeout(()=>o(!1),2e3)}catch{const u=document.createElement("textarea");u.value=e.detail,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u),o(!0),setTimeout(()=>o(!1),2e3)}},[e.detail]);return c.jsxs(lr,{onClose:t,className:"w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsx("p",{className:"font-mono text-sm font-bold uppercase tracking-tight text-c4a-text-primary",children:e.title}),c.jsx("p",{className:"mt-3 text-xs text-c4a-text-muted",children:r("error.dialog.console_hint")}),c.jsxs("div",{className:"mt-5 flex items-center justify-end gap-3",children:[c.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs uppercase tracking-tight text-c4a-text-secondary transition-colors hover:border-c4a-border-strong hover:text-c4a-text-primary",children:[a?c.jsx(Wr,{size:12}):c.jsx(Iu,{size:12}),r(a?"error.dialog.copied":"error.dialog.copy")]}),c.jsx("button",{onClick:t,className:"rounded bg-c4a-accent px-4 py-1.5 font-mono text-xs uppercase tracking-tight text-white transition-colors hover:bg-c4a-accent-hover",children:r("error.dialog.confirm")})]})]})}const Zp=["prepare","clone","scan","save"],e4={prepare:"sources.import.stage.prepare",clone:"sources.import.stage.clone",scan:"sources.import.stage.scan",save:"sources.import.stage.save"},IT={prepare:5,clone:90,scan:95,save:100},dv=["prepare","fetch_tree","read_packages","save"],t4={prepare:"sources.import.stage.prepare",fetch_tree:"sources.import.stage.fetch_tree",read_packages:"sources.import.stage.read_packages",save:"sources.import.stage.save"},UT={prepare:5,fetch_tree:50,read_packages:90,save:100},fv={...e4,...t4};function PT(){const{t:e}=ye(),t=Tt(),{libId:r}=Vo(),[a]=Ol(),o=a.get("url")||"",i=a.get("ref")||"",u=a.get("sourceUuid")||"",f=a.get("parentId")||"",h=a.get("parentName")||"",p=a.get("parentPath")||"",x=Qt(ds(qs)).find(ue=>ue.id===r),[v,_]=b.useState(new Set),w=b.useCallback(async()=>{if(r)try{const ue=new Set;if(f){const Re=(await ze.get(`/sources/${f}`)).tree??[];let Ge=p===""?Re:[];if(p){const Oe=(gt,it)=>{for(const an of gt){if(an.path===it)return an.children??[];if(an.children){const _n=Oe(an.children,it);if(_n.length>0)return _n}}return[]};Ge=Oe(Re,p)}for(const Oe of Ge)ue.add(Oe.name.toLowerCase())}else{const Ee=await ze.get("/sources",{library_id:r});for(const Re of Ee.items)ue.add(Re.name.toLowerCase())}_(ue)}catch{}},[r,f,p]);b.useEffect(()=>{w()},[w]);const[S,k]=b.useState(o?2:1),[N,A]=b.useState(o),[E,D]=b.useState(!!o),[L,z]=b.useState(i),[$,R]=b.useState(""),[B,H]=b.useState(!!i),[J,oe]=b.useState(""),ce=b.useRef(void 0),M=b.useRef(void 0),[P,T]=b.useState("clone"),[F,ee]=b.useState([]),[ae,W]=b.useState(!1),[O,V]=b.useState(null),[re,se]=b.useState(null),ne=b.useRef(0),{fetchApiBranches:ge,fetchRemoteTree:Ne,importViaApi:Fe,clearTreeCache:qe}=BT(),be=F.length>0,fe=b.useCallback(ue=>{T(ue)},[]),_e=b.useRef(N);b.useEffect(()=>{N!==_e.current&&(_e.current=N,z(""),R(""),H(!1),ve(null),It(null),ee([]))},[N]);const[he,ve]=b.useState(null),[Ve,De]=b.useState(!1),[Xe,It]=b.useState(null),[un,Vt]=b.useState(!1),[Bn,cr]=b.useState(!1),[Xn,Ht]=b.useState(null),[An,Le]=b.useState(null),[Ze,We]=b.useState(null),[Nt,ft]=b.useState(null),[Rn,mn]=b.useState([]),[gn,Lt]=b.useState(null),[Et,Pt]=b.useState([]),Er=b.useRef(null),zr=b.useRef(""),sa=P==="api"?t4:e4,me=P==="api"?dv:Zp,Ue=P==="api"?UT:IT,St=b.useMemo(()=>me.map(ue=>({key:ue,label:sa[ue]?e(sa[ue]):ue})),[e,me,sa]),nt=b.useCallback(ue=>{Pt(Ee=>[...Ee,`[${zh()}] ${ue}`])},[]),Ct=b.useRef(null),Dt=b.useCallback(ue=>{const Ee=Ct.current;Ee&&Ee!==ue&&(mn(Re=>Re.includes(Ee)?Re:[...Re,Ee]),nt(`${e(fv[Ee]??Ee)} ${e("sources.import.stage.done_suffix")}`)),nt(`${e(fv[ue]??ue)}...`),Ct.current=ue,ft(ue),Lt(null)},[nt,e]),Oa=b.useCallback((ue,Ee)=>{ce.current=ue,M.current=Ee},[]),oa=b.useCallback((ue,Ee)=>{ue.length!==0&&z(Re=>{if(Re)return Re;const Ge=ce.current,Oe=M.current;if(Ge){const an=ue.find(_n=>_n.name===Ge);if(an)return R(an.commit),an.name}Oe&&R(Oe);const it=ue.find(an=>an.name===Ee)??ue[0];return it?(Oe||R(it.commit),it.name):Re})},[]),ur=b.useCallback(async ue=>{if(!r)return;De(!0),It(null);const Ee=async()=>{const Re=await ze.post("/import/remote/refs",{library_id:r,url:N},ue?{signal:ue}:void 0);ue?.aborted||(ve(Re),oa([...Re.branches??[],...Re.tags??[]],Re.default))};try{if(P==="api"){const{refs:Re,providerMatched:Ge}=await ge(N);if(ue?.aborted)return;if(!Ge){T("clone"),ee([]),await Ee();return}ve(Re),oa(Re.branches,Re.default)}else await Ee()}catch(Re){if(ue?.aborted)return;It(DT(Re,N,e))}finally{ue?.aborted||De(!1)}},[r,N,e,P,ge,oa]);b.useEffect(()=>{if(S!==2||!r)return;const ue=new AbortController;return ur(ue.signal),()=>ue.abort()},[S,r,ur]),b.useEffect(()=>{if(!un||P!=="clone")return;let ue="";return En.on("task/progress",Re=>{const Ge=Re,Oe=OT(Ge.stage??"");Oe&&Zp.includes(Oe)&&(Lt({percent:Ge.percent??-1,label:Ge.detail??Ge.label??""}),Ge.detail&&Ge.detail!==ue&&(ue=Ge.detail,Pt(gt=>[...gt,`[${zh()}] ${Ge.detail}`])))})},[un,P]);const Tn=b.useCallback(async(ue,Ee)=>{mn([...ue]),Ct.current=null,ft(null),nt(`${e("sources.import.stage.save")} ${e("sources.import.stage.done_suffix")}`),nt(e("sources.import.stage.complete")),await G1(Ee),cr(!0),Vt(!1),k(4)},[nt,e]),$r=b.useCallback(async ue=>{if(!r)return;const Ee=J||Os(N);Dt("clone");const Re=p?`${p}/${Ee}`:Ee,Ge=await TT({libraryId:r,url:N,ref:L,commit:$||void 0,repoName:Re});zr.current=Ge.commit_hash,Dt("scan");const Oe=await ze.post("/import/remote/scan",{library_id:r,path:Ge.path,hash:Ge.commit_hash});Dt("save");const gt=await LT({libraryId:r,url:N,ref:L,commitHash:Ge.commit_hash,scanResult:Oe,sourceUuid:u||void 0,parentSourceId:f||void 0,parentPath:p||void 0},Ee,[]);Er.current=gt.importIds[0]??null,Ht({packages:gt.packages,mdFiles:gt.mdFiles}),await Tn(Zp,ue)},[r,N,L,$,J,u,f,p,Dt,Tn]),ia=b.useCallback(async(ue,Ee=!1)=>{if(!r)return;Dt("fetch_tree");const Re=await Fe({libraryId:r,url:N,branch:L,commitSha:$,subPaths:F.length>0?F:void 0,forceTruncated:Ee,sourceUuid:u||void 0,parentSourceId:f||void 0,parentPath:p||void 0});if(Re.response.status==="truncated"){nt(e("sources.import_remote.api.truncated_warning")),V({treeEntries:Re.response.tree_entries??0,message:Re.response.message??""}),Vt(!1);return}Dt("read_packages"),zr.current=$,Dt("save");const Ge=Re.response.results?.[0];Ge&&(Er.current=Ge.source_id),Ht({packages:Re.packages,mdFiles:Re.mdFiles});for(const Oe of Re.response.warnings??[])Qr(Oe.message);await Tn(dv,ue)},[r,N,L,$,F,u,f,p,Fe,Dt,nt,e,Tn]),Ma=b.useCallback(async()=>{if(!r)return;const ue=Date.now();ne.current=ue,Vt(!0),cr(!1),Le(null),We(null),mn([]),Ct.current=null,ft(null),Lt(null),Pt([]),k(3);try{Dt("prepare"),await new Promise(Ee=>setTimeout(Ee,300)),P==="api"?await ia(ue):await $r(ue)}catch(Ee){const Re=Ct.current??"prepare";if(Ee instanceof hn&&Ee.code==="GIT_HOST_NOT_CONFIGURED"){Ct.current=null,ft(null),Vt(!1);let Oe=N;try{Oe=new URL(N).hostname}catch{}console.error("GIT_HOST_NOT_CONFIGURED:",Ee.message),se({title:e("sources.import_remote.api.git_host_not_configured",{host:Oe}),detail:Ee.message});return}if(P==="api"){nt(e("sources.import_remote.api.fallback_msg")),T("clone"),ee([]),mn([]),Ct.current=null,ft(null),Lt(null);try{Dt("prepare"),await new Promise(Oe=>setTimeout(Oe,300)),await $r(ue);return}catch(Oe){const gt=Ct.current??"prepare";We(gt),Ct.current=null,ft(null);const it=Oe instanceof Error?Oe.message:String(Oe);nt(`ERROR: ${it}`),Le(it),Vt(!1);return}}We(Re),Ct.current=null,ft(null);const Ge=Ee instanceof Error?Ee.message:String(Ee);nt(`ERROR: ${Ge}`),Le(Ge),Vt(!1)}},[r,N,P,Dt,ia,$r,nt,e]),I=b.useCallback(()=>{We(null),Le(null),Ma()},[Ma]),G=b.useCallback(ue=>{const Ee=ue instanceof Error?ue.message:String(ue);nt(`ERROR: ${Ee}`),Le(Ee),We(Ct.current??"prepare"),Ct.current=null,ft(null),Vt(!1)},[nt]),Z=b.useCallback(async()=>{V(null),Vt(!0);try{await ia(ne.current,!0)}catch(ue){G(ue)}},[ia,G]),xe=b.useCallback(async()=>{V(null),T("clone"),ee([]),Vt(!0),mn([]),Ct.current=null,ft(null),Lt(null);try{Dt("prepare"),await new Promise(ue=>setTimeout(ue,300)),await $r(ne.current)}catch(ue){G(ue)}},[$r,Dt,G]),we=b.useCallback(()=>{if(r)if(f){const ue=`/studio/sources/${r}?rootId=${f}`;t(p?`${ue}&path=${encodeURIComponent(p)}`:ue)}else Er.current&&!be?t(`/studio/sources/${r}?rootId=${Er.current}`):t(`/studio/sources/${r}`)},[r,t,f,p,be]),Ae=b.useCallback(()=>{k(2),We(null),Le(null),mn([]),Ct.current=null,ft(null),Pt([])},[]),je=(J||Os(N)).toLowerCase(),ke=!be&&v.has(je),Ce=b.useMemo(()=>S===1?E:S===2?B&&!ke&&!Ve&&!Xe:!1,[S,E,B,ke,Ve,Xe]),Ie=b.useMemo(()=>{if(!x)return[];const ue=[{label:x.is_default?e("sources.library.default_cloud_name"):x.name,to:`/studio/sources/${x.id}`}];if(f&&(ue.push({label:h||f,to:`/studio/sources/${x.id}?rootId=${f}`}),p)){const Ee=p.split("/").filter(Boolean);for(const[Re,Ge]of Ee.entries()){const Oe=Ee.slice(0,Re+1).join("/");ue.push({label:Ge,to:`/studio/sources/${x.id}?rootId=${f}&path=${encodeURIComponent(Oe)}`})}}return ue.push({label:e("sources.import_remote.title")}),ue},[x,f,h,p,e]);if(!x)return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})});const Pe=S===4&&Bn,Be=S===3&&!!Ze&&!un,dt=S<=2&&!ae;return S===2&&ae&&P==="api"?c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-4 md:p-6",children:[c.jsx("div",{className:"shrink-0",children:c.jsx(Ta,{segments:Ie})}),c.jsx("div",{className:"mt-3 flex min-h-0 flex-1 flex-col sm:mt-6",children:c.jsx($T,{repoUrl:N,ref:L,selected:F,fetchTree:Ne,onConfirm:ue=>{ee(ue),W(!1),qe()},onCancel:()=>{W(!1),qe()}})})]}):c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-4 md:p-6",children:[c.jsx("div",{className:"shrink-0",children:c.jsx(Ta,{segments:Ie})}),c.jsxs("div",{className:"mt-3 flex shrink-0 items-center gap-2 font-mono text-sm sm:mt-6 md:gap-3",children:[c.jsx(Xr,{active:S>=1,current:S===1}),c.jsx("span",{className:S===1?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.select")}),c.jsx($s,{}),c.jsx(Xr,{active:S>=2,current:S===2}),c.jsx("span",{className:S===2?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.version")}),c.jsx($s,{}),c.jsx(Xr,{active:S>=3,current:S===3}),c.jsx("span",{className:S===3?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.loading")}),c.jsx($s,{}),c.jsx(Xr,{active:S>=4,current:S===4}),c.jsx("span",{className:S===4?"text-c4a-accent":"text-c4a-text-muted",children:e("sources.import.step.confirm")})]}),c.jsxs("div",{className:"mt-3 flex min-h-0 flex-1 flex-col sm:mt-6",children:[S===1&&c.jsx(zT,{url:N,onUrlChange:A,onValidChange:D,onRefHint:Oa,onImportModeChange:fe,forceClone:!!f}),S===2&&r&&c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[c.jsx(X1,{refs:he,loading:Ve,error:Xe,selectedRef:L,commit:$,onRefChange:z,onCommitChange:R,onValidChange:H,onRetry:()=>ur()}),!Ve&&he&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsx("label",{className:"block font-mono text-xs uppercase tracking-tight text-c4a-text-secondary",children:e("sources.import.dir_name")}),c.jsx("input",{type:"text",value:J,onChange:ue=>oe(ue.target.value),placeholder:Os(N),disabled:be,className:`mt-2 w-full rounded border bg-c4a-bg-surface px-3 py-2 font-mono text-sm text-c4a-accent placeholder:text-c4a-text-muted focus:outline-none ${be?"opacity-50":""} ${ke?"border-red-400 focus:border-red-400":"border-c4a-border-default focus:border-c4a-accent"}`}),ke?c.jsx("p",{className:"mt-1.5 text-xs text-red-400",children:e("sources.import.dir_name_duplicate")}):c.jsx("p",{className:"mt-1.5 text-xs text-c4a-text-muted",children:e("sources.import.dir_name_hint")})]}),!f&&P==="api"&&c.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsx("label",{className:"block font-mono text-xs uppercase tracking-tight text-c4a-text-secondary",children:e("sources.import_remote.api.sub_path")}),c.jsx("p",{className:"mt-1 text-xs text-c4a-text-muted",children:e("sources.import_remote.api.sub_path_hint")}),c.jsx("button",{onClick:()=>W(!0),className:"mt-2 rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:e("sources.import_remote.api.select_sub_paths")}),F.length>0&&c.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:F.map(ue=>c.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-c4a-border-subtle bg-c4a-bg-subtle px-1.5 py-0.5 font-mono text-[11px] text-c4a-text-secondary",children:[ue,c.jsx("button",{onClick:()=>ee(Ee=>Ee.filter(Re=>Re!==ue)),className:"cursor-pointer text-c4a-text-muted hover:text-c4a-text-primary",children:c.jsx(Or,{size:10})})]},ue))})]})]})]}),S===3&&c.jsx(Z1,{stages:St,currentStage:Nt,completedStages:Rn,failedStage:Ze,progress:gn,breakpoints:Ue,failedError:An,logs:Et}),S===4&&c.jsx(J1,{repoName:Os(N),repoIdentifier:N,branch:L,commit:zr.current||$,packages:Xn?.packages??[],mdFiles:Xn?.mdFiles??[],importing:!1,completed:Bn,importMethod:P})]}),Pe?c.jsx("div",{className:"mt-3 flex shrink-0 justify-end sm:mt-6",children:c.jsx("button",{onClick:we,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("sources.import.done")})}):Be?c.jsxs("div",{className:"mt-3 flex shrink-0 justify-end gap-2 sm:mt-6",children:[c.jsx("button",{onClick:Ae,className:"rounded border border-c4a-border-default px-4 py-2 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:e("sources.import.back")}),c.jsx("button",{onClick:I,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("sources.import.retry")})]}):dt?c.jsx(km,{step:S,totalSteps:2,importing:!1,stepBusy:Ve,canProceed:Ce,safetyNoticeKey:"sources.safety.notice.remote",confirmLabelKey:"common.next",onPrev:()=>k(ue=>ue-1),onNext:()=>k(ue=>ue+1),onImport:Ma}):null,O&&c.jsxs(lr,{onClose:()=>V(null),className:"w-full max-w-md rounded border border-c4a-border-default bg-c4a-bg-elevated p-6 shadow-c4a-lg",children:[c.jsxs("p",{className:"font-mono text-sm font-bold uppercase tracking-tight text-c4a-text-primary",children:["⚠ ",e("sources.import_remote.api.truncated_warning")]}),c.jsx("p",{className:"mt-3 text-xs text-c4a-text-muted",children:e("sources.import_remote.api.truncated_suggest")}),c.jsxs("div",{className:"mt-5 flex items-center justify-end gap-3",children:[c.jsx("button",{onClick:Z,className:"rounded border border-c4a-border-default px-4 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:e("sources.import_remote.api.truncated_continue")}),c.jsx("button",{onClick:xe,className:"rounded bg-c4a-accent px-4 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("sources.import_remote.api.truncated_use_clone")})]})]}),re&&c.jsx(Bl,{error:re,onClose:()=>{se(null),k(1)}})]})}function HT(){const{t:e}=ye(),t=Tt(),r=Qt(v=>v.createLibrary),[a,o]=b.useState("waiting"),[i,u]=b.useState(null),[f,h]=b.useState(""),[p,m]=b.useState(!1);b.useEffect(()=>En.on("ws:daemon:connected",_=>{const w=_;u(w),h(w.machine_id),o(w.needs_registration?"new_client":"reconnected")}),[]),b.useEffect(()=>{let v=!1;return(async()=>{try{const _=await ze.get("/daemons/pending");if(v||_.pending.length===0)return;const w=_.pending[0];u({machine_id:w.machine_id,needs_registration:!0}),h(w.machine_id),o("new_client")}catch{}})(),()=>{v=!0}},[]);const x=b.useCallback(async()=>{if(i){m(!0);try{const v=await r({type:"daemon",name:f||i.machine_id,config:{machine_id:i.machine_id,os:i.os||"",daemon_version:i.daemon_version||""}});t(`/studio/sources/${v.id}`)}catch{m(!1)}}},[i,f,r,t]);return c.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[c.jsx(Ta,{segments:[{label:e("sources.add_client.title")}]}),c.jsx("p",{className:"mt-4 text-sm text-c4a-text-secondary",children:e("sources.add_client.description")}),c.jsx("div",{className:"mt-6 rounded border border-c4a-border-subtle bg-c4a-bg-surface p-5",children:c.jsxs("ol",{className:"space-y-4 text-sm text-c4a-text-secondary",children:[c.jsxs("li",{children:[c.jsxs("span",{className:"font-mono text-xs font-bold text-c4a-text-primary",children:["1. ",e("sources.add_client.step1")]}),c.jsxs("pre",{className:"mt-1 flex items-center gap-1.5 rounded bg-c4a-bg-base px-3 py-2 font-mono text-xs text-c4a-accent",children:["npm install -g @c4a/daemon ",c.jsx(Jp,{text:"npm install -g @c4a/daemon"})]})]}),c.jsxs("li",{children:[c.jsxs("span",{className:"font-mono text-xs font-bold text-c4a-text-primary",children:["2. ",e("sources.add_client.step2")]}),c.jsxs("pre",{className:"mt-1 flex items-center gap-1.5 rounded bg-c4a-bg-base px-3 py-2 font-mono text-xs text-c4a-accent",children:[`c4a-daemon --server ${window.location.host}`," ",c.jsx(Jp,{text:`c4a-daemon --server ${window.location.host}`})]}),c.jsx("p",{className:"mt-2 text-xs text-c4a-text-muted",children:e("sources.add_client.step2_allow")}),c.jsxs("pre",{className:"mt-1 flex items-center gap-1.5 rounded bg-c4a-bg-base px-3 py-2 font-mono text-xs text-c4a-accent",children:[`c4a-daemon --server ${window.location.host} --allow ~/dir1,~/dir2`," ",c.jsx(Jp,{text:`c4a-daemon --server ${window.location.host} --allow ~/dir1,~/dir2`})]})]}),c.jsxs("li",{children:[c.jsxs("span",{className:"font-mono text-xs font-bold text-c4a-text-primary",children:["3. ",e("sources.add_client.step3")]}),c.jsx("p",{className:"mt-1 text-xs text-c4a-text-muted",children:e("sources.add_client.step3_desc")})]})]})}),c.jsxs("div",{className:"mt-6 rounded border border-c4a-border-subtle bg-c4a-bg-surface p-5",children:[a==="waiting"&&c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Zt,{size:16,className:"animate-spin text-c4a-warning"}),c.jsx("span",{className:"text-sm text-c4a-warning",children:e("sources.add_client.waiting")})]}),a==="new_client"&&i&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h3",{className:"font-mono text-sm font-bold text-c4a-accent",children:e("sources.add_client.detected")}),c.jsxs("div",{className:"space-y-2 text-sm",children:[c.jsx(Wp,{label:e("sources.add_client.machine_name"),value:i.machine_id}),i.os&&c.jsx(Wp,{label:e("sources.add_client.os"),value:i.os}),i.daemon_version&&c.jsx(Wp,{label:e("sources.add_client.daemon_version"),value:i.daemon_version})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-32 font-mono text-xs text-c4a-text-muted",children:e("sources.add_client.client_name")}),c.jsx("input",{value:f,onChange:v=>h(v.target.value),className:"min-w-0 flex-1 rounded border border-c4a-border-default bg-c4a-bg-base px-2 py-1 font-mono text-xs text-c4a-text-primary outline-none focus:border-c4a-accent"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[c.jsx("button",{onClick:()=>t("/studio/sources"),className:"rounded border border-c4a-border-default px-3 py-1.5 font-mono text-xs text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover",children:e("common.cancel")}),c.jsxs("button",{onClick:x,disabled:p||!f.trim(),className:"flex items-center gap-1.5 rounded bg-c4a-accent px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-50",children:[p&&c.jsx(Zt,{size:12,className:"animate-spin"}),e("sources.add_client.confirm")]})]})]}),a==="reconnected"&&i&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Wr,{size:16,className:"text-c4a-success"}),c.jsx("span",{className:"text-sm text-c4a-text-primary",children:e("sources.add_client.reconnected",{name:i.machine_id})})]}),i.lib_id&&c.jsx(jr,{to:`/studio/sources/${i.lib_id}`,className:"inline-block rounded bg-c4a-accent px-3 py-1.5 font-mono text-xs text-white transition-colors hover:bg-c4a-accent-hover",children:e("sources.add_client.go_to",{name:i.machine_id})})]})]})]})}function Jp({text:e}){const[t,r]=b.useState(!1),a=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},[e]);return c.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded p-0.5 text-c4a-accent opacity-60 transition-opacity hover:opacity-100",title:"Copy",children:t?c.jsx(Wr,{size:13}):c.jsx(Iu,{size:13})})}function Wp({label:e,value:t}){return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-32 font-mono text-xs text-c4a-text-muted",children:e}),c.jsx("span",{className:"font-mono text-xs text-c4a-text-primary",children:t})]})}const pv={accent:"bg-c4a-accent/10 text-c4a-accent/60",success:"bg-c4a-success/10 text-c4a-success",warning:"bg-c4a-warning/10 text-c4a-warning",error:"bg-c4a-error/10 text-c4a-error",muted:"bg-c4a-bg-active text-c4a-text-secondary"};function Bt({children:e,variant:t="accent",tooltip:r}){return r?c.jsxs("span",{className:"relative inline-block group cursor-default",children:[c.jsx("span",{className:`inline-block font-mono text-[10px] uppercase px-1.5 py-0.5 rounded-sm ${pv[t]}`,children:e}),c.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-1 rounded bg-c4a-bg-elevated text-c4a-text-primary text-[11px] font-sans normal-case whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-150 shadow-lg border border-c4a-border-subtle z-50",children:r})]}):c.jsx("span",{className:`inline-block font-mono text-[10px] uppercase px-1.5 py-0.5 rounded-sm ${pv[t]}`,children:e})}function Yo(e){return e===void 0?null:e>=.9?{labelKey:"confidence.high",tipKey:"confidence.high.tip",variant:"success",value:e}:e>=.7?{labelKey:"confidence.ai",tipKey:"confidence.ai.tip",variant:"warning",value:e}:{labelKey:"confidence.low",tipKey:"confidence.low.tip",variant:"error",value:e}}const n4="c4a_explorer_mode";function qT(){try{const e=localStorage.getItem(n4);if(e==="append"||e==="replace")return e}catch{}return"append"}const Aa=ea((e,t)=>({tabs:[],activeTabId:null,mode:qT(),openTab:r=>{const{tabs:a,mode:o}=t(),i=a.find(u=>u.id===r.id);if(i){e({activeTabId:i.id});return}if(o==="append")e({tabs:[...a,{...r,isAnchor:!1}],activeTabId:r.id});else{const u=a.find(f=>f.id===t().activeTabId);if(!u||u.isAnchor)e({tabs:[...a,{...r,isAnchor:!1}],activeTabId:r.id});else{const f=a.findIndex(p=>p.id===t().activeTabId),h=[...a];h[f]={...r,isAnchor:!1},e({tabs:h,activeTabId:r.id})}}},closeTab:r=>{const{tabs:a,activeTabId:o}=t(),i=a.find(p=>p.id===r);if(!i||i.isAnchor)return;const u=a.findIndex(p=>p.id===r),f=a.filter(p=>p.id!==r);let h=o;o===r&&(h=f[u-1]?.id??f[0]?.id??null),e({tabs:f,activeTabId:h})},activateTab:r=>{e({activeTabId:r})},closeAll:()=>{const{tabs:r}=t(),a=r.filter(o=>o.isAnchor);e({tabs:a,activeTabId:a[0]?.id??null})},setAnchor:r=>{const a={...r,isAnchor:!0};e({tabs:[a],activeTabId:a.id})},toggleMode:()=>{const r=t().mode==="append"?"replace":"append";try{localStorage.setItem(n4,r)}catch{}e({mode:r})},reset:()=>{e({tabs:[],activeTabId:null})}})),r4=b.createContext(null);function FT({children:e}){const t=Aa(a=>a.openTab),r=b.useCallback((a,o,i,u)=>{t({id:`${a}:${o}`,type:a,resourceId:o,label:i,...u!=null&&{icon:u}})},[t]);return c.jsx(r4.Provider,{value:{active:!0,navigate:r},children:e})}function Ko(){return b.useContext(r4)}const a4=b.createContext(null);function s4(){const e=b.useContext(a4);if(!e)throw new Error("Tabs compound components must be used within <Tabs>");return e}function o4({value:e,onChange:t,children:r}){return c.jsx(a4.Provider,{value:{value:e,onChange:t},children:c.jsx("div",{className:"flex flex-1 flex-col",children:r})})}function i4({children:e}){return c.jsx("div",{className:"flex border-b border-c4a-border-subtle",children:e})}function Vr({value:e,children:t}){const{value:r,onChange:a}=s4(),o=r===e;return c.jsx("button",{onClick:()=>a(e),className:`border-b-2 px-4 py-2 font-mono text-xs uppercase transition-colors ${o?"border-c4a-accent text-c4a-accent":"border-transparent text-c4a-text-muted hover:text-c4a-text-secondary"}`,children:t})}function Yr({value:e,children:t}){const{value:r}=s4();return r!==e?null:c.jsx("div",{className:"flex flex-1 flex-col",children:t})}function l4(e,t){const r=t||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const GT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YT={};function hv(e,t){return(YT.jsx?VT:GT).test(e)}const KT=/[ \t\n\f\r]/g;function cd(e){return typeof e=="object"?e.type==="text"?mv(e.value):!1:mv(e)}function mv(e){return e.replace(KT,"")===""}class Il{constructor(t,r,a){this.normal=r,this.property=t,a&&(this.space=a)}}Il.prototype.normal={};Il.prototype.property={};Il.prototype.space=void 0;function c4(e,t){const r={},a={};for(const o of e)Object.assign(r,o.property),Object.assign(a,o.normal);return new Il(r,a,t)}function $h(e){return e.toLowerCase()}class Kn{constructor(t,r){this.attribute=r,this.property=t}}Kn.prototype.attribute="";Kn.prototype.booleanish=!1;Kn.prototype.boolean=!1;Kn.prototype.commaOrSpaceSeparated=!1;Kn.prototype.commaSeparated=!1;Kn.prototype.defined=!1;Kn.prototype.mustUseProperty=!1;Kn.prototype.number=!1;Kn.prototype.overloadedBoolean=!1;Kn.prototype.property="";Kn.prototype.spaceSeparated=!1;Kn.prototype.space=void 0;let XT=0;const tt=Fs(),rn=Fs(),Bh=Fs(),Se=Fs(),At=Fs(),$o=Fs(),rr=Fs();function Fs(){return 2**++XT}const Ih=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:rn,commaOrSpaceSeparated:rr,commaSeparated:$o,number:Se,overloadedBoolean:Bh,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),eh=Object.keys(Ih);class Nm extends Kn{constructor(t,r,a,o){let i=-1;if(super(t,r),gv(this,"space",o),typeof a=="number")for(;++i<eh.length;){const u=eh[i];gv(this,eh[i],(a&Ih[u])===Ih[u])}}}Nm.prototype.defined=!0;function gv(e,t,r){r&&(e[t]=r)}function Xo(e){const t={},r={};for(const[a,o]of Object.entries(e.properties)){const i=new Nm(a,e.transform(e.attributes||{},a),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),t[a]=i,r[$h(a)]=a,r[$h(i.attribute)]=a}return new Il(t,r,e.space)}const u4=Xo({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:At,ariaCurrent:null,ariaDescribedBy:At,ariaDetails:null,ariaDisabled:rn,ariaDropEffect:At,ariaErrorMessage:null,ariaExpanded:rn,ariaFlowTo:At,ariaGrabbed:rn,ariaHasPopup:null,ariaHidden:rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:At,ariaLevel:Se,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:At,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:At,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:rn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function d4(e,t){return t in e?e[t]:t}function f4(e,t){return d4(e,t.toLowerCase())}const QT=Xo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$o,acceptCharset:At,accessKey:At,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:At,autoFocus:tt,autoPlay:tt,blocking:At,capture:null,charSet:null,checked:tt,cite:null,className:At,cols:Se,colSpan:null,content:null,contentEditable:rn,controls:tt,controlsList:At,coords:Se|$o,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:Bh,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:At,height:Se,hidden:Bh,high:Se,href:null,hrefLang:null,htmlFor:At,httpEquiv:At,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:At,itemRef:At,itemScope:tt,itemType:At,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,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:tt,optimum:Se,pattern:null,ping:At,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:At,required:tt,reversed:tt,rows:Se,rowSpan:Se,sandbox:At,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:tt,useMap:null,value:rn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:At,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tt,disableRemotePlayback:tt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:f4}),ZT=Xo({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:rr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:At,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:$o,g2:$o,glyphName:$o,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:rr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:At,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rr,rev:rr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rr,requiredFeatures:rr,requiredFonts:rr,requiredFormats:rr,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:rr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:d4}),p4=Xo({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()}}),h4=Xo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:f4}),m4=Xo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JT={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"},WT=/[A-Z]/g,xv=/-[a-z]/g,e3=/^data[-\w.:]+$/i;function g4(e,t){const r=$h(t);let a=t,o=Kn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&e3.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(xv,n3);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!xv.test(i)){let u=i.replace(WT,t3);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}o=Nm}return new o(a,t)}function t3(e){return"-"+e.toLowerCase()}function n3(e){return e.charAt(1).toUpperCase()}const x4=c4([u4,QT,p4,h4,m4],"html"),Ul=c4([u4,ZT,p4,h4,m4],"svg");function y4(e){return e.join(" ").trim()}var To={},th,yv;function r3(){if(yv)return th;yv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
34
+ `,p="/",m="*",x="",v="comment",_="declaration";function w(k,N){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];N=N||{};var A=1,E=1;function D(M){var P=M.match(t);P&&(A+=P.length);var T=M.lastIndexOf(h);E=~T?M.length-T:E+M.length}function L(){var M={line:A,column:E};return function(P){return P.position=new z(M),B(),P}}function z(M){this.start=M,this.end={line:A,column:E},this.source=N.source}z.prototype.content=k;function $(M){var P=new Error(N.source+":"+A+":"+E+": "+M);if(P.reason=M,P.filename=N.source,P.line=A,P.column=E,P.source=k,!N.silent)throw P}function R(M){var P=M.exec(k);if(P){var T=P[0];return D(T),k=k.slice(T.length),P}}function B(){R(r)}function H(M){var P;for(M=M||[];P=J();)P!==!1&&M.push(P);return M}function J(){var M=L();if(!(p!=k.charAt(0)||m!=k.charAt(1))){for(var P=2;x!=k.charAt(P)&&(m!=k.charAt(P)||p!=k.charAt(P+1));)++P;if(P+=2,x===k.charAt(P-1))return $("End of comment missing");var T=k.slice(2,P-2);return E+=2,D(T),k=k.slice(P),E+=2,M({type:v,comment:T})}}function oe(){var M=L(),P=R(a);if(P){if(J(),!R(o))return $("property missing ':'");var T=R(i),F=M({type:_,property:S(P[0].replace(e,x)),value:T?S(T[0].replace(e,x)):x});return R(u),F}}function ce(){var M=[];H(M);for(var P;P=oe();)P!==!1&&(M.push(P),H(M));return M}return B(),ce()}function S(k){return k?k.replace(f,x):x}return th=w,th}var bv;function a3(){if(bv)return To;bv=1;var e=To&&To.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(To,"__esModule",{value:!0}),To.default=r;const t=e(r3());function r(a,o){let i=null;if(!a||typeof a!="string")return i;const u=(0,t.default)(a),f=typeof o=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:m}=h;f?o(p,m,h):m&&(i=i||{},i[p]=m)}),i}return To}var Gi={},vv;function s3(){if(vv)return Gi;vv=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(p){return!p||r.test(p)||e.test(p)},u=function(p,m){return m.toUpperCase()},f=function(p,m){return"".concat(m,"-")},h=function(p,m){return m===void 0&&(m={}),i(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(o,f):p=p.replace(a,f),p.replace(t,u))};return Gi.camelCase=h,Gi}var Vi,_v;function o3(){if(_v)return Vi;_v=1;var e=Vi&&Vi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(a3()),r=s3();function a(o,i){var u={};return!o||typeof o!="string"||(0,t.default)(o,function(f,h){f&&h&&(u[(0,r.camelCase)(f,i)]=h)}),u}return a.default=a,Vi=a,Vi}var i3=o3();const l3=I_(i3),c3=u3("start");function u3(e){return t;function t(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function d3(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?wv(e.position):"start"in e||"end"in e?wv(e):"line"in e||"column"in e?Uh(e):""}function Uh(e){return Sv(e&&e.line)+":"+Sv(e&&e.column)}function wv(e){return Uh(e&&e.start)+"-"+Uh(e&&e.end)}function Sv(e){return e&&typeof e=="number"?e:1}class zn extends Error{constructor(t,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let o="",i={},u=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof t=="string"?o=t:!i.cause&&t&&(u=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof a=="string"){const h=a.indexOf(":");h===-1?i.ruleId=a:(i.source=a.slice(0,h),i.ruleId=a.slice(h+1))}if(!i.place&&i.ancestors&&i.ancestors){const h=i.ancestors[i.ancestors.length-1];h&&(i.place=h.position)}const f=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=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=d3(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=u&&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}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const Em={}.hasOwnProperty,f3=new Map,p3=/[A-Z]/g,h3=new Set(["table","tbody","thead","tfoot","tr"]),m3=new Set(["td","th"]),b4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function g3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=j3(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=S3(r,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ul:x4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=v4(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function v4(e,t,r){if(t.type==="element")return x3(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return y3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return v3(e,t,r);if(t.type==="mdxjsEsm")return b3(e,t);if(t.type==="root")return _3(e,t,r);if(t.type==="text")return w3(e,t)}function x3(e,t,r){const a=e.schema;let o=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(o=Ul,e.schema=o),e.ancestors.push(t);const i=w4(e,t.tagName,!1),u=k3(e,t);let f=Am(e,t);return h3.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!cd(h):!0})),_4(e,u,i,t),Cm(u,f),e.ancestors.pop(),e.schema=a,e.create(t,i,u,r)}function y3(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}bl(e,t.position)}function b3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bl(e,t.position)}function v3(e,t,r){const a=e.schema;let o=a;t.name==="svg"&&a.space==="html"&&(o=Ul,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:w4(e,t.name,!0),u=N3(e,t),f=Am(e,t);return _4(e,u,i,t),Cm(u,f),e.ancestors.pop(),e.schema=a,e.create(t,i,u,r)}function _3(e,t,r){const a={};return Cm(a,Am(e,t)),e.create(t,e.Fragment,a,r)}function w3(e,t){return t.value}function _4(e,t,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=a)}function Cm(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function S3(e,t,r){return a;function a(o,i,u,f){const p=Array.isArray(u.children)?r:t;return f?p(i,u,f):p(i,u)}}function j3(e,t){return r;function r(a,o,i,u){const f=Array.isArray(i.children),h=c3(a);return t(o,i,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function k3(e,t){const r={};let a,o;for(o in t.properties)if(o!=="children"&&Em.call(t.properties,o)){const i=E3(e,o,t.properties[o]);if(i){const[u,f]=i;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&m3.has(t.tagName)?a=f:r[u]=f}}if(a){const i=r.style||(r.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function N3(e,t){const r={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const i=a.data.estree.body[0];i.type;const u=i.expression;u.type;const f=u.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else bl(e,t.position);else{const o=a.name;let i;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,i=e.evaluater.evaluateExpression(f.expression)}else bl(e,t.position);else i=a.value===null?!0:a.value;r[o]=i}return r}function Am(e,t){const r=[];let a=-1;const o=e.passKeys?new Map:f3;for(;++a<t.children.length;){const i=t.children[a];let u;if(e.passKeys){const h=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(h){const p=o.get(h)||0;u=h+"-"+p,o.set(h,p+1)}}const f=v4(e,i,u);f!==void 0&&r.push(f)}return r}function E3(e,t,r){const a=g4(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?l4(r):y4(r)),a.property==="style"){let o=typeof r=="object"?r:C3(e,String(r));return e.stylePropertyNameCase==="css"&&(o=A3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&a.space?JT[a.property]||a.property:a.attribute,r]}}function C3(e,t){try{return l3(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,o=new zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=b4+"#cannot-parse-style-attribute",o}}function w4(e,t,r){let a;if(!r)a={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,u;for(;++i<o.length;){const f=hv(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(i&&f.type==="Literal"),optional:!1}:f}a=u}else a=hv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const o=a.value;return Em.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(a);bl(e)}function bl(e,t){const r=new zn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=b4+"#cannot-handle-mdx-estrees-without-createevaluater",r}function A3(e){const t={};let r;for(r in e)Em.call(e,r)&&(t[R3(r)]=e[r]);return t}function R3(e){let t=e.replace(p3,T3);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function T3(e){return"-"+e.toLowerCase()}var Ph=Object.defineProperty,L3=Object.getOwnPropertyDescriptor,D3=Object.getOwnPropertyNames,O3=Object.prototype.hasOwnProperty,M3=(e,t)=>{let r={};for(var a in e)Ph(r,a,{get:e[a],enumerable:!0});return Ph(r,Symbol.toStringTag,{value:"Module"}),r},z3=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=D3(t),i=0,u=o.length,f;i<u;i++)f=o[i],!O3.call(e,f)&&f!==r&&Ph(e,f,{get:(h=>t[h]).bind(null,f),enumerable:!(a=L3(t,f))||a.enumerable});return e},$3=(e,t,r)=>(z3(e,t,"default"),r),Rt=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function B3(e){return Rm(e)}function Rm(e){return Array.isArray(e)?I3(e):e instanceof RegExp?e:typeof e=="object"?U3(e):e}function I3(e){let t=[];for(let r=0,a=e.length;r<a;r++)t[r]=Rm(e[r]);return t}function U3(e){let t={};for(let r in e)t[r]=Rm(e[r]);return t}function S4(e,...t){return t.forEach(r=>{for(let a in r)e[a]=r[a]}),e}function j4(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?j4(e.substring(0,e.length-1)):e.substr(~t+1)}var nh=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,uu=class{static hasCaptures(e){return e===null?!1:(nh.lastIndex=0,nh.test(e))}static replaceCaptures(e,t,r){return e.replace(nh,(a,o,i,u)=>{let f=r[parseInt(o||i,10)];if(f){let h=t.substring(f.start,f.end);for(;h[0]===".";)h=h.substring(1);switch(u){case"downcase":return h.toLowerCase();case"upcase":return h.toUpperCase();default:return h}}else return a})}};function k4(e,t){return e<t?-1:e>t?1:0}function N4(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let r=e.length,a=t.length;if(r===a){for(let o=0;o<r;o++){let i=k4(e[o],t[o]);if(i!==0)return i}return 0}return r-a}function jv(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function E4(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var C4=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Pu=class{constructor(e,t,r){this._colorMap=e,this._defaults=t,this._root=r}static createFromRawTheme(e,t){return this.createFromParsedTheme(q3(e),t)}static createFromParsedTheme(e,t){return G3(e,t)}_cachedMatchRoot=new C4(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,a=this._cachedMatchRoot.get(t).find(o=>P3(e.parent,o.parentScopes));return a?new A4(a.fontStyle,a.foreground,a.background):null}},rh=class Cu{constructor(t,r){this.parent=t,this.scopeName=r}static push(t,r){for(const a of r)t=new Cu(t,a);return t}static from(...t){let r=null;for(let a=0;a<t.length;a++)r=new Cu(r,t[a]);return r}push(t){return new Cu(this,t)}getSegments(){let t=this;const r=[];for(;t;)r.push(t.scopeName),t=t.parent;return r.reverse(),r}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const r=[];let a=this;for(;a&&a!==t;)r.push(a.scopeName),a=a.parent;return a===t?r.reverse():void 0}};function P3(e,t){if(t.length===0)return!0;for(let r=0;r<t.length;r++){let a=t[r],o=!1;if(a===">"){if(r===t.length-1)return!1;a=t[++r],o=!0}for(;e&&!H3(e.scopeName,a);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function H3(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var A4=class{constructor(e,t,r){this.fontStyle=e,this.foregroundId=t,this.backgroundId=r}};function q3(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,r=[],a=0;for(let o=0,i=t.length;o<i;o++){let u=t[o];if(!u.settings)continue;let f;if(typeof u.scope=="string"){let x=u.scope;x=x.replace(/^[,]+/,""),x=x.replace(/[,]+$/,""),f=x.split(",")}else Array.isArray(u.scope)?f=u.scope:f=[""];let h=-1;if(typeof u.settings.fontStyle=="string"){h=0;let x=u.settings.fontStyle.split(" ");for(let v=0,_=x.length;v<_;v++)switch(x[v]){case"italic":h=h|1;break;case"bold":h=h|2;break;case"underline":h=h|4;break;case"strikethrough":h=h|8;break}}let p=null;typeof u.settings.foreground=="string"&&jv(u.settings.foreground)&&(p=u.settings.foreground);let m=null;typeof u.settings.background=="string"&&jv(u.settings.background)&&(m=u.settings.background);for(let x=0,v=f.length;x<v;x++){let w=f[x].trim().split(" "),S=w[w.length-1],k=null;w.length>1&&(k=w.slice(0,w.length-1),k.reverse()),r[a++]=new F3(S,k,o,h,p,m)}}return r}var F3=class{constructor(e,t,r,a,o,i){this.scope=e,this.parentScopes=t,this.index=r,this.fontStyle=a,this.foreground=o,this.background=i}},Nn=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Nn||{});function G3(e,t){e.sort((h,p)=>{let m=k4(h.scope,p.scope);return m!==0||(m=N4(h.parentScopes,p.parentScopes),m!==0)?m:h.index-p.index});let r=0,a="#000000",o="#ffffff";for(;e.length>=1&&e[0].scope==="";){let h=e.shift();h.fontStyle!==-1&&(r=h.fontStyle),h.foreground!==null&&(a=h.foreground),h.background!==null&&(o=h.background)}let i=new V3(t),u=new A4(r,i.getId(a),i.getId(o)),f=new K3(new Hh(0,null,-1,0,0),[]);for(let h=0,p=e.length;h<p;h++){let m=e[h];f.insert(0,m.scope,m.parentScopes,m.fontStyle,i.getId(m.foreground),i.getId(m.background))}return new Pu(i,u,f)}var V3=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,r=e.length;t<r;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Y3=Object.freeze([]),Hh=class R4{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,r,a,o,i){this.scopeDepth=t,this.parentScopes=r||Y3,this.fontStyle=a,this.foreground=o,this.background=i}clone(){return new R4(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let r=[];for(let a=0,o=t.length;a<o;a++)r[a]=t[a].clone();return r}acceptOverwrite(t,r,a,o){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,r!==-1&&(this.fontStyle=r),a!==0&&(this.foreground=a),o!==0&&(this.background=o)}},K3=class qh{constructor(t,r=[],a={}){this._mainRule=t,this._children=a,this._rulesWithParentScopes=r}_rulesWithParentScopes;static _cmpBySpecificity(t,r){if(t.scopeDepth!==r.scopeDepth)return r.scopeDepth-t.scopeDepth;let a=0,o=0;for(;t.parentScopes[a]===">"&&a++,r.parentScopes[o]===">"&&o++,!(a>=t.parentScopes.length||o>=r.parentScopes.length);){const i=r.parentScopes[o].length-t.parentScopes[a].length;if(i!==0)return i;a++,o++}return r.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let a=t.indexOf("."),o,i;if(a===-1?(o=t,i=""):(o=t.substring(0,a),i=t.substring(a+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const r=this._rulesWithParentScopes.concat(this._mainRule);return r.sort(qh._cmpBySpecificity),r}insert(t,r,a,o,i,u){if(r===""){this._doInsertHere(t,a,o,i,u);return}let f=r.indexOf("."),h,p;f===-1?(h=r,p=""):(h=r.substring(0,f),p=r.substring(f+1));let m;this._children.hasOwnProperty(h)?m=this._children[h]:(m=new qh(this._mainRule.clone(),Hh.cloneArr(this._rulesWithParentScopes)),this._children[h]=m),m.insert(t+1,p,a,o,i,u)}_doInsertHere(t,r,a,o,i){if(r===null){this._mainRule.acceptOverwrite(t,a,o,i);return}for(let u=0,f=this._rulesWithParentScopes.length;u<f;u++){let h=this._rulesWithParentScopes[u];if(N4(h.parentScopes,r)===0){h.acceptOverwrite(t,a,o,i);return}}a===-1&&(a=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Hh(t,r,a,o,i))}},Ho=class vr{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const r=vr.getLanguageId(t),a=vr.getTokenType(t),o=vr.getFontStyle(t),i=vr.getForeground(t),u=vr.getBackground(t);console.log({languageId:r,tokenType:a,fontStyle:o,foreground:i,background:u})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,r,a,o,i,u,f){let h=vr.getLanguageId(t),p=vr.getTokenType(t),m=vr.containsBalancedBrackets(t)?1:0,x=vr.getFontStyle(t),v=vr.getForeground(t),_=vr.getBackground(t);return r!==0&&(h=r),a!==8&&(p=a),o!==null&&(m=o?1:0),i!==-1&&(x=i),u!==0&&(v=u),f!==0&&(_=f),(h<<0|p<<8|m<<10|x<<11|v<<15|_<<24)>>>0}};function Hu(e,t){const r=[],a=X3(e);let o=a.next();for(;o!==null;){let h=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":h=1;break;case"L":h=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=a.next()}let p=u();if(r.push({matcher:p,priority:h}),o!==",")break;o=a.next()}return r;function i(){if(o==="-"){o=a.next();const h=i();return p=>!!h&&!h(p)}if(o==="("){o=a.next();const h=f();return o===")"&&(o=a.next()),h}if(kv(o)){const h=[];do h.push(o),o=a.next();while(kv(o));return p=>t(h,p)}return null}function u(){const h=[];let p=i();for(;p;)h.push(p),p=i();return m=>h.every(x=>x(m))}function f(){const h=[];let p=u();for(;p&&(h.push(p),o==="|"||o===",");){do o=a.next();while(o==="|"||o===",");p=u()}return m=>h.some(x=>x(m))}}function kv(e){return!!e&&!!e.match(/[\w\.:]+/)}function X3(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,r=t.exec(e);return{next:()=>{if(!r)return null;const a=r[0];return r=t.exec(e),a}}}function T4(e){typeof e.dispose=="function"&&e.dispose()}var vl=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Q3=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Z3=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},J3=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new vl(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Z3;for(const r of e)W3(r,this.initialScopeName,this.repo,t);for(const r of t.references)if(r instanceof vl){if(this.seenFullScopeRequests.has(r.scopeName))continue;this.seenFullScopeRequests.add(r.scopeName),this.Q.push(r)}else{if(this.seenFullScopeRequests.has(r.scopeName)||this.seenPartialScopeRequests.has(r.toKey()))continue;this.seenPartialScopeRequests.add(r.toKey()),this.Q.push(r)}}};function W3(e,t,r,a){const o=r.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=r.lookup(t);e instanceof vl?Au({baseGrammar:i,selfGrammar:o},a):Fh(e.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},a);const u=r.injections(e.scopeName);if(u)for(const f of u)a.add(new vl(f))}function Fh(e,t,r){if(t.repository&&t.repository[e]){const a=t.repository[e];qu([a],t,r)}}function Au(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&qu(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&qu(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function qu(e,t,r){for(const a of e){if(r.visitedRule.has(a))continue;r.visitedRule.add(a);const o=a.repository?S4({},t.repository,a.repository):t.repository;Array.isArray(a.patterns)&&qu(a.patterns,{...t,repository:o},r);const i=a.include;if(!i)continue;const u=L4(i);switch(u.kind){case 0:Au({...t,selfGrammar:t.baseGrammar},r);break;case 1:Au(t,r);break;case 2:Fh(u.ruleName,{...t,repository:o},r);break;case 3:case 4:const f=u.scopeName===t.selfGrammar.scopeName?t.selfGrammar:u.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(f){const h={baseGrammar:t.baseGrammar,selfGrammar:f,repository:o};u.kind===4?Fh(u.ruleName,h,r):Au(h,r)}else u.kind===4?r.add(new Q3(u.scopeName,u.ruleName)):r.add(new vl(u.scopeName));break}}}var e5=class{kind=0},t5=class{kind=1},n5=class{constructor(e){this.ruleName=e}kind=2},r5=class{constructor(e){this.scopeName=e}kind=3},a5=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function L4(e){if(e==="$base")return new e5;if(e==="$self")return new t5;const t=e.indexOf("#");if(t===-1)return new r5(e);if(t===0)return new n5(e.substring(1));{const r=e.substring(0,t),a=e.substring(t+1);return new a5(r,a)}}var s5=/\\(\d+)/,Nv=/\\(\d+)/g,o5=-1,D4=-2;var Pl=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,r,a){this.$location=e,this.id=t,this._name=r||null,this._nameIsCapturing=uu.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=uu.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${j4(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:uu.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:uu.replaceCaptures(this._contentName,e,t)}},i5=class extends Pl{retokenizeCapturedWithRuleId;constructor(e,t,r,a,o){super(e,t,r,a),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,r,a){throw new Error("Not supported!")}},l5=class extends Pl{_match;captures;_cachedCompiledPatterns;constructor(e,t,r,a,o){super(e,t,r,null),this._match=new _l(a,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,a){return this._getCachedCompiledPatterns(e).compileAG(e,r,a)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new wl,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ev=class extends Pl{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,a,o){super(e,t,r,a),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const r of this.patterns)e.getRule(r).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,a){return this._getCachedCompiledPatterns(e).compileAG(e,r,a)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new wl,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Gh=class extends Pl{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,a,o,i,u,f,h,p){super(e,t,r,a),this._begin=new _l(o,this.id),this.beginCaptures=i,this._end=new _l(u||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=f,this.applyEndPatternLast=h||!1,this.patterns=p.patterns,this.hasMissingPatterns=p.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,r,a){return this._getCachedCompiledPatterns(e,t).compileAG(e,r,a)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new wl;for(const r of this.patterns)e.getRule(r).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Fu=class extends Pl{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,r,a,o,i,u,f,h){super(e,t,r,a),this._begin=new _l(o,this.id),this.beginCaptures=i,this.whileCaptures=f,this._while=new _l(u,D4),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=h.patterns,this.hasMissingPatterns=h.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,a){return this._getCachedCompiledPatterns(e).compileAG(e,r,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new wl;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,r,a){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,r,a)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new wl,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},O4=class jn{static createCaptureRule(t,r,a,o,i){return t.registerRule(u=>new i5(r,u,a,o,i))}static getCompiledRuleId(t,r,a){return t.id||r.registerRule(o=>{if(t.id=o,t.match)return new l5(t.$vscodeTextmateLocation,t.id,t.name,t.match,jn._compileCaptures(t.captures,r,a));if(typeof t.begin>"u"){t.repository&&(a=S4({},a,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new Ev(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,jn._compilePatterns(i,r,a))}return t.while?new Fu(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,jn._compileCaptures(t.beginCaptures||t.captures,r,a),t.while,jn._compileCaptures(t.whileCaptures||t.captures,r,a),jn._compilePatterns(t.patterns,r,a)):new Gh(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,jn._compileCaptures(t.beginCaptures||t.captures,r,a),t.end,jn._compileCaptures(t.endCaptures||t.captures,r,a),t.applyEndPatternLast,jn._compilePatterns(t.patterns,r,a))}),t.id}static _compileCaptures(t,r,a){let o=[];if(t){let i=0;for(const u in t){if(u==="$vscodeTextmateLocation")continue;const f=parseInt(u,10);f>i&&(i=f)}for(let u=0;u<=i;u++)o[u]=null;for(const u in t){if(u==="$vscodeTextmateLocation")continue;const f=parseInt(u,10);let h=0;t[u].patterns&&(h=jn.getCompiledRuleId(t[u],r,a)),o[f]=jn.createCaptureRule(r,t[u].$vscodeTextmateLocation,t[u].name,t[u].contentName,h)}}return o}static _compilePatterns(t,r,a){let o=[];if(t)for(let i=0,u=t.length;i<u;i++){const f=t[i];let h=-1;if(f.include){const p=L4(f.include);switch(p.kind){case 0:case 1:h=jn.getCompiledRuleId(a[f.include],r,a);break;case 2:let m=a[p.ruleName];m&&(h=jn.getCompiledRuleId(m,r,a));break;case 3:case 4:const x=p.scopeName,v=p.kind===4?p.ruleName:null,_=r.getExternalGrammar(x,a);if(_)if(v){let w=_.repository[v];w&&(h=jn.getCompiledRuleId(w,r,_.repository))}else h=jn.getCompiledRuleId(_.repository.$self,r,_.repository);break}}else h=jn.getCompiledRuleId(f,r,a);if(h!==-1){const p=r.getRule(h);let m=!1;if((p instanceof Ev||p instanceof Gh||p instanceof Fu)&&p.hasMissingPatterns&&p.patterns.length===0&&(m=!0),m)continue;o.push(h)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},_l=class M4{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,r){if(t&&typeof t=="string"){const a=t.length;let o=0,i=[],u=!1;for(let f=0;f<a;f++)if(t.charAt(f)==="\\"&&f+1<a){const p=t.charAt(f+1);p==="z"?(i.push(t.substring(o,f)),i.push("$(?!\\n)(?<!\\n)"),o=f+2):(p==="A"||p==="G")&&(u=!0),f++}this.hasAnchor=u,o===0?this.source=t:(i.push(t.substring(o,a)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=r,typeof this.source=="string"?this.hasBackReferences=s5.test(this.source):this.hasBackReferences=!1}clone(){return new M4(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,r){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=r.map(o=>t.substring(o.start,o.end));return Nv.lastIndex=0,this.source.replace(Nv,(o,i)=>E4(a[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],r=[],a=[],o=[],i,u,f,h;for(i=0,u=this.source.length;i<u;i++)f=this.source.charAt(i),t[i]=f,r[i]=f,a[i]=f,o[i]=f,f==="\\"&&i+1<u&&(h=this.source.charAt(i+1),h==="A"?(t[i+1]="￿",r[i+1]="￿",a[i+1]="A",o[i+1]="A"):h==="G"?(t[i+1]="￿",r[i+1]="G",a[i+1]="￿",o[i+1]="G"):(t[i+1]=h,r[i+1]=h,a[i+1]=h,o[i+1]=h),i++);return{A0_G0:t.join(""),A0_G1:r.join(""),A1_G0:a.join(""),A1_G1:o.join("")}}resolveAnchors(t,r){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?r?this._anchorCache.A1_G1:this._anchorCache.A1_G0:r?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},wl=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(r=>r.source);this._cached=new Cv(e,t,this._items.map(r=>r.ruleId))}return this._cached}compileAG(e,t,r){return this._hasAnchors?t?r?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G0):r?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,r){let a=this._items.map(o=>o.resolveAnchors(t,r));return new Cv(e,a,this._items.map(o=>o.ruleId))}},Cv=class{constructor(e,t,r){this.regExps=t,this.rules=r,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,r=this.rules.length;t<r;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
35
+ `)}findNextMatchSync(e,t,r){const a=this.scanner.findNextMatchSync(e,t,r);return a?{ruleId:this.rules[a.index],captureIndices:a.captureIndices}:null}},ah=class{constructor(e,t){this.languageId=e,this.tokenType=t}},c5=class Vh{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,r){this._defaultAttributes=new ah(t,8),this._embeddedLanguagesMatcher=new u5(Object.entries(r||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Vh._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new ah(0,0);_getBasicScopeAttributes=new C4(t=>{const r=this._scopeToLanguage(t),a=this._toStandardTokenType(t);return new ah(r,a)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const r=t.match(Vh.STANDARD_TOKEN_TYPE_REGEXP);if(!r)return 8;switch(r[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},u5=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([r,a])=>E4(r));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Av=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function z4(e,t,r,a,o,i,u,f){const h=t.content.length;let p=!1,m=-1;if(u){const _=d5(e,t,r,a,o,i);o=_.stack,a=_.linePos,r=_.isFirstLine,m=_.anchorPosition}const x=Date.now();for(;!p;){if(f!==0&&Date.now()-x>f)return new Av(o,!0);v()}return new Av(o,!1);function v(){const _=f5(e,t,r,a,o,m);if(!_){i.produce(o,h),p=!0;return}const w=_.captureIndices,S=_.matchedRuleId,k=w&&w.length>0?w[0].end>a:!1;if(S===o5){const N=o.getRule(e);i.produce(o,w[0].start),o=o.withContentNameScopesList(o.nameScopesList),sl(e,t,r,o,i,N.endCaptures,w),i.produce(o,w[0].end);const A=o;if(o=o.parent,m=A.getAnchorPos(),!k&&A.getEnterPos()===a){o=A,i.produce(o,h),p=!0;return}}else{const N=e.getRule(S);i.produce(o,w[0].start);const A=o,E=N.getName(t.content,w),D=o.contentNameScopesList.pushAttributed(E,e);if(o=o.push(S,a,m,w[0].end===h,null,D,D),N instanceof Gh){const L=N;sl(e,t,r,o,i,L.beginCaptures,w),i.produce(o,w[0].end),m=w[0].end;const z=L.getContentName(t.content,w),$=D.pushAttributed(z,e);if(o=o.withContentNameScopesList($),L.endHasBackReferences&&(o=o.withEndRule(L.getEndWithResolvedBackReferences(t.content,w))),!k&&A.hasSameRuleAs(o)){o=o.pop(),i.produce(o,h),p=!0;return}}else if(N instanceof Fu){const L=N;sl(e,t,r,o,i,L.beginCaptures,w),i.produce(o,w[0].end),m=w[0].end;const z=L.getContentName(t.content,w),$=D.pushAttributed(z,e);if(o=o.withContentNameScopesList($),L.whileHasBackReferences&&(o=o.withEndRule(L.getWhileWithResolvedBackReferences(t.content,w))),!k&&A.hasSameRuleAs(o)){o=o.pop(),i.produce(o,h),p=!0;return}}else if(sl(e,t,r,o,i,N.captures,w),i.produce(o,w[0].end),o=o.pop(),!k){o=o.safePop(),i.produce(o,h),p=!0;return}}w[0].end>a&&(a=w[0].end,r=!1)}}function d5(e,t,r,a,o,i){let u=o.beginRuleCapturedEOL?0:-1;const f=[];for(let h=o;h;h=h.pop()){const p=h.getRule(e);p instanceof Fu&&f.push({rule:p,stack:h})}for(let h=f.pop();h;h=f.pop()){const{ruleScanner:p,findOptions:m}=m5(h.rule,e,h.stack.endRule,r,a===u),x=p.findNextMatchSync(t,a,m);if(x){if(x.ruleId!==D4){o=h.stack.pop();break}x.captureIndices&&x.captureIndices.length&&(i.produce(h.stack,x.captureIndices[0].start),sl(e,t,r,h.stack,i,h.rule.whileCaptures,x.captureIndices),i.produce(h.stack,x.captureIndices[0].end),u=x.captureIndices[0].end,x.captureIndices[0].end>a&&(a=x.captureIndices[0].end,r=!1))}else{o=h.stack.pop();break}}return{stack:o,linePos:a,anchorPosition:u,isFirstLine:r}}function f5(e,t,r,a,o,i){const u=p5(e,t,r,a,o,i),f=e.getInjections();if(f.length===0)return u;const h=h5(f,e,t,r,a,o,i);if(!h)return u;if(!u)return h;const p=u.captureIndices[0].start,m=h.captureIndices[0].start;return m<p||h.priorityMatch&&m===p?h:u}function p5(e,t,r,a,o,i){const u=o.getRule(e),{ruleScanner:f,findOptions:h}=$4(u,e,o.endRule,r,a===i),p=f.findNextMatchSync(t,a,h);return p?{captureIndices:p.captureIndices,matchedRuleId:p.ruleId}:null}function h5(e,t,r,a,o,i,u){let f=Number.MAX_VALUE,h=null,p,m=0;const x=i.contentNameScopesList.getScopeNames();for(let v=0,_=e.length;v<_;v++){const w=e[v];if(!w.matcher(x))continue;const S=t.getRule(w.ruleId),{ruleScanner:k,findOptions:N}=$4(S,t,null,a,o===u),A=k.findNextMatchSync(r,o,N);if(!A)continue;const E=A.captureIndices[0].start;if(!(E>=f)&&(f=E,h=A.captureIndices,p=A.ruleId,m=w.priority,f===o))break}return h?{priorityMatch:m===-1,captureIndices:h,matchedRuleId:p}:null}function $4(e,t,r,a,o){return{ruleScanner:e.compileAG(t,r,a,o),findOptions:0}}function m5(e,t,r,a,o){return{ruleScanner:e.compileWhileAG(t,r,a,o),findOptions:0}}function sl(e,t,r,a,o,i,u){if(i.length===0)return;const f=t.content,h=Math.min(i.length,u.length),p=[],m=u[0].end;for(let x=0;x<h;x++){const v=i[x];if(v===null)continue;const _=u[x];if(_.length===0)continue;if(_.start>m)break;for(;p.length>0&&p[p.length-1].endPos<=_.start;)o.produceFromScopes(p[p.length-1].scopes,p[p.length-1].endPos),p.pop();if(p.length>0?o.produceFromScopes(p[p.length-1].scopes,_.start):o.produce(a,_.start),v.retokenizeCapturedWithRuleId){const S=v.getName(f,u),k=a.contentNameScopesList.pushAttributed(S,e),N=v.getContentName(f,u),A=k.pushAttributed(N,e),E=a.push(v.retokenizeCapturedWithRuleId,_.start,-1,!1,null,k,A),D=e.createOnigString(f.substring(0,_.end));z4(e,D,r&&_.start===0,_.start,E,o,!1,0),T4(D);continue}const w=v.getName(f,u);if(w!==null){const k=(p.length>0?p[p.length-1].scopes:a.contentNameScopesList).pushAttributed(w,e);p.push(new g5(k,_.end))}}for(;p.length>0;)o.produceFromScopes(p[p.length-1].scopes,p[p.length-1].endPos),p.pop()}var g5=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function x5(e,t,r,a,o,i,u,f){return new b5(e,t,r,a,o,i,u,f)}function Rv(e,t,r,a,o){const i=Hu(t,Gu),u=O4.getCompiledRuleId(r,a,o.repository);for(const f of i)e.push({debugSelector:t,matcher:f.matcher,ruleId:u,grammar:o,priority:f.priority})}function Gu(e,t){if(t.length<e.length)return!1;let r=0;return e.every(a=>{for(let o=r;o<t.length;o++)if(y5(t[o],a))return r=o+1,!0;return!1})}function y5(e,t){if(!e)return!1;if(e===t)return!0;const r=t.length;return e.length>r&&e.substr(0,r)===t&&e[r]==="."}var b5=class{constructor(e,t,r,a,o,i,u,f){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=f,this._basicScopeAttributesProvider=new c5(r,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=u,this._grammar=Tv(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const h of Object.keys(o)){const p=Hu(h,Gu);for(const m of p)this._tokenTypeMatchers.push({matcher:m.matcher,type:o[h]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},t=[],r=this._rootScopeName,a=e.lookup(r);if(a){const o=a.injections;if(o)for(let u in o)Rv(t,u,o[u],this,a);const i=this._grammarRepository.injections(r);i&&i.forEach(u=>{const f=this.getExternalGrammar(u);if(f){const h=f.injectionSelector;h&&Rv(t,h,f,this,f)}})}return t.sort((o,i)=>o.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,r=e(t);return this._ruleId2desc[t]=r,r}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const r=this._grammarRepository.lookup(e);if(r)return this._includedGrammars[e]=Tv(r,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,r=0){const a=this._tokenize(e,t,!1,r);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(e,t,r=0){const a=this._tokenize(e,t,!0,r);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(e,t,r,a){this._rootId===-1&&(this._rootId=O4.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!t||t===Yh.NULL){o=!0;const p=this._basicScopeAttributesProvider.getDefaultAttributes(),m=this.themeProvider.getDefaults(),x=Ho.set(0,p.languageId,p.tokenType,null,m.fontStyle,m.foregroundId,m.backgroundId),v=this.getRule(this._rootId).getName(null,null);let _;v?_=dl.createRootAndLookUpScopeName(v,x,this):_=dl.createRoot("unknown",x),t=new Yh(null,this._rootId,-1,-1,!1,null,_,_)}else o=!1,t.reset();e=e+`
36
+ `;const i=this.createOnigString(e),u=i.content.length,f=new _5(r,e,this._tokenTypeMatchers,this.balancedBracketSelectors),h=z4(this,i,o,0,t,f,!0,a);return T4(i),{lineLength:u,lineTokens:f,ruleStack:h.stack,stoppedEarly:h.stoppedEarly}}};function Tv(e,t){return e=B3(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var dl=class Fr{constructor(t,r,a){this.parent=t,this.scopePath=r,this.tokenAttributes=a}static fromExtension(t,r){let a=t,o=t?.scopePath??null;for(const i of r)o=rh.push(o,i.scopeNames),a=new Fr(a,o,i.encodedTokenAttributes);return a}static createRoot(t,r){return new Fr(null,new rh(null,t),r)}static createRootAndLookUpScopeName(t,r,a){const o=a.getMetadataForScope(t),i=new rh(null,t),u=a.themeProvider.themeMatch(i),f=Fr.mergeAttributes(r,o,u);return new Fr(null,i,f)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Fr.equals(this,t)}static equals(t,r){do{if(t===r||!t&&!r)return!0;if(!t||!r||t.scopeName!==r.scopeName||t.tokenAttributes!==r.tokenAttributes)return!1;t=t.parent,r=r.parent}while(!0)}static mergeAttributes(t,r,a){let o=-1,i=0,u=0;return a!==null&&(o=a.fontStyle,i=a.foregroundId,u=a.backgroundId),Ho.set(t,r.languageId,r.tokenType,null,o,i,u)}pushAttributed(t,r){if(t===null)return this;if(t.indexOf(" ")===-1)return Fr._pushAttributed(this,t,r);const a=t.split(/ /g);let o=this;for(const i of a)o=Fr._pushAttributed(o,i,r);return o}static _pushAttributed(t,r,a){const o=a.getMetadataForScope(r),i=t.scopePath.push(r),u=a.themeProvider.themeMatch(i),f=Fr.mergeAttributes(t.tokenAttributes,o,u);return new Fr(t,i,f)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const r=[];let a=this;for(;a&&a!==t;)r.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(a.parent?.scopePath??null)}),a=a.parent;return a===t?r.reverse():void 0}},Yh=class Ls{constructor(t,r,a,o,i,u,f,h){this.parent=t,this.ruleId=r,this.beginRuleCapturedEOL=i,this.endRule=u,this.nameScopesList=f,this.contentNameScopesList=h,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=o}_stackElementBrand=void 0;static NULL=new Ls(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:Ls._equals(this,t)}static _equals(t,r){return t===r?!0:this._structuralEquals(t,r)?dl.equals(t.contentNameScopesList,r.contentNameScopesList):!1}static _structuralEquals(t,r){do{if(t===r||!t&&!r)return!0;if(!t||!r||t.depth!==r.depth||t.ruleId!==r.ruleId||t.endRule!==r.endRule)return!1;t=t.parent,r=r.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){Ls._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,r,a,o,i,u,f){return new Ls(this,t,r,a,o,i,u,f)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,r){return this.parent&&(r=this.parent._writeString(t,r)),t[r++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,r}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Ls(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let r=this;for(;r&&r._enterPos===t._enterPos;){if(r.ruleId===t.ruleId)return!0;r=r.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,r){const a=dl.fromExtension(t?.nameScopesList??null,r.nameScopesList);return new Ls(t,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,a,dl.fromExtension(a,r.contentNameScopesList))}},v5=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(r=>r==="*"?(this.allowAny=!0,[]):Hu(r,Gu).map(a=>a.matcher)),this.unbalancedBracketScopes=t.flatMap(r=>Hu(r,Gu).map(a=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},_5=class{constructor(e,t,r,a){this.balancedBracketSelectors=a,this._emitBinaryTokens=e,this._tokenTypeOverrides=r,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let a=e?.tokenAttributes??0,o=!1;if(this.balancedBracketSelectors?.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=e?.getScopeNames()??[];for(const u of this._tokenTypeOverrides)u.matcher(i)&&(a=Ho.set(a,0,u.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(i))}if(o&&(a=Ho.set(a,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=t;return}const r=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:r}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const r=new Uint32Array(this._binaryTokens.length);for(let a=0,o=this._binaryTokens.length;a<o;a++)r[a]=this._binaryTokens[a];return r}},w5=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,r,a,o){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,x5(e,i,t,r,a,o,this,this._onigLib))}return this._grammars.get(e)}},S5=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new w5(Pu.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,r){this._syncRegistry.setTheme(Pu.createFromRawTheme(t,r))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,r,a){return this.loadGrammarWithConfiguration(t,r,{embeddedLanguages:a})}loadGrammarWithConfiguration(t,r,a){return this._loadGrammar(t,r,a.embeddedLanguages,a.tokenTypes,new v5(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,r,a,o,i){const u=new J3(this._syncRegistry,t);for(;u.Q.length>0;)u.Q.map(f=>this._loadSingleGrammar(f.scopeName)),u.processQueue();return this._grammarForScopeName(t,r,a,o,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const r=this._options.loadGrammar(t);if(r){const a=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(r,a)}}addGrammar(t,r=[],a=0,o=null){return this._syncRegistry.addGrammar(t,r),this._grammarForScopeName(t.scopeName,a,o)}_grammarForScopeName(t,r=0,a=null,o=null,i=null){return this._syncRegistry.grammarForScopeName(t,r,a,o,i)}},Kh=Yh.NULL;function Vu(e,t){const r=typeof e=="string"?{}:{...e.colorReplacements},a=typeof e=="string"?e:e.name;for(const[o,i]of Object.entries(t?.colorReplacements||{}))typeof i=="string"?r[o]=i:o===a&&Object.assign(r,i);return r}function us(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function j5(e){return Array.isArray(e)?e:[e]}async function B4(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function ud(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Tm(e){return e==="ansi"||ud(e)}function dd(e){return e==="none"}function I4(e){return dd(e)}function fd(e,t=!1){if(e.length===0)return[["",0]];const r=e.split(/(\r?\n)/g);let a=0;const o=[];for(let i=0;i<r.length;i+=2){const u=t?r[i]+(r[i+1]||""):r[i];o.push([u,a]),a+=r[i].length,a+=r[i+1]?.length||0}return o}const Lv={light:"#333333",dark:"#bbbbbb"},Dv={light:"#fffffe",dark:"#1e1e1e"},Ov="__shiki_resolved";function Lm(e){if(e?.[Ov])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:r,fg:a}=t;if(!r||!a){const f=t.settings?t.settings.find(h=>!h.name&&!h.scope):void 0;f?.settings?.foreground&&(a=f.settings.foreground),f?.settings?.background&&(r=f.settings.background),!a&&t?.colors?.["editor.foreground"]&&(a=t.colors["editor.foreground"]),!r&&t?.colors?.["editor.background"]&&(r=t.colors["editor.background"]),a||(a=t.type==="light"?Lv.light:Lv.dark),r||(r=t.type==="light"?Dv.light:Dv.dark),t.fg=a,t.bg=r}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const i=new Map;function u(f){if(i.has(f))return i.get(f);o+=1;const h=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${h}`]?u(f):(i.set(f,h),h)}t.settings=t.settings.map(f=>{const h=f.settings?.foreground&&!f.settings.foreground.startsWith("#"),p=f.settings?.background&&!f.settings.background.startsWith("#");if(!h&&!p)return f;const m={...f,settings:{...f.settings}};if(h){const x=u(f.settings.foreground);t.colorReplacements[x]=f.settings.foreground,m.settings.foreground=x}if(p){const x=u(f.settings.background);t.colorReplacements[x]=f.settings.background,m.settings.background=x}return m});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!t.colors[f]?.startsWith("#")){const h=u(t.colors[f]);t.colorReplacements[h]=t.colors[f],t.colors[f]=h}return Object.defineProperty(t,Ov,{enumerable:!1,writable:!1,value:!0}),t}async function U4(e){return Array.from(new Set((await Promise.all(e.filter(t=>!Tm(t)).map(async t=>await B4(t).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function P4(e){return(await Promise.all(e.map(async t=>I4(t)?null:Lm(await B4(t))))).filter(t=>!!t)}function H4(e,t){if(!t)return e;if(t[e]){const r=new Set([e]);for(;t[e];){if(e=t[e],r.has(e))throw new Rt(`Circular alias \`${Array.from(r).join(" -> ")} -> ${e}\``);r.add(e)}}return e}var k5=class extends S5{_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,r,a={}){super(e),this._resolver=e,this._themes=t,this._langs=r,this._alias=a,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Lm(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Pu.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=H4(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const a=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(a.name=e.name,this._resolvedGrammars.set(e.name,a),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,t.size)for(const o of t)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const a of e)this.resolveEmbeddedLanguages(a);const t=Array.from(this._langGraph.entries()),r=t.filter(([a,o])=>!o);if(r.length){const a=t.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(u=>r.map(([f])=>f).includes(u)):!1).filter(o=>!r.includes(o));throw new Rt(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${a.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[a,o]of t)this._resolver.addLanguage(o);for(const[a,o]of t)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const r of t)this._langGraph.set(r,this._langMap.get(r))}},N5=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},t.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let r=[];for(let a=1;a<=t.length;a++){const o=t.slice(0,a).join(".");r=[...r,...this._injections.get(o)||[]]}return r}};let Yi=0;function E5(e){Yi+=1,e.warnings!==!1&&Yi>=10&&Yi%10===0&&console.warn(`[Shiki] ${Yi} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Rt("`engine` option is required for synchronous mode");const r=(e.langs||[]).flat(1),a=(e.themes||[]).flat(1).map(Lm),o=new k5(new N5(e.engine,r),a,r,e.langAlias);let i;function u(A){return H4(A,e.langAlias)}function f(A){k();const E=o.getGrammar(typeof A=="string"?A:A.name);if(!E)throw new Rt(`Language \`${A}\` not found, you may need to load it first`);return E}function h(A){if(A==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};k();const E=o.getTheme(A);if(!E)throw new Rt(`Theme \`${A}\` not found, you may need to load it first`);return E}function p(A){k();const E=h(A);return i!==A&&(o.setTheme(E),i=A),{theme:E,colorMap:o.getColorMap()}}function m(){return k(),o.getLoadedThemes()}function x(){return k(),o.getLoadedLanguages()}function v(...A){k(),o.loadLanguages(A.flat(1))}async function _(...A){return v(await U4(A))}function w(...A){k();for(const E of A.flat(1))o.loadTheme(E)}async function S(...A){return k(),w(await P4(A))}function k(){if(t)throw new Rt("Shiki instance has been disposed")}function N(){t||(t=!0,o.dispose(),Yi-=1)}return{setTheme:p,getTheme:h,getLanguage:f,getLoadedThemes:m,getLoadedLanguages:x,resolveLangAlias:u,loadLanguage:_,loadLanguageSync:v,loadTheme:S,loadThemeSync:w,dispose:N,[Symbol.dispose]:N}}async function C5(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,r,a]=await Promise.all([P4(e.themes||[]),U4(e.langs||[]),e.engine]);return E5({...e,themes:t,langs:r,engine:a})}const q4=new WeakMap;function pd(e,t){q4.set(e,t)}function Sl(e){return q4.get(e)}var hd=class F4{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,r){return new F4(Object.fromEntries(j5(r).map(a=>[a,Kh])),t)}constructor(...t){if(t.length===2){const[r,a]=t;this.lang=a,this._stacks=r}else{const[r,a,o]=t;this.lang=a,this._stacks={[o]:r}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return A5(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function A5(e){const t=[],r=new Set;function a(o){if(r.has(o))return;r.add(o);const i=o?.nameScopesList?.scopeName;i&&t.push(i),o.parent&&a(o.parent)}return a(e),t}function R5(e,t){if(!(e instanceof hd))throw new Rt("Invalid grammar state");return e.getInternalStack(t)}function G4(e,t,r={}){const{theme:a=e.getLoadedThemes()[0]}=r;if(ud(e.resolveLangAlias(r.lang||"text"))||dd(a))return fd(t).map(f=>[{content:f[0],offset:f[1]}]);const{theme:o,colorMap:i}=e.setTheme(a),u=e.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==u.name)throw new Rt(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${u.name}"`);if(!r.grammarState.themes.includes(o.name))throw new Rt(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return L5(t,u,o,i,r)}function T5(...e){if(e.length===2)return Sl(e[1]);const[t,r,a={}]=e,{lang:o="text",theme:i=t.getLoadedThemes()[0]}=a;if(ud(o)||dd(i))throw new Rt("Plain language does not have grammar state");if(o==="ansi")throw new Rt("ANSI language does not have grammar state");const{theme:u,colorMap:f}=t.setTheme(i),h=t.getLanguage(o);return new hd(Dm(r,h,u,f,a).stateStack,h.name,u.name)}function L5(e,t,r,a,o){const i=Dm(e,t,r,a,o),u=new hd(i.stateStack,t.name,r.name);return pd(i.tokens,u),i.tokens}function Dm(e,t,r,a,o){const i=Vu(r,o),{tokenizeMaxLineLength:u=0,tokenizeTimeLimit:f=500}=o,h=fd(e);let p=o.grammarState?R5(o.grammarState,r.name)??Kh:o.grammarContextCode!=null?Dm(o.grammarContextCode,t,r,a,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:Kh,m=[];const x=[];for(let v=0,_=h.length;v<_;v++){const[w,S]=h[v];if(w===""){m=[],x.push([]);continue}if(u>0&&w.length>=u){m=[],x.push([{content:w,offset:S,color:"",fontStyle:0}]);continue}let k,N,A;o.includeExplanation&&(k=t.tokenizeLine(w,p,f),N=k.tokens,A=0);const E=t.tokenizeLine2(w,p,f),D=E.tokens.length/2;for(let L=0;L<D;L++){const z=E.tokens[2*L],$=L+1<D?E.tokens[2*L+2]:w.length;if(z===$)continue;const R=E.tokens[2*L+1],B=us(a[Ho.getForeground(R)],i),H=Ho.getFontStyle(R),J={content:w.substring(z,$),offset:S+z,color:B,fontStyle:H};if(o.includeExplanation){const oe=[];if(o.includeExplanation!=="scopeName")for(const M of r.settings){let P;switch(typeof M.scope){case"string":P=M.scope.split(/,/).map(T=>T.trim());break;case"object":P=M.scope;break;default:continue}oe.push({settings:M,selectors:P.map(T=>T.split(/ /))})}J.explanation=[];let ce=0;for(;z+ce<$;){const M=N[A],P=w.substring(M.startIndex,M.endIndex);ce+=P.length,J.explanation.push({content:P,scopes:o.includeExplanation==="scopeName"?D5(M.scopes):O5(oe,M.scopes)}),A+=1}}m.push(J)}x.push(m),m=[],p=E.ruleStack}return{tokens:x,stateStack:p}}function D5(e){return e.map(t=>({scopeName:t}))}function O5(e,t){const r=[];for(let a=0,o=t.length;a<o;a++){const i=t[a];r[a]={scopeName:i,themeMatches:z5(e,i,t.slice(0,a))}}return r}function Mv(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function M5(e,t,r){if(!Mv(e[e.length-1],t))return!1;let a=e.length-2,o=r.length-1;for(;a>=0&&o>=0;)Mv(e[a],r[o])&&(a-=1),o-=1;return a===-1}function z5(e,t,r){const a=[];for(const{selectors:o,settings:i}of e)for(const u of o)if(M5(u,t,r)){a.push(i);break}return a}function V4(e,t,r,a=G4){const o=Object.entries(r.themes).filter(p=>p[1]).map(p=>({color:p[0],theme:p[1]})),i=o.map(p=>{const m=a(e,t,{...r,theme:p.theme});return{tokens:m,state:Sl(m),theme:typeof p.theme=="string"?p.theme:p.theme.name}}),u=$5(...i.map(p=>p.tokens)),f=u[0].map((p,m)=>p.map((x,v)=>{const _={content:x.content,variants:{},offset:x.offset};return"includeExplanation"in r&&r.includeExplanation&&(_.explanation=x.explanation),u.forEach((w,S)=>{const{content:k,explanation:N,offset:A,...E}=w[m][v];_.variants[o[S].color]=E}),_})),h=i[0].state?new hd(Object.fromEntries(i.map(p=>[p.theme,p.state?.getInternalStack(p.theme)])),i[0].state.lang):void 0;return h&&pd(f,h),f}function $5(...e){const t=e.map(()=>[]),r=e.length;for(let a=0;a<e[0].length;a++){const o=e.map(h=>h[a]),i=t.map(()=>[]);t.forEach((h,p)=>h.push(i[p]));const u=o.map(()=>0),f=o.map(h=>h[0]);for(;f.every(h=>h);){const h=Math.min(...f.map(p=>p.content.length));for(let p=0;p<r;p++){const m=f[p];m.content.length===h?(i[p].push(m),u[p]+=1,f[p]=o[p][u[p]]):(i[p].push({...m,content:m.content.slice(0,h)}),f[p]={...m,content:m.content.slice(h),offset:m.offset+h})}}}return t}const B5=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],zv={}.hasOwnProperty;function I5(e,t){const r=t||{};function a(o,...i){let u=a.invalid;const f=a.handlers;if(o&&zv.call(o,e)){const h=String(o[e]);u=zv.call(f,h)?f[h]:a.unknown}if(u)return u.call(this,o,...i)}return a.handlers=r.handlers||{},a.invalid=r.invalid,a.unknown=r.unknown,a}const U5=/["&'<>`]/g,P5=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,H5=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,q5=/[|\\{}()[\]^$+*?.]/g,$v=new WeakMap;function F5(e,t){if(e=e.replace(t.subset?G5(t.subset):U5,a),t.subset||t.escapeOnly)return e;return e.replace(P5,r).replace(H5,a);function r(o,i,u){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,u.charCodeAt(i+2),t)}function a(o,i,u){return t.format(o.charCodeAt(0),u.charCodeAt(i+1),t)}}function G5(e){let t=$v.get(e);return t||(t=V5(e),$v.set(e,t)),t}function V5(e){const t=[];let r=-1;for(;++r<e.length;)t.push(e[r].replace(q5,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Y5=/[\dA-Fa-f]/;function K5(e,t,r){const a="&#x"+e.toString(16).toUpperCase();return r&&t&&!Y5.test(String.fromCharCode(t))?a:a+";"}const X5=/\d/;function Q5(e,t,r){const a="&#"+String(e);return r&&t&&!X5.test(String.fromCharCode(t))?a:a+";"}const Z5=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],sh={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},J5=["cent","copy","divide","gt","lt","not","para","times"],Y4={}.hasOwnProperty,Xh={};let du;for(du in sh)Y4.call(sh,du)&&(Xh[sh[du]]=du);const W5=/[^\dA-Za-z]/;function eL(e,t,r,a){const o=String.fromCharCode(e);if(Y4.call(Xh,o)){const i=Xh[o],u="&"+i;return r&&Z5.includes(i)&&!J5.includes(i)&&(!a||t&&t!==61&&W5.test(String.fromCharCode(t)))?u:u+";"}return""}function tL(e,t,r){let a=K5(e,t,r.omitOptionalSemicolons),o;if((r.useNamedReferences||r.useShortestReferences)&&(o=eL(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!o)&&r.useShortestReferences){const i=Q5(e,t,r.omitOptionalSemicolons);i.length<a.length&&(a=i)}return o&&(!r.useShortestReferences||o.length<a.length)?o:a}function Bo(e,t){return F5(e,Object.assign({format:tL},t))}const nL=/^>|^->|<!--|-->|--!>|<!-$/g,rL=[">"],aL=["<",">"];function sL(e,t,r,a){return a.settings.bogusComments?"<?"+Bo(e.value,Object.assign({},a.settings.characterReferences,{subset:rL}))+">":"<!--"+e.value.replace(nL,o)+"-->";function o(i){return Bo(i,Object.assign({},a.settings.characterReferences,{subset:aL}))}}function oL(e,t,r,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function Bv(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,o=r.indexOf(t);for(;o!==-1;)a++,o=r.indexOf(t,o+t.length);return a}const cn=X4(1),K4=X4(-1),iL=[];function X4(e){return t;function t(r,a,o){const i=r?r.children:iL;let u=(a||0)+e,f=i[u];if(!o)for(;f&&cd(f);)u+=e,f=i[u];return f}}const lL={}.hasOwnProperty;function Q4(e){return t;function t(r,a,o){return lL.call(e,r.tagName)&&e[r.tagName](r,a,o)}}const Om=Q4({body:uL,caption:oh,colgroup:oh,dd:hL,dt:pL,head:oh,html:cL,li:fL,optgroup:mL,option:gL,p:dL,rp:Iv,rt:Iv,tbody:yL,td:Uv,tfoot:bL,th:Uv,thead:xL,tr:vL});function oh(e,t,r){const a=cn(r,t,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&cd(a.value.charAt(0)))}function cL(e,t,r){const a=cn(r,t);return!a||a.type!=="comment"}function uL(e,t,r){const a=cn(r,t);return!a||a.type!=="comment"}function dL(e,t,r){const a=cn(r,t);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function fL(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&a.tagName==="li"}function pL(e,t,r){const a=cn(r,t);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function hL(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function Iv(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function mL(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&a.tagName==="optgroup"}function gL(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function xL(e,t,r){const a=cn(r,t);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function yL(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function bL(e,t,r){return!cn(r,t)}function vL(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&a.tagName==="tr"}function Uv(e,t,r){const a=cn(r,t);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}const _L=Q4({body:jL,colgroup:kL,head:SL,html:wL,tbody:NL});function wL(e){const t=cn(e,-1);return!t||t.type!=="comment"}function SL(e){const t=new Set;for(const a of e.children)if(a.type==="element"&&(a.tagName==="base"||a.tagName==="title")){if(t.has(a.tagName))return!1;t.add(a.tagName)}const r=e.children[0];return!r||r.type==="element"}function jL(e){const t=cn(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&cd(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function kL(e,t,r){const a=K4(r,t),o=cn(e,-1,!0);return r&&a&&a.type==="element"&&a.tagName==="colgroup"&&Om(a,r.children.indexOf(a),r)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function NL(e,t,r){const a=K4(r,t),o=cn(e,-1);return r&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&Om(a,r.children.indexOf(a),r)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const fu={name:[[`
37
+ \f\r &/=>`.split(""),`
38
+ \f\r "&'/=>\``.split("")],[`\0
39
+ \f\r "&'/<=>`.split(""),`\0
40
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
41
+ \f\r &>`.split(""),`\0
42
+ \f\r "&'<=>\``.split("")],[`\0
43
+ \f\r "&'<=>\``.split(""),`\0
44
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function EL(e,t,r,a){const o=a.schema,i=o.space==="svg"?!1:a.settings.omitOptionalTags;let u=o.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(e.tagName.toLowerCase());const f=[];let h;o.space==="html"&&e.tagName==="svg"&&(a.schema=Ul);const p=CL(a,e.properties),m=a.all(o.space==="html"&&e.tagName==="template"?e.content:e);return a.schema=o,m&&(u=!1),(p||!i||!_L(e,t,r))&&(f.push("<",e.tagName,p?" "+p:""),u&&(o.space==="svg"||a.settings.closeSelfClosing)&&(h=p.charAt(p.length-1),(!a.settings.tightSelfClosing||h==="/"||h&&h!=='"'&&h!=="'")&&f.push(" "),f.push("/")),f.push(">")),f.push(m),!u&&(!i||!Om(e,t,r))&&f.push("</"+e.tagName+">"),f.join("")}function CL(e,t){const r=[];let a=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const i=AL(e,o,t[o]);i&&r.push(i)}}for(;++a<r.length;){const i=e.settings.tightAttributes?r[a].charAt(r[a].length-1):void 0;a!==r.length-1&&i!=='"'&&i!=="'"&&(r[a]+=" ")}return r.join("")}function AL(e,t,r){const a=g4(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let u=e.quote,f;if(a.overloadedBoolean&&(r===a.attribute||r==="")?r=!0:(a.boolean||a.overloadedBoolean)&&(typeof r!="string"||r===a.attribute||r==="")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";const h=Bo(a.attribute,Object.assign({},e.settings.characterReferences,{subset:fu.name[o][i]}));return r===!0||(r=Array.isArray(r)?(a.commaSeparated?l4:y4)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?h:(e.settings.preferUnquoted&&(f=Bo(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:fu.unquoted[o][i]}))),f!==r&&(e.settings.quoteSmart&&Bv(r,u)>Bv(r,e.alternative)&&(u=e.alternative),f=u+Bo(r,Object.assign({},e.settings.characterReferences,{subset:(u==="'"?fu.single:fu.double)[o][i],attribute:!0}))+u),h+(f&&"="+f))}const RL=["<","&"];function Z4(e,t,r,a){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?e.value:Bo(e.value,Object.assign({},a.settings.characterReferences,{subset:RL}))}function TL(e,t,r,a){return a.settings.allowDangerousHtml?e.value:Z4(e,t,r,a)}function LL(e,t,r,a){return a.all(e)}const DL=I5("type",{invalid:OL,unknown:ML,handlers:{comment:sL,doctype:oL,element:EL,raw:TL,root:LL,text:Z4}});function OL(e){throw new Error("Expected node, not `"+e+"`")}function ML(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const zL={},$L={},BL=[];function IL(e,t){const r=t||zL,a=r.quote||'"',o=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw new Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:UL,all:PL,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||B5,characterReferences:r.characterReferences||$L,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?Ul:x4,quote:a,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function UL(e,t,r){return DL(e,t,r,this)}function PL(e){const t=[],r=e&&e.children||BL;let a=-1;for(;++a<r.length;)t[a]=this.one(r[a],a,e);return t.join("")}function J4(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const r=Array.isArray(t)?t:t.split(/\s+/g);for(const a of r)a&&!e.properties.class.includes(a)&&e.properties.class.push(a);return e}function HL(e){const t=fd(e,!0).map(([o])=>o);function r(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=o,u=0;for(const f of t){if(i<f.length)break;i-=f.length,u++}return{line:u,character:i}}function a(o,i){let u=0;for(let f=0;f<o;f++)u+=t[f].length;return u+=i,u}return{lines:t,indexToPos:r,posToIndex:a}}function W4(e,t,r){const a=new Set;for(const i of e.matchAll(/:?lang=["']([^"']+)["']/g)){const u=i[1].toLowerCase().trim();u&&a.add(u)}for(const i of e.matchAll(/(?:```|~~~)([\w-]+)/g)){const u=i[1].toLowerCase().trim();u&&a.add(u)}for(const i of e.matchAll(/\\begin\{([\w-]+)\}/g)){const u=i[1].toLowerCase().trim();u&&a.add(u)}for(const i of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const u=i[1].toLowerCase().trim(),f=u.includes("/")?u.split("/").pop():u;f&&a.add(f)}if(!r)return Array.from(a);const o=r.getBundledLanguages();return Array.from(a).filter(i=>i&&o[i])}const Mm="light-dark()",qL=["color","background-color"];function FL(e,t){let r=0;const a=[];for(const o of t)o>r&&a.push({...e,content:e.content.slice(r,o),offset:e.offset+r}),r=o;return r<e.content.length&&a.push({...e,content:e.content.slice(r),offset:e.offset+r}),a}function GL(e,t){const r=Array.from(t instanceof Set?t:new Set(t)).sort((a,o)=>a-o);return r.length?e.map(a=>a.flatMap(o=>{const i=r.filter(u=>o.offset<u&&u<o.offset+o.content.length).map(u=>u-o.offset).sort((u,f)=>u-f);return i.length?FL(o,i):o})):e}function VL(e,t,r,a,o="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},u=t.map(m=>Yu(e.variants[m])),f=new Set(u.flatMap(m=>Object.keys(m))),h={},p=(m,x)=>{const v=x==="color"?"":x==="background-color"?"-bg":`-${x}`;return r+t[m]+(x==="color"?"":v)};return u.forEach((m,x)=>{for(const v of f){const _=m[v]||"inherit";if(x===0&&a&&qL.includes(v))if(a===Mm&&u.length>1){const w=t.findIndex(k=>k==="light"),S=t.findIndex(k=>k==="dark");if(w===-1||S===-1)throw new Rt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');h[v]=`light-dark(${u[w][v]||"inherit"}, ${u[S][v]||"inherit"})`,o==="css-vars"&&(h[p(x,v)]=_)}else h[v]=_;else o==="css-vars"&&(h[p(x,v)]=_)}}),i.htmlStyle=h,i}function Yu(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&Nn.Italic&&(t["font-style"]="italic"),e.fontStyle&Nn.Bold&&(t["font-weight"]="bold");const r=[];e.fontStyle&Nn.Underline&&r.push("underline"),e.fontStyle&Nn.Strikethrough&&r.push("line-through"),r.length&&(t["text-decoration"]=r.join(" "))}return t}function Qh(e){return typeof e=="string"?e:Object.entries(e).map(([t,r])=>`${t}:${r}`).join(";")}function YL(){const e=new WeakMap;function t(r){if(!e.has(r.meta)){let o=function(u){if(typeof u=="number"){if(u<0||u>r.source.length)throw new Rt(`Invalid decoration offset: ${u}. Code length: ${r.source.length}`);return{...a.indexToPos(u),offset:u}}else{const f=a.lines[u.line];if(f===void 0)throw new Rt(`Invalid decoration position ${JSON.stringify(u)}. Lines length: ${a.lines.length}`);let h=u.character;if(h<0&&(h=f.length+h),h<0||h>f.length)throw new Rt(`Invalid decoration position ${JSON.stringify(u)}. Line ${u.line} length: ${f.length}`);return{...u,character:h,offset:a.posToIndex(u.line,h)}}};const a=HL(r.source),i=(r.options.decorations||[]).map(u=>({...u,start:o(u.start),end:o(u.end)}));KL(i),e.set(r.meta,{decorations:i,converter:a,source:r.source})}return e.get(r.meta)}return{name:"shiki:decorations",tokens(r){if(this.options.decorations?.length)return GL(r,t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]))},code(r){if(!this.options.decorations?.length)return;const a=t(this),o=Array.from(r.children).filter(m=>m.type==="element"&&m.tagName==="span");if(o.length!==a.converter.lines.length)throw new Rt(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${a.converter.lines.length}). Failed to apply decorations.`);function i(m,x,v,_){const w=o[m];let S="",k=-1,N=-1;if(x===0&&(k=0),v===0&&(N=0),v===Number.POSITIVE_INFINITY&&(N=w.children.length),k===-1||N===-1)for(let E=0;E<w.children.length;E++)S+=ew(w.children[E]),k===-1&&S.length===x&&(k=E+1),N===-1&&S.length===v&&(N=E+1);if(k===-1)throw new Rt(`Failed to find start index for decoration ${JSON.stringify(_.start)}`);if(N===-1)throw new Rt(`Failed to find end index for decoration ${JSON.stringify(_.end)}`);const A=w.children.slice(k,N);if(!_.alwaysWrap&&A.length===w.children.length)f(w,_,"line");else if(!_.alwaysWrap&&A.length===1&&A[0].type==="element")f(A[0],_,"token");else{const E={type:"element",tagName:"span",properties:{},children:A};f(E,_,"wrapper"),w.children.splice(k,A.length,E)}}function u(m,x){o[m]=f(o[m],x,"line")}function f(m,x,v){const _=x.properties||{},w=x.transform||(S=>S);return m.tagName=x.tagName||"span",m.properties={...m.properties,..._,class:m.properties.class},x.properties?.class&&J4(m,x.properties.class),m=w(m,v)||m,m}const h=[],p=a.decorations.sort((m,x)=>x.start.offset-m.start.offset||m.end.offset-x.end.offset);for(const m of p){const{start:x,end:v}=m;if(x.line===v.line)i(x.line,x.character,v.character,m);else if(x.line<v.line){i(x.line,x.character,Number.POSITIVE_INFINITY,m);for(let _=x.line+1;_<v.line;_++)h.unshift(()=>u(_,m));i(v.line,0,v.character,m)}}h.forEach(m=>m())}}}function KL(e){for(let t=0;t<e.length;t++){const r=e[t];if(r.start.offset>r.end.offset)throw new Rt(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);for(let a=t+1;a<e.length;a++){const o=e[a],i=r.start.offset<=o.start.offset&&o.start.offset<r.end.offset,u=r.start.offset<o.end.offset&&o.end.offset<=r.end.offset,f=o.start.offset<=r.start.offset&&r.start.offset<o.end.offset,h=o.start.offset<r.end.offset&&r.end.offset<=o.end.offset;if(i||u||f||h){if(i&&u||f&&h||f&&r.start.offset===r.end.offset||u&&o.start.offset===o.end.offset)continue;throw new Rt(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function ew(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(ew).join(""):""}const XL=[YL()];function Ku(e){const t=QL(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...XL]}function QL(e){const t=[],r=[],a=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":r.push(o);break;default:a.push(o)}return{pre:t,post:r,normal:a}}var Ms=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],ih={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ZL(e,t){const r=e.indexOf("\x1B",t);if(r!==-1&&e[r+1]==="["){const a=e.indexOf("m",r);if(a!==-1)return{sequence:e.substring(r+2,a).split(";"),startPosition:r,position:a+1}}return{position:e.length}}function Pv(e){const t=e.shift();if(t==="2"){const r=e.splice(0,3).map(a=>Number.parseInt(a));return r.length!==3||r.some(a=>Number.isNaN(a))?void 0:{type:"rgb",rgb:r}}else if(t==="5"){const r=e.shift();if(r)return{type:"table",index:Number(r)}}}function JL(e){const t=[];for(;e.length>0;){const r=e.shift();if(!r)continue;const a=Number.parseInt(r);if(!Number.isNaN(a))if(a===0)t.push({type:"resetAll"});else if(a<=9)ih[a]&&t.push({type:"setDecoration",value:ih[a]});else if(a<=29){const o=ih[a-20];o&&(t.push({type:"resetDecoration",value:o}),o==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(a<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Ms[a-30]}});else if(a===38){const o=Pv(e);o&&t.push({type:"setForegroundColor",value:o})}else if(a===39)t.push({type:"resetForegroundColor"});else if(a<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Ms[a-40]}});else if(a===48){const o=Pv(e);o&&t.push({type:"setBackgroundColor",value:o})}else a===49?t.push({type:"resetBackgroundColor"}):a===53?t.push({type:"setDecoration",value:"overline"}):a===55?t.push({type:"resetDecoration",value:"overline"}):a>=90&&a<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Ms[a-90+8]}}):a>=100&&a<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Ms[a-100+8]}})}return t}function WL(){let e=null,t=null,r=new Set;return{parse(a){const o=[];let i=0;do{const u=ZL(a,i),f=u.sequence?a.substring(i,u.startPosition):a.substring(i);if(f.length>0&&o.push({value:f,foreground:e,background:t,decorations:new Set(r)}),u.sequence){const h=JL(u.sequence);for(const p of h)p.type==="resetAll"?(e=null,t=null,r.clear()):p.type==="resetForegroundColor"?e=null:p.type==="resetBackgroundColor"?t=null:p.type==="resetDecoration"&&r.delete(p.value);for(const p of h)p.type==="setForegroundColor"?e=p.value:p.type==="setBackgroundColor"?t=p.value:p.type==="setDecoration"&&r.add(p.value)}i=u.position}while(i<a.length);return o}}}var eD={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function tD(e=eD){function t(f){return e[f]}function r(f){return`#${f.map(h=>Math.max(0,Math.min(h,255)).toString(16).padStart(2,"0")).join("")}`}let a;function o(){if(a)return a;a=[];for(let p=0;p<Ms.length;p++)a.push(t(Ms[p]));let f=[0,95,135,175,215,255];for(let p=0;p<6;p++)for(let m=0;m<6;m++)for(let x=0;x<6;x++)a.push(r([f[p],f[m],f[x]]));let h=8;for(let p=0;p<24;p++,h+=10)a.push(r([h,h,h]));return a}function i(f){return o()[f]}function u(f){switch(f.type){case"named":return t(f.name);case"rgb":return r(f.rgb);case"table":return i(f.index)}}return{value:u}}const nD={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function rD(e,t,r){const a=Vu(e,r),o=fd(t),i=tD(Object.fromEntries(Ms.map(f=>{const h=`terminal.ansi${f[0].toUpperCase()}${f.substring(1)}`;return[f,e.colors?.[h]||nD[f]]}))),u=WL();return o.map(f=>u.parse(f[0]).map(h=>{let p,m;h.decorations.has("reverse")?(p=h.background?i.value(h.background):e.bg,m=h.foreground?i.value(h.foreground):e.fg):(p=h.foreground?i.value(h.foreground):e.fg,m=h.background?i.value(h.background):void 0),p=us(p,a),m=us(m,a),h.decorations.has("dim")&&(p=aD(p));let x=Nn.None;return h.decorations.has("bold")&&(x|=Nn.Bold),h.decorations.has("italic")&&(x|=Nn.Italic),h.decorations.has("underline")&&(x|=Nn.Underline),h.decorations.has("strikethrough")&&(x|=Nn.Strikethrough),{content:h.value,offset:f[1],color:p,bgColor:m,fontStyle:x}}))}function aD(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const a=t[1];if(a.length===8){const o=Math.round(Number.parseInt(a.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${a.slice(0,6)}${o}`}else{if(a.length===6)return`#${a}80`;if(a.length===4){const o=a[0],i=a[1],u=a[2],f=a[3];return`#${o}${o}${i}${i}${u}${u}${Math.round(Number.parseInt(`${f}${f}`,16)/2).toString(16).padStart(2,"0")}`}else if(a.length===3){const o=a[0],i=a[1],u=a[2];return`#${o}${o}${i}${i}${u}${u}80`}}}const r=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return r?`var(${r[1]}-dim)`:e}function Zh(e,t,r={}){const a=e.resolveLangAlias(r.lang||"text"),{theme:o=e.getLoadedThemes()[0]}=r;if(!ud(a)&&!dd(o)&&a==="ansi"){const{theme:i}=e.setTheme(o);return rD(i,t,r)}return G4(e,t,r)}function Xu(e,t,r){let a,o,i,u,f,h;if("themes"in r){const{defaultColor:p="light",cssVariablePrefix:m="--shiki-",colorsRendering:x="css-vars"}=r,v=Object.entries(r.themes).filter(N=>N[1]).map(N=>({color:N[0],theme:N[1]})).sort((N,A)=>N.color===p?-1:A.color===p?1:0);if(v.length===0)throw new Rt("`themes` option must not be empty");const _=V4(e,t,r,Zh);if(h=Sl(_),p&&Mm!==p&&!v.find(N=>N.color===p))throw new Rt(`\`themes\` option must contain the defaultColor key \`${p}\``);const w=v.map(N=>e.getTheme(N.theme)),S=v.map(N=>N.color);i=_.map(N=>N.map(A=>VL(A,S,m,p,x))),h&&pd(i,h);const k=v.map(N=>Vu(N.theme,r));o=Hv(v,w,k,m,p,"fg",x),a=Hv(v,w,k,m,p,"bg",x),u=`shiki-themes ${w.map(N=>N.name).join(" ")}`,f=p?void 0:[o,a].join(";")}else if("theme"in r){const p=Vu(r.theme,r);i=Zh(e,t,r);const m=e.getTheme(r.theme);a=us(m.bg,p),o=us(m.fg,p),u=m.name,h=Sl(i)}else throw new Rt("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:o,bg:a,themeName:u,rootStyle:f,grammarState:h}}function Hv(e,t,r,a,o,i,u){return e.map((f,h)=>{const p=us(t[h][i],r[h])||"inherit",m=`${a+f.color}${i==="bg"?"-bg":""}:${p}`;if(h===0&&o){if(o===Mm&&e.length>1){const x=e.findIndex(_=>_.color==="light"),v=e.findIndex(_=>_.color==="dark");if(x===-1||v===-1)throw new Rt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${us(t[x][i],r[x])||"inherit"}, ${us(t[v][i],r[v])||"inherit"});${m}`}return p}return u==="css-vars"?m:null}).filter(f=>!!f).join(";")}function Qu(e,t,r,a={meta:{},options:r,codeToHast:(o,i)=>Qu(e,o,i),codeToTokens:(o,i)=>Xu(e,o,i)}){let o=t;for(const w of Ku(r))o=w.preprocess?.call(a,o,r)||o;let{tokens:i,fg:u,bg:f,themeName:h,rootStyle:p,grammarState:m}=Xu(e,o,r);const{mergeWhitespaces:x=!0,mergeSameStyleTokens:v=!1}=r;x===!0?i=oD(i):x==="never"&&(i=iD(i)),v&&(i=lD(i));const _={...a,get source(){return o}};for(const w of Ku(r))i=w.tokens?.call(_,i)||i;return sD(i,{...r,fg:u,bg:f,themeName:h,rootStyle:r.rootStyle===!1?!1:r.rootStyle??p},_,m)}function sD(e,t,r,a=Sl(e)){const o=Ku(t),i=[],u={type:"root",children:[]},{structure:f="classic",tabindex:h="0"}=t,p={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?p.style=t.rootStyle:p.style=`background-color:${t.bg};color:${t.fg}`),h!==!1&&h!=null&&(p.tabindex=h.toString());for(const[S,k]of Object.entries(t.meta||{}))S.startsWith("_")||(p[S]=k);let m={type:"element",tagName:"pre",properties:p,children:[],data:t.data},x={type:"element",tagName:"code",properties:{},children:i};const v=[],_={...r,structure:f,addClassToHast:J4,get source(){return r.source},get tokens(){return e},get options(){return t},get root(){return u},get pre(){return m},get code(){return x},get lines(){return v}};if(e.forEach((S,k)=>{k&&(f==="inline"?u.children.push({type:"element",tagName:"br",properties:{},children:[]}):f==="classic"&&i.push({type:"text",value:`
45
+ `}));let N={type:"element",tagName:"span",properties:{class:"line"},children:[]},A=0;for(const E of S){let D={type:"element",tagName:"span",properties:{...E.htmlAttrs},children:[{type:"text",value:E.content}]};const L=Qh(E.htmlStyle||Yu(E));L&&(D.properties.style=L);for(const z of o)D=z?.span?.call(_,D,k+1,A,N,E)||D;f==="inline"?u.children.push(D):f==="classic"&&N.children.push(D),A+=E.content.length}if(f==="classic"){for(const E of o)N=E?.line?.call(_,N,k+1)||N;v.push(N),i.push(N)}else f==="inline"&&v.push(N)}),f==="classic"){for(const S of o)x=S?.code?.call(_,x)||x;m.children.push(x);for(const S of o)m=S?.pre?.call(_,m)||m;u.children.push(m)}else if(f==="inline"){const S=[];let k={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const A of u.children)A.type==="element"&&A.tagName==="br"?(S.push(k),k={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(A.type==="element"||A.type==="text")&&k.children.push(A);S.push(k);let N={type:"element",tagName:"code",properties:{},children:S};for(const A of o)N=A?.code?.call(_,N)||N;u.children=[];for(let A=0;A<N.children.length;A++){A>0&&u.children.push({type:"element",tagName:"br",properties:{},children:[]});const E=N.children[A];E.type==="element"&&u.children.push(...E.children)}}let w=u;for(const S of o)w=S?.root?.call(_,w)||w;return a&&pd(w,a),w}function oD(e){return e.map(t=>{const r=[];let a="",o;return t.forEach((i,u)=>{const f=!(i.fontStyle&&(i.fontStyle&Nn.Underline||i.fontStyle&Nn.Strikethrough));f&&i.content.match(/^\s+$/)&&t[u+1]?(o===void 0&&(o=i.offset),a+=i.content):a?(f?r.push({...i,offset:o,content:a+i.content}):r.push({content:a,offset:o},i),o=void 0,a=""):r.push(i)}),r})}function iD(e){return e.map(t=>t.flatMap(r=>{if(r.content.match(/^\s+$/))return r;const a=r.content.match(/^(\s*)(.*?)(\s*)$/);if(!a)return r;const[,o,i,u]=a;if(!o&&!u)return r;const f=[{...r,offset:r.offset+o.length,content:i}];return o&&f.unshift({content:o,offset:r.offset}),u&&f.push({content:u,offset:r.offset+o.length+i.length}),f}))}function lD(e){return e.map(t=>{const r=[];for(const a of t){if(r.length===0){r.push({...a});continue}const o=r[r.length-1],i=Qh(o.htmlStyle||Yu(o)),u=Qh(a.htmlStyle||Yu(a)),f=o.fontStyle&&(o.fontStyle&Nn.Underline||o.fontStyle&Nn.Strikethrough),h=a.fontStyle&&(a.fontStyle&Nn.Underline||a.fontStyle&Nn.Strikethrough);!f&&!h&&i===u?o.content+=a.content:r.push({...a})}return r})}const cD=IL;function uD(e,t,r){const a={meta:{},options:r,codeToHast:(i,u)=>Qu(e,i,u),codeToTokens:(i,u)=>Xu(e,i,u)};let o=cD(Qu(e,t,r,a));for(const i of Ku(r))o=i.postprocess?.call(a,o,r)||o;return o}async function dD(e){const t=await C5(e);return{getLastGrammarState:(...r)=>T5(t,...r),codeToTokensBase:(r,a)=>Zh(t,r,a),codeToTokensWithThemes:(r,a)=>V4(t,r,a),codeToTokens:(r,a)=>Xu(t,r,a),codeToHast:(r,a)=>Qu(t,r,a),codeToHtml:(r,a)=>uD(t,r,a),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function fD(e){const t=e.langs,r=e.themes,a=e.engine;async function o(i){function u(x){if(typeof x=="string"){if(x=i.langAlias?.[x]||x,Tm(x))return[];const v=t[x];if(!v)throw new Rt(`Language \`${x}\` is not included in this bundle. You may want to load it from external source.`);return v}return x}function f(x){if(I4(x))return"none";if(typeof x=="string"){const v=r[x];if(!v)throw new Rt(`Theme \`${x}\` is not included in this bundle. You may want to load it from external source.`);return v}return x}const h=(i.themes??[]).map(x=>f(x)),p=(i.langs??[]).map(x=>u(x)),m=await dD({engine:i.engine??a(),...i,themes:h,langs:p});return{...m,loadLanguage(...x){return m.loadLanguage(...x.map(u))},loadTheme(...x){return m.loadTheme(...x.map(f))},getBundledLanguages(){return t},getBundledThemes(){return r}}}return o}function pD(e){let t;async function r(a={}){if(t){const o=await t;return await Promise.all([o.loadTheme(...a.themes||[]),o.loadLanguage(...a.langs||[])]),o}else{t=e({...a,themes:[],langs:[]});const o=await t;return await Promise.all([o.loadTheme(...a.themes||[]),o.loadLanguage(...a.langs||[])]),o}}return r}function hD(e,t){const r=pD(e);async function a(o,i){const u=await r({langs:[i.lang],themes:"theme"in i?[i.theme]:Object.values(i.themes)}),f=await t?.guessEmbeddedLanguages?.(o,i.lang,u);return f&&await u.loadLanguage(...f),u}return{getSingletonHighlighter(o){return r(o)},async codeToHtml(o,i){return(await a(o,i)).codeToHtml(o,i)},async codeToHast(o,i){return(await a(o,i)).codeToHast(o,i)},async codeToTokens(o,i){return(await a(o,i)).codeToTokens(o,i)},async codeToTokensBase(o,i){return(await a(o,i)).codeToTokensBase(o,i)},async codeToTokensWithThemes(o,i){return(await a(o,i)).codeToTokensWithThemes(o,i)},async getLastGrammarState(o,i){return(await r({langs:[i.lang],themes:[i.theme]})).getLastGrammarState(o,i)}}}var qv=Object.prototype.hasOwnProperty;function Fv(e,t,r){for(r of e.keys())if(fl(r,t))return r}function fl(e,t){var r,a,o;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((a=e.length)===t.length)for(;a--&&fl(e[a],t[a]););return a===-1}if(r===Set){if(e.size!==t.size)return!1;for(a of e)if(o=a,o&&typeof o=="object"&&(o=Fv(t,o),!o)||!t.has(o))return!1;return!0}if(r===Map){if(e.size!==t.size)return!1;for(a of e)if(o=a[0],o&&typeof o=="object"&&(o=Fv(t,o),!o)||!fl(a[1],t.get(o)))return!1;return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((a=e.byteLength)===t.byteLength)for(;a--&&e.getInt8(a)===t.getInt8(a););return a===-1}if(ArrayBuffer.isView(e)){if((a=e.byteLength)===t.byteLength)for(;a--&&e[a]===t[a];);return a===-1}if(!r||typeof e=="object"){a=0;for(r in e)if(qv.call(e,r)&&++a&&!qv.call(t,r)||!(r in t)||!fl(e[r],t[r]))return!1;return Object.keys(t).length===a}}return e!==e&&t!==t}function tw(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=tw(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function Gv(){for(var e,t,r=0,a="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=tw(e))&&(a&&(a+=" "),a+=t);return a}var lh=e=>{const t=b.useRef(e);return e!==t.current&&!fl(e,t.current)&&(t.current=e),t.current},mD=(e,t,r)=>{const a=Date.now();clearTimeout(t.current.timeoutId);const o=Math.max(0,t.current.nextAllowedTime-a);t.current.timeoutId=setTimeout(()=>{e().catch(console.error),t.current.nextAllowedTime=a+r},o)},nw="plaintext",Vv=e=>e==null?[]:Array.isArray(e)?e:[e],gD=e=>e==null?null:typeof e=="string"?`s:${e}`:`o:${e.name}::${e.scopeName}`,Yv=e=>{const t=new Set,r=[];for(const a of e){const o=gD(a);o==null||t.has(o)||(t.add(o),r.push(a))}return r},xD=(e,t)=>e==null?!1:typeof e=="string"?e in t:typeof e.name=="string"&&typeof e.scopeName=="string",yD=(e,t)=>Tm(e)||t.includes(e)?e:nw,bD=(e,t,r,a)=>{const o=Vv(t),i=Vv(a),u=[...o,...i];let f=nw,h;if(e==null||typeof e=="string"&&!e.trim())return{languageId:f,langsToLoad:Yv([...i,...o])};if(typeof e=="object")f=e.name,h=e;else{const p=e.toLowerCase(),m=v=>v?.toLowerCase()===p,x=u.find(v=>typeof v=="object"&&v!=null&&!!(m(v.name)||m(v.scopeName)||m(v.scopeName?.split(".").pop())||v.aliases?.some(m)||v.fileTypes?.some(m)));x?(f=x.name||e,h=x):r?.[e]?(f=r[e],h=r[e]):(f=e,h=e)}return{languageId:f,langsToLoad:Yv([h,...i,...o])}},Kv=e=>typeof e=="object"&&e!==null&&"tokenColors"in e&&Array.isArray(e.tokenColors);function vD(e){const t=Kv(e),r=typeof e=="object"&&e!==null&&!t,a=typeof e=="object"&&e!==null&&!t&&Object.entries(e).some(([o,i])=>o.trim()!==""&&(typeof i=="string"&&i.trim()!==""||Kv(i)));return r?{isMultiTheme:!0,themeId:a?`multi-${Object.values(e).map(i=>(typeof i=="string"?i:i?.name)||"custom").sort().join("-")}`:"multi-default",multiTheme:a?e:null,themesToLoad:a?Object.values(e):[]}:{isMultiTheme:!1,themeId:typeof e=="string"?e:e?.name||"custom",singleTheme:e,themesToLoad:[e]}}function _D(e=1){return{name:"react-shiki:line-numbers",code(t){if(this.addClassToHast(t,"has-line-numbers"),e!==1){const r=t.properties?.style||"",a=r?`${r}; --line-start: ${e}`:`--line-start: ${e}`;t.properties={...t.properties,style:a}}},line(t){return this.addClassToHast(t,"line-numbers"),t}}}var Xv={light:"github-light",dark:"github-dark"},wD=(e,t)=>e.isMultiTheme?{themes:e.multiTheme??Xv,defaultColor:t.defaultColor,cssVariablePrefix:t.cssVariablePrefix}:{theme:e.singleTheme??Xv.dark},SD=e=>{const t=[...e.transformers||[]];return e.showLineNumbers&&t.push(_D(e.startingLineNumber)),t},jD=({languageId:e,resolvedTheme:t,options:r})=>{const{defaultColor:a,cssVariablePrefix:o,showLineNumbers:i,startingLineNumber:u,transformers:f,...h}=r;return{lang:e,...wD(t,r),...h,transformers:SD(r)}},kD=(e,t,r)=>{const a=r.getBundledLanguages();return W4(e).flatMap(o=>a[o]??[])},ND=(e,t,r,a={},o)=>{const[i,u]=b.useState(null),f=lh(t),h=lh(r),p=lh(a),{languageId:m,langsToLoad:x}=b.useMemo(()=>bD(f,p.customLanguages,p.langAlias,p.preloadLanguages),[f,p.customLanguages,p.preloadLanguages,p.langAlias]),v=b.useMemo(()=>vD(h),[h]),{themesToLoad:_}=v,w=b.useRef({nextAllowedTime:0,timeoutId:void 0}),S=b.useMemo(()=>jD({languageId:m,resolvedTheme:v,options:p}),[m,v,p]);return b.useEffect(()=>{let k=!0;const N=async()=>{if(!m)return;const E=p.highlighter?p.highlighter:await o(x,_,p.engine);if(!p.highlighter){const z=kD(e,m,E);z.length>0&&await E.loadLanguage(...z)}const D=yD(m,E.getLoadedLanguages()),L={...S,lang:D};if(k){const z=p.outputFormat==="html"?E.codeToHtml(e,L):g3(E.codeToHast(e,L),{jsx:c.jsx,jsxs:c.jsxs,Fragment:c.Fragment});u(z)}},{delay:A}=p;return A?mD(N,w,A):N().catch(console.error),()=>{k=!1,clearTimeout(w.current.timeoutId)}},[e,S,p.delay,p.highlighter,x,_]),i};function ED(e,{insertAt:t}={}){if(typeof document>"u")return;const r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",t==="top"&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}ED(`.relative {
46
+ position: relative;
47
+ }
48
+ .defaultStyles pre {
49
+ overflow: auto;
50
+ border-radius: 0.5rem;
51
+ padding-left: 1.5rem;
52
+ padding-right: 1.5rem;
53
+ padding-top: 1.25rem;
54
+ padding-bottom: 1.25rem;
55
+ }
56
+ .languageLabel {
57
+ position: absolute;
58
+ right: 0.75rem;
59
+ top: 0.5rem;
60
+ font-family: monospace;
61
+ font-size: 0.75rem;
62
+ letter-spacing: -0.05em;
63
+ color: rgba(107, 114, 128, 0.85);
64
+ }
65
+ .line-numbers::before {
66
+ counter-increment: line-number;
67
+ content: counter(line-number);
68
+ display: inline-flex;
69
+ justify-content: flex-end;
70
+ align-items: flex-start;
71
+ box-sizing: content-box;
72
+ min-width: var(--line-numbers-width, 2ch);
73
+ padding-left: var(--line-numbers-padding-left, 2ch);
74
+ padding-right: var(--line-numbers-padding-right, 2ch);
75
+ color: var(--line-numbers-foreground, rgba(107, 114, 128, 0.6));
76
+ font-size: var(--line-numbers-font-size, inherit);
77
+ font-weight: var(--line-numbers-font-weight, inherit);
78
+ line-height: var(--line-numbers-line-height, inherit);
79
+ font-family: var(--line-numbers-font-family, inherit);
80
+ opacity: var(--line-numbers-opacity, 1);
81
+ user-select: none;
82
+ pointer-events: none;
83
+ }
84
+ .has-line-numbers {
85
+ counter-reset: line-number calc(var(--line-start, 1) - 1);
86
+ --line-numbers-foreground: rgba(107, 114, 128, 0.5);
87
+ --line-numbers-width: 2ch;
88
+ --line-numbers-padding-left: 0ch;
89
+ --line-numbers-padding-right: 2ch;
90
+ --line-numbers-font-size: inherit;
91
+ --line-numbers-font-weight: inherit;
92
+ --line-numbers-line-height: inherit;
93
+ --line-numbers-font-family: inherit;
94
+ --line-numbers-opacity: 1;
95
+ }
96
+ `);var CD=e=>b.forwardRef(({language:t,theme:r,delay:a,transformers:o,defaultColor:i,cssVariablePrefix:u,addDefaultStyles:f=!0,style:h,langStyle:p,className:m,langClassName:x,showLanguage:v=!0,showLineNumbers:_=!1,startingLineNumber:w=1,children:S,as:k="pre",customLanguages:N,preloadLanguages:A,...E},D)=>{const L={delay:a,transformers:o,customLanguages:N,preloadLanguages:A,showLineNumbers:_,defaultColor:i,cssVariablePrefix:u,startingLineNumber:w,...E},z=typeof t=="object"?t.name||null:t?.trim()||null,$=e(S,t,r,L),R=typeof $=="string";return c.jsxs(k,{ref:D,"data-testid":"shiki-container",className:Gv("relative","not-prose",f&&"defaultStyles",m),style:h,id:"shiki-container",children:[v&&z?c.jsx("span",{className:Gv("languageLabel",x),style:p,id:"language-label",children:z}):null,R?c.jsx("div",{dangerouslySetInnerHTML:{__html:$}}):$]})}),zm=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function AD(){return 2147483648}function RD(){return typeof performance<"u"?performance.now():Date.now()}const TD=(e,t)=>e+(t-e%t)%t;async function LD(e){let t,r;const a={};function o(_){r=_,a.HEAPU8=new Uint8Array(_),a.HEAPU32=new Uint32Array(_)}function i(_,w,S){a.HEAPU8.copyWithin(_,w,w+S)}function u(_){try{return t.grow(_-r.byteLength+65535>>>16),o(t.buffer),1}catch{}}function f(_){const w=a.HEAPU8.length;_=_>>>0;const S=AD();if(_>S)return!1;for(let k=1;k<=4;k*=2){let N=w*(1+.2/k);N=Math.min(N,_+100663296);const A=Math.min(S,TD(Math.max(_,N),65536));if(u(A))return!0}return!1}const h=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function p(_,w,S=1024){const k=w+S;let N=w;for(;_[N]&&!(N>=k);)++N;if(N-w>16&&_.buffer&&h)return h.decode(_.subarray(w,N));let A="";for(;w<N;){let E=_[w++];if(!(E&128)){A+=String.fromCharCode(E);continue}const D=_[w++]&63;if((E&224)===192){A+=String.fromCharCode((E&31)<<6|D);continue}const L=_[w++]&63;if((E&240)===224?E=(E&15)<<12|D<<6|L:E=(E&7)<<18|D<<12|L<<6|_[w++]&63,E<65536)A+=String.fromCharCode(E);else{const z=E-65536;A+=String.fromCharCode(55296|z>>10,56320|z&1023)}}return A}function m(_,w){return _?p(a.HEAPU8,_,w):""}const x={emscripten_get_now:RD,emscripten_memcpy_big:i,emscripten_resize_heap:f,fd_write:()=>0};async function v(){const w=await e({env:x,wasi_snapshot_preview1:x});t=w.memory,o(t.buffer),Object.assign(a,w),a.UTF8ToString=m}return await v(),a}var DD=Object.defineProperty,OD=(e,t,r)=>t in e?DD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,on=(e,t,r)=>OD(e,typeof t!="symbol"?t+"":t,r);let pn=null;function MD(e){throw new zm(e.UTF8ToString(e.getLastOnigError()))}class md{constructor(t){on(this,"utf16Length"),on(this,"utf8Length"),on(this,"utf16Value"),on(this,"utf8Value"),on(this,"utf16OffsetToUtf8"),on(this,"utf8OffsetToUtf16");const r=t.length,a=md._utf8ByteLength(t),o=a!==r,i=o?new Uint32Array(r+1):null;o&&(i[r]=a);const u=o?new Uint32Array(a+1):null;o&&(u[a]=r);const f=new Uint8Array(a);let h=0;for(let p=0;p<r;p++){const m=t.charCodeAt(p);let x=m,v=!1;if(m>=55296&&m<=56319&&p+1<r){const _=t.charCodeAt(p+1);_>=56320&&_<=57343&&(x=(m-55296<<10)+65536|_-56320,v=!0)}o&&(i[p]=h,v&&(i[p+1]=h),x<=127?u[h+0]=p:x<=2047?(u[h+0]=p,u[h+1]=p):x<=65535?(u[h+0]=p,u[h+1]=p,u[h+2]=p):(u[h+0]=p,u[h+1]=p,u[h+2]=p,u[h+3]=p)),x<=127?f[h++]=x:x<=2047?(f[h++]=192|(x&1984)>>>6,f[h++]=128|(x&63)>>>0):x<=65535?(f[h++]=224|(x&61440)>>>12,f[h++]=128|(x&4032)>>>6,f[h++]=128|(x&63)>>>0):(f[h++]=240|(x&1835008)>>>18,f[h++]=128|(x&258048)>>>12,f[h++]=128|(x&4032)>>>6,f[h++]=128|(x&63)>>>0),v&&p++}this.utf16Length=r,this.utf8Length=a,this.utf16Value=t,this.utf8Value=f,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=u}static _utf8ByteLength(t){let r=0;for(let a=0,o=t.length;a<o;a++){const i=t.charCodeAt(a);let u=i,f=!1;if(i>=55296&&i<=56319&&a+1<o){const h=t.charCodeAt(a+1);h>=56320&&h<=57343&&(u=(i-55296<<10)+65536|h-56320,f=!0)}u<=127?r+=1:u<=2047?r+=2:u<=65535?r+=3:r+=4,f&&a++}return r}createString(t){const r=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,r),r}}const gd=class Gr{constructor(t){if(on(this,"id",++Gr.LAST_ID),on(this,"_onigBinding"),on(this,"content"),on(this,"utf16Length"),on(this,"utf8Length"),on(this,"utf16OffsetToUtf8"),on(this,"utf8OffsetToUtf16"),on(this,"ptr"),!pn)throw new zm("Must invoke loadWasm first.");this._onigBinding=pn,this.content=t;const r=new md(t);this.utf16Length=r.utf16Length,this.utf8Length=r.utf8Length,this.utf16OffsetToUtf8=r.utf16OffsetToUtf8,this.utf8OffsetToUtf16=r.utf8OffsetToUtf16,this.utf8Length<1e4&&!Gr._sharedPtrInUse?(Gr._sharedPtr||(Gr._sharedPtr=pn.omalloc(1e4)),Gr._sharedPtrInUse=!0,pn.HEAPU8.set(r.utf8Value,Gr._sharedPtr),this.ptr=Gr._sharedPtr):this.ptr=r.createString(pn)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Gr._sharedPtr?Gr._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};on(gd,"LAST_ID",0);on(gd,"_sharedPtr",0);on(gd,"_sharedPtrInUse",!1);let rw=gd;class zD{constructor(t){if(on(this,"_onigBinding"),on(this,"_ptr"),!pn)throw new zm("Must invoke loadWasm first.");const r=[],a=[];for(let f=0,h=t.length;f<h;f++){const p=new md(t[f]);r[f]=p.createString(pn),a[f]=p.utf8Length}const o=pn.omalloc(4*t.length);pn.HEAPU32.set(r,o/4);const i=pn.omalloc(4*t.length);pn.HEAPU32.set(a,i/4);const u=pn.createOnigScanner(o,i,t.length);for(let f=0,h=t.length;f<h;f++)pn.ofree(r[f]);pn.ofree(i),pn.ofree(o),u===0&&MD(pn),this._onigBinding=pn,this._ptr=u}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,r,a){let o=0;if(typeof a=="number"&&(o=a),typeof t=="string"){t=new rw(t);const i=this._findNextMatchSync(t,r,!1,o);return t.dispose(),i}return this._findNextMatchSync(t,r,!1,o)}_findNextMatchSync(t,r,a,o){const i=this._onigBinding,u=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(r),o);if(u===0)return null;const f=i.HEAPU32;let h=u/4;const p=f[h++],m=f[h++],x=[];for(let v=0;v<m;v++){const _=t.convertUtf8OffsetToUtf16(f[h++]),w=t.convertUtf8OffsetToUtf16(f[h++]);x[v]={start:_,end:w,length:w-_}}return{index:p,captureIndices:x}}}function $D(e){return typeof e.instantiator=="function"}function BD(e){return typeof e.default=="function"}function ID(e){return typeof e.data<"u"}function UD(e){return typeof Response<"u"&&e instanceof Response}function PD(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let pu;function aw(e){if(pu)return pu;async function t(){pn=await LD(async r=>{let a=e;return a=await a,typeof a=="function"&&(a=await a(r)),typeof a=="function"&&(a=await a(r)),$D(a)?a=await a.instantiator(r):BD(a)?a=await a.default(r):(ID(a)&&(a=a.data),UD(a)?typeof WebAssembly.instantiateStreaming=="function"?a=await HD(a)(r):a=await qD(a)(r):PD(a)?a=await ch(a)(r):a instanceof WebAssembly.Module?a=await ch(a)(r):"default"in a&&a.default instanceof WebAssembly.Module&&(a=await ch(a.default)(r))),"instance"in a&&(a=a.instance),"exports"in a&&(a=a.exports),a})}return pu=t(),pu}function ch(e){return t=>WebAssembly.instantiate(e,t)}function HD(e){return t=>WebAssembly.instantiateStreaming(e,t)}function qD(e){return async t=>{const r=await e.arrayBuffer();return WebAssembly.instantiate(r,t)}}let sw;function FD(e){sw=e}function GD(){return sw}async function ow(e){return e&&await aw(e),{createScanner(t){return new zD(t.map(r=>typeof r=="string"?r:r.source))},createString(t){return new rw(t)}}}const VD=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:ow,getDefaultWasmLoader:GD,loadWasm:aw,setDefaultWasmLoader:FD},Symbol.toStringTag,{value:"Module"}));var iw=M3({});$3(iw,VD);const YD=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>le(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>le(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>le(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>le(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>le(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>le(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>le(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>le(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>le(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>le(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>le(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>le(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>le(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>le(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>le(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>le(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>le(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>le(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>le(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>le(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>le(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>le(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>le(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>le(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>le(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>le(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>le(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>le(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>le(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>le(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>le(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>le(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>le(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>le(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>le(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>le(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>le(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>le(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>le(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>le(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>le(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>le(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>le(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>le(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>le(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>le(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>le(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>le(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>le(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>le(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>le(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>le(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>le(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>le(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>le(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>le(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>le(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>le(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>le(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>le(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>le(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>le(()=>import("./vesper-DU1UobuO.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>le(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>le(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>le(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],KD=Object.fromEntries(YD.map(e=>[e.id,e.import])),lw=[{id:"angular-html",name:"Angular HTML",import:(()=>le(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>le(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"astro",name:"Astro",import:(()=>le(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([6,7,2,8,3,9,10])))},{id:"blade",name:"Blade",import:(()=>le(()=>import("./blade-BjGOyj-B.js"),__vite__mapDeps([11,12,1,2,3,13,14,15,7])))},{id:"c",name:"C",import:(()=>le(()=>import("./c-BIGW1oBm.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>le(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([16,2])))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>le(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([17,18,19,20,15])))},{id:"css",name:"CSS",import:(()=>le(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>le(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"glsl",name:"GLSL",import:(()=>le(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([19,20])))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>le(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([21,2,8,22,10])))},{id:"haml",name:"Ruby Haml",import:(()=>le(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([23,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>le(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([24,1,2,3,25])))},{id:"html",name:"HTML",import:(()=>le(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>le(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([12,1,2,3])))},{id:"http",name:"HTTP",import:(()=>le(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([26,27,7,13,14,21,2,8,22,10])))},{id:"hurl",name:"Hurl",import:(()=>le(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([28,21,2,8,22,10,13,14,29])))},{id:"imba",name:"Imba",import:(()=>le(()=>import("./imba-DGztddWO.js"),[]))},{id:"java",name:"Java",import:(()=>le(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>le(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>le(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([30,1,2,3])))},{id:"jison",name:"Jison",import:(()=>le(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([31,2])))},{id:"json",name:"JSON",import:(()=>le(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>le(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>le(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>le(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>le(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>le(()=>import("./julia-CxzCAyBv.js"),__vite__mapDeps([32,17,18,19,20,15,33,2,34])))},{id:"less",name:"Less",import:(()=>le(()=>import("./less-B1dDrJ26.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>le(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>le(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([35,3,36,5,8])))},{id:"mdc",name:"MDC",import:(()=>le(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([37,38,25,12,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>le(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"php",name:"PHP",import:(()=>le(()=>import("./php-R6g_5hLQ.js"),__vite__mapDeps([39,1,2,3,13,14,15,7])))},{id:"postcss",name:"PostCSS",import:(()=>le(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>le(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([40,2,3,1])))},{id:"python",name:"Python",aliases:["py"],import:(()=>le(()=>import("./python-B6aJPvgy.js"),[]))},{id:"r",name:"R",import:(()=>le(()=>import("./r-Dspwwk_N.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>le(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"sass",name:"Sass",import:(()=>le(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scss",name:"SCSS",import:(()=>le(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>le(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"sql",name:"SQL",import:(()=>le(()=>import("./sql-BLtJtn59.js"),[]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>le(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"svelte",name:"Svelte",import:(()=>le(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([41,2,8,3,9])))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>le(()=>import("./ts-tags-DQrlYJgV.js"),__vite__mapDeps([42,8,3,2,19,20,1,15,13,14])))},{id:"tsx",name:"TSX",import:(()=>le(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>le(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"vue",name:"Vue",import:(()=>le(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([43,3,2,8,7,1,12])))},{id:"vue-html",name:"Vue HTML",import:(()=>le(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([44,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>le(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([45,3,5,36,46,9,2])))},{id:"wasm",name:"WebAssembly",import:(()=>le(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>le(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>le(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"xml",name:"XML",import:(()=>le(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([13,14])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>le(()=>import("./yaml-Buea-lGh.js"),[]))}],XD=Object.fromEntries(lw.map(e=>[e.id,e.import])),QD=Object.fromEntries(lw.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),cw={...XD,...QD},ZD=fD({langs:cw,themes:KD,engine:()=>(0,iw.createOnigurumaEngine)(le(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{getSingletonHighlighter:JD}=hD(ZD,{guessEmbeddedLanguages:W4});async function WD(e,t,r){const a=e.filter(o=>xD(o,cw));return await JD({langs:a,themes:t,engine:r??ow(le(()=>import("./wasm-CG6Dc4jp.js"),[]))})}var e6=(e,t,r,a={})=>ND(e,t,r,a,WD),t6=CD(e6),n6=t6;const r6={"actionBar.toggledBackground":"#525761","activityBar.background":"#282c34","activityBar.foreground":"#d7dae0","activityBarBadge.background":"#4d78cc","activityBarBadge.foreground":"#f8fafd","badge.background":"#282c34","button.background":"#404754","button.secondaryBackground":"#30333d","button.secondaryForeground":"#c0bdbd","checkbox.border":"#404754","debugToolBar.background":"#21252b",descriptionForeground:"#abb2bf","diffEditor.insertedTextBackground":"#00809b33","dropdown.background":"#21252b","dropdown.border":"#21252b","editor.background":"#282c34","editor.findMatchBackground":"#d19a6644","editor.findMatchBorder":"#ffffff5a","editor.findMatchHighlightBackground":"#ffffff22","editor.foreground":"#abb2bf","editor.lineHighlightBackground":"#2c313c","editor.selectionBackground":"#67769660","editor.selectionHighlightBackground":"#ffd33d44","editor.selectionHighlightBorder":"#dddddd","editor.wordHighlightBackground":"#d2e0ff2f","editor.wordHighlightBorder":"#7f848e","editor.wordHighlightStrongBackground":"#abb2bf26","editor.wordHighlightStrongBorder":"#7f848e","editorBracketHighlight.foreground1":"#d19a66","editorBracketHighlight.foreground2":"#c678dd","editorBracketHighlight.foreground3":"#56b6c2","editorBracketMatch.background":"#515a6b","editorBracketMatch.border":"#515a6b","editorCursor.background":"#ffffffc9","editorCursor.foreground":"#528bff","editorError.foreground":"#c24038","editorGroup.background":"#181a1f","editorGroup.border":"#181a1f","editorGroupHeader.tabsBackground":"#21252b","editorGutter.addedBackground":"#109868","editorGutter.deletedBackground":"#9A353D","editorGutter.modifiedBackground":"#948B60","editorHoverWidget.background":"#21252b","editorHoverWidget.border":"#181a1f","editorHoverWidget.highlightForeground":"#61afef","editorIndentGuide.activeBackground1":"#c8c8c859","editorIndentGuide.background1":"#3b4048","editorInlayHint.background":"#2c313c","editorInlayHint.foreground":"#abb2bf","editorLineNumber.activeForeground":"#abb2bf","editorLineNumber.foreground":"#495162","editorMarkerNavigation.background":"#21252b","editorOverviewRuler.addedBackground":"#109868","editorOverviewRuler.deletedBackground":"#9A353D","editorOverviewRuler.modifiedBackground":"#948B60","editorRuler.foreground":"#abb2bf26","editorSuggestWidget.background":"#21252b","editorSuggestWidget.border":"#181a1f","editorSuggestWidget.selectedBackground":"#2c313a","editorWarning.foreground":"#d19a66","editorWhitespace.foreground":"#ffffff1d","editorWidget.background":"#21252b",focusBorder:"#3e4452","gitDecoration.ignoredResourceForeground":"#636b78","input.background":"#1d1f23","input.foreground":"#abb2bf","list.activeSelectionBackground":"#2c313a","list.activeSelectionForeground":"#d7dae0","list.focusBackground":"#323842","list.focusForeground":"#f0f0f0","list.highlightForeground":"#ecebeb","list.hoverBackground":"#2c313a","list.hoverForeground":"#abb2bf","list.inactiveSelectionBackground":"#323842","list.inactiveSelectionForeground":"#d7dae0","list.warningForeground":"#d19a66","menu.foreground":"#abb2bf","menu.separatorBackground":"#343a45","minimapGutter.addedBackground":"#109868","minimapGutter.deletedBackground":"#9A353D","minimapGutter.modifiedBackground":"#948B60","multiDiffEditor.headerBackground":"#21252b","panel.border":"#3e4452","panelSectionHeader.background":"#21252b","peekViewEditor.background":"#1b1d23","peekViewEditor.matchHighlightBackground":"#29244b","peekViewResult.background":"#22262b","scrollbar.shadow":"#23252c","scrollbarSlider.activeBackground":"#747d9180","scrollbarSlider.background":"#4e566660","scrollbarSlider.hoverBackground":"#5a637580","settings.focusedRowBackground":"#282c34","settings.headerForeground":"#fff","sideBar.background":"#21252b","sideBar.foreground":"#abb2bf","sideBarSectionHeader.background":"#282c34","sideBarSectionHeader.foreground":"#abb2bf","statusBar.background":"#21252b","statusBar.debuggingBackground":"#cc6633","statusBar.debuggingBorder":"#ff000000","statusBar.debuggingForeground":"#ffffff","statusBar.foreground":"#9da5b4","statusBar.noFolderBackground":"#21252b","statusBarItem.remoteBackground":"#4d78cc","statusBarItem.remoteForeground":"#f8fafd","tab.activeBackground":"#282c34","tab.activeBorder":"#b4b4b4","tab.activeForeground":"#dcdcdc","tab.border":"#181a1f","tab.hoverBackground":"#323842","tab.inactiveBackground":"#21252b","tab.unfocusedHoverBackground":"#323842","terminal.ansiBlack":"#3f4451","terminal.ansiBlue":"#4aa5f0","terminal.ansiBrightBlack":"#4f5666","terminal.ansiBrightBlue":"#4dc4ff","terminal.ansiBrightCyan":"#4cd1e0","terminal.ansiBrightGreen":"#a5e075","terminal.ansiBrightMagenta":"#de73ff","terminal.ansiBrightRed":"#ff616e","terminal.ansiBrightWhite":"#e6e6e6","terminal.ansiBrightYellow":"#f0a45d","terminal.ansiCyan":"#42b3c2","terminal.ansiGreen":"#8cc265","terminal.ansiMagenta":"#c162de","terminal.ansiRed":"#e05561","terminal.ansiWhite":"#d7dae0","terminal.ansiYellow":"#d18f52","terminal.background":"#282c34","terminal.border":"#3e4452","terminal.foreground":"#abb2bf","terminal.selectionBackground":"#abb2bf30","textBlockQuote.background":"#2e3440","textBlockQuote.border":"#4b5362","textLink.foreground":"#61afef","textPreformat.foreground":"#d19a66","titleBar.activeBackground":"#282c34","titleBar.activeForeground":"#9da5b4","titleBar.inactiveBackground":"#282c34","titleBar.inactiveForeground":"#6b717d","tree.indentGuidesStroke":"#ffffff1d","walkThrough.embeddedEditorBackground":"#2e3440","welcomePage.buttonHoverBackground":"#404754"},a6="C4A Dark",s6="c4a-dark",o6=!0,i6={"annotation:dart":{foreground:"#d19a66"},enumMember:{foreground:"#56b6c2"},macro:{foreground:"#d19a66"},memberOperatorOverload:{foreground:"#c678dd"},"parameter.label:dart":{foreground:"#abb2bf"},"property:dart":{foreground:"#d19a66"},tomlArrayKey:{foreground:"#e5c07b"},"variable.constant":{foreground:"#d19a66"},"variable.defaultLibrary":{foreground:"#e5c07b"},"variable:dart":{foreground:"#d19a66"}},l6=JSON.parse('[{"scope":"meta.embedded","settings":{"foreground":"#abb2bf"}},{"scope":"punctuation.definition.delayed.unison,punctuation.definition.list.begin.unison,punctuation.definition.list.end.unison,punctuation.definition.ability.begin.unison,punctuation.definition.ability.end.unison,punctuation.operator.assignment.as.unison,punctuation.separator.pipe.unison,punctuation.separator.delimiter.unison,punctuation.definition.hash.unison","settings":{"foreground":"#e06c75"}},{"scope":"variable.other.generic-type.haskell","settings":{"foreground":"#c678dd"}},{"scope":"storage.type.haskell","settings":{"foreground":"#d19a66"}},{"scope":"support.variable.magic.python","settings":{"foreground":"#e06c75"}},{"scope":"punctuation.separator.period.python,punctuation.separator.element.python,punctuation.parenthesis.begin.python,punctuation.parenthesis.end.python","settings":{"foreground":"#abb2bf"}},{"scope":"variable.parameter.function.language.special.self.python","settings":{"foreground":"#e5c07b"}},{"scope":"variable.parameter.function.language.special.cls.python","settings":{"foreground":"#e5c07b"}},{"scope":"storage.modifier.lifetime.rust","settings":{"foreground":"#abb2bf"}},{"scope":"support.function.std.rust","settings":{"foreground":"#61afef"}},{"scope":"entity.name.lifetime.rust","settings":{"foreground":"#e5c07b"}},{"scope":"variable.language.rust","settings":{"foreground":"#e06c75"}},{"scope":"support.constant.edge","settings":{"foreground":"#c678dd"}},{"scope":"constant.other.character-class.regexp","settings":{"foreground":"#e06c75"}},{"scope":["keyword.operator.word"],"settings":{"foreground":"#c678dd"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d19a66"}},{"scope":"variable.parameter.function","settings":{"foreground":"#abb2bf"}},{"scope":"comment markup.link","settings":{"foreground":"#5c6370"}},{"scope":"markup.changed.diff","settings":{"foreground":"#e5c07b"}},{"scope":"meta.diff.header.from-file,meta.diff.header.to-file,punctuation.definition.from-file.diff,punctuation.definition.to-file.diff","settings":{"foreground":"#61afef"}},{"scope":"markup.inserted.diff","settings":{"foreground":"#98c379"}},{"scope":"markup.deleted.diff","settings":{"foreground":"#e06c75"}},{"scope":"meta.function.c,meta.function.cpp","settings":{"foreground":"#e06c75"}},{"scope":"punctuation.section.block.begin.bracket.curly.cpp,punctuation.section.block.end.bracket.curly.cpp,punctuation.terminator.statement.c,punctuation.section.block.begin.bracket.curly.c,punctuation.section.block.end.bracket.curly.c,punctuation.section.parens.begin.bracket.round.c,punctuation.section.parens.end.bracket.round.c,punctuation.section.parameters.begin.bracket.round.c,punctuation.section.parameters.end.bracket.round.c","settings":{"foreground":"#abb2bf"}},{"scope":"punctuation.separator.key-value","settings":{"foreground":"#abb2bf"}},{"scope":"keyword.operator.expression.import","settings":{"foreground":"#61afef"}},{"scope":"support.constant.math","settings":{"foreground":"#e5c07b"}},{"scope":"support.constant.property.math","settings":{"foreground":"#d19a66"}},{"scope":"variable.other.constant","settings":{"foreground":"#e5c07b"}},{"scope":["storage.type.annotation.java","storage.type.object.array.java"],"settings":{"foreground":"#e5c07b"}},{"scope":"source.java","settings":{"foreground":"#e06c75"}},{"scope":"punctuation.section.block.begin.java,punctuation.section.block.end.java,punctuation.definition.method-parameters.begin.java,punctuation.definition.method-parameters.end.java,meta.method.identifier.java,punctuation.section.method.begin.java,punctuation.section.method.end.java,punctuation.terminator.java,punctuation.section.class.begin.java,punctuation.section.class.end.java,punctuation.section.inner-class.begin.java,punctuation.section.inner-class.end.java,meta.method-call.java,punctuation.section.class.begin.bracket.curly.java,punctuation.section.class.end.bracket.curly.java,punctuation.section.method.begin.bracket.curly.java,punctuation.section.method.end.bracket.curly.java,punctuation.separator.period.java,punctuation.bracket.angle.java,punctuation.definition.annotation.java,meta.method.body.java","settings":{"foreground":"#abb2bf"}},{"scope":"meta.method.java","settings":{"foreground":"#61afef"}},{"scope":"storage.modifier.import.java,storage.type.java,storage.type.generic.java","settings":{"foreground":"#e5c07b"}},{"scope":"keyword.operator.instanceof.java","settings":{"foreground":"#c678dd"}},{"scope":"meta.definition.variable.name.java","settings":{"foreground":"#e06c75"}},{"scope":"keyword.operator.logical","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.bitwise","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.channel","settings":{"foreground":"#56b6c2"}},{"scope":"support.constant.property-value.scss,support.constant.property-value.css","settings":{"foreground":"#d19a66"}},{"scope":"keyword.operator.css,keyword.operator.scss,keyword.operator.less","settings":{"foreground":"#56b6c2"}},{"scope":"support.constant.color.w3c-standard-color-name.css,support.constant.color.w3c-standard-color-name.scss","settings":{"foreground":"#d19a66"}},{"scope":"punctuation.separator.list.comma.css","settings":{"foreground":"#abb2bf"}},{"scope":"support.constant.color.w3c-standard-color-name.css","settings":{"foreground":"#d19a66"}},{"scope":"support.type.vendored.property-name.css","settings":{"foreground":"#56b6c2"}},{"scope":"support.module.node,support.type.object.module,support.module.node","settings":{"foreground":"#e5c07b"}},{"scope":"entity.name.type.module","settings":{"foreground":"#e5c07b"}},{"scope":"variable.other.readwrite,meta.object-literal.key,support.variable.property,support.variable.object.process,support.variable.object.node","settings":{"foreground":"#e06c75"}},{"scope":"support.constant.json","settings":{"foreground":"#d19a66"}},{"scope":["keyword.operator.expression.instanceof","keyword.operator.new","keyword.operator.ternary","keyword.operator.optional","keyword.operator.expression.keyof"],"settings":{"foreground":"#c678dd"}},{"scope":"support.type.object.console","settings":{"foreground":"#e06c75"}},{"scope":"support.variable.property.process","settings":{"foreground":"#d19a66"}},{"scope":"entity.name.function,support.function.console","settings":{"foreground":"#61afef"}},{"scope":"keyword.operator.misc.rust","settings":{"foreground":"#abb2bf"}},{"scope":"keyword.operator.sigil.rust","settings":{"foreground":"#c678dd"}},{"scope":"keyword.operator.delete","settings":{"foreground":"#c678dd"}},{"scope":"support.type.object.dom","settings":{"foreground":"#56b6c2"}},{"scope":"support.variable.dom,support.variable.property.dom","settings":{"foreground":"#e06c75"}},{"scope":"keyword.operator.arithmetic,keyword.operator.comparison,keyword.operator.decrement,keyword.operator.increment,keyword.operator.relational","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.assignment.c,keyword.operator.comparison.c,keyword.operator.c,keyword.operator.increment.c,keyword.operator.decrement.c,keyword.operator.bitwise.shift.c,keyword.operator.assignment.cpp,keyword.operator.comparison.cpp,keyword.operator.cpp,keyword.operator.increment.cpp,keyword.operator.decrement.cpp,keyword.operator.bitwise.shift.cpp","settings":{"foreground":"#c678dd"}},{"scope":"punctuation.separator.delimiter","settings":{"foreground":"#abb2bf"}},{"scope":"punctuation.separator.c,punctuation.separator.cpp","settings":{"foreground":"#c678dd"}},{"scope":"support.type.posix-reserved.c,support.type.posix-reserved.cpp","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.sizeof.c,keyword.operator.sizeof.cpp","settings":{"foreground":"#c678dd"}},{"scope":"variable.parameter.function.language.python","settings":{"foreground":"#d19a66"}},{"scope":"support.type.python","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.logical.python","settings":{"foreground":"#c678dd"}},{"scope":"variable.parameter.function.python","settings":{"foreground":"#d19a66"}},{"scope":"punctuation.definition.arguments.begin.python,punctuation.definition.arguments.end.python,punctuation.separator.arguments.python,punctuation.definition.list.begin.python,punctuation.definition.list.end.python","settings":{"foreground":"#abb2bf"}},{"scope":"meta.function-call.generic.python","settings":{"foreground":"#61afef"}},{"scope":"constant.character.format.placeholder.other.python","settings":{"foreground":"#d19a66"}},{"scope":"keyword.operator","settings":{"foreground":"#abb2bf"}},{"scope":"keyword.operator.assignment.compound","settings":{"foreground":"#c678dd"}},{"scope":"keyword.operator.assignment.compound.js,keyword.operator.assignment.compound.ts","settings":{"foreground":"#56b6c2"}},{"scope":"keyword","settings":{"foreground":"#c678dd"}},{"scope":"entity.name.namespace","settings":{"foreground":"#e5c07b"}},{"scope":"variable","settings":{"foreground":"#e06c75"}},{"scope":"variable.c","settings":{"foreground":"#abb2bf"}},{"scope":"variable.language","settings":{"foreground":"#e5c07b"}},{"scope":"token.variable.parameter.java","settings":{"foreground":"#abb2bf"}},{"scope":"import.storage.java","settings":{"foreground":"#e5c07b"}},{"scope":"token.package.keyword","settings":{"foreground":"#c678dd"}},{"scope":"token.package","settings":{"foreground":"#abb2bf"}},{"scope":["entity.name.function","meta.require","support.function.any-method","variable.function"],"settings":{"foreground":"#61afef"}},{"scope":"entity.name.type.namespace","settings":{"foreground":"#e5c07b"}},{"scope":"support.class, entity.name.type.class","settings":{"foreground":"#e5c07b"}},{"scope":"entity.name.class.identifier.namespace.type","settings":{"foreground":"#e5c07b"}},{"scope":["entity.name.class","variable.other.class.js","variable.other.class.ts"],"settings":{"foreground":"#e5c07b"}},{"scope":"variable.other.class.php","settings":{"foreground":"#e06c75"}},{"scope":"entity.name.type","settings":{"foreground":"#e5c07b"}},{"scope":"keyword.control","settings":{"foreground":"#c678dd"}},{"scope":"control.elements, keyword.operator.less","settings":{"foreground":"#d19a66"}},{"scope":"keyword.other.special-method","settings":{"foreground":"#61afef"}},{"scope":"storage","settings":{"foreground":"#c678dd"}},{"scope":"token.storage","settings":{"foreground":"#c678dd"}},{"scope":"keyword.operator.expression.delete,keyword.operator.expression.in,keyword.operator.expression.of,keyword.operator.expression.instanceof,keyword.operator.new,keyword.operator.expression.typeof,keyword.operator.expression.void","settings":{"foreground":"#c678dd"}},{"scope":"token.storage.type.java","settings":{"foreground":"#e5c07b"}},{"scope":"support.function","settings":{"foreground":"#56b6c2"}},{"scope":"support.type.property-name","settings":{"foreground":"#abb2bf"}},{"scope":"support.type.property-name.toml, support.type.property-name.table.toml, support.type.property-name.array.toml","settings":{"foreground":"#e06c75"}},{"scope":"support.constant.property-value","settings":{"foreground":"#abb2bf"}},{"scope":"support.constant.font-name","settings":{"foreground":"#d19a66"}},{"scope":"meta.tag","settings":{"foreground":"#abb2bf"}},{"scope":"string","settings":{"foreground":"#98c379"}},{"scope":"constant.other.symbol","settings":{"foreground":"#56b6c2"}},{"scope":"constant.numeric","settings":{"foreground":"#d19a66"}},{"scope":"constant","settings":{"foreground":"#d19a66"}},{"scope":"punctuation.definition.constant","settings":{"foreground":"#d19a66"}},{"scope":"entity.name.tag","settings":{"foreground":"#e06c75"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#d19a66"}},{"scope":"entity.other.attribute-name.id","settings":{"foreground":"#61afef"}},{"scope":"entity.other.attribute-name.class.css","settings":{"foreground":"#d19a66"}},{"scope":"meta.selector","settings":{"foreground":"#c678dd"}},{"scope":"markup.heading","settings":{"foreground":"#ef6f2e"}},{"scope":"markup.heading punctuation.definition.heading, entity.name.section","settings":{"foreground":"#ef6f2e"}},{"scope":"keyword.other.unit","settings":{"foreground":"#e06c75"}},{"scope":"markup.bold,todo.bold","settings":{"foreground":"#d19a66"}},{"scope":"punctuation.definition.bold","settings":{"foreground":"#e5c07b"}},{"scope":"markup.italic, punctuation.definition.italic,todo.emphasis","settings":{"foreground":"#c678dd"}},{"scope":"emphasis md","settings":{"foreground":"#c678dd"}},{"scope":"entity.name.section.markdown","settings":{"foreground":"#ef6f2e"}},{"scope":"punctuation.definition.heading.markdown","settings":{"foreground":"#ef6f2e"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#e5c07b"}},{"scope":"markup.heading.setext","settings":{"foreground":"#ef6f2e"}},{"scope":"punctuation.definition.bold.markdown","settings":{"foreground":"#d19a66"}},{"scope":"markup.inline.raw.markdown","settings":{"foreground":"#98c379"}},{"scope":"markup.inline.raw.string.markdown","settings":{"foreground":"#98c379"}},{"scope":"punctuation.definition.raw.markdown","settings":{"foreground":"#e5c07b"}},{"scope":"punctuation.definition.list.markdown","settings":{"foreground":"#e5c07b"}},{"scope":["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","punctuation.definition.metadata.markdown"],"settings":{"foreground":"#e06c75"}},{"scope":["beginning.punctuation.definition.list.markdown"],"settings":{"foreground":"#e06c75"}},{"scope":"punctuation.definition.metadata.markdown","settings":{"foreground":"#e06c75"}},{"scope":"markup.underline.link.markdown,markup.underline.link.image.markdown","settings":{"foreground":"#c678dd"}},{"scope":"string.other.link.title.markdown,string.other.link.description.markdown","settings":{"foreground":"#61afef"}},{"scope":"markup.raw.monospace.asciidoc","settings":{"foreground":"#98c379"}},{"scope":"punctuation.definition.asciidoc","settings":{"foreground":"#e5c07b"}},{"scope":"markup.list.asciidoc","settings":{"foreground":"#e5c07b"}},{"scope":"markup.link.asciidoc,markup.other.url.asciidoc","settings":{"foreground":"#c678dd"}},{"scope":"string.unquoted.asciidoc,markup.other.url.asciidoc","settings":{"foreground":"#61afef"}},{"scope":"string.regexp","settings":{"foreground":"#56b6c2"}},{"scope":"punctuation.section.embedded, variable.interpolation","settings":{"foreground":"#e06c75"}},{"scope":"punctuation.section.embedded.begin,punctuation.section.embedded.end","settings":{"foreground":"#c678dd"}},{"scope":"invalid.illegal","settings":{"foreground":"#ffffff"}},{"scope":"invalid.illegal.bad-ampersand.html","settings":{"foreground":"#abb2bf"}},{"scope":"invalid.illegal.unrecognized-tag.html","settings":{"foreground":"#e06c75"}},{"scope":"invalid.broken","settings":{"foreground":"#ffffff"}},{"scope":"invalid.deprecated","settings":{"foreground":"#ffffff"}},{"scope":"invalid.deprecated.entity.other.attribute-name.html","settings":{"foreground":"#d19a66"}},{"scope":"invalid.unimplemented","settings":{"foreground":"#ffffff"}},{"scope":"source.json meta.structure.dictionary.json > string.quoted.json","settings":{"foreground":"#e06c75"}},{"scope":"source.json meta.structure.dictionary.json > string.quoted.json > punctuation.string","settings":{"foreground":"#e06c75"}},{"scope":"source.json meta.structure.dictionary.json > value.json > string.quoted.json,source.json meta.structure.array.json > value.json > string.quoted.json,source.json meta.structure.dictionary.json > value.json > string.quoted.json > punctuation,source.json meta.structure.array.json > value.json > string.quoted.json > punctuation","settings":{"foreground":"#98c379"}},{"scope":"source.json meta.structure.dictionary.json > constant.language.json,source.json meta.structure.array.json > constant.language.json","settings":{"foreground":"#56b6c2"}},{"scope":"support.type.property-name.json","settings":{"foreground":"#e06c75"}},{"scope":"support.type.property-name.json punctuation","settings":{"foreground":"#e06c75"}},{"scope":"text.html.laravel-blade source.php.embedded.line.html entity.name.tag.laravel-blade","settings":{"foreground":"#c678dd"}},{"scope":"text.html.laravel-blade source.php.embedded.line.html support.constant.laravel-blade","settings":{"foreground":"#c678dd"}},{"scope":"support.other.namespace.use.php,support.other.namespace.use-as.php,entity.other.alias.php,meta.interface.php","settings":{"foreground":"#e5c07b"}},{"scope":"keyword.operator.error-control.php","settings":{"foreground":"#c678dd"}},{"scope":"keyword.operator.type.php","settings":{"foreground":"#c678dd"}},{"scope":"punctuation.section.array.begin.php","settings":{"foreground":"#abb2bf"}},{"scope":"punctuation.section.array.end.php","settings":{"foreground":"#abb2bf"}},{"scope":"invalid.illegal.non-null-typehinted.php","settings":{"foreground":"#f44747"}},{"scope":"storage.type.php,meta.other.type.phpdoc.php,keyword.other.type.php,keyword.other.array.phpdoc.php","settings":{"foreground":"#e5c07b"}},{"scope":"meta.function-call.php,meta.function-call.object.php,meta.function-call.static.php","settings":{"foreground":"#61afef"}},{"scope":"punctuation.definition.parameters.begin.bracket.round.php,punctuation.definition.parameters.end.bracket.round.php,punctuation.separator.delimiter.php,punctuation.section.scope.begin.php,punctuation.section.scope.end.php,punctuation.terminator.expression.php,punctuation.definition.arguments.begin.bracket.round.php,punctuation.definition.arguments.end.bracket.round.php,punctuation.definition.storage-type.begin.bracket.round.php,punctuation.definition.storage-type.end.bracket.round.php,punctuation.definition.array.begin.bracket.round.php,punctuation.definition.array.end.bracket.round.php,punctuation.definition.begin.bracket.round.php,punctuation.definition.end.bracket.round.php,punctuation.definition.begin.bracket.curly.php,punctuation.definition.end.bracket.curly.php,punctuation.definition.section.switch-block.end.bracket.curly.php,punctuation.definition.section.switch-block.start.bracket.curly.php,punctuation.definition.section.switch-block.begin.bracket.curly.php,punctuation.definition.section.switch-block.end.bracket.curly.php","settings":{"foreground":"#abb2bf"}},{"scope":"support.constant.core.rust","settings":{"foreground":"#d19a66"}},{"scope":"support.constant.ext.php,support.constant.std.php,support.constant.core.php,support.constant.parser-token.php","settings":{"foreground":"#d19a66"}},{"scope":"entity.name.goto-label.php,support.other.php","settings":{"foreground":"#61afef"}},{"scope":"keyword.operator.logical.php,keyword.operator.bitwise.php,keyword.operator.arithmetic.php","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.regexp.php","settings":{"foreground":"#c678dd"}},{"scope":"keyword.operator.comparison.php","settings":{"foreground":"#56b6c2"}},{"scope":"keyword.operator.heredoc.php,keyword.operator.nowdoc.php","settings":{"foreground":"#c678dd"}},{"scope":"meta.function.decorator.python","settings":{"foreground":"#61afef"}},{"scope":"support.token.decorator.python,meta.function.decorator.identifier.python","settings":{"foreground":"#56b6c2"}},{"scope":"function.parameter","settings":{"foreground":"#abb2bf"}},{"scope":"function.brace","settings":{"foreground":"#abb2bf"}},{"scope":"function.parameter.ruby, function.parameter.cs","settings":{"foreground":"#abb2bf"}},{"scope":"constant.language.symbol.ruby","settings":{"foreground":"#56b6c2"}},{"scope":"constant.language.symbol.hashkey.ruby","settings":{"foreground":"#56b6c2"}},{"scope":"rgb-value","settings":{"foreground":"#56b6c2"}},{"scope":"inline-color-decoration rgb-value","settings":{"foreground":"#d19a66"}},{"scope":"less rgb-value","settings":{"foreground":"#d19a66"}},{"scope":"selector.sass","settings":{"foreground":"#e06c75"}},{"scope":"support.type.primitive.ts,support.type.builtin.ts,support.type.primitive.tsx,support.type.builtin.tsx","settings":{"foreground":"#e5c07b"}},{"scope":"block.scope.end,block.scope.begin","settings":{"foreground":"#abb2bf"}},{"scope":"storage.type.cs","settings":{"foreground":"#e5c07b"}},{"scope":"entity.name.variable.local.cs","settings":{"foreground":"#e06c75"}},{"scope":"token.info-token","settings":{"foreground":"#61afef"}},{"scope":"token.warn-token","settings":{"foreground":"#d19a66"}},{"scope":"token.error-token","settings":{"foreground":"#f44747"}},{"scope":"token.debug-token","settings":{"foreground":"#c678dd"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#c678dd"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#abb2bf"}},{"scope":["keyword.operator.module"],"settings":{"foreground":"#c678dd"}},{"scope":["support.type.type.flowtype"],"settings":{"foreground":"#61afef"}},{"scope":["support.type.primitive"],"settings":{"foreground":"#e5c07b"}},{"scope":["meta.property.object"],"settings":{"foreground":"#e06c75"}},{"scope":["variable.parameter.function.js"],"settings":{"foreground":"#e06c75"}},{"scope":["keyword.other.template.begin"],"settings":{"foreground":"#98c379"}},{"scope":["keyword.other.template.end"],"settings":{"foreground":"#98c379"}},{"scope":["keyword.other.substitution.begin"],"settings":{"foreground":"#98c379"}},{"scope":["keyword.other.substitution.end"],"settings":{"foreground":"#98c379"}},{"scope":["keyword.operator.assignment"],"settings":{"foreground":"#56b6c2"}},{"scope":["keyword.operator.assignment.go"],"settings":{"foreground":"#e5c07b"}},{"scope":["keyword.operator.arithmetic.go","keyword.operator.address.go"],"settings":{"foreground":"#c678dd"}},{"scope":["keyword.operator.arithmetic.c","keyword.operator.arithmetic.cpp"],"settings":{"foreground":"#c678dd"}},{"scope":["entity.name.package.go"],"settings":{"foreground":"#e5c07b"}},{"scope":["support.type.prelude.elm"],"settings":{"foreground":"#56b6c2"}},{"scope":["support.constant.elm"],"settings":{"foreground":"#d19a66"}},{"scope":["punctuation.quasi.element"],"settings":{"foreground":"#c678dd"}},{"scope":["constant.character.entity"],"settings":{"foreground":"#e06c75"}},{"scope":["entity.other.attribute-name.pseudo-element","entity.other.attribute-name.pseudo-class"],"settings":{"foreground":"#56b6c2"}},{"scope":["entity.global.clojure"],"settings":{"foreground":"#e5c07b"}},{"scope":["meta.symbol.clojure"],"settings":{"foreground":"#e06c75"}},{"scope":["constant.keyword.clojure"],"settings":{"foreground":"#56b6c2"}},{"scope":["meta.arguments.coffee","variable.parameter.function.coffee"],"settings":{"foreground":"#e06c75"}},{"scope":["source.ini"],"settings":{"foreground":"#98c379"}},{"scope":["meta.scope.prerequisites.makefile"],"settings":{"foreground":"#e06c75"}},{"scope":["source.makefile"],"settings":{"foreground":"#e5c07b"}},{"scope":["storage.modifier.import.groovy"],"settings":{"foreground":"#e5c07b"}},{"scope":["meta.method.groovy"],"settings":{"foreground":"#61afef"}},{"scope":["meta.definition.variable.name.groovy"],"settings":{"foreground":"#e06c75"}},{"scope":["meta.definition.class.inherited.classes.groovy"],"settings":{"foreground":"#98c379"}},{"scope":["support.variable.semantic.hlsl"],"settings":{"foreground":"#e5c07b"}},{"scope":["support.type.texture.hlsl","support.type.sampler.hlsl","support.type.object.hlsl","support.type.object.rw.hlsl","support.type.fx.hlsl","support.type.object.hlsl"],"settings":{"foreground":"#c678dd"}},{"scope":["text.variable","text.bracketed"],"settings":{"foreground":"#e06c75"}},{"scope":["support.type.swift","support.type.vb.asp"],"settings":{"foreground":"#e5c07b"}},{"scope":["entity.name.function.xi"],"settings":{"foreground":"#e5c07b"}},{"scope":["entity.name.class.xi"],"settings":{"foreground":"#56b6c2"}},{"scope":["constant.character.character-class.regexp.xi"],"settings":{"foreground":"#e06c75"}},{"scope":["constant.regexp.xi"],"settings":{"foreground":"#c678dd"}},{"scope":["keyword.control.xi"],"settings":{"foreground":"#56b6c2"}},{"scope":["invalid.xi"],"settings":{"foreground":"#abb2bf"}},{"scope":["beginning.punctuation.definition.quote.markdown.xi"],"settings":{"foreground":"#98c379"}},{"scope":["beginning.punctuation.definition.list.markdown.xi"],"settings":{"foreground":"#7f848e"}},{"scope":["constant.character.xi"],"settings":{"foreground":"#61afef"}},{"scope":["accent.xi"],"settings":{"foreground":"#61afef"}},{"scope":["wikiword.xi"],"settings":{"foreground":"#d19a66"}},{"scope":["constant.other.color.rgb-value.xi"],"settings":{"foreground":"#ffffff"}},{"scope":["punctuation.definition.tag.xi"],"settings":{"foreground":"#5c6370"}},{"scope":["entity.name.label.cs","entity.name.scope-resolution.function.call","entity.name.scope-resolution.function.definition"],"settings":{"foreground":"#e5c07b"}},{"scope":["entity.name.label.cs","markup.heading.setext.1.markdown","markup.heading.setext.2.markdown"],"settings":{"foreground":"#ef6f2e"}},{"scope":[" meta.brace.square"],"settings":{"foreground":"#abb2bf"}},{"scope":"comment, punctuation.definition.comment","settings":{"fontStyle":"italic","foreground":"#7f848e"}},{"scope":"markup.quote.markdown","settings":{"foreground":"#5c6370"}},{"scope":"punctuation.definition.block.sequence.item.yaml","settings":{"foreground":"#abb2bf"}},{"scope":["constant.language.symbol.elixir","constant.language.symbol.double-quoted.elixir"],"settings":{"foreground":"#56b6c2"}},{"scope":["entity.name.variable.parameter.cs"],"settings":{"foreground":"#e5c07b"}},{"scope":["entity.name.variable.field.cs"],"settings":{"foreground":"#e06c75"}},{"scope":"markup.deleted","settings":{"foreground":"#e06c75"}},{"scope":"markup.inserted","settings":{"foreground":"#98c379"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#BE5046"}},{"scope":["support.other.namespace.php"],"settings":{"foreground":"#abb2bf"}},{"scope":["variable.parameter.function.latex"],"settings":{"foreground":"#e06c75"}},{"scope":["variable.other.object"],"settings":{"foreground":"#e5c07b"}},{"scope":["variable.other.constant.property"],"settings":{"foreground":"#e06c75"}},{"scope":["entity.other.inherited-class"],"settings":{"foreground":"#e5c07b"}},{"scope":"variable.other.readwrite.c","settings":{"foreground":"#e06c75"}},{"scope":"entity.name.variable.parameter.php,punctuation.separator.colon.php,constant.other.php","settings":{"foreground":"#abb2bf"}},{"scope":["constant.numeric.decimal.asm.x86_64"],"settings":{"foreground":"#c678dd"}},{"scope":["support.other.parenthesis.regexp"],"settings":{"foreground":"#d19a66"}},{"scope":["constant.character.escape"],"settings":{"foreground":"#56b6c2"}},{"scope":["string.regexp"],"settings":{"foreground":"#e06c75"}},{"scope":["log.info"],"settings":{"foreground":"#98c379"}},{"scope":["log.warning"],"settings":{"foreground":"#e5c07b"}},{"scope":["log.error"],"settings":{"foreground":"#e06c75"}},{"scope":"keyword.operator.expression.is","settings":{"foreground":"#c678dd"}},{"scope":"entity.name.label","settings":{"foreground":"#e06c75"}},{"scope":["support.class.math.block.environment.latex","constant.other.general.math.tex"],"settings":{"foreground":"#61afef"}},{"scope":["constant.character.math.tex"],"settings":{"foreground":"#98c379"}},{"scope":"entity.other.attribute-name.js,entity.other.attribute-name.ts,entity.other.attribute-name.jsx,entity.other.attribute-name.tsx,variable.parameter,variable.language.super","settings":{"fontStyle":"italic"}},{"scope":"comment.line.double-slash,comment.block.documentation","settings":{"fontStyle":"italic"}},{"scope":"markup.italic.markdown","settings":{"fontStyle":"italic"}}]'),c6="dark",u6={colors:r6,displayName:a6,name:s6,semanticHighlighting:o6,semanticTokenColors:i6,tokenColors:l6,type:c6},d6={"activityBar.background":"#FAFAFA","activityBar.foreground":"#121417","activityBarBadge.background":"#526FFF","activityBarBadge.foreground":"#FFFFFF","badge.background":"#526FFF","badge.foreground":"#FFFFFF","button.background":"#5871EF","button.foreground":"#FFFFFF","button.hoverBackground":"#6B83ED","diffEditor.insertedTextBackground":"#00809B33","dropdown.background":"#FFFFFF","dropdown.border":"#DBDBDC","editor.background":"#FAFAFA","editor.findMatchHighlightBackground":"#526FFF33","editor.foreground":"#383A42","editor.lineHighlightBackground":"#383A420C","editor.selectionBackground":"#E5E5E6","editorCursor.foreground":"#526FFF","editorGroup.background":"#EAEAEB","editorGroup.border":"#DBDBDC","editorGroupHeader.tabsBackground":"#EAEAEB","editorHoverWidget.background":"#EAEAEB","editorHoverWidget.border":"#DBDBDC","editorIndentGuide.activeBackground":"#626772","editorIndentGuide.background":"#383A4233","editorInlayHint.background":"#F5F5F5","editorInlayHint.foreground":"#AFB2BB","editorLineNumber.activeForeground":"#383A42","editorLineNumber.foreground":"#9D9D9F","editorRuler.foreground":"#383A4233","editorSuggestWidget.background":"#EAEAEB","editorSuggestWidget.border":"#DBDBDC","editorSuggestWidget.selectedBackground":"#FFFFFF","editorWhitespace.foreground":"#383A4233","editorWidget.background":"#EAEAEB","editorWidget.border":"#E5E5E6","extensionButton.prominentBackground":"#3BBA54","extensionButton.prominentHoverBackground":"#4CC263",focusBorder:"#526FFF","input.background":"#FFFFFF","input.border":"#DBDBDC","list.activeSelectionBackground":"#DBDBDC","list.activeSelectionForeground":"#232324","list.focusBackground":"#DBDBDC","list.highlightForeground":"#121417","list.hoverBackground":"#DBDBDC66","list.inactiveSelectionBackground":"#DBDBDC","list.inactiveSelectionForeground":"#232324","notebook.cellEditorBackground":"#F5F5F5","notification.background":"#333333","peekView.border":"#526FFF","peekViewEditor.background":"#FFFFFF","peekViewResult.background":"#EAEAEB","peekViewResult.selectionBackground":"#DBDBDC","peekViewTitle.background":"#FFFFFF","pickerGroup.border":"#526FFF","scrollbarSlider.activeBackground":"#747D9180","scrollbarSlider.background":"#4E566680","scrollbarSlider.hoverBackground":"#5A637580","sideBar.background":"#EAEAEB","sideBarSectionHeader.background":"#FAFAFA","statusBar.background":"#EAEAEB","statusBar.debuggingForeground":"#FFFFFF","statusBar.foreground":"#424243","statusBar.noFolderBackground":"#EAEAEB","statusBarItem.hoverBackground":"#DBDBDC","tab.activeBackground":"#FAFAFA","tab.activeForeground":"#121417","tab.border":"#DBDBDC","tab.inactiveBackground":"#EAEAEB","titleBar.activeBackground":"#EAEAEB","titleBar.activeForeground":"#424243","titleBar.inactiveBackground":"#EAEAEB","titleBar.inactiveForeground":"#424243"},f6="C4A Light",p6="c4a-light",h6=JSON.parse('[{"scope":["comment"],"settings":{"fontStyle":"italic","foreground":"#A0A1A7"}},{"scope":["comment markup.link"],"settings":{"foreground":"#A0A1A7"}},{"scope":["entity.name.type"],"settings":{"foreground":"#C18401"}},{"scope":["entity.other.inherited-class"],"settings":{"foreground":"#C18401"}},{"scope":["keyword"],"settings":{"foreground":"#A626A4"}},{"scope":["keyword.control"],"settings":{"foreground":"#A626A4"}},{"scope":["keyword.operator"],"settings":{"foreground":"#383A42"}},{"scope":["keyword.other.special-method"],"settings":{"foreground":"#4078F2"}},{"scope":["keyword.other.unit"],"settings":{"foreground":"#986801"}},{"scope":["storage"],"settings":{"foreground":"#A626A4"}},{"scope":["storage.type.annotation","storage.type.primitive"],"settings":{"foreground":"#A626A4"}},{"scope":["storage.modifier.package","storage.modifier.import"],"settings":{"foreground":"#383A42"}},{"scope":["constant"],"settings":{"foreground":"#986801"}},{"scope":["constant.variable"],"settings":{"foreground":"#986801"}},{"scope":["constant.character.escape"],"settings":{"foreground":"#0184BC"}},{"scope":["constant.numeric"],"settings":{"foreground":"#986801"}},{"scope":["constant.other.color"],"settings":{"foreground":"#0184BC"}},{"scope":["constant.other.symbol"],"settings":{"foreground":"#0184BC"}},{"scope":["variable"],"settings":{"foreground":"#E45649"}},{"scope":["variable.interpolation"],"settings":{"foreground":"#CA1243"}},{"scope":["variable.parameter"],"settings":{"foreground":"#383A42"}},{"scope":["string"],"settings":{"foreground":"#50A14F"}},{"scope":["string > source","string embedded"],"settings":{"foreground":"#383A42"}},{"scope":["string.regexp"],"settings":{"foreground":"#0184BC"}},{"scope":["string.regexp source.ruby.embedded"],"settings":{"foreground":"#C18401"}},{"scope":["string.other.link"],"settings":{"foreground":"#E45649"}},{"scope":["punctuation.definition.comment"],"settings":{"foreground":"#A0A1A7"}},{"scope":["punctuation.definition.method-parameters","punctuation.definition.function-parameters","punctuation.definition.parameters","punctuation.definition.separator","punctuation.definition.seperator","punctuation.definition.array"],"settings":{"foreground":"#383A42"}},{"scope":["punctuation.definition.heading","punctuation.definition.identity"],"settings":{"foreground":"#4078F2"}},{"scope":["punctuation.definition.bold"],"settings":{"fontStyle":"bold","foreground":"#C18401"}},{"scope":["punctuation.definition.italic"],"settings":{"fontStyle":"italic","foreground":"#A626A4"}},{"scope":["punctuation.section.embedded"],"settings":{"foreground":"#CA1243"}},{"scope":["punctuation.section.method","punctuation.section.class","punctuation.section.inner-class"],"settings":{"foreground":"#383A42"}},{"scope":["support.class"],"settings":{"foreground":"#C18401"}},{"scope":["support.type"],"settings":{"foreground":"#0184BC"}},{"scope":["support.function"],"settings":{"foreground":"#0184BC"}},{"scope":["support.function.any-method"],"settings":{"foreground":"#4078F2"}},{"scope":["entity.name.function"],"settings":{"foreground":"#4078F2"}},{"scope":["entity.name.class","entity.name.type.class"],"settings":{"foreground":"#C18401"}},{"scope":["entity.name.section"],"settings":{"foreground":"#4078F2"}},{"scope":["entity.name.tag"],"settings":{"foreground":"#E45649"}},{"scope":["entity.other.attribute-name"],"settings":{"foreground":"#986801"}},{"scope":["entity.other.attribute-name.id"],"settings":{"foreground":"#4078F2"}},{"scope":["meta.class"],"settings":{"foreground":"#C18401"}},{"scope":["meta.class.body"],"settings":{"foreground":"#383A42"}},{"scope":["meta.method-call","meta.method"],"settings":{"foreground":"#383A42"}},{"scope":["meta.definition.variable"],"settings":{"foreground":"#E45649"}},{"scope":["meta.link"],"settings":{"foreground":"#986801"}},{"scope":["meta.require"],"settings":{"foreground":"#4078F2"}},{"scope":["meta.selector"],"settings":{"foreground":"#A626A4"}},{"scope":["meta.separator"],"settings":{"foreground":"#383A42"}},{"scope":["meta.tag"],"settings":{"foreground":"#383A42"}},{"scope":["underline"],"settings":{"text-decoration":"underline"}},{"scope":["none"],"settings":{"foreground":"#383A42"}},{"scope":["invalid.deprecated"],"settings":{"background":"#F2A60D","foreground":"#000000"}},{"scope":["invalid.illegal"],"settings":{"background":"#FF1414","foreground":"#50A14F"}},{"scope":["markup.bold"],"settings":{"fontStyle":"bold","foreground":"#986801"}},{"scope":["markup.changed"],"settings":{"foreground":"#A626A4"}},{"scope":["markup.deleted"],"settings":{"foreground":"#E45649"}},{"scope":["markup.italic"],"settings":{"fontStyle":"italic","foreground":"#A626A4"}},{"scope":["markup.heading"],"settings":{"foreground":"#ef6f2e"}},{"scope":["markup.heading punctuation.definition.heading"],"settings":{"foreground":"#ef6f2e"}},{"scope":["markup.link"],"settings":{"foreground":"#0184BC"}},{"scope":["markup.inserted"],"settings":{"foreground":"#50A14F"}},{"scope":["markup.quote"],"settings":{"foreground":"#986801"}},{"scope":["markup.raw"],"settings":{"foreground":"#50A14F"}},{"scope":["source.c keyword.operator"],"settings":{"foreground":"#A626A4"}},{"scope":["source.cpp keyword.operator"],"settings":{"foreground":"#A626A4"}},{"scope":["source.cs keyword.operator"],"settings":{"foreground":"#A626A4"}},{"scope":["source.css property-name","source.css property-value"],"settings":{"foreground":"#696C77"}},{"scope":["source.css property-name.support","source.css property-value.support"],"settings":{"foreground":"#383A42"}},{"scope":["source.elixir source.embedded.source"],"settings":{"foreground":"#383A42"}},{"scope":["source.elixir constant.language","source.elixir constant.numeric","source.elixir constant.definition"],"settings":{"foreground":"#4078F2"}},{"scope":["source.elixir variable.definition","source.elixir variable.anonymous"],"settings":{"foreground":"#A626A4"}},{"scope":["source.elixir parameter.variable.function"],"settings":{"fontStyle":"italic","foreground":"#986801"}},{"scope":["source.elixir quoted"],"settings":{"foreground":"#50A14F"}},{"scope":["source.elixir keyword.special-method","source.elixir embedded.section","source.elixir embedded.source.empty"],"settings":{"foreground":"#E45649"}},{"scope":["source.elixir readwrite.module punctuation"],"settings":{"foreground":"#E45649"}},{"scope":["source.elixir regexp.section","source.elixir regexp.string"],"settings":{"foreground":"#CA1243"}},{"scope":["source.elixir separator","source.elixir keyword.operator"],"settings":{"foreground":"#986801"}},{"scope":["source.elixir variable.constant"],"settings":{"foreground":"#C18401"}},{"scope":["source.elixir array","source.elixir scope","source.elixir section"],"settings":{"foreground":"#696C77"}},{"scope":["source.gfm markup"],"settings":{"-webkit-font-smoothing":"auto"}},{"scope":["source.gfm link entity"],"settings":{"foreground":"#4078F2"}},{"scope":["source.go storage.type.string"],"settings":{"foreground":"#A626A4"}},{"scope":["source.ini keyword.other.definition.ini"],"settings":{"foreground":"#E45649"}},{"scope":["source.java storage.modifier.import"],"settings":{"foreground":"#C18401"}},{"scope":["source.java storage.type"],"settings":{"foreground":"#C18401"}},{"scope":["source.java keyword.operator.instanceof"],"settings":{"foreground":"#A626A4"}},{"scope":["source.java-properties meta.key-pair"],"settings":{"foreground":"#E45649"}},{"scope":["source.java-properties meta.key-pair > punctuation"],"settings":{"foreground":"#383A42"}},{"scope":["source.js keyword.operator"],"settings":{"foreground":"#0184BC"}},{"scope":["source.js keyword.operator.delete","source.js keyword.operator.in","source.js keyword.operator.of","source.js keyword.operator.instanceof","source.js keyword.operator.new","source.js keyword.operator.typeof","source.js keyword.operator.void"],"settings":{"foreground":"#A626A4"}},{"scope":["source.ts keyword.operator"],"settings":{"foreground":"#0184BC"}},{"scope":["source.flow keyword.operator"],"settings":{"foreground":"#0184BC"}},{"scope":["source.json meta.structure.dictionary.json > string.quoted.json"],"settings":{"foreground":"#E45649"}},{"scope":["source.json meta.structure.dictionary.json > string.quoted.json > punctuation.string"],"settings":{"foreground":"#E45649"}},{"scope":["source.json meta.structure.dictionary.json > value.json > string.quoted.json","source.json meta.structure.array.json > value.json > string.quoted.json","source.json meta.structure.dictionary.json > value.json > string.quoted.json > punctuation","source.json meta.structure.array.json > value.json > string.quoted.json > punctuation"],"settings":{"foreground":"#50A14F"}},{"scope":["source.json meta.structure.dictionary.json > constant.language.json","source.json meta.structure.array.json > constant.language.json"],"settings":{"foreground":"#0184BC"}},{"scope":["ng.interpolation"],"settings":{"foreground":"#E45649"}},{"scope":["ng.interpolation.begin","ng.interpolation.end"],"settings":{"foreground":"#4078F2"}},{"scope":["ng.interpolation function"],"settings":{"foreground":"#E45649"}},{"scope":["ng.interpolation function.begin","ng.interpolation function.end"],"settings":{"foreground":"#4078F2"}},{"scope":["ng.interpolation bool"],"settings":{"foreground":"#986801"}},{"scope":["ng.interpolation bracket"],"settings":{"foreground":"#383A42"}},{"scope":["ng.pipe","ng.operator"],"settings":{"foreground":"#383A42"}},{"scope":["ng.tag"],"settings":{"foreground":"#0184BC"}},{"scope":["ng.attribute-with-value attribute-name"],"settings":{"foreground":"#C18401"}},{"scope":["ng.attribute-with-value string"],"settings":{"foreground":"#A626A4"}},{"scope":["ng.attribute-with-value string.begin","ng.attribute-with-value string.end"],"settings":{"foreground":"#383A42"}},{"scope":["source.ruby constant.other.symbol > punctuation"],"settings":{"foreground":"inherit"}},{"scope":["source.php class.bracket"],"settings":{"foreground":"#383A42"}},{"scope":["source.python keyword.operator.logical.python"],"settings":{"foreground":"#A626A4"}},{"scope":["source.python variable.parameter"],"settings":{"foreground":"#986801"}},{"scope":"customrule","settings":{"foreground":"#383A42"}},{"scope":"support.type.property-name","settings":{"foreground":"#383A42"}},{"scope":"string.quoted.double punctuation","settings":{"foreground":"#50A14F"}},{"scope":"support.constant","settings":{"foreground":"#986801"}},{"scope":"support.type.property-name.json","settings":{"foreground":"#E45649"}},{"scope":"support.type.property-name.json punctuation","settings":{"foreground":"#E45649"}},{"scope":["punctuation.separator.key-value.ts","punctuation.separator.key-value.js","punctuation.separator.key-value.tsx"],"settings":{"foreground":"#0184BC"}},{"scope":["source.js.embedded.html keyword.operator","source.ts.embedded.html keyword.operator"],"settings":{"foreground":"#0184BC"}},{"scope":["variable.other.readwrite.js","variable.other.readwrite.ts","variable.other.readwrite.tsx"],"settings":{"foreground":"#383A42"}},{"scope":["support.variable.dom.js","support.variable.dom.ts"],"settings":{"foreground":"#E45649"}},{"scope":["support.variable.property.dom.js","support.variable.property.dom.ts"],"settings":{"foreground":"#E45649"}},{"scope":["meta.template.expression.js punctuation.definition","meta.template.expression.ts punctuation.definition"],"settings":{"foreground":"#CA1243"}},{"scope":["source.ts punctuation.definition.typeparameters","source.js punctuation.definition.typeparameters","source.tsx punctuation.definition.typeparameters"],"settings":{"foreground":"#383A42"}},{"scope":["source.ts punctuation.definition.block","source.js punctuation.definition.block","source.tsx punctuation.definition.block"],"settings":{"foreground":"#383A42"}},{"scope":["source.ts punctuation.separator.comma","source.js punctuation.separator.comma","source.tsx punctuation.separator.comma"],"settings":{"foreground":"#383A42"}},{"scope":["support.variable.property.js","support.variable.property.ts","support.variable.property.tsx"],"settings":{"foreground":"#E45649"}},{"scope":["keyword.control.default.js","keyword.control.default.ts","keyword.control.default.tsx"],"settings":{"foreground":"#E45649"}},{"scope":["keyword.operator.expression.instanceof.js","keyword.operator.expression.instanceof.ts","keyword.operator.expression.instanceof.tsx"],"settings":{"foreground":"#A626A4"}},{"scope":["keyword.operator.expression.of.js","keyword.operator.expression.of.ts","keyword.operator.expression.of.tsx"],"settings":{"foreground":"#A626A4"}},{"scope":["meta.brace.round.js","meta.array-binding-pattern-variable.js","meta.brace.square.js","meta.brace.round.ts","meta.array-binding-pattern-variable.ts","meta.brace.square.ts","meta.brace.round.tsx","meta.array-binding-pattern-variable.tsx","meta.brace.square.tsx"],"settings":{"foreground":"#383A42"}},{"scope":["source.js punctuation.accessor","source.ts punctuation.accessor","source.tsx punctuation.accessor"],"settings":{"foreground":"#383A42"}},{"scope":["punctuation.terminator.statement.js","punctuation.terminator.statement.ts","punctuation.terminator.statement.tsx"],"settings":{"foreground":"#383A42"}},{"scope":["meta.array-binding-pattern-variable.js variable.other.readwrite.js","meta.array-binding-pattern-variable.ts variable.other.readwrite.ts","meta.array-binding-pattern-variable.tsx variable.other.readwrite.tsx"],"settings":{"foreground":"#986801"}},{"scope":["source.js support.variable","source.ts support.variable","source.tsx support.variable"],"settings":{"foreground":"#E45649"}},{"scope":["variable.other.constant.property.js","variable.other.constant.property.ts","variable.other.constant.property.tsx"],"settings":{"foreground":"#986801"}},{"scope":["keyword.operator.new.ts","keyword.operator.new.j","keyword.operator.new.tsx"],"settings":{"foreground":"#A626A4"}},{"scope":["source.ts keyword.operator","source.tsx keyword.operator"],"settings":{"foreground":"#0184BC"}},{"scope":["punctuation.separator.parameter.js","punctuation.separator.parameter.ts","punctuation.separator.parameter.tsx "],"settings":{"foreground":"#383A42"}},{"scope":["constant.language.import-export-all.js","constant.language.import-export-all.ts"],"settings":{"foreground":"#E45649"}},{"scope":["constant.language.import-export-all.jsx","constant.language.import-export-all.tsx"],"settings":{"foreground":"#0184BC"}},{"scope":["keyword.control.as.js","keyword.control.as.ts","keyword.control.as.jsx","keyword.control.as.tsx"],"settings":{"foreground":"#383A42"}},{"scope":["variable.other.readwrite.alias.js","variable.other.readwrite.alias.ts","variable.other.readwrite.alias.jsx","variable.other.readwrite.alias.tsx"],"settings":{"foreground":"#E45649"}},{"scope":["variable.other.constant.js","variable.other.constant.ts","variable.other.constant.jsx","variable.other.constant.tsx"],"settings":{"foreground":"#986801"}},{"scope":["meta.export.default.js variable.other.readwrite.js","meta.export.default.ts variable.other.readwrite.ts"],"settings":{"foreground":"#E45649"}},{"scope":["source.js meta.template.expression.js punctuation.accessor","source.ts meta.template.expression.ts punctuation.accessor","source.tsx meta.template.expression.tsx punctuation.accessor"],"settings":{"foreground":"#50A14F"}},{"scope":["source.js meta.import-equals.external.js keyword.operator","source.jsx meta.import-equals.external.jsx keyword.operator","source.ts meta.import-equals.external.ts keyword.operator","source.tsx meta.import-equals.external.tsx keyword.operator"],"settings":{"foreground":"#383A42"}},{"scope":"entity.name.type.module.js,entity.name.type.module.ts,entity.name.type.module.jsx,entity.name.type.module.tsx","settings":{"foreground":"#50A14F"}},{"scope":"meta.class.js,meta.class.ts,meta.class.jsx,meta.class.tsx","settings":{"foreground":"#383A42"}},{"scope":["meta.definition.property.js variable","meta.definition.property.ts variable","meta.definition.property.jsx variable","meta.definition.property.tsx variable"],"settings":{"foreground":"#383A42"}},{"scope":["meta.type.parameters.js support.type","meta.type.parameters.jsx support.type","meta.type.parameters.ts support.type","meta.type.parameters.tsx support.type"],"settings":{"foreground":"#383A42"}},{"scope":["source.js meta.tag.js keyword.operator","source.jsx meta.tag.jsx keyword.operator","source.ts meta.tag.ts keyword.operator","source.tsx meta.tag.tsx keyword.operator"],"settings":{"foreground":"#383A42"}},{"scope":["meta.tag.js punctuation.section.embedded","meta.tag.jsx punctuation.section.embedded","meta.tag.ts punctuation.section.embedded","meta.tag.tsx punctuation.section.embedded"],"settings":{"foreground":"#383A42"}},{"scope":["meta.array.literal.js variable","meta.array.literal.jsx variable","meta.array.literal.ts variable","meta.array.literal.tsx variable"],"settings":{"foreground":"#C18401"}},{"scope":["support.type.object.module.js","support.type.object.module.jsx","support.type.object.module.ts","support.type.object.module.tsx"],"settings":{"foreground":"#E45649"}},{"scope":["constant.language.json"],"settings":{"foreground":"#0184BC"}},{"scope":["variable.other.constant.object.js","variable.other.constant.object.jsx","variable.other.constant.object.ts","variable.other.constant.object.tsx"],"settings":{"foreground":"#986801"}},{"scope":["storage.type.property.js","storage.type.property.jsx","storage.type.property.ts","storage.type.property.tsx"],"settings":{"foreground":"#0184BC"}},{"scope":["meta.template.expression.js string.quoted punctuation.definition","meta.template.expression.jsx string.quoted punctuation.definition","meta.template.expression.ts string.quoted punctuation.definition","meta.template.expression.tsx string.quoted punctuation.definition"],"settings":{"foreground":"#50A14F"}},{"scope":["meta.template.expression.js string.template punctuation.definition.string.template","meta.template.expression.jsx string.template punctuation.definition.string.template","meta.template.expression.ts string.template punctuation.definition.string.template","meta.template.expression.tsx string.template punctuation.definition.string.template"],"settings":{"foreground":"#50A14F"}},{"scope":["keyword.operator.expression.in.js","keyword.operator.expression.in.jsx","keyword.operator.expression.in.ts","keyword.operator.expression.in.tsx"],"settings":{"foreground":"#A626A4"}},{"scope":["variable.other.object.js","variable.other.object.ts"],"settings":{"foreground":"#383A42"}},{"scope":["meta.object-literal.key.js","meta.object-literal.key.ts"],"settings":{"foreground":"#E45649"}},{"scope":"source.python constant.other","settings":{"foreground":"#383A42"}},{"scope":"source.python constant","settings":{"foreground":"#986801"}},{"scope":"constant.character.format.placeholder.other.python storage","settings":{"foreground":"#986801"}},{"scope":"support.variable.magic.python","settings":{"foreground":"#E45649"}},{"scope":"meta.function.parameters.python","settings":{"foreground":"#986801"}},{"scope":"punctuation.separator.annotation.python","settings":{"foreground":"#383A42"}},{"scope":"punctuation.separator.parameters.python","settings":{"foreground":"#383A42"}},{"scope":"entity.name.variable.field.cs","settings":{"foreground":"#E45649"}},{"scope":"source.cs keyword.operator","settings":{"foreground":"#383A42"}},{"scope":"variable.other.readwrite.cs","settings":{"foreground":"#383A42"}},{"scope":"variable.other.object.cs","settings":{"foreground":"#383A42"}},{"scope":"variable.other.object.property.cs","settings":{"foreground":"#383A42"}},{"scope":"entity.name.variable.property.cs","settings":{"foreground":"#4078F2"}},{"scope":"storage.type.cs","settings":{"foreground":"#C18401"}},{"scope":"keyword.other.unsafe.rust","settings":{"foreground":"#A626A4"}},{"scope":"entity.name.type.rust","settings":{"foreground":"#0184BC"}},{"scope":"storage.modifier.lifetime.rust","settings":{"foreground":"#383A42"}},{"scope":"entity.name.lifetime.rust","settings":{"foreground":"#986801"}},{"scope":"storage.type.core.rust","settings":{"foreground":"#0184BC"}},{"scope":"meta.attribute.rust","settings":{"foreground":"#986801"}},{"scope":"storage.class.std.rust","settings":{"foreground":"#0184BC"}},{"scope":"markup.raw.block.markdown","settings":{"foreground":"#383A42"}},{"scope":"punctuation.definition.variable.shell","settings":{"foreground":"#E45649"}},{"scope":"support.constant.property-value.css","settings":{"foreground":"#383A42"}},{"scope":"punctuation.definition.constant.css","settings":{"foreground":"#986801"}},{"scope":"punctuation.separator.key-value.scss","settings":{"foreground":"#E45649"}},{"scope":"punctuation.definition.constant.scss","settings":{"foreground":"#986801"}},{"scope":"meta.property-list.scss punctuation.separator.key-value.scss","settings":{"foreground":"#383A42"}},{"scope":"storage.type.primitive.array.java","settings":{"foreground":"#C18401"}},{"scope":"entity.name.section.markdown","settings":{"foreground":"#ef6f2e"}},{"scope":"punctuation.definition.heading.markdown","settings":{"foreground":"#ef6f2e"}},{"scope":"markup.heading.setext","settings":{"foreground":"#ef6f2e"}},{"scope":"punctuation.definition.bold.markdown","settings":{"foreground":"#986801"}},{"scope":"markup.inline.raw.markdown","settings":{"foreground":"#50A14F"}},{"scope":"beginning.punctuation.definition.list.markdown","settings":{"foreground":"#E45649"}},{"scope":"markup.quote.markdown","settings":{"fontStyle":"italic","foreground":"#A0A1A7"}},{"scope":["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","punctuation.definition.metadata.markdown"],"settings":{"foreground":"#383A42"}},{"scope":"punctuation.definition.metadata.markdown","settings":{"foreground":"#A626A4"}},{"scope":["markup.underline.link.markdown","markup.underline.link.image.markdown"],"settings":{"foreground":"#A626A4"}},{"scope":["string.other.link.title.markdown","string.other.link.description.markdown"],"settings":{"foreground":"#4078F2"}},{"scope":"punctuation.separator.variable.ruby","settings":{"foreground":"#E45649"}},{"scope":"variable.other.constant.ruby","settings":{"foreground":"#986801"}},{"scope":"keyword.operator.other.ruby","settings":{"foreground":"#50A14F"}},{"scope":"punctuation.definition.variable.php","settings":{"foreground":"#E45649"}},{"scope":"meta.class.php","settings":{"foreground":"#383A42"}}]'),m6="light",g6={colors:d6,displayName:f6,name:p6,tokenColors:h6,type:m6},x6={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"csharp",cpp:"cpp",c:"c",h:"c",swift:"swift",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",dockerfile:"dockerfile"};function y6(e){if(!e)return"plaintext";const t=e.split(".").pop()?.toLowerCase();return t?x6[t]??"plaintext":"plaintext"}function Qv({code:e,language:t,sourcePath:r}){const a=jm(f=>f.theme),i=(a==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a)==="dark"?u6:g6,u=t??y6(r);return c.jsx("div",{className:"flex min-w-0 flex-1 flex-col rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface text-xs leading-relaxed overflow-auto c4a-scrollbar [&>*]:flex-1 [&_pre]:min-h-full [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:!bg-transparent [&_code]:!bg-transparent",children:c.jsx(n6,{language:u,theme:i,children:e})})}let hu=null,mu=[];const gu=ea((e,t)=>({cache:new Map,pending:new Set,resolve:r=>{const{cache:a,pending:o}=t(),i=r.filter(u=>!a.has(u)&&!o.has(u)&&!mu.includes(u));i.length!==0&&(mu.push(...i),e({pending:new Set([...o,...i])}),hu&&clearTimeout(hu),hu=setTimeout(()=>{const u=[...mu];mu=[],hu=null,u.length!==0&&ze.post("/resolve",{refs:u}).then(f=>{const{cache:h,pending:p}=t(),m=new Map(h),x=new Set(p);for(const v of u){const _=f[v];_?m.set(v,_):m.set(v,{exists:!1}),x.delete(v)}e({cache:m,pending:x})}).catch(()=>{const{cache:f,pending:h}=t(),p=new Map(f),m=new Set(h);for(const x of u)p.set(x,{error:!0,exists:!1}),m.delete(x);e({cache:p,pending:m})})},50))},retry:r=>{const{cache:a}=t(),o=new Map(a);o.delete(r),e({cache:o}),t().resolve([r])}})),uh="/studio",sr={entity:e=>`${uh}/entities/${e}`,relation:e=>`${uh}/relations/${e}`,content:e=>`${uh}/contents/${e}`},uw=/^ref:(entity|relation|content):(.+)$/;function b6(e){const t=uw.exec(e);return!t||!t[2]?null:{type:t[1],id:t[2]}}function $m(e){return typeof e=="string"&&uw.test(e)}const Zv={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function v6(e,t){if(e.type==="content")return"📄";if(e.type==="relation")return"🔗";const r=t?.entity_type;return r&&Zv[r]?Zv[r]:"🔹"}function _6(e){switch(e.type){case"entity":return sr.entity(e.id);case"relation":return sr.relation(e.id);case"content":return sr.content(e.id);default:return"#"}}function Bm({pointer:e}){const t=Tt(),{t:r}=ye(),a=Ko(),o=gu(_=>_.cache),i=gu(_=>_.pending);b.useEffect(()=>{gu.getState().resolve([e])},[e]);const u=b6(e);if(!u)return c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:e});const f=o.get(e);if(i.has(e)||!f&&!o.has(e))return c.jsx("span",{className:"inline-block animate-pulse bg-c4a-bg-hover rounded px-2 py-0.5 text-xs font-mono w-24 h-4"});if(f?.error)return c.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted cursor-pointer",title:r("ref.retry"),onClick:()=>gu.getState().retry(e),children:["<",r("ref.unknown"),": ",u.id.slice(0,12),">"]});if(f&&!f.exists)return c.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted line-through",title:e,children:["<",r("ref.stale"),": ",u.id.slice(0,12),">"]});const p=v6(u,f),m=u.type==="relation"?f?.relation_type||u.id.slice(0,12):f?.name||u.id.slice(0,12),x=_6(u),v=()=>{a?.active?a.navigate(u.type,u.id,m,p):t(x)};return c.jsxs("span",{className:"inline-flex items-center gap-1 text-c4a-accent hover:underline cursor-pointer text-xs font-mono",onClick:v,title:e,children:[c.jsx("span",{children:p}),c.jsx("span",{children:m})]})}function Hl({data:e,defaultExpanded:t=2}){return c.jsx("div",{className:"font-mono text-xs",children:c.jsx(Jh,{value:e,depth:0,defaultExpanded:t})})}function Jh({keyName:e,value:t,depth:r,defaultExpanded:a}){const[o,i]=b.useState(r<a);if(typeof t=="string"&&$m(t))return c.jsxs("div",{className:"flex items-baseline gap-1",style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsx(Bm,{pointer:t})]});if(t==null)return c.jsxs("div",{style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsx("span",{className:"text-c4a-text-muted",children:"null"})]});if(typeof t=="string")return c.jsxs("div",{style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsxs("span",{className:"text-c4a-accent",children:['"',t,'"']})]});if(typeof t=="number")return c.jsxs("div",{style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsx("span",{className:"text-c4a-success",children:t})]});if(typeof t=="boolean")return c.jsxs("div",{style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsx("span",{className:"text-c4a-warning",children:String(t)})]});if(Array.isArray(t))return t.length===0?c.jsxs("div",{style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsx("span",{className:"text-c4a-text-muted",children:"[]"})]}):c.jsxs("div",{children:[c.jsxs("div",{style:{paddingLeft:r*16},className:"cursor-pointer hover:bg-c4a-bg-hover rounded px-1 -mx-1",onClick:()=>i(!o),children:[c.jsx("span",{className:"text-c4a-text-muted mr-1",children:o?"▼":"▶"}),e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),!o&&c.jsxs("span",{className:"text-c4a-text-muted",children:["[",t.length," items]"]})]}),o&&t.map((u,f)=>c.jsx(Jh,{keyName:String(f),value:u,depth:r+1,defaultExpanded:a},f))]});if(typeof t=="object"){const u=Object.entries(t);return u.length===0?c.jsxs("div",{style:{paddingLeft:r*16},children:[e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),c.jsx("span",{className:"text-c4a-text-muted",children:"{}"})]}):c.jsxs("div",{children:[c.jsxs("div",{style:{paddingLeft:r*16},className:"cursor-pointer hover:bg-c4a-bg-hover rounded px-1 -mx-1",onClick:()=>i(!o),children:[c.jsx("span",{className:"text-c4a-text-muted mr-1",children:o?"▼":"▶"}),e!==void 0&&c.jsxs("span",{className:"text-c4a-text-secondary",children:[e,": "]}),!o&&c.jsx("span",{className:"text-c4a-text-muted",children:"{ ... }"})]}),o&&u.map(([f,h])=>c.jsx(Jh,{keyName:f,value:h,depth:r+1,defaultExpanded:a},f))]})}return null}const w6={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function Jv({entity:e}){const t=Tt(),r=Ko(),a=w6[e.type]??"🔹",o=()=>{r?.active?r.navigate("entity",e.id,e.name,a):t(sr.entity(e.id))};return c.jsx("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-3 cursor-pointer hover:border-c4a-accent transition-colors",onClick:o,children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"shrink-0",children:a}),c.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate",children:e.name}),e.kind&&c.jsx(Bt,{variant:"muted",children:e.kind})]})})}const S6=new Set(["ts","tsx","js","jsx","mts","mjs","cts","cjs","py","pyi","go","rs","java","kt","c","cpp","h","hpp","cs","rb","php","swift","scala","zig","lua","sh","bash","vue","svelte"]),j6=new Set(["md","txt","rst","adoc"]);function Wv(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}function e_({data:e}){const{t}=ye(),r=Tt(),a=Ko(),o=e.manifest??{},i=o.name??e.name??t("package.unknown"),u=o.version,f=o.license,h=o.description,p=o.dependencies,m=o.devDependencies,x=p?Object.entries(p):[],v=m?Object.entries(m):[],[_,w]=b.useState(!1),[S,k]=b.useState(null),N=e.files??[],A=N.filter(L=>S6.has(Wv(L.path))),E=N.filter(L=>j6.has(Wv(L.path)));b.useEffect(()=>{const L=N.find(z=>{const $=z.path.toLowerCase();return($==="readme.md"||$.endsWith("/readme.md"))&&z.hash_id});if(!L?.hash_id){k(null);return}ze.get(`/contents/${L.hash_id}/raw`).then(z=>k(z.content)).catch(()=>k(null))},[N]);const D=(L,z)=>{a?.active?a.navigate("content",L,z,"📄"):r(sr.content(L))};return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:t("raw.basic_info")}),c.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 font-mono text-xs",children:[c.jsx("span",{className:"text-c4a-text-muted uppercase",children:t("raw.field.name")}),c.jsx("span",{className:"text-c4a-text-primary font-bold",children:i}),u&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-c4a-text-muted uppercase",children:t("raw.field.version")}),c.jsx("span",{className:"text-c4a-text-primary",children:u})]}),f&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-c4a-text-muted uppercase",children:t("raw.field.license")}),c.jsx("span",{className:"text-c4a-text-primary",children:f})]}),h&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-c4a-text-muted uppercase",children:t("raw.field.description")}),c.jsx("span",{className:"text-c4a-text-secondary",children:h})]})]}),e.manifest_type&&c.jsx("div",{className:"mt-2",children:c.jsx("span",{className:"rounded bg-c4a-accent/10 px-1.5 py-0.5 font-mono text-[10px] uppercase text-c4a-accent/60",children:e.manifest_type})})]}),N.length>0&&c.jsxs("div",{className:"flex flex-wrap gap-3",children:[c.jsx(ln,{icon:c.jsx(_m,{size:14}),label:t("raw.code_files"),value:A.length,size:"sm"}),c.jsx(ln,{icon:c.jsx(On,{size:14}),label:t("raw.doc_files"),value:E.length,size:"sm"}),c.jsx(ln,{icon:c.jsx(Dr,{size:14}),label:t("raw.total_files"),value:N.length,size:"sm"})]}),c.jsxs("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsxs("h4",{className:"mb-2 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:[t("raw.dependencies")," (",x.length,")"]}),x.length===0?c.jsx("p",{className:"font-mono text-xs text-c4a-text-muted",children:t("raw.no_dependencies")}):c.jsx("div",{className:"space-y-1",children:x.map(([L,z])=>c.jsxs("div",{className:"flex justify-between font-mono text-xs",children:[c.jsx("span",{className:"text-c4a-text-primary",children:L}),c.jsx("span",{className:"text-c4a-text-muted",children:z})]},L))})]}),v.length>0&&c.jsxs("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5",onClick:()=>w(L=>!L),children:[c.jsx($t,{size:12,className:`shrink-0 text-c4a-text-muted transition-transform duration-200 ${_?"rotate-90":""}`}),c.jsxs("h4",{className:"font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:[t("raw.dev_dependencies")," (",v.length,")"]})]}),_&&c.jsx("div",{className:"mt-2 space-y-1",children:v.map(([L,z])=>c.jsxs("div",{className:"flex justify-between font-mono text-xs",children:[c.jsx("span",{className:"text-c4a-text-primary",children:L}),c.jsx("span",{className:"text-c4a-text-muted",children:z})]},L))})]}),S&&c.jsxs("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:t("raw.readme")}),c.jsx("div",{className:"max-h-64 overflow-y-auto c4a-scrollbar prose prose-invert prose-sm max-w-none text-c4a-text-secondary",children:c.jsx("pre",{className:"whitespace-pre-wrap font-sans text-sm leading-relaxed",children:S})})]}),N.length>0&&c.jsxs("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsxs("h4",{className:"mb-2 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:[t("package.files")," (",N.length,")"]}),c.jsx("div",{className:"space-y-1",children:N.map(L=>c.jsxs("div",{className:"flex items-center justify-between font-mono text-xs",children:[c.jsxs("span",{className:"flex items-center gap-1 text-c4a-text-secondary",children:[c.jsx("span",{children:"📄"}),c.jsx("span",{children:L.path})]}),L.hash_id&&c.jsx("span",{className:"font-mono text-[10px] text-c4a-accent hover:underline cursor-pointer",onClick:()=>D(L.hash_id,L.path),children:L.hash_id.slice(0,12)})]},L.path))})]})]})}const xu=["daemon_starting","cloning","preparing"],k6=["scanning","parsing","analyzing","uploading"],Ki=["chunking","annotating","post-processing","embedding","storing"],Wh={daemon_starting:"index.stage.daemon_starting",cloning:"index.stage.cloning",preparing:"index.stage.preparing",scanning:"index.stage.scanning",parsing:"index.stage.parsing",analyzing:"index.stage.analyzing",uploading:"index.stage.uploading",skipping:"index.stage.skipping",chunking:"index.stage.chunking",annotating:"index.stage.annotating","post-processing":"index.stage.post_processing",embedding:"index.stage.embedding",storing:"index.stage.storing"},t_={daemon_starting:5,cloning:10,preparing:5,scanning:15,parsing:55,analyzing:20,uploading:10},N6={chunking:10,annotating:75,"post-processing":85,embedding:95,storing:100};function E6(e){const t=e.reduce((o,i)=>o+(t_[i]??10),0),r={};let a=0;for(const o of e)a+=(t_[o]??10)/t*100,r[o]=Math.round(a);return r[e[e.length-1]]=100,r}const C6={COMMIT_NOT_AVAILABLE:"index.error.commit_not_available",DAEMON_AUTO_START_FAILED:"index.error.daemon_start_failed",GIT_ARCHIVE_FAILED:"index.error.git_archive_failed"};function A6(e,t){if(e){const r=C6[e];return r?t(r):e}return t("index.code.error")}function Xi(){const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}function yu(e,t,r,a){switch(e){case"daemon_starting":return t("index.log.daemon_ready");case"cloning":return t("index.log.clone_done");case"preparing":return t("index.log.prepare_done");case"scanning":return t("index.log.scan_done");case"parsing":return r!=null?t("index.log.parse_done",{count:r}):`${t(Wh.parsing)} ${t("index.log.done_suffix")}`;case"analyzing":return t("index.log.analyze_done");case"uploading":return a?t("index.log.upload_done",{name:a}):t("index.log.done_suffix");default:return`${t(Wh[e])} ${t("index.log.done_suffix")}`}}function R6({sourceId:e,onComplete:t,retryModules:r}){const{t:a}=ye(),o=kt(ne=>ne.indexingTasks.get(e)),[i,u]=b.useState([]),[f,h]=b.useState(!1),[p,m]=b.useState(!1),x=b.useRef(null),v=b.useRef(!1),_=b.useRef(null),w=b.useRef(null),[S,k]=b.useState(null),N=b.useRef(null),[A,E]=b.useState([]),[D,L]=b.useState(null),[z,$]=b.useState(new Set),[R,B]=b.useState(!0);b.useEffect(()=>{if(!o)return;const ne=o.stage;S!=="doc"&&xu.includes(ne)&&!z.has(ne)&&$(ge=>new Set(ge).add(ne))},[o?.stage,S]),b.useEffect(()=>{if(o?.stage){if(Ki.includes(o.stage)){S!=="doc"&&(k("doc"),x.current=null);return}!S&&o.stage!=="pending"&&o.stage!=="skipping"&&k("code")}},[o?.stage,S]),b.useEffect(()=>{o?.stage&&o.stage!=="skipping"&&o.stage!=="pending"&&(w.current=o.stage)},[o?.stage]);const H=S==="doc"||o?.stage&&Ki.includes(o.stage)?"doc":S??"code",J=H==="doc"?Ki:[...xu.filter(ne=>z.has(ne)),...k6],oe=J.map(ne=>({key:ne,label:a(Wh[ne])})),ce=H==="doc"?N6:E6(J),M=b.useRef(0);b.useEffect(()=>{const ne=o?.pendingSkips;if(!ne||ne.length===0)return;const ge=ne.length;if(ge<=M.current)return;const Ne=ne.slice(M.current);M.current=ge;const Fe=Xi();u(qe=>[...qe,...Ne.map(be=>`[${Fe}] ⏭ ${be}`)].slice(-500))},[o?.pendingSkips]);const P=b.useRef(null),T=b.useRef(null);b.useEffect(()=>{if(!o||o.terminalState)return;const{stage:ne,currentFile:ge,totalFiles:Ne,processedFiles:Fe,moduleName:qe}=o;if(H==="doc"){const he=Xi(),ve=[],Ve=Ki.indexOf(ne);if(ne!==x.current&&(ne==="chunking"&&ve.push(`[${he}] ${a("index.doc.log.chunking")}`),ne==="annotating"&&ve.push(`[${he}] ${a("index.doc.log.annotating_start")}`),ne==="post-processing"&&ve.push(`[${he}] ${a("index.doc.log.post_processing")}`),ne==="embedding"&&ve.push(`[${he}] ${a("index.doc.log.embedding")}`),ne==="storing"&&ve.push(`[${he}] ${a("index.doc.log.storing")}`),Ve>=0&&E(De=>{const Xe=new Set(De);for(const It of Ki.slice(0,Ve))Xe.add(It);return Xe.size===De.length?De:[...Xe]}),L(ne),x.current=ne),o.message){const De=typeof o.message=="string"?o.message:a(o.message.key,o.message.params);De!==N.current&&(ve.push(`[${he}] ${De}`),N.current=De)}ve.length>0&&u(De=>[...De,...ve].slice(-500));return}if(ne==="skipping")return;const be=Xi(),fe=[],_e=qe!=null&&qe!==P.current;if(ne!==x.current){if(x.current==="pending"||x.current===null){L(ne),x.current=ne;const ve=J.indexOf(ne);ve>0&&E(Ve=>{const De=new Set(Ve);for(const Xe of J.slice(0,ve))De.add(Xe);return De.size===Ve.length?Ve:[...De]}),xu.includes(ne)&&fe.push(`[${be}] ${a(`index.log.${ne}`)}`),fe.length>0&&u(Ve=>[...Ve,...fe].slice(-500));return}const he=J.indexOf(ne);if(he>=0){const ve=J.slice(0,he);if(E(Ve=>{const De=new Set(Ve);for(const Xe of ve)De.add(Xe);return De.size===Ve.length?Ve:[...De]}),x.current&&x.current!=="skipping"){const Ve=J.indexOf(x.current);if(Ve<=he){for(let De=Ve;De<he;De++){const Xe=J[De];fe.push(`[${be}] ${yu(Xe,a,T.current,P.current)}`)}xu.includes(ne)&&fe.push(`[${be}] ${a(`index.log.${ne}`)}`)}else{for(let De=Ve;De<J.length;De++){const Xe=J[De];fe.push(`[${be}] ${yu(Xe,a,T.current,P.current)}`)}_e&&(fe.push(`[${be}] ── ${qe} ──`),P.current=qe,T.current=null);for(let De=0;De<he;De++){const Xe=J[De];fe.push(`[${be}] ${yu(Xe,a,null,null)}`)}}}}L(ne),x.current=ne}_e&&P.current!==qe&&(fe.push(`[${be}] ── ${qe} ──`),P.current=qe,T.current=null),Ne!=null&&(T.current=Ne),ge&&Fe!=null&&Ne!=null&&fe.push(`[${be}] ${ge} (${Fe}/${Ne})`),fe.length>0&&u(he=>[...he,...fe].slice(-500))},[o,a,H,J]),b.useEffect(()=>{if(!o?.terminalState){v.current=!1;return}if(v.current)return;v.current=!0;const ne=Xi();if(o.terminalState==="done"){const ge=[];x.current==="uploading"&&P.current&&ge.push(`[${ne}] ${yu("uploading",a,T.current,P.current)}`),ge.push(`[${ne}] ${a("index.code.complete")}`),o.unchangedCount&&ge.push(`[${ne}] ${a("index.code.unchanged_count",{count:o.unchangedCount})}`),u(Ne=>[...Ne,...ge].slice(-500)),E(J.slice()),L(null);return}if(o.terminalState==="error"){const ge=o.errorMessage??a("index.code.error");u(Ne=>[...Ne,`[${ne}] ERROR: ${ge}`].slice(-500)),h(!0),L(null);return}if(o.terminalState==="timeout"){u(ge=>[...ge,`[${ne}] ${a("index.code.timeout")}`].slice(-500)),m(!0),L(null);return}},[o?.terminalState,e,a,t]),b.useEffect(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[i]),b.useEffect(()=>{if(o?.terminalState!=="done"||!R)return;const ne=setTimeout(()=>{kt.getState().clearIndexTask(e),t?.()},2e3);return()=>{clearTimeout(ne)}},[o?.terminalState,R,e,t]);const F=o&&!o.terminalState?{percent:o.progress,label:o.currentFile??""}:null,[ee,ae]=b.useState(!1),W=b.useCallback(async()=>{ae(!0);try{(await kt.getState().triggerIndex(e,r)).status==="skipped"?(kt.getState().clearIndexTask(e),t?.()):(m(!1),h(!1),u([]),E([]),L(null),k(null),x.current=null,w.current=null,$(new Set))}catch{h(!0);const ne=Xi();u(ge=>[...ge,`[${ne}] ${a("index.code.error")}`].slice(-500))}finally{ae(!1)}},[e,r,a,t]),O=b.useCallback(()=>{kt.getState().clearIndexTask(e),t?.()},[e,t]),V=b.useCallback(()=>{kt.getState().clearIndexTask(e),t?.()},[e,t]),re=o?.terminalState==="done",se=!!o&&!o?.terminalState;return c.jsxs("div",{className:"flex flex-col gap-4 pb-8",children:[c.jsx(Q1,{stages:oe,currentStage:D,completedStages:A,failedStage:f?w.current:null,progress:F,breakpoints:ce,headerRight:re&&!R?c.jsx("button",{type:"button",className:"rounded-sm bg-c4a-accent px-2 py-0.5 font-mono text-[11px] text-white hover:bg-c4a-accent/90",onClick:V,children:a("index.code.done_continue")}):re&&R?c.jsx("span",{className:"animate-pulse font-mono text-[11px] text-c4a-text-muted",children:a("index.code.auto_continue_pending")}):se||re?c.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 select-none",children:[c.jsx("span",{className:`flex h-3.5 w-3.5 items-center justify-center rounded-sm border transition-colors ${R?"border-c4a-accent bg-c4a-accent":"border-c4a-border-default bg-transparent"}`,onClick:()=>B(ne=>!ne),children:R&&c.jsx(Wr,{size:10,className:"text-white"})}),c.jsx("span",{className:"font-mono text-[11px] text-c4a-text-muted",onClick:()=>B(ne=>!ne),children:a("index.code.auto_continue")})]}):void 0}),p&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-c4a-warning",children:a("index.code.timeout")}),c.jsx("button",{type:"button",className:`shrink-0 rounded bg-c4a-accent px-3 py-1 font-mono text-xs text-white hover:bg-c4a-accent/90 ${ee?"opacity-50 cursor-not-allowed":""}`,onClick:W,disabled:ee,children:a("sources.import.retry")}),c.jsx("button",{type:"button",className:`shrink-0 rounded border border-c4a-border-default px-3 py-1 font-mono text-xs text-c4a-text-muted hover:text-c4a-text-primary ${ee?"opacity-50 cursor-not-allowed":""}`,onClick:O,disabled:ee,children:a("index.code.dismiss")})]}),f&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-c4a-error",children:A6(o?.errorMessage,a)}),c.jsx("button",{type:"button",className:`shrink-0 rounded bg-c4a-accent px-3 py-1 font-mono text-xs text-white hover:bg-c4a-accent/90 ${ee?"opacity-50 cursor-not-allowed":""}`,onClick:W,disabled:ee,children:a("sources.import.retry")}),c.jsx("button",{type:"button",className:`shrink-0 rounded border border-c4a-border-default px-3 py-1 font-mono text-xs text-c4a-text-muted hover:text-c4a-text-primary ${ee?"opacity-50 cursor-not-allowed":""}`,onClick:O,disabled:ee,children:a("index.code.dismiss")})]}),c.jsxs("div",{className:"mt-4 min-h-[200px] max-h-[50vh] overflow-y-auto rounded bg-c4a-bg-base p-3 c4a-scrollbar",children:[i.map((ne,ge)=>c.jsx("div",{className:`font-mono text-xs leading-relaxed ${ne.includes("ERROR")?"text-red-400/80":"text-c4a-text-muted"}`,children:ne},ge)),c.jsx("div",{ref:_})]})]})}const T6=["entities","relations","behaviors","attributes","states","rules","transitions","events","decisions","metrics","roles","constraints","comparisons","boundaries"],L6={critical:{label:"CRITICAL",className:"text-red-400 bg-red-500/10"},major:{label:"MAJOR",className:"text-amber-400 bg-amber-500/10"},minor:{label:"MINOR",className:"text-c4a-text-muted bg-c4a-bg-elevated"},must:{label:"MUST",className:"text-red-400 bg-red-500/10"},should:{label:"SHOULD",className:"text-amber-400 bg-amber-500/10"},may:{label:"MAY",className:"text-c4a-text-muted bg-c4a-bg-elevated"}};function dw(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function D6(e){if(e==null)return"";if(Array.isArray(e)){const t=e.map(r=>dw(r));return t.length<=5?t.join(", "):`${t.slice(0,5).join(", ")} … (${t.length})`}return typeof e=="object"?JSON.stringify(e):String(e)}function O6(e){return T6.map(t=>({type:t,atoms:Array.isArray(e[t])?e[t]:[]}))}function M6(e){return e.every(t=>t.atoms.length===0)}function z6({severity:e}){if(!e)return null;const t=L6[e];return t?c.jsxs("span",{className:"relative inline-block group cursor-default ml-2",children:[c.jsx("span",{className:`inline-flex rounded-sm px-1.5 py-0.5 font-mono text-[10px] uppercase ${t.className}`,children:t.label}),c.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-1 rounded bg-c4a-bg-elevated text-c4a-text-primary text-[11px] font-sans normal-case whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-150 shadow-lg border border-c4a-border-subtle z-50",children:e})]}):c.jsxs("span",{className:"relative inline-block group cursor-default ml-2",children:[c.jsx("span",{className:"inline-flex rounded-sm bg-c4a-bg-elevated px-1.5 py-0.5 font-mono text-[10px] uppercase text-c4a-text-muted",children:e}),c.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-1 rounded bg-c4a-bg-elevated text-c4a-text-primary text-[11px] font-sans normal-case whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-150 shadow-lg border border-c4a-border-subtle z-50",children:e})]})}function bu({name:e,clickable:t}){if(!t)return c.jsx("span",{className:"text-c4a-accent font-mono",children:e});const r=()=>{const i=document.querySelector(`[data-entity-name="${CSS.escape(e)}"]`);i&&i.classList.add("c4a-entity-highlight")},a=()=>{const i=document.querySelector(`[data-entity-name="${CSS.escape(e)}"]`);i&&i.classList.remove("c4a-entity-highlight")},o=()=>{const i=document.querySelector(`[data-entity-name="${CSS.escape(e)}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})};return c.jsx("span",{className:"text-c4a-accent font-mono cursor-pointer hover:underline",onMouseEnter:r,onMouseLeave:a,onClick:o,children:e})}function n_(e){return Object.entries(e).map(([t,r])=>`${t}: ${dw(r)}`).join(", ")}function $6({rows:e,label:t}){const[r,a]=b.useState(!1),o=b.useRef(null);return b.useEffect(()=>{if(!r)return;const i=u=>{o.current&&!o.current.contains(u.target)&&a(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]),c.jsxs("span",{className:"relative inline-block",ref:o,children:[c.jsx("span",{className:"text-c4a-accent cursor-pointer hover:underline",onClick:()=>a(i=>!i),children:t}),r&&c.jsx("div",{className:"absolute left-0 top-full mt-1 z-50 w-max max-w-[26.25rem] rounded-lg border border-c4a-border-subtle bg-c4a-bg-elevated px-3 py-2 shadow-lg",children:c.jsx("div",{className:"max-h-48 overflow-y-auto c4a-scrollbar space-y-1",children:e.map((i,u)=>c.jsx("div",{className:"font-mono text-[11px] text-c4a-text-secondary whitespace-pre-wrap break-words",children:i},u))})})]})}function Qi({label:e}){return c.jsx("span",{className:"inline-flex rounded-sm bg-c4a-bg-elevated px-1.5 py-0.5 font-mono text-[10px] uppercase text-c4a-text-muted",children:e})}function B6({atom:e,t}){const r=typeof e.severity=="string"?e.severity:void 0,a=typeof e.confidence=="number"?e.confidence:void 0,o=Yo(a);return c.jsxs(c.Fragment,{children:[o?c.jsx("span",{className:"ml-2 inline-flex",children:c.jsx(Bt,{variant:o.variant,tooltip:`${o.value.toFixed(2)} — ${t(o.tipKey)}`,children:t(o.labelKey)})}):null,c.jsx(z6,{severity:r})]})}function I6(e,t){const r=[];switch(e){case"relations":typeof t.description=="string"&&r.push(t.description);break;case"attributes":if(t.value!==void 0)if(Array.isArray(t.value)&&t.value.length>0&&typeof t.value[0]=="object"&&t.value[0]!==null){const a=t.value,o=3,i=a.slice(0,o);for(const u of i)r.push(c.jsx("span",{className:"font-mono",children:n_(u)}));if(a.length>o){const u=a.map(h=>n_(h)),f=a.length-o;r.push(c.jsx($6,{rows:u,label:`…(${f} More)`}))}}else r.push(D6(t.value));break;case"states":Array.isArray(t.values)&&r.push(c.jsxs(c.Fragment,{children:["[",t.values.join(", "),"]"]})),typeof t.ref_sor=="string"&&r.push(t.ref_sor);break;case"rules":typeof t.expression=="string"&&r.push(c.jsx("span",{className:"font-mono",children:t.expression})),Array.isArray(t.depends_on)&&t.depends_on.length>0&&r.push(c.jsxs(c.Fragment,{children:["depends: ",t.depends_on.join(", ")]}));break;case"behaviors":typeof t.description=="string"&&r.push(t.description),typeof t.signature=="string"&&r.push(c.jsx("span",{className:"font-mono",children:t.signature}));break;case"metrics":typeof t.target=="string"&&r.push(c.jsxs(c.Fragment,{children:["target: ",t.target]})),typeof t.threshold=="string"&&r.push(c.jsxs(c.Fragment,{children:["threshold: ",t.threshold]}));break;case"roles":typeof t.description=="string"&&r.push(t.description),Array.isArray(t.performs)&&t.performs.length>0&&r.push(c.jsxs(c.Fragment,{children:["performs: ",t.performs.join(", ")]}));break;case"boundaries":Array.isArray(t.contains)&&t.contains.length>0&&r.push(c.jsxs(c.Fragment,{children:["⊃ ",t.contains.join(", ")]})),Array.isArray(t.excludes)&&t.excludes.length>0&&r.push(c.jsxs(c.Fragment,{children:["⊅ ",t.excludes.join(", ")]}));break;case"decisions":typeof t.rationale=="string"&&r.push(t.rationale),Array.isArray(t.alternatives)&&t.alternatives.length>0&&r.push(c.jsxs(c.Fragment,{children:["alternatives: ",t.alternatives.join(", ")]}));break;case"comparisons":Array.isArray(t.subjects)&&r.push(t.subjects.join(" vs ")),typeof t.conclusion=="string"&&r.push(t.conclusion);break;case"transitions":typeof t.guard=="string"&&r.push(c.jsxs(c.Fragment,{children:["guard: ",c.jsx("span",{className:"font-mono",children:t.guard})]}));break;case"events":Array.isArray(t.trigger_for)&&t.trigger_for.length>0&&r.push(c.jsxs(c.Fragment,{children:["triggers: ",t.trigger_for.join(", ")]}));break;case"constraints":typeof t.metric_ref=="string"&&r.push(c.jsxs(c.Fragment,{children:["metric: ",t.metric_ref]}));break}return r}function U6(e,t){switch(e){case"relations":return{main:c.jsxs(c.Fragment,{children:[c.jsx(bu,{name:String(t.from??""),clickable:!0}),c.jsx("span",{className:"mx-1 text-c4a-text-muted",children:"→"}),c.jsx(bu,{name:String(t.to??""),clickable:!0})]}),chip:typeof t.type=="string"?c.jsx("span",{className:"ml-1",children:c.jsx(Qi,{label:t.type})}):null};case"transitions":return{main:c.jsxs(c.Fragment,{children:[c.jsx(bu,{name:String(t.from??""),clickable:!0}),c.jsx("span",{className:"mx-1 text-c4a-text-muted",children:"→"}),c.jsx(bu,{name:String(t.to??""),clickable:!0})]}),chip:typeof t.trigger=="string"?c.jsx("span",{className:"ml-1",children:c.jsx(Qi,{label:t.trigger})}):null};case"entities":return{main:c.jsx("span",{className:"font-medium text-c4a-accent",children:String(t.name??"")}),chip:typeof t.kind=="string"?c.jsx("span",{className:"ml-1",children:c.jsx(Qi,{label:t.kind})}):null};case"attributes":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:typeof t.type=="string"?c.jsx("span",{className:"ml-1",children:c.jsx(Qi,{label:t.type})}):null};case"roles":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:typeof t.kind=="string"?c.jsx("span",{className:"ml-1",children:c.jsx(Qi,{label:t.kind})}):null};case"metrics":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:null};case"states":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:null};case"boundaries":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:null};case"comparisons":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:null};case"behaviors":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:null};case"events":return{main:c.jsx("span",{className:"font-medium",children:String(t.name??"")}),chip:null};default:return{main:c.jsx("span",{children:String(t.description??t.name??JSON.stringify(t))}),chip:null}}}function P6({type:e,atom:t,t:r}){const{main:a,chip:o}=U6(e,t),i=I6(e,t),u=e==="entities"&&typeof t.name=="string"?{"data-entity-name":t.name}:void 0;return c.jsxs("div",{className:`relative pl-3 text-xs text-c4a-text-secondary leading-relaxed break-words${e==="entities"?" c4a-entity-target":""}`,...u,children:[c.jsxs("div",{children:[a,c.jsx(B6,{atom:t,t:r}),o]}),i.length>0?c.jsx("div",{className:"pl-3 text-c4a-text-muted",children:i.map((f,h)=>c.jsx("div",{children:f},h))}):null]})}function H6({digest:e}){const{t}=ye(),r=b.useMemo(()=>e.sections.map((a,o)=>({section:a,sectionIndex:o})),[e.sections]);return c.jsx("div",{className:"w-full rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4 overflow-hidden",children:r.map(({section:a,sectionIndex:o})=>{const i=a.heading?.trim();return c.jsxs("div",{className:"border-t border-c4a-border-subtle pt-4 mt-4 first:border-t-0 first:mt-0 first:pt-0",children:[i?c.jsx("div",{className:"mb-3 font-mono text-xs uppercase tracking-tight text-c4a-text-muted",children:i}):null,a.paragraphs.map((u,f)=>{const h=`${o}-${f}`,p=O6(u.atoms),m=M6(p);return c.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 px-3 py-3 border-b border-c4a-border-subtle last:border-b-0",children:[c.jsx("div",{className:"lg:w-1/2 w-full min-w-0 text-xs text-c4a-text-secondary leading-relaxed whitespace-pre-wrap break-words overflow-hidden",children:u.text}),c.jsx("div",{className:"lg:w-1/2 w-full min-w-0 min-h-[2rem]",children:m?c.jsx("div",{className:"text-xs text-c4a-text-muted italic",children:t("digest.doc.no_atoms")}):p.map(x=>x.atoms.length>0?c.jsxs("div",{className:"mb-3 last:mb-0",children:[c.jsx("div",{className:"mb-1 font-mono text-xs uppercase tracking-tight text-amber-400",children:t(`digest.doc.atom.${x.type}`)}),c.jsx("div",{className:"space-y-1",children:x.atoms.map((v,_)=>c.jsx(P6,{type:x.type,atom:v,t},`${x.type}-${_}`))})]},x.type):null)})]},h)})]},`section-${o}`)})})}function ka(){return{data:null,loading:!1,error:null,warnings:[],pagination:null}}function dh(){return{data:null,loading:!1,error:null,warnings:[]}}function Zi(e){const t={};for(const[r,a]of Object.entries(e))a!=null&&(Array.isArray(a)?t[r]=a.join(","):t[r]=String(a));return t}const r_=new Map;function Ji(e){const t=r_.get(e);t&&t.abort();const r=new AbortController;return r_.set(e,r),r.signal}const Mn=ea((e,t)=>({symbols:{...ka()},callGraph:{...ka()},imports:{...ka()},inheritance:{...ka()},paragraphs:{...dh()},fetchSymbols:async(r,a)=>{const o=Ji("symbols");e(i=>({symbols:{...i.symbols,loading:!0,error:null}}));try{const i=await ze.get("/query/symbols",Zi({sourceIds:r.sourceIds,exportedOnly:r.exportedOnly,kind:r.kind,namePattern:r.namePattern,filePath:r.filePath,limit:r.limit,offset:r.offset}),{signal:o,skipDedup:!0});if(o.aborted)return;const u=a?.append?t().symbols.data??[]:[];e({symbols:{data:[...u,...i.symbols],pagination:i.pagination,loading:!1,error:null,warnings:i.warnings??[]}})}catch(i){if(o.aborted||i instanceof DOMException&&i.name==="AbortError")return;e(u=>({symbols:{...u.symbols,loading:!1,error:String(i)}}))}},fetchCallGraph:async r=>{const a=Ji("callGraph");e({callGraph:{data:null,loading:!0,error:null,warnings:[],pagination:null}});try{const o=await ze.get("/query/call-graph",Zi({sourceIds:r.sourceIds,functionName:r.functionName,direction:r.direction,maxDepth:r.maxDepth,limit:r.limit,offset:r.offset}),{signal:a,skipDedup:!0});if(a.aborted)return;e({callGraph:{data:o.entries,pagination:o.pagination,loading:!1,error:null,warnings:o.warnings??[]}})}catch(o){if(a.aborted||o instanceof DOMException&&o.name==="AbortError")return;e({callGraph:{data:null,loading:!1,error:String(o),warnings:[],pagination:null}})}},fetchImports:async r=>{const a=Ji("imports");e({imports:{data:null,loading:!0,error:null,warnings:[],pagination:null}});try{const o=await ze.get("/query/imports",Zi({sourceIds:r.sourceIds,filePath:r.filePath,direction:r.direction,limit:r.limit,offset:r.offset}),{signal:a,skipDedup:!0});if(a.aborted)return;e({imports:{data:o.imports,pagination:o.pagination,loading:!1,error:null,warnings:o.warnings??[]}})}catch(o){if(a.aborted||o instanceof DOMException&&o.name==="AbortError")return;e({imports:{data:null,loading:!1,error:String(o),warnings:[],pagination:null}})}},fetchInheritance:async r=>{const a=Ji("inheritance");e({inheritance:{data:null,loading:!0,error:null,warnings:[],pagination:null}});try{const o=await ze.get("/query/inheritance",Zi({sourceIds:r.sourceIds,className:r.className,direction:r.direction,limit:r.limit,offset:r.offset}),{signal:a,skipDedup:!0});if(a.aborted)return;e({inheritance:{data:o.relations,pagination:o.pagination,loading:!1,error:null,warnings:o.warnings??[]}})}catch(o){if(a.aborted||o instanceof DOMException&&o.name==="AbortError")return;e({inheritance:{data:null,loading:!1,error:String(o),warnings:[],pagination:null}})}},fetchParagraphs:async r=>{const a=Ji("paragraphs");e({paragraphs:{data:null,loading:!0,error:null,warnings:[]}});try{const o=await ze.get("/query/paragraphs",Zi({sourceIds:r.sourceIds,text:r.text,topK:r.topK,scoreLow:r.scoreLow}),{signal:a,skipDedup:!0});if(a.aborted)return;e({paragraphs:{data:o.results,loading:!1,error:null,warnings:[]}})}catch(o){if(a.aborted||o instanceof DOMException&&o.name==="AbortError")return;e({paragraphs:{data:null,loading:!1,error:String(o),warnings:[]}})}},resetQuery:r=>{e(r?r==="paragraphs"?{[r]:dh()}:{[r]:ka()}:{symbols:ka(),callGraph:ka(),imports:ka(),inheritance:ka(),paragraphs:dh()})}}));function xd({warnings:e}){const{t}=ye(),[r,a]=b.useState(!1);return e.length===0?null:c.jsxs("div",{className:"rounded-lg bg-c4a-warning/10 border border-c4a-warning/20 px-3 py-2 mb-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(NA,{size:14,className:"text-c4a-warning shrink-0"}),c.jsx("span",{className:"font-mono text-xs text-c4a-warning",children:e[0]}),e.length>1&&c.jsx("button",{type:"button",className:"font-mono text-[10px] text-c4a-warning/70 underline cursor-pointer",onClick:()=>a(!r),children:t("query.warning.more",{count:e.length-1})})]}),r&&e.slice(1).map((o,i)=>c.jsx("div",{className:"mt-1 pl-6 font-mono text-xs text-c4a-warning/80",children:o},i))]})}function q6(e){const t={children:[]},r=new Map,a=new Map;for(const i of e)a.set(i.filePath,(a.get(i.filePath)??0)+1);for(const[i,u]of a){const f=i.split("/").filter(Boolean);let h="",p=t;for(let m=0;m<f.length;m++){const x=f[m];h=h?`${h}/${x}`:x;const v=m===f.length-1;let _=r.get(h);_||(_={name:x,fullPath:h,isFile:v,children:[],symbolCount:0},r.set(h,_),p.children.push(_)),v&&(_.symbolCount=u,_.isFile=!0),p=_}}const o=i=>{i.sort((u,f)=>u.isFile!==f.isFile?u.isFile?1:-1:u.name.localeCompare(f.name));for(const u of i)u.children.length>0&&o(u.children)};return o(t.children),t.children}function F6({symbols:e,selectedFilePath:t,onSelectFile:r,sourceId:a}){const o=b.useMemo(()=>q6(e),[e]);return c.jsx("div",{className:"overflow-y-auto c4a-scrollbar",children:c.jsx(fw,{nodes:o,depth:0,selectedFilePath:t,onSelectFile:r,sourceId:a})})}function fw({nodes:e,depth:t,selectedFilePath:r,onSelectFile:a,sourceId:o}){return c.jsx(c.Fragment,{children:e.map(i=>c.jsx(G6,{node:i,depth:t,selectedFilePath:r,onSelectFile:a,sourceId:o},i.fullPath))})}function G6({node:e,depth:t,selectedFilePath:r,onSelectFile:a,sourceId:o}){const{t:i}=ye(),u=Aa(_=>_.openTab),[f,h]=b.useState(t<2),p=e.isFile&&e.fullPath===r,m=t*16,x=b.useCallback(()=>{e.isFile?a(p?null:e.fullPath):h(_=>!_)},[e.isFile,e.fullPath,p,a]),v=b.useCallback(_=>{_.stopPropagation(),u({id:`import-deps:${e.fullPath}`,type:"import-deps",resourceId:e.fullPath,label:e.name,meta:{sourceIds:[o]}})},[e.fullPath,e.name,o,u]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`group/node flex h-7 items-center cursor-pointer font-mono text-xs ${p?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-secondary hover:bg-c4a-bg-hover/50"}`,style:{paddingLeft:m},onClick:x,children:[e.isFile?c.jsx("span",{className:"w-4 shrink-0"}):c.jsx($t,{size:12,className:`shrink-0 transition-transform duration-200 text-c4a-text-muted ${f?"rotate-90":""}`}),e.isFile?c.jsx(_m,{size:13,className:"mx-1 shrink-0 text-c4a-text-muted"}):c.jsx(Gn,{size:13,className:"mx-1 shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:"truncate flex-1",children:e.name}),e.isFile&&c.jsx("button",{type:"button",className:"opacity-0 group-hover/node:opacity-100 p-0.5 rounded hover:bg-c4a-bg-active shrink-0 mr-1",title:i("query.import_deps.open"),onClick:v,children:c.jsx(GE,{size:12,className:"text-c4a-text-muted"})})]}),!e.isFile&&f&&e.children.length>0&&c.jsx(fw,{nodes:e.children,depth:t+1,selectedFilePath:r,onSelectFile:a,sourceId:o})]})}function V6({symbol:e}){return e.kind==="class"||e.kind==="interface"?c.jsx(Y6,{symbol:e}):e.kind==="function"?c.jsx(K6,{symbol:e}):c.jsxs("div",{className:Im,children:[c.jsxs(jl,{children:[e.kind.toUpperCase(),": ",e.name]}),e.signature&&c.jsx("p",{className:"font-mono text-xs text-c4a-text-secondary",children:e.signature})]})}function Y6({symbol:e}){const{t}=ye();return c.jsxs("div",{className:Im,children:[e.methods&&e.methods.length>0&&c.jsxs("div",{className:"mb-2",children:[c.jsxs(jl,{children:[t("query.symbol.methods")," (",e.methods.length,")"]}),c.jsx("table",{className:"w-full font-mono text-xs",children:c.jsx("tbody",{children:e.methods.map((r,a)=>c.jsxs("tr",{className:"even:bg-c4a-bg-base",children:[c.jsx("td",{className:"py-0.5 pr-3 text-c4a-text-primary",children:r.name}),c.jsxs("td",{className:"py-0.5 pr-3 text-c4a-text-muted",children:["(",r.params.map(o=>`${o.name}: ${o.type??"unknown"}`).join(", "),")"]}),c.jsx("td",{className:"py-0.5 text-c4a-text-secondary",children:r.returnType??"void"})]},a))})})]}),e.properties&&e.properties.length>0&&c.jsxs("div",{className:"mb-2",children:[c.jsxs(jl,{children:[t("query.symbol.properties")," (",e.properties.length,")"]}),c.jsx("table",{className:"w-full font-mono text-xs",children:c.jsx("tbody",{children:e.properties.map((r,a)=>c.jsxs("tr",{className:"even:bg-c4a-bg-base",children:[c.jsx("td",{className:"py-0.5 pr-3 text-c4a-text-primary",children:r.name}),c.jsx("td",{className:"py-0.5 text-c4a-text-secondary",children:r.type??"unknown"})]},a))})})]}),e.baseClass&&c.jsxs("div",{className:"font-mono text-xs text-c4a-text-secondary",children:[c.jsxs("span",{className:"text-c4a-text-muted",children:[t("query.symbol.extends"),":"]})," ",e.baseClass]}),e.interfaces&&e.interfaces.length>0&&c.jsxs("div",{className:"font-mono text-xs text-c4a-text-secondary",children:[c.jsxs("span",{className:"text-c4a-text-muted",children:[t("query.symbol.implements"),":"]})," ",e.interfaces.join(", ")]})]})}function K6({symbol:e}){const{t}=ye();return c.jsxs("div",{className:Im,children:[e.signature&&c.jsxs("div",{className:"mb-1",children:[c.jsx(jl,{children:t("query.symbol.signature")}),c.jsx("p",{className:"font-mono text-xs text-c4a-text-primary",children:e.signature})]}),e.params&&e.params.length>0&&c.jsxs("div",{className:"mb-1",children:[c.jsx(jl,{children:t("query.symbol.parameters")}),c.jsx("div",{className:"font-mono text-xs",children:e.params.map((r,a)=>c.jsxs("div",{className:"text-c4a-text-secondary",children:[c.jsx("span",{className:"text-c4a-text-primary",children:r.name}),": ",r.type??"unknown"]},a))})]}),e.returnType&&c.jsxs("div",{className:"font-mono text-xs text-c4a-text-secondary",children:[c.jsxs("span",{className:"text-c4a-text-muted",children:[t("query.symbol.returns"),":"]})," ",e.returnType]}),e.isAsync&&c.jsxs("div",{className:"font-mono text-xs text-c4a-text-muted",children:[t("query.symbol.async"),": ✓"]})]})}const Im="ml-6 mt-1 mb-2 rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-3";function jl({children:e}){return c.jsx("div",{className:"font-mono text-[10px] uppercase tracking-tight text-c4a-text-muted mb-1",children:e})}const X6={class:"■",interface:"◇",function:"ƒ",enum:"▣",type_alias:"◈"};function Q6(e,t){if(!t)return e;const r=e.toLowerCase().indexOf(t.toLowerCase());return r<0?e:c.jsxs(c.Fragment,{children:[e.slice(0,r),c.jsx("mark",{className:"bg-c4a-accent/20 text-c4a-accent",children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function Z6({symbols:e,searchQuery:t,sourceId:r}){const{t:a}=ye(),[o,i]=b.useState(null),u=Aa(m=>m.openTab),f=b.useCallback(m=>{i(x=>x===m?null:m)},[]),h=b.useCallback((m,x)=>{m.stopPropagation(),u({id:`call-graph:${x.filePath}:${x.name}`,type:"call-graph",resourceId:`${x.filePath}#${x.name}`,label:`Calls: ${x.name}`,icon:"🔗",meta:{sourceIds:[r]}})},[r,u]),p=b.useCallback((m,x)=>{m.stopPropagation(),u({id:`inheritance:${x.filePath}:${x.name}`,type:"inheritance",resourceId:`${x.filePath}#${x.name}`,label:`Inherit: ${x.name}`,icon:"📐",meta:{sourceIds:[r]}})},[r,u]);return e.length===0?c.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:c.jsx("p",{className:"font-mono text-xs text-c4a-text-muted",children:a("query.symbol.empty")})}):c.jsx("div",{className:"overflow-y-auto c4a-scrollbar",children:e.map(m=>{const x=`${m.filePath}:${m.name}:${m.line}`,v=o===x;return c.jsxs("div",{children:[c.jsxs("div",{className:"group flex h-8 items-center gap-2 px-3 cursor-pointer border-b border-c4a-border-subtle last:border-b-0 hover:bg-c4a-bg-hover/50",onClick:()=>f(x),children:[c.jsx("span",{className:"shrink-0 w-4 text-center font-mono text-xs text-c4a-text-muted",children:X6[m.kind]??"·"}),c.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate flex-1",children:Q6(m.name,t)}),c.jsx(Bt,{variant:"muted",children:m.kind.replace("_"," ")}),m.isExported&&c.jsx(Bt,{variant:"accent",children:"Export"}),m.kind==="function"&&c.jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-c4a-bg-active shrink-0",title:a("query.call_graph.open"),onClick:_=>h(_,m),children:c.jsx(Uu,{size:13,className:"text-c4a-text-muted"})}),(m.kind==="class"||m.kind==="interface")&&c.jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-c4a-bg-active shrink-0",title:a("query.inheritance.open"),onClick:_=>p(_,m),children:c.jsx(rA,{size:13,className:"text-c4a-text-muted"})})]}),v&&c.jsx(V6,{symbol:m})]},x)})})}const a_=200,J6=200;function W6({sourceId:e}){const{t}=ye(),{data:r,loading:a,error:o,warnings:i,pagination:u}=Mn($=>$.symbols),f=Mn($=>$.fetchSymbols),h=Mn($=>$.resetQuery),[p,m]=b.useState(!0),[x,v]=b.useState(""),[_,w]=b.useState(null),S=b.useRef(null),[k,N]=b.useState("");b.useEffect(()=>(f({sourceIds:[e],exportedOnly:!0,limit:a_}),()=>h("symbols")),[e]);const A=b.useCallback(()=>{const $=!p;m($),w(null),f({sourceIds:[e],exportedOnly:$,limit:a_})},[p,e,f]),E=b.useCallback($=>{const R=$.target.value;v(R),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>N(R),300)},[]),D=b.useCallback(()=>{!r||!u||f({sourceIds:[e],exportedOnly:p,limit:J6,offset:r.length},{append:!0})},[r,u,e,p,f]),L=b.useMemo(()=>{if(!r)return[];let $=r;if(_&&($=$.filter(R=>R.filePath===_)),k){const R=k.toLowerCase();$=$.filter(B=>B.name.toLowerCase().includes(R))}return $},[r,_,k]),z=u&&r&&u.total>r.length;return a&&!r?c.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[Array.from({length:5}).map(($,R)=>c.jsx("div",{className:"h-7 bg-c4a-bg-hover animate-pulse rounded"},R)),c.jsx("div",{className:"mt-2 text-center",children:c.jsx(ta,{labelKey:"query.symbol.loading"})})]}):o&&!r?c.jsx(wt,{title:t("query.symbol.empty"),description:o}):!a&&r&&r.length===0?c.jsx(wt,{title:t("query.symbol.empty"),description:t("query.symbol.empty_desc")}):c.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.length>0&&c.jsx("div",{className:"px-4 pt-3",children:c.jsx(xd,{warnings:i})}),c.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-c4a-border-subtle",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(gl,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-c4a-text-muted"}),c.jsx("input",{className:"w-full rounded-lg border border-c4a-border-default bg-c4a-bg-surface pl-8 pr-3 py-1.5 text-sm text-c4a-text-primary placeholder:text-c4a-text-muted focus:border-c4a-accent focus:outline-none focus:ring-2 focus:ring-c4a-accent/30",placeholder:t("query.symbol.search_placeholder"),value:x,onChange:E})]}),c.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer shrink-0",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:A,className:"accent-c4a-accent"}),c.jsx("span",{className:"font-mono text-[11px] uppercase tracking-tight text-c4a-text-secondary",children:t("query.symbol.exported_only")})]})]}),c.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[c.jsx("div",{className:"w-1/3 min-w-[200px] max-w-[300px] border-r border-c4a-border-subtle overflow-y-auto c4a-scrollbar",children:r&&c.jsx(F6,{symbols:r,selectedFilePath:_,onSelectFile:w,sourceId:e})}),c.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[c.jsx("div",{className:"flex-1 overflow-y-auto c4a-scrollbar",children:c.jsx(Z6,{symbols:L,searchQuery:k,sourceId:e})}),z&&c.jsx("div",{className:"flex items-center justify-center border-t border-c4a-border-subtle py-2",children:c.jsx("button",{type:"button",className:"rounded-lg border border-c4a-border-default bg-c4a-bg-surface px-4 py-1.5 font-mono text-xs uppercase tracking-tight text-c4a-text-secondary hover:bg-c4a-bg-hover cursor-pointer",onClick:D,disabled:a,children:a?c.jsx("span",{className:"animate-pulse",children:t("query.symbol.loading")}):t("query.symbol.load_more",{count:u.total-r.length})})})]})]})]})}function eO(e){return e>=.7?{stars:3,label:"⭐⭐⭐",key:"query.doc.relevance.high"}:e>=.5?{stars:2,label:"⭐⭐",key:"query.doc.relevance.medium"}:{stars:1,label:"⭐",key:"query.doc.relevance.low"}}function tO(e,t){if(!t)return e;const r=e.toLowerCase().indexOf(t.toLowerCase());return r<0?e:c.jsxs(c.Fragment,{children:[e.slice(0,r),c.jsx("mark",{className:"bg-c4a-accent/20 text-c4a-accent",children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function nO({result:e,searchQuery:t}){const{t:r}=ye(),a=Aa(f=>f.openTab),o=eO(e.score),i=()=>{a({id:`content:${e.hashId}:s${e.sectionIndex}p${e.paragraphIndex}`,type:"content",resourceId:e.hashId,label:e.sourceName,meta:{sectionIndex:e.sectionIndex,paragraphIndex:e.paragraphIndex,sourcePath:e.sourcePath}})},u=e.sectionHeading?e.sectionHeading.split(" > ").filter(Boolean):[];return c.jsxs("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-surface p-4 hover:border-c4a-accent/30 cursor-pointer transition-colors",onClick:i,children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm",children:o.label}),c.jsx("span",{className:"font-mono text-[10px] uppercase tracking-tight text-c4a-text-muted",children:r(o.key)})]}),c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted truncate ml-2",children:e.sourceName})]}),c.jsx("p",{className:"text-sm text-c4a-text-primary leading-relaxed line-clamp-4",children:tO(e.paragraphText,t)}),u.length>0&&c.jsxs("div",{className:"flex items-center gap-1 mt-3 font-mono text-[11px] text-c4a-text-muted",children:[c.jsx(On,{size:12,className:"shrink-0"}),u.map((f,h)=>c.jsxs("span",{className:"flex items-center gap-1",children:[h>0&&c.jsx("span",{className:"text-c4a-text-muted/50",children:">"}),c.jsx("span",{children:f})]},h))]})]})}function rO({sourceId:e}){const{t}=ye(),[r,a]=b.useState(""),[o,i]=b.useState(""),[u,f]=b.useState(null),{data:h,loading:p,error:m}=Mn(S=>S.paragraphs),x=Mn(S=>S.fetchParagraphs),v=Mn(S=>S.resetQuery);b.useEffect(()=>{a(""),i(""),v("paragraphs")},[e,v]),b.useEffect(()=>{m&&!p&&(console.error("[DocSearchBox] search failed:",m),f({title:t("query.doc.error.title"),detail:m}))},[m,p,t]);const _=b.useCallback(()=>{const S=r.trim();S&&(i(S),x({sourceIds:[e],text:S,topK:10}))},[r,e,x]),w=S=>{S.key==="Enter"&&_()};return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-c4a-border-subtle",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(gl,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-c4a-text-muted"}),c.jsx("input",{className:"w-full rounded-lg border border-c4a-border-default bg-c4a-bg-surface pl-8 pr-3 py-1.5 text-sm text-c4a-text-primary placeholder:text-c4a-text-muted focus:border-c4a-accent focus:outline-none focus:ring-2 focus:ring-c4a-accent/30",placeholder:t("query.doc.search_placeholder"),value:r,onChange:S=>a(S.target.value),onKeyDown:w})]}),c.jsx("button",{type:"button",className:"rounded px-4 py-1.5 bg-c4a-accent text-white font-mono text-xs uppercase tracking-tight hover:bg-c4a-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:_,disabled:!r.trim()||p,children:t("query.doc.search_button")})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto c4a-scrollbar p-4",children:[p&&c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(ta,{labelKey:"query.doc.searching"})}),u&&c.jsx(Bl,{error:u,onClose:()=>f(null)}),!p&&!m&&h&&h.length===0&&c.jsx(wt,{title:t("query.doc.empty.title"),description:t("query.doc.empty.desc")}),!p&&!m&&h&&h.length>0&&c.jsx("div",{className:"flex flex-col gap-3",children:h.map(S=>c.jsx(nO,{result:S,searchQuery:o},`${S.hashId}-${S.paragraphIndex}`))})]})]})}function aO({sourceType:e,sourceId:t,indexStatus:r}){const{t:a}=ye();return r==="indexing"?c.jsx(wt,{title:a("query.indexing.title"),description:a("query.indexing.desc")}):e==="code"&&t?c.jsx(W6,{sourceId:t}):e&&e!=="code"&&t?c.jsx(rO,{sourceId:t}):c.jsx(wt,{title:a("query.doc.empty.title"),description:a("query.doc.empty.desc")})}const sO=new Set(["raw","digest","extraction","entities","query"]);function fh(){const e=window.location.hash.replace("#","");return sO.has(e)?e:null}function s_(e){try{const t=JSON.parse(e);return t&&typeof t=="object"&&"manifest_type"in t}catch{return!1}}function o_({sourceId:e,isDaemonOnline:t,indexModules:r}){const{t:a}=ye(),o=kt(h=>h.triggerIndex),[i,u]=b.useState(null),f=async()=>{if(e){u(null);try{(await o(e,r)).status==="skipped"&&(u(a("index.code.skipped")),setTimeout(()=>u(null),3e3))}catch{u(a("index.code.error")),setTimeout(()=>u(null),3e3)}}};return c.jsx(wt,{title:a("common.empty.content_raw.title"),description:a("common.empty.content_raw.description"),action:e?c.jsxs("div",{className:"flex flex-col items-center gap-2",children:[c.jsx("button",{type:"button",className:`rounded bg-c4a-accent px-4 py-2 text-sm font-medium text-white hover:bg-c4a-accent/90 ${t?"":"opacity-40 cursor-not-allowed"}`,onClick:t?f:void 0,title:t?void 0:a("daemon.offline_tooltip"),children:a("common.empty.content_raw.cta")}),i&&c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:i})]}):void 0})}function pw({hashId:e,sourcePath:t,sourceId:r,isCodeIndexing:a,isDaemonOnline:o,indexModules:i,sourceType:u,indexStatus:f,paragraphMeta:h}){const{t:p}=ye(),[m,x]=b.useState(null),[v,_]=b.useState(null),w=h!=null&&typeof h.sectionIndex=="number",[S,k]=b.useState(()=>w?"digest":fh()??"raw"),[N,A]=b.useState(!1);b.useEffect(()=>{const L=()=>{const z=fh();z&&k(z)};return window.addEventListener("hashchange",L),()=>window.removeEventListener("hashchange",L)},[]),b.useEffect(()=>{w&&k("digest")},[w,h?.sectionIndex,h?.paragraphIndex]),b.useEffect(()=>{if(!e){x(null),_(null);return}_(null),ze.get(`/contents/${e}`).then(L=>{x(L),!w&&!fh()&&k("raw")}).catch(L=>{L instanceof hn&&L.status===404?_("not_found"):_("load_failed")})},[e]);const E=b.useCallback(()=>{A(!0),e&&ze.get(`/contents/${e}`).then(L=>x(L)).catch(()=>{})},[e]);b.useEffect(()=>{a&&A(!1)},[a]);const D=a&&!N&&r;return c.jsx("div",{className:"flex flex-1 flex-col",children:c.jsxs(o4,{value:S,onChange:L=>{const z=L;k(z),window.location.hash=z},children:[c.jsxs(i4,{children:[c.jsx(Vr,{value:"raw",children:p("content.detail.tab.raw")}),c.jsx(Vr,{value:"digest",children:p("content.detail.tab.digest")}),c.jsx(Vr,{value:"extraction",children:p("content.detail.tab.extraction")}),c.jsx(Vr,{value:"entities",children:p("content.detail.tab.entities")}),f&&f!=="none"&&c.jsx(Vr,{value:"query",children:p("query.tab.label")})]}),c.jsx("div",{className:"mt-4 flex flex-1 flex-col",children:D?c.jsx(R6,{sourceId:r,onComplete:E,retryModules:i}):v?e?c.jsx(wt,{title:p(`common.error.${v}`),description:p(`common.error.${v}_description`)}):c.jsx(o_,{sourceId:r,isDaemonOnline:o,indexModules:i}):e?m?c.jsxs(c.Fragment,{children:[c.jsx(Yr,{value:"raw",children:c.jsx(oO,{hashId:m.hash_id,sourcePath:t})}),c.jsx(Yr,{value:"digest",children:c.jsx(iO,{hashId:m.hash_id,sourceId:r,sourcePath:t,isDaemonOnline:o,available:m.stages?.digest?.available,indexModules:i})}),c.jsx(Yr,{value:"extraction",children:c.jsx(lO,{hashId:m.hash_id,available:m.stages?.extraction?.available})}),c.jsx(Yr,{value:"entities",children:c.jsx(cO,{hashId:m.hash_id,available:m.stages?.extraction?.available})}),f&&f!=="none"&&c.jsx(Yr,{value:"query",children:c.jsx(aO,{sourceType:u,sourceId:r,indexStatus:f})})]}):c.jsx(ql,{}):c.jsx(o_,{sourceId:r,isDaemonOnline:o,indexModules:i})})]})})}function ql(){return c.jsx("div",{className:"flex flex-1 items-center justify-center pb-15",children:c.jsx(Zt,{size:24,className:"animate-spin text-c4a-text-muted"})})}function oO({hashId:e,sourcePath:t}){const{t:r}=ye(),[a,o]=b.useState(null),[i,u]=b.useState(!1),[f,h]=b.useState(!1);if(b.useEffect(()=>{u(!1),o(null),ze.get(`/contents/${e}/raw`).then(p=>{o(p),u(!0),h(!1)}).catch(p=>{p instanceof hn&&p.status===404&&h(!0),u(!0)})},[e]),!i){if(a){if(s_(a.content))try{return c.jsx(e_,{data:JSON.parse(a.content)})}catch{}return c.jsx(Qv,{code:a.content,sourcePath:t})}return c.jsx(ql,{})}if(f||!a||a.source==="unavailable")return c.jsx(wt,{title:r("common.empty.content_raw.title"),description:r("common.empty.content_raw.description")});if(s_(a.content))try{const p=JSON.parse(a.content);return c.jsx(e_,{data:p})}catch{}return c.jsx(Qv,{code:a.content,sourcePath:t})}function iO({hashId:e,sourceId:t,sourcePath:r,isDaemonOnline:a,available:o,indexModules:i}){const{t:u}=ye(),[f,h]=b.useState(null),[p,m]=b.useState(!1),[x,v]=b.useState(!1),[_,w]=b.useState(null),S=kt(D=>D.triggerIndex),k=kt(D=>D.currentRoot),A=(k&&r?zl(k.tree,r):null)?.source_type==="doc",E=A?!0:!!a;return b.useEffect(()=>{if(o===!1){v(!0),m(!0),h(null);return}m(!1),v(!1),h(null);const D=A?"?digestType=doc_llm":"";ze.get(`/contents/${e}/digest${D}`).then(L=>{const z="digest"in L?L.digest:L.digests?.[0];z?h(z):v(!0),m(!0)}).catch(L=>{L instanceof hn&&L.status===404&&v(!0),m(!0)})},[e,o,A]),p?x||!f?c.jsx(wt,{title:u(A?"digest.doc.empty.title":"digest.empty.title"),description:u(A?"digest.doc.empty.description":"digest.empty.description"),action:t?c.jsxs("div",{className:"flex flex-col items-center gap-2",children:[c.jsx("button",{type:"button",className:`rounded bg-c4a-accent px-4 py-2 text-sm font-medium text-white hover:bg-c4a-accent/90 ${E?"":"opacity-40 cursor-not-allowed"}`,onClick:E?async()=>{w(null);try{(await S(t,i)).status==="skipped"&&(w(u("index.code.skipped")),setTimeout(()=>w(null),3e3))}catch{w(u("index.code.error")),setTimeout(()=>w(null),3e3)}}:void 0,title:!E&&!A?u("daemon.offline_tooltip"):void 0,children:u(A?"digest.doc.empty.cta":"digest.empty.cta")}),_&&c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:_})]}):void 0}):c.jsx(i_,{data:f}):f?c.jsx(i_,{data:f}):c.jsx(ql,{})}function i_({data:e}){const{t}=ye(),r=e.digest_data,a=r.classes||r.functions||r.relations;if(e.digest_type==="doc_llm")return c.jsx(H6,{digest:r});if(!a)return c.jsxs("div",{className:"flex flex-1 flex-col gap-3",children:[r.language&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"text-xs text-c4a-text-muted",children:[t("content.detail.language"),":"]}),c.jsx(Bt,{children:r.language})]}),c.jsx("div",{className:"flex flex-1 flex-col overflow-auto rounded border border-c4a-border-subtle p-3",children:c.jsx(Hl,{data:r,defaultExpanded:2})})]});const o=Array.isArray(r.files)?r.files.length:0,i=Array.isArray(r.classes)?r.classes.length:0,u=Array.isArray(r.functions)?r.functions.length:0,f=(Array.isArray(r.relations?.imports)?r.relations.imports.length:0)+(Array.isArray(r.relations?.calls)?r.relations.calls.length:0)+(Array.isArray(r.relations?.inheritance)?r.relations.inheritance.length:0),h=Array.isArray(r.techStack)?r.techStack:[],p=Array.isArray(r.modules)?r.modules:[];return c.jsxs("div",{className:"flex flex-1 flex-col gap-6 overflow-auto c4a-scrollbar",children:[c.jsxs("div",{className:"flex flex-wrap gap-3",children:[c.jsx(ln,{icon:c.jsx(On,{size:14}),label:t("digest.stats.files"),value:o,size:"sm"}),c.jsx(ln,{icon:c.jsx(T1,{size:14}),label:t("digest.stats.classes"),value:i,size:"sm"}),c.jsx(ln,{icon:c.jsx(LA,{size:14}),label:t("digest.stats.functions"),value:u,size:"sm"}),c.jsx(ln,{icon:c.jsx(FC,{size:14}),label:t("digest.stats.relations"),value:f,size:"sm"})]}),h.length>0&&c.jsxs("div",{children:[c.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:t("digest.tech_stack")}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.map(m=>c.jsx(Bt,{children:m},m))})]}),p.length>0&&c.jsxs("div",{children:[c.jsx("h4",{className:"mb-2 font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:t("digest.modules")}),c.jsx("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface",children:p.map(m=>c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 font-mono text-xs border-b border-c4a-border-subtle last:border-b-0",children:[c.jsx("span",{className:"text-c4a-text-primary",children:m.path||m.name}),c.jsxs("span",{className:"text-c4a-text-muted",children:[m.fileCount," files · ",m.totalLines>=1e3?`${(m.totalLines/1e3).toFixed(1)}k`:m.totalLines," lines"]})]},m.path))})]})]})}function lO({hashId:e,available:t}){const{t:r}=ye(),[a,o]=b.useState(null),[i,u]=b.useState(!1),[f,h]=b.useState(!1);return b.useEffect(()=>{if(t===!1){h(!0),u(!0),o(null);return}u(!1),o(null),h(!1),ze.get(`/contents/${e}/extractions`).then(p=>{!p.extractions||p.extractions.length===0?h(!0):o(p),u(!0)}).catch(p=>{p instanceof hn&&p.status===404&&h(!0),u(!0)})},[e,t]),i?f||!a?c.jsx(wt,{title:r("common.empty.content_extraction.title"),description:r("common.empty.content_extraction.description")}):c.jsx(l_,{extractions:a.extractions}):a?c.jsx(l_,{extractions:a.extractions}):c.jsx(ql,{})}function l_({extractions:e}){const{t}=ye();return c.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-auto c4a-scrollbar",children:e.map(r=>{const a=Yo(r.extraction_confidence);return c.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-4",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.model&&c.jsx(Bt,{variant:"muted",children:r.model}),a&&c.jsx(Bt,{variant:a.variant,tooltip:`${a.value.toFixed(2)} — ${t(a.tipKey)}`,children:t(a.labelKey)})]}),c.jsx(Hl,{data:{atoms:r.atoms,candidate_entities:r.candidate_entities},defaultExpanded:2})]},r.id)})})}function cO({hashId:e,available:t}){const{t:r}=ye(),[a,o]=b.useState([]),[i,u]=b.useState(!1),[f,h]=b.useState(!1);return b.useEffect(()=>{if(t===!1){h(!0),u(!0),o([]);return}u(!1),o([]),h(!1),ze.get(`/contents/${e}/entities`).then(p=>{!p.entities||p.entities.length===0?h(!0):o(p.entities),u(!0)}).catch(p=>{p instanceof hn&&p.status===404&&h(!0),u(!0)})},[e,t]),i?f||a.length===0?c.jsx(wt,{title:r("common.empty.content_entities.title"),description:r("common.empty.content_entities.description")}):c.jsx("div",{className:"flex flex-1 flex-col overflow-auto c4a-scrollbar",children:c.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:a.map(p=>c.jsx(Jv,{entity:p},p.id))})}):a.length>0?c.jsx("div",{className:"flex flex-1 flex-col overflow-auto c4a-scrollbar",children:c.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:a.map(p=>c.jsx(Jv,{entity:p},p.id))})}):c.jsx(ql,{})}const c_={entities:"Entities",behaviors:"Behaviors",roles:"Roles",attributes:"Attributes",states:"States",transitions:"Transitions",events:"Events",rules:"Rules",constraints:"Constraints",decisions:"Decisions",metrics:"Metrics",claims:"Claims",relations:"Relations",comparisons:"Comparisons",boundaries:"Boundaries"};function uO({data:e,atoms:t}){return c.jsxs("div",{className:"space-y-4",children:[e&&Object.keys(e).length>0&&c.jsx("div",{children:c.jsx(Hl,{data:e,defaultExpanded:2})}),t&&c.jsx(dO,{atoms:t})]})}function dO({atoms:e}){const t=Object.keys(c_);return c.jsx("div",{className:"space-y-2",children:t.map(r=>{const a=e[r];return!a||a.length===0?null:c.jsx(fO,{type:r,label:c_[r]??r,items:a},r)})})}function fO({type:e,label:t,items:r}){const[a,o]=b.useState(!0);return c.jsxs("details",{open:a,onToggle:i=>o(i.target.open),children:[c.jsxs("summary",{className:"cursor-pointer font-mono text-xs uppercase text-c4a-text-secondary hover:text-c4a-text-primary py-1.5",children:[t," (",r.length,")"]}),c.jsx("div",{className:"pl-4 pb-2",children:c.jsx(pO,{type:e,items:r})})]})}function pO({type:e,items:t}){switch(e){case"entities":case"behaviors":case"events":case"relations":return c.jsx(u_,{items:t});case"roles":return c.jsx(hO,{items:t});case"attributes":return c.jsx(mO,{items:t});case"states":return c.jsx(gO,{items:t});case"transitions":return c.jsx(xO,{items:t});case"rules":case"constraints":return c.jsx(yO,{items:t});case"decisions":return c.jsx(bO,{items:t});case"metrics":return c.jsx(vO,{items:t});case"claims":return c.jsx(_O,{items:t});case"comparisons":return c.jsx(wO,{items:t});case"boundaries":return c.jsx(SO,{items:t});default:return c.jsx(u_,{items:t})}}function ra({value:e}){const{t}=ye(),r=Yo(e);return r?c.jsx(Bt,{variant:r.variant,tooltip:`${r.value.toFixed(2)} — ${t(r.tipKey)}`,children:t(r.labelKey)}):null}function u_({items:e}){return c.jsx("div",{className:"space-y-1",children:e.map((t,r)=>c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.ref&&$m(t.ref)?c.jsx(Bm,{pointer:t.ref}):c.jsx("span",{className:"text-c4a-text-primary",children:t.name??String(t)}),c.jsx(ra,{value:t.confidence})]},r))})}function hO({items:e}){return c.jsx("div",{className:"space-y-1.5",children:e.map((t,r)=>c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx(Bt,{variant:"accent",children:t.name??"role"}),!!t.performs&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-c4a-text-muted",children:"performs"}),$m(String(t.performs))?c.jsx(Bm,{pointer:String(t.performs)}):c.jsx("span",{className:"text-c4a-text-primary",children:String(t.performs)})]}),c.jsx(ra,{value:t.confidence})]},r))})}function mO({items:e}){return c.jsx("div",{className:"space-y-1",children:e.map((t,r)=>c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsxs("span",{className:"text-c4a-text-secondary font-mono",children:[t.name,":"]}),c.jsx("span",{className:"text-c4a-text-primary",children:String(t.value??"")}),c.jsx(ra,{value:t.confidence})]},r))})}function gO({items:e}){return c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map((t,r)=>c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Bt,{children:t.name??String(t)}),c.jsx(ra,{value:t.confidence})]},r))})}function xO({items:e}){return c.jsx("div",{className:"space-y-1.5",children:e.map((t,r)=>{const a=t;return c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx(Bt,{variant:"muted",children:String(a.from_state??"?")}),c.jsx("span",{className:"text-c4a-text-muted",children:"→"}),c.jsx(Bt,{variant:"muted",children:String(a.to_state??"?")}),!!a.trigger&&c.jsx("span",{className:"text-c4a-text-muted italic",children:String(a.trigger)}),c.jsx(ra,{value:t.confidence})]},r)})})}function yO({items:e}){return c.jsx("div",{className:"space-y-1.5",children:e.map((t,r)=>{const a=t;return c.jsx("div",{className:"text-xs",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"text-c4a-warning font-mono font-bold",children:"IF"}),c.jsx("span",{className:"text-c4a-text-primary",children:String(a.condition??a.name??"")}),c.jsx("span",{className:"text-c4a-accent font-mono font-bold",children:"THEN"}),c.jsx("span",{className:"text-c4a-text-primary",children:String(a.conclusion??a.description??"")}),c.jsx(ra,{value:t.confidence})]})},r)})})}function bO({items:e}){return c.jsx("div",{className:"space-y-1.5",children:e.map((t,r)=>c.jsxs("div",{className:"text-xs",children:[c.jsx("span",{className:"text-c4a-text-primary font-mono",children:t.name}),t.description&&c.jsx("span",{className:"text-c4a-text-muted ml-2",children:t.description}),c.jsx(ra,{value:t.confidence})]},r))})}function vO({items:e}){return c.jsx("div",{className:"space-y-1",children:e.map((t,r)=>{const a=t;return c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("span",{className:"text-c4a-text-primary font-mono",children:t.name}),!!a.unit&&c.jsx("span",{className:"text-c4a-text-muted",children:String(a.unit)}),!!a.threshold&&c.jsxs("span",{className:"text-c4a-text-secondary",children:["< ",String(a.threshold)]}),c.jsx(ra,{value:t.confidence})]},r)})})}function _O({items:e}){return c.jsx("div",{className:"space-y-1.5",children:e.map((t,r)=>{const a=t;return c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[!!a.claim_type&&c.jsx(Bt,{variant:"warning",children:String(a.claim_type)}),c.jsx("span",{className:"text-c4a-text-primary",children:t.description??t.name}),!!a.valid_from&&c.jsxs("span",{className:"text-c4a-text-muted",children:[String(a.valid_from)," 起"]}),c.jsx(ra,{value:t.confidence})]},r)})})}function wO({items:e}){return c.jsx("div",{className:"space-y-3",children:e.map((t,r)=>{const a=t,o=a.criteria,i=a.options;return!o||!i?c.jsx("div",{className:"text-xs text-c4a-text-muted",children:c.jsx(Hl,{data:t,defaultExpanded:1})},r):c.jsx("div",{className:"rounded border border-c4a-border-subtle overflow-auto",children:c.jsxs("table",{className:"w-full text-xs font-mono",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-c4a-border-subtle bg-c4a-bg-surface text-c4a-text-muted",children:[c.jsx("th",{className:"px-2 py-1 text-left",children:"Criteria"}),i.map((u,f)=>c.jsx("th",{className:"px-2 py-1 text-left",children:String(u.name??`Option ${f+1}`)},f))]})}),c.jsx("tbody",{children:o.map((u,f)=>c.jsxs("tr",{className:"border-b border-c4a-border-subtle",children:[c.jsx("td",{className:"px-2 py-1 text-c4a-text-secondary",children:u}),i.map((h,p)=>{const m=h.values;return c.jsx("td",{className:"px-2 py-1 text-c4a-text-primary",children:m?.[f]??"—"},p)})]},f))})]})},r)})})}function SO({items:e}){return c.jsx("div",{className:"space-y-1",children:e.map((t,r)=>{const a=t,o=a.included!==!1&&a.type!=="exclude";return c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("span",{className:o?"text-c4a-success":"text-c4a-error",children:o?"✓ 包含":"✗ 排除"}),c.jsx("span",{className:"text-c4a-text-primary",children:t.name??t.description}),c.jsx(ra,{value:t.confidence})]},r)})})}function jO({relation:e}){const t=Tt(),{t:r}=ye(),a=Ko(),o=Yo(e.confidence),i=e.direction==="incoming"?"←":"→",u=()=>{a?.active?a.navigate("relation",e.id,e.type,"↔"):t(sr.relation(e.id))},f=(h,p)=>{h.stopPropagation(),a?.active?a.navigate("entity",p.id,p.name,"🔹"):t(sr.entity(p.id))};return c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:u,children:[c.jsx(Bt,{variant:"accent",children:e.type}),c.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline cursor-pointer truncate",onClick:h=>f(h,e.from),children:e.from.name}),c.jsx("span",{className:"text-c4a-text-muted text-xs shrink-0",children:i}),c.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline cursor-pointer truncate",onClick:h=>f(h,e.to),children:e.to.name}),e.weight!==void 0&&c.jsxs("span",{className:"text-xs text-c4a-text-muted ml-auto shrink-0",children:["w: ",e.weight]}),o&&c.jsx(Bt,{variant:o.variant,tooltip:`${o.value.toFixed(2)} — ${r(o.tipKey)}`,children:r(o.labelKey)})]})}function kO({entityId:e}){const{t}=ye(),[r,a]=b.useState([]),[o,i]=b.useState(!1),[u,f]=b.useState("both"),[h,p]=b.useState(""),[m,x]=b.useState([]);return b.useEffect(()=>{const v={};u!=="both"&&(v.direction=u),h&&(v.type=h),ze.get(`/entities/${e}/relations`,v).then(_=>{if(a(_.relations),m.length===0){const w=[...new Set(_.relations.map(S=>S.type))];x(w)}i(!0)}).catch(()=>{i(!0)})},[e,u,h]),o?r.length===0?c.jsx(wt,{title:t("common.empty.entity_relations.title"),description:t("common.empty.entity_relations.description")}):c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[c.jsxs("select",{value:u,onChange:v=>f(v.target.value),className:"bg-c4a-bg-surface border border-c4a-border-subtle rounded px-2 py-1 text-xs font-mono text-c4a-text-secondary",children:[c.jsx("option",{value:"both",children:t("relation.filter.direction.all")}),c.jsx("option",{value:"outgoing",children:t("relation.filter.direction.outgoing")}),c.jsx("option",{value:"incoming",children:t("relation.filter.direction.incoming")})]}),m.length>1&&c.jsxs("select",{value:h,onChange:v=>p(v.target.value),className:"bg-c4a-bg-surface border border-c4a-border-subtle rounded px-2 py-1 text-xs font-mono text-c4a-text-secondary",children:[c.jsx("option",{value:"",children:t("relation.filter.type.all")}),m.map(v=>c.jsx("option",{value:v,children:v},v))]})]}),c.jsx("div",{className:"space-y-1",children:r.map(v=>c.jsx(jO,{relation:v},v.id))})]}):c.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})}function NO(e){return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}function hw({content:e}){const{t}=ye(),r=Tt(),a=Ko(),o=e.hash_id.slice(0,12),i=()=>{const u=e.source_path??o;a?.active?a.navigate("content",e.hash_id,u,"📄"):r(sr.content(e.hash_id))};return c.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3 cursor-pointer hover:border-c4a-accent transition-colors",onClick:i,children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"shrink-0",children:"📄"}),c.jsx("span",{className:"font-mono text-xs text-c4a-accent hover:underline truncate",children:o}),e.byte_size!=null&&c.jsx("span",{className:"text-xs text-c4a-text-muted shrink-0",children:NO(e.byte_size)})]}),e.source_path&&c.jsx("p",{className:"mt-1 text-xs text-c4a-text-muted truncate",children:e.source_path}),e.span&&c.jsx("p",{className:"mt-0.5 text-xs text-c4a-text-muted",children:t("content.card.lines",{start:e.span.start,end:e.span.end})})]})}function EO({entityId:e}){const{t}=ye(),[r,a]=b.useState([]),[o,i]=b.useState(!1);return b.useEffect(()=>{ze.get(`/entities/${e}/contents`).then(u=>{a(u.contents??[]),i(!0)}).catch(()=>i(!0))},[e]),o?r.length===0?c.jsx(wt,{title:t("common.empty.entity_contents.title"),description:t("common.empty.entity_contents.description")}):c.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:r.map(u=>c.jsx(hw,{content:u},u.hash_id))}):c.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})}function CO({entityId:e}){const{t}=ye(),r=Tt(),[a,o]=b.useState([]),[i,u]=b.useState(!1);return b.useEffect(()=>{ze.get(`/entities/${e}/referrers`).then(f=>{o(f.referrers??[]),u(!0)}).catch(()=>u(!0))},[e]),i?a.length===0?c.jsx(wt,{title:t("common.empty.entity_referrers.title"),description:t("common.empty.entity_referrers.description")}):c.jsx("div",{className:"space-y-1",children:a.map(f=>c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>r(sr.entity(f.id)),children:[c.jsx("span",{className:"text-xs font-mono text-c4a-accent hover:underline truncate",children:f.name}),c.jsx("span",{className:"text-xs text-c4a-text-muted shrink-0",children:f.type}),c.jsx("span",{className:"text-xs text-c4a-text-muted font-mono ml-auto shrink-0",children:f.ref_field}),c.jsxs("span",{className:"text-xs text-c4a-text-muted shrink-0",children:["(",f.ref_type,")"]})]},`${f.id}-${f.ref_field}`))}):c.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})}function AO(e,t){var r,a=1;e==null&&(e=0),t==null&&(t=0);function o(){var i,u=r.length,f,h=0,p=0;for(i=0;i<u;++i)f=r[i],h+=f.x,p+=f.y;for(h=(h/u-e)*a,p=(p/u-t)*a,i=0;i<u;++i)f=r[i],f.x-=h,f.y-=p}return o.initialize=function(i){r=i},o.x=function(i){return arguments.length?(e=+i,o):e},o.y=function(i){return arguments.length?(t=+i,o):t},o.strength=function(i){return arguments.length?(a=+i,o):a},o}function RO(e){const t=+this._x.call(null,e),r=+this._y.call(null,e);return mw(this.cover(t,r),t,r,e)}function mw(e,t,r,a){if(isNaN(t)||isNaN(r))return e;var o,i=e._root,u={data:a},f=e._x0,h=e._y0,p=e._x1,m=e._y1,x,v,_,w,S,k,N,A;if(!i)return e._root=u,e;for(;i.length;)if((S=t>=(x=(f+p)/2))?f=x:p=x,(k=r>=(v=(h+m)/2))?h=v:m=v,o=i,!(i=i[N=k<<1|S]))return o[N]=u,e;if(_=+e._x.call(null,i.data),w=+e._y.call(null,i.data),t===_&&r===w)return u.next=i,o?o[N]=u:e._root=u,e;do o=o?o[N]=new Array(4):e._root=new Array(4),(S=t>=(x=(f+p)/2))?f=x:p=x,(k=r>=(v=(h+m)/2))?h=v:m=v;while((N=k<<1|S)===(A=(w>=v)<<1|_>=x));return o[A]=i,o[N]=u,e}function TO(e){var t,r,a=e.length,o,i,u=new Array(a),f=new Array(a),h=1/0,p=1/0,m=-1/0,x=-1/0;for(r=0;r<a;++r)isNaN(o=+this._x.call(null,t=e[r]))||isNaN(i=+this._y.call(null,t))||(u[r]=o,f[r]=i,o<h&&(h=o),o>m&&(m=o),i<p&&(p=i),i>x&&(x=i));if(h>m||p>x)return this;for(this.cover(h,p).cover(m,x),r=0;r<a;++r)mw(this,u[r],f[r],e[r]);return this}function LO(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var r=this._x0,a=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(e))+1,i=(a=Math.floor(t))+1;else{for(var u=o-r||1,f=this._root,h,p;r>e||e>=o||a>t||t>=i;)switch(p=(t<a)<<1|e<r,h=new Array(4),h[p]=f,f=h,u*=2,p){case 0:o=r+u,i=a+u;break;case 1:r=o-u,i=a+u;break;case 2:o=r+u,a=i-u;break;case 3:r=o-u,a=i-u;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=a,this._x1=o,this._y1=i,this}function DO(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function OO(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Dn(e,t,r,a,o){this.node=e,this.x0=t,this.y0=r,this.x1=a,this.y1=o}function MO(e,t,r){var a,o=this._x0,i=this._y0,u,f,h,p,m=this._x1,x=this._y1,v=[],_=this._root,w,S;for(_&&v.push(new Dn(_,o,i,m,x)),r==null?r=1/0:(o=e-r,i=t-r,m=e+r,x=t+r,r*=r);w=v.pop();)if(!(!(_=w.node)||(u=w.x0)>m||(f=w.y0)>x||(h=w.x1)<o||(p=w.y1)<i))if(_.length){var k=(u+h)/2,N=(f+p)/2;v.push(new Dn(_[3],k,N,h,p),new Dn(_[2],u,N,k,p),new Dn(_[1],k,f,h,N),new Dn(_[0],u,f,k,N)),(S=(t>=N)<<1|e>=k)&&(w=v[v.length-1],v[v.length-1]=v[v.length-1-S],v[v.length-1-S]=w)}else{var A=e-+this._x.call(null,_.data),E=t-+this._y.call(null,_.data),D=A*A+E*E;if(D<r){var L=Math.sqrt(r=D);o=e-L,i=t-L,m=e+L,x=t+L,a=_.data}}return a}function zO(e){if(isNaN(m=+this._x.call(null,e))||isNaN(x=+this._y.call(null,e)))return this;var t,r=this._root,a,o,i,u=this._x0,f=this._y0,h=this._x1,p=this._y1,m,x,v,_,w,S,k,N;if(!r)return this;if(r.length)for(;;){if((w=m>=(v=(u+h)/2))?u=v:h=v,(S=x>=(_=(f+p)/2))?f=_:p=_,t=r,!(r=r[k=S<<1|w]))return this;if(!r.length)break;(t[k+1&3]||t[k+2&3]||t[k+3&3])&&(a=t,N=k)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(i=r.next)&&delete r.next,o?(i?o.next=i:delete o.next,this):t?(i?t[k]=i:delete t[k],(r=t[0]||t[1]||t[2]||t[3])&&r===(t[3]||t[2]||t[1]||t[0])&&!r.length&&(a?a[N]=r:this._root=r),this):(this._root=i,this)}function $O(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this}function BO(){return this._root}function IO(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function UO(e){var t=[],r,a=this._root,o,i,u,f,h;for(a&&t.push(new Dn(a,this._x0,this._y0,this._x1,this._y1));r=t.pop();)if(!e(a=r.node,i=r.x0,u=r.y0,f=r.x1,h=r.y1)&&a.length){var p=(i+f)/2,m=(u+h)/2;(o=a[3])&&t.push(new Dn(o,p,m,f,h)),(o=a[2])&&t.push(new Dn(o,i,m,p,h)),(o=a[1])&&t.push(new Dn(o,p,u,f,m)),(o=a[0])&&t.push(new Dn(o,i,u,p,m))}return this}function PO(e){var t=[],r=[],a;for(this._root&&t.push(new Dn(this._root,this._x0,this._y0,this._x1,this._y1));a=t.pop();){var o=a.node;if(o.length){var i,u=a.x0,f=a.y0,h=a.x1,p=a.y1,m=(u+h)/2,x=(f+p)/2;(i=o[0])&&t.push(new Dn(i,u,f,m,x)),(i=o[1])&&t.push(new Dn(i,m,f,h,x)),(i=o[2])&&t.push(new Dn(i,u,x,m,p)),(i=o[3])&&t.push(new Dn(i,m,x,h,p))}r.push(a)}for(;a=r.pop();)e(a.node,a.x0,a.y0,a.x1,a.y1);return this}function HO(e){return e[0]}function qO(e){return arguments.length?(this._x=e,this):this._x}function FO(e){return e[1]}function GO(e){return arguments.length?(this._y=e,this):this._y}function Um(e,t,r){var a=new Pm(t??HO,r??FO,NaN,NaN,NaN,NaN);return e==null?a:a.addAll(e)}function Pm(e,t,r,a,o,i){this._x=e,this._y=t,this._x0=r,this._y0=a,this._x1=o,this._y1=i,this._root=void 0}function d_(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var $n=Um.prototype=Pm.prototype;$n.copy=function(){var e=new Pm(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,r,a;if(!t)return e;if(!t.length)return e._root=d_(t),e;for(r=[{source:t,target:e._root=new Array(4)}];t=r.pop();)for(var o=0;o<4;++o)(a=t.source[o])&&(a.length?r.push({source:a,target:t.target[o]=new Array(4)}):t.target[o]=d_(a));return e};$n.add=RO;$n.addAll=TO;$n.cover=LO;$n.data=DO;$n.extent=OO;$n.find=MO;$n.remove=zO;$n.removeAll=$O;$n.root=BO;$n.size=IO;$n.visit=UO;$n.visitAfter=PO;$n.x=qO;$n.y=GO;function Bs(e){return function(){return e}}function cs(e){return(e()-.5)*1e-6}function VO(e){return e.x+e.vx}function YO(e){return e.y+e.vy}function KO(e){var t,r,a,o=1,i=1;typeof e!="function"&&(e=Bs(e==null?1:+e));function u(){for(var p,m=t.length,x,v,_,w,S,k,N=0;N<i;++N)for(x=Um(t,VO,YO).visitAfter(f),p=0;p<m;++p)v=t[p],S=r[v.index],k=S*S,_=v.x+v.vx,w=v.y+v.vy,x.visit(A);function A(E,D,L,z,$){var R=E.data,B=E.r,H=S+B;if(R){if(R.index>v.index){var J=_-R.x-R.vx,oe=w-R.y-R.vy,ce=J*J+oe*oe;ce<H*H&&(J===0&&(J=cs(a),ce+=J*J),oe===0&&(oe=cs(a),ce+=oe*oe),ce=(H-(ce=Math.sqrt(ce)))/ce*o,v.vx+=(J*=ce)*(H=(B*=B)/(k+B)),v.vy+=(oe*=ce)*H,R.vx-=J*(H=1-H),R.vy-=oe*H)}return}return D>_+H||z<_-H||L>w+H||$<w-H}}function f(p){if(p.data)return p.r=r[p.data.index];for(var m=p.r=0;m<4;++m)p[m]&&p[m].r>p.r&&(p.r=p[m].r)}function h(){if(t){var p,m=t.length,x;for(r=new Array(m),p=0;p<m;++p)x=t[p],r[x.index]=+e(x,p,t)}}return u.initialize=function(p,m){t=p,a=m,h()},u.iterations=function(p){return arguments.length?(i=+p,u):i},u.strength=function(p){return arguments.length?(o=+p,u):o},u.radius=function(p){return arguments.length?(e=typeof p=="function"?p:Bs(+p),h(),u):e},u}function XO(e){return e.index}function f_(e,t){var r=e.get(t);if(!r)throw new Error("node not found: "+t);return r}function QO(e){var t=XO,r=x,a,o=Bs(30),i,u,f,h,p,m=1;e==null&&(e=[]);function x(k){return 1/Math.min(f[k.source.index],f[k.target.index])}function v(k){for(var N=0,A=e.length;N<m;++N)for(var E=0,D,L,z,$,R,B,H;E<A;++E)D=e[E],L=D.source,z=D.target,$=z.x+z.vx-L.x-L.vx||cs(p),R=z.y+z.vy-L.y-L.vy||cs(p),B=Math.sqrt($*$+R*R),B=(B-i[E])/B*k*a[E],$*=B,R*=B,z.vx-=$*(H=h[E]),z.vy-=R*H,L.vx+=$*(H=1-H),L.vy+=R*H}function _(){if(u){var k,N=u.length,A=e.length,E=new Map(u.map((L,z)=>[t(L,z,u),L])),D;for(k=0,f=new Array(N);k<A;++k)D=e[k],D.index=k,typeof D.source!="object"&&(D.source=f_(E,D.source)),typeof D.target!="object"&&(D.target=f_(E,D.target)),f[D.source.index]=(f[D.source.index]||0)+1,f[D.target.index]=(f[D.target.index]||0)+1;for(k=0,h=new Array(A);k<A;++k)D=e[k],h[k]=f[D.source.index]/(f[D.source.index]+f[D.target.index]);a=new Array(A),w(),i=new Array(A),S()}}function w(){if(u)for(var k=0,N=e.length;k<N;++k)a[k]=+r(e[k],k,e)}function S(){if(u)for(var k=0,N=e.length;k<N;++k)i[k]=+o(e[k],k,e)}return v.initialize=function(k,N){u=k,p=N,_()},v.links=function(k){return arguments.length?(e=k,_(),v):e},v.id=function(k){return arguments.length?(t=k,v):t},v.iterations=function(k){return arguments.length?(m=+k,v):m},v.strength=function(k){return arguments.length?(r=typeof k=="function"?k:Bs(+k),w(),v):r},v.distance=function(k){return arguments.length?(o=typeof k=="function"?k:Bs(+k),S(),v):o},v}var ZO={value:()=>{}};function yd(){for(var e=0,t=arguments.length,r={},a;e<t;++e){if(!(a=arguments[e]+"")||a in r||/[\s.]/.test(a))throw new Error("illegal type: "+a);r[a]=[]}return new Ru(r)}function Ru(e){this._=e}function JO(e,t){return e.trim().split(/^|\s+/).map(function(r){var a="",o=r.indexOf(".");if(o>=0&&(a=r.slice(o+1),r=r.slice(0,o)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:a}})}Ru.prototype=yd.prototype={constructor:Ru,on:function(e,t){var r=this._,a=JO(e+"",r),o,i=-1,u=a.length;if(arguments.length<2){for(;++i<u;)if((o=(e=a[i]).type)&&(o=WO(r[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<u;)if(o=(e=a[i]).type)r[o]=p_(r[o],e.name,t);else if(t==null)for(o in r)r[o]=p_(r[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Ru(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var r=new Array(o),a=0,o,i;a<o;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],a=0,o=i.length;a<o;++a)i[a].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var a=this._[e],o=0,i=a.length;o<i;++o)a[o].value.apply(t,r)}};function WO(e,t){for(var r=0,a=e.length,o;r<a;++r)if((o=e[r]).name===t)return o.value}function p_(e,t,r){for(var a=0,o=e.length;a<o;++a)if(e[a].name===t){e[a]=ZO,e=e.slice(0,a).concat(e.slice(a+1));break}return r!=null&&e.push({name:t,value:r}),e}var qo=0,ol=0,Wi=0,gw=1e3,Zu,il,Ju=0,Ps=0,bd=0,kl=typeof performance=="object"&&performance.now?performance:Date,xw=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Hm(){return Ps||(xw(eM),Ps=kl.now()+bd)}function eM(){Ps=0}function Wu(){this._call=this._time=this._next=null}Wu.prototype=qm.prototype={constructor:Wu,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Hm():+r)+(t==null?0:+t),!this._next&&il!==this&&(il?il._next=this:Zu=this,il=this),this._call=e,this._time=r,em()},stop:function(){this._call&&(this._call=null,this._time=1/0,em())}};function qm(e,t,r){var a=new Wu;return a.restart(e,t,r),a}function tM(){Hm(),++qo;for(var e=Zu,t;e;)(t=Ps-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qo}function h_(){Ps=(Ju=kl.now())+bd,qo=ol=0;try{tM()}finally{qo=0,rM(),Ps=0}}function nM(){var e=kl.now(),t=e-Ju;t>gw&&(bd-=t,Ju=e)}function rM(){for(var e,t=Zu,r,a=1/0;t;)t._call?(a>t._time&&(a=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Zu=r);il=e,em(a)}function em(e){if(!qo){ol&&(ol=clearTimeout(ol));var t=e-Ps;t>24?(e<1/0&&(ol=setTimeout(h_,e-kl.now()-bd)),Wi&&(Wi=clearInterval(Wi))):(Wi||(Ju=kl.now(),Wi=setInterval(nM,gw)),qo=1,xw(h_))}}function m_(e,t,r){var a=new Wu;return t=t==null?0:+t,a.restart(o=>{a.stop(),e(o+t)},t,r),a}const aM=1664525,sM=1013904223,g_=4294967296;function oM(){let e=1;return()=>(e=(aM*e+sM)%g_)/g_}function iM(e){return e.x}function lM(e){return e.y}var cM=10,uM=Math.PI*(3-Math.sqrt(5));function dM(e){var t,r=1,a=.001,o=1-Math.pow(a,1/300),i=0,u=.6,f=new Map,h=qm(x),p=yd("tick","end"),m=oM();e==null&&(e=[]);function x(){v(),p.call("tick",t),r<a&&(h.stop(),p.call("end",t))}function v(S){var k,N=e.length,A;S===void 0&&(S=1);for(var E=0;E<S;++E)for(r+=(i-r)*o,f.forEach(function(D){D(r)}),k=0;k<N;++k)A=e[k],A.fx==null?A.x+=A.vx*=u:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=u:(A.y=A.fy,A.vy=0);return t}function _(){for(var S=0,k=e.length,N;S<k;++S){if(N=e[S],N.index=S,N.fx!=null&&(N.x=N.fx),N.fy!=null&&(N.y=N.fy),isNaN(N.x)||isNaN(N.y)){var A=cM*Math.sqrt(.5+S),E=S*uM;N.x=A*Math.cos(E),N.y=A*Math.sin(E)}(isNaN(N.vx)||isNaN(N.vy))&&(N.vx=N.vy=0)}}function w(S){return S.initialize&&S.initialize(e,m),S}return _(),t={tick:v,restart:function(){return h.restart(x),t},stop:function(){return h.stop(),t},nodes:function(S){return arguments.length?(e=S,_(),f.forEach(w),t):e},alpha:function(S){return arguments.length?(r=+S,t):r},alphaMin:function(S){return arguments.length?(a=+S,t):a},alphaDecay:function(S){return arguments.length?(o=+S,t):+o},alphaTarget:function(S){return arguments.length?(i=+S,t):i},velocityDecay:function(S){return arguments.length?(u=1-S,t):1-u},randomSource:function(S){return arguments.length?(m=S,f.forEach(w),t):m},force:function(S,k){return arguments.length>1?(k==null?f.delete(S):f.set(S,w(k)),t):f.get(S)},find:function(S,k,N){var A=0,E=e.length,D,L,z,$,R;for(N==null?N=1/0:N*=N,A=0;A<E;++A)$=e[A],D=S-$.x,L=k-$.y,z=D*D+L*L,z<N&&(R=$,N=z);return R},on:function(S,k){return arguments.length>1?(p.on(S,k),t):p.on(S)}}}function fM(){var e,t,r,a,o=Bs(-30),i,u=1,f=1/0,h=.81;function p(_){var w,S=e.length,k=Um(e,iM,lM).visitAfter(x);for(a=_,w=0;w<S;++w)t=e[w],k.visit(v)}function m(){if(e){var _,w=e.length,S;for(i=new Array(w),_=0;_<w;++_)S=e[_],i[S.index]=+o(S,_,e)}}function x(_){var w=0,S,k,N=0,A,E,D;if(_.length){for(A=E=D=0;D<4;++D)(S=_[D])&&(k=Math.abs(S.value))&&(w+=S.value,N+=k,A+=k*S.x,E+=k*S.y);_.x=A/N,_.y=E/N}else{S=_,S.x=S.data.x,S.y=S.data.y;do w+=i[S.data.index];while(S=S.next)}_.value=w}function v(_,w,S,k){if(!_.value)return!0;var N=_.x-t.x,A=_.y-t.y,E=k-w,D=N*N+A*A;if(E*E/h<D)return D<f&&(N===0&&(N=cs(r),D+=N*N),A===0&&(A=cs(r),D+=A*A),D<u&&(D=Math.sqrt(u*D)),t.vx+=N*_.value*a/D,t.vy+=A*_.value*a/D),!0;if(_.length||D>=f)return;(_.data!==t||_.next)&&(N===0&&(N=cs(r),D+=N*N),A===0&&(A=cs(r),D+=A*A),D<u&&(D=Math.sqrt(u*D)));do _.data!==t&&(E=i[_.data.index]*a/D,t.vx+=N*E,t.vy+=A*E);while(_=_.next)}return p.initialize=function(_,w){e=_,r=w,m()},p.strength=function(_){return arguments.length?(o=typeof _=="function"?_:Bs(+_),m(),p):o},p.distanceMin=function(_){return arguments.length?(u=_*_,p):Math.sqrt(u)},p.distanceMax=function(_){return arguments.length?(f=_*_,p):Math.sqrt(f)},p.theta=function(_){return arguments.length?(h=_*_,p):Math.sqrt(h)},p}var tm="http://www.w3.org/1999/xhtml";const x_={svg:"http://www.w3.org/2000/svg",xhtml:tm,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vd(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),x_.hasOwnProperty(t)?{space:x_[t],local:e}:e}function pM(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===tm&&t.documentElement.namespaceURI===tm?t.createElement(e):t.createElementNS(r,e)}}function hM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function yw(e){var t=vd(e);return(t.local?hM:pM)(t)}function mM(){}function Fm(e){return e==null?mM:function(){return this.querySelector(e)}}function gM(e){typeof e!="function"&&(e=Fm(e));for(var t=this._groups,r=t.length,a=new Array(r),o=0;o<r;++o)for(var i=t[o],u=i.length,f=a[o]=new Array(u),h,p,m=0;m<u;++m)(h=i[m])&&(p=e.call(h,h.__data__,m,i))&&("__data__"in h&&(p.__data__=h.__data__),f[m]=p);return new or(a,this._parents)}function xM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function yM(){return[]}function bw(e){return e==null?yM:function(){return this.querySelectorAll(e)}}function bM(e){return function(){return xM(e.apply(this,arguments))}}function vM(e){typeof e=="function"?e=bM(e):e=bw(e);for(var t=this._groups,r=t.length,a=[],o=[],i=0;i<r;++i)for(var u=t[i],f=u.length,h,p=0;p<f;++p)(h=u[p])&&(a.push(e.call(h,h.__data__,p,u)),o.push(h));return new or(a,o)}function vw(e){return function(){return this.matches(e)}}function _w(e){return function(t){return t.matches(e)}}var _M=Array.prototype.find;function wM(e){return function(){return _M.call(this.children,e)}}function SM(){return this.firstElementChild}function jM(e){return this.select(e==null?SM:wM(typeof e=="function"?e:_w(e)))}var kM=Array.prototype.filter;function NM(){return Array.from(this.children)}function EM(e){return function(){return kM.call(this.children,e)}}function CM(e){return this.selectAll(e==null?NM:EM(typeof e=="function"?e:_w(e)))}function AM(e){typeof e!="function"&&(e=vw(e));for(var t=this._groups,r=t.length,a=new Array(r),o=0;o<r;++o)for(var i=t[o],u=i.length,f=a[o]=[],h,p=0;p<u;++p)(h=i[p])&&e.call(h,h.__data__,p,i)&&f.push(h);return new or(a,this._parents)}function ww(e){return new Array(e.length)}function RM(){return new or(this._enter||this._groups.map(ww),this._parents)}function ed(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ed.prototype={constructor:ed,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function TM(e){return function(){return e}}function LM(e,t,r,a,o,i){for(var u=0,f,h=t.length,p=i.length;u<p;++u)(f=t[u])?(f.__data__=i[u],a[u]=f):r[u]=new ed(e,i[u]);for(;u<h;++u)(f=t[u])&&(o[u]=f)}function DM(e,t,r,a,o,i,u){var f,h,p=new Map,m=t.length,x=i.length,v=new Array(m),_;for(f=0;f<m;++f)(h=t[f])&&(v[f]=_=u.call(h,h.__data__,f,t)+"",p.has(_)?o[f]=h:p.set(_,h));for(f=0;f<x;++f)_=u.call(e,i[f],f,i)+"",(h=p.get(_))?(a[f]=h,h.__data__=i[f],p.delete(_)):r[f]=new ed(e,i[f]);for(f=0;f<m;++f)(h=t[f])&&p.get(v[f])===h&&(o[f]=h)}function OM(e){return e.__data__}function MM(e,t){if(!arguments.length)return Array.from(this,OM);var r=t?DM:LM,a=this._parents,o=this._groups;typeof e!="function"&&(e=TM(e));for(var i=o.length,u=new Array(i),f=new Array(i),h=new Array(i),p=0;p<i;++p){var m=a[p],x=o[p],v=x.length,_=zM(e.call(m,m&&m.__data__,p,a)),w=_.length,S=f[p]=new Array(w),k=u[p]=new Array(w),N=h[p]=new Array(v);r(m,x,S,k,N,_,t);for(var A=0,E=0,D,L;A<w;++A)if(D=S[A]){for(A>=E&&(E=A+1);!(L=k[E])&&++E<w;);D._next=L||null}}return u=new or(u,a),u._enter=f,u._exit=h,u}function zM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $M(){return new or(this._exit||this._groups.map(ww),this._parents)}function BM(e,t,r){var a=this.enter(),o=this,i=this.exit();return typeof e=="function"?(a=e(a),a&&(a=a.selection())):a=a.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),r==null?i.remove():r(i),a&&o?a.merge(o).order():o}function IM(e){for(var t=e.selection?e.selection():e,r=this._groups,a=t._groups,o=r.length,i=a.length,u=Math.min(o,i),f=new Array(o),h=0;h<u;++h)for(var p=r[h],m=a[h],x=p.length,v=f[h]=new Array(x),_,w=0;w<x;++w)(_=p[w]||m[w])&&(v[w]=_);for(;h<o;++h)f[h]=r[h];return new or(f,this._parents)}function UM(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var a=e[t],o=a.length-1,i=a[o],u;--o>=0;)(u=a[o])&&(i&&u.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(u,i),i=u);return this}function PM(e){e||(e=HM);function t(x,v){return x&&v?e(x.__data__,v.__data__):!x-!v}for(var r=this._groups,a=r.length,o=new Array(a),i=0;i<a;++i){for(var u=r[i],f=u.length,h=o[i]=new Array(f),p,m=0;m<f;++m)(p=u[m])&&(h[m]=p);h.sort(t)}return new or(o,this._parents).order()}function HM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function FM(){return Array.from(this)}function GM(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var a=e[t],o=0,i=a.length;o<i;++o){var u=a[o];if(u)return u}return null}function VM(){let e=0;for(const t of this)++e;return e}function YM(){return!this.node()}function KM(e){for(var t=this._groups,r=0,a=t.length;r<a;++r)for(var o=t[r],i=0,u=o.length,f;i<u;++i)(f=o[i])&&e.call(f,f.__data__,i,o);return this}function XM(e){return function(){this.removeAttribute(e)}}function QM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ZM(e,t){return function(){this.setAttribute(e,t)}}function JM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function WM(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function e8(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function t8(e,t){var r=vd(e);if(arguments.length<2){var a=this.node();return r.local?a.getAttributeNS(r.space,r.local):a.getAttribute(r)}return this.each((t==null?r.local?QM:XM:typeof t=="function"?r.local?e8:WM:r.local?JM:ZM)(r,t))}function Sw(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function n8(e){return function(){this.style.removeProperty(e)}}function r8(e,t,r){return function(){this.style.setProperty(e,t,r)}}function a8(e,t,r){return function(){var a=t.apply(this,arguments);a==null?this.style.removeProperty(e):this.style.setProperty(e,a,r)}}function s8(e,t,r){return arguments.length>1?this.each((t==null?n8:typeof t=="function"?a8:r8)(e,t,r??"")):Fo(this.node(),e)}function Fo(e,t){return e.style.getPropertyValue(t)||Sw(e).getComputedStyle(e,null).getPropertyValue(t)}function o8(e){return function(){delete this[e]}}function i8(e,t){return function(){this[e]=t}}function l8(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function c8(e,t){return arguments.length>1?this.each((t==null?o8:typeof t=="function"?l8:i8)(e,t)):this.node()[e]}function jw(e){return e.trim().split(/^|\s+/)}function Gm(e){return e.classList||new kw(e)}function kw(e){this._node=e,this._names=jw(e.getAttribute("class")||"")}kw.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Nw(e,t){for(var r=Gm(e),a=-1,o=t.length;++a<o;)r.add(t[a])}function Ew(e,t){for(var r=Gm(e),a=-1,o=t.length;++a<o;)r.remove(t[a])}function u8(e){return function(){Nw(this,e)}}function d8(e){return function(){Ew(this,e)}}function f8(e,t){return function(){(t.apply(this,arguments)?Nw:Ew)(this,e)}}function p8(e,t){var r=jw(e+"");if(arguments.length<2){for(var a=Gm(this.node()),o=-1,i=r.length;++o<i;)if(!a.contains(r[o]))return!1;return!0}return this.each((typeof t=="function"?f8:t?u8:d8)(r,t))}function h8(){this.textContent=""}function m8(e){return function(){this.textContent=e}}function g8(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function x8(e){return arguments.length?this.each(e==null?h8:(typeof e=="function"?g8:m8)(e)):this.node().textContent}function y8(){this.innerHTML=""}function b8(e){return function(){this.innerHTML=e}}function v8(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _8(e){return arguments.length?this.each(e==null?y8:(typeof e=="function"?v8:b8)(e)):this.node().innerHTML}function w8(){this.nextSibling&&this.parentNode.appendChild(this)}function S8(){return this.each(w8)}function j8(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function k8(){return this.each(j8)}function N8(e){var t=typeof e=="function"?e:yw(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function E8(){return null}function C8(e,t){var r=typeof e=="function"?e:yw(e),a=t==null?E8:typeof t=="function"?t:Fm(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),a.apply(this,arguments)||null)})}function A8(){var e=this.parentNode;e&&e.removeChild(this)}function R8(){return this.each(A8)}function T8(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function L8(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D8(e){return this.select(e?L8:T8)}function O8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function M8(e){return function(t){e.call(this,t,this.__data__)}}function z8(e){return e.trim().split(/^|\s+/).map(function(t){var r="",a=t.indexOf(".");return a>=0&&(r=t.slice(a+1),t=t.slice(0,a)),{type:t,name:r}})}function $8(e){return function(){var t=this.__on;if(t){for(var r=0,a=-1,o=t.length,i;r<o;++r)i=t[r],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++a]=i;++a?t.length=a:delete this.__on}}}function B8(e,t,r){return function(){var a=this.__on,o,i=M8(t);if(a){for(var u=0,f=a.length;u<f;++u)if((o=a[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=r),o.value=t;return}}this.addEventListener(e.type,i,r),o={type:e.type,name:e.name,value:t,listener:i,options:r},a?a.push(o):this.__on=[o]}}function I8(e,t,r){var a=z8(e+""),o,i=a.length,u;if(arguments.length<2){var f=this.node().__on;if(f){for(var h=0,p=f.length,m;h<p;++h)for(o=0,m=f[h];o<i;++o)if((u=a[o]).type===m.type&&u.name===m.name)return m.value}return}for(f=t?B8:$8,o=0;o<i;++o)this.each(f(a[o],t,r));return this}function Cw(e,t,r){var a=Sw(e),o=a.CustomEvent;typeof o=="function"?o=new o(t,r):(o=a.document.createEvent("Event"),r?(o.initEvent(t,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function U8(e,t){return function(){return Cw(this,e,t)}}function P8(e,t){return function(){return Cw(this,e,t.apply(this,arguments))}}function H8(e,t){return this.each((typeof t=="function"?P8:U8)(e,t))}function*q8(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var a=e[t],o=0,i=a.length,u;o<i;++o)(u=a[o])&&(yield u)}var Aw=[null];function or(e,t){this._groups=e,this._parents=t}function Fl(){return new or([[document.documentElement]],Aw)}function F8(){return this}or.prototype=Fl.prototype={constructor:or,select:gM,selectAll:vM,selectChild:jM,selectChildren:CM,filter:AM,data:MM,enter:RM,exit:$M,join:BM,merge:IM,selection:F8,order:UM,sort:PM,call:qM,nodes:FM,node:GM,size:VM,empty:YM,each:KM,attr:t8,style:s8,property:c8,classed:p8,text:x8,html:_8,raise:S8,lower:k8,append:N8,insert:C8,remove:R8,clone:D8,datum:O8,on:I8,dispatch:H8,[Symbol.iterator]:q8};function wr(e){return typeof e=="string"?new or([[document.querySelector(e)]],[document.documentElement]):new or([[e]],Aw)}function G8(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ts(e,t){if(e=G8(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var a=r.createSVGPoint();return a.x=e.clientX,a.y=e.clientY,a=a.matrixTransform(t.getScreenCTM().inverse()),[a.x,a.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const nm={capture:!0,passive:!1};function rm(e){e.preventDefault(),e.stopImmediatePropagation()}function V8(e){var t=e.document.documentElement,r=wr(e).on("dragstart.drag",rm,nm);"onselectstart"in t?r.on("selectstart.drag",rm,nm):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Y8(e,t){var r=e.document.documentElement,a=wr(e).on("dragstart.drag",null);t&&(a.on("click.drag",rm,nm),setTimeout(function(){a.on("click.drag",null)},0)),"onselectstart"in r?a.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function Vm(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Rw(e,t){var r=Object.create(e.prototype);for(var a in t)r[a]=t[a];return r}function Gl(){}var Nl=.7,td=1/Nl,Io="\\s*([+-]?\\d+)\\s*",El="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",K8=/^#([0-9a-f]{3,8})$/,X8=new RegExp(`^rgb\\(${Io},${Io},${Io}\\)$`),Q8=new RegExp(`^rgb\\(${Zr},${Zr},${Zr}\\)$`),Z8=new RegExp(`^rgba\\(${Io},${Io},${Io},${El}\\)$`),J8=new RegExp(`^rgba\\(${Zr},${Zr},${Zr},${El}\\)$`),W8=new RegExp(`^hsl\\(${El},${Zr},${Zr}\\)$`),ez=new RegExp(`^hsla\\(${El},${Zr},${Zr},${El}\\)$`),y_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vm(Gl,Cl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:b_,formatHex:b_,formatHex8:tz,formatHsl:nz,formatRgb:v_,toString:v_});function b_(){return this.rgb().formatHex()}function tz(){return this.rgb().formatHex8()}function nz(){return Tw(this).formatHsl()}function v_(){return this.rgb().formatRgb()}function Cl(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=K8.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?__(t):r===3?new Vn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?vu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?vu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=X8.exec(e))?new Vn(t[1],t[2],t[3],1):(t=Q8.exec(e))?new Vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Z8.exec(e))?vu(t[1],t[2],t[3],t[4]):(t=J8.exec(e))?vu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=W8.exec(e))?j_(t[1],t[2]/100,t[3]/100,1):(t=ez.exec(e))?j_(t[1],t[2]/100,t[3]/100,t[4]):y_.hasOwnProperty(e)?__(y_[e]):e==="transparent"?new Vn(NaN,NaN,NaN,0):null}function __(e){return new Vn(e>>16&255,e>>8&255,e&255,1)}function vu(e,t,r,a){return a<=0&&(e=t=r=NaN),new Vn(e,t,r,a)}function rz(e){return e instanceof Gl||(e=Cl(e)),e?(e=e.rgb(),new Vn(e.r,e.g,e.b,e.opacity)):new Vn}function am(e,t,r,a){return arguments.length===1?rz(e):new Vn(e,t,r,a??1)}function Vn(e,t,r,a){this.r=+e,this.g=+t,this.b=+r,this.opacity=+a}Vm(Vn,am,Rw(Gl,{brighter(e){return e=e==null?td:Math.pow(td,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nl:Math.pow(Nl,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vn(Is(this.r),Is(this.g),Is(this.b),nd(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:w_,formatHex:w_,formatHex8:az,formatRgb:S_,toString:S_}));function w_(){return`#${zs(this.r)}${zs(this.g)}${zs(this.b)}`}function az(){return`#${zs(this.r)}${zs(this.g)}${zs(this.b)}${zs((isNaN(this.opacity)?1:this.opacity)*255)}`}function S_(){const e=nd(this.opacity);return`${e===1?"rgb(":"rgba("}${Is(this.r)}, ${Is(this.g)}, ${Is(this.b)}${e===1?")":`, ${e})`}`}function nd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Is(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zs(e){return e=Is(e),(e<16?"0":"")+e.toString(16)}function j_(e,t,r,a){return a<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Tr(e,t,r,a)}function Tw(e){if(e instanceof Tr)return new Tr(e.h,e.s,e.l,e.opacity);if(e instanceof Gl||(e=Cl(e)),!e)return new Tr;if(e instanceof Tr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,a=e.b/255,o=Math.min(t,r,a),i=Math.max(t,r,a),u=NaN,f=i-o,h=(i+o)/2;return f?(t===i?u=(r-a)/f+(r<a)*6:r===i?u=(a-t)/f+2:u=(t-r)/f+4,f/=h<.5?i+o:2-i-o,u*=60):f=h>0&&h<1?0:u,new Tr(u,f,h,e.opacity)}function sz(e,t,r,a){return arguments.length===1?Tw(e):new Tr(e,t,r,a??1)}function Tr(e,t,r,a){this.h=+e,this.s=+t,this.l=+r,this.opacity=+a}Vm(Tr,sz,Rw(Gl,{brighter(e){return e=e==null?td:Math.pow(td,e),new Tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nl:Math.pow(Nl,e),new Tr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,a=r+(r<.5?r:1-r)*t,o=2*r-a;return new Vn(ph(e>=240?e-240:e+120,o,a),ph(e,o,a),ph(e<120?e+240:e-120,o,a),this.opacity)},clamp(){return new Tr(k_(this.h),_u(this.s),_u(this.l),nd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=nd(this.opacity);return`${e===1?"hsl(":"hsla("}${k_(this.h)}, ${_u(this.s)*100}%, ${_u(this.l)*100}%${e===1?")":`, ${e})`}`}}));function k_(e){return e=(e||0)%360,e<0?e+360:e}function _u(e){return Math.max(0,Math.min(1,e||0))}function ph(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Lw=e=>()=>e;function oz(e,t){return function(r){return e+r*t}}function iz(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(a){return Math.pow(e+a*t,r)}}function lz(e){return(e=+e)==1?Dw:function(t,r){return r-t?iz(t,r,e):Lw(isNaN(t)?r:t)}}function Dw(e,t){var r=t-e;return r?oz(e,r):Lw(isNaN(e)?t:e)}const N_=(function e(t){var r=lz(t);function a(o,i){var u=r((o=am(o)).r,(i=am(i)).r),f=r(o.g,i.g),h=r(o.b,i.b),p=Dw(o.opacity,i.opacity);return function(m){return o.r=u(m),o.g=f(m),o.b=h(m),o.opacity=p(m),o+""}}return a.gamma=e,a})(1);function ss(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var sm=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hh=new RegExp(sm.source,"g");function cz(e){return function(){return e}}function uz(e){return function(t){return e(t)+""}}function dz(e,t){var r=sm.lastIndex=hh.lastIndex=0,a,o,i,u=-1,f=[],h=[];for(e=e+"",t=t+"";(a=sm.exec(e))&&(o=hh.exec(t));)(i=o.index)>r&&(i=t.slice(r,i),f[u]?f[u]+=i:f[++u]=i),(a=a[0])===(o=o[0])?f[u]?f[u]+=o:f[++u]=o:(f[++u]=null,h.push({i:u,x:ss(a,o)})),r=hh.lastIndex;return r<t.length&&(i=t.slice(r),f[u]?f[u]+=i:f[++u]=i),f.length<2?h[0]?uz(h[0].x):cz(t):(t=h.length,function(p){for(var m=0,x;m<t;++m)f[(x=h[m]).i]=x.x(p);return f.join("")})}var E_=180/Math.PI,om={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ow(e,t,r,a,o,i){var u,f,h;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(h=e*r+t*a)&&(r-=e*h,a-=t*h),(f=Math.sqrt(r*r+a*a))&&(r/=f,a/=f,h/=f),e*a<t*r&&(e=-e,t=-t,h=-h,u=-u),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*E_,skewX:Math.atan(h)*E_,scaleX:u,scaleY:f}}var wu;function fz(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?om:Ow(t.a,t.b,t.c,t.d,t.e,t.f)}function pz(e){return e==null||(wu||(wu=document.createElementNS("http://www.w3.org/2000/svg","g")),wu.setAttribute("transform",e),!(e=wu.transform.baseVal.consolidate()))?om:(e=e.matrix,Ow(e.a,e.b,e.c,e.d,e.e,e.f))}function Mw(e,t,r,a){function o(p){return p.length?p.pop()+" ":""}function i(p,m,x,v,_,w){if(p!==x||m!==v){var S=_.push("translate(",null,t,null,r);w.push({i:S-4,x:ss(p,x)},{i:S-2,x:ss(m,v)})}else(x||v)&&_.push("translate("+x+t+v+r)}function u(p,m,x,v){p!==m?(p-m>180?m+=360:m-p>180&&(p+=360),v.push({i:x.push(o(x)+"rotate(",null,a)-2,x:ss(p,m)})):m&&x.push(o(x)+"rotate("+m+a)}function f(p,m,x,v){p!==m?v.push({i:x.push(o(x)+"skewX(",null,a)-2,x:ss(p,m)}):m&&x.push(o(x)+"skewX("+m+a)}function h(p,m,x,v,_,w){if(p!==x||m!==v){var S=_.push(o(_)+"scale(",null,",",null,")");w.push({i:S-4,x:ss(p,x)},{i:S-2,x:ss(m,v)})}else(x!==1||v!==1)&&_.push(o(_)+"scale("+x+","+v+")")}return function(p,m){var x=[],v=[];return p=e(p),m=e(m),i(p.translateX,p.translateY,m.translateX,m.translateY,x,v),u(p.rotate,m.rotate,x,v),f(p.skewX,m.skewX,x,v),h(p.scaleX,p.scaleY,m.scaleX,m.scaleY,x,v),p=m=null,function(_){for(var w=-1,S=v.length,k;++w<S;)x[(k=v[w]).i]=k.x(_);return x.join("")}}}var hz=Mw(fz,"px, ","px)","deg)"),mz=Mw(pz,", ",")",")"),gz=1e-12;function C_(e){return((e=Math.exp(e))+1/e)/2}function xz(e){return((e=Math.exp(e))-1/e)/2}function yz(e){return((e=Math.exp(2*e))-1)/(e+1)}const bz=(function e(t,r,a){function o(i,u){var f=i[0],h=i[1],p=i[2],m=u[0],x=u[1],v=u[2],_=m-f,w=x-h,S=_*_+w*w,k,N;if(S<gz)N=Math.log(v/p)/t,k=function($){return[f+$*_,h+$*w,p*Math.exp(t*$*N)]};else{var A=Math.sqrt(S),E=(v*v-p*p+a*S)/(2*p*r*A),D=(v*v-p*p-a*S)/(2*v*r*A),L=Math.log(Math.sqrt(E*E+1)-E),z=Math.log(Math.sqrt(D*D+1)-D);N=(z-L)/t,k=function($){var R=$*N,B=C_(L),H=p/(r*A)*(B*yz(t*R+L)-xz(L));return[f+H*_,h+H*w,p*B/C_(t*R+L)]}}return k.duration=N*1e3*t/Math.SQRT2,k}return o.rho=function(i){var u=Math.max(.001,+i),f=u*u,h=f*f;return e(u,f,h)},o})(Math.SQRT2,2,4);var vz=yd("start","end","cancel","interrupt"),_z=[],zw=0,A_=1,im=2,Tu=3,R_=4,lm=5,Lu=6;function _d(e,t,r,a,o,i){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;wz(e,r,{name:t,index:a,group:o,on:vz,tween:_z,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:zw})}function Ym(e,t){var r=Mr(e,t);if(r.state>zw)throw new Error("too late; already scheduled");return r}function aa(e,t){var r=Mr(e,t);if(r.state>Tu)throw new Error("too late; already running");return r}function Mr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function wz(e,t,r){var a=e.__transition,o;a[t]=r,r.timer=qm(i,0,r.time);function i(p){r.state=A_,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var m,x,v,_;if(r.state!==A_)return h();for(m in a)if(_=a[m],_.name===r.name){if(_.state===Tu)return m_(u);_.state===R_?(_.state=Lu,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete a[m]):+m<t&&(_.state=Lu,_.timer.stop(),_.on.call("cancel",e,e.__data__,_.index,_.group),delete a[m])}if(m_(function(){r.state===Tu&&(r.state=R_,r.timer.restart(f,r.delay,r.time),f(p))}),r.state=im,r.on.call("start",e,e.__data__,r.index,r.group),r.state===im){for(r.state=Tu,o=new Array(v=r.tween.length),m=0,x=-1;m<v;++m)(_=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(o[++x]=_);o.length=x+1}}function f(p){for(var m=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(h),r.state=lm,1),x=-1,v=o.length;++x<v;)o[x].call(e,m);r.state===lm&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=Lu,r.timer.stop(),delete a[t];for(var p in a)return;delete e.__transition}}function Du(e,t){var r=e.__transition,a,o,i=!0,u;if(r){t=t==null?null:t+"";for(u in r){if((a=r[u]).name!==t){i=!1;continue}o=a.state>im&&a.state<lm,a.state=Lu,a.timer.stop(),a.on.call(o?"interrupt":"cancel",e,e.__data__,a.index,a.group),delete r[u]}i&&delete e.__transition}}function Sz(e){return this.each(function(){Du(this,e)})}function jz(e,t){var r,a;return function(){var o=aa(this,e),i=o.tween;if(i!==r){a=r=i;for(var u=0,f=a.length;u<f;++u)if(a[u].name===t){a=a.slice(),a.splice(u,1);break}}o.tween=a}}function kz(e,t,r){var a,o;if(typeof r!="function")throw new Error;return function(){var i=aa(this,e),u=i.tween;if(u!==a){o=(a=u).slice();for(var f={name:t,value:r},h=0,p=o.length;h<p;++h)if(o[h].name===t){o[h]=f;break}h===p&&o.push(f)}i.tween=o}}function Nz(e,t){var r=this._id;if(e+="",arguments.length<2){for(var a=Mr(this.node(),r).tween,o=0,i=a.length,u;o<i;++o)if((u=a[o]).name===e)return u.value;return null}return this.each((t==null?jz:kz)(r,e,t))}function Km(e,t,r){var a=e._id;return e.each(function(){var o=aa(this,a);(o.value||(o.value={}))[t]=r.apply(this,arguments)}),function(o){return Mr(o,a).value[t]}}function $w(e,t){var r;return(typeof t=="number"?ss:t instanceof Cl?N_:(r=Cl(t))?(t=r,N_):dz)(e,t)}function Ez(e){return function(){this.removeAttribute(e)}}function Cz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Az(e,t,r){var a,o=r+"",i;return function(){var u=this.getAttribute(e);return u===o?null:u===a?i:i=t(a=u,r)}}function Rz(e,t,r){var a,o=r+"",i;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===a?i:i=t(a=u,r)}}function Tz(e,t,r){var a,o,i;return function(){var u,f=r(this),h;return f==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=f+"",u===h?null:u===a&&h===o?i:(o=h,i=t(a=u,f)))}}function Lz(e,t,r){var a,o,i;return function(){var u,f=r(this),h;return f==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=f+"",u===h?null:u===a&&h===o?i:(o=h,i=t(a=u,f)))}}function Dz(e,t){var r=vd(e),a=r==="transform"?mz:$w;return this.attrTween(e,typeof t=="function"?(r.local?Lz:Tz)(r,a,Km(this,"attr."+e,t)):t==null?(r.local?Cz:Ez)(r):(r.local?Rz:Az)(r,a,t))}function Oz(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function Mz(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function zz(e,t){var r,a;function o(){var i=t.apply(this,arguments);return i!==a&&(r=(a=i)&&Mz(e,i)),r}return o._value=t,o}function $z(e,t){var r,a;function o(){var i=t.apply(this,arguments);return i!==a&&(r=(a=i)&&Oz(e,i)),r}return o._value=t,o}function Bz(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var a=vd(e);return this.tween(r,(a.local?zz:$z)(a,t))}function Iz(e,t){return function(){Ym(this,e).delay=+t.apply(this,arguments)}}function Uz(e,t){return t=+t,function(){Ym(this,e).delay=t}}function Pz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Iz:Uz)(t,e)):Mr(this.node(),t).delay}function Hz(e,t){return function(){aa(this,e).duration=+t.apply(this,arguments)}}function qz(e,t){return t=+t,function(){aa(this,e).duration=t}}function Fz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hz:qz)(t,e)):Mr(this.node(),t).duration}function Gz(e,t){if(typeof t!="function")throw new Error;return function(){aa(this,e).ease=t}}function Vz(e){var t=this._id;return arguments.length?this.each(Gz(t,e)):Mr(this.node(),t).ease}function Yz(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;aa(this,e).ease=r}}function Kz(e){if(typeof e!="function")throw new Error;return this.each(Yz(this._id,e))}function Xz(e){typeof e!="function"&&(e=vw(e));for(var t=this._groups,r=t.length,a=new Array(r),o=0;o<r;++o)for(var i=t[o],u=i.length,f=a[o]=[],h,p=0;p<u;++p)(h=i[p])&&e.call(h,h.__data__,p,i)&&f.push(h);return new La(a,this._parents,this._name,this._id)}function Qz(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,a=t.length,o=r.length,i=Math.min(a,o),u=new Array(a),f=0;f<i;++f)for(var h=t[f],p=r[f],m=h.length,x=u[f]=new Array(m),v,_=0;_<m;++_)(v=h[_]||p[_])&&(x[_]=v);for(;f<a;++f)u[f]=t[f];return new La(u,this._parents,this._name,this._id)}function Zz(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function Jz(e,t,r){var a,o,i=Zz(t)?Ym:aa;return function(){var u=i(this,e),f=u.on;f!==a&&(o=(a=f).copy()).on(t,r),u.on=o}}function Wz(e,t){var r=this._id;return arguments.length<2?Mr(this.node(),r).on.on(e):this.each(Jz(r,e,t))}function e$(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function t$(){return this.on("end.remove",e$(this._id))}function n$(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Fm(e));for(var a=this._groups,o=a.length,i=new Array(o),u=0;u<o;++u)for(var f=a[u],h=f.length,p=i[u]=new Array(h),m,x,v=0;v<h;++v)(m=f[v])&&(x=e.call(m,m.__data__,v,f))&&("__data__"in m&&(x.__data__=m.__data__),p[v]=x,_d(p[v],t,r,v,p,Mr(m,r)));return new La(i,this._parents,t,r)}function r$(e){var t=this._name,r=this._id;typeof e!="function"&&(e=bw(e));for(var a=this._groups,o=a.length,i=[],u=[],f=0;f<o;++f)for(var h=a[f],p=h.length,m,x=0;x<p;++x)if(m=h[x]){for(var v=e.call(m,m.__data__,x,h),_,w=Mr(m,r),S=0,k=v.length;S<k;++S)(_=v[S])&&_d(_,t,r,S,v,w);i.push(v),u.push(m)}return new La(i,u,t,r)}var a$=Fl.prototype.constructor;function s$(){return new a$(this._groups,this._parents)}function o$(e,t){var r,a,o;return function(){var i=Fo(this,e),u=(this.style.removeProperty(e),Fo(this,e));return i===u?null:i===r&&u===a?o:o=t(r=i,a=u)}}function Bw(e){return function(){this.style.removeProperty(e)}}function i$(e,t,r){var a,o=r+"",i;return function(){var u=Fo(this,e);return u===o?null:u===a?i:i=t(a=u,r)}}function l$(e,t,r){var a,o,i;return function(){var u=Fo(this,e),f=r(this),h=f+"";return f==null&&(h=f=(this.style.removeProperty(e),Fo(this,e))),u===h?null:u===a&&h===o?i:(o=h,i=t(a=u,f))}}function c$(e,t){var r,a,o,i="style."+t,u="end."+i,f;return function(){var h=aa(this,e),p=h.on,m=h.value[i]==null?f||(f=Bw(t)):void 0;(p!==r||o!==m)&&(a=(r=p).copy()).on(u,o=m),h.on=a}}function u$(e,t,r){var a=(e+="")=="transform"?hz:$w;return t==null?this.styleTween(e,o$(e,a)).on("end.style."+e,Bw(e)):typeof t=="function"?this.styleTween(e,l$(e,a,Km(this,"style."+e,t))).each(c$(this._id,e)):this.styleTween(e,i$(e,a,t),r).on("end.style."+e,null)}function d$(e,t,r){return function(a){this.style.setProperty(e,t.call(this,a),r)}}function f$(e,t,r){var a,o;function i(){var u=t.apply(this,arguments);return u!==o&&(a=(o=u)&&d$(e,u,r)),a}return i._value=t,i}function p$(e,t,r){var a="style."+(e+="");if(arguments.length<2)return(a=this.tween(a))&&a._value;if(t==null)return this.tween(a,null);if(typeof t!="function")throw new Error;return this.tween(a,f$(e,t,r??""))}function h$(e){return function(){this.textContent=e}}function m$(e){return function(){var t=e(this);this.textContent=t??""}}function g$(e){return this.tween("text",typeof e=="function"?m$(Km(this,"text",e)):h$(e==null?"":e+""))}function x$(e){return function(t){this.textContent=e.call(this,t)}}function y$(e){var t,r;function a(){var o=e.apply(this,arguments);return o!==r&&(t=(r=o)&&x$(o)),t}return a._value=e,a}function b$(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,y$(e))}function v$(){for(var e=this._name,t=this._id,r=Iw(),a=this._groups,o=a.length,i=0;i<o;++i)for(var u=a[i],f=u.length,h,p=0;p<f;++p)if(h=u[p]){var m=Mr(h,t);_d(h,e,r,p,u,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new La(a,this._parents,e,r)}function _$(){var e,t,r=this,a=r._id,o=r.size();return new Promise(function(i,u){var f={value:u},h={value:function(){--o===0&&i()}};r.each(function(){var p=aa(this,a),m=p.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(f),t._.interrupt.push(f),t._.end.push(h)),p.on=t}),o===0&&i()})}var w$=0;function La(e,t,r,a){this._groups=e,this._parents=t,this._name=r,this._id=a}function Iw(){return++w$}var Na=Fl.prototype;La.prototype={constructor:La,select:n$,selectAll:r$,selectChild:Na.selectChild,selectChildren:Na.selectChildren,filter:Xz,merge:Qz,selection:s$,transition:v$,call:Na.call,nodes:Na.nodes,node:Na.node,size:Na.size,empty:Na.empty,each:Na.each,on:Wz,attr:Dz,attrTween:Bz,style:u$,styleTween:p$,text:g$,textTween:b$,remove:t$,tween:Nz,delay:Pz,duration:Fz,ease:Vz,easeVarying:Kz,end:_$,[Symbol.iterator]:Na[Symbol.iterator]};function S$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var j$={time:null,delay:0,duration:250,ease:S$};function k$(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function N$(e){var t,r;e instanceof La?(t=e._id,e=e._name):(t=Iw(),(r=j$).time=Hm(),e=e==null?null:e+"");for(var a=this._groups,o=a.length,i=0;i<o;++i)for(var u=a[i],f=u.length,h,p=0;p<f;++p)(h=u[p])&&_d(h,e,t,p,u,r||k$(h,t));return new La(a,this._parents,e,t)}Fl.prototype.interrupt=Sz;Fl.prototype.transition=N$;const Su=e=>()=>e;function E$(e,{sourceEvent:t,target:r,transform:a,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:a,enumerable:!0,configurable:!0},_:{value:o}})}function Ra(e,t,r){this.k=e,this.x=t,this.y=r}Ra.prototype={constructor:Ra,scale:function(e){return e===1?this:new Ra(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ra(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xm=new Ra(1,0,0);Ra.prototype;function mh(e){e.stopImmediatePropagation()}function el(e){e.preventDefault(),e.stopImmediatePropagation()}function C$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function A$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function T_(){return this.__zoom||Xm}function R$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function T$(){return navigator.maxTouchPoints||"ontouchstart"in this}function L$(e,t,r){var a=e.invertX(t[0][0])-r[0][0],o=e.invertX(t[1][0])-r[1][0],i=e.invertY(t[0][1])-r[0][1],u=e.invertY(t[1][1])-r[1][1];return e.translate(o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o),u>i?(i+u)/2:Math.min(0,i)||Math.max(0,u))}function D$(){var e=C$,t=A$,r=L$,a=R$,o=T$,i=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],f=250,h=bz,p=yd("start","zoom","end"),m,x,v,_=500,w=150,S=0,k=10;function N(M){M.property("__zoom",T_).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",H).filter(o).on("touchstart.zoom",J).on("touchmove.zoom",oe).on("touchend.zoom touchcancel.zoom",ce).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(M,P,T,F){var ee=M.selection?M.selection():M;ee.property("__zoom",T_),M!==ee?L(M,P,T,F):ee.interrupt().each(function(){z(this,arguments).event(F).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},N.scaleBy=function(M,P,T,F){N.scaleTo(M,function(){var ee=this.__zoom.k,ae=typeof P=="function"?P.apply(this,arguments):P;return ee*ae},T,F)},N.scaleTo=function(M,P,T,F){N.transform(M,function(){var ee=t.apply(this,arguments),ae=this.__zoom,W=T==null?D(ee):typeof T=="function"?T.apply(this,arguments):T,O=ae.invert(W),V=typeof P=="function"?P.apply(this,arguments):P;return r(E(A(ae,V),W,O),ee,u)},T,F)},N.translateBy=function(M,P,T,F){N.transform(M,function(){return r(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),u)},null,F)},N.translateTo=function(M,P,T,F,ee){N.transform(M,function(){var ae=t.apply(this,arguments),W=this.__zoom,O=F==null?D(ae):typeof F=="function"?F.apply(this,arguments):F;return r(Xm.translate(O[0],O[1]).scale(W.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof T=="function"?-T.apply(this,arguments):-T),ae,u)},F,ee)};function A(M,P){return P=Math.max(i[0],Math.min(i[1],P)),P===M.k?M:new Ra(P,M.x,M.y)}function E(M,P,T){var F=P[0]-T[0]*M.k,ee=P[1]-T[1]*M.k;return F===M.x&&ee===M.y?M:new Ra(M.k,F,ee)}function D(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function L(M,P,T,F){M.on("start.zoom",function(){z(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){z(this,arguments).event(F).end()}).tween("zoom",function(){var ee=this,ae=arguments,W=z(ee,ae).event(F),O=t.apply(ee,ae),V=T==null?D(O):typeof T=="function"?T.apply(ee,ae):T,re=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),se=ee.__zoom,ne=typeof P=="function"?P.apply(ee,ae):P,ge=h(se.invert(V).concat(re/se.k),ne.invert(V).concat(re/ne.k));return function(Ne){if(Ne===1)Ne=ne;else{var Fe=ge(Ne),qe=re/Fe[2];Ne=new Ra(qe,V[0]-Fe[0]*qe,V[1]-Fe[1]*qe)}W.zoom(null,Ne)}})}function z(M,P,T){return!T&&M.__zooming||new $(M,P)}function $(M,P){this.that=M,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,P),this.taps=0}$.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,P){return this.mouse&&M!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var P=wr(this.that).datum();p.call(M,this.that,new E$(M,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:p}),P)}};function R(M,...P){if(!e.apply(this,arguments))return;var T=z(this,P).event(M),F=this.__zoom,ee=Math.max(i[0],Math.min(i[1],F.k*Math.pow(2,a.apply(this,arguments)))),ae=Ts(M);if(T.wheel)(T.mouse[0][0]!==ae[0]||T.mouse[0][1]!==ae[1])&&(T.mouse[1]=F.invert(T.mouse[0]=ae)),clearTimeout(T.wheel);else{if(F.k===ee)return;T.mouse=[ae,F.invert(ae)],Du(this),T.start()}el(M),T.wheel=setTimeout(W,w),T.zoom("mouse",r(E(A(F,ee),T.mouse[0],T.mouse[1]),T.extent,u));function W(){T.wheel=null,T.end()}}function B(M,...P){if(v||!e.apply(this,arguments))return;var T=M.currentTarget,F=z(this,P,!0).event(M),ee=wr(M.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",re,!0),ae=Ts(M,T),W=M.clientX,O=M.clientY;V8(M.view),mh(M),F.mouse=[ae,this.__zoom.invert(ae)],Du(this),F.start();function V(se){if(el(se),!F.moved){var ne=se.clientX-W,ge=se.clientY-O;F.moved=ne*ne+ge*ge>S}F.event(se).zoom("mouse",r(E(F.that.__zoom,F.mouse[0]=Ts(se,T),F.mouse[1]),F.extent,u))}function re(se){ee.on("mousemove.zoom mouseup.zoom",null),Y8(se.view,F.moved),el(se),F.event(se).end()}}function H(M,...P){if(e.apply(this,arguments)){var T=this.__zoom,F=Ts(M.changedTouches?M.changedTouches[0]:M,this),ee=T.invert(F),ae=T.k*(M.shiftKey?.5:2),W=r(E(A(T,ae),F,ee),t.apply(this,P),u);el(M),f>0?wr(this).transition().duration(f).call(L,W,F,M):wr(this).call(N.transform,W,F,M)}}function J(M,...P){if(e.apply(this,arguments)){var T=M.touches,F=T.length,ee=z(this,P,M.changedTouches.length===F).event(M),ae,W,O,V;for(mh(M),W=0;W<F;++W)O=T[W],V=Ts(O,this),V=[V,this.__zoom.invert(V),O.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==V[2]&&(ee.touch1=V,ee.taps=0):(ee.touch0=V,ae=!0,ee.taps=1+!!m);m&&(m=clearTimeout(m)),ae&&(ee.taps<2&&(x=V[0],m=setTimeout(function(){m=null},_)),Du(this),ee.start())}}function oe(M,...P){if(this.__zooming){var T=z(this,P).event(M),F=M.changedTouches,ee=F.length,ae,W,O,V;for(el(M),ae=0;ae<ee;++ae)W=F[ae],O=Ts(W,this),T.touch0&&T.touch0[2]===W.identifier?T.touch0[0]=O:T.touch1&&T.touch1[2]===W.identifier&&(T.touch1[0]=O);if(W=T.that.__zoom,T.touch1){var re=T.touch0[0],se=T.touch0[1],ne=T.touch1[0],ge=T.touch1[1],Ne=(Ne=ne[0]-re[0])*Ne+(Ne=ne[1]-re[1])*Ne,Fe=(Fe=ge[0]-se[0])*Fe+(Fe=ge[1]-se[1])*Fe;W=A(W,Math.sqrt(Ne/Fe)),O=[(re[0]+ne[0])/2,(re[1]+ne[1])/2],V=[(se[0]+ge[0])/2,(se[1]+ge[1])/2]}else if(T.touch0)O=T.touch0[0],V=T.touch0[1];else return;T.zoom("touch",r(E(W,O,V),T.extent,u))}}function ce(M,...P){if(this.__zooming){var T=z(this,P).event(M),F=M.changedTouches,ee=F.length,ae,W;for(mh(M),v&&clearTimeout(v),v=setTimeout(function(){v=null},_),ae=0;ae<ee;++ae)W=F[ae],T.touch0&&T.touch0[2]===W.identifier?delete T.touch0:T.touch1&&T.touch1[2]===W.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(W=Ts(W,this),Math.hypot(x[0]-W[0],x[1]-W[1])<k)){var O=wr(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return N.wheelDelta=function(M){return arguments.length?(a=typeof M=="function"?M:Su(+M),N):a},N.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Su(!!M),N):e},N.touchable=function(M){return arguments.length?(o=typeof M=="function"?M:Su(!!M),N):o},N.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Su([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),N):t},N.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],N):[i[0],i[1]]},N.translateExtent=function(M){return arguments.length?(u[0][0]=+M[0][0],u[1][0]=+M[1][0],u[0][1]=+M[0][1],u[1][1]=+M[1][1],N):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},N.constrain=function(M){return arguments.length?(r=M,N):r},N.duration=function(M){return arguments.length?(f=+M,N):f},N.interpolate=function(M){return arguments.length?(h=M,N):h},N.on=function(){var M=p.on.apply(p,arguments);return M===p?N:M},N.clickDistance=function(M){return arguments.length?(S=(M=+M)*M,N):Math.sqrt(S)},N.tapDistance=function(M){return arguments.length?(k=+M,N):k},N}const O$=new Set(["CONTAINS","IMPLEMENTS","CORRESPONDS"]),M$=new Set(["REFERENCES","MENTIONS"]);function z$(e){return O$.has(e)?"skeleton":M$.has(e)?"weak":"standard"}const $$=30,ju=800,tl=500;function B$({centerNode:e,neighbors:t}){const[r,a]=b.useState(t.length>$$?"table":"graph");return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-end gap-1 mb-3",children:[c.jsx("button",{onClick:()=>a("graph"),className:`p-1.5 rounded transition-colors ${r==="graph"?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,title:"力导向图",children:c.jsx(AC,{size:16})}),c.jsx("button",{onClick:()=>a("table"),className:`p-1.5 rounded transition-colors ${r==="table"?"bg-c4a-bg-hover text-c4a-text-primary":"text-c4a-text-muted hover:text-c4a-text-secondary"}`,title:"表格模式",children:c.jsx(OC,{size:16})})]}),r==="graph"?c.jsx(I$,{centerNode:e,neighbors:t}):c.jsx(U$,{neighbors:t})]})}function I$({centerNode:e,neighbors:t}){const r=b.useRef(null),a=Tt(),{t:o}=ye(),i=b.useCallback(f=>a(sr.entity(f)),[a]),u=b.useCallback(f=>a(sr.relation(f)),[a]);return b.useEffect(()=>{const f=r.current;if(!f)return;const h=wr(f);h.selectAll("*").remove();const p=new Map;p.set(e.id,{id:e.id,name:e.name,type:e.type,kind:e.kind,isCenter:!0,x:ju/2,y:tl/2});for(const E of t)p.has(E.neighbor.id)||p.set(E.neighbor.id,{id:E.neighbor.id,name:E.neighbor.name,type:E.neighbor.type,kind:E.neighbor.kind,isCenter:!1});const m=Array.from(p.values()),x=t.map(E=>{const D={id:E.id,type:E.type,edgeClass:z$(E.type),source:E.direction==="outgoing"?e.id:E.neighbor.id,target:E.direction==="outgoing"?E.neighbor.id:e.id};return E.confidence!==void 0&&(D.confidence=E.confidence),D});h.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 6").attr("refX",28).attr("refY",3).attr("markerWidth",10).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M0,0L10,3L0,6").attr("fill","var(--c4a-border-subtle)");const _=h.append("g"),w=D$().scaleExtent([.3,3]).on("zoom",E=>{_.attr("transform",E.transform)});h.call(w).call(w.transform,Xm);const S=_.selectAll("line.link").data(x).join("line").attr("class","link").attr("stroke",E=>E.edgeClass==="skeleton"?"var(--c4a-text-secondary)":"var(--c4a-border-subtle)").attr("stroke-width",E=>E.edgeClass==="skeleton"?2:1).attr("stroke-dasharray",E=>E.edgeClass==="weak"?"4 3":null).attr("opacity",E=>E.edgeClass==="weak"?.6:1).attr("marker-end","url(#arrow)").style("cursor","pointer").on("click",(E,D)=>u(D.id)).on("mouseenter",function(){wr(this).attr("stroke","var(--c4a-accent)").attr("stroke-width",function(){return Number(wr(this).attr("stroke-width"))+1})}).on("mouseleave",function(E,D){wr(this).attr("stroke",D.edgeClass==="skeleton"?"var(--c4a-text-secondary)":"var(--c4a-border-subtle)").attr("stroke-width",D.edgeClass==="skeleton"?2:1)});S.append("title").text(E=>{const D=Yo(E.confidence);return D?`${E.type} · ${o(D.labelKey)}`:E.type});const k=_.selectAll("text.link-label").data(x).join("text").attr("class","link-label").text(E=>E.type).attr("font-family","var(--font-mono)").attr("font-size",9).attr("fill","var(--c4a-text-muted)").attr("text-anchor","middle").attr("dy",-4),N=_.selectAll("g.node").data(m,E=>E.id).join("g").attr("class","node").style("cursor","pointer").on("click",(E,D)=>i(D.id));N.append("circle").attr("r",E=>E.isCenter?24:18).attr("fill",E=>E.isCenter?"var(--c4a-accent)":"var(--c4a-bg-elevated)").attr("stroke",E=>E.isCenter?"#fff":"var(--c4a-border-default)").attr("stroke-width",E=>E.isCenter?2:1),N.append("text").text(E=>E.name.length>12?E.name.slice(0,12)+"…":E.name).attr("font-family","var(--font-mono)").attr("font-size",10).attr("fill","var(--c4a-text-primary)").attr("text-anchor","middle").attr("dy",E=>E.isCenter?36:30),N.append("title").text(E=>{let D=`${E.name}
97
+ type: ${E.type}`;return E.kind&&(D+=`
98
+ kind: ${E.kind}`),D});const A=dM(m).force("link",QO(x).id(E=>E.id).distance(120)).force("charge",fM().strength(-300)).force("center",AO(ju/2,tl/2)).force("collide",KO(30)).on("tick",()=>{S.attr("x1",E=>E.source.x??0).attr("y1",E=>E.source.y??0).attr("x2",E=>E.target.x??0).attr("y2",E=>E.target.y??0),k.attr("x",E=>{const D=E.source.x??0,L=E.target.x??0;return(D+L)/2}).attr("y",E=>{const D=E.source.y??0,L=E.target.y??0;return(D+L)/2}),N.attr("transform",E=>`translate(${E.x??0},${E.y??0})`)});return N.each(function(E,D){const L=wr(this);let z=!1;L.on("mousedown.drag",$=>{$.stopPropagation(),z=!0;const R=m[D],B=f.getBoundingClientRect(),H=oe=>{if(!z)return;const ce=_.attr("transform");let M=0,P=0,T=1;if(ce){const ae=ce.match(/translate\(([-\d.e+]+)[, ]([-\d.e+]+)\)\s*scale\(([-\d.e+]+)\)/);ae&&(M=parseFloat(ae[1]),P=parseFloat(ae[2]),T=parseFloat(ae[3]))}const F=(oe.clientX-B.left)/B.width*ju,ee=(oe.clientY-B.top)/B.height*tl;R.fx=(F-M)/T,R.fy=(ee-P)/T,A.alpha(.3).restart()},J=()=>{z=!1,R.fx=null,R.fy=null,document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",J)};document.addEventListener("mousemove",H),document.addEventListener("mouseup",J)})}),()=>{A.stop()}},[e,t,i,u]),c.jsx("svg",{ref:r,width:"100%",height:tl,viewBox:`0 0 ${ju} ${tl}`,className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface"})}function U$({neighbors:e}){const t=Tt();return c.jsx("div",{className:"rounded border border-c4a-border-subtle overflow-auto",children:c.jsxs("table",{className:"w-full text-xs font-mono",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-c4a-border-subtle bg-c4a-bg-surface text-c4a-text-muted text-left",children:[c.jsx("th",{className:"px-3 py-2",children:"NAME"}),c.jsx("th",{className:"px-3 py-2",children:"TYPE"}),c.jsx("th",{className:"px-3 py-2",children:"KIND"}),c.jsx("th",{className:"px-3 py-2",children:"EDGE"}),c.jsx("th",{className:"px-3 py-2",children:"DIRECTION"})]})}),c.jsx("tbody",{children:e.map(r=>c.jsxs("tr",{className:"border-b border-c4a-border-subtle hover:bg-c4a-bg-hover cursor-pointer transition-colors",onClick:()=>t(sr.entity(r.neighbor.id)),children:[c.jsx("td",{className:"px-3 py-2 text-c4a-accent",children:r.neighbor.name}),c.jsx("td",{className:"px-3 py-2 text-c4a-text-secondary",children:r.neighbor.type}),c.jsx("td",{className:"px-3 py-2 text-c4a-text-muted",children:r.neighbor.kind??"—"}),c.jsx("td",{className:"px-3 py-2",children:c.jsx(Bt,{variant:"accent",children:r.type})}),c.jsx("td",{className:"px-3 py-2 text-c4a-text-muted",children:r.direction==="outgoing"?"→":"←"})]},r.id))})]})})}function P$({entityId:e,centerNode:t}){const{t:r}=ye(),[a,o]=b.useState([]),[i,u]=b.useState(!1);return b.useEffect(()=>{ze.get(`/entities/${e}/neighbors`).then(f=>{const h=[];for(const p of f.neighbors)for(const m of p.via)h.push({id:m.relation_id,type:m.type,direction:m.direction,neighbor:{id:p.id,name:p.name,type:p.type,...p.kind?{kind:p.kind}:{}},...m.weight!==void 0?{weight:m.weight}:{},...m.confidence!==void 0?{confidence:m.confidence}:{}});o(h),u(!0)}).catch(()=>u(!0))},[e]),i?a.length===0?c.jsx(wt,{title:r("common.empty.entity_neighbors.title"),description:r("common.empty.entity_neighbors.description")}):c.jsx(B$,{centerNode:t,neighbors:a}):c.jsx("p",{className:"text-sm text-c4a-text-muted",children:r("common.loading")})}const H$={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function q$({entityId:e}){const{t}=ye(),[r,a]=b.useState(null),[o,i]=b.useState(null),[u,f]=b.useState("overview");if(b.useEffect(()=>{e&&(i(null),a(null),f("overview"),ze.get(`/entities/${e}`).then(a).catch(S=>{S instanceof hn&&S.status===404?i("not_found"):i("load_failed")}))},[e]),o)return c.jsx(wt,{title:t(`common.error.${o}`),description:t(`common.error.${o}_description`)});if(!r)return c.jsx("div",{className:"flex items-center justify-center p-8",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})});const h=H$[r.type]??"🔹",p=r._links,m=p?.relations?.count,x=p?.contents?.count,v=p?.referrers?.count,{atoms:_,...w}=r.data;return c.jsxs("div",{className:"flex flex-1 flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xl",children:h}),c.jsx("h2",{className:"font-mono text-xl font-bold text-c4a-text-primary",children:r.name})]}),c.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[c.jsx(Bt,{children:r.type}),r.kind&&c.jsx(Bt,{variant:"muted",children:r.kind})]}),(r.perspective||r.scope)&&c.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-4 text-xs text-c4a-text-muted",children:[r.perspective&&c.jsxs("span",{children:[t("entity.detail.perspective"),":"," ",c.jsx("span",{className:"text-c4a-text-secondary",children:r.perspective})]}),r.scope&&c.jsxs("span",{children:[t("entity.detail.scope"),":"," ",c.jsx("span",{className:"text-c4a-text-secondary",children:r.scope})]})]}),c.jsxs(o4,{value:u,onChange:S=>f(S),children:[c.jsx("div",{className:"mt-3",children:c.jsxs(i4,{children:[c.jsx(Vr,{value:"overview",children:t("entity.detail.tab.overview")}),c.jsxs(Vr,{value:"relations",children:[t("entity.detail.tab.relations"),m!==void 0&&` (${m})`]}),c.jsxs(Vr,{value:"contents",children:[t("entity.detail.tab.contents"),x!==void 0&&` (${x})`]}),c.jsxs(Vr,{value:"referrers",children:[t("entity.detail.tab.referrers"),v!==void 0&&` (${v})`]}),c.jsx(Vr,{value:"neighbors",children:t("entity.detail.tab.neighbors")})]})}),c.jsxs("div",{className:"mt-4 flex-1",children:[c.jsx(Yr,{value:"overview",children:c.jsx(uO,{data:w,atoms:_})}),c.jsx(Yr,{value:"relations",children:c.jsx(kO,{entityId:r.id})}),c.jsx(Yr,{value:"contents",children:c.jsx(EO,{entityId:r.id})}),c.jsx(Yr,{value:"referrers",children:c.jsx(CO,{entityId:r.id})}),c.jsx(Yr,{value:"neighbors",children:c.jsx(P$,{entityId:r.id,centerNode:{id:r.id,name:r.name,type:r.type,...r.kind?{kind:r.kind}:{}}})})]})]})]})}const Uw={Component:"🏗",SoR:"📋",Product:"📦",Container:"📂",Contract:"📝",Epic:"🎯"};function F$(e){try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return e}}function G$({relationId:e}){const{t}=ye(),r=Tt(),a=Ko(),[o,i]=b.useState(null),[u,f]=b.useState(null),[h,p]=b.useState([]),[m,x]=b.useState(!1);b.useEffect(()=>{e&&(f(null),i(null),p([]),x(!1),ze.get(`/relations/${e}`).then(S=>{i(S),ze.get(`/relations/${e}/contents`).then(k=>{p(k.contents??[]),x(!0)}).catch(()=>x(!0))}).catch(S=>{S instanceof hn&&S.status===404?f("not_found"):f("load_failed")}))},[e]);const v=S=>{const k=Uw[S.type]??"🔹";a?.active?a.navigate("entity",S.id,S.name,k):r(sr.entity(S.id))};if(u)return c.jsx(wt,{title:t(`common.error.${u}`),description:t(`common.error.${u}_description`)});if(!o)return c.jsx("div",{className:"flex items-center justify-center p-8",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:t("common.loading")})});const _=Yo(o.confidence),w=o.metadata?._source==="field_sync"?t("relation.detail.source_field_sync"):t("relation.detail.source_explicit");return c.jsxs("div",{className:"flex flex-1 flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h2",{className:"font-mono text-xl font-bold text-c4a-text-primary",children:o.type}),_&&c.jsx(Bt,{variant:_.variant,tooltip:`${_.value.toFixed(2)} — ${t(_.tipKey)}`,children:t(_.labelKey)})]}),c.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[c.jsx(L_,{label:t("relation.detail.from"),entity:o.from,onClick:()=>v(o.from)}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-c4a-text-muted text-lg",children:"→"}),c.jsx(Bt,{variant:"accent",children:o.type}),c.jsx("span",{className:"text-c4a-text-muted text-lg",children:"→"})]}),c.jsx(L_,{label:t("relation.detail.to"),entity:o.to,onClick:()=>v(o.to)})]}),!!o.data.description&&c.jsxs("div",{className:"mt-4",children:[c.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.description")}),c.jsx("p",{className:"text-sm text-c4a-text-secondary",children:String(o.data.description)})]}),Object.keys(o.data).filter(S=>S!=="description").length>0&&c.jsxs("div",{className:"mt-4",children:[c.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.data")}),c.jsx("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3",children:c.jsx(Hl,{data:Object.fromEntries(Object.entries(o.data).filter(([S])=>S!=="description")),defaultExpanded:2})})]}),m&&h.length>0&&c.jsxs("div",{className:"mt-4",children:[c.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.source_refs")}),c.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:h.map(S=>c.jsx(hw,{content:{hash_id:S.hash_id,...S.source_path?{source_path:S.source_path}:{},...S.span?{span:S.span}:{}}},S.hash_id))})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("h3",{className:"font-mono text-xs uppercase text-c4a-text-muted mb-1.5",children:t("relation.detail.meta")}),c.jsxs("div",{className:"flex flex-wrap gap-4 text-xs",children:[c.jsxs("span",{className:"text-c4a-text-muted",children:[t("relation.detail.source_label"),":",c.jsx("span",{className:"text-c4a-text-secondary ml-1",children:w})]}),o.metadata?.created_at&&c.jsxs("span",{className:"text-c4a-text-muted",children:[t("content.detail.created_at"),":",c.jsx("span",{className:"text-c4a-text-secondary ml-1",children:F$(String(o.metadata.created_at))})]})]})]})]})}function L_({label:e,entity:t,onClick:r}){const a=Uw[t.type]??"🔹";return c.jsxs("div",{className:"rounded border border-c4a-border-subtle bg-c4a-bg-surface p-3 cursor-pointer hover:border-c4a-accent transition-colors min-w-[160px]",onClick:r,children:[c.jsx("p",{className:"text-[10px] font-mono uppercase text-c4a-text-muted mb-1",children:e}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{children:a}),c.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate",children:t.name})]}),c.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[c.jsx(Bt,{children:t.type}),t.kind&&c.jsx(Bt,{variant:"muted",children:t.kind})]})]})}const V$=[1,2,3];function Y$({functionName:e,sourceIds:t}){const{t:r}=ye(),[a,o]=b.useState("callers"),[i,u]=b.useState(1),{data:f,loading:h,error:p,warnings:m}=Mn(S=>S.callGraph),x=Mn(S=>S.fetchCallGraph),v=Mn(S=>S.resetQuery);b.useEffect(()=>{if(t?.length)return x({sourceIds:t,functionName:e,direction:a,maxDepth:i}),()=>v("callGraph")},[e,a,i,t?.join(",")]);const _=b.useCallback(S=>{o(S)},[]),w=f??[];return c.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("h3",{className:"font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary",children:[r("query.call_graph.title"),": ",e.includes("#")?e.slice(e.indexOf("#")+1):e]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"flex gap-1",children:[c.jsx(gh,{label:r("query.call_graph.callers"),active:a==="callers",onClick:()=>_("callers")}),c.jsx(gh,{label:r("query.call_graph.callees"),active:a==="callees",onClick:()=>_("callees")})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-tight text-c4a-text-muted",children:[r("query.call_graph.depth"),":"]}),V$.map(S=>c.jsx(gh,{label:String(S),active:i===S,onClick:()=>u(S)},S))]})]})]}),m.length>0&&c.jsx(xd,{warnings:m}),h?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ta,{labelKey:"query.symbol.loading"})}):p?c.jsx(wt,{title:r("query.call_graph.empty"),description:p}):w.length===0?c.jsx(wt,{title:r("query.call_graph.empty"),description:r("query.call_graph.empty_desc",{direction:r(`query.call_graph.${a}`)})}):c.jsx("div",{className:"overflow-y-auto c4a-scrollbar",children:w.map((S,k)=>c.jsx(K$,{entry:S,direction:a},`${S.caller}-${S.callee}-${k}`))})]})}function gh({label:e,active:t,onClick:r}){return c.jsx("button",{type:"button",className:`rounded px-2.5 py-1 font-mono text-[11px] uppercase tracking-tight cursor-pointer ${t?"bg-c4a-accent text-white":"bg-c4a-bg-surface text-c4a-text-muted hover:bg-c4a-bg-hover"}`,onClick:r,children:e})}function K$({entry:e,direction:t}){const r=t==="callers"?e.caller:e.callee,a=(e.depth-1)*16,o=r.indexOf("#"),i=o>=0?r.slice(o+1):r,u=o>=0?r.slice(0,o):null;return c.jsxs("div",{className:"flex items-center gap-2 px-3 h-8 border-b border-c4a-border-subtle last:border-b-0 hover:bg-c4a-bg-hover/50",style:{paddingLeft:a+12},children:[c.jsx("span",{className:"shrink-0 w-4 text-center font-mono text-xs text-c4a-text-muted",children:"ƒ"}),c.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate",children:i}),u&&c.jsxs("span",{className:"font-mono text-xs text-c4a-text-muted truncate",children:[u,e.line!=null?`:${e.line}`:""]}),e.isExternal&&c.jsx("span",{className:"font-mono text-[10px] uppercase text-c4a-text-muted bg-c4a-bg-active px-1 py-0.5 rounded-sm shrink-0",children:"ext"})]})}function X$({filePath:e,sourceIds:t}){const{t:r}=ye(),[a,o]=b.useState("forward"),{data:i,loading:u,error:f,warnings:h}=Mn(N=>N.imports),p=Mn(N=>N.fetchImports),m=Mn(N=>N.resetQuery),x=Aa(N=>N.openTab);b.useEffect(()=>{if(t?.length)return p({sourceIds:t,filePath:e,direction:a}),()=>m("imports")},[e,a,t?.join(",")]);const v=b.useCallback(N=>{o(N)},[]),_=b.useCallback(N=>{if(!N.hashId)return;const A=a==="forward"?N.to:N.from;x({id:`content:${N.hashId}`,type:"content",resourceId:N.hashId,label:A,meta:{sourcePath:A}})},[a,x]),w=i??[],{external:S,internal:k}=b.useMemo(()=>{const N=[],A=[];for(const E of w)E.isExternal?N.push(E):A.push(E);return{external:N,internal:A}},[w]);return c.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("h3",{className:"font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary truncate",children:[r("query.import_deps.title"),": ",e]}),c.jsxs("div",{className:"flex gap-1 shrink-0",children:[c.jsx(D_,{label:r("query.import_deps.forward"),active:a==="forward",onClick:()=>v("forward")}),c.jsx(D_,{label:r("query.import_deps.reverse"),active:a==="reverse",onClick:()=>v("reverse")})]})]}),h.length>0&&c.jsx(xd,{warnings:h}),u?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ta,{labelKey:"query.symbol.loading"})}):f?c.jsx(wt,{title:r("query.import_deps.empty"),description:f}):w.length===0?c.jsx(wt,{title:r("query.import_deps.empty"),description:r("query.import_deps.empty")}):c.jsxs("div",{className:"overflow-y-auto c4a-scrollbar",children:[S.length>0&&c.jsx(O_,{title:r("query.import_deps.external"),count:S.length,entries:S,isExternal:!0,direction:a}),k.length>0&&c.jsx(O_,{title:r("query.import_deps.internal"),count:k.length,entries:k,isExternal:!1,direction:a,onOpen:_})]})]})}function D_({label:e,active:t,onClick:r}){return c.jsx("button",{type:"button",className:`rounded px-2.5 py-1 font-mono text-[11px] uppercase tracking-tight cursor-pointer ${t?"bg-c4a-accent text-white":"bg-c4a-bg-surface text-c4a-text-muted hover:bg-c4a-bg-hover"}`,onClick:r,children:e})}function O_({title:e,count:t,entries:r,isExternal:a,direction:o,onOpen:i}){return c.jsxs("div",{className:"mb-4",children:[c.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-tight text-c4a-text-muted mb-2",children:[e," (",t,")"]}),r.map((u,f)=>c.jsx(Q$,{entry:u,isExternal:a,direction:o,onOpen:i},`${u.from}-${u.to}-${f}`))]})}function Q$({entry:e,isExternal:t,direction:r,onOpen:a}){const o=t?Dr:_m,i=r==="forward"?e.to:e.from,u=e.symbols.join(", "),f=!t&&!!e.hashId&&!!a;return c.jsxs("div",{className:`flex items-center gap-2 px-3 h-8 border-b border-c4a-border-subtle last:border-b-0 hover:bg-c4a-bg-hover/50 ${f?"cursor-pointer":""}`,onClick:f?()=>a(e):void 0,children:[c.jsx(o,{size:13,className:"shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:`font-mono text-sm truncate ${f?"text-c4a-accent hover:underline":"text-c4a-text-primary"}`,children:i}),u&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-c4a-text-muted shrink-0",children:"→"}),c.jsx("span",{className:"font-mono text-xs text-c4a-text-secondary truncate",children:u})]})]})}function Z$({className:e,sourceIds:t}){const{t:r}=ye(),[a,o]=b.useState("descendants"),{data:i,loading:u,error:f,warnings:h}=Mn(k=>k.inheritance),p=Mn(k=>k.fetchInheritance),m=Mn(k=>k.resetQuery),x=kt(k=>k.rootSources),v=b.useMemo(()=>x.filter(k=>k.source_type==="code"&&(k.index_status==="indexed"||k.index_status==="stale")).map(k=>k.id),[x]),_=v.length>0?v:t??[];b.useEffect(()=>{if(_.length)return p({sourceIds:_,className:e,direction:a}),()=>m("inheritance")},[e,a,_.join(",")]);const w=b.useCallback(k=>{o(k)},[]),S=i??[];return c.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("h3",{className:"font-mono text-xs font-semibold uppercase tracking-tight text-c4a-text-secondary truncate",children:[r("query.inheritance.title"),": ",e.includes("#")?e.slice(e.indexOf("#")+1):e]}),c.jsxs("div",{className:"flex gap-1 shrink-0",children:[c.jsx(M_,{label:r("query.inheritance.descendants"),active:a==="descendants",onClick:()=>w("descendants")}),c.jsx(M_,{label:r("query.inheritance.ancestors"),active:a==="ancestors",onClick:()=>w("ancestors")})]})]}),h.length>0&&c.jsx(xd,{warnings:h}),u?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ta,{labelKey:"query.symbol.loading"})}):f?c.jsx(wt,{title:r("query.inheritance.empty"),description:f}):S.length===0?c.jsx(wt,{title:r("query.inheritance.empty"),description:r("query.inheritance.empty")}):c.jsxs("div",{className:"overflow-y-auto c4a-scrollbar",children:[S.map((k,N)=>c.jsx(J$,{entry:k,direction:a},`${k.child}-${k.parent}-${N}`)),_.length>1&&c.jsx("div",{className:"mt-3 px-3 font-mono text-[11px] text-c4a-text-muted",children:r("query.inheritance.cross_source",{count:_.length})})]})]})}function M_({label:e,active:t,onClick:r}){return c.jsx("button",{type:"button",className:`rounded px-2.5 py-1 font-mono text-[11px] uppercase tracking-tight cursor-pointer ${t?"bg-c4a-accent text-white":"bg-c4a-bg-surface text-c4a-text-muted hover:bg-c4a-bg-hover"}`,onClick:r,children:e})}function J$({entry:e,direction:t}){const r=t==="descendants"?e.child:e.parent;return c.jsxs("div",{className:"flex items-center gap-2 px-3 h-8 border-b border-c4a-border-subtle last:border-b-0 hover:bg-c4a-bg-hover/50",children:[c.jsx("span",{className:"shrink-0 w-4 text-center font-mono text-xs text-c4a-text-muted",children:"■"}),c.jsx("span",{className:"font-mono text-sm text-c4a-text-primary truncate",children:r}),c.jsx(Bt,{variant:"muted",children:e.kind}),c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted truncate",children:e.sourceId})]})}function W$({anchor:e,children:t}){const{t:r}=ye(),a=Aa(w=>w.tabs),o=Aa(w=>w.activeTabId),i=Aa(w=>w.mode),{reset:u,setAnchor:f,activateTab:h,closeTab:p,closeAll:m,toggleMode:x}=Aa.getState();b.useEffect(()=>(u(),f({id:`${e.type}:${e.resourceId}`,type:e.type,resourceId:e.resourceId,label:e.label,...e.icon!=null&&{icon:e.icon}}),()=>u()),[e.id]);const v=a.find(w=>w.id===o),_=a.length>1;return c.jsx(FT,{children:c.jsxs("div",{className:"flex flex-1 flex-col",children:[c.jsx("div",{className:"flex flex-1 flex-col",children:!v||v.isAnchor?t:c.jsx(e9,{tab:v})}),_&&c.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 flex h-6 items-center border-t border-c4a-border-subtle bg-c4a-bg-surface md:left-[220px]",children:[c.jsx("div",{className:"flex min-w-0 flex-1 items-center",children:a.map(w=>{const S=w.id===o;return c.jsxs("div",{className:`flex min-w-0 shrink items-center gap-1 px-2 h-5 font-mono text-[10px] uppercase tracking-tight truncate cursor-pointer border-r border-c4a-border-subtle ${S?"bg-c4a-bg-base text-c4a-text-primary border-b border-b-c4a-accent":"bg-c4a-bg-surface text-c4a-text-muted hover:bg-c4a-bg-hover"}`,onClick:()=>h(w.id),children:[w.icon&&c.jsx("span",{className:"shrink-0 text-[10px]",children:w.icon}),c.jsx("span",{className:"truncate",children:w.label}),!w.isAnchor&&c.jsx("button",{type:"button",className:"ml-0.5 shrink-0 text-c4a-text-muted hover:text-c4a-text-primary",onClick:k=>{k.stopPropagation(),p(w.id)},children:c.jsx(Or,{className:"h-2 w-2"})})]},w.id)})}),c.jsxs("div",{className:"flex items-center gap-0.5 px-1 shrink-0",children:[c.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded-sm text-c4a-text-muted hover:text-c4a-text-primary hover:bg-c4a-bg-hover cursor-pointer",title:r(i==="append"?"explorer.mode.append_tooltip":"explorer.mode.replace_tooltip"),onClick:x,children:c.jsx("span",{className:"text-[10px]",children:i==="append"?"📑":"📌"})}),c.jsx("button",{type:"button",className:"flex h-5 w-5 items-center justify-center rounded-sm text-c4a-text-muted hover:text-c4a-text-primary hover:bg-c4a-bg-hover cursor-pointer",title:r("explorer.close_all"),onClick:m,children:c.jsx(Or,{className:"h-2.5 w-2.5"})})]})]})]})})}function e9({tab:e}){switch(e.type){case"content":return c.jsx(pw,{hashId:e.resourceId,sourcePath:e.meta?.sourcePath??e.label,paragraphMeta:e.meta});case"entity":return c.jsx(q$,{entityId:e.resourceId});case"relation":return c.jsx(G$,{relationId:e.resourceId});case"call-graph":return c.jsx(Y$,{functionName:e.resourceId,sourceIds:e.meta?.sourceIds});case"import-deps":return c.jsx(X$,{filePath:e.resourceId,sourceIds:e.meta?.sourceIds});case"inheritance":return c.jsx(Z$,{className:e.resourceId,sourceIds:e.meta?.sourceIds});default:return null}}function z_(e){if(!e)return"";try{const t=new Date(e),r=new Date,a=t.getFullYear()===r.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),u=String(t.getHours()).padStart(2,"0"),f=String(t.getMinutes()).padStart(2,"0");return a?`${o}-${i} ${u}:${f}`:`${t.getFullYear()}-${o}-${i} ${u}:${f}`}catch{return""}}function t9({versions:e,currentHashId:t,onChange:r}){const[a,o]=b.useState(!1),i=b.useRef(null),u=b.useRef(null),f=b.useCallback(v=>{i.current&&!i.current.contains(v.target)&&o(!1)},[]);b.useEffect(()=>{if(a)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a,f]);const h=b.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),e.length>1&&o(!0)},[e.length]),p=b.useCallback(()=>{u.current=setTimeout(()=>o(!1),150)},[]),m=e.find(v=>v.hash_id===t)??e[0],x=z_(m?.created_at);return c.jsxs("div",{ref:i,className:"relative",onMouseEnter:h,onMouseLeave:p,children:[c.jsxs("button",{type:"button",onClick:e.length>1?()=>o(v=>!v):void 0,className:`flex h-7 items-center gap-1.5 rounded-sm border border-c4a-border-default px-2 font-mono text-[10px] text-c4a-text-secondary transition-colors ${e.length>1?"cursor-pointer hover:border-c4a-border-strong hover:bg-c4a-bg-hover hover:text-c4a-text-primary":""}`,children:[c.jsxs("span",{children:[c.jsx("span",{className:"font-extrabold",children:m?.version_label}),x?` ${x}`:""]}),e.length>1&&c.jsx($t,{size:12,className:`shrink-0 text-c4a-text-muted transition-transform duration-200 ${a?"rotate-90":""}`})]}),a&&c.jsx("div",{className:"absolute right-0 top-full z-10 mt-1 min-w-full rounded-sm border border-c4a-border-default bg-c4a-bg-elevated shadow-c4a-md max-h-40 overflow-y-auto c4a-scrollbar",children:e.map(v=>{const _=v.hash_id===t,w=z_(v.created_at);return c.jsx("div",{className:`flex cursor-pointer items-center px-2 py-1 font-mono text-[10px] transition-colors hover:bg-c4a-bg-hover ${_?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,onClick:()=>{r(v.hash_id),o(!1)},children:c.jsxs("span",{children:[c.jsx("span",{className:"font-extrabold",children:v.version_label}),w?` ${w}`:""]})},v.hash_id)})})]})}function $_(e){if(!e)return"";try{const t=new Date(e),r=new Date,a=t.getFullYear()===r.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),u=String(t.getHours()).padStart(2,"0"),f=String(t.getMinutes()).padStart(2,"0");return a?`${o}-${i} ${u}:${f}`:`${t.getFullYear()}-${o}-${i} ${u}:${f}`}catch{return""}}function n9({commits:e,currentHashId:t,onChange:r}){const[a,o]=b.useState(!1),i=b.useRef(null),u=b.useRef(null),f=b.useCallback(v=>{i.current&&!i.current.contains(v.target)&&o(!1)},[]);b.useEffect(()=>{if(a)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a,f]);const h=b.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),e.length>1&&o(!0)},[e.length]),p=b.useCallback(()=>{u.current=setTimeout(()=>o(!1),150)},[]),m=e.find(v=>v.hash_id===t)??e[0];if(!m)return null;const x=$_(m.created_at);return c.jsxs("div",{ref:i,className:"relative",onMouseEnter:h,onMouseLeave:p,children:[c.jsxs("button",{type:"button",onClick:e.length>1?()=>o(v=>!v):void 0,className:`flex h-7 items-center gap-1.5 rounded-sm border border-c4a-border-default px-2 font-mono text-[10px] text-c4a-text-secondary transition-colors ${e.length>1?"cursor-pointer hover:border-c4a-border-strong hover:bg-c4a-bg-hover hover:text-c4a-text-primary":""}`,children:[c.jsxs("span",{children:[c.jsx("span",{className:"font-extrabold",children:m.branch})," · ",m.commit_hash.slice(0,7),x?` · ${x}`:""]}),e.length>1&&c.jsx($t,{size:12,className:`shrink-0 text-c4a-text-muted transition-transform duration-200 ${a?"rotate-90":""}`})]}),a&&c.jsx("div",{className:"absolute right-0 top-full z-10 mt-1 min-w-full rounded-sm border border-c4a-border-default bg-c4a-bg-elevated shadow-c4a-md max-h-40 overflow-y-auto c4a-scrollbar",children:e.map(v=>{const _=v.hash_id===t,w=$_(v.created_at);return c.jsx("div",{className:`flex cursor-pointer items-center px-2 py-1 font-mono text-[10px] transition-colors hover:bg-c4a-bg-hover ${_?"text-c4a-accent":"text-c4a-text-secondary hover:text-c4a-text-primary"}`,onClick:()=>{r(v.hash_id),o(!1)},children:c.jsxs("span",{children:[c.jsx("span",{className:"font-extrabold",children:v.branch})," · ",v.commit_hash.slice(0,7),w?` · ${w}`:""]})},v.hash_id)})})]})}const B_={none:"bg-c4a-bg-active text-c4a-text-secondary",indexing:"bg-c4a-accent/10 text-c4a-accent animate-pulse",indexed:"bg-c4a-success text-white",stale:"bg-c4a-warning/10 text-c4a-warning"};function r9({sourceId:e,status:t,loading:r,onDeleted:a,isDaemonOnline:o,indexModules:i,isCloudDoc:u}){const{t:f}=ye(),[h,p]=b.useState(!1),[m,x]=b.useState(null),v=kt(z=>z.triggerIndex),_=kt(z=>z.deleteIndex),w=b.useCallback((z,$)=>{console.error(`[IndexBadge] ${z}
99
+ `,$),x({title:z,detail:$})},[]),S=b.useCallback(async()=>{if(o)try{const $=(t==="indexed"||t==="stale")&&i?i.map(B=>({...B,force:!0})):i;(await v(e,$)).status==="skipped"&&Qr(f("index.code.skipped"))}catch(z){const $=z instanceof hn?`POST /sources/${e}/index
100
+ HTTP ${z.status} ${z.code}
101
+ ${z.message}`:`POST /sources/${e}/index
102
+ ${String(z)}`;w(f("index.code.error"),$)}},[e,o,v,i,t,f,w]),k=b.useCallback(async()=>{if(window.confirm(f("index.code.delete_confirm"))){p(!0);try{await _(e,i),Qr(f("index.code.delete_success")),a()}catch(z){const $=z instanceof hn?`DELETE /sources/${e}/index
103
+ HTTP ${z.status} ${z.code}
104
+ ${z.message}`:`DELETE /sources/${e}/index
105
+ ${String(z)}`;w(f("index.code.delete_failed"),$)}finally{p(!1)}}},[e,_,i,f,a,w]),N=b.useCallback(()=>{(t==="none"||t==="indexed"||t==="stale")&&S()},[t,S]),A=(()=>{switch(t){case"indexing":return f("index.code.indexing");case"indexed":return f("sources.status.indexed");case"stale":return f("sources.status.stale");default:return f("sources.status.none")}})(),E=(()=>{switch(t){case"none":return f("index.code.go_index");case"indexed":return f("index.code.reindex");case"stale":return f("index.code.reindex");default:return""}})(),D=t!=="indexing",L=!o;return r?null:c.jsxs(c.Fragment,{children:[t==="indexing"?c.jsx("span",{className:`rounded-sm px-1.5 py-0.5 font-mono text-[10px] uppercase ${B_.indexing}`,children:A}):c.jsxs("span",{className:`group/idx relative inline-block rounded-sm px-1.5 py-0.5 font-mono text-[10px] uppercase ${B_[t]} ${D&&!L?"cursor-pointer hover:bg-c4a-accent hover:text-white":""} ${L?"opacity-40 cursor-not-allowed":""}`,onClick:D&&!L?N:void 0,title:L?f("daemon.offline_tooltip"):void 0,children:[c.jsx("span",{className:D&&!L?"group-hover/idx:hidden":"",children:A}),D&&!L&&c.jsx("span",{className:"hidden group-hover/idx:inline",children:E})]}),t==="indexed"&&!h&&!u&&c.jsx("span",{className:"cursor-pointer rounded-sm p-0.5 text-c4a-text-muted hover:bg-c4a-error/10 hover:text-c4a-error",onClick:k,title:f("index.code.delete"),children:c.jsx(ld,{size:12})}),h&&c.jsx("span",{className:"inline-flex items-center gap-1 font-mono text-[10px] text-c4a-text-muted",children:c.jsx(Zt,{size:10,className:"animate-spin"})}),m&&c.jsx(Bl,{error:m,onClose:()=>x(null)})]})}function a9(e,t){for(const r of t)if(e===r||e.startsWith(r+"/")||r.startsWith(e+"/"))return!0;return!1}function s9(){const{t:e}=ye(),{sourceUuid:t}=Vo(),[r]=Ol(),a=r.get("path")||"",o=Tt(),{currentRoot:i,loading:u,error:f,fetchRootSource:h}=kt(),p=Qt(ds(qs)),[m,x]=b.useState(null),[v,_]=b.useState([]),[w,S]=b.useState(!0),[k,N]=b.useState(!1),[A,E]=b.useState(""),[D,L]=b.useState([]),z=i?.library_id,$=p.find(fe=>fe.id===z),R=$?.type==="cloud"?!0:$?.is_online??!1,B=kt(fe=>i?fe.indexingTasks.get(i.id):void 0),H=b.useMemo(()=>{if(B)return!B.modules||!a||a9(a,B.modules)?B:void 0},[B,a]),J=b.useMemo(()=>{if(i?.source_type==="code")return!0;if(!i?.tree)return!1;const fe=_e=>{for(const he of _e)if(he.kind==="source"&&he.source_type==="code"||he.children&&fe(he.children))return!0;return!1};return fe(i.tree)},[i]),[oe,ce]=b.useState(!1);b.useEffect(()=>{t&&h(t).catch(()=>{})},[t,h]),b.useEffect(()=>{N(!1),S(!0),ce(!1)},[t,a]),b.useEffect(()=>{if(!i?.id||H)return;let fe=!1;return ze.get(`/sources/${i.id}/index/status`).then(_e=>{fe||ce(!!_e.is_stale)}).catch(()=>{}),()=>{fe=!0}},[i?.id,H]);const M=b.useRef(null);b.useEffect(()=>{!i?.id||H||M.current!==i.id&&(M.current=i.id,ze.get(`/sources/${i.id}/index/status`).then(fe=>{if(fe.indexing){const _e=fe.progress?.stage??"scanning",he=fe.progress?.percent??0;kt.getState().updateIndexProgress({sourceId:i.id,stage:_e,progress:he,modules:fe.modules_scope??void 0})}}).catch(()=>{}))},[i?.id,H]);const P=b.useMemo(()=>i?a?zl(i.tree,a):i.kind==="source"?{path:"",kind:i.kind,source_type:i.source_type,name:i.name,metadata:i.metadata,index_status:i.index_status}:null:null,[i,a]),T=$,F=i?.id,ee=i?.kind==="source"&&!a,ae=b.useCallback(async fe=>{if(!F||!P){S(!1),N(!0);return}if(!fe&&P.index_status!=="indexed"&&P.index_status!=="stale"){x(null),_([]),S(!1),N(!0);return}const _e=ee?"":a||P.path;if(_e===void 0){S(!1),N(!0);return}S(!0),x(null),_([]);try{const he=await ze.get(`/sources/${F}/files`,{path:_e});x(he.hash_id),E(he.hash_id);try{const ve=await ze.get(`/sources/${F}/files/versions`,{path:_e});_(ve.versions??[])}catch{_([{version:he.version,version_label:he.version_label,hash_id:he.hash_id,created_at:he.created_at??null}])}}catch(he){he instanceof hn&&he.status===404&&(x(null),_([]))}finally{S(!1),N(!0)}},[F,P,a,ee]);b.useEffect(()=>{ae()},[ae]);const W=b.useRef(!1);b.useEffect(()=>{const fe=W.current,_e=!!H;W.current=_e,fe&&!_e&&(F?h(F).then(()=>ae(!0)).catch(()=>{}):ae(!0))},[H,ae,F,h]),b.useEffect(()=>{const fe=i?.metadata,_e=fe?.pinned_branch?String(fe.pinned_branch):"main";if(v.length>0&&P?.source_type==="code"){const he=v.map(ve=>({hash_id:ve.hash_id,branch:_e,commit_hash:ve.version_label,created_at:ve.created_at??null}));L(he)}else fe?.pinned_hash&&fe?.pinned_branch?L([{hash_id:A||m||"",branch:String(fe.pinned_branch),commit_hash:String(fe.pinned_hash),created_at:i?.updated_at??null}]):L([])},[i,v,P?.source_type,A,m]);const O=P?.metadata,V=P?.source_type==="code"||!P?.source_type&&J,re=P?.name??i?.name??"",se=P?.source_type??null,ne=b.useMemo(()=>{if(P){if(V){if(!a)return;const fe=a.includes("/")?a.split("/").slice(0,-1).join("/"):".";return fe==="."?void 0:[{path:fe}]}return a?[{path:a}]:[{path:"."}]}},[P,V,a]),ge=b.useMemo(()=>{if(!i||!T)return[];const fe=i.kind==="source"&&!a,_e=[{label:T.is_default?e("sources.library.default_cloud_name"):T.name,to:`/studio/sources/${T.id}`},{label:i.name,...fe?{}:{to:`/studio/sources/${T.id}?rootId=${i.id}`}}];if(a){const he=al(i.tree,a);for(let ve=0;ve<he.length-1;ve++){const Ve=he[ve];_e.push({label:Ve.name,to:`/studio/sources/${T.id}?rootId=${i.id}&path=${encodeURIComponent(Ve.path)}`})}he.length>0&&_e.push({label:he[he.length-1].name})}return _e},[i,T,a,e]);if(!u&&f)return c.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:c.jsx(wt,{fullPage:!0,title:e("sources.detail.not_found_title"),description:e("sources.detail.not_found_desc"),action:c.jsx("button",{className:"rounded bg-c4a-accent px-4 py-2 text-sm font-medium text-white hover:bg-c4a-accent/90",onClick:()=>o("/studio/sources"),children:e("common.back")})})});if(u||!i||!P)return c.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[c.jsx(Ta,{segments:[]}),c.jsxs("div",{className:"mt-3 mb-3 flex items-center gap-2",children:[c.jsx("div",{className:"h-5 w-5 shrink-0 animate-pulse rounded bg-c4a-bg-hover"}),c.jsx("div",{className:"h-6 w-56 animate-pulse rounded bg-c4a-bg-hover"})]}),c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Zt,{size:24,className:"animate-spin text-c4a-text-muted"})})]});const Ne=m!==null&&!w,Fe=ee?P?.name??"":a||P?.path||P?.name||"",qe=H&&!H.terminalState?"indexing":H?.terminalState==="done"?"indexed":k?Ne?oe?"stale":"indexed":"none":P?.index_status==="indexed"?"indexed":P?.index_status==="stale"?"stale":"none",be=!!H;return c.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[c.jsxs("div",{className:"shrink-0 px-4 pt-4 md:px-6 md:pt-6",children:[c.jsx(Ta,{segments:ge}),c.jsxs("div",{className:"mt-3 mb-3 flex items-end gap-3",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[V?c.jsx(Dr,{size:20,className:"shrink-0 text-c4a-accent"}):c.jsx(On,{size:20,className:"shrink-0 text-c4a-accent"}),c.jsx("h1",{className:"mb-[0.125rem] min-w-0 break-all font-mono text-xl font-bold leading-none text-c4a-text-primary",children:re})]}),F&&c.jsx(r9,{sourceId:F,status:qe,loading:!k&&w&&P?.index_status!=="indexed",onDeleted:()=>{x(null),E(""),_([]),F&&h(F).catch(()=>{})},isDaemonOnline:R,indexModules:ne,isCloudDoc:$?.type==="cloud"&&!V}),c.jsxs("span",{className:"group relative cursor-default",children:[c.jsx(Bt,{variant:"muted",children:e(se==="code"?"sources.type.code":"sources.type.doc")}),c.jsx("div",{className:"pointer-events-none absolute left-0 top-full z-10 mt-1.5 hidden w-max rounded border border-c4a-border-default bg-c4a-bg-elevated px-3 py-2 shadow-c4a-md group-hover:block",children:c.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-[10px]",children:[c.jsx("dt",{className:"text-c4a-text-muted",children:e("sources.detail.origin")}),c.jsxs("dd",{className:"text-c4a-text-secondary",children:[T?.is_default?e("sources.library.default_cloud_name"):T?.name," / ",i?.name]}),!!O?.repo_name&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{className:"text-c4a-text-muted",children:e("sources.detail.repo")}),c.jsx("dd",{className:"text-c4a-text-secondary",children:O.repo_url?c.jsx("a",{href:String(O.repo_url),target:"_blank",rel:"noopener noreferrer",className:"text-c4a-accent hover:underline",children:String(O.repo_name)}):String(O.repo_name)})]}),c.jsx("dt",{className:"text-c4a-text-muted",children:e("sources.detail.type")}),c.jsx("dd",{className:"text-c4a-text-secondary uppercase",children:re.includes(".")?re.slice(re.lastIndexOf(".")+1):se??"—"})]})})]}),c.jsx("div",{className:"flex-1"}),V&&D.length>0&&c.jsx("div",{className:"self-center",children:c.jsx(n9,{commits:D,currentHashId:A,onChange:E})}),!V&&Ne&&v.length>0&&c.jsx("div",{className:"self-center",children:c.jsx(t9,{versions:v,currentHashId:A,onChange:E})})]})]}),c.jsx("div",{className:"flex flex-1 flex-col overflow-y-auto c4a-scrollbar px-4 pb-8 md:px-6 md:pb-10",children:c.jsx(W$,{anchor:{id:`content:${A||"pending"}`,type:"content",resourceId:A||"pending",label:re,icon:V?"📦":"📄"},children:c.jsx(pw,{hashId:A||"",sourcePath:Fe,sourceId:F,isCodeIndexing:be,isDaemonOnline:R,indexModules:ne,sourceType:se,indexStatus:qe})})})]})}function o9({docSources:e,onConfirm:t,onCancel:r}){const{t:a}=ye(),[o,i]=b.useState(!0),[u,f]=b.useState(null),[h,p]=b.useState(null),m=b.useMemo(()=>{const x=new Map;for(const v of e)x.has(v.sourceId)||x.set(v.sourceId,[]),x.get(v.sourceId).push(v.modulePath);return[...x.entries()].map(([v,_])=>({sourceId:v,paths:_}))},[e]);return b.useEffect(()=>{let x=!1;async function v(){i(!0);try{const _=await Promise.all(m.map(({sourceId:S,paths:k})=>{const N=k.length>0?`?paths=${k.map(encodeURIComponent).join(",")}`:"";return ze.get(`/sources/${S}/index/estimate${N}`)}));if(x)return;const w=_.reduce((S,k)=>({tokens:S.tokens+k.estimated_tokens,calls:S.calls+k.estimated_calls,chunks:S.chunks+k.chunk_count}),{tokens:0,calls:0,chunks:0});f(w)}catch(_){if(x)return;const w=_ instanceof hn?`GET /sources/:id/index/estimate
106
+ HTTP ${_.status} ${_.code}
107
+ ${_.message}`:`GET /sources/:id/index/estimate
108
+ ${String(_)}`;console.error(`[DocIndexConfirmDialog] estimate failed
109
+ `,w),p({title:a("index.doc.confirm_title"),detail:w})}finally{x||i(!1)}}return v(),()=>{x=!0}},[m,a]),h?c.jsx(Bl,{error:h,onClose:()=>{p(null),r()}}):c.jsxs(lr,{onClose:r,className:"w-full max-w-lg rounded-xl bg-c4a-bg-surface p-6",children:[c.jsx("h2",{className:"font-mono text-sm uppercase tracking-tight text-c4a-text-primary mb-4",children:a("index.doc.confirm_title")}),o?c.jsx(ta,{labelKey:"index.doc.estimating"}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-sm text-c4a-text-secondary mb-4",children:a("index.doc.confirm_desc")}),c.jsx("div",{className:"rounded-lg border border-c4a-border-subtle bg-c4a-bg-base p-3 mb-4 max-h-32 overflow-y-auto c4a-scrollbar",children:e.map((x,v)=>c.jsxs("div",{className:"flex items-center gap-2 py-1",children:[c.jsx(On,{size:12,className:"shrink-0 text-c4a-text-muted"}),c.jsx("span",{className:"font-mono text-xs text-c4a-text-primary",children:x.sourceName})]},`${x.sourceId}:${v}`))}),u&&c.jsxs("div",{className:"flex gap-3 mb-4",children:[c.jsx(ln,{icon:c.jsx(JE,{}),label:a("index.doc.estimate_tokens"),value:`~${u.tokens.toLocaleString()}`,size:"sm"}),c.jsx(ln,{icon:c.jsx(cA,{}),label:a("index.doc.estimate_calls"),value:`~${u.calls}`,size:"sm"}),c.jsx(ln,{icon:c.jsx(HC,{}),label:a("index.doc.estimate_chunks"),value:u.chunks,size:"sm"})]}),u&&c.jsx("p",{className:"text-xs text-c4a-text-muted font-mono mb-6",children:a("index.doc.estimate_summary",{tokens:u.tokens.toLocaleString(),calls:u.calls})}),c.jsxs("div",{className:"flex justify-end gap-3",children:[c.jsx("button",{onClick:r,className:"rounded border border-c4a-border-default bg-c4a-bg-surface px-4 py-2 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:a("index.doc.cancel")}),c.jsx("button",{onClick:t,className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs uppercase text-white transition-colors hover:bg-c4a-accent-hover",children:a("index.doc.confirm_btn")})]})]})]})}function Ou(e){return e.source_type==="code"?e.path.includes("/")?e.path.split("/").slice(0,-1).join("/"):".":e.path}function Pw(e){return e.index_status==="indexed"||e.index_status==="stale"}function i9(e,t){const r=[],a=o=>{for(const i of o){if(i.kind==="source"){const u=Ou(i);r.push({sourceId:t,modulePath:u,moduleName:i.name,moduleType:i.source_type==="code"?"package":"document",hasDigest:Pw(i),digestStale:i.index_status==="stale"})}i.children&&a(i.children)}};return a(e),r}function Hw(e,t){for(const r of e){if(r.path===t&&r.children)return r.children;if(r.children){const a=Hw(r.children,t);if(a.length>0)return a}}return[]}function qw(e,t){for(const r of e){if(r.path===t)return r;if(r.children){const a=qw(r.children,t);if(a)return a}}return null}function l9({node:e,sourceId:t,depth:r,selected:a,indeterminate:o,expanded:i,onToggleExpand:u,onToggleSelect:f,t:h}){const p=e.kind==="folder",m=e.source_type==="code",x=Pw(e),v=p?Gn:m?Dr:On,_="text-c4a-text-secondary";return c.jsxs("div",{className:"group/row flex h-8 cursor-pointer items-center gap-1.5 hover:bg-c4a-bg-hover",style:{paddingLeft:`${r*24+8}px`},children:[p?c.jsx("button",{onClick:()=>u(t,e.path),className:"flex h-4 w-4 shrink-0 items-center justify-center text-c4a-text-muted",children:c.jsx($t,{size:12,className:`transition-transform duration-200 ${i?"rotate-90":""}`})}):c.jsx("span",{className:"h-4 w-4 shrink-0"}),c.jsx("input",{type:"checkbox",checked:a,ref:w=>{w&&(w.indeterminate=o)},onChange:()=>f(t,e.path),className:"c4a-check"}),c.jsx(v,{size:14,className:`shrink-0 ${_}`}),c.jsx("span",{className:`truncate text-xs ${_}`,children:e.name}),!p&&x&&c.jsx("span",{className:"ml-1 shrink-0 rounded-sm bg-c4a-success px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",children:h("index.batch.already_indexed")})]})}function cm({nodes:e,depth:t,selectedPaths:r,expandedPaths:a,sourceId:o,onToggleExpand:i,onToggleSelect:u,getSelectionState:f,t:h}){const p=b.useMemo(()=>[...e].sort((m,x)=>m.kind!==x.kind?m.kind==="folder"?-1:1:m.name.localeCompare(x.name)),[e]);return c.jsx(c.Fragment,{children:p.map(m=>{const{selected:x,indeterminate:v}=f(o,m),_=a.has(`${o}:${m.path}`);return c.jsxs("div",{children:[c.jsx(l9,{node:m,sourceId:o,depth:t,selected:x,indeterminate:v,expanded:_,onToggleExpand:i,onToggleSelect:u,t:h}),m.kind==="folder"&&_&&m.children&&c.jsx(cm,{nodes:m.children,depth:t+1,selectedPaths:r,expandedPaths:a,sourceId:o,onToggleExpand:i,onToggleSelect:u,getSelectionState:f,t:h})]},m.path)})})}function c9({root:e,expanded:t,selected:r,indeterminate:a,onToggleExpand:o,onToggleSelect:i}){const u=e.kind==="folder",h=e.metadata?.origin==="remote",p=u?h?Ml:Gn:e.source_type==="code"?Dr:On,m="text-c4a-text-secondary";return c.jsxs("div",{className:"group/row flex h-8 cursor-pointer items-center gap-1.5 hover:bg-c4a-bg-hover",style:{paddingLeft:"8px"},children:[u?c.jsx("button",{onClick:o,className:"flex h-4 w-4 shrink-0 items-center justify-center text-c4a-text-muted",children:c.jsx($t,{size:12,className:`transition-transform duration-200 ${t?"rotate-90":""}`})}):c.jsx("span",{className:"h-4 w-4 shrink-0"}),c.jsx("input",{type:"checkbox",checked:r,ref:x=>{x&&(x.indeterminate=a)},onChange:i,className:"c4a-check"}),c.jsx(p,{size:14,className:`shrink-0 ${m}`}),c.jsx("span",{className:`truncate text-xs ${m}`,children:e.name})]})}function u9({selectedNodes:e,targetRoots:t,setSelectedPaths:r,t:a}){const i=b.useMemo(()=>new Set(e.map(h=>h.sourceId)),[e]).size>1,u=b.useMemo(()=>{const h=new Map;for(const p of t)h.set(p.id,p.name);return h},[t]),f=b.useMemo(()=>{const h=[],p=new Map;for(const m of e){if(!p.has(m.sourceId)){const x=[];p.set(m.sourceId,x),h.push({sourceId:m.sourceId,nodes:x})}p.get(m.sourceId).push(m)}return h},[e]);return c.jsx("div",{className:"flex flex-col gap-0.5",children:f.map(({sourceId:h,nodes:p})=>c.jsxs("div",{children:[i&&c.jsx("div",{className:"mt-1 mb-0.5 border-b border-c4a-border-subtle px-2 pb-1 font-mono text-[10px] uppercase tracking-tight text-c4a-text-muted",children:u.get(h)||h}),p.map(m=>c.jsxs("div",{className:"flex items-center gap-2 rounded-sm px-2 py-1 text-xs text-c4a-text-secondary hover:bg-c4a-bg-hover",children:[m.moduleType==="package"?c.jsx(Dr,{size:12,className:"shrink-0"}):c.jsx(On,{size:12,className:"shrink-0"}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsx("span",{className:"truncate",children:m.moduleName}),m.modulePath!=="."&&m.modulePath!==m.moduleName&&c.jsx("span",{className:"truncate font-mono text-[10px] text-c4a-text-muted",title:m.modulePath,children:m.modulePath})]}),m.hasDigest&&c.jsx("span",{className:"shrink-0 rounded bg-amber-500/10 px-1 font-mono text-[10px] text-amber-500",children:a("index.batch.reindex_tag")}),c.jsx("button",{onClick:()=>{r(x=>{const v=new Set(x);return v.delete(`${m.sourceId}:${m.modulePath}`),v})},className:"shrink-0 text-c4a-text-muted hover:text-c4a-accent",children:c.jsx(Or,{size:12})})]},`${m.sourceId}:${m.modulePath}`))]},h))})}function d9(){const{t:e}=ye(),t=Tt(),{libId:r}=Vo(),[a]=Ol(),o=a.get("rootId")||null,i=a.get("path")||"",f=Qt(ds(qs)).find(be=>be.id===r),{rootSources:h,currentRoot:p,fetchRootSources:m,fetchRootSource:x,triggerIndex:v}=kt(),_=f?.type==="cloud"?!0:f?.is_online??!1,[w,S]=b.useState(new Set),[k,N]=b.useState(new Set),[A,E]=b.useState(!1),[D,L]=b.useState(null),[z,$]=b.useState(!1),[R,B]=b.useState([]),[H,J]=b.useState([]);b.useEffect(()=>{r&&m({library_id:r})},[r,m]),b.useEffect(()=>{o&&x(o).catch(()=>{})},[o,x]);const oe=b.useMemo(()=>{let be;return o&&p?be=[p]:be=h.filter(fe=>fe.kind!=="folder"||fe.tree&&fe.tree.length>0),i?be.map(fe=>{const _e=Hw(fe.tree,i);return{...fe,tree:_e}}).filter(fe=>fe.tree.length>0):be},[o,p,h,i]);b.useEffect(()=>{N(new Set)},[oe]);const ce=b.useMemo(()=>{const be=[];for(const fe of oe)if(fe.kind==="source"){const _e=fe.index_status==="indexed"||fe.index_status==="stale";be.push({sourceId:fe.id,modulePath:".",moduleName:fe.name,moduleType:fe.source_type==="code"?"package":"document",hasDigest:_e,digestStale:fe.index_status==="stale"})}else be.push(...i9(fe.tree,fe.id));return be},[oe]),M=b.useMemo(()=>ce.filter(be=>w.has(`${be.sourceId}:${be.modulePath}`)),[ce,w]),P=b.useCallback(be=>{const fe=[],_e=he=>{he.kind==="source"&&fe.push(Ou(he)),he.children&&he.children.forEach(_e)};return _e(be),fe},[]),T=b.useCallback((be,fe)=>{const _e=oe.find(he=>he.id===be);return _e?qw(_e.tree,fe):null},[oe]),F=b.useCallback((be,fe)=>{const _e=`${be}:${fe}`;N(he=>{const ve=new Set(he);return ve.has(_e)?ve.delete(_e):ve.add(_e),ve})},[]),ee=b.useCallback((be,fe)=>{const _e=T(be,fe);_e&&S(he=>{const ve=new Set(he);if(_e.kind==="source"){const Ve=`${be}:${Ou(_e)}`;ve.has(Ve)?ve.delete(Ve):ve.add(Ve)}else{const Ve=P(_e).map(Xe=>`${be}:${Xe}`);Ve.every(Xe=>ve.has(Xe))?Ve.forEach(Xe=>ve.delete(Xe)):Ve.forEach(Xe=>ve.add(Xe))}return ve})},[T,P]),ae=b.useCallback((be,fe)=>{if(fe.kind==="source"){const ve=`${be}:${Ou(fe)}`;return{selected:w.has(ve),indeterminate:!1}}const _e=P(fe).map(ve=>`${be}:${ve}`);if(_e.length===0)return{selected:!1,indeterminate:!1};const he=_e.filter(ve=>w.has(ve)).length;return{selected:he===_e.length,indeterminate:he>0&&he<_e.length}},[w,P]),W=!o&&oe.length>0,O=b.useCallback(be=>{const _e=ce.filter(he=>he.sourceId===be).map(he=>`${he.sourceId}:${he.modulePath}`);_e.length!==0&&S(he=>{const ve=new Set(he);return _e.every(De=>ve.has(De))?_e.forEach(De=>ve.delete(De)):_e.forEach(De=>ve.add(De)),ve})},[ce]),V=b.useCallback(be=>{const fe=ce.filter(ve=>ve.sourceId===be);if(fe.length===0)return{selected:!1,indeterminate:!1};const _e=fe.map(ve=>`${ve.sourceId}:${ve.modulePath}`),he=_e.filter(ve=>w.has(ve)).length;return{selected:he===_e.length,indeterminate:he>0&&he<_e.length}},[ce,w]),re=b.useCallback(async be=>{const fe=new Map;for(const _e of be)fe.has(_e.sourceId)||fe.set(_e.sourceId,[]),fe.get(_e.sourceId).push({path:_e.modulePath,force:!!_e.hasDigest});return Promise.allSettled(Array.from(fe.entries()).map(async([_e,he])=>{const ve=await v(_e,he);return{sourceId:_e,...ve}}))},[v]),se=b.useCallback((be,fe)=>{let _e=!1;const he=[];for(const ve of be)if(ve.status==="fulfilled")(ve.value.status==="started"||ve.value.status==="completed")&&(_e=!0);else{const Ve=ve.reason instanceof Error?ve.reason.message:String(ve.reason);he.push(Ve)}if(he.length>0&&console.error("[BatchIndex] index errors:",he),E(!1),_e&&fe.length>0){he.length>0&&Qr(e("index.batch.toast_partial_fail"));const ve=[...fe].sort((De,Xe)=>{const It=De.modulePath==="."?0:De.modulePath.split("/").length,un=Xe.modulePath==="."?0:Xe.modulePath.split("/").length;return It-un})[0],Ve=ve.modulePath==="."?"":`?path=${encodeURIComponent(ve.modulePath)}`;t(`/studio/source/${ve.sourceId}${Ve}`,{replace:!0})}else he.length>0?L({title:e("index.batch.error"),detail:he.join(`
110
+
111
+ `)}):(Qr(e("index.batch.toast_skipped")),t(-1))},[t,e]),ne=b.useCallback(async()=>{if(M.length===0)return;const be=M.filter(he=>he.moduleType==="document"),fe=M.filter(he=>he.moduleType==="package");if(be.length>0){B(be),J(fe),$(!0);return}E(!0);const _e=await re(fe);se([..._e],fe)},[M,re,se]),ge=b.useCallback(async()=>{$(!1),E(!0);const be=[...H,...R],[fe,_e]=await Promise.all([H.length>0?re(H):Promise.resolve([]),re(R)]);se([...fe,..._e],be)},[R,H,re,se]),Ne=b.useCallback(()=>{$(!1),B([]),J([])},[]),Fe=b.useMemo(()=>{if(!f)return[];const be=[{label:f.is_default?e("sources.library.default_cloud_name"):f.name,to:`/studio/sources/${f.id}`}];if(o&&p&&(be.push({label:p.name,to:`/studio/sources/${f.id}?rootId=${p.id}`}),i)){const fe=i.split("/");be.push({label:fe[fe.length-1]||i,to:`/studio/sources/${f.id}?rootId=${p.id}&path=${encodeURIComponent(i)}`})}return be.push({label:e("index.batch.title")}),be},[f,o,p,i,e]);if(!f)return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:c.jsx("p",{className:"text-sm text-c4a-text-muted",children:e("common.loading")})});const qe=M.length>50;return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-c4a-bg-default p-4 md:p-6",children:[c.jsx(Ta,{segments:Fe}),c.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col gap-4 lg:flex-row",children:[c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border border-c4a-border-default rounded-lg lg:w-1/2",children:[c.jsx("div",{className:"font-mono text-xs uppercase tracking-tight text-c4a-text-muted px-3 py-2 border-b border-c4a-border-subtle",children:e("index.batch.panel_a_title")}),c.jsx("div",{className:"flex-1 overflow-y-auto c4a-scrollbar",children:oe.map(be=>{if(W){const fe=`${be.id}:__root__`,_e=k.has(fe),{selected:he,indeterminate:ve}=V(be.id);return c.jsxs("div",{children:[c.jsx(c9,{root:be,expanded:_e,selected:he,indeterminate:ve,onToggleExpand:()=>{N(Ve=>{const De=new Set(Ve);return De.has(fe)?De.delete(fe):De.add(fe),De})},onToggleSelect:()=>O(be.id)}),be.kind==="folder"&&_e&&c.jsx(cm,{nodes:be.tree,depth:1,selectedPaths:w,expandedPaths:k,sourceId:be.id,onToggleExpand:F,onToggleSelect:ee,getSelectionState:ae,t:e})]},be.id)}return c.jsx(cm,{nodes:be.tree,depth:0,selectedPaths:w,expandedPaths:k,sourceId:be.id,onToggleExpand:F,onToggleSelect:ee,getSelectionState:ae,t:e},be.id)})})]}),c.jsxs("div",{className:"flex min-h-0 flex-col border border-c4a-border-default rounded-lg lg:w-1/2",children:[c.jsx("div",{className:"font-mono text-xs uppercase tracking-tight text-c4a-text-muted px-3 py-2 border-b border-c4a-border-subtle",children:e("index.batch.panel_b_title")}),c.jsx("div",{className:"px-3 py-2",children:c.jsx("span",{className:"font-mono text-xs text-c4a-text-muted",children:e("index.batch.selected_count",{n:M.length,total:ce.length}).split(/(\d+)/).map((be,fe)=>/^\d+$/.test(be)?c.jsx("span",{className:"text-c4a-accent font-extrabold",children:be},fe):c.jsx("span",{children:be},fe))})}),c.jsx("div",{className:"flex-1 overflow-y-auto c4a-scrollbar px-3",children:M.length===0?null:c.jsx(u9,{selectedNodes:M,targetRoots:oe,setSelectedPaths:S,t:e})})]})]}),c.jsxs("div",{className:"sticky bottom-0 mt-4 flex items-center justify-end gap-3 bg-c4a-bg-default px-4 py-3",children:[qe&&c.jsx("span",{className:"mr-auto font-mono text-xs text-c4a-warning",children:e("index.batch.warning_over_50")}),c.jsx("button",{onClick:()=>t(-1),className:"rounded border border-c4a-border-default bg-c4a-bg-surface px-4 py-2 font-mono text-xs uppercase text-c4a-text-secondary transition-colors hover:bg-c4a-bg-hover hover:text-c4a-text-primary",children:e("index.batch.back")}),c.jsxs("button",{onClick:ne,disabled:M.length===0||A||!_,title:_?void 0:e("daemon.offline_tooltip"),className:"rounded bg-c4a-accent px-4 py-2 font-mono text-xs uppercase text-white transition-colors hover:bg-c4a-accent-hover disabled:opacity-40 disabled:cursor-not-allowed",children:[e("index.batch.confirm")," (",M.length,")"]})]}),D&&c.jsx(Bl,{error:D,onClose:()=>{L(null),t(-1)}}),z&&c.jsx(o9,{docSources:R.map(be=>({sourceId:be.sourceId,sourceName:be.moduleName,modulePath:be.modulePath})),onConfirm:ge,onCancel:Ne})]})}const f9=b.lazy(()=>le(()=>import("./ContentDetail-D-2xyerw.js"),[]).then(e=>({default:e.ContentDetail}))),p9=b.lazy(()=>le(()=>import("./EntityDetail-3CFtMmgQ.js"),[]).then(e=>({default:e.EntityDetail}))),h9=b.lazy(()=>le(()=>import("./RelationDetail-B2gHrceI.js"),[]).then(e=>({default:e.RelationDetail}))),m9=NE([{element:c.jsx(tR,{}),errorElement:c.jsx(rv,{}),children:[{path:"/",element:c.jsx(uR,{})},{path:"/login",element:c.jsx(pR,{})},{path:"/auth/callback",element:c.jsx(mR,{})},{path:"/docs",element:c.jsx(gR,{})}]},{path:"/studio",element:c.jsx(cR,{}),errorElement:c.jsx(rv,{}),children:[{index:!0,element:c.jsx(eE,{to:"/studio/sources",replace:!0})},{path:"sources",element:c.jsx(cT,{})},{path:"sources/add-client",element:c.jsx(HT,{})},{path:"sources/import/:libId",element:c.jsx(jT,{})},{path:"sources/import-dir/:libId",element:c.jsx(AT,{})},{path:"sources/import-remote/:libId",element:c.jsx(PT,{})},{path:"sources/:libId",element:c.jsx(lT,{})},{path:"sources/:libId/batch-index",element:c.jsx(d9,{})},{path:"source/:sourceUuid",element:c.jsx(s9,{})},{path:"contents/:hashId",element:c.jsx(b.Suspense,{fallback:null,children:c.jsx(f9,{})})},{path:"entities/:entityId",element:c.jsx(b.Suspense,{fallback:null,children:c.jsx(p9,{})})},{path:"relations/:relationId",element:c.jsx(b.Suspense,{fallback:null,children:c.jsx(h9,{})})},{path:"modeling",element:c.jsx(yR,{})},{path:"modeling/code/setup",element:c.jsx(CR,{})},{path:"modeling/code/compile",element:c.jsx(AR,{})},{path:"modeling/code/review",element:c.jsx(RR,{})},{path:"modeling/code/result",element:c.jsx(TR,{})},{path:"brain",element:c.jsx(bR,{})},{path:"discovery",element:c.jsx(vR,{})},{path:"sharing",element:c.jsx(_R,{})},{path:"collaboration",element:c.jsx(wR,{})},{path:"settings/api-keys",element:c.jsx(SR,{})}]},{path:"*",element:c.jsx(xR,{})}]);function g9(){return b.useEffect(()=>{Yn.getState().init(),xl.getState().init();const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;return En.connect(t),()=>{En.disconnect()}},[]),c.jsx(ZN,{router:m9})}fk.createRoot(document.getElementById("root")).render(c.jsx(b.StrictMode,{children:c.jsx(g9,{})}));export{pw as C,q$ as E,G$ as R,ye as a,Vo as b,$e as c,c as j,Tt as u};